-
Notifications
You must be signed in to change notification settings - Fork 47
/
firebase.js
2 lines (2 loc) · 875 KB
/
firebase.js
1
2
!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,s,r,i,o,a,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 g(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(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=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t)if("string"==typeof t)this._bodyText=t;else if(s&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(r&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(e&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(i&&s&&a(t))this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!i||!ArrayBuffer.prototype.isPrototypeOf(t)&&!u(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=m(t)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=g(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?g(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var t,e,n=g(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=v(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 T(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,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),r="FormData"in t,(i="ArrayBuffer"in t)&&(o=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},u=ArrayBuffer.isView||function(t){return t&&-1<o.indexOf(Object.prototype.toString.call(t))}),d.prototype.append=function(t,e){t=l(t),e=f(e);var n=this.map[t];this.map[t]=n?n+","+e:e},d.prototype.delete=function(t){delete this.map[l(t)]},d.prototype.get=function(t){return t=l(t),this.has(t)?this.map[t]:null},d.prototype.has=function(t){return this.map.hasOwnProperty(l(t))},d.prototype.set=function(t,e){this.map[l(t)]=f(e)},d.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},d.prototype.keys=function(){var n=[];return this.forEach(function(t,e){n.push(e)}),p(n)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},d.prototype.entries=function(){var n=[];return this.forEach(function(t,e){n.push([e,t])}),p(n)},n&&(d.prototype[Symbol.iterator]=d.prototype.entries),c=["DELETE","GET","HEAD","OPTIONS","POST","PUT"],_.prototype.clone=function(){return new _(this,{body:this._bodyInit})},b.call(_.prototype),b.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:0,statusText:""});return t.type="error",t},h=[301,302,303,307,308],T.redirect=function(t,e){if(-1===h.indexOf(e))throw new RangeError("Invalid status code");return new T(null,{status:e,headers:{location:t}})},t.Headers=d,t.Request=_,t.Response=T,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 T(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&&s&&(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 v(t){try{return!!t()}catch(t){return!0}}function g(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}function r(t){return l.call(t).slice(8,-1)}function s(t){if(null==t)throw TypeError("Can't call method on "+t);return t}function u(t){return w(s(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 _(t){return Object(s(t))}function n(t){return S?E.createElement(t):{}}function m(t){if(!y(t))throw TypeError(String(t)+" is not an object");return t}function c(e,n){try{P(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=!v(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),a={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,p={f:h&&!a.call({1:2},1)?function(t){t=h(this,t);return!!t&&t.enumerable}:a},l={}.toString,d="".split,w=v(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==r(t)?d.call(t,""):Object(t)}:Object,T={}.hasOwnProperty,I=Object.hasOwn||function(t,e){return T.call(_(t),e)},E=b.document,S=y(E)&&y(E.createElement),k=!f&&!v(function(){return 7!=Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}),C=Object.getOwnPropertyDescriptor,A={f:f?C:function(t,e){if(t=u(t),e=i(e,!0),k)try{return C(t,e)}catch(t){}if(I(t,e))return g(!p.f.call(t,e),t[e])}},N=Object.defineProperty,R={f:f?N:function(t,e,n){if(m(t),e=i(e,!0),m(n),k)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}},P=f?function(t,e,n){return R.f(t,e,g(1,n))}:function(t,e,n){return t[e]=n,t},O="__core-js_shared__",D=b[O]||c(O,{}),x=Function.toString;"function"!=typeof D.inspectSource&&(D.inspectSource=function(t){return x.call(t)});function L(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++Y+X).toString(36)}var M,F,j,U,q,V,B,K,W=D.inspectSource,H=b.WeakMap,z="function"==typeof H&&/native code/.test(W(H)),G=!1,Q=e(function(t){(t.exports=function(t,e){return D[t]||(D[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.15.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})}),Y=0,X=Math.random(),$=Q("keys"),o=function(t){return $[t]||($[t]=L(t))},J={},Z="Object already initialized",t=b.WeakMap;B=z||D.state?(M=D.state||(D.state=new t),F=M.get,j=M.has,U=M.set,q=function(t,e){if(j.call(M,t))throw new TypeError(Z);return e.facade=t,U.call(M,t,e),e},V=function(t){return F.call(M,t)||{}},function(t){return j.call(M,t)}):(K=o("state"),J[K]=!0,q=function(t,e){if(I(t,K))throw new TypeError(Z);return e.facade=t,P(t,K,e),e},V=function(t){return I(t,K)?t[K]:{}},function(t){return I(t,K)});function tt(t){return"function"==typeof t?t:void 0}function et(t,e){return arguments.length<2?tt(ft[t])||tt(b[t]):ft[t]&&ft[t][e]||b[t]&&b[t][e]}function nt(t){return isNaN(t=+t)?0:(0<t?dt:pt)(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)!I(J,n)&&I(r,n)&&o.push(n);for(;e.length>i;)I(r,n=e[i++])&&(~mt(o,n)||o.push(n));return o}function ot(t,e){for(var n=It(e),r=R.f,i=A.f,o=0;o<n.length;o++){var s=n[o];I(t,s)||r(t,s,i(e,s))}}function st(t,e){var n,r,i,o=t.target,s=t.global,a=t.stat,u=s?b:a?b[o]||c(o,{}):(b[o]||{}).prototype;if(u)for(n in e){if(r=e[n],i=t.noTargetGet?(i=Rt(u,n))&&i.value:u[n],!Nt(s?n:o+(a?".":"#")+n,t.forced)&&void 0!==i){if(typeof r==typeof i)continue;ot(r,i)}(t.sham||i&&i.sham)&&P(r,"sham",!0),lt(u,n,r,t)}}function at(){}function ut(t){return"<script>"+t+"</"+Ut+">"}var ct,ht={set:q,get:V,has:B,enforce:function(t){return B(t)?V(t):q(t,{})},getterFor:function(n){return function(t){var e;if(!y(t)||(e=V(t)).type!==n)throw TypeError("Incompatible receiver, "+n+" required");return e}}},lt=e(function(t){var e=ht.get,a=ht.enforce,u=String(String).split("String");(t.exports=function(t,e,n,r){var i=!!r&&!!r.unsafe,o=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet;"function"==typeof n&&("string"!=typeof e||I(n,"name")||P(n,"name",e),(r=a(n)).source||(r.source=u.join("string"==typeof e?e:""))),t!==b?(i?!s&&t[e]&&(o=!0):delete t[e],o?t[e]=n:P(t,e,n)):o?t[e]=n:c(e,n)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||W(this)})}),ft=b,pt=Math.ceil,dt=Math.floor,gt=Math.min,vt=Math.max,yt=Math.min,a=function(a){return function(t,e,n){var r,i=u(t),o=rt(i.length),s=function(t,e){t=nt(t);return t<0?vt(t+e,0):yt(t,e)}(n,o);if(a&&e!=e){for(;s<o;)if((r=i[s++])!=r)return!0}else for(;s<o;s++)if((a||s in i)&&i[s]===e)return a||s||0;return!a&&-1}},mt={includes:a(!0),indexOf:a(!1)}.indexOf,bt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_t=bt.concat("length","prototype"),wt={f:Object.getOwnPropertyNames||function(t){return it(t,_t)}},Tt={f:Object.getOwnPropertySymbols},It=et("Reflect","ownKeys")||function(t){var e=wt.f(m(t)),n=Tt.f;return n?e.concat(n(t)):e},Et=/#|\.prototype\./,O=function(t,e){t=kt[St(t)];return t==At||t!=Ct&&("function"==typeof e?v(e):!!e)},St=O.normalize=function(t){return String(t).replace(Et,".").toLowerCase()},kt=O.data={},Ct=O.NATIVE="N",At=O.POLYFILL="P",Nt=O,Rt=A.f,H=!v(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}),Pt=o("IE_PROTO"),Ot=Object.prototype,Dt=H?Object.getPrototypeOf:function(t){return t=_(t),I(t,Pt)?t[Pt]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Ot:null},xt=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),Lt=Object.keys||function(t){return it(t,bt)},Mt=f?Object.defineProperties:function(t,e){m(t);for(var n,r=Lt(e),i=r.length,o=0;o<i;)R.f(t,n=r[o++],e[n]);return t},Ft=et("document","documentElement"),jt="prototype",Ut="script",qt=o("IE_PROTO"),Vt=function(){try{ct=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t;Vt=ct?function(t){t.write(ut("")),t.close();var e=t.parentWindow.Object;return t=null,e}(ct):((t=n("iframe")).style.display="none",Ft.appendChild(t),t.src=String("javascript:"),(t=t.contentWindow.document).open(),t.write(ut("document.F=Object")),t.close(),t.F);for(var e=bt.length;e--;)delete Vt[jt][bt[e]];return Vt()};J[qt]=!0;var Bt=Object.create||function(t,e){var n;return null!==t?(at[jt]=m(t),n=new at,at[jt]=null,n[qt]=t):n=Vt(),void 0===e?n:Mt(n,e)},z=et("navigator","userAgent")||"",t=b.process,a=t&&t.versions,O=a&&a.v8;O?Pe=(Re=O.split("."))[0]<4?1:Re[0]+Re[1]:z&&(!(Re=z.match(/Edge\/(\d+)/))||74<=Re[1])&&(Re=z.match(/Chrome\/(\d+)/))&&(Pe=Re[1]);function Kt(t){return I(Yt,t)&&(Qt||"string"==typeof Yt[t])||(Qt&&I(Xt,t)?Yt[t]=Xt[t]:Yt[t]=$t("Symbol."+t)),Yt[t]}function Wt(t){return void 0!==t&&(Jt.Array===t||te[Zt]===t)}function Ht(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t}function zt(r,i,t){if(Ht(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 Gt=Pe&&+Pe,Qt=!!Object.getOwnPropertySymbols&&!v(function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Gt&&Gt<41}),H=Qt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Yt=Q("wks"),Xt=b.Symbol,$t=H?Xt:Xt&&Xt.withoutSetter||L,Jt={},Zt=Kt("iterator"),te=Array.prototype,t={};t[Kt("toStringTag")]="z";function ee(t){if(null!=t)return t[ue]||t["@@iterator"]||Jt[ae(t)]}function ne(t){var e=t.return;return void 0!==e&&m(e.call(t)).value}function re(t,e){this.stopped=t,this.result=e}function ie(t,e,n){function r(t){return o&&ne(o),new re(!0,t)}function i(t){return f?(m(t),d?g(t[0],t[1],r):g(t[0],t[1])):d?g(t,r):g(t)}var o,s,a,u,c,h,l=n&&n.that,f=!(!n||!n.AS_ENTRIES),p=!(!n||!n.IS_ITERATOR),d=!(!n||!n.INTERRUPTED),g=zt(e,l,1+f+d);if(p)o=t;else{if("function"!=typeof(p=ee(t)))throw TypeError("Target is not iterable");if(Wt(p)){for(s=0,a=rt(t.length);s<a;s++)if((u=i(t[s]))&&u instanceof re)return u;return new re(!1)}o=p.call(t)}for(c=o.next;!(h=c.call(o)).done;){try{u=i(h.value)}catch(t){throw ne(o),t}if("object"==typeof u&&u&&u instanceof re)return u}return new re(!1)}var a="[object z]"===String(t),oe=Kt("toStringTag"),se="Arguments"==r(function(){return arguments}()),ae=a?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),oe))?t:se?r(e):"Object"==(t=r(e))&&"function"==typeof e.callee?"Arguments":t},ue=Kt("iterator"),ce=function(t,e){var n=this;if(!(n instanceof ce))return new ce(t,e);xt&&(n=xt(new Error(void 0),Dt(n))),void 0!==e&&P(n,"message",String(e));e=[];return ie(t,e.push,{that:e}),P(n,"errors",e),n};ce.prototype=Bt(Error.prototype,{constructor:g(5,ce),message:g(5,""),name:g(5,"AggregateError")}),st({global:!0},{AggregateError:ce}),a||lt(Object.prototype,"toString",a?{}.toString:function(){return"[object "+ae(this)+"]"},{unsafe:!0});function he(t,e,n){for(var r in e)lt(t,r,e[r],n);return t}function le(t,e,n){t&&!I(t=n?t:t.prototype,ve)&&ge(t,ve,{configurable:!0,value:e})}function fe(t){var e=et(t),t=R.f;f&&e&&!e[ye]&&t(e,ye,{configurable:!0,get:function(){return this}})}function pe(t,e,n){if(!(t instanceof e))throw TypeError("Incorrect "+(n?n+" ":"")+"invocation");return t}var de=b.Promise,ge=R.f,ve=Kt("toStringTag"),ye=Kt("species"),me=Kt("iterator"),be=!1;try{var _e=0,we={next:function(){return{done:!!_e++}},return:function(){be=!0}};we[me]=function(){return this},Array.from(we,function(){throw 2})}catch(qs){}function Te(t,e){if(!e&&!be)return!1;var n=!1;try{var r={};r[me]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n}function Ie(t,e){var n;return void 0===(t=m(t).constructor)||null==(n=m(t)[Ce])?e:Ht(n)}function Ee(t){var e;Le.hasOwnProperty(t)&&(e=Le[t],delete Le[t],e())}function Se(t){return function(){Ee(t)}}var ke,Ce=Kt("species"),O=/(?:iphone|ipod|ipad).*applewebkit/i.test(z),Ae="process"==r(b.process),Ne=b.location,Re=b.setImmediate,Pe=b.clearImmediate,Oe=b.process,t=b.MessageChannel,De=b.Dispatch,xe=0,Le={},Me="onreadystatechange",a=function(t){Ee(t.data)},we=function(t){b.postMessage(t+"",Ne.protocol+"//"+Ne.host)};Re&&Pe||(Re=function(t){for(var e=[],n=1;n<arguments.length;)e.push(arguments[n++]);return Le[++xe]=function(){("function"==typeof t?t:Function(t)).apply(void 0,e)},ke(xe),xe},Pe=function(t){delete Le[t]},Ae?ke=function(t){Oe.nextTick(Se(t))}:De&&De.now?ke=function(t){De.now(Se(t))}:t&&!O?(He=(t=new t).port2,t.port1.onmessage=a,ke=zt(He.postMessage,He,1)):b.addEventListener&&"function"==typeof postMessage&&!b.importScripts&&Ne&&"file:"!==Ne.protocol&&!v(we)?(ke=we,b.addEventListener("message",a,!1)):ke=Me in n("script")?function(t){Ft.appendChild(n("script"))[Me]=function(){Ft.removeChild(this),Ee(t)}}:function(t){setTimeout(Se(t),0)});var Fe,je,Ue,qe,Ve,Be,Ke,We,He={set:Re,clear:Pe},we=/web0s(?!.*chrome)/i.test(z),a=A.f,ze=He.set,Re=b.MutationObserver||b.WebKitMutationObserver,Pe=b.document,Ge=b.process,z=b.Promise,a=a(b,"queueMicrotask"),a=a&&a.value;a||(Fe=function(){var t,e;for(Ae&&(t=Ge.domain)&&t.exit();je;){e=je.fn,je=je.next;try{e()}catch(t){throw je?qe():Ue=void 0,t}}Ue=void 0,t&&t.enter()},qe=O||Ae||we||!Re||!Pe?z&&z.resolve?((Ke=z.resolve(void 0)).constructor=z,We=Ke.then,function(){We.call(Ke,Fe)}):Ae?function(){Ge.nextTick(Fe)}:function(){ze.call(b,Fe)}:(Ve=!0,Be=Pe.createTextNode(""),new Re(Fe).observe(Be,{characterData:!0}),function(){Be.data=Ve=!Ve}));function Qe(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=Ht(n),this.reject=Ht(r)}function Ye(t,e){return m(t),y(e)&&e.constructor===t?e:((0,(t=un.f(t)).resolve)(e),t.promise)}function Xe(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}function $e(t){var e;return!(!y(t)||"function"!=typeof(e=t.then))&&e}function Je(l,f){var p;l.notified||(l.notified=!0,p=l.reactions,an(function(){for(var t=l.value,e=1==l.state,n=0;p.length>n;){var r,i,o,s=p[n++],a=e?s.ok:s.fail,u=s.resolve,c=s.reject,h=s.domain;try{a?(e||(2===l.rejection&&An(l),l.rejection=1),!0===a?r=t:(h&&h.enter(),r=a(t),h&&(h.exit(),o=!0)),r===s.promise?c(yn("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&&kn(l)}))}function Ze(t,e,n){var r,i;Tn?((r=mn.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),b.dispatchEvent(r)):r={promise:e,reason:n},!In&&(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 tn(e,n,r){return function(t){e(n,t,r)}}function en(t,e,n){t.done||(t.done=!0,(t=n?n:t).value=e,t.state=2,Je(t,!0))}var nn,rn,on,sn,an=a||function(t){t={fn:t,next:void 0};Ue&&(Ue.next=t),je||(je=t,qe()),Ue=t},un={f:function(t){return new Qe(t)}},cn="object"==typeof window,hn=He.set,ln=Kt("species"),fn="Promise",pn=ht.get,dn=ht.set,gn=ht.getterFor(fn),Pe=de&&de.prototype,vn=de,Re=Pe,yn=b.TypeError,mn=b.document,bn=b.process,_n=un.f,wn=_n,Tn=!!(mn&&mn.createEvent&&b.dispatchEvent),In="function"==typeof PromiseRejectionEvent,En="unhandledrejection",Sn=!1,a=Nt(fn,function(){var t=W(vn)!==String(vn);if(!t&&66===Gt)return!0;if(51<=Gt&&/native code/.test(vn))return!1;function e(t){t(function(){},function(){})}var n=new vn(function(t){t(1)});return(n.constructor={})[ln]=e,!(Sn=n.then(function(){})instanceof e)||!t&&cn&&!In}),He=a||!Te(function(t){vn.all(t).catch(function(){})}),kn=function(i){hn.call(b,function(){var t,e=i.facade,n=i.value,r=Cn(i);if(r&&(t=Xe(function(){Ae?bn.emit("unhandledRejection",n,e):Ze(En,e,n)}),i.rejection=Ae||Cn(i)?2:1,t.error))throw t.value})},Cn=function(t){return 1!==t.rejection&&!t.parent},An=function(e){hn.call(b,function(){var t=e.facade;Ae?bn.emit("rejectionHandled",t):Ze("rejectionhandled",t,e.value)})},Nn=function(n,t,e){if(!n.done){n.done=!0,e&&(n=e);try{if(n.facade===t)throw yn("Promise can't be resolved itself");var r=$e(t);r?an(function(){var e={done:!1};try{r.call(t,tn(Nn,e,n),tn(en,e,n))}catch(t){en(e,t,n)}}):(n.value=t,n.state=1,Je(n,!1))}catch(t){en({done:!1},t,n)}}};if(a&&(Re=(vn=function(t){pe(this,vn,fn),Ht(t),nn.call(this);var e=pn(this);try{t(tn(Nn,e),tn(en,e))}catch(t){en(e,t)}}).prototype,(nn=function(t){dn(this,{type:fn,done:!1,notified:!1,parent:!1,reactions:[],rejection:!1,state:0,value:void 0})}).prototype=he(Re,{then:function(t,e){var n=gn(this),r=_n(Ie(this,vn));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=Ae?bn.domain:void 0,n.parent=!0,n.reactions.push(r),0!=n.state&&Je(n,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),rn=function(){var t=new nn,e=pn(t);this.promise=t,this.resolve=tn(Nn,e),this.reject=tn(en,e)},un.f=_n=function(t){return t===vn||t===on?new rn:wn(t)},"function"==typeof de&&Pe!==Object.prototype)){sn=Pe.then,Sn||(lt(Pe,"then",function(t,e){var n=this;return new vn(function(t,e){sn.call(n,t,e)}).then(t,e)},{unsafe:!0}),lt(Pe,"catch",Re.catch,{unsafe:!0}));try{delete Pe.constructor}catch(qs){}xt&&xt(Pe,Re)}st({global:!0,wrap:!0,forced:a},{Promise:vn}),le(vn,fn,!1),fe(fn),on=et(fn),st({target:fn,stat:!0,forced:a},{reject:function(t){var e=_n(this);return e.reject.call(void 0,t),e.promise}}),st({target:fn,stat:!0,forced:a},{resolve:function(t){return Ye(this,t)}}),st({target:fn,stat:!0,forced:He},{all:function(t){var a=this,e=_n(a),u=e.resolve,c=e.reject,n=Xe(function(){var r=Ht(a.resolve),i=[],o=0,s=1;ie(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]=t,--s||u(i))},c)}),--s||u(i)});return n.error&&c(n.value),e.promise},race:function(t){var n=this,r=_n(n),i=r.reject,e=Xe(function(){var e=Ht(n.resolve);ie(t,function(t){e.call(n,t).then(r.resolve,i)})});return e.error&&i(e.value),r.promise}}),st({target:"Promise",stat:!0},{allSettled:function(t){var a=this,e=un.f(a),u=e.resolve,n=e.reject,r=Xe(function(){var r=Ht(a.resolve),i=[],o=0,s=1;ie(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(a,t).then(function(t){n||(n=!0,i[e]={status:"fulfilled",value:t},--s||u(i))},function(t){n||(n=!0,i[e]={status:"rejected",reason:t},--s||u(i))})}),--s||u(i)});return r.error&&n(r.value),e.promise}});var Rn="No one promise resolved";st({target:"Promise",stat:!0},{any:function(t){var u=this,e=un.f(u),c=e.resolve,h=e.reject,n=Xe(function(){var r=Ht(u.resolve),i=[],o=0,s=1,a=!1;ie(t,function(t){var e=o++,n=!1;i.push(void 0),s++,r.call(u,t).then(function(t){n||a||(a=!0,c(t))},function(t){n||a||(n=!0,i[e]=t,--s||h(new(et("AggregateError"))(i,Rn)))})}),--s||h(new(et("AggregateError"))(i,Rn))});return n.error&&h(n.value),e.promise}});Pe=!!de&&v(function(){de.prototype.finally.call({then:function(){}},function(){})});st({target:"Promise",proto:!0,real:!0,forced:Pe},{finally:function(e){var n=Ie(this,et("Promise")),t="function"==typeof e;return this.then(t?function(t){return Ye(n,e()).then(function(){return t})}:e,t?function(t){return Ye(n,e()).then(function(){throw t})}:e)}}),"function"==typeof de&&(Mn=et("Promise").prototype.finally,de.prototype.finally!==Mn&<(de.prototype,"finally",Mn,{unsafe:!0}));var Pn,Re=function(o){return function(t,e){var n,r=String(s(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}},a={codeAt:Re(!1),charAt:Re(!0)},On=Kt("iterator"),He=!1;[].keys&&("next"in(lr=[].keys())?(fr=Dt(Dt(lr)))!==Object.prototype&&(Pn=fr):He=!0);Pe=null==Pn||v(function(){var t={};return Pn[On].call(t)!==t});I(Pn=Pe?{}:Pn,On)||P(Pn,On,function(){return this});function Dn(){return this}function xn(){return this}function Ln(t,e,n,r,i,o,s){function a(t){if(t===i&&d)return d;if(!Un&&t in f)return f[t];switch(t){case"keys":case Vn:case Bn:return function(){return new n(this,t)}}return function(){return new n(this)}}!function(t,e,n){e+=" Iterator";t.prototype=Bt(Fn,{next:g(1,n)}),le(t,e,!1),Jt[e]=Dn}(n,e,r);var u,c,h=e+" Iterator",l=!1,f=t.prototype,p=f[qn]||f["@@iterator"]||i&&f[i],d=!Un&&p||a(i);if((r="Array"==e&&f.entries||p)&&(t=Dt(r.call(new t)),jn!==Object.prototype&&t.next&&(Dt(t)!==jn&&(xt?xt(t,jn):"function"!=typeof t[qn]&&P(t,qn,xn)),le(t,h,!0))),i==Vn&&p&&p.name!==Vn&&(l=!0,d=function(){return p.call(this)}),f[qn]!==d&&P(f,qn,d),Jt[e]=d,i)if(u={values:a(Vn),keys:o?d:a("keys"),entries:a(Bn)},s)for(c in u)!Un&&!l&&c in f||lt(f,c,u[c]);else st({target:e,proto:!0,forced:Un||l},u);return u}var Mn={IteratorPrototype:Pn,BUGGY_SAFARI_ITERATORS:He},Fn=Mn.IteratorPrototype,jn=Mn.IteratorPrototype,Un=Mn.BUGGY_SAFARI_ITERATORS,qn=Kt("iterator"),Vn="values",Bn="entries",Kn=a.charAt,Wn="String Iterator",Hn=ht.set,zn=ht.getterFor(Wn);Ln(String,"String",function(t){Hn(this,{type:Wn,string:String(t),index:0})},function(){var t=zn(this),e=t.string,n=t.index;return n>=e.length?{value:void 0,done:!0}:(n=Kn(e,n),t.index+=n.length,{value:n,done:!1})});var Gn={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},Qn=Kt("unscopables"),Yn=Array.prototype;null==Yn[Qn]&&R.f(Yn,Qn,{configurable:!0,value:Bt(null)});var Re=function(t){Yn[Qn][t]=!0},Xn="Array Iterator",$n=ht.set,Jn=ht.getterFor(Xn),Zn=Ln(Array,"Array",function(t,e){$n(this,{type:Xn,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");Jt.Arguments=Jt.Array,Re("keys"),Re("values"),Re("entries");var tr,er=Kt("iterator"),nr=Kt("toStringTag"),rr=Zn.values;for(tr in Gn){var ir=b[tr],or=ir&&ir.prototype;if(or){if(or[er]!==rr)try{P(or,er,rr)}catch(qs){or[er]=rr}if(or[nr]||P(or,nr,tr),Gn[tr])for(var sr in Zn)if(or[sr]!==Zn[sr])try{P(or,sr,Zn[sr])}catch(qs){or[sr]=Zn[sr]}}}ft.Promise,st({target:"Promise",stat:!0},{try:function(t){var e=un.f(this),t=Xe(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)}var ur=Array.isArray||function(t){return"Array"==r(t)},cr=Kt("species"),hr=[].push,lr=function(f){var p=1==f,d=2==f,g=3==f,v=4==f,y=6==f,m=7==f,b=5==f||y;return function(t,e,n,r){for(var i,o,s=_(t),a=w(s),u=zt(e,n,3),c=rt(a.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 a)&&(o=u(i=a[h],h,s),f))if(p)l[h]=o;else if(o)switch(f){case 3:return!0;case 5:return i;case 6:return h;case 2:hr.call(l,i)}else switch(f){case 4:return!1;case 7:hr.call(l,i)}return y?-1:g||v?v:l}},fr={forEach:lr(0),map:lr(1),filter:lr(2),some:lr(3),every:lr(4),find:lr(5),findIndex:lr(6),filterOut:lr(7)},pr=fr.find,Pe="find",dr=!0;Pe in[]&&Array(1)[Pe](function(){dr=!1}),st({target:"Array",proto:!0,forced:dr},{find:function(t){return pr(this,t,1<arguments.length?arguments[1]:void 0)}}),Re(Pe);var gr=Function.call,He=function(t,e,n){return zt(gr,b[t].prototype[e],n)};He("Array","find");var vr=fr.findIndex,Mn="findIndex",yr=!0;Mn in[]&&Array(1)[Mn](function(){yr=!1}),st({target:"Array",proto:!0,forced:yr},{findIndex:function(t){return vr(this,t,1<arguments.length?arguments[1]:void 0)}}),Re(Mn),He("Array","findIndex");function mr(t,e,n){(e=i(e))in t?R.f(t,e,g(0,n)):t[e]=n}a=!Te(function(t){Array.from(t)});st({target:"Array",stat:!0,forced:a},{from:function(t){var e,n,r,i,o,s,a=_(t),u="function"==typeof this?this:Array,c=arguments.length,h=1<c?arguments[1]:void 0,l=void 0!==h,t=ee(a),f=0;if(l&&(h=zt(h,2<c?arguments[2]:void 0,2)),null==t||u==Array&&Wt(t))for(n=new u(e=rt(a.length));f<e;f++)s=l?h(a[f],f):a[f],mr(n,f,s);else for(o=(i=t.call(a)).next,n=new u;!(r=o.call(i)).done;f++)s=l?function(e,t,n,r){try{return r?t(m(n)[0],n[1]):t(n)}catch(t){throw ne(e),t}}(i,h,[r.value,f],!0):r.value,mr(n,f,s);return n.length=f,n}}),ft.Array.from;var br,_r,wr=fr.some,lr=!!(_r=[]["some"])&&v(function(){_r.call(null,br||function(){throw 1},1)});st({target:"Array",proto:!0,forced:!lr},{some:function(t){return wr(this,t,1<arguments.length?arguments[1]:void 0)}}),He("Array","some");function Tr(t){return!!y(t)&&(t=ae(t),I(Nr,t)||I(Rr,t))}var Ir,Pe="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,Re=R.f,Mn=b.Int8Array,Er=Mn&&Mn.prototype,a=b.Uint8ClampedArray,lr=a&&a.prototype,Sr=Mn&&Dt(Mn),kr=Er&&Dt(Er),a=Object.prototype,Mn=(a.isPrototypeOf,Kt("toStringTag")),Cr=L("TYPED_ARRAY_TAG"),Ar=Pe&&!!xt&&"Opera"!==ae(b.opera),Pe=!1,Nr={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Rr={BigInt64Array:8,BigUint64Array:8};for(Ir in Nr)b[Ir]||(Ar=!1);if((!Ar||"function"!=typeof Sr||Sr===Function.prototype)&&(Sr=function(){throw TypeError("Incorrect invocation")},Ar))for(Ir in Nr)b[Ir]&&xt(b[Ir],Sr);if((!Ar||!kr||kr===a)&&(kr=Sr.prototype,Ar))for(Ir in Nr)b[Ir]&&xt(b[Ir].prototype,kr);if(Ar&&Dt(lr)!==kr&&xt(lr,kr),f&&!I(kr,Mn))for(Ir in Pe=!0,Re(kr,Mn,{get:function(){return y(this)?this[Cr]:void 0}}),Nr)b[Ir]&&P(b[Ir],Cr,Ir);var lr=function(t){if(Tr(t))return t;throw TypeError("Target is not a typed array")},Re=function(t,e,n){if(f){if(n)for(var r in Nr){r=b[r];if(r&&I(r.prototype,t))try{delete r.prototype[t]}catch(t){}}kr[t]&&!n||lt(kr,t,!n&&Ar&&Er[t]||e)}},Mn=Kt("iterator"),Pe=b.Uint8Array,Pr=Zn.values,Or=Zn.keys,Dr=Zn.entries,xr=lr,lr=Re,Re=Pe&&Pe.prototype[Mn],Pe=!!Re&&("values"==Re.name||null==Re.name),Re=function(){return Pr.call(xr(this))};lr("entries",function(){return Dr.call(xr(this))}),lr("keys",function(){return Or.call(xr(this))}),lr("values",Re,!Pe),lr(Mn,Re,!Pe);var Lr=Object.assign,Mr=Object.defineProperty,Re=!Lr||v(function(){if(f&&1!==Lr({b:1},Lr(Mr({},"a",{enumerable:!0,get:function(){Mr(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!=Lr({},t)[n]||Lt(Lr({},e)).join("")!=r})?function(t,e){for(var n=_(t),r=arguments.length,i=1,o=Tt.f,s=p.f;i<r;)for(var a,u=w(arguments[i++]),c=o?Lt(u).concat(o(u)):Lt(u),h=c.length,l=0;l<h;)a=c[l++],f&&!s.call(u,a)||(n[a]=u[a]);return n}:Lr;st({target:"Object",stat:!0,forced:Object.assign!==Re},{assign:Re}),ft.Object.assign;var Fr=p.f,Pe=function(a){return function(t){for(var e,n=u(t),r=Lt(n),i=r.length,o=0,s=[];o<i;)e=r[o++],f&&!Fr.call(n,e)||s.push(a?[e,n[e]]:n[e]);return s}},Re={entries:Pe(!0),values:Pe(!1)},jr=Re.entries;st({target:"Object",stat:!0},{entries:function(t){return jr(t)}}),ft.Object.entries;var Ur=Re.values;st({target:"Object",stat:!0},{values:function(t){return Ur(t)}}),ft.Object.values;function qr(t){if(y(e=t)&&(void 0!==(n=e[Vr])?!!n:"RegExp"==r(e)))throw TypeError("The method doesn't accept regular expressions");var e,n;return t}var Vr=Kt("match"),Br=Kt("match"),Pe=function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[Br]=!1,"/./"[e](n)}catch(t){}}return!1};st({target:"String",proto:!0,forced:!Pe("includes")},{includes:function(t){return!!~String(s(this)).indexOf(qr(t),1<arguments.length?arguments[1]:void 0)}}),He("String","includes");var Kr,Re=A.f,Wr="".startsWith,Hr=Math.min,Pe=Pe("startsWith"),Kr=!(Pe||(!(Kr=Re(String.prototype,"startsWith"))||Kr.writable));st({target:"String",proto:!0,forced:!Kr&&!Pe},{startsWith:function(t){var e=String(s(this));qr(t);var n=rt(Hr(1<arguments.length?arguments[1]:void 0,e.length)),t=String(t);return Wr?Wr.call(e,t,n):e.slice(n,n+t.length)===t}}),He("String","startsWith");st({target:"String",proto:!0},{repeat:function(t){var e=String(s(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}}),He("String","repeat");var zr,Gr=Kt("species"),Qr=Kt("isConcatSpreadable"),Yr=9007199254740991,Xr="Maximum allowed index exceeded",Pe=51<=Gt||!v(function(){var t=[];return t[Qr]=!1,t.concat()[0]!==t}),He=(zr="concat",51<=Gt||!v(function(){var t=[];return(t.constructor={})[Gr]=function(){return{foo:1}},1!==t[zr](Boolean).foo}));st({target:"Array",proto:!0,forced:!Pe||!He},{concat:function(t){for(var e,n,r,i=_(this),o=ar(i,0),s=0,a=-1,u=arguments.length;a<u;a++)if(function(t){if(!y(t))return!1;var e=t[Qr];return void 0!==e?!!e:ur(t)}(r=-1===a?i:arguments[a])){if(n=rt(r.length),Yr<s+n)throw TypeError(Xr);for(e=0;e<n;e++,s++)e in r&&mr(o,s,r[e])}else{if(Yr<=s)throw TypeError(Xr);mr(o,s++,r)}return o.length=s,o}});function $r(t){var e=ft.Symbol||(ft.Symbol={});I(e,t)||ii(e,t,{value:ri.f(t)})}function Jr(t,e){var n=mi[t]=Bt(fi[ui]);return ci(n,{type:ai,tag:t,description:e}),f||(n.description=e),n}function Zr(e,t){m(e);var n=u(t),t=Lt(n).concat(Ci(n));return oi(t,function(t){f&&!ki.call(n,t)||Si(e,t,n[t])}),e}var ti=wt.f,ei={}.toString,ni="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],He={f:function(t){return ni&&"[object Window]"==ei.call(t)?function(t){try{return ti(t)}catch(t){return ni.slice()}}(t):ti(u(t))}},ri={f:Kt},ii=R.f,oi=fr.forEach,si=o("hidden"),ai="Symbol",ui="prototype",fr=Kt("toPrimitive"),ci=ht.set,hi=ht.getterFor(ai),li=Object[ui],fi=b.Symbol,pi=et("JSON","stringify"),di=A.f,gi=R.f,vi=He.f,yi=p.f,mi=Q("symbols"),bi=Q("op-symbols"),_i=Q("string-to-symbol-registry"),wi=Q("symbol-to-string-registry"),o=Q("wks"),Q=b.QObject,Ti=!Q||!Q[ui]||!Q[ui].findChild,Ii=f&&v(function(){return 7!=Bt(gi({},"a",{get:function(){return gi(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=di(li,e);r&&delete li[e],gi(t,e,n),r&&t!==li&&gi(li,e,r)}:gi,Ei=H?function(t){return"symbol"==typeof t}:function(t){return Object(t)instanceof fi},Si=function(t,e,n){t===li&&Si(bi,e,n),m(t);e=i(e,!0);return m(n),I(mi,e)?(n.enumerable?(I(t,si)&&t[si][e]&&(t[si][e]=!1),n=Bt(n,{enumerable:g(0,!1)})):(I(t,si)||gi(t,si,g(1,{})),t[si][e]=!0),Ii(t,e,n)):gi(t,e,n)},ki=function(t){var e=i(t,!0),t=yi.call(this,e);return!(this===li&&I(mi,e)&&!I(bi,e))&&(!(t||!I(this,e)||!I(mi,e)||I(this,si)&&this[si][e])||t)},Q=function(t,e){var n=u(t),t=i(e,!0);if(n!==li||!I(mi,t)||I(bi,t)){e=di(n,t);return!e||!I(mi,t)||I(n,si)&&n[si][t]||(e.enumerable=!0),e}},H=function(t){var t=vi(u(t)),e=[];return oi(t,function(t){I(mi,t)||I(J,t)||e.push(t)}),e},Ci=function(t){var e=t===li,t=vi(e?bi:u(t)),n=[];return oi(t,function(t){!I(mi,t)||e&&!I(li,t)||n.push(mi[t])}),n};Qt||(lt((fi=function(){if(this instanceof fi)throw TypeError("Symbol is not a constructor");var t=arguments.length&&void 0!==arguments[0]?String(arguments[0]):void 0,e=L(t),n=function(t){this===li&&n.call(bi,t),I(this,si)&&I(this[si],e)&&(this[si][e]=!1),Ii(this,e,g(1,t))};return f&&Ti&&Ii(li,e,{configurable:!0,set:n}),Jr(e,t)})[ui],"toString",function(){return hi(this).tag}),lt(fi,"withoutSetter",function(t){return Jr(L(t),t)}),p.f=ki,R.f=Si,A.f=Q,wt.f=He.f=H,Tt.f=Ci,ri.f=function(t){return Jr(Kt(t),t)},f&&(gi(fi[ui],"description",{configurable:!0,get:function(){return hi(this).description}}),lt(li,"propertyIsEnumerable",ki,{unsafe:!0}))),st({global:!0,wrap:!0,forced:!Qt,sham:!Qt},{Symbol:fi}),oi(Lt(o),function(t){$r(t)}),st({target:ai,stat:!0,forced:!Qt},{for:function(t){var e=String(t);if(I(_i,e))return _i[e];t=fi(e);return _i[e]=t,wi[t]=e,t},keyFor:function(t){if(!Ei(t))throw TypeError(t+" is not a symbol");if(I(wi,t))return wi[t]},useSetter:function(){Ti=!0},useSimple:function(){Ti=!1}}),st({target:"Object",stat:!0,forced:!Qt,sham:!f},{create:function(t,e){return void 0===e?Bt(t):Zr(Bt(t),e)},defineProperty:Si,defineProperties:Zr,getOwnPropertyDescriptor:Q}),st({target:"Object",stat:!0,forced:!Qt},{getOwnPropertyNames:H,getOwnPropertySymbols:Ci}),st({target:"Object",stat:!0,forced:v(function(){Tt.f(1)})},{getOwnPropertySymbols:function(t){return Tt.f(_(t))}}),pi&&(qi=!Qt||v(function(){var t=fi();return"[null]"!=pi([t])||"{}"!=pi({a:t})||"{}"!=pi(Object(t))}),st({target:"JSON",stat:!0,forced:qi},{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)&&!Ei(t))return ur(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!Ei(e))return e}),i[1]=e,pi.apply(null,i)}})),fi[ui][fr]||P(fi[ui],fr,fi[ui].valueOf),le(fi,ai),J[si]=!0,$r("asyncIterator");var Ai,Ni,Ri,Pi,Oi,Q=R.f,Di=b.Symbol;!f||"function"!=typeof Di||"description"in Di.prototype&&void 0===Di().description||(Ai={},ot(Ni=function(){var t=arguments.length<1||void 0===arguments[0]?void 0:String(arguments[0]),e=this instanceof Ni?new Di(t):void 0===t?Di():Di(t);return""===t&&(Ai[e]=!0),e},Di),(Ki=Ni.prototype=Di.prototype).constructor=Ni,Ri=Ki.toString,Pi="Symbol(test)"==String(Di("test")),Oi=/^Symbol\((.*)\)[^)]+$/,Q(Ki,"description",{configurable:!0,get:function(){var t=y(this)?this.valueOf():this,e=Ri.call(t);if(I(Ai,t))return"";e=Pi?e.slice(7,-1):e.replace(Oi,"$1");return""===e?void 0:e}}),st({global:!0,forced:!0},{Symbol:Ni})),$r("hasInstance"),$r("isConcatSpreadable"),$r("iterator"),$r("match"),$r("matchAll"),$r("replace"),$r("search"),$r("species"),$r("split"),$r("toPrimitive"),$r("toStringTag"),$r("unscopables"),le(b.JSON,"JSON",!0),le(Math,"Math",!0),st({global:!0},{Reflect:{}}),le(b.Reflect,"Reflect",!0),ft.Symbol,$r("asyncDispose"),$r("dispose"),$r("matcher"),$r("metadata"),$r("observable"),$r("patternMatch"),$r("replaceAll"),ri.f("iterator");var xi=!v(function(){return Object.isExtensible(Object.preventExtensions({}))}),Li=e(function(t){function n(t){e(t,r,{value:{objectID:"O"+ ++i,weakData:{}}})}var e=R.f,r=L("meta"),i=0,o=Object.isExtensible||function(){return!0},s=t.exports={REQUIRED:!1,fastKey:function(t,e){if(!y(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!I(t,r)){if(!o(t))return"F";if(!e)return"E";n(t)}return t[r].objectID},getWeakData:function(t,e){if(!I(t,r)){if(!o(t))return!0;if(!e)return!1;n(t)}return t[r].weakData},onFreeze:function(t){return xi&&s.REQUIRED&&o(t)&&!I(t,r)&&n(t),t}};J[r]=!0}),H=function(s,t,e){function n(t){var n=p[t];lt(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,a,u,c=-1!==s.indexOf("Map"),h=-1!==s.indexOf("Weak"),l=c?"set":"add",f=b[s],p=f&&f.prototype,d=f,g={};return Nt(s,"function"!=typeof f||!(h||p.forEach&&!v(function(){(new f).entries().next()})))?(d=e.getConstructor(t,s,c,l),Li.REQUIRED=!0):Nt(s,!0)&&(i=(r=new d)[l](h?{}:-0,1)!=r,o=v(function(){r.has(1)}),a=Te(function(t){new f(t)}),u=!h&&v(function(){for(var t=new f,e=5;e--;)t[l](e,e);return!t.has(-0)}),a||(((d=t(function(t,e){pe(t,d,s);var n,r,i,o,n=(n=new f,r=t,t=d,xt&&"function"==typeof(i=r.constructor)&&i!==t&&y(o=i.prototype)&&o!==t.prototype&&xt(n,o),n);return null!=e&&ie(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),g[s]=d,st({global:!0,forced:d!=f},g),le(d,s),h||e.setStrong(d,s,c),d},Mi=R.f,Fi=Li.fastKey,ji=ht.set,Ui=ht.getterFor,qi={getConstructor:function(t,n,r,i){function o(t,e,n){var r,i=a(t),o=u(t,e);return o?o.value=n:(i.last=o={index:r=Fi(e,!0),key:e,value:n,previous:n=i.last,next:void 0,removed:!1},i.first||(i.first=o),n&&(n.next=o),f?i.size++:t.size++,"F"!==r&&(i.index[r]=o)),t}var s=t(function(t,e){pe(t,s,n),ji(t,{type:n,index:Bt(null),first:void 0,last:void 0,size:0}),f||(t.size=0),null!=e&&ie(e,t[i],{that:t,AS_ENTRIES:r})}),a=Ui(n),u=function(t,e){var n,r=a(t),t=Fi(e);if("F"!==t)return r.index[t];for(n=r.first;n;n=n.next)if(n.key==e)return n};return he(s.prototype,{clear:function(){for(var t=a(this),e=t.index,n=t.first;n;)n.removed=!0,n.previous&&(n.previous=n.previous.next=void 0),delete e[n.index],n=n.next;t.first=t.last=void 0,f?t.size=0:this.size=0},delete:function(t){var e,n=a(this),r=u(this,t);return r&&(e=r.next,t=r.previous,delete n.index[r.index],r.removed=!0,t&&(t.next=e),e&&(e.previous=t),n.first==r&&(n.first=e),n.last==r&&(n.last=t),f?n.size--:this.size--),!!r},forEach:function(t){for(var e,n=a(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)}}),he(s.prototype,r?{get:function(t){t=u(this,t);return t&&t.value},set:function(t,e){return o(this,0===t?0:t,e)}}:{add:function(t){return o(this,t=0===t?0:t,t)}}),f&&Mi(s.prototype,"size",{get:function(){return a(this).size}}),s},setStrong:function(t,e,n){var r=e+" Iterator",i=Ui(e),o=Ui(r);Ln(t,e,function(t,e){ji(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),fe(e)}};H("Map",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},qi),ft.Map;fr=function(t){var e,n,r,i,o=arguments.length,s=1<o?arguments[1]:void 0;return Ht(this),(e=void 0!==s)&&Ht(s),null==t?new this:(n=[],e?(r=0,i=zt(s,2<o?arguments[2]:void 0,2),ie(t,function(t){n.push(i(t,r++))})):ie(t,n.push,{that:n}),new this(n))};st({target:"Map",stat:!0},{from:fr});Q=function(){for(var t=arguments.length,e=new Array(t);t--;)e[t]=arguments[t];return new this(e)};st({target:"Map",stat:!0},{of:Q});function Vi(){for(var t,e=m(this),n=Ht(e.delete),r=!0,i=0,o=arguments.length;i<o;i++)t=n.call(e,arguments[i]),r=r&&t;return!!r}st({target:"Map",proto:!0,real:!0,forced:G},{deleteAll:function(){return Vi.apply(this,arguments)}});st({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 Bi(t){return Map.prototype.entries.call(t)}st({target:"Map",proto:!0,real:!0,forced:G},{every:function(t){var r=m(this),e=Bi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return!ie(e,function(t,e,n){if(!i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Map",proto:!0,real:!0,forced:G},{filter:function(t){var n=m(this),e=Bi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ie(n,et("Map"))),o=Ht(i.set);return ie(e,function(t,e){r(e,t,n)&&o.call(i,t,e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{find:function(t){var r=m(this),e=Bi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return ie(e,function(t,e,n){if(i(e,t,r))return n(e)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",proto:!0,real:!0,forced:G},{findKey:function(t){var r=m(this),e=Bi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return ie(e,function(t,e,n){if(i(e,t,r))return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",stat:!0},{groupBy:function(t,n){var r=new this;Ht(n);var i=Ht(r.has),o=Ht(r.get),s=Ht(r.set);return ie(t,function(t){var e=n(t);i.call(r,e)?o.call(r,e).push(t):s.call(r,e,[t])}),r}});st({target:"Map",proto:!0,real:!0,forced:G},{includes:function(i){return ie(Bi(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}}),st({target:"Map",stat:!0},{keyBy:function(t,e){var n=new this;Ht(e);var r=Ht(n.set);return ie(t,function(t){r.call(n,e(t),t)}),n}}),st({target:"Map",proto:!0,real:!0,forced:G},{keyOf:function(r){return ie(Bi(m(this)),function(t,e,n){if(e===r)return n(t)},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Map",proto:!0,real:!0,forced:G},{mapKeys:function(t){var n=m(this),e=Bi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ie(n,et("Map"))),o=Ht(i.set);return ie(e,function(t,e){o.call(i,r(e,t,n),e)},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{mapValues:function(t){var n=m(this),e=Bi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ie(n,et("Map"))),o=Ht(i.set);return ie(e,function(t,e){o.call(i,t,r(e,t,n))},{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}}),st({target:"Map",proto:!0,real:!0,forced:G},{merge:function(t){for(var e=m(this),n=Ht(e.set),r=0;r<arguments.length;)ie(arguments[r++],n,{that:e,AS_ENTRIES:!0});return e}}),st({target:"Map",proto:!0,real:!0,forced:G},{reduce:function(n){var r=m(this),t=Bi(r),i=arguments.length<2,o=i?void 0:arguments[1];if(Ht(n),ie(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}}),st({target:"Map",proto:!0,real:!0,forced:G},{some:function(t){var r=m(this),e=Bi(r),i=zt(t,1<arguments.length?arguments[1]:void 0,3);return ie(e,function(t,e,n){if(i(e,t,r))return n()},{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Map",proto:!0,real:!0,forced:G},{update:function(t,e){var n=m(this),r=arguments.length;Ht(e);var i=n.has(t);if(!i&&r<3)throw TypeError("Updating absent value");r=i?n.get(t):Ht(2<r?arguments[2]:void 0)(t,n);return n.set(t,e(r,t,n)),n}});var Ki=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};st({target:"Map",proto:!0,real:!0,forced:G},{upsert:Ki}),st({target:"Map",proto:!0,real:!0,forced:G},{updateOrInsert:Ki}),H("Set",function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},qi),ft.Set,st({target:"Set",stat:!0},{from:fr}),st({target:"Set",stat:!0},{of:Q});st({target:"Set",proto:!0,real:!0,forced:G},{addAll:function(){return function(){for(var t=m(this),e=Ht(t.add),n=0,r=arguments.length;n<r;n++)e.call(t,arguments[n]);return t}.apply(this,arguments)}}),st({target:"Set",proto:!0,real:!0,forced:G},{deleteAll:function(){return Vi.apply(this,arguments)}});function Wi(t){return Set.prototype.values.call(t)}st({target:"Set",proto:!0,real:!0,forced:G},{every:function(t){var n=m(this),e=Wi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return!ie(e,function(t,e){if(!r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{difference:function(t){var e=m(this),n=new(Ie(e,et("Set")))(e),r=Ht(n.delete);return ie(t,function(t){r.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{filter:function(t){var e=m(this),n=Wi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ie(e,et("Set"))),o=Ht(i.add);return ie(n,function(t){r(t,t,e)&&o.call(i,t)},{IS_ITERATOR:!0}),i}}),st({target:"Set",proto:!0,real:!0,forced:G},{find:function(t){var n=m(this),e=Wi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return ie(e,function(t,e){if(r(t,t,n))return e(t)},{IS_ITERATOR:!0,INTERRUPTED:!0}).result}}),st({target:"Set",proto:!0,real:!0,forced:G},{intersection:function(t){var e=m(this),n=new(Ie(e,et("Set"))),r=Ht(e.has),i=Ht(n.add);return ie(t,function(t){r.call(e,t)&&i.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{isDisjointFrom:function(t){var n=m(this),r=Ht(n.has);return!ie(t,function(t,e){if(!0===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{isSubsetOf:function(t){var e=function(t){var e=ee(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=Ht(n.has)),!ie(e,function(t,e){if(!1===r.call(n,t))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{isSupersetOf:function(t){var n=m(this),r=Ht(n.has);return!ie(t,function(t,e){if(!1===r.call(n,t))return e()},{INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{join:function(t){var e=m(this),n=Wi(e),e=void 0===t?",":String(t),t=[];return ie(n,t.push,{that:t,IS_ITERATOR:!0}),t.join(e)}}),st({target:"Set",proto:!0,real:!0,forced:G},{map:function(t){var e=m(this),n=Wi(e),r=zt(t,1<arguments.length?arguments[1]:void 0,3),i=new(Ie(e,et("Set"))),o=Ht(i.add);return ie(n,function(t){o.call(i,r(t,t,e))},{IS_ITERATOR:!0}),i}}),st({target:"Set",proto:!0,real:!0,forced:G},{reduce:function(e){var n=m(this),t=Wi(n),r=arguments.length<2,i=r?void 0:arguments[1];if(Ht(e),ie(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}}),st({target:"Set",proto:!0,real:!0,forced:G},{some:function(t){var n=m(this),e=Wi(n),r=zt(t,1<arguments.length?arguments[1]:void 0,3);return ie(e,function(t,e){if(r(t,t,n))return e()},{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}}),st({target:"Set",proto:!0,real:!0,forced:G},{symmetricDifference:function(t){var e=m(this),n=new(Ie(e,et("Set")))(e),r=Ht(n.delete),i=Ht(n.add);return ie(t,function(t){r.call(n,t)||i.call(n,t)}),n}}),st({target:"Set",proto:!0,real:!0,forced:G},{union:function(t){var e=m(this),e=new(Ie(e,et("Set")))(e);return ie(t,Ht(e.add),{that:e}),e}});var Hi=Math.floor;st({target:"Number",stat:!0},{isInteger:function(t){return!y(t)&&isFinite(t)&&Hi(t)===t}}),ft.Number.isInteger,st({target:"Number",stat:!0},{isNaN:function(t){return t!=t}}),ft.Number.isNaN;var zi=function(t,e){return(zi=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 Gi(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}zi(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Qi=function(){return(Qi=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 Yi(t,s,a,u){return new(a=a||Promise)(function(n,e){function r(t){try{o(u.next(t))}catch(t){e(t)}}function i(t){try{o(u.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(r,i)}o((u=u.apply(t,s||[])).next())})}function Xi(n,r){var i,o,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&&(s=2&e[0]?o.return:e[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,e[1])).done)return s;switch(o=0,(e=s?[2&e[0],s.value]:e)[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0<(s=a.trys).length&&s[s.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!s||e[1]>s[0]&&e[1]<s[3])){a.label=e[1];break}if(6===e[0]&&a.label<s[1]){a.label=s[1],s=e;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(e);break}s[2]&&a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function $i(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 Ji(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0<e--)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function Zi(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}function to(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 eo(t){return t=to(t),so.encodeByteArray(t,!0)}function no(t){try{return so.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var ro={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},io=function(t,e){if(!t)throw oo(e)},oo=function(t){return new Error("Firebase Database ("+ro.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},so={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],s=i+1<t.length,a=s?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,h=(15&a)<<2|c>>6,c=63&c;u||(c=64,s||(h=64)),r.push(n[o>>2],n[(3&o)<<4|a>>4],n[h],n[c])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(to(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n<t.length;){var i,o,s,a=t[n++];a<128?e[r++]=String.fromCharCode(a):191<a&&a<224?(o=t[n++],e[r++]=String.fromCharCode((31&a)<<6|63&o)):239<a&&a<365?(i=((7&a)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536,e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],s=i<t.length?n[t.charAt(i)]:0,a=++i<t.length?n[t.charAt(i)]:64,u=++i<t.length?n[t.charAt(i)]:64;if(++i,null==o||null==s||null==a||null==u)throw Error();r.push(o<<2|s>>4),64!==a&&(r.push(s<<4&240|a>>2),64!==u&&r.push(a<<6&192|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)}}},ao=function(t){return eo(t).replace(/\./g,"")};function uo(t){return co(void 0,t)}function co(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]=co(t[n],e[n]));return t}var ho=(lo.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))}},lo);function lo(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function fo(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var n=e||"demo-project",r=t.iat||0,e=t.sub||t.user_id;if(!e)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");t=Qi({iss:"https://securetoken.google.com/"+n,aud:n,iat:r,exp:r+3600,auth_time:r,sub:e,user_id:e,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ao(JSON.stringify({alg:"none",type:"JWT"})),ao(JSON.stringify(t)),""].join(".")}function po(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function go(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(po())}function vo(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(t){return}}function yo(){var t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}function mo(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function bo(){return!0===ro.NODE_ADMIN}function _o(){return"indexedDB"in self&&null!=indexedDB}function wo(){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 To(){return!(!navigator||!navigator.cookieEnabled)}var Io,Eo="FirebaseError",So=(Gi(ko,Io=Error),ko);function ko(t,e,n){e=Io.call(this,e)||this;return e.code=t,e.customData=n,e.name=Eo,Object.setPrototypeOf(e,ko.prototype),Error.captureStackTrace&&Error.captureStackTrace(e,Co.prototype.create),e}var Co=(Ao.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 So(o,t,i)},Ao);function Ao(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var No=/\{\$([^}]+)}/g;function Ro(t){return JSON.parse(t)}function Po(t){return JSON.stringify(t)}function Oo(t){var e={},n={},r={},i="";try{var o=t.split("."),e=Ro(no(o[0])||""),n=Ro(no(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function Do(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function xo(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]}function Lo(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Mo(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 Fo(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 jo=(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,s=this.chain_[0],a=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^a&(u^c),1518500249):(o=a^u^c,1859775393):r<60?(o=a&u|c&(a|u),2400959708):(o=a^u^c,3395469782),i=(s<<5|s>>>27)+o+h+l+n[r]&4294967295,h=c,c=u,u=4294967295&(a<<30|a>>>2),a=s,s=i;this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+a&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 qo(t,e){e=new Vo(t,e);return e.subscribe.bind(e)}var Vo=(Bo.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},Bo.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},Bo.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},Bo.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=Ko),void 0===r.error&&(r.error=Ko),void 0===r.complete&&(r.complete=Ko);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},Bo.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))},Bo.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},Bo.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)}})},Bo.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}))},Bo);function Bo(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 Ko(){}function Wo(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 Ho(t,e){return t+" failed: "+e+" argument "}function zo(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(Ho(t,e)+"must be a valid function.")}function Go(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(Ho(t,e)+"must be a valid context object.")}function Qo(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 Yo=1e3,Xo=2,$o=144e5,Jo=.5;function Zo(t,e,n){void 0===n&&(n=Xo);n=(e=void 0===e?Yo:e)*Math.pow(n,t),t=Math.round(Jo*n*(Math.random()-.5)*2);return Math.min($o,n+t)}function ts(t){return t&&t._delegate?t._delegate:t}var es=(ns.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},ns.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},ns.prototype.setServiceProps=function(t){return this.serviceProps=t,this},ns.prototype.setInstanceCreatedCallback=function(t){return this.onInstanceCreated=t,this},ns);function ns(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var rs="[DEFAULT]",is=(os.prototype.get=function(t){var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){t=new ho;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{var n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise},os.prototype.getImmediate=function(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),e=null!==(e=null==e?void 0:e.optional)&&void 0!==e&&e;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(e)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(t){if(e)return null;throw t}},os.prototype.getComponent=function(){return this.component},os.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:rs})}catch(t){}try{for(var r=$i(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=Ji(i.value,2),s=o[0],a=o[1],u=this.normalizeInstanceIdentifier(s);try{var c=this.getOrInitializeService({instanceIdentifier:u});a.resolve(c)}catch(t){}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}}},os.prototype.clearInstance=function(t){this.instancesDeferred.delete(t=void 0===t?rs:t),this.instancesOptions.delete(t),this.instances.delete(t)},os.prototype.delete=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(Zi(Zi([],Ji(e.filter(function(t){return"INTERNAL"in t}).map(function(t){return t.INTERNAL.delete()}))),Ji(e.filter(function(t){return"_delete"in t}).map(function(t){return t._delete()}))))];case 1:return t.sent(),[2]}})})},os.prototype.isComponentSet=function(){return null!=this.component},os.prototype.isInitialized=function(t){return this.instances.has(t=void 0===t?rs:t)},os.prototype.getOptions=function(t){return this.instancesOptions.get(t=void 0===t?rs:t)||{}},os.prototype.initialize=function(t){var e,n,r=(t=void 0===t?{}:t).options,r=void 0===r?{}:r,i=this.normalizeInstanceIdentifier(t.instanceIdentifier);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:r});try{for(var s=$i(this.instancesDeferred.entries()),a=s.next();!a.done;a=s.next()){var u=Ji(a.value,2),c=u[0],h=u[1];i===this.normalizeInstanceIdentifier(c)&&h.resolve(o)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return o},os.prototype.onInit=function(t,e){var n=this.normalizeInstanceIdentifier(e),r=null!==(e=this.onInitCallbacks.get(n))&&void 0!==e?e:new Set;r.add(t),this.onInitCallbacks.set(n,r);e=this.instances.get(n);return e&&t(e,n),function(){r.delete(t)}},os.prototype.invokeOnInitCallbacks=function(t,e){var n,r,i=this.onInitCallbacks.get(e);if(i)try{for(var o=$i(i),s=o.next();!s.done;s=o.next()){var a=s.value;try{a(t,e)}catch(t){}}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},os.prototype.getOrInitializeService=function(t){var e=t.instanceIdentifier,n=t.options,r=void 0===n?{}:n,t=this.instances.get(e);if(!t&&this.component&&(t=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===rs?void 0:n,options:r}),this.instances.set(e,t),this.instancesOptions.set(e,r),this.invokeOnInitCallbacks(t,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,t)}catch(t){}return t||null},os.prototype.normalizeInstanceIdentifier=function(t){return void 0===t&&(t=rs),!this.component||this.component.multipleInstances?t:rs},os.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},os);function os(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var ss=(as.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)},as.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},as.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new is(t,this);return this.providers.set(t,e),e},as.prototype.getProviders=function(){return Array.from(this.providers.values())},as);function as(t){this.name=t,this.providers=new Map}var us,cs=[];(fr=us=us||{})[fr.DEBUG=0]="DEBUG",fr[fr.VERBOSE=1]="VERBOSE",fr[fr.INFO=2]="INFO",fr[fr.WARN=3]="WARN",fr[fr.ERROR=4]="ERROR",fr[fr.SILENT=5]="SILENT";function hs(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var i=(new Date).toISOString(),o=ps[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,Zi(["["+i+"] "+t.name+":"],n))}}var ls={debug:us.DEBUG,verbose:us.VERBOSE,info:us.INFO,warn:us.WARN,error:us.ERROR,silent:us.SILENT},fs=us.INFO,ps=((Q={})[us.DEBUG]="log",Q[us.VERBOSE]="log",Q[us.INFO]="info",Q[us.WARN]="warn",Q[us.ERROR]="error",Q),ds=(Object.defineProperty(gs.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in us))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),gs.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?ls[t]:t},Object.defineProperty(gs.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(gs.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),gs.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Zi([this,us.DEBUG],t)),this._logHandler.apply(this,Zi([this,us.DEBUG],t))},gs.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Zi([this,us.VERBOSE],t)),this._logHandler.apply(this,Zi([this,us.VERBOSE],t))},gs.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Zi([this,us.INFO],t)),this._logHandler.apply(this,Zi([this,us.INFO],t))},gs.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Zi([this,us.WARN],t)),this._logHandler.apply(this,Zi([this,us.WARN],t))},gs.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._userLogHandler&&this._userLogHandler.apply(this,Zi([this,us.ERROR],t)),this._logHandler.apply(this,Zi([this,us.ERROR],t))},gs);function gs(t){this.name=t,this._logLevel=fs,this._logHandler=hs,this._userLogHandler=null,cs.push(this)}function vs(e){cs.forEach(function(t){t.setLogLevel(e)})}function ys(s,e){for(var t=0,n=cs;t<n.length;t++)!function(t){var o=null;e&&e.level&&(o=ls[e.level]),t.userLogHandler=null===s?null:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.map(function(t){if(null==t)return null;if("string"==typeof t)return t;if("number"==typeof t||"boolean"==typeof t)return t.toString();if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch(t){return null}}).filter(function(t){return t}).join(" ");e>=(null!=o?o:t.logLevel)&&s({level:us[e].toLowerCase(),message:i,args:n,type:t.name})}}(n[t])}var fr=((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),ms=new Co("app","Firebase",fr),bs="@firebase/app",_s="[DEFAULT]",ws=((Q={})[bs]="fire-core",Q["@firebase/analytics"]="fire-analytics",Q["@firebase/app-check"]="fire-app-check",Q["@firebase/auth"]="fire-auth",Q["@firebase/database"]="fire-rtdb",Q["@firebase/functions"]="fire-fn",Q["@firebase/installations"]="fire-iid",Q["@firebase/messaging"]="fire-fcm",Q["@firebase/performance"]="fire-perf",Q["@firebase/remote-config"]="fire-rc",Q["@firebase/storage"]="fire-gcs",Q["@firebase/firestore"]="fire-fst",Q["fire-js"]="fire-js",Q["firebase-wrapper"]="fire-js-all",Q),Ts=new ds("@firebase/app"),Is=(Object.defineProperty(Es.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(Es.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(Es.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),Es.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})},Es.prototype._getService=function(t,e){void 0===e&&(e=_s),this.checkDestroyed_();var n=this.container.getProvider(t);return n.isInitialized()||"EXPLICIT"!==(null===(t=n.getComponent())||void 0===t?void 0:t.instantiationMode)||n.initialize(),n.getImmediate({identifier:e})},Es.prototype._removeServiceInstance=function(t,e){void 0===e&&(e=_s),this.container.getProvider(t).clearInstance(e)},Es.prototype._addComponent=function(e){try{this.container.addComponent(e)}catch(t){Ts.debug("Component "+e.name+" failed to register with FirebaseApp "+this.name,t)}},Es.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},Es.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Es.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw ms.create("app-deleted",{appName:this.name_})},Es);function Es(t,e,n){var r=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=uo(t),this.container=new ss(e.name),this._addComponent(new es("app",function(){return r},"PUBLIC")),this.firebase_.INTERNAL.components.forEach(function(t){return r._addComponent(t)})}Is.prototype.name&&Is.prototype.options||Is.prototype.delete||console.log("dc");var Ss="8.10.0";function ks(s){var a={},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=_s);e=n.name;if("string"!=typeof e||!e)throw ms.create("bad-app-name",{appName:String(e)});if(Do(a,e))throw ms.create("duplicate-app",{appName:e});n=new s(t,n,c);return a[e]=n},app:h,registerVersion:function(t,e,n){var r=null!==(i=ws[t])&&void 0!==i?i:t;n&&(r+="-"+n);var i=r.match(/\s|\//),t=e.match(/\s|\//);i||t?(n=['Unable to register library "'+r+'" with version "'+e+'":'],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 "/")'),Ts.warn(n.join(" "))):o(new es(r+"-version",function(){return{library:r,version:e}},"VERSION"))},setLogLevel:vs,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw ms.create("invalid-log-argument");ys(t,e)},apps:null,SDK_VERSION:Ss,INTERNAL:{registerComponent:o,removeApp:function(t){delete a[t]},components:u,useAsService:function(t,e){return"serverAuth"!==e?e:null}}};function h(t){if(!Do(a,t=t||_s))throw ms.create("no-app",{appName:t});return a[t]}function o(n){var t,r=n.name;if(u.has(r))return Ts.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 ms.create("invalid-app-argument",{appName:r});return t[r]()},void 0!==n.serviceProps&&co(t,n.serviceProps),c[r]=t,s.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(a);e<i.length;e++){var o=i[e];a[o]._addComponent(n)}return"PUBLIC"===n.type?c[r]:null}return c.default=c,Object.defineProperty(c,"apps",{get:function(){return Object.keys(a).map(function(t){return a[t]})}}),h.App=s,c}var G=function t(){var e=ks(Is);return e.INTERNAL=Qi(Qi({},e.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(t){co(e,t)},createSubscribe:qo,ErrorFactory:Co,deepExtend:co}),e}(),Cs=(As.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(" ")},As);function As(t){this.container=t}"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(Ts.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(Qa=self.firebase.SDK_VERSION)&&0<=Qa.indexOf("LITE")&&Ts.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 Ns=G.initializeApp;G.initializeApp=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return vo()&&Ts.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 '),Ns.apply(void 0,t)};var Rs,Ps,Jl=G;(Rs=Jl).INTERNAL.registerComponent(new es("platform-logger",function(t){return new Cs(t)},"PRIVATE")),Rs.registerVersion(bs,"0.6.30",Ps),Rs.registerVersion("fire-js","");Jl.registerVersion("firebase","8.10.0","app"),Jl.SDK_VERSION="8.10.0";!function(){var t,o="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)};var u=function(t){t=["object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global,t];for(var e=0;e<t.length;++e){var n=t[e];if(n&&n.Math==Math)return n}return globalThis}(this);function c(t){var e,n,r="undefined"!=typeof Symbol&&Symbol.iterator&&t[Symbol.iterator];return r?r.call(t):{next:(e=t,n=0,function(){return n<e.length?{done:!1,value:e[n++]}:{done:!0}})}}!function(t,e){if(e){var n=u;t=t.split(".");for(var r=0;r<t.length-1;r++){var i=t[r];i in n||(n[i]={}),n=n[i]}(e=e(r=n[t=t[t.length-1]]))!=r&&null!=e&&o(n,t,{configurable:!0,writable:!0,value:e})}}("Promise",function(t){function s(t){this.b=0,this.c=void 0,this.a=[];var e=this.f();try{t(e.resolve,e.reject)}catch(t){e.reject(t)}}function e(){this.a=null}function a(e){return e instanceof s?e:new s(function(t){t(e)})}if(t)return t;e.prototype.b=function(t){var e;null==this.a&&(this.a=[],(e=this).c(function(){e.g()})),this.a.push(t)};var n=u.setTimeout;e.prototype.c=function(t){n(t,0)},e.prototype.g=function(){for(;this.a&&this.a.length;){var t=this.a;this.a=[];for(var e=0;e<t.length;++e){var n=t[e];t[e]=null;try{n()}catch(t){this.f(t)}}}this.a=null},e.prototype.f=function(t){this.c(function(){throw t})},s.prototype.f=function(){function t(e){return function(t){r||(r=!0,e.call(n,t))}}var n=this,r=!1;return{resolve:t(this.m),reject:t(this.g)}},s.prototype.m=function(t){if(t===this)this.g(new TypeError("A Promise cannot resolve to itself"));else if(t instanceof s)this.s(t);else{t:switch(typeof t){case"object":var e=null!=t;break t;case"function":e=!0;break t;default:e=!1}e?this.v(t):this.h(t)}},s.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)},s.prototype.g=function(t){this.i(2,t)},s.prototype.h=function(t){this.i(1,t)},s.prototype.i=function(t,e){if(0!=this.b)throw Error("Cannot settle("+t+", "+e+"): Promise already settled in state"+this.b);this.b=t,this.c=e,this.l()},s.prototype.l=function(){if(null!=this.a){for(var t=0;t<this.a.length;++t)i.b(this.a[t]);this.a=null}};var i=new e;return s.prototype.s=function(t){var e=this.f();t.Ra(e.resolve,e.reject)},s.prototype.u=function(t,e){var n=this.f();try{t.call(e,n.resolve,n.reject)}catch(t){n.reject(t)}},s.prototype.then=function(t,e){function n(e,t){return"function"==typeof e?function(t){try{r(e(t))}catch(t){i(t)}}:t}var r,i,o=new s(function(t,e){r=t,i=e});return this.Ra(n(t,r),n(e,i)),o},s.prototype.catch=function(t){return this.then(void 0,t)},s.prototype.Ra=function(t,e){function n(){switch(r.b){case 1:t(r.c);break;case 2:e(r.c);break;default:throw Error("Unexpected state: "+r.b)}}var r=this;null==this.a?i.b(n):this.a.push(n)},s.resolve=a,s.reject=function(n){return new s(function(t,e){e(n)})},s.race=function(i){return new s(function(t,e){for(var n=c(i),r=n.next();!r.done;r=n.next())a(r.value).Ra(t,e)})},s.all=function(t){var e=c(t),o=e.next();return o.done?a([]):new s(function(n,t){for(var r=[],i=0;r.push(void 0),i++,a(o.value).Ra(function(e){return function(t){r[e]=t,0==--i&&n(r)}}(r.length-1),t),!(o=e.next()).done;);})},s});var h=h||{},l=this||self,e=/^[\w+/_-]+[=]{0,2}$/,a=null;function f(t){return(t=t.querySelector&&t.querySelector("script[nonce]"))&&(t=t.nonce||t.getAttribute("nonce"))&&e.test(t)?t:""}function s(){}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 g(t){return"function"==p(t)}function v(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.bb=e.prototype,t.prototype=new n,t.prototype.constructor=t}function w(t){return t}function T(t,e,n){this.code=S+t,this.message=e||k[t]||"",this.a=n||null}function I(t){var e=t&&t.code;return e?new T(e.substring(S.length),t.message,t.serverResponse):null}_(T,Error),T.prototype.w=function(){var t={code:this.code,message:this.message};return this.a&&(t.serverResponse=this.a),t},T.prototype.toJSON=function(){return this.w()};var E,S="auth/",k={"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 to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},C={ld:{Ua:"https://staging-identitytoolkit.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",$a:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Xa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"b"},sd:{Ua:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",$a:"https://securetoken.googleapis.com/v1/token",Xa:"https://identitytoolkit.googleapis.com/v2/",id:"p"},ud:{Ua:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",$a:"https://staging-securetoken.sandbox.googleapis.com/v1/token",Xa:"https://staging-identitytoolkit.sandbox.googleapis.com/v2/",id:"s"},vd:{Ua:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",$a:"https://test-securetoken.sandbox.googleapis.com/v1/token",Xa:"https://test-identitytoolkit.sandbox.googleapis.com/v2/",id:"t"}};function A(t){for(var e in C)if(C[e].id===t)return t=C[e],{firebaseEndpoint:t.Ua,secureTokenEndpoint:t.$a,identityPlatformEndpoint:t.Xa};return null}function N(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 P(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 O(t){throw new P("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=A("__EID__")?"__EID__":void 0,_(R,Error),R.prototype.name="CustomError",_(P,R),P.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 j=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},U=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i="string"==typeof t?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)};var 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,s="string"==typeof t?t.split(""):t,a=0;a<r;a++)a in s&&(n=s[a],e.call(void 0,n,a,t)&&(i[o++]=n));return i},V=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(t,e){for(var n=t.length,r=Array(n),i="string"==typeof t?t.split(""):t,o=0;o<n;o++)o in i&&(r[o]=e.call(void 0,i[o],o,t));return r},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<=j(t,e)}function W(t,e){var n;return(n=0<=(e=j(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 z(){return Array.prototype.concat.apply([],arguments)}function G(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}var Q,Y=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},X=/&/g,$=/</g,J=/>/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 st(t){return rt(Q,t)}function at(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function ut(t){for(var e in t)return;return 1}function ct(t){var e,n={};for(e in t)n[e]=t[e];return n}var ht="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function lt(t){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,r=t&&t.ownerDocument;if((n=(n=r&&(r.defaultView||r.parentWindow))||l).Element&&n.Location){var i=n;break t}}catch(t){}i=null}if(i&&void 0!==i[e]&&(!t||!(t instanceof i[e])&&(t instanceof i.Location||t instanceof i.Element))){if(v(t))try{var o=t.constructor.displayName||t.constructor.name||Object.prototype.toString.call(t)}catch(t){o="<object could not be stringified>"}else o=void 0===t?"undefined":null===t?"null":typeof t;O("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function pt(t,e){this.a=t===yt&&e||"",this.b=vt}function dt(t){return t instanceof pt&&t.constructor===pt&&t.b===vt?t.a:(O("expected object of type Const, got '"+t+"'"),"type_error:Const")}pt.prototype.ta=!0,pt.prototype.sa=function(){return this.a},pt.prototype.toString=function(){return"Const{"+this.a+"}"};var gt,vt={},yt={};function mt(){if(void 0===gt){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)}gt=t}else gt=t}return gt}function bt(t,e){this.a=e===Et?t:""}function _t(t){return t instanceof bt&&t.constructor===bt?t.a:(O("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function wt(t,n){var e,r=dt(t);if(!It.test(r))throw Error("Invalid TrustedResourceUrl format: "+r);return t=r.replace(Tt,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.ta=!0,bt.prototype.sa=function(){return this.a.toString()},bt.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var Tt=/%{(\w+)}/g,It=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Et={};function St(t,e){this.a=e===Ot?t:""}function kt(t){return t instanceof St&&t.constructor===St?t.a:(O("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}St.prototype.ta=!0,St.prototype.sa=function(){return this.a.toString()},St.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Ct=/^(?: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,At=/^data:(.*);base64,[a-z0-9+\/]+=*$/i,Nt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Rt(t){return t instanceof St?t:(t="object"==typeof t&&t.ta?t.sa():String(t),t=Nt.test(t)||(e=(t=(t=String(t)).replace(/(%0A|%0D)/g,"")).match(At))&&Ct.test(e[1])?new St(t,Ot):null);var e}function Pt(t){return t instanceof St?t:(t="object"==typeof t&&t.ta?t.sa():String(t),new St(t=!Nt.test(t)?"about:invalid#zClosurez":t,Ot))}var Ot={},Dt=new St("about:invalid#zClosurez",Ot);function xt(t,e,n){this.a=n===Lt?t:""}xt.prototype.ta=!0,xt.prototype.sa=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:Pt(t),e=e||l,n=n instanceof pt?dt(n):n||"",e.open(kt(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 jt(t){return nt.test(t)&&(-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=(t=-1!=t.indexOf("&")?t.replace(X,"&"):t).indexOf("<")?t.replace($,"<"):t).indexOf(">")?t.replace(J,">"):t).indexOf('"')?t.replace(Z,"""):t).indexOf("'")?t.replace(tt,"'"):t).indexOf("\0")&&(t=t.replace(et,"�"))),t}function Ut(t){return Ut[" "](t),t}Ut[" "]=s;var qt,Vt=st("Opera"),Bt=st("Trident")||st("MSIE"),Kt=st("Edge"),Wt=Kt||Bt,Ht=st("Gecko")&&!(rt(Q.toLowerCase(),"webkit")&&!st("Edge"))&&!(st("Trident")||st("MSIE"))&&!st("Edge"),zt=rt(Q.toLowerCase(),"webkit")&&!st("Edge");function Gt(){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):zt?/WebKit\/(\S+)/.exec(Yt):Vt?/(?:Version)[ \/]?(\S+)/.exec(Yt):void 0);if(Yt&&(Qt=Yt?Yt[1]:""),Bt){Yt=Gt();if(null!=Yt&&Yt>parseFloat(Qt)){qt=String(Yt);break t}}qt=Qt}var Xt={};function $t(a){return t=a,e=function(){for(var t=0,e=Y(String(qt)).split("."),n=Y(String(a)).split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",s=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],(0!=o[0].length||0!=s[0].length)&&(t=it(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||it(0==o[2].length,0==s[2].length)||it(o[2],s[2]),o=o[3],s=s[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 Jt=l.document&&Bt&&(Gt()||parseInt(qt,10))||void 0;try{new self.OffscreenCanvas(0,0).getContext("2d")}catch(t){}var Zt=!Bt||9<=Number(Jt);function te(t){var e=document;return"string"==typeof t?e.getElementById(t):t}function ee(n,t){at(t,function(t,e){t&&"object"==typeof t&&t.ta&&(t=t.sa()),"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="',jt(i.name),'"'),i.type&&(r.push(' type="',jt(i.type),'"'),lt(t={},i),delete t.type,i=t),r.push(">"),r=r.join("")),r=se(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)||v(o)&&0<o.nodeType)r(o);else{t:{if(o&&"number"==typeof o.length){if(v(o)){var s="function"==typeof o.item||"string"==typeof o.item;break t}if(g(o)){s="function"==typeof o.item;break t}}s=!1}U(s?G(o):o,r)}}}(n,r,e),r}function se(t,e){return e=String(e),"application/xhtml+xml"===t.contentType&&(e=e.toLowerCase()),t.createElement(e)}function ae(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;!g(l.setImmediate)||l.Window&&l.Window.prototype&&!st("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&&!st("Presto")?function(){var t=se(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)||st("Trident")||st("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).Hb,n.Hb=null,t())},function(t){r.next={Hb: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;e=t=void 0,e=null,(t=he).a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e=e;){try{e.a.call(e.b)}catch(t){ae(t)}x(M,e)}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!=s)try{var n=this;t.call(e,function(t){Se(n,de,t)},function(t){if(!(t instanceof Oe))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}Se(n,ge,t)})}catch(t){Se(this,ge,t)}}var pe=0,de=2,ge=3;function ve(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}ve.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ye=new D(function(){return new ve},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(s);return Se(e,de,t),e}function _e(n){return new fe(function(t,e){e(n)})}function we(t,e,n){ke(t,e,n,null)||ue(b(e,t))}function Te(n){return new fe(function(r){var i=n.length,o=[];if(i)for(var t=function(t,e,n){i--,o[t]=e?{Qb:!0,value:n}:{Qb:!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 Ie(t,e){t.b||t.a!=de&&t.a!=ge||Ce(t),t.f?t.f.next=e:t.b=e,t.f=e}function Ee(t,i,o,s){var e=me(null,null,null);return e.a=new fe(function(n,r){e.g=i?function(t){try{var e=i.call(s,t);n(e)}catch(t){r(t)}}:n,e.b=o?function(t){try{var e=o.call(s,t);void 0===e&&t instanceof Oe?r(t):n(e)}catch(t){r(t)}}:r}),Ie(e.a.c=t,e),e.a}function Se(t,e,n){var r,i;t.a==pe&&(t===n&&(e=ge,n=new TypeError("Promise cannot resolve to itself")),t.a=1,ke(n,t.$c,t.ad,t)||(t.i=n,t.a=e,t.c=null,Ce(t),e!=ge||n instanceof Oe||(i=n,(r=t).g=!0,ue(function(){r.g&&Pe.call(null,i)}))))}function ke(t,e,n,r){if(t instanceof fe)return Ie(t,me(e||s,n||null,r)),1;if(N(t))return t.then(e,n,r),1;if(v(t))try{var i=t.then;if(g(i))return function(t,e,n,r,i){function o(t){s||(s=!0,r.call(i,t))}var s=!1;try{e.call(t,function(t){s||(s=!0,n.call(i,t))},o)}catch(t){o(t)}}(t,i,e,n,r),1}catch(t){return n.call(r,t),1}}function Ce(t){t.h||(t.h=!0,ue(t.gc,t))}function Ae(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function Ne(t,e,n,r){if(n==ge&&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){Pe.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,g(t)?t:null,g(e)?e:null,n)},fe.prototype.$goog_Thenable=!0,(t=fe.prototype).oa=function(t,e){return(t=me(t,t,e)).c=!0,Ie(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 Oe(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,s=null,a=r.b;a&&(a.c||(i++,!((o=a.a==e?a:o)&&1<i)));a=a.next)o||(s=a);o&&(r.a==pe&&1==i?t(r,n):(s?((i=s).next==r.f&&(r.f=i),i.next=i.next.next):Ae(r),Ne(r,o,ge,n)))}e.c=null}else Se(e,ge,n)}(this,e)},this))},t.$c=function(t){this.a=pe,Se(this,de,t)},t.ad=function(t){this.a=pe,Se(this,ge,t)},t.gc=function(){for(var t;t=Ae(this);)Ne(this,t,this.a,this.i);this.h=!1};var Pe=ae;function Oe(t){R.call(this,t)}function De(){this.ya=this.ya,this.pa=this.pa}_(Oe,R);var xe=0,Le={};function Me(t){t.ya||(t.ya=!0,t.Da(),0==xe)||(t=t,t=Object.prototype.hasOwnProperty.call(t,n)&&t[n]||(t[n]=++r),delete Le[t])}De.prototype.ya=!(Oe.prototype.name="cancel"),De.prototype.Da=function(){if(this.pa)for(;this.pa.length;)this.pa.shift()()};var Fe=Object.freeze||function(t){return t},je=!Bt||9<=Number(Jt),Ue=Bt&&!$t("9"),qe=function(){if(!l.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{l.addEventListener("test",s,e),l.removeEventListener("test",s,e)}catch(t){}return t}();function Ve(t,e){this.type=t,this.b=this.target=e,this.defaultPrevented=!1}function Be(t,e){if(Ve.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{Ut(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:Ke[t.pointerType]||"",(this.a=t).defaultPrevented&&this.preventDefault()}}Ve.prototype.preventDefault=function(){this.defaultPrevented=!0},_(Be,Ve);var Ke=Fe({2:"touch",3:"pen",4:"mouse"});Be.prototype.preventDefault=function(){Be.bb.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){}},Be.prototype.g=function(){return this.a};var We="closure_listenable_"+(1e6*Math.random()|0),He=0;function ze(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Wa=i,this.key=++He,this.wa=this.Qa=!1}function Ge(t){t.wa=!0,t.listener=null,t.proxy=null,t.src=null,t.Wa=null}function Qe(t){this.src=t,this.a={},this.b=0}function Ye(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 Xe(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.wa&&o.listener==e&&o.capture==!!n&&o.Wa==r)return i}return-1}Qe.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var s=Xe(t,e,r,i);return-1<s?(e=t[s],n||(e.Qa=!1)):((e=new ze(e,this.src,o,!!r,i)).Qa=n,t.push(e)),e};var $e="closure_lm_"+(1e6*Math.random()|0),Je={};function Ze(t,e,n,r,i){if(r&&r.once)en(t,e,n,r,i);else if(Array.isArray(e))for(var o=0;o<e.length;o++)Ze(t,e[o],n,r,i);else n=ln(n),t&&t[We]?pn(t,e,n,v(r)?!!r.capture:!!r,i):tn(t,e,n,!1,r,i)}function tn(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s,a,u=v(i)?!!i.capture:!!i,c=cn(t);if(c||(t[$e]=c=new Qe(t)),!(n=c.add(e,n,r,u,o)).proxy)if(s=un,a=je?function(t){return s.call(a.src,a.listener,t)}:function(t){if(!(t=s.call(a.src,a.listener,t)))return t},(n.proxy=r=a).src=t,r.listener=n,t.addEventListener)void 0===(i=!qe?u:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(on(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}}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 n=ln(n),t&&t[We]?dn(t,e,n,v(r)?!!r.capture:!!r,i):tn(t,e,n,!0,r,i)}function nn(t,e,n,r,i){if(Array.isArray(e))for(var o=0;o<e.length;o++)nn(t,e[o],n,r,i);else r=v(r)?!!r.capture:!!r,n=ln(n),t&&t[We]?(t=t.v,(e=String(e).toString())in t.a&&(-1<(n=Xe(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&&cn(t))&&(e=t.a[e.toString()],(n=(t=-1)<(t=e?Xe(e,n,r,i):t)?e[t]:null)&&rn(n))}function rn(t){var e,n,r;"number"!=typeof t&&t&&!t.wa&&((e=t.src)&&e[We]?Ye(e.v,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(on(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=cn(e))?(Ye(n,t),0==n.b&&(n.src=null,e[$e]=null)):Ge(t)))}function on(t){return t in Je?Je[t]:Je[t]="on"+t}function sn(t,e,n,r){var i=!0;if((t=cn(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.wa&&(o=an(o,r),i=i&&!1!==o)}return i}function an(t,e){var n=t.listener,r=t.Wa||t.src;return t.Qa&&rn(t),n.call(r,e)}function un(t,e){if(t.wa)return!0;if(je)return an(t,new Be(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 Be(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=sn(r[i],t,!0,e),n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=sn(r[i],t,!1,e),n=n&&o}return n}function cn(t){return(t=t[$e])instanceof Qe?t:null}var hn="__closure_events_fn_"+(1e9*Math.random()>>>0);function ln(e){return g(e)?e:(e[hn]||(e[hn]=function(t){return e.handleEvent(t)}),e[hn])}function fn(){De.call(this),this.v=new Qe(this),(this.bc=this).hb=null}function pn(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function dn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function gn(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 s,a,u=e[o];u&&!u.wa&&u.capture==n&&(s=u.listener,a=u.Wa||u.src,u.Qa&&Ye(t.v,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}function vn(t,e,n){if(g(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 yn(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 mn(t){if(t.X&&"function"==typeof t.X)return t.X();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 bn(t){if(t.Y&&"function"==typeof t.Y)return t.Y();if(!t.X||"function"!=typeof t.X){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 _n(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 _n)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 wn(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];Tn(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){for(var i={},n=e=0;e<t.a.length;)Tn(i,r=t.a[e])||(i[t.a[n++]=r]=1),e++;t.a.length=n}}function Tn(t,e){return Object.prototype.hasOwnProperty.call(t,e)}_(fn,De),fn.prototype[We]=!0,fn.prototype.addEventListener=function(t,e,n,r){Ze(this,t,e,n,r)},fn.prototype.removeEventListener=function(t,e,n,r){nn(this,t,e,n,r)},fn.prototype.dispatchEvent=function(t){var e;if(n=this.hb)for(e=[];n;n=n.hb)e.push(n);var n=this.bc,r=t.type||t;if("string"==typeof t?t=new Ve(t,n):t instanceof Ve?t.target=t.target||n:(s=t,lt(t=new Ve(r,n),s)),s=!0,e)for(var i=e.length-1;0<=i;i--)var o=t.b=e[i],s=gn(o,r,!0,t)&&s;if(s=gn(o=t.b=n,r,!0,t)&&s,s=gn(o,r,!1,t)&&s,e)for(i=0;i<e.length;i++)s=gn(o=t.b=e[i],r,!1,t)&&s;return s},fn.prototype.Da=function(){if(fn.bb.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.hb=null},(t=_n.prototype).X=function(){wn(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},t.Y=function(){return wn(this),this.a.concat()},t.clear=function(){this.b={},this.c=this.a.length=0},t.get=function(t,e){return Tn(this.b,t)?this.b[t]:e},t.set=function(t,e){Tn(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},t.forEach=function(t,e){for(var n=this.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 En(t,e){var n;this.a=this.l=this.c="",this.g=null,this.h=this.f="",this.i=!1,t instanceof En?(this.i=void 0!==e?e:t.i,Sn(this,t.c),this.l=t.l,this.a=t.a,kn(this,t.g),this.f=t.f,Cn(this,zn(t.b)),this.h=t.h):t&&(n=String(t).match(In))?(this.i=!!e,Sn(this,n[1]||"",!0),this.l=On(n[2]||""),this.a=On(n[3]||"",!0),kn(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 qn(null,this.i))}function Sn(t,e,n){t.c=n?On(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function kn(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 qn?(t.b=e,r=t.b,(i=t.i)&&!r.f&&(Vn(r),r.c=null,r.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Kn(this,e),Hn(this,n,t))},r)),r.f=i):(n||(e=Dn(e,jn)),t.b=new qn(e,t.i))}function An(t,e,n){t.b.set(e,n)}function Nn(t,e){return t.b.get(e)}function Rn(t){return t instanceof En?new En(t):new En(t,void 0)}function Pn(t,e,n,r){var i=new En(null,void 0);return t&&Sn(i,t),e&&(i.a=e),n&&kn(i,n),r&&(i.f=r),i}function On(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Dn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,xn),t=n?t.replace(/%25([0-9a-fA-F]{2})/g,"%$1"):t):null}function xn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}En.prototype.toString=function(){var t=[],e=this.c;e&&t.push(Dn(e,Ln,!0),":");var n=this.a;return!n&&"file"!=e||(t.push("//"),(e=this.l)&&t.push(Dn(e,Ln,!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(Dn(n,"/"==n.charAt(0)?Fn:Mn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Dn(n,Un)),t.join("")},En.prototype.resolve=function(t){var e=new En(this),n=!!t.c;n?Sn(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)kn(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=[],s=0;s<i.length;){var a=i[s++];"."==a?r&&s==i.length&&o.push(""):".."==a?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&s==i.length&&o.push("")):(o.push(a),r=!0)}r=o.join("/")}else r=i;return n?e.f=r:n=""!==t.b.toString(),n?Cn(e,zn(t.b)):n=!!t.h,n&&(e.h=t.h),e};var Ln=/[#\/\?@]/g,Mn=/[#\?:]/g,Fn=/[#\?]/g,jn=/[#\?@]/g,Un=/#/g;function qn(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function Vn(n){n.a||(n.a=new _n,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 Bn(t){var e=bn(t);if(void 0===e)throw Error("Keys are undefined");var n=new qn(null,void 0);t=mn(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];Array.isArray(o)?Hn(n,i,o):n.add(i,o)}return n}function Kn(t,e){Vn(t),e=Gn(t,e),Tn(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,Tn((t=t.a).b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&wn(t)))}function Wn(t,e){return Vn(t),e=Gn(t,e),Tn(t.a.b,e)}function Hn(t,e,n){Kn(t,e),0<n.length&&(t.c=null,t.a.set(Gn(t,e),G(n)),t.b+=n.length)}function zn(t){var e=new qn;return e.c=t.c,t.a&&(e.a=new _n(t.a),e.b=t.b),e}function Gn(t,e){return e=String(e),e=t.f?e.toLowerCase():e}function Qn(t){var e=[];return function t(e,n,r){if(null==n)r.push("null");else{if("object"==typeof n){if(Array.isArray(n)){var i=n;n=i.length,r.push("[");for(var o="",s=0;s<n;s++)r.push(o),t(e,i[s],r),o=",";return void r.push("]")}if(!(n instanceof String||n instanceof Number||n instanceof Boolean)){for(i in r.push("{"),o="",n)Object.prototype.hasOwnProperty.call(n,i)&&(s=n[i],"function"!=typeof s&&(r.push(o),Jn(i,r),r.push(":"),t(e,s,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 Yn,t,e),e.join("")}function Yn(){}(t=qn.prototype).add=function(t,e){Vn(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){Vn(this),this.a.forEach(function(t,e){U(t,function(t){n.call(r,t,e,this)},this)},this)},t.Y=function(){Vn(this);for(var t=this.a.X(),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.X=function(t){Vn(this);var e=[];if("string"==typeof t)Wn(this,t)&&(e=z(e,this.a.get(Gn(this,t))));else{t=this.a.X();for(var n=0;n<t.length;n++)e=z(e,t[n])}return e},t.set=function(t,e){return Vn(this),this.c=null,Wn(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.X(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.X(r),o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}return this.c=t.join("&")};var Xn={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},$n=/\uffff/.test("")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;function Jn(t,e){e.push('"',t.replace($n,function(t){var e=Xn[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Xn[t]=e),e}),'"')}function Zn(){var t=mr();return Bt&&Jt&&11==Jt||/Edge\/\d+/.test(t)}function tr(){return l.window&&l.window.location.href||self&&self.location&&self.location.href||""}function er(t,e){e=e||l.window;var n="about:blank";t&&(n=kt(Rt(t)||Dt)),e.location.href=n}function nr(t){return!!((t=(t||mr()).toLowerCase()).match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function rr(t){t=t||l.window;try{t.close()}catch(t){}}function ir(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;for(s in e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=mr().toLowerCase(),r&&(e.target=r,rt(n,"crios/")&&(e.target="_blank")),gr(mr())==pr&&(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(s){case"width":case"height":case"top":case"left":i.push(s+"="+t[s]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(s+"="+(t[s]?1:0))}var s=i.join(",");if((st("iPhone")&&!st("iPod")&&!st("iPad")||st("iPad")||st("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(ft(s=se(document,"A"),"HTMLAnchorElement"),e=e instanceof St?e:Pt(e),s.href=kt(e),s.setAttribute("target",n),t.noreferrer&&s.setAttribute("rel","noreferrer"),(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,r,1),s.dispatchEvent(t),s={}):t.noreferrer?(s=Mt("",r,n,s),t=kt(e),s&&(Wt&&rt(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),s.opener=null,t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+jt(t)+'">',t=new xt(t=(r=mt())?r.createHTML(t):t,0,Lt),r=s.document)&&(r.write((o=t)instanceof xt&&o.constructor===xt?o.a:(O("expected object of type SafeHtml, got '"+o+"' of type "+p(o)),"type_error:SafeHtml")),r.close())):(s=Mt(e,r,n,s))&&t.noopener&&(s.opener=null),s)try{s.focus()}catch(t){}return s}var or=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sr=/^[^@]+@[^@]+$/;function ar(){var e=null;return new fe(function(t){"complete"==l.document.readyState?t():(e=function(){t()},en(window,"load",e))}).o(function(t){throw nn(window,"load",e),t})}function ur(t){return t=t||mr(),!("file:"!==Ir()&&"ionic:"!==Ir()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function cr(){var t=l.window;try{return t&&t!=t.top}catch(t){return}}function hr(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function lr(){return Jl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Jl.INTERNAL.hasOwnProperty("node")?"Node":hr()?"Worker":"Browser"}function fr(){var t=lr();return"ReactNative"===t||"Node"===t}var pr="Firefox",dr="Chrome";function gr(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/")?pr: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":dr:"Safari"}var vr={md:"FirebaseCore-web",od:"FirebaseUI-web"};function yr(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=lr())?r=gr(i=mr()):"Worker"===r&&(r=gr(i=mr())+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function mr(){return l.navigator&&l.navigator.userAgent||""}function br(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 _r(){try{var t=l.localStorage,e=Ar();if(t)return t.setItem(e,"1"),t.removeItem(e),!Zn()||!!l.indexedDB}catch(t){return hr()&&!!l.indexedDB}return!1}function wr(){return(Tr()||"chrome-extension:"===Ir()||ur())&&!fr()&&_r()&&!hr()}function Tr(){return"http:"===Ir()||"https:"===Ir()}function Ir(){return l.location&&l.location.protocol||null}function Er(t){return!nr(t=t||mr())&&gr(t)!=pr}function Sr(t){return void 0===t?null:Qn(t)}function kr(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 Ar(t){return t||Math.floor(1e9*Math.random()).toString()}function Nr(t){return"Safari"!=gr(t=t||mr())&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function Rr(){var t=l.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var n=0;n<t.CP.length;n++)t.CP[n]=null}function Pr(t,e){if(e<t)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=mr(),e=lr(),this.b=nr(t)||"ReactNative"===e}function Or(){var t=l.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Dr(){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 xr(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 Lr(){return br("fireauth.oauthhelper",l)||br("fireauth.iframe",l)}Pr.prototype.get=function(){var t=l.navigator;return!t||"boolean"!=typeof t.onLine||!Tr()&&"chrome-extension:"!==Ir()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Mr,Fr={};function jr(t){Fr[t]||(Fr[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}),Mr=2==Ur.abcd}catch(t){Mr=!1}function qr(t,e,n){Mr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Vr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&qr(t,n,e[n])}function Br(t){var e={};return Vr(e,t),e}function Kr(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)qr(e,n,Kr(t[n]));return e}function Wr(t){var e=t&&(t[Yr]?"phone":null);if(!(e&&t&&t[Qr]))throw new T("internal-error","Internal assert: invalid MultiFactorInfo object");qr(this,"uid",t[Qr]),qr(this,"displayName",t[zr]||null);var n=null;qr(this,"enrollmentTime",n=t[Gr]?new Date(t[Gr]).toUTCString():n),qr(this,"factorId",e)}function Hr(t){try{var e=new Xr(t)}catch(t){e=null}return e}Wr.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var zr="displayName",Gr="enrolledAt",Qr="mfaEnrollmentId",Yr="phoneInfo";function Xr(t){Wr.call(this,t),qr(this,"phoneNumber",t[Yr])}function $r(t){var e={},n=t[ei],r=t[ri],i=t[ii];if(t=Hr(t[ni]),!i||i!=Zr&&i!=ti&&!n||i==ti&&!r||i==Jr&&!t)throw Error("Invalid checkActionCode response!");i==ti?(e[si]=n||null,e[ui]=n||null,e[oi]=r):(e[si]=r||null,e[ui]=r||null,e[oi]=n||null),e[ai]=t||null,qr(this,hi,i),qr(this,ci,Kr(e))}_(Xr,Wr),Xr.prototype.w=function(){var t=Xr.bb.w.call(this);return t.phoneNumber=this.phoneNumber,t};var Jr="REVERT_SECOND_FACTOR_ADDITION",Zr="EMAIL_SIGNIN",ti="VERIFY_AND_CHANGE_EMAIL",ei="email",ni="mfaInfo",ri="newEmail",ii="requestType",oi="email",si="fromEmail",ai="multiFactorInfo",ui="previousEmail",ci="data",hi="operation";function li(t){var e=Nn(t=Rn(t),fi)||null,n=Nn(t,pi)||null,r=(r=Nn(t,vi)||null)&&mi[r]||null;if(!e||!n||!r)throw new T("argument-error",fi+", "+pi+"and "+vi+" are required in a valid action code URL.");Vr(this,{apiKey:e,operation:r,code:n,continueUrl:Nn(t,di)||null,languageCode:Nn(t,gi)||null,tenantId:Nn(t,yi)||null})}var fi="apiKey",pi="oobCode",di="continueUrl",gi="languageCode",vi="mode",yi="tenantId",mi={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:Jr,signIn:Zr,verifyAndChangeEmail:ti,verifyEmail:"VERIFY_EMAIL"};function bi(t){try{return new li(t)}catch(t){return null}}function _i(t){if(void 0===(e=t[Si]))throw new T("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new T("invalid-continue-uri");if(this.h=e,this.b=this.a=null,this.g=!1,(r=t[wi])&&"object"==typeof r){var e=r[Ai],n=r[ki],r=r[Ci];if("string"==typeof e&&e.length){if(this.a=e,void 0!==n&&"boolean"!=typeof n)throw new T("argument-error",ki+" property must be a boolean when specified.");if(this.g=!!n,void 0!==r&&("string"!=typeof r||"string"==typeof r&&!r.length))throw new T("argument-error",Ci+" property must be a non empty string when specified.");this.b=r||null}else{if(void 0!==e)throw new T("argument-error",Ai+" property must be a non empty string when specified.");if(void 0!==n||void 0!==r)throw new T("missing-android-pkg-name")}}else if(void 0!==r)throw new T("argument-error",wi+" property must be a non null object when specified.");if(this.f=null,(e=t[Ei])&&"object"==typeof e){if("string"==typeof(e=e[Ni])&&e.length)this.f=e;else if(void 0!==e)throw new T("argument-error",Ni+" property must be a non empty string when specified.")}else if(void 0!==e)throw new T("argument-error",Ei+" property must be a non null object when specified.");if(void 0!==(e=t[Ii])&&"boolean"!=typeof e)throw new T("argument-error",Ii+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ti])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new T("argument-error",Ti+" property must be a non empty string when specified.");this.i=t||null}var wi="android",Ti="dynamicLinkDomain",Ii="handleCodeInApp",Ei="iOS",Si="url",ki="installApp",Ci="minimumVersion",Ai="packageName",Ni="bundleId";function Ri(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 Pi=null;function Oi(t){var e=[];return function(r,t){function e(t){for(;i<r.length;){var e=r.charAt(i++),n=Pi[e];if(null!=n)return n;if(!/^[\s\xa0]*$/.test(e))throw Error("Unknown base64 encoding at char: "+e)}return t}!function(){if(!Pi){Pi={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;n<5;n++)for(var r=t.concat(e[n].split("")),i=0;i<r.length;i++){var o=r[i];void 0===Pi[o]&&(Pi[o]=i)}}}();for(var i=0;;){var n=e(-1),o=e(0),s=e(64),a=e(64);if(64===a&&-1===n)break;t(n<<2|o>>4),64!=s&&(t(o<<4&240|s>>2),64!=a&&t(s<<6&192|a))}}(t,function(t){e.push(t)}),e}function Di(t){var e=Li(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 xi(t){try{return new Di(t)}catch(t){return null}}function Li(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,s,a=r[e++];a<128?t[n++]=String.fromCharCode(a):191<a&&a<224?(i=r[e++],t[n++]=String.fromCharCode((31&a)<<6|63&i)):239<a&&a<365?(s=((7&a)<<18|(63&(i=r[e++]))<<12|(63&(o=r[e++]))<<6|63&r[e++])-65536,t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))):(i=r[e++],o=r[e++],t[n++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&o))}return JSON.parse(t.join(""))}catch(t){}return null}Di.prototype.T=function(){return this.f},Di.prototype.l=function(){return this.c},Di.prototype.toString=function(){return this.h};var Mi="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),Fi=["client_id","response_type","scope","redirect_uri","state"],ji={nd:{Ja:"locale",va:700,ua:600,fa:"facebook.com",Ya:Fi},pd:{Ja:null,va:500,ua:750,fa:"github.com",Ya:Fi},qd:{Ja:"hl",va:515,ua:680,fa:"google.com",Ya:Fi},wd:{Ja:"lang",va:485,ua:705,fa:"twitter.com",Ya:Mi},kd:{Ja:"locale",va:640,ua:600,fa:"apple.com",Ya:[]}};function Ui(t){for(var e in ji)if(ji[e].fa==t)return ji[e];return null}function qi(t){var e={};e["facebook.com"]=Hi,e["google.com"]=Gi,e["github.com"]=zi,e["twitter.com"]=Qi;var n=t&&t[Bi];try{if(n)return new(e[n]||Wi)(t);if(void 0!==t[Vi])return new Ki(t)}catch(t){}return null}var Vi="idToken",Bi="providerId";function Ki(t){var e,n=t[Bi];if(n||!t[Vi]||(e=xi(t[Vi]))&&e.b&&(n=e.b),!n)throw Error("Invalid additional user info!");e=!1,void 0!==t.isNewUser?e=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(e=!0),qr(this,"providerId",n="anonymous"==n||"custom"==n?null:n),qr(this,"isNewUser",e)}function Wi(t){Ki.call(this,t),qr(this,"profile",Kr((t=Cr(t.rawUserInfo||"{}"))||{}))}function Hi(t){if(Wi.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function zi(t){if(Wi.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",this.profile&&this.profile.login||null)}function Gi(t){if(Wi.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function Qi(t){if(Wi.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");qr(this,"username",t.screenName||null)}function Yi(t){var e=Nn(r=Rn(t),"link"),n=Nn(Rn(e),"link"),r=Nn(r,"deep_link_id");return Nn(Rn(r),"link")||r||n||e||t}function Xi(t,e){if(!t&&!e)throw new T("internal-error","Internal assert: no raw session string available");if(t&&e)throw new T("internal-error","Internal assert: unable to determine the session type");this.a=t||null,this.b=e||null,this.type=this.a?$i:Ji}_(Wi,Ki),_(Hi,Wi),_(zi,Wi),_(Gi,Wi),_(Qi,Wi);var $i="enroll",Ji="signin";function Zi(){}function to(t,n){return t.then(function(t){if(t[Ks]){var e=xi(t[Ks]);if(!e||n!=e.i)throw new T("user-mismatch");return t}throw new T("user-mismatch")}).o(function(t){throw t&&t.code&&t.code==S+"user-not-found"?new T("user-mismatch"):t})}function eo(t,e){if(!e)throw new T("internal-error","failed to construct a credential");this.a=e,qr(this,"providerId",t),qr(this,"signInMethod",t)}function no(t){return{pendingToken:t.a,requestUri:"http://localhost"}}function ro(t){if(t&&t.providerId&&t.signInMethod&&0==t.providerId.indexOf("saml.")&&t.pendingToken)try{return new eo(t.providerId,t.pendingToken)}catch(t){}return null}function io(t,e,n){if(this.a=null,e.idToken||e.accessToken)e.idToken&&qr(this,"idToken",e.idToken),e.accessToken&&qr(this,"accessToken",e.accessToken),e.nonce&&!e.pendingToken&&qr(this,"nonce",e.nonce),e.pendingToken&&(this.a=e.pendingToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new T("internal-error","failed to construct a credential");qr(this,"accessToken",e.oauthToken),qr(this,"secret",e.oauthTokenSecret)}qr(this,"providerId",t),qr(this,"signInMethod",n)}function oo(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:Bn(e).toString(),requestUri:"http://localhost"},t.a&&(delete e.postBody,e.pendingToken=t.a),e}function so(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 io(t.providerId,e,t.signInMethod)}catch(t){}}return null}function ao(t,e){this.Qc=e||[],Vr(this,{providerId:t,isOAuthProvider:!0}),this.Jb={},this.qb=(Ui(t)||{}).Ja||null,this.pb=null}function uo(t){if("string"!=typeof t||0!=t.indexOf("saml."))throw new T("argument-error",'SAML provider IDs must be prefixed with "saml."');ao.call(this,t,[])}function co(t){ao.call(this,t,Fi),this.a=[]}function ho(){co.call(this,"facebook.com")}function lo(t){if(!t)throw new T("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new ho).credential({accessToken:e})}function fo(){co.call(this,"github.com")}function po(t){if(!t)throw new T("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return v(t)&&(e=t.accessToken),(new fo).credential({accessToken:e})}function go(){co.call(this,"google.com"),this.Ca("profile")}function vo(t,e){var n=t;return v(t)&&(n=t.idToken,e=t.accessToken),(new go).credential({idToken:n,accessToken:e})}function yo(){ao.call(this,"twitter.com",Mi)}function mo(t,e){var n=t;if(!(n=!v(n)?{oauthToken:t,oauthTokenSecret:e}:n).oauthToken||!n.oauthTokenSecret)throw new T("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new io("twitter.com",n,"twitter.com")}function bo(t,e,n){this.a=t,this.f=e,qr(this,"providerId","password"),qr(this,"signInMethod",n===wo.EMAIL_LINK_SIGN_IN_METHOD?wo.EMAIL_LINK_SIGN_IN_METHOD:wo.EMAIL_PASSWORD_SIGN_IN_METHOD)}function _o(t){return t&&t.email&&t.password?new bo(t.email,t.password,t.signInMethod):null}function wo(){Vr(this,{providerId:"password",isOAuthProvider:!1})}function To(t,e){if(!(e=Io(e)))throw new T("argument-error","Invalid email link!");return new bo(t,e.code,wo.EMAIL_LINK_SIGN_IN_METHOD)}function Io(t){return(t=bi(t=Yi(t)))&&t.operation===Zr?t:null}function Eo(t){if(!(t.fb&&t.eb||t.La&&t.ea))throw new T("internal-error");this.a=t,qr(this,"providerId","phone"),this.fa="phone",qr(this,"signInMethod","phone")}function So(e){if(e&&"phone"===e.providerId&&(e.verificationId&&e.verificationCode||e.temporaryProof&&e.phoneNumber)){var n={};return U(["verificationId","verificationCode","temporaryProof","phoneNumber"],function(t){e[t]&&(n[t]=e[t])}),new Eo(n)}return null}function ko(t){return t.a.La&&t.a.ea?{temporaryProof:t.a.La,phoneNumber:t.a.ea}:{sessionInfo:t.a.fb,code:t.a.eb}}function Co(t){try{this.a=t||Jl.auth()}catch(t){throw new T("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().")}Vr(this,{providerId:"phone",isOAuthProvider:!1})}function Ao(t,e){if(!t)throw new T("missing-verification-id");if(!e)throw new T("missing-verification-code");return new Eo({fb:t,eb:e})}function No(t){if(t.temporaryProof&&t.phoneNumber)return new Eo({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,s=t&&t.pendingToken;try{switch(e){case"google.com":return vo(o,n);case"facebook.com":return lo(n);case"github.com":return po(n);case"twitter.com":return mo(n,r);default:return n||r||o||s?s?0==e.indexOf("saml.")?new eo(e,s):new io(e,{pendingToken:s,idToken:t.oauthIdToken,accessToken:t.oauthAccessToken},e):new co(e).credential({idToken:o,accessToken:n,rawNonce:i}):null}}catch(t){return null}}function Ro(t){if(!t.isOAuthProvider)throw new T("invalid-oauth-provider")}function Po(t,e,n,r,i,o,s){if(this.c=t,this.b=e||null,this.g=n||null,this.f=r||null,this.i=o||null,this.h=s||null,this.a=i||null,!this.g&&!this.a)throw new T("invalid-auth-event");if(this.g&&this.a)throw new T("invalid-auth-event");if(this.g&&!this.f)throw new T("invalid-auth-event")}function Oo(t){return(t=t||{}).type?new Po(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&I(t.error),t.postBody,t.tenantId):null}function Do(){this.b=null,this.a=[]}Xi.prototype.Ha=function(){return this.a?be(this.a):be(this.b)},Xi.prototype.w=function(){return this.type==$i?{multiFactorSession:{idToken:this.a}}:{multiFactorSession:{pendingCredential:this.b}}},Zi.prototype.ka=function(){},Zi.prototype.b=function(){},Zi.prototype.c=function(){},Zi.prototype.w=function(){},eo.prototype.ka=function(t){return la(t,no(this))},eo.prototype.b=function(t,e){var n=no(this);return n.idToken=e,fa(t,n)},eo.prototype.c=function(t,e){return to(pa(t,no(this)),e)},eo.prototype.w=function(){return{providerId:this.providerId,signInMethod:this.signInMethod,pendingToken:this.a}},io.prototype.ka=function(t){return la(t,oo(this))},io.prototype.b=function(t,e){var n=oo(this);return n.idToken=e,fa(t,n)},io.prototype.c=function(t,e){return to(pa(t,oo(this)),e)},io.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.Jb=ct(t),this},_(uo,ao),_(co,ao),co.prototype.Ca=function(t){return K(this.a,t)||this.a.push(t),this},co.prototype.Rb=function(){return G(this.a)},co.prototype.credential=function(t,e){e=v(t)?{idToken:t.idToken||null,accessToken:t.accessToken||null,nonce:t.rawNonce||null}:{idToken:t||null,accessToken:e||null};if(!e.idToken&&!e.accessToken)throw new T("argument-error","credential failed: must provide the ID token and/or the access token.");return new io(this.providerId,e,this.providerId)},_(ho,co),qr(ho,"PROVIDER_ID","facebook.com"),qr(ho,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),_(fo,co),qr(fo,"PROVIDER_ID","github.com"),qr(fo,"GITHUB_SIGN_IN_METHOD","github.com"),_(go,co),qr(go,"PROVIDER_ID","google.com"),qr(go,"GOOGLE_SIGN_IN_METHOD","google.com"),_(yo,ao),qr(yo,"PROVIDER_ID","twitter.com"),qr(yo,"TWITTER_SIGN_IN_METHOD","twitter.com"),bo.prototype.ka=function(t){return this.signInMethod==wo.EMAIL_LINK_SIGN_IN_METHOD?Qa(t,wa,{email:this.a,oobCode:this.f}):Qa(t,Ka,{email:this.a,password:this.f})},bo.prototype.b=function(t,e){return this.signInMethod==wo.EMAIL_LINK_SIGN_IN_METHOD?Qa(t,Ta,{idToken:e,email:this.a,oobCode:this.f}):Qa(t,La,{idToken:e,email:this.a,password:this.f})},bo.prototype.c=function(t,e){return to(this.ka(t),e)},bo.prototype.w=function(){return{email:this.a,password:this.f,signInMethod:this.signInMethod}},Vr(wo,{PROVIDER_ID:"password"}),Vr(wo,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Vr(wo,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),Eo.prototype.ka=function(t){return t.gb(ko(this))},Eo.prototype.b=function(t,e){var n=ko(this);return n.idToken=e,Qa(t,Ha,n)},Eo.prototype.c=function(t,e){var n=ko(this);return n.operation="REAUTH",to(t=Qa(t,za,n),e)},Eo.prototype.w=function(){var t={providerId:"phone"};return this.a.fb&&(t.verificationId=this.a.fb),this.a.eb&&(t.verificationCode=this.a.eb),this.a.La&&(t.temporaryProof=this.a.La),this.a.ea&&(t.phoneNumber=this.a.ea),t},Co.prototype.gb=function(r,i){var o=this.a.a;return be(i.verify()).then(function(e){if("string"!=typeof e)throw new T("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 T("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.');var t=v(r)?r.session:null,n=v(r)?r.phoneNumber:r,t=t&&t.type==$i?t.Ha().then(function(t){return Qa(o,Fa,{idToken:t,phoneEnrollmentInfo:{phoneNumber:n,recaptchaToken:e}}).then(function(t){return t.phoneSessionInfo.sessionInfo})}):t&&t.type==Ji?t.Ha().then(function(t){return t={mfaPendingCredential:t,mfaEnrollmentId:r.multiFactorHint&&r.multiFactorHint.uid||r.multiFactorUid,phoneSignInInfo:{recaptchaToken:e}},Qa(o,ja,t).then(function(t){return t.phoneResponseInfo.sessionInfo})}):Qa(o,Da,{phoneNumber:n,recaptchaToken:e});return t.then(function(t){return"function"==typeof i.reset&&i.reset(),t},function(t){throw"function"==typeof i.reset&&i.reset(),t})})},Vr(Co,{PROVIDER_ID:"phone"}),Vr(Co,{PHONE_SIGN_IN_METHOD:"phone"}),Po.prototype.getUid=function(){var t=[];return t.push(this.c),this.b&&t.push(this.b),this.f&&t.push(this.f),this.h&&t.push(this.h),t.join("-")},Po.prototype.T=function(){return this.h},Po.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 xo,Lo=null;function Mo(t){var e="unauthorized-domain",n=void 0,r=Rn(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",T.call(this,e,n)}function Fo(t,e,n){T.call(this,t,n),(t=e||{}).Kb&&qr(this,"email",t.Kb),t.ea&&qr(this,"phoneNumber",t.ea),t.credential&&qr(this,"credential",t.credential),t.$b&&qr(this,"tenantId",t.$b)}function jo(t){if(t.code){var e=t.code||"";0==e.indexOf(S)&&(e=e.substring(S.length));var n={credential:No(t),$b:t.tenantId};if(t.email)n.Kb=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new T(e,t.message||void 0);return new Fo(e,n,t.message)}return null}function Uo(){}function qo(t){return t.c||(t.c=t.b())}function Vo(){}function Bo(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 Ko(){}function Wo(){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.Tb,this),this.a.onprogress=m(this.rc,this),this.a.ontimeout=m(this.vc,this)}function Ho(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function zo(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 Qo(t,e){this.name=t,this.value=e}_(Mo,T),_(Fo,T),Fo.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&<(t,e),t},Fo.prototype.toJSON=function(){return this.w()},Uo.prototype.c=null,_(Vo,Uo),Vo.prototype.a=function(){var t=Bo(this);return t?new ActiveXObject(t):new XMLHttpRequest},Vo.prototype.b=function(){var t={};return Bo(this)&&(t[0]=!0,t[1]=!0),t},xo=new Vo,_(Ko,Uo),Ko.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Wo;throw Error("Unsupported browser")},Ko.prototype.b=function(){return{}},(t=Wo.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,Ho(this,4)},t.Tb=function(){this.status=500,this.response=this.responseText="",Ho(this,4)},t.vc=function(){this.Tb()},t.rc=function(){this.status=200,Ho(this,1)},t.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},zo.prototype.a=null,zo.prototype.reset=function(t,e,n,r,i){delete this.a},Qo.prototype.toString=function(){return this.name};var Yo=new Qo("SEVERE",1e3),Xo=new Qo("WARNING",900),$o=new Qo("CONFIG",700),Jo=new Qo("FINE",500);Go.prototype.log=function(t,e,n){if(t.value>=function t(e){return e.c||(e.a?t(e.a):(O("Root logger has no level set."),null))}(this).value)for(g(e)&&(e=e()),t=new zo(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var Zo,ts={},es=null;function ns(t){var e,n,r;return es||(es=new Go(""),(ts[""]=es).c=$o),(e=ts[t])||(e=new Go(t),r=t.lastIndexOf("."),n=t.substr(r+1),(r=ns(t.substr(0,r))).b||(r.b={}),(r.b[n]=e).a=r,ts[t]=e),e}function rs(t,e){t&&t.log(Jo,e,void 0)}function is(t){this.f=t}function os(t){fn.call(this),this.u=t,this.h=void 0,this.readyState=ss,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=ns("goog.net.FetchXmlHttp"),this.m=this.c=this.g=null}_(is,Uo),is.prototype.a=function(){return new os(this.f)},is.prototype.b=(Zo={},function(){return Zo}),_(os,fn);var ss=0;function as(t){t.c.read().then(t.pc.bind(t)).catch(t.Va.bind(t))}function us(t){t.readyState=4,t.g=null,t.c=null,t.m=null,cs(t)}function cs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function hs(t){fn.call(this),this.headers=new _n,this.D=t||null,this.c=!1,this.C=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.J=!1,this.g=0,this.s=null,this.m=ls,this.u=this.S=!1}(t=os.prototype).open=function(t,e){if(this.readyState!=ss)throw this.abort(),Error("Error reopening a connection");this.s=t,this.f=e,this.readyState=1,cs(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.Va.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,us(this)),this.readyState=ss},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,cs(this)),this.a&&(this.readyState=3,cs(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.sc.bind(this),this.Va.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.m=new TextDecoder,as(this)):t.text().then(this.tc.bind(this),this.Va.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?us:cs)(this),3==this.readyState&&as(this))},t.tc=function(t){this.a&&(this.response=this.responseText=t,us(this))},t.sc=function(t){this.a&&(this.response=t,us(this))},t.Va=function(t){var e=this.i;e&&e.log(Xo,"Failed to fetch url "+this.f,t instanceof Error?t:Error(t)),this.a&&us(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(Xo,"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(Xo,"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(os.prototype,"withCredentials",{get:function(){return"include"===this.h},set:function(t){this.h=t?"include":"same-origin"}}),_(hs,fn);var ls="";hs.prototype.b=ns("goog.net.XhrIo");var fs=/^https?$/i,ps=["POST","PUT"];function ds(e,t,n,r,i){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.P=n,e.J=!1,e.c=!0,e.a=(e.D||xo).a(),e.C=e.D?qo(e.D):qo(xo),e.a.onreadystatechange=m(e.Wb,e);try{rs(e.b,Is(e,"Opening Xhr")),e.N=!0,e.a.open(n,String(t),!0),e.N=!1}catch(t){return rs(e.b,Is(e,"Error opening Xhr: "+t.message)),void vs(e,t)}t=r||"";var o,s=new _n(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)U(t,e,void 0);else for(var n=bn(t),r=mn(t),i=r.length,o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}(i,function(t,e){s.set(e,t)}),i=function(t){t:{for(var e=gs,n=t.length,r="string"==typeof t?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return e<0?null:"string"==typeof t?t.charAt(e):t[e]}(s.Y()),r=l.FormData&&t instanceof l.FormData,!K(ps,n)||i||r||s.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),s.forEach(function(t,e){this.a.setRequestHeader(e,t)},e),e.m&&(e.a.responseType=e.m),"withCredentials"in e.a&&e.a.withCredentials!==e.S&&(e.a.withCredentials=e.S);try{_s(e),0<e.g&&(e.u=(o=e.a,Bt&&$t(9)&&"number"==typeof o.timeout&&void 0!==o.ontimeout),rs(e.b,Is(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)),rs(e.b,Is(e,"Sending request")),e.i=!0,e.a.send(t),e.i=!1}catch(t){rs(e.b,Is(e,"Send error: "+t.message)),vs(e,t)}}function gs(t){return"content-type"==t.toLowerCase()}function vs(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,ys(t),bs(t)}function ys(t){t.J||(t.J=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function ms(e){if(e.c&&void 0!==h)if(e.C[1]&&4==ws(e)&&2==Ts(e))rs(e.b,Is(e,"Local request error detected and ignored"));else if(e.i&&4==ws(e))vn(e.Wb,0,e);else if(e.dispatchEvent("readystatechange"),4==ws(e)){rs(e.b,Is(e,"Request complete")),e.c=!1;try{var t,n,r,i,o=Ts(e);t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((t=s)||((n=0===o)&&(!(i=String(e.l).match(In)[1]||null)&&l.self&&l.self.location&&(i=(r=l.self.location.protocol).substr(0,r.length-1)),n=!fs.test(i?i.toLowerCase():"")),t=n),t)e.dispatchEvent("complete"),e.dispatchEvent("success");else{try{var a=2<ws(e)?e.a.statusText:""}catch(t){rs(e.b,"Can not get status: "+t.message),a=""}e.h=a+" ["+Ts(e)+"]",ys(e)}}finally{bs(e)}}}function bs(e,t){if(e.a){_s(e);var n=e.a,r=e.C[0]?s:null;e.a=null,e.C=null,t||e.dispatchEvent("ready");try{n.onreadystatechange=r}catch(t){(e=e.b)&&e.log(Yo,"Problem encountered resetting onreadystatechange: "+t.message,void 0)}}}function _s(t){t.a&&t.u&&(t.a.ontimeout=null),t.s&&(l.clearTimeout(t.s),t.s=null)}function ws(t){return t.a?t.a.readyState:0}function Ts(t){try{return 2<ws(t)?t.a.status:-1}catch(t){return-1}}function Is(t,e){return e+" ["+t.P+" "+t.l+" "+Ts(t)+"]"}function Es(t){var e=Ls;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 Ss(t,e,n){t.a=!0,t.c=n,t.f=!e,Ns(t)}function ks(t){if(t.a){if(!t.v)throw new Rs;t.v=!1}}function Cs(t,e,n,r){t.g.push([e,n,r]),t.a&&Ns(t)}function As(t){return B(t.g,function(t){return g(t[1])})}function Ns(e){var n;e.h&&e.a&&As(e)&&(r=e.h,(n=Ds[r])&&(l.clearTimeout(n.a),delete Ds[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=(s=e.g.shift())[0],o=s[1],s=s[2];if(i=e.f?o:i)try{var a=i.call(s||e.s,r);void 0!==a&&(e.f=e.f&&(a==r||a instanceof Error),e.c=r=a),(N(r)||"function"==typeof l.Promise&&r instanceof l.Promise)&&(t=!0,e.i=!0)}catch(t){r=t,e.f=!0,As(e)||(n=!0)}}e.c=r,t&&(a=m(e.m,e,!0),t=m(e.m,e,!1),r instanceof Es?(Cs(r,a,t),r.C=!0):r.then(a,t)),n&&(r=new Os(r),Ds[r.a]=r,e.h=r.a)}function Rs(){R.call(this)}function Ps(){R.call(this)}function Os(t){this.a=l.setTimeout(m(this.c,this),0),this.b=t}(t=hs.prototype).Ma=function(){void 0!==h&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",rs(this.b,Is(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},t.abort=function(){this.a&&this.c&&(rs(this.b,Is(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),bs(this))},t.Da=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),bs(this,!0)),hs.bb.Da.call(this)},t.Wb=function(){this.ya||(this.N||this.i||this.f?ms(this):this.Jc())},t.Jc=function(){ms(this)},t.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.m){case ls: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(Yo,"Response type "+this.m+" is not supported on this browser",void 0),null}catch(t){return rs(this.b,"Can not get response: "+t.message),null}},Es.prototype.cancel=function(t){var e;this.a?this.c instanceof Es&&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 Ps,ks(this),Ss(this,!1,t)))},Es.prototype.m=function(t,e){this.i=!1,Ss(this,t,e)},Es.prototype.then=function(t,e,n){var r,i,o=new fe(function(t,e){r=t,i=e});return Cs(this,r,function(t){t instanceof Ps?o.cancel():i(t)}),o.then(t,e,n)},Es.prototype.$goog_Thenable=!0,_(Rs,R),Rs.prototype.message="Deferred has already fired",Rs.prototype.name="AlreadyCalledError",_(Ps,R),Ps.prototype.message="Deferred was canceled",Ps.prototype.name="CanceledError",Os.prototype.c=function(){throw delete Ds[this.a],this.b};var Ds={};function xs(t){var e=document,n=_t(t).toString(),r=se(document,"SCRIPT"),i={Xb:r,Ma:void 0},o=new Es(i),s=window.setTimeout(function(){Ms(r,!0);var t=new Us(js,"Timeout reached for loading script "+n);ks(o),Ss(o,!1,t)},5e3);return i.Ma=s,r.onload=r.onreadystatechange=function(){r.readyState&&"loaded"!=r.readyState&&"complete"!=r.readyState||(Ms(r,!1,s),ks(o),Ss(o,!0,null))},r.onerror=function(){Ms(r,!0,s);var t=new Us(Fs,"Error while loading script "+n);ks(o),Ss(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):a=null===a?f(l.document):a)&&t.setAttribute("nonce",i),((e=((i=e)||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:i.documentElement).appendChild(r),o}function Ls(){var t;this&&this.Xb&&((t=this.Xb)&&"SCRIPT"==t.tagName&&Ms(t,!0,this.Ma))}function Ms(t,e,n){null!=n&&l.clearTimeout(n),t.onload=s,t.onerror=s,t.onreadystatechange=s,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}var Fs=0,js=1;function Us(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),R.call(this,n),this.code=t}function qs(t){this.f=t}function Vs(t,e,n){if(this.c=t,this.l=(t=e||{}).secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||Ws,this.g=ct(t.secureTokenHeaders||Hs),this.h=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.i=t.identityPlatformEndpoint||"https://identitytoolkit.googleapis.com/v2/",this.v=t.firebaseTimeout||zs,this.a=ct(t.firebaseHeaders||Gs),n&&(this.a["X-Client-Version"]=n,this.g["X-Client-Version"]=n),n="Node"==lr(),!(n=l.XMLHttpRequest||n&&Jl.INTERNAL.node&&Jl.INTERNAL.node.XMLHttpRequest)&&!hr())throw new T("internal-error","The XMLHttpRequest compatibility library was not found.");this.f=void 0,hr()?this.f=new is(self):fr()?this.f=new qs(n):this.f=new Ko,this.b=null}_(Us,R),_(qs,Uo),qs.prototype.a=function(){return new this.f},qs.prototype.b=function(){return{}};var Bs,Ks="idToken",Ws=new Pr(3e4,6e4),Hs={"Content-Type":"application/x-www-form-urlencoded"},zs=new Pr(3e4,6e4),Gs={"Content-Type":"application/json"};function Qs(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function Ys(t,e){e&&(t.l=Xs("https://securetoken.googleapis.com/v1/token",e),t.h=Xs("https://www.googleapis.com/identitytoolkit/v3/relyingparty/",e),t.i=Xs("https://identitytoolkit.googleapis.com/v2/",e))}function Xs(t,e){return t=Rn(t),e=Rn(e.url),t.f=t.a+t.f,Sn(t,e.c),t.a=e.a,kn(t,e.g),t.toString()}function $s(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 Js(t,e,n,r,i,o,s){var a;(t=((a=gr(a=mr())==dr&&(a=a.match(/\sChrome\/(\d+)/i))&&2==a.length?parseInt(a[1],10):null)&&a<30||Bt&&Jt&&!(9<Jt))&&!hr()?(Bs=Bs||new fe(function(t,e){var n,r;n=t,r=e,((window.gapi||{}).client||{}).request?n():(l[ta]=function(){((window.gapi||{}).client||{}).request?n():r(Error("CORS_UNSUPPORTED"))},function(t,e){Cs(t,null,e,void 0)}(xs(wt(Zs,{onload:ta})),function(){r(Error("CORS_UNSUPPORTED"))}))}),m(t.s,t)):m(t.u,t))(e,n,r,i,o,s)}Vs.prototype.T=function(){return this.b},Vs.prototype.u=function(t,n,e,r,i,o){if(hr()&&(void 0===l.fetch||void 0===l.Headers||void 0===l.Request))throw new T("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var s,a=new hs(this.f);o&&(a.g=Math.max(0,o),s=setTimeout(function(){a.dispatchEvent("timeout")},o)),pn(a,"complete",function(){s&&clearTimeout(s);var e=null;try{e=JSON.parse(function(e){try{return e.a?e.a.responseText:""}catch(t){return rs(e.b,"Can not get responseText: "+t.message),""}}(this))||null}catch(t){e=null}n&&n(e)}),dn(a,"ready",function(){s&&clearTimeout(s),Me(this)}),dn(a,"timeout",function(){s&&clearTimeout(s),Me(this),n&&n(null)}),ds(a,t,e,r,i)};var Zs=new pt(yt,"https://apis.google.com/js/client.js?onload=%{onload}"),ta="__fcb"+Math.floor(1e6*Math.random()).toString();function ea(t,e,n,r,i,o,s){var a=Rn(e+n);An(a,"key",t.c),s&&An(a,"cb",Date.now().toString());var u="GET"==r;if(u)for(var c in i)i.hasOwnProperty(c)&&An(a,c,i[c]);return new fe(function(e,n){Js(t,a.toString(),function(t){t?t.error?n(Xa(t,o||{})):e(t):n(new T("network-request-failed"))},r,u?void 0:Qn(kr(i)),t.a,t.v.get())})}function na(t){if("string"!=typeof(t=t.email)||!sr.test(t))throw new T("invalid-email")}function ra(t){"email"in t&&na(t)}function ia(t){if(!t[Ks]){if(t.mfaPendingCredential)throw new T("multi-factor-auth-required",null,ct(t));throw new T("internal-error")}}function oa(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new T("internal-error")}else{if(!t.sessionInfo)throw new T("missing-verification-id");if(!t.code)throw new T("missing-verification-code")}}Vs.prototype.s=function(t,n,r,i,o){var s=this;Bs.then(function(){window.gapi.client.setApiKey(s.c);var e=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:r,body:i,headers:o,authType:"none",callback:function(t){window.gapi.auth.setToken(e),n&&n(t)}})}).o(function(t){n&&n({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},Vs.prototype.Ab=function(){return Qa(this,Ma,{})},Vs.prototype.Cb=function(t,e){return Qa(this,xa,{idToken:t,email:e})},Vs.prototype.Db=function(t,e){return Qa(this,La,{idToken:t,password:e})};var sa={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function aa(t){if(!t.phoneVerificationInfo)throw new T("internal-error");if(!t.phoneVerificationInfo.sessionInfo)throw new T("missing-verification-id");if(!t.phoneVerificationInfo.code)throw new T("missing-verification-code")}function ua(t){if(!t.requestUri||!t.sessionId&&!t.postBody&&!t.pendingToken)throw new T("internal-error")}function ca(t,e){return e.oauthIdToken&&e.providerId&&0==e.providerId.indexOf("oidc.")&&!e.pendingToken&&(t.sessionId?e.nonce=t.sessionId:t.postBody&&(Wn(t=new qn(t.postBody),"nonce")&&(e.nonce=t.get("nonce")))),e}function ha(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=jo(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=jo(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=jo(t)):t.errorMessage&&(e=Ya(t.errorMessage)),e)throw e;ia(t)}function la(t,e){return e.returnIdpCredential=!0,Qa(t,Ua,e)}function fa(t,e){return e.returnIdpCredential=!0,Qa(t,Va,e)}function pa(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,Qa(t,qa,e)}function da(t){if(!t.oobCode)throw new T("invalid-action-code")}(t=Vs.prototype).Eb=function(t,r){var i={idToken:t},o=[];return at(sa,function(t,e){var n=r[e];null===n?o.push(t):e in r&&(i[e]=n)}),o.length&&(i.deleteAttribute=o),Qa(this,xa,i)},t.wb=function(t,e){return lt(t={requestType:"PASSWORD_RESET",email:t},e),Qa(this,Na,t)},t.xb=function(t,e){return lt(t={requestType:"EMAIL_SIGNIN",email:t},e),Qa(this,ka,t)},t.vb=function(t,e){return lt(t={requestType:"VERIFY_EMAIL",idToken:t},e),Qa(this,Ca,t)},t.Fb=function(t,e,n){return lt(t={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:t,newEmail:e},n),Qa(this,Aa,t)},t.gb=function(t){return Qa(this,Wa,t)},t.ob=function(t,e){return Qa(this,Oa,{oobCode:t,newPassword:e})},t.Sa=function(t){return Qa(this,va,{oobCode:t})},t.kb=function(t){return Qa(this,ga,{oobCode:t})};var ga={endpoint:"setAccountInfo",A:da,Z:"email",B:!0},va={endpoint:"resetPassword",A:da,G:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e&&"VERIFY_AND_CHANGE_EMAIL"!=e)throw new T("internal-error")},B:!0},ya={endpoint:"signupNewUser",A:function(t){if(na(t),!t.password)throw new T("weak-password")},G:ia,V:!0,B:!0},ma={endpoint:"createAuthUri",B:!0},ba={endpoint:"deleteAccount",O:["idToken"]},_a={endpoint:"setAccountInfo",O:["idToken","deleteProvider"],A:function(t){if(!Array.isArray(t.deleteProvider))throw new T("internal-error")}},wa={endpoint:"emailLinkSignin",O:["email","oobCode"],A:na,G:ia,V:!0,B:!0},Ta={endpoint:"emailLinkSignin",O:["idToken","email","oobCode"],A:na,G:ia,V:!0},Ia={endpoint:"accounts/mfaEnrollment:finalize",O:["idToken","phoneVerificationInfo"],A:aa,G:ia,B:!0,Na:!0},Ea={endpoint:"accounts/mfaSignIn:finalize",O:["mfaPendingCredential","phoneVerificationInfo"],A:aa,G:ia,B:!0,Na:!0},Sa={endpoint:"getAccountInfo"},ka={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new T("internal-error");na(t)},Z:"email",B:!0},Ca={endpoint:"getOobConfirmationCode",O:["idToken","requestType"],A:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new T("internal-error")},Z:"email",B:!0},Aa={endpoint:"getOobConfirmationCode",O:["idToken","newEmail","requestType"],A:function(t){if("VERIFY_AND_CHANGE_EMAIL"!=t.requestType)throw new T("internal-error")},Z:"email",B:!0},Na={endpoint:"getOobConfirmationCode",O:["requestType"],A:function(t){if("PASSWORD_RESET"!=t.requestType)throw new T("internal-error");na(t)},Z:"email",B:!0},Ra={mb:!0,endpoint:"getProjectConfig",Vb:"GET"},Pa={mb:!0,endpoint:"getRecaptchaParam",Vb:"GET",G:function(t){if(!t.recaptchaSiteKey)throw new T("internal-error")}},Oa={endpoint:"resetPassword",A:da,Z:"email",B:!0},Da={endpoint:"sendVerificationCode",O:["phoneNumber","recaptchaToken"],Z:"sessionInfo",B:!0},xa={endpoint:"setAccountInfo",O:["idToken"],A:ra,V:!0},La={endpoint:"setAccountInfo",O:["idToken"],A:function(t){if(ra(t),!t.password)throw new T("weak-password")},G:ia,V:!0},Ma={endpoint:"signupNewUser",G:ia,V:!0,B:!0},Fa={endpoint:"accounts/mfaEnrollment:start",O:["idToken","phoneEnrollmentInfo"],A:function(t){if(!t.phoneEnrollmentInfo)throw new T("internal-error");if(!t.phoneEnrollmentInfo.phoneNumber)throw new T("missing-phone-number");if(!t.phoneEnrollmentInfo.recaptchaToken)throw new T("missing-app-credential")},G:function(t){if(!t.phoneSessionInfo||!t.phoneSessionInfo.sessionInfo)throw new T("internal-error")},B:!0,Na:!0},ja={endpoint:"accounts/mfaSignIn:start",O:["mfaPendingCredential","mfaEnrollmentId","phoneSignInInfo"],A:function(t){if(!t.phoneSignInInfo||!t.phoneSignInInfo.recaptchaToken)throw new T("missing-app-credential")},G:function(t){if(!t.phoneResponseInfo||!t.phoneResponseInfo.sessionInfo)throw new T("internal-error")},B:!0,Na:!0},Ua={endpoint:"verifyAssertion",A:ua,Za:ca,G:ha,V:!0,B:!0},qa={endpoint:"verifyAssertion",A:ua,Za:ca,G:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new T("user-not-found");if(t.errorMessage)throw Ya(t.errorMessage);ia(t)},V:!0,B:!0},Va={endpoint:"verifyAssertion",A:function(t){if(ua(t),!t.idToken)throw new T("internal-error")},Za:ca,G:ha,V:!0},Ba={endpoint:"verifyCustomToken",A:function(t){if(!t.token)throw new T("invalid-custom-token")},G:ia,V:!0,B:!0},Ka={endpoint:"verifyPassword",A:function(t){if(na(t),!t.password)throw new T("wrong-password")},G:ia,V:!0,B:!0},Wa={endpoint:"verifyPhoneNumber",A:oa,G:ia,B:!0},Ha={endpoint:"verifyPhoneNumber",A:function(t){if(!t.idToken)throw new T("internal-error");oa(t)},G:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",jo(t);ia(t)}},za={Ib:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",A:oa,G:ia,B:!0},Ga={endpoint:"accounts/mfaEnrollment:withdraw",O:["idToken","mfaEnrollmentId"],G:function(t){if(!!t[Ks]^!!t.refreshToken)throw new T("internal-error")},B:!0,Na:!0};function Qa(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.O))return _e(new T("internal-error"));var r,i=!!e.Na,o=e.Vb||"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),ea(t,i?t.i:t.h,e.endpoint,o,n,e.Ib,e.mb||!1)}).then(function(t){return r=t,e.Za?e.Za(n,r):r}).then(e.G).then(function(){if(!e.Z)return r;if(!(e.Z in r))throw new T("internal-error");return r[e.Z]})}function Ya(t){return Xa({error:{errors:[{message:t}],code:400,message:t}})}function Xa(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 T(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 T(i[n],e);return new T("internal-error",e=!e&&t?Sr(t):e)}function $a(t){var o;this.b=t,this.a=null,this.sb=(o=this,(eu=eu||new fe(function(t,e){function n(){Rr(),br("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){Rr(),e(Error("Network Error"))},timeout:Za.get()})}var r;br("gapi.iframes.Iframe")?t():br("gapi.load")?n():(r="__iframefcb"+Math.floor(1e6*Math.random()).toString(),l[r]=function(){br("gapi.load")?n():e(Error("Network Error"))},be(xs(r=wt(Ja,{onload:r}))).o(function(){e(Error("Network Error"))}))}).o(function(t){throw eu=null,t})).then(function(){return new fe(function(r,i){br("gapi.iframes.getContext")().open({where:document.body,url:o.b,messageHandlersFilter:br("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"))},tu.get());t.ping(e).then(e,function(){i(Error("Network Error"))})})})}))}var Ja=new pt(yt,"https://apis.google.com/js/api.js?onload=%{onload}"),Za=new Pr(3e4,6e4),tu=new Pr(5e3,15e3),eu=null;function nu(t,e,n,r){this.l=t,this.h=e,this.i=n,this.g=r,this.f=null,t=this.g?Pn((t=Rn(this.g.url)).c,t.a,t.g,"/emulator/auth/iframe"):Pn("https",this.l,null,"/__/auth/iframe"),this.a=t,An(this.a,"apiKey",this.h),An(this.a,"appName",this.i),this.b=null,this.c=[]}function ru(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 iu(t){try{return Jl.app(t).auth().Ga()}catch(t){return[]}}function ou(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 su(t){var a=tr();return Qa(t,Ra,{}).then(function(t){return t.authorizedDomains||[]}).then(function(t){t:{for(var e=(n=Rn(a)).c,n=n.a,r=0;r<t.length;r++){var i=t[r],o=n,s=e;if(o=0==i.indexOf("chrome-extension://")?Rn(i).a==o&&"chrome-extension"==s:("http"==s||"https"==s)&&(or.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 Mo(tr())})}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=iu(i.b),(r=new nu(i.s,i.g,i.b,i.f)).f=t,r.b=e,r.c=G(n||[]),i.u=r.toString()),i.v=new $a(i.u),function(r){if(!r.v)throw Error("IfcHandler must be initialized!");!function(t,e){t.sb.then(function(){t.a.register("authEvent",e,br("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 uu(t){return t.l||(t.C=t.c?yr(t.c,iu(t.b)):null,t.l=new Vs(t.g,A(t.i),t.C),t.f&&Ys(t.l,t.f)),t.l}function cu(t,e,n,r,i,o,s,a,u,c,h,l){return(t=new ru(t,e,n,r,i,l)).l=o,t.g=s,t.i=a,t.b=ct(u||null),t.f=c,t.zb(h).toString()}function hu(t){if(this.a=t||Jl.INTERNAL.reactNative&&Jl.INTERNAL.reactNative.AsyncStorage,!this.a)throw new T("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function lu(t){this.b=t,this.a={},this.f=m(this.c,this)}nu.prototype.toString=function(){return this.f?An(this.a,"v",this.f):Kn(this.a.b,"v"),this.b?An(this.a,"eid",this.b):Kn(this.a.b,"eid"),this.c.length?An(this.a,"fw",this.c.join(",")):Kn(this.a.b,"fw"),this.a.toString()},ru.prototype.zb=function(t){return this.h=t,this},ru.prototype.toString=function(){var t;if(An(t=this.v?Pn((t=Rn(this.v.url)).c,t.a,t.g,"/emulator/auth/handler"):Pn("https",this.u,null,"/__/auth/handler"),"apiKey",this.s),An(t,"appName",this.c),An(t,"authType",this.m),this.a.isOAuthProvider){var e=this.a;try{var n=Jl.app(this.c).auth().la()}catch(t){n=null}for(r in e.pb=n,An(t,"providerId",this.a.providerId),e=kr((n=this.a).Jb))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.qb&&n.pb&&!e[n.qb]&&(e[n.qb]=n.pb),ut(e)||An(t,"customParameters",Sr(e))}if("function"==typeof this.a.Rb&&((n=this.a.Rb()).length&&An(t,"scopes",n.join(","))),this.l?An(t,"redirectUrl",this.l):Kn(t.b,"redirectUrl"),this.g?An(t,"eventId",this.g):Kn(t.b,"eventId"),this.i?An(t,"v",this.i):Kn(t.b,"v"),this.b)for(var s in this.b)this.b.hasOwnProperty(s)&&!Nn(t,s)&&An(t,s,this.b[s]);return this.h?An(t,"tid",this.h):Kn(t.b,"tid"),this.f?An(t,"eid",this.f):Kn(t.b,"eid"),(s=iu(this.c)).length&&An(t,"fw",s.join(",")),t.toString()},(t=ou.prototype).Pb=function(e,n,t){var r=new T("popup-closed-by-user"),i=new T("web-storage-unsupported"),o=this,s=!1;return this.ma().then(function(){var t,r;r={type:"webStorageSupport"},au(t=o).then(function(){return e=t.v,n=r,e.sb.then(function(){return new fe(function(t){e.a.send(n.type,n,t,br("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&&rr(e),n(i),s=!0)})}).o(function(){}).then(function(){if(!s)return n=e,new fe(function(e){return function t(){yn(2e3).then(function(){return n&&!n.closed?t():void e()})}()});var n}).then(function(){if(!s)return yn(t).then(function(){n(r)})})},t.Yb=function(){var t=mr();return!Er(t)&&!Nr(t)},t.Ub=function(){return!1},t.Nb=function(e,t,n,r,i,o,s,a){if(!e)return _e(new T("popup-blocked"));if(s&&!Er())return this.ma().o(function(t){rr(e),i(t)}),r(),be();this.a||(this.a=su(uu(this)));var u=this;return this.a.then(function(){var t=u.ma().o(function(t){throw rr(e),i(t),t});return r(),t}).then(function(){Ro(n),s||er(cu(u.s,u.g,u.b,t,n,null,o,u.c,void 0,u.i,a,u.f),e)}).o(function(t){throw"auth/network-request-failed"==t.code&&(u.a=null),t})},t.Ob=function(t,e,n,r){this.a||(this.a=su(uu(this)));var i=this;return this.a.then(function(){Ro(e),er(cu(i.s,i.g,i.b,t,e,tr(),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.sb}).o(function(){throw t.a=null,new T("network-request-failed")})},t.ac=function(){return!0},t.Ea=function(t){this.h.push(t)},t.Ta=function(e){H(this.h,function(t){return t==e})},(t=hu.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,Sr(e)))},t.U=function(t){return be(this.a.removeItem(t))},t.ca=function(){},t.ia=function(){};var fu,pu=[];function du(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 gu(t){this.a=t}function vu(t){this.c=t,this.b=!1,this.a=[]}function yu(r,t,e,n){var i,o,s,a,u=e||{},c=null;if(r.b)return _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(),s=setTimeout(function(){n(Error("unsupported_event"))},h),c={messageChannel:l,onMessage:o=function(t){t.data.eventId===i&&("ack"===t.data.status?(clearTimeout(s),a=setTimeout(function(){n(Error("timeout"))},3e3)):"done"===t.data.status?(clearTimeout(a),void 0!==t.data.response?e(t.data.response):n(Error("unknown_error"))):(clearTimeout(s),clearTimeout(a),n(Error("invalid_response"))))}},r.a.push(c),l.port1.addEventListener("message",o),r.c.postMessage({eventType:t,eventId:i,data:u},[l.port2])):n(Error("connection_unavailable"))}).then(function(t){return mu(r,c),t}).o(function(t){throw mu(r,c),t})}function mu(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 bu(){if(!Iu())throw new T("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;hr()&&self?(this.v=(n=hr()?self:null,U(pu,function(t){t.b==n&&(e=t)}),e||(e=new lu(n),pu.push(e)),e),du(this.v,"keyChanged",function(t,n){return Au(r).then(function(e){return 0<e.length&&U(r.a,function(t){t(e)}),{keyProcessed:K(e,n.key)}})}),du(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 gu(t)),yu(r.g,"ping",null,!0).then(function(t){t[0].fulfilled&&K(t[0].value,"keyChanged")&&(r.s=!0)}).o(function(){}))})}function _u(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 _u(i)}).then(function(t){e(t)}).o(function(t){n(t)}))}})}function wu(t){return t.i||(t.i=_u(t)),t.i}function Tu(i,t){var o=0;return new fe(function e(n,r){wu(i).then(t).then(n).o(function(t){return 3<++o?void r(t):wu(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 Eu(t){return t.objectStore("firebaseLocalStorage")}function Su(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function ku(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?yu(t.g,"keyChanged",{key:e},t.s).then(function(){}).o(function(){}):be();var n}function Au(r){return wu(r).then(function(t){var i=Eu(Su(t,!1));return i.getAll?ku(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 Ru(t){var r=this,i=null;this.a=[],this.type="indexedDB",this.c=t,this.b=be().then(function(){if(Iu()){var e=Ar(),n="__sak"+e;return fu=fu||new bu,(i=fu).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){U(r.a,function(t){t(e)})}),t})}function Pu(){this.a={},this.type="inMemory"}function Ou(){if(!function(){var t="Node"==lr();if(!(t=Du()||t&&Jl.INTERNAL.node&&Jl.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==lr())throw new T("internal-error","The LocalStorage compatibility library was not found.");throw new T("web-storage-unsupported")}this.a=Du()||Jl.INTERNAL.node.localStorage,this.type="localStorage"}function Du(){try{var t=l.localStorage,e=Ar();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function xu(){this.type="nullStorage"}function Lu(){if(!function(){var t="Node"==lr();if(!(t=Mu()||t&&Jl.INTERNAL.node&&Jl.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}()){if("Node"==lr())throw new T("internal-error","The SessionStorage compatibility library was not found.");throw new T("web-storage-unsupported")}this.a=Mu()||Jl.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Mu(){try{var t=l.sessionStorage,e=Ar();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function Fu(){var t={};t.Browser=qu,t.Node=Vu,t.ReactNative=Bu,t.Worker=Ku,this.a=t[lr()]}lu.prototype.c=function(n){var e,r=n.data.eventType,i=n.data.eventId,t=this.a[r];t&&0<t.length&&(n.ports[0].postMessage({status:"ack",eventId:i,eventType:r,response:null}),e=[],U(t,function(t){e.push(be().then(function(){return t(n.origin,n.data.data)}))}),Te(e).then(function(t){var e=[];U(t,function(t){e.push({fulfilled:t.Qb,value:t.value,reason:t.reason?t.reason.message:void 0})}),U(e,function(t){for(var e in t)void 0===t[e]&&delete t[e]}),n.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:e})}))},gu.prototype.postMessage=function(t,e){this.a.postMessage(t,e)},vu.prototype.close=function(){for(;0<this.a.length;)mu(this,this.a[0]);this.b=!0},(t=bu.prototype).set=function(r,i){var o=this,s=!1;return Tu(this,function(t){return ku((t=Eu(Su(t,!0))).get(r))}).then(function(n){return Tu(o,function(t){if(t=Eu(Su(t,!0)),n)return n.value=i,ku(t.put(n));o.b++,s=!0;var e={};return e.fbase_key=r,e.value=i,ku(t.add(e))})}).then(function(){return o.c[r]=i,Cu(o,r)}).oa(function(){s&&o.b--})},t.get=function(e){return Tu(this,function(t){return ku(Eu(Su(t,!1)).get(e))}).then(function(t){return t&&t.value})},t.U=function(e){var n=this,r=!1;return Tu(this,function(t){return r=!0,n.b++,ku(Eu(Su(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=Au(n).then(function(e){0<e.length&&U(n.a,function(t){t(e)})}).then(function(){e()}).o(function(t){"STOP_EVENT"!=t.message&&e()})},800)}()),this.a.push(t)},t.ia=function(e){H(this.a,function(t){return t==e}),0==this.a.length&&Nu(this)},(t=Ru.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=Pu.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=Sr(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&&Ze(l.window,"storage",t)},t.ia=function(t){l.window&&nn(l.window,"storage",t)},(t=xu.prototype).get=function(){return be(null)},t.set=function(){return be()},t.U=function(){return be()},t.ca=function(){},t.ia=function(){},(t=Lu.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=Sr(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 ju,Uu,qu={F:Ou,cb:Lu},Vu={F:Ou,cb:Lu},Bu={F:hu,cb:xu},Ku={F:Ou,cb:xu},Wu={rd:"local",NONE:"none",td:"session"};function Hu(){var t=!(Nr(mr())||!cr()),e=Er(),n=_r();this.m=t,this.h=e,this.l=n,this.a={},t=ju=ju||new Fu;try{this.g=!Zn()&&Lr()||!l.indexedDB?new t.a.F:new Ru(new(hr()?Pu:t.a.F))}catch(t){this.g=new Pu,this.h=!0}try{this.i=new t.a.cb}catch(t){this.i=new Pu}this.v=new Pu,this.f=m(this.Zb,this),this.b={}}function zu(){return Uu=Uu||new Hu}function Gu(t,e){switch(e){case"session":return t.i;case"none":return t.v;default:return t.g}}function Qu(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Yu(t,e,n){return n=Qu(e,n),"local"==e.F&&(t.b[n]=null),Gu(t,e.F).U(n)}function Xu(t){t.c&&(clearInterval(t.c),t.c=null)}function $u(t){this.a=t,this.b=zu()}(t=Hu.prototype).get=function(t,e){return Gu(this,t.F).get(Qu(t,e))},t.set=function(e,t,n){var r=Qu(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=Qu(t,e),this.l&&(this.b[t]=l.localStorage.getItem(t)),ut(this.a)&&(Gu(this,"local").ca(this.f),this.h||(Zn()||!Lr())&&l.indexedDB||!this.l||(Xu(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 Be({type:"storage",key:t,target:window,oldValue:n,newValue:e,a:!0}),r.Zb(e))}},1e3))),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},t.removeListener=function(t,e,n){t=Qu(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),Xu(this))},t.Zb=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.nb(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if(void 0!==t.a.a?Gu(this,"local").ia(this.f):Xu(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.nb(e))};Bt&&Jt&&10==Jt&&l.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else U(t,m(this.nb,this))},t.nb=function(t){this.a[t]&&U(this.a[t],function(t){t()})};var Ju,Zu={name:"authEvent",F:"local"};function tc(){this.a=zu()}function ec(t,e){this.b=nc,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(cc):cc),this.reset()}_(ec,function(){this.b=-1});for(var nc=64,rc=nc-1,ic=[],oc=0;oc<rc;oc++)ic[oc]=0;var sc=z(128,ic);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,s=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+s|0}r=0|t.a[0],i=0|t.a[1];var a=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],l=0|t.a[6];for(o=0|t.a[7],e=0;e<64;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&a^i&a)|0;s=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((s=(s=c&h^~c&l)+(0|Ju[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+s|0,u=a,a=i,i=r,r=s+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+a|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function uc(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}ec.prototype.reset=function(){this.g=this.c=0,this.a=l.Int32Array?new Int32Array(this.h):G(this.h)};var cc=[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 hc(){ec.call(this,8,lc)}_(hc,ec);var lc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function fc(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 tc,this.g=new $u(this.h),this.f=null,this.b=[],this.a=this.c=null}function pc(t){return new T("invalid-cordova-configuration",t)}function dc(t){var e=new hc;uc(e,t),t=[];var n=8*e.g;e.c<56?uc(e,sc,56-e.c):uc(e,sc,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 gc(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function vc(a){return a.f||(a.f=a.ma().then(function(){return new fe(function(n){function e(r){t=!0,s&&s.cancel(),yc(i).then(function(t){var e,n=o;t&&r&&r.url&&(e=null,n=(e=-1!=(n=Yi(r.url)).indexOf("/__/auth/callback")?(e="object"==typeof(e=Cr(Nn(e=Rn(n),"firebaseError")||null))?I(e):null)?new Po(t.c,t.b,null,null,e,null,t.T()):new Po(t.c,t.b,n,t.f,null,null,t.T()):e)||o),gc(i,n)})}var i,o,t,s,r;a.Ea(function t(e){return n(e),a.Ta(t),!1}),i=a,o=new Po("unknown",null,null,null,new T("no-auth-event")),t=!1,s=yn(500).then(function(){return yc(i).then(function(){t||gc(i,o)})}),r=l.handleOpenURL,l.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(br("BuildInfo.packageName",l).toLowerCase()+"://")&&e({url:t}),"function"==typeof r)try{r(t)}catch(t){console.error(t)}},Lo=Lo||new Do,function(t){var n=Lo;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=br("universalLinks.subscribe",l))&&t(null,n.b))}(e)})})),a.f}function yc(e){var t,n=null;return(t=e.g).b.get(Zu,t.a).then(Oo).then(function(t){return n=t,Yu((t=e.g).b,Zu,t.a)}).then(function(){return n})}function mc(t){this.a=t,this.b=zu()}(t=fc.prototype).ma=function(){return this.Ia||(this.Ia=(ur(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 br("universalLinks.subscribe",l))throw pc("cordova-universal-links-plugin-fix is not installed");if(void 0===br("BuildInfo.packageName",l))throw pc("cordova-plugin-buildinfo is not installed");if("function"!=typeof br("cordova.plugins.browsertab.openUrl",l))throw pc("cordova-plugin-browsertab is not installed");if("function"!=typeof br("cordova.InAppBrowser.open",l))throw pc("cordova-plugin-inappbrowser is not installed")},function(){throw new T("cordova-not-ready")}))},t.Pb=function(t,e){return e(new T("operation-not-supported-in-this-environment")),be()},t.Nb=function(){return _e(new T("operation-not-supported-in-this-environment"))},t.ac=function(){return!1},t.Yb=function(){return!0},t.Ub=function(){return!0},t.Ob=function(t,e,n,r){if(this.c)return _e(new T("redirect-operation-pending"));var i=this,o=l.document,s=null,a=null,u=null,c=null;return this.c=be().then(function(){return Ro(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("")}(),s=new Po(t,r,null,o,new T("no-auth-event"),null,i),a=br("BuildInfo.packageName",l);if("string"!=typeof a)throw new T("invalid-cordova-configuration");var u=br("BuildInfo.displayName",l),c={};if(mr().toLowerCase().match(/iphone|ipad|ipod/))c.ibi=a;else{if(!mr().toLowerCase().match(/android/))return _e(new T("operation-not-supported-in-this-environment"));c.apn=a}u&&(c.appDisplayName=u),o=dc(o),c.sessionId=o;var h=cu(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(Zu,s.w(),t)}).then(function(){var t=br("cordova.plugins.browsertab.isAvailable",l);if("function"!=typeof t)throw new T("invalid-cordova-configuration");var e=null;t(function(t){if(t){if("function"!=typeof(e=br("cordova.plugins.browsertab.openUrl",l)))throw new T("invalid-cordova-configuration");e(h)}else{if("function"!=typeof(e=br("cordova.InAppBrowser.open",l)))throw new T("invalid-cordova-configuration");t=mr(),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){a=function(){var t=br("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(a),u=function(){s=s||yn(2e3).then(function(){t(new T("redirect-cancelled-by-user"))})},c=function(){Or()&&u()},o.addEventListener("resume",u,!1),mr().toLowerCase().match(/android/)||o.addEventListener("visibilitychange",c,!1)}).o(function(t){return yc(i).then(function(){throw t})})}).oa(function(){u&&o.removeEventListener("resume",u,!1),c&&o.removeEventListener("visibilitychange",c,!1),s&&s.cancel(),a&&i.Ta(a),i.c=null})},t.Ea=function(e){this.b.push(e),vc(this).o(function(t){"auth/invalid-cordova-configuration"===t.code&&(t=new Po("unknown",null,null,null,new T("no-auth-event")),e(t))})},t.Ta=function(e){H(this.b,function(t){return t==e})};var bc={name:"pendingRedirect",F:"session"};function _c(t){return Yu(t.b,bc,t.a)}function wc(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 Mc,this.C=new Vc,this.g=new mc(xc(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=Tc(this.D,this.v,this.m,E,this.J)}function Tc(t,e,n,r,i){var o=Jl.SDK_VERSION||null;return new(ur()?fc:ou)(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 Ec(n){n.a.Yb()&&Ic(n).o(function(t){var e=new Po("unknown",null,null,null,new T("operation-not-supported-in-this-environment"));Rc(t)&&n.s(e)}),n.a.Ub()||Fc(n.b)}function Sc(n,t){K(n.h,t)||n.h.push(t),n.f||(t=n.g).b.get(bc,t.a).then(function(t){return"pending"==t}).then(function(t){t?_c(n.g).then(function(){Ic(n).o(function(t){var e=new Po("unknown",null,null,null,new T("operation-not-supported-in-this-environment"));Rc(t)&&n.s(e)})}):Ec(n)}).o(function(){Ec(n)})}function kc(t,e){H(t.h,function(t){return t==e})}wc.prototype.reset=function(){this.f=!1,this.a.Ta(this.l),this.a=Tc(this.D,this.v,this.m,null,this.J),this.i={}},wc.prototype.s=function(t){if(!t)throw new T("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.Gb(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 Fc(this.b),e};var Cc=new Pr(2e3,1e4),Ac=new Pr(3e4,6e4);function Nc(t,e,n,r,i,o,s){return t.a.Nb(e,n,r,function(){t.f||(t.f=!0,t.a.Ea(t.l))},function(){t.reset()},i,o,s)}function Rc(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function Pc(e,t,n,r,i){var o,s;return(s=e.g).b.set(bc,"pending",s.a).then(function(){return e.a.Ob(t,n,r,i).o(function(t){if(Rc(t))throw new T("operation-not-supported-in-this-environment");return o=t,_c(e.g).then(function(){throw o})}).then(function(){return e.a.ac()?new fe(function(){}):_c(e.g).then(function(){return e.ra()}).then(function(){}).o(function(){})})})}function Oc(t,e,n,r,i){return t.a.Pb(r,function(t){e.na(n,null,t,i)},Cc.get())}wc.prototype.ra=function(){return this.b.ra()};var Dc={};function xc(t,e,n){return t=t+":"+e,t=n?t+":"+n.url:t}function Lc(t,e,n,r){var i=xc(e,n,r);return Dc[i]||(Dc[i]=new wc(t,e,n,r)),Dc[i]}function Mc(){this.b=null,this.f=[],this.c=[],this.a=null,this.i=this.g=!1}function Fc(t){t.g||(t.g=!0,qc(t,!1,null,null))}function jc(t){t.g&&!t.i&&qc(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 qc(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 Vc(){}function Bc(){this.jb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.jb},set:function(t){this.jb=t},enumerable:!1})}function Kc(t,e){this.a=e,qr(this,"verificationId",t)}function Wc(t,e,n,r){return new Co(t).gb(e,n).then(function(t){return new Kc(t,r)})}function Hc(t){var e=Li(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new T("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");Vr(this,{token:t,expirationTime:xr(1e3*e.exp),authTime:xr(1e3*e.auth_time),issuedAtTime:xr(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 zc(t,e,n){var r=e&&e[Qc];if(!r)throw new T("argument-error","Internal assert: Invalid MultiFactorResolver");this.a=t,this.f=ct(e),this.g=n,this.c=new Xi(null,r),this.b=[];var i=this;U(e[Gc]||[],function(t){(t=Hr(t))&&i.b.push(t)}),qr(this,"auth",this.a),qr(this,"session",this.c),qr(this,"hints",this.b)}Mc.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},Mc.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?(qc(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,s=t.T(),a=!!t.c.match(/Redirect$/);n(r,i,s,o).then(function(t){qc(e,a,t,null)}).o(function(t){qc(e,a,null,t)})}(this,t,e):_e(new T("invalid-auth-event")):(qc(this,!1,null,null),be())):_e(new T("invalid-auth-event"))},Mc.prototype.ra=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 T("timeout"),n.a&&n.a.cancel(),n.a=yn(Ac.get()).then(function(){n.b||(n.g=!0,qc(n,!0,null,r))}))})},Vc.prototype.h=function(t,e){var n,r,i,o,s;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,s=t.c,i.Fa(s,o)(t.g,t.f,t.T(),t.i).then(function(t){i.na(s,t,null,o)}).o(function(t){i.na(s,null,t,o)})):_e(new T("invalid-auth-event"))):_e(new T("invalid-auth-event"))},Kc.prototype.confirm=function(t){return t=Ao(this.verificationId,t),this.a(t)};var Gc="mfaInfo",Qc="mfaPendingCredential";function Yc(t,e,n,r){T.call(this,"multi-factor-auth-required",r,e),this.b=new zc(t,e,n),qr(this,"resolver",this.b)}function Xc(t,e,n){if(t&&v(t.serverResponse)&&"auth/multi-factor-auth-required"===t.code)try{return new Yc(e,t.serverResponse,n,t.message)}catch(t){}return null}function $c(){}function Jc(t){qr(this,"factorId",t.fa),this.a=t}function Zc(t){if(Jc.call(this,t),this.a.fa!=Co.PROVIDER_ID)throw new T("argument-error","firebase.auth.PhoneMultiFactorAssertion requires a valid firebase.auth.PhoneAuthCredential")}function th(t,e){for(var n in Ve.call(this,t),e)this[n]=e[n]}function eh(t,e){this.a=t,this.b=[],this.c=m(this.yc,this),Ze(this.a,"userReloaded",this.c);var r=[];e&&e.multiFactor&&e.multiFactor.enrolledFactors&&U(e.multiFactor.enrolledFactors,function(t){var e=null,n={};if(t){t.uid&&(n[Qr]=t.uid),t.displayName&&(n[zr]=t.displayName),t.enrollmentTime&&(n[Gr]=new Date(t.enrollmentTime).toISOString()),t.phoneNumber&&(n[Yr]=t.phoneNumber);try{e=new Xr(n)}catch(t){}t=e}else t=null;t&&r.push(t)}),nh(this,r)}function nh(t,e){t.b=e,qr(t,"enrolledFactors",e)}function rh(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 ih(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 oh(t){this.f=t,this.b=this.a=null,this.c=Date.now()}function sh(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=xi(e[Ks]||""),t.a=e.refreshToken,sh(t,void 0!==(e=e.expiresIn)?Number(e):void 0)}function uh(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?Js(r,r.l+"?key="+encodeURIComponent(r.c),function(t){t?t.error?n(Xa(t)):t.access_token&&t.refresh_token?e(t):n(new T("internal-error")):n(new T("network-request-failed"))},"POST",Bn(i).toString(),r.g,r.m.get()):n(new T("internal-error"))}).then(function(t){return e.b=xi(t.access_token),e.a=t.refresh_token,sh(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 ch(t,e){this.a=t||null,this.b=e||null,Vr(this,{lastSignInTime:xr(e||null),creationTime:xr(t||null)})}function hh(t,e,n,r,i,o){Vr(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function lh(t,e,n){this.N=[],this.l=t.apiKey,this.m=t.appName,this.s=t.authDomain||null;var r,i=Jl.SDK_VERSION?yr(Jl.SDK_VERSION):null;this.a=new Vs(this.l,A(E),i),(this.u=t.emulatorConfig||null)&&Ys(this.a,this.u),this.h=new oh(this.a),_h(this,e[Ks]),ah(this.h,e),qr(this,"refreshToken",this.h.a),Ih(this,n||{}),fn.call(this),this.P=!1,this.s&&wr()&&(this.b=Lc(this.s,this.l,this.m,this.u)),this.W=[],this.i=null,this.D=(r=this,new rh(function(){return r.I(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=r.h.c-Date.now()-3e5;return 0<t?t:0})),this.ba=m(this.ib,this);var o=this;this.za=null,this.Pa=function(t){o.xa(t.h)},this.qa=null,this.Ba=function(t){fh(o,t.c)},this.$=null,this.aa=[],this.Oa=function(t){gh(o,t.f)},this.ja=null,this.S=new eh(this,n),qr(this,"multiFactor",this.S)}function fh(t,e){t.u=e,Ys(t.a,e),t.b&&(e=t.b,t.b=Lc(t.s,t.l,t.m,t.u),t.P&&(kc(e,t),Sc(t.b,t)))}function ph(t,e){t.qa&&nn(t.qa,"languageCodeChanged",t.Pa),(t.qa=e)&&Ze(e,"languageCodeChanged",t.Pa)}function dh(t,e){t.$&&nn(t.$,"emulatorConfigChanged",t.Ba),(t.$=e)&&Ze(e,"emulatorConfigChanged",t.Ba)}function gh(t,e){t.aa=e,$s(t.a,Jl.SDK_VERSION?yr(Jl.SDK_VERSION,t.aa):null)}function vh(t,e){t.ja&&nn(t.ja,"frameworkChanged",t.Oa),(t.ja=e)&&Ze(e,"frameworkChanged",t.Oa)}function yh(e){try{return Jl.app(e.m).auth()}catch(t){throw new T("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+e.m+"'!")}}function mh(t){t.J||t.D.b||(t.D.start(),nn(t,"tokenChanged",t.ba),Ze(t,"tokenChanged",t.ba))}function bh(t){nn(t,"tokenChanged",t.ba),t.D.stop()}function _h(t,e){t.Aa=e,qr(t,"_lat",e)}function wh(t){for(var e=[],n=0;n<t.W.length;n++)e.push(t.W[n](t));return Te(e).then(function(){return t})}function Th(t){t.b&&!t.P&&(t.P=!0,Sc(t.b,t))}function Ih(t,e){Vr(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 ch(e.createdAt,e.lastLoginAt),providerData:[]}),t.a.b=t.tenantId}function Eh(){}function Sh(t){return be().then(function(){if(t.J)throw new T("app-deleted")})}function kh(t){return V(t.providerData,function(t){return t.providerId})}function Ch(t,e){e&&(Ah(t,e.providerId),t.providerData.push(e))}function Ah(t,e){H(t.providerData,function(t){return t.providerId==e})}function Nh(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&qr(t,e,n)}function Rh(e,t){var n,r;e!=t&&(Vr(e,{uid:t.uid,displayName:t.displayName,photoURL:t.photoURL,email:t.email,emailVerified:t.emailVerified,phoneNumber:t.phoneNumber,isAnonymous:t.isAnonymous,tenantId:t.tenantId,providerData:[]}),t.metadata?qr(e,"metadata",new ch((r=t.metadata).a,r.b)):qr(e,"metadata",new ch),U(t.providerData,function(t){Ch(e,t)}),n=e.h,r=t.h,n.b=r.b,n.a=r.a,n.c=r.c,qr(e,"refreshToken",e.h.a),nh(e.S,t.S.b))}function Ph(r){return r.I().then(function(t){var e,n=r.isAnonymous;return Qa((e=r).a,Sa,{idToken:t}).then(m(e.Kc,e)).then(function(){return n||Nh(r,"isAnonymous",!1),t})})}function Oh(t,e){e[Ks]&&t.Aa!=e[Ks]&&(ah(t.h,e),t.dispatchEvent(new th("tokenChanged")),_h(t,e[Ks]),Nh(t,"refreshToken",t.h.a))}function Dh(t,e){return Ph(t).then(function(){if(K(kh(t),e))return wh(t).then(function(){throw new T("provider-already-linked")})})}function xh(t,e,n){return Br({user:t,credential:No(e),additionalUserInfo:e=qi(e),operationType:n})}function Lh(t,e){return Oh(t,e),t.reload().then(function(){return t})}function Mh(n,r,t,e,i){if(!wr())return _e(new T("operation-not-supported-in-this-environment"));if(n.i&&!i)return _e(n.i);var o=Ui(t.providerId),s=Ar(n.uid+":::"),a=null,u=ir(a=(!Er()||cr())&&n.s&&t.isOAuthProvider?cu(n.s,n.l,n.m,r,t,null,s,Jl.SDK_VERSION||null,null,null,n.tenantId,n.u):a,o&&o.va,o&&o.ua);return e=e().then(function(){if(jh(n),!i)return n.I().then(function(){})}).then(function(){return Nc(n.b,u,r,t,s,!!a,n.tenantId)}).then(function(){return new fe(function(t,e){n.na(r,null,new T("cancelled-popup-request"),n.g||null),n.f=t,n.C=e,n.g=s,n.c=Oc(n.b,n,r,u,s)})}).then(function(t){return u&&rr(u),t?Br(t):null}).o(function(t){throw u&&rr(u),t}),Uh(n,e,i)}function Fh(e,t,n,r,i){if(!wr())return _e(new T("operation-not-supported-in-this-environment"));if(e.i&&!i)return _e(e.i);var o=null,s=Ar(e.uid+":::");return r=r().then(function(){if(jh(e),!i)return e.I().then(function(){})}).then(function(){return e.ga=s,wh(e)}).then(function(t){return t=e.ha?(t=e.ha).b.set(Bh,e.w(),t.a):t}).then(function(){return Pc(e.b,t,n,s,e.tenantId)}).o(function(t){if(o=t,e.ha)return Kh(e.ha);throw o}).then(function(){if(o)throw o}),Uh(e,r,i)}function jh(t){if(!t.b||!t.P){if(t.b&&!t.P)throw new T("internal-error");throw new T("auth-domain-config-required")}}function Uh(n,t,e){var r,i=(t=t,e=e,(r=n).i&&!e?(t.cancel(),_e(r.i)):t.o(function(t){throw!t||"auth/user-disabled"!=t.code&&"auth/user-token-expired"!=t.code||(r.i||r.dispatchEvent(new th("userInvalidated")),r.i=t),t}));return n.N.push(i),i.oa(function(){W(n.N,i)}),i.o(function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Xc(t.w(),yh(n),m(n.jc,n)):e)||t})}function qh(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[Ks]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null;var r=t.stsTokenManager.expirationTime;r&&(n.expiresIn=(r-Date.now())/1e3);var i=new lh(e,n,t);return t.providerData&&U(t.providerData,function(t){t&&Ch(i,Br(t))}),t.redirectEventId&&(i.ga=t.redirectEventId),i}function Vh(t){this.a=t,this.b=zu()}zc.prototype.Rc=function(t){var n=this;return t.tb(this.a.a,this.c).then(function(t){var e=ct(n.f);return delete e[Gc],delete e[Qc],lt(e,t),n.g(e)})},_(Yc,T),$c.prototype.tb=function(t,e,n){return e.type==$i?(o=this,s=t,a=n,e.Ha().then(function(t){return t={idToken:t},void 0!==a&&(t.displayName=a),lt(t,{phoneVerificationInfo:ko(o.a)}),Qa(s,Ia,t)})):(r=this,i=t,e.Ha().then(function(t){return lt(t={mfaPendingCredential:t},{phoneVerificationInfo:ko(r.a)}),Qa(i,Ea,t)}));var r,i,o,s,a},_(Jc,$c),_(Zc,Jc),_(th,Ve),(t=eh.prototype).yc=function(t){var e;nh(this,(t=t.hd,e=[],U(t.mfaInfo||[],function(t){(t=Hr(t))&&e.push(t)}),e))},t.Sb=function(){return this.a.I().then(function(t){return new Xi(t,null)})},t.fc=function(e,n){var r=this,i=this.a.a;return this.Sb().then(function(t){return e.tb(i,t,n)}).then(function(t){return Oh(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 Qa(e,Ga,{idToken:t,mfaEnrollmentId:r})}).then(function(t){var e=q(n.b,function(t){return t.uid!=r});return nh(n,e),Oh(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()})}}},rh.prototype.start=function(){this.a=this.c,function e(n,t){n.stop();n.b=yn(ih(n,t)).then(Dr).then(function(){return n.h()}).then(function(){e(n,!0)}).o(function(t){n.i(t)&&e(n,!1)})}(this,!0)},rh.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},oh.prototype.w=function(){return{apiKey:this.f.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:this.c}},oh.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?_e(new T("user-token-expired")):t||!this.b||Date.now()>this.c-3e4?this.a?uh(this,{grant_type:"refresh_token",refresh_token:this.a}):be(null):be({accessToken:this.b.toString(),refreshToken:this.a})},ch.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},_(lh,fn),lh.prototype.xa=function(t){this.za=t,Qs(this.a,t)},lh.prototype.la=function(){return this.za},lh.prototype.Ga=function(){return G(this.aa)},lh.prototype.ib=function(){this.D.b&&(this.D.stop(),this.D.start())},qr(lh.prototype,"providerId","firebase"),(t=lh.prototype).reload=function(){var t=this;return Uh(this,Sh(this).then(function(){return Ph(t).then(function(){return wh(t)}).then(Eh)}))},t.oc=function(t){return this.I(t).then(function(t){return new Hc(t)})},t.I=function(t){var e=this;return Uh(this,Sh(this).then(function(){return e.h.getToken(t)}).then(function(t){if(!t)throw new T("internal-error");return t.accessToken!=e.Aa&&(_h(e,t.accessToken),e.dispatchEvent(new th("tokenChanged"))),Nh(e,"refreshToken",t.refreshToken),t.accessToken}))},t.Kc=function(t){if(!(t=t.users)||!t.length)throw new T("internal-error");Ih(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 hh(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[],r=0;r<n.length;r++)Ch(this,n[r]);Nh(this,"isAnonymous",!(this.email&&t.passwordHash||this.providerData&&this.providerData.length)),this.dispatchEvent(new th("userReloaded",{hd:t}))},t.Lc=function(t){return jr("firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateWithCredential instead."),this.ub(t)},t.ub=function(t){var e=this,n=null;return Uh(this,t.c(this.a,this.uid).then(function(t){return Oh(e,t),n=xh(e,t,"reauthenticate"),e.i=null,e.reload()}).then(function(){return n}),!0)},t.Cc=function(t){return jr("firebase.User.prototype.linkAndRetrieveDataWithCredential is deprecated. Please use firebase.User.prototype.linkWithCredential instead."),this.rb(t)},t.rb=function(e){var n=this,r=null;return Uh(this,Dh(this,e.providerId).then(function(){return n.I()}).then(function(t){return e.b(n.a,t)}).then(function(t){return r=xh(n,t,"link"),Lh(n,t)}).then(function(){return r}))},t.Dc=function(t,e){var n=this;return Uh(this,Dh(this,"phone").then(function(){return Wc(yh(n),t,e,m(n.rb,n))}))},t.Mc=function(t,e){var n=this;return Uh(this,be().then(function(){return Wc(yh(n),t,e,m(n.ub,n))}),!0)},t.Cb=function(e){var n=this;return Uh(this,this.I().then(function(t){return n.a.Cb(t,e)}).then(function(t){return Oh(n,t),n.reload()}))},t.ed=function(e){var n=this;return Uh(this,this.I().then(function(t){return e.b(n.a,t)}).then(function(t){return Oh(n,t),n.reload()}))},t.Db=function(e){var n=this;return Uh(this,this.I().then(function(t){return n.a.Db(t,e)}).then(function(t){return Oh(n,t),n.reload()}))},t.Eb=function(e){if(void 0===e.displayName&&void 0===e.photoURL)return Sh(this);var n=this;return Uh(this,this.I().then(function(t){return n.a.Eb(t,{displayName:e.displayName,photoUrl:e.photoURL})}).then(function(t){return Oh(n,t),Nh(n,"displayName",t.displayName||null),Nh(n,"photoURL",t.photoUrl||null),U(n.providerData,function(t){"password"===t.providerId&&(qr(t,"displayName",n.displayName),qr(t,"photoURL",n.photoURL))}),wh(n)}).then(Eh))},t.cd=function(e){var n=this;return Uh(this,Ph(this).then(function(t){return K(kh(n),e)?Qa(n.a,_a,{idToken:t,deleteProvider:[e]}).then(function(t){var e={};return U(t.providerUserInfo||[],function(t){e[t.providerId]=!0}),U(kh(n),function(t){e[t]||Ah(n,t)}),e[Co.PROVIDER_ID]||qr(n,"phoneNumber",null),wh(n)}):wh(n).then(function(){throw new T("no-such-provider")})}))},t.delete=function(){var e=this;return Uh(this,this.I().then(function(t){return Qa(e.a,ba,{idToken:t})}).then(function(){e.dispatchEvent(new th("userDeleted"))})).then(function(){for(var t=0;t<e.N.length;t++)e.N[t].cancel("app-deleted");ph(e,null),dh(e,null),vh(e,null),e.N=[],e.J=!0,bh(e),qr(e,"refreshToken",null),e.b&&kc(e.b,e)})},t.Gb=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.Lb,this):"reauthViaPopup"==t&&e==(this.g||null)?m(this.Mb,this):"linkViaRedirect"==t&&(this.ga||null)==e?m(this.Lb,this):"reauthViaRedirect"==t&&(this.ga||null)==e?m(this.Mb,this):null},t.Ec=function(t){var e=this;return Mh(this,"linkViaPopup",t,function(){return Dh(e,t.providerId).then(function(){return wh(e)})},!1)},t.Nc=function(t){return Mh(this,"reauthViaPopup",t,function(){return be()},!0)},t.Fc=function(t){var e=this;return Fh(this,"linkViaRedirect",t,function(){return Dh(e,t.providerId)},!1)},t.Oc=function(t){return Fh(this,"reauthViaRedirect",t,function(){return be()},!0)},t.Lb=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 fa(i.a,{requestUri:e,postBody:r,sessionId:n,idToken:t})}).then(function(t){return o=xh(i,t,"link"),Lh(i,t)}).then(function(){return o}),Uh(this,t)},t.Mb=function(t,e,n,r){var i=this;this.c&&(this.c.cancel(),this.c=null);var o=null;return Uh(this,be().then(function(){return to(pa(i.a,{requestUri:t,sessionId:e,postBody:r,tenantId:n}),i.uid)}).then(function(t){return o=xh(i,t,"reauthenticate"),Oh(i,t),i.i=null,i.reload()}).then(function(){return o}),!0)},t.vb=function(e){var n=this,r=null;return Uh(this,this.I().then(function(t){return r=t,void 0===e||ut(e)?{}:Ri(new _i(e))}).then(function(t){return n.a.vb(r,t)}).then(function(t){if(n.email!=t)return n.reload()}).then(function(){}))},t.Fb=function(e,n){var r=this,i=null;return Uh(this,this.I().then(function(t){return i=t,void 0===n||ut(n)?{}:Ri(new _i(n))}).then(function(t){return r.a.Fb(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 Uh(this,t=to(be(t),n.uid).then(function(t){return e=xh(n,t,"reauthenticate"),Oh(n,t),n.i=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.h.w(),redirectEventId:this.ga||null};return this.metadata&<(e,this.metadata.w()),U(this.providerData,function(t){e.providerData.push(function(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}(t))}),lt(e,this.S.w()),e};var Bh={name:"redirectUser",F:"session"};function Kh(t){return Yu(t.b,Bh,t.a)}function Wh(t){var e,n,r,i;this.a=t,this.b=zu(),this.c=null,this.f=(n=Gh("local"),r=Gh("session"),i=Gh("none"),function(n,r,i){var o=Qu(r,i),s=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"!=s.type&&l.localStorage.removeItem(o)})}((e=this).b,n,e.a).then(function(){return e.b.get(r,e.a)}).then(function(t){return t?r:e.b.get(i,e.a).then(function(t){return t?i:e.b.get(n,e.a).then(function(t){return t?n:e.b.get(zh,e.a).then(function(t){return t?Gh(t):n})})})}).then(function(t){return e.c=t,Hh(e,t.F)}).o(function(){e.c||(e.c=n)})),this.b.addListener(Gh("local"),this.a,m(this.g,this))}function Hh(t,e){var n,a,r=[];for(n in Wu)Wu[n]!==e&&r.push(Yu(t.b,Gh(Wu[n]),t.a));return r.push(Yu(t.b,zh,t.a)),a=r,new fe(function(n,e){var r=a.length,i=[];if(r)for(var t=function(t,e){r--,i[t]=e,0==r&&n(i)},o=function(t){e(t)},s=0;s<a.length;s++)we(a[s],b(t,s),o);else n(i)})}Wh.prototype.g=function(){var e=this,n=Gh("local");$h(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 Hh(e,"local").then(function(){e.c=n})})})};var zh={name:"persistence",F:"session"};function Gh(t){return{name:"authUser",F:t}}function Qh(t,e){return $h(t,function(){return t.b.set(t.c,e.w(),t.a)})}function Yh(t){return $h(t,function(){return Yu(t.b,t.c,t.a)})}function Xh(t,e,n){return $h(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),t&&n&&(t.emulatorConfig=n),qh(t||{})})})}function $h(t,e){return t.f=t.f.then(e,e),t.f}function Jh(t){if(this.l=!1,qr(this,"settings",new Bc),qr(this,"app",t),!this.app.options||!this.app.options.apiKey)throw new T("invalid-api-key");var n,e,r,i,o,s;t=Jl.SDK_VERSION?yr(Jl.SDK_VERSION):null,this.a=new Vs(this.app.options&&this.app.options.apiKey,A(E),t),this.P=[],this.s=[],this.N=[],this.Pa=Jl.INTERNAL.createSubscribe(m(this.zc,this)),this.W=void 0,this.ib=Jl.INTERNAL.createSubscribe(m(this.Ac,this)),ol(this,null),this.i=new Wh(this.app.options.apiKey+":"+this.app.name),this.D=new Vh(this.app.options.apiKey+":"+this.app.name),this.$=hl(this,(e=(n=this).app.options.authDomain,t=function(e){var t=function(t,e){return t.b.get(Bh,t.a).then(function(t){return t&&e&&(t.authDomain=e),qh(t||{})})}(e.D,e.app.options.authDomain).then(function(t){return(e.m=t)&&(t.ha=e.D),Kh(e.D)});return hl(e,t)}(n).then(function(){return Xh(n.i,e,n.R)}).then(function(e){return e?(e.ha=n.D,n.m&&(n.m.ga||null)==(e.ga||null)?e:e.reload().then(function(){return Qh(n.i,e).then(function(){return e})}).o(function(t){return"auth/network-request-failed"==t.code?e:Yh(n.i)})):null}).then(function(t){ol(n,t||null)}),hl(n,t))),this.h=hl(this,(r=this).$.then(function(){return rl(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(Gh("local"),t.a,r.ja))})),this.ba=!1,this.ja=m(this.Zc,this),this.Ba=m(this.da,this),this.qa=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,s=i.app.options.apiKey,o&&wr()&&(i.Oa=i.$.then(function(){var t;if(!i.l)return i.b=Lc(o,s,i.app.name,i.R),Sc(i.b,i),al(i)&&Th(al(i)),i.m&&(Th(i.m),(t=i.m).xa(i.la()),ph(t,i),gh(t=i.m,i.J),vh(t,i),fh(t=i.m,i.R),dh(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,fn.call(this),t=this,Object.defineProperty(t,"lc",{get:function(){return this.la()},set:function(t){this.xa(t)},enumerable:!1}),t.aa=null,Object.defineProperty(t,"ti",{get:function(){return this.T()},set:function(t){this.zb(t)},enumerable:!1}),t.S=null,Object.defineProperty(t,"emulatorConfig",{get:function(){var t;return t=this.R?Br({protocol:(t=Rn(this.R.url)).c,host:t.a,port:t.g,options:Br({disableWarnings:this.R.ec})}):null},enumerable:!1}),this.J=[],this.R=null}function Zh(t){Ve.call(this,"languageCodeChanged"),this.h=t}function tl(t){Ve.call(this,"emulatorConfigChanged"),this.c=t}function el(t){Ve.call(this,"frameworkChanged"),this.f=t}function nl(t){return t.Oa||_e(new T("auth-domain-config-required"))}function rl(t){if(!wr())return _e(new T("operation-not-supported-in-this-environment"));var e=nl(t).then(function(){return t.b.ra()}).then(function(t){return t?Br(t):null});return hl(t,e)}function il(o,s){var a={};return a.apiKey=o.app.options.apiKey,a.authDomain=o.app.options.authDomain,a.appName=o.app.name,o.R&&(a.emulatorConfig=o.R),o.$.then(function(){return t=a,e=s,n=o.D,r=o.Ga(),i=new lh(t,e),n&&(i.ha=n),r&&gh(i,r),i.reload().then(function(){return i});var t,e,n,r,i}).then(function(t){return al(o)&&t.uid==al(o).uid?Rh(al(o),t):(ol(o,t),Th(t)),o.da(t)}).then(function(){cl(o)})}function ol(t,e){var n,r;al(t)&&(n=al(t),r=t.Ba,H(n.W,function(t){return t==r}),nn(al(t),"tokenChanged",t.qa),nn(al(t),"userDeleted",t.za),nn(al(t),"userInvalidated",t.Aa),bh(al(t))),e&&(e.W.push(t.Ba),Ze(e,"tokenChanged",t.qa),Ze(e,"userDeleted",t.za),Ze(e,"userInvalidated",t.Aa),0<t.u&&mh(e)),qr(t,"currentUser",e),e&&(e.xa(t.la()),ph(e,t),gh(e,t.J),vh(e,t),fh(e,t.R),dh(e,t))}function sl(n,t){var e=null,r=null;return hl(n,t.then(function(t){return e=No(t),r=qi(t),il(n,t)},function(t){var e=null;throw(e=t&&"auth/multi-factor-auth-required"===t.code?Xc(t.w(),n,m(n.kc,n)):e)||t}).then(function(){return Br({user:al(n),credential:e,additionalUserInfo:r,operationType:"signIn"})}))}function al(t){return t.currentUser}function ul(t){return al(t)&&al(t)._lat||null}function cl(t){if(t.ba){for(var e=0;e<t.s.length;e++)t.s[e]&&t.s[e](ul(t));if(t.W!==t.getUid()&&t.N.length)for(t.W=t.getUid(),e=0;e<t.N.length;e++)t.N[e]&&t.N[e](ul(t))}}function hl(t,e){return t.P.push(e),e.oa(function(){W(t.P,e)}),e}function ll(){}function fl(){this.a={},this.b=1e12}Wh.prototype.yb=function(e){var n=null,r=this;return function(t){var e=new T("invalid-persistence-type"),n=new T("unsupported-persistence-type");t:{for(r in Wu)if(Wu[r]==t){var r=!0;break t}r=!1}if(!r||"string"!=typeof t)throw e;switch(lr()){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(!_r()&&"none"!==t)throw n}}(e),$h(this,function(){return e!=r.c.F?r.b.get(r.c,r.a).then(function(t){return n=t,Hh(r,e)}).then(function(){if(r.c=Gh(e),n)return r.b.set(r.c,n,r.a)}):be()})},_(Jh,fn),_(Zh,Ve),_(tl,Ve),_(el,Ve),(t=Jh.prototype).yb=function(t){return t=this.i.yb(t),hl(this,t)},t.xa=function(t){this.aa===t||this.l||(this.aa=t,Qs(this.a,this.aa),this.dispatchEvent(new Zh(this.la())))},t.la=function(){return this.aa},t.fd=function(){var t=l.navigator;this.xa(t&&(t.languages&&t.languages[0]||t.language||t.userLanguage)||null)},t.gd=function(t,e){if(!this.R){if(!/^https?:\/\//.test(t))throw new T("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="#b50000",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.R={url:t,ec:e},this.settings.jb=!0,Ys(this.a,this.R),this.dispatchEvent(new tl(this.R))}var n},t.Gc=function(t){this.J.push(t),$s(this.a,Jl.SDK_VERSION?yr(Jl.SDK_VERSION,this.J):null),this.dispatchEvent(new el(this.J))},t.Ga=function(){return G(this.J)},t.zb=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:al(this)&&al(this).w()}},t.Gb=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 sl(i,la(i.a,o))})},t.Xc=function(e){if(!wr())return _e(new T("operation-not-supported-in-this-environment"));var n=this,t=Ui(e.providerId),r=Ar(),i=null,o=ir(i=(!Er()||cr())&&this.app.options.authDomain&&e.isOAuthProvider?cu(this.app.options.authDomain,this.app.options.apiKey,this.app.name,"signInViaPopup",e,null,r,Jl.SDK_VERSION||null,null,null,this.T(),this.R):i,t&&t.va,t&&t.ua);return hl(this,t=nl(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 T("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&&rr(o),t?Br(t):null}).o(function(t){throw o&&rr(o),t}))},t.Yc=function(t){if(!wr())return _e(new T("operation-not-supported-in-this-environment"));var e=this;return hl(this,nl(this).then(function(){return $h(t=e.i,function(){return t.b.set(zh,t.c.F,t.a)});var t}).then(function(){return Pc(e.b,"signInViaRedirect",t,void 0,e.T())}))},t.ra=function(){var e=this;return rl(this).then(function(t){return e.b&&jc(e.b.b),t}).o(function(t){throw e.b&&jc(e.b.b),t})},t.dd=function(t){if(!t)return _e(new T("null-user"));if(this.S!=t.tenantId)return _e(new T("tenant-id-mismatch"));var e=this,n={};n.apiKey=this.app.options.apiKey,n.authDomain=this.app.options.authDomain,n.appName=this.app.name;var r,i,o,s,a,u=(r=t,i=n,o=e.D,s=e.Ga(),a=r.h,(n={})[Ks]=a.b&&a.b.toString(),n.refreshToken=a.a,i=new lh(i||{apiKey:r.l,authDomain:r.s,appName:r.m},n),o&&(i.ha=o),s&&gh(i,s),Rh(i,r),i);return hl(this,this.h.then(function(){if(e.app.options.apiKey!=t.l)return u.reload()}).then(function(){return al(e)&&t.uid==al(e).uid?(Rh(al(e),t),e.da(t)):(ol(e,u),Th(u),e.da(u))}).then(function(){cl(e)}))},t.Bb=function(){var t=this,e=this.h.then(function(){return t.b&&jc(t.b.b),al(t)?(ol(t,null),Yh(t.i).then(function(){cl(t)})):be()});return hl(this,e)},t.Zc=function(){var r=this;return Xh(this.i,this.app.options.authDomain).then(function(t){if(!r.l){var e,n;if((e=al(r)&&t)&&(e=al(r).uid,n=t.uid,e=null!=e&&""!==e&&null!=n&&""!==n&&e==n),e)return Rh(al(r),t),al(r).I();(al(r)||t)&&(ol(r,t),t&&(Th(t),t.ha=r.D),r.b&&Sc(r.b,r),cl(r))}})},t.da=function(t){return Qh(this.i,t)},t.mc=function(){cl(this),this.da(al(this))},t.wc=function(){this.Bb()},t.xc=function(){this.Bb()},t.kc=function(t){var e=this;return this.h.then(function(){return sl(e,be(t))})},t.zc=function(t){var e=this;this.addAuthTokenListener(function(){t.next(al(e))})},t.Ac=function(t){var e,n,r=this;n=function(){t.next(al(r))},(e=this).N.push(n),hl(e,e.h.then(function(){!e.l&&K(e.N,n)&&e.W!==e.getUid()&&(e.W=e.getUid(),n(ul(e)))}))},t.Ic=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){"function"==typeof t?t(al(r)):"function"==typeof t.next&&t.next(al(r))}),this.Pa(t,e,n)},t.Hc=function(t,e,n){var r=this;return this.ba&&Promise.resolve().then(function(){r.W=r.getUid(),"function"==typeof t?t(al(r)):"function"==typeof t.next&&t.next(al(r))}),this.ib(t,e,n)},t.nc=function(t){var e=this,n=this.h.then(function(){return al(e)?al(e).I(t).then(function(t){return{accessToken:t}}):null});return hl(this,n)},t.Tc=function(t){var n=this;return this.h.then(function(){return sl(n,Qa(n.a,Ba,{token:t}))}).then(function(t){var e=t.user;return Nh(e,"isAnonymous",!1),n.da(e),t})},t.Uc=function(t,e){var n=this;return this.h.then(function(){return sl(n,Qa(n.a,Ka,{email:t,password:e}))})},t.dc=function(t,e){var n=this;return this.h.then(function(){return sl(n,Qa(n.a,ya,{email:t,password:e}))})},t.ab=function(t){var e=this;return this.h.then(function(){return sl(e,t.ka(e.a))})},t.Sc=function(t){return jr("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInWithCredential instead."),this.ab(t)},t.Ab=function(){var n=this;return this.h.then(function(){var t=al(n);if(t&&t.isAnonymous){var e=Br({providerId:null,isNewUser:!1});return Br({user:t,credential:null,additionalUserInfo:e,operationType:"signIn"})}return sl(n,n.a.Ab()).then(function(t){var e=t.user;return Nh(e,"isAnonymous",!0),n.da(e),t})})},t.getUid=function(){return al(this)&&al(this).uid||null},t.cc=function(t){this.addAuthTokenListener(t),this.u++,0<this.u&&al(this)&&mh(al(this))},t.Pc=function(e){var n=this;U(this.s,function(t){t==e&&n.u--}),this.u<0&&(this.u=0),0==this.u&&al(this)&&bh(al(this)),this.removeAuthTokenListener(e)},t.addAuthTokenListener=function(t){var e=this;this.s.push(t),hl(this,this.h.then(function(){e.l||K(e.s,t)&&t(ul(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.P.length;t++)this.P[t].cancel("app-deleted");return this.P=[],this.i&&(t=this.i).b.removeListener(Gh("local"),t.a,this.ja),this.b&&(kc(this.b,this),jc(this.b.b)),Promise.resolve()},t.hc=function(t){return hl(this,Qa(this.a,ma,{identifier:t,continueUri:Tr()?tr():"http://localhost"}).then(function(t){return t.signinMethods||[]}))},t.Bc=function(t){return!!Io(t)},t.xb=function(e,n){var r=this;return hl(this,be().then(function(){var t=new _i(n);if(!t.c)throw new T("argument-error",Ii+" must be true when sending sign in link to email");return Ri(t)}).then(function(t){return r.a.xb(e,t)}).then(function(){}))},t.jd=function(t){return this.Sa(t).then(function(t){return t.data.email})},t.ob=function(t,e){return hl(this,this.a.ob(t,e).then(function(){}))},t.Sa=function(t){return hl(this,this.a.Sa(t).then(function(t){return new $r(t)}))},t.kb=function(t){return hl(this,this.a.kb(t).then(function(){}))},t.wb=function(e,t){var n=this;return hl(this,be().then(function(){return void 0===t||ut(t)?{}:Ri(new _i(t))}).then(function(t){return n.a.wb(e,t)}).then(function(){}))},t.Wc=function(t,e){return hl(this,Wc(this,t,e,m(this.ab,this)))},t.Vc=function(n,r){var i=this;return hl(this,be().then(function(){var t=r||tr(),e=To(n,t);if(!(t=Io(t)))throw new T("argument-error","Invalid email link!");if(t.tenantId!==i.T())throw new T("tenant-id-mismatch");return i.ab(e)}))},ll.prototype.render=function(){},ll.prototype.reset=function(){},ll.prototype.getResponse=function(){},ll.prototype.execute=function(){};var pl=null;function dl(t,e){return(e=gl(e))&&t.a[e]||null}function gl(t){return(t=void 0===t?1e12:t)?t.toString():null}function vl(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():Ze(this.f,"click",this.i)}function yl(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function ml(){}function bl(){}fl.prototype.render=function(t,e){return this.a[this.b.toString()]=new vl(t,e),this.b++},fl.prototype.reset=function(t){var e=dl(this,t);t=gl(t),e&&t&&(e.delete(),delete this.a[t])},fl.prototype.getResponse=function(t){return(t=dl(this,t))?t.getResponse():null},fl.prototype.execute=function(t){(t=dl(this,t))&&t.execute()},vl.prototype.getResponse=function(){return yl(this),this.b},vl.prototype.execute=function(){yl(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))},vl.prototype.delete=function(){yl(this),this.g=!0,clearTimeout(this.a),this.a=null,nn(this.f,"click",this.i)},qr(ml,"FACTOR_ID","phone"),bl.prototype.g=function(){return be(pl=pl||new fl)},bl.prototype.c=function(){};var _l=null;function wl(){this.b=l.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}var Tl=new pt(yt,"https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),Il=new Pr(3e4,6e4);wl.prototype.g=function(i){var o=this;return new fe(function(t,e){var r=setTimeout(function(){e(new T("network-request-failed"))},Il.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 T("internal-error"))),delete l[o.a]},be(xs(wt(Tl,{onload:o.a,hl:i||""}))).o(function(){clearTimeout(r),e(new T("internal-error","Unable to load external reCAPTCHA dependencies!"))})):(clearTimeout(r),t(l.grecaptcha))})},wl.prototype.c=function(){this.b--};var El=null;function Sl(t,e,n,r,i,o,s){if(qr(this,"type","recaptcha"),this.c=this.f=null,this.J=!1,this.v=e,this.g=null,s=s?_l=_l||new bl:El=El||new wl,this.m=s,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[Al])throw new T("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[Nl],!l.document)throw new T("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 T("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.s=new Vs(t,o||null,i||null),this.u=r||function(){return null};var a=this;this.l=[];var u=this.a[kl];this.a[kl]=function(t){var e;Rl(a,t),"function"==typeof u?u(t):"string"!=typeof u||"function"==typeof(e=br(u,l))&&e(t)};var c=this.a[Cl];this.a[Cl]=function(){var t;Rl(a,null),"function"==typeof c?c():"string"!=typeof c||"function"==typeof(t=br(c,l))&&t()}}var kl="callback",Cl="expired-callback",Al="sitekey",Nl="size";function Rl(t,e){for(var n=0;n<t.l.length;n++)try{t.l[n](e)}catch(t){}}function Pl(t,e){return t.h.push(e),e.oa(function(){W(t.h,e)}),e}function Ol(t){if(t.J)throw new T("internal-error","RecaptchaVerifier instance has been destroyed.")}function Dl(t,e,n){var r=!1;try{this.b=n||Jl.app()}catch(t){throw new T("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new T("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=Jl.SDK_VERSION?yr(Jl.SDK_VERSION,o):null,Sl.call(this,n,t,e,function(){try{var e=i.b.auth().la()}catch(t){e=null}return e},o,A(E),r)}function xl(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,s=0;s<e.length;s++)if(e[s].optional)o=!0;else{if(o)throw new T("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>=Ll.length)throw new T("internal-error","Argument validator received an unsupported number of arguments.");n=Ll[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new T("argument-error",t+" failed: "+r)}(t=Sl.prototype).Ia=function(){var e=this;return this.f||(this.f=Pl(this,be().then(function(){if(Tr()&&!hr())return ar();throw new T("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,Qa(e.s,Pa,{})}).then(function(t){e.a[Al]=t.recaptchaSiteKey}).o(function(t){throw e.f=null,t})))},t.render=function(){Ol(this);var n=this;return Pl(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(){Ol(this);var i=this;return Pl(this,this.render().then(function(e){return new fe(function(n){var r,t=i.g.getResponse(e);t?n(t):(i.l.push(r=function(t){var e;t&&(e=r,H(i.l,function(t){return t==e}),n(t))}),i.i&&i.g.execute(i.c))})}))},t.reset=function(){Ol(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){Ol(this),this.J=!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)}},_(Dl,Sl);var Ll="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");function Ml(t,e){return{name:t||"",K:"a valid string",optional:!!e,M:function(t){return"string"==typeof t}}}function Fl(t,e){return{name:t||"",K:"a boolean",optional:!!e,M:function(t){return"boolean"==typeof t}}}function jl(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:v}}function Ul(t,e){return{name:t||"",K:"a function",optional:!!e,M:function(t){return"function"==typeof t}}}function ql(t,e){return{name:t||"",K:"null",optional:!!e,M:function(t){return null===t}}}function Vl(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 Bl(){return{name:"multiFactorAssertion",K:"a valid multiFactorAssertion",optional:!1,M:function(t){return!!t&&!!t.tb}}}function Kl(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function Wl(t,e){return v(t)&&"string"==typeof t.type&&t.type===e&&"function"==typeof t.Ha}function Hl(t){return v(t)&&"string"==typeof t.uid}function zl(){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 Gl(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 Ql(t,e){for(var n in e){var r=e[n].name;t[r]=$l(r,t[n],e[n].j)}}function Yl(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){xl(t,[n],[r],!0),this[e]=r},r,n,e[n].lb),enumerable:!0})}}function Xl(t,e,n,r){t[e]=$l(e,n,r)}function $l(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return xl(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}Ql(Jh.prototype,{kb:{name:"applyActionCode",j:[Ml("code")]},Sa:{name:"checkActionCode",j:[Ml("code")]},ob:{name:"confirmPasswordReset",j:[Ml("code"),Ml("newPassword")]},dc:{name:"createUserWithEmailAndPassword",j:[Ml("email"),Ml("password")]},hc:{name:"fetchSignInMethodsForEmail",j:[Ml("email")]},ra:{name:"getRedirectResult",j:[]},Bc:{name:"isSignInWithEmailLink",j:[Ml("emailLink")]},Hc:{name:"onAuthStateChanged",j:[Gl(jl(),Ul(),"nextOrObserver"),Ul("opt_error",!0),Ul("opt_completed",!0)]},Ic:{name:"onIdTokenChanged",j:[Gl(jl(),Ul(),"nextOrObserver"),Ul("opt_error",!0),Ul("opt_completed",!0)]},wb:{name:"sendPasswordResetEmail",j:[Ml("email"),Gl(jl("opt_actionCodeSettings",!0),ql(null,!0),"opt_actionCodeSettings",!0)]},xb:{name:"sendSignInLinkToEmail",j:[Ml("email"),jl("actionCodeSettings")]},yb:{name:"setPersistence",j:[Ml("persistence")]},Sc:{name:"signInAndRetrieveDataWithCredential",j:[Vl()]},Ab:{name:"signInAnonymously",j:[]},ab:{name:"signInWithCredential",j:[Vl()]},Tc:{name:"signInWithCustomToken",j:[Ml("token")]},Uc:{name:"signInWithEmailAndPassword",j:[Ml("email"),Ml("password")]},Vc:{name:"signInWithEmailLink",j:[Ml("email"),Ml("emailLink",!0)]},Wc:{name:"signInWithPhoneNumber",j:[Ml("phoneNumber"),zl()]},Xc:{name:"signInWithPopup",j:[Kl()]},Yc:{name:"signInWithRedirect",j:[Kl()]},dd:{name:"updateCurrentUser",j:[Gl({name:"user",K:"an instance of Firebase User",optional:!1,M:function(t){return!!(t&&t instanceof lh)}},ql(),"user")]},Bb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[Ml(null,!0)]},fd:{name:"useDeviceLanguage",j:[]},gd:{name:"useEmulator",j:[Ml("url"),jl("options",!0)]},jd:{name:"verifyPasswordResetCode",j:[Ml("code")]}}),Yl(Jh.prototype,{lc:{name:"languageCode",lb:Gl(Ml(),ql(),"languageCode")},ti:{name:"tenantId",lb:Gl(Ml(),ql(),"tenantId")}}),(Jh.Persistence=Wu).LOCAL="local",Jh.Persistence.SESSION="session",Jh.Persistence.NONE="none",Ql(lh.prototype,{delete:{name:"delete",j:[]},oc:{name:"getIdTokenResult",j:[Fl("opt_forceRefresh",!0)]},I:{name:"getIdToken",j:[Fl("opt_forceRefresh",!0)]},Cc:{name:"linkAndRetrieveDataWithCredential",j:[Vl()]},rb:{name:"linkWithCredential",j:[Vl()]},Dc:{name:"linkWithPhoneNumber",j:[Ml("phoneNumber"),zl()]},Ec:{name:"linkWithPopup",j:[Kl()]},Fc:{name:"linkWithRedirect",j:[Kl()]},Lc:{name:"reauthenticateAndRetrieveDataWithCredential",j:[Vl()]},ub:{name:"reauthenticateWithCredential",j:[Vl()]},Mc:{name:"reauthenticateWithPhoneNumber",j:[Ml("phoneNumber"),zl()]},Nc:{name:"reauthenticateWithPopup",j:[Kl()]},Oc:{name:"reauthenticateWithRedirect",j:[Kl()]},reload:{name:"reload",j:[]},vb:{name:"sendEmailVerification",j:[Gl(jl("opt_actionCodeSettings",!0),ql(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[Ml(null,!0)]},cd:{name:"unlink",j:[Ml("provider")]},Cb:{name:"updateEmail",j:[Ml("email")]},Db:{name:"updatePassword",j:[Ml("password")]},ed:{name:"updatePhoneNumber",j:[Vl("phone")]},Eb:{name:"updateProfile",j:[jl("profile")]},Fb:{name:"verifyBeforeUpdateEmail",j:[Ml("email"),Gl(jl("opt_actionCodeSettings",!0),ql(null,!0),"opt_actionCodeSettings",!0)]}}),Ql(fl.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ql(ll.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),Ql(fe.prototype,{oa:{name:"finally"},o:{name:"catch"},then:{name:"then"}}),Yl(Bc.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",lb:Fl("appVerificationDisabledForTesting")}}),Ql(Kc.prototype,{confirm:{name:"confirm",j:[Ml("verificationCode")]}}),Xl(Zi,"fromJSON",function(t){t="string"==typeof t?JSON.parse(t):t;for(var e,n=[so,_o,So,ro],r=0;r<n.length;r++)if(e=n[r](t))return e;return null},[Gl(Ml(),jl(),"json")]),Xl(wo,"credential",function(t,e){return new bo(t,e)},[Ml("email"),Ml("password")]),Ql(bo.prototype,{w:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(ho.prototype,{Ca:{name:"addScope",j:[Ml("scope")]},Ka:{name:"setCustomParameters",j:[jl("customOAuthParameters")]}}),Xl(ho,"credential",lo,[Gl(Ml(),jl(),"token")]),Xl(wo,"credentialWithLink",To,[Ml("email"),Ml("emailLink")]),Ql(fo.prototype,{Ca:{name:"addScope",j:[Ml("scope")]},Ka:{name:"setCustomParameters",j:[jl("customOAuthParameters")]}}),Xl(fo,"credential",po,[Gl(Ml(),jl(),"token")]),Ql(go.prototype,{Ca:{name:"addScope",j:[Ml("scope")]},Ka:{name:"setCustomParameters",j:[jl("customOAuthParameters")]}}),Xl(go,"credential",vo,[Gl(Ml(),Gl(jl(),ql()),"idToken"),Gl(Ml(),ql(),"accessToken",!0)]),Ql(yo.prototype,{Ka:{name:"setCustomParameters",j:[jl("customOAuthParameters")]}}),Xl(yo,"credential",mo,[Gl(Ml(),jl(),"token"),Ml("secret",!0)]),Ql(co.prototype,{Ca:{name:"addScope",j:[Ml("scope")]},credential:{name:"credential",j:[Gl(Ml(),Gl(jl(),ql()),"optionsOrIdToken"),Gl(Ml(),ql(),"accessToken",!0)]},Ka:{name:"setCustomParameters",j:[jl("customOAuthParameters")]}}),Ql(io.prototype,{w:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(eo.prototype,{w:{name:"toJSON",j:[Ml(null,!0)]}}),Xl(Co,"credential",Ao,[Ml("verificationId"),Ml("verificationCode")]),Ql(Co.prototype,{gb:{name:"verifyPhoneNumber",j:[Gl(Ml(),{name:"phoneInfoOptions",K:"valid phone info options",optional:!1,M:function(t){return!!t&&(t.session&&t.phoneNumber?Wl(t.session,$i)&&"string"==typeof t.phoneNumber:t.session&&t.multiFactorHint?Wl(t.session,Ji)&&Hl(t.multiFactorHint):t.session&&t.multiFactorUid?Wl(t.session,Ji)&&"string"==typeof t.multiFactorUid:!!t.phoneNumber&&"string"==typeof t.phoneNumber)}},"phoneInfoOptions"),zl()]}}),Ql(Eo.prototype,{w:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(T.prototype,{toJSON:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(Fo.prototype,{toJSON:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(Mo.prototype,{toJSON:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(Yc.prototype,{toJSON:{name:"toJSON",j:[Ml(null,!0)]}}),Ql(zc.prototype,{Rc:{name:"resolveSignIn",j:[Bl()]}}),Ql(eh.prototype,{Sb:{name:"getSession",j:[]},fc:{name:"enroll",j:[Bl(),Ml("displayName",!0)]},bd:{name:"unenroll",j:[Gl({name:"multiFactorInfo",K:"a valid multiFactorInfo",optional:!1,M:Hl},Ml(),"multiFactorInfoIdentifier")]}}),Ql(Dl.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),Xl(li,"parseLink",bi,[Ml("link")]),Xl(ml,"assertion",function(t){return new Zc(t)},[Vl("phone")]),function(){if(void 0===Jl||!Jl.INTERNAL||!Jl.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:Zr,PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:Jr,VERIFY_AND_CHANGE_EMAIL:ti,VERIFY_EMAIL:"VERIFY_EMAIL"}},Auth:Jh,AuthCredential:Zi,Error:T};Xl(t,"EmailAuthProvider",wo,[]),Xl(t,"FacebookAuthProvider",ho,[]),Xl(t,"GithubAuthProvider",fo,[]),Xl(t,"GoogleAuthProvider",go,[]),Xl(t,"TwitterAuthProvider",yo,[]),Xl(t,"OAuthProvider",co,[Ml("providerId")]),Xl(t,"SAMLAuthProvider",uo,[Ml("providerId")]),Xl(t,"PhoneAuthProvider",Co,[{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof Jh)}}]),Xl(t,"RecaptchaVerifier",Dl,[Gl(Ml(),{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}},"recaptchaContainer"),jl("recaptchaParameters",!0),{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof Jl.app.App)}}]),Xl(t,"ActionCodeURL",li,[]),Xl(t,"PhoneMultiFactorGenerator",ml,[]),Jl.INTERNAL.registerComponent({name:"auth",instanceFactory:function(t){return new Jh(t=t.getProvider("app").getImmediate())},multipleInstances:!1,serviceProps:t,instantiationMode:"LAZY",type:"PUBLIC",onInstanceCreated:function(t){t.getProvider("auth-internal").initialize()}}),Jl.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"}),Jl.registerVersion("@firebase/auth","0.16.8"),Jl.INTERNAL.extendNamespace({User:lh})}()}.apply("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var Os="";function Ds(t){Os=t}var xs=(Ls.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),Po(e))},Ls.prototype.get=function(t){t=this.domStorage_.getItem(this.prefixedName_(t));return null==t?null:Ro(t)},Ls.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},Ls.prototype.prefixedName_=function(t){return this.prefix_+t},Ls.prototype.toString=function(){return this.domStorage_.toString()},Ls);function Ls(t){this.domStorage_=t,this.prefix_="firebase:"}var Ms=(Fs.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},Fs.prototype.get=function(t){return Do(this.cache_,t)?this.cache_[t]:null},Fs.prototype.remove=function(t){delete this.cache_[t]},Fs);function Fs(){this.cache_={},this.isInMemoryStorage=!0}function js(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,io(++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 jo).update(e),t=t.digest(),so.encodeByteArray(t)}function Us(t,e){io(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Qs.logLevel=us.VERBOSE,$s=Qs.log.bind(Qs),e&&Gs.set("logging_enabled",!0)):"function"==typeof t?$s=t:($s=null,Gs.remove("logging_enabled"))}function qs(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+Xs.apply(void 0,Zi([],Ji(t)));Qs.error(n)}function Vs(t){return"number"==typeof t&&(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function Bs(t,e){return t===e?0:t<e?-1:1}function Ks(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+Po(e))}function Ws(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 Hs,fr=function(t){try{if("undefined"!=typeof window&&void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new xs(e)}}catch(t){}return new Ms},zs=fr("localStorage"),Gs=fr("sessionStorage"),Qs=new ds("@firebase/database"),Ys=(Hs=1,function(){return Hs++}),Xs=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+=Xs.apply(null,i):n+="object"==typeof i?Po(i):i,n+=" "}return n},$s=null,Js=!0,Zs=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];!0===Js&&(Js=!1,null===$s&&!0===Gs.get("logging_enabled")&&Us(!0)),$s&&(t=Xs.apply(null,e),$s(t))},ta=function(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Zs.apply(void 0,Zi([n],Ji(t)))}},ea=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+Xs.apply(void 0,Zi([],Ji(t)));throw Qs.error(n),new Error(n)},na=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+Xs.apply(void 0,Zi([],Ji(t)));Qs.warn(n)},ra="[MIN_NAME]",ia="[MAX_NAME]",oa=function(t,e){if(t===e)return 0;if(t===ra||e===ia)return-1;if(e===ra||t===ia)return 1;var n=pa(t),r=pa(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&&t<e?-1:1},sa=function(t){if("object"!=typeof t||null===t)return Po(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+=Po(n[i]),r+=":",r+=sa(t[n[i]]);return r+="}"};function aa(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}function ua(t){var e,n,r,i;io(!Vs(t),"Invalid JSON number"),0===t?e=1/t==-1/(r=n=0)?1:0:(e=t<0,r=(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074))));for(var o=[],s=52;s;--s)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;--s)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var a=o.join(""),u="";for(s=0;s<64;s+=8){var c=parseInt(a.substr(s,8),2).toString(16);u+=c=1===c.length?"0"+c:c}return u.toLowerCase()}function ca(t,e){return"object"==typeof(e=setTimeout(t,e))&&e.unref&&e.unref(),e}var ha=new RegExp("^-?(0*)\\d{1,10}$"),la=-2147483648,fa=2147483647,pa=function(t){if(ha.test(t)){t=Number(t);if(la<=t&&t<=fa)return t}return null},da=function(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw na("Exception was thrown by user callback.",t),e},Math.floor(0))}},ga=(va.prototype.getToken=function(n){var r=this;return this.appCheck?this.appCheck.getToken(n):new Promise(function(t,e){setTimeout(function(){r.appCheck?r.getToken(n).then(t,e):t(null)},0)})},va.prototype.addTokenChangeListener=function(e){var t;null!==(t=this.appCheckProvider)&&void 0!==t&&t.get().then(function(t){return t.addTokenListener(e)})},va.prototype.notifyForInvalidToken=function(){na('Provided AppCheck credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly.')},va);function va(t,e){var n=this;this.appName_=t,this.appCheckProvider=e,this.appCheck=null==e?void 0:e.getImmediate({optional:!0}),this.appCheck||null!=e&&e.get().then(function(t){return n.appCheck=t})}var ya=(ma.prototype.getToken=function(n){var r=this;return this.auth_?this.auth_.getToken(n).catch(function(t){return t&&"auth/token-not-initialized"===t.code?(Zs("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)}):new Promise(function(t,e){setTimeout(function(){r.auth_?r.getToken(n).then(t,e):t(null)},0)})},ma.prototype.addTokenChangeListener=function(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(function(t){return t.addAuthTokenListener(e)})},ma.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then(function(t){return t.removeAuthTokenListener(e)})},ma.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/.',na(t)},ma);function ma(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.onInit(function(t){return r.auth_=t})}var ba=(_a.prototype.getToken=function(t){return Promise.resolve({accessToken:this.accessToken})},_a.prototype.addTokenChangeListener=function(t){t(this.accessToken)},_a.prototype.removeTokenChangeListener=function(t){},_a.prototype.notifyForInvalidToken=function(){},_a.OWNER="owner",_a);function _a(t){this.accessToken=t}var wa=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Ta="websocket",Ia="long_polling",Ea=(Sa.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Sa.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(Sa.prototype,"host",{get:function(){return this._host},set:function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&zs.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),Sa.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},Sa.prototype.toURLString=function(){var t=this.secure?"https://":"http://",e=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return t+this.host+"/"+e},Sa);function Sa(t,e,n,r,i,o,s){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===s&&(s=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this._host=t.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=zs.get("host:"+t)||this._host}function ka(t,e,n){var r;if(io("string"==typeof e,"typeof type must == string"),io("object"==typeof n,"typeof params must == object"),e===Ta)r=(t.secure?"wss://":"ws://")+t.internalHost+"/.ws?";else{if(e!==Ia)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 aa(n,function(t,e){i.push(t+"="+e)}),r+i.join("&")}var Ca=(Aa.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),Do(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Aa.prototype.get=function(){return uo(this.counters_)},Aa);function Aa(){this.counters_={}}var Na={},Ra={};function Pa(t){t=t.toString();return Na[t]||(Na[t]=new Ca),Na[t]}var Oa=(Da.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},Da.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=function(){var e=i.pendingResponses[i.currentResponseNum];delete i.pendingResponses[i.currentResponseNum];for(var t=0;t<e.length;++t)!function(t){e[t]&&da(function(){n.onMessage_(e[t])})}(t);if(i.currentResponseNum===i.closeAfterResponse)return i.onClose&&(i.onClose(),i.onClose=null),"break";i.currentResponseNum++},i=this;this.pendingResponses[this.currentResponseNum];)if("break"===r())break},Da);function Da(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var xa="pLPCommand",La="pRTLPCB",Ma=(Fa.prototype.open=function(t,e){var n,r,i,s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Oa(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null},Math.floor(3e4)),n=function(){var t;s.isClosed_||(s.scriptTagHolder=new ja(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ji(t,5),r=n[0],i=n[1],o=n[2];if(n[3],n[4],s.incrementIncomingBytes_(t),s.scriptTagHolder)if(s.connectTimeoutTimer_&&(clearTimeout(s.connectTimeoutTimer_),s.connectTimeoutTimer_=null),s.everConnected_=!0,"start"===r)s.id=i,s.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(s.scriptTagHolder.sendNewPolls=!1,s.myPacketOrderer.closeAfter(i,function(){s.onClosed_()})):s.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Ji(t,2),r=n[0],n=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,n)},function(){s.onClosed_()},s.urlFn),(t={start:"t"}).ser=Math.floor(1e8*Math.random()),s.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=s.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",s.transportSessionId&&(t.s=s.transportSessionId),s.lastSessionId&&(t.ls=s.lastSessionId),s.applicationId&&(t.p=s.applicationId),s.appCheckToken&&(t.ac=s.appCheckToken),"undefined"!=typeof location&&location.hostname&&wa.test(location.hostname)&&(t.r="f"),t=s.urlFn(t),s.log_("Connecting via long-poll to "+t),s.scriptTagHolder.addTag(t,function(){}))},"complete"===document.readyState?n():(r=!1,i=function(){document.body?r||(r=!0,n()):setTimeout(i,Math.floor(10))},document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&i()}),window.attachEvent("onload",i)))},Fa.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},Fa.forceAllow=function(){Fa.forceAllow_=!0},Fa.forceDisallow=function(){Fa.forceDisallow_=!0},Fa.isAvailable=function(){return!!Fa.forceAllow_||!(Fa.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)},Fa.prototype.markConnectionHealthy=function(){},Fa.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)},Fa.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},Fa.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},Fa.prototype.send=function(t){t=Po(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var t=eo(t),e=Ws(t,1840),n=0;n<e.length;n++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,e.length,e[n]),this.curSegmentNum++},Fa.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)},Fa.prototype.incrementIncomingBytes_=function(t){t=Po(t).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},Fa);function Fa(t,e,n,r,i,o,s){var a=this;this.connId=t,this.repoInfo=e,this.applicationId=n,this.appCheckToken=r,this.authToken=i,this.transportSessionId=o,this.lastSessionId=s,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=ta(t),this.stats_=Pa(e),this.urlFn=function(t){return a.appCheckToken&&(t.ac=a.appCheckToken),ka(e,Ia,t)}}var ja=(Ua.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||Zs("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},Ua.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())},Ua.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},Ua.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 this.addLongPollTag_(t+=e,this.currentSerial),!0}return!1},Ua.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},Ua.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()})},Ua.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(){Zs("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}},Math.floor(1))},Ua);function Ua(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=Ys(),window[xa+this.uniqueCallbackIdentifier]=t,window[La+this.uniqueCallbackIdentifier]=e,this.myIFrame=Ua.createIFrame_();e="",e="<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(e),this.myIFrame.doc.close()}catch(t){Zs("frame writing exception"),t.stack&&Zs(t.stack),Zs(t)}}var qa=null;"undefined"!=typeof MozWebSocket?qa=MozWebSocket:"undefined"!=typeof WebSocket&&(qa=WebSocket);var Va=(Ba.connectionURL_=function(t,e,n,r){var i={v:"5"};return"undefined"!=typeof location&&location.hostname&&wa.test(location.hostname)&&(i.r="f"),e&&(i.s=e),n&&(i.ls=n),r&&(i.ac=r),ka(t,Ta,i)},Ba.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,zs.set("previous_websocket_failure",!0);try{bo()||(r={headers:{"X-Firebase-GMPID":this.applicationId||"","X-Firebase-AppCheck":this.appCheckToken||""}},this.mySock=new qa(this.connURL,[],r))}catch(t){this.log_("Error instantiating WebSocket.");var r=t.message||t.data;return r&&this.log_(r),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");t=t.message||t.data;t&&n.log_(t),n.onClosed_()}},Ba.prototype.start=function(){},Ba.forceDisallow=function(){Ba.forceDisallow_=!0},Ba.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!==qa&&!Ba.forceDisallow_},Ba.previouslyFailed=function(){return zs.isInMemoryStorage||!0===zs.get("previous_websocket_failure")},Ba.prototype.markConnectionHealthy=function(){zs.remove("previous_websocket_failure")},Ba.prototype.appendFrame_=function(t){this.frames.push(t),this.frames.length===this.totalFrames&&(t=this.frames.join(""),this.frames=null,t=Ro(t),this.onMessage(t))},Ba.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},Ba.prototype.extractFrameCount_=function(t){if(io(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},Ba.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))},Ba.prototype.send=function(t){this.resetKeepAlive();t=Po(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var e=Ws(t,16384);1<e.length&&this.sendString_(String(e.length));for(var n=0;n<e.length;n++)this.sendString_(e[n])},Ba.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},Ba.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},Ba.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},Ba.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},Ba.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)}},Ba.responsesRequiredToBeHealthy=2,Ba.healthyTimeout=3e4,Ba);function Ba(t,e,n,r,i,o,s){this.connId=t,this.applicationId=n,this.appCheckToken=r,this.authToken=i,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=ta(this.connId),this.stats_=Pa(e),this.connURL=Ba.connectionURL_(e,o,s,r),this.nodeAdmin=e.nodeAdmin}var Ka=(Object.defineProperty(Wa,"ALL_TRANSPORTS",{get:function(){return[Ma,Va]},enumerable:!1,configurable:!0}),Wa.prototype.initTransports_=function(t){var e,n,r=Va&&Va.isAvailable(),i=r&&!Va.previouslyFailed();if(t.webSocketOnly&&(r||na("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),i=!0),i)this.transports_=[Va];else{var o=this.transports_=[];try{for(var s=$i(Wa.ALL_TRANSPORTS),a=s.next();!a.done;a=s.next()){var u=a.value;u&&u.isAvailable()&&o.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}}},Wa.prototype.initialTransport=function(){if(0<this.transports_.length)return this.transports_[0];throw new Error("No transports available")},Wa.prototype.upgradeTransport=function(){return 1<this.transports_.length?this.transports_[1]:null},Wa);function Wa(t){this.initTransports_(t)}var Ha=(za.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));e=e.healthyTimeout||0;0<e&&(this.healthyTimeout_=ca(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&102400<t.conn_.bytesReceived?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes. Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&10240<t.conn_.bytesSent?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes. Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(e)))},za.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},za.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")}},za.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"))}},za.prototype.sendRequest=function(t){this.sendData_({t:"d",d:t})},za.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)},za.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_()))},za.prototype.onSecondaryMessageReceived_=function(t){var e=Ks("t",t),t=Ks("d",t);if("c"===e)this.onSecondaryControl_(t);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},za.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:{}}}))},za.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()},za.prototype.onPrimaryMessageReceived_=function(t){var e=Ks("t",t),t=Ks("d",t);"c"===e?this.onControl_(t):"d"===e&&this.onDataMessage_(t)},za.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},za.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},za.prototype.onControl_=function(t){var e=Ks("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?qs("Server Error: "+t):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):qs("Unknown control packet command: "+e)}},za.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&&na("Protocol version mismatch detected"),this.tryStartUpgrade_())},za.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},za.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,t),ca(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},za.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_())},za.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):ca(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},za.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},za.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},za.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()&&(zs.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},za.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()},za.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},za.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},za.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)},za);function za(t,e,n,r,i,o,s,a,u,c){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.appCheckToken_=r,this.authToken_=i,this.onMessage_=o,this.onReady_=s,this.onDisconnect_=a,this.onKill_=u,this.lastSessionId=c,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=ta("c:"+this.id+":"),this.transportManager_=new Ka(e),this.log_("Connection created"),this.start_()}Ga.prototype.put=function(t,e,n,r){},Ga.prototype.merge=function(t,e,n,r){},Ga.prototype.refreshAuthToken=function(t){},Ga.prototype.refreshAppCheckToken=function(t){},Ga.prototype.onDisconnectPut=function(t,e,n){},Ga.prototype.onDisconnectMerge=function(t,e,n){},Ga.prototype.onDisconnectCancel=function(t,e){},Ga.prototype.reportStats=function(t){},Q=Ga;function Ga(){}var Qa=(Ya.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=Zi([],Ji(this.listeners_[t])),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},Ya.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)},Ya.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)},Ya.prototype.validateEventType_=function(e){io(this.allowedEvents_.find(function(t){return t===e}),"Unknown event: "+e)},Ya);function Ya(t){this.allowedEvents_=t,this.listeners_={},io(Array.isArray(t)&&0<t.length,"Requires a non-empty array")}var Xa,$a=(Gi(Ja,Xa=Qa),Ja.getInstance=function(){return new Ja},Ja.prototype.getInitialEvent=function(t){return io("online"===t,"Unknown event type: "+t),[this.online_]},Ja.prototype.currentlyOnline=function(){return this.online_},Ja);function Ja(){var t=Xa.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||go()||(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 Za=32,tu=768,eu=(nu.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},nu);function nu(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 ru(){return new eu("")}function iu(t){return t.pieceNum_>=t.pieces_.length?null:t.pieces_[t.pieceNum_]}function ou(t){return t.pieces_.length-t.pieceNum_}function su(t){var e=t.pieceNum_;return e<t.pieces_.length&&e++,new eu(t.pieces_,e)}function au(t){return t.pieceNum_<t.pieces_.length?t.pieces_[t.pieces_.length-1]:null}function uu(t,e){return t.pieces_.slice(t.pieceNum_+(e=void 0===e?0:e))}function cu(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 eu(e,0)}function hu(t,e){for(var n=[],r=t.pieceNum_;r<t.pieces_.length;r++)n.push(t.pieces_[r]);if(e instanceof eu)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 eu(n,0)}function lu(t){return t.pieceNum_>=t.pieces_.length}function fu(t,e){var n=iu(t),r=iu(e);if(null===n)return e;if(n===r)return fu(su(t),su(e));throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")}function pu(t,e){for(var n=uu(t,0),r=uu(e,0),i=0;i<n.length&&i<r.length;i++){var o=oa(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1}function du(t,e){if(ou(t)!==ou(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 gu(t,e){var n=t.pieceNum_,r=e.pieceNum_;if(ou(t)>ou(e))return!1;for(;n<t.pieces_.length;){if(t.pieces_[n]!==e.pieces_[r])return!1;++n,++r}return!0}var vu=function(t,e){this.errorPrefix_=e,this.parts_=uu(t,0),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=Qo(this.parts_[n]);yu(this)};function yu(t){if(t.byteLength_>tu)throw new Error(t.errorPrefix_+"has a key path longer than "+tu+" bytes ("+t.byteLength_+").");if(t.parts_.length>Za)throw new Error(t.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Za+") or object contains a cycle "+mu(t))}function mu(t){return 0===t.parts_.length?"":"in property '"+t.parts_.join(".")+"'"}var bu,_u=(Gi(wu,bu=Qa),wu.getInstance=function(){return new wu},wu.prototype.getInitialEvent=function(t){return io("visible"===t,"Unknown event type: "+t),[this.visible_]},wu);function wu(){var e,t,n=bu.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 Tu,Iu=1e3,Eu=3e5,Su=(Gi(ku,Tu=Q),ku.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_(Po(e)),io(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&&(this.requestCBHash_[r]=n)},ku.prototype.get=function(t){var n=this;this.initConnection_();var r=new ho,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},ku.prototype.listen=function(t,e,n,r){this.initConnection_();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),io(t._queryParams.isDefault()||!t._queryParams.loadsAllData(),"listen() called for non-default but complete query"),io(!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)},ku.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)})},ku.prototype.sendListen_=function(r){var i=this,o=r.query,s=o._path.toString(),a=o._queryIdentifier;this.log_("Listen on "+s+" for "+a);var t={p:s};r.tag&&(t.q=o._queryObject,t.t=r.tag),t.h=r.hashFn(),this.sendRequest("q",t,function(t){var e=t.d,n=t.s;ku.warnOnListenWarnings_(e,o),(i.listens.get(s)&&i.listens.get(s).get(a))===r&&(i.log_("listen response",t),"ok"!==n&&i.removeListen_(s,a),r.onComplete&&r.onComplete(n,e))})},ku.warnOnListenWarnings_=function(t,e){t&&"object"==typeof t&&Do(t,"w")&&(t=xo(t,"w"),Array.isArray(t)&&~t.indexOf("no_index")&&(t='".indexOn": "'+e._queryParams.getIndex().toString()+'"',e=e._path.toString(),na("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.")))},ku.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)},ku.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)},ku.prototype.refreshAppCheckToken=function(t){this.appCheckToken_=t,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},function(){})},ku.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))}))},ku.prototype.tryAppCheck=function(){var n=this;this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},function(t){var e=t.s,t=t.d||"error";"ok"===e?n.invalidAppCheckTokenCount_=0:n.onAppCheckRevoked_(e,t)})},ku.prototype.unlisten=function(t,e){var n=t._path.toString(),r=t._queryIdentifier;this.log_("Unlisten called for "+n+" "+r),io(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)},ku.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)},ku.prototype.onDisconnectPut=function(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},ku.prototype.onDisconnectMerge=function(t,e,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},ku.prototype.onDisconnectCancel=function(t,e){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},ku.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))})},ku.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},ku.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},ku.prototype.putInternal=function(t,e,n,r,i){this.initConnection_();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)},ku.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)})},ku.prototype.reportStats=function(t){var e=this;this.connected_&&(this.log_("reportStats",t={c:t}),this.sendRequest("s",t,function(t){"ok"!==t.s&&(t=t.d,e.log_("reportStats","Error sending stats: "+t))}))},ku.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+Po(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)}},ku.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):"apc"===t?this.onAppCheckRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):qs("Unrecognized action received from server: "+Po(t)+"\nAre you using the latest client?")},ku.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)},ku.prototype.scheduleConnect_=function(t){var e=this;io(!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))},ku.prototype.initConnection_=function(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)},ku.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=Iu,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},ku.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=Iu,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},ku.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_=Iu),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)},ku.prototype.establishConnection_=function(){return Yi(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l=this;return Xi(this,function(t){switch(t.label){case 0:if(!this.shouldReconnect_())return[3,4];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+":"+ku.nextConnectionId_++,h=this.lastSessionId,o=!1,s=null,a=function(){s?s.close():(o=!0,r())},c=function(t){io(s,"sendRequest call when we're not connected not allowed."),s.sendRequest(t)},this.realtime_={close:a,sendRequest:c},u=this.forceTokenRefresh_,this.forceTokenRefresh_=!1,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,Promise.all([this.authTokenProvider_.getToken(u),this.appCheckTokenProvider_.getToken(u)])];case 2:return c=Ji.apply(void 0,[t.sent(),2]),u=c[0],c=c[1],o?Zs("getToken() completed but was canceled"):(Zs("getToken() completed. Creating connection."),this.authToken_=u&&u.accessToken,this.appCheckToken_=c&&c.token,s=new Ha(i,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,n,r,function(t){na(t+" ("+l.repoInfo_.toString()+")"),l.interrupt("server_kill")},h)),[3,4];case 3:return h=t.sent(),this.log_("Failed to get token: "+h),o||(this.repoInfo_.nodeAdmin&&na(h),a()),[3,4];case 4:return[2]}})})},ku.prototype.interrupt=function(t){Zs("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_())},ku.prototype.resume=function(t){Zs("Resuming connection for reason: "+t),delete this.interruptReasons_[t],Lo(this.interruptReasons_)&&(this.reconnectDelay_=Iu,this.realtime_||this.scheduleConnect_(0))},ku.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},ku.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_=[])},ku.prototype.onListenRevoked_=function(t,e){e=e?e.map(function(t){return sa(t)}).join("$"):"default",e=this.removeListen_(t,e);e&&e.onComplete&&e.onComplete("permission_denied")},ku.prototype.removeListen_=function(t,e){var n,r=new eu(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},ku.prototype.onAuthRevoked_=function(t,e){Zs("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()))},ku.prototype.onAppCheckRevoked_=function(t,e){Zs("App check token revoked: "+t+"/"+e),this.appCheckToken_=null,this.forceTokenRefresh_=!0,"invalid_token"!==t&&"permission_denied"!==t||(this.invalidAppCheckTokenCount_++,3<=this.invalidAppCheckTokenCount_&&this.appCheckTokenProvider_.notifyForInvalidToken())},ku.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},ku.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth(),this.tryAppCheck();try{for(var i=$i(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,$i(s.values())),u=a.next();!u.done;u=a.next()){var c=u.value;this.sendListen_(c)}}catch(t){n={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}for(var h=0;h<this.outstandingPuts_.length;h++)this.outstandingPuts_[h]&&this.sendPut_(h);for(;this.onDisconnectRequestQueue_.length;){var l=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(l.action,l.pathString,l.data,l.onComplete)}for(h=0;h<this.outstandingGets_.length;h++)this.outstandingGets_[h]&&this.sendGet_(h)},ku.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+Os.replace(/\./g,"-")]=1,go()?t["framework.cordova"]=1:mo()&&(t["framework.reactnative"]=1),this.reportStats(t)},ku.prototype.shouldReconnect_=function(){var t=$a.getInstance().currentlyOnline();return Lo(this.interruptReasons_)&&t},ku.nextPersistentConnectionId_=0,ku.nextConnectionId_=0,ku);function ku(t,e,n,r,i,o,s,a){var u=Tu.call(this)||this;if(u.repoInfo_=t,u.applicationId_=e,u.onDataUpdate_=n,u.onConnectStatus_=r,u.onServerInfoUpdate_=i,u.authTokenProvider_=o,u.appCheckTokenProvider_=s,u.authOverride_=a,u.id=ku.nextPersistentConnectionId_++,u.log_=ta("p:"+u.id+":"),u.interruptReasons_={},u.listens=new Map,u.outstandingPuts_=[],u.outstandingGets_=[],u.outstandingPutCount_=0,u.outstandingGetCount_=0,u.onDisconnectRequestQueue_=[],u.connected_=!1,u.reconnectDelay_=Iu,u.maxReconnectDelay_=Eu,u.securityDebugCallback_=null,u.lastSessionId=null,u.establishConnectionTimer_=null,u.visible_=!1,u.requestCBHash_={},u.requestNumber_=0,u.realtime_=null,u.authToken_=null,u.appCheckToken_=null,u.forceTokenRefresh_=!1,u.invalidAuthTokenCount_=0,u.invalidAppCheckTokenCount_=0,u.firstConnection_=!0,u.lastConnectionAttemptTime_=null,u.lastConnectionEstablishedTime_=null,a&&!bo())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return _u.getInstance().on("visible",u.onVisible_,u),-1===t.host.indexOf("fblocal")&&$a.getInstance().on("online",u.onOnline_,u),u}var Cu=(Au.Wrap=function(t,e){return new Au(t,e)},Au);function Au(t,e){this.name=t,this.node=e}var Nu,G=(Ru.prototype.getCompare=function(){return this.compare.bind(this)},Ru.prototype.indexedValueChanged=function(t,e){t=new Cu(ra,t),e=new Cu(ra,e);return 0!==this.compare(t,e)},Ru.prototype.minPost=function(){return Cu.MIN},Ru);function Ru(){}var Pu,fr=(Gi(Ou,Pu=G),Object.defineProperty(Ou,"__EMPTY_NODE",{get:function(){return Nu},set:function(t){Nu=t},enumerable:!1,configurable:!0}),Ou.prototype.compare=function(t,e){return oa(t.name,e.name)},Ou.prototype.isDefinedOn=function(t){throw oo("KeyIndex.isDefinedOn not expected to be called.")},Ou.prototype.indexedValueChanged=function(t,e){return!1},Ou.prototype.minPost=function(){return Cu.MIN},Ou.prototype.maxPost=function(){return new Cu(ia,Nu)},Ou.prototype.makePost=function(t,e){return io("string"==typeof t,"KeyIndex indexValue must always be a string."),new Cu(t,Nu)},Ou.prototype.toString=function(){return".key"},Ou);function Ou(){return null!==Pu&&Pu.apply(this,arguments)||this}var Du=new fr,xu=(Lu.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},Lu.prototype.hasNext=function(){return 0<this.nodeStack_.length},Lu.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}},Lu);function Lu(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 Mu=(Fu.prototype.copy=function(t,e,n,r,i){return new Fu(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)},Fu.prototype.count=function(){return this.left.count()+1+this.right.count()},Fu.prototype.isEmpty=function(){return!1},Fu.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},Fu.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},Fu.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},Fu.prototype.minKey=function(){return this.min_().key},Fu.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},Fu.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_()},Fu.prototype.removeMin_=function(){if(this.left.isEmpty())return qu.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_()},Fu.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 qu.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_()},Fu.prototype.isRed_=function(){return this.color},Fu.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},Fu.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},Fu.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t=t.left.left.isRed_()?(t=t.rotateRight_()).colorFlip_():t},Fu.prototype.rotateLeft_=function(){var t=this.copy(null,null,Fu.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},Fu.prototype.rotateRight_=function(){var t=this.copy(null,null,Fu.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},Fu.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)},Fu.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},Fu.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)},Fu.RED=!0,Fu.BLACK=!1,Fu);function Fu(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:Fu.RED,this.left=null!=r?r:qu.EMPTY_NODE,this.right=null!=i?i:qu.EMPTY_NODE}ju.prototype.copy=function(t,e,n,r,i){return this},ju.prototype.insert=function(t,e,n){return new Mu(t,e,null)},ju.prototype.remove=function(t,e){return this},ju.prototype.count=function(){return 0},ju.prototype.isEmpty=function(){return!0},ju.prototype.inorderTraversal=function(t){return!1},ju.prototype.reverseTraversal=function(t){return!1},ju.prototype.minKey=function(){return null},ju.prototype.maxKey=function(){return null},ju.prototype.check_=function(){return 0},ju.prototype.isRed_=function(){return!1},Qa=ju;function ju(){}var Uu,qu=(Vu.prototype.insert=function(t,e){return new Vu(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,Mu.BLACK,null,null))},Vu.prototype.remove=function(t){return new Vu(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,Mu.BLACK,null,null))},Vu.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},Vu.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?")},Vu.prototype.isEmpty=function(){return this.root_.isEmpty()},Vu.prototype.count=function(){return this.root_.count()},Vu.prototype.minKey=function(){return this.root_.minKey()},Vu.prototype.maxKey=function(){return this.root_.maxKey()},Vu.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},Vu.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},Vu.prototype.getIterator=function(t){return new xu(this.root_,null,this.comparator_,!1,t)},Vu.prototype.getIteratorFrom=function(t,e){return new xu(this.root_,t,this.comparator_,!1,e)},Vu.prototype.getReverseIteratorFrom=function(t,e){return new xu(this.root_,t,this.comparator_,!0,e)},Vu.prototype.getReverseIterator=function(t){return new xu(this.root_,null,this.comparator_,!0,t)},Vu.EMPTY_NODE=new Qa,Vu);function Vu(t,e){void 0===e&&(e=Vu.EMPTY_NODE),this.comparator_=t,this.root_=e}function Bu(t,e){return oa(t.name,e.name)}function Ku(t,e){return oa(t,e)}function Wu(t){return"number"==typeof t?"number:"+ua(t):"string:"+t}var Hu,zu,Gu,Qu,Yu=function(t){var e;t.isLeafNode()?(e=t.val(),io("string"==typeof e||"number"==typeof e||"object"==typeof e&&Do(e,".sv"),"Priority must be a string or number.")):io(t===Uu||t.isEmpty(),"priority of unexpected type."),io(t===Uu||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Xu=(Object.defineProperty($u,"__childrenNodeConstructor",{get:function(){return Hu},set:function(t){Hu=t},enumerable:!1,configurable:!0}),$u.prototype.isLeafNode=function(){return!0},$u.prototype.getPriority=function(){return this.priorityNode_},$u.prototype.updatePriority=function(t){return new $u(this.value_,t)},$u.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:$u.__childrenNodeConstructor.EMPTY_NODE},$u.prototype.getChild=function(t){return lu(t)?this:".priority"===iu(t)?this.priorityNode_:$u.__childrenNodeConstructor.EMPTY_NODE},$u.prototype.hasChild=function(){return!1},$u.prototype.getPredecessorChildName=function(t,e){return null},$u.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&&".priority"!==t?this:$u.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},$u.prototype.updateChild=function(t,e){var n=iu(t);return null===n?e:e.isEmpty()&&".priority"!==n?this:(io(".priority"!==n||1===ou(t),".priority must be the last token in a path"),this.updateImmediateChild(n,$u.__childrenNodeConstructor.EMPTY_NODE.updateChild(su(t),e)))},$u.prototype.isEmpty=function(){return!1},$u.prototype.numChildren=function(){return 0},$u.prototype.forEachChild=function(t,e){return!1},$u.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},$u.prototype.hash=function(){var t,e;return null===this.lazyHash_&&(t="",this.priorityNode_.isEmpty()||(t+="priority:"+Wu(this.priorityNode_.val())+":"),t+=(e=typeof this.value_)+":",t+="number"==e?ua(this.value_):this.value_,this.lazyHash_=js(t)),this.lazyHash_},$u.prototype.getValue=function(){return this.value_},$u.prototype.compareTo=function(t){return t===$u.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof $u.__childrenNodeConstructor?-1:(io(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},$u.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=$u.VALUE_TYPE_ORDER.indexOf(e),i=$u.VALUE_TYPE_ORDER.indexOf(n);return io(0<=r,"Unknown leaf type: "+e),io(0<=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_<t.value_?-1:this.value_===t.value_?0:1:i-r},$u.prototype.withIndex=function(){return this},$u.prototype.isIndexed=function(){return!0},$u.prototype.equals=function(t){return t===this||!!t.isLeafNode()&&(this.value_===t.value_&&this.priorityNode_.equals(t.priorityNode_))},$u.VALUE_TYPE_ORDER=["object","boolean","number","string"],$u);function $u(t,e){void 0===e&&(e=$u.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,io(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Yu(this.priorityNode_)}function Ju(){return null!==Qu&&Qu.apply(this,arguments)||this}var Zu=new(Gi(Ju,Qu=G),Ju.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),r=n.compareTo(r);return 0===r?oa(t.name,e.name):r},Ju.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Ju.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Ju.prototype.minPost=function(){return Cu.MIN},Ju.prototype.maxPost=function(){return new Cu(ia,new Xu("[PRIORITY-POST]",Gu))},Ju.prototype.makePost=function(t,e){t=zu(t);return new Cu(e,new Xu("[PRIORITY-POST]",t))},Ju.prototype.toString=function(){return".priority"},Ju),tc=Math.log(2),ec=(nc.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},nc);function nc(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/tc,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 rc,ic,oc=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 Mu(i,r.node,Mu.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 Mu(i,r.node,Mu.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 Mu(n,r.node,e,null,t))},o=function(t){e=e?e.left=t:n=t},s=0;s<t.count;++s){var a=t.nextBitIsOne(),u=Math.pow(2,t.count-(s+1));a?r(u,Mu.BLACK):(r(u,Mu.BLACK),r(u,Mu.RED))}return n}(new ec(c.length));return new qu(e||t,n)},sc={},ac=(Object.defineProperty(uc,"Default",{get:function(){return io(Zu,"ChildrenNode.ts has not been loaded"),rc=rc||new uc({".priority":sc},{".priority":Zu})},enumerable:!1,configurable:!0}),uc.prototype.get=function(t){var e=xo(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof qu?e:null},uc.prototype.hasIndex=function(t){return Do(this.indexSet_,t.toString())},uc.prototype.addIndex=function(t,e){io(t!==Du,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n=[],r=!1,i=e.getIterator(Cu.Wrap),o=i.getNext();o;)r=r||t.isDefinedOn(o.node),n.push(o),o=i.getNext();var s=r?oc(n,t.getCompare()):sc,a=t.toString(),u=Qi({},this.indexSet_);u[a]=t;e=Qi({},this.indexes_);return e[a]=s,new uc(e,u)},uc.prototype.addToIndexes=function(s,a){var u=this;return new uc(Mo(this.indexes_,function(t,e){var n=xo(u.indexSet_,e);if(io(n,"Missing index implementation for "+e),t===sc){if(n.isDefinedOn(s.node)){for(var r=[],i=a.getIterator(Cu.Wrap),o=i.getNext();o;)o.name!==s.name&&r.push(o),o=i.getNext();return r.push(s),oc(r,n.getCompare())}return sc}e=a.get(s.name),n=t;return(n=e?t.remove(new Cu(s.name,e)):n).insert(s,s.node)}),this.indexSet_)},uc.prototype.removeFromIndexes=function(n,r){return new uc(Mo(this.indexes_,function(t){if(t===sc)return t;var e=r.get(n.name);return e?t.remove(new Cu(n.name,e)):t}),this.indexSet_)},uc);function uc(t,e){this.indexes_=t,this.indexSet_=e}var cc,hc=(Object.defineProperty(lc,"EMPTY_NODE",{get:function(){return ic=ic||new lc(new qu(Ku),null,ac.Default)},enumerable:!1,configurable:!0}),lc.prototype.isLeafNode=function(){return!1},lc.prototype.getPriority=function(){return this.priorityNode_||ic},lc.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new lc(this.children_,t,this.indexMap_)},lc.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();t=this.children_.get(t);return null===t?ic:t},lc.prototype.getChild=function(t){var e=iu(t);return null===e?this:this.getImmediateChild(e).getChild(su(t))},lc.prototype.hasChild=function(t){return null!==this.children_.get(t)},lc.prototype.updateImmediateChild=function(t,e){if(io(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new Cu(t,e),r=void 0,i=void 0,i=e.isEmpty()?(r=this.children_.remove(t),this.indexMap_.removeFromIndexes(n,this.children_)):(r=this.children_.insert(t,e),this.indexMap_.addToIndexes(n,this.children_)),n=r.isEmpty()?ic:this.priorityNode_;return new lc(r,n,i)},lc.prototype.updateChild=function(t,e){var n=iu(t);if(null===n)return e;io(".priority"!==iu(t)||1===ou(t),".priority must be the last token in a path");e=this.getImmediateChild(n).updateChild(su(t),e);return this.updateImmediateChild(n,e)},lc.prototype.isEmpty=function(){return this.children_.isEmpty()},lc.prototype.numChildren=function(){return this.children_.count()},lc.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(Zu,function(t,e){r[t]=e.val(n),i++,s&&lc.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1}),!n&&s&&o<2*i){var t,e=[];for(t in r)e[t]=r[t];return e}return n&&!this.getPriority().isEmpty()&&(r[".priority"]=this.getPriority().val()),r},lc.prototype.hash=function(){var n;return null===this.lazyHash_&&(n="",this.getPriority().isEmpty()||(n+="priority:"+Wu(this.getPriority().val())+":"),this.forEachChild(Zu,function(t,e){e=e.hash();""!==e&&(n+=":"+t+":"+e)}),this.lazyHash_=""===n?"":js(n)),this.lazyHash_},lc.prototype.getPredecessorChildName=function(t,e,n){n=this.resolveIndex_(n);if(n){e=n.getPredecessorKey(new Cu(t,e));return e?e.name:null}return this.children_.getPredecessorKey(t)},lc.prototype.getFirstChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.minKey();return t&&t.name}return this.children_.minKey()},lc.prototype.getFirstChild=function(t){t=this.getFirstChildName(t);return t?new Cu(t,this.children_.get(t)):null},lc.prototype.getLastChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.maxKey();return t&&t.name}return this.children_.maxKey()},lc.prototype.getLastChild=function(t){t=this.getLastChildName(t);return t?new Cu(t,this.children_.get(t)):null},lc.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)},lc.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},lc.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,Cu.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},lc.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},lc.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,Cu.Wrap),i=r.peek();null!=i&&0<e.compare(i,t);)r.getNext(),i=r.peek();return r},lc.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===pc?-1:0},lc.prototype.withIndex=function(t){if(t===Du||this.indexMap_.hasIndex(t))return this;t=this.indexMap_.addIndex(t,this.children_);return new lc(this.children_,this.priorityNode_,t)},lc.prototype.isIndexed=function(t){return t===Du||this.indexMap_.hasIndex(t)},lc.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(Zu),n=t.getIterator(Zu),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},lc.prototype.resolveIndex_=function(t){return t===Du?null:this.indexMap_.get(t.toString())},lc.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,lc);function lc(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Yu(this.priorityNode_),this.children_.isEmpty()&&io(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function fc(){return cc.call(this,new qu(Ku),hc.EMPTY_NODE,ac.Default)||this}var pc=new(Gi(fc,cc=hc),fc.prototype.compareTo=function(t){return t===this?0:1},fc.prototype.equals=function(t){return t===this},fc.prototype.getPriority=function(){return this},fc.prototype.getImmediateChild=function(t){return hc.EMPTY_NODE},fc.prototype.isEmpty=function(){return!1},fc);Object.defineProperties(Cu,{MIN:{value:new Cu(ra,hc.EMPTY_NODE)},MAX:{value:new Cu(ia,pc)}}),fr.__EMPTY_NODE=hc.EMPTY_NODE,Xu.__childrenNodeConstructor=hc,Gu=Uu=pc;var dc=!0;function gc(n,t){if(void 0===t&&(t=null),null===n)return hc.EMPTY_NODE;if("object"==typeof n&&".priority"in n&&(t=n[".priority"]),io(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"!=typeof(n="object"==typeof n&&".value"in n&&null!==n[".value"]?n[".value"]:n)||".sv"in n)return new Xu(n,gc(t));if(n instanceof Array||!dc){var r=hc.EMPTY_NODE;return aa(n,function(t,e){Do(n,t)&&"."!==t.substring(0,1)&&(!(e=gc(e)).isLeafNode()&&e.isEmpty()||(r=r.updateImmediateChild(t,e)))}),r.updatePriority(gc(t))}var i=[],o=!1;if(aa(n,function(t,e){"."!==t.substring(0,1)&&((e=gc(e)).isEmpty()||(o=o||!e.getPriority().isEmpty(),i.push(new Cu(t,e))))}),0===i.length)return hc.EMPTY_NODE;var e=oc(i,Bu,function(t){return t.name},Ku);if(o){var s=oc(i,Zu.getCompare());return new hc(e,gc(t),new ac({".priority":s},{".priority":Zu}))}return new hc(e,gc(t),ac.Default)}zu=gc;var vc,yc,mc=(Gi(bc,vc=G),bc.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},bc.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},bc.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),r=n.compareTo(r);return 0===r?oa(t.name,e.name):r},bc.prototype.makePost=function(t,e){t=gc(t),t=hc.EMPTY_NODE.updateChild(this.indexPath_,t);return new Cu(e,t)},bc.prototype.maxPost=function(){var t=hc.EMPTY_NODE.updateChild(this.indexPath_,pc);return new Cu(ia,t)},bc.prototype.toString=function(){return uu(this.indexPath_,0).join("/")},bc);function bc(t){var e=vc.call(this)||this;return e.indexPath_=t,io(!lu(t)&&".priority"!==iu(t),"Can't create PathIndex with empty path or .priority key"),e}function _c(){return null!==yc&&yc.apply(this,arguments)||this}function wc(t){if(t===""+fa)return"-";var e=pa(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?ia:(e=n[i],e=kc.charAt(kc.indexOf(e)+1),n[i]=e,n.slice(0,i+1).join(""))}function Tc(t){if(t===""+la)return ra;var e=pa(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?""+fa:(delete n[n.length-1],n.join("")):(n[n.length-1]=kc.charAt(kc.indexOf(n[n.length-1])-1),n.join("")+"z".repeat(786-n.length))}var Ic,Ec,Sc=new(Gi(_c,yc=G),_c.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?oa(t.name,e.name):n},_c.prototype.isDefinedOn=function(t){return!0},_c.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},_c.prototype.minPost=function(){return Cu.MIN},_c.prototype.maxPost=function(){return Cu.MAX},_c.prototype.makePost=function(t,e){t=gc(t);return new Cu(e,t)},_c.prototype.toString=function(){return".value"},_c),kc="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",Cc=(Ic=0,Ec=[],function(t){var e=t===Ic;Ic=t;for(var n=new Array(8),r=7;0<=r;r--)n[r]=kc.charAt(t%64),t=Math.floor(t/64);io(0===t,"Cannot push at time == 0");var i=n.join("");if(e){for(r=11;0<=r&&63===Ec[r];r--)Ec[r]=0;Ec[r]++}else for(r=0;r<12;r++)Ec[r]=Math.floor(64*Math.random());for(r=0;r<12;r++)i+=kc.charAt(Ec[r]);return io(20===i.length,"nextPushId: Length should be 20."),i});function Ac(t){return{type:"value",snapshotNode:t}}function Nc(t,e){return{type:"child_added",snapshotNode:e,childName:t}}function Rc(t,e){return{type:"child_removed",snapshotNode:e,childName:t}}function Pc(t,e,n){return{type:"child_changed",snapshotNode:e,childName:t,oldSnap:n}}var Oc=(Dc.prototype.updateChild=function(t,e,n,r,i,o){io(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Rc(e,s)):io(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Nc(e,n)):o.trackChildChange(Pc(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},Dc.prototype.updateFullNode=function(r,n,i){return null!=i&&(r.isLeafNode()||r.forEachChild(Zu,function(t,e){n.hasChild(t)||i.trackChildChange(Rc(t,e))}),n.isLeafNode()||n.forEachChild(Zu,function(t,e){var n;r.hasChild(t)?(n=r.getImmediateChild(t)).equals(e)||i.trackChildChange(Pc(t,e,n)):i.trackChildChange(Nc(t,e))})),n.withIndex(this.index_)},Dc.prototype.updatePriority=function(t,e){return t.isEmpty()?hc.EMPTY_NODE:t.updatePriority(e)},Dc.prototype.filtersNodes=function(){return!1},Dc.prototype.getIndexedFilter=function(){return this},Dc.prototype.getIndex=function(){return this.index_},Dc);function Dc(t){this.index_=t}var xc=(Lc.prototype.getStartPost=function(){return this.startPost_},Lc.prototype.getEndPost=function(){return this.endPost_},Lc.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},Lc.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new Cu(e,n))||(n=hc.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Lc.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=hc.EMPTY_NODE);var r=(r=e.withIndex(this.index_)).updatePriority(hc.EMPTY_NODE),i=this;return e.forEachChild(Zu,function(t,e){i.matches(new Cu(t,e))||(r=r.updateImmediateChild(t,hc.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},Lc.prototype.updatePriority=function(t,e){return t},Lc.prototype.filtersNodes=function(){return!0},Lc.prototype.getIndexedFilter=function(){return this.indexedFilter_},Lc.prototype.getIndex=function(){return this.index_},Lc.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Lc.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Lc);function Lc(t){this.indexedFilter_=new Oc(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Lc.getStartPost_(t),this.endPost_=Lc.getEndPost_(t)}var Mc=(Fc.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new Cu(e,n))||(n=hc.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)},Fc.prototype.updateFullNode=function(t,e,n){if(e.isLeafNode()||e.isEmpty())r=hc.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){var r=hc.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 s=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),s)<=0:this.index_.compare(s,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(s.name,s.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(hc.EMPTY_NODE);var a,u=void 0,c=void 0,h=void 0,i=void 0;h=this.reverse_?(i=r.getReverseIterator(this.index_),u=this.rangedFilter_.getEndPost(),c=this.rangedFilter_.getStartPost(),a=this.index_.getCompare(),function(t,e){return a(e,t)}):(i=r.getIterator(this.index_),u=this.rangedFilter_.getStartPost(),c=this.rangedFilter_.getEndPost(),this.index_.getCompare());for(var o=0,l=!1;i.hasNext();){s=i.getNext();(l=!l&&h(u,s)<=0?!0:l)&&o<this.limit_&&h(s,c)<=0?o++:r=r.updateImmediateChild(s.name,hc.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},Fc.prototype.updatePriority=function(t,e){return t},Fc.prototype.filtersNodes=function(){return!0},Fc.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},Fc.prototype.getIndex=function(){return this.index_},Fc.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o,s;s=this.reverse_?(o=this.index_.getCompare(),function(t,e){return o(e,t)}):this.index_.getCompare();var a=t;io(a.numChildren()===this.limit_,"");var u=new Cu(e,n),c=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),h=this.rangedFilter_.matches(u);if(a.hasChild(e)){for(var l=a.getImmediateChild(e),f=r.getChildAfterChild(this.index_,c,this.reverse_);null!=f&&(f.name===e||a.hasChild(f.name));)f=r.getChildAfterChild(this.index_,f,this.reverse_);var p=null==f?1:s(f,u);if(h&&!n.isEmpty()&&0<=p)return null!=i&&i.trackChildChange(Pc(e,n,l)),a.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Rc(e,l));l=a.updateImmediateChild(e,hc.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Nc(f.name,f.node)),l.updateImmediateChild(f.name,f.node)):l}return!n.isEmpty()&&h&&0<=s(c,u)?(null!=i&&(i.trackChildChange(Rc(c.name,c.node)),i.trackChildChange(Nc(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(c.name,hc.EMPTY_NODE)):t},Fc);function Fc(t){this.rangedFilter_=new xc(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var jc=(Uc.prototype.hasStart=function(){return this.startSet_},Uc.prototype.hasStartAfter=function(){return this.startAfterSet_},Uc.prototype.hasEndBefore=function(){return this.endBeforeSet_},Uc.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_},Uc.prototype.getIndexStartValue=function(){return io(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},Uc.prototype.getIndexStartName=function(){return io(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:ra},Uc.prototype.hasEnd=function(){return this.endSet_},Uc.prototype.getIndexEndValue=function(){return io(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},Uc.prototype.getIndexEndName=function(){return io(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:ia},Uc.prototype.hasLimit=function(){return this.limitSet_},Uc.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},Uc.prototype.getLimit=function(){return io(this.limitSet_,"Only valid if limit has been set"),this.limit_},Uc.prototype.getIndex=function(){return this.index_},Uc.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},Uc.prototype.isDefault=function(){return this.loadsAllData()&&this.index_===Zu},Uc.prototype.copy=function(){var t=new Uc;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},Uc);function Uc(){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_=Zu}function qc(t,e,n){t=t.copy();return t.startSet_=!0,t.indexStartValue_=e=void 0===e?null:e,null!=n?(t.startNameSet_=!0,t.indexStartName_=n):(t.startNameSet_=!1,t.indexStartName_=""),t}function Vc(t,e,n){t=t.copy();return t.endSet_=!0,t.indexEndValue_=e=void 0===e?null:e,void 0!==n?(t.endNameSet_=!0,t.indexEndName_=n):(t.endNameSet_=!1,t.indexEndName_=""),t}function Bc(t,e){t=t.copy();return t.index_=e,t}function Kc(t){var e,n={};return t.isDefault()||(e=t.index_===Zu?"$priority":t.index_===Sc?"$value":t.index_===Du?"$key":(io(t.index_ instanceof mc,"Unrecognized index type!"),t.index_.toString()),n.orderBy=Po(e),t.startSet_&&(n.startAt=Po(t.indexStartValue_),t.startNameSet_&&(n.startAt+=","+Po(t.indexStartName_))),t.endSet_&&(n.endAt=Po(t.indexEndValue_),t.endNameSet_&&(n.endAt+=","+Po(t.indexEndName_))),t.limitSet_&&(t.isViewFromLeft()?n.limitToFirst=t.limit_:n.limitToLast=t.limit_)),n}function Wc(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_!==Zu&&(n.i=t.index_.toString()),n}var Hc,zc=(Gi(Gc,Hc=Q),Gc.prototype.reportStats=function(t){throw new Error("Method not implemented.")},Gc.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(io(t._queryParams.isDefault(),"should have a tag if it's not a default query."),t._path.toString())},Gc.prototype.listen=function(t,e,n,r){var i=this,o=t._path.toString();this.log_("Listen called for "+o+" "+t._queryIdentifier);var s=Gc.getListenId_(t,n),a={};this.listens_[s]=a;t=Kc(t._queryParams);this.restRequest_(o+".json",t,function(t,e){null===(t=404===t?e=null:t)&&i.onDataUpdate_(o,e,!1,n),xo(i.listens_,s)===a&&r(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)})},Gc.prototype.unlisten=function(t,e){e=Gc.getListenId_(t,e);delete this.listens_[e]},Gc.prototype.get=function(t){var n=this,e=Kc(t._queryParams),r=t._path.toString(),i=new ho;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},Gc.prototype.refreshAuthToken=function(t){},Gc.prototype.restRequest_=function(i,o,s){var a=this;return(o=void 0===o?{}:o).format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(function(t){var e=Ji(t,2),t=e[0],e=e[1];t&&t.accessToken&&(o.auth=t.accessToken),e&&e.token&&(o.ac=e.token);var n=(a.repoInfo_.secure?"https://":"http://")+a.repoInfo_.host+i+"?ns="+a.repoInfo_.namespace+Fo(o);a.log_("Sending REST request for "+n);var r=new XMLHttpRequest;r.onreadystatechange=function(){if(s&&4===r.readyState){a.log_("REST Response for "+n+" received. status:",r.status,"response:",r.responseText);var t=null;if(200<=r.status&&r.status<300){try{t=Ro(r.responseText)}catch(t){na("Failed to parse JSON response for "+n+": "+r.responseText)}s(null,t)}else 401!==r.status&&404!==r.status&&na("Got unsuccessful REST response for "+n+" Status: "+r.status),s(r.status);s=null}},r.open("GET",n,!0),r.send()})},Gc);function Gc(t,e,n,r){var i=Hc.call(this)||this;return i.repoInfo_=t,i.onDataUpdate_=e,i.authTokenProvider_=n,i.appCheckTokenProvider_=r,i.log_=ta("p:rest:"),i.listens_={},i}var Qc=(Yc.prototype.getNode=function(t){return this.rootNode_.getChild(t)},Yc.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},Yc);function Yc(){this.rootNode_=hc.EMPTY_NODE}function Xc(){return{value:null,children:new Map}}function $c(t,e,n){var r;lu(e)?(t.value=n,t.children.clear()):null!==t.value?t.value=t.value.updateChild(e,n):(r=iu(e),t.children.has(r)||t.children.set(r,Xc()),$c(t.children.get(r),e=su(e),n))}function Jc(t,n,r){var i;null!==t.value?r(n,t.value):(i=function(t,e){Jc(e,new eu(n.toString()+"/"+t),r)},t.children.forEach(function(t,e){i(e,t)}))}var Zc=(th.prototype.get=function(){var t=this.collection_.get(),n=Qi({},t);return this.last_&&aa(this.last_,function(t,e){n[t]=n[t]-e}),this.last_=t,n},th);function th(t){this.collection_=t,this.last_=null}var eh,nh=(rh.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;aa(t,function(t,e){0<e&&Do(n.statsToReport_,t)&&(r[t]=e,i=!0)}),i&&this.server_.reportStats(r),ca(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},rh);function rh(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Zc(t);t=1e4+2e4*Math.random();ca(this.reportStats_.bind(this),Math.floor(t))}function ih(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function oh(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function sh(t){return{fromUser:!1,fromServer:!0,queryId:t,tagged:!0}}(Qa=eh=eh||{})[Qa.OVERWRITE=0]="OVERWRITE",Qa[Qa.MERGE=1]="MERGE",Qa[Qa.ACK_USER_WRITE=2]="ACK_USER_WRITE",Qa[Qa.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var ah=(uh.prototype.operationForChild=function(t){if(lu(this.path)){if(null!=this.affectedTree.value)return io(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new eu(t));return new uh(ru(),e,this.revert)}return io(iu(this.path)===t,"operationForChild called for unrelated child."),new uh(su(this.path),this.affectedTree,this.revert)},uh);function uh(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=eh.ACK_USER_WRITE,this.source=ih()}var ch=(hh.prototype.operationForChild=function(t){return lu(this.path)?new hh(this.source,ru()):new hh(this.source,su(this.path))},hh);function hh(t,e){this.source=t,this.path=e,this.type=eh.LISTEN_COMPLETE}var lh=(fh.prototype.operationForChild=function(t){return lu(this.path)?new fh(this.source,ru(),this.snap.getImmediateChild(t)):new fh(this.source,su(this.path),this.snap)},fh);function fh(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=eh.OVERWRITE}var ph=(dh.prototype.operationForChild=function(t){if(lu(this.path)){var e=this.children.subtree(new eu(t));return e.isEmpty()?null:e.value?new lh(this.source,ru(),e.value):new dh(this.source,ru(),e)}return io(iu(this.path)===t,"Can't get a merge for a child not on the path of the operation"),new dh(this.source,su(this.path),this.children)},dh.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},dh);function dh(t,e,n){this.source=t,this.path=e,this.children=n,this.type=eh.MERGE}var gh=(vh.prototype.isFullyInitialized=function(){return this.fullyInitialized_},vh.prototype.isFiltered=function(){return this.filtered_},vh.prototype.isCompleteForPath=function(t){if(lu(t))return this.isFullyInitialized()&&!this.filtered_;t=iu(t);return this.isCompleteForChild(t)},vh.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},vh.prototype.getNode=function(){return this.node_},vh);function vh(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var yh,mh=function(t){this.query_=t,this.index_=this.query_._queryParams.getIndex()};function bh(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}))}),_h(n,i,"child_removed",t,r,e),_h(n,i,"child_added",t,r,e),_h(n,i,"child_moved",o,r,e),_h(n,i,"child_changed",t,r,e),_h(n,i,"value",t,r,e),i}function _h(o,s,e,t,a,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 oo("Should only compare child_ events.");e=new Cu(e.childName,e.snapshotNode),n=new Cu(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);a.forEach(function(t){t.respondsTo(e.type)&&s.push(t.createEvent(i,o.query_))})})}function wh(t,e){return{eventCache:t,serverCache:e}}function Th(t,e,n,r){return wh(new gh(e,n,r),t.serverCache)}function Ih(t,e,n,r){return wh(t.eventCache,new gh(e,n,r))}function Eh(t){return t.eventCache.isFullyInitialized()?t.eventCache.getNode():null}function Sh(t){return t.serverCache.isFullyInitialized()?t.serverCache.getNode():null}var kh=(Ch.fromObject=function(t){var n=new Ch(null);return aa(t,function(t,e){n=n.set(new eu(t),e)}),n},Ch.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},Ch.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:ru(),value:this.value};if(lu(t))return null;var n=iu(t),r=this.children.get(n);if(null===r)return null;e=r.findRootMostMatchingPathAndValue(su(t),e);return null==e?null:{path:hu(new eu(n),e.path),value:e.value}},Ch.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},Ch.prototype.subtree=function(t){if(lu(t))return this;var e=iu(t),e=this.children.get(e);return null!==e?e.subtree(su(t)):new Ch(null)},Ch.prototype.set=function(t,e){if(lu(t))return new Ch(e,this.children);var n=iu(t),e=(this.children.get(n)||new Ch(null)).set(su(t),e),e=this.children.insert(n,e);return new Ch(this.value,e)},Ch.prototype.remove=function(t){if(lu(t))return this.children.isEmpty()?new Ch(null):new Ch(null,this.children);var e=iu(t),n=this.children.get(e);if(n){n=n.remove(su(t)),t=void 0,t=n.isEmpty()?this.children.remove(e):this.children.insert(e,n);return null===this.value&&t.isEmpty()?new Ch(null):new Ch(this.value,t)}return this},Ch.prototype.get=function(t){if(lu(t))return this.value;var e=iu(t),e=this.children.get(e);return e?e.get(su(t)):null},Ch.prototype.setTree=function(t,e){if(lu(t))return e;var n=iu(t),t=(this.children.get(n)||new Ch(null)).setTree(su(t),e),e=void 0,e=t.isEmpty()?this.children.remove(n):this.children.insert(n,t);return new Ch(this.value,e)},Ch.prototype.fold=function(t){return this.fold_(ru(),t)},Ch.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal(function(t,e){i[t]=e.fold_(hu(n,t),r)}),r(n,this.value,i)},Ch.prototype.findOnPath=function(t,e){return this.findOnPath_(t,ru(),e)},Ch.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(lu(t))return null;var i=iu(t),r=this.children.get(i);return r?r.findOnPath_(su(t),hu(e,i),n):null},Ch.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,ru(),e)},Ch.prototype.foreachOnPath_=function(t,e,n){if(lu(t))return this;this.value&&n(e,this.value);var r=iu(t),i=this.children.get(r);return i?i.foreachOnPath_(su(t),hu(e,r),n):new Ch(null)},Ch.prototype.foreach=function(t){this.foreach_(ru(),t)},Ch.prototype.foreach_=function(n,r){this.children.inorderTraversal(function(t,e){e.foreach_(hu(n,t),r)}),this.value&&r(n,this.value)},Ch.prototype.foreachChild=function(n){this.children.inorderTraversal(function(t,e){e.value&&n(t,e.value)})},Ch);function Ch(t,e){void 0===e&&(e=yh=yh||new qu(Bs)),this.value=t,this.children=e}var Ah=(Nh.empty=function(){return new Nh(new kh(null))},Nh);function Nh(t){this.writeTree_=t}function Rh(t,e,n){if(lu(e))return new Ah(new kh(n));var r=t.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,r=fu(i,e),o=o.updateChild(r,n);return new Ah(t.writeTree_.set(i,o))}n=new kh(n),n=t.writeTree_.setTree(e,n);return new Ah(n)}function Ph(t,n,e){var r=t;return aa(e,function(t,e){r=Rh(r,hu(n,t),e)}),r}function Oh(t,e){if(lu(e))return Ah.empty();e=t.writeTree_.setTree(e,new kh(null));return new Ah(e)}function Dh(t,e){return null!=xh(t,e)}function xh(t,e){var n=t.writeTree_.findRootMostValueAndPath(e);return null!=n?t.writeTree_.get(n.path).getChild(fu(n.path,e)):null}function Lh(t){var n=[],e=t.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Zu,function(t,e){n.push(new Cu(t,e))}):t.writeTree_.children.inorderTraversal(function(t,e){null!=e.value&&n.push(new Cu(t,e.value))}),n}function Mh(t,e){if(lu(e))return t;var n=xh(t,e);return new Ah(null!=n?new kh(n):t.writeTree_.subtree(e))}function Fh(t){return t.writeTree_.isEmpty()}function jh(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?(io(null!==e.value,"Priority writes must always be leaf nodes"),o=e.value):i=n(hu(r,t),e,i)}),i=!i.getChild(r).isEmpty()&&null!==o?i.updateChild(hu(r,".priority"),o):i}}(ru(),t.writeTree_,e)}function Uh(t,e){return $h(e,t)}function qh(e,n){var t=e.allWrites.findIndex(function(t){return t.writeId===n});io(0<=t,"removeWrite called with nonexistent writeId.");var r=e.allWrites[t];e.allWrites.splice(t,1);for(var i,o=r.visible,s=!1,a=e.allWrites.length-1;o&&0<=a;){var u=e.allWrites[a];u.visible&&(t<=a&&function(t,e){{if(t.snap)return gu(t.path,e);for(var n in t.children)if(t.children.hasOwnProperty(n)&&gu(hu(t.path,n),e))return!0;return!1}}(u,r.path)?o=!1:gu(r.path,u.path)&&(s=!0)),a--}return!!o&&(s?((i=e).visibleWrites=Bh(i.allWrites,Vh,ru()),0<i.allWrites.length?i.lastWriteId=i.allWrites[i.allWrites.length-1].writeId:i.lastWriteId=-1):r.snap?e.visibleWrites=Oh(e.visibleWrites,r.path):aa(r.children,function(t){e.visibleWrites=Oh(e.visibleWrites,hu(r.path,t))}),!0)}function Vh(t){return t.visible}function Bh(t,e,n){for(var r=Ah.empty(),i=0;i<t.length;++i){var o=t[i];if(e(o)){var s=o.path,a=void 0;if(o.snap)gu(n,s)?r=Rh(r,a=fu(n,s),o.snap):gu(s,n)&&(a=fu(s,n),r=Rh(r,ru(),o.snap.getChild(a)));else{if(!o.children)throw oo("WriteRecord should have .snap or .children");gu(n,s)?r=Ph(r,a=fu(n,s),o.children):gu(s,n)&&(lu(a=fu(s,n))?r=Ph(r,ru(),o.children):(o=xo(o.children,iu(a)))&&(a=o.getChild(su(a)),r=Rh(r,ru(),a)))}}}return r}function Kh(t,e,n,r,i){if(r||i){var o=Mh(t.visibleWrites,e);if(!i&&Fh(o))return n;if(i||null!=n||Dh(o,ru()))return jh(Bh(t.allWrites,function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(gu(t.path,e)||gu(e,t.path))},e),n||hc.EMPTY_NODE);return null}o=xh(t.visibleWrites,e);if(null!=o)return o;t=Mh(t.visibleWrites,e);return Fh(t)?n:null!=n||Dh(t,ru())?jh(t,n||hc.EMPTY_NODE):null}function Wh(t,e,n,r){return Kh(t.writeTree,t.treePath,e,n,r)}function Hh(t,e){return function(t,e,n){var r=hc.EMPTY_NODE,i=xh(t.visibleWrites,e);if(i)return i.isLeafNode()||i.forEachChild(Zu,function(t,e){r=r.updateImmediateChild(t,e)}),r;if(n){var o=Mh(t.visibleWrites,e);return n.forEachChild(Zu,function(t,e){e=jh(Mh(o,new eu(t)),e);r=r.updateImmediateChild(t,e)}),Lh(o).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}return Lh(Mh(t.visibleWrites,e)).forEach(function(t){r=r.updateImmediateChild(t.name,t.node)}),r}(t.writeTree,t.treePath,e)}function zh(t,e,n,r){return i=t.writeTree,t=t.treePath,e=e,r=r,io(n||r,"Either existingEventSnap or existingServerSnap must exist"),t=hu(t,e),Dh(i.visibleWrites,t)?null:Fh(t=Mh(i.visibleWrites,t))?r.getChild(e):jh(t,r.getChild(e));var i}function Gh(t,e){return n=t.writeTree,e=hu(t.treePath,e),xh(n.visibleWrites,e);var n}function Qh(t,e,n,r,i,o){return function(t,e,n,r,i,o,s){var a,t=Mh(t.visibleWrites,e);if(null!=(e=xh(t,ru())))a=e;else{if(null==n)return[];a=jh(t,n)}if((a=a.withIndex(s)).isEmpty()||a.isLeafNode())return[];for(var u=[],c=s.getCompare(),h=o?a.getReverseIteratorFrom(r,s):a.getIteratorFrom(r,s),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 Yh(t,e,n){return r=t.writeTree,i=t.treePath,t=n,e=hu(i,n=e),null!=(i=xh(r.visibleWrites,e))?i:t.isCompleteForChild(n)?jh(Mh(r.visibleWrites,e),t.getNode().getImmediateChild(n)):null;var r,i}function Xh(t,e){return $h(hu(t.treePath,e),t.writeTree)}function $h(t,e){return{treePath:t,writeTree:e}}var Jh=(Zh.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;io("child_added"===e||"child_changed"===e||"child_removed"===e,"Only child changes supported for tracking"),io(".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,Pc(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,Rc(n,r.oldSnap));else if("child_changed"===e&&"child_added"===i)this.changeMap.set(n,Nc(n,t.snapshotNode));else{if("child_changed"!==e||"child_changed"!==i)throw oo("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Pc(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},Zh.prototype.getChanges=function(){return Array.from(this.changeMap.values())},Zh);function Zh(){this.changeMap=new Map}function tl(){}var el=new(tl.prototype.getCompleteChild=function(t){return null},tl.prototype.getChildAfterChild=function(t,e,n){return null},tl),nl=(rl.prototype.getCompleteChild=function(t){var e=this.viewCache_.eventCache;if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);e=null!=this.optCompleteServerCache_?new gh(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return Yh(this.writes_,t,e)},rl.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:Sh(this.viewCache_),t=Qh(this.writes_,r,e,1,n,t);return 0===t.length?null:t[0]},rl);function rl(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}function il(t,e,n,r,i){var o,s,a,u,c,h,l,f,p=new Jh;if(n.type===eh.OVERWRITE)var d=n,g=d.source.fromUser?al(t,e,d.path,d.snap,r,i,p):(io(d.source.fromServer,"Unknown source."),o=d.source.tagged||e.serverCache.isFiltered()&&!lu(d.path),sl(t,e,d.path,d.snap,r,i,o,p));else if(n.type===eh.MERGE){var v=n;g=v.source.fromUser?(s=t,a=e,u=v.path,d=v.children,c=r,h=i,l=p,f=a,d.foreach(function(t,e){t=hu(u,t);ul(a,iu(t))&&(f=al(s,f,t,e,c,h,l))}),d.foreach(function(t,e){t=hu(u,t);ul(a,iu(t))||(f=al(s,f,t,e,c,h,l))}),f):(io(v.source.fromServer,"Unknown source."),o=v.source.tagged||e.serverCache.isFiltered(),hl(t,e,v.path,v.children,r,i,o,p))}else if(n.type===eh.ACK_USER_WRITE){var y=n;g=y.revert?function(t,e,n,r,i,o){var s;{if(null!=Gh(r,n))return e;var a,u,c=new nl(r,e,i),h=e.eventCache.getNode(),i=void 0;return lu(n)||".priority"===iu(n)?(u=void 0,u=e.serverCache.isFullyInitialized()?Wh(r,Sh(e)):(a=e.serverCache.getNode(),io(a instanceof hc,"serverChildren would be complete if leaf node"),Hh(r,a)),i=t.filter.updateFullNode(h,u,o)):(a=iu(n),null==(u=Yh(r,a,e.serverCache))&&e.serverCache.isCompleteForChild(a)&&(u=h.getImmediateChild(a)),(i=null!=u?t.filter.updateChild(h,a,u,su(n),c,o):e.eventCache.getNode().hasChild(a)?t.filter.updateChild(h,a,hc.EMPTY_NODE,su(n),c,o):h).isEmpty()&&e.serverCache.isFullyInitialized()&&(s=Wh(r,Sh(e))).isLeafNode()&&(i=t.filter.updateFullNode(i,s,o))),s=e.serverCache.isFullyInitialized()||null!=Gh(r,ru()),Th(e,i,s,t.filter.filtersNodes())}}(t,e,y.path,r,i,p):function(t,e,r,n,i,o,s){if(null!=Gh(i,r))return e;var a=e.serverCache.isFiltered(),u=e.serverCache;{if(null!=n.value){if(lu(r)&&u.isFullyInitialized()||u.isCompleteForPath(r))return sl(t,e,r,u.getNode().getChild(r),i,o,a,s);if(lu(r)){var c=new kh(null);return u.getNode().forEachChild(Du,function(t,e){c=c.set(new eu(t),e)}),hl(t,e,r,c,i,o,a,s)}return e}var h=new kh(null);return n.foreach(function(t,e){var n=hu(r,t);u.isCompleteForPath(n)&&(h=h.set(t,u.getNode().getChild(n)))}),hl(t,e,r,h,i,o,a,s)}}(t,e,y.path,y.affectedTree,r,i,p)}else{if(n.type!==eh.LISTEN_COMPLETE)throw oo("Unknown operation type: "+n.type);y=t,i=n.path,t=r,n=p,r=Ih(e,(r=e.serverCache).getNode(),r.isFullyInitialized()||lu(i),r.isFiltered()),g=ol(y,r,i,t,el,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=Eh(t),(0<n.length||!t.eventCache.isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Ac(Eh(e))))}}(e,g,p),{viewCache:g,changes:p}}function ol(t,e,n,r,i,o){var s=e.eventCache;if(null!=Gh(r,n))return e;var a,u,c,h,l=void 0,f=void 0;return l=lu(n)?(io(e.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),e.serverCache.isFiltered()?(a=Hh(r,(a=Sh(e))instanceof hc?a:hc.EMPTY_NODE),t.filter.updateFullNode(e.eventCache.getNode(),a,o)):(u=Wh(r,Sh(e)),t.filter.updateFullNode(e.eventCache.getNode(),u,o))):".priority"===(u=iu(n))?(io(1===ou(n),"Can't have a priority with additional path components"),null!=(h=zh(r,n,c=s.getNode(),f=e.serverCache.getNode()))?t.filter.updatePriority(c,h):s.getNode()):(c=su(n),h=void 0,null!=(h=s.isCompleteForChild(u)?(f=e.serverCache.getNode(),null!=(f=zh(r,n,s.getNode(),f))?s.getNode().getImmediateChild(u).updateChild(c,f):s.getNode().getImmediateChild(u)):Yh(r,u,e.serverCache))?t.filter.updateChild(s.getNode(),u,h,c,i,o):s.getNode()),Th(e,l,s.isFullyInitialized()||lu(n),t.filter.filtersNodes())}function sl(t,e,n,r,i,o,s,a){var u=e.serverCache,c=s?t.filter:t.filter.getIndexedFilter();if(lu(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{s=iu(n);if(!u.isCompleteForPath(n)&&1<ou(n))return e;h=su(n),r=u.getNode().getImmediateChild(s).updateChild(h,r);l=".priority"===s?c.updatePriority(u.getNode(),r):c.updateChild(u.getNode(),s,r,h,el,null)}c=Ih(e,l,u.isFullyInitialized()||lu(n),c.filtersNodes());return ol(t,c,n,i,new nl(i,c,o),a)}function al(t,e,n,r,i,o,s){var a,u,c=e.eventCache,h=new nl(i,e,o);return lu(n)?(u=t.filter.updateFullNode(e.eventCache.getNode(),r,s),Th(e,u,!0,t.filter.filtersNodes())):".priority"===(a=iu(n))?(u=t.filter.updatePriority(e.eventCache.getNode(),r),Th(e,u,c.isFullyInitialized(),c.isFiltered())):(i=su(n),o=c.getNode().getImmediateChild(a),u=void 0,u=lu(i)?r:null!=(n=h.getCompleteChild(a))?".priority"===au(i)&&n.getChild(cu(i)).isEmpty()?n:n.updateChild(i,r):hc.EMPTY_NODE,o.equals(u)?e:Th(e,t.filter.updateChild(c.getNode(),a,u,i,h,s),c.isFullyInitialized(),t.filter.filtersNodes()))}function ul(t,e){return t.eventCache.isCompleteForChild(e)}function cl(t,n,e){return e.foreach(function(t,e){n=n.updateChild(t,e)}),n}function hl(r,i,t,e,o,s,a,u){if(i.serverCache.getNode().isEmpty()&&!i.serverCache.isFullyInitialized())return i;var c=i,e=lu(t)?e:new kh(null).setTree(t,e),h=i.serverCache.getNode();return e.children.inorderTraversal(function(t,e){h.hasChild(t)&&(e=cl(0,i.serverCache.getNode().getImmediateChild(t),e),c=sl(r,c,new eu(t),e,o,s,a,u))}),e.children.inorderTraversal(function(t,e){var n=!i.serverCache.isCompleteForChild(t)&&void 0===e.value;h.hasChild(t)||n||(e=cl(0,i.serverCache.getNode().getImmediateChild(t),e),c=sl(r,c,new eu(t),e,o,s,a,u))}),c}var ll,fl=(Object.defineProperty(pl.prototype,"query",{get:function(){return this.query_},enumerable:!1,configurable:!0}),pl);function pl(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_._queryParams,r=new Oc(n.getIndex()),i=(o=n).loadsAllData()?new Oc(o.getIndex()):new(o.hasLimit()?Mc:xc)(o);this.processor_={filter:i};var t=e.serverCache,n=e.eventCache,o=r.updateFullNode(hc.EMPTY_NODE,t.getNode(),null),e=i.updateFullNode(hc.EMPTY_NODE,n.getNode(),null),r=new gh(o,t.isFullyInitialized(),r.filtersNodes()),i=new gh(e,n.isFullyInitialized(),i.filtersNodes());this.viewCache_=wh(i,r),this.eventGenerator_=new mh(this.query_)}function dl(t){return 0===t.eventRegistrations_.length}function gl(t,e,n){var r,i=[];if(n&&(io(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=[],s=0;s<t.eventRegistrations_.length;++s){var a=t.eventRegistrations_[s];if(a.matches(e)){if(e.hasAnyCallback()){o=o.concat(t.eventRegistrations_.slice(s+1));break}}else o.push(a)}t.eventRegistrations_=o}else t.eventRegistrations_=[];return i}function vl(t,e,n,r){e.type===eh.MERGE&&null!==e.source.queryId&&(io(Sh(t.viewCache_),"We should always have a full cache before handling merges"),io(Eh(t.viewCache_),"Missing event cache, even though we have a server cache"));var i=t.viewCache_,e=il(t.processor_,i,e,n,r);return n=t.processor_,r=e.viewCache,io(r.eventCache.getNode().isIndexed(n.filter.getIndex()),"Event snap not indexed"),io(r.serverCache.getNode().isIndexed(n.filter.getIndex()),"Server snap not indexed"),io(e.viewCache.serverCache.isFullyInitialized()||!i.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),t.viewCache_=e.viewCache,yl(t,e.changes,e.viewCache.eventCache.getNode(),null)}function yl(t,e,n,r){r=r?[r]:t.eventRegistrations_;return bh(t.eventGenerator_,e,n,r)}var ml,bl=function(){this.views=new Map};function _l(t,e,n,r){var i,o,s=e.source.queryId;if(null!==s){var a=t.views.get(s);return io(null!=a,"SyncTree gave us an op for an invalid query."),vl(a,e,n,r)}var u=[];try{for(var c=$i(t.views.values()),h=c.next();!h.done;h=c.next())a=h.value,u=u.concat(vl(a,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 wl(t,e,n,r,i){var o=e._queryIdentifier,t=t.views.get(o);if(t)return t;o=Wh(n,i?r:null),t=!1,t=!!o||(o=r instanceof hc?Hh(n,r):hc.EMPTY_NODE,!1),i=wh(new gh(o,t,!1),new gh(r,i,!1));return new fl(e,i)}function Tl(t,e,n,r,i,o){var s,o=wl(t,e,r,i,o);return t.views.has(e._queryIdentifier)||t.views.set(e._queryIdentifier,o),o.eventRegistrations_.push(n),e=n,o=(n=o).viewCache_.eventCache,s=[],o.getNode().isLeafNode()||o.getNode().forEachChild(Zu,function(t,e){s.push(Nc(t,e))}),o.isFullyInitialized()&&s.push(Ac(o.getNode())),yl(n,s,o.getNode(),e)}function Il(t,e,n,r){var i,o,s=e._queryIdentifier,a=[],u=[],c=Al(t);if("default"===s)try{for(var h=$i(t.views.entries()),l=h.next();!l.done;l=h.next()){var f=Ji(l.value,2),p=f[0],d=f[1],u=u.concat(gl(d,n,r));dl(d)&&(t.views.delete(p),d.query._queryParams.loadsAllData()||a.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(s))&&(u=u.concat(gl(d,n,r)),dl(d)&&(t.views.delete(s),d.query._queryParams.loadsAllData()||a.push(d.query)));return c&&!Al(t)&&a.push((io(ll,"Reference.ts has not been loaded"),new ll(e._repo,e._path))),{removed:a,events:u}}function El(t){var e,n,r=[];try{for(var i=$i(t.views.values()),o=i.next();!o.done;o=i.next()){var s=o.value;s.query._queryParams.loadsAllData()||r.push(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 Sl(t,e){var n,r,i,o,s,a=null;try{for(var u=$i(t.views.values()),c=u.next();!c.done;c=u.next())var h=c.value,a=a||(o=e,s=void 0,(s=Sh((i=h).viewCache_))&&(i.query._queryParams.loadsAllData()||!lu(o)&&!s.getImmediateChild(iu(o)).isEmpty())?s.getChild(o):null)}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return a}function kl(t,e){if(e._queryParams.loadsAllData())return Nl(t);e=e._queryIdentifier;return t.views.get(e)}function Cl(t,e){return null!=kl(t,e)}function Al(t){return null!=Nl(t)}function Nl(t){var e,n;try{for(var r=$i(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 Rl=1,Pl=function(t){this.listenProvider_=t,this.syncPointTree_=new kh(null),this.pendingWriteTree_={visibleWrites:Ah.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map};function Ol(t,e,n,r,i){var o,s,a,u;return o=t.pendingWriteTree_,s=e,a=n,u=i,io((r=r)>o.lastWriteId,"Stacking an older write on top of newer ones"),o.allWrites.push({path:s,snap:a,writeId:r,visible:u=void 0===u?!0:u}),u&&(o.visibleWrites=Rh(o.visibleWrites,s,a)),o.lastWriteId=r,i?ql(t,new lh(ih(),e,n)):[]}function Dl(t,e,n,r){var i,o,s;i=t.pendingWriteTree_,o=e,s=n,io((r=r)>i.lastWriteId,"Stacking an older merge on top of newer ones"),i.allWrites.push({path:o,children:s,writeId:r,visible:!0}),i.visibleWrites=Ph(i.visibleWrites,o,s),i.lastWriteId=r;n=kh.fromObject(n);return ql(t,new ph(ih(),e,n))}function xl(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(qh(t.pendingWriteTree_,e)){var i=new kh(null);return null!=r.snap?i=i.set(ru(),!0):aa(r.children,function(t){i=i.set(new eu(t),!0)}),ql(t,new ah(r.path,i,n))}return[]}function Ll(t,e,n){return ql(t,new lh(oh(),e,n))}function Ml(n,t,e,r){var i=t._path,o=n.syncPointTree_.get(i),s=[];if(o&&("default"===t._queryIdentifier||Cl(o,t))){var a=Il(o,t,e,r);0===o.views.size&&(n.syncPointTree_=n.syncPointTree_.remove(i));e=a.removed,s=a.events,o=-1!==e.findIndex(function(t){return t._queryParams.loadsAllData()}),a=n.syncPointTree_.findOnPath(i,function(t,e){return Al(e)});if(o&&!a){i=n.syncPointTree_.subtree(i);if(!i.isEmpty())for(var u=i.fold(function(t,e,n){if(e&&Al(e))return[Nl(e)];var r=[];return e&&(r=El(e)),aa(n,function(t,e){r=r.concat(e)}),r}),c=0;c<u.length;++c){var h=u[c],l=h.query,h=Bl(n,h);n.listenProvider_.startListening(Ql(l),Kl(n,l),h.hashFn,h.onComplete)}}!a&&0<e.length&&!r&&(o?n.listenProvider_.stopListening(Ql(t),null):e.forEach(function(t){var e=n.queryToTagMap.get(Wl(t));n.listenProvider_.stopListening(Ql(t),e)})),function(t,e){for(var n=0;n<e.length;++n){var r,i=e[n];i._queryParams.loadsAllData()||(r=Wl(i),i=t.queryToTagMap.get(r),t.queryToTagMap.delete(r),t.tagToQueryMap.delete(i))}}(n,e)}return s}function Fl(t,e,n){var r=e._path,i=null,o=!1;t.syncPointTree_.foreachOnPath(r,function(t,e){t=fu(t,r);i=i||Sl(e,t),o=o||Al(e)});var s=t.syncPointTree_.get(r);s?(o=o||Al(s),i=i||Sl(s,ru())):(s=new bl,t.syncPointTree_=t.syncPointTree_.set(r,s)),null!=i?h=!0:(h=!1,i=hc.EMPTY_NODE,t.syncPointTree_.subtree(r).foreachChild(function(t,e){e=Sl(e,ru());e&&(i=i.updateImmediateChild(t,e))}));var a,u,c=Cl(s,e);c||e._queryParams.loadsAllData()||(a=Wl(e),io(!t.queryToTagMap.has(a),"View does not exist, but we have a tag"),u=Rl++,t.queryToTagMap.set(a,u),t.tagToQueryMap.set(u,a));var h=Tl(s,e,n,Uh(t.pendingWriteTree_,r),i,h);return c||o||(s=kl(s,e),h=h.concat(function(t,e,n){var r=e._path,i=Kl(t,e),n=Bl(t,n),n=t.listenProvider_.startListening(Ql(e),i,n.hashFn,n.onComplete),r=t.syncPointTree_.subtree(r);if(i)io(!Al(r.value),"If we're adding a query, it shouldn't be shadowed");else for(var o=r.fold(function(t,e,n){if(!lu(t)&&e&&Al(e))return[Nl(e).query];var r=[];return e&&(r=r.concat(El(e).map(function(t){return t.query}))),aa(n,function(t,e){r=r.concat(e)}),r}),s=0;s<o.length;++s){var a=o[s];t.listenProvider_.stopListening(Ql(a),Kl(t,a))}return n}(t,e,s))),h}function jl(t,n,e){var r=t.pendingWriteTree_,t=t.syncPointTree_.findOnPath(n,function(t,e){t=Sl(e,fu(t,n));if(t)return t});return Kh(r,n,t,e,!0)}function Ul(t,e){var n=e._path,r=null;t.syncPointTree_.foreachOnPath(n,function(t,e){t=fu(t,n);r=r||Sl(e,t)});var i=t.syncPointTree_.get(n);i?r=r||Sl(i,ru()):(i=new bl,t.syncPointTree_=t.syncPointTree_.set(n,i));var o=null!=r,s=o?new gh(r,!0,!1):null;return Eh(wl(i,e,Uh(t.pendingWriteTree_,e._path),o?s.getNode():hc.EMPTY_NODE,o).viewCache_)}function ql(t,e){return function t(e,n,r,i){{if(lu(e.path))return Vl(e,n,r,i);var o=n.get(ru());null==r&&null!=o&&(r=Sl(o,ru()));var s=[],a=iu(e.path),u=e.operationForChild(a),c=n.children.get(a);return c&&u&&(n=r?r.getImmediateChild(a):null,a=Xh(i,a),s=s.concat(t(u,c,n,a))),s=o?s.concat(_l(o,e,i,r)):s}}(e,t.syncPointTree_,null,Uh(t.pendingWriteTree_,ru()))}function Vl(i,t,o,s){var e=t.get(ru());null==o&&null!=e&&(o=Sl(e,ru()));var a=[];return t.children.inorderTraversal(function(t,e){var n=o?o.getImmediateChild(t):null,r=Xh(s,t),t=i.operationForChild(t);t&&(a=a.concat(Vl(t,e,n,r)))}),a=e?a.concat(_l(e,i,s,o)):a}function Bl(n,t){var r=t.query,i=Kl(n,r);return{hashFn:function(){return(t.viewCache_.serverCache.getNode()||hc.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return i?function(t,e,n){var r=Hl(t,n);if(r){n=zl(r),r=n.path,n=n.queryId,e=fu(r,e);return Gl(t,r,new ch(sh(n),e))}return[]}(n,r._path,i):(e=r._path,ql(n,new ch(oh(),e)));var e,e=(e="Unknown Error","too_big"===(t=t)?e="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?e="Client doesn't have permission to access the desired data.":"unavailable"===t&&(e="The service is unavailable"),(e=new Error(t+" at "+r._path.toString()+": "+e)).code=t.toUpperCase(),e);return Ml(n,r,null,e)}}}function Kl(t,e){e=Wl(e);return t.queryToTagMap.get(e)}function Wl(t){return t._path.toString()+"$"+t._queryIdentifier}function Hl(t,e){return t.tagToQueryMap.get(e)}function zl(t){var e=t.indexOf("$");return io(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new eu(t.substr(0,e))}}function Gl(t,e,n){var r=t.syncPointTree_.get(e);return io(r,"Missing sync point for query tag that we're tracking"),_l(r,n,Uh(t.pendingWriteTree_,e),null)}function Ql(t){return t._queryParams.loadsAllData()&&!t._queryParams.isDefault()?(io(ml,"Reference.ts has not been loaded"),new ml(t._repo,t._path)):t}var Yl=(Xl.prototype.getImmediateChild=function(t){return new Xl(this.node_.getImmediateChild(t))},Xl.prototype.node=function(){return this.node_},Xl);function Xl(t){this.node_=t}var $l=(Zl.prototype.getImmediateChild=function(t){t=hu(this.path_,t);return new Zl(this.syncTree_,t)},Zl.prototype.node=function(){return jl(this.syncTree_,this.path_)},Zl);function Zl(t,e){this.syncTree_=t,this.path_=e}var tf=function(t){return(t=t||{}).timestamp=t.timestamp||(new Date).getTime(),t},ef=function(t,e,n){return t&&"object"==typeof t?(io(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?nf(t[".sv"],e,n):"object"==typeof t[".sv"]?rf(t[".sv"],e):void io(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},nf=function(t,e,n){if("timestamp"===t)return n.timestamp;io(!1,"Unexpected server value: "+t)},rf=function(t,e,n){t.hasOwnProperty("increment")||io(!1,"Unexpected server value: "+JSON.stringify(t,null,2));t=t.increment;"number"!=typeof t&&io(!1,"Unexpected increment value: "+t);e=e.node();if(io(null!=e,"Expected ChildrenNode.EMPTY_NODE for nulls"),!e.isLeafNode())return t;e=e.getValue();return"number"!=typeof e?t:e+t},of=function(t,e,n,r){return af(e,new $l(n,t),r)},sf=function(t,e,n){return af(t,new Yl(e),n)};function af(t,r,i){var e=t.getPriority().val(),n=ef(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var o=t,e=ef(o.getValue(),r,i);return e!==o.getValue()||n!==o.getPriority().val()?new Xu(e,gc(n)):t}var t=t,s=t;return n!==t.getPriority().val()&&(s=s.updatePriority(new Xu(n))),t.forEachChild(Zu,function(t,e){var n=af(e,r.getImmediateChild(t),i);n!==e&&(s=s.updateImmediateChild(t,n))}),s}var uf=function(t,e,n){void 0===e&&(e=null),void 0===n&&(n={children:{},childCount:0}),this.name=t=void 0===t?"":t,this.parent=e,this.node=n};function cf(t,e){for(var n=e instanceof eu?e:new eu(e),r=t,i=iu(n);null!==i;)var o=xo(r.node.children,i)||{children:{},childCount:0},r=new uf(i,r,o),i=iu(n=su(n));return r}function hf(t){return t.node.value}function lf(t,e){t.node.value=e,gf(t)}function ff(t){return 0<t.node.childCount}function pf(n,r){aa(n.node.children,function(t,e){r(new uf(t,n,e))})}function df(t){return new eu(null===t.parent?t.name:df(t.parent)+"/"+t.name)}function gf(t){var e,n,r,i;null!==t.parent&&(e=t.parent,n=t.name,i=function(t){return void 0===hf(t)&&!ff(t)}(r=t),t=Do(e.node.children,n),i&&t?(delete e.node.children[n],e.node.childCount--,gf(e)):i||t||(e.node.children[n]=r.node,e.node.childCount++,gf(e)))}function vf(t){return"string"==typeof t&&0!==t.length&&!wf.test(t)}function yf(t){return"string"==typeof t&&0!==t.length&&!Tf.test(t)}function mf(t,e,n,r){if(!r||void 0!==e){var i=Ho(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=[];aa(e,function(t,e){t=new eu(t);if(kf(i,e,hu(n,t)),".priority"===au(t)&&!Ef(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=uu(r=e[n]),o=0;o<i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&&!vf(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(pu);var s=null;for(n=0;n<e.length;n++){if(r=e[n],null!==s&&gu(s,r))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+r.toString());s=r}}(i,o)}}function bf(t,e,n){if(!n||void 0!==e){if(Vs(e))throw new Error(Ho(t,"priority")+"is "+e.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Ef(e))throw new Error(Ho(t,"priority")+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function _f(t,e,n,r){if(!(r&&void 0===n||vf(n)))throw new Error(Ho(t,e)+'was an invalid key = "'+n+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}var wf=/[\[\].#$\/\u0000-\u001F\u007F]/,Tf=/[\[\].#$\u0000-\u001F\u007F]/,If=10485760,Ef=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!Vs(t)||t&&"object"==typeof t&&Do(t,".sv")},Sf=function(t,e,n,r){r&&void 0===e||kf(Ho(t,"value"),e,n)},kf=function(r,t,e){var i=e instanceof eu?new vu(e,r):e;if(void 0===t)throw new Error(r+"contains undefined "+mu(i));if("function"==typeof t)throw new Error(r+"contains a function "+mu(i)+" with contents = "+t.toString());if(Vs(t))throw new Error(r+"contains "+t.toString()+" "+mu(i));if("string"==typeof t&&t.length>If/3&&Qo(t)>If)throw new Error(r+"contains a string greater than "+If+" utf8 bytes "+mu(i)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var o=!1,s=!1;if(aa(t,function(t,e){if(".value"===t)o=!0;else if(".priority"!==t&&".sv"!==t&&(s=!0,!vf(t)))throw new Error(r+" contains an invalid key ("+t+") "+mu(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_+=Qo(n),yu(t),kf(r,e,i),e=(t=i).parts_.pop(),t.byteLength_-=Qo(e),0<t.parts_.length&&--t.byteLength_}),o&&s)throw new Error(r+' contains ".value" child '+mu(i)+" in addition to actual children.")}},Cf=function(t,e,n,r){if(!(r&&void 0===n||yf(n)))throw new Error(Ho(t,e)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},Af=function(t,e,n,r){n=n&&n.replace(/^\/*\.info(\/|$)/,"/"),Cf(t,e,n,r)},Nf=function(t,e){if(".info"===iu(e))throw new Error(t+" failed = Can't modify data under /.info/")},Rf=function(t,e){var n=e.path.toString();if("string"!=typeof e.repoInfo.host||0===e.repoInfo.host.length||!vf(e.repoInfo.namespace)&&"localhost"!==e.repoInfo.host.split(":")[0]||0!==n.length&&(n=(n=n)&&n.replace(/^\/*\.info(\/|$)/,"/"),!yf(n)))throw new Error(Ho(t,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},Pf=function(){this.eventLists_=[],this.recursionDepth_=0};function Of(t,e){for(var n=null,r=0;r<e.length;r++){var i=e[r],o=i.getPath();null===n||du(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 Df(t,e,n){Of(t,n),Lf(t,function(t){return du(t,e)})}function xf(t,e,n){Of(t,n),Lf(t,function(t){return gu(t,e)||gu(e,t)})}function Lf(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(),$s&&Zs("event: "+r.toString()),da(n))}}(t.eventLists_[r]),t.eventLists_[r]=null):n=!1)}n&&(t.eventLists_=[]),t.recursionDepth_--}var Mf="repo_interrupt",Ff=25,jf=(Uf.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},Uf);function Uf(t,e,n,r){this.repoInfo_=t,this.forceRestClient_=e,this.authTokenProvider_=n,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Pf,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=Xc(),this.transactionQueueTree_=new uf,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}function qf(s,t,e){if(s.stats_=Pa(s.repoInfo_),s.forceRestClient_||0<=("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))s.server_=new zc(s.repoInfo_,function(t,e,n,r){Kf(s,t,e,n,r)},s.authTokenProvider_,s.appCheckProvider_),setTimeout(function(){return Wf(s,!0)},0);else{if(null!=e){if("object"!=typeof e)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{Po(e)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}s.persistentConnection_=new Su(s.repoInfo_,t,function(t,e,n,r){Kf(s,t,e,n,r)},function(t){Wf(s,t)},function(t){var n;n=s,aa(t,function(t,e){Hf(n,t,e)})},s.authTokenProvider_,s.appCheckProvider_,e),s.server_=s.persistentConnection_}s.authTokenProvider_.addTokenChangeListener(function(t){s.server_.refreshAuthToken(t)}),s.appCheckProvider_.addTokenChangeListener(function(t){s.server_.refreshAppCheckToken(t.token)}),s.statsReporter_=(t=s.repoInfo_,e=function(){return new nh(s.stats_,s.server_)},t=t.toString(),Ra[t]||(Ra[t]=e()),Ra[t]),s.infoData_=new Qc,s.infoSyncTree_=new Pl({startListening:function(t,e,n,r){var i=[],o=s.infoData_.getNode(t._path);return o.isEmpty()||(i=Ll(s.infoSyncTree_,t._path,o),setTimeout(function(){r("ok")},0)),i},stopListening:function(){}}),Hf(s,"connected",!1),s.serverSyncTree_=new Pl({startListening:function(n,t,e,r){return s.server_.listen(n,e,t,function(t,e){e=r(t,e);xf(s.eventQueue_,n._path,e)}),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})}function Vf(t){t=t.infoData_.getNode(new eu(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t}function Bf(t){return tf({timestamp:Vf(t)})}function Kf(t,e,n,r,i){t.dataUpdateCount++;var o=new eu(e);n=t.interceptServerDataCallback_?t.interceptServerDataCallback_(e,n):n;var s,a,u,c,h=[],e=o;0<(h=i?r?(s=Mo(n,function(t){return gc(t)}),function(t,e,n,r){var i=Hl(t,r);if(i){r=zl(i),i=r.path,r=r.queryId,e=fu(i,e),n=kh.fromObject(n);return Gl(t,i,new ph(sh(r),e,n))}return[]}(t.serverSyncTree_,o,s,i)):(c=gc(n),s=t.serverSyncTree_,a=o,u=c,null==(i=Hl(s,c=i))?[]:(c=zl(i),i=c.path,c=c.queryId,a=fu(i,a),Gl(s,i,new lh(sh(c),a,u)))):r?(c=Mo(n,function(t){return gc(t)}),a=t.serverSyncTree_,u=o,r=c,r=kh.fromObject(c),ql(a,new ph(oh(),u,r))):(n=gc(n),Ll(t.serverSyncTree_,o,n))).length&&(e=np(t,o)),xf(t.eventQueue_,e,h)}function Wf(t,e){Hf(t,"connected",e),!1===e&&function(n){Jf(n,"onDisconnectEvents");var r=Bf(n),i=Xc();Jc(n.onDisconnect_,ru(),function(t,e){e=of(t,e,n.serverSyncTree_,r);$c(i,t,e)});var o=[];Jc(i,ru(),function(t,e){o=o.concat(Ll(n.serverSyncTree_,t,e));t=sp(n,t);np(n,t)}),n.onDisconnect_=Xc(),xf(n.eventQueue_,ru(),o)}(t)}function Hf(t,e,n){e=new eu("/.info/"+e),n=gc(n);t.infoData_.updateSnapshot(e,n);n=Ll(t.infoSyncTree_,e,n);xf(t.eventQueue_,e,n)}function zf(t){return t.nextWriteId_++}function Gf(r,i,t,e,o){Jf(r,"set",{path:i.toString(),value:t,priority:e});var n=Bf(r),t=gc(t,e),e=jl(r.serverSyncTree_,i),n=sf(t,e,n),s=zf(r),n=Ol(r.serverSyncTree_,i,n,s,!0);Of(r.eventQueue_,n),r.server_.put(i.toString(),t.val(!0),function(t,e){var n="ok"===t;n||na("set at "+i+" failed: "+t);n=xl(r.serverSyncTree_,s,!n);xf(r.eventQueue_,i,n),Zf(0,o,t,e)});t=sp(r,i);np(r,t),xf(r.eventQueue_,t,[])}function Qf(n,r,i){n.server_.onDisconnectCancel(r.toString(),function(t,e){"ok"===t&&!function t(n,e){if(lu(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(Zu,function(t,e){$c(n,new eu(t),e)}),t(n,e)}if(0<n.children.size)return r=iu(e),e=su(e),n.children.has(r)&&t(n.children.get(r),e)&&n.children.delete(r),0===n.children.size;return!0}(n.onDisconnect_,r),Zf(0,i,t,e)})}function Yf(n,r,t,i){var o=gc(t);n.server_.onDisconnectPut(r.toString(),o.val(!0),function(t,e){"ok"===t&&$c(n.onDisconnect_,r,o),Zf(0,i,t,e)})}function Xf(t,e,n){n=".info"===iu(e._path)?Ml(t.infoSyncTree_,e,n):Ml(t.serverSyncTree_,e,n);Df(t.eventQueue_,e._path,n)}function $f(t){t.persistentConnection_&&t.persistentConnection_.interrupt(Mf)}function Jf(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];var r="";t.persistentConnection_&&(r=t.persistentConnection_.id+":"),Zs.apply(void 0,Zi([r],Ji(e)))}function Zf(t,n,r,i){n&&da(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 tp(t,e,n){return jl(t.serverSyncTree_,e,n)||hc.EMPTY_NODE}function ep(e,t){var n;(t=void 0===t?e.transactionQueueTree_:t)||op(e,t),hf(t)?(n=ip(e,t),io(0<n.length,"Sending zero length transaction queue"),n.every(function(t){return 0===t.status})&&function(i,o,s){for(var t=s.map(function(t){return t.currentWriteId}),e=tp(i,o,t),n=e,t=e.hash(),r=0;r<s.length;r++){var a=s[r];io(0===a.status,"tryToSendTransactionQueue_: items in queue should all be run."),a.status=1,a.retryCount++;var u=fu(o,a.path);n=n.updateChild(u,a.currentOutputSnapshotRaw)}var e=n.val(!0),c=o;i.server_.put(c.toString(),e,function(t){Jf(i,"transaction put response",{path:c.toString(),status:t});var e=[];if("ok"===t){for(var n=[],r=0;r<s.length;r++)!function(t){s[t].status=2,e=e.concat(xl(i.serverSyncTree_,s[t].currentWriteId)),s[t].onComplete&&n.push(function(){return s[t].onComplete(null,!0,s[t].currentOutputSnapshotResolved)}),s[t].unwatcher()}(r);op(i,cf(i.transactionQueueTree_,o)),ep(i,i.transactionQueueTree_),xf(i.eventQueue_,o,e);for(r=0;r<n.length;r++)da(n[r])}else{if("datastale"===t)for(r=0;r<s.length;r++)3===s[r].status?s[r].status=4:s[r].status=0;else{na("transaction at "+c.toString()+" failed: "+t);for(r=0;r<s.length;r++)s[r].status=4,s[r].abortReason=t}np(i,o)}},t)}(e,df(t),n)):ff(t)&&pf(t,function(t){ep(e,t)})}function np(t,e){var n=rp(t,e),e=df(n);return function(u,c,h){if(0!==c.length){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],s=fu(h,o.path),a=!1;io(null!==s,"rerunTransactionsUnderNode_: relativePath should not be null."),4===o.status?(e=o.abortReason,f=f.concat(xl(u.serverSyncTree_,o.currentWriteId,a=!0))):0===o.status&&(f=o.retryCount>=Ff?(e="maxretry",f.concat(xl(u.serverSyncTree_,o.currentWriteId,a=!0))):(n=tp(u,o.path,p),o.currentInputSnapshot=n,void 0!==(i=c[t].update(n.val()))?(kf("transaction failed: Data returned ",i,o.path),r=gc(i),"object"==typeof i&&null!=i&&Do(i,".priority")||(r=r.updatePriority(n.getPriority())),s=o.currentWriteId,i=Bf(u),i=sf(r,n,i),o.currentOutputSnapshotRaw=r,o.currentOutputSnapshotResolved=i,o.currentWriteId=zf(u),p.splice(p.indexOf(s),1),(f=f.concat(Ol(u.serverSyncTree_,o.path,i,o.currentWriteId,o.applyLocally))).concat(xl(u.serverSyncTree_,s,!0))):(e="nodata",f.concat(xl(u.serverSyncTree_,o.currentWriteId,a=!0))))),xf(u.eventQueue_,h,f),f=[],a&&(c[t].status=2,a=c[t].unwatcher,setTimeout(a,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);op(u,u.transactionQueueTree_);for(t=0;t<l.length;t++)da(l[t]);ep(u,u.transactionQueueTree_)}}(t,ip(t,n),e),e}function rp(t,e){for(var n=t.transactionQueueTree_,r=iu(e);null!==r&&void 0===hf(n);)n=cf(n,r),r=iu(e=su(e));return n}function ip(t,e){var n=[];return function e(n,t,r){var i=hf(t);if(i)for(var o=0;o<i.length;o++)r.push(i[o]);pf(t,function(t){e(n,t,r)})}(t,e,n),n.sort(function(t,e){return t.order-e.order}),n}function op(e,t){var n=hf(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,lf(t,0<n.length?n:void 0)}pf(t,function(t){op(e,t)})}function sp(e,t){var n=df(rp(e,t)),t=cf(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){ap(e,t)}),ap(e,t),function e(t,n,r,i){r&&!i&&n(t),pf(t,function(t){e(t,n,!0,i)}),r&&i&&n(t)}(t,function(t){ap(e,t)}),n}function ap(t,e){var n=hf(e);if(n){for(var r=[],i=[],o=-1,s=0;s<n.length;s++)3===n[s].status||(1===n[s].status?(io(o===s-1,"All SENT items should be at beginning of queue."),n[o=s].status=3,n[s].abortReason="set"):(io(0===n[s].status,"Unexpected transaction status in abort"),n[s].unwatcher(),i=i.concat(xl(t.serverSyncTree_,n[s].currentWriteId,!0)),n[s].onComplete&&r.push(n[s].onComplete.bind(null,new Error("set"),!1,null))));-1===o?lf(e,void 0):n.length=o+1,xf(t.eventQueue_,df(e),i);for(s=0;s<r.length;s++)da(r[s])}}var up=function(t,e){var n=cp(t),r=n.namespace;"firebase.com"===n.domain&&ea(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||ea("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:")&&na("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 Ea(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new eu(n.pathString)}},cp=function(t){var e,n,r,i="",o="",s="",a="",u="",c=!0,h="https",l=443;return"string"==typeof t&&(0<=(r=t.indexOf("//"))&&(h=t.substring(0,r-1),t=t.substring(r+2)),-1===(e=t.indexOf("/"))&&(e=t.length),-1===(n=t.indexOf("?"))&&(n=t.length),i=t.substring(0,Math.min(e,n)),e<n&&(a=function(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(0<n[r].length){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(e,n))),n=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=$i(t.split("&")),o=i.next();!o.done;o=i.next()){var s,a=o.value;0!==a.length&&(2===(s=a.split("=")).length?r[decodeURIComponent(s[0])]=decodeURIComponent(s[1]):na("Invalid query segment '"+a+"' in query '"+t+"'"))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,n))),0<=(r=i.indexOf(":"))?(c="https"===h||"wss"===h,l=parseInt(i.substring(r+1),10)):r=i.length,"localhost"===(r=i.slice(0,r)).toLowerCase()?o="localhost":r.split(".").length<=2?o=r:(r=i.indexOf("."),s=i.substring(0,r).toLowerCase(),o=i.substring(r+1),u=s),"ns"in n&&(u=n.ns)),{host:i,port:l,domain:o,subdomain:s,secure:c,scheme:h,pathString:a,namespace:u}},hp=(lp.prototype.getPath=function(){var t=this.snapshot.ref;return("value"===this.eventType?t:t.parent)._path},lp.prototype.getEventType=function(){return this.eventType},lp.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},lp.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+Po(this.snapshot.exportVal())},lp);function lp(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var fp=(pp.prototype.getPath=function(){return this.path},pp.prototype.getEventType=function(){return"cancel"},pp.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},pp.prototype.toString=function(){return this.path.toString()+":cancel"},pp);function pp(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var dp=(gp.prototype.onValue=function(t,e){this.snapshotCallback.call(null,t,e)},gp.prototype.onCancel=function(t){return io(this.hasCancelCallback,"Raising a cancel event on a listener with no cancel callback"),this.cancelCallback.call(null,t)},Object.defineProperty(gp.prototype,"hasCancelCallback",{get:function(){return!!this.cancelCallback},enumerable:!1,configurable:!0}),gp.prototype.matches=function(t){return this.snapshotCallback===t.snapshotCallback||void 0!==this.snapshotCallback.userCallback&&this.snapshotCallback.userCallback===t.snapshotCallback.userCallback&&this.snapshotCallback.context===t.snapshotCallback.context},gp);function gp(t,e){this.snapshotCallback=t,this.cancelCallback=e}var vp=(yp.prototype.cancel=function(){var t=new ho;return Qf(this._repo,this._path,t.wrapCallback(function(){})),t.promise},yp.prototype.remove=function(){Nf("OnDisconnect.remove",this._path);var t=new ho;return Yf(this._repo,this._path,null,t.wrapCallback(function(){})),t.promise},yp.prototype.set=function(t){Nf("OnDisconnect.set",this._path),Sf("OnDisconnect.set",t,this._path,!1);var e=new ho;return Yf(this._repo,this._path,t,e.wrapCallback(function(){})),e.promise},yp.prototype.setWithPriority=function(t,e){Nf("OnDisconnect.setWithPriority",this._path),Sf("OnDisconnect.setWithPriority",t,this._path,!1),bf("OnDisconnect.setWithPriority",e,!1);var n,r,i,o,s=new ho;return n=this._repo,r=this._path,t=t,e=e,i=s.wrapCallback(function(){}),o=gc(t,e),n.server_.onDisconnectPut(r.toString(),o.val(!0),function(t,e){"ok"===t&&$c(n.onDisconnect_,r,o),Zf(0,i,t,e)}),s.promise},yp.prototype.update=function(t){Nf("OnDisconnect.update",this._path),mf("OnDisconnect.update",t,this._path,!1);var e=new ho;return function(n,r,i,o){if(Lo(i))return Zs("onDisconnect().update() called with empty data. Don't do anything."),Zf(0,o,"ok",void 0);n.server_.onDisconnectMerge(r.toString(),i,function(t,e){"ok"===t&&aa(i,function(t,e){e=gc(e);$c(n.onDisconnect_,hu(r,t),e)}),Zf(0,o,t,e)})}(this._repo,this._path,t,e.wrapCallback(function(){})),e.promise},yp);function yp(t,e){this._repo=t,this._path=e}var mp=(Object.defineProperty(bp.prototype,"key",{get:function(){return lu(this._path)?null:au(this._path)},enumerable:!1,configurable:!0}),Object.defineProperty(bp.prototype,"ref",{get:function(){return new Ep(this._repo,this._path)},enumerable:!1,configurable:!0}),Object.defineProperty(bp.prototype,"_queryIdentifier",{get:function(){var t=Wc(this._queryParams),t=sa(t);return"{}"===t?"default":t},enumerable:!1,configurable:!0}),Object.defineProperty(bp.prototype,"_queryObject",{get:function(){return Wc(this._queryParams)},enumerable:!1,configurable:!0}),bp.prototype.isEqual=function(t){if(!((t=ts(t))instanceof bp))return!1;var e=this._repo===t._repo,n=du(this._path,t._path),t=this._queryIdentifier===t._queryIdentifier;return e&&n&&t},bp.prototype.toJSON=function(){return this.toString()},bp.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)},bp);function bp(t,e,n,r){this._repo=t,this._path=e,this._queryParams=n,this._orderByCalled=r}function _p(t,e){if(!0===t._orderByCalled)throw new Error(e+": You can't combine multiple orderBy calls.")}function wp(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===Du){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()!==ra)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==ia)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Zu){if(null!=e&&!Ef(e)||null!=n&&!Ef(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(io(t.getIndex()instanceof mc||t.getIndex()===Sc,"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 Tp(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 Ip,Ep=(Gi(Sp,Ip=mp),Object.defineProperty(Sp.prototype,"parent",{get:function(){var t=cu(this._path);return null===t?null:new Sp(this._repo,t)},enumerable:!1,configurable:!0}),Object.defineProperty(Sp.prototype,"root",{get:function(){for(var t=this;null!==t.parent;)t=t.parent;return t},enumerable:!1,configurable:!0}),Sp);function Sp(t,e){return Ip.call(this,t,e,new jc,!1)||this}var kp=(Object.defineProperty(Cp.prototype,"priority",{get:function(){return this._node.getPriority().val()},enumerable:!1,configurable:!0}),Object.defineProperty(Cp.prototype,"key",{get:function(){return this.ref.key},enumerable:!1,configurable:!0}),Object.defineProperty(Cp.prototype,"size",{get:function(){return this._node.numChildren()},enumerable:!1,configurable:!0}),Cp.prototype.child=function(t){var e=new eu(t),t=Rp(this.ref,t);return new Cp(this._node.getChild(e),t,Zu)},Cp.prototype.exists=function(){return!this._node.isEmpty()},Cp.prototype.exportVal=function(){return this._node.val(!0)},Cp.prototype.forEach=function(n){var r=this;return!this._node.isLeafNode()&&!!this._node.forEachChild(this._index,function(t,e){return n(new Cp(e,Rp(r.ref,t),Zu))})},Cp.prototype.hasChild=function(t){t=new eu(t);return!this._node.getChild(t).isEmpty()},Cp.prototype.hasChildren=function(){return!this._node.isLeafNode()&&!this._node.isEmpty()},Cp.prototype.toJSON=function(){return this.exportVal()},Cp.prototype.val=function(){return this._node.val()},Cp);function Cp(t,e,n){this._node=t,this.ref=e,this._index=n}function Ap(t,e){return(t=ts(t))._checkNotDeleted("ref"),void 0!==e?Rp(t._root,e):t._root}function Np(t,e){(t=ts(t))._checkNotDeleted("refFromURL");var n=up(e,t._repo.repoInfo_.nodeAdmin);Rf("refFromURL",n);e=n.repoInfo;return t._repo.repoInfo_.isCustomHost()||e.host===t._repo.repoInfo_.host||ea("refFromURL: Host name does not match the current database: (found "+e.host+" but expected "+t._repo.repoInfo_.host+")"),Ap(t,n.path.toString())}function Rp(t,e){return(null===iu((t=ts(t))._path)?Af:Cf)("child","path",e,!1),new Ep(t._repo,hu(t._path,e))}function Pp(t,e){t=ts(t),Nf("set",t._path),Sf("set",e,t._path,!1);var n=new ho;return Gf(t._repo,t._path,e,null,n.wrapCallback(function(){})),n.promise}function Op(t,e){mf("update",e,t._path,!1);var n=new ho;return function(i,o,t,s){Jf(i,"update",{path:o.toString(),value:t});var a,e,n=!0,r=Bf(i),u={};aa(t,function(t,e){n=!1,u[t]=of(hu(o,t),gc(e),i.serverSyncTree_,r)}),n?(Zs("update() called with empty data. Don't do anything."),Zf(0,s,"ok",void 0)):(a=zf(i),e=Dl(i.serverSyncTree_,o,u,a),Of(i.eventQueue_,e),i.server_.merge(o.toString(),t,function(t,e){var n="ok"===t;n||na("update at "+o+" failed: "+t);var r=xl(i.serverSyncTree_,a,!n),n=0<r.length?np(i,o):o;xf(i.eventQueue_,n,r),Zf(0,s,t,e)}),aa(t,function(t){t=sp(i,hu(o,t));np(i,t)}),xf(i.eventQueue_,o,[]))}(t._repo,t._path,e,n.wrapCallback(function(){})),n.promise}function Dp(e){return e=ts(e),n=e._repo,r=e,(null!=(t=Ul(n.serverSyncTree_,r))?Promise.resolve(t):n.server_.get(r).then(function(t){var e=gc(t).withIndex(r._queryParams.getIndex()),t=Ll(n.serverSyncTree_,r._path,e);return Df(n.eventQueue_,r._path,t),Promise.resolve(e)},function(t){return Jf(n,"get for query "+Po(r)+" failed: "+t),Promise.reject(new Error(t))})).then(function(t){return new kp(t,new Ep(e._repo,e._path),e._queryParams.getIndex())});var n,r,t}var xp=(Lp.prototype.respondsTo=function(t){return"value"===t},Lp.prototype.createEvent=function(t,e){var n=e._queryParams.getIndex();return new hp("value",this,new kp(t.snapshotNode,new Ep(e._repo,e._path),n))},Lp.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)}},Lp.prototype.createCancelEvent=function(t,e){return this.callbackContext.hasCancelCallback?new fp(this,t,e):null},Lp.prototype.matches=function(t){return t instanceof Lp&&(!t.callbackContext||!this.callbackContext||t.callbackContext.matches(this.callbackContext))},Lp.prototype.hasAnyCallback=function(){return null!==this.callbackContext},Lp);function Lp(t){this.callbackContext=t}var Mp=(Fp.prototype.respondsTo=function(t){t="children_added"===t?"child_added":t;return this.eventType===(t="children_removed"===t?"child_removed":t)},Fp.prototype.createCancelEvent=function(t,e){return this.callbackContext.hasCancelCallback?new fp(this,t,e):null},Fp.prototype.createEvent=function(t,e){io(null!=t.childName,"Child events should have a childName.");var n=Rp(new Ep(e._repo,e._path),t.childName),e=e._queryParams.getIndex();return new hp(t.type,this,new kp(t.snapshotNode,n,e),t.prevName)},Fp.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,t.prevName)}},Fp.prototype.matches=function(t){return t instanceof Fp&&(this.eventType===t.eventType&&(!this.callbackContext||!t.callbackContext||this.callbackContext.matches(t.callbackContext)))},Fp.prototype.hasAnyCallback=function(){return!!this.callbackContext},Fp);function Fp(t,e){this.eventType=t,this.callbackContext=e}function jp(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){Xf(n._repo,n,a),o(t,e)}).userCallback=(o=e).userCallback,i.context=e.context,e=i);var s,e=new dp(e,s||void 0),a="value"===t?new xp(e):new Mp(t,e);return s=n._repo,t=a,t=".info"===iu((e=n)._path)?Fl(s.infoSyncTree_,e,t):Fl(s.serverSyncTree_,e,t),Df(s.eventQueue_,e._path,t),function(){return Xf(n._repo,n,a)}}function Up(t,e,n,r){return jp(t,"value",e,n,r)}function qp(t,e,n,r){return jp(t,"child_added",e,n,r)}function Vp(t,e,n,r){return jp(t,"child_changed",e,n,r)}function Bp(t,e,n,r){return jp(t,"child_moved",e,n,r)}function Kp(t,e,n,r){return jp(t,"child_removed",e,n,r)}function Wp(t,e,n){var r=null,n=n?new dp(n):null;"value"===e?r=new xp(n):e&&(r=new Mp(e,n)),Xf(t._repo,t,r)}var Hp,fr=function(){},zp=(Gi(Gp,Hp=fr),Gp.prototype._apply=function(t){Sf("endAt",this._value,t._path,!0);var e=Vc(t._queryParams,this._value,this._key);if(Tp(e),wp(e),t._queryParams.hasEnd())throw new Error("endAt: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new mp(t._repo,t._path,e,t._orderByCalled)},Gp);function Gp(t,e){var n=Hp.call(this)||this;return n._value=t,n._key=e,n}var Qp,Yp=(Gi(Xp,Qp=fr),Xp.prototype._apply=function(t){Sf("endBefore",this._value,t._path,!1);var e,n,r,r=(e=t._queryParams,n=this._value,r=this._key,(r=e.index_===Du?Vc(e,n="string"==typeof n?Tc(n):n,r):Vc(e,n,null==r?ra:Tc(r))).endBeforeSet_=!0,r);if(Tp(r),wp(r),t._queryParams.hasEnd())throw new Error("endBefore: Starting point was already set (by another call to endAt, endBefore or equalTo).");return new mp(t._repo,t._path,r,t._orderByCalled)},Xp);function Xp(t,e){var n=Qp.call(this)||this;return n._value=t,n._key=e,n}var $p,Jp=(Gi(Zp,$p=fr),Zp.prototype._apply=function(t){Sf("startAt",this._value,t._path,!0);var e=qc(t._queryParams,this._value,this._key);if(Tp(e),wp(e),t._queryParams.hasStart())throw new Error("startAt: Starting point was already set (by another call to startAt, startBefore or equalTo).");return new mp(t._repo,t._path,e,t._orderByCalled)},Zp);function Zp(t,e){var n=$p.call(this)||this;return n._value=t,n._key=e,n}var td,ed=(Gi(nd,td=fr),nd.prototype._apply=function(t){Sf("startAfter",this._value,t._path,!1);var e,n,r,r=(e=t._queryParams,n=this._value,r=this._key,(r=e.index_===Du?qc(e,n="string"==typeof n?wc(n):n,r):qc(e,n,null==r?ia:wc(r))).startAfterSet_=!0,r);if(Tp(r),wp(r),t._queryParams.hasStart())throw new Error("startAfter: Starting point was already set (by another call to startAt, startAfter, or equalTo).");return new mp(t._repo,t._path,r,t._orderByCalled)},nd);function nd(t,e){var n=td.call(this)||this;return n._value=t,n._key=e,n}var rd,id=(Gi(od,rd=fr),od.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 mp(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},od);function od(t){var e=rd.call(this)||this;return e._limit=t,e}var sd,ad=(Gi(ud,sd=fr),ud.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 mp(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},ud);function ud(t){var e=sd.call(this)||this;return e._limit=t,e}var cd,hd=(Gi(ld,cd=fr),ld.prototype._apply=function(t){_p(t,"orderByChild");var e=new eu(this._path);if(lu(e))throw new Error("orderByChild: cannot pass in empty path. Use orderByValue() instead.");e=new mc(e),e=Bc(t._queryParams,e);return wp(e),new mp(t._repo,t._path,e,!0)},ld);function ld(t){var e=cd.call(this)||this;return e._path=t,e}var fd,pd=(Gi(dd,fd=fr),dd.prototype._apply=function(t){_p(t,"orderByKey");var e=Bc(t._queryParams,Du);return wp(e),new mp(t._repo,t._path,e,!0)},dd);function dd(){return null!==fd&&fd.apply(this,arguments)||this}var gd,vd=(Gi(yd,gd=fr),yd.prototype._apply=function(t){_p(t,"orderByPriority");var e=Bc(t._queryParams,Zu);return wp(e),new mp(t._repo,t._path,e,!0)},yd);function yd(){return null!==gd&&gd.apply(this,arguments)||this}var md,bd=(Gi(_d,md=fr),_d.prototype._apply=function(t){_p(t,"orderByValue");var e=Bc(t._queryParams,Sc);return wp(e),new mp(t._repo,t._path,e,!0)},_d);function _d(){return null!==md&&md.apply(this,arguments)||this}var wd,Td,Id,Ed=(Gi(Sd,wd=fr),Sd.prototype._apply=function(t){if(Sf("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 zp(this._value,this._key)._apply(new Jp(this._value,this._key)._apply(t))},Sd);function Sd(t,e){var n=wd.call(this)||this;return n._value=t,n._key=e,n}function kd(t){for(var e,n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var o=ts(t);try{for(var s=$i(r),a=s.next();!a.done;a=s.next())o=a.value._apply(o)}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return o}Td=Ep,io(!ll,"__referenceConstructor has already been defined"),ll=Td,Id=Ep,io(!ml,"__referenceConstructor has already been defined"),ml=Id;var Cd="FIREBASE_DATABASE_EMULATOR_HOST",Ad={},Nd=!1;function Rd(t,e,n,r,i){var o=r||t.options.databaseURL;void 0===o&&(t.options.projectId||ea("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),Zs("Using default host for project ",t.options.projectId),o=t.options.projectId+"-default-rtdb.firebaseio.com");var s,a=up(o,i),u=a.repoInfo,r=void 0;(r="undefined"!=typeof process?process.env[Cd]:r)?(s=!0,o="http://"+r+"?ns="+u.namespace,u=(a=up(o,i)).repoInfo):s=!a.repoInfo.secure;e=i&&s?new ba(ba.OWNER):new ya(t.name,t.options,e);Rf("Invalid Firebase Database URL",a),lu(a.path)||ea("Database URL must point to the root of a Firebase Database (not including a child path).");n=function(t,e,n,r){var i=Ad[e.name];i||(i={},Ad[e.name]=i);(e=i[t.toURLString()])&&ea("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call.");return e=new jf(t,Nd,n,r),i[t.toURLString()]=e}(u,t,e,new ga(t.name,n));return new Pd(n,t)}var Pd=(Object.defineProperty(Od.prototype,"_repo",{get:function(){return this._instanceStarted||(qf(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal},enumerable:!1,configurable:!0}),Object.defineProperty(Od.prototype,"_root",{get:function(){return this._rootInternal||(this._rootInternal=new Ep(this._repo,ru())),this._rootInternal},enumerable:!1,configurable:!0}),Od.prototype._delete=function(){var t,e,n;return null!==this._rootInternal&&(t=this._repo,e=this.app.name,(n=Ad[e])&&n[t.key]===t||ea("Database "+e+"("+t.repoInfo_+") has already been deleted."),$f(t),delete n[t.key],this._repoInternal=null,this._rootInternal=null),Promise.resolve()},Od.prototype._checkNotDeleted=function(t){null===this._rootInternal&&ea("Cannot call "+t+" on a deleted database.")},Od);function Od(t,e){this._repoInternal=t,this.app=e,this.type="database",this._instanceStarted=!1}function Dd(t,e,n,r){void 0===r&&(r={}),(t=ts(t))._checkNotDeleted("useEmulator"),t._instanceStarted&&ea("Cannot call useEmulator() after instance has already been initialized.");var i=t._repoInternal,o=void 0;i.repoInfo_.nodeAdmin?(r.mockUserToken&&ea('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),o=new ba(ba.OWNER)):r.mockUserToken&&(t="string"==typeof r.mockUserToken?r.mockUserToken:fo(r.mockUserToken,t.app.options.projectId),o=new ba(t)),o=o,(i=i).repoInfo_=new Ea(e+":"+n,!1,i.repoInfo_.namespace,i.repoInfo_.webSocketOnly,i.repoInfo_.nodeAdmin,i.repoInfo_.persistenceKey,i.repoInfo_.includeNamespaceInQueryParams),o&&(i.authTokenProvider_=o)}function xd(t){(t=ts(t))._checkNotDeleted("goOnline"),(t=t._repo).persistentConnection_&&t.persistentConnection_.resume(Mf)}var Ld={".sv":"timestamp"};var Md=(Fd.prototype.toJSON=function(){return{committed:this.committed,snapshot:this.snapshot.toJSON()}},Fd);function Fd(t,e){this.committed=t,this.snapshot=e}function jd(i,t,e){if(i=ts(i),Nf("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 ho,n=Up(i,function(){});return function(t,e,n,r,i,o){Jf(t,"transaction on "+e);var s={path:e,update:n,onComplete:r,status:null,order:Ys(),applyLocally:o,retryCount:0,unwatcher:i,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},n=tp(t,e,void 0);s.currentInputSnapshot=n,void 0===(r=s.update(n.val()))?(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&&s.onComplete(null,!1,s.currentInputSnapshot)):(kf("transaction failed: Data returned ",r,s.path),s.status=0,(i=hf(o=cf(t.transactionQueueTree_,e))||[]).push(s),lf(o,i),o=void 0,"object"==typeof r&&null!==r&&Do(r,".priority")?(o=xo(r,".priority"),io(Ef(o),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):o=(jl(t.serverSyncTree_,e)||hc.EMPTY_NODE).getPriority().val(),i=Bf(t),o=gc(r,o),i=sf(o,n,i),s.currentOutputSnapshotRaw=o,s.currentOutputSnapshotResolved=i,s.currentWriteId=zf(t),s=Ol(t.serverSyncTree_,e,i,s.currentWriteId,s.applyLocally),xf(t.eventQueue_,e,s),ep(t,t.transactionQueueTree_))}(i._repo,i._path,t,function(t,e,n){var r;t?o.reject(t):(r=new kp(n,new Ep(i._repo,i._path),Zu),o.resolve(new Md(e,r)))},n,e),o.promise}var Ud=(qd.prototype.cancel=function(e){Wo("OnDisconnect.cancel",0,1,arguments.length),zo("OnDisconnect.cancel","onComplete",e,!0);var t=this._delegate.cancel();return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},qd.prototype.remove=function(e){Wo("OnDisconnect.remove",0,1,arguments.length),zo("OnDisconnect.remove","onComplete",e,!0);var t=this._delegate.remove();return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},qd.prototype.set=function(t,e){Wo("OnDisconnect.set",1,2,arguments.length),zo("OnDisconnect.set","onComplete",e,!0);t=this._delegate.set(t);return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},qd.prototype.setWithPriority=function(t,e,n){Wo("OnDisconnect.setWithPriority",2,3,arguments.length),zo("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},qd.prototype.update=function(t,e){if(Wo("OnDisconnect.update",1,2,arguments.length),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,na("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.")}zo("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},qd);function qd(t){this._delegate=t}var Vd=(Bd.prototype.toJSON=function(){return Wo("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},Bd);function Bd(t,e){this.committed=t,this.snapshot=e}var Kd=(Wd.prototype.val=function(){return Wo("DataSnapshot.val",0,0,arguments.length),this._delegate.val()},Wd.prototype.exportVal=function(){return Wo("DataSnapshot.exportVal",0,0,arguments.length),this._delegate.exportVal()},Wd.prototype.toJSON=function(){return Wo("DataSnapshot.toJSON",0,1,arguments.length),this._delegate.toJSON()},Wd.prototype.exists=function(){return Wo("DataSnapshot.exists",0,0,arguments.length),this._delegate.exists()},Wd.prototype.child=function(t){return Wo("DataSnapshot.child",0,1,arguments.length),t=String(t),Cf("DataSnapshot.child","path",t,!1),new Wd(this._database,this._delegate.child(t))},Wd.prototype.hasChild=function(t){return Wo("DataSnapshot.hasChild",1,1,arguments.length),Cf("DataSnapshot.hasChild","path",t,!1),this._delegate.hasChild(t)},Wd.prototype.getPriority=function(){return Wo("DataSnapshot.getPriority",0,0,arguments.length),this._delegate.priority},Wd.prototype.forEach=function(e){var n=this;return Wo("DataSnapshot.forEach",1,1,arguments.length),zo("DataSnapshot.forEach","action",e,!1),this._delegate.forEach(function(t){return e(new Wd(n._database,t))})},Wd.prototype.hasChildren=function(){return Wo("DataSnapshot.hasChildren",0,0,arguments.length),this._delegate.hasChildren()},Object.defineProperty(Wd.prototype,"key",{get:function(){return this._delegate.key},enumerable:!1,configurable:!0}),Wd.prototype.numChildren=function(){return Wo("DataSnapshot.numChildren",0,0,arguments.length),this._delegate.size},Wd.prototype.getRef=function(){return Wo("DataSnapshot.ref",0,0,arguments.length),new Qd(this._database,this._delegate.ref)},Object.defineProperty(Wd.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),Wd);function Wd(t,e){this._database=t,this._delegate=e}var Hd=(zd.prototype.on=function(t,n,e,r){var i=this;Wo("Query.on",2,4,arguments.length),zo("Query.on","callback",n,!1);function o(t,e){n.call(s.context,new Kd(i.database,t),e)}var s=zd.getCancelAndContextArgs_("Query.on",e,r);o.userCallback=n,o.context=s.context;var a=null===(r=s.cancel)||void 0===r?void 0:r.bind(s.context);switch(t){case"value":return Up(this._delegate,o,a),n;case"child_added":return qp(this._delegate,o,a),n;case"child_removed":return Kp(this._delegate,o,a),n;case"child_changed":return Vp(this._delegate,o,a),n;case"child_moved":return Bp(this._delegate,o,a),n;default:throw new Error(Ho("Query.on","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},zd.prototype.off=function(t,e,n){var r;Wo("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(Ho(t,"eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}("Query.off",t,!0),zo("Query.off","callback",e,!0),Go("Query.off","context",n,!0),e?((r=function(){}).userCallback=e,r.context=n,Wp(this._delegate,t,r)):Wp(this._delegate,t)},zd.prototype.get=function(){var e=this;return Dp(this._delegate).then(function(t){return new Kd(e.database,t)})},zd.prototype.once=function(t,n,e,r){var i=this;Wo("Query.once",1,4,arguments.length),zo("Query.once","callback",n,!0);function o(t,e){t=new Kd(i.database,t),n&&n.call(s.context,t,e),a.resolve(t)}var s=zd.getCancelAndContextArgs_("Query.once",e,r),a=new ho;o.userCallback=n,o.context=s.context;function u(t){s.cancel&&s.cancel.call(s.context,t),a.reject(t)}switch(t){case"value":Up(this._delegate,o,u,{onlyOnce:!0});break;case"child_added":qp(this._delegate,o,u,{onlyOnce:!0});break;case"child_removed":Kp(this._delegate,o,u,{onlyOnce:!0});break;case"child_changed":Vp(this._delegate,o,u,{onlyOnce:!0});break;case"child_moved":Bp(this._delegate,o,u,{onlyOnce:!0});break;default:throw new Error(Ho("Query.once","eventType")+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}return a.promise},zd.prototype.limitToFirst=function(t){return Wo("Query.limitToFirst",1,1,arguments.length),new zd(this.database,kd(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 id(t)}(t)))},zd.prototype.limitToLast=function(t){return Wo("Query.limitToLast",1,1,arguments.length),new zd(this.database,kd(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 ad(t)}(t)))},zd.prototype.orderByChild=function(t){return Wo("Query.orderByChild",1,1,arguments.length),new zd(this.database,kd(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 Cf("orderByChild","path",t,!1),new hd(t)}(t)))},zd.prototype.orderByKey=function(){return Wo("Query.orderByKey",0,0,arguments.length),new zd(this.database,kd(this._delegate,new pd))},zd.prototype.orderByPriority=function(){return Wo("Query.orderByPriority",0,0,arguments.length),new zd(this.database,kd(this._delegate,new vd))},zd.prototype.orderByValue=function(){return Wo("Query.orderByValue",0,0,arguments.length),new zd(this.database,kd(this._delegate,new bd))},zd.prototype.startAt=function(t,e){return void 0===t&&(t=null),Wo("Query.startAt",0,2,arguments.length),new zd(this.database,kd(this._delegate,(void 0===(t=t)&&(t=null),_f("startAt","key",e=e,!0),new Jp(t,e))))},zd.prototype.startAfter=function(t,e){return void 0===t&&(t=null),Wo("Query.startAfter",0,2,arguments.length),new zd(this.database,kd(this._delegate,(t=t,_f("startAfter","key",e=e,!0),new ed(t,e))))},zd.prototype.endAt=function(t,e){return void 0===t&&(t=null),Wo("Query.endAt",0,2,arguments.length),new zd(this.database,kd(this._delegate,(t=t,_f("endAt","key",e=e,!0),new zp(t,e))))},zd.prototype.endBefore=function(t,e){return void 0===t&&(t=null),Wo("Query.endBefore",0,2,arguments.length),new zd(this.database,kd(this._delegate,(t=t,_f("endBefore","key",e=e,!0),new Yp(t,e))))},zd.prototype.equalTo=function(t,e){return Wo("Query.equalTo",1,2,arguments.length),new zd(this.database,kd(this._delegate,(t=t,_f("equalTo","key",e=e,!0),new Ed(t,e))))},zd.prototype.toString=function(){return Wo("Query.toString",0,0,arguments.length),this._delegate.toString()},zd.prototype.toJSON=function(){return Wo("Query.toJSON",0,1,arguments.length),this._delegate.toJSON()},zd.prototype.isEqual=function(t){if(Wo("Query.isEqual",1,1,arguments.length),t instanceof zd)return this._delegate.isEqual(t._delegate);throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")},zd.getCancelAndContextArgs_=function(t,e,n){var r={cancel:void 0,context:void 0};if(e&&n)r.cancel=e,zo(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(Ho(t,"cancelOrContext")+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(zd.prototype,"ref",{get:function(){return new Qd(this.database,new Ep(this._delegate._repo,this._delegate._path))},enumerable:!1,configurable:!0}),zd);function zd(t,e){this.database=t,this._delegate=e}var Gd,Qd=(Gi(Yd,Gd=Hd),Yd.prototype.getKey=function(){return Wo("Reference.key",0,0,arguments.length),this._delegate.key},Yd.prototype.child=function(t){return Wo("Reference.child",1,1,arguments.length),"number"==typeof t&&(t=String(t)),new Yd(this.database,Rp(this._delegate,t))},Yd.prototype.getParent=function(){Wo("Reference.parent",0,0,arguments.length);var t=this._delegate.parent;return t?new Yd(this.database,t):null},Yd.prototype.getRoot=function(){return Wo("Reference.root",0,0,arguments.length),new Yd(this.database,this._delegate.root)},Yd.prototype.set=function(t,e){Wo("Reference.set",1,2,arguments.length),zo("Reference.set","onComplete",e,!0);t=Pp(this._delegate,t);return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},Yd.prototype.update=function(t,e){if(Wo("Reference.update",1,2,arguments.length),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,na("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.")}Nf("Reference.update",this._delegate._path),zo("Reference.update","onComplete",e,!0);var i=Op(this._delegate,t);return e&&i.then(function(){return e(null)},function(t){return e(t)}),i},Yd.prototype.setWithPriority=function(t,e,n){Wo("Reference.setWithPriority",2,3,arguments.length),zo("Reference.setWithPriority","onComplete",n,!0);e=function(t,e,n){if(Nf("setWithPriority",t._path),Sf("setWithPriority",e,t._path,!1),bf("setWithPriority",n,!1),".length"===t.key||".keys"===t.key)throw"setWithPriority failed: "+t.key+" is a read-only object.";var r=new ho;return Gf(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},Yd.prototype.remove=function(e){Wo("Reference.remove",0,1,arguments.length),zo("Reference.remove","onComplete",e,!0);var t,t=(t=this._delegate,Nf("remove",t._path),Pp(t,null));return e&&t.then(function(){return e(null)},function(t){return e(t)}),t},Yd.prototype.transaction=function(t,e,n){var r=this;Wo("Reference.transaction",1,3,arguments.length),zo("Reference.transaction","transactionUpdate",t,!1),zo("Reference.transaction","onComplete",e,!0),function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!=typeof n)throw new Error(Ho(t,e)+"must be a boolean.")}("Reference.transaction","applyLocally",n,!0);n=jd(this._delegate,t,{applyLocally:n}).then(function(t){return new Vd(t.committed,new Kd(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},Yd.prototype.setPriority=function(t,e){Wo("Reference.setPriority",1,2,arguments.length),zo("Reference.setPriority","onComplete",e,!0);t=function(t,e){t=ts(t),Nf("setPriority",t._path),bf("setPriority",e,!1);var n=new ho;return Gf(t._repo,hu(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},Yd.prototype.push=function(t,e){var n=this;Wo("Reference.push",0,2,arguments.length),zo("Reference.push","onComplete",e,!0);var r=function(t,e){t=ts(t),Nf("push",t._path),Sf("push",e,t._path,!0);var n=Vf(t._repo),r=Cc(n),n=Rp(t,r),i=Rp(t,r),e=null!=e?Pp(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 Yd(n.database,t)});e&&t.then(function(){return e(null)},function(t){return e(t)});r=new Yd(this.database,r);return r.then=t.then.bind(t),r.catch=t.catch.bind(t,void 0),r},Yd.prototype.onDisconnect=function(){return Nf("Reference.onDisconnect",this._delegate._path),new Ud(new vp(this._delegate._repo,this._delegate._path))},Object.defineProperty(Yd.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(Yd.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(Yd.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),Yd);function Yd(t,e){var n=Gd.call(this,t,new mp(e._repo,e._path,new jc,!1))||this;return n.database=t,n._delegate=e,n}var Xd=($d.prototype.useEmulator=function(t,e,n){Dd(this._delegate,t,e,n=void 0===n?{}:n)},$d.prototype.ref=function(t){if(Wo("database.ref",0,1,arguments.length),t instanceof Qd){var e=Np(this._delegate,t.toString());return new Qd(this,e)}e=Ap(this._delegate,t);return new Qd(this,e)},$d.prototype.refFromURL=function(t){Wo("database.refFromURL",1,1,arguments.length);t=Np(this._delegate,t);return new Qd(this,t)},$d.prototype.goOffline=function(){var t;Wo("database.goOffline",0,0,arguments.length),(t=ts(t=this._delegate))._checkNotDeleted("goOffline"),$f(t._repo)},$d.prototype.goOnline=function(){return Wo("database.goOnline",0,0,arguments.length),xd(this._delegate)},$d.ServerValue={TIMESTAMP:Ld,increment:function(t){return{".sv":{increment:t}}}},$d);function $d(t,e){var n=this;this._delegate=t,this.app=e,this.INTERNAL={delete:function(){return n._delegate._delete()}}}var Jd=Object.freeze({__proto__:null,forceLongPolling:function(){Va.forceDisallow(),Ma.forceAllow()},forceWebSockets:function(){Ma.forceDisallow()},isWebSocketsAvailable:function(){return Va.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 Zc(t.stats_)),t.statsListener_.get()):t.stats_.get(),i=Object.keys(t).reduce(function(t,e){return Math.max(e.length,t)},0),aa(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.statsReporter_.statsToReport_[e]=!0},dataUpdateCount:function(t){return t._delegate._repo.dataUpdateCount},interceptServerData:function(t,e){t._delegate._repo.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 Ds(r),(r=new is("auth-internal",new ss("database-standalone"))).setComponent(new es("auth-internal",function(){return i},"PRIVATE")),{instance:new Xd(Rd(e,r,void 0,n,t),e),namespace:o}}}),G=Su;Su.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},Su.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Zd,tg=Object.freeze({__proto__:null,DataConnection:G,RealTimeConnection:Ha,hijackHash:function(i){var o=Su.prototype.put;return Su.prototype.put=function(t,e,n,r){void 0!==r&&(r=i()),o.call(this,t,e,n,r)},function(){Su.prototype.put=o}},ConnectionTarget:Ea,queryIdentifier:function(t){return t._delegate._queryIdentifier},forceRestClient:function(t){Nd=t}}),eg=Xd.ServerValue;Ds((Zd=Jl).SDK_VERSION),Zd.INTERNAL.registerComponent(new es("database",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),e=t.getProvider("auth-internal"),t=t.getProvider("app-check-internal");return new Xd(Rd(r,e,t,n),r)},"PUBLIC").setServiceProps({Reference:Qd,Query:Hd,Database:Xd,DataSnapshot:Kd,enableLogging:Us,INTERNAL:Jd,ServerValue:eg,TEST_ACCESS:tg}).setMultipleInstances(!0)),Zd.registerVersion("@firebase/database","0.11.0");var ng=function(t,e){return(ng=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 rg(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 Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ig={},og=Q||self;function sg(){}function ag(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 ug(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var cg="closure_uid_"+(1e9*Math.random()>>>0),hg=0;function lg(t,e,n){return t.call.apply(t.bind,arguments)}function fg(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 pg(t,e,n){return(pg=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?lg:fg).apply(null,arguments)}function dg(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 gg(t,o){function e(){}e.prototype=o.prototype,t.Z=o.prototype,t.prototype=new e,(t.prototype.constructor=t).Vb=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 vg(){this.s=this.s,this.o=this.o}var yg={};vg.prototype.s=!1,vg.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,t=Object.prototype.hasOwnProperty.call(t,cg)&&t[cg]||(t[cg]=++hg),delete yg[t])},vg.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var mg=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},bg=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 _g(){return Array.prototype.concat.apply([],arguments)}function wg(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 Tg(t){return/^[\s\xa0]*$/.test(t)}var Ig,Eg=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function Sg(t,e){return-1!=t.indexOf(e)}function kg(t,e){return t<e?-1:e<t?1:0}t:{var Cg=og.navigator;if(Cg){Cg=Cg.userAgent;if(Cg){Ig=Cg;break t}}Ig=""}function Ag(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ng(t){var e,n={};for(e in t)n[e]=t[e];return n}var Rg="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Pg(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<Rg.length;i++)e=Rg[i],Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}}function Og(t){return Og[" "](t),t}Og[" "]=sg;var Dg,xg=Sg(Ig,"Opera"),Lg=Sg(Ig,"Trident")||Sg(Ig,"MSIE"),Mg=Sg(Ig,"Edge"),Fg=Mg||Lg,jg=Sg(Ig,"Gecko")&&!(Sg(Ig.toLowerCase(),"webkit")&&!Sg(Ig,"Edge"))&&!(Sg(Ig,"Trident")||Sg(Ig,"MSIE"))&&!Sg(Ig,"Edge"),Ug=Sg(Ig.toLowerCase(),"webkit")&&!Sg(Ig,"Edge");function qg(){var t=og.document;return t?t.documentMode:void 0}t:{var Vg="",Bg=(Bg=Ig,jg?/rv:([^\);]+)(\)|;)/.exec(Bg):Mg?/Edge\/([\d\.]+)/.exec(Bg):Lg?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Bg):Ug?/WebKit\/(\S+)/.exec(Bg):xg?/(?:Version)[ \/]?(\S+)/.exec(Bg):void 0);if(Bg&&(Vg=Bg?Bg[1]:""),Lg){Bg=qg();if(null!=Bg&&Bg>parseFloat(Vg)){Dg=String(Bg);break t}}Dg=Vg}var Kg={};function Wg(){return t=function(){for(var t=0,e=Eg(String(Dg)).split("."),n=Eg("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++)for(var o=e[i]||"",s=n[i]||"";o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],(0!=o[0].length||0!=s[0].length)&&(t=kg(0==o[1].length?0:parseInt(o[1],10),0==s[1].length?0:parseInt(s[1],10))||kg(0==o[2].length,0==s[2].length)||kg(o[2],s[2]),o=o[3],s=s[3],0==t););return 0<=t},e=Kg,Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9);var t,e}var Hg=og.document&&Lg&&(qg()||parseInt(Dg,10))||void 0,zg=function(){if(!og.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{og.addEventListener("test",sg,e),og.removeEventListener("test",sg,e)}catch(t){}return t}();function Gg(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}function Qg(t,e){if(Gg.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,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.g=e,e=t.relatedTarget){if(jg){t:{try{Og(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:Yg[t.pointerType]||"",this.state=t.state,(this.i=t).defaultPrevented&&Qg.Z.h.call(this)}}Gg.prototype.h=function(){this.defaultPrevented=!0},gg(Qg,Gg);var Yg={2:"touch",3:"pen",4:"mouse"};Qg.prototype.h=function(){Qg.Z.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var Xg="closure_listenable_"+(1e6*Math.random()|0),$g=0;function Jg(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ia=i,this.key=++$g,this.ca=this.fa=!1}function Zg(t){t.ca=!0,t.listener=null,t.proxy=null,t.src=null,t.ia=null}function tv(t){this.src=t,this.g={},this.h=0}function ev(t,e){var n,r,i,o=e.type;o in t.g&&(n=t.g[o],(i=0<=(r=mg(n,e)))&&Array.prototype.splice.call(n,r,1),i&&(Zg(e),0==t.g[o].length&&(delete t.g[o],t.h--)))}function nv(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.ca&&o.listener==e&&o.capture==!!n&&o.ia==r)return i}return-1}tv.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.g[o])||(t=this.g[o]=[],this.h++);var s=nv(t,e,r,i);return-1<s?(e=t[s],n||(e.fa=!1)):((e=new Jg(e,this.src,o,!!r,i)).fa=n,t.push(e)),e};var rv="closure_lm_"+(1e6*Math.random()|0),iv={};function ov(t,e,n,r,i){if(r&&r.once)return function t(e,n,r,i,o){if(Array.isArray(n)){for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);return null}r=fv(r);return e&&e[Xg]?e.O(n,r,ug(i)?!!i.capture:!!i,o):sv(e,n,r,!0,i,o)}(t,e,n,r,i);if(Array.isArray(e)){for(var o=0;o<e.length;o++)ov(t,e[o],n,r,i);return null}return n=fv(n),t&&t[Xg]?t.N(e,n,ug(r)?!!r.capture:!!r,i):sv(t,e,n,!1,r,i)}function sv(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var s,a=ug(i)?!!i.capture:!!i,u=hv(t);if(u||(t[rv]=u=new tv(t)),(n=u.add(e,n,r,a,o)).proxy)return n;if(s=cv,(n.proxy=r=function t(e){return s.call(t.src,t.listener,e)}).src=t,r.listener=n,t.addEventListener)void 0===(i=!zg?a:i)&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(uv(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function av(t){var e,n,r;"number"!=typeof t&&t&&!t.ca&&((e=t.src)&&e[Xg]?ev(e.i,t):(n=t.type,r=t.proxy,e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(uv(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=hv(e))?(ev(n,t),0==n.h&&(n.src=null,e[rv]=null)):Zg(t)))}function uv(t){return t in iv?iv[t]:iv[t]="on"+t}function cv(t,e){var n,r;return t=!!t.ca||(e=new Qg(e,this),n=t.listener,r=t.ia||t.src,t.fa&&av(t),n.call(r,e))}function hv(t){return(t=t[rv])instanceof tv?t:null}var lv="__closure_events_fn_"+(1e9*Math.random()>>>0);function fv(e){return"function"==typeof e?e:(e[lv]||(e[lv]=function(t){return e.handleEvent(t)}),e[lv])}function pv(){vg.call(this),this.i=new tv(this),(this.P=this).I=null}function dv(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e?e=new Gg(e,t):e instanceof Gg?e.target=e.target||t:(s=e,Pg(e=new Gg(r,t),s)),s=!0,n)for(var i=n.length-1;0<=i;i--)var o=e.g=n[i],s=gv(o,r,!0,e)&&s;if(s=gv(o=e.g=t,r,!0,e)&&s,s=gv(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=gv(o=e.g=n[i],r,!1,e)&&s}function gv(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var s,a,u=e[o];u&&!u.ca&&u.capture==n&&(s=u.listener,a=u.ia||u.src,u.fa&&ev(t.i,u),i=!1!==s.call(a,r)&&i)}return i&&!r.defaultPrevented}gg(pv,vg),pv.prototype[Xg]=!0,pv.prototype.removeEventListener=function(t,e,n,r){!function t(e,n,r,i,o){if(Array.isArray(n))for(var s=0;s<n.length;s++)t(e,n[s],r,i,o);else i=ug(i)?!!i.capture:!!i,r=fv(r),e&&e[Xg]?(e=e.i,(n=String(n).toString())in e.g&&-1<(r=nv(s=e.g[n],r,i,o))&&(Zg(s[r]),Array.prototype.splice.call(s,r,1),0==s.length&&(delete e.g[n],e.h--))):(e=e&&hv(e))&&(n=e.g[n.toString()],(r=(e=-1)<(e=n?nv(n,r,i,o):e)?n[e]:null)&&av(r))}(this,t,e,n,r)},pv.prototype.M=function(){if(pv.Z.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)Zg(n[r]);delete e.g[t],e.h--}}this.I=null},pv.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},pv.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vv=og.JSON.stringify;yv.prototype.add=function(t,e){var n=mv.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},Qa=yv;function yv(){this.h=this.g=null}var mv=(bv.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},new bv(function(){return new wv},function(t){return t.reset()}));function bv(t,e){this.i=t,this.j=e,this.h=0,this.g=null}var _v,wv=(Tv.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},Tv.prototype.reset=function(){this.next=this.g=this.h=null},Tv);function Tv(){this.next=this.g=this.h=null}function Iv(t,e){var n;_v||(n=og.Promise.resolve(void 0),_v=function(){n.then(kv)}),Ev||(_v(),Ev=!0),Sv.add(t,e)}var Ev=!1,Sv=new Qa;function kv(){for(var t;e=t=void 0,e=null,(t=Sv).g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(t){!function(t){og.setTimeout(function(){throw t},0)}(t)}var e=mv;e.j(t),e.h<100&&(e.h++,t.next=e.g,e.g=t)}Ev=!1}function Cv(t,e){pv.call(this),this.h=t||1,this.g=e||og,this.j=pg(this.kb,this),this.l=Date.now()}function Av(t){t.da=!1,t.S&&(t.g.clearTimeout(t.S),t.S=null)}function Nv(t,e,n){if("function"==typeof t)n&&(t=pg(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=pg(t.handleEvent,t)}return 2147483647<Number(e)?-1:og.setTimeout(t,e||0)}gg(Cv,pv),(fr=Cv.prototype).da=!1,fr.S=null,fr.kb=function(){var t;this.da&&(0<(t=Date.now()-this.l)&&t<.8*this.h?this.S=this.g.setTimeout(this.j,this.h-t):(this.S&&(this.g.clearTimeout(this.S),this.S=null),dv(this,"tick"),this.da&&(Av(this),this.start())))},fr.start=function(){this.da=!0,this.S||(this.S=this.g.setTimeout(this.j,this.h),this.l=Date.now())},fr.M=function(){Cv.Z.M.call(this),Av(this),delete this.g};var Rv,Pv=(function(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}ng(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(Ov,Rv=vg),Ov.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:function t(e){e.g=Nv(function(){e.g=null,e.i&&(e.i=!1,t(e))},e.j);var n=e.h;e.h=null,e.m.apply(null,n)}(this)},Ov.prototype.M=function(){Rv.prototype.M.call(this),this.g&&(og.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},Ov);function Ov(t,e){var n=Rv.call(this)||this;return n.m=t,n.j=e,n.h=null,n.i=!1,n.g=null,n}function Dv(t){vg.call(this),this.h=t,this.g={}}gg(Dv,vg);var xv=[];function Lv(t,e,n,r){Array.isArray(n)||(n&&(xv[0]=n.toString()),n=xv);for(var i=0;i<n.length;i++){var o=ov(e,n[i],r||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}}function Mv(t){Ag(t.g,function(t,e){this.g.hasOwnProperty(e)&&av(t)},t),t.g={}}function Fv(){this.g=!0}function jv(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)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)){var o=i[0];if("noop"!=o&&"stop"!=o&&"close"!=o)for(var s=1;s<i.length;s++)i[s]=""}}}return vv(n)}catch(t){return e}}(t,n)+(r?" "+r:"")})}Dv.prototype.M=function(){Dv.Z.M.call(this),Mv(this)},Dv.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},Fv.prototype.Aa=function(){this.g=!1},Fv.prototype.info=function(){};var Uv={},qv=null;function Vv(){return qv=qv||new pv}function Bv(t){Gg.call(this,Uv.Ma,t)}function Kv(){var t=Vv();dv(t,new Bv(t))}function Wv(t,e){Gg.call(this,Uv.STAT_EVENT,t),this.stat=e}function Hv(t){var e=Vv();dv(e,new Wv(e,t))}function zv(t,e){Gg.call(this,Uv.Na,t),this.size=e}function Gv(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return og.setTimeout(function(){t()},e)}Uv.Ma="serverreachability",gg(Bv,Gg),Uv.STAT_EVENT="statevent",gg(Wv,Gg),Uv.Na="timingevent",gg(zv,Gg);G={NO_ERROR:0,lb:1,yb:2,xb:3,sb:4,wb:5,zb:6,Ja:7,TIMEOUT:8,Cb:9},Q={qb:"complete",Mb:"success",Ka:"error",Ja:"abort",Eb:"ready",Fb:"readystatechange",TIMEOUT:"timeout",Ab:"incrementaldata",Db:"progress",tb:"downloadprogress",Ub:"uploadprogress"};function Qv(){}function Yv(t){return t.h||(t.h=t.i())}function Xv(){}Qv.prototype.h=null;Qa={OPEN:"a",pb:"b",Ka:"c",Bb:"d"};function $v(){Gg.call(this,"d")}function Jv(){Gg.call(this,"c")}function Zv(){}function ty(t,e,n,r){this.l=t,this.j=e,this.m=n,this.X=r||1,this.V=new Dv(this),this.P=ry,this.W=new Cv(t=Fg?125:void 0),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.Y=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.N=-1,this.I=!1,this.O=0,this.L=null,this.aa=this.J=this.$=this.U=!1,this.h=new ey}function ey(){this.i=null,this.g="",this.h=!1}gg($v,Gg),gg(Jv,Gg),gg(Zv,Qv),Zv.prototype.g=function(){return new XMLHttpRequest},Zv.prototype.i=function(){return{}};var ny=new Zv,ry=45e3,iy={},oy={};function sy(t,e,n){t.K=1,t.v=Ay(Ty(e)),t.s=n,t.U=!0,ay(t,null)}function ay(t,e){t.F=Date.now(),hy(t),t.A=Ty(t.v);var s,a,u,c,h,l,n=t.A,r=t.X;Array.isArray(r)||(r=[String(r)]),Vy(n.h,"t",r),t.C=0,n=t.l.H,t.h=new ey,t.g=Bm(t.l,n?e:null,!t.s),0<t.O&&(t.L=new Pv(pg(t.Ia,t,t.g),t.O)),Lv(t.V,t.g,"readystatechange",t.gb),e=t.H?Ng(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ea(t.A,t.u,t.s,e)):(t.u="GET",t.g.ea(t.A,t.u,null,e)),Kv(),s=t.j,a=t.u,u=t.A,c=t.m,h=t.X,l=t.s,s.info(function(){if(s.g)if(l)for(var t="",e=l.split("&"),n=0;n<e.length;n++){var r,i,o=e[n].split("=");1<o.length&&(r=o[0],o=o[1],t=2<=(i=r.split("_")).length&&"type"==i[1]?t+(r+"=")+o+"&":t+(r+"=redacted&"))}else t=null;else t=l;return"XMLHTTP REQ ("+c+") [attempt "+h+"]: "+a+"\n"+u+"\n"+t})}function uy(t){return t.g&&("GET"==t.u&&2!=t.K&&t.l.Ba)}function cy(t,e,n){for(var r,i,o,s,a,u=!0;!t.I&&t.C<n.length;){if(o=n,a=s=void 0,s=(i=t).C,(r=-1==(a=o.indexOf("\n",s))?oy:(s=Number(o.substring(s,a)),isNaN(s)?iy:(a+=1)+s>o.length?oy:(o=o.substr(a,s),i.C=a+s,o)))==oy){4==e&&(t.o=4,Hv(14),u=!1),jv(t.j,t.m,null,"[Incomplete Response]");break}if(r==iy){t.o=4,Hv(15),jv(t.j,t.m,n,"[Invalid Chunk]"),u=!1;break}jv(t.j,t.m,r,null),gy(t,r)}uy(t)&&r!=oy&&r!=iy&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Hv(16),u=!1),t.i=t.i&&u,u?0<n.length&&!t.aa&&(t.aa=!0,(e=t.l).g==t&&e.$&&!e.L&&(e.h.info("Great, no buffering proxy detected. Bytes received: "+n.length),xm(e),e.L=!0,Hv(11))):(jv(t.j,t.m,n,"[Invalid Chunked Response]"),dy(t),py(t))}function hy(t){t.Y=Date.now()+t.P,ly(t,t.P)}function ly(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Gv(pg(t.eb,t),e)}function fy(t){t.B&&(og.clearTimeout(t.B),t.B=null)}function py(t){0==t.l.G||t.I||Fm(t.l,t)}function dy(t){fy(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Av(t.W),Mv(t.V),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function gy(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Yy(n.i,t)))if(n.I=t.N,!t.J&&Yy(n.i,t)&&3==n.G){try{var r=n.Ca.g.parse(e)}catch(g){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mm(n),Sm(n)}Dm(n),Hv(18)}}else n.ta=i[1],0<n.ta-n.U&&i[2]<37500&&n.N&&0==n.A&&!n.v&&(n.v=Gv(pg(n.ab,n),6e3));if(Qy(n.i)<=1&&n.ka){try{n.ka()}catch(g){}n.ka=void 0}}else Um(n,11)}else if(!t.J&&n.g!=t||Mm(n),!Tg(e))for(i=n.Ca.g.parse(e),e=0;e<i.length;e++){var o,s,a,u,c,h,l,f,p,d,g=i[e];n.U=g[0],g=g[1],2==n.G?"c"==g[0]?(n.J=g[1],n.la=g[2],null!=(o=g[3])&&(n.ma=o,n.h.info("VER="+n.ma)),null!=(s=g[4])&&(n.za=s,n.h.info("SVER="+n.za)),null!=(a=g[5])&&"number"==typeof a&&0<a&&(r=1.5*a,n.K=r,n.h.info("backChannelRequestTimeoutMs_="+r)),r=n,(u=t.g)&&(!(c=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null)||!(h=r.i).g&&(Sg(c,"spdy")||Sg(c,"quic")||Sg(c,"h2"))&&(h.j=h.l,h.g=new Set,h.h&&(Xy(h,h.h),h.h=null)),!r.D||(l=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null)&&(r.sa=l,Cy(r.F,r.D,l))),n.G=3,n.j&&n.j.xa(),n.$&&(n.O=Date.now()-t.F,n.h.info("Handshake RTT: "+n.O+"ms")),f=t,(r=n).oa=Vm(r,r.H?r.la:null,r.W),f.J?($y(r.i,f),p=f,(d=r.K)&&p.setTimeout(d),p.B&&(fy(p),hy(p)),r.g=f):Om(r),0<n.l.length&&Am(n)):"stop"!=g[0]&&"close"!=g[0]||Um(n,7):3==n.G&&("stop"==g[0]||"close"==g[0]?"stop"==g[0]?Um(n,7):Em(n):"noop"!=g[0]&&n.j&&n.j.wa(g),n.A=0)}Kv()}catch(g){}}function vy(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(ag(t)||"string"==typeof t)bg(t,e,void 0);else{if(t.T&&"function"==typeof t.T)var n=t.T();else if(t.R&&"function"==typeof t.R)n=void 0;else if(ag(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.R&&"function"==typeof t.R)return t.R();if("string"==typeof t)return t.split("");if(ag(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 yy(t,e){this.h={},this.g=[],this.i=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 yy)for(n=t.T(),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 my(t){if(t.i!=t.g.length){for(var e=0,n=0;e<t.g.length;){var r=t.g[e];by(t.h,r)&&(t.g[n++]=r),e++}t.g.length=n}if(t.i!=t.g.length){for(var i={},n=e=0;e<t.g.length;)by(i,r=t.g[e])||(i[t.g[n++]=r]=1),e++;t.g.length=n}}function by(t,e){return Object.prototype.hasOwnProperty.call(t,e)}(fr=ty.prototype).setTimeout=function(t){this.P=t},fr.gb=function(t){t=t.target;var e=this.L;e&&3==bm(t)?e.l():this.Ia(t)},fr.Ia=function(t){try{if(t==this.g)t:{var e=bm(this.g),n=this.g.Da();this.g.ba();if(!(e<3)&&(3!=e||Fg||this.g&&(this.h.h||this.g.ga()||_m(this.g)))){this.I||4!=e||7==n||Kv(),fy(this);var r=this.g.ba();this.N=r;e:if(uy(this)){var i=_m(this.g);t="";var o=i.length,s=4==bm(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){dy(this),py(this);var a="";break e}this.h.i=new og.TextDecoder}for(n=0;n<o;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:s&&n==o-1});i.splice(0,o),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.ga();if(this.i=200==r,l=this.j,f=this.u,p=this.A,d=this.m,g=this.X,v=e,y=r,l.info(function(){return"XMLHTTP RESP ("+d+") [ attempt "+g+"]: "+f+"\n"+p+"\n"+v+" "+y}),this.i){if(this.$&&!this.J){e:{if(this.g){var u,c=this.g;if((u=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Tg(u)){var h=u;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,Hv(12),dy(this),py(this);break t}jv(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,gy(this,r)}this.U?(cy(this,e,a),Fg&&this.i&&3==e&&(Lv(this.V,this.W,"tick",this.fb),this.W.start())):(jv(this.j,this.m,a,null),gy(this,a)),4==e&&dy(this),this.i&&!this.I&&(4==e?Fm(this.l,this):(this.i=!1,hy(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Hv(12)):(this.o=0,Hv(13)),dy(this),py(this)}}}catch(e){}var l,f,p,d,g,v,y},fr.fb=function(){var t,e;this.g&&(t=bm(this.g),e=this.g.ga(),this.C<e.length&&(fy(this),cy(this,t,e),this.i&&4!=t&&hy(this)))},fr.cancel=function(){this.I=!0,dy(this)},fr.eb=function(){this.B=null;var t,e,n=Date.now();0<=n-this.Y?(t=this.j,e=this.A,t.info(function(){return"TIMEOUT: "+e}),2!=this.K&&(Kv(),Hv(17)),dy(this),this.o=2,py(this)):ly(this,this.Y-n)},(fr=yy.prototype).R=function(){my(this);for(var t=[],e=0;e<this.g.length;e++)t.push(this.h[this.g[e]]);return t},fr.T=function(){return my(this),this.g.concat()},fr.get=function(t,e){return by(this.h,t)?this.h[t]:e},fr.set=function(t,e){by(this.h,t)||(this.i++,this.g.push(t)),this.h[t]=e},fr.forEach=function(t,e){for(var n=this.T(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var _y=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;function wy(t,e){var n;this.i=this.s=this.j="",this.m=null,this.o=this.l="",this.g=!1,t instanceof wy?(this.g=void 0!==e?e:t.g,Iy(this,t.j),this.s=t.s,Ey(this,t.i),Sy(this,t.m),this.l=t.l,e=t.h,(n=new Fy).i=e.i,e.g&&(n.g=new yy(e.g),n.h=e.h),ky(this,n),this.o=t.o):t&&(n=String(t).match(_y))?(this.g=!!e,Iy(this,n[1]||"",!0),this.s=Ny(n[2]||""),Ey(this,n[3]||"",!0),Sy(this,n[4]),this.l=Ny(n[5]||"",!0),ky(this,n[6]||"",!0),this.o=Ny(n[7]||"")):(this.g=!!e,this.h=new Fy(null,this.g))}function Ty(t){return new wy(t)}function Iy(t,e,n){t.j=n?Ny(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Ey(t,e,n){t.i=n?Ny(e,!0):e}function Sy(t,e){if(e){if(e=Number(e),isNaN(e)||e<0)throw Error("Bad port number "+e);t.m=e}else t.m=null}function ky(t,e,n){var r,i;e instanceof Fy?(t.h=e,r=t.h,(i=t.g)&&!r.j&&(jy(r),r.i=null,r.g.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Uy(this,e),Vy(this,n,t))},r)),r.j=i):(n||(e=Ry(e,Ly)),t.h=new Fy(e,t.g))}function Cy(t,e,n){t.h.set(e,n)}function Ay(t){return Cy(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Ny(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ry(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)}wy.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Ry(e,Oy,!0),":");var n=this.i;return!n&&"file"!=e||(t.push("//"),(e=this.s)&&t.push(Ry(e,Oy,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.i&&"/"!=n.charAt(0)&&t.push("/"),t.push(Ry(n,"/"==n.charAt(0)?xy:Dy,!0))),(n=this.h.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Ry(n,My)),t.join("")};var Oy=/[#\/\?@]/g,Dy=/[#\?:]/g,xy=/[#\?]/g,Ly=/[#\?@]/g,My=/#/g;function Fy(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function jy(n){n.g||(n.g=new yy,n.h=0,n.i&&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.i,function(t,e){n.add(decodeURIComponent(t.replace(/\+/g," ")),e)}))}function Uy(t,e){jy(t),e=By(t,e),by(t.g.h,e)&&(t.i=null,t.h-=t.g.get(e).length,by((t=t.g).h,e)&&(delete t.h[e],t.i--,t.g.length>2*t.i&&my(t)))}function qy(t,e){return jy(t),e=By(t,e),by(t.g.h,e)}function Vy(t,e,n){Uy(t,e),0<n.length&&(t.i=null,t.g.set(By(t,e),wg(n)),t.h+=n.length)}function By(t,e){return e=String(e),e=t.j?e.toLowerCase():e}(fr=Fy.prototype).add=function(t,e){jy(this),this.i=null,t=By(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},fr.forEach=function(n,r){jy(this),this.g.forEach(function(t,e){bg(t,function(t){n.call(r,t,e,this)},this)},this)},fr.T=function(){jy(this);for(var t=this.g.R(),e=this.g.T(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},fr.R=function(t){jy(this);var e=[];if("string"==typeof t)qy(this,t)&&(e=_g(e,this.g.get(By(this,t))));else{t=this.g.R();for(var n=0;n<t.length;n++)e=_g(e,t[n])}return e},fr.set=function(t,e){return jy(this),this.i=null,qy(this,t=By(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},fr.get=function(t,e){return t&&0<(t=this.R(t)).length?String(t[0]):e},fr.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=this.g.T(),n=0;n<e.length;n++)for(var r=e[n],i=encodeURIComponent(String(r)),r=this.R(r),o=0;o<r.length;o++){var s=i;""!==r[o]&&(s+="="+encodeURIComponent(String(r[o]))),t.push(s)}return this.i=t.join("&")};var Ky=function(t,e){this.h=t,this.g=e};function Wy(t){this.l=t||zy,t=og.PerformanceNavigationTiming?0<(t=og.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):!!(og.g&&og.g.Ea&&og.g.Ea()&&og.g.Ea().Zb),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Hy,zy=10;function Gy(t){return t.h||t.g&&t.g.size>=t.j}function Qy(t){return t.h?1:t.g?t.g.size:0}function Yy(t,e){return t.h?t.h==e:t.g&&t.g.has(e)}function Xy(t,e){t.g?t.g.add(e):t.h=e}function $y(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Jy(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null==t.g||0===t.g.size)return wg(t.i);var r=t.i;try{for(var i=rg(t.g.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r.concat(s.D)}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.g=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){}}function nm(t){this.l=t.$b||null,this.j=t.ib||!1}function rm(t,e){pv.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=im,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}Wy.prototype.cancel=function(){var e,t;if(this.i=Jy(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=rg(this.g.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.g.clear()}},Zy.prototype.stringify=function(t){return og.JSON.stringify(t,void 0)},Zy.prototype.parse=function(t){return og.JSON.parse(t,void 0)},gg(nm,Qv),nm.prototype.g=function(){return new rm(this.l,this.j)},nm.prototype.i=(Hy={},function(){return Hy}),gg(rm,pv);var im=0;function om(t){t.j.read().then(t.Sa.bind(t)).catch(t.ha.bind(t))}function sm(t){t.readyState=4,t.l=null,t.j=null,t.A=null,am(t)}function am(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(fr=rm.prototype).open=function(t,e){if(this.readyState!=im)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,am(this)},fr.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||og).fetch(new Request(this.B,e)).then(this.Va.bind(this),this.ha.bind(this))},fr.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted."),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,sm(this)),this.readyState=im},fr.Va=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,am(this)),this.g&&(this.readyState=3,am(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ta.bind(this),this.ha.bind(this));else if(void 0!==og.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;om(this)}else t.text().then(this.Ua.bind(this),this.ha.bind(this))},fr.Sa=function(t){var e;this.g&&(this.u&&t.value?this.response.push(t.value):this.u||(e=t.value||new Uint8Array(0),(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)),(t.done?sm:am)(this),3==this.readyState&&om(this))},fr.Ua=function(t){this.g&&(this.response=this.responseText=t,sm(this))},fr.Ta=function(t){this.g&&(this.response=t,sm(this))},fr.ha=function(){this.g&&sm(this)},fr.setRequestHeader=function(t,e){this.v.append(t,e)},fr.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},fr.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.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(rm.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var um=og.JSON.parse;function cm(t){pv.call(this),this.headers=new yy,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=hm,this.K=this.L=!1}gg(cm,pv);var hm="",lm=/^https?$/i,fm=["POST","PUT"];function pm(t){return"content-type"==t.toLowerCase()}function dm(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gm(t),ym(t)}function gm(t){t.D||(t.D=!0,dv(t,"complete"),dv(t,"error"))}function vm(t){if(t.h&&void 0!==ig&&(!t.C[1]||4!=bm(t)||2!=t.ba()))if(t.v&&4==bm(t))Nv(t.Fa,0,t);else if(dv(t,"readystatechange"),4==bm(t)){t.h=!1;try{var e,n,r,i,o=t.ba();t:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var s=!0;break t;default:s=!1}if((e=s)||((n=0===o)&&(!(i=String(t.H).match(_y)[1]||null)&&og.self&&og.self.location&&(i=(r=og.self.location.protocol).substr(0,r.length-1)),n=!lm.test(i?i.toLowerCase():"")),e=n),e)dv(t,"complete"),dv(t,"success");else{t.m=6;try{var a=2<bm(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.ba()+"]",gm(t)}}finally{ym(t)}}}function ym(t,e){if(t.g){mm(t);var n=t.g,r=t.C[0]?sg:null;t.g=null,t.C=null,e||dv(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function mm(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(og.clearTimeout(t.A),t.A=null)}function bm(t){return t.g?t.g.readyState:0}function _m(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hm:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function wm(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}var i;r||(i="",Ag(n,function(t,e){i+=e,i+=":",i+=t,i+="\r\n"}),n=i,"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Cy(t,e,n))}function Tm(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Im(t){this.za=0,this.l=[],this.h=new Fv,this.la=this.oa=this.F=this.W=this.g=this.sa=this.D=this.aa=this.o=this.P=this.s=null,this.Za=this.V=0,this.Xa=Tm("failFast",!1,t),this.N=this.v=this.u=this.m=this.j=null,this.X=!0,this.I=this.ta=this.U=-1,this.Y=this.A=this.C=0,this.Pa=Tm("baseRetryDelayMs",5e3,t),this.$a=Tm("retryDelaySeedMs",1e4,t),this.Ya=Tm("forwardChannelMaxRetries",2,t),this.ra=Tm("forwardChannelRequestTimeoutMs",2e4,t),this.qa=t&&t.xmlHttpFactory||void 0,this.Ba=t&&t.Yb||!1,this.K=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.J="",this.i=new Wy(t&&t.concurrentRequestLimit),this.Ca=new tm,this.ja=t&&t.fastHandshake||!1,this.Ra=t&&t.Wb||!1,t&&t.Aa&&this.h.Aa(),t&&t.forceLongPolling&&(this.X=!1),this.$=!this.ja&&this.X&&t&&t.detectBufferingProxy||!1,this.ka=void 0,this.O=0,this.L=!1,this.B=null,this.Wa=!t||!1!==t.Xb}function Em(t){var e,n;km(t),3==t.G&&(e=t.V++,Cy(n=Ty(t.F),"SID",t.J),Cy(n,"RID",e),Cy(n,"TYPE","terminate"),Rm(t,n),(e=new ty(t,t.h,e,void 0)).K=2,e.v=Ay(Ty(n)),n=!1,!(n=og.navigator&&og.navigator.sendBeacon?og.navigator.sendBeacon(e.v.toString(),""):n)&&og.Image&&((new Image).src=e.v,n=!0),n||(e.g=Bm(e.l,null),e.g.ea(e.v)),e.F=Date.now(),hy(e)),qm(t)}function Sm(t){t.g&&(xm(t),t.g.cancel(),t.g=null)}function km(t){Sm(t),t.u&&(og.clearTimeout(t.u),t.u=null),Mm(t),t.i.cancel(),t.m&&("number"==typeof t.m&&og.clearTimeout(t.m),t.m=null)}function Cm(t,e){t.l.push(new Ky(t.Za++,e)),3==t.G&&Am(t)}function Am(t){Gy(t.i)||t.m||(t.m=!0,Iv(t.Ha,t),t.C=0)}function Nm(t,e){var n=e?e.m:t.V++,r=Ty(t.F);Cy(r,"SID",t.J),Cy(r,"RID",n),Cy(r,"AID",t.U),Rm(t,r),t.o&&t.s&&wm(r,t.o,t.s),n=new ty(t,t.h,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.l=e.D.concat(t.l)),e=Pm(t,n,1e3),n.setTimeout(Math.round(.5*t.ra)+Math.round(.5*t.ra*Math.random())),Xy(t.i,n),sy(n,r,e)}function Rm(t,n){t.j&&vy({},function(t,e){Cy(n,e,t)})}function Pm(t,e,n){n=Math.min(t.l.length,n);var r=t.j?pg(t.j.Oa,t.j,t):null;t:for(var i=t.l,o=-1;;){var s=["count="+n];-1==o?0<n?(o=i[0].h,s.push("ofs="+o)):o=0:s.push("ofs="+o);for(var a=!0,u=0;u<n;u++){var c=i[u].h,h=i[u].g;if((c-=o)<0)o=Math.max(0,i[u].h-100),a=!1;else try{!function(t,r,e){var i=e||"";try{vy(t,function(t,e){var n=t;ug(t)&&(n=vv(t)),r.push(i+e+"="+encodeURIComponent(n))})}catch(t){throw r.push(i+"type="+encodeURIComponent("_badmap")),t}}(h,s,"req"+c+"_")}catch(t){r&&r(h)}}if(a){r=s.join("&");break t}}return t=t.l.splice(0,n),e.D=t,r}function Om(t){t.g||t.u||(t.Y=1,Iv(t.Ga,t),t.A=0)}function Dm(t){return!(t.g||t.u||3<=t.A)&&(t.Y++,t.u=Gv(pg(t.Ga,t),jm(t,t.A)),t.A++,1)}function xm(t){null!=t.B&&(og.clearTimeout(t.B),t.B=null)}function Lm(t){t.g=new ty(t,t.h,"rpc",t.Y),null===t.o&&(t.g.H=t.s),t.g.O=0;var e=Ty(t.oa);Cy(e,"RID","rpc"),Cy(e,"SID",t.J),Cy(e,"CI",t.N?"0":"1"),Cy(e,"AID",t.U),Rm(t,e),Cy(e,"TYPE","xmlhttp"),t.o&&t.s&&wm(e,t.o,t.s),t.K&&t.g.setTimeout(t.K);var n=t.g;t=t.la,n.K=1,n.v=Ay(Ty(e)),n.s=null,n.U=!0,ay(n,t)}function Mm(t){null!=t.v&&(og.clearTimeout(t.v),t.v=null)}function Fm(t,e){var n,r,i,o=null;if(t.g==e){Mm(t),xm(t),t.g=null;var s=2}else{if(!Yy(t.i,e))return;o=e.D,$y(t.i,e),s=1}if(t.I=e.N,0!=t.G)if(e.i)1==s?(o=e.s?e.s.length:0,e=Date.now()-e.F,n=t.C,dv(s=Vv(),new zv(s,o)),Am(t)):Om(t);else if(3==(n=e.o)||0==n&&0<t.I||(1!=s||(i=e,Qy((r=t).i)>=r.i.j-(r.m?1:0)||(r.m?(r.l=i.D.concat(r.l),0):1==r.G||2==r.G||r.C>=(r.Xa?0:r.Ya)||(r.m=Gv(pg(r.Ha,r,i),jm(r,r.C)),r.C++,0))))&&(2!=s||!Dm(t)))switch(o&&0<o.length&&(e=t.i,e.i=e.i.concat(o)),n){case 1:Um(t,5);break;case 4:Um(t,10);break;case 3:Um(t,6);break;default:Um(t,2)}}function jm(t,e){var n=t.Pa+Math.floor(Math.random()*t.$a);return t.j||(n*=2),n*e}function Um(t,e){var n,r,i,o;t.h.info("Error code "+e),2==e?(r=null,t.j&&(r=null),o=pg(t.jb,t),r||(r=new wy("//www.google.com/images/cleardot.gif"),og.location&&"http"==og.location.protocol||Iy(r,"https"),Ay(r)),n=r.toString(),r=o,o=new Fv,og.Image?((i=new Image).onload=dg(em,o,i,"TestLoadImage: loaded",!0,r),i.onerror=dg(em,o,i,"TestLoadImage: error",!1,r),i.onabort=dg(em,o,i,"TestLoadImage: abort",!1,r),i.ontimeout=dg(em,o,i,"TestLoadImage: timeout",!1,r),og.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=n):r(!1)):Hv(2),t.G=0,t.j&&t.j.va(e),qm(t),km(t)}function qm(t){t.G=0,t.I=-1,t.j&&(0==Jy(t.i).length&&0==t.l.length||(t.i.i.length=0,wg(t.l),t.l.length=0),t.j.ua())}function Vm(t,e,n){var r,i,o,s,a,u=(s=n)instanceof wy?Ty(s):new wy(s,void 0);return""!=u.i?(e&&Ey(u,e+"."+u.i),Sy(u,u.m)):(a=og.location,r=a.protocol,i=e?e+"."+a.hostname:a.hostname,o=+a.port,s=n,a=new wy(null,void 0),r&&Iy(a,r),i&&Ey(a,i),o&&Sy(a,o),s&&(a.l=s),u=a),t.aa&&Ag(t.aa,function(t,e){Cy(u,e,t)}),e=t.D,n=t.sa,e&&n&&Cy(u,e,n),Cy(u,"VER",t.ma),Rm(t,u),u}function Bm(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Ba&&!t.qa?new cm(new nm({ib:!0})):new cm(t.qa)).L=t.H,e}function Km(){}function Wm(){if(Lg&&!(10<=Number(Hg)))throw Error("Environmental error: no available transport.")}function Hm(t,e){pv.call(this),this.g=new Im(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=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.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.P=t,(t=e&&e.httpHeadersOverwriteParam)&&!Tg(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Tg(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new Qm(this)}function zm(t){$v.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function Gm(){Jv.call(this),this.status=1}function Qm(t){this.g=t}(fr=cm.prototype).ea=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=(this.u||ny).g(),this.C=this.u?Yv(this.u):Yv(ny),this.g.onreadystatechange=pg(this.Fa,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(t){return void dm(this,t)}t=n||"";var i,o=new yy(this.headers);r&&vy(r,function(t,e){o.set(e,t)}),r=function(t){t:{for(var e=pm,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.T()),n=og.FormData&&t instanceof og.FormData,0<=mg(fm,e)&&!r&&!n&&o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.g.setRequestHeader(e,t)},this),this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{mm(this),0<this.B&&((this.K=(i=this.g,Lg&&Wg()&&"number"==typeof i.timeout&&void 0!==i.ontimeout))?(this.g.timeout=this.B,this.g.ontimeout=pg(this.pa,this)):this.A=Nv(this.pa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(t){dm(this,t)}},fr.pa=function(){void 0!==ig&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,dv(this,"timeout"),this.abort(8))},fr.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,dv(this,"complete"),dv(this,"abort"),ym(this))},fr.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),ym(this,!0)),cm.Z.M.call(this)},fr.Fa=function(){this.s||(this.F||this.v||this.l?vm(this):this.cb())},fr.cb=function(){vm(this)},fr.ba=function(){try{return 2<bm(this)?this.g.status:-1}catch(t){return-1}},fr.ga=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},fr.Qa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),um(e)}},fr.Da=function(){return this.m},fr.La=function(){return"string"==typeof this.j?this.j:String(this.j)},(fr=Im.prototype).ma=8,fr.G=1,fr.hb=function(t){try{this.h.info("Origin Trials invoked: "+t)}catch(t){}},fr.Ha=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.V=Math.floor(1e5*Math.random()),t=this.V++;var e=new ty(this,this.h,t,void 0),n=this.s;if(this.P&&(n?Pg(n=Ng(n),this.P):n=this.P),null===this.o&&(e.H=n),this.ja)t:{for(var r=0,i=0;i<this.l.length;i++){var o=this.l[i];if("__data__"in o.g&&"string"==typeof(o=o.g.__data__)?o=o.length:o=void 0,void 0===o)break;if(4096<(r+=o)){r=i;break t}if(4096===r||i===this.l.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Pm(this,e,r),Cy(i=Ty(this.F),"RID",t),Cy(i,"CVER",22),this.D&&Cy(i,"X-HTTP-Session-Id",this.D),Rm(this,i),this.o&&n&&wm(i,this.o,n),Xy(this.i,e),this.Ra&&Cy(i,"TYPE","init"),this.ja?(Cy(i,"$req",r),Cy(i,"SID","null"),e.$=!0,sy(e,i,null)):sy(e,i,r),this.G=2}}else 3==this.G&&(t?Nm(this,t):0==this.l.length||Gy(this.i)||Nm(this))},fr.Ga=function(){var t;this.u=null,Lm(this),this.$&&!(this.L||null==this.g||this.O<=0)&&(t=2*this.O,this.h.info("BP detection timer enabled: "+t),this.B=Gv(pg(this.bb,this),t))},fr.bb=function(){this.B&&(this.B=null,this.h.info("BP detection timeout reached."),this.h.info("Buffering proxy detected and switch to long-polling!"),this.N=!1,this.L=!0,Hv(10),Sm(this),Lm(this))},fr.ab=function(){null!=this.v&&(this.v=null,Sm(this),Dm(this),Hv(19))},fr.jb=function(t){t?(this.h.info("Successfully pinged google.com"),Hv(2)):(this.h.info("Failed to ping google.com"),Hv(1))},(fr=Km.prototype).xa=function(){},fr.wa=function(){},fr.va=function(){},fr.ua=function(){},fr.Oa=function(){},Wm.prototype.g=function(t,e){return new Hm(t,e)},gg(Hm,pv),Hm.prototype.m=function(){this.g.j=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;t.Wa&&(t.h.info("Origin Trials enabled."),Iv(pg(t.hb,t,e))),Hv(0),t.W=e,t.aa=n||{},t.N=t.X,t.F=Vm(t,null,t.W),Am(t)},Hm.prototype.close=function(){Em(this.g)},Hm.prototype.u=function(t){var e;"string"==typeof t?((e={}).__data__=t,Cm(this.g,e)):this.v?((e={}).__data__=vv(t),Cm(this.g,e)):Cm(this.g,t)},Hm.prototype.M=function(){this.g.j=null,delete this.j,Em(this.g),delete this.g,Hm.Z.M.call(this)},gg(zm,$v),gg(Gm,Jv),gg(Qm,Km),Qm.prototype.xa=function(){dv(this.g,"a")},Qm.prototype.wa=function(t){dv(this.g,new zm(t))},Qm.prototype.va=function(t){dv(this.g,new Gm)},Qm.prototype.ua=function(){dv(this.g,"b")},Wm.prototype.createWebChannel=Wm.prototype.g,Hm.prototype.send=Hm.prototype.u,Hm.prototype.open=Hm.prototype.m,G.NO_ERROR=0,G.TIMEOUT=8,G.HTTP_ERROR=6,Q.COMPLETE="complete",(Xv.EventType=Qa).OPEN="a",Qa.CLOSE="b",Qa.ERROR="c",Qa.MESSAGE="d",pv.prototype.listen=pv.prototype.N,cm.prototype.listenOnce=cm.prototype.O,cm.prototype.getLastError=cm.prototype.La,cm.prototype.getLastErrorCode=cm.prototype.Da,cm.prototype.getStatus=cm.prototype.ba,cm.prototype.getResponseJson=cm.prototype.Qa,cm.prototype.getResponseText=cm.prototype.ga,cm.prototype.send=cm.prototype.ea;var Ym=Vv,Xm=G,$m=Q,Jm=Uv,Zm=10,tb=11,eb=nm,nb=Xv,rb=cm,ib=(ob.prototype.t=function(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue},ob.prototype.next=function(){var t=++this.previousValue;return this.i&&this.i(t),t},ob);function ob(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)})}ib.o=-1;var sb,ab={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"},ub=(Gi(hb,sb=Error),hb),cb=new ds("@firebase/firestore");function hb(t,e){var n=this;return(n=sb.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 lb(){return cb.logLevel}function fb(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];cb.logLevel<=us.DEBUG&&(e=n.map(gb),cb.debug.apply(cb,Zi(["Firestore (8.10.0): "+t],e)))}function pb(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];cb.logLevel<=us.ERROR&&(e=n.map(gb),cb.error.apply(cb,Zi(["Firestore (8.10.0): "+t],e)))}function db(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];cb.logLevel<=us.WARN&&(e=n.map(gb),cb.warn.apply(cb,Zi(["Firestore (8.10.0): "+t],e)))}function gb(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function vb(t){t="FIRESTORE (8.10.0) INTERNAL ASSERTION FAILED: "+(t=void 0===t?"Unexpected state":t);throw pb(t),new Error(t)}function yb(t){t||vb()}var mb=(bb.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},bb);function bb(){}function _b(t,e){return t<e?-1:e<t?1:0}function wb(t,n,r){return t.length===n.length&&t.every(function(t,e){return r(t,n[e])})}function Tb(t){return t+"\0"}var Ib=(kb.now=function(){return kb.fromMillis(Date.now())},kb.fromDate=function(t){return kb.fromMillis(t.getTime())},kb.fromMillis=function(t){var e=Math.floor(t/1e3);return new kb(e,Math.floor(1e6*(t-1e3*e)))},kb.prototype.toDate=function(){return new Date(this.toMillis())},kb.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},kb.prototype._compareTo=function(t){return this.seconds===t.seconds?_b(this.nanoseconds,t.nanoseconds):_b(this.seconds,t.seconds)},kb.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},kb.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},kb.prototype.toJSON=function(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}},kb.prototype.valueOf=function(){var t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")},kb),Eb=(Sb.fromTimestamp=function(t){return new Sb(t)},Sb.min=function(){return new Sb(new Ib(0,0))},Sb.prototype.compareTo=function(t){return this.timestamp._compareTo(t.timestamp)},Sb.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},Sb.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},Sb.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},Sb.prototype.toTimestamp=function(){return this.timestamp},Sb);function Sb(t){this.timestamp=t}function kb(t,e){if(this.seconds=t,(this.nanoseconds=e)<0)throw new ub(ab.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(1e9<=e)throw new ub(ab.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new ub(ab.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(253402300800<=t)throw new ub(ab.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}function Cb(t){var e,n=0;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&n++;return n}function Ab(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Nb(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}var Rb,Pb,G=(Object.defineProperty(Vb.prototype,"length",{get:function(){return this.len},enumerable:!1,configurable:!0}),Vb.prototype.isEqual=function(t){return 0===Vb.comparator(this,t)},Vb.prototype.child=function(t){var e=this.segments.slice(this.offset,this.limit());return t instanceof Vb?t.forEach(function(t){e.push(t)}):e.push(t),this.construct(e)},Vb.prototype.limit=function(){return this.offset+this.length},Vb.prototype.popFirst=function(t){return this.construct(this.segments,this.offset+(t=void 0===t?1:t),this.length-t)},Vb.prototype.popLast=function(){return this.construct(this.segments,this.offset,this.length-1)},Vb.prototype.firstSegment=function(){return this.segments[this.offset]},Vb.prototype.lastSegment=function(){return this.get(this.length-1)},Vb.prototype.get=function(t){return this.segments[this.offset+t]},Vb.prototype.isEmpty=function(){return 0===this.length},Vb.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},Vb.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},Vb.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},Vb.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},Vb.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},Vb),Ob=(Gi(qb,Pb=G),qb.prototype.construct=function(t,e,n){return new qb(t,e,n)},qb.prototype.canonicalString=function(){return this.toArray().join("/")},qb.prototype.toString=function(){return this.canonicalString()},qb.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 ub(ab.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 qb(n)},qb.emptyPath=function(){return new qb([])},qb),Db=/^[_a-zA-Z][_a-zA-Z0-9]*$/,xb=(Gi(Ub,Rb=G),Ub.prototype.construct=function(t,e,n){return new Ub(t,e,n)},Ub.isValidIdentifier=function(t){return Db.test(t)},Ub.prototype.canonicalString=function(){return this.toArray().map(function(t){return t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),t=!Ub.isValidIdentifier(t)?"`"+t+"`":t}).join(".")},Ub.prototype.toString=function(){return this.canonicalString()},Ub.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},Ub.keyField=function(){return new Ub(["__name__"])},Ub.fromServerFormat=function(t){for(var e=[],n="",r=0,i=function(){if(0===n.length)throw new ub(ab.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");e.push(n),n=""},o=!1;r<t.length;){var s=t[r];if("\\"===s){if(r+1===t.length)throw new ub(ab.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var a=t[r+1];if("\\"!==a&&"."!==a&&"`"!==a)throw new ub(ab.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=a,r+=2}else"`"===s?o=!o:"."!==s||o?n+=s:i(),r++}if(i(),o)throw new ub(ab.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Ub(e)},Ub.emptyPath=function(){return new Ub([])},Ub),Lb=(jb.prototype.covers=function(t){for(var e=0,n=this.fields;e<n.length;e++)if(n[e].isPrefixOf(t))return!0;return!1},jb.prototype.isEqual=function(t){return wb(this.fields,t.fields,function(t,e){return t.isEqual(e)})},jb),Mb=(Fb.fromBase64String=function(t){return new Fb(atob(t))},Fb.fromUint8Array=function(t){return new Fb(function(t){for(var e="",n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t))},Fb.prototype.toBase64=function(){return t=this.binaryString,btoa(t);var t},Fb.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)},Fb.prototype.approximateByteSize=function(){return 2*this.binaryString.length},Fb.prototype.compareTo=function(t){return _b(this.binaryString,t.binaryString)},Fb.prototype.isEqual=function(t){return this.binaryString===t.binaryString},Fb);function Fb(t){this.binaryString=t}function jb(t){(this.fields=t).sort(xb.comparator)}function Ub(){return null!==Rb&&Rb.apply(this,arguments)||this}function qb(){return null!==Pb&&Pb.apply(this,arguments)||this}function Vb(t,e,n){void 0===e?e=0:e>t.length&&vb(),void 0===n?n=t.length-e:n>t.length-e&&vb(),this.segments=t,this.offset=e,this.len=n}Mb.EMPTY_BYTE_STRING=new Mb("");var Bb=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Kb(t){if(yb(!!t),"string"!=typeof t)return{seconds:Wb(t.seconds),nanos:Wb(t.nanos)};var e=0,n=Bb.exec(t);yb(!!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 Wb(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Hb(t){return"string"==typeof t?Mb.fromBase64String(t):Mb.fromUint8Array(t)}function zb(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 Gb(t){t=Kb(t.mapValue.fields.__local_write_time__.timestampValue);return new Ib(t.seconds,t.nanos)}function Qb(t){return null==t}function Yb(t){return 0===t&&1/t==-1/0}function Xb(t){return"number"==typeof t&&Number.isInteger(t)&&!Yb(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}var $b=(Jb.fromPath=function(t){return new Jb(Ob.fromString(t))},Jb.fromName=function(t){return new Jb(Ob.fromString(t).popFirst(5))},Jb.prototype.hasCollectionId=function(t){return 2<=this.path.length&&this.path.get(this.path.length-2)===t},Jb.prototype.isEqual=function(t){return null!==t&&0===Ob.comparator(this.path,t.path)},Jb.prototype.toString=function(){return this.path.toString()},Jb.comparator=function(t,e){return Ob.comparator(t.path,e.path)},Jb.isDocumentKey=function(t){return t.length%2==0},Jb.fromSegments=function(t){return new Jb(new Ob(t.slice()))},Jb);function Jb(t){this.path=t}function Zb(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?zb(t)?4:10:vb()}function t_(r,i){var t,e,n=Zb(r);if(n!==Zb(i))return!1;switch(n){case 0:return!0;case 1:return r.booleanValue===i.booleanValue;case 4:return Gb(r).isEqual(Gb(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=Kb(r.timestampValue),t=Kb(t.timestampValue);return e.seconds===t.seconds&&e.nanos===t.nanos}(i);case 5:return r.stringValue===i.stringValue;case 6:return e=i,Hb(r.bytesValue).isEqual(Hb(e.bytesValue));case 7:return r.referenceValue===i.referenceValue;case 8:return t=i,Wb((e=r).geoPointValue.latitude)===Wb(t.geoPointValue.latitude)&&Wb(e.geoPointValue.longitude)===Wb(t.geoPointValue.longitude);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Wb(t.integerValue)===Wb(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){t=Wb(t.doubleValue),e=Wb(e.doubleValue);return t===e?Yb(t)===Yb(e):isNaN(t)&&isNaN(e)}return!1}(r,i);case 9:return wb(r.arrayValue.values||[],i.arrayValue.values||[],t_);case 10:return function(){var t,e=r.mapValue.fields||{},n=i.mapValue.fields||{};if(Cb(e)!==Cb(n))return!1;for(t in e)if(e.hasOwnProperty(t)&&(void 0===n[t]||!t_(e[t],n[t])))return!1;return!0}();default:return vb()}}function e_(t,e){return void 0!==(t.values||[]).find(function(t){return t_(t,e)})}function n_(t,e){var n,r,i,o=Zb(t),s=Zb(e);if(o!==s)return _b(o,s);switch(o){case 0:return 0;case 1:return _b(t.booleanValue,e.booleanValue);case 2:return r=e,i=Wb(t.integerValue||t.doubleValue),r=Wb(r.integerValue||r.doubleValue),i<r?-1:r<i?1:i===r?0:isNaN(i)?isNaN(r)?0:-1:1;case 3:return r_(t.timestampValue,e.timestampValue);case 4:return r_(Gb(t),Gb(e));case 5:return _b(t.stringValue,e.stringValue);case 6:return function(t,e){t=Hb(t),e=Hb(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=_b(n[i],r[i]);if(0!==o)return o}return _b(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return n=t.geoPointValue,i=e.geoPointValue,0!==(r=_b(Wb(n.latitude),Wb(i.latitude)))?r:_b(Wb(n.longitude),Wb(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=n_(n[i],r[i]);if(o)return o}return _b(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){var n=t.fields||{},r=Object.keys(n),i=e.fields||{},o=Object.keys(i);r.sort(),o.sort();for(var s=0;s<r.length&&s<o.length;++s){var a=_b(r[s],o[s]);if(0!==a)return a;a=n_(n[r[s]],i[o[s]]);if(0!==a)return a}return _b(r.length,o.length)}(t.mapValue,e.mapValue);default:throw vb()}}function r_(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return _b(t,e);var n=Kb(t),t=Kb(e),e=_b(n.seconds,t.seconds);return 0!==e?e:_b(n.nanos,t.nanos)}function i_(t){return function s(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){t=Kb(t);return"time("+t.seconds+","+t.nanos+")"}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Hb(t.bytesValue).toBase64():"referenceValue"in t?(e=t.referenceValue,$b.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+=s(i[r]);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){for(var e="{",n=!0,r=0,i=Object.keys(t.fields||{}).sort();r<i.length;r++){var o=i[r];n?n=!1:e+=",",e+=o+":"+s(t.fields[o])}return e+"}"}(t.mapValue):vb();var e}(t)}function o_(t,e){return{referenceValue:"projects/"+t.projectId+"/databases/"+t.database+"/documents/"+e.path.canonicalString()}}function s_(t){return t&&"integerValue"in t}function a_(t){return!!t&&"arrayValue"in t}function u_(t){return t&&"nullValue"in t}function c_(t){return t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function h_(t){return t&&"mapValue"in t}function l_(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){var n={mapValue:{fields:{}}};return Ab(t.mapValue.fields,function(t,e){return n.mapValue.fields[t]=l_(e)}),n}if(t.arrayValue){for(var e={arrayValue:{values:[]}},r=0;r<(t.arrayValue.values||[]).length;++r)e.arrayValue.values[r]=l_(t.arrayValue.values[r]);return e}return Object.assign({},t)}var f_=(p_.empty=function(){return new p_({mapValue:{}})},p_.prototype.field=function(t){if(t.isEmpty())return this.value;for(var e=this.value,n=0;n<t.length-1;++n)if(!h_(e=(e.mapValue.fields||{})[t.get(n)]))return null;return(e=(e.mapValue.fields||{})[t.lastSegment()])||null},p_.prototype.set=function(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=l_(e)},p_.prototype.setAll=function(t){var r=this,i=xb.emptyPath(),o={},s=[];t.forEach(function(t,e){var n;i.isImmediateParentOf(e)||(n=r.getFieldsMap(i),r.applyChanges(n,o,s),o={},s=[],i=e.popLast()),t?o[e.lastSegment()]=l_(t):s.push(e.lastSegment())});t=this.getFieldsMap(i);this.applyChanges(t,o,s)},p_.prototype.delete=function(t){var e=this.field(t.popLast());h_(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]},p_.prototype.isEqual=function(t){return t_(this.value,t.value)},p_.prototype.getFieldsMap=function(t){var e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(var n=0;n<t.length;++n){var r=e.mapValue.fields[t.get(n)];h_(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields},p_.prototype.applyChanges=function(n,t,e){Ab(t,function(t,e){return n[t]=e});for(var r=0,i=e;r<i.length;r++){var o=i[r];delete n[o]}},p_.prototype.clone=function(){return new p_(l_(this.value))},p_);function p_(t){this.value=t}var d_=(v_.newInvalidDocument=function(t){return new v_(t,0,Eb.min(),f_.empty(),0)},v_.newFoundDocument=function(t,e,n){return new v_(t,1,e,n,0)},v_.newNoDocument=function(t,e){return new v_(t,2,e,f_.empty(),0)},v_.newUnknownDocument=function(t,e){return new v_(t,3,e,f_.empty(),2)},v_.prototype.convertToFoundDocument=function(t,e){return this.version=t,this.documentType=1,this.data=e,this.documentState=0,this},v_.prototype.convertToNoDocument=function(t){return this.version=t,this.documentType=2,this.data=f_.empty(),this.documentState=0,this},v_.prototype.convertToUnknownDocument=function(t){return this.version=t,this.documentType=3,this.data=f_.empty(),this.documentState=2,this},v_.prototype.setHasCommittedMutations=function(){return this.documentState=2,this},v_.prototype.setHasLocalMutations=function(){return this.documentState=1,this},Object.defineProperty(v_.prototype,"hasLocalMutations",{get:function(){return 1===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(v_.prototype,"hasCommittedMutations",{get:function(){return 2===this.documentState},enumerable:!1,configurable:!0}),Object.defineProperty(v_.prototype,"hasPendingWrites",{get:function(){return this.hasLocalMutations||this.hasCommittedMutations},enumerable:!1,configurable:!0}),v_.prototype.isValidDocument=function(){return 0!==this.documentType},v_.prototype.isFoundDocument=function(){return 1===this.documentType},v_.prototype.isNoDocument=function(){return 2===this.documentType},v_.prototype.isUnknownDocument=function(){return 3===this.documentType},v_.prototype.isEqual=function(t){return t instanceof v_&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)},v_.prototype.clone=function(){return new v_(this.key,this.documentType,this.version,this.data.clone(),this.documentState)},v_.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+JSON.stringify(this.data.value)+", {documentType: "+this.documentType+"}), {documentState: "+this.documentState+"})"},v_),g_=function(t,e,n,r,i,o,s){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=o,this.endAt=s,this.h=null};function v_(t,e,n,r,i){this.key=t,this.documentType=e,this.version=n,this.data=r,this.documentState=i}function y_(t,e,n,r,i,o,s){return new g_(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,s=void 0===s?null:s)}function m_(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()+i_(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+=G_(e.startAt)),e.endAt&&(t+="|ub:",t+=G_(e.endAt)),e.h=t),e.h}function b_(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(var n,r,i=0;i<t.orderBy.length;i++)if(n=t.orderBy[i],r=e.orderBy[i],n.dir!==r.dir||!n.field.isEqual(r.field))return!1;if(t.filters.length!==e.filters.length)return!1;for(var o,s,a=0;a<t.filters.length;a++)if(o=t.filters[a],s=e.filters[a],o.op!==s.op||!o.field.isEqual(s.field)||!t_(o.value,s.value))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!X_(t.startAt,e.startAt)&&X_(t.endAt,e.endAt)}function __(t){return $b.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}var w_,T_=(Gi(I_,w_=function(){}),I_.create=function(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.l(t,e,n):new C_(t,e,n):"array-contains"===e?new j_(t,n):"in"===e?new U_(t,n):"not-in"===e?new q_(t,n):"array-contains-any"===e?new V_(t,n):new I_(t,e,n)},I_.l=function(t,e,n){return new("in"===e?A_:N_)(t,n)},I_.prototype.matches=function(t){t=t.data.field(this.field);return"!="===this.op?null!==t&&this.m(n_(t,this.value)):null!==t&&Zb(this.value)===Zb(t)&&this.m(n_(t,this.value))},I_.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 vb()}},I_.prototype.g=function(){return 0<=["<","<=",">",">=","!=","not-in"].indexOf(this.op)},I_);function I_(t,e,n){var r=this;return(r=w_.call(this)||this).field=t,r.op=e,r.value=n,r}var E_,S_,k_,C_=(Gi(O_,k_=T_),O_.prototype.matches=function(t){t=$b.comparator(t.key,this.key);return this.m(t)},O_),A_=(Gi(P_,S_=T_),P_.prototype.matches=function(e){return this.keys.some(function(t){return t.isEqual(e.key)})},P_),N_=(Gi(R_,E_=T_),R_.prototype.matches=function(e){return!this.keys.some(function(t){return t.isEqual(e.key)})},R_);function R_(t,e){var n=this;return(n=E_.call(this,t,"not-in",e)||this).keys=D_(0,e),n}function P_(t,e){var n=this;return(n=S_.call(this,t,"in",e)||this).keys=D_(0,e),n}function O_(t,e,n){var r=this;return(r=k_.call(this,t,e,n)||this).key=$b.fromName(n.referenceValue),r}function D_(t,e){return((null===(e=e.arrayValue)||void 0===e?void 0:e.values)||[]).map(function(t){return $b.fromName(t.referenceValue)})}var x_,L_,M_,F_,j_=(Gi(z_,F_=T_),z_.prototype.matches=function(t){t=t.data.field(this.field);return a_(t)&&e_(t.arrayValue,this.value)},z_),U_=(Gi(H_,M_=T_),H_.prototype.matches=function(t){t=t.data.field(this.field);return null!==t&&e_(this.value.arrayValue,t)},H_),q_=(Gi(W_,L_=T_),W_.prototype.matches=function(t){if(e_(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;t=t.data.field(this.field);return null!==t&&!e_(this.value.arrayValue,t)},W_),V_=(Gi(K_,x_=T_),K_.prototype.matches=function(t){var e=this,t=t.data.field(this.field);return!(!a_(t)||!t.arrayValue.values)&&t.arrayValue.values.some(function(t){return e_(e.value.arrayValue,t)})},K_),B_=function(t,e){this.position=t,this.before=e};function K_(t,e){return x_.call(this,t,"array-contains-any",e)||this}function W_(t,e){return L_.call(this,t,"not-in",e)||this}function H_(t,e){return M_.call(this,t,"in",e)||this}function z_(t,e){return F_.call(this,t,"array-contains",e)||this}function G_(t){return(t.before?"b":"a")+":"+t.position.map(i_).join(",")}var Q_=function(t,e){void 0===e&&(e="asc"),this.field=t,this.dir=e};function Y_(t,e,n){for(var r=0,i=0;i<t.position.length;i++){var o=e[i],s=t.position[i],r=o.field.isKeyField()?$b.comparator($b.fromName(s.referenceValue),n.key):n_(s,n.data.field(o.field));if("desc"===o.dir&&(r*=-1),0!==r)break}return t.before?r<=0:r<0}function X_(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(!t_(t.position[n],e.position[n]))return!1;return!0}var $_=function(t,e,n,r,i,o,s,a){void 0===e&&(e=null),void 0===n&&(n=[]),void 0===r&&(r=[]),void 0===i&&(i=null),void 0===o&&(o="F"),void 0===s&&(s=null),void 0===a&&(a=null),this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=o,this.startAt=s,this.endAt=a,this.p=null,this.T=null,this.startAt,this.endAt};function J_(t,e,n,r,i,o,s,a){return new $_(t,e,n,r,i,o,s,a)}function Z_(t){return new $_(t)}function tw(t){return!Qb(t.limit)&&"F"===t.limitType}function ew(t){return!Qb(t.limit)&&"L"===t.limitType}function nw(t){return 0<t.explicitOrderBy.length?t.explicitOrderBy[0].field:null}function rw(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 iw(t){return null!==t.collectionGroup}function ow(t){var e=t;if(null===e.p){e.p=[];var n=rw(e),t=nw(e);if(null!==n&&null===t)n.isKeyField()||e.p.push(new Q_(n)),e.p.push(new Q_(xb.keyField(),"asc"));else{for(var r=!1,i=0,o=e.explicitOrderBy;i<o.length;i++){var s=o[i];e.p.push(s),s.field.isKeyField()&&(r=!0)}r||(n=0<e.explicitOrderBy.length?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc",e.p.push(new Q_(xb.keyField(),n)))}}return e.p}function sw(t){var e=t;if(!e.T)if("F"===e.limitType)e.T=y_(e.path,e.collectionGroup,ow(e),e.filters,e.limit,e.startAt,e.endAt);else{for(var n=[],r=0,i=ow(e);r<i.length;r++){var o=i[r],s="desc"===o.dir?"asc":"desc";n.push(new Q_(o.field,s))}var a=e.endAt?new B_(e.endAt.position,!e.endAt.before):null,t=e.startAt?new B_(e.startAt.position,!e.startAt.before):null;e.T=y_(e.path,e.collectionGroup,n,e.filters,e.limit,a,t)}return e.T}function aw(t,e,n){return new $_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function uw(t,e){return b_(sw(t),sw(e))&&t.limitType===e.limitType}function cw(t){return m_(sw(t))+"|lt:"+t.limitType}function hw(t){return"Query(target="+(e=sw(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+" "+i_(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: "+G_(e.startAt)),e.endAt&&(n+=", endAt: "+G_(e.endAt)),"Target("+n+")")+"; limitType="+t.limitType+")";var e,n}function lw(i,t){return t.isFoundDocument()&&(e=i,n=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):$b.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||Y_(t.startAt,ow(t),n))&&(!t.endAt||!Y_(t.endAt,ow(t),n)));var e,n}function fw(a){return function(t,e){for(var n=!1,r=0,i=ow(a);r<i.length;r++){var o=i[r],s=function(t,r,e){var n=t.field.isKeyField()?$b.comparator(r.key,e.key):function(t,e){var n=r.data.field(t),t=e.data.field(t);return null!==n&&null!==t?n_(n,t):vb()}(t.field,e);switch(t.dir){case"asc":return n;case"desc":return-1*n;default:return vb()}}(o,t,e);if(0!==s)return s;n=n||o.field.isKeyField()}return 0}}function pw(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:Yb(e)?"-0":e}}function dw(t){return{integerValue:""+t}}function gw(t,e){return Xb(e)?dw(e):pw(t,e)}Q=function(){this._=void 0};function vw(t,e){return t instanceof Nw?s_(t=e)||t&&"doubleValue"in t?e:{integerValue:0}:null}var yw,mw,bw=(Gi(Tw,mw=Q),Tw),_w=(Gi(ww,yw=Q),ww);function ww(t){var e=this;return(e=yw.call(this)||this).elements=t,e}function Tw(){return null!==mw&&mw.apply(this,arguments)||this}function Iw(t,e){for(var n=Ow(e),r=0,i=t.elements;r<i.length;r++)!function(e){n.some(function(t){return t_(t,e)})||n.push(e)}(i[r]);return{arrayValue:{values:n}}}var Ew,Sw=(Gi(kw,Ew=Q),kw);function kw(t){var e=this;return(e=Ew.call(this)||this).elements=t,e}function Cw(t,e){for(var n=Ow(e),r=0,i=t.elements;r<i.length;r++)!function(e){n=n.filter(function(t){return!t_(t,e)})}(i[r]);return{arrayValue:{values:n}}}var Aw,Nw=(Gi(Rw,Aw=Q),Rw);function Rw(t,e){var n=this;return(n=Aw.call(this)||this).R=t,n.A=e,n}function Pw(t){return Wb(t.integerValue||t.doubleValue)}function Ow(t){return a_(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function Dw(t,e){this.version=t,this.transformResults=e}var xw=function(t,e){this.field=t,this.transform=e},Lw=(Mw.none=function(){return new Mw},Mw.exists=function(t){return new Mw(void 0,t)},Mw.updateTime=function(t){return new Mw(t)},Object.defineProperty(Mw.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!1,configurable:!0}),Mw.prototype.isEqual=function(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)},Mw);function Mw(t,e){this.updateTime=t,this.exists=e}function Fw(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}G=function(){};function jw(t,e,n){var r,i,o,s;t instanceof Kw?(i=e,o=n,Fw((r=t).precondition,i)&&(s=r.value.clone(),o=Yw(r.fieldTransforms,o,i),s.setAll(o),i.convertToFoundDocument(qw(i),s).setHasLocalMutations())):t instanceof Ww?(o=e,i=n,Fw((s=t).precondition,o)&&(n=Yw(s.fieldTransforms,i,o),(i=o.data).setAll(Gw(s)),i.setAll(n),o.convertToFoundDocument(qw(o),i).setHasLocalMutations())):(e=e,Fw(t.precondition,e)&&e.convertToNoDocument(Eb.min()))}function Uw(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&&wb(n,r,function(t,e){return e=e,(t=t).field.isEqual(e.field)&&(t=t.transform,e=e.transform,t instanceof _w&&e instanceof _w||t instanceof Sw&&e instanceof Sw?wb(t.elements,e.elements,t_):t instanceof Nw&&e instanceof Nw?t_(t.A,e.A):t instanceof bw&&e instanceof bw)})))&&(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 qw(t){return t.isFoundDocument()?t.version:Eb.min()}var Vw,Bw,Kw=(Gi(zw,Bw=G),zw),Ww=(Gi(Hw,Vw=G),Hw);function Hw(t,e,n,r,i){void 0===i&&(i=[]);var o=this;return(o=Vw.call(this)||this).key=t,o.data=e,o.fieldMask=n,o.precondition=r,o.fieldTransforms=i,o.type=1,o}function zw(t,e,n,r){void 0===r&&(r=[]);var i=this;return(i=Bw.call(this)||this).key=t,i.value=e,i.precondition=n,i.fieldTransforms=r,i.type=0,i}function Gw(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 Qw(t,e,n){var r=new Map;yb(t.length===n.length);for(var i=0;i<n.length;i++){var o=t[i],s=o.transform,a=e.data.field(o.field);r.set(o.field,(o=s,s=a,a=n[i],o instanceof _w?Iw(o,s):o instanceof Sw?Cw(o,s):a))}return r}function Yw(t,e,n){for(var r,i=new Map,o=0,s=t;o<s.length;o++){var a=s[o],u=a.transform,c=n.data.field(a.field);i.set(a.field,(r=c,a=e,c=void 0,(u=u)instanceof bw?(c={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:a.seconds,nanos:a.nanoseconds}}}},r&&(c.fields.__previous_value__=r),{mapValue:c}):u instanceof _w?Iw(u,r):u instanceof Sw?Cw(u,r):(u=vw(c=u,r),r=Pw(u)+Pw(c.A),s_(u)&&s_(c.A)?dw(r):pw(c.R,r))))}return i}function Xw(t){this.count=t}var $w,Jw,Zw,t0=(Gi(r0,Zw=G),r0),e0=(Gi(n0,Jw=G),n0);function n0(t,e){var n=this;return(n=Jw.call(this)||this).key=t,n.precondition=e,n.type=3,n.fieldTransforms=[],n}function r0(t,e){var n=this;return(n=Zw.call(this)||this).key=t,n.precondition=e,n.type=2,n.fieldTransforms=[],n}function i0(t){switch(t){case ab.OK:return vb(),0;case ab.CANCELLED:case ab.UNKNOWN:case ab.DEADLINE_EXCEEDED:case ab.RESOURCE_EXHAUSTED:case ab.INTERNAL:case ab.UNAVAILABLE:case ab.UNAUTHENTICATED:return;case ab.INVALID_ARGUMENT:case ab.NOT_FOUND:case ab.ALREADY_EXISTS:case ab.PERMISSION_DENIED:case ab.FAILED_PRECONDITION:case ab.ABORTED:case ab.OUT_OF_RANGE:case ab.UNIMPLEMENTED:case ab.DATA_LOSS:return 1;default:return vb(),0}}function o0(t){if(void 0===t)return pb("GRPC error has no .code"),ab.UNKNOWN;switch(t){case $w.OK:return ab.OK;case $w.CANCELLED:return ab.CANCELLED;case $w.UNKNOWN:return ab.UNKNOWN;case $w.DEADLINE_EXCEEDED:return ab.DEADLINE_EXCEEDED;case $w.RESOURCE_EXHAUSTED:return ab.RESOURCE_EXHAUSTED;case $w.INTERNAL:return ab.INTERNAL;case $w.UNAVAILABLE:return ab.UNAVAILABLE;case $w.UNAUTHENTICATED:return ab.UNAUTHENTICATED;case $w.INVALID_ARGUMENT:return ab.INVALID_ARGUMENT;case $w.NOT_FOUND:return ab.NOT_FOUND;case $w.ALREADY_EXISTS:return ab.ALREADY_EXISTS;case $w.PERMISSION_DENIED:return ab.PERMISSION_DENIED;case $w.FAILED_PRECONDITION:return ab.FAILED_PRECONDITION;case $w.ABORTED:return ab.ABORTED;case $w.OUT_OF_RANGE:return ab.OUT_OF_RANGE;case $w.UNIMPLEMENTED:return ab.UNIMPLEMENTED;case $w.DATA_LOSS:return ab.DATA_LOSS;default:return vb()}}(Q=$w=$w||{})[Q.OK=0]="OK",Q[Q.CANCELLED=1]="CANCELLED",Q[Q.UNKNOWN=2]="UNKNOWN",Q[Q.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",Q[Q.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",Q[Q.NOT_FOUND=5]="NOT_FOUND",Q[Q.ALREADY_EXISTS=6]="ALREADY_EXISTS",Q[Q.PERMISSION_DENIED=7]="PERMISSION_DENIED",Q[Q.UNAUTHENTICATED=16]="UNAUTHENTICATED",Q[Q.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",Q[Q.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",Q[Q.ABORTED=10]="ABORTED",Q[Q.OUT_OF_RANGE=11]="OUT_OF_RANGE",Q[Q.UNIMPLEMENTED=12]="UNIMPLEMENTED",Q[Q.INTERNAL=13]="INTERNAL",Q[Q.UNAVAILABLE=14]="UNAVAILABLE",Q[Q.DATA_LOSS=15]="DATA_LOSS";var s0=(l0.prototype.insert=function(t,e){return new l0(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,u0.BLACK,null,null))},l0.prototype.remove=function(t){return new l0(this.comparator,this.root.remove(t,this.comparator).copy(null,null,u0.BLACK,null,null))},l0.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},l0.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},l0.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(l0.prototype,"size",{get:function(){return this.root.size},enumerable:!1,configurable:!0}),l0.prototype.minKey=function(){return this.root.minKey()},l0.prototype.maxKey=function(){return this.root.maxKey()},l0.prototype.inorderTraversal=function(t){return this.root.inorderTraversal(t)},l0.prototype.forEach=function(n){this.inorderTraversal(function(t,e){return n(t,e),!1})},l0.prototype.toString=function(){var n=[];return this.inorderTraversal(function(t,e){return n.push(t+":"+e),!1}),"{"+n.join(", ")+"}"},l0.prototype.reverseTraversal=function(t){return this.root.reverseTraversal(t)},l0.prototype.getIterator=function(){return new a0(this.root,null,this.comparator,!1)},l0.prototype.getIteratorFrom=function(t){return new a0(this.root,t,this.comparator,!1)},l0.prototype.getReverseIterator=function(){return new a0(this.root,null,this.comparator,!0)},l0.prototype.getReverseIteratorFrom=function(t){return new a0(this.root,t,this.comparator,!0)},l0),a0=(h0.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},h0.prototype.hasNext=function(){return 0<this.nodeStack.length},h0.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}},h0),u0=(c0.prototype.copy=function(t,e,n,r,i){return new c0(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)},c0.prototype.isEmpty=function(){return!1},c0.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},c0.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},c0.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},c0.prototype.minKey=function(){return this.min().key},c0.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},c0.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()},c0.prototype.removeMin=function(){if(this.left.isEmpty())return c0.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()},c0.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 c0.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()},c0.prototype.isRed=function(){return this.color},c0.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},c0.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},c0.prototype.moveRedRight=function(){var t=this.colorFlip();return t=t.left.left.isRed()?(t=t.rotateRight()).colorFlip():t},c0.prototype.rotateLeft=function(){var t=this.copy(null,null,c0.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},c0.prototype.rotateRight=function(){var t=this.copy(null,null,c0.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},c0.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)},c0.prototype.checkMaxDepth=function(){var t=this.check();return Math.pow(2,t)<=this.size+1},c0.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw vb();if(this.right.isRed())throw vb();var t=this.left.check();if(t!==this.right.check())throw vb();return t+(this.isRed()?0:1)},c0);function c0(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:c0.RED,this.left=null!=r?r:c0.EMPTY,this.right=null!=i?i:c0.EMPTY,this.size=this.left.size+1+this.right.size}function h0(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 l0(t,e){this.comparator=t,this.root=e||u0.EMPTY}function f0(){this.size=0}u0.EMPTY=null,u0.RED=!0,u0.BLACK=!1,u0.EMPTY=(Object.defineProperty(f0.prototype,"key",{get:function(){throw vb()},enumerable:!1,configurable:!0}),Object.defineProperty(f0.prototype,"value",{get:function(){throw vb()},enumerable:!1,configurable:!0}),Object.defineProperty(f0.prototype,"color",{get:function(){throw vb()},enumerable:!1,configurable:!0}),Object.defineProperty(f0.prototype,"left",{get:function(){throw vb()},enumerable:!1,configurable:!0}),Object.defineProperty(f0.prototype,"right",{get:function(){throw vb()},enumerable:!1,configurable:!0}),f0.prototype.copy=function(t,e,n,r,i){return this},f0.prototype.insert=function(t,e,n){return new u0(t,e)},f0.prototype.remove=function(t,e){return this},f0.prototype.isEmpty=function(){return!0},f0.prototype.inorderTraversal=function(t){return!1},f0.prototype.reverseTraversal=function(t){return!1},f0.prototype.minKey=function(){return null},f0.prototype.maxKey=function(){return null},f0.prototype.isRed=function(){return!1},f0.prototype.checkMaxDepth=function(){return!0},f0.prototype.check=function(){return 0},new f0);var p0=(y0.prototype.has=function(t){return null!==this.data.get(t)},y0.prototype.first=function(){return this.data.minKey()},y0.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(y0.prototype,"size",{get:function(){return this.data.size},enumerable:!1,configurable:!0}),y0.prototype.indexOf=function(t){return this.data.indexOf(t)},y0.prototype.forEach=function(n){this.data.inorderTraversal(function(t,e){return n(t),!1})},y0.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)}},y0.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},y0.prototype.firstAfterOrEqual=function(t){t=this.data.getIteratorFrom(t);return t.hasNext()?t.getNext().key:null},y0.prototype.getIterator=function(){return new d0(this.data.getIterator())},y0.prototype.getIteratorFrom=function(t){return new d0(this.data.getIteratorFrom(t))},y0.prototype.add=function(t){return this.copy(this.data.remove(t).insert(t,!0))},y0.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},y0.prototype.isEmpty=function(){return this.data.isEmpty()},y0.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},y0.prototype.isEqual=function(t){if(!(t instanceof y0))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},y0.prototype.toArray=function(){var e=[];return this.forEach(function(t){e.push(t)}),e},y0.prototype.toString=function(){var e=[];return this.forEach(function(t){return e.push(t)}),"SortedSet("+e.toString()+")"},y0.prototype.copy=function(t){var e=new y0(this.comparator);return e.data=t,e},y0),d0=(v0.prototype.getNext=function(){return this.iter.getNext().key},v0.prototype.hasNext=function(){return this.iter.hasNext()},v0),g0=new s0($b.comparator);function v0(t){this.iter=t}function y0(t){this.comparator=t,this.data=new s0(this.comparator)}var m0=new s0($b.comparator);var b0=new s0($b.comparator);var _0=new p0($b.comparator);function w0(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n=_0,r=0,i=t;r<i.length;r++)var o=i[r],n=n.add(o);return n}var T0=new p0(_b);var I0=(D0.createSynthesizedRemoteEventForCurrentChange=function(t,e){var n=new Map;return n.set(t,E0.createSynthesizedTargetChangeForCurrentChange(t,e)),new D0(Eb.min(),n,T0,g0,w0())},D0),E0=(O0.createSynthesizedTargetChangeForCurrentChange=function(t,e){return new O0(Mb.EMPTY_BYTE_STRING,e,w0(),w0(),w0())},O0),S0=function(t,e,n,r){this.v=t,this.removedTargetIds=e,this.key=n,this.P=r},k0=function(t,e){this.targetId=t,this.V=e},C0=function(t,e,n,r){void 0===n&&(n=Mb.EMPTY_BYTE_STRING),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r},A0=(Object.defineProperty(P0.prototype,"current",{get:function(){return this.N},enumerable:!1,configurable:!0}),Object.defineProperty(P0.prototype,"resumeToken",{get:function(){return this.C},enumerable:!1,configurable:!0}),Object.defineProperty(P0.prototype,"F",{get:function(){return 0!==this.S},enumerable:!1,configurable:!0}),Object.defineProperty(P0.prototype,"$",{get:function(){return this.k},enumerable:!1,configurable:!0}),P0.prototype.O=function(t){0<t.approximateByteSize()&&(this.k=!0,this.C=t)},P0.prototype.M=function(){var n=w0(),r=w0(),i=w0();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:vb()}}),new E0(this.C,this.N,n,r,i)},P0.prototype.L=function(){this.k=!1,this.D=L0()},P0.prototype.B=function(t,e){this.k=!0,this.D=this.D.insert(t,e)},P0.prototype.q=function(t){this.k=!0,this.D=this.D.remove(t)},P0.prototype.U=function(){this.S+=1},P0.prototype.K=function(){--this.S},P0.prototype.j=function(){this.k=!0,this.N=!0},P0),N0=(R0.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)},R0.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.O(n.resumeToken);break;case 1:e.K(),e.F||e.L(),e.O(n.resumeToken);break;case 2:e.K(),e.F||r.removeTarget(t);break;case 3:r.st(t)&&(e.j(),e.O(n.resumeToken));break;case 4:r.st(t)&&(r.it(t),e.O(n.resumeToken));break;default:vb()}})},R0.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)})},R0.prototype.rt=function(t){var e=t.targetId,n=t.V.count,t=this.ot(e);t&&(__(t=t.target)?0===n?(t=new $b(t.path),this.tt(e,t,d_.newNoDocument(t,Eb.min()))):yb(1===n):this.ct(e)!==n&&(this.it(e),this.Y=this.Y.add(e)))},R0.prototype.ut=function(r){var i=this,o=new Map;this.G.forEach(function(t,e){var n=i.ot(e);n&&(t.current&&__(n.target)&&(n=new $b(n.target.path),null!==i.H.get(n)||i.at(e,n)||i.tt(e,n,d_.newNoDocument(n,r))),t.$&&(o.set(e,t.M()),t.L()))});var s=w0();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&&(s=s.add(t))});var t=new I0(r,o,this.Y,this.H,s);return this.H=g0,this.J=x0(),this.Y=new p0(_b),t},R0.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)))},R0.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)))},R0.prototype.removeTarget=function(t){this.G.delete(t)},R0.prototype.ct=function(t){var e=this.nt(t).M();return this.W.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size},R0.prototype.U=function(t){this.nt(t).U()},R0.prototype.nt=function(t){var e=this.G.get(t);return e||(e=new A0,this.G.set(t,e)),e},R0.prototype.ht=function(t){var e=this.J.get(t);return e||(e=new p0(_b),this.J=this.J.insert(t,e)),e},R0.prototype.st=function(t){var e=null!==this.ot(t);return e||fb("WatchChangeAggregator","Detected inactive target",t),e},R0.prototype.ot=function(t){var e=this.G.get(t);return e&&e.F?null:this.W.lt(t)},R0.prototype.it=function(e){var n=this;this.G.set(e,new A0),this.W.getRemoteKeysForTarget(e).forEach(function(t){n.tt(e,t,null)})},R0.prototype.at=function(t,e){return this.W.getRemoteKeysForTarget(t).has(e)},R0);function R0(t){this.W=t,this.G=new Map,this.H=g0,this.J=x0(),this.Y=new p0(_b)}function P0(){this.S=0,this.D=L0(),this.C=Mb.EMPTY_BYTE_STRING,this.N=!1,this.k=!0}function O0(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}function D0(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}function x0(){return new s0($b.comparator)}function L0(){return new s0($b.comparator)}var M0={asc:"ASCENDING",desc:"DESCENDING"},F0={"<":"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"},j0=function(t,e){this.databaseId=t,this.I=e};function U0(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 q0(t,e){return t.I?e.toBase64():e.toUint8Array()}function V0(t){return yb(!!t),Eb.fromTimestamp((t=Kb(t),new Ib(t.seconds,t.nanos)))}function B0(t,e){return new Ob(["projects",t.projectId,"databases",t.database]).child("documents").child(e).canonicalString()}function K0(t){t=Ob.fromString(t);return yb(cT(t)),t}function W0(t,e){return B0(t.databaseId,e.path)}function H0(t,e){e=K0(e);if(e.get(1)!==t.databaseId.projectId)throw new ub(ab.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 ub(ab.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+e.get(3)+" vs "+t.databaseId.database);return new $b(Y0(e))}function z0(t,e){return B0(t.databaseId,e)}function G0(t){t=K0(t);return 4===t.length?Ob.emptyPath():Y0(t)}function Q0(t){return new Ob(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Y0(t){return yb(4<t.length&&"documents"===t.get(4)),t.popFirst(5)}function X0(t,e,n){return{name:W0(t,e),fields:n.value.mapValue.fields}}function $0(t,e,n){var r=H0(t,e.name),t=V0(e.updateTime),e=new f_({mapValue:{fields:e.fields}}),e=d_.newFoundDocument(r,t,e);return n&&e.setHasCommittedMutations(),n?e.setHasCommittedMutations():e}function J0(t,e){var n,r,i;if(e instanceof Kw)n={update:X0(t,e.key,e.value)};else if(e instanceof t0)n={delete:W0(t,e.key)};else if(e instanceof Ww)n={update:X0(t,e.key,e.data),updateMask:(r=e.fieldMask,i=[],r.fields.forEach(function(t){return i.push(t.canonicalString())}),{fieldPaths:i})};else{if(!(e instanceof e0))return vb();n={verify:W0(t,e.key)}}return 0<e.fieldTransforms.length&&(n.updateTransforms=e.fieldTransforms.map(function(t){var e=t.transform;if(e instanceof bw)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(e instanceof _w)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:e.elements}};if(e instanceof Sw)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:e.elements}};if(e instanceof Nw)return{fieldPath:t.field.canonicalString(),increment:e.A};throw vb()})),e.precondition.isNone||(n.currentDocument=void 0!==(e=e.precondition).updateTime?{updateTime:U0(t,e.updateTime.toTimestamp())}:void 0!==e.exists?{exists:e.exists}:vb()),n}function Z0(e,t){var n=t.currentDocument?void 0!==(s=t.currentDocument).updateTime?Lw.updateTime(V0(s.updateTime)):void 0!==s.exists?Lw.exists(s.exists):Lw.none():Lw.none(),r=t.updateTransforms?t.updateTransforms.map(function(t){return function(t,e){var n,r=null;"setToServerValue"in e?(yb("REQUEST_TIME"===e.setToServerValue),r=new bw):"appendMissingElements"in e?(n=e.appendMissingElements.values||[],r=new _w(n)):"removeAllFromArray"in e?(n=e.removeAllFromArray.values||[],r=new Sw(n)):"increment"in e?r=new Nw(t,e.increment):vb();e=xb.fromServerFormat(e.fieldPath);return new xw(e,r)}(e,t)}):[];if(t.update){t.update.name;var i=H0(e,t.update.name),o=new f_({mapValue:{fields:t.update.fields}});if(t.updateMask){var s=(s=t.updateMask.fieldPaths||[],new Lb(s.map(function(t){return xb.fromServerFormat(t)})));return new Ww(i,o,s,n,r)}return new Kw(i,o,n,r)}if(t.delete){r=H0(e,t.delete);return new t0(r,n)}if(t.verify){t=H0(e,t.verify);return new e0(t,n)}return vb()}function tT(t,e){return{documents:[z0(t,e.path)]}}function eT(t,e){var n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=z0(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=z0(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(c_(t.value))return{unaryFilter:{field:oT(t.field),op:"IS_NAN"}};if(u_(t.value))return{unaryFilter:{field:oT(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(c_(t.value))return{unaryFilter:{field:oT(t.field),op:"IS_NOT_NAN"}};if(u_(t.value))return{unaryFilter:{field:oT(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:oT(t.field),op:(e=t.op,F0[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:oT((t=t).field),direction:(t=t.dir,M0[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=rT(e.startAt)),e.endAt&&(n.structuredQuery.endAt=rT(e.endAt)),n}function nT(t){var e=G0(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0,i=null;0<r&&(yb(1===r),(a=n.from[0]).allDescendants?i=a.collectionId:e=e.child(a.collectionId));var o=[];n.where&&(o=function e(t){return t?void 0!==t.unaryFilter?[uT(t)]:void 0!==t.fieldFilter?[aT(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e(t)}).reduce(function(t,e){return t.concat(e)}):vb():[]}(n.where));var s=[],t=null,r=null,a=null;return J_(e,i,s=n.orderBy?n.orderBy.map(function(t){return new Q_(sT((e=t).field),function(){switch(e.direction){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}());var e}):s,o,t=n.limit?Qb(o="object"==typeof(o=n.limit)?o.value:o)?null:o:t,"F",r=n.startAt?iT(n.startAt):r,a=n.endAt?iT(n.endAt):a)}function rT(t){return{before:t.before,values:t.position}}function iT(t){var e=!!t.before,t=t.values||[];return new B_(t,e)}function oT(t){return{fieldPath:t.canonicalString()}}function sT(t){return xb.fromServerFormat(t.fieldPath)}function aT(t){return T_.create(sT(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 vb()}}(),t.fieldFilter.value)}function uT(t){switch(t.unaryFilter.op){case"IS_NAN":var e=sT(t.unaryFilter.field);return T_.create(e,"==",{doubleValue:NaN});case"IS_NULL":e=sT(t.unaryFilter.field);return T_.create(e,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":var n=sT(t.unaryFilter.field);return T_.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":n=sT(t.unaryFilter.field);return T_.create(n,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":default:return vb()}}function cT(t){return 4<=t.length&&"projects"===t.get(0)&&"databases"===t.get(2)}function hT(t){for(var e="",n=0;n<t.length;n++)0<e.length&&(e=lT(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 lT(e)}function lT(t){return t+""}function fT(t){var e=t.length;if(yb(2<=e),2===e)return yb(""===t.charAt(0)&&""===t.charAt(1)),Ob.emptyPath();for(var n=e-2,r=[],i="",o=0;o<e;){var s=t.indexOf("",o);switch((s<0||n<s)&&vb(),t.charAt(s+1)){case"":var a=t.substring(o,s),u=void 0;0===i.length?u=a:(u=i+=a,i=""),r.push(u);break;case"":i+=t.substring(o,s),i+="\0";break;case"":i+=t.substring(o,s+1);break;default:vb()}o=s+2}return new Ob(r)}function pT(t,e,n){this.ownerId=t,this.allowTabSynchronization=e,this.leaseTimestampMs=n}var dT=function(t,e){this.seconds=t,this.nanoseconds=e};pT.store="owner",pT.key="owner";function gT(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}gT.store="mutationQueues",gT.keyPath="userId";function vT(t,e,n,r,i){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.baseMutations=r,this.mutations=i}vT.store="mutations",vT.keyPath="batchId",vT.userMutationsIndex="userMutationsIndex",vT.userMutationsKeyPath=["userId","batchId"];var yT=(mT.prefixForUser=function(t){return[t]},mT.prefixForPath=function(t,e){return[t,hT(e)]},mT.key=function(t,e,n){return[t,hT(e),n]},mT);function mT(){}yT.store="documentMutations",yT.PLACEHOLDER=new yT;function bT(t,e){this.path=t,this.readTime=e}function _T(t,e){this.path=t,this.version=e}var wT=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};wT.store="remoteDocuments",wT.readTimeIndex="readTimeIndex",wT.readTimeIndexPath="readTime",wT.collectionReadTimeIndex="collectionReadTimeIndex",wT.collectionReadTimeIndexPath=["parentPath","readTime"];function TT(t){this.byteSize=t}TT.store="remoteDocumentGlobal",TT.key="remoteDocumentGlobalKey";function IT(t,e,n,r,i,o,s){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.lastLimboFreeSnapshotVersion=o,this.query=s}IT.store="targets",IT.keyPath="targetId",IT.queryTargetsIndexName="queryTargetsIndex",IT.queryTargetsKeyPath=["canonicalId","targetId"];var ET=function(t,e,n){this.targetId=t,this.path=e,this.sequenceNumber=n};ET.store="targetDocuments",ET.keyPath=["targetId","path"],ET.documentTargetsIndex="documentTargetsIndex",ET.documentTargetsKeyPath=["path","targetId"];function ST(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}ST.key="targetGlobalKey",ST.store="targetGlobal";function kT(t,e){this.collectionId=t,this.parent=e}kT.store="collectionParents",kT.keyPath=["collectionId","parent"];function CT(t,e,n,r){this.clientId=t,this.updateTimeMs=e,this.networkEnabled=n,this.inForeground=r}CT.store="clientMetadata",CT.keyPath="clientId";function AT(t,e,n){this.bundleId=t,this.createTime=e,this.version=n}AT.store="bundles",AT.keyPath="bundleId";function NT(t,e,n){this.name=t,this.readTime=e,this.bundledQuery=n}NT.store="namedQueries",NT.keyPath="name";var RT,PT=Zi(Zi([],Zi(Zi([],Zi(Zi([],Zi(Zi([],[gT.store,vT.store,yT.store,wT.store,IT.store,pT.store,ST.store,ET.store]),[CT.store])),[TT.store])),[kT.store])),[AT.store,NT.store]),OT="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.",G=(WT.prototype.addOnCommittedListener=function(t){this.onCommittedListeners.push(t)},WT.prototype.raiseOnCommittedEvent=function(){this.onCommittedListeners.forEach(function(t){return t()})},WT),DT=function(){var n=this;this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})},xT=(KT.prototype.catch=function(t){return this.next(void 0,t)},KT.prototype.next=function(r,i){var o=this;return this.callbackAttached&&vb(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(i,this.error):this.wrapSuccess(r,this.result):new KT(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)}})},KT.prototype.toPromise=function(){var n=this;return new Promise(function(t,e){n.next(t,e)})},KT.prototype.wrapUserFunction=function(t){try{var e=t();return e instanceof KT?e:KT.resolve(e)}catch(t){return KT.reject(t)}},KT.prototype.wrapSuccess=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):KT.resolve(e)},KT.prototype.wrapFailure=function(t,e){return t?this.wrapUserFunction(function(){return t(e)}):KT.reject(e)},KT.resolve=function(n){return new KT(function(t,e){t(n)})},KT.reject=function(n){return new KT(function(t,e){e(n)})},KT.waitFor=function(t){return new KT(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()})},KT.or=function(t){for(var n=KT.resolve(!1),e=0,r=t;e<r.length;e++)!function(e){n=n.next(function(t){return t?KT.resolve(t):e()})}(r[e]);return n},KT.forEach=function(t,n){var r=this,i=[];return t.forEach(function(t,e){i.push(n.call(r,t,e))}),this.waitFor(i)},KT),LT=(BT.open=function(t,e,n,r){try{return new BT(e,t.transaction(r,n))}catch(t){throw new jT(e,t)}},Object.defineProperty(BT.prototype,"dt",{get:function(){return this.ft.promise},enumerable:!1,configurable:!0}),BT.prototype.abort=function(t){t&&this.ft.reject(t),this.aborted||(fb("SimpleDb","Aborting transaction:",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},BT.prototype.store=function(t){t=this.transaction.objectStore(t);return new zT(t)},BT),MT=(VT.delete=function(t){return fb("SimpleDb","Removing database:",t),QT(window.indexedDB.deleteDatabase(t)).toPromise()},VT.yt=function(){if("undefined"==typeof indexedDB)return!1;if(VT.gt())return!0;var t=po(),e=VT._t(t),n=0<e&&e<10,e=VT.Et(t),e=0<e&&e<4.5;return!(0<t.indexOf("MSIE ")||0<t.indexOf("Trident/")||0<t.indexOf("Edge/")||n||e)},VT.gt=function(){var t;return"undefined"!=typeof process&&"YES"===(null===(t=process.env)||void 0===t?void 0:t.Tt)},VT.It=function(t,e){return t.store(e)},VT._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)},VT.Et=function(t){t=t.match(/Android ([\d.]+)/i),t=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(t)},VT.prototype.At=function(o){return Yi(this,void 0,void 0,function(){var e,i=this;return Xi(this,function(t){switch(t.label){case 0:return this.db?[3,2]:(fb("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 jT(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 ub(ab.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 jT(o,t))},r.onupgradeneeded=function(t){fb("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(){fb("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)]}})})},VT.prototype.vt=function(e){this.bt=e,this.db&&(this.db.onversionchange=function(t){return e(t)})},VT.prototype.runTransaction=function(a,n,u,c){return Yi(this,void 0,void 0,function(){var i,o,s,e;return Xi(this,function(t){switch(t.label){case 0:i="readonly"===n,o=0,e=function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:++o,t.label=1;case 1:return t.trys.push([1,4,,5]),[4,s.At(a)];case 2:return s.db=t.sent(),e=LT.open(s.db,a,i?"readonly":"readwrite",u),n=c(e).catch(function(t){return e.abort(t),xT.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,fb("SimpleDb","Transaction failed with error:",n.message,"Retrying:",r),s.close(),r?[3,5]:[2,{value:Promise.reject(n)}];case 5:return[2]}})},s=this,t.label=1;case 1:return[5,e()];case 2:if("object"==typeof(e=t.sent()))return[2,e.value];t.label=3;case 3:return[3,1];case 4:return[2]}})})},VT.prototype.close=function(){this.db&&this.db.close(),this.db=void 0},VT),FT=(Object.defineProperty(qT.prototype,"isDone",{get:function(){return this.Vt},enumerable:!1,configurable:!0}),Object.defineProperty(qT.prototype,"Dt",{get:function(){return this.St},enumerable:!1,configurable:!0}),Object.defineProperty(qT.prototype,"cursor",{set:function(t){this.Pt=t},enumerable:!1,configurable:!0}),qT.prototype.done=function(){this.Vt=!0},qT.prototype.Ct=function(t){this.St=t},qT.prototype.delete=function(){return QT(this.Pt.delete())},qT),jT=(Gi(UT,RT=ub),UT);function UT(t,e){var n=this;return(n=RT.call(this,ab.UNAVAILABLE,"IndexedDB transaction '"+t+"' failed: "+e)||this).name="IndexedDbTransactionError",n}function qT(t){this.Pt=t,this.Vt=!1,this.St=null}function VT(t,e,n){this.name=t,this.version=e,this.wt=n,12.2===VT._t(po())&&pb("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 BT(e,t){var n=this;this.action=e,this.transaction=t,this.aborted=!1,this.ft=new DT,this.transaction.oncomplete=function(){n.ft.resolve()},this.transaction.onabort=function(){t.error?n.ft.reject(new jT(e,t.error)):n.ft.resolve()},this.transaction.onerror=function(t){t=XT(t.target.error);n.ft.reject(new jT(e,t))}}function KT(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 WT(){this.onCommittedListeners=[]}function HT(t){return"IndexedDbTransactionError"===t.name}var zT=(GT.prototype.put=function(t,e){t=void 0!==e?(fb("SimpleDb","PUT",this.store.name,t,e),this.store.put(e,t)):(fb("SimpleDb","PUT",this.store.name,"<auto-key>",t),this.store.put(t));return QT(t)},GT.prototype.add=function(t){return fb("SimpleDb","ADD",this.store.name,t,t),QT(this.store.add(t))},GT.prototype.get=function(e){var n=this;return QT(this.store.get(e)).next(function(t){return fb("SimpleDb","GET",n.store.name,e,t=void 0===t?null:t),t})},GT.prototype.delete=function(t){return fb("SimpleDb","DELETE",this.store.name,t),QT(this.store.delete(t))},GT.prototype.count=function(){return fb("SimpleDb","COUNT",this.store.name),QT(this.store.count())},GT.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})},GT.prototype.kt=function(t,e){fb("SimpleDb","DELETE ALL",this.store.name);e=this.options(t,e);e.Ft=!1;e=this.cursor(e);return this.xt(e,function(t,e,n){return n.delete()})},GT.prototype.$t=function(t,e){e?n=t:(n={},e=t);var n=this.cursor(n);return this.xt(n,e)},GT.prototype.Ot=function(r){var t=this.cursor({});return new xT(function(n,e){t.onerror=function(t){t=XT(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()}})},GT.prototype.xt=function(t,i){var o=[];return new xT(function(r,e){t.onerror=function(t){e(t.target.error)},t.onsuccess=function(t){var e,n=t.target.result;n?(e=new FT(n),(t=i(n.primaryKey,n.value,e))instanceof xT&&(t=t.catch(function(t){return e.done(),xT.reject(t)}),o.push(t)),e.isDone?r():null===e.Dt?n.continue():n.continue(e.Dt)):r()}}).next(function(){return xT.waitFor(o)})},GT.prototype.options=function(t,e){var n;return void 0!==t&&("string"==typeof t?n=t:e=t),{index:n,range:e}},GT.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.Ft?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},GT);function GT(t){this.store=t}function QT(t){return new xT(function(e,n){t.onsuccess=function(t){t=t.target.result;e(t)},t.onerror=function(t){t=XT(t.target.error);n(t)}})}var YT=!1;function XT(t){var e=MT._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 ub("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 YT||(YT=!0,setTimeout(function(){throw n},0)),n}}return t}var $T,JT=(Gi(ZT,$T=G),ZT);function ZT(t,e){var n=this;return(n=$T.call(this)||this).Mt=t,n.currentSequenceNumber=e,n}function tI(t,e){return MT.It(t.Mt,e)}var eI=(aI.prototype.applyToRemoteDocument=function(t,e){for(var n,r,i,o,s,a,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=a=s=o=void 0,n instanceof Kw?(s=r,a=i,h=(o=n).value.clone(),o=Qw(o.fieldTransforms,s,a.transformResults),h.setAll(o),s.convertToFoundDocument(a.version,h).setHasCommittedMutations()):n instanceof Ww?(o=r,s=i,Fw((a=n).precondition,o)?(h=Qw(a.fieldTransforms,o,s.transformResults),(n=o.data).setAll(Gw(a)),n.setAll(h),o.convertToFoundDocument(s.version,n).setHasCommittedMutations()):o.convertToUnknownDocument(s.version)):r.convertToNoDocument(i.version).setHasCommittedMutations())}},aI.prototype.applyToLocalView=function(t){for(var e=0,n=this.baseMutations;e<n.length;e++)(r=n[e]).key.isEqual(t.key)&&jw(r,t,this.localWriteTime);for(var r,i=0,o=this.mutations;i<o.length;i++)(r=o[i]).key.isEqual(t.key)&&jw(r,t,this.localWriteTime)},aI.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(Eb.min())})},aI.prototype.keys=function(){return this.mutations.reduce(function(t,e){return t.add(e.key)},w0())},aI.prototype.isEqual=function(t){return this.batchId===t.batchId&&wb(this.mutations,t.mutations,Uw)&&wb(this.baseMutations,t.baseMutations,Uw)},aI),nI=(sI.from=function(t,e,n){yb(t.mutations.length===n.length);for(var r=b0,i=t.mutations,o=0;o<i.length;o++)r=r.insert(i[o].key,n[o].version);return new sI(t,e,n,r)},sI),rI=(oI.prototype.withSequenceNumber=function(t){return new oI(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)},oI.prototype.withResumeToken=function(t,e){return new oI(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)},oI.prototype.withLastLimboFreeSnapshotVersion=function(t){return new oI(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)},oI),iI=function(t){this.Lt=t};function oI(t,e,n,r,i,o,s){void 0===i&&(i=Eb.min()),void 0===o&&(o=Eb.min()),void 0===s&&(s=Mb.EMPTY_BYTE_STRING),this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=s}function sI(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}function aI(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}function uI(t,e){if(e.document)return $0(t.Lt,e.document,!!e.hasCommittedMutations);if(e.noDocument){var n=$b.fromSegments(e.noDocument.path),r=pI(e.noDocument.readTime),n=d_.newNoDocument(n,r);return e.hasCommittedMutations?n.setHasCommittedMutations():n}if(e.unknownDocument){n=$b.fromSegments(e.unknownDocument.path),r=pI(e.unknownDocument.version);return d_.newUnknownDocument(n,r)}return vb()}function cI(t,e,n){var r=hI(n),n=e.key.path.popLast().toArray();if(e.isFoundDocument()){var i={name:W0(o=t.Lt,(s=e).key),fields:s.data.value.mapValue.fields,updateTime:U0(o,s.version.toTimestamp())},o=e.hasCommittedMutations;return new wT(null,null,i,o,r,n)}if(e.isNoDocument()){var s=e.key.path.toArray(),i=fI(e.version),o=e.hasCommittedMutations;return new wT(null,new bT(s,i),null,o,r,n)}if(e.isUnknownDocument()){o=e.key.path.toArray(),e=fI(e.version);return new wT(new _T(o,e),null,null,!0,r,n)}return vb()}function hI(t){t=t.toTimestamp();return[t.seconds,t.nanoseconds]}function lI(t){t=new Ib(t[0],t[1]);return Eb.fromTimestamp(t)}function fI(t){t=t.toTimestamp();return new dT(t.seconds,t.nanoseconds)}function pI(t){t=new Ib(t.seconds,t.nanoseconds);return Eb.fromTimestamp(t)}function dI(e,t){for(var n=(t.baseMutations||[]).map(function(t){return Z0(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 s=t.mutations.map(function(t){return Z0(e.Lt,t)}),a=Ib.fromMillis(t.localWriteTimeMs);return new eI(t.batchId,a,n,s)}function gI(t){var e=pI(t.readTime),n=void 0!==t.lastLimboFreeSnapshotVersion?pI(t.lastLimboFreeSnapshotVersion):Eb.min(),r=void 0!==t.query.documents?(yb(1===(r=t.query).documents.length),sw(Z_(G0(r.documents[0])))):sw(nT(t.query));return new rI(r,t.targetId,0,t.lastListenSequenceNumber,e,n,Mb.fromBase64String(t.resumeToken))}function vI(t,e){var n=fI(e.snapshotVersion),r=fI(e.lastLimboFreeSnapshotVersion),i=(__(e.target)?tT:eT)(t.Lt,e.target),t=e.resumeToken.toBase64();return new IT(e.targetId,m_(e.target),n,t,e.sequenceNumber,r,i)}function yI(t){var e=nT({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?aw(e,e.limit,"L"):e}var mI=(bI.prototype.getBundleMetadata=function(t,e){return _I(t).get(e).next(function(t){if(t)return{id:(t=t).bundleId,createTime:pI(t.createTime),version:t.version}})},bI.prototype.saveBundleMetadata=function(t,e){return _I(t).put({bundleId:(e=e).id,createTime:fI(V0(e.createTime)),version:e.version})},bI.prototype.getNamedQuery=function(t,e){return wI(t).get(e).next(function(t){if(t)return{name:(t=t).name,query:yI(t.bundledQuery),readTime:pI(t.readTime)}})},bI.prototype.saveNamedQuery=function(t,e){return wI(t).put({name:(e=e).name,readTime:fI(V0(e.readTime)),bundledQuery:e.bundledQuery})},bI);function bI(){}function _I(t){return tI(t,AT.store)}function wI(t){return tI(t,NT.store)}var TI=(CI.prototype.addToCollectionParentIndex=function(t,e){return this.Bt.add(e),xT.resolve()},CI.prototype.getCollectionParents=function(t,e){return xT.resolve(this.Bt.getEntries(e))},CI),II=(kI.prototype.add=function(t){var e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new p0(Ob.comparator),t=!r.has(n);return this.index[e]=r.add(n),t},kI.prototype.has=function(t){var e=t.lastSegment(),t=t.popLast(),e=this.index[e];return e&&e.has(t)},kI.prototype.getEntries=function(t){return(this.index[t]||new p0(Ob.comparator)).toArray()},kI),EI=(SI.prototype.addToCollectionParentIndex=function(t,e){var n=this;if(this.qt.has(e))return xT.resolve();var r=e.lastSegment(),i=e.popLast();t.addOnCommittedListener(function(){n.qt.add(e)});i={collectionId:r,parent:hT(i)};return AI(t).put(i)},SI.prototype.getCollectionParents=function(t,i){var o=[],e=IDBKeyRange.bound([i,""],[Tb(i),""],!1,!0);return AI(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(fT(r.parent))}return o})},SI);function SI(){this.qt=new II}function kI(){this.index={}}function CI(){this.Bt=new II}function AI(t){return tI(t,kT.store)}var NI={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},RI=(PI.withCacheSize=function(t){return new PI(t,PI.DEFAULT_COLLECTION_PERCENTILE,PI.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)},PI);function PI(t,e,n){this.cacheSizeCollectionThreshold=t,this.percentileToCollect=e,this.maximumSequenceNumbersToCollect=n}function OI(t,e,n){var r=t.store(vT.store),i=t.store(yT.store),o=[],t=IDBKeyRange.only(n.batchId),s=0,t=r.$t({range:t},function(t,e,n){return s++,n.delete()});o.push(t.next(function(){yb(1===s)}));for(var a=[],u=0,c=n.mutations;u<c.length;u++){var h=c[u],l=yT.key(e,h.key.path,n.batchId);o.push(i.delete(l)),a.push(h.key)}return xT.waitFor(o).next(function(){return a})}function DI(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 vb();e=t.noDocument}return JSON.stringify(e).length}RI.DEFAULT_COLLECTION_PERCENTILE=10,RI.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,RI.DEFAULT=new RI(41943040,RI.DEFAULT_COLLECTION_PERCENTILE,RI.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),RI.DISABLED=new RI(-1,0,0);var xI=(LI.Qt=function(t,e,n,r){return yb(""!==t.uid),new LI(t.isAuthenticated()?t.uid:"",e,n,r)},LI.prototype.checkEmpty=function(t){var r=!0,e=IDBKeyRange.bound([this.userId,Number.NEGATIVE_INFINITY],[this.userId,Number.POSITIVE_INFINITY]);return FI(t).$t({index:vT.userMutationsIndex,range:e},function(t,e,n){r=!1,n.done()}).next(function(){return r})},LI.prototype.addMutationBatch=function(d,g,v,y){var m=this,b=jI(d),_=FI(d);return _.add({}).next(function(t){yb("number"==typeof t);for(var e,n,r,i,o,s=new eI(t,g,v,y),a=(e=m.R,n=m.userId,i=(r=s).baseMutations.map(function(t){return J0(e.Lt,t)}),o=r.mutations.map(function(t){return J0(e.Lt,t)}),new vT(n,r.batchId,r.localWriteTime.toMillis(),i,o)),u=[],c=new p0(function(t,e){return _b(t.canonicalString(),e.canonicalString())}),h=0,l=y;h<l.length;h++){var f=l[h],p=yT.key(m.userId,f.key.path,t),c=c.add(f.key.path.popLast());u.push(_.put(a)),u.push(b.put(p,yT.PLACEHOLDER))}return c.forEach(function(t){u.push(m.Ut.addToCollectionParentIndex(d,t))}),d.addOnCommittedListener(function(){m.Kt[t]=s.keys()}),xT.waitFor(u).next(function(){return s})})},LI.prototype.lookupMutationBatch=function(t,e){var n=this;return FI(t).get(e).next(function(t){return t?(yb(t.userId===n.userId),dI(n.R,t)):null})},LI.prototype.jt=function(t,e){var n=this;return this.Kt[e]?xT.resolve(this.Kt[e]):this.lookupMutationBatch(t,e).next(function(t){if(t){t=t.keys();return n.Kt[e]=t}return null})},LI.prototype.getNextMutationBatchAfterBatchId=function(t,e){var r=this,i=e+1,e=IDBKeyRange.lowerBound([this.userId,i]),o=null;return FI(t).$t({index:vT.userMutationsIndex,range:e},function(t,e,n){e.userId===r.userId&&(yb(e.batchId>=i),o=dI(r.R,e)),n.done()}).next(function(){return o})},LI.prototype.getHighestUnacknowledgedBatchId=function(t){var e=IDBKeyRange.upperBound([this.userId,Number.POSITIVE_INFINITY]),r=-1;return FI(t).$t({index:vT.userMutationsIndex,range:e,reverse:!0},function(t,e,n){r=e.batchId,n.done()}).next(function(){return r})},LI.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return FI(t).Nt(vT.userMutationsIndex,n).next(function(t){return t.map(function(t){return dI(e.R,t)})})},LI.prototype.getAllMutationBatchesAffectingDocumentKey=function(o,s){var a=this,t=yT.prefixForPath(this.userId,s.path),t=IDBKeyRange.lowerBound(t),u=[];return jI(o).$t({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=fT(i);if(r===a.userId&&s.path.isEqual(i))return FI(o).get(t).next(function(t){if(!t)throw vb();yb(t.userId===a.userId),u.push(dI(a.R,t))});n.done()}).next(function(){return u})},LI.prototype.getAllMutationBatchesAffectingDocumentKeys=function(e,t){var s=this,a=new p0(_b),n=[];return t.forEach(function(o){var t=yT.prefixForPath(s.userId,o.path),t=IDBKeyRange.lowerBound(t),t=jI(e).$t({range:t},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=fT(i);r===s.userId&&o.path.isEqual(i)?a=a.add(t):n.done()});n.push(t)}),xT.waitFor(n).next(function(){return s.Wt(e,a)})},LI.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var o=this,s=e.path,a=s.length+1,e=yT.prefixForPath(this.userId,s),e=IDBKeyRange.lowerBound(e),u=new p0(_b);return jI(t).$t({range:e},function(t,e,n){var r=t[0],i=t[1],t=t[2],i=fT(i);r===o.userId&&s.isPrefixOf(i)?i.length===a&&(u=u.add(t)):n.done()}).next(function(){return o.Wt(t,u)})},LI.prototype.Wt=function(e,t){var n=this,r=[],i=[];return t.forEach(function(t){i.push(FI(e).get(t).next(function(t){if(null===t)throw vb();yb(t.userId===n.userId),r.push(dI(n.R,t))}))}),xT.waitFor(i).next(function(){return r})},LI.prototype.removeMutationBatch=function(e,n){var r=this;return OI(e.Mt,this.userId,n).next(function(t){return e.addOnCommittedListener(function(){r.Gt(n.batchId)}),xT.forEach(t,function(t){return r.referenceDelegate.markPotentiallyOrphaned(e,t)})})},LI.prototype.Gt=function(t){delete this.Kt[t]},LI.prototype.performConsistencyCheck=function(e){var i=this;return this.checkEmpty(e).next(function(t){if(!t)return xT.resolve();var t=IDBKeyRange.lowerBound(yT.prefixForUser(i.userId)),r=[];return jI(e).$t({range:t},function(t,e,n){t[0]===i.userId?(t=fT(t[1]),r.push(t)):n.done()}).next(function(){yb(0===r.length)})})},LI.prototype.containsKey=function(t,e){return MI(t,this.userId,e)},LI.prototype.zt=function(t){var e=this;return UI(t).get(this.userId).next(function(t){return t||new gT(e.userId,-1,"")})},LI);function LI(t,e,n,r){this.userId=t,this.R=e,this.Ut=n,this.referenceDelegate=r,this.Kt={}}function MI(t,o,e){var e=yT.prefixForPath(o,e.path),s=e[1],e=IDBKeyRange.lowerBound(e),a=!1;return jI(t).$t({range:e,Ft:!0},function(t,e,n){var r=t[0],i=t[1];t[2],r===o&&i===s&&(a=!0),n.done()}).next(function(){return a})}function FI(t){return tI(t,vT.store)}function jI(t){return tI(t,yT.store)}function UI(t){return tI(t,gT.store)}var qI=(KI.prototype.next=function(){return this.Ht+=2,this.Ht},KI.Jt=function(){return new KI(0)},KI.Yt=function(){return new KI(-1)},KI),VI=(BI.prototype.allocateTargetId=function(n){var r=this;return this.Xt(n).next(function(t){var e=new qI(t.highestTargetId);return t.highestTargetId=e.next(),r.Zt(n,t).next(function(){return t.highestTargetId})})},BI.prototype.getLastRemoteSnapshotVersion=function(t){return this.Xt(t).next(function(t){return Eb.fromTimestamp(new Ib(t.lastRemoteSnapshotVersion.seconds,t.lastRemoteSnapshotVersion.nanoseconds))})},BI.prototype.getHighestSequenceNumber=function(t){return this.Xt(t).next(function(t){return t.highestListenSequenceNumber})},BI.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)})},BI.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)})})},BI.prototype.updateTargetData=function(t,e){return this.te(t,e)},BI.prototype.removeTargetData=function(e,t){var n=this;return this.removeMatchingKeysForTargetId(e,t.targetId).next(function(){return WI(e).delete(t.targetId)}).next(function(){return n.Xt(e)}).next(function(t){return yb(0<t.targetCount),--t.targetCount,n.Zt(e,t)})},BI.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return WI(n).$t(function(t,e){e=gI(e);e.sequenceNumber<=r&&null===i.get(e.targetId)&&(s++,a.push(o.removeTargetData(n,e)))}).next(function(){return xT.waitFor(a)}).next(function(){return s})},BI.prototype.forEachTarget=function(t,n){return WI(t).$t(function(t,e){e=gI(e);n(e)})},BI.prototype.Xt=function(t){return HI(t).get(ST.key).next(function(t){return yb(null!==t),t})},BI.prototype.Zt=function(t,e){return HI(t).put(ST.key,e)},BI.prototype.te=function(t,e){return WI(t).put(vI(this.R,e))},BI.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},BI.prototype.getTargetCount=function(t){return this.Xt(t).next(function(t){return t.targetCount})},BI.prototype.getTargetData=function(t,r){var e=m_(r),e=IDBKeyRange.bound([e,Number.NEGATIVE_INFINITY],[e,Number.POSITIVE_INFINITY]),i=null;return WI(t).$t({range:e,index:IT.queryTargetsIndexName},function(t,e,n){e=gI(e);b_(r,e.target)&&(i=e,n.done())}).next(function(){return i})},BI.prototype.addMatchingKeys=function(n,t,r){var i=this,o=[],s=zI(n);return t.forEach(function(t){var e=hT(t.path);o.push(s.put(new ET(r,e))),o.push(i.referenceDelegate.addReference(n,r,t))}),xT.waitFor(o)},BI.prototype.removeMatchingKeys=function(n,t,r){var i=this,o=zI(n);return xT.forEach(t,function(t){var e=hT(t.path);return xT.waitFor([o.delete([r,e]),i.referenceDelegate.removeReference(n,r,t)])})},BI.prototype.removeMatchingKeysForTargetId=function(t,e){t=zI(t),e=IDBKeyRange.bound([e],[e+1],!1,!0);return t.delete(e)},BI.prototype.getMatchingKeysForTargetId=function(t,e){var e=IDBKeyRange.bound([e],[e+1],!1,!0),t=zI(t),r=w0();return t.$t({range:e,Ft:!0},function(t,e,n){t=fT(t[1]),t=new $b(t);r=r.add(t)}).next(function(){return r})},BI.prototype.containsKey=function(t,e){var e=hT(e.path),e=IDBKeyRange.bound([e],[Tb(e)],!1,!0),i=0;return zI(t).$t({index:ET.documentTargetsIndex,Ft:!0,range:e},function(t,e,n){var r=t[0];t[1],0!==r&&(i++,n.done())}).next(function(){return 0<i})},BI.prototype.lt=function(t,e){return WI(t).get(e).next(function(t){return t?gI(t):null})},BI);function BI(t,e){this.referenceDelegate=t,this.R=e}function KI(t){this.Ht=t}function WI(t){return tI(t,IT.store)}function HI(t){return tI(t,ST.store)}function zI(t){return tI(t,ET.store)}function GI(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){if(e.code!==ab.FAILED_PRECONDITION||e.message!==OT)throw e;return fb("LocalStore","Unexpectedly lost primary lease"),[2]})})}function QI(t,e){var n=t[0],r=t[1],t=e[0],e=e[1],t=_b(n,t);return 0===t?_b(r,e):t}var YI=(nE.prototype.ie=function(){return++this.se},nE.prototype.re=function(t){var e=[t,this.ie()];this.buffer.size<this.ne?this.buffer=this.buffer.add(e):QI(e,t=this.buffer.last())<0&&(this.buffer=this.buffer.delete(t).add(e))},Object.defineProperty(nE.prototype,"maxValue",{get:function(){return this.buffer.last()[0]},enumerable:!1,configurable:!0}),nE),XI=(eE.prototype.start=function(t){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.ue(t)},eE.prototype.stop=function(){this.ce&&(this.ce.cancel(),this.ce=null)},Object.defineProperty(eE.prototype,"started",{get:function(){return null!==this.ce},enumerable:!1,configurable:!0}),eE.prototype.ue=function(n){var t=this,e=this.oe?3e5:6e4;fb("LruGarbageCollector","Garbage collection scheduled in "+e+"ms"),this.ce=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,function(){return Yi(t,void 0,void 0,function(){var e;return Xi(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 HT(e=t.sent())?(fb("LruGarbageCollector","Ignoring IndexedDB error during garbage collection: ",e),[3,6]):[3,4];case 4:return[4,GI(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]}})})})},eE),$I=(tE.prototype.calculateTargetCount=function(t,e){return this.ae.he(t).next(function(t){return Math.floor(e/100*t)})},tE.prototype.nthSequenceNumber=function(t,e){var n=this;if(0===e)return xT.resolve(ib.o);var r=new YI(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})},tE.prototype.removeTargets=function(t,e,n){return this.ae.removeTargets(t,e,n)},tE.prototype.removeOrphanedDocuments=function(t,e){return this.ae.removeOrphanedDocuments(t,e)},tE.prototype.collect=function(e,n){var r=this;return-1===this.params.cacheSizeCollectionThreshold?(fb("LruGarbageCollector","Garbage collection skipped; disabled"),xT.resolve(NI)):this.getCacheSize(e).next(function(t){return t<r.params.cacheSizeCollectionThreshold?(fb("LruGarbageCollector","Garbage collection skipped; Cache size "+t+" is lower than threshold "+r.params.cacheSizeCollectionThreshold),NI):r.fe(e,n)})},tE.prototype.getCacheSize=function(t){return this.ae.getCacheSize(t)},tE.prototype.fe=function(e,n){var r,i,o,s,a,u,c,h=this,l=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(function(t){return i=t>h.params.maximumSequenceNumbersToCollect?(fb("LruGarbageCollector","Capping sequence numbers to collect down to the maximum of "+h.params.maximumSequenceNumbersToCollect+" from "+t),h.params.maximumSequenceNumbersToCollect):t,s=Date.now(),h.nthSequenceNumber(e,i)}).next(function(t){return r=t,a=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(),lb()<=us.DEBUG&&fb("LruGarbageCollector","LRU Garbage Collection\n\tCounted targets in "+(s-l)+"ms\n\tDetermined least recently used "+i+" in "+(a-s)+"ms\n\tRemoved "+o+" targets in "+(u-a)+"ms\n\tRemoved "+t+" documents in "+(c-u)+"ms\nTotal Duration: "+(c-l)+"ms"),xT.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:o,documentsRemoved:t})})},tE),JI=(ZI.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})})},ZI.prototype.de=function(t){var e=0;return this.le(t,function(t){e++}).next(function(){return e})},ZI.prototype.forEachTarget=function(t,e){return this.db.getTargetCache().forEachTarget(t,e)},ZI.prototype.le=function(t,n){return this.we(t,function(t,e){return n(e)})},ZI.prototype.addReference=function(t,e,n){return rE(t,n)},ZI.prototype.removeReference=function(t,e,n){return rE(t,n)},ZI.prototype.removeTargets=function(t,e,n){return this.db.getTargetCache().removeTargets(t,e,n)},ZI.prototype.markPotentiallyOrphaned=rE,ZI.prototype._e=function(t,e){return r=e,i=!1,UI(n=t).Ot(function(t){return MI(n,t,r).next(function(t){return t&&(i=!0),xT.resolve(!t)})}).next(function(){return i});var n,r,i},ZI.prototype.removeOrphanedDocuments=function(n,r){var i=this,o=this.db.getRemoteDocumentCache().newChangeBuffer(),s=[],a=0;return this.we(n,function(e,t){t<=r&&(t=i._e(n,e).next(function(t){if(!t)return a++,o.getEntry(n,e).next(function(){return o.removeEntry(e),zI(n).delete([0,hT(e.path)])})}),s.push(t))}).next(function(){return xT.waitFor(s)}).next(function(){return o.apply(n)}).next(function(){return a})},ZI.prototype.removeTarget=function(t,e){e=e.withSequenceNumber(t.currentSequenceNumber);return this.db.getTargetCache().updateTargetData(t,e)},ZI.prototype.updateLimboDocument=rE,ZI.prototype.we=function(t,r){var i,t=zI(t),o=ib.o;return t.$t({index:ET.documentTargetsIndex},function(t,e){var n=t[0];t[1];t=e.path,e=e.sequenceNumber;0===n?(o!==ib.o&&r(new $b(fT(i)),o),o=e,i=t):o=ib.o}).next(function(){o!==ib.o&&r(new $b(fT(i)),o)})},ZI.prototype.getCacheSize=function(t){return this.db.getRemoteDocumentCache().getSize(t)},ZI);function ZI(t,e){this.db=t,this.garbageCollector=new $I(this,e)}function tE(t,e){this.ae=t,this.params=e}function eE(t,e){this.garbageCollector=t,this.asyncQueue=e,this.oe=!1,this.ce=null}function nE(t){this.ne=t,this.buffer=new p0(QI),this.se=0}function rE(t,e){return zI(t).put((t=t.currentSequenceNumber,new ET(0,hT(e.path),t)))}var iE,oE=(lE.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}},lE.prototype.has=function(t){return void 0!==this.get(t)},lE.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]]},lE.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},lE.prototype.forEach=function(s){Ab(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];s(o,i)}})},lE.prototype.isEmpty=function(){return Nb(this.inner)},lE),Q=(hE.prototype.getReadTime=function(t){t=this.changes.get(t);return t?t.readTime:Eb.min()},hE.prototype.addEntry=function(t,e){this.assertNotApplied(),this.changes.set(t.key,{document:t,readTime:e})},hE.prototype.removeEntry=function(t,e){void 0===e&&(e=null),this.assertNotApplied(),this.changes.set(t,{document:d_.newInvalidDocument(t),readTime:e})},hE.prototype.getEntry=function(t,e){this.assertNotApplied();var n=this.changes.get(e);return void 0!==n?xT.resolve(n.document):this.getFromCache(t,e)},hE.prototype.getEntries=function(t,e){return this.getAllFromCache(t,e)},hE.prototype.apply=function(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)},hE.prototype.assertNotApplied=function(){},hE),sE=(cE.prototype.addEntry=function(t,e,n){return pE(t).put(dE(e),n)},cE.prototype.removeEntry=function(t,e){t=pE(t),e=dE(e);return t.delete(e)},cE.prototype.updateMetadata=function(e,n){var r=this;return this.getMetadata(e).next(function(t){return t.byteSize+=n,r.me(e,t)})},cE.prototype.getEntry=function(t,e){var n=this;return pE(t).get(dE(e)).next(function(t){return n.ye(e,t)})},cE.prototype.ge=function(t,e){var n=this;return pE(t).get(dE(e)).next(function(t){return{document:n.ye(e,t),size:DI(t)}})},cE.prototype.getEntries=function(t,e){var n=this,r=g0;return this.pe(t,e,function(t,e){e=n.ye(t,e);r=r.insert(t,e)}).next(function(){return r})},cE.prototype.Ee=function(t,e){var r=this,i=g0,o=new s0($b.comparator);return this.pe(t,e,function(t,e){var n=r.ye(t,e);i=i.insert(t,n),o=o.insert(t,DI(e))}).next(function(){return{documents:i,Te:o}})},cE.prototype.pe=function(t,e,i){if(e.isEmpty())return xT.resolve();var n=IDBKeyRange.bound(e.first().path.toArray(),e.last().path.toArray()),o=e.getIterator(),s=o.getNext();return pE(t).$t({range:n},function(t,e,n){for(var r=$b.fromSegments(t);s&&$b.comparator(s,r)<0;)i(s,null),s=o.getNext();s&&s.isEqual(r)&&(i(s,e),s=o.hasNext()?o.getNext():null),s?n.Ct(s.path.toArray()):n.done()}).next(function(){for(;s;)i(s,null),s=o.hasNext()?o.getNext():null})},cE.prototype.getDocumentsMatchingQuery=function(t,r,e){var n,i=this,o=g0,s=r.path.length+1,a={};return e.isEqual(Eb.min())?(n=r.path.toArray(),a.range=IDBKeyRange.lowerBound(n)):(n=r.path.toArray(),e=hI(e),a.range=IDBKeyRange.lowerBound([n,e],!0),a.index=wT.collectionReadTimeIndex),pE(t).$t(a,function(t,e,n){t.length===s&&(e=uI(i.R,e),r.path.isPrefixOf(e.key.path)?lw(r,e)&&(o=o.insert(e.key,e)):n.done())}).next(function(){return o})},cE.prototype.newChangeBuffer=function(t){return new aE(this,!!t&&t.trackRemovals)},cE.prototype.getSize=function(t){return this.getMetadata(t).next(function(t){return t.byteSize})},cE.prototype.getMetadata=function(t){return fE(t).get(TT.key).next(function(t){return yb(!!t),t})},cE.prototype.me=function(t,e){return fE(t).put(TT.key,e)},cE.prototype.ye=function(t,e){if(e){e=uI(this.R,e);if(!e.isNoDocument()||!e.version.isEqual(Eb.min()))return e}return d_.newInvalidDocument(t)},cE),aE=(Gi(uE,iE=Q),uE.prototype.applyChanges=function(i){var o=this,s=[],a=0,u=new p0(function(t,e){return _b(t.canonicalString(),e.canonicalString())});return this.changes.forEach(function(t,e){var n,r=o.Ae.get(t);e.document.isValidDocument()?(n=cI(o.Ie.R,e.document,o.getReadTime(t)),u=u.add(t.path.popLast()),e=DI(n),a+=e-r,s.push(o.Ie.addEntry(i,t,n))):(a-=r,o.trackRemovals?(r=cI(o.Ie.R,d_.newNoDocument(t,Eb.min()),o.getReadTime(t)),s.push(o.Ie.addEntry(i,t,r))):s.push(o.Ie.removeEntry(i,t)))}),u.forEach(function(t){s.push(o.Ie.Ut.addToCollectionParentIndex(i,t))}),s.push(this.Ie.updateMetadata(i,a)),xT.waitFor(s)},uE.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})},uE.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})},uE);function uE(t,e){var n=this;return(n=iE.call(this)||this).Ie=t,n.trackRemovals=e,n.Ae=new oE(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),n}function cE(t,e){this.R=t,this.Ut=e}function hE(){this.changes=new oE(function(t){return t.toString()},function(t,e){return t.isEqual(e)}),this.changesApplied=!1}function lE(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={}}function fE(t){return tI(t,TT.store)}function pE(t){return tI(t,wT.store)}function dE(t){return t.path.toArray()}var gE=(vE.prototype.Rt=function(e,n,t,r){var i=this;yb(t<r&&0<=t&&r<=11);var o=new LT("createOrUpgrade",n);t<1&&1<=r&&(e.createObjectStore(pT.store),(s=e).createObjectStore(gT.store,{keyPath:gT.keyPath}),s.createObjectStore(vT.store,{keyPath:vT.keyPath,autoIncrement:!0}).createIndex(vT.userMutationsIndex,vT.userMutationsKeyPath,{unique:!0}),s.createObjectStore(yT.store),yE(e),e.createObjectStore(wT.store));var s,a=xT.resolve();return t<3&&3<=r&&(0!==t&&((s=e).deleteObjectStore(ET.store),s.deleteObjectStore(IT.store),s.deleteObjectStore(ST.store),yE(e)),a=a.next(function(){return t=o.store(ST.store),e=new ST(0,0,Eb.min().toTimestamp(),0),t.put(ST.key,e);var t,e})),t<4&&4<=r&&(a=(a=0!==t?a.next(function(){return n=e,(r=o).store(vT.store).Nt().next(function(t){n.deleteObjectStore(vT.store),n.createObjectStore(vT.store,{keyPath:vT.keyPath,autoIncrement:!0}).createIndex(vT.userMutationsIndex,vT.userMutationsKeyPath,{unique:!0});var e=r.store(vT.store),t=t.map(function(t){return e.put(t)});return xT.waitFor(t)});var n,r}):a).next(function(){e.createObjectStore(CT.store,{keyPath:CT.keyPath})})),t<5&&5<=r&&(a=a.next(function(){return i.Re(o)})),t<6&&6<=r&&(a=a.next(function(){return e.createObjectStore(TT.store),i.be(o)})),t<7&&7<=r&&(a=a.next(function(){return i.ve(o)})),t<8&&8<=r&&(a=a.next(function(){return i.Pe(e,o)})),t<9&&9<=r&&(a=a.next(function(){var t;(t=e).objectStoreNames.contains("remoteDocumentChanges")&&t.deleteObjectStore("remoteDocumentChanges"),(t=n.objectStore(wT.store)).createIndex(wT.readTimeIndex,wT.readTimeIndexPath,{unique:!1}),t.createIndex(wT.collectionReadTimeIndex,wT.collectionReadTimeIndexPath,{unique:!1})})),t<10&&10<=r&&(a=a.next(function(){return i.Ve(o)})),a=t<11&&11<=r?a.next(function(){e.createObjectStore(AT.store,{keyPath:AT.keyPath}),e.createObjectStore(NT.store,{keyPath:NT.keyPath})}):a},vE.prototype.be=function(e){var n=0;return e.store(wT.store).$t(function(t,e){n+=DI(e)}).next(function(){var t=new TT(n);return e.store(TT.store).put(TT.key,t)})},vE.prototype.Re=function(n){var r=this,t=n.store(gT.store),i=n.store(vT.store);return t.Nt().next(function(t){return xT.forEach(t,function(e){var t=IDBKeyRange.bound([e.userId,-1],[e.userId,e.lastAcknowledgedBatchId]);return i.Nt(vT.userMutationsIndex,t).next(function(t){return xT.forEach(t,function(t){yb(t.userId===e.userId);t=dI(r.R,t);return OI(n,e.userId,t).next(function(){})})})})})},vE.prototype.ve=function(t){var o=t.store(ET.store),e=t.store(wT.store);return t.store(ST.store).get(ST.key).next(function(r){var i=[];return e.$t(function(t,e){var n=new Ob(t),t=[0,hT(n)];i.push(o.get(t).next(function(t){return t?xT.resolve():o.put(new ET(0,hT(n),r.highestListenSequenceNumber))}))}).next(function(){return xT.waitFor(i)})})},vE.prototype.Pe=function(t,e){t.createObjectStore(kT.store,{keyPath:kT.keyPath});function r(t){if(i.add(t)){var e=t.lastSegment(),t=t.popLast();return n.put({collectionId:e,parent:hT(t)})}}var n=e.store(kT.store),i=new II;return e.store(wT.store).$t({Ft:!0},function(t,e){t=new Ob(t);return r(t.popLast())}).next(function(){return e.store(yT.store).$t({Ft:!0},function(t,e){t[0];var n=t[1];t[2];n=fT(n);return r(n.popLast())})})},vE.prototype.Ve=function(t){var n=this,r=t.store(IT.store);return r.$t(function(t,e){e=gI(e),e=vI(n.R,e);return r.put(e)})},vE);function vE(t){this.R=t}function yE(t){t.createObjectStore(ET.store,{keyPath:ET.keyPath}).createIndex(ET.documentTargetsIndex,ET.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(IT.store,{keyPath:IT.keyPath}).createIndex(IT.queryTargetsIndexName,IT.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(ST.store)}var mE="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.",bE=(_E.prototype.start=function(){var e=this;return this.je().then(function(){if(!e.isPrimary&&!e.allowTabSynchronization)throw new ub(ab.FAILED_PRECONDITION,mE);return e.We(),e.Ge(),e.ze(),e.runTransaction("getHighestListenSequenceNumber","readonly",function(t){return e.qe.getHighestSequenceNumber(t)})}).then(function(t){e.Ne=new ib(t,e.De)}).then(function(){e.xe=!0}).catch(function(t){return e.Be&&e.Be.close(),Promise.reject(t)})},_E.prototype.He=function(n){var t=this;return this.Me=function(e){return Yi(t,void 0,void 0,function(){return Xi(this,function(t){return this.started?[2,n(e)]:[2]})})},n(this.isPrimary)},_E.prototype.setDatabaseDeletedListener=function(n){var t=this;this.Be.vt(function(e){return Yi(t,void 0,void 0,function(){return Xi(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]}})})})},_E.prototype.setNetworkEnabled=function(t){var e=this;this.networkEnabled!==t&&(this.networkEnabled=t,this.Se.enqueueAndForget(function(){return Yi(e,void 0,void 0,function(){return Xi(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]}})})}))},_E.prototype.je=function(){var n=this;return this.runTransaction("updateClientMetadataAndTryBecomePrimary","readwrite",function(e){return TE(e).put(new CT(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(HT(t))return fb("IndexedDbPersistence","Failed to extend owner lease: ",t),n.isPrimary;if(!n.allowTabSynchronization)throw t;return fb("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})},_E.prototype.Je=function(t){var e=this;return wE(t).get(pT.key).next(function(t){return xT.resolve(e.tn(t))})},_E.prototype.en=function(t){return TE(t).delete(this.clientId)},_E.prototype.nn=function(){return Yi(this,void 0,void 0,function(){var e,n,r,i,o=this;return Xi(this,function(t){switch(t.label){case 0:return!this.isPrimary||this.sn(this.Oe,18e5)?[3,2]:(this.Oe=Date.now(),[4,this.runTransaction("maybeGarbageCollectMultiClientState","readwrite-primary",function(t){var r=tI(t,CT.store);return r.Nt().next(function(t){var e=o.rn(t,18e5),n=t.filter(function(t){return-1===e.indexOf(t)});return xT.forEach(n,function(t){return r.delete(t.clientId)}).next(function(){return n})})}).catch(function(){return[]})]);case 1:if(e=t.sent(),this.Qe)for(n=0,r=e;n<r.length;n++)i=r[n],this.Qe.removeItem(this.on(i.clientId));t.label=2;case 2:return[2]}})})},_E.prototype.ze=function(){var t=this;this.$e=this.Se.enqueueAfterDelay("client_metadata_refresh",4e3,function(){return t.je().then(function(){return t.nn()}).then(function(){return t.ze()})})},_E.prototype.tn=function(t){return!!t&&t.ownerId===this.clientId},_E.prototype.Ye=function(e){var r=this;return this.Ce?xT.resolve(!0):wE(e).get(pT.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 ub(ab.FAILED_PRECONDITION,mE);return!1}}return!(!r.networkEnabled||!r.inForeground)||TE(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&&fb("IndexedDbPersistence","Client "+(t?"is":"is not")+" eligible for a primary lease."),t})},_E.prototype.shutdown=function(){return Yi(this,void 0,void 0,function(){var n=this;return Xi(this,function(t){switch(t.label){case 0:return this.xe=!1,this.un(),this.$e&&(this.$e.cancel(),this.$e=null),this.an(),this.hn(),[4,this.Be.runTransaction("shutdown","readwrite",[pT.store,CT.store],function(t){var e=new JT(t,ib.o);return n.Xe(e).next(function(){return n.en(e)})})];case 1:return t.sent(),this.Be.close(),this.ln(),[2]}})})},_E.prototype.rn=function(t,e){var n=this;return t.filter(function(t){return n.sn(t.updateTimeMs,e)&&!n.cn(t.clientId)})},_E.prototype.fn=function(){var e=this;return this.runTransaction("getActiveClients","readonly",function(t){return TE(t).Nt().next(function(t){return e.rn(t,18e5).map(function(t){return t.clientId})})})},Object.defineProperty(_E.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),_E.prototype.getMutationQueue=function(t){return xI.Qt(t,this.R,this.Ut,this.referenceDelegate)},_E.prototype.getTargetCache=function(){return this.qe},_E.prototype.getRemoteDocumentCache=function(){return this.Ue},_E.prototype.getIndexManager=function(){return this.Ut},_E.prototype.getBundleCache=function(){return this.Ke},_E.prototype.runTransaction=function(e,n,r){var i,o=this;return fb("IndexedDbPersistence","Starting transaction:",e),this.Be.runTransaction(e,"readonly"===n?"readonly":"readwrite",PT,function(t){return i=new JT(t,o.Ne?o.Ne.next():ib.o),"readwrite-primary"===n?o.Je(i).next(function(t){return!!t||o.Ye(i)}).next(function(t){if(!t)throw pb("Failed to obtain primary lease for action '"+e+"'."),o.isPrimary=!1,o.Se.enqueueRetryable(function(){return o.Me(!1)}),new ub(ab.FAILED_PRECONDITION,OT);return r(i)}).next(function(t){return o.Ze(i).next(function(){return t})}):o.dn(i).next(function(){return r(i)})}).then(function(t){return i.raiseOnCommittedEvent(),t})},_E.prototype.dn=function(t){var e=this;return wE(t).get(pT.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 ub(ab.FAILED_PRECONDITION,mE)})},_E.prototype.Ze=function(t){var e=new pT(this.clientId,this.allowTabSynchronization,Date.now());return wE(t).put(pT.key,e)},_E.yt=function(){return MT.yt()},_E.prototype.Xe=function(t){var e=this,n=wE(t);return n.get(pT.key).next(function(t){return e.tn(t)?(fb("IndexedDbPersistence","Releasing primary lease."),n.delete(pT.key)):xT.resolve()})},_E.prototype.sn=function(t,e){var n=Date.now();return!(t<n-e||n<t&&(pb("Detected an update time that is in the future: "+t+" > "+n),1))},_E.prototype.We=function(){var t=this;null!==this.document&&"function"==typeof this.document.addEventListener&&(this.Fe=function(){t.Se.enqueueAndForget(function(){return t.inForeground="visible"===t.document.visibilityState,t.je()})},this.document.addEventListener("visibilitychange",this.Fe),this.inForeground="visible"===this.document.visibilityState)},_E.prototype.an=function(){this.Fe&&(this.document.removeEventListener("visibilitychange",this.Fe),this.Fe=null)},_E.prototype.Ge=function(){var t,e=this;"function"==typeof(null===(t=this.window)||void 0===t?void 0:t.addEventListener)&&(this.ke=function(){e.un(),!vo()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")&&navigator.appVersion.match("Version/14")&&e.Se.enterRestrictedMode(!0),e.Se.enqueueAndForget(function(){return e.shutdown()})},this.window.addEventListener("pagehide",this.ke))},_E.prototype.hn=function(){this.ke&&(this.window.removeEventListener("pagehide",this.ke),this.ke=null)},_E.prototype.cn=function(t){var e;try{var n=null!==(null===(e=this.Qe)||void 0===e?void 0:e.getItem(this.on(t)));return fb("IndexedDbPersistence","Client '"+t+"' "+(n?"is":"is not")+" zombied in LocalStorage"),n}catch(t){return pb("IndexedDbPersistence","Failed to get zombied client id.",t),!1}},_E.prototype.un=function(){if(this.Qe)try{this.Qe.setItem(this.on(this.clientId),String(Date.now()))}catch(t){pb("Failed to set zombie client id.",t)}},_E.prototype.ln=function(){if(this.Qe)try{this.Qe.removeItem(this.on(this.clientId))}catch(t){}},_E.prototype.on=function(t){return"firestore_zombie_"+this.persistenceKey+"_"+t},_E);function _E(t,e,n,r,i,o,s,a,u,c){if(this.allowTabSynchronization=t,this.persistenceKey=e,this.clientId=n,this.Se=i,this.window=o,this.document=s,this.De=u,this.Ce=c,this.Ne=null,this.xe=!1,this.isPrimary=!1,this.networkEnabled=!0,this.ke=null,this.inForeground=!1,this.Fe=null,this.$e=null,this.Oe=Number.NEGATIVE_INFINITY,this.Me=function(t){return Promise.resolve()},!_E.yt())throw new ub(ab.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");this.referenceDelegate=new JI(this,r),this.Le=e+"main",this.R=new iI(a),this.Be=new MT(this.Le,11,new gE(this.R)),this.qe=new VI(this.referenceDelegate,this.R),this.Ut=new EI,this.Ue=(e=this.R,a=this.Ut,new sE(e,a)),this.Ke=new mI,this.window&&this.window.localStorage?this.Qe=this.window.localStorage:(this.Qe=null,!1===c&&pb("IndexedDbPersistence","LocalStorage is unavailable. As a result, persistence may not work reliably. In particular enablePersistence() could fail immediately after refreshing the page."))}function wE(t){return tI(t,pT.store)}function TE(t){return tI(t,CT.store)}function IE(t,e){var n=t.projectId;return t.isDefaultDatabase||(n+="."+t.database),"firestore/"+e+"/"+n+"/"}function EE(t,e){this.progress=t,this.wn=e}var SE=(OE.prototype.mn=function(e,n){var r=this;return this._n.getAllMutationBatchesAffectingDocumentKey(e,n).next(function(t){return r.yn(e,n,t)})},OE.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})},OE.prototype.gn=function(t,i){t.forEach(function(t,e){for(var n=0,r=i;n<r.length;n++)r[n].applyToLocalView(e)})},OE.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})})},OE.prototype.En=function(t,e){var n=this;return this._n.getAllMutationBatchesAffectingDocumentKeys(t,e).next(function(t){return n.gn(e,t)})},OE.prototype.getDocumentsMatchingQuery=function(t,e,n){return r=e,$b.isDocumentKey(r.path)&&null===r.collectionGroup&&0===r.filters.length?this.Tn(t,e.path):iw(e)?this.In(t,e,n):this.An(t,e,n);var r},OE.prototype.Tn=function(t,e){return this.mn(t,new $b(e)).next(function(t){var e=m0;return e=t.isFoundDocument()?e.insert(t.key,t):e})},OE.prototype.In=function(n,r,i){var o=this,s=r.collectionGroup,a=m0;return this.Ut.getCollectionParents(n,s).next(function(t){return xT.forEach(t,function(t){var e,e=(e=r,t=t.child(s),new $_(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){a=a.insert(t,e)})})}).next(function(){return a})})},OE.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 s=o[i],a=s.key,u=c.get(a);null==u&&(u=d_.newInvalidDocument(a),c=c.insert(a,u)),jw(s,u,r.localWriteTime),u.isFoundDocument()||(c=c.remove(a))}})}).next(function(){return c.forEach(function(t,e){lw(n,e)||(c=c.remove(t))}),c})},OE.prototype.Rn=function(t,e,n){for(var r=w0(),i=0,o=e;i<o.length;i++)for(var s=0,a=o[i].mutations;s<a.length;s++){var u=a[s];u instanceof Ww&&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})},OE),kE=(PE.Pn=function(t,e){for(var n=w0(),r=w0(),i=0,o=e.docChanges;i<o.length;i++){var s=o[i];switch(s.type){case 0:n=n.add(s.doc.key);break;case 1:r=r.add(s.doc.key)}}return new PE(t,e.fromCache,n,r)},PE),CE=(RE.prototype.Vn=function(t){this.Sn=t},RE.prototype.getDocumentsMatchingQuery=function(e,r,i,o){var s=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(Eb.min())?this.Dn(e,r):this.Sn.pn(e,o).next(function(t){var n=s.Cn(r,t);return(tw(r)||ew(r))&&s.Nn(r.limitType,n,o,i)?s.Dn(e,r):(lb()<=us.DEBUG&&fb("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),hw(r)),s.Sn.getDocumentsMatchingQuery(e,r,i).next(function(e){return n.forEach(function(t){e=e.insert(t.key,t)}),e}))})},RE.prototype.Cn=function(n,t){var r=new p0(fw(n));return t.forEach(function(t,e){lw(n,e)&&(r=r.add(e))}),r},RE.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))},RE.prototype.Dn=function(t,e){return lb()<=us.DEBUG&&fb("QueryEngine","Using full collection scan to execute query:",hw(e)),this.Sn.getDocumentsMatchingQuery(t,e,Eb.min())},RE),AE=(NE.prototype.collectGarbage=function(e){var n=this;return this.persistence.runTransaction("Collect garbage","readwrite-primary",function(t){return e.collect(t,n.kn)})},NE);function NE(t,e,n,r){this.persistence=t,this.xn=e,this.R=r,this.kn=new s0(_b),this.Fn=new oE(m_,b_),this.$n=Eb.min(),this._n=t.getMutationQueue(n),this.On=t.getRemoteDocumentCache(),this.qe=t.getTargetCache(),this.Mn=new SE(this.On,this._n,this.persistence.getIndexManager()),this.Ke=t.getBundleCache(),this.xn.Vn(this.Mn)}function RE(){}function PE(t,e,n,r){this.targetId=t,this.fromCache=e,this.bn=n,this.vn=r}function OE(t,e,n){this.Ue=t,this._n=e,this.Ut=n}function DE(t,e,n,r){return new AE(t,e,n,r)}function xE(i,o){return Yi(this,void 0,void 0,function(){var e,n,m,r;return Xi(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(v){var y;return e._n.getAllMutationBatches(v).next(function(t){return y=t,n=e.persistence.getMutationQueue(o),m=new SE(e.On,n,e.persistence.getIndexManager()),n.getAllMutationBatches(v)}).next(function(t){for(var e=[],n=[],r=w0(),i=0,o=y;i<o.length;i++){var s=o[i];e.push(s.batchId);for(var a=0,u=s.mutations;a<u.length;a++)var c=u[a],r=r.add(c.key)}for(var h=0,l=t;h<l.length;h++){var f=l[h];n.push(f.batchId);for(var p=0,d=f.mutations;p<d.length;p++){var g=d[p];r=r.add(g.key)}}return m.pn(v,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 LE(t,h){var l=t;return l.persistence.runTransaction("Acknowledge batch","readwrite-primary",function(t){var e,r,i,o,s,n,a,u=h.batch.keys(),c=l.On.newChangeBuffer({trackRemovals:!0});return e=l,r=t,o=c,s=(i=h).batch,n=s.keys(),a=xT.resolve(),n.forEach(function(n){a=a.next(function(){return o.getEntry(r,n)}).next(function(t){var e=i.docVersions.get(n);yb(null!==e),t.version.compareTo(e)<0&&(s.applyToRemoteDocument(t,i),t.isValidDocument()&&o.addEntry(t,i.commitVersion))})}),a.next(function(){return e._n.removeMutationBatch(r,s)}).next(function(){return c.apply(t)}).next(function(){return l._n.performConsistencyCheck(t)}).next(function(){return l.Mn.pn(t,u)})})}function ME(t){var e=t;return e.persistence.runTransaction("Get last remote snapshot version","readonly",function(t){return e.qe.getLastRemoteSnapshotVersion(t)})}function FE(t,r){var u=t,c=r.snapshotVersion,h=u.kn;return u.persistence.runTransaction("Apply remote event","readwrite-primary",function(s){var t=u.On.newChangeBuffer({trackRemovals:!0});h=u.kn;var a=[];r.targetChanges.forEach(function(t,e){var n,r,i,o=h.get(e);o&&(a.push(u.qe.removeMatchingKeys(s,t.removedDocuments,e).next(function(){return u.qe.addMatchingKeys(s,t.addedDocuments,e)})),0<(i=t.resumeToken).approximateByteSize()&&(n=o.withResumeToken(i,c).withSequenceNumber(s.currentSequenceNumber),h=h.insert(e,n),r=o,i=t,yb(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)&&a.push(u.qe.updateTargetData(s,n))))});var e,n=g0;return r.documentUpdates.forEach(function(t,e){r.resolvedLimboDocuments.has(t)&&a.push(u.persistence.referenceDelegate.updateLimboDocument(s,t))}),a.push(jE(s,t,r.documentUpdates,c,void 0).next(function(t){n=t})),c.isEqual(Eb.min())||(e=u.qe.getLastRemoteSnapshotVersion(s).next(function(t){return u.qe.setTargetsMetadata(s,s.currentSequenceNumber,c)}),a.push(e)),xT.waitFor(a).next(function(){return t.apply(s)}).next(function(){return u.Mn.En(s,n)}).next(function(){return n})}).then(function(t){return u.kn=h,t})}function jE(t,s,e,a,u){var n=w0();return e.forEach(function(t){return n=n.add(t)}),s.getEntries(t,n).next(function(i){var o=g0;return e.forEach(function(t,e){var n=i.get(t),r=(null==u?void 0:u.get(t))||a;e.isNoDocument()&&e.version.isEqual(Eb.min())?(s.removeEntry(t,r),o=o.insert(t,e)):!n.isValidDocument()||0<e.version.compareTo(n.version)||0===e.version.compareTo(n.version)&&n.hasPendingWrites?(s.addEntry(e,r),o=o.insert(t,e)):fb("LocalStore","Ignoring outdated watch update for ",t,". Current version:",n.version," Watch version:",e.version)}),o})}function UE(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,xT.resolve(n)):i.qe.allocateTargetId(e).next(function(t){return n=new rI(r,t,0,e.currentSequenceNumber),i.qe.addTargetData(e,n).next(function(){return n})})})}).then(function(t){var e=i.kn.get(t.targetId);return(null===e||0<t.snapshotVersion.compareTo(e.snapshotVersion))&&(i.kn=i.kn.insert(t.targetId,t),i.Fn.set(r,t.targetId)),t})}function qE(i,o,s){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:n=(e=i).kn.get(o),r=s?"readwrite":"readwrite-primary",t.label=1;case 1:return t.trys.push([1,4,,5]),s?[3,3]:[4,e.persistence.runTransaction("Release target",r,function(t){return e.persistence.referenceDelegate.removeTarget(t,n)})];case 2:t.sent(),t.label=3;case 3:return[3,5];case 4:if(!HT(r=t.sent()))throw r;return fb("LocalStore","Failed to update sequence numbers for target "+o+": "+r),[3,5];case 5:return e.kn=e.kn.remove(o),e.Fn.delete(n.target),[2]}})})}function VE(t,o,s){var a=t,u=Eb.min(),c=w0();return a.persistence.runTransaction("Execute query","readonly",function(e){return t=a,n=e,r=sw(o),(void 0!==(t=(i=t).Fn.get(r))?xT.resolve(i.kn.get(t)):i.qe.getTargetData(n,r)).next(function(t){if(t)return u=t.lastLimboFreeSnapshotVersion,a.qe.getMatchingKeysForTargetId(e,t.targetId).next(function(t){c=t})}).next(function(){return a.xn.getDocumentsMatchingQuery(e,o,s?u:Eb.min(),s?c:w0())}).next(function(t){return{documents:t,Bn:c}});var t,n,r,i})}function BE(t,e){var n=t,r=n.qe,t=n.kn.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 KE(t){var s=t;return s.persistence.runTransaction("Get new document changes","readonly",function(t){return e=s.On,n=t,t=s.$n,r=e,i=g0,o=hI(t),t=pE(n),n=IDBKeyRange.lowerBound(o,!0),t.$t({index:wT.readTimeIndex,range:n},function(t,e){var n=uI(r.R,e);i=i.insert(n.key,n),o=e.readTime}).next(function(){return{wn:i,readTime:lI(o)}});var e,n,r,i,o}).then(function(t){var e=t.wn,t=t.readTime;return s.$n=t,e})}function WE(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){return[2,(e=n).persistence.runTransaction("Synchronize last document change read time","readonly",function(t){return t=pE(t),r=Eb.min(),t.$t({index:wT.readTimeIndex,reverse:!0},function(t,e,n){e.readTime&&(r=lI(e.readTime)),n.done()}).next(function(){return r});var r}).then(function(t){e.$n=t})]})})}var HE,zE,GE=(dS.prototype.getBundleMetadata=function(t,e){return xT.resolve(this.Qn.get(e))},dS.prototype.saveBundleMetadata=function(t,e){return this.Qn.set(e.id,{id:e.id,version:e.version,createTime:V0(e.createTime)}),xT.resolve()},dS.prototype.getNamedQuery=function(t,e){return xT.resolve(this.jn.get(e))},dS.prototype.saveNamedQuery=function(t,e){return this.jn.set(e.name,{name:(e=e).name,query:yI(e.bundledQuery),readTime:V0(e.readTime)}),xT.resolve()},dS),QE=(pS.prototype.isEmpty=function(){return this.Wn.isEmpty()},pS.prototype.addReference=function(t,e){e=new YE(t,e);this.Wn=this.Wn.add(e),this.zn=this.zn.add(e)},pS.prototype.Jn=function(t,e){var n=this;t.forEach(function(t){return n.addReference(t,e)})},pS.prototype.removeReference=function(t,e){this.Yn(new YE(t,e))},pS.prototype.Xn=function(t,e){var n=this;t.forEach(function(t){return n.removeReference(t,e)})},pS.prototype.Zn=function(t){var e=this,n=new $b(new Ob([])),r=new YE(n,t),t=new YE(n,t+1),i=[];return this.zn.forEachInRange([r,t],function(t){e.Yn(t),i.push(t.key)}),i},pS.prototype.ts=function(){var e=this;this.Wn.forEach(function(t){return e.Yn(t)})},pS.prototype.Yn=function(t){this.Wn=this.Wn.delete(t),this.zn=this.zn.delete(t)},pS.prototype.es=function(t){var e=new $b(new Ob([])),n=new YE(e,t),t=new YE(e,t+1),r=w0();return this.zn.forEachInRange([n,t],function(t){r=r.add(t.key)}),r},pS.prototype.containsKey=function(t){var e=new YE(t,0),e=this.Wn.firstAfterOrEqual(e);return null!==e&&t.isEqual(e.key)},pS),YE=(fS.Gn=function(t,e){return $b.comparator(t.key,e.key)||_b(t.ns,e.ns)},fS.Hn=function(t,e){return _b(t.ns,e.ns)||$b.comparator(t.key,e.key)},fS),XE=(lS.prototype.checkEmpty=function(t){return xT.resolve(0===this._n.length)},lS.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 eI(i,e,n,r);this._n.push(n);for(var o=0,s=r;o<s.length;o++){var a=s[o];this.rs=this.rs.add(new YE(a.key,i)),this.Ut.addToCollectionParentIndex(t,a.key.path.popLast())}return xT.resolve(n)},lS.prototype.lookupMutationBatch=function(t,e){return xT.resolve(this.os(e))},lS.prototype.getNextMutationBatchAfterBatchId=function(t,e){e=this.cs(e+1),e=e<0?0:e;return xT.resolve(this._n.length>e?this._n[e]:null)},lS.prototype.getHighestUnacknowledgedBatchId=function(){return xT.resolve(0===this._n.length?-1:this.ss-1)},lS.prototype.getAllMutationBatches=function(t){return xT.resolve(this._n.slice())},lS.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new YE(e,0),e=new YE(e,Number.POSITIVE_INFINITY),i=[];return this.rs.forEachInRange([r,e],function(t){t=n.os(t.ns);i.push(t)}),xT.resolve(i)},lS.prototype.getAllMutationBatchesAffectingDocumentKeys=function(t,e){var n=this,r=new p0(_b);return e.forEach(function(t){var e=new YE(t,0),t=new YE(t,Number.POSITIVE_INFINITY);n.rs.forEachInRange([e,t],function(t){r=r.add(t.ns)})}),xT.resolve(this.us(r))},lS.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=e.path,r=n.length+1,e=n;$b.isDocumentKey(e)||(e=e.child(""));var e=new YE(new $b(e),0),i=new p0(_b);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),xT.resolve(this.us(i))},lS.prototype.us=function(t){var e=this,n=[];return t.forEach(function(t){t=e.os(t);null!==t&&n.push(t)}),n},lS.prototype.removeMutationBatch=function(n,r){var i=this;yb(0===this.hs(r.batchId,"removed")),this._n.shift();var o=this.rs;return xT.forEach(r.mutations,function(t){var e=new YE(t.key,r.batchId);return o=o.delete(e),i.referenceDelegate.markPotentiallyOrphaned(n,t.key)}).next(function(){i.rs=o})},lS.prototype.Gt=function(t){},lS.prototype.containsKey=function(t,e){var n=new YE(e,0),n=this.rs.firstAfterOrEqual(n);return xT.resolve(e.isEqual(n&&n.key))},lS.prototype.performConsistencyCheck=function(t){return this._n.length,xT.resolve()},lS.prototype.hs=function(t,e){return this.cs(t)},lS.prototype.cs=function(t){return 0===this._n.length?0:t-this._n[0].batchId},lS.prototype.os=function(t){t=this.cs(t);return t<0||t>=this._n.length?null:this._n[t]},lS),$E=(hS.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())},hS.prototype.removeEntry=function(t){var e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)},hS.prototype.getEntry=function(t,e){var n=this.docs.get(e);return xT.resolve(n?n.document.clone():d_.newInvalidDocument(e))},hS.prototype.getEntries=function(t,e){var n=this,r=g0;return e.forEach(function(t){var e=n.docs.get(t);r=r.insert(t,e?e.document.clone():d_.newInvalidDocument(t))}),xT.resolve(r)},hS.prototype.getDocumentsMatchingQuery=function(t,e,n){for(var r=g0,i=new $b(e.path.child("")),o=this.docs.getIteratorFrom(i);o.hasNext();){var s=o.getNext(),a=s.key,u=s.value,s=u.document,u=u.readTime;if(!e.path.isPrefixOf(a.path))break;u.compareTo(n)<=0||lw(e,s)&&(r=r.insert(s.key,s.clone()))}return xT.resolve(r)},hS.prototype.fs=function(t,e){return xT.forEach(this.docs,function(t){return e(t)})},hS.prototype.newChangeBuffer=function(t){return new JE(this)},hS.prototype.getSize=function(t){return xT.resolve(this.size)},hS),JE=(Gi(cS,zE=Q),cS.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)}),xT.waitFor(i)},cS.prototype.getFromCache=function(t,e){return this.Ie.getEntry(t,e)},cS.prototype.getAllFromCache=function(t,e){return this.Ie.getEntries(t,e)},cS),ZE=(uS.prototype.forEachTarget=function(t,n){return this.ds.forEach(function(t,e){return n(e)}),xT.resolve()},uS.prototype.getLastRemoteSnapshotVersion=function(t){return xT.resolve(this.lastRemoteSnapshotVersion)},uS.prototype.getHighestSequenceNumber=function(t){return xT.resolve(this.ws)},uS.prototype.allocateTargetId=function(t){return this.highestTargetId=this.ys.next(),xT.resolve(this.highestTargetId)},uS.prototype.setTargetsMetadata=function(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.ws&&(this.ws=e),xT.resolve()},uS.prototype.te=function(t){this.ds.set(t.target,t);var e=t.targetId;e>this.highestTargetId&&(this.ys=new qI(e),this.highestTargetId=e),t.sequenceNumber>this.ws&&(this.ws=t.sequenceNumber)},uS.prototype.addTargetData=function(t,e){return this.te(e),this.targetCount+=1,xT.resolve()},uS.prototype.updateTargetData=function(t,e){return this.te(e),xT.resolve()},uS.prototype.removeTargetData=function(t,e){return this.ds.delete(e.target),this._s.Zn(e.targetId),--this.targetCount,xT.resolve()},uS.prototype.removeTargets=function(n,r,i){var o=this,s=0,a=[];return this.ds.forEach(function(t,e){e.sequenceNumber<=r&&null===i.get(e.targetId)&&(o.ds.delete(t),a.push(o.removeMatchingKeysForTargetId(n,e.targetId)),s++)}),xT.waitFor(a).next(function(){return s})},uS.prototype.getTargetCount=function(t){return xT.resolve(this.targetCount)},uS.prototype.getTargetData=function(t,e){e=this.ds.get(e)||null;return xT.resolve(e)},uS.prototype.addMatchingKeys=function(t,e,n){return this._s.Jn(e,n),xT.resolve()},uS.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))}),xT.waitFor(i)},uS.prototype.removeMatchingKeysForTargetId=function(t,e){return this._s.Zn(e),xT.resolve()},uS.prototype.getMatchingKeysForTargetId=function(t,e){e=this._s.es(e);return xT.resolve(e)},uS.prototype.containsKey=function(t,e){return xT.resolve(this._s.containsKey(e))},uS),tS=(aS.prototype.start=function(){return Promise.resolve()},aS.prototype.shutdown=function(){return this.xe=!1,Promise.resolve()},Object.defineProperty(aS.prototype,"started",{get:function(){return this.xe},enumerable:!1,configurable:!0}),aS.prototype.setDatabaseDeletedListener=function(){},aS.prototype.setNetworkEnabled=function(){},aS.prototype.getIndexManager=function(){return this.Ut},aS.prototype.getMutationQueue=function(t){var e=this.gs[t.toKey()];return e||(e=new XE(this.Ut,this.referenceDelegate),this.gs[t.toKey()]=e),e},aS.prototype.getTargetCache=function(){return this.qe},aS.prototype.getRemoteDocumentCache=function(){return this.Ue},aS.prototype.getBundleCache=function(){return this.Ke},aS.prototype.runTransaction=function(t,e,n){var r=this;fb("MemoryPersistence","Starting transaction:",t);var i=new eS(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})},aS.prototype.Is=function(e,n){return xT.or(Object.values(this.gs).map(function(t){return function(){return t.containsKey(e,n)}}))},aS),eS=(Gi(sS,HE=G),sS),nS=(oS.bs=function(t){return new oS(t)},Object.defineProperty(oS.prototype,"vs",{get:function(){if(this.Rs)return this.Rs;throw vb()},enumerable:!1,configurable:!0}),oS.prototype.addReference=function(t,e,n){return this.As.addReference(n,e),this.vs.delete(n.toString()),xT.resolve()},oS.prototype.removeReference=function(t,e,n){return this.As.removeReference(n,e),this.vs.add(n.toString()),xT.resolve()},oS.prototype.markPotentiallyOrphaned=function(t,e){return this.vs.add(e.toString()),xT.resolve()},oS.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)})},oS.prototype.Es=function(){this.Rs=new Set},oS.prototype.Ts=function(n){var r=this,i=this.persistence.getRemoteDocumentCache().newChangeBuffer();return xT.forEach(this.vs,function(t){var e=$b.fromPath(t);return r.Ps(n,e).next(function(t){t||i.removeEntry(e)})}).next(function(){return r.Rs=null,i.apply(n)})},oS.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())})},oS.prototype.ps=function(t){return 0},oS.prototype.Ps=function(t,e){var n=this;return xT.or([function(){return xT.resolve(n.As.containsKey(e))},function(){return n.persistence.getTargetCache().containsKey(t,e)},function(){return n.persistence.Is(t,e)}])},oS),rS=(iS.prototype.isAuthenticated=function(){return null!=this.uid},iS.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},iS.prototype.isEqual=function(t){return t.uid===this.uid},iS);function iS(t){this.uid=t}function oS(t){this.persistence=t,this.As=new QE,this.Rs=null}function sS(t){var e=this;return(e=HE.call(this)||this).currentSequenceNumber=t,e}function aS(t,e){var n=this;this.gs={},this.Ne=new ib(0),this.xe=!1,this.xe=!0,this.referenceDelegate=t(this),this.qe=new ZE(this),this.Ut=new TI,this.Ue=(t=this.Ut,new $E(t,function(t){return n.referenceDelegate.ps(t)})),this.R=new iI(e),this.Ke=new GE(this.R)}function uS(t){this.persistence=t,this.ds=new oE(m_,b_),this.lastRemoteSnapshotVersion=Eb.min(),this.highestTargetId=0,this.ws=0,this._s=new QE,this.targetCount=0,this.ys=qI.Jt()}function cS(t){var e=this;return(e=zE.call(this)||this).Ie=t,e}function hS(t,e){this.Ut=t,this.ls=e,this.docs=new s0($b.comparator),this.size=0}function lS(t,e){this.Ut=t,this.referenceDelegate=e,this._n=[],this.ss=1,this.rs=new p0(YE.Gn)}function fS(t,e){this.key=t,this.ns=e}function pS(){this.Wn=new p0(YE.Gn),this.zn=new p0(YE.Hn)}function dS(t){this.R=t,this.Qn=new Map,this.jn=new Map}function gS(t,e){return"firestore_clients_"+t+"_"+e}function vS(t,e,n){n="firestore_mutations_"+t+"_"+n;return e.isAuthenticated()&&(n+="_"+e.uid),n}function yS(t,e){return"firestore_targets_"+t+"_"+e}rS.UNAUTHENTICATED=new rS(null),rS.GOOGLE_CREDENTIALS=new rS("google-credentials-uid"),rS.FIRST_PARTY=new rS("first-party-uid"),rS.MOCK_USER=new rS("mock-user");var mS,bS=(BS.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 ub(i.error.code,i.error.message)),o?new BS(t,e,i.state,r):(pb("SharedClientState","Failed to parse mutation state for ID '"+e+"': "+n),null)},BS.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)},BS),_S=(VS.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 ub(r.error.code,r.error.message)),i?new VS(t,r.state,n):(pb("SharedClientState","Failed to parse target state for ID '"+t+"': "+e),null)},VS.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)},VS),wS=(qS.Vs=function(t,e){for(var n=JSON.parse(e),r="object"==typeof n&&n.activeTargetIds instanceof Array,i=T0,o=0;r&&o<n.activeTargetIds.length;++o)r=Xb(n.activeTargetIds[o]),i=i.add(n.activeTargetIds[o]);return r?new qS(t,i):(pb("SharedClientState","Failed to parse client data for instance '"+t+"': "+e),null)},qS),TS=(US.Vs=function(t){var e=JSON.parse(t);return"object"==typeof e&&-1!==["Unknown","Online","Offline"].indexOf(e.onlineState)&&"string"==typeof e.clientId?new US(e.clientId,e.onlineState):(pb("SharedClientState","Failed to parse online state: "+t),null)},US),IS=(jS.prototype.Ds=function(t){this.activeTargetIds=this.activeTargetIds.add(t)},jS.prototype.Cs=function(t){this.activeTargetIds=this.activeTargetIds.delete(t)},jS.prototype.Ss=function(){var t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)},jS),ES=(FS.yt=function(t){return!(!t||!t.localStorage)},FS.prototype.start=function(){return Yi(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l=this;return Xi(this,function(t){switch(t.label){case 0:return[4,this.syncEngine.fn()];case 1:for(s=t.sent(),e=0,n=s;e<n.length;e++)(r=n[e])!==this.Ns&&(i=this.getItem(gS(this.persistenceKey,r)))&&(o=wS.Vs(r,i))&&(this.Fs=this.Fs.insert(o.clientId,o));for(this.Qs(),(s=this.storage.getItem(this.Us))&&(a=this.js(s))&&this.Ws(a),u=0,c=this.$s;u<c.length;u++)h=c[u],this.ks(h);return this.$s=[],this.window.addEventListener("pagehide",function(){return l.shutdown()}),this.started=!0,[2]}})})},FS.prototype.writeSequenceNumber=function(t){this.setItem(this.Ms,JSON.stringify(t))},FS.prototype.getAllActiveQueryTargets=function(){return this.Gs(this.Fs)},FS.prototype.isActiveQueryTarget=function(n){var r=!1;return this.Fs.forEach(function(t,e){e.activeTargetIds.has(n)&&(r=!0)}),r},FS.prototype.addPendingMutation=function(t){this.zs(t,"pending")},FS.prototype.updateMutationState=function(t,e,n){this.zs(t,e,n),this.Hs(t)},FS.prototype.addLocalQueryTarget=function(t){var e,n="not-current";return this.isActiveQueryTarget(t)&&(!(e=this.storage.getItem(yS(this.persistenceKey,t)))||(e=_S.Vs(t,e))&&(n=e.state)),this.Js.Ds(t),this.Qs(),n},FS.prototype.removeLocalQueryTarget=function(t){this.Js.Cs(t),this.Qs()},FS.prototype.isLocalQueryTarget=function(t){return this.Js.activeTargetIds.has(t)},FS.prototype.clearQueryState=function(t){this.removeItem(yS(this.persistenceKey,t))},FS.prototype.updateQueryState=function(t,e,n){this.Ys(t,e,n)},FS.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)})},FS.prototype.setOnlineState=function(t){this.Xs(t)},FS.prototype.notifyBundleLoaded=function(){this.Zs()},FS.prototype.shutdown=function(){this.started&&(this.window.removeEventListener("storage",this.xs),this.removeItem(this.Os),this.started=!1)},FS.prototype.getItem=function(t){var e=this.storage.getItem(t);return fb("SharedClientState","READ",t,e),e},FS.prototype.setItem=function(t,e){fb("SharedClientState","SET",t,e),this.storage.setItem(t,e)},FS.prototype.removeItem=function(t){fb("SharedClientState","REMOVE",t),this.storage.removeItem(t)},FS.prototype.ks=function(t){var e=this,o=t;o.storageArea===this.storage&&(fb("SharedClientState","EVENT",o.key,o.newValue),o.key!==this.Os?this.Se.enqueueRetryable(function(){return Yi(e,void 0,void 0,function(){var e,n,r,i;return Xi(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=ib.o;if(null!=t)try{var n=JSON.parse(t);yb("number"==typeof n),e=n}catch(t){pb("SharedClientState","Failed to read sequence number from WebStorage",t)}return e}(o.newValue))!==ib.o&&this.sequenceNumberHandler(i);else if(o.key===this.Ks)return[2,this.syncEngine.ci()]}else this.$s.push(o);return[2]})})}):pb("Received WebStorage notification for local change. Another client might have garbage-collected our state"))},Object.defineProperty(FS.prototype,"Js",{get:function(){return this.Fs.get(this.Ns)},enumerable:!1,configurable:!0}),FS.prototype.Qs=function(){this.setItem(this.Os,this.Js.Ss())},FS.prototype.zs=function(t,e,n){n=new bS(this.currentUser,t,e,n),t=vS(this.persistenceKey,this.currentUser,t);this.setItem(t,n.Ss())},FS.prototype.Hs=function(t){t=vS(this.persistenceKey,this.currentUser,t);this.removeItem(t)},FS.prototype.Xs=function(t){t={clientId:this.Ns,onlineState:t};this.storage.setItem(this.Us,JSON.stringify(t))},FS.prototype.Ys=function(t,e,n){var r=yS(this.persistenceKey,t),n=new _S(t,e,n);this.setItem(r,n.Ss())},FS.prototype.Zs=function(){this.setItem(this.Ks,"value-not-used")},FS.prototype.ti=function(t){t=this.Ls.exec(t);return t?t[1]:null},FS.prototype.ni=function(t,e){t=this.ti(t);return wS.Vs(t,e)},FS.prototype.si=function(t,e){var n=this.Bs.exec(t),t=Number(n[1]),n=void 0!==n[2]?n[2]:null;return bS.Vs(new rS(n),t,e)},FS.prototype.ri=function(t,e){t=this.qs.exec(t),t=Number(t[1]);return _S.Vs(t,e)},FS.prototype.js=function(t){return TS.Vs(t)},FS.prototype.ii=function(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return e.user.uid===this.currentUser.uid?[2,this.syncEngine.ui(e.batchId,e.state,e.error)]:(fb("SharedClientState","Ignoring mutation for non-active user "+e.user.uid),[2])})})},FS.prototype.oi=function(t){return this.syncEngine.ai(t.targetId,t.state,t.error)},FS.prototype.ei=function(t,e){var n=this,r=e?this.Fs.insert(t,e):this.Fs.remove(t),i=this.Gs(this.Fs),o=this.Gs(r),s=[],a=[];return o.forEach(function(t){i.has(t)||s.push(t)}),i.forEach(function(t){o.has(t)||a.push(t)}),this.syncEngine.hi(s,a).then(function(){n.Fs=r})},FS.prototype.Ws=function(t){this.Fs.get(t.clientId)&&this.onlineStateHandler(t.onlineState)},FS.prototype.Gs=function(t){var n=T0;return t.forEach(function(t,e){n=n.unionWith(e.activeTargetIds)}),n},FS),SS=(MS.prototype.addPendingMutation=function(t){},MS.prototype.updateMutationState=function(t,e,n){},MS.prototype.addLocalQueryTarget=function(t){return this.li.Ds(t),this.fi[t]||"not-current"},MS.prototype.updateQueryState=function(t,e,n){this.fi[t]=e},MS.prototype.removeLocalQueryTarget=function(t){this.li.Cs(t)},MS.prototype.isLocalQueryTarget=function(t){return this.li.activeTargetIds.has(t)},MS.prototype.clearQueryState=function(t){delete this.fi[t]},MS.prototype.getAllActiveQueryTargets=function(){return this.li.activeTargetIds},MS.prototype.isActiveQueryTarget=function(t){return this.li.activeTargetIds.has(t)},MS.prototype.start=function(){return this.li=new IS,Promise.resolve()},MS.prototype.handleUserChange=function(t,e,n){},MS.prototype.setOnlineState=function(t){},MS.prototype.shutdown=function(){},MS.prototype.writeSequenceNumber=function(t){},MS.prototype.notifyBundleLoaded=function(){},MS),kS=(LS.prototype.di=function(t){},LS.prototype.shutdown=function(){},LS),CS=(xS.prototype.di=function(t){this.gi.push(t)},xS.prototype.shutdown=function(){window.removeEventListener("online",this.wi),window.removeEventListener("offline",this.mi)},xS.prototype.pi=function(){window.addEventListener("online",this.wi),window.addEventListener("offline",this.mi)},xS.prototype._i=function(){fb("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(0)},xS.prototype.yi=function(){fb("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(var t=0,e=this.gi;t<e.length;t++)(0,e[t])(1)},xS.yt=function(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener},xS),AS={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery"},NS=(DS.prototype.Ii=function(t){this.Ai=t},DS.prototype.Ri=function(t){this.bi=t},DS.prototype.onMessage=function(t){this.vi=t},DS.prototype.close=function(){this.Ti()},DS.prototype.send=function(t){this.Ei(t)},DS.prototype.Pi=function(){this.Ai()},DS.prototype.Vi=function(t){this.bi(t)},DS.prototype.Si=function(t){this.vi(t)},DS),RS=(OS.prototype.Ni=function(e,t,n,r){var i=this.xi(e,t);fb("RestConnection","Sending: ",i,n);t={};return this.ki(t,r),this.Fi(e,i,t,n).then(function(t){return fb("RestConnection","Received: ",t),t},function(t){throw db("RestConnection",e+" failed with error: ",t,"url: ",i,"request:",n),t})},OS.prototype.$i=function(t,e,n,r){return this.Ni(t,e,n,r)},OS.prototype.ki=function(t,e){if(t["X-Goog-Api-Client"]="gl-js/ fire/8.10.0",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])},OS.prototype.xi=function(t,e){return this.Di+"/v1/"+e+":"+AS[t]},Gi(PS,mS=OS),PS.prototype.Fi=function(u,e,n,r){return new Promise(function(o,s){var a=new rb;a.listenOnce($m.COMPLETE,function(){try{switch(a.getLastErrorCode()){case Xm.NO_ERROR:var t=a.getResponseJson();fb("Connection","XHR received:",JSON.stringify(t)),o(t);break;case Xm.TIMEOUT:fb("Connection",'RPC "'+u+'" timed out'),s(new ub(ab.DEADLINE_EXCEEDED,"Request time out"));break;case Xm.HTTP_ERROR:var e,n,r=a.getStatus();fb("Connection",'RPC "'+u+'" failed with status:',r,"response text:",a.getResponseText()),0<r?(e=a.getResponseJson().error)&&e.status&&e.message?(i=e.status.toLowerCase().replace(/_/g,"-"),n=0<=Object.values(ab).indexOf(i)?i:ab.UNKNOWN,s(new ub(n,e.message))):s(new ub(ab.UNKNOWN,"Server responded with status "+a.getStatus())):s(new ub(ab.UNAVAILABLE,"Connection failed."));break;default:vb()}}finally{fb("Connection",'RPC "'+u+'" completed.')}var i});var t=JSON.stringify(r);a.send(e,"POST",t,n,15)})},PS.prototype.Oi=function(t,e){var n=[this.Di,"/","google.firestore.v1.Firestore","/",t,"/channel"],r=new Wm,i=Ym(),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.useFetchStreams&&(t.xmlHttpFactory=new eb({})),this.ki(t.initMessageHeaders,e),go()||mo()||0<=po().indexOf("Electron/")||(0<=(e=po()).indexOf("MSIE ")||0<=e.indexOf("Trident/"))||0<=po().indexOf("MSAppHost/")||yo()||(t.httpHeadersOverwriteParam="$httpHeaders");n=n.join("");fb("Connection","Creating WebChannel: "+n,t);var o=r.createWebChannel(n,t),s=!1,a=!1,u=new NS({Ei:function(t){a?fb("Connection","Not sending because WebChannel is closed:",t):(s||(fb("Connection","Opening WebChannel transport."),o.open(),s=!0),fb("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,nb.EventType.OPEN,function(){a||fb("Connection","WebChannel transport opened.")}),t(o,nb.EventType.CLOSE,function(){a||(a=!0,fb("Connection","WebChannel transport closed"),u.Vi())}),t(o,nb.EventType.ERROR,function(t){a||(a=!0,db("Connection","WebChannel transport errored:",t),u.Vi(new ub(ab.UNAVAILABLE,"The operation could not be completed")))}),t(o,nb.EventType.MESSAGE,function(t){var e,n,r,i;a||(yb(!!(e=t.data[0])),(n=e.error||(null===(i=e[0])||void 0===i?void 0:i.error))?(fb("Connection","WebChannel received error:",n),r=n.status,t=function(){var t=$w[r];if(void 0!==t)return o0(t)}(),i=n.message,void 0===t&&(t=ab.INTERNAL,i="Unknown error status: "+r+" with message "+n.message),a=!0,u.Vi(new ub(t,i)),o.close()):(fb("Connection","WebChannel received:",e),u.Si(e)))}),t(i,Jm.STAT_EVENT,function(t){t.stat===Zm?fb("Connection","Detected buffering proxy"):t.stat===tb&&fb("Connection","Detected no buffering proxy")}),setTimeout(function(){u.Pi()},0),u},PS);function PS(t){var e=this;return(e=mS.call(this,t)||this).forceLongPolling=t.forceLongPolling,e.autoDetectLongPolling=t.autoDetectLongPolling,e.useFetchStreams=t.useFetchStreams,e}function OS(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 DS(t){this.Ei=t.Ei,this.Ti=t.Ti}function xS(){var t=this;this.wi=function(){return t._i()},this.mi=function(){return t.yi()},this.gi=[],this.pi()}function LS(){}function MS(){this.li=new IS,this.fi={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}function FS(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.ks.bind(this),this.Fs=new s0(_b),this.started=!1,this.$s=[];n=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");this.storage=this.window.localStorage,this.currentUser=i,this.Os=gS(this.persistenceKey,this.Ns),this.Ms="firestore_sequence_number_"+this.persistenceKey,this.Fs=this.Fs.insert(this.Ns,new IS),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.Ks="firestore_bundle_loaded_"+this.persistenceKey,this.window.addEventListener("storage",this.xs)}function jS(){this.activeTargetIds=T0}function US(t,e){this.clientId=t,this.onlineState=e}function qS(t,e){this.clientId=t,this.activeTargetIds=e}function VS(t,e,n){this.targetId=t,this.state=e,this.error=n}function BS(t,e,n,r){this.user=t,this.batchId=e,this.state=n,this.error=r}function KS(){return"undefined"!=typeof window?window:null}function WS(){return"undefined"!=typeof document?document:null}function HS(t){return new j0(t,!0)}function zS(t,e,n,r,i){var o=this;this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.Fr=[],this.$r=new Map,this.Or=new Set,this.Mr=[],this.Lr=i,this.Lr.di(function(t){n.enqueueAndForget(function(){return Yi(o,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return g1(this)?(fb("RemoteStore","Restarting streams for network reachability change."),[4,function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return(e=n).Or.add(4),[4,u1(e)];case 1:return t.sent(),e.Br.set("Unknown"),e.Or.delete(4),[4,a1(e)];case 2:return t.sent(),[2]}})})}(this)]):[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}),this.Br=new t1(n,r)}var GS,QS,YS,XS=(s1.prototype.reset=function(){this.qi=0},s1.prototype.Qi=function(){this.qi=this.Bi},s1.prototype.ji=function(t){var e=this;this.cancel();var n=Math.floor(this.qi+this.Wi()),r=Math.max(0,Date.now()-this.Ki),i=Math.max(0,n-r);0<i&&fb("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.Ki=Date.now(),t()}),this.qi*=this.Li,this.qi<this.Mi&&(this.qi=this.Mi),this.qi>this.Bi&&(this.qi=this.Bi)},s1.prototype.Gi=function(){null!==this.Ui&&(this.Ui.skipDelay(),this.Ui=null)},s1.prototype.cancel=function(){null!==this.Ui&&(this.Ui.cancel(),this.Ui=null)},s1.prototype.Wi=function(){return(Math.random()-.5)*this.qi},s1),Q=(o1.prototype.tr=function(){return 1===this.state||2===this.state||4===this.state},o1.prototype.er=function(){return 2===this.state},o1.prototype.start=function(){3!==this.state?this.auth():this.nr()},o1.prototype.stop=function(){return Yi(this,void 0,void 0,function(){return Xi(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]}})})},o1.prototype.sr=function(){this.state=0,this.Zi.reset()},o1.prototype.ir=function(){var t=this;this.er()&&null===this.Xi&&(this.Xi=this.Se.enqueueAfterDelay(this.zi,6e4,function(){return t.rr()}))},o1.prototype.cr=function(t){this.ur(),this.stream.send(t)},o1.prototype.rr=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return this.er()?[2,this.close(0)]:[2]})})},o1.prototype.ur=function(){this.Xi&&(this.Xi.cancel(),this.Xi=null)},o1.prototype.close=function(e,n){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return this.ur(),this.Zi.cancel(),this.Yi++,3!==e?this.Zi.reset():n&&n.code===ab.RESOURCE_EXHAUSTED?(pb(n.toString()),pb("Using maximum backoff delay to prevent overloading the backend."),this.Zi.Qi()):n&&n.code===ab.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]}})})},o1.prototype.ar=function(){},o1.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 ub(ab.UNKNOWN,"Fetching auth token failed: "+e.message);return n.dr(t)})})},o1.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)})})},o1.prototype.nr=function(){var t=this;this.state=4,this.Zi.ji(function(){return Yi(t,void 0,void 0,function(){return Xi(this,function(t){return this.state=0,this.start(),[2]})})})},o1.prototype.dr=function(t){return fb("PersistentStream","close with error: "+t),this.stream=null,this.close(3,t)},o1.prototype.hr=function(e){var n=this;return function(t){n.Se.enqueueAndForget(function(){return n.Yi===e?t():(fb("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())})}},o1),$S=(Gi(i1,YS=Q),i1.prototype.wr=function(t){return this.Hi.Oi("Listen",t)},i1.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:vb(),r=e.targetChange.targetIds||[],i=(s=e.targetChange.resumeToken,t.I?(yb(void 0===s||"string"==typeof s),Mb.fromBase64String(s||"")):(yb(void 0===s||s instanceof Uint8Array),Mb.fromUint8Array(s||new Uint8Array))),o=(a=e.targetChange.cause)&&(u=void 0===(c=a).code?ab.UNKNOWN:o0(c.code),new ub(u,c.message||"")),s=new C0(n,r,i,o||null)}else if("documentChange"in e){e.documentChange,(n=e.documentChange).document,n.document.name,n.document.updateTime;var r=H0(t,n.document.name),i=V0(n.document.updateTime),a=new f_({mapValue:{fields:n.document.fields}}),u=(o=d_.newFoundDocument(r,i,a),n.targetIds||[]),c=n.removedTargetIds||[];s=new S0(u,c,o.key,o)}else if("documentDelete"in e)e.documentDelete,(n=e.documentDelete).document,r=H0(t,n.document),i=n.readTime?V0(n.readTime):Eb.min(),a=d_.newNoDocument(r,i),o=n.removedTargetIds||[],s=new S0([],o,a.key,a);else if("documentRemove"in e)e.documentRemove,(n=e.documentRemove).document,r=H0(t,n.document),i=n.removedTargetIds||[],s=new S0([],i,r,null);else{if(!("filter"in e))return vb();e.filter;e=e.filter;e.targetId,n=e.count||0,r=new Xw(n),i=e.targetId,s=new k0(i,r)}return s}(this.R,t),t=function(t){if(!("targetChange"in t))return Eb.min();t=t.targetChange;return(!t.targetIds||!t.targetIds.length)&&t.readTime?V0(t.readTime):Eb.min()}(t);return this.listener._r(e,t)},i1.prototype.mr=function(t){var e,n,r,i={};i.database=Q0(this.R),i.addTarget=(e=this.R,(r=__(r=(n=t).target)?{documents:tT(e,r)}:{query:eT(e,r)}).targetId=n.targetId,0<n.resumeToken.approximateByteSize()?r.resumeToken=q0(e,n.resumeToken):0<n.snapshotVersion.compareTo(Eb.min())&&(r.readTime=U0(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 vb()}}())?null:{"goog-listen-tags":t});t&&(i.labels=t),this.cr(i)},i1.prototype.yr=function(t){var e={};e.database=Q0(this.R),e.removeTarget=t,this.cr(e)},i1),JS=(Gi(r1,QS=Q),Object.defineProperty(r1.prototype,"pr",{get:function(){return this.gr},enumerable:!1,configurable:!0}),r1.prototype.start=function(){this.gr=!1,this.lastStreamToken=void 0,QS.prototype.start.call(this)},r1.prototype.ar=function(){this.gr&&this.Er([])},r1.prototype.wr=function(t){return this.Hi.Oi("Write",t)},r1.prototype.onMessage=function(t){if(yb(!!t.streamToken),this.lastStreamToken=t.streamToken,this.gr){this.Zi.reset();var e=(n=t.writeResults,r=t.commitTime,n&&0<n.length?(yb(void 0!==r),n.map(function(t){return n=r,(t=(e=t).updateTime?V0(e.updateTime):V0(n)).isEqual(Eb.min())&&(t=V0(n)),new Dw(t,e.transformResults||[]);var e,n})):[]),n=V0(t.commitTime);return this.listener.Tr(n,e)}var n,r;return yb(!t.writeResults||0===t.writeResults.length),this.gr=!0,this.listener.Ir()},r1.prototype.Ar=function(){var t={};t.database=Q0(this.R),this.cr(t)},r1.prototype.Er=function(t){var e=this,t={streamToken:this.lastStreamToken,writes:t.map(function(t){return J0(e.R,t)})};this.cr(t)},r1),ZS=(Gi(n1,GS=function(){}),n1.prototype.br=function(){if(this.Rr)throw new ub(ab.FAILED_PRECONDITION,"The client has already been terminated.")},n1.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===ab.UNAUTHENTICATED&&i.credentials.invalidateToken(),t):new ub(ab.UNKNOWN,t.toString())})},n1.prototype.$i=function(e,n,r){var i=this;return this.br(),this.credentials.getToken().then(function(t){return i.Hi.$i(e,n,r,t)}).catch(function(t){throw"FirebaseError"===t.name?(t.code===ab.UNAUTHENTICATED&&i.credentials.invalidateToken(),t):new ub(ab.UNKNOWN,t.toString())})},n1.prototype.terminate=function(){this.Rr=!0},n1),t1=(e1.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()}))},e1.prototype.Nr=function(t){"Online"===this.state?this.Dr("Unknown"):(this.vr++,1<=this.vr&&(this.kr(),this.Cr("Connection failed 1 times. Most recent error: "+t.toString()),this.Dr("Offline")))},e1.prototype.set=function(t){this.kr(),this.vr=0,"Online"===t&&(this.Vr=!1),this.Dr(t)},e1.prototype.Dr=function(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))},e1.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?(pb(t),this.Vr=!1):fb("OnlineStateTracker",t)},e1.prototype.kr=function(){null!==this.Pr&&(this.Pr.cancel(),this.Pr=null)},e1);function e1(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.vr=0,this.Pr=null,this.Vr=!0}function n1(t,e,n){var r=this;return(r=GS.call(this)||this).credentials=t,r.Hi=e,r.R=n,r.Rr=!1,r}function r1(t,e,n,r,i){var o=this;return(o=QS.call(this,t,"write_stream_connection_backoff","write_stream_idle",e,n,i)||this).R=r,o.gr=!1,o}function i1(t,e,n,r,i){var o=this;return(o=YS.call(this,t,"listen_stream_connection_backoff","listen_stream_idle",e,n,i)||this).R=r,o}function o1(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 XS(t,e)}function s1(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.Ki=Date.now(),this.reset()}function a1(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:if(!g1(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 u1(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(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 c1(t,e){t.$r.has(e.targetId)||(t.$r.set(e.targetId,e),d1(t)?p1(t):E1(t).er()&&l1(t,e))}function h1(t,e){var n=t,t=E1(n);n.$r.delete(e),t.er()&&f1(n,e),0===n.$r.size&&(t.er()?t.ir():g1(n)&&n.Br.set("Unknown"))}function l1(t,e){t.qr.U(e.targetId),E1(t).mr(e)}function f1(t,e){t.qr.U(e),E1(t).yr(e)}function p1(e){e.qr=new N0({getRemoteKeysForTarget:function(t){return e.remoteSyncer.getRemoteKeysForTarget(t)},lt:function(t){return e.$r.get(t)||null}}),E1(e).start(),e.Br.Sr()}function d1(t){return g1(t)&&!E1(t).tr()&&0<t.$r.size}function g1(t){return 0===t.Or.size}function v1(t){t.qr=void 0}function y1(s,a,u){return Yi(this,void 0,void 0,function(){var n,o;return Xi(this,function(t){switch(t.label){case 0:if(s.Br.set("Online"),!(a instanceof C0&&2===a.state&&a.cause))return[3,6];t.label=1;case 1:return t.trys.push([1,3,,5]),[4,function(o,s){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:e=s.cause,n=0,r=s.targetIds,t.label=1;case 1:return n<r.length?(i=r[n],o.$r.has(i)?[4,o.remoteSyncer.rejectListen(i,e)]:[3,3]):[3,5];case 2:t.sent(),o.$r.delete(i),o.qr.removeTarget(i),t.label=3;case 3:t.label=4;case 4:return n++,[3,1];case 5:return[2]}})})}(s,a)];case 2:return t.sent(),[3,5];case 3:return n=t.sent(),fb("RemoteStore","Failed to remove targets %s: %s ",a.targetIds.join(","),n),[4,m1(s,n)];case 4:return t.sent(),[3,5];case 5:return[3,13];case 6:if(a instanceof S0?s.qr.X(a):a instanceof k0?s.qr.rt(a):s.qr.et(a),u.isEqual(Eb.min()))return[3,13];t.label=7;case 7:return t.trys.push([7,11,,13]),[4,ME(s.localStore)];case 8:return o=t.sent(),0<=u.compareTo(o)?[4,(i=u,(e=(r=s).qr.ut(i)).targetChanges.forEach(function(t,e){var n;0<t.resumeToken.approximateByteSize()&&((n=r.$r.get(e))&&r.$r.set(e,n.withResumeToken(t.resumeToken,i)))}),e.targetMismatches.forEach(function(t){var e=r.$r.get(t);e&&(r.$r.set(t,e.withResumeToken(Mb.EMPTY_BYTE_STRING,e.snapshotVersion)),f1(r,t),e=new rI(e.target,t,1,e.sequenceNumber),l1(r,e))}),r.remoteSyncer.applyRemoteEvent(e))]:[3,10];case 9:t.sent(),t.label=10;case 10:return[3,13];case 11:return fb("RemoteStore","Failed to raise snapshot:",o=t.sent()),[4,m1(s,o)];case 12:return t.sent(),[3,13];case 13:return[2]}var r,i,e})})}function m1(n,r,i){return Yi(this,void 0,void 0,function(){var e=this;return Xi(this,function(t){switch(t.label){case 0:if(!HT(r))throw r;return n.Or.add(1),[4,u1(n)];case 1:return t.sent(),n.Br.set("Offline"),i=i||function(){return ME(n.localStore)},n.asyncQueue.enqueueRetryable(function(){return Yi(e,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return fb("RemoteStore","Retrying IndexedDB access"),[4,i()];case 1:return t.sent(),n.Or.delete(1),[4,a1(n)];case 2:return t.sent(),[2]}})})}),[2]}})})}function b1(e,n){return n().catch(function(t){return m1(e,t,n)})}function _1(u){return Yi(this,void 0,void 0,function(){var i,o,s,a;return Xi(this,function(t){switch(t.label){case 0:o=S1(i=u),s=0<i.Fr.length?i.Fr[i.Fr.length-1].batchId:-1,t.label=1;case 1:if(!(g1(i)&&i.Fr.length<10))return[3,7];t.label=2;case 2:return t.trys.push([2,4,,6]),[4,(e=i.localStore,n=s,(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===(a=t.sent())?(0===i.Fr.length&&o.ir(),[3,7]):(s=a.batchId,function(t,e){t.Fr.push(e);t=S1(t);t.er()&&t.pr&&t.Er(e.mutations)}(i,a),[3,6]);case 4:return a=t.sent(),[4,m1(i,a)];case 5:return t.sent(),[3,6];case 6:return[3,1];case 7:return w1(i)&&T1(i),[2]}var e,n,r})})}function w1(t){return g1(t)&&!S1(t).tr()&&0<t.Fr.length}function T1(t){S1(t).start()}function I1(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=n,r?(e.Or.delete(2),[4,a1(e)]):[3,2];case 1:return t.sent(),[3,5];case 2:return r?[3,4]:(e.Or.add(2),[4,u1(e)]);case 3:t.sent(),e.Br.set("Unknown"),t.label=4;case 4:t.label=5;case 5:return[2]}})})}function E1(n){var t,e,r,i=this;return n.Ur||(n.Ur=(t=n.datastore,e=n.asyncQueue,r={Ii:function(n){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return n.$r.forEach(function(t,e){l1(n,t)}),[2]})})}.bind(null,n),Ri:function(e,n){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return v1(e),d1(e)?(e.Br.Nr(n),p1(e)):e.Br.set("Unknown"),[2]})})}.bind(null,n),_r:y1.bind(null,n)},t.br(),new $S(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return Yi(i,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return e?(n.Ur.sr(),d1(n)?p1(n):n.Br.set("Unknown"),[3,3]):[3,1];case 1:return[4,n.Ur.stop()];case 2:t.sent(),v1(n),t.label=3;case 3:return[2]}})})})),n.Ur}function S1(n){var t,e,r,i=this;return n.Kr||(n.Kr=(t=n.datastore,e=n.asyncQueue,r={Ii:function(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return S1(e).Ar(),[2]})})}.bind(null,n),Ri:function(e,n){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return n&&S1(e).pr?[4,function(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return i0(n=i.code)&&n!==ab.ABORTED?(e=r.Fr.shift(),S1(r).sr(),[4,b1(r,function(){return r.remoteSyncer.rejectFailedWrite(e.batchId,i)})]):[3,3];case 1:return t.sent(),[4,_1(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 w1(e)&&T1(e),[2]}})})}.bind(null,n),Ir:function(o){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){for(e=S1(o),n=0,r=o.Fr;n<r.length;n++)i=r[n],e.Er(i.mutations);return[2]})})}.bind(null,n),Tr:function(r,i,o){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return e=r.Fr.shift(),n=nI.from(e,i,o),[4,b1(r,function(){return r.remoteSyncer.applySuccessfulWrite(n)})];case 1:return t.sent(),[4,_1(r)];case 2:return t.sent(),[2]}})})}.bind(null,n)},t.br(),new JS(e,t.Hi,t.credentials,t.R,r)),n.Mr.push(function(e){return Yi(i,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return e?(n.Kr.sr(),[4,_1(n)]):[3,2];case 1:return t.sent(),[3,4];case 2:return[4,n.Kr.stop()];case 3:t.sent(),0<n.Fr.length&&(fb("RemoteStore","Stopping write stream with "+n.Fr.length+" pending writes"),n.Fr=[]),t.label=4;case 4:return[2]}})})})),n.Kr}var k1=(C1.createAndSchedule=function(t,e,n,r,i){i=new C1(t,e,Date.now()+n,r,i);return i.start(n),i},C1.prototype.start=function(t){var e=this;this.timerHandle=setTimeout(function(){return e.handleDelayElapsed()},t)},C1.prototype.skipDelay=function(){return this.handleDelayElapsed()},C1.prototype.cancel=function(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new ub(ab.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},C1.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()})},C1.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},C1);function C1(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new DT,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(function(t){})}function A1(t,e){if(pb("AsyncQueue",e+": "+t),HT(t))return new ub(ab.UNAVAILABLE,e+": "+t);throw t}function N1(){this.queries=new oE(cw,uw),this.onlineState="Unknown",this.Gr=new Set}var R1=(M1.emptySet=function(t){return new M1(t.comparator)},M1.prototype.has=function(t){return null!=this.keyedMap.get(t)},M1.prototype.get=function(t){return this.keyedMap.get(t)},M1.prototype.first=function(){return this.sortedSet.minKey()},M1.prototype.last=function(){return this.sortedSet.maxKey()},M1.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},M1.prototype.indexOf=function(t){t=this.keyedMap.get(t);return t?this.sortedSet.indexOf(t):-1},Object.defineProperty(M1.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!1,configurable:!0}),M1.prototype.forEach=function(n){this.sortedSet.inorderTraversal(function(t,e){return n(t),!1})},M1.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))},M1.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this},M1.prototype.isEqual=function(t){if(!(t instanceof M1))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},M1.prototype.toString=function(){var e=[];return this.forEach(function(t){e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"},M1.prototype.copy=function(t,e){var n=new M1;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n},M1),P1=(L1.prototype.track=function(t){var e=t.doc.key,n=this.Qr.get(e);!n||0!==t.type&&3===n.type?this.Qr=this.Qr.insert(e,t):3===t.type&&1!==n.type?this.Qr=this.Qr.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Qr=this.Qr.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Qr=this.Qr.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Qr=this.Qr.remove(e):1===t.type&&2===n.type?this.Qr=this.Qr.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Qr=this.Qr.insert(e,{type:2,doc:t.doc}):vb()},L1.prototype.jr=function(){var n=[];return this.Qr.inorderTraversal(function(t,e){n.push(e)}),n},L1),O1=(x1.fromInitialDocuments=function(t,e,n,r){var i=[];return e.forEach(function(t){i.push({type:0,doc:t})}),new x1(t,e,R1.emptySet(e),i,n,r,!0,!1)},Object.defineProperty(x1.prototype,"hasPendingWrites",{get:function(){return!this.mutatedKeys.isEmpty()},enumerable:!1,configurable:!0}),x1.prototype.isEqual=function(t){if(!(this.fromCache===t.fromCache&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&uw(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},x1),D1=function(){this.Wr=void 0,this.listeners=[]};function x1(t,e,n,r,i,o,s,a){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=s,this.excludesMetadataChanges=a}function L1(){this.Qr=new s0($b.comparator)}function M1(n){this.comparator=n?function(t,e){return n(t,e)||$b.comparator(t.key,e.key)}:function(t,e){return $b.comparator(t.key,e.key)},this.keyedMap=m0,this.sortedSet=new s0(this.comparator)}function F1(s,a){return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:if(e=s,n=a.query,r=!1,(i=e.queries.get(n))||(r=!0,i=new D1),!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=A1(o,"Initialization of query '"+hw(a.query)+"' failed"),[2,void a.onError(o)];case 4:return e.queries.set(n,i),i.listeners.push(a),a.zr(e.onlineState),i.Wr&&a.Hr(i.Wr)&&U1(e),[2]}})})}function j1(s,a){return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){return e=s,n=a.query,r=!1,(i=e.queries.get(n))&&0<=(o=i.listeners.indexOf(a))&&(i.listeners.splice(o,1),r=0===i.listeners.length),r?[2,(e.queries.delete(n),e.onUnlisten(n))]:[2]})})}function U1(t){t.Gr.forEach(function(t){t.next()})}var q1=(G1.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 O1(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},G1.prototype.onError=function(t){this.Jr.error(t)},G1.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},G1.prototype.eo=function(t,e){return!t.fromCache||!(this.options.so&&"Offline"!==e||t.docs.isEmpty()&&"Offline"!==e)},G1.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},G1.prototype.no=function(t){t=O1.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache),this.Yr=!0,this.Jr.next(t)},G1),V1=(z1.prototype.io=function(){return"metadata"in this.payload},z1),B1=(H1.prototype.qn=function(t){return H0(this.R,t)},H1.prototype.Un=function(t){return t.metadata.exists?$0(this.R,t.document,!1):d_.newNoDocument(this.qn(t.metadata.name),this.Kn(t.metadata.readTime))},H1.prototype.Kn=V0,H1),K1=(W1.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},W1.prototype.co=function(t){for(var e=new Map,n=new B1(this.R),r=0,i=t;r<i.length;r++){var o=i[r];if(o.metadata.queries)for(var s=n.qn(o.metadata.name),a=0,u=o.metadata.queries;a<u.length;a++){var c=u[a],h=(e.get(c)||w0()).add(s);e.set(c,h)}}return e},W1.prototype.complete=function(){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:return[4,function(l,f,p,d){return Yi(this,void 0,void 0,function(){var n,r,i,o,e,s,a,u,c,h;return Xi(this,function(t){switch(t.label){case 0:for(n=l,r=w0(),i=g0,o=b0,e=0,s=p;e<s.length;e++)a=s[e],u=f.qn(a.metadata.name),a.document&&(r=r.add(u)),i=i.insert(u,f.Un(a)),o=o.insert(u,f.Kn(a.metadata.readTime));return c=n.On.newChangeBuffer({trackRemovals:!0}),[4,UE(n,sw(Z_(Ob.fromString("__bundle__/docs/"+d))))];case 1:return h=t.sent(),[2,n.persistence.runTransaction("Apply bundle documents","readwrite",function(e){return jE(e,c,i,Eb.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 B1(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=w0()),Yi(this,void 0,void 0,function(){var n,r;return Xi(this,function(t){switch(t.label){case 0:return[4,UE(e,sw(yI(i.bundledQuery)))];case 1:return n=t.sent(),[2,(r=e).persistence.runTransaction("Save named query","readwrite",function(t){var e=V0(i.readTime);if(0<=n.snapshotVersion.compareTo(e))return r.Ke.saveNamedQuery(t,i);e=n.withResumeToken(Mb.EMPTY_BYTE_STRING,e);return r.kn=r.kn.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.Ke.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 EE(Object.assign({},this.progress),e))]}})})},W1);function W1(t,e,n){this.ro=t,this.localStore=e,this.R=n,this.queries=[],this.documents=[],this.progress=Q1(t)}function H1(t){this.R=t}function z1(t,e){this.payload=t,this.byteLength=e}function G1(t,e,n){this.query=t,this.Jr=e,this.Yr=!1,this.Xr=null,this.onlineState="Unknown",this.options=n||{}}function Q1(t){return{taskState:"Running",documentsLoaded:0,bytesLoaded:0,totalDocuments:t.totalDocuments,totalBytes:t.totalBytes}}var Y1=function(t){this.key=t},X1=function(t){this.key=t},$1=(Object.defineProperty(nk.prototype,"wo",{get:function(){return this.uo},enumerable:!1,configurable:!0}),nk.prototype._o=function(t,e){var s=this,a=e?e.mo:new P1,u=(e||this).fo,c=(e||this).mutatedKeys,h=u,l=!1,f=tw(this.query)&&u.size===this.query.limit?u.last():null,p=ew(this.query)&&u.size===this.query.limit?u.first():null;if(t.inorderTraversal(function(t,e){var n=u.get(t),r=lw(s.query,e)?e:null,i=!!n&&s.mutatedKeys.has(n.key),o=!!r&&(r.hasLocalMutations||s.mutatedKeys.has(r.key)&&r.hasCommittedMutations),e=!1;n&&r?n.data.isEqual(r.data)?i!==o&&(a.track({type:3,doc:r}),e=!0):s.yo(n,r)||(a.track({type:2,doc:r}),e=!0,(f&&0<s.lo(r,f)||p&&s.lo(r,p)<0)&&(l=!0)):!n&&r?(a.track({type:0,doc:r}),e=!0):n&&!r&&(a.track({type:1,doc:n}),e=!0,(f||p)&&(l=!0)),e&&(c=r?(h=h.add(r),o?c.add(t):c.delete(t)):(h=h.delete(t),c.delete(t)))}),tw(this.query)||ew(this.query))for(;h.size>this.query.limit;){var n=tw(this.query)?h.last():h.first(),h=h.delete(n.key),c=c.delete(n.key);a.track({type:1,doc:n})}return{fo:h,mo:a,Nn:l,mutatedKeys:c}},nk.prototype.yo=function(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations},nk.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 vb()}}var r,i}),this.po(n);var s=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 O1(this.query,t.fo,r,i,t.mutatedKeys,0==n,e,!1),To:s}:{To:s}},nk.prototype.zr=function(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({fo:this.fo,mo:new P1,mutatedKeys:this.mutatedKeys,Nn:!1},!1)):{To:[]}},nk.prototype.Io=function(t){return!this.uo.has(t)&&!!this.fo.has(t)&&!this.fo.get(t).hasLocalMutations},nk.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)},nk.prototype.Eo=function(){var e=this;if(!this.current)return[];var n=this.ho;this.ho=w0(),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 X1(t))}),this.ho.forEach(function(t){n.has(t)||r.push(new Y1(t))}),r},nk.prototype.Ao=function(t){this.uo=t.Bn,this.ho=w0();t=this._o(t.documents);return this.applyChanges(t,!0)},nk.prototype.Ro=function(){return O1.fromInitialDocuments(this.query,this.fo,this.mutatedKeys,0===this.ao)},nk),J1=function(t,e,n){this.query=t,this.targetId=e,this.view=n},Z1=function(t){this.key=t,this.bo=!1},tk=(Object.defineProperty(ek.prototype,"isPrimaryClient",{get:function(){return!0===this.$o},enumerable:!1,configurable:!0}),ek);function ek(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 oE(cw,uw),this.Vo=new Map,this.So=new Set,this.Do=new s0($b.comparator),this.Co=new Map,this.No=new QE,this.xo={},this.ko=new Map,this.Fo=qI.Yt(),this.onlineState="Unknown",this.$o=void 0}function nk(t,e){this.query=t,this.uo=e,this.ao=null,this.current=!1,this.ho=w0(),this.mutatedKeys=w0(),this.lo=fw(t),this.fo=new R1(this.lo)}function rk(i,o,s,a){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return i.Oo=function(t,e,n){return function(r,i,o,s){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return(e=i.view._o(o)).Nn?[4,VE(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=s&&s.targetChanges.get(i.targetId),n=i.view.applyChanges(e,r.isPrimaryClient,n),[2,(pk(r,i.targetId,n.To),n.snapshot)]}})})}(i,t,e,n)},[4,VE(i.localStore,o,!0)];case 1:return n=t.sent(),r=new $1(o,n.Bn),e=r._o(n.documents),n=E0.createSynthesizedTargetChangeForCurrentChange(s,a&&"Offline"!==i.onlineState),n=r.applyChanges(e,i.isPrimaryClient,n),pk(i,s,n.To),r=new J1(o,s,r),[2,(i.Po.set(o,r),i.Vo.has(s)?i.Vo.get(s).push(o):i.Vo.set(s,[o]),n.snapshot)]}})})}function ik(f,p,d){return Yi(this,void 0,void 0,function(){var s,l;return Xi(this,function(t){switch(t.label){case 0:l=Tk(f),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,(i=l.localStore,a=p,c=i,h=Ib.now(),o=a.reduce(function(t,e){return t.add(e.key)},w0()),c.persistence.runTransaction("Locally write mutations","readwrite",function(s){return c.Mn.pn(s,o).next(function(t){u=t;for(var e=[],n=0,r=a;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],s=e.data.field(o.field),s=vw(o.transform,s||null);null!=s&&(n=null==n?f_.empty():n).set(o.field,s)}return n||null}(i,u.get(i.key));null!=o&&e.push(new Ww(i.key,o,function s(t){var a=[];return Ab(t.fields,function(t,e){var n=new xb([t]);if(h_(e))if(0===(e=s(e.mapValue).fields).length)a.push(n);else for(var r=0,i=e;r<i.length;r++){var o=i[r];a.push(n.child(o))}else a.push(n)}),new Lb(a)}(o.value.mapValue),Lw.exists(!0)))}return c._n.addMutationBatch(s,h,e,a)})}).then(function(t){return t.applyToLocalDocumentSet(u),{batchId:t.batchId,changes:u}}))];case 2:return s=t.sent(),l.sharedClientState.addPendingMutation(s.batchId),e=l,n=s.batchId,r=d,i=(i=(i=e.xo[e.currentUser.toKey()])||new s0(_b)).insert(n,r),e.xo[e.currentUser.toKey()]=i,[4,gk(l,s.changes)];case 3:return t.sent(),[4,_1(l.remoteStore)];case 4:return t.sent(),[3,6];case 5:return l=t.sent(),l=A1(l,"Failed to persist write"),d.reject(l),[3,6];case 6:return[2]}var e,n,r,i,a,u,c,h,o})})}function ok(r,i){return Yi(this,void 0,void 0,function(){var n,e;return Xi(this,function(t){switch(t.label){case 0:n=r,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,FE(n.localStore,i)];case 2:return e=t.sent(),i.targetChanges.forEach(function(t,e){e=n.Co.get(e);e&&(yb(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),0<t.addedDocuments.size?e.bo=!0:0<t.modifiedDocuments.size?yb(e.bo):0<t.removedDocuments.size&&(yb(e.bo),e.bo=!1))}),[4,gk(n,e,i)];case 3:return t.sent(),[3,6];case 4:return[4,GI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}function sk(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&&U1(t)}(t.eventManager,n),r.length&&t.vo._r(r),t.onlineState=n,t.isPrimaryClient&&t.sharedClientState.setOnlineState(n))}function ak(s,a,u){return Yi(this,void 0,void 0,function(){var n,o;return Xi(this,function(t){switch(t.label){case 0:n=s,t.label=1;case 1:return t.trys.push([1,4,,6]),[4,(e=n.localStore,r=a,(i=e).persistence.runTransaction("Reject batch","readwrite-primary",function(e){var n;return i._n.lookupMutationBatch(e,r).next(function(t){return yb(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(),hk(n,a,u),ck(n,a),n.sharedClientState.updateMutationState(a,"rejected",u),[4,gk(n,o)];case 3:return t.sent(),[3,6];case 4:return[4,GI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}var e,r,i})})}function uk(o,s){return Yi(this,void 0,void 0,function(){var n,r,i;return Xi(this,function(t){switch(t.label){case 0:g1((n=o).remoteStore)||fb("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 s.resolve()]:((i=n.ko.get(r)||[]).push(s),n.ko.set(r,i),[3,4]);case 3:return i=t.sent(),i=A1(i,"Initialization of waitForPendingWrites() operation failed"),s.reject(i),[3,4];case 4:return[2]}var e})})}function ck(t,e){(t.ko.get(e)||[]).forEach(function(t){t.resolve()}),t.ko.delete(e)}function hk(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 lk(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)||fk(e,t)})}function fk(t,e){t.So.delete(e.path.canonicalString());var n=t.Do.get(e);null!==n&&(h1(t.remoteStore,n),t.Do=t.Do.remove(e),t.Co.delete(n),dk(t))}function pk(t,e,n){for(var r,i,o,s=0,a=n;s<a.length;s++){var u=a[s];u instanceof Y1?(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)||(fb("SyncEngine","New document in limbo: "+o),r.So.add(i),dk(r))):u instanceof X1?(fb("SyncEngine","Document no longer in limbo: "+u.key),t.No.removeReference(u.key,e),t.No.containsKey(u.key)||fk(t,u.key)):vb()}}function dk(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 $b(Ob.fromString(e)),e=t.Fo.next();t.Co.set(e,new Z1(n)),t.Do=t.Do.insert(n,e),c1(t.remoteStore,new rI(sw(Z_(n.path)),e,2,ib.o))}}function gk(e,s,a){return Yi(this,void 0,void 0,function(){var n,r,i,o;return Xi(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.Oo(e,s,a).then(function(t){t&&(n.isPrimaryClient&&n.sharedClientState.updateQueryState(e.targetId,t.fromCache?"not-current":"current"),r.push(t),t=kE.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 Yi(this,void 0,void 0,function(){var r,e,n,i,o,s,a;return Xi(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 xT.forEach(c,function(e){return xT.forEach(e.bn,function(t){return r.persistence.referenceDelegate.addReference(n,e.targetId,t)}).next(function(){return xT.forEach(e.vn,function(t){return r.persistence.referenceDelegate.removeReference(n,e.targetId,t)})})})})];case 2:return t.sent(),[3,4];case 3:if(!HT(e=t.sent()))throw e;return fb("LocalStore","Failed to update sequence numbers: "+e),[3,4];case 4:for(n=0,i=c;n<i.length;n++)a=i[n],o=a.targetId,a.fromCache||(s=r.kn.get(o),a=s.snapshotVersion,a=s.withLastLimboFreeSnapshotVersion(a),r.kn=r.kn.insert(o,a));return[2]}})})}(n.localStore,i)];case 2:t.sent(),t.label=3;case 3:return[2]}})})}function vk(i,o){return Yi(this,void 0,void 0,function(){var n,r;return Xi(this,function(t){switch(t.label){case 0:return(n=i).currentUser.isEqual(o)?[3,3]:(fb("SyncEngine","User change. New user:",o.toKey()),[4,xE(n.localStore,o)]);case 1:return r=t.sent(),n.currentUser=o,(e=n).ko.forEach(function(t){t.forEach(function(t){t.reject(new ub(ab.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.ko.clear(),n.sharedClientState.handleUserChange(o,r.removedBatchIds,r.addedBatchIds),[4,gk(n,r.Ln)];case 2:t.sent(),t.label=3;case 3:return[2]}var e})})}function yk(a,u,c,h){return Yi(this,void 0,void 0,function(){var o,s;return Xi(this,function(t){switch(t.label){case 0:return[4,(e=(o=a).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):xT.resolve(null)})}))];case 1:return null===(s=t.sent())?[3,6]:"pending"!==c?[3,3]:[4,_1(o.remoteStore)];case 2:return t.sent(),[3,4];case 3:"acknowledged"===c||"rejected"===c?(hk(o,u,h||null),ck(o,u),o.localStore._n.Gt(u)):vb(),t.label=4;case 4:return[4,gk(o,s)];case 5:return t.sent(),[3,7];case 6:fb("SyncEngine","Cannot apply mutation batch with id: "+u),t.label=7;case 7:return[2]}var e,n,r,i})})}function mk(h,l){return Yi(this,void 0,void 0,function(){var r,e,i,o,s,a,u,c;return Xi(this,function(t){switch(t.label){case 0:return wk(r=h),Tk(r),!0!==l||!0===r.$o?[3,3]:(e=r.sharedClientState.getAllActiveQueryTargets(),[4,bk(r,e.toArray())]);case 1:return i=t.sent(),r.$o=!0,[4,I1(r.remoteStore,!0)];case 2:for(t.sent(),o=0,s=i;o<s.length;o++)a=s[o],c1(r.remoteStore,a);return[3,7];case 3:return!1!==l||!1===r.$o?[3,7]:(u=[],c=Promise.resolve(),r.Vo.forEach(function(t,e){r.sharedClientState.isLocalQueryTarget(e)?u.push(e):c=c.then(function(){return lk(r,e),qE(r.localStore,e,!0)}),h1(r.remoteStore,e)}),[4,c]);case 4:return t.sent(),[4,bk(r,u)];case 5:return t.sent(),(n=r).Co.forEach(function(t,e){h1(n.remoteStore,e)}),n.No.ts(),n.Co=new Map,n.Do=new s0($b.comparator),r.$o=!1,[4,I1(r.remoteStore,!1)];case 6:t.sent(),t.label=7;case 7:return[2]}var n})})}function bk(p,d){return Yi(this,void 0,void 0,function(){var e,n,r,i,o,s,a,u,c,h,l,f;return Xi(this,function(t){switch(t.label){case 0:e=p,n=[],r=[],i=0,o=d,t.label=1;case 1:return i<o.length?(s=o[i],a=void 0,(u=e.Vo.get(s))&&0!==u.length?[4,UE(e.localStore,sw(u[0]))]:[3,7]):[3,13];case 2:a=t.sent(),c=0,h=u,t.label=3;case 3:return c<h.length?(l=h[c],l=e.Po.get(l),[4,function(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,VE((e=r).localStore,i.query,!0)];case 1:return n=t.sent(),n=i.view.Ao(n),[2,(e.isPrimaryClient&&pk(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,BE(e.localStore,s)];case 8:return f=t.sent(),[4,UE(e.localStore,f)];case 9:return a=t.sent(),[4,rk(e,_k(f),s,!1)];case 10:t.sent(),t.label=11;case 11:n.push(a),t.label=12;case 12:return i++,[3,1];case 13:return[2,(e.vo._r(r),n)]}})})}function _k(t){return J_(t.path,t.collectionGroup,t.orderBy,t.filters,t.limit,"F",t.startAt,t.endAt)}function wk(t){return t.remoteStore.remoteSyncer.applyRemoteEvent=ok.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=function(t,e){var n=t;if((t=n.Co.get(e))&&t.bo)return w0().add(t.key);var r=w0();if(!(e=n.Vo.get(e)))return r;for(var i=0,o=e;i<o.length;i++)var s=o[i],s=n.Po.get(s),r=r.unionWith(s.view.wo);return r}.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=function(o,s,a){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:return(e=o).sharedClientState.updateQueryState(s,"rejected",a),i=e.Co.get(s),(n=i&&i.key)?(r=(r=new s0($b.comparator)).insert(n,d_.newNoDocument(n,Eb.min())),i=w0().add(n),i=new I0(Eb.min(),new Map,new p0(_b),r,i),[4,ok(e,i)]):[3,2];case 1:return t.sent(),e.Do=e.Do.remove(n),e.Co.delete(s),dk(e),[3,4];case 2:return[4,qE(e.localStore,s,!1).then(function(){return lk(e,s,a)}).catch(GI)];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 s=o[i],a=s.query,a=n.queries.get(a);if(a){for(var u=0,c=a.listeners;u<c.length;u++)c[u].Hr(s)&&(r=!0);a.Wr=s}}r&&U1(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 Tk(t){return t.remoteStore.remoteSyncer.applySuccessfulWrite=function(i,o){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(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,LE(e.localStore,o)];case 2:return r=t.sent(),hk(e,n,null),ck(e,n),e.sharedClientState.updateMutationState(n,"acknowledged"),[4,gk(e,r)];case 3:return t.sent(),[3,6];case 4:return[4,GI(t.sent())];case 5:return t.sent(),[3,6];case 6:return[2]}})})}.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=ak.bind(null,t),t}function Ik(t,e,n){var r=t;!function(f,p,d){return Yi(this,void 0,void 0,function(){var a,u,c,h,l;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,14,,15]),[4,p.getMetadata()];case 1:return a=t.sent(),[4,(r=f.localStore,o=r,s=V0((i=a).createTime),o.persistence.runTransaction("hasNewerBundle","readonly",function(t){return o.Ke.getBundleMetadata(t,i.id)}).then(function(t){return!!t&&0<=t.createTime.compareTo(s)}))];case 2:return t.sent()?[4,p.close()]:[3,4];case 3:return[2,(t.sent(),void d._completeWith({taskState:"Success",documentsLoaded:a.totalDocuments,bytesLoaded:a.totalBytes,totalDocuments:a.totalDocuments,totalBytes:a.totalBytes}))];case 4:return d._updateProgress(Q1(a)),u=new K1(a,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,gk(f,l.wn,void 0)];case 12:return t.sent(),[4,(r=f.localStore,e=a,(n=r).persistence.runTransaction("Save bundle","readwrite",function(t){return n.Ke.saveBundleMetadata(t,e)}))];case 13:return t.sent(),d._completeWith(l.progress),[3,15];case 14:return db("SyncEngine","Loading bundle failed with "+(l=t.sent())),d._failWith(l),[3,15];case 15:return[2]}var e,n,r,i,o,s})})}(r,e,n).then(function(){r.sharedClientState.notifyBundleLoaded()})}var Ek,Sk,kk=(Dk.prototype.initialize=function(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return this.R=HS(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.Ko(e),[2]}})})},Dk.prototype.Uo=function(t){return null},Dk.prototype.Ko=function(t){return DE(this.persistence,new CE,t.initialUser,this.R)},Dk.prototype.qo=function(t){return new tS(nS.bs,this.R)},Dk.prototype.Bo=function(t){return new SS},Dk.prototype.terminate=function(){return Yi(this,void 0,void 0,function(){return Xi(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]}})})},Dk),Ck=(Gi(Ok,Sk=kk),Ok.prototype.initialize=function(n){return Yi(this,void 0,void 0,function(){var e=this;return Xi(this,function(t){switch(t.label){case 0:return[4,Sk.prototype.initialize.call(this,n)];case 1:return t.sent(),[4,WE(this.localStore)];case 2:return t.sent(),[4,this.Qo.initialize(this,n)];case 3:return t.sent(),[4,Tk(this.Qo.syncEngine)];case 4:return t.sent(),[4,_1(this.Qo.remoteStore)];case 5:return t.sent(),[4,this.persistence.He(function(){return e.gcScheduler&&!e.gcScheduler.started&&e.gcScheduler.start(e.localStore),Promise.resolve()})];case 6:return t.sent(),[2]}})})},Ok.prototype.Ko=function(t){return DE(this.persistence,new CE,t.initialUser,this.R)},Ok.prototype.Uo=function(t){var e=this.persistence.referenceDelegate.garbageCollector;return new XI(e,t.asyncQueue)},Ok.prototype.qo=function(t){var e=IE(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey),n=void 0!==this.cacheSizeBytes?RI.withCacheSize(this.cacheSizeBytes):RI.DEFAULT;return new bE(this.synchronizeTabs,e,t.clientId,n,t.asyncQueue,KS(),WS(),this.R,this.sharedClientState,!!this.forceOwnership)},Ok.prototype.Bo=function(t){return new SS},Ok),Ak=(Gi(Pk,Ek=Ck),Pk.prototype.initialize=function(r){return Yi(this,void 0,void 0,function(){var e,n=this;return Xi(this,function(t){switch(t.label){case 0:return[4,Ek.prototype.initialize.call(this,r)];case 1:return t.sent(),e=this.Qo.syncEngine,this.sharedClientState instanceof ES?(this.sharedClientState.syncEngine={ui:yk.bind(null,e),ai:function(i,o,s,a){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return(e=i).$o?(fb("SyncEngine","Ignoring unexpected query state notification."),[3,8]):[3,1];case 1:if(!e.Vo.has(o))return[3,8];switch(s){case"current":case"not-current":return[3,2];case"rejected":return[3,5]}return[3,7];case 2:return[4,KE(e.localStore)];case 3:return n=t.sent(),r=I0.createSynthesizedRemoteEventForCurrentChange(o,"current"===s),[4,gk(e,n,r)];case 4:return t.sent(),[3,8];case 5:return[4,qE(e.localStore,o,!0)];case 6:return t.sent(),lk(e,o,a),[3,8];case 7:vb(),t.label=8;case 8:return[2]}})})}.bind(null,e),hi:function(c,h,l){return Yi(this,void 0,void 0,function(){var n,e,r,i,o,s,a,u;return Xi(this,function(t){switch(t.label){case 0:if(!(n=wk(c)).$o)return[3,10];e=0,r=h,t.label=1;case 1:return e<r.length?(r=r[e],n.Vo.has(r)?(fb("SyncEngine","Adding an already active target "+r),[3,5]):[4,BE(n.localStore,r)]):[3,6];case 2:return i=t.sent(),[4,UE(n.localStore,i)];case 3:return o=t.sent(),[4,rk(n,_k(i),o.targetId,!1)];case 4:t.sent(),c1(n.remoteStore,o),t.label=5;case 5:return e++,[3,1];case 6:s=function(e){return Xi(this,function(t){switch(t.label){case 0:return n.Vo.has(e)?[4,qE(n.localStore,e,!1).then(function(){h1(n.remoteStore,e),lk(n,e)}).catch(GI)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})},a=0,u=l,t.label=7;case 7:return a<u.length?(u=u[a],[5,s(u)]):[3,10];case 8:t.sent(),t.label=9;case 9:return a++,[3,7];case 10:return[2]}})})}.bind(null,e),fn:function(t){return t.localStore.persistence.fn()}.bind(null,e),ci:function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){return[2,KE((e=n).localStore).then(function(t){return gk(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 Yi(n,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return[4,mk(this.Qo.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]}})})},Pk.prototype.Bo=function(t){var e=KS();if(!ES.yt(e))throw new ub(ab.UNIMPLEMENTED,"IndexedDB persistence is only available on platforms that support LocalStorage.");var n=IE(t.databaseInfo.databaseId,t.databaseInfo.persistenceKey);return new ES(e,t.asyncQueue,n,t.clientId,t.initialUser)},Pk),Nk=(Rk.prototype.initialize=function(n,r){return Yi(this,void 0,void 0,function(){var e=this;return Xi(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 sk(e.syncEngine,t,1)},this.remoteStore.remoteSyncer.handleCredentialChange=vk.bind(null,this.syncEngine),[4,I1(this.remoteStore,this.syncEngine.isPrimaryClient)]);case 1:t.sent(),t.label=2;case 2:return[2]}})})},Rk.prototype.createEventManager=function(t){return new N1},Rk.prototype.createDatastore=function(t){var e=HS(t.databaseInfo.databaseId),n=(n=t.databaseInfo,new RS(n));return t=t.credentials,new ZS(t,n,e)},Rk.prototype.createRemoteStore=function(t){var e=this,n=this.localStore,r=this.datastore,i=t.asyncQueue,o=function(t){return sk(e.syncEngine,t,0)},t=new(CS.yt()?CS:kS);return new zS(n,r,i,o,t)},Rk.prototype.createSyncEngine=function(t,e){return function(t,e,n,r,i,o,s){o=new tk(t,e,n,r,i,o);return s&&(o.$o=!0),o}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)},Rk.prototype.terminate=function(){return function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=n,fb("RemoteStore","RemoteStore shutting down."),e.Or.add(5),[4,u1(e)];case 1:return t.sent(),e.Lr.shutdown(),e.Br.set("Unknown"),[2]}})})}(this.remoteStore)},Rk);function Rk(){}function Pk(t,e){var n=this;return(n=Ek.call(this,t,e,!1)||this).Qo=t,n.cacheSizeBytes=e,n.synchronizeTabs=!0,n}function Ok(t,e,n){var r=this;return(r=Sk.call(this)||this).Qo=t,r.cacheSizeBytes=e,r.forceOwnership=n,r.synchronizeTabs=!1,r}function Dk(){this.synchronizeTabs=!1}function xk(n,r){void 0===r&&(r=10240);var i=0;return{read:function(){return Yi(this,void 0,void 0,function(){var e;return Xi(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 Yi(this,void 0,void 0,function(){return Xi(this,function(t){return[2]})})},releaseLock:function(){},closed:Promise.reject("unimplemented")}}var Lk=(Wk.prototype.next=function(t){this.observer.next&&this.jo(this.observer.next,t)},Wk.prototype.error=function(t){this.observer.error?this.jo(this.observer.error,t):console.error("Uncaught Error in snapshot listener:",t)},Wk.prototype.Wo=function(){this.muted=!0},Wk.prototype.jo=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},Wk),Mk=(Kk.prototype.close=function(){return this.Go.cancel()},Kk.prototype.getMetadata=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return[2,this.metadata.promise]})})},Kk.prototype.Lo=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return[4,this.getMetadata()];case 1:return[2,(t.sent(),this.Ho())]}})})},Kk.prototype.Ho=function(){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(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 V1(JSON.parse(r),e.length+n)]}})})},Kk.prototype.Zo=function(){return this.buffer.findIndex(function(t){return t==="{".charCodeAt(0)})},Kk.prototype.Jo=function(){return Yi(this,void 0,void 0,function(){var e,n;return Xi(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)])}})})},Kk.prototype.Xo=function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(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)]}})})},Kk.prototype.Yo=function(t){throw this.Go.cancel(),new Error("Invalid bundle format: "+t)},Kk.prototype.tc=function(){return Yi(this,void 0,void 0,function(){var e,n;return Xi(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]}})})},Kk),Fk=(Bk.prototype.lookup=function(r){return Yi(this,void 0,void 0,function(){var e,n=this;return Xi(this,function(t){switch(t.label){case 0:if(this.ensureCommitNotCalled(),0<this.mutations.length)throw new ub(ab.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes.");return[4,function(s,a){return Yi(this,void 0,void 0,function(){var n,e,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return e=Q0((n=s).R)+"/documents",r={documents:a.map(function(t){return W0(n.R,t)})},[4,n.$i("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){yb(!!e.found),e.found.name,e.found.updateTime;var n=H0(t,e.found.name),t=V0(e.found.updateTime),e=new f_({mapValue:{fields:e.found.fields}});return d_.newFoundDocument(n,t,e)}(e,t):"missing"in t?function(t,e){yb(!!e.missing),yb(!!e.readTime);t=H0(t,e.missing),e=V0(e.readTime);return d_.newNoDocument(t,e)}(e,t):vb());i.set(t.key.toString(),t)}),o=[],[2,(a.forEach(function(t){t=i.get(t.toString());yb(!!t),o.push(t)}),o)]}})})}(this.datastore,r)];case 1:return[2,((e=t.sent()).forEach(function(t){return n.recordVersion(t)}),e)]}})})},Bk.prototype.set=function(t,e){this.write(e.toMutation(t,this.precondition(t))),this.writtenDocs.add(t.toString())},Bk.prototype.update=function(t,e){try{this.write(e.toMutation(t,this.preconditionForUpdate(t)))}catch(t){this.lastWriteError=t}this.writtenDocs.add(t.toString())},Bk.prototype.delete=function(t){this.write(new t0(t,this.precondition(t))),this.writtenDocs.add(t.toString())},Bk.prototype.commit=function(){return Yi(this,void 0,void 0,function(){var e,n=this;return Xi(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=$b.fromPath(e);n.mutations.push(new e0(e,n.precondition(e)))}),[4,function(i,o){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return n=Q0((e=i).R)+"/documents",r={writes:o.map(function(t){return J0(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]}})})},Bk.prototype.recordVersion=function(t){var e;if(t.isFoundDocument())e=t.version;else{if(!t.isNoDocument())throw vb();e=Eb.min()}var n=this.readVersions.get(t.key.toString());if(n){if(!e.isEqual(n))throw new ub(ab.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(t.key.toString(),e)},Bk.prototype.precondition=function(t){var e=this.readVersions.get(t.toString());return!this.writtenDocs.has(t.toString())&&e?Lw.updateTime(e):Lw.none()},Bk.prototype.preconditionForUpdate=function(t){var e=this.readVersions.get(t.toString());if(this.writtenDocs.has(t.toString())||!e)return Lw.exists(!0);if(e.isEqual(Eb.min()))throw new ub(ab.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return Lw.updateTime(e)},Bk.prototype.write=function(t){this.ensureCommitNotCalled(),this.mutations.push(t)},Bk.prototype.ensureCommitNotCalled=function(){},Bk),jk=(Vk.prototype.run=function(){--this.ec,this.nc()},Vk.prototype.nc=function(){var t=this;this.Zi.ji(function(){return Yi(t,void 0,void 0,function(){var e,n,r=this;return Xi(this,function(t){return e=new Fk(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]})})})},Vk.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}},Vk.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)},Vk.prototype.rc=function(t){if("FirebaseError"!==t.name)return!1;t=t.code;return"aborted"===t||"failed-precondition"===t||!i0(t)},Vk),Uk=(qk.prototype.getConfiguration=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return[2,{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,credentials:this.credentials,initialUser:this.user,maxConcurrentLimboResolutions:100}]})})},qk.prototype.setCredentialChangeListener=function(t){this.credentialListener=t},qk.prototype.verifyNotTerminated=function(){if(this.asyncQueue.isShuttingDown)throw new ub(ab.FAILED_PRECONDITION,"The client has already been terminated.")},qk.prototype.terminate=function(){var t=this;this.asyncQueue.enterRestrictedMode();var n=new DT;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(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=A1(e,"Failed to shutdown persistence"),n.reject(e),[3,6];case 6:return[2]}})})}),n.promise},qk);function qk(t,e,n){var r=this;this.credentials=t,this.asyncQueue=e,this.databaseInfo=n,this.user=rS.UNAUTHENTICATED,this.clientId=mb.u(),this.credentialListener=function(){return Promise.resolve()},this.credentials.setChangeListener(e,function(e){return Yi(r,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return fb("FirestoreClient","Received user=",e.uid),[4,this.credentialListener(e)];case 1:return t.sent(),this.user=e,[2]}})})})}function Vk(t,e,n,r){this.asyncQueue=t,this.datastore=e,this.updateFunction=n,this.deferred=r,this.ec=5,this.Zi=new XS(this.asyncQueue,"transaction_retry")}function Bk(t){this.datastore=t,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastWriteError=null,this.writtenDocs=new Set}function Kk(t,e){var n=this;this.Go=t,this.R=e,this.metadata=new DT,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 Wk(t){this.observer=t,this.muted=!1}function Hk(i,o){return Yi(this,void 0,void 0,function(){var e,n,r=this;return Xi(this,function(t){switch(t.label){case 0:return i.asyncQueue.verifyOperationInProgress(),fb("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){return Yi(r,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return n.isEqual(e)?[3,2]:[4,xE(o.localStore,e)];case 1:t.sent(),n=e,t.label=2;case 2:return[2]}})})}),o.persistence.setDatabaseDeletedListener(function(){return i.terminate()}),i.offlineComponents=o,[2]}})})}function zk(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return r.asyncQueue.verifyOperationInProgress(),[4,Gk(r)];case 1:return e=t.sent(),fb("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 function(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return(e=r).asyncQueue.verifyOperationInProgress(),fb("RemoteStore","RemoteStore received new credentials"),n=g1(e),e.Or.add(3),[4,u1(e)];case 1:return t.sent(),n&&e.Br.set("Unknown"),[4,e.remoteSyncer.handleCredentialChange(i)];case 2:return t.sent(),e.Or.delete(3),[4,a1(e)];case 3:return t.sent(),[2]}})})}(i.remoteStore,t)}),r.onlineComponents=i,[2]}})})}function Gk(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return e.offlineComponents?[3,2]:(fb("FirestoreClient","Using default OfflineComponentProvider"),[4,Hk(e,new kk)]);case 1:t.sent(),t.label=2;case 2:return[2,e.offlineComponents]}})})}function Qk(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return e.onlineComponents?[3,2]:(fb("FirestoreClient","Using default OnlineComponentProvider"),[4,zk(e,new Nk)]);case 1:t.sent(),t.label=2;case 2:return[2,e.onlineComponents]}})})}function Yk(t){return Gk(t).then(function(t){return t.persistence})}function Xk(t){return Gk(t).then(function(t){return t.localStore})}function $k(t){return Qk(t).then(function(t){return t.remoteStore})}function Jk(t){return Qk(t).then(function(t){return t.syncEngine})}function Zk(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,Qk(r)];case 1:return e=t.sent(),[2,((n=e.eventManager).onListen=function(s,a){return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return e=wk(s),(o=e.Po.get(a))?(n=o.targetId,e.sharedClientState.addLocalQueryTarget(n),r=o.view.Ro(),[3,4]):[3,1];case 1:return[4,UE(e.localStore,sw(a))];case 2:return i=t.sent(),o=e.sharedClientState.addLocalQueryTarget(i.targetId),n=i.targetId,[4,rk(e,a,n,"current"===o)];case 3:r=t.sent(),e.isPrimaryClient&&c1(e.remoteStore,i),t.label=4;case 4:return[2,r]}})})}.bind(null,e.syncEngine),n.onUnlisten=function(i,o){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(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!uw(t,o)})),void e.Po.delete(o))]:e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)?[3,2]:[4,qE(e.localStore,n.targetId,!1).then(function(){e.sharedClientState.clearQueryState(n.targetId),h1(e.remoteStore,n.targetId),lk(e,n.targetId)}).catch(GI)]):[3,3];case 1:t.sent(),t.label=2;case 2:return[3,5];case 3:return lk(e,n.targetId),[4,qE(e.localStore,n.targetId,!0)];case 4:t.sent(),t.label=5;case 5:return[2]}})})}.bind(null,e.syncEngine),n)]}})})}function tC(n,r,i){var t=this;void 0===i&&(i={});var o=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(n,r,i,o,s){var t=new Lk({next:function(t){r.enqueueAndForget(function(){return j1(n,a)});var e=t.docs.has(i);!e&&t.fromCache?s.reject(new ub(ab.UNAVAILABLE,"Failed to get document because the client is offline.")):e&&t.fromCache&&o&&"server"===o.source?s.reject(new ub(ab.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(t)},error:function(t){return s.reject(t)}}),a=new q1(Z_(i.path),t,{includeMetadataChanges:!0,so:!0});return F1(n,a)},[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function eC(n,r,i){var t=this;void 0===i&&(i={});var o=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(e,n,t,r,i){var o=new Lk({next:function(t){n.enqueueAndForget(function(){return j1(e,s)}),t.fromCache&&"server"===r.source?i.reject(new ub(ab.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):i.resolve(t)},error:function(t){return i.reject(t)}}),s=new q1(t,o,{includeMetadataChanges:!0,so:!0});return F1(e,s)},[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),n.asyncQueue,r,i,o])]}})})}),o.promise}function nC(t,e){this.user=e,this.type="OAuth",this.authHeaders={},this.authHeaders.Authorization="Bearer "+t}var rC=function(t,e,n,r,i,o,s,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=s,this.useFetchStreams=a},iC=(Object.defineProperty(vC.prototype,"isDefaultDatabase",{get:function(){return"(default)"===this.database},enumerable:!1,configurable:!0}),vC.prototype.isEqual=function(t){return t instanceof vC&&t.projectId===this.projectId&&t.database===this.database},vC),oC=new Map,sC=(gC.prototype.getToken=function(){return Promise.resolve(null)},gC.prototype.invalidateToken=function(){},gC.prototype.setChangeListener=function(t,e){this.changeListener=e,t.enqueueRetryable(function(){return e(rS.UNAUTHENTICATED)})},gC.prototype.removeChangeListener=function(){this.changeListener=null},gC),aC=(dC.prototype.getToken=function(){return Promise.resolve(this.token)},dC.prototype.invalidateToken=function(){},dC.prototype.setChangeListener=function(t,e){var n=this;this.changeListener=e,t.enqueueRetryable(function(){return e(n.token.user)})},dC.prototype.removeChangeListener=function(){this.changeListener=null},dC),uC=(pC.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?(fb("FirebaseCredentialsProvider","getToken aborted due to token change."),e.getToken()):t?(yb("string"==typeof t.accessToken),new nC(t.accessToken,e.currentUser)):null}):Promise.resolve(null)},pC.prototype.invalidateToken=function(){this.forceRefresh=!0},pC.prototype.setChangeListener=function(t,e){var n=this;this.asyncQueue=t,this.asyncQueue.enqueueRetryable(function(){return Yi(n,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return[4,this.oc.promise];case 1:return t.sent(),[4,e(this.currentUser)];case 2:return t.sent(),this.changeListener=e,[2]}})})})},pC.prototype.removeChangeListener=function(){this.auth&&this.auth.removeAuthTokenListener(this.uc),this.changeListener=function(){return Promise.resolve()}},pC.prototype.ac=function(){var t=this.auth&&this.auth.getUid();return yb(null===t||"string"==typeof t),new rS(t)},pC),cC=(Object.defineProperty(fC.prototype,"authHeaders",{get:function(){var t={"X-Goog-AuthUser":this.lc},e=this.hc.auth.getAuthHeaderValueForFirstParty([]);return e&&(t.Authorization=e),this.fc&&(t["X-Goog-Iam-Authorization-Token"]=this.fc),t},enumerable:!1,configurable:!0}),fC),hC=(lC.prototype.getToken=function(){return Promise.resolve(new cC(this.hc,this.lc,this.fc))},lC.prototype.setChangeListener=function(t,e){t.enqueueRetryable(function(){return e(rS.FIRST_PARTY)})},lC.prototype.removeChangeListener=function(){},lC.prototype.invalidateToken=function(){},lC);function lC(t,e,n){this.hc=t,this.lc=e,this.fc=n}function fC(t,e,n){this.hc=t,this.lc=e,this.fc=n,this.type="FirstParty",this.user=rS.FIRST_PARTY}function pC(e){var n=this;this.currentUser=rS.UNAUTHENTICATED,this.oc=new DT,this.cc=0,this.forceRefresh=!1,this.auth=null,this.asyncQueue=null,this.uc=function(){n.cc++,n.currentUser=n.ac(),n.oc.resolve(),n.changeListener&&n.asyncQueue.enqueueRetryable(function(){return n.changeListener(n.currentUser)})};function r(t){fb("FirebaseCredentialsProvider","Auth detected"),n.auth=t,n.auth.addAuthTokenListener(n.uc)}e.onInit(r),setTimeout(function(){var t;n.auth||((t=e.getImmediate({optional:!0}))?r(t):(fb("FirebaseCredentialsProvider","Auth not yet detected"),n.oc.resolve()))},0)}function dC(t){this.token=t,this.changeListener=null}function gC(){this.changeListener=null}function vC(t,e){this.projectId=t,this.database=e||"(default)"}function yC(t,e,n){if(!n)throw new ub(ab.INVALID_ARGUMENT,"Function "+t+"() cannot be called with an empty "+e+".")}function mC(t,e){if(void 0===e)return{merge:!1};if(void 0!==e.mergeFields&&void 0!==e.merge)throw new ub(ab.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function bC(t,e,n,r){if(!0===e&&!0===r)throw new ub(ab.INVALID_ARGUMENT,t+" and "+n+" cannot be used together.")}function _C(t){if(!$b.isDocumentKey(t))throw new ub(ab.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t+" has "+t.length+".")}function wC(t){if($b.isDocumentKey(t))throw new ub(ab.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+t+" has "+t.length+".")}function TC(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":vb();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 IC(t,e){if((t="_delegate"in t?t._delegate:t)instanceof e)return t;if(e.name===t.constructor.name)throw new ub(ab.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");t=TC(t);throw new ub(ab.INVALID_ARGUMENT,"Expected type '"+e.name+"', but it was: "+t)}function EC(t,e){if(e<=0)throw new ub(ab.INVALID_ARGUMENT,"Function "+t+"() requires a positive number, but it was: "+e+".")}var SC,kC=(LC.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&&this.useFetchStreams===t.useFetchStreams},LC),CC=(Object.defineProperty(xC.prototype,"app",{get:function(){if(!this._app)throw new ub(ab.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app},enumerable:!1,configurable:!0}),Object.defineProperty(xC.prototype,"_initialized",{get:function(){return this._settingsFrozen},enumerable:!1,configurable:!0}),Object.defineProperty(xC.prototype,"_terminated",{get:function(){return void 0!==this._terminateTask},enumerable:!1,configurable:!0}),xC.prototype._setSettings=function(t){if(this._settingsFrozen)throw new ub(ab.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 kC(t),void 0!==t.credentials&&(this._credentials=function(t){if(!t)return new sC;switch(t.type){case"gapi":var e=t.client;return yb(!("object"!=typeof e||null===e||!e.auth||!e.auth.getAuthHeaderValueForFirstParty)),new hC(e,t.sessionIndex||"0",t.iamToken||null);case"provider":return t.client;default:throw new ub(ab.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}(t.credentials))},xC.prototype._getSettings=function(){return this._settings},xC.prototype._freezeSettings=function(){return this._settingsFrozen=!0,this._settings},xC.prototype._delete=function(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask},xC.prototype.toJSON=function(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}},xC.prototype._terminate=function(){return(t=oC.get(this))&&(fb("ComponentProvider","Removing Datastore"),oC.delete(this),t.terminate()),Promise.resolve();var t},xC),AC=(Object.defineProperty(DC.prototype,"_path",{get:function(){return this._key.path},enumerable:!1,configurable:!0}),Object.defineProperty(DC.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(DC.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(DC.prototype,"parent",{get:function(){return new RC(this.firestore,this.converter,this._key.path.popLast())},enumerable:!1,configurable:!0}),DC.prototype.withConverter=function(t){return new DC(this.firestore,t,this._key)},DC),NC=(OC.prototype.withConverter=function(t){return new OC(this.firestore,t,this._query)},OC),RC=(Gi(PC,SC=NC),Object.defineProperty(PC.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(PC.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!1,configurable:!0}),Object.defineProperty(PC.prototype,"parent",{get:function(){var t=this._path.popLast();return t.isEmpty()?null:new AC(this.firestore,null,new $b(t))},enumerable:!1,configurable:!0}),PC.prototype.withConverter=function(t){return new PC(this.firestore,t,this._path)},PC);function PC(t,e,n){var r=this;return(r=SC.call(this,t,e,Z_(n))||this)._path=n,r.type="collection",r}function OC(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}function DC(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}function xC(t,e){this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new kC({}),this._settingsFrozen=!1,t instanceof iC?(this._databaseId=t,this._credentials=new sC):(this._app=t,this._databaseId=function(t){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new ub(ab.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new iC(t.options.projectId)}(t),this._credentials=new uC(e))}function LC(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new ub(ab.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 ub(ab.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,bC("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}function MC(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=ts(t),yC("collection","path",e),t instanceof CC)return wC(n=Ob.fromString.apply(Ob,Zi([e],r))),new RC(t,null,n);if(!(t instanceof AC||t instanceof RC))throw new ub(ab.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return wC(n=Ob.fromString.apply(Ob,Zi([t.path],r)).child(Ob.fromString(e))),new RC(t.firestore,null,n)}function FC(t,e){for(var n,r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];if(t=ts(t),yC("doc","path",e=1===arguments.length?mb.u():e),t instanceof CC)return _C(n=Ob.fromString.apply(Ob,Zi([e],r))),new AC(t,null,new $b(n));if(!(t instanceof AC||t instanceof RC))throw new ub(ab.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");return _C(n=t._path.child(Ob.fromString.apply(Ob,Zi([e],r)))),new AC(t.firestore,t instanceof RC?t.converter:null,new $b(n))}function jC(t,e){return t=ts(t),e=ts(e),(t instanceof AC||t instanceof RC)&&(e instanceof AC||e instanceof RC)&&t.firestore===e.firestore&&t.path===e.path&&t.converter===e.converter}function UC(t,e){return t=ts(t),e=ts(e),t instanceof NC&&e instanceof NC&&t.firestore===e.firestore&&uw(t._query,e._query)&&t.converter===e.converter}var qC=(Object.defineProperty(VC.prototype,"isShuttingDown",{get:function(){return this._c},enumerable:!1,configurable:!0}),VC.prototype.enqueueAndForget=function(t){this.enqueue(t)},VC.prototype.enqueueAndForgetEvenWhileRestricted=function(t){this.Ac(),this.Rc(t)},VC.prototype.enterRestrictedMode=function(t){this._c||(this._c=!0,this.Ec=t||!1,(t=WS())&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Ic))},VC.prototype.enqueue=function(t){var e=this;if(this.Ac(),this._c)return new Promise(function(){});var n=new DT;return this.Rc(function(){return e._c&&e.Ec?Promise.resolve():(t().then(n.resolve,n.reject),n.promise)}).then(function(){return n.promise})},VC.prototype.enqueueRetryable=function(t){var e=this;this.enqueueAndForget(function(){return e.wc.push(t),e.bc()})},VC.prototype.bc=function(){return Yi(this,void 0,void 0,function(){var e,n=this;return Xi(this,function(t){switch(t.label){case 0:if(0===this.wc.length)return[3,5];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.wc[0]()];case 2:return t.sent(),this.wc.shift(),this.Zi.reset(),[3,4];case 3:if(!HT(e=t.sent()))throw e;return fb("AsyncQueue","Operation failed with retryable error: "+e),[3,4];case 4:0<this.wc.length&&this.Zi.ji(function(){return n.bc()}),t.label=5;case 5:return[2]}})})},VC.prototype.Rc=function(t){var r=this,e=this.dc.then(function(){return r.gc=!0,t().catch(function(t){throw r.yc=t,r.gc=!1,pb("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.gc=!1,t})});return this.dc=e},VC.prototype.enqueueAfterDelay=function(t,e,n){var r=this;this.Ac(),-1<this.Tc.indexOf(t)&&(e=0);n=k1.createAndSchedule(this,t,e,n,function(t){return r.vc(t)});return this.mc.push(n),n},VC.prototype.Ac=function(){this.yc&&vb()},VC.prototype.verifyOperationInProgress=function(){},VC.prototype.Pc=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,e=this.dc];case 1:t.sent(),t.label=2;case 2:if(e!==this.dc)return[3,0];t.label=3;case 3:return[2]}})})},VC.prototype.Vc=function(t){for(var e=0,n=this.mc;e<n.length;e++)if(n[e].timerId===t)return!0;return!1},VC.prototype.Sc=function(r){var i=this;return this.Pc().then(function(){i.mc.sort(function(t,e){return t.targetTimeMs-e.targetTimeMs});for(var t=0,e=i.mc;t<e.length;t++){var n=e[t];if(n.skipDelay(),"all"!==r&&n.timerId===r)break}return i.Pc()})},VC.prototype.Dc=function(t){this.Tc.push(t)},VC.prototype.vc=function(t){t=this.mc.indexOf(t);this.mc.splice(t,1)},VC);function VC(){var e=this;this.dc=Promise.resolve(),this.wc=[],this._c=!1,this.mc=[],this.yc=null,this.gc=!1,this.Ec=!1,this.Tc=[],this.Zi=new XS(this,"async_queue_retry"),this.Ic=function(){var t=WS();t&&fb("AsyncQueue","Visibility state changed to "+t.visibilityState),e.Zi.Gi()};var t=WS();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Ic)}function BC(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 KC,WC=(GC.prototype.onProgress=function(t,e,n){this._progressObserver={next:t,error:e,complete:n}},GC.prototype.catch=function(t){return this._taskCompletionResolver.promise.catch(t)},GC.prototype.then=function(t,e){return this._taskCompletionResolver.promise.then(t,e)},GC.prototype._completeWith=function(t){this._updateProgress(t),this._progressObserver.complete&&this._progressObserver.complete(),this._taskCompletionResolver.resolve(t)},GC.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)},GC.prototype._updateProgress=function(t){this._lastProgress=t,this._progressObserver.next&&this._progressObserver.next(t)},GC),HC=(Gi(zC,KC=CC),zC.prototype._terminate=function(){return this._firestoreClient||YC(this),this._firestoreClient.terminate()},zC);function zC(t,e){var n=this;return(n=KC.call(this,t,e)||this).type="firestore",n._queue=new qC,n._persistenceKey="name"in t?t.name:"[DEFAULT]",n}function GC(){this._progressObserver={},this._taskCompletionResolver=new DT,this._lastProgress={taskState:"Running",totalBytes:0,totalDocuments:0,bytesLoaded:0,documentsLoaded:0}}function QC(t){return t._firestoreClient||YC(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function YC(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 rC(e,n,r,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,i.useFetchStreams));t._firestoreClient=new Uk(t._credentials,t._queue,i)}function XC(n,r,i){var t=this,o=new DT;return n.asyncQueue.enqueue(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,Hk(n,i)];case 1:return t.sent(),[4,zk(n,r)];case 2:return t.sent(),o.resolve(),[3,4];case 3:if(!("FirebaseError"===(e=t.sent()).name?e.code===ab.FAILED_PRECONDITION||e.code===ab.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code))throw e;return console.warn("Error enabling offline persistence. Falling back to persistence disabled: "+e),o.reject(e),[3,4];case 4:return[2]}})})}).then(function(){return o.promise})}function $C(t){if(t._initialized||t._terminated)throw new ub(ab.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 JC=(cA.prototype.isEqual=function(t){return this._internalPath.isEqual(t._internalPath)},cA),ZC=(uA.fromBase64String=function(t){try{return new uA(Mb.fromBase64String(t))}catch(t){throw new ub(ab.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}},uA.fromUint8Array=function(t){return new uA(Mb.fromUint8Array(t))},uA.prototype.toBase64=function(){return this._byteString.toBase64()},uA.prototype.toUint8Array=function(){return this._byteString.toUint8Array()},uA.prototype.toString=function(){return"Bytes(base64: "+this.toBase64()+")"},uA.prototype.isEqual=function(t){return this._byteString.isEqual(t._byteString)},uA),tA=function(t){this._methodName=t},eA=(Object.defineProperty(aA.prototype,"latitude",{get:function(){return this._lat},enumerable:!1,configurable:!0}),Object.defineProperty(aA.prototype,"longitude",{get:function(){return this._long},enumerable:!1,configurable:!0}),aA.prototype.isEqual=function(t){return this._lat===t._lat&&this._long===t._long},aA.prototype.toJSON=function(){return{latitude:this._lat,longitude:this._long}},aA.prototype._compareTo=function(t){return _b(this._lat,t._lat)||_b(this._long,t._long)},aA),nA=/^__.*__$/,rA=(sA.prototype.toMutation=function(t,e){return null!==this.fieldMask?new Ww(t,this.data,this.fieldMask,e,this.fieldTransforms):new Kw(t,this.data,e,this.fieldTransforms)},sA),iA=(oA.prototype.toMutation=function(t,e){return new Ww(t,this.data,this.fieldMask,e,this.fieldTransforms)},oA);function oA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function sA(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}function aA(t,e){if(!isFinite(t)||t<-90||90<t)throw new ub(ab.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||180<e)throw new ub(ab.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}function uA(t){this._byteString=t}function cA(){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 ub(ab.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new xb(t)}function hA(t){switch(t){case 0:case 2:case 1:return 1;case 3:case 4:return;default:throw vb()}}var lA=(Object.defineProperty(dA.prototype,"path",{get:function(){return this.settings.path},enumerable:!1,configurable:!0}),Object.defineProperty(dA.prototype,"Nc",{get:function(){return this.settings.Nc},enumerable:!1,configurable:!0}),dA.prototype.xc=function(t){return new dA(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.R,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)},dA.prototype.kc=function(t){var e=null===(e=this.path)||void 0===e?void 0:e.child(t),e=this.xc({path:e,Fc:!1});return e.$c(t),e},dA.prototype.Oc=function(t){var e,t=null===(e=this.path)||void 0===e?void 0:e.child(t),t=this.xc({path:t,Fc:!1});return t.Cc(),t},dA.prototype.Mc=function(t){return this.xc({path:void 0,Fc:!0})},dA.prototype.Lc=function(t){return KA(t,this.settings.methodName,this.settings.Bc||!1,this.path,this.settings.qc)},dA.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)})},dA.prototype.Cc=function(){if(this.path)for(var t=0;t<this.path.length;t++)this.$c(this.path.get(t))},dA.prototype.$c=function(t){if(0===t.length)throw this.Lc("Document fields must not be empty");if(hA(this.Nc)&&nA.test(t))throw this.Lc('Document fields cannot begin and end with "__"')},dA),fA=(pA.prototype.Uc=function(t,e,n,r){return void 0===r&&(r=!1),new lA({Nc:t,methodName:e,qc:n,path:xb.emptyPath(),Fc:!1,Bc:r},this.databaseId,this.R,this.ignoreUndefinedProperties)},pA);function pA(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.R=n||HS(t)}function dA(t,e,n,r,i,o){this.settings=t,this.databaseId=e,this.R=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Cc(),this.fieldTransforms=i||[],this.fieldMask=o||[]}function gA(t){var e=t._freezeSettings(),n=HS(t._databaseId);return new fA(t._databaseId,!!e.ignoreUndefinedProperties,n)}function vA(t,e,n,r,i,o){var s=t.Uc((o=void 0===o?{}:o).merge||o.mergeFields?2:0,e,n,i);UA("Data must be an object, but it was:",s,r);var a,u,r=FA(r,s);if(o.merge)a=new Lb(s.fieldMask),u=s.fieldTransforms;else if(o.mergeFields){for(var c=[],h=0,l=o.mergeFields;h<l.length;h++){var f=qA(e,l[h],n);if(!s.contains(f))throw new ub(ab.INVALID_ARGUMENT,"Field '"+f+"' is specified in your field mask but missing from your input data.");WA(c,f)||c.push(f)}a=new Lb(c),u=s.fieldTransforms.filter(function(t){return a.covers(t.field)})}else a=null,u=s.fieldTransforms;return new rA(new f_(r),a,u)}var yA,mA=(Gi(bA,yA=tA),bA.prototype._toFieldTransform=function(t){if(2!==t.Nc)throw 1===t.Nc?t.Lc(this._methodName+"() can only appear at the top level of your update data"):t.Lc(this._methodName+"() cannot be used with set() unless you pass {merge:true}");return t.fieldMask.push(t.path),null},bA.prototype.isEqual=function(t){return t instanceof bA},bA);function bA(){return null!==yA&&yA.apply(this,arguments)||this}function _A(t,e,n){return new lA({Nc:3,qc:e.settings.qc,methodName:t._methodName,Fc:n},e.databaseId,e.R,e.ignoreUndefinedProperties)}var wA,TA,IA,EA,SA=(Gi(OA,EA=tA),OA.prototype._toFieldTransform=function(t){return new xw(t.path,new bw)},OA.prototype.isEqual=function(t){return t instanceof OA},OA),kA=(Gi(PA,IA=tA),PA.prototype._toFieldTransform=function(t){var e=_A(this,t,!0),n=this.Kc.map(function(t){return MA(t,e)}),n=new _w(n);return new xw(t.path,n)},PA.prototype.isEqual=function(t){return this===t},PA),CA=(Gi(RA,TA=tA),RA.prototype._toFieldTransform=function(t){var e=_A(this,t,!0),n=this.Kc.map(function(t){return MA(t,e)}),n=new Sw(n);return new xw(t.path,n)},RA.prototype.isEqual=function(t){return this===t},RA),AA=(Gi(NA,wA=tA),NA.prototype._toFieldTransform=function(t){var e=new Nw(t.R,gw(t.R,this.Qc));return new xw(t.path,e)},NA.prototype.isEqual=function(t){return this===t},NA);function NA(t,e){var n=this;return(n=wA.call(this,t)||this).Qc=e,n}function RA(t,e){var n=this;return(n=TA.call(this,t)||this).Kc=e,n}function PA(t,e){var n=this;return(n=IA.call(this,t)||this).Kc=e,n}function OA(){return null!==EA&&EA.apply(this,arguments)||this}function DA(t,r,i,e){var o=t.Uc(1,r,i);UA("Data must be an object, but it was:",o,e);var s=[],a=f_.empty();Ab(e,function(t,e){var n=BA(r,t,i);e=ts(e);t=o.Oc(n);e instanceof mA?s.push(n):null!=(t=MA(e,t))&&(s.push(n),a.set(n,t))});e=new Lb(s);return new iA(a,e,o.fieldTransforms)}function xA(t,e,n,r,i,o){var s=t.Uc(1,e,n),a=[qA(e,r,n)],u=[i];if(o.length%2!=0)throw new ub(ab.INVALID_ARGUMENT,"Function "+e+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var c=0;c<o.length;c+=2)a.push(qA(e,o[c])),u.push(o[c+1]);for(var h,l,f,p=[],d=f_.empty(),g=a.length-1;0<=g;--g)WA(p,a[g])||(h=a[g],l=ts(l=u[g]),f=s.Oc(h),l instanceof mA?p.push(h):null!=(f=MA(l,f))&&(p.push(h),d.set(h,f)));i=new Lb(p);return new iA(d,i,s.fieldTransforms)}function LA(t,e,n,r){return MA(n,t.Uc((r=void 0===r?!1:r)?4:3,e))}function MA(s,t){if(jA(s=ts(s)))return UA("Unsupported field value:",t,s),FA(s,t);if(s instanceof tA)return function(t,e){if(!hA(e.Nc))throw e.Lc(t._methodName+"() can only be used with update() and set()");if(!e.path)throw e.Lc(t._methodName+"() is not currently supported inside arrays");t=t._toFieldTransform(e);t&&e.fieldTransforms.push(t)}(s,t),null;if(void 0===s&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),s instanceof Array){if(t.settings.Fc&&4!==t.Nc)throw t.Lc("Nested arrays are not supported");return function(t){for(var e=[],n=0,r=0,i=s;r<i.length;r++){var o=MA(i[r],t.Mc(n));null==o&&(o={nullValue:"NULL_VALUE"}),e.push(o),n++}return{arrayValue:{values:e}}}(t)}return function(t,e){if(null===(t=ts(s)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return gw(e.R,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){var n=Ib.fromDate(t);return{timestampValue:U0(e.R,n)}}if(t instanceof Ib)return n=new Ib(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)),{timestampValue:U0(e.R,n)};if(t instanceof eA)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof ZC)return{bytesValue:q0(e.R,t._byteString)};if(t instanceof AC){var n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.Lc("Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return{referenceValue:B0(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.Lc("Unsupported field value: "+TC(t))}(0,t)}function FA(t,n){var r={};return Nb(t)?n.path&&0<n.path.length&&n.fieldMask.push(n.path):Ab(t,function(t,e){e=MA(e,n.kc(t));null!=e&&(r[t]=e)}),{mapValue:{fields:r}}}function jA(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ib||t instanceof eA||t instanceof ZC||t instanceof AC||t instanceof tA)}function UA(t,e,n){if(!jA(n)||("object"!=typeof(r=n)||null===r||Object.getPrototypeOf(r)!==Object.prototype&&null!==Object.getPrototypeOf(r))){n=TC(n);throw"an object"===n?e.Lc(t+" a custom object"):e.Lc(t+" "+n)}var r}function qA(t,e,n){if((e=ts(e))instanceof JC)return e._internalPath;if("string"==typeof e)return BA(t,e);throw KA("Field path arguments must be of type string or FieldPath.",t,!1,void 0,n)}var VA=new RegExp("[~\\*/\\[\\]]");function BA(e,n,r){if(0<=n.search(VA))throw KA("Invalid field path ("+n+"). Paths must not contain '~', '*', '/', '[', or ']'",e,!1,void 0,r);try{return(new(JC.bind.apply(JC,Zi([void 0],n.split(".")))))._internalPath}catch(t){throw KA("Invalid field path ("+n+"). Paths must not be empty, begin with '.', end with '.', or contain '..'",e,!1,void 0,r)}}function KA(t,e,n,r,i){var o=r&&!r.isEmpty(),s=void 0!==i,e="Function "+e+"() called with invalid data";n&&(e+=" (via `toFirestore()`)");n="";return(o||s)&&(n+=" (found",o&&(n+=" in field "+r),s&&(n+=" in document "+i),n+=")"),new ub(ab.INVALID_ARGUMENT,(e+=". ")+t+n)}function WA(t,e){return t.some(function(t){return t.isEqual(e)})}var HA,zA=(Object.defineProperty(YA.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!1,configurable:!0}),Object.defineProperty(YA.prototype,"ref",{get:function(){return new AC(this._firestore,this._converter,this._key)},enumerable:!1,configurable:!0}),YA.prototype.exists=function(){return null!==this._document},YA.prototype.data=function(){if(this._document){if(this._converter){var t=new GA(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}},YA.prototype.get=function(t){if(this._document){t=this._document.data.field(XA("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t)}},YA),GA=(Gi(QA,HA=zA),QA.prototype.data=function(){return HA.prototype.data.call(this)},QA);function QA(){return null!==HA&&HA.apply(this,arguments)||this}function YA(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}function XA(t,e){return"string"==typeof e?BA(t,e):(e instanceof JC?e:e._delegate)._internalPath}var $A,JA,ZA=(sN.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},sN),tN=(Gi(oN,JA=zA),oN.prototype.exists=function(){return JA.prototype.exists.call(this)},oN.prototype.data=function(t){if(void 0===t&&(t={}),this._document){if(this._converter){var e=new eN(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}},oN.prototype.get=function(t,e){if(void 0===e&&(e={}),this._document){t=this._document.data.field(XA("DocumentSnapshot.get",t));if(null!==t)return this._userDataWriter.convertValue(t,e.serverTimestamps)}},oN),eN=(Gi(iN,$A=tN),iN.prototype.data=function(t){return $A.prototype.data.call(this,t=void 0===t?{}:t)},iN),nN=(Object.defineProperty(rN.prototype,"docs",{get:function(){var e=[];return this.forEach(function(t){return e.push(t)}),e},enumerable:!1,configurable:!0}),Object.defineProperty(rN.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!1,configurable:!0}),Object.defineProperty(rN.prototype,"empty",{get:function(){return 0===this.size},enumerable:!1,configurable:!0}),rN.prototype.forEach=function(e,n){var r=this;this._snapshot.docs.forEach(function(t){e.call(n,new eN(r._firestore,r._userDataWriter,t.key,t,new ZA(r._snapshot.mutatedKeys.has(t.key),r._snapshot.fromCache),r.query.converter))})},rN.prototype.docChanges=function(t){t=!!(t=void 0===t?{}:t).includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new ub(ab.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){return{type:"added",doc:new eN(i._firestore,i._userDataWriter,t.doc.key,t.doc,new ZA(i._snapshot.mutatedKeys.has(t.doc.key),i._snapshot.fromCache),i.query.converter),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 eN(i._firestore,i._userDataWriter,t.doc.key,t.doc,new ZA(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 vb()}}(t.type),doc:e,oldIndex:n,newIndex:r}})}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges},rN);function rN(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new ZA(r.hasPendingWrites,r.fromCache),this.query=n}function iN(){return null!==$A&&$A.apply(this,arguments)||this}function oN(t,e,n,r,i,o){var s=this;return(s=JA.call(this,t,e,n,r,o)||this)._firestore=t,s._firestoreImpl=t,s.metadata=i,s}function sN(t,e){this.hasPendingWrites=t,this.fromCache=e}function aN(t,e){return t instanceof tN&&e instanceof tN?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 nN&&e instanceof nN&&t._firestore===e._firestore&&UC(t.query,e.query)&&t.metadata.isEqual(e.metadata)&&t._snapshot.isEqual(e._snapshot)}function uN(t){if(ew(t)&&0===t.explicitOrderBy.length)throw new ub(ab.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}G=function(){};function cN(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 hN,lN,fN,pN,dN,gN=(Gi(EN,dN=G),EN.prototype._apply=function(t){var e=gA(t.firestore),e=function(t,e,n,r,i,o){if(r.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new ub(ab.INVALID_ARGUMENT,"Invalid Query. You can't perform '"+i+"' queries on FieldPath.documentId().");if("in"===i||"not-in"===i){CN(o,i);for(var s=[],a=0,u=o;a<u.length;a++){var c=u[a];s.push(kN(n,t,c))}h={arrayValue:{values:s}}}else h=kN(n,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||CN(o,i),h=LA(e,"where",o,"in"===i||"not-in"===i);var h=T_.create(r,i,h);return function(t,e){if(e.g()){var n=rw(t);if(null!==n&&!n.isEqual(e.field))throw new ub(ab.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=nw(t);null!==n&&AN(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 ub(ab.INVALID_ARGUMENT,"Invalid query. You cannot use more than one '"+e.op.toString()+"' filter."):new ub(ab.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.jc,this.Wc,this.Gc);return new NC(t.firestore,t.converter,(t=t._query,e=t.filters.concat([e]),new $_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),e,t.limit,t.limitType,t.startAt,t.endAt)))},EN),vN=(Gi(IN,pN=G),IN.prototype._apply=function(t){var e=function(t,e,n){if(null!==t.startAt)throw new ub(ab.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==t.endAt)throw new ub(ab.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");var r=new Q_(e,n);return e=r,null!==nw(n=t)||null!==(t=rw(n))&&AN(0,t,e.field),r}(t._query,this.jc,this.zc);return new NC(t.firestore,t.converter,(t=t._query,e=t.explicitOrderBy.concat([e]),new $_(t.path,t.collectionGroup,e,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)))},IN),yN=(Gi(TN,fN=G),TN.prototype._apply=function(t){return new NC(t.firestore,t.converter,aw(t._query,this.Hc,this.Jc))},TN),mN=(Gi(wN,lN=G),wN.prototype._apply=function(t){var e=SN(t,this.type,this.Yc,this.Xc);return new NC(t.firestore,t.converter,(t=t._query,e=e,new $_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)))},wN),bN=(Gi(_N,hN=G),_N.prototype._apply=function(t){var e=SN(t,this.type,this.Yc,this.Xc);return new NC(t.firestore,t.converter,(t=t._query,e=e,new $_(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,e)))},_N);function _N(t,e,n){var r=this;return(r=hN.call(this)||this).type=t,r.Yc=e,r.Xc=n,r}function wN(t,e,n){var r=this;return(r=lN.call(this)||this).type=t,r.Yc=e,r.Xc=n,r}function TN(t,e,n){var r=this;return(r=fN.call(this)||this).type=t,r.Hc=e,r.Jc=n,r}function IN(t,e){var n=this;return(n=pN.call(this)||this).jc=t,n.zc=e,n.type="orderBy",n}function EN(t,e,n){var r=this;return(r=dN.call(this)||this).jc=t,r.Wc=e,r.Gc=n,r.type="where",r}function SN(t,c,e,n){if(e[0]=ts(e[0]),e[0]instanceof zA)return function(t,e,n,r){if(!n)throw new ub(ab.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+c+"().");for(var i=[],o=0,s=ow(t);o<s.length;o++){var a=s[o];if(a.field.isKeyField())i.push(o_(e,n.key));else{var u=n.data.field(a.field);if(zb(u))throw new ub(ab.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+a.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(null===u){a=a.field.canonicalString();throw new ub(ab.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+a+"' (used as the orderBy) does not exist.")}i.push(u)}}return new B_(i,r)}(t._query,t.firestore._databaseId,e[0]._document,n);var r=gA(t.firestore);return function(t,e,n,r,i,o){var s=t.explicitOrderBy;if(i.length>s.length)throw new ub(ab.INVALID_ARGUMENT,"Too many arguments provided to "+r+"(). The number of arguments must be less than or equal to the number of orderBy() clauses");for(var a=[],u=0;u<i.length;u++){var c=i[u];if(s[u].field.isKeyField()){if("string"!=typeof c)throw new ub(ab.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+r+"(), but got a "+typeof c);if(!iw(t)&&-1!==c.indexOf("/"))throw new ub(ab.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(Ob.fromString(c));if(!$b.isDocumentKey(h))throw new ub(ab.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 $b(h);a.push(o_(e,h))}else{c=LA(n,r,c);a.push(c)}}return new B_(a,o)}(t._query,t.firestore._databaseId,r,c,e,n)}function kN(t,e,n){if("string"==typeof(n=ts(n))){if(""===n)throw new ub(ab.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");if(!iw(e)&&-1!==n.indexOf("/"))throw new ub(ab.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(Ob.fromString(n));if(!$b.isDocumentKey(e))throw new ub(ab.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 o_(t,new $b(e))}if(n instanceof AC)return o_(t,n._key);throw new ub(ab.INVALID_ARGUMENT,"Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: "+TC(n)+".")}function CN(t,e){if(!Array.isArray(t)||0===t.length)throw new ub(ab.INVALID_ARGUMENT,"Invalid Query. A non-empty array is required for '"+e.toString()+"' filters.");if(10<t.length)throw new ub(ab.INVALID_ARGUMENT,"Invalid Query. '"+e.toString()+"' filters support a maximum of 10 elements in the value array.")}function AN(t,e,n){if(!n.isEqual(e))throw new ub(ab.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.")}NN.prototype.convertValue=function(t,e){switch(void 0===e&&(e="none"),Zb(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Wb(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(Hb(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 vb()}},NN.prototype.convertObject=function(t,n){var r=this,i={};return Ab(t.fields,function(t,e){i[t]=r.convertValue(e,n)}),i},NN.prototype.convertGeoPoint=function(t){return new eA(Wb(t.latitude),Wb(t.longitude))},NN.prototype.convertArray=function(t,e){var n=this;return(t.values||[]).map(function(t){return n.convertValue(t,e)})},NN.prototype.convertServerTimestamp=function(t,e){switch(e){case"previous":var n=function t(e){e=e.mapValue.fields.__previous_value__;return zb(e)?t(e):e}(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Gb(t));default:return null}},NN.prototype.convertTimestamp=function(t){t=Kb(t);return new Ib(t.seconds,t.nanos)},NN.prototype.convertDocumentKey=function(t,e){var n=Ob.fromString(t);yb(cT(n));t=new iC(n.get(1),n.get(3)),n=new $b(n.popFirst(5));return t.isEqual(e)||pb("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},Q=NN;function NN(){}function RN(t,e,n){return t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e}var PN,ON=(Gi(LN,PN=Q),LN.prototype.convertBytes=function(t){return new ZC(t)},LN.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new AC(this.firestore,null,t)},LN),DN=(xN.prototype.set=function(t,e,n){this._verifyNotCommitted();t=MN(t,this._firestore),e=RN(t.converter,e,n),n=vA(this._dataReader,"WriteBatch.set",t._key,e,null!==t.converter,n);return this._mutations.push(n.toMutation(t._key,Lw.none())),this},xN.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];this._verifyNotCommitted();t=MN(t,this._firestore),e="string"==typeof(e=ts(e))||e instanceof JC?xA(this._dataReader,"WriteBatch.update",t._key,e,n,r):DA(this._dataReader,"WriteBatch.update",t._key,e);return this._mutations.push(e.toMutation(t._key,Lw.exists(!0))),this},xN.prototype.delete=function(t){this._verifyNotCommitted();t=MN(t,this._firestore);return this._mutations=this._mutations.concat(new t0(t._key,Lw.none())),this},xN.prototype.commit=function(){return this._verifyNotCommitted(),this._committed=!0,0<this._mutations.length?this._commitHandler(this._mutations):Promise.resolve()},xN.prototype._verifyNotCommitted=function(){if(this._committed)throw new ub(ab.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},xN);function xN(t,e){this._firestore=t,this._commitHandler=e,this._mutations=[],this._committed=!1,this._dataReader=gA(t)}function LN(t){var e=this;return(e=PN.call(this)||this).firestore=t,e}function MN(t,e){if((t=ts(t)).firestore!==e)throw new ub(ab.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}var FN,jN=(Gi(UN,FN=Q),UN.prototype.convertBytes=function(t){return new ZC(t)},UN.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return new AC(this.firestore,null,t)},UN);function UN(t){var e=this;return(e=FN.call(this)||this).firestore=t,e}function qN(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=IC(t,AC);var o=IC(t.firestore,HC),s=gA(o);return BN(o,[("string"==typeof(e=ts(e))||e instanceof JC?xA(s,"updateDoc",t._key,e,n,r):DA(s,"updateDoc",t._key,e)).toMutation(t._key,Lw.exists(!0))])}function VN(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];e=ts(e);var r={includeMetadataChanges:!1},i=0;"object"!=typeof n[i]||BC(n[i])||(r=n[i],i++);var o,s,a,u,c,h,l={includeMetadataChanges:r.includeMetadataChanges};return BC(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 AC?(a=IC(e.firestore,HC),u=Z_(e._key.path),h={next:function(t){n[i]&&n[i](KN(a,e,t))},error:n[i+1],complete:n[i+2]}):(s=IC(e,NC),a=IC(s.firestore,HC),u=s._query,c=new jN(a),h={next:function(t){n[i]&&n[i](new nN(a,c,s,t))},error:n[i+1],complete:n[i+2]},uN(e._query)),function(n,t,e){var r=this,i=new Lk(h),o=new q1(t,i,e);return n.asyncQueue.enqueueAndForget(function(){return Yi(r,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=F1,[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})}),function(){i.Wo(),n.asyncQueue.enqueueAndForget(function(){return Yi(r,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=j1,[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),o])]}})})})}}(QC(a),u,l)}function BN(t,e){return function(n,r){var t=this,i=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=ik,[4,Jk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(QC(t),e)}function KN(t,e,n){var r=n.docs.get(e._key),i=new jN(t);return new tN(t,i,e._key,r,new ZA(n.hasPendingWrites,n.fromCache),e.converter)}var WN,HN=(GN.prototype.get=function(t){var e=this,n=MN(t,this._firestore),r=new ON(this._firestore);return this._transaction.lookup([n._key]).then(function(t){if(!t||1!==t.length)return vb();t=t[0];if(t.isFoundDocument())return new zA(e._firestore,r,t.key,t,n.converter);if(t.isNoDocument())return new zA(e._firestore,r,n._key,null,n.converter);throw vb()})},GN.prototype.set=function(t,e,n){t=MN(t,this._firestore),e=RN(t.converter,e,n),n=vA(this._dataReader,"Transaction.set",t._key,e,null!==t.converter,n);return this._transaction.set(t._key,n),this},GN.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];t=MN(t,this._firestore),e="string"==typeof(e=ts(e))||e instanceof JC?xA(this._dataReader,"Transaction.update",t._key,e,n,r):DA(this._dataReader,"Transaction.update",t._key,e);return this._transaction.update(t._key,e),this},GN.prototype.delete=function(t){t=MN(t,this._firestore);return this._transaction.delete(t._key),this},Gi(zN,WN=GN),zN.prototype.get=function(t){var e=this,n=MN(t,this._firestore),r=new jN(this._firestore);return WN.prototype.get.call(this,t).then(function(t){return new tN(e._firestore,r,n._key,t._document,new ZA(!1,!1),n.converter)})},zN);function zN(t,e){var n=this;return(n=WN.call(this,t,e)||this)._firestore=t,n}function GN(t,e){this._firestore=t,this._transaction=e,this._dataReader=gA(t)}function QN(){if("undefined"==typeof Uint8Array)throw new ub(ab.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function YN(){if("undefined"==typeof atob)throw new ub(ab.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}var XN,$N=(iR.fromBase64String=function(t){return YN(),new iR(ZC.fromBase64String(t))},iR.fromUint8Array=function(t){return QN(),new iR(ZC.fromUint8Array(t))},iR.prototype.toBase64=function(){return YN(),this._delegate.toBase64()},iR.prototype.toUint8Array=function(){return QN(),this._delegate.toUint8Array()},iR.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},iR.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},iR),JN=(rR.prototype.enableIndexedDbPersistence=function(t,e){return function(t,e){$C(t=IC(t,HC));var n=QC(t),r=t._freezeSettings(),t=new Nk;return XC(n,t,new Ck(t,r.cacheSizeBytes,null==e?void 0:e.forceOwnership))}(t._delegate,{forceOwnership:e})},rR.prototype.enableMultiTabIndexedDbPersistence=function(t){return function(t){$C(t=IC(t,HC));var e=QC(t),n=t._freezeSettings(),t=new Nk;return XC(e,t,new Ak(t,n.cacheSizeBytes))}(t._delegate)},rR.prototype.clearIndexedDbPersistence=function(t){return function(n){var t=this;if(n._initialized&&!n._terminated)throw new ub(ab.FAILED_PRECONDITION,"Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");var r=new DT;return n._queue.enqueueAndForgetEvenWhileRestricted(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return MT.yt()?(e=n+"main",[4,MT.delete(e)]):[2,Promise.resolve()];case 1:return t.sent(),[2]}})})}(IE(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)},rR),ZN=(Object.defineProperty(nR.prototype,"_databaseId",{get:function(){return this._delegate._databaseId},enumerable:!1,configurable:!0}),nR.prototype.settings=function(t){var e=this._delegate._getSettings();t.merge||e.host===t.host||db("You are overriding the original host. If you did not intend to override your settings, use {merge: true}."),t.merge&&delete(t=Object.assign(Object.assign({},e),t)).merge,this._delegate._setSettings(t)},nR.prototype.useEmulator=function(t,e,n){(function(t,e,n,r){void 0===r&&(r={});var i,o=(t=IC(t,CC))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&db("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:e+":"+n,ssl:!1})),r.mockUserToken){if("string"==typeof r.mockUserToken)s=r.mockUserToken,i=rS.MOCK_USER;else{var s=fo(r.mockUserToken,null===(n=t._app)||void 0===n?void 0:n.options.projectId),r=r.mockUserToken.sub||r.mockUserToken.user_id;if(!r)throw new ub(ab.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");i=new rS(r)}t._credentials=new aC(new nC(s,i))}})(this._delegate,t,e,n=void 0===n?{}:n)},nR.prototype.enableNetwork=function(){return function(i){var t=this;return i.asyncQueue.enqueue(function(){return Yi(t,void 0,void 0,function(){var n,r;return Xi(this,function(t){switch(t.label){case 0:return[4,Yk(i)];case 1:return n=t.sent(),[4,$k(i)];case 2:return r=t.sent(),[2,(n.setNetworkEnabled(!0),(e=r).Or.delete(0),a1(e))]}var e})})})}(QC(IC(this._delegate,HC)))},nR.prototype.disableNetwork=function(){return function(r){var t=this;return r.asyncQueue.enqueue(function(){return Yi(t,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,Yk(r)];case 1:return e=t.sent(),[4,$k(r)];case 2:return n=t.sent(),[2,(e.setNetworkEnabled(!1),function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return(e=n).Or.add(0),[4,u1(e)];case 1:return t.sent(),e.Br.set("Offline"),[2]}})})}(n))]}})})})}(QC(IC(this._delegate,HC)))},nR.prototype.enablePersistence=function(t){var e=!1,n=!1;return t&&bC("synchronizeTabs",e=!!t.synchronizeTabs,"experimentalForceOwningTab",n=!!t.experimentalForceOwningTab),e?this.Zc.enableMultiTabIndexedDbPersistence(this):this.Zc.enableIndexedDbPersistence(this,n)},nR.prototype.clearPersistence=function(){return this.Zc.clearIndexedDbPersistence(this)},nR.prototype.terminate=function(){return this.tu&&(this.tu._removeServiceInstance("firestore"),this.tu._removeServiceInstance("firestore-exp")),this._delegate._delete()},nR.prototype.waitForPendingWrites=function(){return function(n){var t=this,r=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=uk,[4,Jk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),r.promise}(QC(IC(this._delegate,HC)))},nR.prototype.onSnapshotsInSync=function(t){return e=this._delegate,t=t,function(n,t){var e=this,r=new Lk(t);return n.asyncQueue.enqueueAndForget(function(){return Yi(e,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.add(e),e.next()},[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})}),function(){r.Wo(),n.asyncQueue.enqueueAndForget(function(){return Yi(e,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(t,e){t.Gr.delete(e)},[4,Zk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}}(QC(IC(e,HC)),BC(t)?t:{next:t});var e},Object.defineProperty(nR.prototype,"app",{get:function(){if(!this.tu)throw new ub(ab.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this.tu},enumerable:!1,configurable:!0}),nR.prototype.collection=function(t){try{return new IR(this,MC(this._delegate,t))}catch(t){throw pR(t,"collection()","Firestore.collection()")}},nR.prototype.doc=function(t){try{return new lR(this,FC(this._delegate,t))}catch(t){throw pR(t,"doc()","Firestore.doc()")}},nR.prototype.collectionGroup=function(t){try{return new _R(this,function(t,e){if(t=IC(t,CC),yC("collectionGroup","collection id",e),0<=e.indexOf("/"))throw new ub(ab.INVALID_ARGUMENT,"Invalid collection ID '"+e+"' passed to function collectionGroup(). Collection IDs must not contain '/'.");return new NC(t,null,(e=e,new $_(Ob.emptyPath(),e)))}(this._delegate,t))}catch(t){throw pR(t,"collectionGroup()","Firestore.collectionGroup()")}},nR.prototype.runTransaction=function(e){var n,r=this;return function(n,r){var t=this,i=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,Qk(n).then(function(t){return t.datastore})];case 1:return e=t.sent(),new jk(n.asyncQueue,e,r,i).run(),[2]}})})}),i.promise}(QC(n=this._delegate),function(t){return t=new HN(n,t),e(new oR(r,t))})},nR.prototype.batch=function(){var e=this;return QC(this._delegate),new sR(new DN(this._delegate,function(t){return BN(e._delegate,t)}))},nR.prototype.loadBundle=function(t){throw new ub(ab.FAILED_PRECONDITION,'"loadBundle()" does not exist, have you imported "firebase/firestore/bundle"?')},nR.prototype.namedQuery=function(t){throw new ub(ab.FAILED_PRECONDITION,'"namedQuery()" does not exist, have you imported "firebase/firestore/bundle"?')},nR),tR=(Gi(eR,XN=Q),eR.prototype.convertBytes=function(t){return new $N(new ZC(t))},eR.prototype.convertReference=function(t){t=this.convertDocumentKey(t,this.firestore._databaseId);return lR.eu(t,this.firestore,null)},eR);function eR(t){var e=this;return(e=XN.call(this)||this).firestore=t,e}function nR(t,e,n){var r=this;this._delegate=e,this.Zc=n,this.INTERNAL={delete:function(){return r.terminate()}},t instanceof iC||(this.tu=t)}function rR(){}function iR(t){this._delegate=t}var oR=(hR.prototype.get=function(t){var e=this,n=RR(t);return this._delegate.get(n).then(function(t){return new mR(e._firestore,new tN(e._firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,n.converter))})},hR.prototype.set=function(t,e,n){t=RR(t);return n?(mC("Transaction.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},hR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=RR(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,Zi([o,e,n],r)),this},hR.prototype.delete=function(t){t=RR(t);return this._delegate.delete(t),this},hR),sR=(cR.prototype.set=function(t,e,n){t=RR(t);return n?(mC("WriteBatch.set",n),this._delegate.set(t,e,n)):this._delegate.set(t,e),this},cR.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o=RR(t);return 2===arguments.length?this._delegate.update(o,e):(t=this._delegate).update.apply(t,Zi([o,e,n],r)),this},cR.prototype.delete=function(t){t=RR(t);return this._delegate.delete(t),this},cR.prototype.commit=function(){return this._delegate.commit()},cR),aR=(uR.prototype.fromFirestore=function(t,e){t=new eN(this._firestore._delegate,this._userDataWriter,t._key,t._document,t.metadata,null);return this._delegate.fromFirestore(new bR(this._firestore,t),null!=e?e:{})},uR.prototype.toFirestore=function(t,e){return e?this._delegate.toFirestore(t,e):this._delegate.toFirestore(t)},uR.nu=function(t,e){var n=uR.su,r=n.get(t);r||(r=new WeakMap,n.set(t,r));n=r.get(e);return n||(n=new uR(t,new tR(t),e),r.set(e,n)),n},uR);function uR(t,e,n){this._firestore=t,this._userDataWriter=e,this._delegate=n}function cR(t){this._delegate=t}function hR(t,e){this._firestore=t,this._delegate=e,this._userDataWriter=new tR(t)}aR.su=new WeakMap;var lR=(fR.iu=function(t,e,n){if(t.length%2!=0)throw new ub(ab.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+t.canonicalString()+" has "+t.length);return new fR(e,new AC(e._delegate,n,new $b(t)))},fR.eu=function(t,e,n){return new fR(e,new AC(e._delegate,n,t))},Object.defineProperty(fR.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(fR.prototype,"parent",{get:function(){return new IR(this.firestore,this._delegate.parent)},enumerable:!1,configurable:!0}),Object.defineProperty(fR.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),fR.prototype.collection=function(t){try{return new IR(this.firestore,MC(this._delegate,t))}catch(t){throw pR(t,"collection()","DocumentReference.collection()")}},fR.prototype.isEqual=function(t){return(t=ts(t))instanceof AC&&jC(this._delegate,t)},fR.prototype.set=function(t,e){e=mC("DocumentReference.set",e);try{return function(t,e,n){t=IC(t,AC);var r=IC(t.firestore,HC),e=RN(t.converter,e,n);return BN(r,[vA(gA(r),"setDoc",t._key,e,null!==t.converter,n).toMutation(t._key,Lw.none())])}(this._delegate,t,e)}catch(t){throw pR(t,"setDoc()","DocumentReference.set()")}},fR.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];try{return 1===arguments.length?qN(this._delegate,t):qN.apply(void 0,Zi([this._delegate,t,e],n))}catch(t){throw pR(t,"updateDoc()","DocumentReference.update()")}},fR.prototype.delete=function(){return BN(IC((t=this._delegate).firestore,HC),[new t0(t._key,Lw.none())]);var t},fR.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=dR(t),i=gR(t,function(t){return new mR(e.firestore,new tN(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate.converter))});return VN(this._delegate,r,i)},fR.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=IC(e,AC);var n=IC(e.firestore,HC),t=QC(n),r=new jN(n);return function(n,r){var t=this,i=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(o,s,a){return Yi(this,void 0,void 0,function(){var r,i;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(e=s,(n=o).persistence.runTransaction("read document","readonly",function(t){return n.Mn.mn(t,e)}))];case 1:return(i=t.sent()).isFoundDocument()?a.resolve(i):i.isNoDocument()?a.resolve(null):a.reject(new ub(ab.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=A1(r,"Failed to get document '"+s+" from cache"),a.reject(i),[3,3];case 3:return[2]}var e,n})})},[4,Xk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._key).then(function(t){return new tN(n,r,e._key,t,new ZA(null!==t&&t.hasLocalMutations,!0),e.converter)})}:"server"===(null==t?void 0:t.source)?function(e){e=IC(e,AC);var n=IC(e.firestore,HC);return tC(QC(n),e._key,{source:"server"}).then(function(t){return KN(n,e,t)})}:function(e){e=IC(e,AC);var n=IC(e.firestore,HC);return tC(QC(n),e._key).then(function(t){return KN(n,e,t)})})(this._delegate).then(function(t){return new mR(e.firestore,new tN(e.firestore._delegate,e._userDataWriter,t._key,t._document,t.metadata,e._delegate.converter))})},fR.prototype.withConverter=function(t){return new fR(this.firestore,t?this._delegate.withConverter(aR.nu(this.firestore,t)):this._delegate.withConverter(null))},fR);function fR(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new tR(t)}function pR(t,e,n){return t.message=t.message.replace(e,n),t}function dR(t){for(var e=0,n=t;e<n.length;e++){var r=n[e];if("object"==typeof r&&!BC(r))return r}return{}}function gR(t,e){var n;return{next:function(t){n.next&&n.next(e(t))},error:null===(t=(n=BC(t[0])?t[0]:BC(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 vR,yR,mR=(Object.defineProperty(NR.prototype,"ref",{get:function(){return new lR(this._firestore,this._delegate.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(NR.prototype,"exists",{get:function(){return this._delegate.exists()},enumerable:!1,configurable:!0}),NR.prototype.data=function(t){return this._delegate.data(t)},NR.prototype.get=function(t,e){return this._delegate.get(t,e)},NR.prototype.isEqual=function(t){return aN(this._delegate,t._delegate)},NR),bR=(Gi(AR,yR=mR),AR.prototype.data=function(t){return this._delegate.data(t)},AR),_R=(CR.prototype.where=function(t,e,n){try{return new CR(this.firestore,cN(this._delegate,(r=n,i=e,o=XA("where",t),new gN(o,i,r))))}catch(t){throw pR(t,/(orderBy|where)\(\)/,"Query.$1()")}var r,i,o},CR.prototype.orderBy=function(t,e){try{return new CR(this.firestore,cN(this._delegate,(n=void 0===e?"asc":e,r=XA("orderBy",t),new vN(r,n))))}catch(t){throw pR(t,/(orderBy|where)\(\)/,"Query.$1()")}var n,r},CR.prototype.limit=function(t){try{return new CR(this.firestore,cN(this._delegate,(EC("limit",e=t),new yN("limit",e,"F"))))}catch(t){throw pR(t,"limit()","Query.limit()")}var e},CR.prototype.limitToLast=function(t){try{return new CR(this.firestore,cN(this._delegate,(EC("limitToLast",e=t),new yN("limitToLast",e,"L"))))}catch(t){throw pR(t,"limitToLast()","Query.limitToLast()")}var e},CR.prototype.startAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new CR(this.firestore,cN(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new mN("startAt",t,!0)}.apply(void 0,t)))}catch(t){throw pR(t,"startAt()","Query.startAt()")}},CR.prototype.startAfter=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new CR(this.firestore,cN(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new mN("startAfter",t,!1)}.apply(void 0,t)))}catch(t){throw pR(t,"startAfter()","Query.startAfter()")}},CR.prototype.endBefore=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new CR(this.firestore,cN(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new bN("endBefore",t,!0)}.apply(void 0,t)))}catch(t){throw pR(t,"endBefore()","Query.endBefore()")}},CR.prototype.endAt=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{return new CR(this.firestore,cN(this._delegate,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return new bN("endAt",t,!1)}.apply(void 0,t)))}catch(t){throw pR(t,"endAt()","Query.endAt()")}},CR.prototype.isEqual=function(t){return UC(this._delegate,t._delegate)},CR.prototype.get=function(t){var e=this;return("cache"===(null==t?void 0:t.source)?function(e){e=IC(e,NC);var n=IC(e.firestore,HC),t=QC(n),r=new jN(n);return function(n,r){var t=this,i=new DT;return n.asyncQueue.enqueueAndForget(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(i,o,s){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,VE(i,o,!0)];case 1:return r=t.sent(),e=new $1(o,r.Bn),n=e._o(r.documents),n=e.applyChanges(n,!1),s.resolve(n.snapshot),[3,3];case 2:return n=t.sent(),r=A1(n,"Failed to execute query '"+o+" against cache"),s.reject(r),[3,3];case 3:return[2]}})})},[4,Xk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r,i])]}})})}),i.promise}(t,e._query).then(function(t){return new nN(n,r,e,t)})}:"server"===(null==t?void 0:t.source)?function(e){e=IC(e,NC);var n=IC(e.firestore,HC),t=QC(n),r=new jN(n);return eC(t,e._query,{source:"server"}).then(function(t){return new nN(n,r,e,t)})}:function(e){e=IC(e,NC);var n=IC(e.firestore,HC),t=QC(n),r=new jN(n);return uN(e._query),eC(t,e._query).then(function(t){return new nN(n,r,e,t)})})(this._delegate).then(function(t){return new TR(e.firestore,new nN(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))})},CR.prototype.onSnapshot=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=dR(t),i=gR(t,function(t){return new TR(e.firestore,new nN(e.firestore._delegate,e._userDataWriter,e._delegate,t._snapshot))});return VN(this._delegate,r,i)},CR.prototype.withConverter=function(t){return new CR(this.firestore,t?this._delegate.withConverter(aR.nu(this.firestore,t)):this._delegate.withConverter(null))},CR),wR=(Object.defineProperty(kR.prototype,"type",{get:function(){return this._delegate.type},enumerable:!1,configurable:!0}),Object.defineProperty(kR.prototype,"doc",{get:function(){return new bR(this._firestore,this._delegate.doc)},enumerable:!1,configurable:!0}),Object.defineProperty(kR.prototype,"oldIndex",{get:function(){return this._delegate.oldIndex},enumerable:!1,configurable:!0}),Object.defineProperty(kR.prototype,"newIndex",{get:function(){return this._delegate.newIndex},enumerable:!1,configurable:!0}),kR),TR=(Object.defineProperty(SR.prototype,"query",{get:function(){return new _R(this._firestore,this._delegate.query)},enumerable:!1,configurable:!0}),Object.defineProperty(SR.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(SR.prototype,"size",{get:function(){return this._delegate.size},enumerable:!1,configurable:!0}),Object.defineProperty(SR.prototype,"empty",{get:function(){return this._delegate.empty},enumerable:!1,configurable:!0}),Object.defineProperty(SR.prototype,"docs",{get:function(){var e=this;return this._delegate.docs.map(function(t){return new bR(e._firestore,t)})},enumerable:!1,configurable:!0}),SR.prototype.docChanges=function(t){var e=this;return this._delegate.docChanges(t).map(function(t){return new wR(e._firestore,t)})},SR.prototype.forEach=function(e,n){var r=this;this._delegate.forEach(function(t){e.call(n,new bR(r._firestore,t))})},SR.prototype.isEqual=function(t){return aN(this._delegate,t._delegate)},SR),IR=(Gi(ER,vR=_R),Object.defineProperty(ER.prototype,"id",{get:function(){return this._delegate.id},enumerable:!1,configurable:!0}),Object.defineProperty(ER.prototype,"path",{get:function(){return this._delegate.path},enumerable:!1,configurable:!0}),Object.defineProperty(ER.prototype,"parent",{get:function(){var t=this._delegate.parent;return t?new lR(this.firestore,t):null},enumerable:!1,configurable:!0}),ER.prototype.doc=function(t){try{return new lR(this.firestore,void 0===t?FC(this._delegate):FC(this._delegate,t))}catch(t){throw pR(t,"doc()","CollectionReference.doc()")}},ER.prototype.add=function(t){var e,n,r,i=this;return e=this._delegate,n=t,t=IC(e.firestore,HC),r=FC(e),n=RN(e.converter,n),BN(t,[vA(gA(e.firestore),"addDoc",r._key,n,null!==e.converter,{}).toMutation(r._key,Lw.exists(!1))]).then(function(){return r}).then(function(t){return new lR(i.firestore,t)})},ER.prototype.isEqual=function(t){return jC(this._delegate,t._delegate)},ER.prototype.withConverter=function(t){return new ER(this.firestore,t?this._delegate.withConverter(aR.nu(this.firestore,t)):this._delegate.withConverter(null))},ER);function ER(t,e){var n=this;return(n=vR.call(this,t,e)||this).firestore=t,n._delegate=e,n}function SR(t,e){this._firestore=t,this._delegate=e}function kR(t,e){this._firestore=t,this._delegate=e}function CR(t,e){this.firestore=t,this._delegate=e,this._userDataWriter=new tR(t)}function AR(){return null!==yR&&yR.apply(this,arguments)||this}function NR(t,e){this._firestore=t,this._delegate=e}function RR(t){return IC(t,AC)}OR.documentId=function(){return new OR(xb.keyField().canonicalString())},OR.prototype.isEqual=function(t){return(t=ts(t))instanceof JC&&this._delegate._internalPath.isEqual(t._internalPath)},G=OR,PR.serverTimestamp=function(){var t=new SA("serverTimestamp");return t._methodName="FieldValue.serverTimestamp",new PR(t)},PR.delete=function(){var t=new mA("deleteField");return t._methodName="FieldValue.delete",new PR(t)},PR.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 kA("arrayUnion",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayUnion",new PR(n)},PR.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 CA("arrayRemove",t)}.apply(void 0,t);return n._methodName="FieldValue.arrayRemove",new PR(n)},PR.increment=function(t){t=new AA("increment",t);return t._methodName="FieldValue.increment",new PR(t)},PR.prototype.isEqual=function(t){return this._delegate.isEqual(t._delegate)},Q=PR;function PR(t){this._delegate=t}function OR(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._delegate=new(JC.bind.apply(JC,Zi([void 0],t)))}function DR(t){return e=this._delegate,s=t,n=QC(e=IC(e,HC)),t=new WC,function(n,t,r){var e,i=this,o=(e=s,t=HS(t),e=function(t){if(t instanceof Uint8Array)return xk(t,void 0);if(t instanceof ArrayBuffer)return xk(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 Mk(e,t));n.asyncQueue.enqueueAndForget(function(){return Yi(i,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=Ik,[4,Jk(n)];case 1:return e.apply(void 0,[t.sent(),o,r]),[2]}})})})}(n,e._databaseId,t),t;var e,s,n}function xR(t){var e=this,n=this._delegate,t=t;return function(n,r){var t=this;return n.asyncQueue.enqueue(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(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.Ke.getNamedQuery(t,e)})},[4,Xk(n)];case 1:return[2,e.apply(void 0,[t.sent(),r])]}})})})}(QC(n=IC(n,HC)),t).then(function(t){return t?new NC(n,null,t.query):null}).then(function(t){return t?new _R(e,t):null})}var LR,MR,FR={Firestore:ZN,GeoPoint:eA,Timestamp:Ib,Blob:$N,Transaction:oR,WriteBatch:sR,DocumentReference:lR,DocumentSnapshot:mR,Query:_R,QueryDocumentSnapshot:bR,QuerySnapshot:TR,CollectionReference:IR,FieldPath:G,FieldValue:Q,setLogLevel:function(t){cb.setLogLevel(t)},CACHE_SIZE_UNLIMITED:-1};(LR=Jl).INTERNAL.registerComponent(new es("firestore",function(t){var e=t.getProvider("app").getImmediate();return e=e,t=t.getProvider("auth-internal"),new ZN(e,new HC(e,t),new JN)},"PUBLIC").setServiceProps(Object.assign({},FR))),LR.registerVersion("@firebase/firestore","2.4.0"),(MR=ZN).prototype.loadBundle=DR,MR.prototype.namedQuery=xR;var jR,UR={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"},qR=(Gi(VR,jR=Error),VR);function VR(t,e,n){e=jR.call(this,e)||this;return Object.setPrototypeOf(e,VR.prototype),e.code=t,e.details=n,e}function BR(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,t=void 0;try{var o=e&&e.error;if(o){var s=o.status;if("string"==typeof s){if(!UR[s])return new qR("internal","internal");r=UR[s],i=s}var a=o.message;"string"==typeof a&&(i=a),void 0!==(t=o.details)&&(t=n.decode(t))}}catch(t){}return"ok"===r?null:new qR(r,i,t)}var KR=(WR.prototype.getAuthToken=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(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]}})})},WR.prototype.getInstanceIdToken=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:if(!(this.messaging&&"Notification"in self&&"granted"===Notification.permission))return[2,void 0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.messaging.getToken()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,void 0];case 4:return[2]}})})},WR.prototype.getContext=function(){return Yi(this,void 0,void 0,function(){var e,n;return Xi(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}]}})})},WR);function WR(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 HR(t,e){var n,r={};for(n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}var zR=(GR.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(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(function(t){return e.encode(t)});if("function"==typeof t||"object"==typeof t)return HR(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},GR.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?HR(t,function(t){return e.decode(t)}):t},GR);function GR(){}var QR=(Object.defineProperty(YR.prototype,"app",{get:function(){return this.app_},enumerable:!1,configurable:!0}),YR.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},YR.prototype.useEmulator=function(t,e){this.emulatorOrigin="http://"+t+":"+e},YR.prototype.useFunctionsEmulator=function(t){this.emulatorOrigin=t},YR.prototype.httpsCallable=function(e,n){var r=this;return function(t){return r.call(e,t,n||{})}},YR.prototype.postJSON=function(i,o,s){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return s["Content-Type"]="application/json",[4,this.getAppCheckToken()];case 1:null!==(e=t.sent())&&(s["X-Firebase-AppCheck"]=e),t.label=2;case 2:return t.trys.push([2,4,,5]),[4,this.fetchImpl(i,{method:"POST",body:JSON.stringify(o),headers:s})];case 3:return n=t.sent(),[3,5];case 4:return t.sent(),[2,{status:0,json:null}];case 5:r=null,t.label=6;case 6:return t.trys.push([6,8,,9]),[4,n.json()];case 7:return r=t.sent(),[3,9];case 8:return t.sent(),[3,9];case 9:return[2,{status:n.status,json:r}]}})})},YR.prototype.getAppCheckToken=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return(e=this.appCheckProvider.getImmediate({optional:!0}))?[4,e.getToken()]:[3,2];case 1:return[2,t.sent().token];case 2:return[2,null]}})})},YR.prototype.call=function(c,h,l){return Yi(this,void 0,void 0,function(){var i,o,s,a,u;return Xi(this,function(t){switch(t.label){case 0:return i=this._url(c),h=this.serializer.encode(h),o={data:h},s={},[4,this.contextProvider.getContext()];case 1:return(a=t.sent()).authToken&&(s.Authorization="Bearer "+a.authToken),a.instanceIdToken&&(s["Firebase-Instance-ID-Token"]=a.instanceIdToken),u=l.timeout||7e4,n=u,e=new Promise(function(t,e){r=setTimeout(function(){e(new qR("deadline-exceeded","deadline-exceeded"))},n)}),u=(a={timer:r,promise:e}).timer,a=a.promise,[4,Promise.race([XR(u,this.postJSON(i,o,s)),a,XR(u,this.cancelAllRequests)])];case 2:if(!(a=t.sent()))throw new qR("cancelled","Firebase Functions instance was deleted.");if(u=BR(a.status,a.json,this.serializer))throw u;if(!a.json)throw new qR("internal","Response is not valid JSON object.");if(void 0===(u=void 0===(u=a.json.data)?a.json.result:u))throw new qR("internal","Response is missing data field.");return[2,{data:this.serializer.decode(u)}]}var n,r,e})})},YR);function YR(t,e,n,r,i,o){var s=this;void 0===i&&(i="us-central1"),this.app_=t,this.appCheckProvider=r,this.fetchImpl=o,this.serializer=new zR,this.emulatorOrigin=null,this.INTERNAL={delete:function(){return Promise.resolve(s.deleteService())}},this.contextProvider=new KR(e,n),this.cancelAllRequests=new Promise(function(t){s.deleteService=function(){return t()}});try{var a=new URL(i);this.customDomain=a.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=i}}function XR(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,r];case 1:return e=t.sent(),clearTimeout(n),[2,e]}})})}var $R,JR,ZR;function tP(n){return new Promise(function(t,e){n.onsuccess=function(){t(n.result)},n.onerror=function(){e(n.error)}})}function eP(n,r,i){var o,t=new Promise(function(t,e){tP(o=n[r].apply(n,i)).then(t,e)});return t.request=o,t}function nP(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 rP(e,n,r,t){t.forEach(function(t){t in r.prototype&&(e.prototype[t]=function(){return eP(this[n],t,arguments)})})}function iP(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 oP(t,r,e,n){n.forEach(function(n){n in e.prototype&&(t.prototype[n]=function(){return t=this[r],(e=eP(t,n,arguments)).then(function(t){if(t)return new aP(t,e.request)});var t,e})})}function sP(t){this._index=t}function aP(t,e){this._cursor=t,this._request=e}function uP(t){this._store=t}function cP(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 hP(t,e,n){this._db=t,this.oldVersion=e,this.transaction=new cP(n)}function lP(t){this._db=t}function fP(t,e,n){var e=eP(indexedDB,"open",[t,e]),r=e.request;return r&&(r.onupgradeneeded=function(t){n&&n(new hP(r.result,t.oldVersion,r.transaction))}),e.then(function(t){return new lP(t)})}function pP(t){return eP(indexedDB,"deleteDatabase",[t])}$R=Jl,JR=fetch.bind(self),ZR={Functions:QR},$R.INTERNAL.registerComponent(new es("functions",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),i=t.getProvider("auth-internal"),e=t.getProvider("app-check-internal"),t=t.getProvider("messaging");return new QR(r,i,t,e,n,JR)},"PUBLIC").setServiceProps(ZR).setMultipleInstances(!0)),Jl.registerVersion("@firebase/functions","0.6.15"),nP(sP,"_index",["name","keyPath","multiEntry","unique"]),rP(sP,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),oP(sP,"_index",IDBIndex,["openCursor","openKeyCursor"]),nP(aP,"_cursor",["direction","key","primaryKey","value"]),rP(aP,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(aP.prototype[n]=function(){var e=this,t=arguments;return Promise.resolve().then(function(){return e._cursor[n].apply(e._cursor,t),tP(e._request).then(function(t){if(t)return new aP(t,e._request)})})})}),uP.prototype.createIndex=function(){return new sP(this._store.createIndex.apply(this._store,arguments))},uP.prototype.index=function(){return new sP(this._store.index.apply(this._store,arguments))},nP(uP,"_store",["name","keyPath","indexNames","autoIncrement"]),rP(uP,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),oP(uP,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),iP(uP,"_store",IDBObjectStore,["deleteIndex"]),cP.prototype.objectStore=function(){return new uP(this._tx.objectStore.apply(this._tx,arguments))},nP(cP,"_tx",["objectStoreNames","mode"]),iP(cP,"_tx",IDBTransaction,["abort"]),hP.prototype.createObjectStore=function(){return new uP(this._db.createObjectStore.apply(this._db,arguments))},nP(hP,"_db",["name","version","objectStoreNames"]),iP(hP,"_db",IDBDatabase,["deleteObjectStore","close"]),lP.prototype.transaction=function(){return new cP(this._db.transaction.apply(this._db,arguments))},nP(lP,"_db",["name","version","objectStoreNames"]),iP(lP,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[uP,sP].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)}})})}),[sP,uP].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 dP=1e4,gP="w:0.4.32",vP="FIS_v2",yP="https://firebaseinstallations.googleapis.com/v1",mP=36e5,Q=((G={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',G["not-registered"]="Firebase Installation is not registered.",G["installation-not-found"]="Firebase Installation not found.",G["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',G["app-offline"]="Could not process request. Application offline.",G["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",G),bP=new Co("installations","Installations",Q);function _P(t){return t instanceof So&&t.code.includes("request-failed")}function wP(t){t=t.projectId;return yP+"/projects/"+t+"/installations"}function TP(t){return{token:t.token,requestStatus:2,expiresIn:(t=t.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()}}function IP(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,r.json()];case 1:return e=t.sent(),e=e.error,[2,bP.create("request-failed",{requestName:n,serverCode:e.code,serverMessage:e.message,serverStatus:e.status})]}})})}function EP(t){t=t.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function SP(t,e){e=e.refreshToken,t=EP(t);return t.append("Authorization",vP+" "+e),t}function kP(n){return Yi(this,void 0,void 0,function(){var e;return Xi(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 CP(e){return new Promise(function(t){setTimeout(t,e)})}var AP=/^[cdef][\w-]{21}$/,NP="";function RP(){try{var t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(t){return btoa(String.fromCharCode.apply(String,Zi([],Ji(t)))).replace(/\+/g,"-").replace(/\//g,"_")}(t).substr(0,22);return AP.test(e)?e:NP}catch(t){return NP}}function PP(t){return t.appName+"!"+t.appId}var OP=new Map;function DP(t,e){t=PP(t);xP(t,e),function(t,e){var n=MP();n&&n.postMessage({key:t,fid:e});FP()}(t,e)}function xP(t,e){var n,r,t=OP.get(t);if(t)try{for(var i=$i(t),o=i.next();!o.done;o=i.next())(0,o.value)(e)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}var LP=null;function MP(){return!LP&&"BroadcastChannel"in self&&((LP=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(t){xP(t.data.key,t.data.fid)}),LP}function FP(){0===OP.size&&LP&&(LP.close(),LP=null)}var jP,UP="firebase-installations-database",qP=1,VP="firebase-installations-store",BP=null;function KP(){return BP=BP||fP(UP,qP,function(t){0===t.oldVersion&&t.createObjectStore(VP)})}function WP(o,s){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:return e=PP(o),[4,KP()];case 1:return r=t.sent(),n=r.transaction(VP,"readwrite"),[4,(r=n.objectStore(VP)).get(e)];case 2:return i=t.sent(),[4,r.put(s,e)];case 3:return t.sent(),[4,n.complete];case 4:return t.sent(),i&&i.fid===s.fid||DP(o,s.fid),[2,s]}})})}function HP(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return e=PP(r),[4,KP()];case 1:return n=t.sent(),[4,(n=n.transaction(VP,"readwrite")).objectStore(VP).delete(e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2]}})})}function zP(s,a){return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return e=PP(s),[4,KP()];case 1:return r=t.sent(),n=r.transaction(VP,"readwrite"),[4,(r=n.objectStore(VP)).get(e)];case 2:return i=t.sent(),void 0!==(o=a(i))?[3,4]:[4,r.delete(e)];case 3:return t.sent(),[3,6];case 4:return[4,r.put(o,e)];case 5:t.sent(),t.label=6;case 6:return[4,n.complete];case 7:return t.sent(),!o||i&&i.fid===o.fid||DP(s,o.fid),[2,o]}})})}function GP(i){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return[4,zP(i,function(t){t=YP(t||{fid:RP(),registrationStatus:0}),t=function(t,e){{if(0!==e.registrationStatus)return 1===e.registrationStatus?{installationEntry:e,registrationPromise:function(i){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return[4,QP(i)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.registrationStatus?[3,5]:[4,CP(100)];case 3:return t.sent(),[4,QP(i)];case 4:return e=t.sent(),[3,2];case 5:return 0!==e.registrationStatus?[3,7]:[4,GP(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(bP.create("app-offline"));return{installationEntry:e,registrationPromise:n}}e={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},t=function(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,7]),[4,function(s,t){var a=t.fid;return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return e=wP(s),n=EP(s),o={fid:a,authVersion:vP,appId:s.appId,sdkVersion:gP},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,kP(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,{fid:o.fid||a,registrationStatus:2,refreshToken:o.refreshToken,authToken:TP(o.authToken)}];case 3:return[4,IP("Create Installation",i)];case 4:throw t.sent()}})})}(r,i)];case 1:return e=t.sent(),[2,WP(r,e)];case 2:return _P(n=t.sent())&&409===n.customData.serverCode?[4,HP(r)]:[3,4];case 3:return t.sent(),[3,6];case 4:return[4,WP(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!==NP?[3,3]:(r={},[4,e]);case 2:return[2,(r.installationEntry=t.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:e}]}})})}function QP(t){return zP(t,function(t){if(!t)throw bP.create("installation-not-found");return YP(t)})}function YP(t){return 1===(e=t).registrationStatus&&e.registrationTime+dP<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}function XP(t,s){var a=t.appConfig,u=t.platformLoggerProvider;return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return wP(t)+"/"+e+"/authTokens:generate"}(a,s),n=SP(a,s),(o=u.getImmediate({optional:!0}))&&n.append("x-firebase-client",o.getPlatformInfoString()),o={installation:{sdkVersion:gP}},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,kP(function(){return fetch(e,r)})];case 1:return(i=t.sent()).ok?[4,i.json()]:[3,3];case 2:return o=t.sent(),[2,TP(o)];case 3:return[4,IP("Generate Auth Token",i)];case 4:throw t.sent()}})})}function $P(i,o){return void 0===o&&(o=!1),Yi(this,void 0,void 0,function(){var r,e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,zP(i.appConfig,function(t){if(!ZP(t))throw bP.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+mP}(e)){if(1===n.requestStatus)return r=function(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,JP(n.appConfig)];case 1:e=t.sent(),t.label=2;case 2:return 1!==e.authToken.requestStatus?[3,5]:[4,CP(100)];case 3:return t.sent(),[4,JP(n.appConfig)];case 4:return e=t.sent(),[3,2];case 5:return 0===(e=e.authToken).requestStatus?[2,$P(n,r)]:[2,e]}})})}(i,o),t;if(!navigator.onLine)throw bP.create("app-offline");n=(e=t,n={requestStatus:1,requestTime:Date.now()},Qi(Qi({},e),{authToken:n}));return r=function(i,o){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,8]),[4,XP(i,o)];case 1:return e=t.sent(),r=Qi(Qi({},o),{authToken:e}),[4,WP(i.appConfig,r)];case 2:return t.sent(),[2,e];case 3:return!_P(n=t.sent())||401!==n.customData.serverCode&&404!==n.customData.serverCode?[3,5]:[4,HP(i.appConfig)];case 4:return t.sent(),[3,7];case 5:return r=Qi(Qi({},o),{authToken:{requestStatus:0}}),[4,WP(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 JP(t){return zP(t,function(t){if(!ZP(t))throw bP.create("not-registered");var e=t.authToken;return 1===(e=e).requestStatus&&e.requestTime+dP<Date.now()?Qi(Qi({},t),{authToken:{requestStatus:0}}):t})}function ZP(t){return void 0!==t&&2===t.registrationStatus}function tO(e,n){return void 0===n&&(n=!1),Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return[4,function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,GP(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,$P(e,n)];case 2:return[2,t.sent().token]}})})}function eO(i,o){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return e=function(t,e){e=e.fid;return wP(t)+"/"+e}(i,o),r=SP(i,o),n={method:"DELETE",headers:r},[4,kP(function(){return fetch(e,n)})];case 1:return(r=t.sent()).ok?[3,3]:[4,IP("Delete Installation",r)];case 2:throw t.sent();case 3:return[2]}})})}function nO(t,r){var i=t.appConfig;return function(t,e){MP();var n=PP(t);(t=OP.get(n))||(t=new Set,OP.set(n,t)),t.add(e)}(i,r),function(){var t,e,n;e=r,n=PP(t=i),(t=OP.get(n))&&(t.delete(e),0===t.size&&OP.delete(n),FP())}}function rO(t){return bP.create("missing-app-config-values",{valueName:t})}(jP=Jl).INTERNAL.registerComponent(new es("installations",function(t){var e=t.getProvider("app").getImmediate(),n={appConfig:function(t){var e,n;if(!t||!t.options)throw rO("App Configuration");if(!t.name)throw rO("App Name");try{for(var r=$i(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!t.options[o])throw rO(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 Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,GP(r.appConfig)];case 1:return e=t.sent(),n=e.installationEntry,(e.registrationPromise||$P(r)).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(t){return tO(n,t)},delete:function(){return function(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,zP(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 bP.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw bP.create("app-offline");case 3:return[4,eO(e,n)];case 4:return t.sent(),[4,HP(e)];case 5:t.sent(),t.label=6;case 6:return[2]}})})}(n)},onIdChange:function(t){return nO(n,t)}}},"PUBLIC")),jP.registerVersion("@firebase/installations","0.4.32");var iO,Q=((G={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',G["only-available-in-window"]="This method is available in a Window context.",G["only-available-in-sw"]="This method is available in a service worker context.",G["permission-default"]="The notification permission was not granted and dismissed instead.",G["permission-blocked"]="The notification permission was not granted and blocked instead.",G["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",G["failed-service-worker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",G["token-subscribe-failed"]="A problem occurred while subscribing the user to FCM: {$errorInfo}",G["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",G["token-unsubscribe-failed"]="A problem occurred while unsubscribing the user from FCM: {$errorInfo}",G["token-update-failed"]="A problem occurred while updating the user from FCM: {$errorInfo}",G["token-update-no-token"]="FCM returned no token when updating the user to push.",G["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.",G["invalid-sw-registration"]="The input to useServiceWorker() must be a ServiceWorkerRegistration.",G["invalid-bg-handler"]="The input to setBackgroundMessageHandler() must be a function.",G["invalid-vapid-key"]="The public VAPID key must be a string.",G["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.",G),oO=new Co("messaging","Messaging",Q),sO="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",aO="https://fcmregistrations.googleapis.com/v1",uO="FCM_MSG",cO="google.c.a.c_id";function hO(t){t=new Uint8Array(t);return btoa(String.fromCharCode.apply(String,Zi([],Ji(t)))).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(G=iO=iO||{}).PUSH_RECEIVED="push-received",G.NOTIFICATION_CLICKED="notification-clicked";var lO="fcm_token_details_db",fO=5,pO="fcm_token_object_Store";function dO(s){return Yi(this,void 0,void 0,function(){var e,o,n=this;return Xi(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(lO))return[2,null];t.label=2;case 2:return o=null,[4,fP(lO,fO,function(i){return Yi(n,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return i.oldVersion<2?[2]:i.objectStoreNames.contains(pO)?[4,(r=i.transaction.objectStore(pO)).index("fcmSenderId").get(s)]:[2];case 1:return e=t.sent(),[4,r.clear()];case 2:if(t.sent(),!e)return[2];if(2===i.oldVersion){if(!(n=e).auth||!n.p256dh||!n.endpoint)return[2];o={token:n.fcmToken,createTime:null!==(r=n.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:n.auth,p256dh:n.p256dh,endpoint:n.endpoint,swScope:n.swScope,vapidKey:"string"==typeof n.vapidKey?n.vapidKey:hO(n.vapidKey)}}}else(3===i.oldVersion||4===i.oldVersion)&&(o={token:(n=e).fcmToken,createTime:n.createTime,subscriptionOptions:{auth:hO(n.auth),p256dh:hO(n.p256dh),endpoint:n.endpoint,swScope:n.swScope,vapidKey:hO(n.vapidKey)}});return[2]}})})})];case 3:return t.sent().close(),[4,pP(lO)];case 4:return t.sent(),[4,pP("fcm_vapid_details_db")];case 5:return t.sent(),[4,pP("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 gO="firebase-messaging-database",vO=1,yO="firebase-messaging-store",mO=null;function bO(){return mO=mO||fP(gO,vO,function(t){0===t.oldVersion&&t.createObjectStore(yO)})}function _O(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return e=TO(r),[4,bO()];case 1:return[4,t.sent().transaction(yO).objectStore(yO).get(e)];case 2:return(e=t.sent())?[2,e]:[3,3];case 3:return[4,dO(r.appConfig.senderId)];case 4:return(n=t.sent())?[4,wO(r,n)]:[3,6];case 5:return t.sent(),[2,n];case 6:return[2]}})})}function wO(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return e=TO(r),[4,bO()];case 1:return n=t.sent(),[4,(n=n.transaction(yO,"readwrite")).objectStore(yO).put(i,e)];case 2:return t.sent(),[4,n.complete];case 3:return t.sent(),[2,i]}})})}function TO(t){return t.appConfig.appId}function IO(r,i){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,SO(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(EO(r.appConfig)+"/"+i,e)];case 3:return[4,t.sent().json()];case 4:if((e=t.sent()).error)throw n=e.error.message,oO.create("token-unsubscribe-failed",{errorInfo:n});return[3,6];case 5:throw n=t.sent(),oO.create("token-unsubscribe-failed",{errorInfo:n});case 6:return[2]}})})}function EO(t){t=t.projectId;return aO+"/projects/"+t+"/registrations"}function SO(t){var n=t.appConfig,r=t.installations;return Yi(this,void 0,void 0,function(){var e;return Xi(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 kO(t){var e=t.p256dh,n=t.auth,r=t.endpoint,t=t.vapidKey,e={web:{endpoint:r,auth:n,p256dh:e}};return t!==sO&&(e.web.applicationPubKey=t),e}function CO(u,c,h){return Yi(this,void 0,void 0,function(){var o,s,a;return Xi(this,function(t){switch(t.label){case 0:if("granted"!==Notification.permission)throw oO.create("permission-blocked");return[4,function(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(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)})]}})})}(c,h)];case 1:return a=t.sent(),[4,_O(u)];case 2:return o=t.sent(),s={vapidKey:h,swScope:c.scope,endpoint:a.endpoint,auth:hO(a.getKey("auth")),p256dh:hO(a.getKey("p256dh"))},o?[3,3]:[2,NO(u,s)];case 3:if(e=o.subscriptionOptions,n=s.vapidKey===e.vapidKey,r=s.endpoint===e.endpoint,i=s.auth===e.auth,e=s.p256dh===e.p256dh,n&&r&&i&&e)return[3,8];t.label=4;case 4:return t.trys.push([4,6,,7]),[4,IO(u,o.token)];case 5:return t.sent(),[3,7];case 6:return a=t.sent(),console.warn(a),[3,7];case 7:return[2,NO(u,s)];case 8:return Date.now()>=o.createTime+6048e5?[2,function(i,o,s){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,5]),[4,function(o,s){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:return[4,SO(o)];case 1:e=t.sent(),n=kO(s.subscriptionOptions),n={method:"PATCH",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(EO(o.appConfig)+"/"+s.token,n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),oO.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,oO.create("token-update-failed",{errorInfo:i});if(!r.token)throw oO.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return e=t.sent(),n=Qi(Qi({},i),{token:e,createTime:Date.now()}),[4,wO(o,n)];case 2:return t.sent(),[2,e];case 3:return r=t.sent(),[4,AO(o,s)];case 4:throw t.sent(),r;case 5:return[2]}})})}({token:o.token,createTime:Date.now(),subscriptionOptions:s},u,c)]:[2,o.token];case 9:return[2]}var e,n,r,i})})}function AO(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,_O(n)];case 1:return(e=t.sent())?[4,IO(n,e.token)]:[3,4];case 2:return t.sent(),[4,function(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return e=TO(r),[4,bO()];case 1:return n=t.sent(),[4,(n=n.transaction(yO,"readwrite")).objectStore(yO).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 NO(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,function(o,s){return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(this,function(t){switch(t.label){case 0:return[4,SO(o)];case 1:e=t.sent(),n=kO(s),n={method:"POST",headers:e,body:JSON.stringify(n)},t.label=2;case 2:return t.trys.push([2,5,,6]),[4,fetch(EO(o.appConfig),n)];case 3:return[4,t.sent().json()];case 4:return r=t.sent(),[3,6];case 5:throw i=t.sent(),oO.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,oO.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw oO.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,wO(n,e)];case 2:return t.sent(),[2,e.token]}})})}function RO(t){return"object"==typeof t&&t&&cO in t}function PO(e){return new Promise(function(t){setTimeout(t,e)})}var OO=(Object.defineProperty(DO.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),DO.prototype.setBackgroundMessageHandler=function(t){if(this.isOnBackgroundMessageUsed=!1,!t||"function"!=typeof t)throw oO.create("invalid-bg-handler");this.bgMessageHandler=t},DO.prototype.onBackgroundMessage=function(t){var e=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=t,function(){e.bgMessageHandler=null}},DO.prototype.getToken=function(){var n;return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return this.vapidKey?[3,2]:[4,_O(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:sO,t.label=2;case 2:return[2,CO(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},DO.prototype.deleteToken=function(){return AO(this.firebaseDependencies,self.registration)},DO.prototype.requestPermission=function(){throw oO.create("only-available-in-window")},DO.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw oO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw oO.create("invalid-vapid-key");this.vapidKey=t},DO.prototype.useServiceWorker=function(){throw oO.create("only-available-in-window")},DO.prototype.onMessage=function(){throw oO.create("only-available-in-window")},DO.prototype.onTokenRefresh=function(){throw oO.create("only-available-in-window")},DO.prototype.onPush=function(c){return Yi(this,void 0,void 0,function(){var s,a,u;return Xi(this,function(t){switch(t.label){case 0:return(u=function(t){t=t.data;if(!t)return null;try{return t.json()}catch(t){return null}}(c))?[4,xO()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return(s=t.sent()).some(function(t){return"visible"===t.visibilityState&&!t.url.startsWith("chrome-extension://")})?[2,function(t,e){var n,r;e.isFirebaseMessaging=!0,e.messageType=iO.PUSH_RECEIVED;try{for(var i=$i(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}}}(s,u)]:(a=!1,u.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)}(((o=Qi({},(r=u).notification)).data=((i={})[uO]=r,i),o))]:[3,3]);case 2:t.sent(),a=!0,t.label=3;case 3:return!0===a&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(n={from:(e=u).from,collapseKey:e.collapse_key,messageId:e.fcm_message_id},r=n,(i=e).notification&&(r.notification={},(o=i.notification.title)&&(r.notification.title=o),(o=i.notification.body)&&(r.notification.body=o),(i=i.notification.image)&&(r.notification.image=i)),r=n,(i=e).data&&(r.data=i.data),r=n,(i=e).fcmOptions&&(r.fcmOptions={},(e=i.fcmOptions.link)&&(r.fcmOptions.link=e),(i=i.fcmOptions.analytics_label)&&(r.fcmOptions.analyticsLabel=i)),u=n,"function"==typeof this.bgMessageHandler?this.bgMessageHandler(u):this.bgMessageHandler.next(u)),[4,PO(1e3)]);case 4:return t.sent(),[2]}var e,n,r,i,o})})},DO.prototype.onSubChange=function(n){var r;return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return n.newSubscription?[3,2]:[4,AO(this.firebaseDependencies,self.registration)];case 1:return t.sent(),[2];case 2:return[4,_O(this.firebaseDependencies)];case 3:return e=t.sent(),[4,AO(this.firebaseDependencies,self.registration)];case 4:return t.sent(),[4,CO(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:sO)];case 5:return t.sent(),[2]}})})},DO.prototype.onNotificationClick=function(s){var a;return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:return(e=null===(a=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===a?void 0:a[uO])?s.action?[2]:(s.stopImmediatePropagation(),s.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 RO(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 Yi(this,void 0,void 0,function(){var e,n,r,i,o,s,a;return Xi(this,function(t){switch(t.label){case 0:return[4,xO()];case 1:e=t.sent();try{for(n=$i(e),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),u.host===o.host)return[2,i]}catch(t){s={error:t}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]):[2]):[2];case 1:return(o=t.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return o=t.sent(),[4,PO(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=iO.NOTIFICATION_CLICKED,e.isFirebaseMessaging=!0,[2,o.postMessage(e)]):[2]}})})},DO);function DO(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 xO(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var LO=(Object.defineProperty(MO.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),MO.prototype.messageEventListener=function(i){return Yi(this,void 0,void 0,function(){var n,r;return Xi(this,function(t){switch(t.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===iO.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(e=Object.assign({},n)).messageType,delete e.isFirebaseMessaging,e)):this.onMessageCallback.next(Object.assign({},n))),RO(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})})},MO.prototype.getVapidKey=function(){return this.vapidKey},MO.prototype.getSwReg=function(){return this.swRegistration},MO.prototype.getToken=function(e){return Yi(this,void 0,void 0,function(){return Xi(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 oO.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,CO(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},MO.prototype.updateVapidKey=function(e){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){return e?this.vapidKey=e:this.vapidKey||(this.vapidKey=sO),[2]})})},MO.prototype.updateSwReg=function(e){return Yi(this,void 0,void 0,function(){return Xi(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 oO.create("invalid-sw-registration");return this.swRegistration=e,[2]}})})},MO.prototype.registerDefaultSw=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(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(),oO.create("failed-service-worker-registration",{browserErrorMessage:e.message});case 3:return[2]}})})},MO.prototype.deleteToken=function(){return Yi(this,void 0,void 0,function(){return Xi(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,AO(this.firebaseDependencies,this.swRegistration)]}})})},MO.prototype.requestPermission=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(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?oO.create("permission-blocked"):oO.create("permission-default")}})})},MO.prototype.usePublicVapidKey=function(t){if(null!==this.vapidKey)throw oO.create("use-vapid-key-after-get-token");if("string"!=typeof t||0===t.length)throw oO.create("invalid-vapid-key");this.vapidKey=t},MO.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw oO.create("invalid-sw-registration");if(this.swRegistration)throw oO.create("use-sw-after-get-token");this.swRegistration=t},MO.prototype.onMessage=function(t){var e=this;return this.onMessageCallback=t,function(){e.onMessageCallback=null}},MO.prototype.setBackgroundMessageHandler=function(){throw oO.create("only-available-in-sw")},MO.prototype.onBackgroundMessage=function(){throw oO.create("only-available-in-sw")},MO.prototype.onTokenRefresh=function(){return function(){}},MO.prototype.logEvent=function(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return e=function(t){switch(t){case iO.NOTIFICATION_CLICKED:return"notification_open";case iO.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[cO],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},MO);function MO(t){var e=this;this.firebaseDependencies=t,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(t){return e.messageEventListener(t)})}function FO(t){return oO.create("missing-app-config-values",{valueName:t})}Q={isSupported:jO};function jO(){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")}Jl.INTERNAL.registerComponent(new es("messaging",function(t){var e=t.getProvider("app").getImmediate(),t={app:e,appConfig:function(t){var e,n;if(!t||!t.options)throw FO("App Configuration Object");if(!t.name)throw FO("App Name");var r=t.options;try{for(var i=$i(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw FO(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return{appName:t.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(e),installations:t.getProvider("installations").getImmediate(),analyticsProvider:t.getProvider("analytics-internal")};if(!jO())throw oO.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?OO:LO)(t)},"PUBLIC").setServiceProps(Q));var UO,qO="firebasestorage.googleapis.com",VO="storageBucket",BO=(Gi(KO,UO=So),KO.prototype._codeEquals=function(t){return WO(t)===this.code},Object.defineProperty(KO.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}),KO);function KO(t,e){t=UO.call(this,WO(t),"Firebase Storage: "+e+" ("+WO(t)+")")||this;return t.customData={serverResponse:null},t._baseMessage=t.message,Object.setPrototypeOf(t,KO.prototype),t}function WO(t){return"storage/"+t}function HO(){return new BO("unknown","An unknown error occurred, please check the error payload for server response.")}function zO(){return new BO("canceled","User canceled the upload/download.")}function GO(){return new BO("cannot-slice-blob","Cannot slice blob for upload. Please retry the upload.")}function QO(t){return new BO("invalid-argument",t)}function YO(){return new BO("app-deleted","The Firebase app was deleted.")}function XO(t){return new BO("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 $O(t,e){return new BO("invalid-format","String does not match format '"+t+"': "+e)}function JO(t){throw new BO("internal-error","Internal error: "+t)}var ZO={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},tD=function(t,e){this.data=t,this.contentType=e||null};function eD(t,e){switch(t){case ZO.RAW:return new tD(nD(e));case ZO.BASE64:case ZO.BASE64URL:return new tD(rD(t,e));case ZO.DATA_URL:return new tD(function(t){t=new iD(t);return t.base64?rD(ZO.BASE64,t.rest):function(t){var e;try{e=decodeURIComponent(t)}catch(t){throw $O(ZO.DATA_URL,"Malformed data URL.")}return nD(e)}(t.rest)}(e),new iD(e).contentType)}throw HO()}function nD(t){for(var e=[],n=0;n<t.length;n++){var r,i,o=t.charCodeAt(n);o<=127?e.push(o):o<=2047?e.push(192|o>>6,128|63&o):55296==(64512&o)?n<t.length-1&&56320==(64512&t.charCodeAt(n+1))?(r=o,i=t.charCodeAt(++n),e.push(240|(o=65536|(1023&r)<<10|1023&i)>>18,128|o>>12&63,128|o>>6&63,128|63&o)):e.push(239,191,189):56320==(64512&o)?e.push(239,191,189):e.push(224|o>>12,128|o>>6&63,128|63&o)}return new Uint8Array(e)}function rD(e,t){switch(e){case ZO.BASE64:var n=-1!==t.indexOf("-"),r=-1!==t.indexOf("_");if(n||r)throw $O(e,"Invalid character '"+(n?"-":"_")+"' found: is it base64url encoded?");break;case ZO.BASE64URL:r=-1!==t.indexOf("+"),n=-1!==t.indexOf("/");if(r||n)throw $O(e,"Invalid character '"+(r?"+":"/")+"' found: is it base64 encoded?");t=t.replace(/-/g,"+").replace(/_/g,"/")}var i;try{i=atob(t)}catch(t){throw $O(e,"Invalid character found")}for(var o=new Uint8Array(i.length),s=0;s<i.length;s++)o[s]=i.charCodeAt(s);return o}var iD=function(t){var e;if(this.base64=!1,(this.contentType=null)===(e=t.match(/^data:([^,]+)?,/)))throw $O(ZO.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 oD,sD={STATE_CHANGED:"state_changed"},aD={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function uD(t){switch(t){case"running":case"pausing":case"canceling":return aD.RUNNING;case"paused":return aD.PAUSED;case"success":return aD.SUCCESS;case"canceled":return aD.CANCELED;case"error":default:return aD.ERROR}}(G=oD=oD||{})[G.NO_ERROR=0]="NO_ERROR",G[G.NETWORK_ERROR=1]="NETWORK_ERROR",G[G.ABORT=2]="ABORT";var cD=(hD.prototype.send=function(t,e,n,r){if(this.sent_)throw JO("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_},hD.prototype.getErrorCode=function(){if(!this.sent_)throw JO("cannot .getErrorCode() before sending");return this.errorCode_},hD.prototype.getStatus=function(){if(!this.sent_)throw JO("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},hD.prototype.getResponseText=function(){if(!this.sent_)throw JO("cannot .getResponseText() before sending");return this.xhr_.responseText},hD.prototype.abort=function(){this.xhr_.abort()},hD.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},hD.prototype.addUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.addEventListener("progress",t)},hD.prototype.removeUploadProgressListener=function(t){null!=this.xhr_.upload&&this.xhr_.upload.removeEventListener("progress",t)},hD);function hD(){var e=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=oD.NO_ERROR,this.sendPromise_=new Promise(function(t){e.xhr_.addEventListener("abort",function(){e.errorCode_=oD.ABORT,t()}),e.xhr_.addEventListener("error",function(){e.errorCode_=oD.NETWORK_ERROR,t()}),e.xhr_.addEventListener("load",function(){t()})})}var lD=(fD.prototype.createConnection=function(){return new cD},fD);function fD(){}var pD=(Object.defineProperty(dD.prototype,"path",{get:function(){return this.path_},enumerable:!1,configurable:!0}),Object.defineProperty(dD.prototype,"isRoot",{get:function(){return 0===this.path.length},enumerable:!1,configurable:!0}),dD.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},dD.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},dD.makeFromBucketSpec=function(e,t){var n;try{n=dD.makeFromUrl(e,t)}catch(t){return new dD(e,"")}if(""===n.path)return n;throw new BO("invalid-default-bucket","Invalid default bucket '"+e+"'.")},dD.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 s=e.replace(/[.]/g,"\\."),a=[{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?://"+s+"/v[A-Za-z0-9_]+/b/"+r+"/o(/([^?#]*).*)?$","i"),indices:{bucket:1,path:3},postModify:o},{regex:new RegExp("^https?://"+(e===qO?"(?:storage.googleapis.com|storage.cloud.google.com)":e)+"/"+r+"/([^?#]*)","i"),indices:{bucket:1,path:2},postModify:o}],u=0;u<a.length;u++){var c=a[u],h=c.regex.exec(t);if(h){n=new dD(h[c.indices.bucket],h[c.indices.path]||"");c.postModify(n);break}}if(null==n)throw new BO("invalid-url","Invalid URL '"+t+"'.");return n},dD);function dD(t,e){this.bucket=t,this.path_=e}var gD=(vD.prototype.getPromise=function(){return this.promise_},vD.prototype.cancel=function(t){},vD);function vD(t){this.promise_=Promise.reject(t)}function yD(t){return"string"==typeof t||t instanceof String}function mD(t){return bD()&&t instanceof Blob}function bD(){return"undefined"!=typeof Blob}function _D(t,e,n,r){if(r<e)throw QO("Invalid value for '"+t+"'. Expected "+e+" or greater.");if(n<r)throw QO("Invalid value for '"+t+"'. Expected "+n+" or less.")}function wD(t,e){var n=e.match(/^(\w+):\/\/.+/);return(null==(null==n?void 0:n[1])?"https://"+e:e)+"/v0"+t}function TD(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 ID=(ED.prototype.start_=function(){var e,n,t,r,i,o,s,a,u,c=this;function h(t,e){var n,r=c.resolve_,i=c.reject_,o=e.connection;if(e.wasSuccessCode)try{var s=c.callback_(o,o.getResponseText());void 0!==s?r(s):r()}catch(t){i(t)}else null!==o?((n=HO()).serverResponse=o.getResponseText(),c.errorCallback_?i(c.errorCallback_(o,n)):i(n)):e.canceled?i(n=(c.appDelete_?YO:zO)()):i(n=new BO("retry-limit-exceeded","Max retry time for operation exceeded, please try again."))}function l(){return 2===s}function f(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];a||(a=!0,n.apply(null,t))}function p(t){i=setTimeout(function(){i=null,e(d,l())},t)}function d(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];a||(t||l()||o?f.call.apply(f,Zi([null,t],e)):(r<64&&(r*=2),p(1===s?(s=2,0):1e3*(r+Math.random()))))}function g(t){u||(u=!0,a||(null!==i?(t||(s=2),clearTimeout(i),p(0)):t||(s=1)))}this.canceled_?h(0,new SD(!1,null,!0)):this.backoffId_=(e=function(r,t){var i;function o(t){var e=t.loaded,t=t.lengthComputable?t.total:-1;null!==c.progressCallback_&&c.progressCallback_(e,t)}t?r(!1,new SD(!1,null,!0)):(i=c.pool_.createConnection(),c.pendingConnection_=i,null!==c.progressCallback_&&i.addUploadProgressListener(o),i.send(c.url_,c.method_,c.body_,c.headers_).then(function(){null!==c.progressCallback_&&i.removeUploadProgressListener(o),c.pendingConnection_=null;var t,e=i.getErrorCode()===oD.NO_ERROR,n=i.getStatus();e&&!c.isRetryStatusCode_(n)?(t=-1!==c.successCodes_.indexOf(n),r(!0,new SD(t,i))):(t=i.getErrorCode()===oD.ABORT,r(!1,new SD(!1,null,t)))}))},n=h,t=this.timeout_,i=null,u=a=o=!(r=1),p(s=0),setTimeout(function(){o=!0,g(!0)},t),g)},ED.prototype.getPromise=function(){return this.promise_},ED.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()},ED.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},ED);function ED(t,e,n,r,i,o,s,a,u,c,h){var l=this;this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=s,this.errorCallback_=a,this.progressCallback_=c,this.timeout_=u,this.pool_=h,this.promise_=new Promise(function(t,e){l.resolve_=t,l.reject_=e,l.start_()})}var SD=function(t,e,n){this.wasSuccessCode=t,this.connection=e,this.canceled=!!n};function kD(){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(bD())return new Blob(t);throw new BO("unsupported-environment","This browser doesn't seem to support creating Blobs")}var CD=(AD.prototype.size=function(){return this.size_},AD.prototype.type=function(){return this.type_},AD.prototype.slice=function(t,e){if(mD(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 AD(r)}var i,r;return new AD(new Uint8Array(this.data_.buffer,t,e-t),!0)},AD.getBlob=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(bD()){var n=t.map(function(t){return t instanceof AD?t.data_:t});return new AD(kD.apply(null,n))}var n=t.map(function(t){return yD(t)?eD(ZO.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 AD(i,!0)},AD.prototype.uploadData=function(){return this.data_},AD);function AD(t,e){var n=0,r="";mD(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 ND(t){var e;try{e=JSON.parse(t)}catch(t){return null}return"object"!=typeof(t=e)||Array.isArray(t)?null:e}function RD(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function PD(t,e){return e}var OD=function(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||PD},DD=null;function xD(){if(DD)return DD;var t=[];t.push(new OD("bucket")),t.push(new OD("generation")),t.push(new OD("metageneration")),t.push(new OD("name","fullPath",!0));var e=new OD("name");e.xform=function(t,e){return!yD(e=e)||e.length<2?e:RD(e)},t.push(e);e=new OD("size");return e.xform=function(t,e){return void 0!==e?Number(e):e},t.push(e),t.push(new OD("timeCreated")),t.push(new OD("updated")),t.push(new OD("md5Hash",null,!0)),t.push(new OD("cacheControl",null,!0)),t.push(new OD("contentDisposition",null,!0)),t.push(new OD("contentEncoding",null,!0)),t.push(new OD("contentLanguage",null,!0)),t.push(new OD("contentType",null,!0)),t.push(new OD("metadata","customMetadata",!0)),DD=t}function LD(n,r){Object.defineProperty(n,"ref",{get:function(){var t=n.bucket,e=n.fullPath,e=new pD(t,e);return r._makeStorageReference(e)}})}function MD(t,e,n){e=ND(e);return null===e?null:function(t,e,n){for(var r={type:"file"},i=n.length,o=0;o<i;o++){var s=n[o];r[s.local]=s.xform(r,e[s.server])}return LD(r,t),r}(t,e,n)}function FD(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 jD="prefixes",UD="items";function qD(t,e,n){n=ND(n);return null===n?null:function(t,e,n){var r={prefixes:[],items:[],nextPageToken:n.nextPageToken};if(n[jD])for(var i=0,o=n[jD];i<o.length;i++){var s=o[i].replace(/\/$/,""),a=t._makeStorageReference(new pD(e,s));r.prefixes.push(a)}if(n[UD])for(var u=0,c=n[UD];u<c.length;u++){var h=c[u],a=t._makeStorageReference(new pD(e,h.name));r.items.push(a)}return r}(t,e,n)}var VD=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 BD(t){if(!t)throw HO()}function KD(n,r){return function(t,e){return BD(null!==(e=MD(n,e,r))),e}}function WD(n,r){return function(t,e){return BD(null!==(e=qD(n,r,e))),e}}function HD(r,i){return function(t,e){var n=MD(r,e,i);return BD(null!==n),function(r,t,i){if(null===(t=ND(t)))return null;if(!yD(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 wD("/b/"+o(e)+"/o/"+o(n),i)+TD({alt:"media",token:t})})[0]}(n,e,r.host)}}function zD(i){return function(t,e){var n,r=401===t.getStatus()?t.getResponseText().includes("Firebase App Check token is invalid")?new BO("unauthorized-app","This app does not have permission to access Firebase Storage on this project."):new BO("unauthenticated","User is not authenticated, please authenticate using Firebase Authentication and try again."):402===t.getStatus()?(n=i.bucket,new BO("quota-exceeded","Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")):403===t.getStatus()?(r=i.path,new BO("unauthorized","User does not have permission to access '"+r+"'.")):e;return r.serverResponse=e.serverResponse,r}}function GD(r){var i=zD(r);return function(t,e){var n=i(t,e);return 404===t.getStatus()&&(t=r.path,n=new BO("object-not-found","Object '"+t+"' does not exist.")),n.serverResponse=e.serverResponse,n}}function QD(t,e,n){var r=wD(e.fullServerUrl(),t.host),i=t.maxOperationRetryTime,i=new VD(r,"GET",KD(t,n),i);return i.errorHandler=GD(e),i}function YD(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 XD(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s={"X-Goog-Upload-Protocol":"multipart"};var a=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();s["Content-Type"]="multipart/related; boundary="+a;var u=YD(e,r,i),i="--"+a+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+FD(u,n)+"\r\n--"+a+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",r=CD.getBlob(i,r,"\r\n--"+a+"--");if(null===r)throw GO();a={name:u.fullPath},u=wD(o,t.host),o=t.maxUploadRetryTime,o=new VD(u,"POST",KD(t,n),o);return o.urlParams=a,o.headers=s,o.body=r.uploadData(),o.errorHandler=zD(e),o}var $D=function(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null};function JD(t,e){var n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){BD(!1)}return BD(!!n&&-1!==(e||["active"]).indexOf(n)),n}function ZD(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),s=YD(e,r,i),i={name:s.fullPath},o=wD(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":s.contentType,"Content-Type":"application/json; charset=utf-8"},n=FD(s,n),t=t.maxUploadRetryTime;t=new VD(o,"POST",function(t){var e;JD(t);try{e=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){BD(!1)}return BD(yD(e)),e},t);return t.urlParams=i,t.headers=r,t.body=n,t.errorHandler=zD(e),t}function tx(t,e,n,r){t=t.maxUploadRetryTime,t=new VD(n,"POST",function(t){var e=JD(t,["active","final"]),n=null;try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){BD(!1)}return n||BD(!1),n=Number(n),BD(!isNaN(n)),new $D(n,r.size(),"final"===e)},t);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=zD(e),t}function ex(t,o,e,s,n,a,r,i){var u=new $D(0,0);if(r?(u.current=r.current,u.total=r.total):(u.current=0,u.total=s.size()),s.size()!==u.total)throw new BO("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={"X-Goog-Upload-Command":h===c?"upload, finalize":"upload","X-Goog-Upload-Offset":""+u.current},c=s.slice(r,r+h);if(null===c)throw GO();r=o.maxUploadRetryTime,r=new VD(e,"POST",function(t,e){var n=JD(t,["active","final"]),r=u.current+h,i=s.size(),e="final"===n?KD(o,a)(t,e):null;return new $D(r,i,"final"===n,e)},r);return r.headers=n,r.body=c.uploadData(),r.progressCallback=i||null,r.errorHandler=zD(t),r}var nx=function(t,e,n){"function"==typeof t||null!=e||null!=n?(this.next=t,this.error=e,this.complete=n):(this.next=(t=t).next,this.error=t.error,this.complete=t.complete)};function rx(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 ix=(ox.prototype._makeProgressCallback=function(){var e=this,n=this._transferred;return function(t){return e._updateProgress(n+t)}},ox.prototype._shouldDoResumable=function(t){return 262144<t.size()},ox.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())},ox.prototype._resolveToken=function(r){var i=this;Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(function(t){var e=t[0],n=t[1];switch(i._state){case"running":r(e,n);break;case"canceling":i._transition("canceled");break;case"pausing":i._transition("paused")}})},ox.prototype._createResumable=function(){var r=this;this._resolveToken(function(t,e){var n=ZD(r._ref.storage,r._ref._location,r._mappings,r._blob,r._metadata),e=r._ref.storage._makeRequest(n,t,e);(r._request=e).getPromise().then(function(t){r._request=void 0,r._uploadUrl=t,r._needToFetchStatus=!1,r.completeTransitions_()},r._errorHandler)})},ox.prototype._fetchStatus=function(){var r=this,i=this._uploadUrl;this._resolveToken(function(t,e){var n=tx(r._ref.storage,r._ref._location,i,r._blob),e=r._ref.storage._makeRequest(n,t,e);(r._request=e).getPromise().then(function(t){r._request=void 0,r._updateProgress(t.current),r._needToFetchStatus=!1,t.finalized&&(r._needToFetchMetadata=!0),r.completeTransitions_()},r._errorHandler)})},ox.prototype._continueUpload=function(){var r=this,i=262144*this._chunkMultiplier,o=new $D(this._transferred,this._blob.size()),s=this._uploadUrl;this._resolveToken(function(t,e){var n;try{n=ex(r._ref._location,r._ref.storage,s,r._blob,i,r._mappings,o,r._makeProgressCallback())}catch(t){return r._error=t,void r._transition("error")}e=r._ref.storage._makeRequest(n,t,e);(r._request=e).getPromise().then(function(t){r._increaseMultiplier(),r._request=void 0,r._updateProgress(t.current),t.finalized?(r._metadata=t.metadata,r._transition("success")):r.completeTransitions_()},r._errorHandler)})},ox.prototype._increaseMultiplier=function(){262144*this._chunkMultiplier<33554432&&(this._chunkMultiplier*=2)},ox.prototype._fetchMetadata=function(){var r=this;this._resolveToken(function(t,e){var n=QD(r._ref.storage,r._ref._location,r._mappings),e=r._ref.storage._makeRequest(n,t,e);(r._request=e).getPromise().then(function(t){r._request=void 0,r._metadata=t,r._transition("success")},r._metadataErrorHandler)})},ox.prototype._oneShotUpload=function(){var r=this;this._resolveToken(function(t,e){var n=XD(r._ref.storage,r._ref._location,r._mappings,r._blob,r._metadata),e=r._ref.storage._makeRequest(n,t,e);(r._request=e).getPromise().then(function(t){r._request=void 0,r._metadata=t,r._updateProgress(r._blob.size()),r._transition("success")},r._errorHandler)})},ox.prototype._updateProgress=function(t){var e=this._transferred;this._transferred=t,this._transferred!==e&&this._notifyObservers()},ox.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=zO(),this._state=t,this._notifyObservers();break;case"error":case"success":this._state=t,this._notifyObservers()}},ox.prototype.completeTransitions_=function(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start()}},Object.defineProperty(ox.prototype,"snapshot",{get:function(){var t=uD(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:t,metadata:this._metadata,task:this,ref:this._ref}},enumerable:!1,configurable:!0}),ox.prototype.on=function(t,e,n,r){var i=this,o=new nx(e,n,r);return this._addObserver(o),function(){i._removeObserver(o)}},ox.prototype.then=function(t,e){return this._promise.then(t,e)},ox.prototype.catch=function(t){return this.then(null,t)},ox.prototype._addObserver=function(t){this._observers.push(t),this._notifyObserver(t)},ox.prototype._removeObserver=function(t){t=this._observers.indexOf(t);-1!==t&&this._observers.splice(t,1)},ox.prototype._notifyObservers=function(){var e=this;this._finishPromise(),this._observers.slice().forEach(function(t){e._notifyObserver(t)})},ox.prototype._finishPromise=function(){if(void 0!==this._resolve){var t=!0;switch(uD(this._state)){case aD.SUCCESS:rx(this._resolve.bind(null,this.snapshot))();break;case aD.CANCELED:case aD.ERROR:rx(this._reject.bind(null,this._error))();break;default:t=!1}t&&(this._resolve=void 0,this._reject=void 0)}},ox.prototype._notifyObserver=function(t){switch(uD(this._state)){case aD.RUNNING:case aD.PAUSED:t.next&&rx(t.next.bind(t,this.snapshot))();break;case aD.SUCCESS:t.complete&&rx(t.complete.bind(t))();break;case aD.CANCELED:case aD.ERROR:t.error&&rx(t.error.bind(t,this._error))();break;default:t.error&&rx(t.error.bind(t,this._error))()}},ox.prototype.resume=function(){var t="paused"===this._state||"pausing"===this._state;return t&&this._transition("running"),t},ox.prototype.pause=function(){var t="running"===this._state;return t&&this._transition("pausing"),t},ox.prototype.cancel=function(){var t="running"===this._state||"pausing"===this._state;return t&&this._transition("canceling"),t},ox);function ox(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=xD(),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 sx=(ax.prototype.toString=function(){return"gs://"+this._location.bucket+"/"+this._location.path},ax.prototype._newRef=function(t,e){return new ax(t,e)},Object.defineProperty(ax.prototype,"root",{get:function(){var t=new pD(this._location.bucket,"");return this._newRef(this._service,t)},enumerable:!1,configurable:!0}),Object.defineProperty(ax.prototype,"bucket",{get:function(){return this._location.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(ax.prototype,"fullPath",{get:function(){return this._location.path},enumerable:!1,configurable:!0}),Object.defineProperty(ax.prototype,"name",{get:function(){return RD(this._location.path)},enumerable:!1,configurable:!0}),Object.defineProperty(ax.prototype,"storage",{get:function(){return this._service},enumerable:!1,configurable:!0}),Object.defineProperty(ax.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 pD(this._location.bucket,t);return new ax(this._service,t)},enumerable:!1,configurable:!0}),ax.prototype._throwIfRoot=function(t){if(""===this._location.path)throw XO(t)},ax);function ax(t,e){this._service=t,this._location=e instanceof pD?e:pD.makeFromUrl(e,t.host)}function ux(t){var e={prefixes:[],items:[]};return function r(i,o,s){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,cx(i,{pageToken:s})];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 cx(u,c){return Yi(this,void 0,void 0,function(){var a;return Xi(this,function(t){switch(t.label){case 0:return null!=c&&"number"==typeof c.maxResults&&_D("options.maxResults",1,1e3,c.maxResults),a=c||{},e=u.storage,n=u._location,r="/",i=a.pageToken,o=a.maxResults,s={},n.isRoot?s.prefix="":s.prefix=n.path+"/",r&&0<r.length&&(s.delimiter=r),i&&(s.pageToken=i),o&&(s.maxResults=o),i=wD(n.bucketOnlyServerUrl(),e.host),o=e.maxOperationRetryTime,(o=new VD(i,"GET",WD(e,n.bucket),o)).urlParams=s,o.errorHandler=zD(n),[4,u.storage.makeRequestWithTokens(o)];case 1:return[2,t.sent().getPromise()]}var e,n,r,i,o,s})})}function hx(a,u){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return a._throwIfRoot("updateMetadata"),e=a.storage,n=a._location,r=u,i=xD(),o=wD(n.fullServerUrl(),e.host),s=FD(r,i),r=e.maxOperationRetryTime,(r=new VD(o,"PATCH",KD(e,i),r)).headers={"Content-Type":"application/json; charset=utf-8"},r.body=s,r.errorHandler=GD(n),[4,a.storage.makeRequestWithTokens(r)];case 1:return[2,t.sent().getPromise()]}var e,n,r,i,o,s})})}function lx(s){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return s._throwIfRoot("getDownloadURL"),e=s.storage,n=s._location,r=xD(),i=wD(n.fullServerUrl(),e.host),o=e.maxOperationRetryTime,(o=new VD(i,"GET",HD(e,r),o)).errorHandler=GD(n),[4,s.storage.makeRequestWithTokens(o)];case 1:return[2,t.sent().getPromise().then(function(t){if(null===t)throw new BO("no-download-url","The given file does not have any download URLs.");return t})]}var e,n,r,i,o})})}function fx(i){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return i._throwIfRoot("deleteObject"),e=i.storage,n=i._location,r=wD(n.fullServerUrl(),e.host),e=e.maxOperationRetryTime,(e=new VD(r,"DELETE",function(t,e){},e)).successCodes=[200,204],e.errorHandler=GD(n),[4,i.storage.makeRequestWithTokens(e)];case 1:return[2,t.sent().getPromise()]}var e,n,r})})}function px(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 pD(t._location.bucket,e);return new sx(t.storage,e)}function dx(t){return/^[A-Za-z]+:\/\//.test(t)}function gx(t,e){if(t instanceof mx){var n=t;if(null==n._bucket)throw new BO("no-default-bucket","No default bucket found. Did you set the '"+VO+"' property when initializing the app?");n=new sx(n,n._bucket);return null!=e?gx(n,e):n}return void 0!==e?px(t,e):t}function vx(t,e){if(e&&dx(e)){if(t instanceof mx)return new sx(t,e);throw QO("To use ref(service, url), the first argument must be a Storage instance.")}return gx(t,e)}function yx(t,e){e=null==e?void 0:e[VO];return null==e?null:pD.makeFromBucketSpec(e,t)}var mx=(Object.defineProperty(bx.prototype,"host",{get:function(){return this._host},set:function(t){this._host=t,null!=this._url?this._bucket=pD.makeFromBucketSpec(this._url,t):this._bucket=yx(t,this.app.options)},enumerable:!1,configurable:!0}),Object.defineProperty(bx.prototype,"maxUploadRetryTime",{get:function(){return this._maxUploadRetryTime},set:function(t){_D("time",0,Number.POSITIVE_INFINITY,t),this._maxUploadRetryTime=t},enumerable:!1,configurable:!0}),Object.defineProperty(bx.prototype,"maxOperationRetryTime",{get:function(){return this._maxOperationRetryTime},set:function(t){_D("time",0,Number.POSITIVE_INFINITY,t),this._maxOperationRetryTime=t},enumerable:!1,configurable:!0}),bx.prototype._getAuthToken=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return this._overrideAuthToken?[2,this._overrideAuthToken]:(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]}})})},bx.prototype._getAppCheckToken=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return(e=this._appCheckProvider.getImmediate({optional:!0}))?[4,e.getToken()]:[3,2];case 1:return[2,t.sent().token];case 2:return[2,null]}})})},bx.prototype._delete=function(){return this._deleted||(this._deleted=!0,this._requests.forEach(function(t){return t.cancel()}),this._requests.clear()),Promise.resolve()},bx.prototype._makeStorageReference=function(t){return new sx(this,t)},bx.prototype._makeRequest=function(t,e,n){var r=this;if(this._deleted)return new gD(YO());var i,o,s,a,u,c,h=(i=t,o=this._appId,s=e,a=n,u=this._pool,c=this._firebaseVersion,t=TD(i.urlParams),e=i.url+t,n=Object.assign({},i.headers),t=n,(o=o)&&(t["X-Firebase-GMPID"]=o),o=n,null!==(s=s)&&0<s.length&&(o.Authorization="Firebase "+s),c=c,n["X-Firebase-Storage-Version"]="webjs/"+(null!=c?c:"AppManager"),c=n,null!==(a=a)&&(c["X-Firebase-AppCheck"]=a),new ID(e,i.method,n,i.body,i.successCodes,i.additionalRetryCodes,i.handler,i.errorHandler,i.timeout,i.progressCallback,u));return this._requests.add(h),h.getPromise().then(function(){return r._requests.delete(h)},function(){return r._requests.delete(h)}),h},bx.prototype.makeRequestWithTokens=function(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,Promise.all([this._getAuthToken(),this._getAppCheckToken()])];case 1:return n=t.sent(),e=n[0],n=n[1],[2,this._makeRequest(r,e,n)]}})})},bx);function bx(t,e,n,r,i,o){this.app=t,this._authProvider=e,this._appCheckProvider=n,this._pool=r,this._url=i,this._firebaseVersion=o,this._bucket=null,this._host=qO,this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,this._bucket=null!=i?pD.makeFromBucketSpec(i,this._host):yx(this._host,this.app.options)}function _x(t,e,n){return t=ts(t),e=e,n=n,(t=t)._throwIfRoot("uploadBytesResumable"),new ix(t,new CD(e),n)}function wx(t){return function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return n._throwIfRoot("getMetadata"),e=QD(n.storage,n._location,xD()),[4,n.storage.makeRequestWithTokens(e)];case 1:return[2,t.sent().getPromise()]}})})}(t=ts(t))}function Tx(t,e){return vx(t=ts(t),e)}function Ix(t,e,n,r){void 0===(r=r=void 0===r?{}:r)&&(r={}),(t=t).host="http://"+e+":"+n,(r=r.mockUserToken)&&(t._overrideAuthToken="string"==typeof r?r:fo(r,t.app.options.projectId))}var Ex=(Object.defineProperty(Sx.prototype,"bytesTransferred",{get:function(){return this._delegate.bytesTransferred},enumerable:!1,configurable:!0}),Object.defineProperty(Sx.prototype,"metadata",{get:function(){return this._delegate.metadata},enumerable:!1,configurable:!0}),Object.defineProperty(Sx.prototype,"state",{get:function(){return this._delegate.state},enumerable:!1,configurable:!0}),Object.defineProperty(Sx.prototype,"totalBytes",{get:function(){return this._delegate.totalBytes},enumerable:!1,configurable:!0}),Sx);function Sx(t,e,n){this._delegate=t,this.task=e,this.ref=n}var kx=(Object.defineProperty(Cx.prototype,"snapshot",{get:function(){return new Ex(this._delegate.snapshot,this,this._ref)},enumerable:!1,configurable:!0}),Cx.prototype.then=function(e,t){var n=this;return this._delegate.then(function(t){if(e)return e(new Ex(t,n,n._ref))},t)},Cx.prototype.on=function(t,e,n,r){var i=this,o=void 0;return e&&(o="function"==typeof e?function(t){return e(new Ex(t,i,i._ref))}:{next:e.next?function(t){return e.next(new Ex(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)},Cx);function Cx(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 Ax=(Object.defineProperty(Nx.prototype,"prefixes",{get:function(){var e=this;return this._delegate.prefixes.map(function(t){return new Rx(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(Nx.prototype,"items",{get:function(){var e=this;return this._delegate.items.map(function(t){return new Rx(t,e._service)})},enumerable:!1,configurable:!0}),Object.defineProperty(Nx.prototype,"nextPageToken",{get:function(){return this._delegate.nextPageToken||null},enumerable:!1,configurable:!0}),Nx);function Nx(t,e){this._delegate=t,this._service=e}var Rx=(Object.defineProperty(Px.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(Px.prototype,"bucket",{get:function(){return this._delegate.bucket},enumerable:!1,configurable:!0}),Object.defineProperty(Px.prototype,"fullPath",{get:function(){return this._delegate.fullPath},enumerable:!1,configurable:!0}),Px.prototype.toString=function(){return this._delegate.toString()},Px.prototype.child=function(t){return new Px(px(this._delegate,t),this.storage)},Object.defineProperty(Px.prototype,"root",{get:function(){return new Px(this._delegate.root,this.storage)},enumerable:!1,configurable:!0}),Object.defineProperty(Px.prototype,"parent",{get:function(){var t=this._delegate.parent;return null==t?null:new Px(t,this.storage)},enumerable:!1,configurable:!0}),Px.prototype.put=function(t,e){return this._throwIfRoot("put"),new kx(_x(this._delegate,t,e),this)},Px.prototype.putString=function(t,e,n){void 0===e&&(e=ZO.RAW),this._throwIfRoot("putString");t=eD(e,t),n=Qi({},n);return null==n.contentType&&null!=t.contentType&&(n.contentType=t.contentType),new kx(new ix(this._delegate,new CD(t.data,!0),n),this)},Px.prototype.listAll=function(){var e=this;return ux(ts(this._delegate)).then(function(t){return new Ax(t,e.storage)})},Px.prototype.list=function(t){var e,n=this;return e=this._delegate,t=t||void 0,cx(e=ts(e),t).then(function(t){return new Ax(t,n.storage)})},Px.prototype.getMetadata=function(){return wx(this._delegate)},Px.prototype.updateMetadata=function(t){return hx(ts(this._delegate),t)},Px.prototype.getDownloadURL=function(){return lx(ts(this._delegate))},Px.prototype.delete=function(){return this._throwIfRoot("delete"),fx(ts(this._delegate))},Px.prototype._throwIfRoot=function(t){if(""===this._delegate._location.path)throw XO(t)},Px);function Px(t,e){this._delegate=t,this.storage=e}var Ox=(Object.defineProperty(Dx.prototype,"maxOperationRetryTime",{get:function(){return this._delegate.maxOperationRetryTime},enumerable:!1,configurable:!0}),Object.defineProperty(Dx.prototype,"maxUploadRetryTime",{get:function(){return this._delegate.maxUploadRetryTime},enumerable:!1,configurable:!0}),Dx.prototype.ref=function(t){if(dx(t))throw QO("ref() expected a child path but got a URL, use refFromURL instead.");return new Rx(Tx(this._delegate,t),this)},Dx.prototype.refFromURL=function(t){if(!dx(t))throw QO("refFromURL() expected a full URL but got a child path, use ref() instead.");try{pD.makeFromUrl(t,this._delegate.host)}catch(t){throw QO("refFromUrl() expected a valid full URL but got an invalid one.")}return new Rx(Tx(this._delegate,t),this)},Dx.prototype.setMaxUploadRetryTime=function(t){this._delegate.maxUploadRetryTime=t},Dx.prototype.setMaxOperationRetryTime=function(t){this._delegate.maxOperationRetryTime=t},Dx.prototype.useEmulator=function(t,e,n){Ix(this._delegate,t,e,n=void 0===n?{}:n)},Dx);function Dx(t,e){this.app=t,this._delegate=e}var xx,Lx;function Mx(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),e=t.getProvider("auth-internal"),t=t.getProvider("app-check-internal");return new Ox(r,new mx(r,e,t,new lD,n,Jl.SDK_VERSION))}Lx={TaskState:aD,TaskEvent:sD,StringFormat:ZO,Storage:mx,Reference:Rx},(xx=Jl).INTERNAL.registerComponent(new es("storage",Mx,"PUBLIC").setServiceProps(Lx).setMultipleInstances(!0)),xx.registerVersion("@firebase/storage","0.7.0");var Fx,jx,Ux="0.4.18",qx="FB-PERF-TRACE-MEASURE",Vx="@firebase/performance/config",Bx="@firebase/performance/configexpire",Q="Performance",G=((G={})["trace started"]="Trace {$traceName} was started before.",G["trace stopped"]="Trace {$traceName} is not running.",G["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",G["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",G["no window"]="Window is not available.",G["no app id"]="App id is not available.",G["no project id"]="Project id is not available.",G["no api key"]="Api key is not available.",G["invalid cc log"]="Attempted to queue invalid cc event",G["FB not default"]="Performance can only start when Firebase app instance is the default one.",G["RC response not ok"]="RC response is not ok",G["invalid attribute name"]="Attribute name {$attributeName} is invalid.",G["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",G["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",G["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",G),Kx=new Co("performance",Q,G),Wx=new ds(Q);Wx.logLevel=us.INFO;var Hx,zx=(Gx.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},Gx.prototype.mark=function(t){this.performance&&this.performance.mark&&this.performance.mark(t)},Gx.prototype.measure=function(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)},Gx.prototype.getEntriesByType=function(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]},Gx.prototype.getEntriesByName=function(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]},Gx.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},Gx.prototype.requiredApisAvailable=function(){return fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled?!!_o()||(Wx.info("IndexedDB is not supported by current browswer"),!1):(Wx.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},Gx.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]})},Gx.getInstance=function(){return Fx=void 0===Fx?new Gx(jx):Fx},Gx);function Gx(t){if(!(this.window=t))throw Kx.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 Qx(t,e){var n=t.length-e.length;if(n<0||1<n)throw Kx.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 Yx,Xx,$x=(Jx.prototype.getAppId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!t)throw Kx.create("no app id");return t},Jx.prototype.getProjectId=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!t)throw Kx.create("no project id");return t},Jx.prototype.getApiKey=function(){var t=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!t)throw Kx.create("no api key");return t},Jx.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},Jx.getInstance=function(){return Hx=void 0===Hx?new Jx:Hx},Jx);function Jx(){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=Qx("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=Qx("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(Q=Xx=Xx||{})[Q.UNKNOWN=0]="UNKNOWN",Q[Q.VISIBLE=1]="VISIBLE",Q[Q.HIDDEN=2]="HIDDEN";var Zx=["firebase_","google_","ga_"],tL=new RegExp("^[a-zA-Z]\\w*$");function eL(){switch(zx.getInstance().document.visibilityState){case"visible":return Xx.VISIBLE;case"hidden":return Xx.HIDDEN;default:return Xx.UNKNOWN}}var nL="0.0.1",rL={loggingEnabled:!0},iL="FIREBASE_INSTALLATIONS_AUTH";function oL(t){var n,e=function(){var t=zx.getInstance().localStorage;if(t){var e=t.getItem(Bx);if(e&&function(t){return Number(t)>Date.now()}(e)){t=t.getItem(Vx);if(t)try{return JSON.parse(t)}catch(t){return}}}}();return e?(aL(e),Promise.resolve()):(n=t,function(){var t=$x.getInstance().installationsService.getToken();return t.then(function(t){}),t}().then(function(t){var e="https://firebaseremoteconfig.googleapis.com/v1/projects/"+$x.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+$x.getInstance().getApiKey(),t=new Request(e,{method:"POST",headers:{Authorization:iL+" "+t},body:JSON.stringify({app_instance_id:n,app_instance_id_token:t,app_id:$x.getInstance().getAppId(),app_version:Ux,sdk_version:nL})});return fetch(t).then(function(t){if(t.ok)return t.json();throw Kx.create("RC response not ok")})}).catch(function(){Wx.info(sL)}).then(aL).then(function(t){var e;e=t,t=zx.getInstance().localStorage,e&&t&&(t.setItem(Vx,JSON.stringify(e)),t.setItem(Bx,String(Date.now()+60*$x.getInstance().configTimeToLive*60*1e3)))},function(){}))}var sL="Could not fetch config, will use default configs";function aL(t){if(!t)return t;var e=$x.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=rL.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=uL(e.tracesSamplingRate),e.logNetworkAfterSampling=uL(e.networkRequestsSamplingRate),t}function uL(t){return Math.random()<=t}var cL,hL=1;function lL(){return hL=2,cL=cL||function(){var n=zx.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=$x.getInstance().installationsService.getId()).then(function(t){Yx=t}),t;var t}).then(oL).then(fL,fL)}function fL(){hL=3}var pL,dL=1e4,gL=5500,vL=3,yL=1e3,mL=vL,bL=[],_L=!1;function wL(t){setTimeout(function(){var t,e;if(0!==mL)return bL.length?(t=bL.splice(0,yL),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=$x.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then(function(t){return t.ok||Wx.info("Call to Firebase backend failed."),t.json()}).then(function(t){var e=Number(t.nextRequestWaitMillis),n=dL;isNaN(e)||(n=Math.max(e,n));t=t.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(bL=Zi(Zi([],r),bL),Wx.info("Retry transport request later.")),mL=vL,wL(n)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:$x.getInstance().logSource,log_event:e},t).catch(function(){bL=Zi(Zi([],t),bL),mL--,Wx.info("Tries left: "+mL+"."),wL(dL)})):wL(dL)},t)}function TL(n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];!function(t){if(!t.eventTime||!t.message)throw Kx.create("invalid cc log");bL=Zi(Zi([],bL),[t])}({message:n.apply(void 0,t),eventTime:Date.now()})}}function IL(t,e){(pL=pL||TL(kL))(t,e)}function EL(t){var e=$x.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&zx.getInstance().requiredApisAvailable()&&(t.isAuto&&eL()!==Xx.VISIBLE||(3===hL?SL(t):lL().then(function(){return SL(t)},function(){return SL(t)})))}function SL(t){var e;!Yx||(e=$x.getInstance()).loggingEnabled&&e.logTraceAfterSampling&&setTimeout(function(){return IL(t,1)},0)}function kL(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:CL(),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:CL(),trace_metric:e};return JSON.stringify(e)})(t)}function CL(){return{google_app_id:$x.getInstance().getAppId(),app_instance_id:Yx,web_app_info:{sdk_version:Ux,page_url:zx.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=zx.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:eL(),effective_connection_type:function(){var t=zx.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 AL=["_fp","_fcp","_fid"];var NL=(RL.prototype.start=function(){if(1!==this.state)throw Kx.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},RL.prototype.stop=function(){if(2!==this.state)throw Kx.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(),EL(this)},RL.prototype.record=function(t,e,n){if(t<=0)throw Kx.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw Kx.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=Qi({},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])))}EL(this)},RL.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)},RL.prototype.putMetric=function(t,e){if(n=t,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<AL.indexOf(n))&&n.startsWith("_"))throw Kx.create("invalid custom metric name",{customMetricName:t});var n,r;this.counters[t]=(t=e,(e=Math.floor(t))<t&&Wx.info("Metric value should be an Integer, setting the value as : "+e+"."),e)},RL.prototype.getMetric=function(t){return this.counters[t]||0},RL.prototype.putAttribute=function(t,e){var n,r,i=!(0===(n=t).length||40<n.length)&&(!Zx.some(function(t){return n.startsWith(t)})&&!!n.match(tL)),r=0!==(r=e).length&&r.length<=100;if(i&&r)this.customAttributes[t]=e;else{if(!i)throw Kx.create("invalid attribute name",{attributeName:t});if(!r)throw Kx.create("invalid attribute value",{attributeValue:e})}},RL.prototype.getAttribute=function(t){return this.customAttributes[t]},RL.prototype.removeAttribute=function(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]},RL.prototype.getAttributes=function(){return Qi({},this.customAttributes)},RL.prototype.setStartTime=function(t){this.startTimeUs=t},RL.prototype.setDuration=function(t){this.durationUs=t},RL.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())))},RL.createOobTrace=function(t,e,n){var r,i=zx.getInstance().getUrl();i&&(r=new RL("_wt_"+i,!0),i=Math.floor(1e3*zx.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))),EL(r))},RL.createUserTimingTrace=function(t){EL(new RL(t,!1,t))},RL);function RL(t,e,n){void 0===e&&(e=!1),this.name=t,this.isAuto=e,this.state=1,this.customAttributes={},this.counters={},this.api=zx.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||qx+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function PL(t){var e,n,r,i=t;i&&void 0!==i.responseStart&&(n=zx.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=$x.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 IL(e,0)},0)))}var OL=5e3;function DL(){Yx&&(setTimeout(function(){var t=zx.getInstance(),e=t.getEntriesByType("navigation"),n=t.getEntriesByType("paint");{var r;t.onFirstInputDelay?(r=setTimeout(function(){NL.createOobTrace(e,n),r=void 0},OL),t.onFirstInputDelay(function(t){r&&(clearTimeout(r),NL.createOobTrace(e,n,t))})):NL.createOobTrace(e,n)}},0),setTimeout(function(){for(var t=zx.getInstance(),e=t.getEntriesByType("resource"),n=0,r=e;n<r.length;n++)PL(r[n]);t.setupObserver("resource",PL)},0),setTimeout(function(){for(var t=zx.getInstance(),e=t.getEntriesByType("measure"),n=0,r=e;n<r.length;n++)xL(r[n]);t.setupObserver("measure",xL)},0))}function xL(t){t=t.name;t.substring(0,qx.length)!==qx&&NL.createUserTimingTrace(t)}var LL=(ML.prototype.trace=function(t){return new NL(t)},Object.defineProperty(ML.prototype,"instrumentationEnabled",{get:function(){return $x.getInstance().instrumentationEnabled},set:function(t){$x.getInstance().instrumentationEnabled=t},enumerable:!1,configurable:!0}),Object.defineProperty(ML.prototype,"dataCollectionEnabled",{get:function(){return $x.getInstance().dataCollectionEnabled},set:function(t){$x.getInstance().dataCollectionEnabled=t},enumerable:!1,configurable:!0}),ML);function ML(t){this.app=t,zx.getInstance().requiredApisAvailable()&&wo().then(function(t){t&&(_L||(wL(gL),_L=!0),lL().then(DL,DL))}).catch(function(t){Wx.info("Environment doesn't support IndexedDB: "+t)})}var FL;function jL(t,e){if("[DEFAULT]"!==t.name)throw Kx.create("FB not default");if("undefined"==typeof window)throw Kx.create("no window");return jx=window,$x.getInstance().firebaseAppInstance=t,$x.getInstance().installationsService=e,new LL(t)}(FL=Jl).INTERNAL.registerComponent(new es("performance",function(t){var e=t.getProvider("app").getImmediate(),t=t.getProvider("installations").getImmediate();return jL(e,t)},"PUBLIC")),FL.registerVersion("@firebase/performance","0.4.18");var UL,qL,VL="firebase_id",BL="origin",KL=6e4,WL="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",HL="https://www.googletagmanager.com/gtag/js";(Q=UL=UL||{}).EVENT="event",Q.SET="set",Q.CONFIG="config",(Q=qL=qL||{}).ADD_SHIPPING_INFO="add_shipping_info",Q.ADD_PAYMENT_INFO="add_payment_info",Q.ADD_TO_CART="add_to_cart",Q.ADD_TO_WISHLIST="add_to_wishlist",Q.BEGIN_CHECKOUT="begin_checkout",Q.CHECKOUT_PROGRESS="checkout_progress",Q.EXCEPTION="exception",Q.GENERATE_LEAD="generate_lead",Q.LOGIN="login",Q.PAGE_VIEW="page_view",Q.PURCHASE="purchase",Q.REFUND="refund",Q.REMOVE_FROM_CART="remove_from_cart",Q.SCREEN_VIEW="screen_view",Q.SEARCH="search",Q.SELECT_CONTENT="select_content",Q.SELECT_ITEM="select_item",Q.SELECT_PROMOTION="select_promotion",Q.SET_CHECKOUT_OPTION="set_checkout_option",Q.SHARE="share",Q.SIGN_UP="sign_up",Q.TIMING_COMPLETE="timing_complete",Q.VIEW_CART="view_cart",Q.VIEW_ITEM="view_item",Q.VIEW_ITEM_LIST="view_item_list",Q.VIEW_PROMOTION="view_promotion",Q.VIEW_SEARCH_RESULTS="view_search_results";var zL=new ds("@firebase/analytics");function GL(o,s,a,u){return function(n,r,i){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return t.trys.push([0,6,,7]),n!==UL.EVENT?[3,2]:[4,function(u,c,h,l,f){return Yi(this,void 0,void 0,function(){var n,r,e,i,o,s,a;return Xi(this,function(t){switch(t.label){case 0:return(t.trys.push([0,4,,5]),n=[],f&&f.send_to)?(a=f.send_to,Array.isArray(a)||(a=[a]),[4,Promise.all(h)]):[3,2];case 1:for(r=t.sent(),e=function(e){var t=r.find(function(t){return t.measurementId===e}),t=t&&c[t.appId];if(!t)return n=[],"break";n.push(t)},i=0,o=a;i<o.length&&(s=o[i],"break"!==e(s));i++);t.label=2;case 2:return 0===n.length&&(n=Object.values(c)),[4,Promise.all(n)];case 3:return t.sent(),u(UL.EVENT,l,f||{}),[3,5];case 4:return a=t.sent(),zL.error(a),[3,5];case 5:return[2]}})})}(o,s,a,r,i)];case 1:return t.sent(),[3,5];case 2:return n!==UL.CONFIG?[3,4]:[4,function(r,i,o,s,a,u){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:e=s[a],t.label=1;case 1:return t.trys.push([1,7,,8]),e?[4,i[e]]:[3,3];case 2:return t.sent(),[3,6];case 3:return[4,Promise.all(o)];case 4:return n=t.sent(),(n=n.find(function(t){return t.measurementId===a}))?[4,i[n.appId]]:[3,6];case 5:t.sent(),t.label=6;case 6:return[3,8];case 7:return n=t.sent(),zL.error(n),[3,8];case 8:return r(UL.CONFIG,a,u),[2]}})})}(o,s,a,u,r,i)];case 3:return t.sent(),[3,5];case 4:o(UL.SET,r),t.label=5;case 5:return[3,7];case 6:return e=t.sent(),zL.error(e),[3,7];case 7:return[2]}})})}}var Q=((Q={})["already-exists"]="A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.",Q["already-initialized"]="Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.",Q["interop-component-reg-failed"]="Firebase Analytics Interop Component failed to instantiate: {$reason}",Q["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}",Q["indexeddb-unavailable"]="IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}",Q["fetch-throttle"]="The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.",Q["config-fetch-failed"]="Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}",Q["no-api-key"]='The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',Q["no-app-id"]='The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',Q),QL=new Co("analytics","Analytics",Q),YL=30;function XL(t,e){void 0===e&&(e=1e3),this.throttleMetadata=t=void 0===t?{}:t,this.intervalMillis=e}var $L=new(XL.prototype.getThrottleMetadata=function(t){return this.throttleMetadata[t]},XL.prototype.setThrottleMetadata=function(t,e){this.throttleMetadata[t]=e},XL.prototype.deleteThrottleMetadata=function(t){delete this.throttleMetadata[t]},XL);function JL(o){var s;return Yi(this,void 0,void 0,function(){var e,n,r,i;return Xi(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=WL.replace("{app-id}",e),[4,fetch(e,i)];case 1:if(200===(n=t.sent()).status||304===n.status)return[3,6];r="",t.label=2;case 2:return t.trys.push([2,4,,5]),[4,n.json()];case 3:return i=t.sent(),null!==(s=i.error)&&void 0!==s&&s.message&&(r=i.error.message),[3,5];case 4:return t.sent(),[3,5];case 5:throw QL.create("config-fetch-failed",{httpStatus:n.status,responseMessage:r});case 6:return[2,n.json()]}})})}function ZL(a,u,c){return void 0===u&&(u=$L),Yi(this,void 0,void 0,function(){var e,n,r,i,o,s=this;return Xi(this,function(t){if(i=a.options,e=i.appId,n=i.apiKey,r=i.measurementId,!e)throw QL.create("no-app-id");if(n)return i=u.getThrottleMetadata(e)||{backoffCount:0,throttleEndTimeMillis:Date.now()},o=new nM,setTimeout(function(){return Yi(s,void 0,void 0,function(){return Xi(this,function(t){return o.abort(),[2]})})},void 0!==c?c:KL),[2,function s(a,t,u,c){var h=t.throttleEndTimeMillis,l=t.backoffCount;void 0===c&&(c=$L);return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:e=a.appId,n=a.measurementId,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,tM(u,h)];case 2:return t.sent(),[3,4];case 3:if(i=t.sent(),n)return zL.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,JL(a)];case 5:return o=t.sent(),c.deleteThrottleMetadata(e),[2,o];case 6:if(eM(r=t.sent()))return i=503===Number(r.customData.httpStatus)?Zo(l,c.intervalMillis,YL):Zo(l,c.intervalMillis),o={throttleEndTimeMillis:Date.now()+i,backoffCount:l+1},c.setThrottleMetadata(e,o),zL.debug("Calling attemptFetch again in "+i+" millis"),[2,s(a,o,u,c)];if(c.deleteThrottleMetadata(e),n)return zL.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 QL.create("no-api-key")})})}function tM(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(QL.create("fetch-throttle",{throttleEndTimeMillis:o}))})})}function eM(t){if(t instanceof So&&t.customData){t=Number(t.customData.httpStatus);return 429===t||500===t||503===t||504===t}}var nM=(rM.prototype.addEventListener=function(t){this.listeners.push(t)},rM.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},rM);function rM(){this.listeners=[]}function iM(a,u,c,h,l,f){return Yi(this,void 0,void 0,function(){var i,o,s;return Xi(this,function(t){switch(t.label){case 0:return(i=ZL(a)).then(function(t){c[t.measurementId]=t.appId,a.options.measurementId&&t.measurementId!==a.options.measurementId&&zL.warn("The measurement ID in the local Firebase config ("+a.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 zL.error(t)}),u.push(i),o=function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return _o()?[3,1]:(zL.warn(QL.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),[2,!1]);case 1:return t.trys.push([1,3,,4]),[4,wo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),zL.warn(QL.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 s=t.sent(),i=s[0],o=s[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(HL))return r}}()||(e=f,n=i.measurementId,(r=document.createElement("script")).src=HL+"?l="+e+"&id="+n,r.async=!0,document.head.appendChild(r)),l("js",new Date),(s={})[BL]="firebase",s.update=!0,s=s,null!=o&&(s[VL]=o),l(UL.CONFIG,i.measurementId,s),[2,i.measurementId]}var e,n,r})})}var oM,sM,aM={},uM=[],cM={},hM="dataLayer",lM="gtag",fM=!1;function pM(t){if(fM)throw QL.create("already-initialized");t.dataLayerName&&(hM=t.dataLayerName),t.gtagName&&(lM=t.gtagName)}function dM(t,e){i=[],yo()&&i.push("This is a browser extension environment."),To()||i.push("Cookies are not available."),0<i.length&&(i=i.map(function(t,e){return"("+(e+1)+") "+t}).join(" "),i=QL.create("invalid-analytics-context",{errorInfo:i}),zL.warn(i.message));var n,r,i,o=t.options.appId;if(!o)throw QL.create("no-app-id");if(!t.options.apiKey){if(!t.options.measurementId)throw QL.create("no-api-key");zL.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!=aM[o])throw QL.create("already-exists",{id:o});return fM||(r=hM,i=[],Array.isArray(window[r])?i=window[r]:window[r]=i,n=hM,r=lM,i=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];window[n].push(arguments)},window[r]&&"function"==typeof window[r]&&(i=window[r]),window[r]=GL(i,aM,uM,cM),r={gtagCore:i,wrappedGtag:window[r]},sM=r.wrappedGtag,oM=r.gtagCore,fM=!0),aM[o]=iM(t,uM,cM,e,oM,hM),{app:t,logEvent:function(t,e,n){!function(n,r,i,o,s){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return s&&s.global?(n(UL.EVENT,i,o),[2]):[3,1];case 1:return[4,r];case 2:e=t.sent(),e=Qi(Qi({},o),{send_to:e}),n(UL.EVENT,i,e),t.label=3;case 3:return[2]}})})}(sM,aM[o],t,e,n).catch(function(t){return zL.error(t)})},setCurrentScreen:function(t,e){!function(n,r,i,o){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(UL.SET,{screen_name:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(UL.CONFIG,e,{update:!0,screen_name:i}),t.label=3;case 3:return[2]}})})}(sM,aM[o],t,e).catch(function(t){return zL.error(t)})},setUserId:function(t,e){!function(n,r,i,o){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return o&&o.global?(n(UL.SET,{user_id:i}),[2,Promise.resolve()]):[3,1];case 1:return[4,r];case 2:e=t.sent(),n(UL.CONFIG,e,{update:!0,user_id:i}),t.label=3;case 3:return[2]}})})}(sM,aM[o],t,e).catch(function(t){return zL.error(t)})},setUserProperties:function(t,e){!function(s,a,u,c){return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:if(!c||!c.global)return[3,1];for(e={},n=0,r=Object.keys(u);n<r.length;n++)i=r[n],e["user_properties."+i]=u[i];return s(UL.SET,e),[2,Promise.resolve()];case 1:return[4,a];case 2:o=t.sent(),s(UL.CONFIG,o,{update:!0,user_properties:u}),t.label=3;case 3:return[2]}})})}(sM,aM[o],t,e).catch(function(t){return zL.error(t)})},setAnalyticsCollectionEnabled:function(t){!function(n,r){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,n];case 1:return e=t.sent(),window["ga-disable-"+e]=!r,[2]}})})}(aM[o],t).catch(function(t){return zL.error(t)})},INTERNAL:{delete:function(){return delete aM[o],Promise.resolve()}}}}var gM,vM="analytics";function yM(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:if(yo())return[2,!1];if(!To())return[2,!1];if(!_o())return[2,!1];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,wo()];case 2:return[2,t.sent()];case 3:return t.sent(),[2,!1];case 4:return[2]}})})}(gM=Jl).INTERNAL.registerComponent(new es(vM,function(t){return dM(t.getProvider("app").getImmediate(),t.getProvider("installations").getImmediate())},"PUBLIC").setServiceProps({settings:pM,EventName:qL,isSupported:yM})),gM.INTERNAL.registerComponent(new es("analytics-internal",function(t){try{return{logEvent:t.getProvider(vM).getImmediate().logEvent}}catch(t){throw QL.create("interop-component-reg-failed",{reason:t})}},"PRIVATE")),gM.registerVersion("@firebase/analytics","0.6.18");var mM=(bM.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},bM.prototype.fetch=function(i){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(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]}})})},bM);function bM(t,e,n,r){this.client=t,this.storage=e,this.storageCache=n,this.logger=r}var Q=((Q={})["registration-window"]="Undefined window object. This SDK only supports usage in a browser environment.",Q["registration-project-id"]="Undefined project identifier. Check Firebase app initialization.",Q["registration-api-key"]="Undefined API key. Check Firebase app initialization.",Q["registration-app-id"]="Undefined app identifier. Check Firebase app initialization.",Q["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",Q["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",Q["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",Q["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",Q["fetch-client-network"]="Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",Q["fetch-timeout"]='The config fetch request timed out. Configure timeout using "fetchTimeoutMillis" SDK setting.',Q["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}.',Q["fetch-client-parse"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",Q["fetch-status"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",Q),_M=new Co("remoteconfig","Remote Config",Q);var wM=(TM.prototype.fetch=function(f){return Yi(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h,l;return Xi(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"),_M.create(o,{originalErrorMessage:i.message});case 6:if(s=l.status,a=l.headers.get("ETag")||void 0,200!==l.status)return[3,11];h=void 0,t.label=7;case 7:return t.trys.push([7,9,,10]),[4,l.json()];case 8:return h=t.sent(),[3,10];case 9:throw l=t.sent(),_M.create("fetch-client-parse",{originalErrorMessage:l.message});case 10:u=h.entries,c=h.state,t.label=11;case 11:if("INSTANCE_STATE_UNSPECIFIED"===c?s=500:"NO_CHANGE"===c?s=304:"NO_TEMPLATE"!==c&&"EMPTY_CONFIG"!==c||(u={}),304!==s&&200!==s)throw _M.create("fetch-status",{httpStatus:s});return[2,{status:s,eTag:a,config:u}]}var e})})},TM);function TM(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 IM=(EM.prototype.addEventListener=function(t){this.listeners.push(t)},EM.prototype.abort=function(){this.listeners.forEach(function(t){return t()})},EM);function EM(){this.listeners=[]}var SM=["1","true","t","yes","y","on"],kM=(CM.prototype.asString=function(){return this._value},CM.prototype.asBoolean=function(){return"static"!==this._source&&0<=SM.indexOf(this._value.toLowerCase())},CM.prototype.asNumber=function(){if("static"===this._source)return 0;var t=Number(this._value);return t=isNaN(t)?0:t},CM.prototype.getSource=function(){return this._source},CM);function CM(t,e){void 0===e&&(e=""),this._source=t,this._value=e}var AM=(NM.prototype.setLogLevel=function(t){switch(t){case"debug":this._logger.logLevel=us.DEBUG;break;case"silent":this._logger.logLevel=us.SILENT;break;default:this._logger.logLevel=us.ERROR}},Object.defineProperty(NM.prototype,"fetchTimeMillis",{get:function(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1},enumerable:!1,configurable:!0}),Object.defineProperty(NM.prototype,"lastFetchStatus",{get:function(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"},enumerable:!1,configurable:!0}),NM.prototype.activate=function(){return Yi(this,void 0,void 0,function(){var e,n;return Xi(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]}})})},NM.prototype.ensureInitialized=function(){var t=this;return this._initializePromise||(this._initializePromise=this._storageCache.loadFromStorage().then(function(){t._isInitializationComplete=!0})),this._initializePromise},NM.prototype.fetch=function(){return Yi(this,void 0,void 0,function(){var r,i,o,s=this;return Xi(this,function(t){switch(t.label){case 0:r=new IM,setTimeout(function(){return Yi(s,void 0,void 0,function(){return Xi(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 So&&-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})})},NM.prototype.fetchAndActivate=function(){return Yi(this,void 0,void 0,function(){return Xi(this,function(t){switch(t.label){case 0:return[4,this.fetch()];case 1:return t.sent(),[2,this.activate()]}})})},NM.prototype.getAll=function(){var n=this;return function(t,e){void 0===t&&(t={});void 0===e&&(e={});return Object.keys(Qi(Qi({},t),e))}(this._storageCache.getActiveConfig(),this.defaultConfig).reduce(function(t,e){return t[e]=n.getValue(e),t},{})},NM.prototype.getBoolean=function(t){return this.getValue(t).asBoolean()},NM.prototype.getNumber=function(t){return this.getValue(t).asNumber()},NM.prototype.getString=function(t){return this.getValue(t).asString()},NM.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 kM("remote",e[t]):this.defaultConfig&&void 0!==this.defaultConfig[t]?new kM("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 kM("static"))},NM);function NM(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 RM(t,e){t=t.target.error||void 0;return _M.create(e,{originalErrorMessage:t&&t.message})}var PM="app_namespace_store",OM="firebase_remote_config",DM=1;var xM=(LM.prototype.getLastFetchStatus=function(){return this.get("last_fetch_status")},LM.prototype.setLastFetchStatus=function(t){return this.set("last_fetch_status",t)},LM.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.get("last_successful_fetch_timestamp_millis")},LM.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.set("last_successful_fetch_timestamp_millis",t)},LM.prototype.getLastSuccessfulFetchResponse=function(){return this.get("last_successful_fetch_response")},LM.prototype.setLastSuccessfulFetchResponse=function(t){return this.set("last_successful_fetch_response",t)},LM.prototype.getActiveConfig=function(){return this.get("active_config")},LM.prototype.setActiveConfig=function(t){return this.set("active_config",t)},LM.prototype.getActiveConfigEtag=function(){return this.get("active_config_etag")},LM.prototype.setActiveConfigEtag=function(t){return this.set("active_config_etag",t)},LM.prototype.getThrottleMetadata=function(){return this.get("throttle_metadata")},LM.prototype.setThrottleMetadata=function(t){return this.set("throttle_metadata",t)},LM.prototype.deleteThrottleMetadata=function(){return this.delete("throttle_metadata")},LM.prototype.get=function(a){return Yi(this,void 0,void 0,function(){var o,s=this;return Xi(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([PM],"readonly").objectStore(PM),r=s.createCompositeKey(a);try{var i=t.get(r);i.onerror=function(t){n(RM(t,"storage-get"))},i.onsuccess=function(t){t=t.target.result;e(t?t.value:void 0)}}catch(t){n(_M.create("storage-get",{originalErrorMessage:t&&t.message}))}})]}})})},LM.prototype.set=function(a,u){return Yi(this,void 0,void 0,function(){var o,s=this;return Xi(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([PM],"readwrite").objectStore(PM),r=s.createCompositeKey(a);try{var i=n.put({compositeKey:r,value:u});i.onerror=function(t){e(RM(t,"storage-set"))},i.onsuccess=function(){t()}}catch(t){e(_M.create("storage-set",{originalErrorMessage:t&&t.message}))}})]}})})},LM.prototype.delete=function(a){return Yi(this,void 0,void 0,function(){var o,s=this;return Xi(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([PM],"readwrite").objectStore(PM),r=s.createCompositeKey(a);try{var i=n.delete(r);i.onerror=function(t){e(RM(t,"storage-delete"))},i.onsuccess=function(){t()}}catch(t){e(_M.create("storage-delete",{originalErrorMessage:t&&t.message}))}})]}})})},LM.prototype.createCompositeKey=function(t){return[this.appId,this.appName,this.namespace,t].join()},LM);function LM(t,e,n,r){void 0===r&&(r=new Promise(function(e,n){var t=indexedDB.open(OM,DM);t.onerror=function(t){n(RM(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(PM,{keyPath:"compositeKey"})}})),this.appId=t,this.appName=e,this.namespace=n,this.openDbPromise=r}var MM=(FM.prototype.getLastFetchStatus=function(){return this.lastFetchStatus},FM.prototype.getLastSuccessfulFetchTimestampMillis=function(){return this.lastSuccessfulFetchTimestampMillis},FM.prototype.getActiveConfig=function(){return this.activeConfig},FM.prototype.loadFromStorage=function(){return Yi(this,void 0,void 0,function(){var e,n,r;return Xi(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]}})})},FM.prototype.setLastFetchStatus=function(t){return this.lastFetchStatus=t,this.storage.setLastFetchStatus(t)},FM.prototype.setLastSuccessfulFetchTimestampMillis=function(t){return this.lastSuccessfulFetchTimestampMillis=t,this.storage.setLastSuccessfulFetchTimestampMillis(t)},FM.prototype.setActiveConfig=function(t){return this.activeConfig=t,this.storage.setActiveConfig(t)},FM);function FM(t){this.storage=t}var jM=(UM.prototype.fetch=function(n){return Yi(this,void 0,void 0,function(){var e;return Xi(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)]}})})},UM.prototype.attemptFetch=function(r,t){var s=t.throttleEndTimeMillis,a=t.backoffCount;return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:return[4,(i=r.signal,o=s,new Promise(function(t,e){var n=Math.max(o-Date.now(),0),r=setTimeout(t,n);i.addEventListener(function(){clearTimeout(r),e(_M.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 So&&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()+Zo(a),backoffCount:a+1},[4,this.storage.setThrottleMetadata(n)];case 6:return t.sent(),[2,this.attemptFetch(r,n)];case 7:return[2]}var i,o})})},UM);function UM(t,e){this.client=t,this.storage=e}var qM,VM="@firebase/remote-config";(qM=Jl).INTERNAL.registerComponent(new es("remoteConfig",function(t,e){var n=e.instanceIdentifier,r=t.getProvider("app").getImmediate(),i=t.getProvider("installations").getImmediate();if("undefined"==typeof window)throw _M.create("registration-window");var o=r.options,s=o.projectId,a=o.apiKey,u=o.appId;if(!s)throw _M.create("registration-project-id");if(!a)throw _M.create("registration-api-key");if(!u)throw _M.create("registration-app-id");n=n||"firebase";e=new xM(u,r.name,n),t=new MM(e),o=new ds(VM);o.logLevel=us.ERROR;u=new wM(i,qM.SDK_VERSION,n,s,a,u),u=new jM(u,e),u=new mM(u,e,t,o),o=new AM(r,u,t,e,o);return o.ensureInitialized(),o},"PUBLIC").setMultipleInstances(!0)),qM.registerVersion(VM,"0.1.43");var Q=((Q={})["already-activated"]="You are trying to activate AppCheck for FirebaseApp {$appName}, while it is already activated. AppCheck can only be activated once.",Q["use-before-activation"]="AppCheck is being used before activate() is called for FirebaseApp {$appName}. Please make sure you call activate() before instantiating other Firebase services.",Q["fetch-network-error"]="Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",Q["fetch-parse-error"]="Fetch client could not parse response. Original error: {$originalErrorMessage}.",Q["fetch-status-error"]="Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",Q["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",Q["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",Q["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",Q["recaptcha-error"]="ReCAPTCHA error.",Q),BM=new Co("appCheck","AppCheck",Q),KM=new Map,WM={activated:!1,tokenObservers:[]},HM={enabled:!1};function zM(t){return KM.get(t)||WM}function GM(t,e){KM.set(t,e)}var QM="https://content-firebaseappcheck.googleapis.com/v1beta",YM="exchangeDebugToken",XM={OFFSET_DURATION:3e5,RETRIAL_MIN_WAIT:3e4,RETRIAL_MAX_WAIT:96e4},$M=(JM.prototype.start=function(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(function(){})},JM.prototype.stop=function(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)},JM.prototype.isRunning=function(){return!!this.pending},JM.prototype.process=function(r){return Yi(this,void 0,void 0,function(){var n;return Xi(this,function(t){switch(t.label){case 0:this.stop(),t.label=1;case 1:return t.trys.push([1,6,,7]),this.pending=new ho,[4,(e=this.getNextRun(r),new Promise(function(t){setTimeout(t,e)}))];case 2:return t.sent(),this.pending.resolve(),[4,this.pending.promise];case 3:return t.sent(),this.pending=new ho,[4,this.operation()];case 4:return t.sent(),this.pending.resolve(),[4,this.pending.promise];case 5:return t.sent(),this.process(!0).catch(function(){}),[3,7];case 6:return n=t.sent(),this.retryPolicy(n)?this.process(!1).catch(function(){}):this.stop(),[3,7];case 7:return[2]}var e})})},JM.prototype.getNextRun=function(t){if(t)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t},JM);function JM(t,e,n,r,i){if(this.operation=t,this.retryPolicy=e,this.getWaitDuration=n,this.lowerBound=r,this.upperBound=i,this.pending=null,i<(this.nextErrorWaitInterval=r))throw new Error("Proactive refresh lower bound greater than upper bound!")}function ZM(){return self.grecaptcha}function t2(t){if(!zM(t).activated)throw BM.create("use-before-activation",{appName:t.name})}function e2(t,s){var a=t.url,u=t.body;return Yi(this,void 0,void 0,function(){var e,n,r,i,o;return Xi(this,function(t){switch(t.label){case 0:n={"Content-Type":"application/json"},(e=s.getImmediate({optional:!0}))&&(n["X-Firebase-Client"]=e.getPlatformInfoString()),n={method:"POST",body:JSON.stringify(u),headers:n},t.label=1;case 1:return t.trys.push([1,3,,4]),[4,fetch(a,n)];case 2:return o=t.sent(),[3,4];case 3:throw n=t.sent(),BM.create("fetch-network-error",{originalErrorMessage:n.message});case 4:if(200!==o.status)throw BM.create("fetch-status-error",{httpStatus:o.status});t.label=5;case 5:return t.trys.push([5,7,,8]),[4,o.json()];case 6:return r=t.sent(),[3,8];case 7:throw i=t.sent(),BM.create("fetch-parse-error",{originalErrorMessage:i.message});case 8:if(!(o=r.ttl.match(/^([\d.]+)(s)$/))||!o[2]||isNaN(Number(o[1])))throw BM.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration format: "+r.ttl});return i=1e3*Number(o[1]),o=Date.now(),[2,{token:r.attestationToken,expireTimeMillis:o+i,issuedAtTimeMillis:o}]}})})}function n2(t,e){var n=t.options,r=n.projectId,t=n.appId,n=n.apiKey;return{url:QM+"/projects/"+r+"/apps/"+t+":"+YM+"?key="+n,body:{debug_token:e}}}var r2="firebase-app-check-database",i2=1,o2="firebase-app-check-store",s2="debug-token",a2=null;function u2(){return a2=a2||new Promise(function(e,n){try{var t=indexedDB.open(r2,i2);t.onsuccess=function(t){e(t.target.result)},t.onerror=function(t){n(BM.create("storage-open",{originalErrorMessage:null===(t=t.target.error)||void 0===t?void 0:t.message}))},t.onupgradeneeded=function(t){var e=t.target.result;0===t.oldVersion&&e.createObjectStore(o2,{keyPath:"compositeKey"})}}catch(t){n(BM.create("storage-open",{originalErrorMessage:t.message}))}})}function c2(n,o){return Yi(this,void 0,void 0,function(){var r,e,i;return Xi(this,function(t){switch(t.label){case 0:return[4,u2()];case 1:return e=t.sent(),r=e.transaction(o2,"readwrite"),e=r.objectStore(o2),i=e.put({compositeKey:n,value:o}),[2,new Promise(function(e,n){i.onsuccess=function(t){e()},r.onerror=function(t){n(BM.create("storage-set",{originalErrorMessage:null===(t=t.target.error)||void 0===t?void 0:t.message}))}})]}})})}function h2(n){return Yi(this,void 0,void 0,function(){var r,e,i;return Xi(this,function(t){switch(t.label){case 0:return[4,u2()];case 1:return e=t.sent(),r=e.transaction(o2,"readonly"),e=r.objectStore(o2),i=e.get(n),[2,new Promise(function(e,n){i.onsuccess=function(t){t=t.target.result;e(t?t.value:void 0)},r.onerror=function(t){n(BM.create("storage-get",{originalErrorMessage:null===(t=t.target.error)||void 0===t?void 0:t.message}))}})]}})})}function l2(t){return t.options.appId+"-"+t.name}var f2=new ds("@firebase/app-check");function p2(r){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:if(!_o())return[3,5];e=void 0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h2(l2(r))];case 2:return e=t.sent(),[3,4];case 3:return n=t.sent(),f2.warn("Failed to read token from indexeddb. Error: "+n),[3,4];case 4:return[2,e];case 5:return[2,void 0]}})})}function d2(t,e){return _o()?c2(l2(t),e).catch(function(t){f2.warn("Failed to write token to indexeddb. Error: "+t)}):Promise.resolve()}function g2(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:e=void 0,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,h2(s2)];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[3,4];case 4:return e?[2,e]:(e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}),c2(s2,e).catch(function(t){return f2.warn("Failed to persist debug token to indexeddb. Error: "+t)}),console.log("AppCheck debug token: "+e+". You will need to whitelist it in the Firebase console for it to work"),[2,e])}})})}var v2={error:"UNKNOWN_ERROR"};function y2(l,f,p){return void 0===p&&(p=!1),Yi(this,void 0,void 0,function(){var n,r,i,o,s,a,u,c,h;return Xi(this,function(t){switch(t.label){case 0:return t2(l),n=zM(l),r=n.token,i=void 0,r?[3,2]:[4,n.cachedTokenPromise];case 1:(o=t.sent())&&w2(o)&&(r=o,GM(l,Qi(Qi({},n),{token:r})),_2(l,{token:r.token})),t.label=2;case 2:return!p&&r&&w2(r)?[2,{token:r.token}]:HM.enabled?(s=e2,a=n2,u=[l],[4,function(){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){if((e=HM).enabled&&e.token)return[2,e.token.promise];throw Error("\n Can't get debug token in production mode.\n ")})})}()]):[3,6];case 3:return[4,s.apply(void 0,[a.apply(void 0,u.concat([t.sent()])),f])];case 4:return c=t.sent(),[4,d2(l,c)];case 5:return t.sent(),GM(l,Qi(Qi({},n),{token:c})),[2,{token:c.token}];case 6:return t.trys.push([6,8,,9]),[4,n.provider.getToken()];case 7:return r=t.sent(),[3,9];case 8:return c=t.sent(),f2.error(c),i=c,[3,9];case 9:return r?[3,10]:(e=i,h={token:function(t){return so.encodeString(JSON.stringify(t),!1)}(v2),error:e},[3,12]);case 10:return h={token:r.token},GM(l,Qi(Qi({},n),{token:r})),[4,d2(l,r)];case 11:t.sent(),t.label=12;case 12:return _2(l,h),[2,h]}var e})})}function m2(t,e,n,r,i){var o,s=zM(t),n={next:r,error:i,type:n},n=Qi(Qi({},s),{tokenObservers:Zi(Zi([],s.tokenObservers),[n])});n.tokenRefresher||(e=function(n,r){var t=this;return new $M(function(){return Yi(t,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return zM(n).token?[3,2]:[4,y2(n,r)];case 1:return e=t.sent(),[3,4];case 2:return[4,y2(n,r,!0)];case 3:e=t.sent(),t.label=4;case 4:if(e.error)throw e.error;return[2]}})})},function(){return!0},function(){var t=zM(n);if(t.token){var e=t.token.issuedAtTimeMillis+.5*(t.token.expireTimeMillis-t.token.issuedAtTimeMillis)+3e5,t=t.token.expireTimeMillis-3e5,e=Math.min(e,t);return Math.max(0,e-Date.now())}return 0},XM.RETRIAL_MIN_WAIT,XM.RETRIAL_MAX_WAIT)}(t,e),n.tokenRefresher=e),!n.tokenRefresher.isRunning()&&s.isTokenAutoRefreshEnabled&&n.tokenRefresher.start(),s.token&&w2(s.token)?(o=s.token,Promise.resolve().then(function(){return r({token:o.token})}).catch(function(){})):null==s.token&&s.cachedTokenPromise.then(function(t){t&&w2(t)&&r({token:t.token})}).catch(function(){}),GM(t,n)}function b2(t,e){var n=zM(t),r=n.tokenObservers.filter(function(t){return t.next!==e});0===r.length&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),GM(t,Qi(Qi({},n),{tokenObservers:r}))}function _2(t,e){for(var n=0,r=zM(t).tokenObservers;n<r.length;n++){var i=r[n];try{"EXTERNAL"===i.type&&null!=e.error?i.error(e.error):i.next(e)}catch(t){}}}function w2(t){return 0<t.expireTimeMillis-Date.now()}var T2="https://www.google.com/recaptcha/api.js";function I2(e,n){var t=zM(e),r=new ho;GM(e,Qi(Qi({},t),{reCAPTCHAState:{initialized:r}}));var i="fire_app_check_"+e.name,o=document.createElement("div");o.id=i,o.style.display="none",document.body.appendChild(o);var s=ZM();return s?s.ready(function(){E2(e,n,s,i),r.resolve(s)}):(t=function(){var t=ZM();if(!t)throw new Error("no recaptcha");t.ready(function(){E2(e,n,t,i),r.resolve(t)})},(o=document.createElement("script")).src=""+T2,o.onload=t,document.head.appendChild(o)),r.promise}function E2(t,e,n,r){r=n.render(r,{sitekey:e,size:"invisible"}),e=zM(t);GM(t,Qi(Qi({},e),{reCAPTCHAState:Qi(Qi({},e.reCAPTCHAState),{widgetId:r})}))}var S2=(k2.prototype.getToken=function(){return Yi(this,void 0,void 0,function(){var i;return Xi(this,function(t){switch(t.label){case 0:if(!this._app||!this._platformLoggerProvider)throw BM.create("use-before-activation",{appName:""});t.label=1;case 1:return t.trys.push([1,3,,4]),[4,function(i){return Yi(this,void 0,void 0,function(){var r;return Xi(this,function(t){switch(t.label){case 0:return t2(i),[4,zM(i).reCAPTCHAState.initialized.promise];case 1:return r=t.sent(),[2,new Promise(function(t,e){var n=zM(i).reCAPTCHAState;r.ready(function(){t(r.execute(n.widgetId,{action:"fire_app_check"}))})})]}})})}(this._app)];case 2:return i=t.sent(),[3,4];case 3:throw t.sent(),BM.create("recaptcha-error");case 4:return[2,e2((e=this._app,n=(r=e.options).projectId,e=r.appId,r=r.apiKey,{url:QM+"/projects/"+n+"/apps/"+e+":exchangeRecaptchaToken?key="+r,body:{recaptcha_token:i}}),this._platformLoggerProvider)]}var e,n,r})})},k2.prototype.initialize=function(t,e){this._app=t,this._platformLoggerProvider=e,I2(t,this._siteKey).catch(function(){})},k2);function k2(t){this._siteKey=t}var C2=(A2.prototype.getToken=function(){return Yi(this,void 0,void 0,function(){var e,n;return Xi(this,function(t){switch(t.label){case 0:if(!this._app)throw BM.create("use-before-activation",{appName:""});return[4,this._customProviderOptions.getToken()];case 1:return e=t.sent(),n=function(t){t=Oo(t).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null}(e.token),n=null!==n&&n<Date.now()&&0<n?1e3*n:Date.now(),[2,Qi(Qi({},e),{issuedAtTimeMillis:n})]}})})},A2.prototype.initialize=function(t){this._app=t},A2);function A2(t){this._customProviderOptions=t}function N2(a,u){return{app:a,activate:function(t,e){return function(e,t,n,r){var i=zM(e);if(i.activated)throw BM.create("already-activated",{appName:e.name});(i=Qi(Qi({},i),{activated:!0})).cachedTokenPromise=p2(e).then(function(t){return t&&w2(t)&&GM(e,Qi(Qi({},zM(e)),{token:t})),t}),i.provider="string"==typeof t?new S2(t):t instanceof S2||t instanceof C2?t:new C2({getToken:t.getToken}),i.isTokenAutoRefreshEnabled=void 0===r?e.automaticDataCollectionEnabled:r,GM(e,i),i.provider.initialize(e,n)}(a,t,u,e)},setTokenAutoRefreshEnabled:function(t){return n=t,(t=zM(e=a)).tokenRefresher&&(!0===n?t.tokenRefresher.start():t.tokenRefresher.stop()),void GM(e,Qi(Qi({},t),{isTokenAutoRefreshEnabled:n}));var e,n},getToken:function(t){return function(n,r,i){return Yi(this,void 0,void 0,function(){var e;return Xi(this,function(t){switch(t.label){case 0:return[4,y2(n,r,i)];case 1:if((e=t.sent()).error)throw e.error;return[2,{token:e.token}]}})})}(a,u,t)},onTokenChanged:function(t,e,n){return r=a,i=u,o=e,s=function(){},e=function(){},s=null!=(t=t).next?t.next.bind(t):t,null!=t.error?e=t.error.bind(t):o&&(e=o),m2(r,i,"EXTERNAL",s,e),function(){return b2(r,s)};var r,i,o,s},INTERNAL:{delete:function(){for(var t=0,e=zM(a).tokenObservers;t<e.length;t++){var n=e[t];b2(a,n.next)}return Promise.resolve()}}}}var R2,P2,O2,D2,x2="app-check-internal";return(R2=Jl).INTERNAL.registerComponent(new es("appCheck",function(t){return N2(t.getProvider("app").getImmediate(),t.getProvider("platform-logger"))},"PUBLIC").setServiceProps({ReCaptchaV3Provider:S2,CustomProvider:C2}).setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(function(t,e,n){t.getProvider(x2).initialize()})),R2.INTERNAL.registerComponent(new es(x2,function(t){var e,n,r=t.getProvider("app").getImmediate(),t=t.getProvider("platform-logger");return e=r,n=t,{getToken:function(t){return y2(e,n,t)},addTokenListener:function(t){return m2(e,n,"INTERNAL",t)},removeTokenListener:function(t){return b2(e,t)}}},"PUBLIC").setInstantiationMode("EXPLICIT")),R2.registerVersion("@firebase/app-check","0.3.2"),"string"!=typeof(D2=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}()).FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==D2.FIREBASE_APPCHECK_DEBUG_TOKEN||((P2=HM).enabled=!0,O2=new ho,P2.token=O2,"string"==typeof D2.FIREBASE_APPCHECK_DEBUG_TOKEN?O2.resolve(D2.FIREBASE_APPCHECK_DEBUG_TOKEN):O2.resolve(g2())),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"),Jl.registerVersion("firebase","8.10.0","cdn"),Jl});
//# sourceMappingURL=firebase.js.map