diff --git a/public/app/bundle.js b/public/app/bundle.js index 9eccf64..2544286 100644 --- a/public/app/bundle.js +++ b/public/app/bundle.js @@ -229,7 +229,7 @@ function(A){return T(void 0,A)},M.deepExtend=T,M.errorPrefix=s,M.every=function( * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */,M.validateNamespace=function(A,M,D,I){if((!I||D)&&"string"!=typeof D)throw new Error(s(A,M,I)+"must be a valid firebase namespace.")}},function(A,M){A.exports=function(A){try{return!!A()}catch(A){return!0}}},function(A,M){A.exports=function(A){return"object"==typeof A?null!==A:"function"==typeof A}},function(A,M,D){var I=D(19),g=D(33);A.exports=D(20)?function(A,M,D){return I.f(A,M,g(1,D))}:function(A,M,D){return A[M]=D,A}},function(A,M,D){var I=D(4),g=D(61).f,t=D(16),e=D(45),w=D(59),N=D(222),i=D(317);A.exports=function(A,M){var D,T,n,c,E,j=A.target,y=A.global,o=A.stat;if(D=y?I:o?I[j]||w(j,{}):(I[j]||{}).prototype)for(T in M){if(c=M[T],n=A.noTargetGet?(E=g(D,T))&&E.value:D[T],!i(y?T:j+(o?".":"#")+T,A.forced)&&void 0!==n){if(typeof c==typeof n)continue;N(c,n)}(A.sham||n&&n.sham)&&t(c,"sham",!0),e(D,T,c,A)}}},function(A,M,D){"use strict";D.r(M);var I=D(1),g=D(3),t=D.n(g),e=t.a.shape({trySubscribe:t.a.func.isRequired,tryUnsubscribe:t.a.func.isRequired,notifyNestedSubs:t.a.func.isRequired,isSubscribed:t.a.func.isRequired}),w=t.a.shape({subscribe:t.a.func.isRequired,dispatch:t.a.func.isRequired,getState:t.a.func.isRequired});function N(){var A,M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",D=arguments[1]||M+"Subscription",g=function(A){function g(D,I){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,g);var t=function(A,M){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!M||"object"!=typeof M&&"function"!=typeof M?A:M}(this,A.call(this,D,I));return t[M]=D.store,t}return function(A,M){if("function"!=typeof M&&null!==M)throw new TypeError("Super expression must either be null or a function, not "+typeof M);A.prototype=Object.create(M&&M.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(A,M):A.__proto__=M)}(g,A),g.prototype.getChildContext=function(){var A;return(A={})[M]=this[M],A[D]=null,A},g.prototype.render=function(){return I.Children.only(this.props.children)},g}(I.Component);return g.propTypes={store:w.isRequired,children:t.a.element.isRequired},g.childContextTypes=((A={})[M]=w.isRequired,A[D]=e,A),g}var i=N(),T=D(239),n=D.n(T),c=D(7),E=D.n(c);var j=null,y={notify:function(){}};var o=function(){function A(M,D,I){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,A),this.store=M,this.parentSub=D,this.onStateChange=I,this.unsubscribe=null,this.listeners=y}return A.prototype.addNestedSub=function(A){return this.trySubscribe(),this.listeners.subscribe(A)},A.prototype.notifyNestedSubs=function(){this.listeners.notify()},A.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},A.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=function(){var A=[],M=[];return{clear:function(){M=j,A=j},notify:function(){for(var D=A=M,I=0;I1&&void 0!==arguments[1]?arguments[1]:{},t=g.getDisplayName,N=void 0===t?function(A){return"ConnectAdvanced("+A+")"}:t,i=g.methodName,T=void 0===i?"connectAdvanced":i,c=g.renderCountProp,j=void 0===c?void 0:c,y=g.shouldHandleStateChanges,z=void 0===y||y,B=g.storeKey,a=void 0===B?"store":B,L=g.withRef,s=void 0!==L&&L,x=function(A,M){var D={};for(var I in A)M.indexOf(I)>=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(g,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),O=a+"Subscription",Y=r++,S=((M={})[a]=w,M[O]=e,M),k=((D={})[O]=e,D);return function(M){E()("function"==typeof M,"You must pass a component to the function returned by "+T+". Instead received "+JSON.stringify(M));var D=M.displayName||M.name||"Component",g=N(D),t=u({},x,{getDisplayName:N,methodName:T,renderCountProp:j,shouldHandleStateChanges:z,storeKey:a,withRef:s,displayName:g,wrappedComponentName:D,WrappedComponent:M}),e=function(D){function e(A,M){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,e);var I=function(A,M){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!M||"object"!=typeof M&&"function"!=typeof M?A:M}(this,D.call(this,A,M));return I.version=Y,I.state={},I.renderCount=0,I.store=A[a]||M[a],I.propsMode=Boolean(A[a]),I.setWrappedInstance=I.setWrappedInstance.bind(I),E()(I.store,'Could not find "'+a+'" in either the context or props of "'+g+'". Either wrap the root component in a , or explicitly pass "'+a+'" as a prop to "'+g+'".'),I.initSelector(),I.initSubscription(),I}return function(A,M){if("function"!=typeof M&&null!==M)throw new TypeError("Super expression must either be null or a function, not "+typeof M);A.prototype=Object.create(M&&M.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(A,M):A.__proto__=M)}(e,D),e.prototype.getChildContext=function(){var A,M=this.propsMode?null:this.subscription;return(A={})[O]=M||this.context[O],A},e.prototype.componentDidMount=function(){z&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},e.prototype.componentWillReceiveProps=function(A){this.selector.run(A)},e.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},e.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=Q,this.store=null,this.selector.run=Q,this.selector.shouldComponentUpdate=!1},e.prototype.getWrappedInstance=function(){return E()(s,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+T+"() call."),this.wrappedInstance},e.prototype.setWrappedInstance=function(A){this.wrappedInstance=A},e.prototype.initSelector=function(){var M=A(this.store.dispatch,t);this.selector=function(A,M){var D={run:function(I){try{var g=A(M.getState(),I);(g!==D.props||D.error)&&(D.shouldComponentUpdate=!0,D.props=g,D.error=null)}catch(A){D.shouldComponentUpdate=!0,D.error=A}}};return D}(M,this.store),this.selector.run(this.props)},e.prototype.initSubscription=function(){if(z){var A=(this.propsMode?this.props:this.context)[O];this.subscription=new o(this.store,A,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},e.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(C)):this.notifyNestedSubs()},e.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},e.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},e.prototype.addExtraProps=function(A){if(!(s||j||this.propsMode&&this.subscription))return A;var M=u({},A);return s&&(M.ref=this.setWrappedInstance),j&&(M[j]=this.renderCount++),this.propsMode&&this.subscription&&(M[O]=this.subscription),M},e.prototype.render=function(){var A=this.selector;if(A.shouldComponentUpdate=!1,A.error)throw A.error;return Object(I.createElement)(M,this.addExtraProps(A.props))},e}(I.Component);return e.WrappedComponent=M,e.displayName=g,e.childContextTypes=k,e.contextTypes=S,e.propTypes=S,n()(e,M)}}var B=Object.prototype.hasOwnProperty;function a(A,M){return A===M?0!==A||0!==M||1/A==1/M:A!=A&&M!=M}function L(A,M){if(a(A,M))return!0;if("object"!=typeof A||null===A||"object"!=typeof M||null===M)return!1;var D=Object.keys(A),I=Object.keys(M);if(D.length!==I.length)return!1;for(var g=0;g=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(M,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),e=D(A,t),w=I(A,t),N=g(A,t);return(t.pure?J:b)(e,w,N,A,t)}var v=Object.assign||function(A){for(var M=1;M=0;I--){var g=M[I](A);if(g)return g}return function(M,I){throw new Error("Invalid value of type "+typeof A+" for "+D+" argument when connecting component "+I.wrappedComponentName+".")}}function P(A,M){return A===M}var V=function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},M=A.connectHOC,D=void 0===M?z:M,I=A.mapStateToPropsFactories,g=void 0===I?m:I,t=A.mapDispatchToPropsFactories,e=void 0===t?f:t,w=A.mergePropsFactories,N=void 0===w?H:w,i=A.selectorFactory,T=void 0===i?R:i;return function(A,M,I){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},w=t.pure,i=void 0===w||w,n=t.areStatesEqual,c=void 0===n?P:n,E=t.areOwnPropsEqual,j=void 0===E?L:E,y=t.areStatePropsEqual,o=void 0===y?L:y,u=t.areMergedPropsEqual,r=void 0===u?L:u,C=function(A,M){var D={};for(var I in A)M.indexOf(I)>=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(t,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),Q=W(A,g,"mapStateToProps"),z=W(M,e,"mapDispatchToProps"),B=W(I,N,"mergeProps");return D(T,v({methodName:"connect",getDisplayName:function(A){return"Connect("+A+")"},shouldHandleStateChanges:Boolean(A),initMapStateToProps:Q,initMapDispatchToProps:z,initMergeProps:B,pure:i,areStatesEqual:c,areOwnPropsEqual:j,areStatePropsEqual:o,areMergedPropsEqual:r},C))}}();D.d(M,"Provider",function(){return i}),D.d(M,"createProvider",function(){return N}),D.d(M,"connectAdvanced",function(){return z}),D.d(M,"connect",function(){return V})},function(A,M,D){var I=D(20),g=D(218),t=D(22),e=D(42),w=Object.defineProperty;M.f=I?w:function(A,M,D){if(t(A),M=e(M,!0),t(D),g)try{return w(A,M,D)}catch(A){}if("get"in D||"set"in D)throw TypeError("Accessors not supported");return"value"in D&&(A[M]=D.value),A}},function(A,M,D){A.exports=!D(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(A,M,D){"use strict";A.exports=function(A){var M=[];return M.toString=function(){return this.map(function(M){var D=function(A,M){var D=A[1]||"",I=A[3];if(!I)return D;if(M&&"function"==typeof btoa){var g=function(A){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(A))))+" */"}(I),t=I.sources.map(function(A){return"/*# sourceURL="+I.sourceRoot+A+" */"});return[D].concat(t).concat([g]).join("\n")}return[D].join("\n")}(M,A);return M[2]?"@media "+M[2]+"{"+D+"}":D}).join("")},M.i=function(A,D){"string"==typeof A&&(A=[[null,A,""]]);for(var I={},g=0;g0){for(M=1,D=1;MvA&&(vA=bA,WA=[]),WA.push(A))}function DM(A,M,D){return new y(y.buildMessage(A,M),A,M,D)}function IM(){return gM()}function gM(){var A,M;for(A=[],M=tM();M!==I;)A.push(M),M=tM();return A}function tM(){var M;return(M=function(){var A,M;return A=bA,(M=eM())!==I&&(JA=A,M=N(M)),A=M}())===I&&(M=function(){var M,D,g,t;return PA++,M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(125===A.charCodeAt(bA)?(t=c,bA++):(t=I,0===PA&&MM(E)),t!==I?(JA=M,D=o(g),M=D):(bA=M,M=I)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(i)),M}())===I&&(M=function(){var M;return(M=function(){var M,D,g,t,e,w,N,i,j;return M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I&&oM()!==I?(A.substr(bA,6)===d?(e=d,bA+=6):(e=I,0===PA&&MM(F)),e!==I&&oM()!==I?(w=bA,44===A.charCodeAt(bA)?(N=l,bA++):(N=I,0===PA&&MM(h)),N!==I&&(i=oM())!==I&&(j=function(){var M,D,g;return M=bA,A.substr(bA,2)===Y?(D=Y,bA+=2):(D=I,0===PA&&MM(S)),D!==I&&(g=function(){var A,M,D;if(A=bA,M=[],(D=iM())!==I)for(;D!==I;)M.push(D),D=iM();else M=I;return M!==I&&(JA=A,M=O(M)),A=M}())!==I?(JA=M,D=k(g),M=D):(bA=M,M=I),M===I&&(M=bA,(D=eM())!==I&&(JA=M,D=U(D)),M=D),M}())!==I?w=N=[N,i,j]:(bA=w,w=I),w===I&&(w=null),w!==I&&(N=oM())!==I?(125===A.charCodeAt(bA)?(i=c,bA++):(i=I,0===PA&&MM(E)),i!==I?(JA=M,D=f(g,e,w),M=D):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j;return M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I&&oM()!==I?(A.substr(bA,4)===P?(e=P,bA+=4):(e=I,0===PA&&MM(V)),e===I&&(A.substr(bA,4)===X?(e=X,bA+=4):(e=I,0===PA&&MM(Z))),e!==I&&oM()!==I?(w=bA,44===A.charCodeAt(bA)?(N=l,bA++):(N=I,0===PA&&MM(h)),N!==I&&(i=oM())!==I&&(j=function(){var M,D,g;return M=bA,A.substr(bA,2)===Y?(D=Y,bA+=2):(D=I,0===PA&&MM(S)),D!==I&&(g=function(){var M,D,g,t;if(M=bA,D=bA,g=[],(t=TM())===I&&(t=nM()),t!==I)for(;t!==I;)g.push(t),(t=TM())===I&&(t=nM());else g=I;return(D=g!==I?A.substring(D,bA):g)!==I&&(JA=M,D=W(D)),M=D}())!==I?(JA=M,D=k(g),M=D):(bA=M,M=I),M===I&&(M=bA,(D=eM())!==I&&(JA=M,D=U(D)),M=D),M}())!==I?w=N=[N,i,j]:(bA=w,w=I),w===I&&(w=null),w!==I&&(N=oM())!==I?(125===A.charCodeAt(bA)?(i=c,bA++):(i=I,0===PA&&MM(E)),i!==I?(JA=M,D=f(g,e,w),M=D):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}()),M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j,y,o;if(M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I)if(oM()!==I)if((g=zM())!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I)if(oM()!==I)if(A.substr(bA,6)===K?(e=K,bA+=6):(e=I,0===PA&&MM(_)),e===I&&(A.substr(bA,13)===q?(e=q,bA+=13):(e=I,0===PA&&MM($))),e!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(w=l,bA++):(w=I,0===PA&&MM(h)),w!==I)if(oM()!==I)if(N=bA,A.substr(bA,7)===AA?(i=AA,bA+=7):(i=I,0===PA&&MM(MA)),i!==I&&(j=oM())!==I&&(y=uM())!==I?N=i=[i,j,y]:(bA=N,N=I),N===I&&(N=null),N!==I)if((i=oM())!==I){if(j=[],(y=EM())!==I)for(;y!==I;)j.push(y),y=EM();else j=I;j!==I&&(y=oM())!==I?(125===A.charCodeAt(bA)?(o=c,bA++):(o=I,0===PA&&MM(E)),o!==I?(JA=M,D=DA(g,e,N,j),M=D):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;return M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j;if(M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I)if(oM()!==I)if((g=zM())!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I)if(oM()!==I)if(A.substr(bA,6)===IA?(e=IA,bA+=6):(e=I,0===PA&&MM(gA)),e!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(w=l,bA++):(w=I,0===PA&&MM(h)),w!==I)if(oM()!==I){if(N=[],(i=cM())!==I)for(;i!==I;)N.push(i),i=cM();else N=I;N!==I&&(i=oM())!==I?(125===A.charCodeAt(bA)?(j=c,bA++):(j=I,0===PA&&MM(E)),j!==I?(JA=M,D=tA(g,N),M=D):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;return M}()),M}function eM(){var A,M,D;if(A=bA,M=[],(D=rM())===I&&(D=CM())===I&&(D=QM()),D!==I)for(;D!==I;)M.push(D),(D=rM())===I&&(D=CM())===I&&(D=QM());else M=I;return M!==I&&(JA=A,M=w(M)),A=M}function wM(){var M,D,g,t,e;if(PA++,M=bA,D=[],g=bA,t=bA,PA++,(e=jM())===I&&(r.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(C))),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I),g!==I)for(;g!==I;)D.push(g),g=bA,t=bA,PA++,(e=jM())===I&&(r.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(C))),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I);else D=I;return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(u)),M}function NM(){var M,D,g;return PA++,M=bA,47===A.charCodeAt(bA)?(D=B,bA++):(D=I,0===PA&&MM(a)),D!==I&&(g=wM())!==I?(JA=M,M=D=L(g)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(z)),M}function iM(){var A,M,D,g;if(PA++,A=bA,oM()!==I)if((M=wM())!==I){for(D=[],g=NM();g!==I;)D.push(g),g=NM();D!==I?(JA=A,A=x(M,D)):(bA=A,A=I)}else bA=A,A=I;else bA=A,A=I;return PA--,A===I&&0===PA&&MM(s),A}function TM(){var M,D,g,t;if(M=bA,39===A.charCodeAt(bA)?(D=m,bA++):(D=I,0===PA&&MM(p)),D!==I){if(g=[],(t=rM())===I&&(G.test(A.charAt(bA))?(t=A.charAt(bA),bA++):(t=I,0===PA&&MM(H))),t!==I)for(;t!==I;)g.push(t),(t=rM())===I&&(G.test(A.charAt(bA))?(t=A.charAt(bA),bA++):(t=I,0===PA&&MM(H)));else g=I;g!==I?(39===A.charCodeAt(bA)?(t=m,bA++):(t=I,0===PA&&MM(p)),t!==I?M=D=[D,g,t]:(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;if(M===I)if(M=[],(D=rM())===I&&(b.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(J))),D!==I)for(;D!==I;)M.push(D),(D=rM())===I&&(b.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(J)));else M=I;return M}function nM(){var M,D;if(M=[],R.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(v)),D!==I)for(;D!==I;)M.push(D),R.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(v));else M=I;return M}function cM(){var M,D,g,t,e;return M=bA,oM()!==I&&(D=aM())!==I&&oM()!==I?(123===A.charCodeAt(bA)?(g=T,bA++):(g=I,0===PA&&MM(n)),g!==I&&(t=gM())!==I?(125===A.charCodeAt(bA)?(e=c,bA++):(e=I,0===PA&&MM(E)),e!==I?(JA=M,M=NA(D,t)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}function EM(){var M,D,g,t,e;return M=bA,oM()!==I&&(D=function(){var M,D,g,t;return M=bA,D=bA,61===A.charCodeAt(bA)?(g=eA,bA++):(g=I,0===PA&&MM(wA)),g!==I&&(t=uM())!==I?D=g=[g,t]:(bA=D,D=I),(M=D!==I?A.substring(M,bA):D)===I&&(M=aM()),M}())!==I&&oM()!==I?(123===A.charCodeAt(bA)?(g=T,bA++):(g=I,0===PA&&MM(n)),g!==I&&(t=gM())!==I?(125===A.charCodeAt(bA)?(e=c,bA++):(e=I,0===PA&&MM(E)),e!==I?(JA=M,M=iA(D,t)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}function jM(){var M;return PA++,nA.test(A.charAt(bA))?(M=A.charAt(bA),bA++):(M=I,0===PA&&MM(cA)),PA--,M===I&&0===PA&&MM(TA),M}function yM(){var M;return PA++,jA.test(A.charAt(bA))?(M=A.charAt(bA),bA++):(M=I,0===PA&&MM(yA)),PA--,M===I&&0===PA&&MM(EA),M}function oM(){var M,D,g;for(PA++,M=bA,D=[],g=jM();g!==I;)D.push(g),g=jM();return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(oA)),M}function uM(){var M,D,g;return PA++,M=bA,45===A.charCodeAt(bA)?(D=rA,bA++):(D=I,0===PA&&MM(CA)),D===I&&(D=null),D!==I&&(g=BM())!==I?(JA=M,M=D=QA(D,g)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(uA)),M}function rM(){var M,D;return PA++,M=bA,A.substr(bA,2)===BA?(D=BA,bA+=2):(D=I,0===PA&&MM(aA)),D!==I&&(JA=M,D=LA()),PA--,(M=D)===I&&(D=I,0===PA&&MM(zA)),M}function CM(){var M,D,g,t,e,w;if(M=bA,39===A.charCodeAt(bA)?(D=m,bA++):(D=I,0===PA&&MM(p)),D!==I)if(sA.test(A.charAt(bA))?(g=A.charAt(bA),bA++):(g=I,0===PA&&MM(xA)),g!==I){for(t=bA,e=[],A.substr(bA,2)===BA?(w=BA,bA+=2):(w=I,0===PA&&MM(aA)),w===I&&(G.test(A.charAt(bA))?(w=A.charAt(bA),bA++):(w=I,0===PA&&MM(H)));w!==I;)e.push(w),A.substr(bA,2)===BA?(w=BA,bA+=2):(w=I,0===PA&&MM(aA)),w===I&&(G.test(A.charAt(bA))?(w=A.charAt(bA),bA++):(w=I,0===PA&&MM(H)));(t=e!==I?A.substring(t,bA):e)!==I?(39===A.charCodeAt(bA)?(e=m,bA++):(e=I,0===PA&&MM(p)),e!==I?(JA=M,M=D=OA(g,t)):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;return M}function QM(){var M,D;return M=bA,YA.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(SA)),M=D!==I?A.substring(M,bA):D}function zM(){var M,D;return PA++,M=bA,(D=BM())===I&&(D=aM()),M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(kA)),M}function BM(){var M,D,g,t,e;if(PA++,M=bA,48===A.charCodeAt(bA)?(D=lA,bA++):(D=I,0===PA&&MM(hA)),D!==I&&(JA=M,D=dA()),(M=D)===I){if(M=bA,D=bA,FA.test(A.charAt(bA))?(g=A.charAt(bA),bA++):(g=I,0===PA&&MM(fA)),g!==I){for(t=[],mA.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(pA));e!==I;)t.push(e),mA.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(pA));t!==I?D=g=[g,t]:(bA=D,D=I)}else bA=D,D=I;D!==I&&(JA=M,D=GA(D)),M=D}return PA--,M===I&&(D=I,0===PA&&MM(UA)),M}function aM(){var M,D,g,t,e;if(PA++,M=bA,D=[],g=bA,t=bA,PA++,(e=jM())===I&&(e=yM()),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I),g!==I)for(;g!==I;)D.push(g),g=bA,t=bA,PA++,(e=jM())===I&&(e=yM()),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I);else D=I;return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(HA)),M}function LM(){return M&&M.captureLocation?{location:XA()}:{}}if((D=e())!==I&&bA===A.length)return D;throw D!==I&&bA(.*?)<\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\/>)/,F=Date.now()+"@@",f=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function m(A,M,D,I,g,t){var e={},w=S(A,M,D,I,g,void 0,t).reduce(function(A,M){if(0===M.type)return A+M.value;var D=Date.now()+"_"+ ++l;return e[D]=M.value,A+""+k+D+k},"");if(!d.test(w))return h(w,e);if(!g)throw new Y("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new Y("Cannot format XML message without DOMParser");B||(B=new DOMParser);var N=B.parseFromString(''+w+"","text/html").getElementById(F);if(!N)throw new Y("Malformed HTML message "+w);var i=Object.keys(g).filter(function(A){return!!N.getElementsByTagName(A).length});if(!i.length)return h(w,e);var T=i.filter(function(A){return A!==A.toLowerCase()});if(T.length)throw new Y("HTML tag must be lowercased but the following tags are not: "+T.join(", "));return Array.prototype.slice.call(N.childNodes).reduce(function(A,M){return A.concat(function A(M,D,I){var g=M.tagName,t=M.outerHTML,e=M.textContent,w=M.childNodes;if(!g)return h(e||"",D);g=g.toLowerCase();var N=~f.indexOf(g),i=I[g];if(i&&N)throw new Y(g+" is a self-closing tag and can not be used, please use another tag name.");if(!w.length)return[t];var T=Array.prototype.slice.call(w).reduce(function(M,g){return M.concat(A(g,D,I))},[]);return i?"function"==typeof i?[i.apply(void 0,T)]:[i]:s(["<"+g+">"],T,[""])}(M,e,g))},[])}var p=function(){return(p=Object.assign||function(A){for(var M,D=1,I=arguments.length;D<"']/g;function X(A,M,D={}){return M.reduce((M,I)=>(A.hasOwnProperty(I)?M[I]=A[I]:D.hasOwnProperty(I)&&(M[I]=D[I]),M),{})}function Z(A){W(A,"[React Intl] Could not find required `intl` object. needs to exist in the component ancestry.")}function K(A,M){return`[React Intl] ${A}${M?`\n${M.stack}`:""}`}const _={formats:{},messages:{},timeZone:void 0,textComponent:t.Fragment,defaultLocale:"en",defaultFormats:{},onError:function(A){}};function q(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}}}function $(A={dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}}){const M=Intl.RelativeTimeFormat;return{getDateTimeFormat:a(Intl.DateTimeFormat,A.dateTime),getNumberFormat:a(Intl.NumberFormat,A.number),getMessageFormat:a(J,A.message),getRelativeTimeFormat:a(M,A.relativeTime),getPluralRules:a(Intl.PluralRules,A.pluralRules)}}function AA(A,M,D,I){const g=A&&A[M];let t;if(g&&(t=g[D]),t)return t;I(K(`No ${M} format named: ${D}`))}var MA=D(78);const DA=D.n(MA).a||MA;const IA=t.createContext(null),{Consumer:gA,Provider:tA}=IA,eA=tA,wA=IA;function NA(A,M){const{intlPropName:D="intl",forwardRef:I=!1,enforceContext:g=!0}=M||{},e=M=>t.createElement(gA,null,e=>(g&&Z(e),t.createElement(A,Object.assign({},M,{[D]:e},{ref:I?M.forwardedRef:null}))));return e.displayName=`injectIntl(${function(A){return A.displayName||A.name||"Component"}(A)})`,e.WrappedComponent=A,DA(I?t.forwardRef((A,M)=>t.createElement(e,Object.assign({},A,{forwardedRef:M}))):e,A)}var iA,TA,nA=function(A,M){var D={};for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&M.indexOf(I)<0&&(D[I]=A[I]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var g=0;for(I=Object.getOwnPropertySymbols(A);gt.createElement(wA.Consumer,null,M=>{Z(M);const{value:D,children:I}=A,g=nA(A,["value","children"]);return I(M.formatNumberToParts(D,g))});function EA(A){const M=M=>t.createElement(wA.Consumer,null,D=>{Z(D);const{value:I,children:g}=M,t=nA(M,["value","children"]),e="string"==typeof I?new Date(I||0):I;return g("formatDate"===A?D.formatDateToParts(e,t):D.formatTimeToParts(e,t))});return M.displayName=TA[A],M}function jA(A){const M=M=>t.createElement(wA.Consumer,null,D=>{Z(D);const{value:I,children:g}=M,e=nA(M,["value","children"]),w=D[A](I,e);if("function"==typeof g)return g(w);const N=D.textComponent||t.Fragment;return t.createElement(N,null,w)});return M.displayName=iA[A],M}function yA(){const A=Object(t.useContext)(wA);return Z(A),A}cA.displayName="FormattedNumberParts";const oA=["localeMatcher","style","currency","currencyDisplay","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay"];function uA({locale:A,formats:M,onError:D},I,g={}){const{format:t}=g;let e=t&&AA(M,"number",t,D)||{};return I(A,X(g,oA,e))}const rA=["numeric","style"];function CA(A,M,D,I,g={}){I||(I="second"),Intl.RelativeTimeFormat||A.onError(K('Intl.RelativeTimeFormat is not available in this environment.\nTry polyfilling it using "@formatjs/intl-relativetimeformat"\n'));try{return function({locale:A,formats:M,onError:D},I,g={}){const{format:t}=g,e=!!t&&AA(M,"relative",t,D)||{};return I(A,X(g,rA,e))}(A,M,g).format(D,I)}catch(M){A.onError(K("Error formatting relative time.",M))}return String(D)}const QA=["localeMatcher","formatMatcher","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function zA({locale:A,formats:M,onError:D,timeZone:I},g,t,e={}){const{format:w}=e;let N=Object.assign({},I&&{timeZone:I},w&&AA(M,g,w,D)),i=X(e,QA,N);return"time"!==g||i.hour||i.minute||i.second||(i=Object.assign({},i,{hour:"numeric",minute:"numeric"})),t(A,i)}const BA=["localeMatcher","type"];const aA=v.a||R;function LA(A,M){return Object.keys(A).reduce((D,I)=>(D[I]=Object.assign({timeZone:M},A[I]),D),{})}function sA(A,M){return Object.keys(Object.assign({},A,M)).reduce((D,I)=>(D[I]=Object.assign({},A[I]||{},M[I]||{}),D),{})}function xA(A,M){if(!M)return A;const D=J.formats;return Object.assign({},D,A,{date:sA(LA(D.date,M),LA(A.date||{},M)),time:sA(LA(D.time,M),LA(A.time||{},M))})}function OA({locale:A,formats:M,messages:D,defaultLocale:I,defaultFormats:g,onError:t,timeZone:e},w,N={id:""},i={}){const{id:T,defaultMessage:n}=N;aA(T,"[React Intl] An `id` must be provided to format a message.");const c=D&&D[T];M=xA(M,e),g=xA(g,e);let E=[];if(c)try{E=w.getMessageFormat(c,A,M,{formatters:w}).formatHTMLMessage(i)}catch(M){t(K(`Error formatting message: "${T}" for locale: "${A}"`+(n?", using default message as fallback.":""),M))}else(!n||A&&A.toLowerCase()!==I.toLowerCase())&&t(K(`Missing message: "${T}" for locale: "${A}"`+(n?", using default message as fallback.":"")));if(!E.length&&n)try{E=w.getMessageFormat(n,I,g).formatHTMLMessage(i)}catch(A){t(K(`Error formatting the default message for: "${T}"`,A))}return E.length?1===E.length&&"string"==typeof E[0]?E[0]||n||T:E:(t(K(`Cannot format message: "${T}", `+`using message ${c||n?"source":"id"} as fallback.`)),"string"==typeof c?c||n||T:n||T)}function YA(A,M,D={id:""},I={}){return OA(A,M,D,Object.keys(I).reduce((A,M)=>{let D=I[M];return A[M]="string"==typeof D?function(A){return(""+A).replace(V,A=>P[A.charCodeAt(0)])}(D):D,A},{}))}var SA=D(27),kA=D.n(SA);const UA=kA.a||SA;function lA(A){return{locale:A.locale,timeZone:A.timeZone,formats:A.formats,textComponent:A.textComponent,messages:A.messages,defaultLocale:A.defaultLocale,defaultFormats:A.defaultFormats,onError:A.onError}}class hA extends t.PureComponent{constructor(){super(...arguments),this.cache={dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}},this.state={cache:this.cache,intl:dA(lA(this.props),this.cache),prevConfig:lA(this.props)}}static getDerivedStateFromProps(A,{prevConfig:M,cache:D}){const I=lA(A);return UA(M,I)?null:{intl:dA(I,D),prevConfig:I}}render(){return Z(this.state.intl),t.createElement(eA,{value:this.state.intl},this.props.children)}}function dA(A,M){const D=$(M),I=Object.assign({},_,A);if(!I.locale||!function(A,M){if("undefined"==typeof Intl)return!1;if(!A)throw new Error("locales must be supplied.");Array.isArray(A)||(A=[A]);var D=M||[Intl.DateTimeFormat,Intl.NumberFormat,Intl.PluralRules];return!(0===(D=D.filter(Boolean)).length||M&&D.length!==M.length)&&D.every(function(M){return M.supportedLocalesOf(A).length===A.length})}(I.locale)){const{locale:A,defaultLocale:M,onError:D}=I;"function"==typeof D&&D(K(`Missing locale data for locale: "${A}". `+`Using default locale: "${M}" as fallback.`)),I.locale=I.defaultLocale||"en"}return Object.assign({},I,{formatters:D,formatNumber:function(A,M,D,I={}){try{return uA(A,M,I).format(D)}catch(M){A.onError(K("Error formatting number.",M))}return String(D)}.bind(null,I,D.getNumberFormat),formatNumberToParts:function(A,M,D,I={}){try{return uA(A,M,I).formatToParts(D)}catch(M){A.onError(K("Error formatting number.",M))}return[]}.bind(null,I,D.getNumberFormat),formatRelativeTime:CA.bind(null,I,D.getRelativeTimeFormat),formatDate:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"date",M,I).format(g)}catch(M){A.onError(K("Error formatting date.",M))}return String(g)}.bind(null,I,D.getDateTimeFormat),formatDateToParts:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"date",M,I).formatToParts(g)}catch(M){A.onError(K("Error formatting date.",M))}return[]}.bind(null,I,D.getDateTimeFormat),formatTime:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"time",M,I).format(g)}catch(M){A.onError(K("Error formatting time.",M))}return String(g)}.bind(null,I,D.getDateTimeFormat),formatTimeToParts:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"time",M,I).formatToParts(g)}catch(M){A.onError(K("Error formatting time.",M))}return[]}.bind(null,I,D.getDateTimeFormat),formatPlural:function({locale:A,onError:M},D,I,g={}){Intl.PluralRules||M(K('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n'));let t=X(g,BA);try{return D(A,t).select(I)}catch(A){M(K("Error formatting plural.",A))}return"other"}.bind(null,I,D.getPluralRules),formatMessage:OA.bind(null,I,D),formatHTMLMessage:YA.bind(null,I,D)})}hA.displayName="IntlProvider",hA.defaultProps=_;const FA=v.a||R,fA=60,mA=3600,pA=86400;function GA(A){const M=Math.abs(A);return M=D?e-t:e,N=Math.abs(w-D);this._updateTimer=setTimeout(()=>this.setState({currentValueInSeconds:w}),1e3*N)}componentDidMount(){this.scheduleNextUpdate(this.props,this.state)}componentDidUpdate(){this.scheduleNextUpdate(this.props,this.state)}componentWillUnmount(){clearTimeout(this._updateTimer),this._updateTimer=null}static getDerivedStateFromProps(A,M){return A.unit!==M.prevUnit||A.value!==M.prevValue?{prevValue:A.value,prevUnit:A.unit,currentValueInSeconds:RA(A.unit)?bA(A.value,A.unit):0}:null}render(){return t.createElement(wA.Consumer,null,A=>{Z(A);const{formatRelativeTime:M,textComponent:D}=A,{children:I,value:g,unit:e,updateIntervalInSeconds:w}=this.props,{currentValueInSeconds:N}=this.state;let i=g||0,T=e;if(RA(e)&&null!=N&&w){const A=HA(T=GA(N));i=Math.round(N/A)}const n=M(i,T,Object.assign({},this.props));return"function"==typeof I?I(n):D?t.createElement(D,null,n):n})}}vA.displayName="FormattedRelativeTime",vA.defaultProps={value:0,unit:"second"};var WA=vA;const PA=A=>{const{value:M,other:D,children:I,intl:{formatPlural:g,textComponent:e}}=A;let w=A[g(M,A)]||D;return"function"==typeof I?I(w):e?t.createElement(e,null,w):w};PA.defaultProps={type:"cardinal"},PA.displayName="FormattedPlural";var VA=NA(PA),XA=function(A,M){var D={};for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&M.indexOf(I)<0&&(D[I]=A[I]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var g=0;for(I=Object.getOwnPropertySymbols(A);gOA(Object.assign({},_,{locale:"en"}),$(),A,M);class _A extends t.Component{shouldComponentUpdate(A){const M=this.props,{values:D}=M,I=XA(M,["values"]),{values:g}=A,t=XA(A,["values"]);return!ZA(g,D)||!ZA(I,t)}render(){return t.createElement(wA.Consumer,null,A=>{this.props.defaultMessage||Z(A);const{formatMessage:M=KA,textComponent:D=t.Fragment}=A||{},{id:I,description:g,defaultMessage:e,values:w,children:N,tagName:i=D}=this.props;let T=M({id:I,description:g,defaultMessage:e},w);return Array.isArray(T)||(T=[T]),"function"==typeof N?N(...T):i?t.createElement(i,null,...T):T})}}_A.displayName="FormattedMessage",_A.defaultProps={values:{}};var qA=_A;class $A extends qA{render(){return t.createElement(wA.Consumer,null,A=>{this.props.defaultMessage||Z(A);const{formatHTMLMessage:M,textComponent:D}=A,{id:I,description:g,defaultMessage:e,values:w,children:N}=this.props;let{tagName:i}=this.props;i||(i=D||"span");let T=M({id:I,description:g,defaultMessage:e},w);if("function"==typeof N)return N(T);const n={__html:T};return t.createElement(i,{dangerouslySetInnerHTML:n})})}}$A.displayName="FormattedHTMLMessage",$A.defaultProps=Object.assign({},qA.defaultProps,{tagName:"span"});var AM=$A;D.d(M,"FormattedDate",function(){return MM}),D.d(M,"FormattedTime",function(){return DM}),D.d(M,"FormattedNumber",function(){return IM}),D.d(M,"FormattedDateParts",function(){return gM}),D.d(M,"FormattedTimeParts",function(){return tM}),D.d(M,"defineMessages",function(){return I}),D.d(M,"injectIntl",function(){return NA}),D.d(M,"RawIntlProvider",function(){return eA}),D.d(M,"IntlContext",function(){return wA}),D.d(M,"useIntl",function(){return yA}),D.d(M,"IntlProvider",function(){return hA}),D.d(M,"createIntl",function(){return dA}),D.d(M,"FormattedNumberParts",function(){return cA}),D.d(M,"FormattedRelativeTime",function(){return WA}),D.d(M,"FormattedPlural",function(){return VA}),D.d(M,"FormattedMessage",function(){return qA}),D.d(M,"FormattedHTMLMessage",function(){return AM}),D.d(M,"createIntlCache",function(){return q});const MM=jA("formatDate"),DM=jA("formatTime"),IM=jA("formatNumber"),gM=EA("formatDate"),tM=EA("formatTime")},function(A,M,D){"use strict";function I(A,M){A.prototype=Object.create(M.prototype),A.prototype.constructor=A,A.__proto__=M}D.r(M);var g=D(1),t=D.n(g);D(247);function e(){return(e=Object.assign||function(A){for(var M=1;M=0;c--){var E=g[c];"."===E?N(g,c):".."===E?(N(g,c),n++):n&&(N(g,c),n--)}if(!i)for(;n--;n)g.unshift("..");!i||""===g[0]||g[0]&&w(g[0])||g.unshift("");var j=g.join("/");return D&&"/"!==j.substr(-1)&&(j+="/"),j};function T(A){return A.valueOf?A.valueOf():Object.prototype.valueOf.call(A)}var n=function A(M,D){if(M===D)return!0;if(null==M||null==D)return!1;if(Array.isArray(M))return Array.isArray(D)&&M.length===D.length&&M.every(function(M,I){return A(M,D[I])});if("object"==typeof M||"object"==typeof D){var I=T(M),g=T(D);return I!==M||g!==D?A(I,g):Object.keys(Object.assign({},M,D)).every(function(I){return A(M[I],D[I])})}return!1},c=!0,E="Invariant failed";var j=function(A,M){if(!A)throw c?new Error(E):new Error(E+": "+(M||""))};function y(A){return"/"===A.charAt(0)?A:"/"+A}function o(A){return"/"===A.charAt(0)?A.substr(1):A}function u(A,M){return function(A,M){return 0===A.toLowerCase().indexOf(M.toLowerCase())&&-1!=="/?#".indexOf(A.charAt(M.length))}(A,M)?A.substr(M.length):A}function r(A){return"/"===A.charAt(A.length-1)?A.slice(0,-1):A}function C(A){var M=A.pathname,D=A.search,I=A.hash,g=M||"/";return D&&"?"!==D&&(g+="?"===D.charAt(0)?D:"?"+D),I&&"#"!==I&&(g+="#"===I.charAt(0)?I:"#"+I),g}function Q(A,M,D,I){var g;"string"==typeof A?(g=function(A){var M=A||"/",D="",I="",g=M.indexOf("#");-1!==g&&(I=M.substr(g),M=M.substr(0,g));var t=M.indexOf("?");return-1!==t&&(D=M.substr(t),M=M.substr(0,t)),{pathname:M,search:"?"===D?"":D,hash:"#"===I?"":I}}(A)).state=M:(void 0===(g=e({},A)).pathname&&(g.pathname=""),g.search?"?"!==g.search.charAt(0)&&(g.search="?"+g.search):g.search="",g.hash?"#"!==g.hash.charAt(0)&&(g.hash="#"+g.hash):g.hash="",void 0!==M&&void 0===g.state&&(g.state=M));try{g.pathname=decodeURI(g.pathname)}catch(A){throw A instanceof URIError?new URIError('Pathname "'+g.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):A}return D&&(g.key=D),I?g.pathname?"/"!==g.pathname.charAt(0)&&(g.pathname=i(g.pathname,I.pathname)):g.pathname=I.pathname:g.pathname||(g.pathname="/"),g}function z(){var A=null;var M=[];return{setPrompt:function(M){return A=M,function(){A===M&&(A=null)}},confirmTransitionTo:function(M,D,I,g){if(null!=A){var t="function"==typeof A?A(M,D):A;"string"==typeof t?"function"==typeof I?I(t,g):g(!0):g(!1!==t)}else g(!0)},appendListener:function(A){var D=!0;function I(){D&&A.apply(void 0,arguments)}return M.push(I),function(){D=!1,M=M.filter(function(A){return A!==I})}},notifyListeners:function(){for(var A=arguments.length,D=new Array(A),I=0;I=0||(g[D]=A[D]);return g}var V=D(237),X=D.n(V),Z=function(A){var M=J();return M.displayName=A,M}("Router"),K=function(A){function M(M){var D;return(D=A.call(this,M)||this).state={location:M.history.location},D._isMounted=!1,D._pendingLocation=null,M.staticContext||(D.unlisten=M.history.listen(function(A){D._isMounted?D.setState({location:A}):D._pendingLocation=A})),D}I(M,A),M.computeRootMatch=function(A){return{path:"/",url:"/",params:{},isExact:"/"===A}};var D=M.prototype;return D.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},D.componentWillUnmount=function(){this.unlisten&&this.unlisten()},D.render=function(){return t.a.createElement(Z.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:M.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},M}(t.a.Component);var _=function(A){function M(){for(var M,D=arguments.length,I=new Array(D),g=0;gM?D.splice(M,D.length-M,I):D.push(I),n({action:"PUSH",location:I,index:M,entries:D})}})},replace:function(A,M){var I=Q(A,M,c(),u.location);T.confirmTransitionTo(I,"REPLACE",D,function(A){A&&(u.entries[u.index]=I,n({action:"REPLACE",location:I}))})},go:o,goBack:function(){o(-1)},goForward:function(){o(1)},canGo:function(A){var M=u.index+A;return M>=0&&M=0||(g[D]=A[D]);return g}D.d(M,"BrowserRouter",function(){return sA}),D.d(M,"HashRouter",function(){return xA}),D.d(M,"Link",function(){return lA}),D.d(M,"NavLink",function(){return FA}),D.d(M,"MemoryRouter",function(){return _}),D.d(M,"Prompt",function(){return $}),D.d(M,"Redirect",function(){return gA}),D.d(M,"Route",function(){return iA}),D.d(M,"Router",function(){return K}),D.d(M,"StaticRouter",function(){return jA}),D.d(M,"Switch",function(){return yA}),D.d(M,"__RouterContext",function(){return Z}),D.d(M,"generatePath",function(){return IA}),D.d(M,"matchPath",function(){return NA}),D.d(M,"useHistory",function(){return rA}),D.d(M,"useLocation",function(){return CA}),D.d(M,"useParams",function(){return QA}),D.d(M,"useRouteMatch",function(){return zA}),D.d(M,"withRouter",function(){return oA});var sA=function(A){function M(){for(var M,D=arguments.length,I=new Array(D),g=0;g1)for(var D=1;D=8)M(j(D));else{M(C("error.passwordLength"))}}},M.handleLogin=function(A,M){return function(D){null!==A&&""!==A&&null!==M&&""!==M?Q(A,M):D(C("error.noCredentials"))}},M.authHandler=function(A,M){return function(D){var I=w.default.auth().currentUser,g=A.user.uid;localStorage.setItem("currentUser",JSON.stringify(I)),(0,T.getUserAvatar)(g).then(function(t){var e=A.user.displayName,w=A.user.email,N=t||A.user.photoURL,T={uid:g,email:w,displayName:e,avURL:N,chatkitUser:{}},n=[g,w,e],c=["uid","email","displayName"],E=n.length;D((0,i.dispatchedGenInfo)(T)),M(I,T);for(var j=0;j0?g(I(A),9007199254740991):0}},function(A,M){var D=Math.ceil,I=Math.floor;A.exports=function(A){return isNaN(A=+A)?0:(A>0?I:D)(A)}},function(A,M,D){var I=D(15);A.exports=function(A,M){if(!I(A))return A;var D,g;if(M&&"function"==typeof(D=A.toString)&&!I(g=D.call(A)))return g;if("function"==typeof(D=A.valueOf)&&!I(g=D.call(A)))return g;if(!M&&"function"==typeof(D=A.toString)&&!I(g=D.call(A)))return g;throw TypeError("Can't convert object to primitive value")}},function(A,M){A.exports=!1},function(A,M,D){"use strict";var I={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,t=g&&!I.call({1:2},1);M.f=t?function(A){var M=g(this,A);return!!M&&M.enumerable}:I},function(A,M,D){var I=D(4),g=D(16),t=D(12),e=D(59),w=D(221),N=D(46),i=N.get,T=N.enforce,n=String(w).split("toString");D(32)("inspectSource",function(A){return w.call(A)}),(A.exports=function(A,M,D,w){var N=!!w&&!!w.unsafe,i=!!w&&!!w.enumerable,c=!!w&&!!w.noTargetGet;"function"==typeof D&&("string"!=typeof M||t(D,"name")||g(D,"name",M),T(D).source=n.join("string"==typeof M?M:"")),A!==I?(N?!c&&A[M]&&(i=!0):delete A[M],i?A[M]=D:g(A,M,D)):i?A[M]=D:e(M,D)})(Function.prototype,"toString",function(){return"function"==typeof this&&i(this).source||w.call(this)})},function(A,M,D){var I,g,t,e=D(313),w=D(15),N=D(16),i=D(12),T=D(47),n=D(48),c=D(4).WeakMap;if(e){var E=new c,j=E.get,y=E.has,o=E.set;I=function(A,M){return o.call(E,A,M),M},g=function(A){return j.call(E,A)||{}},t=function(A){return y.call(E,A)}}else{var u=T("state");n[u]=!0,I=function(A,M){return N(A,u,M),M},g=function(A){return i(A,u)?A[u]:{}},t=function(A){return i(A,u)}}A.exports={set:I,get:g,has:t,enforce:function(A){return t(A)?g(A):I(A,{})},getterFor:function(A){return function(M){var D;if(!w(M)||(D=g(M)).type!==A)throw TypeError("Incompatible receiver, "+A+" required");return D}}}},function(A,M,D){var I=D(32)("keys"),g=D(60);A.exports=function(A){return I[A]||(I[A]=g(A))}},function(A,M){A.exports={}},function(A,M){M.f=Object.getOwnPropertySymbols},function(A,M,D){var I=D(223),g=D(63);A.exports=Object.keys||function(A){return I(A,g)}},function(A,M,D){var I=D(4),g=D(216),t=Function.call;A.exports=function(A,M,D){return g(t,I[A].prototype[M],D)}},function(A,M,D){A.exports=D(379)},,function(A,M,D){"use strict";A.exports=D(255)},function(A,M,D){"use strict";A.exports=function(A,M){return"string"!=typeof A?A:(/^['"].*['"]$/.test(A)&&(A=A.slice(1,-1)),/["'() \t\n]/.test(A)||M?'"'+A.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':A)}},function(A,M,D){"use strict";D(214);var I=function(A){return A&&"object"==typeof A&&"default"in A?A.default:A}(D(2)); + */,M.validateNamespace=function(A,M,D,I){if((!I||D)&&"string"!=typeof D)throw new Error(s(A,M,I)+"must be a valid firebase namespace.")}},function(A,M){A.exports=function(A){try{return!!A()}catch(A){return!0}}},function(A,M){A.exports=function(A){return"object"==typeof A?null!==A:"function"==typeof A}},function(A,M,D){var I=D(19),g=D(33);A.exports=D(20)?function(A,M,D){return I.f(A,M,g(1,D))}:function(A,M,D){return A[M]=D,A}},function(A,M,D){var I=D(4),g=D(61).f,t=D(16),e=D(45),w=D(59),N=D(222),i=D(317);A.exports=function(A,M){var D,T,n,c,E,j=A.target,y=A.global,o=A.stat;if(D=y?I:o?I[j]||w(j,{}):(I[j]||{}).prototype)for(T in M){if(c=M[T],n=A.noTargetGet?(E=g(D,T))&&E.value:D[T],!i(y?T:j+(o?".":"#")+T,A.forced)&&void 0!==n){if(typeof c==typeof n)continue;N(c,n)}(A.sham||n&&n.sham)&&t(c,"sham",!0),e(D,T,c,A)}}},function(A,M,D){"use strict";D.r(M);var I=D(1),g=D(3),t=D.n(g),e=t.a.shape({trySubscribe:t.a.func.isRequired,tryUnsubscribe:t.a.func.isRequired,notifyNestedSubs:t.a.func.isRequired,isSubscribed:t.a.func.isRequired}),w=t.a.shape({subscribe:t.a.func.isRequired,dispatch:t.a.func.isRequired,getState:t.a.func.isRequired});function N(){var A,M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",D=arguments[1]||M+"Subscription",g=function(A){function g(D,I){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,g);var t=function(A,M){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!M||"object"!=typeof M&&"function"!=typeof M?A:M}(this,A.call(this,D,I));return t[M]=D.store,t}return function(A,M){if("function"!=typeof M&&null!==M)throw new TypeError("Super expression must either be null or a function, not "+typeof M);A.prototype=Object.create(M&&M.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(A,M):A.__proto__=M)}(g,A),g.prototype.getChildContext=function(){var A;return(A={})[M]=this[M],A[D]=null,A},g.prototype.render=function(){return I.Children.only(this.props.children)},g}(I.Component);return g.propTypes={store:w.isRequired,children:t.a.element.isRequired},g.childContextTypes=((A={})[M]=w.isRequired,A[D]=e,A),g}var i=N(),T=D(239),n=D.n(T),c=D(7),E=D.n(c);var j=null,y={notify:function(){}};var o=function(){function A(M,D,I){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,A),this.store=M,this.parentSub=D,this.onStateChange=I,this.unsubscribe=null,this.listeners=y}return A.prototype.addNestedSub=function(A){return this.trySubscribe(),this.listeners.subscribe(A)},A.prototype.notifyNestedSubs=function(){this.listeners.notify()},A.prototype.isSubscribed=function(){return Boolean(this.unsubscribe)},A.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=function(){var A=[],M=[];return{clear:function(){M=j,A=j},notify:function(){for(var D=A=M,I=0;I1&&void 0!==arguments[1]?arguments[1]:{},t=g.getDisplayName,N=void 0===t?function(A){return"ConnectAdvanced("+A+")"}:t,i=g.methodName,T=void 0===i?"connectAdvanced":i,c=g.renderCountProp,j=void 0===c?void 0:c,y=g.shouldHandleStateChanges,z=void 0===y||y,B=g.storeKey,a=void 0===B?"store":B,L=g.withRef,s=void 0!==L&&L,x=function(A,M){var D={};for(var I in A)M.indexOf(I)>=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(g,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),O=a+"Subscription",Y=r++,S=((M={})[a]=w,M[O]=e,M),k=((D={})[O]=e,D);return function(M){E()("function"==typeof M,"You must pass a component to the function returned by "+T+". Instead recieved "+JSON.stringify(M));var D=M.displayName||M.name||"Component",g=N(D),t=u({},x,{getDisplayName:N,methodName:T,renderCountProp:j,shouldHandleStateChanges:z,storeKey:a,withRef:s,displayName:g,wrappedComponentName:D,WrappedComponent:M}),e=function(D){function e(A,M){!function(A,M){if(!(A instanceof M))throw new TypeError("Cannot call a class as a function")}(this,e);var I=function(A,M){if(!A)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!M||"object"!=typeof M&&"function"!=typeof M?A:M}(this,D.call(this,A,M));return I.version=Y,I.state={},I.renderCount=0,I.store=A[a]||M[a],I.propsMode=Boolean(A[a]),I.setWrappedInstance=I.setWrappedInstance.bind(I),E()(I.store,'Could not find "'+a+'" in either the context or props of "'+g+'". Either wrap the root component in a , or explicitly pass "'+a+'" as a prop to "'+g+'".'),I.initSelector(),I.initSubscription(),I}return function(A,M){if("function"!=typeof M&&null!==M)throw new TypeError("Super expression must either be null or a function, not "+typeof M);A.prototype=Object.create(M&&M.prototype,{constructor:{value:A,enumerable:!1,writable:!0,configurable:!0}}),M&&(Object.setPrototypeOf?Object.setPrototypeOf(A,M):A.__proto__=M)}(e,D),e.prototype.getChildContext=function(){var A,M=this.propsMode?null:this.subscription;return(A={})[O]=M||this.context[O],A},e.prototype.componentDidMount=function(){z&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},e.prototype.componentWillReceiveProps=function(A){this.selector.run(A)},e.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},e.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=Q,this.store=null,this.selector.run=Q,this.selector.shouldComponentUpdate=!1},e.prototype.getWrappedInstance=function(){return E()(s,"To access the wrapped instance, you need to specify { withRef: true } in the options argument of the "+T+"() call."),this.wrappedInstance},e.prototype.setWrappedInstance=function(A){this.wrappedInstance=A},e.prototype.initSelector=function(){var M=A(this.store.dispatch,t);this.selector=function(A,M){var D={run:function(I){try{var g=A(M.getState(),I);(g!==D.props||D.error)&&(D.shouldComponentUpdate=!0,D.props=g,D.error=null)}catch(A){D.shouldComponentUpdate=!0,D.error=A}}};return D}(M,this.store),this.selector.run(this.props)},e.prototype.initSubscription=function(){if(z){var A=(this.propsMode?this.props:this.context)[O];this.subscription=new o(this.store,A,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},e.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(C)):this.notifyNestedSubs()},e.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},e.prototype.isSubscribed=function(){return Boolean(this.subscription)&&this.subscription.isSubscribed()},e.prototype.addExtraProps=function(A){if(!(s||j||this.propsMode&&this.subscription))return A;var M=u({},A);return s&&(M.ref=this.setWrappedInstance),j&&(M[j]=this.renderCount++),this.propsMode&&this.subscription&&(M[O]=this.subscription),M},e.prototype.render=function(){var A=this.selector;if(A.shouldComponentUpdate=!1,A.error)throw A.error;return Object(I.createElement)(M,this.addExtraProps(A.props))},e}(I.Component);return e.WrappedComponent=M,e.displayName=g,e.childContextTypes=k,e.contextTypes=S,e.propTypes=S,n()(e,M)}}var B=Object.prototype.hasOwnProperty;function a(A,M){return A===M?0!==A||0!==M||1/A==1/M:A!=A&&M!=M}function L(A,M){if(a(A,M))return!0;if("object"!=typeof A||null===A||"object"!=typeof M||null===M)return!1;var D=Object.keys(A),I=Object.keys(M);if(D.length!==I.length)return!1;for(var g=0;g=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(M,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),e=D(A,t),w=I(A,t),N=g(A,t);return(t.pure?J:b)(e,w,N,A,t)}var v=Object.assign||function(A){for(var M=1;M=0;I--){var g=M[I](A);if(g)return g}return function(M,I){throw new Error("Invalid value of type "+typeof A+" for "+D+" argument when connecting component "+I.wrappedComponentName+".")}}function P(A,M){return A===M}var V=function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},M=A.connectHOC,D=void 0===M?z:M,I=A.mapStateToPropsFactories,g=void 0===I?m:I,t=A.mapDispatchToPropsFactories,e=void 0===t?f:t,w=A.mergePropsFactories,N=void 0===w?H:w,i=A.selectorFactory,T=void 0===i?R:i;return function(A,M,I){var t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},w=t.pure,i=void 0===w||w,n=t.areStatesEqual,c=void 0===n?P:n,E=t.areOwnPropsEqual,j=void 0===E?L:E,y=t.areStatePropsEqual,o=void 0===y?L:y,u=t.areMergedPropsEqual,r=void 0===u?L:u,C=function(A,M){var D={};for(var I in A)M.indexOf(I)>=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D}(t,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),Q=W(A,g,"mapStateToProps"),z=W(M,e,"mapDispatchToProps"),B=W(I,N,"mergeProps");return D(T,v({methodName:"connect",getDisplayName:function(A){return"Connect("+A+")"},shouldHandleStateChanges:Boolean(A),initMapStateToProps:Q,initMapDispatchToProps:z,initMergeProps:B,pure:i,areStatesEqual:c,areOwnPropsEqual:j,areStatePropsEqual:o,areMergedPropsEqual:r},C))}}();D.d(M,"Provider",function(){return i}),D.d(M,"createProvider",function(){return N}),D.d(M,"connectAdvanced",function(){return z}),D.d(M,"connect",function(){return V})},function(A,M,D){var I=D(20),g=D(218),t=D(22),e=D(42),w=Object.defineProperty;M.f=I?w:function(A,M,D){if(t(A),M=e(M,!0),t(D),g)try{return w(A,M,D)}catch(A){}if("get"in D||"set"in D)throw TypeError("Accessors not supported");return"value"in D&&(A[M]=D.value),A}},function(A,M,D){A.exports=!D(14)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(A,M,D){"use strict";A.exports=function(A){var M=[];return M.toString=function(){return this.map(function(M){var D=function(A,M){var D=A[1]||"",I=A[3];if(!I)return D;if(M&&"function"==typeof btoa){var g=function(A){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(A))))+" */"}(I),t=I.sources.map(function(A){return"/*# sourceURL="+I.sourceRoot+A+" */"});return[D].concat(t).concat([g]).join("\n")}return[D].join("\n")}(M,A);return M[2]?"@media "+M[2]+"{"+D+"}":D}).join("")},M.i=function(A,D){"string"==typeof A&&(A=[[null,A,""]]);for(var I={},g=0;g0){for(M=1,D=1;MvA&&(vA=bA,WA=[]),WA.push(A))}function DM(A,M,D){return new y(y.buildMessage(A,M),A,M,D)}function IM(){return gM()}function gM(){var A,M;for(A=[],M=tM();M!==I;)A.push(M),M=tM();return A}function tM(){var M;return(M=function(){var A,M;return A=bA,(M=eM())!==I&&(JA=A,M=N(M)),A=M}())===I&&(M=function(){var M,D,g,t;return PA++,M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(125===A.charCodeAt(bA)?(t=c,bA++):(t=I,0===PA&&MM(E)),t!==I?(JA=M,D=o(g),M=D):(bA=M,M=I)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(i)),M}())===I&&(M=function(){var M;return(M=function(){var M,D,g,t,e,w,N,i,j;return M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I&&oM()!==I?(A.substr(bA,6)===d?(e=d,bA+=6):(e=I,0===PA&&MM(F)),e!==I&&oM()!==I?(w=bA,44===A.charCodeAt(bA)?(N=l,bA++):(N=I,0===PA&&MM(h)),N!==I&&(i=oM())!==I&&(j=function(){var M,D,g;return M=bA,A.substr(bA,2)===Y?(D=Y,bA+=2):(D=I,0===PA&&MM(S)),D!==I&&(g=function(){var A,M,D;if(A=bA,M=[],(D=iM())!==I)for(;D!==I;)M.push(D),D=iM();else M=I;return M!==I&&(JA=A,M=O(M)),A=M}())!==I?(JA=M,D=k(g),M=D):(bA=M,M=I),M===I&&(M=bA,(D=eM())!==I&&(JA=M,D=U(D)),M=D),M}())!==I?w=N=[N,i,j]:(bA=w,w=I),w===I&&(w=null),w!==I&&(N=oM())!==I?(125===A.charCodeAt(bA)?(i=c,bA++):(i=I,0===PA&&MM(E)),i!==I?(JA=M,D=f(g,e,w),M=D):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j;return M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I&&oM()!==I&&(g=zM())!==I&&oM()!==I?(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I&&oM()!==I?(A.substr(bA,4)===P?(e=P,bA+=4):(e=I,0===PA&&MM(V)),e===I&&(A.substr(bA,4)===X?(e=X,bA+=4):(e=I,0===PA&&MM(Z))),e!==I&&oM()!==I?(w=bA,44===A.charCodeAt(bA)?(N=l,bA++):(N=I,0===PA&&MM(h)),N!==I&&(i=oM())!==I&&(j=function(){var M,D,g;return M=bA,A.substr(bA,2)===Y?(D=Y,bA+=2):(D=I,0===PA&&MM(S)),D!==I&&(g=function(){var M,D,g,t;if(M=bA,D=bA,g=[],(t=TM())===I&&(t=nM()),t!==I)for(;t!==I;)g.push(t),(t=TM())===I&&(t=nM());else g=I;return(D=g!==I?A.substring(D,bA):g)!==I&&(JA=M,D=W(D)),M=D}())!==I?(JA=M,D=k(g),M=D):(bA=M,M=I),M===I&&(M=bA,(D=eM())!==I&&(JA=M,D=U(D)),M=D),M}())!==I?w=N=[N,i,j]:(bA=w,w=I),w===I&&(w=null),w!==I&&(N=oM())!==I?(125===A.charCodeAt(bA)?(i=c,bA++):(i=I,0===PA&&MM(E)),i!==I?(JA=M,D=f(g,e,w),M=D):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}()),M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j,y,o;if(M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I)if(oM()!==I)if((g=zM())!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I)if(oM()!==I)if(A.substr(bA,6)===K?(e=K,bA+=6):(e=I,0===PA&&MM(_)),e===I&&(A.substr(bA,13)===q?(e=q,bA+=13):(e=I,0===PA&&MM($))),e!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(w=l,bA++):(w=I,0===PA&&MM(h)),w!==I)if(oM()!==I)if(N=bA,A.substr(bA,7)===AA?(i=AA,bA+=7):(i=I,0===PA&&MM(MA)),i!==I&&(j=oM())!==I&&(y=uM())!==I?N=i=[i,j,y]:(bA=N,N=I),N===I&&(N=null),N!==I)if((i=oM())!==I){if(j=[],(y=EM())!==I)for(;y!==I;)j.push(y),y=EM();else j=I;j!==I&&(y=oM())!==I?(125===A.charCodeAt(bA)?(o=c,bA++):(o=I,0===PA&&MM(E)),o!==I?(JA=M,D=DA(g,e,N,j),M=D):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;return M}())===I&&(M=function(){var M,D,g,t,e,w,N,i,j;if(M=bA,123===A.charCodeAt(bA)?(D=T,bA++):(D=I,0===PA&&MM(n)),D!==I)if(oM()!==I)if((g=zM())!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(t=l,bA++):(t=I,0===PA&&MM(h)),t!==I)if(oM()!==I)if(A.substr(bA,6)===IA?(e=IA,bA+=6):(e=I,0===PA&&MM(gA)),e!==I)if(oM()!==I)if(44===A.charCodeAt(bA)?(w=l,bA++):(w=I,0===PA&&MM(h)),w!==I)if(oM()!==I){if(N=[],(i=cM())!==I)for(;i!==I;)N.push(i),i=cM();else N=I;N!==I&&(i=oM())!==I?(125===A.charCodeAt(bA)?(j=c,bA++):(j=I,0===PA&&MM(E)),j!==I?(JA=M,D=tA(g,N),M=D):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;else bA=M,M=I;return M}()),M}function eM(){var A,M,D;if(A=bA,M=[],(D=rM())===I&&(D=CM())===I&&(D=QM()),D!==I)for(;D!==I;)M.push(D),(D=rM())===I&&(D=CM())===I&&(D=QM());else M=I;return M!==I&&(JA=A,M=w(M)),A=M}function wM(){var M,D,g,t,e;if(PA++,M=bA,D=[],g=bA,t=bA,PA++,(e=jM())===I&&(r.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(C))),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I),g!==I)for(;g!==I;)D.push(g),g=bA,t=bA,PA++,(e=jM())===I&&(r.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(C))),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I);else D=I;return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(u)),M}function NM(){var M,D,g;return PA++,M=bA,47===A.charCodeAt(bA)?(D=B,bA++):(D=I,0===PA&&MM(a)),D!==I&&(g=wM())!==I?(JA=M,M=D=L(g)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(z)),M}function iM(){var A,M,D,g;if(PA++,A=bA,oM()!==I)if((M=wM())!==I){for(D=[],g=NM();g!==I;)D.push(g),g=NM();D!==I?(JA=A,A=x(M,D)):(bA=A,A=I)}else bA=A,A=I;else bA=A,A=I;return PA--,A===I&&0===PA&&MM(s),A}function TM(){var M,D,g,t;if(M=bA,39===A.charCodeAt(bA)?(D=m,bA++):(D=I,0===PA&&MM(p)),D!==I){if(g=[],(t=rM())===I&&(G.test(A.charAt(bA))?(t=A.charAt(bA),bA++):(t=I,0===PA&&MM(H))),t!==I)for(;t!==I;)g.push(t),(t=rM())===I&&(G.test(A.charAt(bA))?(t=A.charAt(bA),bA++):(t=I,0===PA&&MM(H)));else g=I;g!==I?(39===A.charCodeAt(bA)?(t=m,bA++):(t=I,0===PA&&MM(p)),t!==I?M=D=[D,g,t]:(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;if(M===I)if(M=[],(D=rM())===I&&(b.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(J))),D!==I)for(;D!==I;)M.push(D),(D=rM())===I&&(b.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(J)));else M=I;return M}function nM(){var M,D;if(M=[],R.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(v)),D!==I)for(;D!==I;)M.push(D),R.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(v));else M=I;return M}function cM(){var M,D,g,t,e;return M=bA,oM()!==I&&(D=aM())!==I&&oM()!==I?(123===A.charCodeAt(bA)?(g=T,bA++):(g=I,0===PA&&MM(n)),g!==I&&(t=gM())!==I?(125===A.charCodeAt(bA)?(e=c,bA++):(e=I,0===PA&&MM(E)),e!==I?(JA=M,M=NA(D,t)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}function EM(){var M,D,g,t,e;return M=bA,oM()!==I&&(D=function(){var M,D,g,t;return M=bA,D=bA,61===A.charCodeAt(bA)?(g=eA,bA++):(g=I,0===PA&&MM(wA)),g!==I&&(t=uM())!==I?D=g=[g,t]:(bA=D,D=I),(M=D!==I?A.substring(M,bA):D)===I&&(M=aM()),M}())!==I&&oM()!==I?(123===A.charCodeAt(bA)?(g=T,bA++):(g=I,0===PA&&MM(n)),g!==I&&(t=gM())!==I?(125===A.charCodeAt(bA)?(e=c,bA++):(e=I,0===PA&&MM(E)),e!==I?(JA=M,M=iA(D,t)):(bA=M,M=I)):(bA=M,M=I)):(bA=M,M=I),M}function jM(){var M;return PA++,nA.test(A.charAt(bA))?(M=A.charAt(bA),bA++):(M=I,0===PA&&MM(cA)),PA--,M===I&&0===PA&&MM(TA),M}function yM(){var M;return PA++,jA.test(A.charAt(bA))?(M=A.charAt(bA),bA++):(M=I,0===PA&&MM(yA)),PA--,M===I&&0===PA&&MM(EA),M}function oM(){var M,D,g;for(PA++,M=bA,D=[],g=jM();g!==I;)D.push(g),g=jM();return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(oA)),M}function uM(){var M,D,g;return PA++,M=bA,45===A.charCodeAt(bA)?(D=rA,bA++):(D=I,0===PA&&MM(CA)),D===I&&(D=null),D!==I&&(g=BM())!==I?(JA=M,M=D=QA(D,g)):(bA=M,M=I),PA--,M===I&&(D=I,0===PA&&MM(uA)),M}function rM(){var M,D;return PA++,M=bA,A.substr(bA,2)===BA?(D=BA,bA+=2):(D=I,0===PA&&MM(aA)),D!==I&&(JA=M,D=LA()),PA--,(M=D)===I&&(D=I,0===PA&&MM(zA)),M}function CM(){var M,D,g,t,e,w;if(M=bA,39===A.charCodeAt(bA)?(D=m,bA++):(D=I,0===PA&&MM(p)),D!==I)if(sA.test(A.charAt(bA))?(g=A.charAt(bA),bA++):(g=I,0===PA&&MM(xA)),g!==I){for(t=bA,e=[],A.substr(bA,2)===BA?(w=BA,bA+=2):(w=I,0===PA&&MM(aA)),w===I&&(G.test(A.charAt(bA))?(w=A.charAt(bA),bA++):(w=I,0===PA&&MM(H)));w!==I;)e.push(w),A.substr(bA,2)===BA?(w=BA,bA+=2):(w=I,0===PA&&MM(aA)),w===I&&(G.test(A.charAt(bA))?(w=A.charAt(bA),bA++):(w=I,0===PA&&MM(H)));(t=e!==I?A.substring(t,bA):e)!==I?(39===A.charCodeAt(bA)?(e=m,bA++):(e=I,0===PA&&MM(p)),e!==I?(JA=M,M=D=OA(g,t)):(bA=M,M=I)):(bA=M,M=I)}else bA=M,M=I;else bA=M,M=I;return M}function QM(){var M,D;return M=bA,YA.test(A.charAt(bA))?(D=A.charAt(bA),bA++):(D=I,0===PA&&MM(SA)),M=D!==I?A.substring(M,bA):D}function zM(){var M,D;return PA++,M=bA,(D=BM())===I&&(D=aM()),M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(kA)),M}function BM(){var M,D,g,t,e;if(PA++,M=bA,48===A.charCodeAt(bA)?(D=lA,bA++):(D=I,0===PA&&MM(hA)),D!==I&&(JA=M,D=dA()),(M=D)===I){if(M=bA,D=bA,FA.test(A.charAt(bA))?(g=A.charAt(bA),bA++):(g=I,0===PA&&MM(fA)),g!==I){for(t=[],mA.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(pA));e!==I;)t.push(e),mA.test(A.charAt(bA))?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(pA));t!==I?D=g=[g,t]:(bA=D,D=I)}else bA=D,D=I;D!==I&&(JA=M,D=GA(D)),M=D}return PA--,M===I&&(D=I,0===PA&&MM(UA)),M}function aM(){var M,D,g,t,e;if(PA++,M=bA,D=[],g=bA,t=bA,PA++,(e=jM())===I&&(e=yM()),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I),g!==I)for(;g!==I;)D.push(g),g=bA,t=bA,PA++,(e=jM())===I&&(e=yM()),PA--,e===I?t=void 0:(bA=t,t=I),t!==I?(A.length>bA?(e=A.charAt(bA),bA++):(e=I,0===PA&&MM(Q)),e!==I?g=t=[t,e]:(bA=g,g=I)):(bA=g,g=I);else D=I;return M=D!==I?A.substring(M,bA):D,PA--,M===I&&(D=I,0===PA&&MM(HA)),M}function LM(){return M&&M.captureLocation?{location:XA()}:{}}if((D=e())!==I&&bA===A.length)return D;throw D!==I&&bA(.*?)<\/([0-9a-zA-Z-_]*?)>)|(<[0-9a-zA-Z-_]*?\/>)/,F=Date.now()+"@@",f=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"];function m(A,M,D,I,g,t){var e={},w=S(A,M,D,I,g,void 0,t).reduce(function(A,M){if(0===M.type)return A+M.value;var D=Date.now()+"_"+ ++l;return e[D]=M.value,A+""+k+D+k},"");if(!d.test(w))return h(w,e);if(!g)throw new Y("Message has placeholders but no values was given");if("undefined"==typeof DOMParser)throw new Y("Cannot format XML message without DOMParser");B||(B=new DOMParser);var N=B.parseFromString(''+w+"","text/html").getElementById(F);if(!N)throw new Y("Malformed HTML message "+w);var i=Object.keys(g).filter(function(A){return!!N.getElementsByTagName(A).length});if(!i.length)return h(w,e);var T=i.filter(function(A){return A!==A.toLowerCase()});if(T.length)throw new Y("HTML tag must be lowercased but the following tags are not: "+T.join(", "));return Array.prototype.slice.call(N.childNodes).reduce(function(A,M){return A.concat(function A(M,D,I){var g=M.tagName,t=M.outerHTML,e=M.textContent,w=M.childNodes;if(!g)return h(e||"",D);g=g.toLowerCase();var N=~f.indexOf(g),i=I[g];if(i&&N)throw new Y(g+" is a self-closing tag and can not be used, please use another tag name.");if(!w.length)return[t];var T=Array.prototype.slice.call(w).reduce(function(M,g){return M.concat(A(g,D,I))},[]);return i?"function"==typeof i?[i.apply(void 0,T)]:[i]:s(["<"+g+">"],T,[""])}(M,e,g))},[])}var p=function(){return(p=Object.assign||function(A){for(var M,D=1,I=arguments.length;D<"']/g;function X(A,M,D={}){return M.reduce((M,I)=>(A.hasOwnProperty(I)?M[I]=A[I]:D.hasOwnProperty(I)&&(M[I]=D[I]),M),{})}function Z(A){W(A,"[React Intl] Could not find required `intl` object. needs to exist in the component ancestry.")}function K(A,M){return`[React Intl] ${A}${M?`\n${M.stack}`:""}`}const _={formats:{},messages:{},timeZone:void 0,textComponent:t.Fragment,defaultLocale:"en",defaultFormats:{},onError:function(A){}};function q(){return{dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}}}function $(A={dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}}){const M=Intl.RelativeTimeFormat;return{getDateTimeFormat:a(Intl.DateTimeFormat,A.dateTime),getNumberFormat:a(Intl.NumberFormat,A.number),getMessageFormat:a(J,A.message),getRelativeTimeFormat:a(M,A.relativeTime),getPluralRules:a(Intl.PluralRules,A.pluralRules)}}function AA(A,M,D,I){const g=A&&A[M];let t;if(g&&(t=g[D]),t)return t;I(K(`No ${M} format named: ${D}`))}var MA=D(78);const DA=D.n(MA).a||MA;const IA=t.createContext(null),{Consumer:gA,Provider:tA}=IA,eA=tA,wA=IA;function NA(A,M){const{intlPropName:D="intl",forwardRef:I=!1,enforceContext:g=!0}=M||{},e=M=>t.createElement(gA,null,e=>(g&&Z(e),t.createElement(A,Object.assign({},M,{[D]:e},{ref:I?M.forwardedRef:null}))));return e.displayName=`injectIntl(${function(A){return A.displayName||A.name||"Component"}(A)})`,e.WrappedComponent=A,DA(I?t.forwardRef((A,M)=>t.createElement(e,Object.assign({},A,{forwardedRef:M}))):e,A)}var iA,TA,nA=function(A,M){var D={};for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&M.indexOf(I)<0&&(D[I]=A[I]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var g=0;for(I=Object.getOwnPropertySymbols(A);gt.createElement(wA.Consumer,null,M=>{Z(M);const{value:D,children:I}=A,g=nA(A,["value","children"]);return I(M.formatNumberToParts(D,g))});function EA(A){const M=M=>t.createElement(wA.Consumer,null,D=>{Z(D);const{value:I,children:g}=M,t=nA(M,["value","children"]),e="string"==typeof I?new Date(I||0):I;return g("formatDate"===A?D.formatDateToParts(e,t):D.formatTimeToParts(e,t))});return M.displayName=TA[A],M}function jA(A){const M=M=>t.createElement(wA.Consumer,null,D=>{Z(D);const{value:I,children:g}=M,e=nA(M,["value","children"]),w=D[A](I,e);if("function"==typeof g)return g(w);const N=D.textComponent||t.Fragment;return t.createElement(N,null,w)});return M.displayName=iA[A],M}function yA(){const A=Object(t.useContext)(wA);return Z(A),A}cA.displayName="FormattedNumberParts";const oA=["localeMatcher","style","currency","currencyDisplay","unit","unitDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","currencyDisplay","currencySign","notation","signDisplay","unit","unitDisplay"];function uA({locale:A,formats:M,onError:D},I,g={}){const{format:t}=g;let e=t&&AA(M,"number",t,D)||{};return I(A,X(g,oA,e))}const rA=["numeric","style"];function CA(A,M,D,I,g={}){I||(I="second"),Intl.RelativeTimeFormat||A.onError(K('Intl.RelativeTimeFormat is not available in this environment.\nTry polyfilling it using "@formatjs/intl-relativetimeformat"\n'));try{return function({locale:A,formats:M,onError:D},I,g={}){const{format:t}=g,e=!!t&&AA(M,"relative",t,D)||{};return I(A,X(g,rA,e))}(A,M,g).format(D,I)}catch(M){A.onError(K("Error formatting relative time.",M))}return String(D)}const QA=["localeMatcher","formatMatcher","timeZone","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function zA({locale:A,formats:M,onError:D,timeZone:I},g,t,e={}){const{format:w}=e;let N=Object.assign({},I&&{timeZone:I},w&&AA(M,g,w,D)),i=X(e,QA,N);return"time"!==g||i.hour||i.minute||i.second||(i=Object.assign({},i,{hour:"numeric",minute:"numeric"})),t(A,i)}const BA=["localeMatcher","type"];const aA=v.a||R;function LA(A,M){return Object.keys(A).reduce((D,I)=>(D[I]=Object.assign({timeZone:M},A[I]),D),{})}function sA(A,M){return Object.keys(Object.assign({},A,M)).reduce((D,I)=>(D[I]=Object.assign({},A[I]||{},M[I]||{}),D),{})}function xA(A,M){if(!M)return A;const D=J.formats;return Object.assign({},D,A,{date:sA(LA(D.date,M),LA(A.date||{},M)),time:sA(LA(D.time,M),LA(A.time||{},M))})}function OA({locale:A,formats:M,messages:D,defaultLocale:I,defaultFormats:g,onError:t,timeZone:e},w,N={id:""},i={}){const{id:T,defaultMessage:n}=N;aA(T,"[React Intl] An `id` must be provided to format a message.");const c=D&&D[T];M=xA(M,e),g=xA(g,e);let E=[];if(c)try{E=w.getMessageFormat(c,A,M,{formatters:w}).formatHTMLMessage(i)}catch(M){t(K(`Error formatting message: "${T}" for locale: "${A}"`+(n?", using default message as fallback.":""),M))}else(!n||A&&A.toLowerCase()!==I.toLowerCase())&&t(K(`Missing message: "${T}" for locale: "${A}"`+(n?", using default message as fallback.":"")));if(!E.length&&n)try{E=w.getMessageFormat(n,I,g).formatHTMLMessage(i)}catch(A){t(K(`Error formatting the default message for: "${T}"`,A))}return E.length?1===E.length&&"string"==typeof E[0]?E[0]||n||T:E:(t(K(`Cannot format message: "${T}", `+`using message ${c||n?"source":"id"} as fallback.`)),"string"==typeof c?c||n||T:n||T)}function YA(A,M,D={id:""},I={}){return OA(A,M,D,Object.keys(I).reduce((A,M)=>{let D=I[M];return A[M]="string"==typeof D?function(A){return(""+A).replace(V,A=>P[A.charCodeAt(0)])}(D):D,A},{}))}var SA=D(27),kA=D.n(SA);const UA=kA.a||SA;function lA(A){return{locale:A.locale,timeZone:A.timeZone,formats:A.formats,textComponent:A.textComponent,messages:A.messages,defaultLocale:A.defaultLocale,defaultFormats:A.defaultFormats,onError:A.onError}}class hA extends t.PureComponent{constructor(){super(...arguments),this.cache={dateTime:{},number:{},message:{},relativeTime:{},pluralRules:{}},this.state={cache:this.cache,intl:dA(lA(this.props),this.cache),prevConfig:lA(this.props)}}static getDerivedStateFromProps(A,{prevConfig:M,cache:D}){const I=lA(A);return UA(M,I)?null:{intl:dA(I,D),prevConfig:I}}render(){return Z(this.state.intl),t.createElement(eA,{value:this.state.intl},this.props.children)}}function dA(A,M){const D=$(M),I=Object.assign({},_,A);if(!I.locale||!function(A,M){if("undefined"==typeof Intl)return!1;if(!A)throw new Error("locales must be supplied.");Array.isArray(A)||(A=[A]);var D=M||[Intl.DateTimeFormat,Intl.NumberFormat,Intl.PluralRules];return!(0===(D=D.filter(Boolean)).length||M&&D.length!==M.length)&&D.every(function(M){return M.supportedLocalesOf(A).length===A.length})}(I.locale)){const{locale:A,defaultLocale:M,onError:D}=I;"function"==typeof D&&D(K(`Missing locale data for locale: "${A}". `+`Using default locale: "${M}" as fallback.`)),I.locale=I.defaultLocale||"en"}return Object.assign({},I,{formatters:D,formatNumber:function(A,M,D,I={}){try{return uA(A,M,I).format(D)}catch(M){A.onError(K("Error formatting number.",M))}return String(D)}.bind(null,I,D.getNumberFormat),formatNumberToParts:function(A,M,D,I={}){try{return uA(A,M,I).formatToParts(D)}catch(M){A.onError(K("Error formatting number.",M))}return[]}.bind(null,I,D.getNumberFormat),formatRelativeTime:CA.bind(null,I,D.getRelativeTimeFormat),formatDate:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"date",M,I).format(g)}catch(M){A.onError(K("Error formatting date.",M))}return String(g)}.bind(null,I,D.getDateTimeFormat),formatDateToParts:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"date",M,I).formatToParts(g)}catch(M){A.onError(K("Error formatting date.",M))}return[]}.bind(null,I,D.getDateTimeFormat),formatTime:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"time",M,I).format(g)}catch(M){A.onError(K("Error formatting time.",M))}return String(g)}.bind(null,I,D.getDateTimeFormat),formatTimeToParts:function(A,M,D,I={}){const g="string"==typeof D?new Date(D||0):D;try{return zA(A,"time",M,I).formatToParts(g)}catch(M){A.onError(K("Error formatting time.",M))}return[]}.bind(null,I,D.getDateTimeFormat),formatPlural:function({locale:A,onError:M},D,I,g={}){Intl.PluralRules||M(K('Intl.PluralRules is not available in this environment.\nTry polyfilling it using "@formatjs/intl-pluralrules"\n'));let t=X(g,BA);try{return D(A,t).select(I)}catch(A){M(K("Error formatting plural.",A))}return"other"}.bind(null,I,D.getPluralRules),formatMessage:OA.bind(null,I,D),formatHTMLMessage:YA.bind(null,I,D)})}hA.displayName="IntlProvider",hA.defaultProps=_;const FA=v.a||R,fA=60,mA=3600,pA=86400;function GA(A){const M=Math.abs(A);return M=D?e-t:e,N=Math.abs(w-D);this._updateTimer=setTimeout(()=>this.setState({currentValueInSeconds:w}),1e3*N)}componentDidMount(){this.scheduleNextUpdate(this.props,this.state)}componentDidUpdate(){this.scheduleNextUpdate(this.props,this.state)}componentWillUnmount(){clearTimeout(this._updateTimer),this._updateTimer=null}static getDerivedStateFromProps(A,M){return A.unit!==M.prevUnit||A.value!==M.prevValue?{prevValue:A.value,prevUnit:A.unit,currentValueInSeconds:RA(A.unit)?bA(A.value,A.unit):0}:null}render(){return t.createElement(wA.Consumer,null,A=>{Z(A);const{formatRelativeTime:M,textComponent:D}=A,{children:I,value:g,unit:e,updateIntervalInSeconds:w}=this.props,{currentValueInSeconds:N}=this.state;let i=g||0,T=e;if(RA(e)&&null!=N&&w){const A=HA(T=GA(N));i=Math.round(N/A)}const n=M(i,T,Object.assign({},this.props));return"function"==typeof I?I(n):D?t.createElement(D,null,n):n})}}vA.displayName="FormattedRelativeTime",vA.defaultProps={value:0,unit:"second"};var WA=vA;const PA=A=>{const{value:M,other:D,children:I,intl:{formatPlural:g,textComponent:e}}=A;let w=A[g(M,A)]||D;return"function"==typeof I?I(w):e?t.createElement(e,null,w):w};PA.defaultProps={type:"cardinal"},PA.displayName="FormattedPlural";var VA=NA(PA),XA=function(A,M){var D={};for(var I in A)Object.prototype.hasOwnProperty.call(A,I)&&M.indexOf(I)<0&&(D[I]=A[I]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var g=0;for(I=Object.getOwnPropertySymbols(A);gOA(Object.assign({},_,{locale:"en"}),$(),A,M);class _A extends t.Component{shouldComponentUpdate(A){const M=this.props,{values:D}=M,I=XA(M,["values"]),{values:g}=A,t=XA(A,["values"]);return!ZA(g,D)||!ZA(I,t)}render(){return t.createElement(wA.Consumer,null,A=>{this.props.defaultMessage||Z(A);const{formatMessage:M=KA,textComponent:D=t.Fragment}=A||{},{id:I,description:g,defaultMessage:e,values:w,children:N,tagName:i=D}=this.props;let T=M({id:I,description:g,defaultMessage:e},w);return Array.isArray(T)||(T=[T]),"function"==typeof N?N(...T):i?t.createElement(i,null,...T):T})}}_A.displayName="FormattedMessage",_A.defaultProps={values:{}};var qA=_A;class $A extends qA{render(){return t.createElement(wA.Consumer,null,A=>{this.props.defaultMessage||Z(A);const{formatHTMLMessage:M,textComponent:D}=A,{id:I,description:g,defaultMessage:e,values:w,children:N}=this.props;let{tagName:i}=this.props;i||(i=D||"span");let T=M({id:I,description:g,defaultMessage:e},w);if("function"==typeof N)return N(T);const n={__html:T};return t.createElement(i,{dangerouslySetInnerHTML:n})})}}$A.displayName="FormattedHTMLMessage",$A.defaultProps=Object.assign({},qA.defaultProps,{tagName:"span"});var AM=$A;D.d(M,"FormattedDate",function(){return MM}),D.d(M,"FormattedTime",function(){return DM}),D.d(M,"FormattedNumber",function(){return IM}),D.d(M,"FormattedDateParts",function(){return gM}),D.d(M,"FormattedTimeParts",function(){return tM}),D.d(M,"defineMessages",function(){return I}),D.d(M,"injectIntl",function(){return NA}),D.d(M,"RawIntlProvider",function(){return eA}),D.d(M,"IntlContext",function(){return wA}),D.d(M,"useIntl",function(){return yA}),D.d(M,"IntlProvider",function(){return hA}),D.d(M,"createIntl",function(){return dA}),D.d(M,"FormattedNumberParts",function(){return cA}),D.d(M,"FormattedRelativeTime",function(){return WA}),D.d(M,"FormattedPlural",function(){return VA}),D.d(M,"FormattedMessage",function(){return qA}),D.d(M,"FormattedHTMLMessage",function(){return AM}),D.d(M,"createIntlCache",function(){return q});const MM=jA("formatDate"),DM=jA("formatTime"),IM=jA("formatNumber"),gM=EA("formatDate"),tM=EA("formatTime")},function(A,M,D){"use strict";function I(A,M){A.prototype=Object.create(M.prototype),A.prototype.constructor=A,A.__proto__=M}D.r(M);var g=D(1),t=D.n(g);D(247);function e(){return(e=Object.assign||function(A){for(var M=1;M=0;c--){var E=g[c];"."===E?N(g,c):".."===E?(N(g,c),n++):n&&(N(g,c),n--)}if(!i)for(;n--;n)g.unshift("..");!i||""===g[0]||g[0]&&w(g[0])||g.unshift("");var j=g.join("/");return D&&"/"!==j.substr(-1)&&(j+="/"),j};function T(A){return A.valueOf?A.valueOf():Object.prototype.valueOf.call(A)}var n=function A(M,D){if(M===D)return!0;if(null==M||null==D)return!1;if(Array.isArray(M))return Array.isArray(D)&&M.length===D.length&&M.every(function(M,I){return A(M,D[I])});if("object"==typeof M||"object"==typeof D){var I=T(M),g=T(D);return I!==M||g!==D?A(I,g):Object.keys(Object.assign({},M,D)).every(function(I){return A(M[I],D[I])})}return!1},c=!0,E="Invariant failed";var j=function(A,M){if(!A)throw c?new Error(E):new Error(E+": "+(M||""))};function y(A){return"/"===A.charAt(0)?A:"/"+A}function o(A){return"/"===A.charAt(0)?A.substr(1):A}function u(A,M){return function(A,M){return 0===A.toLowerCase().indexOf(M.toLowerCase())&&-1!=="/?#".indexOf(A.charAt(M.length))}(A,M)?A.substr(M.length):A}function r(A){return"/"===A.charAt(A.length-1)?A.slice(0,-1):A}function C(A){var M=A.pathname,D=A.search,I=A.hash,g=M||"/";return D&&"?"!==D&&(g+="?"===D.charAt(0)?D:"?"+D),I&&"#"!==I&&(g+="#"===I.charAt(0)?I:"#"+I),g}function Q(A,M,D,I){var g;"string"==typeof A?(g=function(A){var M=A||"/",D="",I="",g=M.indexOf("#");-1!==g&&(I=M.substr(g),M=M.substr(0,g));var t=M.indexOf("?");return-1!==t&&(D=M.substr(t),M=M.substr(0,t)),{pathname:M,search:"?"===D?"":D,hash:"#"===I?"":I}}(A)).state=M:(void 0===(g=e({},A)).pathname&&(g.pathname=""),g.search?"?"!==g.search.charAt(0)&&(g.search="?"+g.search):g.search="",g.hash?"#"!==g.hash.charAt(0)&&(g.hash="#"+g.hash):g.hash="",void 0!==M&&void 0===g.state&&(g.state=M));try{g.pathname=decodeURI(g.pathname)}catch(A){throw A instanceof URIError?new URIError('Pathname "'+g.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):A}return D&&(g.key=D),I?g.pathname?"/"!==g.pathname.charAt(0)&&(g.pathname=i(g.pathname,I.pathname)):g.pathname=I.pathname:g.pathname||(g.pathname="/"),g}function z(){var A=null;var M=[];return{setPrompt:function(M){return A=M,function(){A===M&&(A=null)}},confirmTransitionTo:function(M,D,I,g){if(null!=A){var t="function"==typeof A?A(M,D):A;"string"==typeof t?"function"==typeof I?I(t,g):g(!0):g(!1!==t)}else g(!0)},appendListener:function(A){var D=!0;function I(){D&&A.apply(void 0,arguments)}return M.push(I),function(){D=!1,M=M.filter(function(A){return A!==I})}},notifyListeners:function(){for(var A=arguments.length,D=new Array(A),I=0;I=0||(g[D]=A[D]);return g}var V=D(237),X=D.n(V),Z=function(A){var M=J();return M.displayName=A,M}("Router"),K=function(A){function M(M){var D;return(D=A.call(this,M)||this).state={location:M.history.location},D._isMounted=!1,D._pendingLocation=null,M.staticContext||(D.unlisten=M.history.listen(function(A){D._isMounted?D.setState({location:A}):D._pendingLocation=A})),D}I(M,A),M.computeRootMatch=function(A){return{path:"/",url:"/",params:{},isExact:"/"===A}};var D=M.prototype;return D.componentDidMount=function(){this._isMounted=!0,this._pendingLocation&&this.setState({location:this._pendingLocation})},D.componentWillUnmount=function(){this.unlisten&&this.unlisten()},D.render=function(){return t.a.createElement(Z.Provider,{children:this.props.children||null,value:{history:this.props.history,location:this.state.location,match:M.computeRootMatch(this.state.location.pathname),staticContext:this.props.staticContext}})},M}(t.a.Component);var _=function(A){function M(){for(var M,D=arguments.length,I=new Array(D),g=0;gM?D.splice(M,D.length-M,I):D.push(I),n({action:"PUSH",location:I,index:M,entries:D})}})},replace:function(A,M){var I=Q(A,M,c(),u.location);T.confirmTransitionTo(I,"REPLACE",D,function(A){A&&(u.entries[u.index]=I,n({action:"REPLACE",location:I}))})},go:o,goBack:function(){o(-1)},goForward:function(){o(1)},canGo:function(A){var M=u.index+A;return M>=0&&M=0||(g[D]=A[D]);return g}D.d(M,"BrowserRouter",function(){return sA}),D.d(M,"HashRouter",function(){return xA}),D.d(M,"Link",function(){return lA}),D.d(M,"NavLink",function(){return FA}),D.d(M,"MemoryRouter",function(){return _}),D.d(M,"Prompt",function(){return $}),D.d(M,"Redirect",function(){return gA}),D.d(M,"Route",function(){return iA}),D.d(M,"Router",function(){return K}),D.d(M,"StaticRouter",function(){return jA}),D.d(M,"Switch",function(){return yA}),D.d(M,"__RouterContext",function(){return Z}),D.d(M,"generatePath",function(){return IA}),D.d(M,"matchPath",function(){return NA}),D.d(M,"useHistory",function(){return rA}),D.d(M,"useLocation",function(){return CA}),D.d(M,"useParams",function(){return QA}),D.d(M,"useRouteMatch",function(){return zA}),D.d(M,"withRouter",function(){return oA});var sA=function(A){function M(){for(var M,D=arguments.length,I=new Array(D),g=0;g1)for(var D=1;D=8)M(j(D));else{M(C("error.passwordLength"))}}},M.handleLogin=function(A,M){return function(D){null!==A&&""!==A&&null!==M&&""!==M?Q(A,M):D(C("error.noCredentials"))}},M.authHandler=function(A,M){return function(D){var I=w.default.auth().currentUser,g=A.user.uid;localStorage.setItem("currentUser",JSON.stringify(I)),(0,T.getUserAvatar)(g).then(function(t){var e=A.user.displayName,w=A.user.email,N=t||A.user.photoURL,T={uid:g,email:w,displayName:e,avURL:N,chatkitUser:{}},n=[g,w,e],c=["uid","email","displayName"],E=n.length;D((0,i.dispatchedGenInfo)(T)),M(I,T);for(var j=0;j0?g(I(A),9007199254740991):0}},function(A,M){var D=Math.ceil,I=Math.floor;A.exports=function(A){return isNaN(A=+A)?0:(A>0?I:D)(A)}},function(A,M,D){var I=D(15);A.exports=function(A,M){if(!I(A))return A;var D,g;if(M&&"function"==typeof(D=A.toString)&&!I(g=D.call(A)))return g;if("function"==typeof(D=A.valueOf)&&!I(g=D.call(A)))return g;if(!M&&"function"==typeof(D=A.toString)&&!I(g=D.call(A)))return g;throw TypeError("Can't convert object to primitive value")}},function(A,M){A.exports=!1},function(A,M,D){"use strict";var I={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,t=g&&!I.call({1:2},1);M.f=t?function(A){var M=g(this,A);return!!M&&M.enumerable}:I},function(A,M,D){var I=D(4),g=D(16),t=D(12),e=D(59),w=D(221),N=D(46),i=N.get,T=N.enforce,n=String(w).split("toString");D(32)("inspectSource",function(A){return w.call(A)}),(A.exports=function(A,M,D,w){var N=!!w&&!!w.unsafe,i=!!w&&!!w.enumerable,c=!!w&&!!w.noTargetGet;"function"==typeof D&&("string"!=typeof M||t(D,"name")||g(D,"name",M),T(D).source=n.join("string"==typeof M?M:"")),A!==I?(N?!c&&A[M]&&(i=!0):delete A[M],i?A[M]=D:g(A,M,D)):i?A[M]=D:e(M,D)})(Function.prototype,"toString",function(){return"function"==typeof this&&i(this).source||w.call(this)})},function(A,M,D){var I,g,t,e=D(313),w=D(15),N=D(16),i=D(12),T=D(47),n=D(48),c=D(4).WeakMap;if(e){var E=new c,j=E.get,y=E.has,o=E.set;I=function(A,M){return o.call(E,A,M),M},g=function(A){return j.call(E,A)||{}},t=function(A){return y.call(E,A)}}else{var u=T("state");n[u]=!0,I=function(A,M){return N(A,u,M),M},g=function(A){return i(A,u)?A[u]:{}},t=function(A){return i(A,u)}}A.exports={set:I,get:g,has:t,enforce:function(A){return t(A)?g(A):I(A,{})},getterFor:function(A){return function(M){var D;if(!w(M)||(D=g(M)).type!==A)throw TypeError("Incompatible receiver, "+A+" required");return D}}}},function(A,M,D){var I=D(32)("keys"),g=D(60);A.exports=function(A){return I[A]||(I[A]=g(A))}},function(A,M){A.exports={}},function(A,M){M.f=Object.getOwnPropertySymbols},function(A,M,D){var I=D(223),g=D(63);A.exports=Object.keys||function(A){return I(A,g)}},function(A,M,D){var I=D(4),g=D(216),t=Function.call;A.exports=function(A,M,D){return g(t,I[A].prototype[M],D)}},function(A,M,D){A.exports=D(379)},,function(A,M,D){"use strict";A.exports=D(255)},function(A,M,D){"use strict";A.exports=function(A,M){return"string"!=typeof A?A:(/^['"].*['"]$/.test(A)&&(A=A.slice(1,-1)),/["'() \t\n]/.test(A)||M?'"'+A.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':A)}},function(A,M,D){"use strict";D(214);var I=function(A){return A&&"object"==typeof A&&"default"in A?A.default:A}(D(2)); /** * @license * Copyright 2018 Google Inc. @@ -392,7 +392,7 @@ var I,g=[];!function(A){A[A.DEBUG=0]="DEBUG",A[A.VERBOSE=1]="VERBOSE",A[A.INFO=2 * See the License for the specific language governing permissions and * limitations under the License. */ -function N(A){g.forEach(function(M){M.logLevel=A})}},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.emailregex=/^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i,M.devProfileURL="https://www.upwork.com/fl/stevenmuganwa",M.payPalURL="https://www.paypal.com/cgi-bin/webscr",M.devEmailAddress="stevenmuganwa@live.com"},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.getUserAvatar=void 0;var I=t(D(8)),g=t(D(10));function t(A){return A&&A.__esModule?A:{default:A}}var e=I.default.createClass(g.default.database());M.getUserAvatar=function(A){return new Promise(function(M){e.fetch("users/"+A,{context:void 0,asArray:!0,then:function(A){if(0!==A.length){var D=A[1][0],I=A[1];"h"===D?(localStorage.setItem("avatar",I),M(I)):storageRef.child("general/avatar.jpg").getDownloadURL().then(function(A){localStorage.setItem("avatar",A),M(A)})}}})})}},function(A,M,D){"use strict";D.r(M),D.d(M,"createStore",function(){return N}),D.d(M,"combineReducers",function(){return T}),D.d(M,"bindActionCreators",function(){return c}),D.d(M,"applyMiddleware",function(){return j}),D.d(M,"compose",function(){return E}),D.d(M,"__DO_NOT_USE__ActionTypes",function(){return g});var I=D(77),g={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},e=Object.assign||function(A){for(var M=1;M0&&void 0!==arguments[0]?arguments[0]:{},M=arguments[1];if(w)throw w;for(var I=!1,g={},t=0;t()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i,M.devProfileURL="https://www.upwork.com/fl/stevenmuganwa",M.payPalURL="https://www.paypal.com/cgi-bin/webscr",M.devEmailAddress="stevenmuganwa@live.com"},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0}),M.getUserAvatar=void 0;var I=t(D(8)),g=t(D(10));function t(A){return A&&A.__esModule?A:{default:A}}var e=I.default.createClass(g.default.database());M.getUserAvatar=function(A){return new Promise(function(M){e.fetch("users/"+A,{context:void 0,asArray:!0,then:function(A){if(0!==A.length){var D=A[1][0],I=A[1];"h"===D?(localStorage.setItem("avatar",I),M(I)):storageRef.child("general/avatar.jpg").getDownloadURL().then(function(A){localStorage.setItem("avatar",A),M(A)})}}})})}},function(A,M,D){"use strict";D.r(M),D.d(M,"createStore",function(){return N}),D.d(M,"combineReducers",function(){return T}),D.d(M,"bindActionCreators",function(){return c}),D.d(M,"applyMiddleware",function(){return j}),D.d(M,"compose",function(){return E}),D.d(M,"__DO_NOT_USE__ActionTypes",function(){return g});var I=D(77),g={INIT:"@@redux/INIT"+Math.random().toString(36).substring(7).split("").join("."),REPLACE:"@@redux/REPLACE"+Math.random().toString(36).substring(7).split("").join(".")},t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},e=Object.assign||function(A){for(var M=1;M0&&void 0!==arguments[0]?arguments[0]:{},M=arguments[1];if(w)throw w;for(var I=!1,g={},t=0;t * @license MIT */ -A.exports=function(A){return null!=A&&null!=A.constructor&&"function"==typeof A.constructor.isBuffer&&A.constructor.isBuffer(A)}},function(A,M,D){"use strict";var I=D(69),g=D(9),t=D(389),e=D(390);function w(A){this.defaults=A,this.interceptors={request:new t,response:new t}}w.prototype.request=function(A){"string"==typeof A&&(A=g.merge({url:arguments[0]},arguments[1])),(A=g.merge(I,{method:"get"},this.defaults,A)).method=A.method.toLowerCase();var M=[e,void 0],D=Promise.resolve(A);for(this.interceptors.request.forEach(function(A){M.unshift(A.fulfilled,A.rejected)}),this.interceptors.response.forEach(function(A){M.push(A.fulfilled,A.rejected)});M.length;)D=D.then(M.shift(),M.shift());return D},g.forEach(["delete","get","head","options"],function(A){w.prototype[A]=function(M,D){return this.request(g.merge(D||{},{method:A,url:M}))}}),g.forEach(["post","put","patch"],function(A){w.prototype[A]=function(M,D,I){return this.request(g.merge(I||{},{method:A,url:M,data:D}))}}),A.exports=w},function(A,M,D){"use strict";var I=D(9);A.exports=function(A,M){I.forEach(A,function(D,I){I!==M&&I.toUpperCase()===M.toUpperCase()&&(A[M]=D,delete A[I])})}},function(A,M,D){"use strict";var I=D(230);A.exports=function(A,M,D){var g=D.config.validateStatus;D.status&&g&&!g(D.status)?M(I("Request failed with status code "+D.status,D.config,null,D.request,D)):A(D)}},function(A,M,D){"use strict";A.exports=function(A,M,D,I,g){return A.config=M,D&&(A.code=D),A.request=I,A.response=g,A}},function(A,M,D){"use strict";var I=D(9);function g(A){return encodeURIComponent(A).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}A.exports=function(A,M,D){if(!M)return A;var t;if(D)t=D(M);else if(I.isURLSearchParams(M))t=M.toString();else{var e=[];I.forEach(M,function(A,M){null!==A&&void 0!==A&&(I.isArray(A)?M+="[]":A=[A],I.forEach(A,function(A){I.isDate(A)?A=A.toISOString():I.isObject(A)&&(A=JSON.stringify(A)),e.push(g(M)+"="+g(A))}))}),t=e.join("&")}return t&&(A+=(-1===A.indexOf("?")?"?":"&")+t),A}},function(A,M,D){"use strict";var I=D(9),g=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];A.exports=function(A){var M,D,t,e={};return A?(I.forEach(A.split("\n"),function(A){if(t=A.indexOf(":"),M=I.trim(A.substr(0,t)).toLowerCase(),D=I.trim(A.substr(t+1)),M){if(e[M]&&g.indexOf(M)>=0)return;e[M]="set-cookie"===M?(e[M]?e[M]:[]).concat([D]):e[M]?e[M]+", "+D:D}}),e):e}},function(A,M,D){"use strict";var I=D(9);A.exports=I.isStandardBrowserEnv()?function(){var A,M=/(msie|trident)/i.test(navigator.userAgent),D=document.createElement("a");function g(A){var I=A;return M&&(D.setAttribute("href",I),I=D.href),D.setAttribute("href",I),{href:D.href,protocol:D.protocol?D.protocol.replace(/:$/,""):"",host:D.host,search:D.search?D.search.replace(/^\?/,""):"",hash:D.hash?D.hash.replace(/^#/,""):"",hostname:D.hostname,port:D.port,pathname:"/"===D.pathname.charAt(0)?D.pathname:"/"+D.pathname}}return A=g(window.location.href),function(M){var D=I.isString(M)?g(M):M;return D.protocol===A.protocol&&D.host===A.host}}():function(){return!0}},function(A,M,D){"use strict";var I=D(9);A.exports=I.isStandardBrowserEnv()?{write:function(A,M,D,g,t,e){var w=[];w.push(A+"="+encodeURIComponent(M)),I.isNumber(D)&&w.push("expires="+new Date(D).toGMTString()),I.isString(g)&&w.push("path="+g),I.isString(t)&&w.push("domain="+t),!0===e&&w.push("secure"),document.cookie=w.join("; ")},read:function(A){var M=document.cookie.match(new RegExp("(^|;\\s*)("+A+")=([^;]*)"));return M?decodeURIComponent(M[3]):null},remove:function(A){this.write(A,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(A,M,D){"use strict";var I=D(9);function g(){this.handlers=[]}g.prototype.use=function(A,M){return this.handlers.push({fulfilled:A,rejected:M}),this.handlers.length-1},g.prototype.eject=function(A){this.handlers[A]&&(this.handlers[A]=null)},g.prototype.forEach=function(A){I.forEach(this.handlers,function(M){null!==M&&A(M)})},A.exports=g},function(A,M,D){"use strict";var I=D(9),g=D(391),t=D(231),e=D(69),w=D(392),N=D(393);function i(A){A.cancelToken&&A.cancelToken.throwIfRequested()}A.exports=function(A){return i(A),A.baseURL&&!w(A.url)&&(A.url=N(A.baseURL,A.url)),A.headers=A.headers||{},A.data=g(A.data,A.headers,A.transformRequest),A.headers=I.merge(A.headers.common||{},A.headers[A.method]||{},A.headers||{}),I.forEach(["delete","get","head","post","put","patch","common"],function(M){delete A.headers[M]}),(A.adapter||e.adapter)(A).then(function(M){return i(A),M.data=g(M.data,M.headers,A.transformResponse),M},function(M){return t(M)||(i(A),M&&M.response&&(M.response.data=g(M.response.data,M.response.headers,A.transformResponse))),Promise.reject(M)})}},function(A,M,D){"use strict";var I=D(9);A.exports=function(A,M,D){return I.forEach(D,function(D){A=D(A,M)}),A}},function(A,M,D){"use strict";A.exports=function(A){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(A)}},function(A,M,D){"use strict";A.exports=function(A,M){return M?A.replace(/\/+$/,"")+"/"+M.replace(/^\/+/,""):A}},function(A,M,D){"use strict";var I=D(232);function g(A){if("function"!=typeof A)throw new TypeError("executor must be a function.");var M;this.promise=new Promise(function(A){M=A});var D=this;A(function(A){D.reason||(D.reason=new I(A),M(D.reason))})}g.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},g.source=function(){var A;return{token:new g(function(M){A=M}),cancel:A}},A.exports=g},function(A,M,D){"use strict";A.exports=function(A){return function(M){return A.apply(null,M)}}},function(A,M,D){"use strict";D.r(M),function(A){var M=D(2),I=D.n(M);(function(){var A,M=M||{},D=this;function g(A){return"string"==typeof A}function t(A){return"boolean"==typeof A}var e=/^[\w+/_-]+[=]{0,2}$/,w=null;function N(){}function i(A){var M=typeof A;if("object"==M){if(!A)return"null";if(A instanceof Array)return"array";if(A instanceof Object)return M;var D=Object.prototype.toString.call(A);if("[object Window]"==D)return"object";if("[object Array]"==D||"number"==typeof A.length&&void 0!==A.splice&&void 0!==A.propertyIsEnumerable&&!A.propertyIsEnumerable("splice"))return"array";if("[object Function]"==D||void 0!==A.call&&void 0!==A.propertyIsEnumerable&&!A.propertyIsEnumerable("call"))return"function"}else if("function"==M&&void 0===A.call)return"object";return M}function T(A){return null===A}function n(A){return"array"==i(A)}function c(A){var M=i(A);return"array"==M||"object"==M&&"number"==typeof A.length}function E(A){return"function"==i(A)}function j(A){var M=typeof A;return"object"==M&&null!=A||"function"==M}var y="closure_uid_"+(1e9*Math.random()>>>0),o=0;function u(A,M,D){return A.call.apply(A.bind,arguments)}function r(A,M,D){if(!A)throw Error();if(2A.b&&(A.b++,M.next=A.a,A.a=M)}function S(){this.b=this.a=null}B(L,Error),L.prototype.name="CustomError",B(s,L),s.prototype.name="AssertionError",O.prototype.get=function(){if(0/g,V=/"/g,X=/'/g,Z=/\x00/g,K=/[\x00&<>"']/;function _(A,M){return-1!=A.indexOf(M)}function q(A,M){return AM?1:0}A:{var $=D.navigator;if($){var AA=$.userAgent;if(AA){J=AA;break A}}J=""}function MA(A){return _(J,A)}function DA(A,M){for(var D in A)M.call(void 0,A[D],D,A)}function IA(A){for(var M in A)return!1;return!0}function gA(A){var M,D={};for(M in A)D[M]=A[M];return D}var tA,eA,wA="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function NA(A,M){for(var D,I,g=1;g")&&(A=A.replace(P,">")),-1!=A.indexOf('"')&&(A=A.replace(V,""")),-1!=A.indexOf("'")&&(A=A.replace(X,"'")),-1!=A.indexOf("\0")&&(A=A.replace(Z,"�"))),A}function nA(A){D.setTimeout(function(){throw A},0)}function cA(A,M){eA||function(){if(D.Promise&&D.Promise.resolve){var A=D.Promise.resolve(void 0);eA=function(){A.then(yA)}}else eA=function(){var A=yA;!E(D.setImmediate)||D.Window&&D.Window.prototype&&!MA("Edge")&&D.Window.prototype.setImmediate==D.setImmediate?(tA||(tA=function(){var A=D.MessageChannel;if(void 0===A&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!MA("Presto")&&(A=function(){var A=document.createElement("IFRAME");A.style.display="none",A.src="",document.documentElement.appendChild(A);var M=A.contentWindow;(A=M.document).open(),A.write(""),A.close();var D="callImmediate"+Math.random(),I="file:"==M.location.protocol?"*":M.location.protocol+"//"+M.location.host;A=C(function(A){"*"!=I&&A.origin!=I||A.data!=D||this.port1.onmessage()},this),M.addEventListener("message",A,!1),this.port1={},this.port2={postMessage:function(){M.postMessage(D,I)}}}),void 0!==A&&!MA("Trident")&&!MA("MSIE")){var M=new A,I={},g=I;return M.port1.onmessage=function(){if(void 0!==I.next){var A=(I=I.next).xb;I.xb=null,A()}},function(A){g.next={xb:A},g=g.next,M.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(A){var M=document.createElement("SCRIPT");M.onreadystatechange=function(){M.onreadystatechange=null,M.parentNode.removeChild(M),M=null,A(),A=null},document.documentElement.appendChild(M)}:function(A){D.setTimeout(A,0)}}()),tA(A)):D.setImmediate(A)}}(),EA||(eA(),EA=!0),jA.add(A,M)}var EA=!1,jA=new S;function yA(){for(var A;A=U();){try{A.a.call(A.b)}catch(A){nA(A)}Y(k,A)}EA=!1}function oA(A,M){if(this.a=uA,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,A!=N)try{var D=this;A.call(M,function(A){SA(D,rA,A)},function(A){if(!(A instanceof fA))try{if(A instanceof Error)throw A;throw Error("Promise rejected.")}catch(A){}SA(D,CA,A)})}catch(A){SA(this,CA,A)}}var uA=0,rA=2,CA=3;function QA(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}QA.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var zA=new O(function(){return new QA},function(A){A.reset()});function BA(A,M,D){var I=zA.get();return I.g=A,I.b=M,I.f=D,I}function aA(A){if(A instanceof oA)return A;var M=new oA(N);return SA(M,rA,A),M}function LA(A){return new oA(function(M,D){D(A)})}function sA(A,M,D){kA(A,M,D,null)||cA(Q(M,A))}function xA(A){return new oA(function(M){var D=A.length,I=[];if(D)for(var g=function(A,g,t){D--,I[A]=g?{Eb:!0,value:t}:{Eb:!1,reason:t},0==D&&M(I)},t=0;tparseFloat(KA)){JA=String(qA);break A}}JA=KA}var $A,AM={};function MM(A){return function(A,M){var D=AM;return Object.prototype.hasOwnProperty.call(D,A)?D[A]:D[A]=M(A)}(A,function(){for(var M=0,D=R(String(JA)).split("."),I=R(String(A)).split("."),g=Math.max(D.length,I.length),t=0;0==M&&t=A.keyCode)&&(A.keyCode=-1)}catch(A){}},NM.prototype.f=function(){return this.a};var TM="closure_listenable_"+(1e6*Math.random()|0),nM=0;function cM(A){A.oa=!0,A.listener=null,A.proxy=null,A.src=null,A.Ma=null}function EM(A){this.src=A,this.a={},this.b=0}function jM(A,M){var D=M.type;D in A.a&&p(A.a[D],M)&&(cM(M),0==A.a[D].length&&(delete A.a[D],A.b--))}function yM(A,M,D,I){for(var g=0;gg.keyCode||void 0!=g.returnValue)){A:{var t=!1;if(0==g.keyCode)try{g.keyCode=-1;break A}catch(A){t=!0}(t||void 0==g.returnValue)&&(g.returnValue=!0)}for(g=[],t=M.b;t;t=t.parentNode)g.push(t);for(A=A.type,t=g.length-1;0<=t;t--){M.b=g[t];var e=LM(g[t],A,!0,M);I=I&&e}for(t=0;t>>0);function SM(A){return E(A)?A:(A[YM]||(A[YM]=function(M){return A.handleEvent(M)}),A[YM])}function kM(){mA.call(this),this.o=new EM(this),this.Rb=this,this.Wa=null}function UM(A,M,D,I,g){A.o.add(String(M),D,!1,I,g)}function lM(A,M,D,I,g){A.o.add(String(M),D,!0,I,g)}function hM(A,M,D,I){if(!(M=A.o.a[String(M)]))return!0;M=M.concat();for(var g=!0,t=0;tM)throw Error("Bad port number "+M);A.i=M}else A.i=null}function WM(A,M,D){M instanceof gD?(A.a=M,function(A,M){M&&!A.f&&(tD(A),A.c=null,A.a.forEach(function(A,M){var D=M.toLowerCase();M!=D&&(wD(this,M),iD(this,D,A))},A)),A.f=M}(A.a,A.f)):(D||(M=_M(M,DD)),A.a=new gD(M,A.f))}function PM(A,M,D){A.a.set(M,D)}function VM(A,M){return A.a.get(M)}function XM(A){return A instanceof JM?new JM(A):new JM(A,void 0)}function ZM(A,M){var D=new JM(null,void 0);return RM(D,"https"),A&&(D.b=A),M&&(D.g=M),D}function KM(A,M){return A?M?decodeURI(A.replace(/%25/g,"%2525")):decodeURIComponent(A):""}function _M(A,M,D){return g(A)?(A=encodeURI(A).replace(M,qM),D&&(A=A.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),A):null}function qM(A){return"%"+((A=A.charCodeAt(0))>>4&15).toString(16)+(15&A).toString(16)}JM.prototype.toString=function(){var A=[],M=this.c;M&&A.push(_M(M,$M,!0),":");var D=this.b;return(D||"file"==M)&&(A.push("//"),(M=this.o)&&A.push(_M(M,$M,!0),"@"),A.push(encodeURIComponent(String(D)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(D=this.i)&&A.push(":",String(D))),(D=this.g)&&(this.b&&"/"!=D.charAt(0)&&A.push("/"),A.push(_M(D,"/"==D.charAt(0)?MD:AD,!0))),(D=this.a.toString())&&A.push("?",D),(D=this.h)&&A.push("#",_M(D,ID)),A.join("")};var $M=/[#\/\?@]/g,AD=/[#\?:]/g,MD=/[#\?]/g,DD=/[#\?@]/g,ID=/#/g;function gD(A,M){this.b=this.a=null,this.c=A||null,this.f=!!M}function tD(A){A.a||(A.a=new pM,A.b=0,A.c&&function(A,M){if(A){A=A.split("&");for(var D=0;D2*A.c&&GM(A)))}function ND(A,M){return tD(A),M=TD(A,M),HM(A.a.b,M)}function iD(A,M,D){wD(A,M),0"),kD(""),kD("
");var hD={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 dD(A,M,D){var I=arguments,t=document,e=String(I[0]),w=I[1];if(!nD&&w&&(w.name||w.type)){if(e=["<",e],w.name&&e.push(' name="',TA(w.name),'"'),w.type){e.push(' type="',TA(w.type),'"');var N={};NA(N,w),delete N.type,w=N}e.push(">"),e=e.join("")}return e=t.createElement(e),w&&(g(w)?e.className=w:n(w)?e.className=w.join(" "):lD(e,w)),2'),e.document.write(function(A){return A instanceof YD&&A.constructor===YD&&A.b===SD?A.a:(x("expected object of type SafeHtml, got '"+A+"' of type "+i(A)),"type_error:SafeHtml")}(A)),e.document.close())):(e=I.open(aD(M).toString(),D,e))&&A.noopener&&(e.opener=null),e)try{e.focus()}catch(A){}return e}var PD=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,VD=/^[^@]+@[^@]+$/;function XD(){var A=null;return new oA(function(M){"complete"==D.document.readyState?M():(A=function(){M()},QM(window,"load",A))}).s(function(M){throw zM(window,"load",A),M})}function ZD(A){return A=A||tI(),!("file:"!==TI()||!A.toLowerCase().match(/iphone|ipad|ipod|android/))}function KD(){var A=D.window;try{return!(!A||A==A.top)}catch(A){return!1}}function _D(){return void 0!==D.WorkerGlobalScope&&"function"==typeof D.importScripts}function qD(){return I.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":I.a.INTERNAL.hasOwnProperty("node")?"Node":_D()?"Worker":"Browser"}function $D(){var A=qD();return"ReactNative"===A||"Node"===A}var AI="Firefox",MI="Chrome";function DI(A){var M=A.toLowerCase();return _(M,"opera/")||_(M,"opr/")||_(M,"opios/")?"Opera":_(M,"iemobile")?"IEMobile":_(M,"msie")||_(M,"trident/")?"IE":_(M,"edge/")?"Edge":_(M,"firefox/")?AI:_(M,"silk/")?"Silk":_(M,"blackberry")?"Blackberry":_(M,"webos")?"Webos":!_(M,"safari/")||_(M,"chrome/")||_(M,"crios/")||_(M,"android")?!_(M,"chrome/")&&!_(M,"crios/")||_(M,"edge/")?_(M,"android")?"Android":(A=A.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==A.length?A[1]:"Other":MI:"Safari"}var II={Wc:"FirebaseCore-web",Yc:"FirebaseUI-web"};function gI(A,M){M=M||[];var D,I=[],g={};for(D in II)g[II[D]]=!0;for(D=0;DM)throw Error("Short delay should be less than long delay!");this.a=A,this.c=M,A=tI(),M=qD(),this.b=RD(A)||"ReactNative"===M}function CI(){var A=D.document;return!A||void 0===A.visibilityState||"visible"==A.visibilityState}function QI(A){try{var M=new Date(parseInt(A,10));if(!isNaN(M.getTime())&&!/[^0-9]/.test(A))return M.toUTCString()}catch(A){}return null}function zI(){return!(!eI("fireauth.oauthhelper",D)&&!eI("fireauth.iframe",D))}rI.prototype.get=function(){var A=D.navigator;return!A||"boolean"!=typeof A.onLine||!iI()&&"chrome-extension:"!==TI()&&void 0===A.connection||A.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var BI,aI={};function LI(A){aI[A]||(aI[A]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(A))}try{var sI={};Object.defineProperty(sI,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(sI,"abcd",{configurable:!0,enumerable:!0,value:2}),BI=2==sI.abcd}catch(A){BI=!1}function xI(A,M,D){BI?Object.defineProperty(A,M,{configurable:!0,enumerable:!0,value:D}):A[M]=D}function OI(A,M){if(M)for(var D in M)M.hasOwnProperty(D)&&xI(A,D,M[D])}function YI(A){var M={};return OI(M,A),M}function SI(A){var M=A;if("object"==typeof A&&null!=A)for(var D in M="length"in A?[]:{},A)xI(M,D,SI(A[D]));return M}var kI="EMAIL_SIGNIN",UI="email",lI="newEmail",hI="requestType",dI="email",FI="fromEmail",fI="data",mI="operation";function pI(A,M){this.code=HI+A,this.message=M||bI[A]||""}function GI(A){var M=A&&A.code;return M?new pI(M.substring(HI.length),A.message):null}B(pI,Error),pI.prototype.w=function(){return{code:this.code,message:this.message}},pI.prototype.toJSON=function(){return this.w()};var HI="auth/",bI={"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-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-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.","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-or-invalid-nonce":"The OIDC ID token requires a valid unhashed nonce.","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.",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-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"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."};function JI(A){var M=A[VI];if(void 0===M)throw new pI("missing-continue-uri");if("string"!=typeof M||"string"==typeof M&&!M.length)throw new pI("invalid-continue-uri");this.h=M,this.b=this.a=null,this.g=!1;var D=A[RI];if(D&&"object"==typeof D){M=D[KI];var I=D[XI];if(D=D[ZI],"string"==typeof M&&M.length){if(this.a=M,void 0!==I&&"boolean"!=typeof I)throw new pI("argument-error",XI+" property must be a boolean when specified.");if(this.g=!!I,void 0!==D&&("string"!=typeof D||"string"==typeof D&&!D.length))throw new pI("argument-error",ZI+" property must be a non empty string when specified.");this.b=D||null}else{if(void 0!==M)throw new pI("argument-error",KI+" property must be a non empty string when specified.");if(void 0!==I||void 0!==D)throw new pI("missing-android-pkg-name")}}else if(void 0!==D)throw new pI("argument-error",RI+" property must be a non null object when specified.");if(this.f=null,(M=A[PI])&&"object"==typeof M){if("string"==typeof(M=M[_I])&&M.length)this.f=M;else if(void 0!==M)throw new pI("argument-error",_I+" property must be a non empty string when specified.")}else if(void 0!==M)throw new pI("argument-error",PI+" property must be a non null object when specified.");if(void 0!==(M=A[WI])&&"boolean"!=typeof M)throw new pI("argument-error",WI+" property must be a boolean when specified.");if(this.c=!!M,void 0!==(A=A[vI])&&("string"!=typeof A||"string"==typeof A&&!A.length))throw new pI("argument-error",vI+" property must be a non empty string when specified.");this.i=A||null}var RI="android",vI="dynamicLinkDomain",WI="handleCodeInApp",PI="iOS",VI="url",XI="installApp",ZI="minimumVersion",KI="packageName",_I="bundleId";function qI(A){var M={};for(var D in M.continueUrl=A.h,M.canHandleCodeInApp=A.c,(M.androidPackageName=A.a)&&(M.androidMinimumVersion=A.b,M.androidInstallApp=A.g),M.iOSBundleId=A.f,M.dynamicLinkDomain=A.i,M)null===M[D]&&delete M[D];return M}var $I=null,Ag=null;function Mg(A){var M="";return function(A,M){function D(M){for(;IA;A++)$I[A]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(A),Ag[$I[A]]=A,62<=A&&(Ag["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(A)]=A)}}();for(var I=0;;){var g=D(-1),t=D(0),e=D(64),w=D(64);if(64===w&&-1===g)break;M(g<<2|t>>4),64!=e&&(M(t<<4&240|e>>2),64!=w&&M(e<<6&192|w))}}(A,function(A){M+=String.fromCharCode(A)}),M}function Dg(A){this.c=A.sub,z(),this.a=A.provider_id||A.firebase&&A.firebase.sign_in_provider||null,this.b=!!A.is_anonymous||"anonymous"==this.a}function Ig(A){return(A=gg(A))&&A.sub&&A.iss&&A.aud&&A.exp?new Dg(A):null}function gg(A){if(!A)return null;if(3!=(A=A.split(".")).length)return null;for(var M=(4-(A=A[1]).length%4)%4,D=0;D Auth section -> Sign in method tab.",A):"http"==I||"https"==I?D=iA("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.",A):M="operation-not-supported-in-this-environment",pI.call(this,M,D)}function tt(A,M,D){pI.call(this,A,D),(A=M||{}).Ab&&xI(this,"email",A.Ab),A.$&&xI(this,"phoneNumber",A.$),A.credential&&xI(this,"credential",A.credential)}function et(A){if(A.code){var M=A.code||"";0==M.indexOf(HI)&&(M=M.substring(HI.length));var D={credential:_g(A)};if(A.email)D.Ab=A.email;else if(A.phoneNumber)D.$=A.phoneNumber;else if(!D.credential)return new pI(M,A.message||void 0);return new tt(M,D,A.message)}return null}function wt(){}function Nt(A){return A.c||(A.c=A.b())}function it(){}function Tt(A){if(!A.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var M=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],D=0;D=function A(M){return M.c?M.c:M.a?A(M.a):(x("Root logger has no level set."),null)}(this).value)for(E(M)&&(M=M()),A=new jt(A,String(M),this.f),D&&(A.a=D),D=this;D;)D=D.a};var zt={},Bt=null;function at(A){var M;if(Bt||(Bt=new yt(""),zt[""]=Bt,Bt.c=Ct),!(M=zt[A])){M=new yt(A);var D=A.lastIndexOf("."),I=A.substr(D+1);(D=at(A.substr(0,D))).b||(D.b={}),D.b[I]=M,M.a=D,zt[A]=M}return M}function Lt(A,M){A&&A.log(Qt,M,void 0)}function st(A){this.f=A}function xt(A){kM.call(this),this.u=A,this.readyState=Ot,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=at("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}B(st,wt),st.prototype.a=function(){return new xt(this.f)},st.prototype.b=function(A){return function(){return A}}({}),B(xt,kM);var Ot=0;function Yt(A){A.c.read().then(A.ec.bind(A)).catch(A.La.bind(A))}function St(A,M){M&&A.f&&(A.status=A.f.status,A.statusText=A.f.statusText),A.readyState=4,A.f=null,A.c=null,A.l=null,kt(A)}function kt(A){A.onreadystatechange&&A.onreadystatechange.call(A)}function Ut(A){kM.call(this),this.headers=new pM,this.D=A||null,this.c=!1,this.A=this.a=null,this.h=this.N=this.l="",this.f=this.I=this.i=this.G=!1,this.g=0,this.u=null,this.m=lt,this.v=this.O=!1}(A=xt.prototype).open=function(A,M){if(this.readyState!=Ot)throw this.abort(),Error("Error reopening a connection");this.m=A,this.g=M,this.readyState=1,kt(this)},A.send=function(A){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var M={headers:this.i,method:this.m,credentials:void 0,cache:void 0};A&&(M.body=A),this.u.fetch(new Request(this.g,M)).then(this.jc.bind(this),this.La.bind(this))},A.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,St(this,!1)),this.readyState=Ot},A.jc=function(A){this.a&&(this.f=A,this.b||(this.b=A.headers,this.readyState=2,kt(this)),this.a&&(this.readyState=3,kt(this),this.a&&("arraybuffer"===this.responseType?A.arrayBuffer().then(this.hc.bind(this),this.La.bind(this)):void 0!==D.ReadableStream&&"body"in A?(this.response=this.responseText="",this.c=A.body.getReader(),this.l=new TextDecoder,Yt(this)):A.text().then(this.ic.bind(this),this.La.bind(this)))))},A.ec=function(A){if(this.a){var M=this.l.decode(A.value?A.value:new Uint8Array(0),{stream:!A.done});M&&(this.response=this.responseText+=M),A.done?St(this,!0):kt(this),3==this.readyState&&Yt(this)}},A.ic=function(A){this.a&&(this.response=this.responseText=A,St(this,!0))},A.hc=function(A){this.a&&(this.response=A,St(this,!0))},A.La=function(A){var M=this.h;M&&M.log(rt,"Failed to fetch url "+this.g,A instanceof Error?A:Error(A)),this.a&&St(this,!0)},A.setRequestHeader=function(A,M){this.i.append(A,M)},A.getResponseHeader=function(A){return this.b?this.b.get(A.toLowerCase())||"":((A=this.h)&&A.log(rt,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},A.getAllResponseHeaders=function(){if(!this.b){var A=this.h;return A&&A.log(rt,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}A=[];for(var M=this.b.entries(),D=M.next();!D.done;)D=D.value,A.push(D[0]+": "+D[1]),D=M.next();return A.join("\r\n")},B(Ut,kM);var lt="";Ut.prototype.b=at("goog.net.XhrIo");var ht=/^https?$/i,dt=["POST","PUT"];function Ft(A,M,I,t,e){if(A.a)throw Error("[goog.net.XhrIo] Object is active with another request="+A.l+"; newUri="+M);I=I?I.toUpperCase():"GET",A.l=M,A.h="",A.N=I,A.G=!1,A.c=!0,A.a=A.D?A.D.a():Dt.a(),A.A=A.D?Nt(A.D):Nt(Dt),A.a.onreadystatechange=C(A.Jb,A);try{Lt(A.b,vt(A,"Opening Xhr")),A.I=!0,A.a.open(I,String(M),!0),A.I=!1}catch(M){return Lt(A.b,vt(A,"Error opening Xhr: "+M.message)),void mt(A,M)}M=t||"";var w=new pM(A.headers);e&&function(A,M){if(A.forEach&&"function"==typeof A.forEach)A.forEach(M,void 0);else if(c(A)||g(A))d(A,M,void 0);else for(var D=mM(A),I=fM(A),t=I.length,e=0;eM?null:g(A)?A.charAt(M):A[M]}(w.U()),t=D.FormData&&M instanceof D.FormData,!m(dt,I)||e||t||w.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),w.forEach(function(A,M){this.a.setRequestHeader(M,A)},A),A.m&&(A.a.responseType=A.m),"withCredentials"in A.a&&A.a.withCredentials!==A.O&&(A.a.withCredentials=A.O);try{bt(A),0=M.o&&M.cancel())}this.v?this.v.call(this.u,this):this.l=!0,this.a||(A=new qt(this),Vt(this),Pt(this,!1,A))}},Wt.prototype.m=function(A,M){this.i=!1,Pt(this,A,M)},Wt.prototype.then=function(A,M,D){var I,g,t=new oA(function(A,M){I=A,g=M});return Xt(this,I,function(A){A instanceof qt?t.cancel():g(A)}),t.then(A,M,D)},Wt.prototype.$goog_Thenable=!0,B(_t,L),_t.prototype.message="Deferred has already fired",_t.prototype.name="AlreadyCalledError",B(qt,L),qt.prototype.message="Deferred was canceled",qt.prototype.name="CanceledError",$t.prototype.c=function(){throw delete Ae[this.a],this.b};var Ae={};function Me(A){var M={},I=M.document||document,g=uD(A).toString(),t=document.createElement("SCRIPT"),N={Lb:t,Ga:void 0},i=new Wt(N),T=null,n=null!=M.timeout?M.timeout:5e3;return 0A||vA&&$A&&!(9<$A))})()||_D()?A=C(A.m,A):(ie||(ie=new oA(function(A,M){!function(A,M){if(((window.gapi||{}).client||{}).request)A();else{D[Ce]=function(){((window.gapi||{}).client||{}).request?A():M(Error("CORS_UNSUPPORTED"))};var I=rD(re,{onload:Ce});!function(A,M){Xt(A,null,M,void 0)}(Me(I),function(){M(Error("CORS_UNSUPPORTED"))})}}(A,M)})),A=C(A.l,A)),A(M,I,g,t,e,w)}Ne.prototype.m=function(A,M,I,g,t,e){if(_D()&&(void 0===D.fetch||void 0===D.Headers||void 0===D.Request))throw new pI("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 w=new Ut(this.c);if(e){w.g=Math.max(0,e);var N=setTimeout(function(){w.dispatchEvent("timeout")},e)}UM(w,"complete",function(){N&&clearTimeout(N);var A=null;try{A=JSON.parse(function(A){try{return A.a?A.a.responseText:""}catch(M){return Lt(A.b,"Can not get responseText: "+M.message),""}}(this))||null}catch(M){A=null}M&&M(A)}),lM(w,"ready",function(){N&&clearTimeout(N),HA(this)}),lM(w,"timeout",function(){N&&clearTimeout(N),HA(this),M&&M(null)}),Ft(w,A,I,g,t)};var re=new cD(yD,"https://apis.google.com/js/client.js?onload=%{onload}"),Ce="__fcb"+Math.floor(1e6*Math.random()).toString();function Qe(A){if(!g(A=A.email)||!VD.test(A))throw new pI("invalid-email")}function ze(A){"email"in A&&Qe(A)}function Be(A){if(!A[Te])throw new pI("internal-error")}function ae(A){if(A.phoneNumber||A.temporaryProof){if(!A.phoneNumber||!A.temporaryProof)throw new pI("internal-error")}else{if(!A.sessionInfo)throw new pI("missing-verification-id");if(!A.code)throw new pI("missing-verification-code")}}Ne.prototype.l=function(A,M,D,I,g){var t=this;ie.then(function(){window.gapi.client.setApiKey(t.b);var e=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:A,method:D,body:I,headers:g,authType:"none",callback:function(A){window.gapi.auth.setToken(e),M&&M(A)}})}).s(function(A){M&&M({error:{message:A&&A.message||"CORS_UNSUPPORTED"}})})},Ne.prototype.Ra=function(){return tw(this,Ke,{})},Ne.prototype.qb=function(A,M){return tw(this,Xe,{idToken:A,email:M})},Ne.prototype.rb=function(A,M){return tw(this,Ze,{idToken:A,password:M})};var Le={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function se(A){if(!A.requestUri||!A.sessionId&&!A.postBody&&!A.pendingToken)throw new pI("internal-error")}function xe(A,M){return M.oauthIdToken&&M.providerId&&0==M.providerId.indexOf("oidc.")&&!M.pendingToken&&(A.sessionId?M.nonce=A.sessionId:A.postBody&&(ND(A=new gD(A.postBody),"nonce")&&(M.nonce=A.get("nonce")))),M}function Oe(A){var M=null;if(A.needConfirmation?(A.code="account-exists-with-different-credential",M=et(A)):"FEDERATED_USER_ID_ALREADY_LINKED"==A.errorMessage?(A.code="credential-already-in-use",M=et(A)):"EMAIL_EXISTS"==A.errorMessage?(A.code="email-already-in-use",M=et(A)):A.errorMessage&&(M=ew(A.errorMessage)),M)throw M;if(!A[Te])throw new pI("internal-error")}function Ye(A,M){return M.returnIdpCredential=!0,tw(A,_e,M)}function Se(A,M){return M.returnIdpCredential=!0,tw(A,$e,M)}function ke(A,M){return M.returnIdpCredential=!0,M.autoCreate=!1,tw(A,qe,M)}function Ue(A){if(!A.oobCode)throw new pI("invalid-action-code")}(A=Ne.prototype).sb=function(A,M){var D={idToken:A},I=[];return DA(Le,function(A,g){var t=M[g];null===t?I.push(A):g in M&&(D[g]=t)}),I.length&&(D.deleteAttribute=I),tw(this,Xe,D)},A.lb=function(A,M){return NA(A={requestType:"PASSWORD_RESET",email:A},M),tw(this,Re,A)},A.mb=function(A,M){return NA(A={requestType:"EMAIL_SIGNIN",email:A},M),tw(this,be,A)},A.kb=function(A,M){return NA(A={requestType:"VERIFY_EMAIL",idToken:A},M),tw(this,Je,A)},A.Va=function(A){return tw(this,Dw,A)},A.$a=function(A,M){return tw(this,Pe,{oobCode:A,newPassword:M})},A.Ja=function(A){return tw(this,he,{oobCode:A})},A.Xa=function(A){return tw(this,le,{oobCode:A})};var le={endpoint:"setAccountInfo",C:Ue,da:"email"},he={endpoint:"resetPassword",C:Ue,J:function(A){var M=A.requestType;if(!M||!A.email&&"EMAIL_SIGNIN"!=M)throw new pI("internal-error")}},de={endpoint:"signupNewUser",C:function(A){if(Qe(A),!A.password)throw new pI("weak-password")},J:Be,R:!0},Fe={endpoint:"createAuthUri"},fe={endpoint:"deleteAccount",T:["idToken"]},me={endpoint:"setAccountInfo",T:["idToken","deleteProvider"],C:function(A){if(!n(A.deleteProvider))throw new pI("internal-error")}},pe={endpoint:"emailLinkSignin",T:["email","oobCode"],C:Qe,J:Be,R:!0},Ge={endpoint:"emailLinkSignin",T:["idToken","email","oobCode"],C:Qe,J:Be,R:!0},He={endpoint:"getAccountInfo"},be={endpoint:"getOobConfirmationCode",T:["requestType"],C:function(A){if("EMAIL_SIGNIN"!=A.requestType)throw new pI("internal-error");Qe(A)},da:"email"},Je={endpoint:"getOobConfirmationCode",T:["idToken","requestType"],C:function(A){if("VERIFY_EMAIL"!=A.requestType)throw new pI("internal-error")},da:"email"},Re={endpoint:"getOobConfirmationCode",T:["requestType"],C:function(A){if("PASSWORD_RESET"!=A.requestType)throw new pI("internal-error");Qe(A)},da:"email"},ve={vb:!0,endpoint:"getProjectConfig",Ib:"GET"},We={vb:!0,endpoint:"getRecaptchaParam",Ib:"GET",J:function(A){if(!A.recaptchaSiteKey)throw new pI("internal-error")}},Pe={endpoint:"resetPassword",C:Ue,da:"email"},Ve={endpoint:"sendVerificationCode",T:["phoneNumber","recaptchaToken"],da:"sessionInfo"},Xe={endpoint:"setAccountInfo",T:["idToken"],C:ze,R:!0},Ze={endpoint:"setAccountInfo",T:["idToken"],C:function(A){if(ze(A),!A.password)throw new pI("weak-password")},J:Be,R:!0},Ke={endpoint:"signupNewUser",J:Be,R:!0},_e={endpoint:"verifyAssertion",C:se,Pa:xe,J:Oe,R:!0},qe={endpoint:"verifyAssertion",C:se,Pa:xe,J:function(A){if(A.errorMessage&&"USER_NOT_FOUND"==A.errorMessage)throw new pI("user-not-found");if(A.errorMessage)throw ew(A.errorMessage);if(!A[Te])throw new pI("internal-error")},R:!0},$e={endpoint:"verifyAssertion",C:function(A){if(se(A),!A.idToken)throw new pI("internal-error")},Pa:xe,J:Oe,R:!0},Aw={endpoint:"verifyCustomToken",C:function(A){if(!A.token)throw new pI("invalid-custom-token")},J:Be,R:!0},Mw={endpoint:"verifyPassword",C:function(A){if(Qe(A),!A.password)throw new pI("wrong-password")},J:Be,R:!0},Dw={endpoint:"verifyPhoneNumber",C:ae,J:Be},Iw={endpoint:"verifyPhoneNumber",C:function(A){if(!A.idToken)throw new pI("internal-error");ae(A)},J:function(A){if(A.temporaryProof)throw A.code="credential-already-in-use",et(A);Be(A)}},gw={Xb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",C:ae,J:Be};function tw(A,M,D){if(!function(A,M){if(!M||!M.length)return!0;if(!A)return!1;for(var D=0;DM;M++){g=0|D[M-15],I=0|D[M-2];var t=(0|D[M-16])+((g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3)|0,e=(0|D[M-7])+((I>>>17|I<<15)^(I>>>19|I<<13)^I>>>10)|0;D[M]=t+e|0}I=0|A.a[0],g=0|A.a[1];var w=0|A.a[2],N=0|A.a[3],i=0|A.a[4],T=0|A.a[5],n=0|A.a[6];for(t=0|A.a[7],M=0;64>M;M++){var c=((I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10))+(I&g^I&w^g&w)|0;e=(t=t+((i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7))|0)+((e=(e=i&T^~i&n)+(0|tN[M])|0)+(0|D[M])|0)|0,t=n,n=T,T=i,i=N+e|0,N=w,w=g,g=I,I=e+c|0}A.a[0]=A.a[0]+I|0,A.a[1]=A.a[1]+g|0,A.a[2]=A.a[2]+w|0,A.a[3]=A.a[3]+N|0,A.a[4]=A.a[4]+i|0,A.a[5]=A.a[5]+T|0,A.a[6]=A.a[6]+n|0,A.a[7]=A.a[7]+t|0}function jN(A,M,D){void 0===D&&(D=M.length);var I=0,t=A.c;if(g(M))for(;I=e&&e==(0|e)))throw Error("message must be a byte array");A.f[t++]=e,t==A.b&&(EN(A),t=0)}}A.c=t,A.g+=D}wN.prototype.reset=function(){this.g=this.c=0,this.a=D.Int32Array?new Int32Array(this.h):b(this.h)};var yN=[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 oN(){wN.call(this,8,uN)}B(oN,wN);var uN=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function rN(A,M,D,I,g){this.l=A,this.i=M,this.o=D,this.m=I||null,this.u=g||null,this.h=M+":"+D,this.v=new function(){this.a=AN()},this.g=new function(A){this.a=A,this.b=AN()}(this.h),this.f=null,this.b=[],this.a=this.c=null}function CN(A){return new pI("invalid-cordova-configuration",A)}function QN(A){var M=new oN;jN(M,A),A=[];var D=8*M.g;56>M.c?jN(M,cN,56-M.c):jN(M,cN,M.b-(M.c-56));for(var I=63;56<=I;I--)M.f[I]=255&D,D/=256;for(EN(M),I=D=0;I>g&255;return function(A){return F(A,function(A){return 1<(A=A.toString(16)).length?A:"0"+A}).join("")}(A)}function zN(A,M){for(var D=0;DA.f&&(A.a=A.f),M)}(M,I)).then(function(){return function(){var A=D.document,M=null;return CI()||!A?aA():new oA(function(D){M=function(){CI()&&(A.removeEventListener("visibilitychange",M,!1),D())},A.addEventListener("visibilitychange",M,!1)}).s(function(D){throw A.removeEventListener("visibilitychange",M,!1),D})}()}).then(function(){return M.h()}).then(function(){A(M,!0)}).s(function(D){M.i(D)&&A(M,!1)})}(this,!0)},vN.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},WN.prototype.w=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},WN.prototype.getToken=function(A){return A=!!A,this.b&&!this.a?LA(new pI("user-token-expired")):A||!this.b||z()>this.c-3e4?this.a?XN(this,{grant_type:"refresh_token",refresh_token:this.a}):aA(null):aA({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},ZN.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},B(KN,wM),B(_N,kM),_N.prototype.pa=function(A){this.ka=A,ye(this.b,A)},_N.prototype.ea=function(){return this.ka},_N.prototype.ya=function(){return b(this.O)},_N.prototype.Ha=function(){this.A.b&&(this.A.stop(),this.A.start())},xI(_N.prototype,"providerId","firebase"),(A=_N.prototype).reload=function(){var A=this;return ai(this,ii(this).then(function(){return yi(A).then(function(){return ti(A)}).then(Ni)}))},A.dc=function(A){return this.F(A).then(function(A){return new function(A){var M=gg(A);if(!(M&&M.exp&&M.auth_time&&M.iat))throw new pI("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");OI(this,{token:A,expirationTime:QI(1e3*M.exp),authTime:QI(1e3*M.auth_time),issuedAtTime:QI(1e3*M.iat),signInProvider:M.firebase&&M.firebase.sign_in_provider?M.firebase.sign_in_provider:null,claims:M})}(A)})},A.F=function(A){var M=this;return ai(this,ii(this).then(function(){return M.h.getToken(A)}).then(function(A){if(!A)throw new pI("internal-error");return A.accessToken!=M.ra&&(gi(M,A.accessToken),M.dispatchEvent(new KN("tokenChanged"))),Ei(M,"refreshToken",A.refreshToken),A.accessToken}))},A.zc=function(A){if(!(A=A.users)||!A.length)throw new pI("internal-error");wi(this,{uid:(A=A[0]).localId,displayName:A.displayName,photoURL:A.photoUrl,email:A.email,emailVerified:!!A.emailVerified,phoneNumber:A.phoneNumber,lastLoginAt:A.lastLoginAt,createdAt:A.createdAt});for(var M=function(A){return(A=A.providerUserInfo)&&A.length?F(A,function(A){return new function(A,M,D,I,g,t){OI(this,{uid:A,displayName:I||null,photoURL:g||null,email:D||null,phoneNumber:t||null,providerId:M})}(A.rawId,A.providerId,A.email,A.displayName,A.photoUrl,A.phoneNumber)}):[]}(A),D=0;Dthis.u&&(this.u=0),0==this.u&&Ri(this)&&Ii(Ri(this)),this.removeAuthTokenListener(A)},A.addAuthTokenListener=function(A){var M=this;this.m.push(A),Pi(this,this.i.then(function(){M.l||m(M.m,A)&&A(vi(M))}))},A.removeAuthTokenListener=function(A){G(this.m,function(M){return M==A})},A.delete=function(){this.l=!0;for(var A=0;Ag||g>=oT.length)throw new pI("internal-error","Argument validator received an unsupported number of arguments.");D=oT[g],I=(I?"":D+" argument ")+(M.name?'"'+M.name+'" ':"")+"must be "+M.K+".";break A}I=null}}if(I)throw new pI("argument-error",A+" failed: "+I)}(A=eT.prototype).za=function(){var A=this;return this.f?this.f:this.f=cT(this,aA().then(function(){if(iI()&&!_D())return XD();throw new pI("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return A.m.g(A.v())}).then(function(M){return A.g=M,tw(A.u,We,{})}).then(function(M){A.a[iT]=M.recaptchaSiteKey}).s(function(M){throw A.f=null,M}))},A.render=function(){ET(this);var A=this;return cT(this,this.za().then(function(){if(null===A.c){var M=A.l;if(!A.i){var D=UD(M);M=dD("DIV"),D.appendChild(M)}A.c=A.g.render(M,A.a)}return A.c}))},A.verify=function(){ET(this);var A=this;return cT(this,this.render().then(function(M){return new oA(function(D){var I=A.g.getResponse(M);if(I)D(I);else{var g=function(M){M&&(function(A,M){G(A.o,function(A){return A==M})}(A,g),D(M))};A.o.push(g),A.i&&A.g.execute(A.c)}})}))},A.reset=function(){ET(this),null!==this.c&&this.g.reset(this.c)},A.clear=function(){ET(this),this.D=!0,this.m.c();for(var A=0;AD?I.push(A.substring(g,D)):I.push(A.substring(g,g+M));return I},h=function(A,M){if(Array.isArray(A))for(var D=0;D=Math.pow(2,-1022)?(D=(g=Math.min(Math.floor(Math.log(A)/Math.LN2),1023))+1023,I=Math.round(A*Math.pow(2,52-g)-Math.pow(2,52))):(D=0,I=Math.round(A/Math.pow(2,-1074)))),w=[],t=52;t;t-=1)w.push(I%2?1:0),I=Math.floor(I/2);for(t=11;t;t-=1)w.push(D%2?1:0),D=Math.floor(D/2);w.push(M?1:0),w.reverse(),N=w.join("");var i="";for(t=0;t<64;t+=8){var T=parseInt(N.substr(t,8),2).toString(16);1===T.length&&(T="0"+T),i+=T}return i.toLowerCase()},F=new RegExp("^-?\\d{1,10}$"),f=function(A){if(F.test(A)){var M=Number(A);if(M>=-2147483648&&M<=2147483647)return M}return null},m=function(A){try{A()}catch(A){setTimeout(function(){var M=A.stack||"";throw L("Exception was thrown by user callback.",M),A},Math.floor(0))}},p=function(){return("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},G=function(A,M){var D=setTimeout(A,M);return"object"==typeof D&&D.unref&&D.unref(),D},H=function(){function A(A,M){if(void 0===M){this.pieces_=A.split("/");for(var D=0,I=0;I0&&(this.pieces_[D]=this.pieces_[I],D++);this.pieces_.length=D,this.pieceNum_=0}else this.pieces_=A,this.pieceNum_=M}return Object.defineProperty(A,"Empty",{get:function(){return new A("")},enumerable:!0,configurable:!0}),A.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},A.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},A.prototype.popFront=function(){var M=this.pieceNum_;return M=this.pieces_.length)return null;for(var M=[],D=this.pieceNum_;D0&&D.push(g[I])}return new A(D,0)},A.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},A.relativePath=function(M,D){var I=M.getFront(),g=D.getFront();if(null===I)return D;if(I===g)return A.relativePath(M.popFront(),D.popFront());throw new Error("INTERNAL ERROR: innerPath ("+D+") is not within outerPath ("+M+")")},A.comparePaths=function(A,M){for(var D=A.slice(),I=M.slice(),g=0;gA.getLength())return!1;for(;M0&&(this.byteLength_+=1),this.parts_.push(A),this.byteLength_+=e.stringLength(A),this.checkValid_()},A.prototype.pop=function(){var A=this.parts_.pop();this.byteLength_-=e.stringLength(A),this.parts_.length>0&&(this.byteLength_-=1)},A.prototype.checkValid_=function(){if(this.byteLength_>A.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+A.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>A.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+A.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},A.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},A}(),J="long_polling",R=function(){function A(A,M,D,I,g){void 0===g&&(g=""),this.secure=M,this.namespace=D,this.webSocketOnly=I,this.persistenceKey=g,this.host=A.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=n.get("host:"+A)||this.host}return A.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},A.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},A.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},A.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},A.prototype.updateHost=function(A){A!==this.internalHost&&(this.internalHost=A,this.isCacheableHost()&&n.set("host:"+this.host,this.internalHost))},A.prototype.connectionURL=function(A,M){var D;if(e.assert("string"==typeof A,"typeof type must == string"),e.assert("object"==typeof M,"typeof params must == object"),"websocket"===A)D=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(A!==J)throw new Error("Unknown connection type: "+A);D=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(M.ns=this.namespace);var I=[];return e.forEach(M,function(A,M){I.push(A+"="+M)}),D+I.join("&")},A.prototype.toString=function(){var A=this.toURLString();return this.persistenceKey&&(A+="<"+this.persistenceKey+">"),A},A.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},A}();var v,W,P=function(A){var M=V(A),D=M.subdomain;"firebase"===M.domain&&a(M.host+" is no longer supported. Please use .firebaseio.com instead"),D&&"undefined"!=D||"localhost"===M.domain||a("Cannot parse Firebase url. Please use https://.firebaseio.com"),M.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&L("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var I="ws"===M.scheme||"wss"===M.scheme;return{repoInfo:new R(M.host,M.secure,D,I),path:new H(M.pathString)}},V=function(A){var M="",D="",I="",g="",t=!0,e="https",w=443;if("string"==typeof A){var N=A.indexOf("//");N>=0&&(e=A.substring(0,N-1),A=A.substring(N+2));var i=A.indexOf("/");-1===i&&(i=A.length);var T=A.indexOf("?");-1===T&&(T=A.length),M=A.substring(0,Math.min(i,T)),i=0)return;e[M]="set-cookie"===M?(e[M]?e[M]:[]).concat([D]):e[M]?e[M]+", "+D:D}}),e):e}},function(A,M,D){"use strict";var I=D(9);A.exports=I.isStandardBrowserEnv()?function(){var A,M=/(msie|trident)/i.test(navigator.userAgent),D=document.createElement("a");function g(A){var I=A;return M&&(D.setAttribute("href",I),I=D.href),D.setAttribute("href",I),{href:D.href,protocol:D.protocol?D.protocol.replace(/:$/,""):"",host:D.host,search:D.search?D.search.replace(/^\?/,""):"",hash:D.hash?D.hash.replace(/^#/,""):"",hostname:D.hostname,port:D.port,pathname:"/"===D.pathname.charAt(0)?D.pathname:"/"+D.pathname}}return A=g(window.location.href),function(M){var D=I.isString(M)?g(M):M;return D.protocol===A.protocol&&D.host===A.host}}():function(){return!0}},function(A,M,D){"use strict";var I=D(9);A.exports=I.isStandardBrowserEnv()?{write:function(A,M,D,g,t,e){var w=[];w.push(A+"="+encodeURIComponent(M)),I.isNumber(D)&&w.push("expires="+new Date(D).toGMTString()),I.isString(g)&&w.push("path="+g),I.isString(t)&&w.push("domain="+t),!0===e&&w.push("secure"),document.cookie=w.join("; ")},read:function(A){var M=document.cookie.match(new RegExp("(^|;\\s*)("+A+")=([^;]*)"));return M?decodeURIComponent(M[3]):null},remove:function(A){this.write(A,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},function(A,M,D){"use strict";var I=D(9);function g(){this.handlers=[]}g.prototype.use=function(A,M){return this.handlers.push({fulfilled:A,rejected:M}),this.handlers.length-1},g.prototype.eject=function(A){this.handlers[A]&&(this.handlers[A]=null)},g.prototype.forEach=function(A){I.forEach(this.handlers,function(M){null!==M&&A(M)})},A.exports=g},function(A,M,D){"use strict";var I=D(9),g=D(391),t=D(231),e=D(69),w=D(392),N=D(393);function i(A){A.cancelToken&&A.cancelToken.throwIfRequested()}A.exports=function(A){return i(A),A.baseURL&&!w(A.url)&&(A.url=N(A.baseURL,A.url)),A.headers=A.headers||{},A.data=g(A.data,A.headers,A.transformRequest),A.headers=I.merge(A.headers.common||{},A.headers[A.method]||{},A.headers||{}),I.forEach(["delete","get","head","post","put","patch","common"],function(M){delete A.headers[M]}),(A.adapter||e.adapter)(A).then(function(M){return i(A),M.data=g(M.data,M.headers,A.transformResponse),M},function(M){return t(M)||(i(A),M&&M.response&&(M.response.data=g(M.response.data,M.response.headers,A.transformResponse))),Promise.reject(M)})}},function(A,M,D){"use strict";var I=D(9);A.exports=function(A,M,D){return I.forEach(D,function(D){A=D(A,M)}),A}},function(A,M,D){"use strict";A.exports=function(A){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(A)}},function(A,M,D){"use strict";A.exports=function(A,M){return M?A.replace(/\/+$/,"")+"/"+M.replace(/^\/+/,""):A}},function(A,M,D){"use strict";var I=D(232);function g(A){if("function"!=typeof A)throw new TypeError("executor must be a function.");var M;this.promise=new Promise(function(A){M=A});var D=this;A(function(A){D.reason||(D.reason=new I(A),M(D.reason))})}g.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},g.source=function(){var A;return{token:new g(function(M){A=M}),cancel:A}},A.exports=g},function(A,M,D){"use strict";A.exports=function(A){return function(M){return A.apply(null,M)}}},function(A,M,D){"use strict";D.r(M),function(A){var M=D(2),I=D.n(M);(function(){var A,M=M||{},D=this;function g(A){return"string"==typeof A}function t(A){return"boolean"==typeof A}var e=/^[\w+/_-]+[=]{0,2}$/,w=null;function N(){}function i(A){var M=typeof A;if("object"==M){if(!A)return"null";if(A instanceof Array)return"array";if(A instanceof Object)return M;var D=Object.prototype.toString.call(A);if("[object Window]"==D)return"object";if("[object Array]"==D||"number"==typeof A.length&&void 0!==A.splice&&void 0!==A.propertyIsEnumerable&&!A.propertyIsEnumerable("splice"))return"array";if("[object Function]"==D||void 0!==A.call&&void 0!==A.propertyIsEnumerable&&!A.propertyIsEnumerable("call"))return"function"}else if("function"==M&&void 0===A.call)return"object";return M}function T(A){return null===A}function n(A){return"array"==i(A)}function c(A){var M=i(A);return"array"==M||"object"==M&&"number"==typeof A.length}function E(A){return"function"==i(A)}function j(A){var M=typeof A;return"object"==M&&null!=A||"function"==M}var y="closure_uid_"+(1e9*Math.random()>>>0),o=0;function u(A,M,D){return A.call.apply(A.bind,arguments)}function r(A,M,D){if(!A)throw Error();if(2A.b&&(A.b++,M.next=A.a,A.a=M)}function S(){this.b=this.a=null}B(L,Error),L.prototype.name="CustomError",B(s,L),s.prototype.name="AssertionError",O.prototype.get=function(){if(0/g,V=/"/g,X=/'/g,Z=/\x00/g,K=/[\x00&<>"']/;function _(A,M){return-1!=A.indexOf(M)}function q(A,M){return AM?1:0}A:{var $=D.navigator;if($){var AA=$.userAgent;if(AA){J=AA;break A}}J=""}function MA(A){return _(J,A)}function DA(A,M){for(var D in A)M.call(void 0,A[D],D,A)}function IA(A){for(var M in A)return!1;return!0}function gA(A){var M,D={};for(M in A)D[M]=A[M];return D}var tA,eA,wA="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function NA(A,M){for(var D,I,g=1;g")&&(A=A.replace(P,">")),-1!=A.indexOf('"')&&(A=A.replace(V,""")),-1!=A.indexOf("'")&&(A=A.replace(X,"'")),-1!=A.indexOf("\0")&&(A=A.replace(Z,"�"))),A}function nA(A){D.setTimeout(function(){throw A},0)}function cA(A,M){eA||function(){if(D.Promise&&D.Promise.resolve){var A=D.Promise.resolve(void 0);eA=function(){A.then(yA)}}else eA=function(){var A=yA;!E(D.setImmediate)||D.Window&&D.Window.prototype&&!MA("Edge")&&D.Window.prototype.setImmediate==D.setImmediate?(tA||(tA=function(){var A=D.MessageChannel;if(void 0===A&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!MA("Presto")&&(A=function(){var A=document.createElement("IFRAME");A.style.display="none",A.src="",document.documentElement.appendChild(A);var M=A.contentWindow;(A=M.document).open(),A.write(""),A.close();var D="callImmediate"+Math.random(),I="file:"==M.location.protocol?"*":M.location.protocol+"//"+M.location.host;A=C(function(A){"*"!=I&&A.origin!=I||A.data!=D||this.port1.onmessage()},this),M.addEventListener("message",A,!1),this.port1={},this.port2={postMessage:function(){M.postMessage(D,I)}}}),void 0!==A&&!MA("Trident")&&!MA("MSIE")){var M=new A,I={},g=I;return M.port1.onmessage=function(){if(void 0!==I.next){var A=(I=I.next).xb;I.xb=null,A()}},function(A){g.next={xb:A},g=g.next,M.port2.postMessage(0)}}return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(A){var M=document.createElement("SCRIPT");M.onreadystatechange=function(){M.onreadystatechange=null,M.parentNode.removeChild(M),M=null,A(),A=null},document.documentElement.appendChild(M)}:function(A){D.setTimeout(A,0)}}()),tA(A)):D.setImmediate(A)}}(),EA||(eA(),EA=!0),jA.add(A,M)}var EA=!1,jA=new S;function yA(){for(var A;A=U();){try{A.a.call(A.b)}catch(A){nA(A)}Y(k,A)}EA=!1}function oA(A,M){if(this.a=uA,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,A!=N)try{var D=this;A.call(M,function(A){SA(D,rA,A)},function(A){if(!(A instanceof fA))try{if(A instanceof Error)throw A;throw Error("Promise rejected.")}catch(A){}SA(D,CA,A)})}catch(A){SA(this,CA,A)}}var uA=0,rA=2,CA=3;function QA(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}QA.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var zA=new O(function(){return new QA},function(A){A.reset()});function BA(A,M,D){var I=zA.get();return I.g=A,I.b=M,I.f=D,I}function aA(A){if(A instanceof oA)return A;var M=new oA(N);return SA(M,rA,A),M}function LA(A){return new oA(function(M,D){D(A)})}function sA(A,M,D){kA(A,M,D,null)||cA(Q(M,A))}function xA(A){return new oA(function(M){var D=A.length,I=[];if(D)for(var g=function(A,g,t){D--,I[A]=g?{Eb:!0,value:t}:{Eb:!1,reason:t},0==D&&M(I)},t=0;tparseFloat(KA)){JA=String(qA);break A}}JA=KA}var $A,AM={};function MM(A){return function(A,M){var D=AM;return Object.prototype.hasOwnProperty.call(D,A)?D[A]:D[A]=M(A)}(A,function(){for(var M=0,D=R(String(JA)).split("."),I=R(String(A)).split("."),g=Math.max(D.length,I.length),t=0;0==M&&t=A.keyCode)&&(A.keyCode=-1)}catch(A){}},NM.prototype.f=function(){return this.a};var TM="closure_listenable_"+(1e6*Math.random()|0),nM=0;function cM(A){A.oa=!0,A.listener=null,A.proxy=null,A.src=null,A.Ma=null}function EM(A){this.src=A,this.a={},this.b=0}function jM(A,M){var D=M.type;D in A.a&&p(A.a[D],M)&&(cM(M),0==A.a[D].length&&(delete A.a[D],A.b--))}function yM(A,M,D,I){for(var g=0;gg.keyCode||void 0!=g.returnValue)){A:{var t=!1;if(0==g.keyCode)try{g.keyCode=-1;break A}catch(A){t=!0}(t||void 0==g.returnValue)&&(g.returnValue=!0)}for(g=[],t=M.b;t;t=t.parentNode)g.push(t);for(A=A.type,t=g.length-1;0<=t;t--){M.b=g[t];var e=LM(g[t],A,!0,M);I=I&&e}for(t=0;t>>0);function SM(A){return E(A)?A:(A[YM]||(A[YM]=function(M){return A.handleEvent(M)}),A[YM])}function kM(){mA.call(this),this.o=new EM(this),this.Rb=this,this.Wa=null}function UM(A,M,D,I,g){A.o.add(String(M),D,!1,I,g)}function lM(A,M,D,I,g){A.o.add(String(M),D,!0,I,g)}function hM(A,M,D,I){if(!(M=A.o.a[String(M)]))return!0;M=M.concat();for(var g=!0,t=0;tM)throw Error("Bad port number "+M);A.i=M}else A.i=null}function WM(A,M,D){M instanceof gD?(A.a=M,function(A,M){M&&!A.f&&(tD(A),A.c=null,A.a.forEach(function(A,M){var D=M.toLowerCase();M!=D&&(wD(this,M),iD(this,D,A))},A)),A.f=M}(A.a,A.f)):(D||(M=_M(M,DD)),A.a=new gD(M,A.f))}function PM(A,M,D){A.a.set(M,D)}function VM(A,M){return A.a.get(M)}function XM(A){return A instanceof JM?new JM(A):new JM(A,void 0)}function ZM(A,M){var D=new JM(null,void 0);return RM(D,"https"),A&&(D.b=A),M&&(D.g=M),D}function KM(A,M){return A?M?decodeURI(A.replace(/%25/g,"%2525")):decodeURIComponent(A):""}function _M(A,M,D){return g(A)?(A=encodeURI(A).replace(M,qM),D&&(A=A.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),A):null}function qM(A){return"%"+((A=A.charCodeAt(0))>>4&15).toString(16)+(15&A).toString(16)}JM.prototype.toString=function(){var A=[],M=this.c;M&&A.push(_M(M,$M,!0),":");var D=this.b;return(D||"file"==M)&&(A.push("//"),(M=this.o)&&A.push(_M(M,$M,!0),"@"),A.push(encodeURIComponent(String(D)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(D=this.i)&&A.push(":",String(D))),(D=this.g)&&(this.b&&"/"!=D.charAt(0)&&A.push("/"),A.push(_M(D,"/"==D.charAt(0)?MD:AD,!0))),(D=this.a.toString())&&A.push("?",D),(D=this.h)&&A.push("#",_M(D,ID)),A.join("")};var $M=/[#\/\?@]/g,AD=/[#\?:]/g,MD=/[#\?]/g,DD=/[#\?@]/g,ID=/#/g;function gD(A,M){this.b=this.a=null,this.c=A||null,this.f=!!M}function tD(A){A.a||(A.a=new pM,A.b=0,A.c&&function(A,M){if(A){A=A.split("&");for(var D=0;D2*A.c&&GM(A)))}function ND(A,M){return tD(A),M=TD(A,M),HM(A.a.b,M)}function iD(A,M,D){wD(A,M),0"),kD(""),kD("
");var hD={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 dD(A,M,D){var I=arguments,t=document,e=String(I[0]),w=I[1];if(!nD&&w&&(w.name||w.type)){if(e=["<",e],w.name&&e.push(' name="',TA(w.name),'"'),w.type){e.push(' type="',TA(w.type),'"');var N={};NA(N,w),delete N.type,w=N}e.push(">"),e=e.join("")}return e=t.createElement(e),w&&(g(w)?e.className=w:n(w)?e.className=w.join(" "):lD(e,w)),2'),e.document.write(function(A){return A instanceof YD&&A.constructor===YD&&A.b===SD?A.a:(x("expected object of type SafeHtml, got '"+A+"' of type "+i(A)),"type_error:SafeHtml")}(A)),e.document.close())):(e=I.open(aD(M).toString(),D,e))&&A.noopener&&(e.opener=null),e)try{e.focus()}catch(A){}return e}var PD=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,VD=/^[^@]+@[^@]+$/;function XD(){var A=null;return new oA(function(M){"complete"==D.document.readyState?M():(A=function(){M()},QM(window,"load",A))}).s(function(M){throw zM(window,"load",A),M})}function ZD(A){return A=A||tI(),!("file:"!==TI()||!A.toLowerCase().match(/iphone|ipad|ipod|android/))}function KD(){var A=D.window;try{return!(!A||A==A.top)}catch(A){return!1}}function _D(){return void 0!==D.WorkerGlobalScope&&"function"==typeof D.importScripts}function qD(){return I.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":I.a.INTERNAL.hasOwnProperty("node")?"Node":_D()?"Worker":"Browser"}function $D(){var A=qD();return"ReactNative"===A||"Node"===A}var AI="Firefox",MI="Chrome";function DI(A){var M=A.toLowerCase();return _(M,"opera/")||_(M,"opr/")||_(M,"opios/")?"Opera":_(M,"iemobile")?"IEMobile":_(M,"msie")||_(M,"trident/")?"IE":_(M,"edge/")?"Edge":_(M,"firefox/")?AI:_(M,"silk/")?"Silk":_(M,"blackberry")?"Blackberry":_(M,"webos")?"Webos":!_(M,"safari/")||_(M,"chrome/")||_(M,"crios/")||_(M,"android")?!_(M,"chrome/")&&!_(M,"crios/")||_(M,"edge/")?_(M,"android")?"Android":(A=A.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==A.length?A[1]:"Other":MI:"Safari"}var II={Wc:"FirebaseCore-web",Yc:"FirebaseUI-web"};function gI(A,M){M=M||[];var D,I=[],g={};for(D in II)g[II[D]]=!0;for(D=0;DM)throw Error("Short delay should be less than long delay!");this.a=A,this.c=M,A=tI(),M=qD(),this.b=RD(A)||"ReactNative"===M}function CI(){var A=D.document;return!A||void 0===A.visibilityState||"visible"==A.visibilityState}function QI(A){try{var M=new Date(parseInt(A,10));if(!isNaN(M.getTime())&&!/[^0-9]/.test(A))return M.toUTCString()}catch(A){}return null}function zI(){return!(!eI("fireauth.oauthhelper",D)&&!eI("fireauth.iframe",D))}rI.prototype.get=function(){var A=D.navigator;return!A||"boolean"!=typeof A.onLine||!iI()&&"chrome-extension:"!==TI()&&void 0===A.connection||A.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var BI,aI={};function LI(A){aI[A]||(aI[A]=!0,"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(A))}try{var sI={};Object.defineProperty(sI,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(sI,"abcd",{configurable:!0,enumerable:!0,value:2}),BI=2==sI.abcd}catch(A){BI=!1}function xI(A,M,D){BI?Object.defineProperty(A,M,{configurable:!0,enumerable:!0,value:D}):A[M]=D}function OI(A,M){if(M)for(var D in M)M.hasOwnProperty(D)&&xI(A,D,M[D])}function YI(A){var M={};return OI(M,A),M}function SI(A){var M=A;if("object"==typeof A&&null!=A)for(var D in M="length"in A?[]:{},A)xI(M,D,SI(A[D]));return M}var kI="EMAIL_SIGNIN",UI="email",lI="newEmail",hI="requestType",dI="email",FI="fromEmail",fI="data",mI="operation";function pI(A,M){this.code=HI+A,this.message=M||bI[A]||""}function GI(A){var M=A&&A.code;return M?new pI(M.substring(HI.length),A.message):null}B(pI,Error),pI.prototype.w=function(){return{code:this.code,message:this.message}},pI.prototype.toJSON=function(){return this.w()};var HI="auth/",bI={"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-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-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.","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-or-invalid-nonce":"The OIDC ID token requires a valid unhashed nonce.","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.",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-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"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."};function JI(A){var M=A[VI];if(void 0===M)throw new pI("missing-continue-uri");if("string"!=typeof M||"string"==typeof M&&!M.length)throw new pI("invalid-continue-uri");this.h=M,this.b=this.a=null,this.g=!1;var D=A[RI];if(D&&"object"==typeof D){M=D[KI];var I=D[XI];if(D=D[ZI],"string"==typeof M&&M.length){if(this.a=M,void 0!==I&&"boolean"!=typeof I)throw new pI("argument-error",XI+" property must be a boolean when specified.");if(this.g=!!I,void 0!==D&&("string"!=typeof D||"string"==typeof D&&!D.length))throw new pI("argument-error",ZI+" property must be a non empty string when specified.");this.b=D||null}else{if(void 0!==M)throw new pI("argument-error",KI+" property must be a non empty string when specified.");if(void 0!==I||void 0!==D)throw new pI("missing-android-pkg-name")}}else if(void 0!==D)throw new pI("argument-error",RI+" property must be a non null object when specified.");if(this.f=null,(M=A[PI])&&"object"==typeof M){if("string"==typeof(M=M[_I])&&M.length)this.f=M;else if(void 0!==M)throw new pI("argument-error",_I+" property must be a non empty string when specified.")}else if(void 0!==M)throw new pI("argument-error",PI+" property must be a non null object when specified.");if(void 0!==(M=A[WI])&&"boolean"!=typeof M)throw new pI("argument-error",WI+" property must be a boolean when specified.");if(this.c=!!M,void 0!==(A=A[vI])&&("string"!=typeof A||"string"==typeof A&&!A.length))throw new pI("argument-error",vI+" property must be a non empty string when specified.");this.i=A||null}var RI="android",vI="dynamicLinkDomain",WI="handleCodeInApp",PI="iOS",VI="url",XI="installApp",ZI="minimumVersion",KI="packageName",_I="bundleId";function qI(A){var M={};for(var D in M.continueUrl=A.h,M.canHandleCodeInApp=A.c,(M.androidPackageName=A.a)&&(M.androidMinimumVersion=A.b,M.androidInstallApp=A.g),M.iOSBundleId=A.f,M.dynamicLinkDomain=A.i,M)null===M[D]&&delete M[D];return M}var $I=null,Ag=null;function Mg(A){var M="";return function(A,M){function D(M){for(;IA;A++)$I[A]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(A),Ag[$I[A]]=A,62<=A&&(Ag["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(A)]=A)}}();for(var I=0;;){var g=D(-1),t=D(0),e=D(64),w=D(64);if(64===w&&-1===g)break;M(g<<2|t>>4),64!=e&&(M(t<<4&240|e>>2),64!=w&&M(e<<6&192|w))}}(A,function(A){M+=String.fromCharCode(A)}),M}function Dg(A){this.c=A.sub,z(),this.a=A.provider_id||A.firebase&&A.firebase.sign_in_provider||null,this.b=!!A.is_anonymous||"anonymous"==this.a}function Ig(A){return(A=gg(A))&&A.sub&&A.iss&&A.aud&&A.exp?new Dg(A):null}function gg(A){if(!A)return null;if(3!=(A=A.split(".")).length)return null;for(var M=(4-(A=A[1]).length%4)%4,D=0;D Auth section -> Sign in method tab.",A):"http"==I||"https"==I?D=iA("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.",A):M="operation-not-supported-in-this-environment",pI.call(this,M,D)}function tt(A,M,D){pI.call(this,A,D),(A=M||{}).Ab&&xI(this,"email",A.Ab),A.$&&xI(this,"phoneNumber",A.$),A.credential&&xI(this,"credential",A.credential)}function et(A){if(A.code){var M=A.code||"";0==M.indexOf(HI)&&(M=M.substring(HI.length));var D={credential:_g(A)};if(A.email)D.Ab=A.email;else if(A.phoneNumber)D.$=A.phoneNumber;else if(!D.credential)return new pI(M,A.message||void 0);return new tt(M,D,A.message)}return null}function wt(){}function Nt(A){return A.c||(A.c=A.b())}function it(){}function Tt(A){if(!A.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var M=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],D=0;D=function A(M){return M.c?M.c:M.a?A(M.a):(x("Root logger has no level set."),null)}(this).value)for(E(M)&&(M=M()),A=new jt(A,String(M),this.f),D&&(A.a=D),D=this;D;)D=D.a};var zt={},Bt=null;function at(A){var M;if(Bt||(Bt=new yt(""),zt[""]=Bt,Bt.c=Ct),!(M=zt[A])){M=new yt(A);var D=A.lastIndexOf("."),I=A.substr(D+1);(D=at(A.substr(0,D))).b||(D.b={}),D.b[I]=M,M.a=D,zt[A]=M}return M}function Lt(A,M){A&&A.log(Qt,M,void 0)}function st(A){this.f=A}function xt(A){kM.call(this),this.u=A,this.readyState=Ot,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=at("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}B(st,wt),st.prototype.a=function(){return new xt(this.f)},st.prototype.b=function(A){return function(){return A}}({}),B(xt,kM);var Ot=0;function Yt(A){A.c.read().then(A.ec.bind(A)).catch(A.La.bind(A))}function St(A,M){M&&A.f&&(A.status=A.f.status,A.statusText=A.f.statusText),A.readyState=4,A.f=null,A.c=null,A.l=null,kt(A)}function kt(A){A.onreadystatechange&&A.onreadystatechange.call(A)}function Ut(A){kM.call(this),this.headers=new pM,this.D=A||null,this.c=!1,this.A=this.a=null,this.h=this.N=this.l="",this.f=this.I=this.i=this.G=!1,this.g=0,this.u=null,this.m=lt,this.v=this.O=!1}(A=xt.prototype).open=function(A,M){if(this.readyState!=Ot)throw this.abort(),Error("Error reopening a connection");this.m=A,this.g=M,this.readyState=1,kt(this)},A.send=function(A){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var M={headers:this.i,method:this.m,credentials:void 0,cache:void 0};A&&(M.body=A),this.u.fetch(new Request(this.g,M)).then(this.jc.bind(this),this.La.bind(this))},A.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,St(this,!1)),this.readyState=Ot},A.jc=function(A){this.a&&(this.f=A,this.b||(this.b=A.headers,this.readyState=2,kt(this)),this.a&&(this.readyState=3,kt(this),this.a&&("arraybuffer"===this.responseType?A.arrayBuffer().then(this.hc.bind(this),this.La.bind(this)):void 0!==D.ReadableStream&&"body"in A?(this.response=this.responseText="",this.c=A.body.getReader(),this.l=new TextDecoder,Yt(this)):A.text().then(this.ic.bind(this),this.La.bind(this)))))},A.ec=function(A){if(this.a){var M=this.l.decode(A.value?A.value:new Uint8Array(0),{stream:!A.done});M&&(this.response=this.responseText+=M),A.done?St(this,!0):kt(this),3==this.readyState&&Yt(this)}},A.ic=function(A){this.a&&(this.response=this.responseText=A,St(this,!0))},A.hc=function(A){this.a&&(this.response=A,St(this,!0))},A.La=function(A){var M=this.h;M&&M.log(rt,"Failed to fetch url "+this.g,A instanceof Error?A:Error(A)),this.a&&St(this,!0)},A.setRequestHeader=function(A,M){this.i.append(A,M)},A.getResponseHeader=function(A){return this.b?this.b.get(A.toLowerCase())||"":((A=this.h)&&A.log(rt,"Attempting to get response header but no headers have been recieved for url: "+this.g,void 0),"")},A.getAllResponseHeaders=function(){if(!this.b){var A=this.h;return A&&A.log(rt,"Attempting to get all response headers but no headers have been recieved for url: "+this.g,void 0),""}A=[];for(var M=this.b.entries(),D=M.next();!D.done;)D=D.value,A.push(D[0]+": "+D[1]),D=M.next();return A.join("\r\n")},B(Ut,kM);var lt="";Ut.prototype.b=at("goog.net.XhrIo");var ht=/^https?$/i,dt=["POST","PUT"];function Ft(A,M,I,t,e){if(A.a)throw Error("[goog.net.XhrIo] Object is active with another request="+A.l+"; newUri="+M);I=I?I.toUpperCase():"GET",A.l=M,A.h="",A.N=I,A.G=!1,A.c=!0,A.a=A.D?A.D.a():Dt.a(),A.A=A.D?Nt(A.D):Nt(Dt),A.a.onreadystatechange=C(A.Jb,A);try{Lt(A.b,vt(A,"Opening Xhr")),A.I=!0,A.a.open(I,String(M),!0),A.I=!1}catch(M){return Lt(A.b,vt(A,"Error opening Xhr: "+M.message)),void mt(A,M)}M=t||"";var w=new pM(A.headers);e&&function(A,M){if(A.forEach&&"function"==typeof A.forEach)A.forEach(M,void 0);else if(c(A)||g(A))d(A,M,void 0);else for(var D=mM(A),I=fM(A),t=I.length,e=0;eM?null:g(A)?A.charAt(M):A[M]}(w.U()),t=D.FormData&&M instanceof D.FormData,!m(dt,I)||e||t||w.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),w.forEach(function(A,M){this.a.setRequestHeader(M,A)},A),A.m&&(A.a.responseType=A.m),"withCredentials"in A.a&&A.a.withCredentials!==A.O&&(A.a.withCredentials=A.O);try{bt(A),0=M.o&&M.cancel())}this.v?this.v.call(this.u,this):this.l=!0,this.a||(A=new qt(this),Vt(this),Pt(this,!1,A))}},Wt.prototype.m=function(A,M){this.i=!1,Pt(this,A,M)},Wt.prototype.then=function(A,M,D){var I,g,t=new oA(function(A,M){I=A,g=M});return Xt(this,I,function(A){A instanceof qt?t.cancel():g(A)}),t.then(A,M,D)},Wt.prototype.$goog_Thenable=!0,B(_t,L),_t.prototype.message="Deferred has already fired",_t.prototype.name="AlreadyCalledError",B(qt,L),qt.prototype.message="Deferred was canceled",qt.prototype.name="CanceledError",$t.prototype.c=function(){throw delete Ae[this.a],this.b};var Ae={};function Me(A){var M={},I=M.document||document,g=uD(A).toString(),t=document.createElement("SCRIPT"),N={Lb:t,Ga:void 0},i=new Wt(N),T=null,n=null!=M.timeout?M.timeout:5e3;return 0A||vA&&$A&&!(9<$A))})()||_D()?A=C(A.m,A):(ie||(ie=new oA(function(A,M){!function(A,M){if(((window.gapi||{}).client||{}).request)A();else{D[Ce]=function(){((window.gapi||{}).client||{}).request?A():M(Error("CORS_UNSUPPORTED"))};var I=rD(re,{onload:Ce});!function(A,M){Xt(A,null,M,void 0)}(Me(I),function(){M(Error("CORS_UNSUPPORTED"))})}}(A,M)})),A=C(A.l,A)),A(M,I,g,t,e,w)}Ne.prototype.m=function(A,M,I,g,t,e){if(_D()&&(void 0===D.fetch||void 0===D.Headers||void 0===D.Request))throw new pI("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 w=new Ut(this.c);if(e){w.g=Math.max(0,e);var N=setTimeout(function(){w.dispatchEvent("timeout")},e)}UM(w,"complete",function(){N&&clearTimeout(N);var A=null;try{A=JSON.parse(function(A){try{return A.a?A.a.responseText:""}catch(M){return Lt(A.b,"Can not get responseText: "+M.message),""}}(this))||null}catch(M){A=null}M&&M(A)}),lM(w,"ready",function(){N&&clearTimeout(N),HA(this)}),lM(w,"timeout",function(){N&&clearTimeout(N),HA(this),M&&M(null)}),Ft(w,A,I,g,t)};var re=new cD(yD,"https://apis.google.com/js/client.js?onload=%{onload}"),Ce="__fcb"+Math.floor(1e6*Math.random()).toString();function Qe(A){if(!g(A=A.email)||!VD.test(A))throw new pI("invalid-email")}function ze(A){"email"in A&&Qe(A)}function Be(A){if(!A[Te])throw new pI("internal-error")}function ae(A){if(A.phoneNumber||A.temporaryProof){if(!A.phoneNumber||!A.temporaryProof)throw new pI("internal-error")}else{if(!A.sessionInfo)throw new pI("missing-verification-id");if(!A.code)throw new pI("missing-verification-code")}}Ne.prototype.l=function(A,M,D,I,g){var t=this;ie.then(function(){window.gapi.client.setApiKey(t.b);var e=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:A,method:D,body:I,headers:g,authType:"none",callback:function(A){window.gapi.auth.setToken(e),M&&M(A)}})}).s(function(A){M&&M({error:{message:A&&A.message||"CORS_UNSUPPORTED"}})})},Ne.prototype.Ra=function(){return tw(this,Ke,{})},Ne.prototype.qb=function(A,M){return tw(this,Xe,{idToken:A,email:M})},Ne.prototype.rb=function(A,M){return tw(this,Ze,{idToken:A,password:M})};var Le={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};function se(A){if(!A.requestUri||!A.sessionId&&!A.postBody&&!A.pendingToken)throw new pI("internal-error")}function xe(A,M){return M.oauthIdToken&&M.providerId&&0==M.providerId.indexOf("oidc.")&&!M.pendingToken&&(A.sessionId?M.nonce=A.sessionId:A.postBody&&(ND(A=new gD(A.postBody),"nonce")&&(M.nonce=A.get("nonce")))),M}function Oe(A){var M=null;if(A.needConfirmation?(A.code="account-exists-with-different-credential",M=et(A)):"FEDERATED_USER_ID_ALREADY_LINKED"==A.errorMessage?(A.code="credential-already-in-use",M=et(A)):"EMAIL_EXISTS"==A.errorMessage?(A.code="email-already-in-use",M=et(A)):A.errorMessage&&(M=ew(A.errorMessage)),M)throw M;if(!A[Te])throw new pI("internal-error")}function Ye(A,M){return M.returnIdpCredential=!0,tw(A,_e,M)}function Se(A,M){return M.returnIdpCredential=!0,tw(A,$e,M)}function ke(A,M){return M.returnIdpCredential=!0,M.autoCreate=!1,tw(A,qe,M)}function Ue(A){if(!A.oobCode)throw new pI("invalid-action-code")}(A=Ne.prototype).sb=function(A,M){var D={idToken:A},I=[];return DA(Le,function(A,g){var t=M[g];null===t?I.push(A):g in M&&(D[g]=t)}),I.length&&(D.deleteAttribute=I),tw(this,Xe,D)},A.lb=function(A,M){return NA(A={requestType:"PASSWORD_RESET",email:A},M),tw(this,Re,A)},A.mb=function(A,M){return NA(A={requestType:"EMAIL_SIGNIN",email:A},M),tw(this,be,A)},A.kb=function(A,M){return NA(A={requestType:"VERIFY_EMAIL",idToken:A},M),tw(this,Je,A)},A.Va=function(A){return tw(this,Dw,A)},A.$a=function(A,M){return tw(this,Pe,{oobCode:A,newPassword:M})},A.Ja=function(A){return tw(this,he,{oobCode:A})},A.Xa=function(A){return tw(this,le,{oobCode:A})};var le={endpoint:"setAccountInfo",C:Ue,da:"email"},he={endpoint:"resetPassword",C:Ue,J:function(A){var M=A.requestType;if(!M||!A.email&&"EMAIL_SIGNIN"!=M)throw new pI("internal-error")}},de={endpoint:"signupNewUser",C:function(A){if(Qe(A),!A.password)throw new pI("weak-password")},J:Be,R:!0},Fe={endpoint:"createAuthUri"},fe={endpoint:"deleteAccount",T:["idToken"]},me={endpoint:"setAccountInfo",T:["idToken","deleteProvider"],C:function(A){if(!n(A.deleteProvider))throw new pI("internal-error")}},pe={endpoint:"emailLinkSignin",T:["email","oobCode"],C:Qe,J:Be,R:!0},Ge={endpoint:"emailLinkSignin",T:["idToken","email","oobCode"],C:Qe,J:Be,R:!0},He={endpoint:"getAccountInfo"},be={endpoint:"getOobConfirmationCode",T:["requestType"],C:function(A){if("EMAIL_SIGNIN"!=A.requestType)throw new pI("internal-error");Qe(A)},da:"email"},Je={endpoint:"getOobConfirmationCode",T:["idToken","requestType"],C:function(A){if("VERIFY_EMAIL"!=A.requestType)throw new pI("internal-error")},da:"email"},Re={endpoint:"getOobConfirmationCode",T:["requestType"],C:function(A){if("PASSWORD_RESET"!=A.requestType)throw new pI("internal-error");Qe(A)},da:"email"},ve={vb:!0,endpoint:"getProjectConfig",Ib:"GET"},We={vb:!0,endpoint:"getRecaptchaParam",Ib:"GET",J:function(A){if(!A.recaptchaSiteKey)throw new pI("internal-error")}},Pe={endpoint:"resetPassword",C:Ue,da:"email"},Ve={endpoint:"sendVerificationCode",T:["phoneNumber","recaptchaToken"],da:"sessionInfo"},Xe={endpoint:"setAccountInfo",T:["idToken"],C:ze,R:!0},Ze={endpoint:"setAccountInfo",T:["idToken"],C:function(A){if(ze(A),!A.password)throw new pI("weak-password")},J:Be,R:!0},Ke={endpoint:"signupNewUser",J:Be,R:!0},_e={endpoint:"verifyAssertion",C:se,Pa:xe,J:Oe,R:!0},qe={endpoint:"verifyAssertion",C:se,Pa:xe,J:function(A){if(A.errorMessage&&"USER_NOT_FOUND"==A.errorMessage)throw new pI("user-not-found");if(A.errorMessage)throw ew(A.errorMessage);if(!A[Te])throw new pI("internal-error")},R:!0},$e={endpoint:"verifyAssertion",C:function(A){if(se(A),!A.idToken)throw new pI("internal-error")},Pa:xe,J:Oe,R:!0},Aw={endpoint:"verifyCustomToken",C:function(A){if(!A.token)throw new pI("invalid-custom-token")},J:Be,R:!0},Mw={endpoint:"verifyPassword",C:function(A){if(Qe(A),!A.password)throw new pI("wrong-password")},J:Be,R:!0},Dw={endpoint:"verifyPhoneNumber",C:ae,J:Be},Iw={endpoint:"verifyPhoneNumber",C:function(A){if(!A.idToken)throw new pI("internal-error");ae(A)},J:function(A){if(A.temporaryProof)throw A.code="credential-already-in-use",et(A);Be(A)}},gw={Xb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",C:ae,J:Be};function tw(A,M,D){if(!function(A,M){if(!M||!M.length)return!0;if(!A)return!1;for(var D=0;DM;M++){g=0|D[M-15],I=0|D[M-2];var t=(0|D[M-16])+((g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3)|0,e=(0|D[M-7])+((I>>>17|I<<15)^(I>>>19|I<<13)^I>>>10)|0;D[M]=t+e|0}I=0|A.a[0],g=0|A.a[1];var w=0|A.a[2],N=0|A.a[3],i=0|A.a[4],T=0|A.a[5],n=0|A.a[6];for(t=0|A.a[7],M=0;64>M;M++){var c=((I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10))+(I&g^I&w^g&w)|0;e=(t=t+((i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7))|0)+((e=(e=i&T^~i&n)+(0|tN[M])|0)+(0|D[M])|0)|0,t=n,n=T,T=i,i=N+e|0,N=w,w=g,g=I,I=e+c|0}A.a[0]=A.a[0]+I|0,A.a[1]=A.a[1]+g|0,A.a[2]=A.a[2]+w|0,A.a[3]=A.a[3]+N|0,A.a[4]=A.a[4]+i|0,A.a[5]=A.a[5]+T|0,A.a[6]=A.a[6]+n|0,A.a[7]=A.a[7]+t|0}function jN(A,M,D){void 0===D&&(D=M.length);var I=0,t=A.c;if(g(M))for(;I=e&&e==(0|e)))throw Error("message must be a byte array");A.f[t++]=e,t==A.b&&(EN(A),t=0)}}A.c=t,A.g+=D}wN.prototype.reset=function(){this.g=this.c=0,this.a=D.Int32Array?new Int32Array(this.h):b(this.h)};var yN=[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 oN(){wN.call(this,8,uN)}B(oN,wN);var uN=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function rN(A,M,D,I,g){this.l=A,this.i=M,this.o=D,this.m=I||null,this.u=g||null,this.h=M+":"+D,this.v=new function(){this.a=AN()},this.g=new function(A){this.a=A,this.b=AN()}(this.h),this.f=null,this.b=[],this.a=this.c=null}function CN(A){return new pI("invalid-cordova-configuration",A)}function QN(A){var M=new oN;jN(M,A),A=[];var D=8*M.g;56>M.c?jN(M,cN,56-M.c):jN(M,cN,M.b-(M.c-56));for(var I=63;56<=I;I--)M.f[I]=255&D,D/=256;for(EN(M),I=D=0;I>g&255;return function(A){return F(A,function(A){return 1<(A=A.toString(16)).length?A:"0"+A}).join("")}(A)}function zN(A,M){for(var D=0;DA.f&&(A.a=A.f),M)}(M,I)).then(function(){return function(){var A=D.document,M=null;return CI()||!A?aA():new oA(function(D){M=function(){CI()&&(A.removeEventListener("visibilitychange",M,!1),D())},A.addEventListener("visibilitychange",M,!1)}).s(function(D){throw A.removeEventListener("visibilitychange",M,!1),D})}()}).then(function(){return M.h()}).then(function(){A(M,!0)}).s(function(D){M.i(D)&&A(M,!1)})}(this,!0)},vN.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},WN.prototype.w=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},WN.prototype.getToken=function(A){return A=!!A,this.b&&!this.a?LA(new pI("user-token-expired")):A||!this.b||z()>this.c-3e4?this.a?XN(this,{grant_type:"refresh_token",refresh_token:this.a}):aA(null):aA({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},ZN.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},B(KN,wM),B(_N,kM),_N.prototype.pa=function(A){this.ka=A,ye(this.b,A)},_N.prototype.ea=function(){return this.ka},_N.prototype.ya=function(){return b(this.O)},_N.prototype.Ha=function(){this.A.b&&(this.A.stop(),this.A.start())},xI(_N.prototype,"providerId","firebase"),(A=_N.prototype).reload=function(){var A=this;return ai(this,ii(this).then(function(){return yi(A).then(function(){return ti(A)}).then(Ni)}))},A.dc=function(A){return this.F(A).then(function(A){return new function(A){var M=gg(A);if(!(M&&M.exp&&M.auth_time&&M.iat))throw new pI("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");OI(this,{token:A,expirationTime:QI(1e3*M.exp),authTime:QI(1e3*M.auth_time),issuedAtTime:QI(1e3*M.iat),signInProvider:M.firebase&&M.firebase.sign_in_provider?M.firebase.sign_in_provider:null,claims:M})}(A)})},A.F=function(A){var M=this;return ai(this,ii(this).then(function(){return M.h.getToken(A)}).then(function(A){if(!A)throw new pI("internal-error");return A.accessToken!=M.ra&&(gi(M,A.accessToken),M.dispatchEvent(new KN("tokenChanged"))),Ei(M,"refreshToken",A.refreshToken),A.accessToken}))},A.zc=function(A){if(!(A=A.users)||!A.length)throw new pI("internal-error");wi(this,{uid:(A=A[0]).localId,displayName:A.displayName,photoURL:A.photoUrl,email:A.email,emailVerified:!!A.emailVerified,phoneNumber:A.phoneNumber,lastLoginAt:A.lastLoginAt,createdAt:A.createdAt});for(var M=function(A){return(A=A.providerUserInfo)&&A.length?F(A,function(A){return new function(A,M,D,I,g,t){OI(this,{uid:A,displayName:I||null,photoURL:g||null,email:D||null,phoneNumber:t||null,providerId:M})}(A.rawId,A.providerId,A.email,A.displayName,A.photoUrl,A.phoneNumber)}):[]}(A),D=0;Dthis.u&&(this.u=0),0==this.u&&Ri(this)&&Ii(Ri(this)),this.removeAuthTokenListener(A)},A.addAuthTokenListener=function(A){var M=this;this.m.push(A),Pi(this,this.i.then(function(){M.l||m(M.m,A)&&A(vi(M))}))},A.removeAuthTokenListener=function(A){G(this.m,function(M){return M==A})},A.delete=function(){this.l=!0;for(var A=0;Ag||g>=oT.length)throw new pI("internal-error","Argument validator recieved an unsupported number of arguments.");D=oT[g],I=(I?"":D+" argument ")+(M.name?'"'+M.name+'" ':"")+"must be "+M.K+".";break A}I=null}}if(I)throw new pI("argument-error",A+" failed: "+I)}(A=eT.prototype).za=function(){var A=this;return this.f?this.f:this.f=cT(this,aA().then(function(){if(iI()&&!_D())return XD();throw new pI("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return A.m.g(A.v())}).then(function(M){return A.g=M,tw(A.u,We,{})}).then(function(M){A.a[iT]=M.recaptchaSiteKey}).s(function(M){throw A.f=null,M}))},A.render=function(){ET(this);var A=this;return cT(this,this.za().then(function(){if(null===A.c){var M=A.l;if(!A.i){var D=UD(M);M=dD("DIV"),D.appendChild(M)}A.c=A.g.render(M,A.a)}return A.c}))},A.verify=function(){ET(this);var A=this;return cT(this,this.render().then(function(M){return new oA(function(D){var I=A.g.getResponse(M);if(I)D(I);else{var g=function(M){M&&(function(A,M){G(A.o,function(A){return A==M})}(A,g),D(M))};A.o.push(g),A.i&&A.g.execute(A.c)}})}))},A.reset=function(){ET(this),null!==this.c&&this.g.reset(this.c)},A.clear=function(){ET(this),this.D=!0,this.m.c();for(var A=0;AD?I.push(A.substring(g,D)):I.push(A.substring(g,g+M));return I},h=function(A,M){if(Array.isArray(A))for(var D=0;D=Math.pow(2,-1022)?(D=(g=Math.min(Math.floor(Math.log(A)/Math.LN2),1023))+1023,I=Math.round(A*Math.pow(2,52-g)-Math.pow(2,52))):(D=0,I=Math.round(A/Math.pow(2,-1074)))),w=[],t=52;t;t-=1)w.push(I%2?1:0),I=Math.floor(I/2);for(t=11;t;t-=1)w.push(D%2?1:0),D=Math.floor(D/2);w.push(M?1:0),w.reverse(),N=w.join("");var i="";for(t=0;t<64;t+=8){var T=parseInt(N.substr(t,8),2).toString(16);1===T.length&&(T="0"+T),i+=T}return i.toLowerCase()},F=new RegExp("^-?\\d{1,10}$"),f=function(A){if(F.test(A)){var M=Number(A);if(M>=-2147483648&&M<=2147483647)return M}return null},m=function(A){try{A()}catch(A){setTimeout(function(){var M=A.stack||"";throw L("Exception was thrown by user callback.",M),A},Math.floor(0))}},p=function(){return("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},G=function(A,M){var D=setTimeout(A,M);return"object"==typeof D&&D.unref&&D.unref(),D},H=function(){function A(A,M){if(void 0===M){this.pieces_=A.split("/");for(var D=0,I=0;I0&&(this.pieces_[D]=this.pieces_[I],D++);this.pieces_.length=D,this.pieceNum_=0}else this.pieces_=A,this.pieceNum_=M}return Object.defineProperty(A,"Empty",{get:function(){return new A("")},enumerable:!0,configurable:!0}),A.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},A.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},A.prototype.popFront=function(){var M=this.pieceNum_;return M=this.pieces_.length)return null;for(var M=[],D=this.pieceNum_;D0&&D.push(g[I])}return new A(D,0)},A.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},A.relativePath=function(M,D){var I=M.getFront(),g=D.getFront();if(null===I)return D;if(I===g)return A.relativePath(M.popFront(),D.popFront());throw new Error("INTERNAL ERROR: innerPath ("+D+") is not within outerPath ("+M+")")},A.comparePaths=function(A,M){for(var D=A.slice(),I=M.slice(),g=0;gA.getLength())return!1;for(;M0&&(this.byteLength_+=1),this.parts_.push(A),this.byteLength_+=e.stringLength(A),this.checkValid_()},A.prototype.pop=function(){var A=this.parts_.pop();this.byteLength_-=e.stringLength(A),this.parts_.length>0&&(this.byteLength_-=1)},A.prototype.checkValid_=function(){if(this.byteLength_>A.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+A.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>A.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+A.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},A.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},A}(),J="long_polling",R=function(){function A(A,M,D,I,g){void 0===g&&(g=""),this.secure=M,this.namespace=D,this.webSocketOnly=I,this.persistenceKey=g,this.host=A.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=n.get("host:"+A)||this.host}return A.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},A.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},A.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},A.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},A.prototype.updateHost=function(A){A!==this.internalHost&&(this.internalHost=A,this.isCacheableHost()&&n.set("host:"+this.host,this.internalHost))},A.prototype.connectionURL=function(A,M){var D;if(e.assert("string"==typeof A,"typeof type must == string"),e.assert("object"==typeof M,"typeof params must == object"),"websocket"===A)D=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(A!==J)throw new Error("Unknown connection type: "+A);D=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(M.ns=this.namespace);var I=[];return e.forEach(M,function(A,M){I.push(A+"="+M)}),D+I.join("&")},A.prototype.toString=function(){var A=this.toURLString();return this.persistenceKey&&(A+="<"+this.persistenceKey+">"),A},A.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},A}();var v,W,P=function(A){var M=V(A),D=M.subdomain;"firebase"===M.domain&&a(M.host+" is no longer supported. Please use .firebaseio.com instead"),D&&"undefined"!=D||"localhost"===M.domain||a("Cannot parse Firebase url. Please use https://.firebaseio.com"),M.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&L("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var I="ws"===M.scheme||"wss"===M.scheme;return{repoInfo:new R(M.host,M.secure,D,I),path:new H(M.pathString)}},V=function(A){var M="",D="",I="",g="",t=!0,e="https",w=443;if("string"==typeof A){var N=A.indexOf("//");N>=0&&(e=A.substring(0,N-1),A=A.substring(N+2));var i=A.indexOf("/");-1===i&&(i=A.length);var T=A.indexOf("?");-1===T&&(T=A.length),M=A.substring(0,Math.min(i,T)),i0||!A.getEventCache().isFullyInitialized()||g&&!I.getNode().equals(t)||!I.getNode().getPriority().equals(t.getPriority()))&&D.push(TM.valueChange(M.getCompleteEventSnap()))}},A.prototype.generateEventCacheAfterServerEvent_=function(A,M,D,I,g){var t=A.getEventCache();if(null!=D.shadowingWrite(M))return A;var w=void 0,N=void 0;if(M.isEmpty())if(e.assert(A.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),A.getServerCache().isFiltered()){var i=A.getCompleteServerSnap(),T=i instanceof FA?i:FA.EMPTY_NODE,n=D.calcCompleteEventChildren(T);w=this.filter_.updateFullNode(A.getEventCache().getNode(),n,g)}else{var c=D.calcCompleteEventCache(A.getCompleteServerSnap());w=this.filter_.updateFullNode(A.getEventCache().getNode(),c,g)}else{var E=M.getFront();if(".priority"==E){e.assert(1==M.getLength(),"Can't have a priority with additional path components");var j=t.getNode();N=A.getServerCache().getNode();var y=D.calcEventCacheAfterServerOverwrite(M,j,N);w=null!=y?this.filter_.updatePriority(j,y):t.getNode()}else{var o=M.popFront(),u=void 0;if(t.isCompleteForChild(E)){N=A.getServerCache().getNode();var r=D.calcEventCacheAfterServerOverwrite(M,t.getNode(),N);u=null!=r?t.getNode().getImmediateChild(E).updateChild(o,r):t.getNode().getImmediateChild(E)}else u=D.calcCompleteChild(E,A.getServerCache());w=null!=u?this.filter_.updateChild(t.getNode(),E,u,o,I,g):t.getNode()}}return A.updateEventSnap(w,t.isFullyInitialized()||M.isEmpty(),this.filter_.filtersNodes())},A.prototype.applyServerOverwrite_=function(A,M,D,I,g,t,e){var w,N=A.getServerCache(),i=t?this.filter_:this.filter_.getIndexedFilter();if(M.isEmpty())w=i.updateFullNode(N.getNode(),D,null);else if(i.filtersNodes()&&!N.isFiltered()){var T=N.getNode().updateChild(M,D);w=i.updateFullNode(N.getNode(),T,null)}else{var n=M.getFront();if(!N.isCompleteForPath(M)&&M.getLength()>1)return A;var c=M.popFront(),E=N.getNode().getImmediateChild(n).updateChild(c,D);w=".priority"==n?i.updatePriority(N.getNode(),E):i.updateChild(N.getNode(),n,E,c,EM,null)}var j=A.updateServerSnap(w,N.isFullyInitialized()||M.isEmpty(),i.filtersNodes()),y=new jM(I,j,g);return this.generateEventCacheAfterServerEvent_(j,M,I,y,e)},A.prototype.applyUserOverwrite_=function(A,M,D,I,g,t){var e,w,N=A.getEventCache(),i=new jM(I,A,g);if(M.isEmpty())w=this.filter_.updateFullNode(A.getEventCache().getNode(),D,t),e=A.updateEventSnap(w,!0,this.filter_.filtersNodes());else{var T=M.getFront();if(".priority"===T)w=this.filter_.updatePriority(A.getEventCache().getNode(),D),e=A.updateEventSnap(w,N.isFullyInitialized(),N.isFiltered());else{var n=M.popFront(),c=N.getNode().getImmediateChild(T),E=void 0;if(n.isEmpty())E=D;else{var j=i.getCompleteChild(T);E=null!=j?".priority"===n.getBack()&&j.getChild(n.parent()).isEmpty()?j:j.updateChild(n,D):FA.EMPTY_NODE}if(c.equals(E))e=A;else{var y=this.filter_.updateChild(N.getNode(),T,E,n,i,t);e=A.updateEventSnap(y,N.isFullyInitialized(),this.filter_.filtersNodes())}}}return e},A.cacheHasChild_=function(A,M){return A.getEventCache().isCompleteForChild(M)},A.prototype.applyUserMerge_=function(M,D,I,g,t,e){var w=this,N=M;return I.foreach(function(I,i){var T=D.child(I);A.cacheHasChild_(M,T.getFront())&&(N=w.applyUserOverwrite_(N,T,i,g,t,e))}),I.foreach(function(I,i){var T=D.child(I);A.cacheHasChild_(M,T.getFront())||(N=w.applyUserOverwrite_(N,T,i,g,t,e))}),N},A.prototype.applyMerge_=function(A,M){return M.foreach(function(M,D){A=A.updateChild(M,D)}),A},A.prototype.applyServerMerge_=function(A,M,D,I,g,t,e){var w=this;if(A.getServerCache().getNode().isEmpty()&&!A.getServerCache().isFullyInitialized())return A;var N,i=A;N=M.isEmpty()?D:gM.Empty.setTree(M,D);var T=A.getServerCache().getNode();return N.children.inorderTraversal(function(M,D){if(T.hasChild(M)){var N=A.getServerCache().getNode().getImmediateChild(M),n=w.applyMerge_(N,D);i=w.applyServerOverwrite_(i,new H(M),n,I,g,t,e)}}),N.children.inorderTraversal(function(M,D){var N=!A.getServerCache().isCompleteForChild(M)&&null==D.value;if(!T.hasChild(M)&&!N){var n=A.getServerCache().getNode().getImmediateChild(M),c=w.applyMerge_(n,D);i=w.applyServerOverwrite_(i,new H(M),c,I,g,t,e)}}),i},A.prototype.ackUserWrite_=function(A,M,D,I,g,t){if(null!=I.shadowingWrite(M))return A;var e=A.getServerCache().isFiltered(),w=A.getServerCache();if(null!=D.value){if(M.isEmpty()&&w.isFullyInitialized()||w.isCompleteForPath(M))return this.applyServerOverwrite_(A,M,w.getNode().getChild(M),I,g,e,t);if(M.isEmpty()){var N=gM.Empty;return w.getNode().forEachChild(jA,function(A,M){N=N.set(new H(A),M)}),this.applyServerMerge_(A,M,N,I,g,e,t)}return A}var i=gM.Empty;return D.foreach(function(A,D){var I=M.child(A);w.isCompleteForPath(I)&&(i=i.set(A,w.getNode().getChild(I)))}),this.applyServerMerge_(A,M,i,I,g,e,t)},A.prototype.listenComplete_=function(A,M,D,I){var g=A.getServerCache(),t=A.updateServerSnap(g.getNode(),g.isFullyInitialized()||M.isEmpty(),g.isFiltered());return this.generateEventCacheAfterServerEvent_(t,M,D,EM,I)},A.prototype.revertUserWrite_=function(A,M,D,I,g){var t;if(null!=D.shadowingWrite(M))return A;var w=new jM(D,A,I),N=A.getEventCache().getNode(),i=void 0;if(M.isEmpty()||".priority"===M.getFront()){var T=void 0;if(A.getServerCache().isFullyInitialized())T=D.calcCompleteEventCache(A.getCompleteServerSnap());else{var n=A.getServerCache().getNode();e.assert(n instanceof FA,"serverChildren would be complete if leaf node"),T=D.calcCompleteEventChildren(n)}T=T,i=this.filter_.updateFullNode(N,T,g)}else{var c=M.getFront(),E=D.calcCompleteChild(c,A.getServerCache());null==E&&A.getServerCache().isCompleteForChild(c)&&(E=N.getImmediateChild(c)),(i=null!=E?this.filter_.updateChild(N,c,E,M.popFront(),w,g):A.getEventCache().getNode().hasChild(c)?this.filter_.updateChild(N,c,FA.EMPTY_NODE,M.popFront(),w,g):N).isEmpty()&&A.getServerCache().isFullyInitialized()&&(t=D.calcCompleteEventCache(A.getCompleteServerSnap())).isLeafNode()&&(i=this.filter_.updateFullNode(i,t,g))}return t=A.getServerCache().isFullyInitialized()||null!=D.shadowingWrite(H.Empty),A.updateEventSnap(i,t,this.filter_.filtersNodes())},A}(),uM=function(){function A(A){this.query_=A,this.index_=this.query_.getQueryParams().getIndex()}return A.prototype.generateEventsForChanges=function(A,M,D){var I=this,g=[],t=[];return A.forEach(function(A){A.type===TM.CHILD_CHANGED&&I.index_.indexedValueChanged(A.oldSnap,A.snapshotNode)&&t.push(TM.childMovedChange(A.childName,A.snapshotNode))}),this.generateEventsForType_(g,TM.CHILD_REMOVED,A,D,M),this.generateEventsForType_(g,TM.CHILD_ADDED,A,D,M),this.generateEventsForType_(g,TM.CHILD_MOVED,t,D,M),this.generateEventsForType_(g,TM.CHILD_CHANGED,A,D,M),this.generateEventsForType_(g,TM.VALUE,A,D,M),g},A.prototype.generateEventsForType_=function(A,M,D,I,g){var t=this,e=D.filter(function(A){return A.type===M});e.sort(this.compareChanges_.bind(this)),e.forEach(function(M){var D=t.materializeSingleChange_(M,g);I.forEach(function(I){I.respondsTo(M.type)&&A.push(I.createEvent(D,t.query_))})})},A.prototype.materializeSingleChange_=function(A,M){return"value"===A.type||"child_removed"===A.type?A:(A.prevName=M.getPredecessorChildName(A.childName,A.snapshotNode,this.index_),A)},A.prototype.compareChanges_=function(A,M){if(null==A.childName||null==M.childName)throw e.assertionError("Should only compare child_ events.");var D=new nA(A.childName,A.snapshotNode),I=new nA(M.childName,M.snapshotNode);return this.index_.compare(D,I)},A}(),rM=function(){function A(A,M){this.query_=A,this.eventRegistrations_=[];var D=this.query_.getQueryParams(),I=new nM(D.getIndex()),g=D.getNodeFilter();this.processor_=new oM(g);var t=M.getServerCache(),e=M.getEventCache(),w=I.updateFullNode(FA.EMPTY_NODE,t.getNode(),null),N=g.updateFullNode(FA.EMPTY_NODE,e.getNode(),null),i=new NM(w,t.isFullyInitialized(),I.filtersNodes()),T=new NM(N,e.isFullyInitialized(),g.filtersNodes());this.viewCache_=new iM(T,i),this.eventGenerator_=new uM(this.query_)}return A.prototype.getQuery=function(){return this.query_},A.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},A.prototype.getCompleteServerCache=function(A){var M=this.viewCache_.getCompleteServerSnap();return M&&(this.query_.getQueryParams().loadsAllData()||!A.isEmpty()&&!M.getImmediateChild(A.getFront()).isEmpty())?M.getChild(A):null},A.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},A.prototype.addEventRegistration=function(A){this.eventRegistrations_.push(A)},A.prototype.removeEventRegistration=function(A,M){var D=[];if(M){e.assert(null==A,"A cancel should cancel all event registrations.");var I=this.query_.path;this.eventRegistrations_.forEach(function(A){M=M;var g=A.createCancelEvent(M,I);g&&D.push(g)})}if(A){for(var g=[],t=0;tthis.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===I&&(I=!0),this.allWrites_.push({path:A,snap:M,writeId:D,visible:I}),I&&(this.visibleWrites_=this.visibleWrites_.addWrite(A,M)),this.lastWriteId_=D},A.prototype.addMerge=function(A,M,D){e.assert(D>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:A,children:M,writeId:D,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(A,M),this.lastWriteId_=D},A.prototype.getWrite=function(A){for(var M=0;M=0,"removeWrite called with nonexistent writeId.");var I=this.allWrites_[D];this.allWrites_.splice(D,1);for(var g=I.visible,t=!1,w=this.allWrites_.length-1;g&&w>=0;){var N=this.allWrites_[w];N.visible&&(w>=D&&this.recordContainsPath_(N,I.path)?g=!1:I.path.contains(N.path)&&(t=!0)),w--}if(g){if(t)return this.resetTree_(),!0;if(I.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(I.path);else{var i=I.children;e.forEach(i,function(A){M.visibleWrites_=M.visibleWrites_.removeWrite(I.path.child(A))})}return!0}return!1},A.prototype.getCompleteWriteData=function(A){return this.visibleWrites_.getCompleteNode(A)},A.prototype.calcCompleteEventCache=function(M,D,I,g){if(I||g){var t=this.visibleWrites_.childCompoundWrite(M);if(!g&&t.isEmpty())return D;if(g||null!=D||t.hasCompleteWrite(H.Empty)){var e=A.layerTree_(this.allWrites_,function(A){return(A.visible||g)&&(!I||!~I.indexOf(A.writeId))&&(A.path.contains(M)||M.contains(A.path))},M);i=D||FA.EMPTY_NODE;return e.apply(i)}return null}var w=this.visibleWrites_.getCompleteNode(M);if(null!=w)return w;var N=this.visibleWrites_.childCompoundWrite(M);if(N.isEmpty())return D;if(null!=D||N.hasCompleteWrite(H.Empty)){var i=D||FA.EMPTY_NODE;return N.apply(i)}return null},A.prototype.calcCompleteEventChildren=function(A,M){var D=FA.EMPTY_NODE,I=this.visibleWrites_.getCompleteNode(A);if(I)return I.isLeafNode()||I.forEachChild(aA,function(A,M){D=D.updateImmediateChild(A,M)}),D;if(M){var g=this.visibleWrites_.childCompoundWrite(A);return M.forEachChild(aA,function(A,M){var I=g.childCompoundWrite(new H(A)).apply(M);D=D.updateImmediateChild(A,I)}),g.getCompleteChildren().forEach(function(A){D=D.updateImmediateChild(A.name,A.node)}),D}return this.visibleWrites_.childCompoundWrite(A).getCompleteChildren().forEach(function(A){D=D.updateImmediateChild(A.name,A.node)}),D},A.prototype.calcEventCacheAfterServerOverwrite=function(A,M,D,I){e.assert(D||I,"Either existingEventSnap or existingServerSnap must exist");var g=A.child(M);if(this.visibleWrites_.hasCompleteWrite(g))return null;var t=this.visibleWrites_.childCompoundWrite(g);return t.isEmpty()?I.getChild(M):t.apply(I.getChild(M))},A.prototype.calcCompleteChild=function(A,M,D){var I=A.child(M),g=this.visibleWrites_.getCompleteNode(I);return null!=g?g:D.isCompleteForChild(M)?this.visibleWrites_.childCompoundWrite(I).apply(D.getNode().getImmediateChild(M)):null},A.prototype.shadowingWrite=function(A){return this.visibleWrites_.getCompleteNode(A)},A.prototype.calcIndexedSlice=function(A,M,D,I,g,t){var e,w=this.visibleWrites_.childCompoundWrite(A),N=w.getCompleteNode(H.Empty);if(null!=N)e=N;else{if(null==M)return[];e=w.apply(M)}if((e=e.withIndex(t)).isEmpty()||e.isLeafNode())return[];for(var i=[],T=t.getCompare(),n=g?e.getReverseIteratorFrom(D,t):e.getIteratorFrom(D,t),c=n.getNext();c&&i.length0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},A.DefaultFilter_=function(A){return A.visible},A.layerTree_=function(A,M,D){for(var I=QM.Empty,g=0;g0&&!I)if(T){this.listenProvider_.stopListening(A.queryForListening_(M),null)}else i.forEach(function(M){var D=g.queryToTagMap_[A.makeQueryKey_(M)];g.listenProvider_.stopListening(A.queryForListening_(M),D)});this.removeTags_(i)}return w},A.prototype.calcCompleteEventCache=function(A,M){var D=this.pendingWriteTree_,I=this.syncPointTree_.findOnPath(A,function(M,D){var I=H.relativePath(M,A),g=D.getCompleteServerCache(I);if(g)return g});return D.calcCompleteEventCache(A,I,M,!0)},A.prototype.collectDistinctViewsForSubTree_=function(A){return A.fold(function(A,M,D){if(M&&M.hasCompleteView())return[M.getCompleteView()];var I=[];return M&&(I=M.getQueryViews()),e.forEach(D,function(A,M){I=I.concat(M)}),I})},A.prototype.removeTags_=function(M){for(var D=0;D0&&e.contains(A.statsToReport_,M)&&(D[M]=g,I=!0)}),I&&this.server_.reportStats(D),G(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},A}(),lM=function(){function A(){this.eventLists_=[],this.recursionDepth_=0}return A.prototype.queueEvents=function(A){for(var M=null,D=0;D0,"Requires a non-empty array")}return A.prototype.trigger=function(A){for(var M=[],D=1;Ddocument.domain="'+document.domain+'";<\/script>';var w=""+t+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(w),this.myIFrame.doc.close()}catch(A){Q("frame writing exception"),A.stack&&Q(A.stack),Q(A)}}}return A.createIFrame_=function(){var A=document.createElement("iframe");if(A.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(A);try{A.contentWindow.document||Q("No IE domain setting required")}catch(D){var M=document.domain;A.src="javascript:void((function(){document.open();document.domain='"+M+"';document.close();})())"}return A.contentDocument?A.doc=A.contentDocument:A.contentWindow?A.doc=A.contentWindow.document:A.document&&(A.doc=A.document),A},A.prototype.close=function(){var M=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==M.myIFrame&&(document.body.removeChild(M.myIFrame),M.myIFrame=null)},Math.floor(0))),e.isNodeSdk()&&this.myID){var D={disconn:"t"};D.id=this.myID,D.pw=this.myPW;var I=this.urlFn(D);A.nodeRestRequest(I)}var g=this.onDisconnect;g&&(this.onDisconnect=null,g())},A.prototype.startLongPoll=function(A,M){for(this.myID=A,this.myPW=M,this.alive=!0;this.newRequest_(););},A.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var A={};A.id=this.myID,A.pw=this.myPW,A.ser=this.currentSerial;for(var M=this.urlFn(A),D="",I=0;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+D.length<=1870))break;var g=this.pendingSegs.shift();D=D+"&seg"+I+"="+g.seg+"&ts"+I+"="+g.ts+"&d"+I+"="+g.d,I++}return M+=D,this.addLongPollTag_(M,this.currentSerial),!0}return!1},A.prototype.enqueueSegment=function(A,M,D){this.pendingSegs.push({seg:A,ts:M,d:D}),this.alive&&this.newRequest_()},A.prototype.addLongPollTag_=function(A,M){var D=this;this.outstandingRequests.add(M,1);var I=function(){D.outstandingRequests.remove(M),D.newRequest_()},g=setTimeout(I,Math.floor(25e3));this.addTag(A,function(){clearTimeout(g),I()})},A.prototype.addTag=function(A,M){var D=this;e.isNodeSdk()?this.doNodeLongPoll(A,M):setTimeout(function(){try{if(!D.sendNewPolls)return;var I=D.myIFrame.doc.createElement("script");I.type="text/javascript",I.async=!0,I.src=A,I.onload=I.onreadystatechange=function(){var A=I.readyState;A&&"loaded"!==A&&"complete"!==A||(I.onload=I.onreadystatechange=null,I.parentNode&&I.parentNode.removeChild(I),M())},I.onerror=function(){Q("Long-poll script failed to load: "+A),D.sendNewPolls=!1,D.close()},D.myIFrame.doc.body.appendChild(I)}catch(A){}},Math.floor(1))},A}(),JM=null; +var GA,HA,bA=new(function(A){function M(){return null!==A&&A.apply(this,arguments)||this}return t.__extends(M,A),M.prototype.compare=function(A,M){var D=A.node.compareTo(M.node);return 0===D?Y(A.name,M.name):D},M.prototype.isDefinedOn=function(A){return!0},M.prototype.indexedValueChanged=function(A,M){return!A.equals(M)},M.prototype.minPost=function(){return nA.MIN},M.prototype.maxPost=function(){return nA.MAX},M.prototype.makePost=function(A,M){var D=pA(A);return new nA(M,D)},M.prototype.toString=function(){return".value"},M}(cA)),JA=function(A){function M(M){var D=A.call(this)||this;return D.indexPath_=M,e.assert(!M.isEmpty()&&".priority"!==M.getFront(),"Can't create PathIndex with empty path or .priority key"),D}return t.__extends(M,A),M.prototype.extractChild=function(A){return A.getChild(this.indexPath_)},M.prototype.isDefinedOn=function(A){return!A.getChild(this.indexPath_).isEmpty()},M.prototype.compare=function(A,M){var D=this.extractChild(A.node),I=this.extractChild(M.node),g=D.compareTo(I);return 0===g?Y(A.name,M.name):g},M.prototype.makePost=function(A,M){var D=pA(A),I=FA.EMPTY_NODE.updateChild(this.indexPath_,D);return new nA(M,I)},M.prototype.maxPost=function(){var A=FA.EMPTY_NODE.updateChild(this.indexPath_,fA);return new nA(O,A)},M.prototype.toString=function(){return this.indexPath_.slice().join("/")},M}(cA),RA=function(){function A(A,M,D){this.node_=A,this.ref_=M,this.index_=D}return A.prototype.val=function(){return e.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},A.prototype.exportVal=function(){return e.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},A.prototype.toJSON=function(){return e.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},A.prototype.exists=function(){return e.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},A.prototype.child=function(M){e.validateArgCount("DataSnapshot.child",0,1,arguments.length),M=String(M),tA("DataSnapshot.child",1,M,!1);var D=new H(M),I=this.ref_.child(D);return new A(this.node_.getChild(D),I,aA)},A.prototype.hasChild=function(A){e.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),tA("DataSnapshot.hasChild",1,A,!1);var M=new H(A);return!this.node_.getChild(M).isEmpty()},A.prototype.getPriority=function(){return e.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},A.prototype.forEach=function(M){var D=this;return e.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),e.validateCallback("DataSnapshot.forEach",1,M,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(I,g){return M(new A(g,D.ref_.child(I),aA))})},A.prototype.hasChildren=function(){return e.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(A.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),A.prototype.numChildren=function(){return e.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},A.prototype.getRef=function(){return e.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(A.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),A}(),vA=function(){function A(A,M,D,I){this.eventType=A,this.eventRegistration=M,this.snapshot=D,this.prevName=I}return A.prototype.getPath=function(){var A=this.snapshot.getRef();return"value"===this.eventType?A.path:A.getParent().path},A.prototype.getEventType=function(){return this.eventType},A.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},A.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+e.stringify(this.snapshot.exportVal())},A}(),WA=function(){function A(A,M,D){this.eventRegistration=A,this.error=M,this.path=D}return A.prototype.getPath=function(){return this.path},A.prototype.getEventType=function(){return"cancel"},A.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},A.prototype.toString=function(){return this.path.toString()+":cancel"},A}(),PA=function(){function A(A,M,D){this.callback_=A,this.cancelCallback_=M,this.context_=D}return A.prototype.respondsTo=function(A){return"value"===A},A.prototype.createEvent=function(A,M){var D=M.getQueryParams().getIndex();return new vA("value",this,new RA(A.snapshotNode,M.getRef(),D))},A.prototype.getEventRunner=function(A){var M=this.context_;if("cancel"===A.getEventType()){e.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var D=this.cancelCallback_;return function(){D.call(M,A.error)}}var I=this.callback_;return function(){I.call(M,A.snapshot)}},A.prototype.createCancelEvent=function(A,M){return this.cancelCallback_?new WA(this,A,M):null},A.prototype.matches=function(M){return M instanceof A&&(!M.callback_||!this.callback_||M.callback_===this.callback_&&M.context_===this.context_)},A.prototype.hasAnyCallback=function(){return null!==this.callback_},A}(),VA=function(){function A(A,M,D){this.callbacks_=A,this.cancelCallback_=M,this.context_=D}return A.prototype.respondsTo=function(A){var M="children_added"===A?"child_added":A;return M="children_removed"===M?"child_removed":M,e.contains(this.callbacks_,M)},A.prototype.createCancelEvent=function(A,M){return this.cancelCallback_?new WA(this,A,M):null},A.prototype.createEvent=function(A,M){e.assert(null!=A.childName,"Child events should have a childName.");var D=M.getRef().child(A.childName),I=M.getQueryParams().getIndex();return new vA(A.type,this,new RA(A.snapshotNode,D,I),A.prevName)},A.prototype.getEventRunner=function(A){var M=this.context_;if("cancel"===A.getEventType()){e.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var D=this.cancelCallback_;return function(){D.call(M,A.error)}}var I=this.callbacks_[A.eventType];return function(){I.call(M,A.snapshot,A.prevName)}},A.prototype.matches=function(M){if(M instanceof A){if(!this.callbacks_||!M.callbacks_)return!0;if(this.context_===M.context_){var D=e.getCount(M.callbacks_);if(D===e.getCount(this.callbacks_)){if(1===D){var I=e.getAnyKey(M.callbacks_),g=e.getAnyKey(this.callbacks_);return!(g!==I||M.callbacks_[I]&&this.callbacks_[g]&&M.callbacks_[I]!==this.callbacks_[g])}return e.every(this.callbacks_,function(A,D){return M.callbacks_[A]===D})}}}return!1},A.prototype.hasAnyCallback=function(){return null!==this.callbacks_},A}(),XA=function(){function A(A,M,D,I){this.repo=A,this.path=M,this.queryParams_=D,this.orderByCalled_=I}return Object.defineProperty(A,"__referenceConstructor",{get:function(){return e.assert(GA,"Reference.ts has not been loaded"),GA},set:function(A){GA=A},enumerable:!0,configurable:!0}),A.validateQueryEndpoints_=function(A){var M=null,D=null;if(A.hasStart()&&(M=A.getIndexStartValue()),A.hasEnd()&&(D=A.getIndexEndValue()),A.getIndex()===jA){var I="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",g="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(A.hasStart()){if(A.getIndexStartName()!=x)throw new Error(I);if("string"!=typeof M)throw new Error(g)}if(A.hasEnd()){if(A.getIndexEndName()!=O)throw new Error(I);if("string"!=typeof D)throw new Error(g)}}else if(A.getIndex()===aA){if(null!=M&&!q(M)||null!=D&&!q(D))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(e.assert(A.getIndex()instanceof JA||A.getIndex()===bA,"unknown index type."),null!=M&&"object"==typeof M||null!=D&&"object"==typeof D)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},A.validateLimit_=function(A){if(A.hasStart()&&A.hasEnd()&&A.hasLimit()&&!A.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},A.prototype.validateNoPreviousOrderByCall_=function(A){if(!0===this.orderByCalled_)throw new Error(A+": You can't combine multiple orderBy calls.")},A.prototype.getQueryParams=function(){return this.queryParams_},A.prototype.getRef=function(){return e.validateArgCount("Query.ref",0,0,arguments.length),new A.__referenceConstructor(this.repo,this.path)},A.prototype.on=function(M,D,I,g){e.validateArgCount("Query.on",2,4,arguments.length),IA("Query.on",1,M,!1),e.validateCallback("Query.on",2,D,!1);var t=A.getCancelAndContextArgs_("Query.on",I,g);if("value"===M)this.onValueEvent(D,t.cancel,t.context);else{var w={};w[M]=D,this.onChildEvent(w,t.cancel,t.context)}return D},A.prototype.onValueEvent=function(A,M,D){var I=new PA(A,M||null,D||null);this.repo.addEventCallbackForQuery(this,I)},A.prototype.onChildEvent=function(A,M,D){var I=new VA(A,M,D);this.repo.addEventCallbackForQuery(this,I)},A.prototype.off=function(A,M,D){e.validateArgCount("Query.off",0,3,arguments.length),IA("Query.off",1,A,!0),e.validateCallback("Query.off",2,M,!0),e.validateContextObject("Query.off",3,D,!0);var I=null,g=null;"value"===A?I=new PA(M||null,null,D||null):A&&(M&&((g={})[A]=M),I=new VA(g,null,D||null));this.repo.removeEventCallbackForQuery(this,I)},A.prototype.once=function(M,D,I,g){var t=this;e.validateArgCount("Query.once",1,4,arguments.length),IA("Query.once",1,M,!1),e.validateCallback("Query.once",2,D,!0);var w=A.getCancelAndContextArgs_("Query.once",I,g),N=!0,i=new e.Deferred;i.promise.catch(function(){});var T=function(A){N&&(N=!1,t.off(M,T),D&&D.bind(w.context)(A),i.resolve(A))};return this.on(M,T,function(A){t.off(M,T),w.cancel&&w.cancel.bind(w.context)(A),i.reject(A)}),i.promise},A.prototype.limitToFirst=function(M){if(e.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!=typeof M||Math.floor(M)!==M||M<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new A(this.repo,this.path,this.queryParams_.limitToFirst(M),this.orderByCalled_)},A.prototype.limitToLast=function(M){if(e.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!=typeof M||Math.floor(M)!==M||M<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new A(this.repo,this.path,this.queryParams_.limitToLast(M),this.orderByCalled_)},A.prototype.orderByChild=function(M){if(e.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===M)throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===M)throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===M)throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');tA("Query.orderByChild",1,M,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var D=new H(M);if(D.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var I=new JA(D),g=this.queryParams_.orderBy(I);return A.validateQueryEndpoints_(g),new A(this.repo,this.path,g,!0)},A.prototype.orderByKey=function(){e.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var M=this.queryParams_.orderBy(jA);return A.validateQueryEndpoints_(M),new A(this.repo,this.path,M,!0)},A.prototype.orderByPriority=function(){e.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var M=this.queryParams_.orderBy(aA);return A.validateQueryEndpoints_(M),new A(this.repo,this.path,M,!0)},A.prototype.orderByValue=function(){e.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var M=this.queryParams_.orderBy(bA);return A.validateQueryEndpoints_(M),new A(this.repo,this.path,M,!0)},A.prototype.startAt=function(M,D){void 0===M&&(M=null),e.validateArgCount("Query.startAt",0,2,arguments.length),$("Query.startAt",1,M,this.path,!0),gA("Query.startAt",2,D,!0);var I=this.queryParams_.startAt(M,D);if(A.validateLimit_(I),A.validateQueryEndpoints_(I),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===M&&(M=null,D=null),new A(this.repo,this.path,I,this.orderByCalled_)},A.prototype.endAt=function(M,D){void 0===M&&(M=null),e.validateArgCount("Query.endAt",0,2,arguments.length),$("Query.endAt",1,M,this.path,!0),gA("Query.endAt",2,D,!0);var I=this.queryParams_.endAt(M,D);if(A.validateLimit_(I),A.validateQueryEndpoints_(I),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new A(this.repo,this.path,I,this.orderByCalled_)},A.prototype.equalTo=function(A,M){if(e.validateArgCount("Query.equalTo",1,2,arguments.length),$("Query.equalTo",1,A,this.path,!1),gA("Query.equalTo",2,M,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(A,M).endAt(A,M)},A.prototype.toString=function(){return e.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},A.prototype.toJSON=function(){return e.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},A.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},A.prototype.queryIdentifier=function(){var A=this.queryObject(),M=U(A);return"{}"===M?"default":M},A.prototype.isEqual=function(M){if(e.validateArgCount("Query.isEqual",1,1,arguments.length),!(M instanceof A)){throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")}var D=this.repo===M.repo,I=this.path.equals(M.path),g=this.queryIdentifier()===M.queryIdentifier();return D&&I&&g},A.getCancelAndContextArgs_=function(A,M,D){var I={cancel:null,context:null};if(M&&D)I.cancel=M,e.validateCallback(A,3,I.cancel,!0),I.context=D,e.validateContextObject(A,4,I.context,!0);else if(M)if("object"==typeof M&&null!==M)I.context=M;else{if("function"!=typeof M)throw new Error(e.errorPrefix(A,3,!0)+" must either be a cancel callback or a context object.");I.cancel=M}return I},Object.defineProperty(A.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),A}(),ZA=function(){function A(){this.set={}}return A.prototype.add=function(A,M){this.set[A]=null===M||M},A.prototype.contains=function(A){return e.contains(this.set,A)},A.prototype.get=function(A){return this.contains(A)?this.set[A]:void 0},A.prototype.remove=function(A){delete this.set[A]},A.prototype.clear=function(){this.set={}},A.prototype.isEmpty=function(){return e.isEmpty(this.set)},A.prototype.count=function(){return e.getCount(this.set)},A.prototype.each=function(A){e.forEach(this.set,function(M,D){return A(M,D)})},A.prototype.keys=function(){var A=[];return e.forEach(this.set,function(M){A.push(M)}),A},A}(),KA=function(){function A(){this.value_=null,this.children_=null}return A.prototype.find=function(A){if(null!=this.value_)return this.value_.getChild(A);if(A.isEmpty()||null==this.children_)return null;var M=A.getFront();return A=A.popFront(),this.children_.contains(M)?this.children_.get(M).find(A):null},A.prototype.remember=function(M,D){if(M.isEmpty())this.value_=D,this.children_=null;else if(null!==this.value_)this.value_=this.value_.updateChild(M,D);else{null==this.children_&&(this.children_=new ZA);var I=M.getFront();this.children_.contains(I)||this.children_.add(I,new A);var g=this.children_.get(I);M=M.popFront(),g.remember(M,D)}},A.prototype.forget=function(A){if(A.isEmpty())return this.value_=null,this.children_=null,!0;if(null!==this.value_){if(this.value_.isLeafNode())return!1;var M=this.value_;this.value_=null;var D=this;return M.forEachChild(aA,function(A,M){D.remember(new H(A),M)}),this.forget(A)}if(null!==this.children_){var I=A.getFront();if(A=A.popFront(),this.children_.contains(I))this.children_.get(I).forget(A)&&this.children_.remove(I);return!!this.children_.isEmpty()&&(this.children_=null,!0)}return!0},A.prototype.forEachTree=function(A,M){null!==this.value_?M(A,this.value_):this.forEachChild(function(D,I){var g=new H(A.toString()+"/"+D);I.forEachTree(g,M)})},A.prototype.forEachChild=function(A){null!==this.children_&&this.children_.each(function(M,D){A(M,D)})},A}(),_A=function(A,M){return A&&"object"==typeof A?(e.assert(".sv"in A,"Unexpected leaf node or priority contents"),M[A[".sv"]]):A},qA=function(A,M){var D,I=A.getPriority().val(),g=_A(I,M);if(A.isLeafNode()){var t=A,e=_A(t.getValue(),M);return e!==t.getValue()||g!==t.getPriority().val()?new QA(e,pA(g)):A}var w=A;return D=w,g!==w.getPriority().val()&&(D=D.updatePriority(new QA(g))),w.forEachChild(aA,function(A,I){var g=qA(I,M);g!==I&&(D=D.updateImmediateChild(A,g))}),D};!function(A){A[A.OVERWRITE=0]="OVERWRITE",A[A.MERGE=1]="MERGE",A[A.ACK_USER_WRITE=2]="ACK_USER_WRITE",A[A.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(HA||(HA={}));var $A,AM,MM=function(){function A(A,M,D,I){this.fromUser=A,this.fromServer=M,this.queryId=D,this.tagged=I,e.assert(!I||M,"Tagged queries must be from server.")}return A.User=new A(!0,!1,null,!1),A.Server=new A(!1,!0,null,!1),A.forServerTaggedQuery=function(M){return new A(!1,!0,M,!0)},A}(),DM=function(){function A(A,M,D){this.path=A,this.affectedTree=M,this.revert=D,this.type=HA.ACK_USER_WRITE,this.source=MM.User}return A.prototype.operationForChild=function(M){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return e.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var D=this.affectedTree.subtree(new H(M));return new A(H.Empty,D,this.revert)}return e.assert(this.path.getFront()===M,"operationForChild called for unrelated child."),new A(this.path.popFront(),this.affectedTree,this.revert)},A}(),IM=function(){return $A||($A=new OA(S)),$A},gM=function(){function A(A,M){void 0===M&&(M=IM()),this.value=A,this.children=M}return A.fromObject=function(M){var D=A.Empty;return e.forEach(M,function(A,M){D=D.set(new H(A),M)}),D},A.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},A.prototype.findRootMostMatchingPathAndValue=function(A,M){if(null!=this.value&&M(this.value))return{path:H.Empty,value:this.value};if(A.isEmpty())return null;var D=A.getFront(),I=this.children.get(D);if(null!==I){var g=I.findRootMostMatchingPathAndValue(A.popFront(),M);return null!=g?{path:new H(D).child(g.path),value:g.value}:null}return null},A.prototype.findRootMostValueAndPath=function(A){return this.findRootMostMatchingPathAndValue(A,function(){return!0})},A.prototype.subtree=function(M){if(M.isEmpty())return this;var D=M.getFront(),I=this.children.get(D);return null!==I?I.subtree(M.popFront()):A.Empty},A.prototype.set=function(M,D){if(M.isEmpty())return new A(D,this.children);var I=M.getFront(),g=(this.children.get(I)||A.Empty).set(M.popFront(),D),t=this.children.insert(I,g);return new A(this.value,t)},A.prototype.remove=function(M){if(M.isEmpty())return this.children.isEmpty()?A.Empty:new A(null,this.children);var D=M.getFront(),I=this.children.get(D);if(I){var g=I.remove(M.popFront()),t=void 0;return t=g.isEmpty()?this.children.remove(D):this.children.insert(D,g),null===this.value&&t.isEmpty()?A.Empty:new A(this.value,t)}return this},A.prototype.get=function(A){if(A.isEmpty())return this.value;var M=A.getFront(),D=this.children.get(M);return D?D.get(A.popFront()):null},A.prototype.setTree=function(M,D){if(M.isEmpty())return D;var I=M.getFront(),g=(this.children.get(I)||A.Empty).setTree(M.popFront(),D),t=void 0;return t=g.isEmpty()?this.children.remove(I):this.children.insert(I,g),new A(this.value,t)},A.prototype.fold=function(A){return this.fold_(H.Empty,A)},A.prototype.fold_=function(A,M){var D={};return this.children.inorderTraversal(function(I,g){D[I]=g.fold_(A.child(I),M)}),M(A,this.value,D)},A.prototype.findOnPath=function(A,M){return this.findOnPath_(A,H.Empty,M)},A.prototype.findOnPath_=function(A,M,D){var I=!!this.value&&D(M,this.value);if(I)return I;if(A.isEmpty())return null;var g=A.getFront(),t=this.children.get(g);return t?t.findOnPath_(A.popFront(),M.child(g),D):null},A.prototype.foreachOnPath=function(A,M){return this.foreachOnPath_(A,H.Empty,M)},A.prototype.foreachOnPath_=function(M,D,I){if(M.isEmpty())return this;this.value&&I(D,this.value);var g=M.getFront(),t=this.children.get(g);return t?t.foreachOnPath_(M.popFront(),D.child(g),I):A.Empty},A.prototype.foreach=function(A){this.foreach_(H.Empty,A)},A.prototype.foreach_=function(A,M){this.children.inorderTraversal(function(D,I){I.foreach_(A.child(D),M)}),this.value&&M(A,this.value)},A.prototype.foreachChild=function(A){this.children.inorderTraversal(function(M,D){D.value&&A(M,D.value)})},A.Empty=new A(null),A}(),tM=function(){function A(A,M){this.source=A,this.path=M,this.type=HA.LISTEN_COMPLETE}return A.prototype.operationForChild=function(M){return this.path.isEmpty()?new A(this.source,H.Empty):new A(this.source,this.path.popFront())},A}(),eM=function(){function A(A,M,D){this.source=A,this.path=M,this.snap=D,this.type=HA.OVERWRITE}return A.prototype.operationForChild=function(M){return this.path.isEmpty()?new A(this.source,H.Empty,this.snap.getImmediateChild(M)):new A(this.source,this.path.popFront(),this.snap)},A}(),wM=function(){function A(A,M,D){this.source=A,this.path=M,this.children=D,this.type=HA.MERGE}return A.prototype.operationForChild=function(M){if(this.path.isEmpty()){var D=this.children.subtree(new H(M));return D.isEmpty()?null:D.value?new eM(this.source,H.Empty,D.value):new A(this.source,H.Empty,D)}return e.assert(this.path.getFront()===M,"Can't get a merge for a child not on the path of the operation"),new A(this.source,this.path.popFront(),this.children)},A.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},A}(),NM=function(){function A(A,M,D){this.node_=A,this.fullyInitialized_=M,this.filtered_=D}return A.prototype.isFullyInitialized=function(){return this.fullyInitialized_},A.prototype.isFiltered=function(){return this.filtered_},A.prototype.isCompleteForPath=function(A){if(A.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var M=A.getFront();return this.isCompleteForChild(M)},A.prototype.isCompleteForChild=function(A){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(A)},A.prototype.getNode=function(){return this.node_},A}(),iM=function(){function A(A,M){this.eventCache_=A,this.serverCache_=M}return A.prototype.updateEventSnap=function(M,D,I){return new A(new NM(M,D,I),this.serverCache_)},A.prototype.updateServerSnap=function(M,D,I){return new A(this.eventCache_,new NM(M,D,I))},A.prototype.getEventCache=function(){return this.eventCache_},A.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},A.prototype.getServerCache=function(){return this.serverCache_},A.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},A.Empty=new A(new NM(FA.EMPTY_NODE,!1,!1),new NM(FA.EMPTY_NODE,!1,!1)),A}(),TM=function(){function A(A,M,D,I,g){this.type=A,this.snapshotNode=M,this.childName=D,this.oldSnap=I,this.prevName=g}return A.valueChange=function(M){return new A(A.VALUE,M)},A.childAddedChange=function(M,D){return new A(A.CHILD_ADDED,D,M)},A.childRemovedChange=function(M,D){return new A(A.CHILD_REMOVED,D,M)},A.childChangedChange=function(M,D,I){return new A(A.CHILD_CHANGED,D,M,I)},A.childMovedChange=function(M,D){return new A(A.CHILD_MOVED,D,M)},A.CHILD_ADDED="child_added",A.CHILD_REMOVED="child_removed",A.CHILD_CHANGED="child_changed",A.CHILD_MOVED="child_moved",A.VALUE="value",A}(),nM=function(){function A(A){this.index_=A}return A.prototype.updateChild=function(A,M,D,I,g,t){e.assert(A.isIndexed(this.index_),"A node must be indexed if only a child is updated");var w=A.getImmediateChild(M);return w.getChild(I).equals(D.getChild(I))&&w.isEmpty()==D.isEmpty()?A:(null!=t&&(D.isEmpty()?A.hasChild(M)?t.trackChildChange(TM.childRemovedChange(M,w)):e.assert(A.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):w.isEmpty()?t.trackChildChange(TM.childAddedChange(M,D)):t.trackChildChange(TM.childChangedChange(M,D,w))),A.isLeafNode()&&D.isEmpty()?A:A.updateImmediateChild(M,D).withIndex(this.index_))},A.prototype.updateFullNode=function(A,M,D){return null!=D&&(A.isLeafNode()||A.forEachChild(aA,function(A,I){M.hasChild(A)||D.trackChildChange(TM.childRemovedChange(A,I))}),M.isLeafNode()||M.forEachChild(aA,function(M,I){if(A.hasChild(M)){var g=A.getImmediateChild(M);g.equals(I)||D.trackChildChange(TM.childChangedChange(M,I,g))}else D.trackChildChange(TM.childAddedChange(M,I))})),M.withIndex(this.index_)},A.prototype.updatePriority=function(A,M){return A.isEmpty()?FA.EMPTY_NODE:A.updatePriority(M)},A.prototype.filtersNodes=function(){return!1},A.prototype.getIndexedFilter=function(){return this},A.prototype.getIndex=function(){return this.index_},A}(),cM=function(){function A(){this.changeMap_={}}return A.prototype.trackChildChange=function(A){var M=A.type,D=A.childName;e.assert(M==TM.CHILD_ADDED||M==TM.CHILD_CHANGED||M==TM.CHILD_REMOVED,"Only child changes supported for tracking"),e.assert(".priority"!==D,"Only non-priority child changes can be tracked.");var I=e.safeGet(this.changeMap_,D);if(I){var g=I.type;if(M==TM.CHILD_ADDED&&g==TM.CHILD_REMOVED)this.changeMap_[D]=TM.childChangedChange(D,A.snapshotNode,I.snapshotNode);else if(M==TM.CHILD_REMOVED&&g==TM.CHILD_ADDED)delete this.changeMap_[D];else if(M==TM.CHILD_REMOVED&&g==TM.CHILD_CHANGED)this.changeMap_[D]=TM.childRemovedChange(D,I.oldSnap);else if(M==TM.CHILD_CHANGED&&g==TM.CHILD_ADDED)this.changeMap_[D]=TM.childAddedChange(D,A.snapshotNode);else{if(M!=TM.CHILD_CHANGED||g!=TM.CHILD_CHANGED)throw e.assertionError("Illegal combination of changes: "+A+" occurred after "+I);this.changeMap_[D]=TM.childChangedChange(D,A.snapshotNode,I.oldSnap)}}else this.changeMap_[D]=A},A.prototype.getChanges=function(){return e.getValues(this.changeMap_)},A}(),EM=new(function(){function A(){}return A.prototype.getCompleteChild=function(A){return null},A.prototype.getChildAfterChild=function(A,M,D){return null},A}()),jM=function(){function A(A,M,D){void 0===D&&(D=null),this.writes_=A,this.viewCache_=M,this.optCompleteServerCache_=D}return A.prototype.getCompleteChild=function(A){var M=this.viewCache_.getEventCache();if(M.isCompleteForChild(A))return M.getNode().getImmediateChild(A);var D=null!=this.optCompleteServerCache_?new NM(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(A,D)},A.prototype.getChildAfterChild=function(A,M,D){var I=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),g=this.writes_.calcIndexedSlice(I,M,1,D,A);return 0===g.length?null:g[0]},A}(),yM=function(){return function(A,M){this.viewCache=A,this.changes=M}}(),oM=function(){function A(A){this.filter_=A}return A.prototype.assertIndexed=function(A){e.assert(A.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),e.assert(A.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},A.prototype.applyOperation=function(M,D,I,g){var t,w,N=new cM;if(D.type===HA.OVERWRITE){var i=D;i.source.fromUser?t=this.applyUserOverwrite_(M,i.path,i.snap,I,g,N):(e.assert(i.source.fromServer,"Unknown source."),w=i.source.tagged||M.getServerCache().isFiltered()&&!i.path.isEmpty(),t=this.applyServerOverwrite_(M,i.path,i.snap,I,g,w,N))}else if(D.type===HA.MERGE){var T=D;T.source.fromUser?t=this.applyUserMerge_(M,T.path,T.children,I,g,N):(e.assert(T.source.fromServer,"Unknown source."),w=T.source.tagged||M.getServerCache().isFiltered(),t=this.applyServerMerge_(M,T.path,T.children,I,g,w,N))}else if(D.type===HA.ACK_USER_WRITE){var n=D;t=n.revert?this.revertUserWrite_(M,n.path,I,g,N):this.ackUserWrite_(M,n.path,n.affectedTree,I,g,N)}else{if(D.type!==HA.LISTEN_COMPLETE)throw e.assertionError("Unknown operation type: "+D.type);t=this.listenComplete_(M,D.path,I,N)}var c=N.getChanges();return A.maybeAddValueEvent_(M,t,c),new yM(t,c)},A.maybeAddValueEvent_=function(A,M,D){var I=M.getEventCache();if(I.isFullyInitialized()){var g=I.getNode().isLeafNode()||I.getNode().isEmpty(),t=A.getCompleteEventSnap();(D.length>0||!A.getEventCache().isFullyInitialized()||g&&!I.getNode().equals(t)||!I.getNode().getPriority().equals(t.getPriority()))&&D.push(TM.valueChange(M.getCompleteEventSnap()))}},A.prototype.generateEventCacheAfterServerEvent_=function(A,M,D,I,g){var t=A.getEventCache();if(null!=D.shadowingWrite(M))return A;var w=void 0,N=void 0;if(M.isEmpty())if(e.assert(A.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),A.getServerCache().isFiltered()){var i=A.getCompleteServerSnap(),T=i instanceof FA?i:FA.EMPTY_NODE,n=D.calcCompleteEventChildren(T);w=this.filter_.updateFullNode(A.getEventCache().getNode(),n,g)}else{var c=D.calcCompleteEventCache(A.getCompleteServerSnap());w=this.filter_.updateFullNode(A.getEventCache().getNode(),c,g)}else{var E=M.getFront();if(".priority"==E){e.assert(1==M.getLength(),"Can't have a priority with additional path components");var j=t.getNode();N=A.getServerCache().getNode();var y=D.calcEventCacheAfterServerOverwrite(M,j,N);w=null!=y?this.filter_.updatePriority(j,y):t.getNode()}else{var o=M.popFront(),u=void 0;if(t.isCompleteForChild(E)){N=A.getServerCache().getNode();var r=D.calcEventCacheAfterServerOverwrite(M,t.getNode(),N);u=null!=r?t.getNode().getImmediateChild(E).updateChild(o,r):t.getNode().getImmediateChild(E)}else u=D.calcCompleteChild(E,A.getServerCache());w=null!=u?this.filter_.updateChild(t.getNode(),E,u,o,I,g):t.getNode()}}return A.updateEventSnap(w,t.isFullyInitialized()||M.isEmpty(),this.filter_.filtersNodes())},A.prototype.applyServerOverwrite_=function(A,M,D,I,g,t,e){var w,N=A.getServerCache(),i=t?this.filter_:this.filter_.getIndexedFilter();if(M.isEmpty())w=i.updateFullNode(N.getNode(),D,null);else if(i.filtersNodes()&&!N.isFiltered()){var T=N.getNode().updateChild(M,D);w=i.updateFullNode(N.getNode(),T,null)}else{var n=M.getFront();if(!N.isCompleteForPath(M)&&M.getLength()>1)return A;var c=M.popFront(),E=N.getNode().getImmediateChild(n).updateChild(c,D);w=".priority"==n?i.updatePriority(N.getNode(),E):i.updateChild(N.getNode(),n,E,c,EM,null)}var j=A.updateServerSnap(w,N.isFullyInitialized()||M.isEmpty(),i.filtersNodes()),y=new jM(I,j,g);return this.generateEventCacheAfterServerEvent_(j,M,I,y,e)},A.prototype.applyUserOverwrite_=function(A,M,D,I,g,t){var e,w,N=A.getEventCache(),i=new jM(I,A,g);if(M.isEmpty())w=this.filter_.updateFullNode(A.getEventCache().getNode(),D,t),e=A.updateEventSnap(w,!0,this.filter_.filtersNodes());else{var T=M.getFront();if(".priority"===T)w=this.filter_.updatePriority(A.getEventCache().getNode(),D),e=A.updateEventSnap(w,N.isFullyInitialized(),N.isFiltered());else{var n=M.popFront(),c=N.getNode().getImmediateChild(T),E=void 0;if(n.isEmpty())E=D;else{var j=i.getCompleteChild(T);E=null!=j?".priority"===n.getBack()&&j.getChild(n.parent()).isEmpty()?j:j.updateChild(n,D):FA.EMPTY_NODE}if(c.equals(E))e=A;else{var y=this.filter_.updateChild(N.getNode(),T,E,n,i,t);e=A.updateEventSnap(y,N.isFullyInitialized(),this.filter_.filtersNodes())}}}return e},A.cacheHasChild_=function(A,M){return A.getEventCache().isCompleteForChild(M)},A.prototype.applyUserMerge_=function(M,D,I,g,t,e){var w=this,N=M;return I.foreach(function(I,i){var T=D.child(I);A.cacheHasChild_(M,T.getFront())&&(N=w.applyUserOverwrite_(N,T,i,g,t,e))}),I.foreach(function(I,i){var T=D.child(I);A.cacheHasChild_(M,T.getFront())||(N=w.applyUserOverwrite_(N,T,i,g,t,e))}),N},A.prototype.applyMerge_=function(A,M){return M.foreach(function(M,D){A=A.updateChild(M,D)}),A},A.prototype.applyServerMerge_=function(A,M,D,I,g,t,e){var w=this;if(A.getServerCache().getNode().isEmpty()&&!A.getServerCache().isFullyInitialized())return A;var N,i=A;N=M.isEmpty()?D:gM.Empty.setTree(M,D);var T=A.getServerCache().getNode();return N.children.inorderTraversal(function(M,D){if(T.hasChild(M)){var N=A.getServerCache().getNode().getImmediateChild(M),n=w.applyMerge_(N,D);i=w.applyServerOverwrite_(i,new H(M),n,I,g,t,e)}}),N.children.inorderTraversal(function(M,D){var N=!A.getServerCache().isCompleteForChild(M)&&null==D.value;if(!T.hasChild(M)&&!N){var n=A.getServerCache().getNode().getImmediateChild(M),c=w.applyMerge_(n,D);i=w.applyServerOverwrite_(i,new H(M),c,I,g,t,e)}}),i},A.prototype.ackUserWrite_=function(A,M,D,I,g,t){if(null!=I.shadowingWrite(M))return A;var e=A.getServerCache().isFiltered(),w=A.getServerCache();if(null!=D.value){if(M.isEmpty()&&w.isFullyInitialized()||w.isCompleteForPath(M))return this.applyServerOverwrite_(A,M,w.getNode().getChild(M),I,g,e,t);if(M.isEmpty()){var N=gM.Empty;return w.getNode().forEachChild(jA,function(A,M){N=N.set(new H(A),M)}),this.applyServerMerge_(A,M,N,I,g,e,t)}return A}var i=gM.Empty;return D.foreach(function(A,D){var I=M.child(A);w.isCompleteForPath(I)&&(i=i.set(A,w.getNode().getChild(I)))}),this.applyServerMerge_(A,M,i,I,g,e,t)},A.prototype.listenComplete_=function(A,M,D,I){var g=A.getServerCache(),t=A.updateServerSnap(g.getNode(),g.isFullyInitialized()||M.isEmpty(),g.isFiltered());return this.generateEventCacheAfterServerEvent_(t,M,D,EM,I)},A.prototype.revertUserWrite_=function(A,M,D,I,g){var t;if(null!=D.shadowingWrite(M))return A;var w=new jM(D,A,I),N=A.getEventCache().getNode(),i=void 0;if(M.isEmpty()||".priority"===M.getFront()){var T=void 0;if(A.getServerCache().isFullyInitialized())T=D.calcCompleteEventCache(A.getCompleteServerSnap());else{var n=A.getServerCache().getNode();e.assert(n instanceof FA,"serverChildren would be complete if leaf node"),T=D.calcCompleteEventChildren(n)}T=T,i=this.filter_.updateFullNode(N,T,g)}else{var c=M.getFront(),E=D.calcCompleteChild(c,A.getServerCache());null==E&&A.getServerCache().isCompleteForChild(c)&&(E=N.getImmediateChild(c)),(i=null!=E?this.filter_.updateChild(N,c,E,M.popFront(),w,g):A.getEventCache().getNode().hasChild(c)?this.filter_.updateChild(N,c,FA.EMPTY_NODE,M.popFront(),w,g):N).isEmpty()&&A.getServerCache().isFullyInitialized()&&(t=D.calcCompleteEventCache(A.getCompleteServerSnap())).isLeafNode()&&(i=this.filter_.updateFullNode(i,t,g))}return t=A.getServerCache().isFullyInitialized()||null!=D.shadowingWrite(H.Empty),A.updateEventSnap(i,t,this.filter_.filtersNodes())},A}(),uM=function(){function A(A){this.query_=A,this.index_=this.query_.getQueryParams().getIndex()}return A.prototype.generateEventsForChanges=function(A,M,D){var I=this,g=[],t=[];return A.forEach(function(A){A.type===TM.CHILD_CHANGED&&I.index_.indexedValueChanged(A.oldSnap,A.snapshotNode)&&t.push(TM.childMovedChange(A.childName,A.snapshotNode))}),this.generateEventsForType_(g,TM.CHILD_REMOVED,A,D,M),this.generateEventsForType_(g,TM.CHILD_ADDED,A,D,M),this.generateEventsForType_(g,TM.CHILD_MOVED,t,D,M),this.generateEventsForType_(g,TM.CHILD_CHANGED,A,D,M),this.generateEventsForType_(g,TM.VALUE,A,D,M),g},A.prototype.generateEventsForType_=function(A,M,D,I,g){var t=this,e=D.filter(function(A){return A.type===M});e.sort(this.compareChanges_.bind(this)),e.forEach(function(M){var D=t.materializeSingleChange_(M,g);I.forEach(function(I){I.respondsTo(M.type)&&A.push(I.createEvent(D,t.query_))})})},A.prototype.materializeSingleChange_=function(A,M){return"value"===A.type||"child_removed"===A.type?A:(A.prevName=M.getPredecessorChildName(A.childName,A.snapshotNode,this.index_),A)},A.prototype.compareChanges_=function(A,M){if(null==A.childName||null==M.childName)throw e.assertionError("Should only compare child_ events.");var D=new nA(A.childName,A.snapshotNode),I=new nA(M.childName,M.snapshotNode);return this.index_.compare(D,I)},A}(),rM=function(){function A(A,M){this.query_=A,this.eventRegistrations_=[];var D=this.query_.getQueryParams(),I=new nM(D.getIndex()),g=D.getNodeFilter();this.processor_=new oM(g);var t=M.getServerCache(),e=M.getEventCache(),w=I.updateFullNode(FA.EMPTY_NODE,t.getNode(),null),N=g.updateFullNode(FA.EMPTY_NODE,e.getNode(),null),i=new NM(w,t.isFullyInitialized(),I.filtersNodes()),T=new NM(N,e.isFullyInitialized(),g.filtersNodes());this.viewCache_=new iM(T,i),this.eventGenerator_=new uM(this.query_)}return A.prototype.getQuery=function(){return this.query_},A.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},A.prototype.getCompleteServerCache=function(A){var M=this.viewCache_.getCompleteServerSnap();return M&&(this.query_.getQueryParams().loadsAllData()||!A.isEmpty()&&!M.getImmediateChild(A.getFront()).isEmpty())?M.getChild(A):null},A.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},A.prototype.addEventRegistration=function(A){this.eventRegistrations_.push(A)},A.prototype.removeEventRegistration=function(A,M){var D=[];if(M){e.assert(null==A,"A cancel should cancel all event registrations.");var I=this.query_.path;this.eventRegistrations_.forEach(function(A){M=M;var g=A.createCancelEvent(M,I);g&&D.push(g)})}if(A){for(var g=[],t=0;tthis.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===I&&(I=!0),this.allWrites_.push({path:A,snap:M,writeId:D,visible:I}),I&&(this.visibleWrites_=this.visibleWrites_.addWrite(A,M)),this.lastWriteId_=D},A.prototype.addMerge=function(A,M,D){e.assert(D>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:A,children:M,writeId:D,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(A,M),this.lastWriteId_=D},A.prototype.getWrite=function(A){for(var M=0;M=0,"removeWrite called with nonexistent writeId.");var I=this.allWrites_[D];this.allWrites_.splice(D,1);for(var g=I.visible,t=!1,w=this.allWrites_.length-1;g&&w>=0;){var N=this.allWrites_[w];N.visible&&(w>=D&&this.recordContainsPath_(N,I.path)?g=!1:I.path.contains(N.path)&&(t=!0)),w--}if(g){if(t)return this.resetTree_(),!0;if(I.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(I.path);else{var i=I.children;e.forEach(i,function(A){M.visibleWrites_=M.visibleWrites_.removeWrite(I.path.child(A))})}return!0}return!1},A.prototype.getCompleteWriteData=function(A){return this.visibleWrites_.getCompleteNode(A)},A.prototype.calcCompleteEventCache=function(M,D,I,g){if(I||g){var t=this.visibleWrites_.childCompoundWrite(M);if(!g&&t.isEmpty())return D;if(g||null!=D||t.hasCompleteWrite(H.Empty)){var e=A.layerTree_(this.allWrites_,function(A){return(A.visible||g)&&(!I||!~I.indexOf(A.writeId))&&(A.path.contains(M)||M.contains(A.path))},M);i=D||FA.EMPTY_NODE;return e.apply(i)}return null}var w=this.visibleWrites_.getCompleteNode(M);if(null!=w)return w;var N=this.visibleWrites_.childCompoundWrite(M);if(N.isEmpty())return D;if(null!=D||N.hasCompleteWrite(H.Empty)){var i=D||FA.EMPTY_NODE;return N.apply(i)}return null},A.prototype.calcCompleteEventChildren=function(A,M){var D=FA.EMPTY_NODE,I=this.visibleWrites_.getCompleteNode(A);if(I)return I.isLeafNode()||I.forEachChild(aA,function(A,M){D=D.updateImmediateChild(A,M)}),D;if(M){var g=this.visibleWrites_.childCompoundWrite(A);return M.forEachChild(aA,function(A,M){var I=g.childCompoundWrite(new H(A)).apply(M);D=D.updateImmediateChild(A,I)}),g.getCompleteChildren().forEach(function(A){D=D.updateImmediateChild(A.name,A.node)}),D}return this.visibleWrites_.childCompoundWrite(A).getCompleteChildren().forEach(function(A){D=D.updateImmediateChild(A.name,A.node)}),D},A.prototype.calcEventCacheAfterServerOverwrite=function(A,M,D,I){e.assert(D||I,"Either existingEventSnap or existingServerSnap must exist");var g=A.child(M);if(this.visibleWrites_.hasCompleteWrite(g))return null;var t=this.visibleWrites_.childCompoundWrite(g);return t.isEmpty()?I.getChild(M):t.apply(I.getChild(M))},A.prototype.calcCompleteChild=function(A,M,D){var I=A.child(M),g=this.visibleWrites_.getCompleteNode(I);return null!=g?g:D.isCompleteForChild(M)?this.visibleWrites_.childCompoundWrite(I).apply(D.getNode().getImmediateChild(M)):null},A.prototype.shadowingWrite=function(A){return this.visibleWrites_.getCompleteNode(A)},A.prototype.calcIndexedSlice=function(A,M,D,I,g,t){var e,w=this.visibleWrites_.childCompoundWrite(A),N=w.getCompleteNode(H.Empty);if(null!=N)e=N;else{if(null==M)return[];e=w.apply(M)}if((e=e.withIndex(t)).isEmpty()||e.isLeafNode())return[];for(var i=[],T=t.getCompare(),n=g?e.getReverseIteratorFrom(D,t):e.getIteratorFrom(D,t),c=n.getNext();c&&i.length0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},A.DefaultFilter_=function(A){return A.visible},A.layerTree_=function(A,M,D){for(var I=QM.Empty,g=0;g0&&!I)if(T){this.listenProvider_.stopListening(A.queryForListening_(M),null)}else i.forEach(function(M){var D=g.queryToTagMap_[A.makeQueryKey_(M)];g.listenProvider_.stopListening(A.queryForListening_(M),D)});this.removeTags_(i)}return w},A.prototype.calcCompleteEventCache=function(A,M){var D=this.pendingWriteTree_,I=this.syncPointTree_.findOnPath(A,function(M,D){var I=H.relativePath(M,A),g=D.getCompleteServerCache(I);if(g)return g});return D.calcCompleteEventCache(A,I,M,!0)},A.prototype.collectDistinctViewsForSubTree_=function(A){return A.fold(function(A,M,D){if(M&&M.hasCompleteView())return[M.getCompleteView()];var I=[];return M&&(I=M.getQueryViews()),e.forEach(D,function(A,M){I=I.concat(M)}),I})},A.prototype.removeTags_=function(M){for(var D=0;D0&&e.contains(A.statsToReport_,M)&&(D[M]=g,I=!0)}),I&&this.server_.reportStats(D),G(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},A}(),lM=function(){function A(){this.eventLists_=[],this.recursionDepth_=0}return A.prototype.queueEvents=function(A){for(var M=null,D=0;D0,"Requires a non-empty array")}return A.prototype.trigger=function(A){for(var M=[],D=1;Ddocument.domain="'+document.domain+'";<\/script>';var w=""+t+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(w),this.myIFrame.doc.close()}catch(A){Q("frame writing exception"),A.stack&&Q(A.stack),Q(A)}}}return A.createIFrame_=function(){var A=document.createElement("iframe");if(A.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(A);try{A.contentWindow.document||Q("No IE domain setting required")}catch(D){var M=document.domain;A.src="javascript:void((function(){document.open();document.domain='"+M+"';document.close();})())"}return A.contentDocument?A.doc=A.contentDocument:A.contentWindow?A.doc=A.contentWindow.document:A.document&&(A.doc=A.document),A},A.prototype.close=function(){var M=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==M.myIFrame&&(document.body.removeChild(M.myIFrame),M.myIFrame=null)},Math.floor(0))),e.isNodeSdk()&&this.myID){var D={disconn:"t"};D.id=this.myID,D.pw=this.myPW;var I=this.urlFn(D);A.nodeRestRequest(I)}var g=this.onDisconnect;g&&(this.onDisconnect=null,g())},A.prototype.startLongPoll=function(A,M){for(this.myID=A,this.myPW=M,this.alive=!0;this.newRequest_(););},A.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var A={};A.id=this.myID,A.pw=this.myPW,A.ser=this.currentSerial;for(var M=this.urlFn(A),D="",I=0;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+D.length<=1870))break;var g=this.pendingSegs.shift();D=D+"&seg"+I+"="+g.seg+"&ts"+I+"="+g.ts+"&d"+I+"="+g.d,I++}return M+=D,this.addLongPollTag_(M,this.currentSerial),!0}return!1},A.prototype.enqueueSegment=function(A,M,D){this.pendingSegs.push({seg:A,ts:M,d:D}),this.alive&&this.newRequest_()},A.prototype.addLongPollTag_=function(A,M){var D=this;this.outstandingRequests.add(M,1);var I=function(){D.outstandingRequests.remove(M),D.newRequest_()},g=setTimeout(I,Math.floor(25e3));this.addTag(A,function(){clearTimeout(g),I()})},A.prototype.addTag=function(A,M){var D=this;e.isNodeSdk()?this.doNodeLongPoll(A,M):setTimeout(function(){try{if(!D.sendNewPolls)return;var I=D.myIFrame.doc.createElement("script");I.type="text/javascript",I.async=!0,I.src=A,I.onload=I.onreadystatechange=function(){var A=I.readyState;A&&"loaded"!==A&&"complete"!==A||(I.onload=I.onreadystatechange=null,I.parentNode&&I.parentNode.removeChild(I),M())},I.onerror=function(){Q("Long-poll script failed to load: "+A),D.sendNewPolls=!1,D.close()},D.myIFrame.doc.body.appendChild(I)}catch(A){}},Math.floor(1))},A}(),JM=null; /** * @license * Copyright 2017 Google Inc. @@ -586,7 +586,7 @@ var GA,HA,bA=new(function(A){function M(){return null!==A&&A.apply(this,argument * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */"undefined"!=typeof MozWebSocket?JM=MozWebSocket:"undefined"!=typeof WebSocket&&(JM=WebSocket);var RM=function(){function A(M,D,I,g){this.connId=M,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=z(this.connId),this.stats_=OM.getCollection(D),this.connURL=A.connectionURL_(D,I,g)}return A.connectionURL_=function(A,M,D){var I={v:"5"};return!e.isNodeSdk()&&"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(I.r="f"),M&&(I.s=M),D&&(I.ls=D),A.connectionURL("websocket",I)},A.prototype.open=function(A,M){var D=this;this.onDisconnect=M,this.onMessage=A,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,n.set("previous_websocket_failure",!0);try{if(e.isNodeSdk()){var t=e.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",w={headers:{"User-Agent":"Firebase/5/"+g.SDK_VERSION+"/"+I.platform+"/"+t}},N=I.env,i=0==this.connURL.indexOf("wss://")?N.HTTPS_PROXY||N.https_proxy:N.HTTP_PROXY||N.http_proxy;i&&(w.proxy={origin:i}),this.mySock=new JM(this.connURL,[],w)}else this.mySock=new JM(this.connURL)}catch(A){this.log_("Error instantiating WebSocket.");var T=A.message||A.data;return T&&this.log_(T),void this.onClosed_()}this.mySock.onopen=function(){D.log_("Websocket connected."),D.everConnected_=!0},this.mySock.onclose=function(){D.log_("Websocket connection was disconnected."),D.mySock=null,D.onClosed_()},this.mySock.onmessage=function(A){D.handleIncomingFrame(A)},this.mySock.onerror=function(A){D.log_("WebSocket error. Closing connection.");var M=A.message||A.data;M&&D.log_(M),D.onClosed_()}},A.prototype.start=function(){},A.forceDisallow=function(){A.forceDisallow_=!0},A.isAvailable=function(){var M=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var D=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);D&&D.length>1&&parseFloat(D[1])<4.4&&(M=!0)}return!M&&null!==JM&&!A.forceDisallow_},A.previouslyFailed=function(){return n.isInMemoryStorage||!0===n.get("previous_websocket_failure")},A.prototype.markConnectionHealthy=function(){n.remove("previous_websocket_failure")},A.prototype.appendFrame_=function(A){if(this.frames.push(A),this.frames.length==this.totalFrames){var M=this.frames.join("");this.frames=null;var D=e.jsonEval(M);this.onMessage(D)}},A.prototype.handleNewFrameCount_=function(A){this.totalFrames=A,this.frames=[]},A.prototype.extractFrameCount_=function(A){if(e.assert(null===this.frames,"We already have a frame buffer"),A.length<=6){var M=Number(A);if(!isNaN(M))return this.handleNewFrameCount_(M),null}return this.handleNewFrameCount_(1),A},A.prototype.handleIncomingFrame=function(A){if(null!==this.mySock){var M=A.data;if(this.bytesReceived+=M.length,this.stats_.incrementCounter("bytes_received",M.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(M);else{var D=this.extractFrameCount_(M);null!==D&&this.appendFrame_(D)}}},A.prototype.send=function(A){this.resetKeepAlive();var M=e.stringify(A);this.bytesSent+=M.length,this.stats_.incrementCounter("bytes_sent",M.length);var D=l(M,16384);D.length>1&&this.sendString_(String(D.length));for(var I=0;I0)return this.transports_[0];throw new Error("No transports available")},A.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},A}(),WM=function(){function A(A,M,D,I,g,t,e){this.id=A,this.repoInfo_=M,this.onMessage_=D,this.onReady_=I,this.onDisconnect_=g,this.onKill_=t,this.lastSessionId=e,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=z("c:"+this.id+":"),this.transportManager_=new vM(M),this.log_("Connection created"),this.start_()}return A.prototype.start_=function(){var A=this,M=this.transportManager_.initialTransport();this.conn_=new M(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=M.responsesRequiredToBeHealthy||0;var D=this.connReceiver_(this.conn_),I=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){A.conn_&&A.conn_.open(D,I)},Math.floor(0));var g=M.healthyTimeout||0;g>0&&(this.healthyTimeout_=G(function(){A.healthyTimeout_=null,A.isHealthy_||(A.conn_&&A.conn_.bytesReceived>102400?(A.log_("Connection exceeded healthy timeout but has received "+A.conn_.bytesReceived+" bytes. Marking connection healthy."),A.isHealthy_=!0,A.conn_.markConnectionHealthy()):A.conn_&&A.conn_.bytesSent>10240?A.log_("Connection exceeded healthy timeout but has sent "+A.conn_.bytesSent+" bytes. Leaving connection alive."):(A.log_("Closing unhealthy connection after timeout."),A.close()))},Math.floor(g)))},A.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},A.prototype.disconnReceiver_=function(A){var M=this;return function(D){A===M.conn_?M.onConnectionLost_(D):A===M.secondaryConn_?(M.log_("Secondary connection lost."),M.onSecondaryConnectionLost_()):M.log_("closing an old connection")}},A.prototype.connReceiver_=function(A){var M=this;return function(D){2!=M.state_&&(A===M.rx_?M.onPrimaryMessageReceived_(D):A===M.secondaryConn_?M.onSecondaryMessageReceived_(D):M.log_("message on old connection"))}},A.prototype.sendRequest=function(A){var M={t:"d",d:A};this.sendData_(M)},A.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)},A.prototype.onSecondaryControl_=function(A){if("t"in A){var M=A.t;"a"===M?this.upgradeIfSecondaryHealthy_():"r"===M?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===M&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},A.prototype.onSecondaryMessageReceived_=function(A){var M=k("t",A),D=k("d",A);if("c"==M)this.onSecondaryControl_(D);else{if("d"!=M)throw new Error("Unknown protocol layer: "+M);this.pendingDataMessages.push(D)}},A.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:{}}}))},A.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()},A.prototype.onPrimaryMessageReceived_=function(A){var M=k("t",A),D=k("d",A);"c"==M?this.onControl_(D):"d"==M&&this.onDataMessage_(D)},A.prototype.onDataMessage_=function(A){this.onPrimaryResponse_(),this.onMessage_(A)},A.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},A.prototype.onControl_=function(A){var M=k("t",A);if("d"in A){var D=A.d;if("h"===M)this.onHandshake_(D);else if("n"===M){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var I=0;I3e4&&(this.reconnectDelay_=VM),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var A=(new Date).getTime()-this.lastConnectionAttemptTime_,M=Math.max(0,this.reconnectDelay_-A);M=Math.random()*M,this.log_("Trying to reconnect in "+M+"ms"),this.scheduleConnect_(M),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},M.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var A=this.onDataMessage_.bind(this),D=this.onReady_.bind(this),I=this.onRealtimeDisconnect_.bind(this),g=this.id+":"+M.nextConnectionId_++,t=this,w=this.lastSessionId,N=!1,i=null,T=function(){i?i.close():(N=!0,I())};this.realtime_={close:T,sendRequest:function(A){e.assert(i,"sendRequest call when we're not connected not allowed."),i.sendRequest(A)}};var n=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(n).then(function(M){N?Q("getToken() completed but was canceled"):(Q("getToken() completed. Creating connection."),t.authToken_=M&&M.accessToken,i=new WM(g,t.repoInfo_,A,D,I,function(A){L(A+" ("+t.repoInfo_.toString()+")"),t.interrupt("server_kill")},w))}).then(null,function(A){t.log_("Failed to get token: "+A),N||(e.CONSTANTS.NODE_ADMIN&&L(A),T())})}},M.prototype.interrupt=function(A){Q("Interrupting connection for reason: "+A),this.interruptReasons_[A]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},M.prototype.resume=function(A){Q("Resuming connection for reason: "+A),delete this.interruptReasons_[A],e.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=VM,this.realtime_||this.scheduleConnect_(0))},M.prototype.handleTimestamp_=function(A){var M=A-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:M})},M.prototype.cancelSentTransactions_=function(){for(var A=0;A=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},M.prototype.onSecurityDebugPacket_=function(A){this.securityDebugCallback_?this.securityDebugCallback_(A):"msg"in A&&console.log("FIREBASE: "+A.msg.replace("\n","\nFIREBASE: "))},M.prototype.restoreState_=function(){var A=this;this.tryAuth(),e.forEach(this.listens_,function(M,D){e.forEach(D,function(M,D){A.sendListen_(D)})});for(var M=0;M=200&&N.status<300){try{A=e.jsonEval(N.responseText)}catch(A){L("Failed to parse JSON response for "+w+": "+N.responseText)}D(null,A)}else 401!==N.status&&404!==N.status&&L("Got unsuccessful REST response for "+w+" Status: "+N.status),D(N.status);D=null}},N.open("GET",w,!0),N.send()})},M}(PM),_M=function(){function A(A,M,D){var I=this;this.repoInfo_=A,this.app=D,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new lM,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new KA,this.persistentConnection_=null;var g=new sM(D);if(this.stats_=OM.getCollection(A),M||p())this.server_=new KM(this.repoInfo_,this.onDataUpdate_.bind(this),g),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var t=D.options.databaseAuthVariableOverride;if(void 0!==t&&null!==t){if("object"!=typeof t)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{e.stringify(t)}catch(A){throw new Error("Invalid authOverride provided: "+A)}}this.persistentConnection_=new ZM(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),g,t),this.server_=this.persistentConnection_}g.addTokenChangeListener(function(A){I.server_.refreshAuthToken(A)}),this.statsReporter_=OM.getOrCreateReporter(A,function(){return new UM(I.stats_,I.server_)}),this.transactions_init_(),this.infoData_=new LM,this.infoSyncTree_=new aM({startListening:function(A,M,D,g){var t=[],e=I.infoData_.getNode(A.path);return e.isEmpty()||(t=I.infoSyncTree_.applyServerOverwrite(A.path,e),setTimeout(function(){g("ok")},0)),t},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new aM({startListening:function(A,M,D,g){return I.server_.listen(A,D,M,function(M,D){var t=g(M,D);I.eventQueue_.raiseEventsForChangedPath(A.path,t)}),[]},stopListening:function(A,M){I.server_.unlisten(A,M)}})}return A.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},A.prototype.name=function(){return this.repoInfo_.namespace},A.prototype.serverTime=function(){var A=this.infoData_.getNode(new H(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+A},A.prototype.generateServerValues=function(){return function(A){return(A=A||{}).timestamp=A.timestamp||(new Date).getTime(),A}({timestamp:this.serverTime()})},A.prototype.onDataUpdate_=function(A,M,D,I){this.dataUpdateCount++;var g=new H(A);M=this.interceptServerDataCallback_?this.interceptServerDataCallback_(A,M):M;var t=[];if(I)if(D){var w=e.map(M,function(A){return pA(A)});t=this.serverSyncTree_.applyTaggedQueryMerge(g,w,I)}else{var N=pA(M);t=this.serverSyncTree_.applyTaggedQueryOverwrite(g,N,I)}else if(D){var i=e.map(M,function(A){return pA(A)});t=this.serverSyncTree_.applyServerMerge(g,i)}else{var T=pA(M);t=this.serverSyncTree_.applyServerOverwrite(g,T)}var n=g;t.length>0&&(n=this.rerunTransactions_(g)),this.eventQueue_.raiseEventsForChangedPath(n,t)},A.prototype.interceptServerData_=function(A){this.interceptServerDataCallback_=A},A.prototype.onConnectStatus_=function(A){this.updateInfo_("connected",A),!1===A&&this.runOnDisconnectEvents_()},A.prototype.onServerInfoUpdate_=function(A){var M=this;h(A,function(A,D){M.updateInfo_(D,A)})},A.prototype.updateInfo_=function(A,M){var D=new H("/.info/"+A),I=pA(M);this.infoData_.updateSnapshot(D,I);var g=this.infoSyncTree_.applyServerOverwrite(D,I);this.eventQueue_.raiseEventsForChangedPath(D,g)},A.prototype.getNextWriteId_=function(){return this.nextWriteId_++},A.prototype.setWithPriority=function(A,M,D,I){var g=this;this.log_("set",{path:A.toString(),value:M,priority:D});var t=this.generateServerValues(),e=pA(M,D),w=qA(e,t),N=this.getNextWriteId_(),i=this.serverSyncTree_.applyUserOverwrite(A,w,N,!0);this.eventQueue_.queueEvents(i),this.server_.put(A.toString(),e.val(!0),function(M,D){var t="ok"===M;t||L("set at "+A+" failed: "+M);var e=g.serverSyncTree_.ackUserWrite(N,!t);g.eventQueue_.raiseEventsForChangedPath(A,e),g.callOnCompleteCallback(I,M,D)});var T=this.abortTransactions_(A);this.rerunTransactions_(T),this.eventQueue_.raiseEventsForChangedPath(T,[])},A.prototype.update=function(A,M,D){var I=this;this.log_("update",{path:A.toString(),value:M});var g=!0,t=this.generateServerValues(),w={};if(e.forEach(M,function(A,M){g=!1;var D=pA(M);w[A]=qA(D,t)}),g)Q("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(D,"ok");else{var N=this.getNextWriteId_(),i=this.serverSyncTree_.applyUserMerge(A,w,N);this.eventQueue_.queueEvents(i),this.server_.merge(A.toString(),M,function(M,g){var t="ok"===M;t||L("update at "+A+" failed: "+M);var e=I.serverSyncTree_.ackUserWrite(N,!t),w=e.length>0?I.rerunTransactions_(A):A;I.eventQueue_.raiseEventsForChangedPath(w,e),I.callOnCompleteCallback(D,M,g)}),e.forEach(M,function(M){var D=I.abortTransactions_(A.child(M));I.rerunTransactions_(D)}),this.eventQueue_.raiseEventsForChangedPath(A,[])}},A.prototype.runOnDisconnectEvents_=function(){var A=this;this.log_("onDisconnectEvents");var M=this.generateServerValues(),D=[];(function(A,M){var D=new KA;return A.forEachTree(new H(""),function(A,I){D.remember(A,qA(I,M))}),D})(this.onDisconnect_,M).forEachTree(H.Empty,function(M,I){D=D.concat(A.serverSyncTree_.applyServerOverwrite(M,I));var g=A.abortTransactions_(M);A.rerunTransactions_(g)}),this.onDisconnect_=new KA,this.eventQueue_.raiseEventsForChangedPath(H.Empty,D)},A.prototype.onDisconnectCancel=function(A,M){var D=this;this.server_.onDisconnectCancel(A.toString(),function(I,g){"ok"===I&&D.onDisconnect_.forget(A),D.callOnCompleteCallback(M,I,g)})},A.prototype.onDisconnectSet=function(A,M,D){var I=this,g=pA(M);this.server_.onDisconnectPut(A.toString(),g.val(!0),function(M,t){"ok"===M&&I.onDisconnect_.remember(A,g),I.callOnCompleteCallback(D,M,t)})},A.prototype.onDisconnectSetWithPriority=function(A,M,D,I){var g=this,t=pA(M,D);this.server_.onDisconnectPut(A.toString(),t.val(!0),function(M,D){"ok"===M&&g.onDisconnect_.remember(A,t),g.callOnCompleteCallback(I,M,D)})},A.prototype.onDisconnectUpdate=function(A,M,D){var I=this;if(e.isEmpty(M))return Q("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(D,"ok");this.server_.onDisconnectMerge(A.toString(),M,function(g,t){"ok"===g&&e.forEach(M,function(M,D){var g=pA(D);I.onDisconnect_.remember(A.child(M),g)}),I.callOnCompleteCallback(D,g,t)})},A.prototype.addEventCallbackForQuery=function(A,M){var D;D=".info"===A.path.getFront()?this.infoSyncTree_.addEventRegistration(A,M):this.serverSyncTree_.addEventRegistration(A,M),this.eventQueue_.raiseEventsAtPath(A.path,D)},A.prototype.removeEventCallbackForQuery=function(A,M){var D;D=".info"===A.path.getFront()?this.infoSyncTree_.removeEventRegistration(A,M):this.serverSyncTree_.removeEventRegistration(A,M),this.eventQueue_.raiseEventsAtPath(A.path,D)},A.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},A.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},A.prototype.stats=function(A){if(void 0===A&&(A=!1),"undefined"!=typeof console){var M;A?(this.statsListener_||(this.statsListener_=new YM(this.stats_)),M=this.statsListener_.get()):M=this.stats_.get();var D=Object.keys(M).reduce(function(A,M){return Math.max(M.length,A)},0);e.forEach(M,function(A,M){for(var I=A.length;I=0)return null!=g&&g.trackChildChange(TM.childChangedChange(M,D,c)),N.updateImmediateChild(M,D);null!=g&&g.trackChildChange(TM.childRemovedChange(M,c));var y=N.updateImmediateChild(M,FA.EMPTY_NODE);return null!=E&&this.rangedFilter_.matches(E)?(null!=g&&g.trackChildChange(TM.childAddedChange(E.name,E.node)),y.updateImmediateChild(E.name,E.node)):y}return D.isEmpty()?A:n&&t(T,i)>=0?(null!=g&&(g.trackChildChange(TM.childRemovedChange(T.name,T.node)),g.trackChildChange(TM.childAddedChange(M,D))),N.updateImmediateChild(M,D).updateImmediateChild(T.name,FA.EMPTY_NODE)):A},A}(),AD=function(){function A(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=aA}return A.prototype.hasStart=function(){return this.startSet_},A.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},A.prototype.getIndexStartValue=function(){return e.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},A.prototype.getIndexStartName=function(){return e.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:x},A.prototype.hasEnd=function(){return this.endSet_},A.prototype.getIndexEndValue=function(){return e.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},A.prototype.getIndexEndName=function(){return e.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:O},A.prototype.hasLimit=function(){return this.limitSet_},A.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},A.prototype.getLimit=function(){return e.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},A.prototype.getIndex=function(){return this.index_},A.prototype.copy_=function(){var M=new A;return M.limitSet_=this.limitSet_,M.limit_=this.limit_,M.startSet_=this.startSet_,M.indexStartValue_=this.indexStartValue_,M.startNameSet_=this.startNameSet_,M.indexStartName_=this.indexStartName_,M.endSet_=this.endSet_,M.indexEndValue_=this.indexEndValue_,M.endNameSet_=this.endNameSet_,M.indexEndName_=this.indexEndName_,M.index_=this.index_,M.viewFrom_=this.viewFrom_,M},A.prototype.limit=function(A){var M=this.copy_();return M.limitSet_=!0,M.limit_=A,M.viewFrom_="",M},A.prototype.limitToFirst=function(M){var D=this.copy_();return D.limitSet_=!0,D.limit_=M,D.viewFrom_=A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,D},A.prototype.limitToLast=function(M){var D=this.copy_();return D.limitSet_=!0,D.limit_=M,D.viewFrom_=A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,D},A.prototype.startAt=function(A,M){var D=this.copy_();return D.startSet_=!0,void 0===A&&(A=null),D.indexStartValue_=A,null!=M?(D.startNameSet_=!0,D.indexStartName_=M):(D.startNameSet_=!1,D.indexStartName_=""),D},A.prototype.endAt=function(A,M){var D=this.copy_();return D.endSet_=!0,void 0===A&&(A=null),D.indexEndValue_=A,void 0!==M?(D.endNameSet_=!0,D.indexEndName_=M):(D.endNameSet_=!1,D.indexEndName_=""),D},A.prototype.orderBy=function(A){var M=this.copy_();return M.index_=A,M},A.prototype.getQueryObject=function(){var M=A.WIRE_PROTOCOL_CONSTANTS_,D={};if(this.startSet_&&(D[M.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(D[M.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(D[M.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(D[M.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){D[M.LIMIT]=this.limit_;var I=this.viewFrom_;""===I&&(I=this.isViewFromLeft()?M.VIEW_FROM_LEFT:M.VIEW_FROM_RIGHT),D[M.VIEW_FROM]=I}return this.index_!==aA&&(D[M.INDEX]=this.index_.toString()),D},A.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},A.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==aA},A.prototype.getNodeFilter=function(){return this.loadsAllData()?new nM(this.getIndex()):this.hasLimit()?new $M(this):new qM(this)},A.prototype.toRestQueryStringParameters=function(){var M,D=A.REST_QUERY_CONSTANTS_,I={};return this.isDefault()?I:(this.index_===aA?M=D.PRIORITY_INDEX:this.index_===bA?M=D.VALUE_INDEX:this.index_===jA?M=D.KEY_INDEX:(e.assert(this.index_ instanceof JA,"Unrecognized index type!"),M=this.index_.toString()),I[D.ORDER_BY]=e.stringify(M),this.startSet_&&(I[D.START_AT]=e.stringify(this.indexStartValue_),this.startNameSet_&&(I[D.START_AT]+=","+e.stringify(this.indexStartName_))),this.endSet_&&(I[D.END_AT]=e.stringify(this.indexEndValue_),this.endNameSet_&&(I[D.END_AT]+=","+e.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?I[D.LIMIT_TO_FIRST]=this.limit_:I[D.LIMIT_TO_LAST]=this.limit_),I)},A.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},A.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},A.DEFAULT=new A,A}(),MD=function(A){function M(M,D){if(!(M instanceof _M))throw new Error("new Reference() no longer supported - use app.database().");return A.call(this,M,D,AD.DEFAULT,!1)||this}return t.__extends(M,A),M.prototype.getKey=function(){return e.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},M.prototype.child=function(A){return e.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof A?A=String(A):A instanceof H||(null===this.path.getFront()?function(A,M,D,I){D&&(D=D.replace(/^\/*\.info(\/|$)/,"/")),tA(A,M,D,I)}("Reference.child",1,A,!1):tA("Reference.child",1,A,!1)),new M(this.repo,this.path.child(A))},M.prototype.getParent=function(){e.validateArgCount("Reference.parent",0,0,arguments.length);var A=this.path.parent();return null===A?null:new M(this.repo,A)},M.prototype.getRoot=function(){e.validateArgCount("Reference.root",0,0,arguments.length);for(var A=this;null!==A.getParent();)A=A.getParent();return A},M.prototype.databaseProp=function(){return this.repo.database},M.prototype.set=function(A,M){e.validateArgCount("Reference.set",1,2,arguments.length),eA("Reference.set",this.path),$("Reference.set",1,A,this.path,!1),e.validateCallback("Reference.set",2,M,!0);var D=new e.Deferred;return this.repo.setWithPriority(this.path,A,null,D.wrapCallback(M)),D.promise},M.prototype.update=function(A,M){if(e.validateArgCount("Reference.update",1,2,arguments.length),eA("Reference.update",this.path),Array.isArray(A)){for(var D={},I=0;I1&&parseFloat(D[1])<4.4&&(M=!0)}return!M&&null!==JM&&!A.forceDisallow_},A.previouslyFailed=function(){return n.isInMemoryStorage||!0===n.get("previous_websocket_failure")},A.prototype.markConnectionHealthy=function(){n.remove("previous_websocket_failure")},A.prototype.appendFrame_=function(A){if(this.frames.push(A),this.frames.length==this.totalFrames){var M=this.frames.join("");this.frames=null;var D=e.jsonEval(M);this.onMessage(D)}},A.prototype.handleNewFrameCount_=function(A){this.totalFrames=A,this.frames=[]},A.prototype.extractFrameCount_=function(A){if(e.assert(null===this.frames,"We already have a frame buffer"),A.length<=6){var M=Number(A);if(!isNaN(M))return this.handleNewFrameCount_(M),null}return this.handleNewFrameCount_(1),A},A.prototype.handleIncomingFrame=function(A){if(null!==this.mySock){var M=A.data;if(this.bytesRecieved+=M.length,this.stats_.incrementCounter("bytes_recieved",M.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(M);else{var D=this.extractFrameCount_(M);null!==D&&this.appendFrame_(D)}}},A.prototype.send=function(A){this.resetKeepAlive();var M=e.stringify(A);this.bytesSent+=M.length,this.stats_.incrementCounter("bytes_sent",M.length);var D=l(M,16384);D.length>1&&this.sendString_(String(D.length));for(var I=0;I0)return this.transports_[0];throw new Error("No transports available")},A.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},A}(),WM=function(){function A(A,M,D,I,g,t,e){this.id=A,this.repoInfo_=M,this.onMessage_=D,this.onReady_=I,this.onDisconnect_=g,this.onKill_=t,this.lastSessionId=e,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=z("c:"+this.id+":"),this.transportManager_=new vM(M),this.log_("Connection created"),this.start_()}return A.prototype.start_=function(){var A=this,M=this.transportManager_.initialTransport();this.conn_=new M(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=M.responsesRequiredToBeHealthy||0;var D=this.connReceiver_(this.conn_),I=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){A.conn_&&A.conn_.open(D,I)},Math.floor(0));var g=M.healthyTimeout||0;g>0&&(this.healthyTimeout_=G(function(){A.healthyTimeout_=null,A.isHealthy_||(A.conn_&&A.conn_.bytesRecieved>102400?(A.log_("Connection exceeded healthy timeout but has recieved "+A.conn_.bytesRecieved+" bytes. Marking connection healthy."),A.isHealthy_=!0,A.conn_.markConnectionHealthy()):A.conn_&&A.conn_.bytesSent>10240?A.log_("Connection exceeded healthy timeout but has sent "+A.conn_.bytesSent+" bytes. Leaving connection alive."):(A.log_("Closing unhealthy connection after timeout."),A.close()))},Math.floor(g)))},A.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},A.prototype.disconnReceiver_=function(A){var M=this;return function(D){A===M.conn_?M.onConnectionLost_(D):A===M.secondaryConn_?(M.log_("Secondary connection lost."),M.onSecondaryConnectionLost_()):M.log_("closing an old connection")}},A.prototype.connReceiver_=function(A){var M=this;return function(D){2!=M.state_&&(A===M.rx_?M.onPrimaryMessageRecieved_(D):A===M.secondaryConn_?M.onSecondaryMessageRecieved_(D):M.log_("message on old connection"))}},A.prototype.sendRequest=function(A){var M={t:"d",d:A};this.sendData_(M)},A.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)},A.prototype.onSecondaryControl_=function(A){if("t"in A){var M=A.t;"a"===M?this.upgradeIfSecondaryHealthy_():"r"===M?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===M&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},A.prototype.onSecondaryMessageRecieved_=function(A){var M=k("t",A),D=k("d",A);if("c"==M)this.onSecondaryControl_(D);else{if("d"!=M)throw new Error("Unknown protocol layer: "+M);this.pendingDataMessages.push(D)}},A.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:{}}}))},A.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()},A.prototype.onPrimaryMessageRecieved_=function(A){var M=k("t",A),D=k("d",A);"c"==M?this.onControl_(D):"d"==M&&this.onDataMessage_(D)},A.prototype.onDataMessage_=function(A){this.onPrimaryResponse_(),this.onMessage_(A)},A.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},A.prototype.onControl_=function(A){var M=k("t",A);if("d"in A){var D=A.d;if("h"===M)this.onHandshake_(D);else if("n"===M){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var I=0;I3e4&&(this.reconnectDelay_=VM),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var A=(new Date).getTime()-this.lastConnectionAttemptTime_,M=Math.max(0,this.reconnectDelay_-A);M=Math.random()*M,this.log_("Trying to reconnect in "+M+"ms"),this.scheduleConnect_(M),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},M.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var A=this.onDataMessage_.bind(this),D=this.onReady_.bind(this),I=this.onRealtimeDisconnect_.bind(this),g=this.id+":"+M.nextConnectionId_++,t=this,w=this.lastSessionId,N=!1,i=null,T=function(){i?i.close():(N=!0,I())};this.realtime_={close:T,sendRequest:function(A){e.assert(i,"sendRequest call when we're not connected not allowed."),i.sendRequest(A)}};var n=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(n).then(function(M){N?Q("getToken() completed but was canceled"):(Q("getToken() completed. Creating connection."),t.authToken_=M&&M.accessToken,i=new WM(g,t.repoInfo_,A,D,I,function(A){L(A+" ("+t.repoInfo_.toString()+")"),t.interrupt("server_kill")},w))}).then(null,function(A){t.log_("Failed to get token: "+A),N||(e.CONSTANTS.NODE_ADMIN&&L(A),T())})}},M.prototype.interrupt=function(A){Q("Interrupting connection for reason: "+A),this.interruptReasons_[A]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},M.prototype.resume=function(A){Q("Resuming connection for reason: "+A),delete this.interruptReasons_[A],e.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=VM,this.realtime_||this.scheduleConnect_(0))},M.prototype.handleTimestamp_=function(A){var M=A-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:M})},M.prototype.cancelSentTransactions_=function(){for(var A=0;A=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},M.prototype.onSecurityDebugPacket_=function(A){this.securityDebugCallback_?this.securityDebugCallback_(A):"msg"in A&&console.log("FIREBASE: "+A.msg.replace("\n","\nFIREBASE: "))},M.prototype.restoreState_=function(){var A=this;this.tryAuth(),e.forEach(this.listens_,function(M,D){e.forEach(D,function(M,D){A.sendListen_(D)})});for(var M=0;M=200&&N.status<300){try{A=e.jsonEval(N.responseText)}catch(A){L("Failed to parse JSON response for "+w+": "+N.responseText)}D(null,A)}else 401!==N.status&&404!==N.status&&L("Got unsuccessful REST response for "+w+" Status: "+N.status),D(N.status);D=null}},N.open("GET",w,!0),N.send()})},M}(PM),_M=function(){function A(A,M,D){var I=this;this.repoInfo_=A,this.app=D,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new lM,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new KA,this.persistentConnection_=null;var g=new sM(D);if(this.stats_=OM.getCollection(A),M||p())this.server_=new KM(this.repoInfo_,this.onDataUpdate_.bind(this),g),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var t=D.options.databaseAuthVariableOverride;if(void 0!==t&&null!==t){if("object"!=typeof t)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{e.stringify(t)}catch(A){throw new Error("Invalid authOverride provided: "+A)}}this.persistentConnection_=new ZM(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),g,t),this.server_=this.persistentConnection_}g.addTokenChangeListener(function(A){I.server_.refreshAuthToken(A)}),this.statsReporter_=OM.getOrCreateReporter(A,function(){return new UM(I.stats_,I.server_)}),this.transactions_init_(),this.infoData_=new LM,this.infoSyncTree_=new aM({startListening:function(A,M,D,g){var t=[],e=I.infoData_.getNode(A.path);return e.isEmpty()||(t=I.infoSyncTree_.applyServerOverwrite(A.path,e),setTimeout(function(){g("ok")},0)),t},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new aM({startListening:function(A,M,D,g){return I.server_.listen(A,D,M,function(M,D){var t=g(M,D);I.eventQueue_.raiseEventsForChangedPath(A.path,t)}),[]},stopListening:function(A,M){I.server_.unlisten(A,M)}})}return A.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},A.prototype.name=function(){return this.repoInfo_.namespace},A.prototype.serverTime=function(){var A=this.infoData_.getNode(new H(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+A},A.prototype.generateServerValues=function(){return function(A){return(A=A||{}).timestamp=A.timestamp||(new Date).getTime(),A}({timestamp:this.serverTime()})},A.prototype.onDataUpdate_=function(A,M,D,I){this.dataUpdateCount++;var g=new H(A);M=this.interceptServerDataCallback_?this.interceptServerDataCallback_(A,M):M;var t=[];if(I)if(D){var w=e.map(M,function(A){return pA(A)});t=this.serverSyncTree_.applyTaggedQueryMerge(g,w,I)}else{var N=pA(M);t=this.serverSyncTree_.applyTaggedQueryOverwrite(g,N,I)}else if(D){var i=e.map(M,function(A){return pA(A)});t=this.serverSyncTree_.applyServerMerge(g,i)}else{var T=pA(M);t=this.serverSyncTree_.applyServerOverwrite(g,T)}var n=g;t.length>0&&(n=this.rerunTransactions_(g)),this.eventQueue_.raiseEventsForChangedPath(n,t)},A.prototype.interceptServerData_=function(A){this.interceptServerDataCallback_=A},A.prototype.onConnectStatus_=function(A){this.updateInfo_("connected",A),!1===A&&this.runOnDisconnectEvents_()},A.prototype.onServerInfoUpdate_=function(A){var M=this;h(A,function(A,D){M.updateInfo_(D,A)})},A.prototype.updateInfo_=function(A,M){var D=new H("/.info/"+A),I=pA(M);this.infoData_.updateSnapshot(D,I);var g=this.infoSyncTree_.applyServerOverwrite(D,I);this.eventQueue_.raiseEventsForChangedPath(D,g)},A.prototype.getNextWriteId_=function(){return this.nextWriteId_++},A.prototype.setWithPriority=function(A,M,D,I){var g=this;this.log_("set",{path:A.toString(),value:M,priority:D});var t=this.generateServerValues(),e=pA(M,D),w=qA(e,t),N=this.getNextWriteId_(),i=this.serverSyncTree_.applyUserOverwrite(A,w,N,!0);this.eventQueue_.queueEvents(i),this.server_.put(A.toString(),e.val(!0),function(M,D){var t="ok"===M;t||L("set at "+A+" failed: "+M);var e=g.serverSyncTree_.ackUserWrite(N,!t);g.eventQueue_.raiseEventsForChangedPath(A,e),g.callOnCompleteCallback(I,M,D)});var T=this.abortTransactions_(A);this.rerunTransactions_(T),this.eventQueue_.raiseEventsForChangedPath(T,[])},A.prototype.update=function(A,M,D){var I=this;this.log_("update",{path:A.toString(),value:M});var g=!0,t=this.generateServerValues(),w={};if(e.forEach(M,function(A,M){g=!1;var D=pA(M);w[A]=qA(D,t)}),g)Q("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(D,"ok");else{var N=this.getNextWriteId_(),i=this.serverSyncTree_.applyUserMerge(A,w,N);this.eventQueue_.queueEvents(i),this.server_.merge(A.toString(),M,function(M,g){var t="ok"===M;t||L("update at "+A+" failed: "+M);var e=I.serverSyncTree_.ackUserWrite(N,!t),w=e.length>0?I.rerunTransactions_(A):A;I.eventQueue_.raiseEventsForChangedPath(w,e),I.callOnCompleteCallback(D,M,g)}),e.forEach(M,function(M){var D=I.abortTransactions_(A.child(M));I.rerunTransactions_(D)}),this.eventQueue_.raiseEventsForChangedPath(A,[])}},A.prototype.runOnDisconnectEvents_=function(){var A=this;this.log_("onDisconnectEvents");var M=this.generateServerValues(),D=[];(function(A,M){var D=new KA;return A.forEachTree(new H(""),function(A,I){D.remember(A,qA(I,M))}),D})(this.onDisconnect_,M).forEachTree(H.Empty,function(M,I){D=D.concat(A.serverSyncTree_.applyServerOverwrite(M,I));var g=A.abortTransactions_(M);A.rerunTransactions_(g)}),this.onDisconnect_=new KA,this.eventQueue_.raiseEventsForChangedPath(H.Empty,D)},A.prototype.onDisconnectCancel=function(A,M){var D=this;this.server_.onDisconnectCancel(A.toString(),function(I,g){"ok"===I&&D.onDisconnect_.forget(A),D.callOnCompleteCallback(M,I,g)})},A.prototype.onDisconnectSet=function(A,M,D){var I=this,g=pA(M);this.server_.onDisconnectPut(A.toString(),g.val(!0),function(M,t){"ok"===M&&I.onDisconnect_.remember(A,g),I.callOnCompleteCallback(D,M,t)})},A.prototype.onDisconnectSetWithPriority=function(A,M,D,I){var g=this,t=pA(M,D);this.server_.onDisconnectPut(A.toString(),t.val(!0),function(M,D){"ok"===M&&g.onDisconnect_.remember(A,t),g.callOnCompleteCallback(I,M,D)})},A.prototype.onDisconnectUpdate=function(A,M,D){var I=this;if(e.isEmpty(M))return Q("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(D,"ok");this.server_.onDisconnectMerge(A.toString(),M,function(g,t){"ok"===g&&e.forEach(M,function(M,D){var g=pA(D);I.onDisconnect_.remember(A.child(M),g)}),I.callOnCompleteCallback(D,g,t)})},A.prototype.addEventCallbackForQuery=function(A,M){var D;D=".info"===A.path.getFront()?this.infoSyncTree_.addEventRegistration(A,M):this.serverSyncTree_.addEventRegistration(A,M),this.eventQueue_.raiseEventsAtPath(A.path,D)},A.prototype.removeEventCallbackForQuery=function(A,M){var D;D=".info"===A.path.getFront()?this.infoSyncTree_.removeEventRegistration(A,M):this.serverSyncTree_.removeEventRegistration(A,M),this.eventQueue_.raiseEventsAtPath(A.path,D)},A.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},A.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},A.prototype.stats=function(A){if(void 0===A&&(A=!1),"undefined"!=typeof console){var M;A?(this.statsListener_||(this.statsListener_=new YM(this.stats_)),M=this.statsListener_.get()):M=this.stats_.get();var D=Object.keys(M).reduce(function(A,M){return Math.max(M.length,A)},0);e.forEach(M,function(A,M){for(var I=A.length;I=0)return null!=g&&g.trackChildChange(TM.childChangedChange(M,D,c)),N.updateImmediateChild(M,D);null!=g&&g.trackChildChange(TM.childRemovedChange(M,c));var y=N.updateImmediateChild(M,FA.EMPTY_NODE);return null!=E&&this.rangedFilter_.matches(E)?(null!=g&&g.trackChildChange(TM.childAddedChange(E.name,E.node)),y.updateImmediateChild(E.name,E.node)):y}return D.isEmpty()?A:n&&t(T,i)>=0?(null!=g&&(g.trackChildChange(TM.childRemovedChange(T.name,T.node)),g.trackChildChange(TM.childAddedChange(M,D))),N.updateImmediateChild(M,D).updateImmediateChild(T.name,FA.EMPTY_NODE)):A},A}(),AD=function(){function A(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=aA}return A.prototype.hasStart=function(){return this.startSet_},A.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},A.prototype.getIndexStartValue=function(){return e.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},A.prototype.getIndexStartName=function(){return e.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:x},A.prototype.hasEnd=function(){return this.endSet_},A.prototype.getIndexEndValue=function(){return e.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},A.prototype.getIndexEndName=function(){return e.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:O},A.prototype.hasLimit=function(){return this.limitSet_},A.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},A.prototype.getLimit=function(){return e.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},A.prototype.getIndex=function(){return this.index_},A.prototype.copy_=function(){var M=new A;return M.limitSet_=this.limitSet_,M.limit_=this.limit_,M.startSet_=this.startSet_,M.indexStartValue_=this.indexStartValue_,M.startNameSet_=this.startNameSet_,M.indexStartName_=this.indexStartName_,M.endSet_=this.endSet_,M.indexEndValue_=this.indexEndValue_,M.endNameSet_=this.endNameSet_,M.indexEndName_=this.indexEndName_,M.index_=this.index_,M.viewFrom_=this.viewFrom_,M},A.prototype.limit=function(A){var M=this.copy_();return M.limitSet_=!0,M.limit_=A,M.viewFrom_="",M},A.prototype.limitToFirst=function(M){var D=this.copy_();return D.limitSet_=!0,D.limit_=M,D.viewFrom_=A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,D},A.prototype.limitToLast=function(M){var D=this.copy_();return D.limitSet_=!0,D.limit_=M,D.viewFrom_=A.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,D},A.prototype.startAt=function(A,M){var D=this.copy_();return D.startSet_=!0,void 0===A&&(A=null),D.indexStartValue_=A,null!=M?(D.startNameSet_=!0,D.indexStartName_=M):(D.startNameSet_=!1,D.indexStartName_=""),D},A.prototype.endAt=function(A,M){var D=this.copy_();return D.endSet_=!0,void 0===A&&(A=null),D.indexEndValue_=A,void 0!==M?(D.endNameSet_=!0,D.indexEndName_=M):(D.endNameSet_=!1,D.indexEndName_=""),D},A.prototype.orderBy=function(A){var M=this.copy_();return M.index_=A,M},A.prototype.getQueryObject=function(){var M=A.WIRE_PROTOCOL_CONSTANTS_,D={};if(this.startSet_&&(D[M.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(D[M.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(D[M.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(D[M.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){D[M.LIMIT]=this.limit_;var I=this.viewFrom_;""===I&&(I=this.isViewFromLeft()?M.VIEW_FROM_LEFT:M.VIEW_FROM_RIGHT),D[M.VIEW_FROM]=I}return this.index_!==aA&&(D[M.INDEX]=this.index_.toString()),D},A.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},A.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==aA},A.prototype.getNodeFilter=function(){return this.loadsAllData()?new nM(this.getIndex()):this.hasLimit()?new $M(this):new qM(this)},A.prototype.toRestQueryStringParameters=function(){var M,D=A.REST_QUERY_CONSTANTS_,I={};return this.isDefault()?I:(this.index_===aA?M=D.PRIORITY_INDEX:this.index_===bA?M=D.VALUE_INDEX:this.index_===jA?M=D.KEY_INDEX:(e.assert(this.index_ instanceof JA,"Unrecognized index type!"),M=this.index_.toString()),I[D.ORDER_BY]=e.stringify(M),this.startSet_&&(I[D.START_AT]=e.stringify(this.indexStartValue_),this.startNameSet_&&(I[D.START_AT]+=","+e.stringify(this.indexStartName_))),this.endSet_&&(I[D.END_AT]=e.stringify(this.indexEndValue_),this.endNameSet_&&(I[D.END_AT]+=","+e.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?I[D.LIMIT_TO_FIRST]=this.limit_:I[D.LIMIT_TO_LAST]=this.limit_),I)},A.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},A.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},A.DEFAULT=new A,A}(),MD=function(A){function M(M,D){if(!(M instanceof _M))throw new Error("new Reference() no longer supported - use app.database().");return A.call(this,M,D,AD.DEFAULT,!1)||this}return t.__extends(M,A),M.prototype.getKey=function(){return e.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},M.prototype.child=function(A){return e.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof A?A=String(A):A instanceof H||(null===this.path.getFront()?function(A,M,D,I){D&&(D=D.replace(/^\/*\.info(\/|$)/,"/")),tA(A,M,D,I)}("Reference.child",1,A,!1):tA("Reference.child",1,A,!1)),new M(this.repo,this.path.child(A))},M.prototype.getParent=function(){e.validateArgCount("Reference.parent",0,0,arguments.length);var A=this.path.parent();return null===A?null:new M(this.repo,A)},M.prototype.getRoot=function(){e.validateArgCount("Reference.root",0,0,arguments.length);for(var A=this;null!==A.getParent();)A=A.getParent();return A},M.prototype.databaseProp=function(){return this.repo.database},M.prototype.set=function(A,M){e.validateArgCount("Reference.set",1,2,arguments.length),eA("Reference.set",this.path),$("Reference.set",1,A,this.path,!1),e.validateCallback("Reference.set",2,M,!0);var D=new e.Deferred;return this.repo.setWithPriority(this.path,A,null,D.wrapCallback(M)),D.promise},M.prototype.update=function(A,M){if(e.validateArgCount("Reference.update",1,2,arguments.length),eA("Reference.update",this.path),Array.isArray(A)){for(var D={},I=0;I4&&"documents"===A.get(4),"tried to deserialize invalid key "+A.toString()),A.popFirst(5)},A.prototype.isValidResourceName=function(A){return A.length>=4&&"projects"===A.get(0)&&"databases"===A.get(2)},A.prototype.toValue=function(A){if(A instanceof BA)return{nullValue:"NULL_VALUE"};if(A instanceof aA)return{booleanValue:A.value()};if(A instanceof xA)return{integerValue:""+A.value()};if(A instanceof OA){var M=A.value();if(this.options.useProto3Json){if(isNaN(M))return{doubleValue:"NaN"};if(M===1/0)return{doubleValue:"Infinity"};if(M===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:A.value()}}return A instanceof YA?{stringValue:A.value()}:A instanceof dA?{mapValue:this.toMapValue(A)}:A instanceof FA?{arrayValue:this.toArrayValue(A)}:A instanceof SA?{timestampValue:this.toTimestamp(A.internalValue)}:A instanceof hA?{geoPointValue:{latitude:A.value().latitude,longitude:A.value().longitude}}:A instanceof UA?{bytesValue:this.toBytes(A.value())}:A instanceof lA?{referenceValue:this.toResourceName(A.databaseId,A.key.path)}:o("Unknown FieldValue "+JSON.stringify(A))},A.prototype.fromValue=function(A){var M=this,D=A.value_type;if(MD(A,D,"nullValue"))return BA.INSTANCE;if(MD(A,D,"booleanValue"))return aA.of(A.booleanValue);if(MD(A,D,"integerValue"))return new xA($M(A.integerValue));if(MD(A,D,"doubleValue")){if(this.options.useProto3Json){if("NaN"===A.doubleValue)return OA.NAN;if("Infinity"===A.doubleValue)return OA.POSITIVE_INFINITY;if("-Infinity"===A.doubleValue)return OA.NEGATIVE_INFINITY}return new OA(A.doubleValue)}if(MD(A,D,"stringValue"))return new YA(A.stringValue);if(MD(A,D,"mapValue"))return this.fromFields(A.mapValue.fields||{});if(MD(A,D,"arrayValue")){qM(A.arrayValue,"arrayValue");var I=A.arrayValue.values||[];return new FA(I.map(function(A){return M.fromValue(A)}))}if(MD(A,D,"timestampValue"))return qM(A.timestampValue,"timestampValue"),new SA(this.fromTimestamp(A.timestampValue));if(MD(A,D,"geoPointValue")){qM(A.geoPointValue,"geoPointValue");var g=A.geoPointValue.latitude||0,t=A.geoPointValue.longitude||0;return new hA(new DA(g,t))}if(MD(A,D,"bytesValue")){qM(A.bytesValue,"bytesValue");var e=this.fromBlob(A.bytesValue);return new UA(e)}if(MD(A,D,"referenceValue")){qM(A.referenceValue,"referenceValue");var w=this.fromResourceName(A.referenceValue),N=new eA(w.get(1),w.get(3)),i=new nA(this.extractLocalPathFromResourceName(w));return new lA(N,i)}return o("Unknown Value proto "+JSON.stringify(A))},A.prototype.toMutationDocument=function(A,M){return{name:this.toName(A),fields:this.toFields(M)}},A.prototype.toDocument=function(A){return u(!A.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(A.key),fields:this.toFields(A.data),updateTime:this.toTimestamp(A.version.toTimestamp())}},A.prototype.fromDocument=function(A,M){return new EA(this.fromName(A.name),this.fromVersion(A.updateTime),this.fromFields(A.fields||{}),{hasCommittedMutations:!!M})},A.prototype.toFields=function(A){var M=this,D={};return A.forEach(function(A,I){D[A]=M.toValue(I)}),D},A.prototype.fromFields=function(A){var M=this,D=A,I=dA.EMPTY;return x(D,function(A,D){I=I.set(new TA([A]),M.fromValue(D))}),I},A.prototype.toMapValue=function(A){return{fields:this.toFields(A)}},A.prototype.toArrayValue=function(A){var M=this,D=[];return A.forEach(function(A){D.push(M.toValue(A))}),{values:D}},A.prototype.fromFound=function(A){u(!!A.found,"Tried to deserialize a found document from a missing document."),qM(A.found.name,"doc.found.name"),qM(A.found.updateTime,"doc.found.updateTime");var M=this.fromName(A.found.name),D=this.fromVersion(A.found.updateTime),I=this.fromFields(A.found.fields||{});return new EA(M,D,I,{},A.found)},A.prototype.fromMissing=function(A){u(!!A.missing,"Tried to deserialize a missing document from a found document."),u(!!A.readTime,"Tried to deserialize a missing document without a read time.");var M=this.fromName(A.missing),D=this.fromVersion(A.readTime);return new jA(M,D)},A.prototype.fromMaybeDocument=function(A){var M=A.result;return MD(A,M,"found")?this.fromFound(A):MD(A,M,"missing")?this.fromMissing(A):o("invalid batch get response: "+JSON.stringify(A))},A.prototype.toWatchTargetChangeState=function(A){switch(A){case mM.Added:return"ADD";case mM.Current:return"CURRENT";case mM.NoChange:return"NO_CHANGE";case mM.Removed:return"REMOVE";case mM.Reset:return"RESET";default:return o("Unknown WatchTargetChangeState: "+A)}},A.prototype.toTestWatchChange=function(A){if(A instanceof RM)return{filter:{count:A.existenceFilter.count,targetId:A.targetId}};if(A instanceof JM){if(A.newDoc instanceof EA){var M=A.newDoc;return{documentChange:{document:{name:this.toName(M.key),fields:this.toFields(M.data),updateTime:this.toVersion(M.version)},targetIds:A.updatedTargetIds,removedTargetIds:A.removedTargetIds}}}if(A.newDoc instanceof jA){M=A.newDoc;return{documentDelete:{document:this.toName(M.key),readTime:this.toVersion(M.version),removedTargetIds:A.removedTargetIds}}}if(null===A.newDoc)return{documentRemove:{document:this.toName(A.key),removedTargetIds:A.removedTargetIds}}}if(A instanceof vM){var D=void 0;return A.cause&&(D={code:function(A){if(void 0===A)return CM.OK;switch(A){case Q.OK:return CM.OK;case Q.CANCELLED:return CM.CANCELLED;case Q.UNKNOWN:return CM.UNKNOWN;case Q.DEADLINE_EXCEEDED:return CM.DEADLINE_EXCEEDED;case Q.RESOURCE_EXHAUSTED:return CM.RESOURCE_EXHAUSTED;case Q.INTERNAL:return CM.INTERNAL;case Q.UNAVAILABLE:return CM.UNAVAILABLE;case Q.UNAUTHENTICATED:return CM.UNAUTHENTICATED;case Q.INVALID_ARGUMENT:return CM.INVALID_ARGUMENT;case Q.NOT_FOUND:return CM.NOT_FOUND;case Q.ALREADY_EXISTS:return CM.ALREADY_EXISTS;case Q.PERMISSION_DENIED:return CM.PERMISSION_DENIED;case Q.FAILED_PRECONDITION:return CM.FAILED_PRECONDITION;case Q.ABORTED:return CM.ABORTED;case Q.OUT_OF_RANGE:return CM.OUT_OF_RANGE;case Q.UNIMPLEMENTED:return CM.UNIMPLEMENTED;case Q.DATA_LOSS:return CM.DATA_LOSS;default:return o("Unknown status code: "+A)}}(A.cause.code),message:A.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(A.state),targetIds:A.targetIds,resumeToken:this.unsafeCastProtoByteString(A.resumeToken),cause:D}}}return o("Unrecognized watch change: "+JSON.stringify(A))},A.prototype.fromWatchChange=function(A){var M,D=A.response_type;if(MD(A,D,"targetChange")){qM(A.targetChange,"targetChange");var I=this.fromWatchTargetChangeState(A.targetChange.targetChangeType||"NO_CHANGE"),g=A.targetChange.targetIds||[],t=A.targetChange.resumeToken||this.emptyByteString(),e=A.targetChange.cause,w=e&&this.fromRpcStatus(e);M=new vM(I,g,t,w||null)}else if(MD(A,D,"documentChange")){qM(A.documentChange,"documentChange"),qM(A.documentChange.document,"documentChange.name"),qM(A.documentChange.document.name,"documentChange.document.name"),qM(A.documentChange.document.updateTime,"documentChange.document.updateTime");var N=A.documentChange,i=this.fromName(N.document.name),T=this.fromVersion(N.document.updateTime),n=this.fromFields(N.document.fields||{}),c=new EA(i,T,n,{},N.document),E=N.targetIds||[],j=N.removedTargetIds||[];M=new JM(E,j,c.key,c)}else if(MD(A,D,"documentDelete")){qM(A.documentDelete,"documentDelete"),qM(A.documentDelete.document,"documentDelete.document");var y=A.documentDelete;i=this.fromName(y.document),T=y.readTime?this.fromVersion(y.readTime):AM.forDeletedDoc(),c=new jA(i,T),j=y.removedTargetIds||[];M=new JM([],j,c.key,c)}else if(MD(A,D,"documentRemove")){qM(A.documentRemove,"documentRemove"),qM(A.documentRemove.document,"documentRemove");var u=A.documentRemove;i=this.fromName(u.document),j=u.removedTargetIds||[];M=new JM([],j,i,null)}else{if(!MD(A,D,"filter"))return o("Unknown change type "+JSON.stringify(A));qM(A.filter,"filter"),qM(A.filter.targetId,"filter.targetId");var r=A.filter,C=r.count||0,Q=new QM(C),z=r.targetId;M=new RM(z,Q)}return M},A.prototype.fromWatchTargetChangeState=function(A){return"NO_CHANGE"===A?mM.NoChange:"ADD"===A?mM.Added:"REMOVE"===A?mM.Removed:"CURRENT"===A?mM.Current:"RESET"===A?mM.Reset:o("Got unexpected TargetChange.state: "+A)},A.prototype.versionFromListenResponse=function(A){if(!MD(A,A.response_type,"targetChange"))return AM.MIN;var M=A.targetChange;return M.targetIds&&M.targetIds.length?AM.MIN:M.readTime?this.fromVersion(M.readTime):AM.MIN},A.prototype.toMutation=function(A){var M,D=this;if(A instanceof TM)M={update:this.toMutationDocument(A.key,A.value)};else if(A instanceof EM)M={delete:this.toName(A.key)};else if(A instanceof nM)M={update:this.toMutationDocument(A.key,A.data),updateMask:this.toDocumentMask(A.fieldMask)};else{if(!(A instanceof cM))return o("Unknown mutation type "+A.type);M={transform:{document:this.toName(A.key),fieldTransforms:A.fieldTransforms.map(function(A){return D.toFieldTransform(A)})}}}return A.precondition.isNone||(M.currentDocument=this.toPrecondition(A.precondition)),M},A.prototype.fromMutation=function(A){var M=this,D=A.currentDocument?this.fromPrecondition(A.currentDocument):NM.NONE;if(A.update){qM(A.update.name,"name");var I=this.fromName(A.update.name),g=this.fromFields(A.update.fields||{});if(A.updateMask){var t=this.fromDocumentMask(A.updateMask);return new nM(I,g,t,D)}return new TM(I,g,D)}if(A.delete){I=this.fromName(A.delete);return new EM(I,D)}if(A.transform){I=this.fromName(A.transform.document);var e=A.transform.fieldTransforms.map(function(A){return M.fromFieldTransform(A)});return u(!0===D.exists,'Transforms only support precondition "exists == true"'),new cM(I,e)}return o("unknown mutation proto: "+JSON.stringify(A))},A.prototype.toPrecondition=function(A){return u(!A.isNone,"Can't serialize an empty precondition"),void 0!==A.updateTime?{updateTime:this.toVersion(A.updateTime)}:void 0!==A.exists?{exists:A.exists}:o("Unknown precondition")},A.prototype.fromPrecondition=function(A){return void 0!==A.updateTime?NM.updateTime(this.fromVersion(A.updateTime)):void 0!==A.exists?NM.exists(A.exists):NM.NONE},A.prototype.fromWriteResult=function(A,M){var D=this,I=A.updateTime?this.fromVersion(A.updateTime):this.fromVersion(M),g=null;return A.transformResults&&A.transformResults.length>0&&(g=A.transformResults.map(function(A){return D.fromValue(A)})),new wM(I,g)},A.prototype.fromWriteResults=function(A,M){var D=this;return A&&A.length>0?(u(void 0!==M,"Received a write result without a commit time"),A.map(function(A){return D.fromWriteResult(A,M)})):[]},A.prototype.toFieldTransform=function(A){var M=this,D=A.transform;if(D instanceof jM)return{fieldPath:A.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(D instanceof yM)return{fieldPath:A.field.canonicalString(),appendMissingElements:{values:D.elements.map(function(A){return M.toValue(A)})}};if(D instanceof oM)return{fieldPath:A.field.canonicalString(),removeAllFromArray:{values:D.elements.map(function(A){return M.toValue(A)})}};if(D instanceof uM)return{fieldPath:A.field.canonicalString(),increment:this.toValue(D.operand)};throw o("Unknown transform: "+A.transform)},A.prototype.fromFieldTransform=function(A){var M=this,D=A.transform_type,I=null;if(MD(A,D,"setToServerValue"))u("REQUEST_TIME"===A.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(A)),I=jM.instance;else if(MD(A,D,"appendMissingElements")){var g=A.appendMissingElements.values||[];I=new yM(g.map(function(A){return M.fromValue(A)}))}else if(MD(A,D,"removeAllFromArray")){g=A.removeAllFromArray.values||[];I=new oM(g.map(function(A){return M.fromValue(A)}))}else if(MD(A,D,"increment")){var t=this.fromValue(A.increment);u(t instanceof LA,"NUMERIC_ADD transform requires a NumberValue"),I=new uM(t)}else o("Unknown transform proto: "+JSON.stringify(A));var e=TA.fromServerFormat(A.fieldPath);return new eM(e,I)},A.prototype.toDocumentsTarget=function(A){return{documents:[this.toQueryPath(A.path)]}},A.prototype.fromDocumentsTarget=function(A){var M=A.documents.length;u(1===M,"DocumentsTarget contained other than 1 document: "+M);var D=A.documents[0];return RA.atPath(this.fromQueryPath(D))},A.prototype.toQueryTarget=function(A){var M={structuredQuery:{}},D=A.path;null!==A.collectionGroup?(u(D.length%2==0,"Collection Group queries should be within a document path or root."),M.parent=this.toQueryPath(D),M.structuredQuery.from=[{collectionId:A.collectionGroup,allDescendants:!0}]):(u(D.length%2!=0,"Document queries with filters are not supported."),M.parent=this.toQueryPath(D.popLast()),M.structuredQuery.from=[{collectionId:D.lastSegment()}]);var I=this.toFilter(A.filters);I&&(M.structuredQuery.where=I);var g=this.toOrder(A.orderBy);g&&(M.structuredQuery.orderBy=g);var t=this.toInt32Value(A.limit);return void 0!==t&&(M.structuredQuery.limit=t),A.startAt&&(M.structuredQuery.startAt=this.toCursor(A.startAt)),A.endAt&&(M.structuredQuery.endAt=this.toCursor(A.endAt)),M},A.prototype.fromQueryTarget=function(A){var M=this.fromQueryPath(A.parent),D=A.structuredQuery,I=D.from?D.from.length:0,g=null;if(I>0){u(1===I,"StructuredQuery.from with more than one collection is not supported.");var t=D.from[0];t.allDescendants?g=t.collectionId:M=M.child(t.collectionId)}var e=[];D.where&&(e=this.fromFilter(D.where));var w=[];D.orderBy&&(w=this.fromOrder(D.orderBy));var N=null;D.limit&&(N=this.fromInt32Value(D.limit));var i=null;D.startAt&&(i=this.fromCursor(D.startAt));var T=null;return D.endAt&&(T=this.fromCursor(D.endAt)),new RA(M,g,w,e,N,i,T)},A.prototype.toListenRequestLabels=function(A){var M=this.toLabel(A.purpose);return null==M?null:{"goog-listen-tags":M}},A.prototype.toLabel=function(A){switch(A){case JA.Listen:return null;case JA.ExistenceFilterMismatch:return"existence-filter-mismatch";case JA.LimboResolution:return"limbo-document";default:return o("Unrecognized query purpose: "+A)}},A.prototype.toTarget=function(A){var M,D=A.query;return(M=D.isDocumentQuery()?{documents:this.toDocumentsTarget(D)}:{query:this.toQueryTarget(D)}).targetId=A.targetId,A.resumeToken.length>0&&(M.resumeToken=this.unsafeCastProtoByteString(A.resumeToken)),M},A.prototype.toFilter=function(A){var M=this;if(0!==A.length){var D=A.map(function(A){return A instanceof PA?M.toRelationFilter(A):M.toUnaryFilter(A)});return 1===D.length?D[0]:{compositeFilter:{op:"AND",filters:D}}}},A.prototype.fromFilter=function(A){var M=this;return A?void 0!==A.unaryFilter?[this.fromUnaryFilter(A)]:void 0!==A.fieldFilter?[this.fromRelationFilter(A)]:void 0!==A.compositeFilter?A.compositeFilter.filters.map(function(A){return M.fromFilter(A)}).reduce(function(A,M){return A.concat(M)}):o("Unknown filter: "+JSON.stringify(A)):[]},A.prototype.toOrder=function(A){var M=this;if(0!==A.length)return A.map(function(A){return M.toPropertyOrder(A)})},A.prototype.fromOrder=function(A){var M=this;return A.map(function(A){return M.fromPropertyOrder(A)})},A.prototype.toCursor=function(A){var M=this;return{before:A.before,values:A.position.map(function(A){return M.toValue(A)})}},A.prototype.fromCursor=function(A){var M=this,D=!!A.before,I=A.values.map(function(A){return M.fromValue(A)});return new KA(I,D)},A.prototype.toDirection=function(A){return ZM[A.name]},A.prototype.fromDirection=function(A){switch(A){case"ASCENDING":return ZA.ASCENDING;case"DESCENDING":return ZA.DESCENDING;default:return}},A.prototype.toOperatorName=function(A){return KM[A.name]},A.prototype.fromOperatorName=function(A){switch(A){case"EQUAL":return WA.EQUAL;case"GREATER_THAN":return WA.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return WA.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return WA.LESS_THAN;case"LESS_THAN_OR_EQUAL":return WA.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return WA.ARRAY_CONTAINS;case"OPERATOR_UNSPECIFIED":return o("Unspecified relation");default:return o("Unknown relation")}},A.prototype.toFieldPathReference=function(A){return{fieldPath:A.canonicalString()}},A.prototype.fromFieldPathReference=function(A){return TA.fromServerFormat(A.fieldPath)},A.prototype.toPropertyOrder=function(A){return{field:this.toFieldPathReference(A.field),direction:this.toDirection(A.dir)}},A.prototype.fromPropertyOrder=function(A){return new _A(this.fromFieldPathReference(A.field),this.fromDirection(A.direction))},A.prototype.toRelationFilter=function(A){return A instanceof PA?{fieldFilter:{field:this.toFieldPathReference(A.field),op:this.toOperatorName(A.op),value:this.toValue(A.value)}}:o("Unrecognized filter: "+JSON.stringify(A))},A.prototype.fromRelationFilter=function(A){return new PA(this.fromFieldPathReference(A.fieldFilter.field),this.fromOperatorName(A.fieldFilter.op),this.fromValue(A.fieldFilter.value))},A.prototype.toUnaryFilter=function(A){return A instanceof XA?{unaryFilter:{field:this.toFieldPathReference(A.field),op:"IS_NAN"}}:A instanceof VA?{unaryFilter:{field:this.toFieldPathReference(A.field),op:"IS_NULL"}}:o("Unrecognized filter: "+JSON.stringify(A))},A.prototype.fromUnaryFilter=function(A){switch(A.unaryFilter.op){case"IS_NAN":var M=this.fromFieldPathReference(A.unaryFilter.field);return new XA(M);case"IS_NULL":var D=this.fromFieldPathReference(A.unaryFilter.field);return new VA(D);case"OPERATOR_UNSPECIFIED":return o("Unspecified filter");default:return o("Unknown filter")}},A.prototype.toDocumentMask=function(A){var M=[];return A.fields.forEach(function(A){return M.push(A.canonicalString())}),{fieldPaths:M}},A.prototype.fromDocumentMask=function(A){var M=(A.fieldPaths||[]).map(function(A){return TA.fromServerFormat(A)});return tM.fromArray(M)},A}();function MD(A,M,D){return M===D||!M&&D in A} + */var ZM=function(){var A={};return A[ZA.ASCENDING.name]="ASCENDING",A[ZA.DESCENDING.name]="DESCENDING",A}(),KM=function(){var A={};return A[WA.LESS_THAN.name]="LESS_THAN",A[WA.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",A[WA.GREATER_THAN.name]="GREATER_THAN",A[WA.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",A[WA.EQUAL.name]="EQUAL",A[WA.ARRAY_CONTAINS.name]="ARRAY_CONTAINS",A}(),_M=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function qM(A,M){u(!HA(A),M+" is missing")}function $M(A){return"number"==typeof A?A:"string"==typeof A?Number(A):o("can't parse "+A)}var AD=function(){function A(A,M){this.databaseId=A,this.options=M}return A.prototype.emptyByteString=function(){return this.options.useProto3Json?"":new Uint8Array(0)},A.prototype.unsafeCastProtoByteString=function(A){return A},A.prototype.fromRpcStatus=function(A){var M=void 0===A.code?Q.UNKNOWN:BM(A.code);return new z(M,A.message||"")},A.prototype.toInt32Value=function(A){return HA(A)?void 0:{value:A}},A.prototype.fromInt32Value=function(A){var M;return HA(M="object"==typeof A?A.value:A)?null:M},A.prototype.toTimestamp=function(A){return{seconds:A.seconds,nanos:A.nanoseconds}},A.prototype.fromTimestamp=function(A){if("string"==typeof A)return this.fromIso8601String(A);u(!!A,"Cannot deserialize null or undefined timestamp.");var M=$M(A.seconds||"0"),D=A.nanos||0;return new IA(M,D)},A.prototype.fromIso8601String=function(A){var M=0,D=_M.exec(A);if(u(!!D,"invalid timestamp: "+A),D[1]){var I=D[1];I=(I+"000000000").substr(0,9),M=Number(I)}var g=new Date(A),t=Math.floor(g.getTime()/1e3);return new IA(t,M)},A.prototype.toBytes=function(A){return this.options.useProto3Json?A.toBase64():this.unsafeCastProtoByteString(A.toUint8Array())},A.prototype.fromBlob=function(A){return"string"==typeof A?(u(this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),AA.fromBase64String(A)):(u(!this.options.useProto3Json,"Expected bytes to be passed in as string, but got something else instead."),AA.fromUint8Array(A))},A.prototype.toVersion=function(A){return this.toTimestamp(A.toTimestamp())},A.prototype.fromVersion=function(A){return u(!!A,"Trying to deserialize version that isn't set"),AM.fromTimestamp(this.fromTimestamp(A))},A.prototype.toResourceName=function(A,M){return this.fullyQualifiedPrefixPath(A).child("documents").child(M).canonicalString()},A.prototype.fromResourceName=function(A){var M=NA.fromString(A);return u(this.isValidResourceName(M),"Tried to deserialize invalid key "+M.toString()),M},A.prototype.toName=function(A){return this.toResourceName(this.databaseId,A.path)},A.prototype.fromName=function(A){var M=this.fromResourceName(A);return u(M.get(1)===this.databaseId.projectId,"Tried to deserialize key from different project: "+M.get(1)+" vs "+this.databaseId.projectId),u(!M.get(3)&&!this.databaseId.database||M.get(3)===this.databaseId.database,"Tried to deserialize key from different database: "+M.get(3)+" vs "+this.databaseId.database),new nA(this.extractLocalPathFromResourceName(M))},A.prototype.toQueryPath=function(A){return this.toResourceName(this.databaseId,A)},A.prototype.fromQueryPath=function(A){var M=this.fromResourceName(A);return 4===M.length?NA.EMPTY_PATH:this.extractLocalPathFromResourceName(M)},Object.defineProperty(A.prototype,"encodedDatabaseId",{get:function(){return new NA(["projects",this.databaseId.projectId,"databases",this.databaseId.database]).canonicalString()},enumerable:!0,configurable:!0}),A.prototype.fullyQualifiedPrefixPath=function(A){return new NA(["projects",A.projectId,"databases",A.database])},A.prototype.extractLocalPathFromResourceName=function(A){return u(A.length>4&&"documents"===A.get(4),"tried to deserialize invalid key "+A.toString()),A.popFirst(5)},A.prototype.isValidResourceName=function(A){return A.length>=4&&"projects"===A.get(0)&&"databases"===A.get(2)},A.prototype.toValue=function(A){if(A instanceof BA)return{nullValue:"NULL_VALUE"};if(A instanceof aA)return{booleanValue:A.value()};if(A instanceof xA)return{integerValue:""+A.value()};if(A instanceof OA){var M=A.value();if(this.options.useProto3Json){if(isNaN(M))return{doubleValue:"NaN"};if(M===1/0)return{doubleValue:"Infinity"};if(M===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:A.value()}}return A instanceof YA?{stringValue:A.value()}:A instanceof dA?{mapValue:this.toMapValue(A)}:A instanceof FA?{arrayValue:this.toArrayValue(A)}:A instanceof SA?{timestampValue:this.toTimestamp(A.internalValue)}:A instanceof hA?{geoPointValue:{latitude:A.value().latitude,longitude:A.value().longitude}}:A instanceof UA?{bytesValue:this.toBytes(A.value())}:A instanceof lA?{referenceValue:this.toResourceName(A.databaseId,A.key.path)}:o("Unknown FieldValue "+JSON.stringify(A))},A.prototype.fromValue=function(A){var M=this,D=A.value_type;if(MD(A,D,"nullValue"))return BA.INSTANCE;if(MD(A,D,"booleanValue"))return aA.of(A.booleanValue);if(MD(A,D,"integerValue"))return new xA($M(A.integerValue));if(MD(A,D,"doubleValue")){if(this.options.useProto3Json){if("NaN"===A.doubleValue)return OA.NAN;if("Infinity"===A.doubleValue)return OA.POSITIVE_INFINITY;if("-Infinity"===A.doubleValue)return OA.NEGATIVE_INFINITY}return new OA(A.doubleValue)}if(MD(A,D,"stringValue"))return new YA(A.stringValue);if(MD(A,D,"mapValue"))return this.fromFields(A.mapValue.fields||{});if(MD(A,D,"arrayValue")){qM(A.arrayValue,"arrayValue");var I=A.arrayValue.values||[];return new FA(I.map(function(A){return M.fromValue(A)}))}if(MD(A,D,"timestampValue"))return qM(A.timestampValue,"timestampValue"),new SA(this.fromTimestamp(A.timestampValue));if(MD(A,D,"geoPointValue")){qM(A.geoPointValue,"geoPointValue");var g=A.geoPointValue.latitude||0,t=A.geoPointValue.longitude||0;return new hA(new DA(g,t))}if(MD(A,D,"bytesValue")){qM(A.bytesValue,"bytesValue");var e=this.fromBlob(A.bytesValue);return new UA(e)}if(MD(A,D,"referenceValue")){qM(A.referenceValue,"referenceValue");var w=this.fromResourceName(A.referenceValue),N=new eA(w.get(1),w.get(3)),i=new nA(this.extractLocalPathFromResourceName(w));return new lA(N,i)}return o("Unknown Value proto "+JSON.stringify(A))},A.prototype.toMutationDocument=function(A,M){return{name:this.toName(A),fields:this.toFields(M)}},A.prototype.toDocument=function(A){return u(!A.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(A.key),fields:this.toFields(A.data),updateTime:this.toTimestamp(A.version.toTimestamp())}},A.prototype.fromDocument=function(A,M){return new EA(this.fromName(A.name),this.fromVersion(A.updateTime),this.fromFields(A.fields||{}),{hasCommittedMutations:!!M})},A.prototype.toFields=function(A){var M=this,D={};return A.forEach(function(A,I){D[A]=M.toValue(I)}),D},A.prototype.fromFields=function(A){var M=this,D=A,I=dA.EMPTY;return x(D,function(A,D){I=I.set(new TA([A]),M.fromValue(D))}),I},A.prototype.toMapValue=function(A){return{fields:this.toFields(A)}},A.prototype.toArrayValue=function(A){var M=this,D=[];return A.forEach(function(A){D.push(M.toValue(A))}),{values:D}},A.prototype.fromFound=function(A){u(!!A.found,"Tried to deserialize a found document from a missing document."),qM(A.found.name,"doc.found.name"),qM(A.found.updateTime,"doc.found.updateTime");var M=this.fromName(A.found.name),D=this.fromVersion(A.found.updateTime),I=this.fromFields(A.found.fields||{});return new EA(M,D,I,{},A.found)},A.prototype.fromMissing=function(A){u(!!A.missing,"Tried to deserialize a missing document from a found document."),u(!!A.readTime,"Tried to deserialize a missing document without a read time.");var M=this.fromName(A.missing),D=this.fromVersion(A.readTime);return new jA(M,D)},A.prototype.fromMaybeDocument=function(A){var M=A.result;return MD(A,M,"found")?this.fromFound(A):MD(A,M,"missing")?this.fromMissing(A):o("invalid batch get response: "+JSON.stringify(A))},A.prototype.toWatchTargetChangeState=function(A){switch(A){case mM.Added:return"ADD";case mM.Current:return"CURRENT";case mM.NoChange:return"NO_CHANGE";case mM.Removed:return"REMOVE";case mM.Reset:return"RESET";default:return o("Unknown WatchTargetChangeState: "+A)}},A.prototype.toTestWatchChange=function(A){if(A instanceof RM)return{filter:{count:A.existenceFilter.count,targetId:A.targetId}};if(A instanceof JM){if(A.newDoc instanceof EA){var M=A.newDoc;return{documentChange:{document:{name:this.toName(M.key),fields:this.toFields(M.data),updateTime:this.toVersion(M.version)},targetIds:A.updatedTargetIds,removedTargetIds:A.removedTargetIds}}}if(A.newDoc instanceof jA){M=A.newDoc;return{documentDelete:{document:this.toName(M.key),readTime:this.toVersion(M.version),removedTargetIds:A.removedTargetIds}}}if(null===A.newDoc)return{documentRemove:{document:this.toName(A.key),removedTargetIds:A.removedTargetIds}}}if(A instanceof vM){var D=void 0;return A.cause&&(D={code:function(A){if(void 0===A)return CM.OK;switch(A){case Q.OK:return CM.OK;case Q.CANCELLED:return CM.CANCELLED;case Q.UNKNOWN:return CM.UNKNOWN;case Q.DEADLINE_EXCEEDED:return CM.DEADLINE_EXCEEDED;case Q.RESOURCE_EXHAUSTED:return CM.RESOURCE_EXHAUSTED;case Q.INTERNAL:return CM.INTERNAL;case Q.UNAVAILABLE:return CM.UNAVAILABLE;case Q.UNAUTHENTICATED:return CM.UNAUTHENTICATED;case Q.INVALID_ARGUMENT:return CM.INVALID_ARGUMENT;case Q.NOT_FOUND:return CM.NOT_FOUND;case Q.ALREADY_EXISTS:return CM.ALREADY_EXISTS;case Q.PERMISSION_DENIED:return CM.PERMISSION_DENIED;case Q.FAILED_PRECONDITION:return CM.FAILED_PRECONDITION;case Q.ABORTED:return CM.ABORTED;case Q.OUT_OF_RANGE:return CM.OUT_OF_RANGE;case Q.UNIMPLEMENTED:return CM.UNIMPLEMENTED;case Q.DATA_LOSS:return CM.DATA_LOSS;default:return o("Unknown status code: "+A)}}(A.cause.code),message:A.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(A.state),targetIds:A.targetIds,resumeToken:this.unsafeCastProtoByteString(A.resumeToken),cause:D}}}return o("Unrecognized watch change: "+JSON.stringify(A))},A.prototype.fromWatchChange=function(A){var M,D=A.response_type;if(MD(A,D,"targetChange")){qM(A.targetChange,"targetChange");var I=this.fromWatchTargetChangeState(A.targetChange.targetChangeType||"NO_CHANGE"),g=A.targetChange.targetIds||[],t=A.targetChange.resumeToken||this.emptyByteString(),e=A.targetChange.cause,w=e&&this.fromRpcStatus(e);M=new vM(I,g,t,w||null)}else if(MD(A,D,"documentChange")){qM(A.documentChange,"documentChange"),qM(A.documentChange.document,"documentChange.name"),qM(A.documentChange.document.name,"documentChange.document.name"),qM(A.documentChange.document.updateTime,"documentChange.document.updateTime");var N=A.documentChange,i=this.fromName(N.document.name),T=this.fromVersion(N.document.updateTime),n=this.fromFields(N.document.fields||{}),c=new EA(i,T,n,{},N.document),E=N.targetIds||[],j=N.removedTargetIds||[];M=new JM(E,j,c.key,c)}else if(MD(A,D,"documentDelete")){qM(A.documentDelete,"documentDelete"),qM(A.documentDelete.document,"documentDelete.document");var y=A.documentDelete;i=this.fromName(y.document),T=y.readTime?this.fromVersion(y.readTime):AM.forDeletedDoc(),c=new jA(i,T),j=y.removedTargetIds||[];M=new JM([],j,c.key,c)}else if(MD(A,D,"documentRemove")){qM(A.documentRemove,"documentRemove"),qM(A.documentRemove.document,"documentRemove");var u=A.documentRemove;i=this.fromName(u.document),j=u.removedTargetIds||[];M=new JM([],j,i,null)}else{if(!MD(A,D,"filter"))return o("Unknown change type "+JSON.stringify(A));qM(A.filter,"filter"),qM(A.filter.targetId,"filter.targetId");var r=A.filter,C=r.count||0,Q=new QM(C),z=r.targetId;M=new RM(z,Q)}return M},A.prototype.fromWatchTargetChangeState=function(A){return"NO_CHANGE"===A?mM.NoChange:"ADD"===A?mM.Added:"REMOVE"===A?mM.Removed:"CURRENT"===A?mM.Current:"RESET"===A?mM.Reset:o("Got unexpected TargetChange.state: "+A)},A.prototype.versionFromListenResponse=function(A){if(!MD(A,A.response_type,"targetChange"))return AM.MIN;var M=A.targetChange;return M.targetIds&&M.targetIds.length?AM.MIN:M.readTime?this.fromVersion(M.readTime):AM.MIN},A.prototype.toMutation=function(A){var M,D=this;if(A instanceof TM)M={update:this.toMutationDocument(A.key,A.value)};else if(A instanceof EM)M={delete:this.toName(A.key)};else if(A instanceof nM)M={update:this.toMutationDocument(A.key,A.data),updateMask:this.toDocumentMask(A.fieldMask)};else{if(!(A instanceof cM))return o("Unknown mutation type "+A.type);M={transform:{document:this.toName(A.key),fieldTransforms:A.fieldTransforms.map(function(A){return D.toFieldTransform(A)})}}}return A.precondition.isNone||(M.currentDocument=this.toPrecondition(A.precondition)),M},A.prototype.fromMutation=function(A){var M=this,D=A.currentDocument?this.fromPrecondition(A.currentDocument):NM.NONE;if(A.update){qM(A.update.name,"name");var I=this.fromName(A.update.name),g=this.fromFields(A.update.fields||{});if(A.updateMask){var t=this.fromDocumentMask(A.updateMask);return new nM(I,g,t,D)}return new TM(I,g,D)}if(A.delete){I=this.fromName(A.delete);return new EM(I,D)}if(A.transform){I=this.fromName(A.transform.document);var e=A.transform.fieldTransforms.map(function(A){return M.fromFieldTransform(A)});return u(!0===D.exists,'Transforms only support precondition "exists == true"'),new cM(I,e)}return o("unknown mutation proto: "+JSON.stringify(A))},A.prototype.toPrecondition=function(A){return u(!A.isNone,"Can't serialize an empty precondition"),void 0!==A.updateTime?{updateTime:this.toVersion(A.updateTime)}:void 0!==A.exists?{exists:A.exists}:o("Unknown precondition")},A.prototype.fromPrecondition=function(A){return void 0!==A.updateTime?NM.updateTime(this.fromVersion(A.updateTime)):void 0!==A.exists?NM.exists(A.exists):NM.NONE},A.prototype.fromWriteResult=function(A,M){var D=this,I=A.updateTime?this.fromVersion(A.updateTime):this.fromVersion(M),g=null;return A.transformResults&&A.transformResults.length>0&&(g=A.transformResults.map(function(A){return D.fromValue(A)})),new wM(I,g)},A.prototype.fromWriteResults=function(A,M){var D=this;return A&&A.length>0?(u(void 0!==M,"Recieved a write result without a commit time"),A.map(function(A){return D.fromWriteResult(A,M)})):[]},A.prototype.toFieldTransform=function(A){var M=this,D=A.transform;if(D instanceof jM)return{fieldPath:A.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(D instanceof yM)return{fieldPath:A.field.canonicalString(),appendMissingElements:{values:D.elements.map(function(A){return M.toValue(A)})}};if(D instanceof oM)return{fieldPath:A.field.canonicalString(),removeAllFromArray:{values:D.elements.map(function(A){return M.toValue(A)})}};if(D instanceof uM)return{fieldPath:A.field.canonicalString(),increment:this.toValue(D.operand)};throw o("Unknown transform: "+A.transform)},A.prototype.fromFieldTransform=function(A){var M=this,D=A.transform_type,I=null;if(MD(A,D,"setToServerValue"))u("REQUEST_TIME"===A.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(A)),I=jM.instance;else if(MD(A,D,"appendMissingElements")){var g=A.appendMissingElements.values||[];I=new yM(g.map(function(A){return M.fromValue(A)}))}else if(MD(A,D,"removeAllFromArray")){g=A.removeAllFromArray.values||[];I=new oM(g.map(function(A){return M.fromValue(A)}))}else if(MD(A,D,"increment")){var t=this.fromValue(A.increment);u(t instanceof LA,"NUMERIC_ADD transform requires a NumberValue"),I=new uM(t)}else o("Unknown transform proto: "+JSON.stringify(A));var e=TA.fromServerFormat(A.fieldPath);return new eM(e,I)},A.prototype.toDocumentsTarget=function(A){return{documents:[this.toQueryPath(A.path)]}},A.prototype.fromDocumentsTarget=function(A){var M=A.documents.length;u(1===M,"DocumentsTarget contained other than 1 document: "+M);var D=A.documents[0];return RA.atPath(this.fromQueryPath(D))},A.prototype.toQueryTarget=function(A){var M={structuredQuery:{}},D=A.path;null!==A.collectionGroup?(u(D.length%2==0,"Collection Group queries should be within a document path or root."),M.parent=this.toQueryPath(D),M.structuredQuery.from=[{collectionId:A.collectionGroup,allDescendants:!0}]):(u(D.length%2!=0,"Document queries with filters are not supported."),M.parent=this.toQueryPath(D.popLast()),M.structuredQuery.from=[{collectionId:D.lastSegment()}]);var I=this.toFilter(A.filters);I&&(M.structuredQuery.where=I);var g=this.toOrder(A.orderBy);g&&(M.structuredQuery.orderBy=g);var t=this.toInt32Value(A.limit);return void 0!==t&&(M.structuredQuery.limit=t),A.startAt&&(M.structuredQuery.startAt=this.toCursor(A.startAt)),A.endAt&&(M.structuredQuery.endAt=this.toCursor(A.endAt)),M},A.prototype.fromQueryTarget=function(A){var M=this.fromQueryPath(A.parent),D=A.structuredQuery,I=D.from?D.from.length:0,g=null;if(I>0){u(1===I,"StructuredQuery.from with more than one collection is not supported.");var t=D.from[0];t.allDescendants?g=t.collectionId:M=M.child(t.collectionId)}var e=[];D.where&&(e=this.fromFilter(D.where));var w=[];D.orderBy&&(w=this.fromOrder(D.orderBy));var N=null;D.limit&&(N=this.fromInt32Value(D.limit));var i=null;D.startAt&&(i=this.fromCursor(D.startAt));var T=null;return D.endAt&&(T=this.fromCursor(D.endAt)),new RA(M,g,w,e,N,i,T)},A.prototype.toListenRequestLabels=function(A){var M=this.toLabel(A.purpose);return null==M?null:{"goog-listen-tags":M}},A.prototype.toLabel=function(A){switch(A){case JA.Listen:return null;case JA.ExistenceFilterMismatch:return"existence-filter-mismatch";case JA.LimboResolution:return"limbo-document";default:return o("Unrecognized query purpose: "+A)}},A.prototype.toTarget=function(A){var M,D=A.query;return(M=D.isDocumentQuery()?{documents:this.toDocumentsTarget(D)}:{query:this.toQueryTarget(D)}).targetId=A.targetId,A.resumeToken.length>0&&(M.resumeToken=this.unsafeCastProtoByteString(A.resumeToken)),M},A.prototype.toFilter=function(A){var M=this;if(0!==A.length){var D=A.map(function(A){return A instanceof PA?M.toRelationFilter(A):M.toUnaryFilter(A)});return 1===D.length?D[0]:{compositeFilter:{op:"AND",filters:D}}}},A.prototype.fromFilter=function(A){var M=this;return A?void 0!==A.unaryFilter?[this.fromUnaryFilter(A)]:void 0!==A.fieldFilter?[this.fromRelationFilter(A)]:void 0!==A.compositeFilter?A.compositeFilter.filters.map(function(A){return M.fromFilter(A)}).reduce(function(A,M){return A.concat(M)}):o("Unknown filter: "+JSON.stringify(A)):[]},A.prototype.toOrder=function(A){var M=this;if(0!==A.length)return A.map(function(A){return M.toPropertyOrder(A)})},A.prototype.fromOrder=function(A){var M=this;return A.map(function(A){return M.fromPropertyOrder(A)})},A.prototype.toCursor=function(A){var M=this;return{before:A.before,values:A.position.map(function(A){return M.toValue(A)})}},A.prototype.fromCursor=function(A){var M=this,D=!!A.before,I=A.values.map(function(A){return M.fromValue(A)});return new KA(I,D)},A.prototype.toDirection=function(A){return ZM[A.name]},A.prototype.fromDirection=function(A){switch(A){case"ASCENDING":return ZA.ASCENDING;case"DESCENDING":return ZA.DESCENDING;default:return}},A.prototype.toOperatorName=function(A){return KM[A.name]},A.prototype.fromOperatorName=function(A){switch(A){case"EQUAL":return WA.EQUAL;case"GREATER_THAN":return WA.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return WA.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return WA.LESS_THAN;case"LESS_THAN_OR_EQUAL":return WA.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return WA.ARRAY_CONTAINS;case"OPERATOR_UNSPECIFIED":return o("Unspecified relation");default:return o("Unknown relation")}},A.prototype.toFieldPathReference=function(A){return{fieldPath:A.canonicalString()}},A.prototype.fromFieldPathReference=function(A){return TA.fromServerFormat(A.fieldPath)},A.prototype.toPropertyOrder=function(A){return{field:this.toFieldPathReference(A.field),direction:this.toDirection(A.dir)}},A.prototype.fromPropertyOrder=function(A){return new _A(this.fromFieldPathReference(A.field),this.fromDirection(A.direction))},A.prototype.toRelationFilter=function(A){return A instanceof PA?{fieldFilter:{field:this.toFieldPathReference(A.field),op:this.toOperatorName(A.op),value:this.toValue(A.value)}}:o("Unrecognized filter: "+JSON.stringify(A))},A.prototype.fromRelationFilter=function(A){return new PA(this.fromFieldPathReference(A.fieldFilter.field),this.fromOperatorName(A.fieldFilter.op),this.fromValue(A.fieldFilter.value))},A.prototype.toUnaryFilter=function(A){return A instanceof XA?{unaryFilter:{field:this.toFieldPathReference(A.field),op:"IS_NAN"}}:A instanceof VA?{unaryFilter:{field:this.toFieldPathReference(A.field),op:"IS_NULL"}}:o("Unrecognized filter: "+JSON.stringify(A))},A.prototype.fromUnaryFilter=function(A){switch(A.unaryFilter.op){case"IS_NAN":var M=this.fromFieldPathReference(A.unaryFilter.field);return new XA(M);case"IS_NULL":var D=this.fromFieldPathReference(A.unaryFilter.field);return new VA(D);case"OPERATOR_UNSPECIFIED":return o("Unspecified filter");default:return o("Unknown filter")}},A.prototype.toDocumentMask=function(A){var M=[];return A.fields.forEach(function(A){return M.push(A.canonicalString())}),{fieldPaths:M}},A.prototype.fromDocumentMask=function(A){var M=(A.fieldPaths||[]).map(function(A){return TA.fromServerFormat(A)});return tM.fromArray(M)},A}();function MD(A,M,D){return M===D||!M&&D in A} /** * @license * Copyright 2017 Google Inc. @@ -926,7 +926,7 @@ var aM=new oA(nA.comparator);function LM(){return aM}function sM(){return LM()}v * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var DD=function(){function A(A){this.sendFn=A.sendFn,this.closeFn=A.closeFn}return A.prototype.onOpen=function(A){u(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=A},A.prototype.onClose=function(A){u(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=A},A.prototype.onMessage=function(A){u(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=A},A.prototype.close=function(){this.closeFn()},A.prototype.send=function(A){this.sendFn(A)},A.prototype.callOnOpen=function(){u(void 0!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},A.prototype.callOnClose=function(A){u(void 0!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(A)},A.prototype.callOnMessage=function(A){u(void 0!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(A)},A}(),ID="Connection",gD={BatchGetDocuments:"batchGet",Commit:"commit"},tD="gl-js/ fire/"+i,eD=function(){function A(A){this.databaseId=A.databaseId;var M=A.ssl?"https":"http";this.baseUrl=M+"://"+A.host,this.forceLongPolling=A.forceLongPolling}return A.prototype.modifyHeadersForRequest=function(A,M){if(M)for(var D in M.authHeaders)M.authHeaders.hasOwnProperty(D)&&(A[D]=M.authHeaders[D]);A["X-Goog-Api-Client"]=tD},A.prototype.invokeRPC=function(A,M,D){var I=this,g=this.makeUrl(A);return new Promise(function(t,e){var N=new w.XhrIo;N.listenOnce(w.EventType.COMPLETE,function(){try{switch(N.getLastErrorCode()){case w.ErrorCode.NO_ERROR:var M=N.getResponseJson();E(ID,"XHR received:",JSON.stringify(M)),t(M);break;case w.ErrorCode.TIMEOUT:E(ID,'RPC "'+A+'" timed out'),e(new z(Q.DEADLINE_EXCEEDED,"Request time out"));break;case w.ErrorCode.HTTP_ERROR:var D=N.getStatus();E(ID,'RPC "'+A+'" failed with status:',D,"response text:",N.getResponseText()),D>0?e(new z(function(A){switch(A){case 200:return Q.OK;case 400:return Q.INVALID_ARGUMENT;case 401:return Q.UNAUTHENTICATED;case 403:return Q.PERMISSION_DENIED;case 404:return Q.NOT_FOUND;case 409:return Q.ABORTED;case 416:return Q.OUT_OF_RANGE;case 429:return Q.RESOURCE_EXHAUSTED;case 499:return Q.CANCELLED;case 500:return Q.UNKNOWN;case 501:return Q.UNIMPLEMENTED;case 503:return Q.UNAVAILABLE;case 504:return Q.DEADLINE_EXCEEDED;default:return A>=200&&A<300?Q.OK:A>=400&&A<500?Q.FAILED_PRECONDITION:A>=500&&A<600?Q.INTERNAL:Q.UNKNOWN}}(D),"Server responded with status "+N.getStatusText())):(E(ID,'RPC "'+A+'" failed'),e(new z(Q.UNAVAILABLE,"Connection failed.")));break;default:o('RPC "'+A+'" failed with unanticipated webchannel error '+N.getLastErrorCode()+": "+N.getLastError()+", giving up.")}}finally{E(ID,'RPC "'+A+'" completed.')}});var i=JSON.stringify(M);E(ID,"XHR sending: ",g+" "+i);var T={"Content-Type":"text/plain"};I.modifyHeadersForRequest(T,D),N.send(g,"POST",i,T,15)})},A.prototype.invokeStreamingRPC=function(A,M,D){return this.invokeRPC(A,M,D)},A.prototype.openStream=function(A,M){var D=[this.baseUrl,"/","google.firestore.v1.Firestore","/",A,"/channel"],I=w.createWebChannelTransport(),g={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.modifyHeadersForRequest(g.initMessageHeaders,M),N.isReactNative()||(g.httpHeadersOverwriteParam="$httpHeaders");var t=D.join("");E(ID,"Creating WebChannel: "+t+" "+g);var e=I.createWebChannel(t,g),i=!1,T=!1,n=new DD({sendFn:function(A){T?E(ID,"Not sending because WebChannel is closed:",A):(i||(E(ID,"Opening WebChannel transport."),e.open(),i=!0),E(ID,"WebChannel sending:",A),e.send(A))},closeFn:function(){return e.close()}}),c=function(A,M){e.listen(A,function(A){try{M(A)}catch(A){setTimeout(function(){throw A},0)}})};return c(w.WebChannel.EventType.OPEN,function(){T||E(ID,"WebChannel transport opened.")}),c(w.WebChannel.EventType.CLOSE,function(){T||(T=!0,E(ID,"WebChannel transport closed"),n.callOnClose())}),c(w.WebChannel.EventType.ERROR,function(A){T||(T=!0,E(ID,"WebChannel transport errored:",A),n.callOnClose(new z(Q.UNAVAILABLE,"The operation could not be completed")))}),c(w.WebChannel.EventType.MESSAGE,function(A){if(!T){var M=A.data[0];u(!!M,"Got a webchannel message without data.");var D=M.error||M[0]&&M[0].error;if(D){E(ID,"WebChannel received error:",D);var I=D.status,g=function(A){var M=CM[A];if(void 0!==M)return BM(M)}(I),t=D.message;void 0===g&&(g=Q.INTERNAL,t="Unknown error status: "+I+" with message "+D.message),T=!0,n.callOnClose(new z(g,t)),e.close()}else E(ID,"WebChannel received:",M),n.callOnMessage(M)}}),setTimeout(function(){n.callOnOpen()},0),n},A.prototype.makeUrl=function(A){var M=gD[A];u(void 0!==M,"Unknown REST mapping for: "+A);var D=[this.baseUrl,"/","v1"];return D.push("/projects/"),D.push(this.databaseId.projectId),D.push("/databases/"),D.push(this.databaseId.database),D.push("/documents"),D.push(":"),D.push(M),D.join("")},A}(),wD=function(){function A(){this.emptyByteString="",this.base64Available="undefined"!=typeof atob}return Object.defineProperty(A.prototype,"document",{get:function(){return"undefined"!=typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"window",{get:function(){return"undefined"!=typeof window?window:null},enumerable:!0,configurable:!0}),A.prototype.loadConnection=function(A){return Promise.resolve(new eD(A))},A.prototype.newSerializer=function(A){return new AD(A,{useProto3Json:!0})},A.prototype.formatJSON=function(A){return JSON.stringify(A)},A.prototype.atob=function(A){return atob(A)},A.prototype.btoa=function(A){return btoa(A)},A}(); + */var DD=function(){function A(A){this.sendFn=A.sendFn,this.closeFn=A.closeFn}return A.prototype.onOpen=function(A){u(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=A},A.prototype.onClose=function(A){u(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=A},A.prototype.onMessage=function(A){u(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=A},A.prototype.close=function(){this.closeFn()},A.prototype.send=function(A){this.sendFn(A)},A.prototype.callOnOpen=function(){u(void 0!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},A.prototype.callOnClose=function(A){u(void 0!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(A)},A.prototype.callOnMessage=function(A){u(void 0!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(A)},A}(),ID="Connection",gD={BatchGetDocuments:"batchGet",Commit:"commit"},tD="gl-js/ fire/"+i,eD=function(){function A(A){this.databaseId=A.databaseId;var M=A.ssl?"https":"http";this.baseUrl=M+"://"+A.host,this.forceLongPolling=A.forceLongPolling}return A.prototype.modifyHeadersForRequest=function(A,M){if(M)for(var D in M.authHeaders)M.authHeaders.hasOwnProperty(D)&&(A[D]=M.authHeaders[D]);A["X-Goog-Api-Client"]=tD},A.prototype.invokeRPC=function(A,M,D){var I=this,g=this.makeUrl(A);return new Promise(function(t,e){var N=new w.XhrIo;N.listenOnce(w.EventType.COMPLETE,function(){try{switch(N.getLastErrorCode()){case w.ErrorCode.NO_ERROR:var M=N.getResponseJson();E(ID,"XHR recieved:",JSON.stringify(M)),t(M);break;case w.ErrorCode.TIMEOUT:E(ID,'RPC "'+A+'" timed out'),e(new z(Q.DEADLINE_EXCEEDED,"Request time out"));break;case w.ErrorCode.HTTP_ERROR:var D=N.getStatus();E(ID,'RPC "'+A+'" failed with status:',D,"response text:",N.getResponseText()),D>0?e(new z(function(A){switch(A){case 200:return Q.OK;case 400:return Q.INVALID_ARGUMENT;case 401:return Q.UNAUTHENTICATED;case 403:return Q.PERMISSION_DENIED;case 404:return Q.NOT_FOUND;case 409:return Q.ABORTED;case 416:return Q.OUT_OF_RANGE;case 429:return Q.RESOURCE_EXHAUSTED;case 499:return Q.CANCELLED;case 500:return Q.UNKNOWN;case 501:return Q.UNIMPLEMENTED;case 503:return Q.UNAVAILABLE;case 504:return Q.DEADLINE_EXCEEDED;default:return A>=200&&A<300?Q.OK:A>=400&&A<500?Q.FAILED_PRECONDITION:A>=500&&A<600?Q.INTERNAL:Q.UNKNOWN}}(D),"Server responded with status "+N.getStatusText())):(E(ID,'RPC "'+A+'" failed'),e(new z(Q.UNAVAILABLE,"Connection failed.")));break;default:o('RPC "'+A+'" failed with unanticipated webchannel error '+N.getLastErrorCode()+": "+N.getLastError()+", giving up.")}}finally{E(ID,'RPC "'+A+'" completed.')}});var i=JSON.stringify(M);E(ID,"XHR sending: ",g+" "+i);var T={"Content-Type":"text/plain"};I.modifyHeadersForRequest(T,D),N.send(g,"POST",i,T,15)})},A.prototype.invokeStreamingRPC=function(A,M,D){return this.invokeRPC(A,M,D)},A.prototype.openStream=function(A,M){var D=[this.baseUrl,"/","google.firestore.v1.Firestore","/",A,"/channel"],I=w.createWebChannelTransport(),g={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling};this.modifyHeadersForRequest(g.initMessageHeaders,M),N.isReactNative()||(g.httpHeadersOverwriteParam="$httpHeaders");var t=D.join("");E(ID,"Creating WebChannel: "+t+" "+g);var e=I.createWebChannel(t,g),i=!1,T=!1,n=new DD({sendFn:function(A){T?E(ID,"Not sending because WebChannel is closed:",A):(i||(E(ID,"Opening WebChannel transport."),e.open(),i=!0),E(ID,"WebChannel sending:",A),e.send(A))},closeFn:function(){return e.close()}}),c=function(A,M){e.listen(A,function(A){try{M(A)}catch(A){setTimeout(function(){throw A},0)}})};return c(w.WebChannel.EventType.OPEN,function(){T||E(ID,"WebChannel transport opened.")}),c(w.WebChannel.EventType.CLOSE,function(){T||(T=!0,E(ID,"WebChannel transport closed"),n.callOnClose())}),c(w.WebChannel.EventType.ERROR,function(A){T||(T=!0,E(ID,"WebChannel transport errored:",A),n.callOnClose(new z(Q.UNAVAILABLE,"The operation could not be completed")))}),c(w.WebChannel.EventType.MESSAGE,function(A){if(!T){var M=A.data[0];u(!!M,"Got a webchannel message without data.");var D=M.error||M[0]&&M[0].error;if(D){E(ID,"WebChannel recieved error:",D);var I=D.status,g=function(A){var M=CM[A];if(void 0!==M)return BM(M)}(I),t=D.message;void 0===g&&(g=Q.INTERNAL,t="Unknown error status: "+I+" with message "+D.message),T=!0,n.callOnClose(new z(g,t)),e.close()}else E(ID,"WebChannel recieved:",M),n.callOnMessage(M)}}),setTimeout(function(){n.callOnOpen()},0),n},A.prototype.makeUrl=function(A){var M=gD[A];u(void 0!==M,"Unknown REST mapping for: "+A);var D=[this.baseUrl,"/","v1"];return D.push("/projects/"),D.push(this.databaseId.projectId),D.push("/databases/"),D.push(this.databaseId.database),D.push("/documents"),D.push(":"),D.push(M),D.join("")},A}(),wD=function(){function A(){this.emptyByteString="",this.base64Available="undefined"!=typeof atob}return Object.defineProperty(A.prototype,"document",{get:function(){return"undefined"!=typeof document?document:null},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"window",{get:function(){return"undefined"!=typeof window?window:null},enumerable:!0,configurable:!0}),A.prototype.loadConnection=function(A){return Promise.resolve(new eD(A))},A.prototype.newSerializer=function(A){return new AD(A,{useProto3Json:!0})},A.prototype.formatJSON=function(A){return JSON.stringify(A)},A.prototype.atob=function(A){return atob(A)},A.prototype.btoa=function(A){return btoa(A)},A}(); /** * @license * Copyright 2017 Google Inc. @@ -1008,7 +1008,7 @@ var ND,iD=function(){function A(A,M){var D=this;this.previousValue=A,M&&(M.seque * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */var zD=function(){function A(A,M,D,I){this.batchId=A,this.localWriteTime=M,this.baseMutations=D,this.mutations=I,u(I.length>0,"Cannot create an empty mutation batch")}return A.prototype.applyToRemoteDocument=function(A,M,D){M&&u(M.key.isEqual(A),"applyToRemoteDocument: key "+A+" should match maybeDoc key\n "+M.key);var I=D.mutationResults;u(I.length===this.mutations.length,"Mismatch between mutations length\n ("+this.mutations.length+") and mutation results length\n ("+I.length+").");for(var g=0;g=g,"Should have found mutation after "+g),e=D.serializer.fromDbMutationBatch(M)),I.done()}).next(function(){return e})})},A.prototype.getAllMutationBatches=function(A){var M=this,D=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return YD(A).loadAll(wI.userMutationsIndex,D).next(function(A){return A.map(function(A){return M.serializer.fromDbMutationBatch(A)})})},A.prototype.getAllMutationBatchesAffectingDocumentKey=function(A,M){var D=this,I=NI.prefixForPath(this.userId,M.path),g=IDBKeyRange.lowerBound(I),t=[];return SD(A).iterate({range:g},function(I,g,e){var w=I[0],N=I[1],i=I[2],T=QD(N);if(w===D.userId&&M.path.isEqual(T))return YD(A).get(i).next(function(A){if(!A)throw o("Dangling document-mutation reference found: "+I+" which points to "+i);u(A.userId===D.userId,"Unexpected user '"+A.userId+"' for mutation batch "+i),t.push(D.serializer.fromDbMutationBatch(A))});e.done()}).next(function(){return t})},A.prototype.getAllMutationBatchesAffectingDocumentKeys=function(A,M){var D=this,I=new IM(V),g=[];return M.forEach(function(M){var t=NI.prefixForPath(D.userId,M.path),e=IDBKeyRange.lowerBound(t),w=SD(A).iterate({range:e},function(A,g,t){var e=A[0],w=A[1],N=A[2],i=QD(w);e===D.userId&&M.path.isEqual(i)?I=I.add(N):t.done()});g.push(w)}),aD.waitFor(g).next(function(){return D.lookupMutationBatches(A,I)})},A.prototype.getAllMutationBatchesAffectingQuery=function(A,M){var D=this;u(!M.isDocumentQuery(),"Document queries shouldn't go down this path"),u(!M.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var I=M.path,g=I.length+1,t=NI.prefixForPath(this.userId,I),e=IDBKeyRange.lowerBound(t),w=new IM(V);return SD(A).iterate({range:e},function(A,M,t){var e=A[0],N=A[1],i=A[2],T=QD(N);e===D.userId&&I.isPrefixOf(T)?T.length===g&&(w=w.add(i)):t.done()}).next(function(){return D.lookupMutationBatches(A,w)})},A.prototype.lookupMutationBatches=function(A,M){var D=this,I=[],g=[];return M.forEach(function(M){g.push(YD(A).get(M).next(function(A){if(null===A)throw o("Dangling document-mutation reference found, which points to "+M);u(A.userId===D.userId,"Unexpected user '"+A.userId+"' for mutation batch "+M),I.push(D.serializer.fromDbMutationBatch(A))}))}),aD.waitFor(g).next(function(){return I})},A.prototype.removeMutationBatch=function(A,M){var D=this;return xD(A.simpleDbTransaction,this.userId,M).next(function(I){return D.removeCachedMutationKeys(M.batchId),aD.forEach(I,function(M){return D.referenceDelegate.removeMutationReference(A,M)})})},A.prototype.removeCachedMutationKeys=function(A){delete this.documentKeysByBatchId[A]},A.prototype.performConsistencyCheck=function(A){var M=this;return this.checkEmpty(A).next(function(D){if(!D)return aD.resolve();var I=IDBKeyRange.lowerBound(NI.prefixForUser(M.userId)),g=[];return SD(A).iterate({range:I},function(A,D,I){if(A[0]===M.userId){var t=QD(A[1]);g.push(t)}else I.done()}).next(function(){u(0===g.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+g.map(function(A){return A.canonicalString()}))})})},A.prototype.containsKey=function(A,M){return sD(A,this.userId,M)},A.prototype.getMutationQueueMetadata=function(A){var M=this;return kD(A).get(this.userId).next(function(A){return A||new eI(M.userId,-1,"")})},A}();function sD(A,M,D){var I=NI.prefixForPath(M,D.path),g=I[1],t=IDBKeyRange.lowerBound(I),e=!1;return SD(A).iterate({range:t,keysOnly:!0},function(A,D,I){var t=A[0],w=A[1];A[2];t===M&&w===g&&(e=!0),I.done()}).next(function(){return e})}function xD(A,M,D){var I=A.store(wI.store),g=A.store(NI.store),t=[],e=IDBKeyRange.only(D.batchId),w=0,N=I.iterate({range:e},function(A,M,D){return w++,D.delete()});t.push(N.next(function(){u(1===w,"Dangling document-mutation reference found: Missing batch "+D.batchId)}));for(var i=[],T=0,n=D.mutations;T0,"Cannot create an empty mutation batch")}return A.prototype.applyToRemoteDocument=function(A,M,D){M&&u(M.key.isEqual(A),"applyToRemoteDocument: key "+A+" should match maybeDoc key\n "+M.key);var I=D.mutationResults;u(I.length===this.mutations.length,"Mismatch between mutations length\n ("+this.mutations.length+") and mutation results length\n ("+I.length+").");for(var g=0;g=g,"Should have found mutation after "+g),e=D.serializer.fromDbMutationBatch(M)),I.done()}).next(function(){return e})})},A.prototype.getAllMutationBatches=function(A){var M=this,D=IDBKeyRange.bound([this.userId,-1],[this.userId,Number.POSITIVE_INFINITY]);return YD(A).loadAll(wI.userMutationsIndex,D).next(function(A){return A.map(function(A){return M.serializer.fromDbMutationBatch(A)})})},A.prototype.getAllMutationBatchesAffectingDocumentKey=function(A,M){var D=this,I=NI.prefixForPath(this.userId,M.path),g=IDBKeyRange.lowerBound(I),t=[];return SD(A).iterate({range:g},function(I,g,e){var w=I[0],N=I[1],i=I[2],T=QD(N);if(w===D.userId&&M.path.isEqual(T))return YD(A).get(i).next(function(A){if(!A)throw o("Dangling document-mutation reference found: "+I+" which points to "+i);u(A.userId===D.userId,"Unexpected user '"+A.userId+"' for mutation batch "+i),t.push(D.serializer.fromDbMutationBatch(A))});e.done()}).next(function(){return t})},A.prototype.getAllMutationBatchesAffectingDocumentKeys=function(A,M){var D=this,I=new IM(V),g=[];return M.forEach(function(M){var t=NI.prefixForPath(D.userId,M.path),e=IDBKeyRange.lowerBound(t),w=SD(A).iterate({range:e},function(A,g,t){var e=A[0],w=A[1],N=A[2],i=QD(w);e===D.userId&&M.path.isEqual(i)?I=I.add(N):t.done()});g.push(w)}),aD.waitFor(g).next(function(){return D.lookupMutationBatches(A,I)})},A.prototype.getAllMutationBatchesAffectingQuery=function(A,M){var D=this;u(!M.isDocumentQuery(),"Document queries shouldn't go down this path"),u(!M.isCollectionGroupQuery(),"CollectionGroup queries should be handled in LocalDocumentsView");var I=M.path,g=I.length+1,t=NI.prefixForPath(this.userId,I),e=IDBKeyRange.lowerBound(t),w=new IM(V);return SD(A).iterate({range:e},function(A,M,t){var e=A[0],N=A[1],i=A[2],T=QD(N);e===D.userId&&I.isPrefixOf(T)?T.length===g&&(w=w.add(i)):t.done()}).next(function(){return D.lookupMutationBatches(A,w)})},A.prototype.lookupMutationBatches=function(A,M){var D=this,I=[],g=[];return M.forEach(function(M){g.push(YD(A).get(M).next(function(A){if(null===A)throw o("Dangling document-mutation reference found, which points to "+M);u(A.userId===D.userId,"Unexpected user '"+A.userId+"' for mutation batch "+M),I.push(D.serializer.fromDbMutationBatch(A))}))}),aD.waitFor(g).next(function(){return I})},A.prototype.removeMutationBatch=function(A,M){var D=this;return xD(A.simpleDbTransaction,this.userId,M).next(function(I){return D.removeCachedMutationKeys(M.batchId),aD.forEach(I,function(M){return D.referenceDelegate.removeMutationReference(A,M)})})},A.prototype.removeCachedMutationKeys=function(A){delete this.documentKeysByBatchId[A]},A.prototype.performConsistencyCheck=function(A){var M=this;return this.checkEmpty(A).next(function(D){if(!D)return aD.resolve();var I=IDBKeyRange.lowerBound(NI.prefixForUser(M.userId)),g=[];return SD(A).iterate({range:I},function(A,D,I){if(A[0]===M.userId){var t=QD(A[1]);g.push(t)}else I.done()}).next(function(){u(0===g.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+g.map(function(A){return A.canonicalString()}))})})},A.prototype.containsKey=function(A,M){return sD(A,this.userId,M)},A.prototype.getMutationQueueMetadata=function(A){var M=this;return kD(A).get(this.userId).next(function(A){return A||new eI(M.userId,-1,"")})},A}();function sD(A,M,D){var I=NI.prefixForPath(M,D.path),g=I[1],t=IDBKeyRange.lowerBound(I),e=!1;return SD(A).iterate({range:t,keysOnly:!0},function(A,D,I){var t=A[0],w=A[1];A[2];t===M&&w===g&&(e=!0),I.done()}).next(function(){return e})}function xD(A,M,D){var I=A.store(wI.store),g=A.store(NI.store),t=[],e=IDBKeyRange.only(D.batchId),w=0,N=I.iterate({range:e},function(A,M,D){return w++,D.delete()});t.push(N.next(function(){u(1===w,"Dangling document-mutation reference found: Missing batch "+D.batchId)}));for(var i=[],T=0,n=D.mutations;T=0,"Got negative number of retries for transaction.");var I=this.remoteStore.createTransaction();return function(){try{var M=A(I);return!HA(M)&&M.catch&&M.then?M.catch(function(A){return Promise.reject(D.wrapUpdateFunctionError(A))}):Promise.reject(Error("Transaction callback must return a Promise"))}catch(A){return Promise.reject(D.wrapUpdateFunctionError(A))}}().then(function(g){return I.commit().then(function(){return g}).catch(function(I){return 0===M?Promise.reject(I):D.runTransaction(A,M-1)})})},A.prototype.applyRemoteEvent=function(A){var M=this;return this.assertSubscribed("applyRemoteEvent()"),this.localStore.applyRemoteEvent(A).then(function(D){return x(A.targetChanges,function(A,D){var I=M.limboResolutionsByTarget[A];I&&(u(D.addedDocuments.size+D.modifiedDocuments.size+D.removedDocuments.size<=1,"Limbo resolution for single document contains multiple changes."),D.addedDocuments.size>0?I.receivedDocument=!0:D.modifiedDocuments.size>0?u(I.receivedDocument,"Received change for limbo target document without add."):D.removedDocuments.size>0&&(u(I.receivedDocument,"Received remove for limbo target document without add."),I.receivedDocument=!1))}),M.emitNewSnapsAndNotifyLocalStore(D,A)}).catch(fI)},A.prototype.applyOnlineStateChange=function(A,M){if(this.isPrimary&&M===Dg.RemoteStore||!this.isPrimary&&M===Dg.SharedClientState){var D=[];this.queryViewsByQuery.forEach(function(M,I){var g=I.view.applyOnlineStateChange(A);u(0===g.limboChanges.length,"OnlineState should not affect limbo documents."),g.snapshot&&D.push(g.snapshot)}),this.syncEngineListener.onOnlineStateChange(A),this.syncEngineListener.onWatchChange(D),this.onlineState=A,this.isPrimary&&this.sharedClientState.setOnlineState(A)}},A.prototype.rejectListen=function(A,M){return e.__awaiter(this,void 0,void 0,function(){var D,I,g,t,w,N,i=this;return e.__generator(this,function(e){switch(e.label){case 0:return this.assertSubscribed("rejectListens()"),this.sharedClientState.updateQueryState(A,"rejected",M),D=this.limboResolutionsByTarget[A],(I=D&&D.key)?(this.limboTargetsByKey=this.limboTargetsByKey.remove(I),delete this.limboResolutionsByTarget[A],g=(g=new oA(nA.comparator)).insert(I,new jA(I,AM.forDeletedDoc())),t=UM().add(I),w=new HM(AM.MIN,{},new IM(V),g,t),[2,this.applyRemoteEvent(w)]):[3,1];case 1:return u(!!(N=this.queryViewsByTarget[A]),"Unknown targetId: "+A),[4,this.localStore.releaseQuery(N.query,!1).then(function(){return i.removeAndCleanupQuery(N)}).catch(fI)];case 2:e.sent(),this.syncEngineListener.onWatchError(N.query,M),e.label=3;case 3:return[2]}})})},A.prototype.applyBatchState=function(A,M,D){return e.__awaiter(this,void 0,void 0,function(){var I;return e.__generator(this,function(g){switch(g.label){case 0:return this.assertSubscribed("applyBatchState()"),[4,this.localStore.lookupMutationDocuments(A)];case 1:return null===(I=g.sent())?(E("SyncEngine","Cannot apply mutation batch with id: "+A),[2]):"pending"!==M?[3,3]:[4,this.remoteStore.fillWritePipeline()];case 2:return g.sent(),[3,4];case 3:"acknowledged"===M||"rejected"===M?(this.processUserCallback(A,D||null),this.localStore.removeCachedMutationBatchMetadata(A)):o("Unknown batchState: "+M),g.label=4;case 4:return[4,this.emitNewSnapsAndNotifyLocalStore(I)];case 5:return g.sent(),[2]}})})},A.prototype.applySuccessfulWrite=function(A){var M=this;this.assertSubscribed("applySuccessfulWrite()");var D=A.batch.batchId;return this.processUserCallback(D,null),this.localStore.acknowledgeBatch(A).then(function(A){return M.sharedClientState.updateMutationState(D,"acknowledged"),M.emitNewSnapsAndNotifyLocalStore(A)}).catch(fI)},A.prototype.rejectFailedWrite=function(A,M){var D=this;return this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(A,M),this.localStore.rejectBatch(A).then(function(I){return D.sharedClientState.updateMutationState(A,"rejected",M),D.emitNewSnapsAndNotifyLocalStore(I)}).catch(fI)},A.prototype.addMutationCallback=function(A,M){var D=this.mutationUserCallbacks[this.currentUser.toKey()];D||(D=new oA(V)),D=D.insert(A,M),this.mutationUserCallbacks[this.currentUser.toKey()]=D},A.prototype.processUserCallback=function(A,M){var D=this.mutationUserCallbacks[this.currentUser.toKey()];if(D){var I=D.get(A);I&&(u(A===D.minKey(),"Mutation callbacks processed out-of-order?"),M?I.reject(M):I.resolve(),D=D.remove(A)),this.mutationUserCallbacks[this.currentUser.toKey()]=D}},A.prototype.removeAndCleanupQuery=function(A){var M=this;if(this.sharedClientState.removeLocalQueryTarget(A.targetId),this.queryViewsByQuery.delete(A.query),delete this.queryViewsByTarget[A.targetId],this.isPrimary){var D=this.limboDocumentRefs.referencesForId(A.targetId);this.limboDocumentRefs.removeReferencesForId(A.targetId),D.forEach(function(A){M.limboDocumentRefs.containsKey(A)||M.removeLimboTarget(A)})}},A.prototype.removeLimboTarget=function(A){var M=this.limboTargetsByKey.get(A);null!==M&&(this.remoteStore.unlisten(M),this.limboTargetsByKey=this.limboTargetsByKey.remove(A),delete this.limboResolutionsByTarget[M])},A.prototype.updateTrackedLimbos=function(A,M){for(var D=0,I=M;D=0,"Got negative number of retries for transaction.");var I=this.remoteStore.createTransaction();return function(){try{var M=A(I);return!HA(M)&&M.catch&&M.then?M.catch(function(A){return Promise.reject(D.wrapUpdateFunctionError(A))}):Promise.reject(Error("Transaction callback must return a Promise"))}catch(A){return Promise.reject(D.wrapUpdateFunctionError(A))}}().then(function(g){return I.commit().then(function(){return g}).catch(function(I){return 0===M?Promise.reject(I):D.runTransaction(A,M-1)})})},A.prototype.applyRemoteEvent=function(A){var M=this;return this.assertSubscribed("applyRemoteEvent()"),this.localStore.applyRemoteEvent(A).then(function(D){return x(A.targetChanges,function(A,D){var I=M.limboResolutionsByTarget[A];I&&(u(D.addedDocuments.size+D.modifiedDocuments.size+D.removedDocuments.size<=1,"Limbo resolution for single document contains multiple changes."),D.addedDocuments.size>0?I.recievedDocument=!0:D.modifiedDocuments.size>0?u(I.recievedDocument,"Recieved change for limbo target document without add."):D.removedDocuments.size>0&&(u(I.recievedDocument,"Recieved remove for limbo target document without add."),I.recievedDocument=!1))}),M.emitNewSnapsAndNotifyLocalStore(D,A)}).catch(fI)},A.prototype.applyOnlineStateChange=function(A,M){if(this.isPrimary&&M===Dg.RemoteStore||!this.isPrimary&&M===Dg.SharedClientState){var D=[];this.queryViewsByQuery.forEach(function(M,I){var g=I.view.applyOnlineStateChange(A);u(0===g.limboChanges.length,"OnlineState should not affect limbo documents."),g.snapshot&&D.push(g.snapshot)}),this.syncEngineListener.onOnlineStateChange(A),this.syncEngineListener.onWatchChange(D),this.onlineState=A,this.isPrimary&&this.sharedClientState.setOnlineState(A)}},A.prototype.rejectListen=function(A,M){return e.__awaiter(this,void 0,void 0,function(){var D,I,g,t,w,N,i=this;return e.__generator(this,function(e){switch(e.label){case 0:return this.assertSubscribed("rejectListens()"),this.sharedClientState.updateQueryState(A,"rejected",M),D=this.limboResolutionsByTarget[A],(I=D&&D.key)?(this.limboTargetsByKey=this.limboTargetsByKey.remove(I),delete this.limboResolutionsByTarget[A],g=(g=new oA(nA.comparator)).insert(I,new jA(I,AM.forDeletedDoc())),t=UM().add(I),w=new HM(AM.MIN,{},new IM(V),g,t),[2,this.applyRemoteEvent(w)]):[3,1];case 1:return u(!!(N=this.queryViewsByTarget[A]),"Unknown targetId: "+A),[4,this.localStore.releaseQuery(N.query,!1).then(function(){return i.removeAndCleanupQuery(N)}).catch(fI)];case 2:e.sent(),this.syncEngineListener.onWatchError(N.query,M),e.label=3;case 3:return[2]}})})},A.prototype.applyBatchState=function(A,M,D){return e.__awaiter(this,void 0,void 0,function(){var I;return e.__generator(this,function(g){switch(g.label){case 0:return this.assertSubscribed("applyBatchState()"),[4,this.localStore.lookupMutationDocuments(A)];case 1:return null===(I=g.sent())?(E("SyncEngine","Cannot apply mutation batch with id: "+A),[2]):"pending"!==M?[3,3]:[4,this.remoteStore.fillWritePipeline()];case 2:return g.sent(),[3,4];case 3:"acknowledged"===M||"rejected"===M?(this.processUserCallback(A,D||null),this.localStore.removeCachedMutationBatchMetadata(A)):o("Unknown batchState: "+M),g.label=4;case 4:return[4,this.emitNewSnapsAndNotifyLocalStore(I)];case 5:return g.sent(),[2]}})})},A.prototype.applySuccessfulWrite=function(A){var M=this;this.assertSubscribed("applySuccessfulWrite()");var D=A.batch.batchId;return this.processUserCallback(D,null),this.localStore.acknowledgeBatch(A).then(function(A){return M.sharedClientState.updateMutationState(D,"acknowledged"),M.emitNewSnapsAndNotifyLocalStore(A)}).catch(fI)},A.prototype.rejectFailedWrite=function(A,M){var D=this;return this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(A,M),this.localStore.rejectBatch(A).then(function(I){return D.sharedClientState.updateMutationState(A,"rejected",M),D.emitNewSnapsAndNotifyLocalStore(I)}).catch(fI)},A.prototype.addMutationCallback=function(A,M){var D=this.mutationUserCallbacks[this.currentUser.toKey()];D||(D=new oA(V)),D=D.insert(A,M),this.mutationUserCallbacks[this.currentUser.toKey()]=D},A.prototype.processUserCallback=function(A,M){var D=this.mutationUserCallbacks[this.currentUser.toKey()];if(D){var I=D.get(A);I&&(u(A===D.minKey(),"Mutation callbacks processed out-of-order?"),M?I.reject(M):I.resolve(),D=D.remove(A)),this.mutationUserCallbacks[this.currentUser.toKey()]=D}},A.prototype.removeAndCleanupQuery=function(A){var M=this;if(this.sharedClientState.removeLocalQueryTarget(A.targetId),this.queryViewsByQuery.delete(A.query),delete this.queryViewsByTarget[A.targetId],this.isPrimary){var D=this.limboDocumentRefs.referencesForId(A.targetId);this.limboDocumentRefs.removeReferencesForId(A.targetId),D.forEach(function(A){M.limboDocumentRefs.containsKey(A)||M.removeLimboTarget(A)})}},A.prototype.removeLimboTarget=function(A){var M=this.limboTargetsByKey.get(A);null!==M&&(this.remoteStore.unlisten(M),this.limboTargetsByKey=this.limboTargetsByKey.remove(A),delete this.limboResolutionsByTarget[M])},A.prototype.updateTrackedLimbos=function(A,M){for(var D=0,I=M;D=0))throw"Expected a number 0 or greater."})}function TA(A,M){return new eA(function(M){if(!(null===M||f(M)&&M instanceof Object))throw"Expected an Object.";void 0!==A&&null!==A&&A(M)},M)}function nA(A){return new eA(function(A){if(null!==A&&!p(A))throw"Expected a Function."},A)} + */function tA(A,M,D){for(var I=M.length,g=M.length,t=0;t=0))throw"Expected a number 0 or greater."})}function TA(A,M){return new eA(function(M){if(!(null===M||f(M)&&M instanceof Object))throw"Expected an Object.";void 0!==A&&null!==A&&A(M)},M)}function nA(A){return new eA(function(A){if(null!==A&&!p(A))throw"Expected a Function."},A)} /** * @license * Copyright 2017 Google Inc. @@ -1718,7 +1718,7 @@ function YA(A){return function(){for(var M=[],D=0;D262144},A.prototype.start_=function(){this.state_===Y.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},A.prototype.resolveToken_=function(A){var M=this;this.authWrapper_.getAuthToken().then(function(D){switch(M.state_){case Y.RUNNING:A(D);break;case Y.CANCELING:M.transition_(Y.CANCELED);break;case Y.PAUSING:M.transition_(Y.PAUSED)}})},A.prototype.createResumable_=function(){var A=this;this.resolveToken_(function(M){var D=function(A,M,D,I,g){var t=M.bucketOnlyServerUrl(),e=BA(M,I,g),w={name:e.fullPath},N=Z(t),i={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":I.size(),"X-Goog-Upload-Header-Content-Type":e.contentType,"Content-Type":"application/json; charset=utf-8"},T=IA(e,D),n=A.maxUploadRetryTime(),c=new yA(N,"POST",function(A,M){var D;LA(A);try{D=A.getResponseHeader("X-Goog-Upload-URL")}catch(A){oA(!1)}return oA(b(D)),D},n);return c.urlParams=w,c.headers=i,c.body=T,c.errorHandler=CA(M),c}(A.authWrapper_,A.location_,A.mappings_,A.blob_,A.metadata_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.uploadUrl_=M,A.needToFetchStatus_=!1,A.completeTransitions_()},A.errorHandler_)})},A.prototype.fetchStatus_=function(){var A=this,M=this.uploadUrl_;this.resolveToken_(function(D){var I=function(A,M,D,I){var g=A.maxUploadRetryTime(),t=new yA(D,"POST",function(A,M){var D,g=LA(A,["active","final"]);try{D=A.getResponseHeader("X-Goog-Upload-Size-Received")}catch(A){oA(!1)}var t=parseInt(D,10);return oA(!isNaN(t)),new aA(t,I.size(),"final"===g)},g);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=CA(M),t}(A.authWrapper_,A.location_,M,A.blob_),g=A.authWrapper_.makeRequest(I,D);A.request_=g,g.getPromise().then(function(M){M=M,A.request_=null,A.updateProgress_(M.current),A.needToFetchStatus_=!1,M.finalized&&(A.needToFetchMetadata_=!0),A.completeTransitions_()},A.errorHandler_)})},A.prototype.continueUpload_=function(){var A=this,M=262144*this.chunkMultiplier_,D=new aA(this.transferred_,this.blob_.size()),I=this.uploadUrl_;this.resolveToken_(function(g){var t;try{t=sA(A.location_,A.authWrapper_,I,A.blob_,M,A.mappings_,D,A.makeProgressCallback_())}catch(M){return A.error_=M,void A.transition_(Y.ERROR)}var e=A.authWrapper_.makeRequest(t,g);A.request_=e,e.getPromise().then(function(M){A.increaseMultiplier_(),A.request_=null,A.updateProgress_(M.current),M.finalized?(A.metadata_=M.metadata,A.transition_(Y.SUCCESS)):A.completeTransitions_()},A.errorHandler_)})},A.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},A.prototype.fetchMetadata_=function(){var A=this;this.resolveToken_(function(M){var D=zA(A.authWrapper_,A.location_,A.mappings_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.metadata_=M,A.transition_(Y.SUCCESS)},A.metadataErrorHandler_)})},A.prototype.oneShotUpload_=function(){var A=this;this.resolveToken_(function(M){var D=function(A,M,D,I,g){var t=M.bucketOnlyServerUrl(),e={"X-Goog-Upload-Protocol":"multipart"},w=function(){for(var A="",M=0;M<2;M++)A+=Math.random().toString().slice(2);return A}();e["Content-Type"]="multipart/related; boundary="+w;var N=BA(M,I,g),i="--"+w+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+IA(N,D)+"\r\n--"+w+"\r\nContent-Type: "+N.contentType+"\r\n\r\n",T="\r\n--"+w+"--",n=EA.getBlob(i,I,T);if(null===n)throw j();var c={name:N.fullPath},E=Z(t),y=A.maxUploadRetryTime(),o=new yA(E,"POST",uA(A,D),y);return o.urlParams=c,o.headers=e,o.body=n.uploadData(),o.errorHandler=CA(M),o}(A.authWrapper_,A.location_,A.mappings_,A.blob_,A.metadata_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.metadata_=M,A.updateProgress_(A.blob_.size()),A.transition_(Y.SUCCESS)},A.errorHandler_)})},A.prototype.updateProgress_=function(A){var M=this.transferred_;this.transferred_=A,this.transferred_!==M&&this.notifyObservers_()},A.prototype.transition_=function(A){if(this.state_!==A)switch(A){case Y.CANCELING:case Y.PAUSING:this.state_=A,null!==this.request_&&this.request_.cancel();break;case Y.RUNNING:var M=this.state_===Y.PAUSED;this.state_=A,M&&(this.notifyObservers_(),this.start_());break;case Y.PAUSED:this.state_=A,this.notifyObservers_();break;case Y.CANCELED:this.error_=E(),this.state_=A,this.notifyObservers_();break;case Y.ERROR:case Y.SUCCESS:this.state_=A,this.notifyObservers_()}},A.prototype.completeTransitions_=function(){switch(this.state_){case Y.PAUSING:this.transition_(Y.PAUSED);break;case Y.CANCELING:this.transition_(Y.CANCELED);break;case Y.RUNNING:this.start_()}},Object.defineProperty(A.prototype,"snapshot",{get:function(){var A=k(this.state_);return new OA(this.transferred_,this.blob_.size(),A,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),A.prototype.on=function(A,M,D,I){void 0===M&&(M=void 0),void 0===D&&(D=void 0),void 0===I&&(I=void 0);var g="Expected a function or an Object with one of `next`, `error`, `complete` properties.",t=nA(!0).validator,e=TA(null,!0).validator;function w(A){try{return void t(A)}catch(A){}try{if(e(A),!(m(A.next)||m(A.error)||m(A.complete)))throw"";return}catch(A){throw g}}tA("on",[wA(function(M){if(A!==O.STATE_CHANGED)throw"Expected one of the event types: ["+O.STATE_CHANGED+"]."}),TA(w,!0),nA(!0),nA(!0)],arguments);var N=this;function i(A){return function(M,D,g){null!==A&&tA("on",A,arguments);var t=new xA(M,D,I);return N.addObserver_(t),function(){N.removeObserver_(t)}}}var T=[TA(function(A){if(null===A)throw g;w(A)}),nA(!0),nA(!0)];return!(m(M)||m(D)||m(I))?i(T):i(null)(M,D,I)},A.prototype.then=function(A,M){return this.promise_.then(A,M)},A.prototype.catch=function(A){return this.then(null,A)},A.prototype.addObserver_=function(A){this.observers_.push(A),this.notifyObserver_(A)},A.prototype.removeObserver_=function(A){!function(A,M){var D=A.indexOf(M);-1!==D&&A.splice(D,1)}(this.observers_,A)},A.prototype.notifyObservers_=function(){var A=this;this.finishPromise_(),function(A){return Array.prototype.slice.call(A)}(this.observers_).forEach(function(M){A.notifyObserver_(M)})},A.prototype.finishPromise_=function(){if(null!==this.resolve_){var A=!0;switch(k(this.state_)){case S.SUCCESS:YA(this.resolve_.bind(null,this.snapshot))();break;case S.CANCELED:case S.ERROR:YA(this.reject_.bind(null,this.error_))();break;default:A=!1}A&&(this.resolve_=null,this.reject_=null)}},A.prototype.notifyObserver_=function(A){switch(k(this.state_)){case S.RUNNING:case S.PAUSED:null!==A.next&&YA(A.next.bind(A,this.snapshot))();break;case S.SUCCESS:null!==A.complete&&YA(A.complete.bind(A))();break;case S.CANCELED:case S.ERROR:null!==A.error&&YA(A.error.bind(A,this.error_))();break;default:null!==A.error&&YA(A.error.bind(A,this.error_))()}},A.prototype.resume=function(){tA("resume",[],arguments);var A=this.state_===Y.PAUSED||this.state_===Y.PAUSING;return A&&this.transition_(Y.RUNNING),A},A.prototype.pause=function(){tA("pause",[],arguments);var A=this.state_===Y.RUNNING;return A&&this.transition_(Y.PAUSING),A},A.prototype.cancel=function(){tA("cancel",[],arguments);var A=this.state_===Y.RUNNING||this.state_===Y.PAUSING;return A&&this.transition_(Y.CANCELING),A},A}(),kA=function(){function A(A,M){this.authWrapper=A,this.location=M instanceof V?M:V.makeFromUrl(M)}return A.prototype.toString=function(){return tA("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},A.prototype.newRef=function(M,D){return new A(M,D)},A.prototype.mappings=function(){return AA()},A.prototype.child=function(A){tA("child",[wA()],arguments);var M=function(A,M){var D=M.split("/").filter(function(A){return A.length>0}).join("/");return 0===A.length?D:A+"/"+D}(this.location.path,A),D=new V(this.location.bucket,M);return this.newRef(this.authWrapper,D)},Object.defineProperty(A.prototype,"parent",{get:function(){var A=function(A){if(0==A.length)return null;var M=A.lastIndexOf("/");return-1===M?"":A.slice(0,M)}(this.location.path);if(null===A)return null;var M=new V(this.location.bucket,A);return this.newRef(this.authWrapper,M)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"root",{get:function(){var A=new V(this.location.bucket,"");return this.newRef(this.authWrapper,A)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"name",{get:function(){return X(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),A.prototype.put=function(A,M){return void 0===M&&(M=null),tA("put",[new eA(function(A){if(!(A instanceof Uint8Array||A instanceof ArrayBuffer||R()&&A instanceof Blob))throw"Expected Blob or File."}),NA(!0)],arguments),this.throwIfRoot_("put"),new SA(this,this.authWrapper,this.location,this.mappings(),new EA(A),M)},A.prototype.putString=function(A,M,D){void 0===M&&(M=C.RAW),tA("putString",[wA(),wA(Q,!0),NA(!0)],arguments),this.throwIfRoot_("putString");var I=B(M,A),g=h(D);return!f(g.contentType)&&f(I.contentType)&&(g.contentType=I.contentType),new SA(this,this.authWrapper,this.location,this.mappings(),new EA(I.data,!0),g)},A.prototype.delete=function(){tA("delete",[],arguments),this.throwIfRoot_("delete");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=function(A,M){var D=Z(M.fullServerUrl()),I=A.maxOperationRetryTime(),g=new yA(D,"DELETE",function(A,M){},I);return g.successCodes=[200,204],g.errorHandler=QA(M),g}(A.authWrapper,A.location);return A.authWrapper.makeRequest(D,M).getPromise()})},A.prototype.getMetadata=function(){tA("getMetadata",[],arguments),this.throwIfRoot_("getMetadata");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=zA(A.authWrapper,A.location,A.mappings());return A.authWrapper.makeRequest(D,M).getPromise()})},A.prototype.updateMetadata=function(A){tA("updateMetadata",[NA()],arguments),this.throwIfRoot_("updateMetadata");var M=this;return this.authWrapper.getAuthToken().then(function(D){var I=function(A,M,D,I){var g=Z(M.fullServerUrl()),t=IA(D,I),e=A.maxOperationRetryTime(),w=new yA(g,"PATCH",uA(A,I),e);return w.headers={"Content-Type":"application/json; charset=utf-8"},w.body=t,w.errorHandler=QA(M),w}(M.authWrapper,M.location,A,M.mappings());return M.authWrapper.makeRequest(I,D).getPromise()})},A.prototype.getDownloadURL=function(){tA("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=function(A,M,D){var I=Z(M.fullServerUrl()),g=A.maxOperationRetryTime(),t=new yA(I,"GET",rA(A,D),g);return t.errorHandler=QA(M),t}(A.authWrapper,A.location,A.mappings());return A.authWrapper.makeRequest(D,M).getPromise().then(function(A){if(null===A)throw new i(T.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return A})})},A.prototype.throwIfRoot_=function(A){if(""===this.location.path)throw function(A){return new i(T.INVALID_ROOT_OPERATION,"The operation '"+A+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(A)},A}(),UA=function(){function A(A){this.promise_=function(A){return Promise.reject(A)}(A)}return A.prototype.getPromise=function(){return this.promise_},A.prototype.cancel=function(A){void 0===A&&(A=!1)},A}(),lA=function(){function A(){this.map_={},this.id_=N}return A.prototype.addRequest=function(A){var M=this.id_;this.id_++,this.map_[M]=A;var D=this;function I(){delete D.map_[M]}A.getPromise().then(I,I)},A.prototype.clear=function(){l(this.map_,function(A,M){M&&M.cancel(!0)}),this.map_={}},A}(),hA=function(){function A(M,D,I,g,t){if(this.bucket_=null,this.deleted_=!1,this.app_=M,null!==this.app_){var N=this.app_.options;f(N)&&(this.bucket_=A.extractBucket_(N))}this.storageRefMaker_=D,this.requestMaker_=I,this.pool_=t,this.service_=g,this.maxOperationRetryTime_=e,this.maxUploadRetryTime_=w,this.requestMap_=new lA}return A.extractBucket_=function(A){var M=A.storageBucket||null;return null==M?null:V.makeFromBucketSpec(M).bucket},A.prototype.getAuthToken=function(){return null!==this.app_&&f(this.app_.INTERNAL)&&f(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then(function(A){return null!==A?A.accessToken:null},function(A){return null}):F(null)},A.prototype.bucket=function(){if(this.deleted_)throw o();return this.bucket_},A.prototype.service=function(){return this.service_},A.prototype.makeStorageReference=function(A){return this.storageRefMaker_(this,A)},A.prototype.makeRequest=function(A,M){if(this.deleted_)return new UA(o());var D=this.requestMaker_(A,M,this.pool_);return this.requestMap_.addRequest(D),D},A.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},A.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},A.prototype.setMaxUploadRetryTime=function(A){this.maxUploadRetryTime_=A},A.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},A.prototype.setMaxOperationRetryTime=function(A){this.maxOperationRetryTime_=A},A}(); + */var SA=function(){function A(A,M,D,I,g,t){var e=this;void 0===t&&(t=null),this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=A,this.authWrapper_=M,this.location_=D,this.blob_=g,this.metadata_=t,this.mappings_=I,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=Y.RUNNING,this.errorHandler_=function(A){e.request_=null,e.chunkMultiplier_=1,A.codeEquals(T.CANCELED)?(e.needToFetchStatus_=!0,e.completeTransitions_()):(e.error_=A,e.transition_(Y.ERROR))},this.metadataErrorHandler_=function(A){e.request_=null,A.codeEquals(T.CANCELED)?e.completeTransitions_():(e.error_=A,e.transition_(Y.ERROR))},this.promise_=d(function(A,M){e.resolve_=A,e.reject_=M,e.start_()}),this.promise_.then(null,function(){})}return A.prototype.makeProgressCallback_=function(){var A=this,M=this.transferred_;return function(D,I){A.updateProgress_(M+D)}},A.prototype.shouldDoResumable_=function(A){return A.size()>262144},A.prototype.start_=function(){this.state_===Y.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},A.prototype.resolveToken_=function(A){var M=this;this.authWrapper_.getAuthToken().then(function(D){switch(M.state_){case Y.RUNNING:A(D);break;case Y.CANCELING:M.transition_(Y.CANCELED);break;case Y.PAUSING:M.transition_(Y.PAUSED)}})},A.prototype.createResumable_=function(){var A=this;this.resolveToken_(function(M){var D=function(A,M,D,I,g){var t=M.bucketOnlyServerUrl(),e=BA(M,I,g),w={name:e.fullPath},N=Z(t),i={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":I.size(),"X-Goog-Upload-Header-Content-Type":e.contentType,"Content-Type":"application/json; charset=utf-8"},T=IA(e,D),n=A.maxUploadRetryTime(),c=new yA(N,"POST",function(A,M){var D;LA(A);try{D=A.getResponseHeader("X-Goog-Upload-URL")}catch(A){oA(!1)}return oA(b(D)),D},n);return c.urlParams=w,c.headers=i,c.body=T,c.errorHandler=CA(M),c}(A.authWrapper_,A.location_,A.mappings_,A.blob_,A.metadata_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.uploadUrl_=M,A.needToFetchStatus_=!1,A.completeTransitions_()},A.errorHandler_)})},A.prototype.fetchStatus_=function(){var A=this,M=this.uploadUrl_;this.resolveToken_(function(D){var I=function(A,M,D,I){var g=A.maxUploadRetryTime(),t=new yA(D,"POST",function(A,M){var D,g=LA(A,["active","final"]);try{D=A.getResponseHeader("X-Goog-Upload-Size-Recieved")}catch(A){oA(!1)}var t=parseInt(D,10);return oA(!isNaN(t)),new aA(t,I.size(),"final"===g)},g);return t.headers={"X-Goog-Upload-Command":"query"},t.errorHandler=CA(M),t}(A.authWrapper_,A.location_,M,A.blob_),g=A.authWrapper_.makeRequest(I,D);A.request_=g,g.getPromise().then(function(M){M=M,A.request_=null,A.updateProgress_(M.current),A.needToFetchStatus_=!1,M.finalized&&(A.needToFetchMetadata_=!0),A.completeTransitions_()},A.errorHandler_)})},A.prototype.continueUpload_=function(){var A=this,M=262144*this.chunkMultiplier_,D=new aA(this.transferred_,this.blob_.size()),I=this.uploadUrl_;this.resolveToken_(function(g){var t;try{t=sA(A.location_,A.authWrapper_,I,A.blob_,M,A.mappings_,D,A.makeProgressCallback_())}catch(M){return A.error_=M,void A.transition_(Y.ERROR)}var e=A.authWrapper_.makeRequest(t,g);A.request_=e,e.getPromise().then(function(M){A.increaseMultiplier_(),A.request_=null,A.updateProgress_(M.current),M.finalized?(A.metadata_=M.metadata,A.transition_(Y.SUCCESS)):A.completeTransitions_()},A.errorHandler_)})},A.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},A.prototype.fetchMetadata_=function(){var A=this;this.resolveToken_(function(M){var D=zA(A.authWrapper_,A.location_,A.mappings_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.metadata_=M,A.transition_(Y.SUCCESS)},A.metadataErrorHandler_)})},A.prototype.oneShotUpload_=function(){var A=this;this.resolveToken_(function(M){var D=function(A,M,D,I,g){var t=M.bucketOnlyServerUrl(),e={"X-Goog-Upload-Protocol":"multipart"},w=function(){for(var A="",M=0;M<2;M++)A+=Math.random().toString().slice(2);return A}();e["Content-Type"]="multipart/related; boundary="+w;var N=BA(M,I,g),i="--"+w+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+IA(N,D)+"\r\n--"+w+"\r\nContent-Type: "+N.contentType+"\r\n\r\n",T="\r\n--"+w+"--",n=EA.getBlob(i,I,T);if(null===n)throw j();var c={name:N.fullPath},E=Z(t),y=A.maxUploadRetryTime(),o=new yA(E,"POST",uA(A,D),y);return o.urlParams=c,o.headers=e,o.body=n.uploadData(),o.errorHandler=CA(M),o}(A.authWrapper_,A.location_,A.mappings_,A.blob_,A.metadata_),I=A.authWrapper_.makeRequest(D,M);A.request_=I,I.getPromise().then(function(M){A.request_=null,A.metadata_=M,A.updateProgress_(A.blob_.size()),A.transition_(Y.SUCCESS)},A.errorHandler_)})},A.prototype.updateProgress_=function(A){var M=this.transferred_;this.transferred_=A,this.transferred_!==M&&this.notifyObservers_()},A.prototype.transition_=function(A){if(this.state_!==A)switch(A){case Y.CANCELING:case Y.PAUSING:this.state_=A,null!==this.request_&&this.request_.cancel();break;case Y.RUNNING:var M=this.state_===Y.PAUSED;this.state_=A,M&&(this.notifyObservers_(),this.start_());break;case Y.PAUSED:this.state_=A,this.notifyObservers_();break;case Y.CANCELED:this.error_=E(),this.state_=A,this.notifyObservers_();break;case Y.ERROR:case Y.SUCCESS:this.state_=A,this.notifyObservers_()}},A.prototype.completeTransitions_=function(){switch(this.state_){case Y.PAUSING:this.transition_(Y.PAUSED);break;case Y.CANCELING:this.transition_(Y.CANCELED);break;case Y.RUNNING:this.start_()}},Object.defineProperty(A.prototype,"snapshot",{get:function(){var A=k(this.state_);return new OA(this.transferred_,this.blob_.size(),A,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),A.prototype.on=function(A,M,D,I){void 0===M&&(M=void 0),void 0===D&&(D=void 0),void 0===I&&(I=void 0);var g="Expected a function or an Object with one of `next`, `error`, `complete` properties.",t=nA(!0).validator,e=TA(null,!0).validator;function w(A){try{return void t(A)}catch(A){}try{if(e(A),!(m(A.next)||m(A.error)||m(A.complete)))throw"";return}catch(A){throw g}}tA("on",[wA(function(M){if(A!==O.STATE_CHANGED)throw"Expected one of the event types: ["+O.STATE_CHANGED+"]."}),TA(w,!0),nA(!0),nA(!0)],arguments);var N=this;function i(A){return function(M,D,g){null!==A&&tA("on",A,arguments);var t=new xA(M,D,I);return N.addObserver_(t),function(){N.removeObserver_(t)}}}var T=[TA(function(A){if(null===A)throw g;w(A)}),nA(!0),nA(!0)];return!(m(M)||m(D)||m(I))?i(T):i(null)(M,D,I)},A.prototype.then=function(A,M){return this.promise_.then(A,M)},A.prototype.catch=function(A){return this.then(null,A)},A.prototype.addObserver_=function(A){this.observers_.push(A),this.notifyObserver_(A)},A.prototype.removeObserver_=function(A){!function(A,M){var D=A.indexOf(M);-1!==D&&A.splice(D,1)}(this.observers_,A)},A.prototype.notifyObservers_=function(){var A=this;this.finishPromise_(),function(A){return Array.prototype.slice.call(A)}(this.observers_).forEach(function(M){A.notifyObserver_(M)})},A.prototype.finishPromise_=function(){if(null!==this.resolve_){var A=!0;switch(k(this.state_)){case S.SUCCESS:YA(this.resolve_.bind(null,this.snapshot))();break;case S.CANCELED:case S.ERROR:YA(this.reject_.bind(null,this.error_))();break;default:A=!1}A&&(this.resolve_=null,this.reject_=null)}},A.prototype.notifyObserver_=function(A){switch(k(this.state_)){case S.RUNNING:case S.PAUSED:null!==A.next&&YA(A.next.bind(A,this.snapshot))();break;case S.SUCCESS:null!==A.complete&&YA(A.complete.bind(A))();break;case S.CANCELED:case S.ERROR:null!==A.error&&YA(A.error.bind(A,this.error_))();break;default:null!==A.error&&YA(A.error.bind(A,this.error_))()}},A.prototype.resume=function(){tA("resume",[],arguments);var A=this.state_===Y.PAUSED||this.state_===Y.PAUSING;return A&&this.transition_(Y.RUNNING),A},A.prototype.pause=function(){tA("pause",[],arguments);var A=this.state_===Y.RUNNING;return A&&this.transition_(Y.PAUSING),A},A.prototype.cancel=function(){tA("cancel",[],arguments);var A=this.state_===Y.RUNNING||this.state_===Y.PAUSING;return A&&this.transition_(Y.CANCELING),A},A}(),kA=function(){function A(A,M){this.authWrapper=A,this.location=M instanceof V?M:V.makeFromUrl(M)}return A.prototype.toString=function(){return tA("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},A.prototype.newRef=function(M,D){return new A(M,D)},A.prototype.mappings=function(){return AA()},A.prototype.child=function(A){tA("child",[wA()],arguments);var M=function(A,M){var D=M.split("/").filter(function(A){return A.length>0}).join("/");return 0===A.length?D:A+"/"+D}(this.location.path,A),D=new V(this.location.bucket,M);return this.newRef(this.authWrapper,D)},Object.defineProperty(A.prototype,"parent",{get:function(){var A=function(A){if(0==A.length)return null;var M=A.lastIndexOf("/");return-1===M?"":A.slice(0,M)}(this.location.path);if(null===A)return null;var M=new V(this.location.bucket,A);return this.newRef(this.authWrapper,M)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"root",{get:function(){var A=new V(this.location.bucket,"");return this.newRef(this.authWrapper,A)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"name",{get:function(){return X(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),A.prototype.put=function(A,M){return void 0===M&&(M=null),tA("put",[new eA(function(A){if(!(A instanceof Uint8Array||A instanceof ArrayBuffer||R()&&A instanceof Blob))throw"Expected Blob or File."}),NA(!0)],arguments),this.throwIfRoot_("put"),new SA(this,this.authWrapper,this.location,this.mappings(),new EA(A),M)},A.prototype.putString=function(A,M,D){void 0===M&&(M=C.RAW),tA("putString",[wA(),wA(Q,!0),NA(!0)],arguments),this.throwIfRoot_("putString");var I=B(M,A),g=h(D);return!f(g.contentType)&&f(I.contentType)&&(g.contentType=I.contentType),new SA(this,this.authWrapper,this.location,this.mappings(),new EA(I.data,!0),g)},A.prototype.delete=function(){tA("delete",[],arguments),this.throwIfRoot_("delete");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=function(A,M){var D=Z(M.fullServerUrl()),I=A.maxOperationRetryTime(),g=new yA(D,"DELETE",function(A,M){},I);return g.successCodes=[200,204],g.errorHandler=QA(M),g}(A.authWrapper,A.location);return A.authWrapper.makeRequest(D,M).getPromise()})},A.prototype.getMetadata=function(){tA("getMetadata",[],arguments),this.throwIfRoot_("getMetadata");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=zA(A.authWrapper,A.location,A.mappings());return A.authWrapper.makeRequest(D,M).getPromise()})},A.prototype.updateMetadata=function(A){tA("updateMetadata",[NA()],arguments),this.throwIfRoot_("updateMetadata");var M=this;return this.authWrapper.getAuthToken().then(function(D){var I=function(A,M,D,I){var g=Z(M.fullServerUrl()),t=IA(D,I),e=A.maxOperationRetryTime(),w=new yA(g,"PATCH",uA(A,I),e);return w.headers={"Content-Type":"application/json; charset=utf-8"},w.body=t,w.errorHandler=QA(M),w}(M.authWrapper,M.location,A,M.mappings());return M.authWrapper.makeRequest(I,D).getPromise()})},A.prototype.getDownloadURL=function(){tA("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL");var A=this;return this.authWrapper.getAuthToken().then(function(M){var D=function(A,M,D){var I=Z(M.fullServerUrl()),g=A.maxOperationRetryTime(),t=new yA(I,"GET",rA(A,D),g);return t.errorHandler=QA(M),t}(A.authWrapper,A.location,A.mappings());return A.authWrapper.makeRequest(D,M).getPromise().then(function(A){if(null===A)throw new i(T.NO_DOWNLOAD_URL,"The given file does not have any download URLs.");return A})})},A.prototype.throwIfRoot_=function(A){if(""===this.location.path)throw function(A){return new i(T.INVALID_ROOT_OPERATION,"The operation '"+A+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}(A)},A}(),UA=function(){function A(A){this.promise_=function(A){return Promise.reject(A)}(A)}return A.prototype.getPromise=function(){return this.promise_},A.prototype.cancel=function(A){void 0===A&&(A=!1)},A}(),lA=function(){function A(){this.map_={},this.id_=N}return A.prototype.addRequest=function(A){var M=this.id_;this.id_++,this.map_[M]=A;var D=this;function I(){delete D.map_[M]}A.getPromise().then(I,I)},A.prototype.clear=function(){l(this.map_,function(A,M){M&&M.cancel(!0)}),this.map_={}},A}(),hA=function(){function A(M,D,I,g,t){if(this.bucket_=null,this.deleted_=!1,this.app_=M,null!==this.app_){var N=this.app_.options;f(N)&&(this.bucket_=A.extractBucket_(N))}this.storageRefMaker_=D,this.requestMaker_=I,this.pool_=t,this.service_=g,this.maxOperationRetryTime_=e,this.maxUploadRetryTime_=w,this.requestMap_=new lA}return A.extractBucket_=function(A){var M=A.storageBucket||null;return null==M?null:V.makeFromBucketSpec(M).bucket},A.prototype.getAuthToken=function(){return null!==this.app_&&f(this.app_.INTERNAL)&&f(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then(function(A){return null!==A?A.accessToken:null},function(A){return null}):F(null)},A.prototype.bucket=function(){if(this.deleted_)throw o();return this.bucket_},A.prototype.service=function(){return this.service_},A.prototype.makeStorageReference=function(A){return this.storageRefMaker_(this,A)},A.prototype.makeRequest=function(A,M){if(this.deleted_)return new UA(o());var D=this.requestMaker_(A,M,this.pool_);return this.requestMap_.addRequest(D),D},A.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},A.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},A.prototype.setMaxUploadRetryTime=function(A){this.maxUploadRetryTime_=A},A.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},A.prototype.setMaxOperationRetryTime=function(A){this.maxOperationRetryTime_=A},A}(); /** * @license * Copyright 2017 Google Inc. @@ -2253,7 +2253,7 @@ function p(A,M){return N(this,void 0,void 0,function(){var D,I,g,t,e,w;return i( * See the License for the specific language governing permissions and * limitations under the License. */ -function R(A){A.INTERNAL.registerService("installations",function(A){return z(A),{app:A,getId:function(){return function(A){return N(this,void 0,void 0,function(){var M,D,I;return i(this,function(g){switch(g.label){case 0:return[4,F(z(A))];case 1:return M=g.sent(),D=M.installationEntry,(I=M.registrationPromise)&&I.catch(function(){}),[2,D.fid]}})})}(A)},getToken:function(){return G(A)},delete:function(){return function(A){return N(this,void 0,void 0,function(){var M,D;return i(this,function(I){switch(I.label){case 0:return[4,h(M=z(A),function(A){if(!A||0!==A.registrationStatus)return A})];case 1:if(!(D=I.sent()))return[3,6];if(1!==D.registrationStatus)return[3,2];throw C.create("delete-pending-registration");case 2:if(2!==D.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw C.create("app-offline");case 3:return[4,J(M,D)];case 4:return I.sent(),[4,l(M)];case 5:I.sent(),I.label=6;case 6:return[2]}})})}(A)}}})}R(g.a)},function(A,M,D){var I=D(409);"string"==typeof I&&(I=[[A.i,I,""]]);var g={insert:"head",singleton:!1};D(28)(I,g);I.locals&&(A.exports=I.locals)},function(A,M,D){(A.exports=D(21)(!1)).push([A.i,'.App {\n text-align: center;\n}\n.clear {\n clear: both;\n content: "";\n}\n.App-logo {\n animation: App-logo-spin infinite 20s linear;\n height: 80px;\n}\n\n.App-header {\n background-color: #222;\n height: 150px;\n padding: 20px;\n color: white;\n}\n\n.App-title {\n font-size: 1.5em;\n}\n\n.App-intro {\n font-size: large;\n}\n@keyframes App-logo-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n',""])},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0});var I=function(){function A(A,M){for(var D=0;D0){var e=g.substring(0,t),w=g.substring(t+2);M[e]=w}}return M}Object.defineProperty(M,"__esModule",{value:!0}),M.responseToHeadersObject=I;var g=function(){function A(A,M,D){this.statusCode=A,this.headers=M,this.info=D}return A.fromXHR=function(M){var D=M.responseText;try{D=JSON.parse(M.responseText)}catch(A){}return new A(M.status,I(M.getAllResponseHeaders()),D)},A}();M.ErrorResponse=g;var t=function(A){this.error=A};M.NetworkError=t,function(A){A[A.UNSENT=0]="UNSENT",A[A.OPENED=1]="OPENED",A[A.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",A[A.LOADING=3]="LOADING",A[A.DONE=4]="DONE"}(M.XhrReadyState||(M.XhrReadyState={}))},function(A,M,D){var I;Object.defineProperty(M,"__esModule",{value:!0}),function(A){A[A.VERBOSE=1]="VERBOSE",A[A.DEBUG=2]="DEBUG",A[A.INFO=3]="INFO",A[A.WARNING=4]="WARNING",A[A.ERROR=5]="ERROR"}(I=M.LogLevel||(M.LogLevel={}));var g=function(){function A(A){void 0===A&&(A=2),this.threshold=A;var M=Array(),D="--------------------------------------------------------------------------------";window.console.group||(window.console.group=function(A){M.push(A),window.console.log("%c \nBEGIN GROUP: %c",D,A)}),window.console.groupEnd||(window.console.groupEnd=function(){window.console.log("END GROUP: %c\n%c",M.pop(),D)})}return A.prototype.verbose=function(){for(var A=[],M=0;M=this.threshold){var t="Logger."+I[M];D.length>1?(window.console.group(),D.forEach(function(M){g.errorAwareLog(A,M,t)}),window.console.groupEnd()):this.errorAwareLog(A,D[0],t)}},A.prototype.errorAwareLog=function(A,M,D){if(void 0!==M&&M.info&&M.info.error_uri){var I=M.info.error_description;A((I||"An error has occurred")+". More information can be found at "+M.info.error_uri+". Error object: ",M)}else A(D+": ",M)},A}();M.ConsoleLogger=g;var t=function(){function A(){}return A.prototype.verbose=function(){for(var A=[],M=0;MD?D:2*A},initialTimeoutMillis:M,limit:I,maxTimeoutMillis:D}};var g=function(A){this.waitTimeMillis=A};M.Retry=g;var t=function(A){this.error=A};M.DoNotRetry=t;var e=function(){function A(A,M,D){this.options=A,this.logger=M,this.retryUnsafeRequests=D,this.currentRetryCount=0,this.initialTimeoutMillis=A.initialTimeoutMillis,this.maxTimeoutMillis=A.maxTimeoutMillis,this.limit=A.limit,this.increaseTimeoutFunction=A.increaseTimeout,this.currentBackoffMillis=this.initialTimeoutMillis}return A.prototype.attemptRetry=function(A){return this.logger.verbose(this.constructor.name+": Error received",A),this.currentRetryCount>=this.limit&&this.limit>=0?(this.logger.verbose(this.constructor.name+": Retry count is over the maximum limit: "+this.limit),new t(A)):A instanceof I.ErrorResponse&&A.headers["Retry-After"]?(this.logger.verbose(this.constructor.name+": Retry-After header is present, retrying in "+A.headers["Retry-After"]),new g(1e3*parseInt(A.headers["Retry-After"],10))):A instanceof I.NetworkError||A instanceof I.ErrorResponse&&("GET"===(M=(M=A.headers["Request-Method"]).toUpperCase())||"HEAD"===M||"OPTIONS"===M||"SUBSCRIBE"===M)||this.retryUnsafeRequests?this.shouldSafeRetry(A):A instanceof I.NetworkError?this.shouldSafeRetry(A):(this.logger.verbose(this.constructor.name+": Error is not retryable",A),new t(A));var M},A.prototype.shouldSafeRetry=function(A){return A instanceof I.NetworkError?(this.logger.verbose(this.constructor.name+": It's a Network Error, will retry",A),new g(this.calulateMillisToRetry())):A instanceof I.ErrorResponse&&A.statusCode>=500&&A.statusCode<600?(this.logger.verbose(this.constructor.name+": Error 5xx, will retry"),new g(this.calulateMillisToRetry())):(this.logger.verbose(this.constructor.name+": Error is not retryable",A),new t(A))},A.prototype.calulateMillisToRetry=function(){return this.currentBackoffMillis=this.increaseTimeoutFunction(this.currentBackoffMillis),this.logger.verbose(this.constructor.name+": Retrying in "+this.currentBackoffMillis+"ms"),this.currentBackoffMillis},A}();M.RetryResolution=e},function(A,M,D){var I=this&&this.__assign||Object.assign||function(A){for(var M,D=1,I=arguments.length;D=200&&A.status<300?M(A.response):0!==A.status?D(I.ErrorResponse.fromXHR(A)):D(new I.NetworkError("No Connection")))},A}M.executeNetworkRequest=function(A,M){return new Promise(function(D,I){!function(A,M){M.json?A.send(JSON.stringify(M.json)):A.send(M.body)}(g(A(),D,I),M)})},M.sendRawRequest=function(A){return new Promise(function(M,D){var I=g(new window.XMLHttpRequest,M,D);if(I.open(A.method.toUpperCase(),A.url,!0),A.headers)for(var t in A.headers)A.headers.hasOwnProperty(t)&&I.setRequestHeader(t,A.headers[t]);I.send(A.body)})}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0),g=D(2);M.createResumingStrategy=function(A,M,D,I){var e=g.createRetryStrategyOptionsOrDefault(A),w=new g.RetryResolution(e,D);return function(A,I){return new t(D,I,M,A,w)}};var t=function(A,M,D,I,g){var t=this;this.unsubscribe=function(){t.state.unsubscribe()},this.onTransition=function(A){t.state=A},this.state=new e(this.onTransition,A,M,D,I,g)},e=function(){function A(A,M,D,I,g,t,e){var i=this;this.onTransition=A,this.logger=M,this.headers=D,this.nextSubscribeStrategy=I,this.listeners=g,this.retryResolution=t,this.initialEventId=e;var n=e;M.verbose("ResumingSubscription: transitioning to OpeningSubscriptionState"),n&&(D["Last-Event-Id"]=n,M.verbose("ResumingSubscription: initialEventId is "+n)),this.underlyingSubscription=I({onEnd:function(D){A(new T(M,g,D))},onError:function(e){A(new N(e,A,M,D,g,I,t,n))},onEvent:function(A){n=A.eventId,g.onEvent(A)},onOpen:function(D){A(new w(M,D,g,i.underlyingSubscription,A))},onRetrying:g.onRetrying},D)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),this.underlyingSubscription.unsubscribe()},A}(),w=function(){function A(A,M,D,I,g){this.logger=A,this.headers=M,this.listeners=D,this.underlyingSubscription=I,this.onTransition=g,A.verbose("ResumingSubscription: transitioning to OpenSubscriptionState"),D.onOpen(M)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),this.underlyingSubscription.unsubscribe()},A}(),N=function(){function A(A,M,D,t,e,N,i,c){var E=this;this.onTransition=M,this.logger=D,this.headers=t,this.listeners=e,this.nextSubscribeStrategy=N,this.retryResolution=i,D.verbose("ResumingSubscription: transitioning to ResumingSubscriptionState");var j=function(A,t){e.onRetrying();var w,N=((w=A)instanceof I.ErrorResponse&&(w.headers["Request-Method"]="SUBSCRIBE"),i.attemptRetry(w));N instanceof g.Retry?E.timeout=window.setTimeout(function(){y(t)},N.waitTimeMillis):M(new n(D,e,A))},y=function(A){D.verbose("ResumingSubscription: trying to re-establish the subscription"),A&&(D.verbose("ResumingSubscription: lastEventId: "+A),t["Last-Event-Id"]=A),E.underlyingSubscription=N({onEnd:function(A){M(new T(D,e,A))},onError:function(A){j(A,c)},onEvent:function(A){c=A.eventId,e.onEvent(A)},onOpen:function(A){M(new w(D,A,e,E.underlyingSubscription,M))},onRetrying:e.onRetrying},t)};j(A,c)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),window.clearTimeout(this.timeout),this.underlyingSubscription.unsubscribe()},A}(),i=function(){function A(A,M){this.logger=A,A.verbose("ResumingSubscription: transitioning to EndingSubscriptionState")}return A.prototype.unsubscribe=function(){throw new Error("Subscription is already ending")},A}(),T=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("ResumingSubscription: transitioning to EndedSubscriptionState"),M.onEnd(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}(),n=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("ResumingSubscription: transitioning to FailedSubscriptionState",D),M.onError(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0),g=D(2);M.createRetryingStrategy=function(A,M,D){var I=g.createRetryStrategyOptionsOrDefault(A),e=new g.RetryResolution(I,D);return function(A,I){return new t(D,I,A,M,e)}};var t=function(A,M,D,I,g){var t=this;this.unsubscribe=function(){t.state.unsubscribe()},this.onTransition=function(A){t.state=A},this.state=new e(this.onTransition,A,M,D,I,g)},e=function(){function A(A,M,D,I,g,t){var e=this;this.logger=M,this.headers=D,this.listeners=I,this.nextSubscribeStrategy=g,this.retryResolution=t,M.verbose("RetryingSubscription: transitioning to OpeningSubscriptionState"),this.underlyingSubscription=g({onEnd:function(D){return A(new i(M,I,D))},onError:function(e){return A(new w(e,A,M,D,I,g,t))},onEvent:I.onEvent,onOpen:function(D){return A(new N(M,I,D,e.underlyingSubscription,A))},onRetrying:I.onRetrying},D)}return A.prototype.unsubscribe=function(){throw this.underlyingSubscription.unsubscribe(),new Error("Method not implemented.")},A}(),w=function(){function A(A,M,D,t,e,w,n){var c=this;this.onTransition=M,this.logger=D,this.headers=t,this.listeners=e,this.nextSubscribeStrategy=w,this.retryResolution=n,D.verbose("RetryingSubscription: transitioning to RetryingSubscriptionState");var E=function(A){e.onRetrying();var t,w=((t=A)instanceof I.ErrorResponse&&(t.headers["Request-Method"]="SUBSCRIBE"),n.attemptRetry(t));w instanceof g.Retry?c.timeout=window.setTimeout(function(){j()},w.waitTimeMillis):M(new T(D,e,A))},j=function(){D.verbose("RetryingSubscription: trying to re-establish the subscription");var A=w({onEnd:function(A){return M(new i(D,e,A))},onError:function(A){return E(A)},onEvent:e.onEvent,onOpen:function(I){M(new N(D,e,I,A,M))},onRetrying:e.onRetrying},t)};E(A)}return A.prototype.unsubscribe=function(){window.clearTimeout(this.timeout),this.onTransition(new i(this.logger,this.listeners))},A}(),N=function(){function A(A,M,D,I,g){this.logger=A,this.listeners=M,this.headers=D,this.underlyingSubscription=I,this.onTransition=g,A.verbose("RetryingSubscription: transitioning to OpenSubscriptionState"),M.onOpen(D)}return A.prototype.unsubscribe=function(){this.underlyingSubscription.unsubscribe(),this.onTransition(new i(this.logger,this.listeners))},A}(),i=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("RetryingSubscription: transitioning to EndedSubscriptionState"),M.onEnd(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}(),T=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("RetryingSubscription: transitioning to FailedSubscriptionState",D),M.onError(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0);M.createTokenProvidingStrategy=function(A,M,D){return D?function(I,t){return new g(M,I,t,D,A)}:A};var g=function(){function A(A,M,D,I,g){var w=this;this.logger=A,this.listeners=M,this.headers=D,this.tokenProvider=I,this.nextSubscribeStrategy=g,this.unsubscribe=function(){w.state.unsubscribe(),w.state=new e(w.logger)},this.state=new t(A,D,g),this.subscribe()}return A.prototype.subscribe=function(){var A=this;this.tokenProvider.fetchToken().then(function(M){var D=Object.assign({},A.listeners);A.state.subscribe(M,{onEnd:function(M){A.state=new e(A.logger),D.onEnd(M)},onError:function(I){A.isTokenExpiredError(I)?(A.tokenProvider.clearToken(M),A.subscribe()):(A.state=new e(A.logger),D.onError(I))},onEvent:A.listeners.onEvent,onOpen:A.listeners.onOpen})}).catch(function(M){A.logger.debug("TokenProvidingSubscription: error when fetching token:",M),A.state=new e(A.logger),A.listeners.onError(M)})},A.prototype.isTokenExpiredError=function(A){return A instanceof I.ErrorResponse&&401===A.statusCode&&"authentication/expired"===A.info},A}(),t=function(){function A(A,M,D){this.logger=A,this.headers=M,this.nextSubscribeStrategy=D,A.verbose("TokenProvidingSubscription: transitioning to ActiveState")}return A.prototype.subscribe=function(A,M){var D=this;this.putTokenIntoHeader(A),this.underlyingSubscription=this.nextSubscribeStrategy({onEnd:function(A){D.logger.verbose("TokenProvidingSubscription: subscription ended"),M.onEnd(A)},onError:function(A){D.logger.verbose("TokenProvidingSubscription: subscription errored:",A),M.onError(A)},onEvent:M.onEvent,onOpen:function(A){D.logger.verbose("TokenProvidingSubscription: subscription opened"),M.onOpen(A)},onRetrying:M.onRetrying},this.headers)},A.prototype.unsubscribe=function(){this.underlyingSubscription.unsubscribe()},A.prototype.putTokenIntoHeader=function(A){this.headers.Authorization="Bearer "+A,this.logger.verbose("TokenProvidingSubscription: token fetched: "+A)},A}(),e=function(){function A(A){this.logger=A,A.verbose("TokenProvidingSubscription: transitioning to InactiveState")}return A.prototype.subscribe=function(A,M){this.logger.verbose("TokenProvidingSubscription: subscribe called in Inactive state; doing nothing")},A.prototype.unsubscribe=function(){this.logger.verbose("TokenProvidingSubscription: unsubscribe called in Inactive state; doing nothing")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.createTransportStrategy=function(A,M,D){return function(D,I){return M.subscribe(A,D,I)}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.HOST_BASE="pusherplatform.io"},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(3);M.BaseClient=I.BaseClient;var g=D(9);M.HOST_BASE=g.HOST_BASE;var t=D(15);M.Instance=t.default;var e=D(1);M.ConsoleLogger=e.ConsoleLogger,M.EmptyLogger=e.EmptyLogger;var w=D(0);M.ErrorResponse=w.ErrorResponse,M.NetworkError=w.NetworkError,M.responseToHeadersObject=w.responseToHeadersObject,M.XhrReadyState=w.XhrReadyState;var N=D(4);M.executeNetworkRequest=N.executeNetworkRequest,M.sendRawRequest=N.sendRawRequest;var i=D(5);M.createResumingStrategy=i.createResumingStrategy;var T=D(2);M.createRetryStrategyOptionsOrDefault=T.createRetryStrategyOptionsOrDefault,M.DoNotRetry=T.DoNotRetry,M.Retry=T.Retry,M.RetryResolution=T.RetryResolution;var n=D(6);M.createRetryingStrategy=n.createRetryingStrategy;var c=D(7);M.createTokenProvidingStrategy=c.createTokenProvidingStrategy;var E=D(8);M.createTransportStrategy=E.createTransportStrategy,M.default={BaseClient:I.BaseClient,ConsoleLogger:e.ConsoleLogger,EmptyLogger:e.EmptyLogger,Instance:t.default}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.subscribeStrategyListenersFromSubscriptionListeners=function(A){return{onEnd:A.onEnd,onError:A.onError,onEvent:A.onEvent,onOpen:A.onOpen,onRetrying:A.onRetrying}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.replaceMissingListenersWithNoOps=function(A){return{onEnd:A.onEnd||function(A){},onError:A.onError||function(A){},onEvent:A.onEvent||function(A){},onOpen:A.onOpen||function(A){},onRetrying:A.onRetrying||function(){},onSubscribe:A.onSubscribe||function(){}}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I,g=D(0);!function(A){A[A.UNOPENED=0]="UNOPENED",A[A.OPENING=1]="OPENING",A[A.OPEN=2]="OPEN",A[A.ENDING=3]="ENDING",A[A.ENDED=4]="ENDED"}(I=M.HttpTransportState||(M.HttpTransportState={}));var t=function(){function A(A,M){var D=this;return this.gotEOS=!1,this.lastNewlineIndex=0,this.state=I.UNOPENED,this.xhr=A,this.listeners=M,this.xhr.onreadystatechange=function(){switch(D.xhr.readyState){case g.XhrReadyState.UNSENT:case g.XhrReadyState.OPENED:case g.XhrReadyState.HEADERS_RECEIVED:D.assertStateIsIn(I.OPENING);break;case g.XhrReadyState.LOADING:D.onLoading();break;case g.XhrReadyState.DONE:D.onDone()}},this.state=I.OPENING,this.xhr.send(),this}return A.prototype.unsubscribe=function(){this.state=I.ENDED,this.xhr.abort(),this.listeners.onEnd&&this.listeners.onEnd(null)},A.prototype.onLoading=function(){if(this.assertStateIsIn(I.OPENING,I.OPEN,I.ENDING),200===this.xhr.status){this.state===I.OPENING&&(this.state=I.OPEN,window.console.log(g.responseToHeadersObject(this.xhr.getAllResponseHeaders())),this.listeners.onOpen&&this.listeners.onOpen(g.responseToHeadersObject(this.xhr.getAllResponseHeaders()))),this.assertStateIsIn(I.OPEN);var A=this.onChunk();this.assertStateIsIn(I.OPEN,I.ENDING),A&&(this.state=I.ENDED,A instanceof g.ErrorResponse&&204!==A.statusCode&&this.listeners.onError&&this.listeners.onError(A))}},A.prototype.onDone=function(){if(200===this.xhr.status){this.state===I.OPENING&&(this.state=I.OPEN,this.listeners.onOpen&&this.listeners.onOpen(g.responseToHeadersObject(this.xhr.getAllResponseHeaders()))),this.assertStateIsIn(I.OPEN,I.ENDING);var A=this.onChunk();A?(this.state=I.ENDED,204===A.statusCode?this.listeners.onEnd&&this.listeners.onEnd(null):this.listeners.onError&&this.listeners.onError(A)):this.state<=I.ENDING?this.listeners.onError&&this.listeners.onError(new Error("HTTP response ended without receiving EOS message")):this.listeners.onEnd&&this.listeners.onEnd(null)}else{if(this.assertStateIsIn(I.OPENING,I.OPEN,I.ENDED),this.state===I.ENDED)return;0===this.xhr.status?this.listeners.onError&&this.listeners.onError(new g.NetworkError("Connection lost.")):this.listeners.onError&&this.listeners.onError(g.ErrorResponse.fromXHR(this.xhr))}},A.prototype.onChunk=function(){this.assertStateIsIn(I.OPEN);var A=this.xhr.responseText,M=A.lastIndexOf("\n");if(M>this.lastNewlineIndex){var D=A.slice(this.lastNewlineIndex,M).split("\n");this.lastNewlineIndex=M;for(var g=0,t=D;gM-A.lastMessageReceivedTimestamp||(A.sendMessage(A.getMessage(16,M)),A.lastSentPingID=M,A.pongTimeout=window.setTimeout(function(){1e4>(new Date).getTime()-A.lastMessageReceivedTimestamp?A.pongTimeout=null:A.close(new t.NetworkError("Pong response wasn't received until timeout."))},1e4))}},3e4)},this.socket.onmessage=function(M){return A.receiveMessage(M)},this.socket.onerror=function(M){A.close(new t.NetworkError("Connection was lost."))},this.socket.onclose=function(M){if(A.forcedClose){var D=A.closedError?function(M){M.listeners.onError&&M.listeners.onError(A.closedError)}:function(A){A.listeners.onEnd&&A.listeners.onEnd(null)},I=!1===A.pendingSubscriptions.isEmpty()?A.pendingSubscriptions:A.subscriptions;I.getAllAsArray().forEach(D),I.removeAll(),A.closedError&&A.tryReconnectIfNeeded()}else A.tryReconnectIfNeeded()}},A.prototype.close=function(A){this.socket instanceof window.WebSocket&&(this.forcedClose=!0,this.closedError=A,this.socket.close(),window.clearTimeout(this.pingInterval),window.clearTimeout(this.pongTimeout),delete this.pongTimeout,this.lastSentPingID=null)},A.prototype.tryReconnectIfNeeded=function(){this.socket.readyState===g.Closed&&this.connect()},A.prototype.subscribePending=function(A,M,D,I){void 0!==I?(this.subscriptions.add(I,A,M,D),this.sendMessage(this.getMessage(100,I,A,D))):window.console.logger.debug("Subscription to path "+A+" has an undefined ID")},A.prototype.getMessage=function(A,M,D,I){return[A,M,D,I]},A.prototype.sendMessage=function(A){if(this.socket.readyState!==g.Open)return window.console.warn("Can't send in \""+g[this.socket.readyState]+'" state');this.socket.send(JSON.stringify(A))},A.prototype.subscription=function(A){return this.subscriptions.get(A)},A.prototype.receiveMessage=function(A){var M;this.lastMessageReceivedTimestamp=(new Date).getTime();try{M=JSON.parse(A.data)}catch(M){return void this.close(new Error("Message is not valid JSON format. Getting "+A.data))}var D=this.validateMessage(M);if(D)this.close(new Error(D.message));else{var I=M.shift();switch(I){case 17:return void this.onPongMessage(M);case 16:return void this.onPingMessage(M);case 99:return void this.onCloseMessage(M)}var g=M.shift(),t=this.subscription(g);if(t){var e=t.listeners;switch(I){case 101:this.onOpenMessage(M,g,e);break;case 102:this.onEventMessage(M,e);break;case 199:this.onEOSMessage(M,g,e);break;default:this.close(new Error("Received non existing type of message."))}}else this.close(new Error('Received message for non existing subscription id: "'+g+'"'))}},A.prototype.validateMessage=function(A){return Array.isArray(A)?A.length<1?new Error("Message is empty array: "+JSON.stringify(A)):null:new Error("Message is expected to be an array. Getting: "+JSON.stringify(A))},A.prototype.onOpenMessage=function(A,M,D){D.onOpen&&D.onOpen(A[1])},A.prototype.onEventMessage=function(A,M){if(3!==A.length)return new Error("Event message has "+A.length+" elements (expected 4)");var D=A[0],I=A[1],g=A[2];return"string"!=typeof D?new Error("Invalid event ID in message: "+JSON.stringify(A)):"object"!=typeof I||Array.isArray(I)?new Error("Invalid event headers in message: "+JSON.stringify(A)):void(M.onEvent&&M.onEvent({eventId:D,headers:I,body:g}))},A.prototype.onEOSMessage=function(A,M,D){if(this.subscriptions.remove(M),3===A.length){var I=A[0],g=A[1],e=A[2];"number"==typeof I?"object"!=typeof g||Array.isArray(g)?D.onError&&D.onError(new Error("Invalid EOS ElementsHeaders")):204!==I?D.onError&&D.onError(new t.ErrorResponse(I,g,e)):D.onEnd&&D.onEnd(null):D.onError&&D.onError(new Error("Invalid EOS Status Code"))}else D.onError&&D.onError(new Error("EOS message has "+A.length+" elements (expected 4)"))},A.prototype.onCloseMessage=function(A){var M=A[0],D=A[1];return A[2],"number"!=typeof M?this.close(new Error("Close message: Invalid EOS Status Code")):"object"!=typeof D||Array.isArray(D)?this.close(new Error("Close message: Invalid EOS ElementsHeaders")):void this.close()},A.prototype.onPongMessage=function(A){var M=A[0];this.lastSentPingID!==M&&this.close(new t.NetworkError("Didn't received pong with proper ID")),window.clearTimeout(this.pongTimeout),delete this.pongTimeout,this.lastSentPingID=null},A.prototype.onPingMessage=function(A){var M=A[0];this.sendMessage(this.getMessage(17,M))},A}();M.default=N},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(3),g=D(9),t=D(1),e=function(){function A(A){if(!A.locator)throw new Error("Expected `locator` property in Instance options!");var M=A.locator.split(":");if(3!==M.length)throw new Error("The instance locator supplied is invalid. Did you copy it correctly from the Pusher dashboard?");if(!A.serviceName)throw new Error("Expected `serviceName` property in Instance options!");if(!A.serviceVersion)throw new Error("Expected `serviceVersion` property in Instance options!");this.platformVersion=M[0],this.cluster=M[1],this.id=M[2],this.serviceName=A.serviceName,this.serviceVersion=A.serviceVersion,this.host=A.host||this.cluster+"."+g.HOST_BASE,this.logger=A.logger||new t.ConsoleLogger,this.client=A.client||new I.BaseClient({encrypted:A.encrypted,host:this.host,logger:this.logger}),this.tokenProvider=A.tokenProvider}return A.prototype.request=function(A,M){return A.path=this.absPath(A.path),null!=A.headers&&void 0!==A.headers||(A.headers={}),A.tokenProvider=A.tokenProvider||this.tokenProvider,this.client.request(A,M)},A.prototype.subscribeNonResuming=function(A){var M=A.headers||{},D=A.retryStrategyOptions||{},I=A.tokenProvider||this.tokenProvider;return this.client.subscribeNonResuming(this.absPath(A.path),M,A.listeners,D,I)},A.prototype.subscribeResuming=function(A){var M=A.headers||{},D=A.retryStrategyOptions||{},I=A.tokenProvider||this.tokenProvider;return this.client.subscribeResuming(this.absPath(A.path),M,A.listeners,D,A.initialEventId,I)},A.prototype.absPath=function(A){return("/services/"+this.serviceName+"/"+this.serviceVersion+"/"+this.id+"/"+A).replace(/\/+/g,"/").replace(/\/+$/,"")},A}();M.default=e}])},A.exports=D()}(A={exports:{}}),A.exports);(D=I)&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")&&D.default;var g=I.BaseClient,t=I.HOST_BASE,e=I.Instance,w=I.sendRawRequest;function N(A){return null!=A&&"object"==typeof A&&!0===A["@@functional/placeholder"]}function i(A){return function M(D){return 0===arguments.length||N(D)?M:A.apply(this,arguments)}}function T(A){return function M(D,I){switch(arguments.length){case 0:return M;case 1:return N(D)?M:i(function(M){return A(D,M)});default:return N(D)&&N(I)?M:N(D)?i(function(M){return A(M,I)}):N(I)?i(function(M){return A(D,M)}):A(D,I)}}}function n(A,M){switch(A){case 0:return function(){return M.apply(this,arguments)};case 1:return function(A){return M.apply(this,arguments)};case 2:return function(A,D){return M.apply(this,arguments)};case 3:return function(A,D,I){return M.apply(this,arguments)};case 4:return function(A,D,I,g){return M.apply(this,arguments)};case 5:return function(A,D,I,g,t){return M.apply(this,arguments)};case 6:return function(A,D,I,g,t,e){return M.apply(this,arguments)};case 7:return function(A,D,I,g,t,e,w){return M.apply(this,arguments)};case 8:return function(A,D,I,g,t,e,w,N){return M.apply(this,arguments)};case 9:return function(A,D,I,g,t,e,w,N,i){return M.apply(this,arguments)};case 10:return function(A,D,I,g,t,e,w,N,i,T){return M.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function c(A,M,D){return function(){for(var I=[],g=0,t=A,e=0;e=arguments.length)?w=M[e]:(w=arguments[g],g+=1),I[e]=w,N(w)||(t-=1),e+=1}return t<=0?D.apply(this,I):n(t,c(A,I,D))}}var E=T(function(A,M){return 1===A?i(M):n(A,c(A,[],M))});function j(A){return function M(D,I,g){switch(arguments.length){case 0:return M;case 1:return N(D)?M:T(function(M,I){return A(D,M,I)});case 2:return N(D)&&N(I)?M:N(D)?T(function(M,D){return A(M,I,D)}):N(I)?T(function(M,I){return A(D,M,I)}):i(function(M){return A(D,I,M)});default:return N(D)&&N(I)&&N(g)?M:N(D)&&N(I)?T(function(M,D){return A(M,D,g)}):N(D)&&N(g)?T(function(M,D){return A(M,I,D)}):N(I)&&N(g)?T(function(M,I){return A(D,M,I)}):N(D)?i(function(M){return A(M,I,g)}):N(I)?i(function(M){return A(D,M,g)}):N(g)?i(function(M){return A(D,I,M)}):A(D,I,g)}}}var y=Array.isArray||function(A){return null!=A&&A.length>=0&&"[object Array]"===Object.prototype.toString.call(A)};function o(A,M,D){return function(){if(0===arguments.length)return D();var I=Array.prototype.slice.call(arguments,0),g=I.pop();if(!y(g)){for(var t=0;tA?M:A});function C(A,M){for(var D=0,I=M.length,g=Array(I);D0&&A.hasOwnProperty(0)&&A.hasOwnProperty(A.length-1))}),B=function(){function A(A){this.f=A}return A.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},A.prototype["@@transducer/result"]=function(A){return A},A.prototype["@@transducer/step"]=function(A,M){return this.f(A,M)},A}(),a=T(function(A,M){return n(A.length,function(){return A.apply(M,arguments)})});function L(A,M,D){for(var I=D.next();!I.done;){if((M=A["@@transducer/step"](M,I.value))&&M["@@transducer/reduced"]){M=M["@@transducer/value"];break}I=D.next()}return A["@@transducer/result"](M)}function s(A,M,D,I){return A["@@transducer/result"](D[I](a(A["@@transducer/step"],A),M))}var x="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function O(A,M,D){if("function"==typeof A&&(A=function(A){return new B(A)}(A)),z(D))return function(A,M,D){for(var I=0,g=D.length;I=0;)k(M=d[D],A)&&!f(I,M)&&(I[I.length]=M),D-=1;return I}:function(A){return Object(A)!==A?[]:Object.keys(A)}),p=T(o(["fantasy-land/map","map"],S,function(A,M){switch(Object.prototype.toString.call(M)){case"[object Function]":return E(M.length,function(){return A.call(this,M.apply(this,arguments))});case"[object Object]":return O(function(D,I){return D[I]=A(M[I]),D},{},m(M));default:return C(A,M)}})),G=T(function(A,M){for(var D=M,I=0;I=0;){if(D[w]===A)return I[w]===M;w-=1}switch(e){case"Map":return A.size===M.size&&DA(A.entries(),M.entries(),D.concat([A]),I.concat([M]));case"Set":return A.size===M.size&&DA(A.values(),M.values(),D.concat([A]),I.concat([M]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var N=m(A);if(N.length!==m(M).length)return!1;var i=D.concat([A]),T=I.concat([M]);for(w=N.length-1;w>=0;){var n=N[w];if(!k(n,M)||!IA(M[n],A[n],i,T))return!1;w-=1}return!0}var gA=T(function(A,M){return IA(A,M,[],[])});function tA(A,M){return function(A,M,D){var I,g;if("function"==typeof A.indexOf)switch(typeof M){case"number":if(0===M){for(I=1/M;D=0}function eA(A){return'"'+A.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var wA=function(A){return(A<10?"0":"")+A},NA="function"==typeof Date.prototype.toISOString?function(A){return A.toISOString()}:function(A){return A.getUTCFullYear()+"-"+wA(A.getUTCMonth()+1)+"-"+wA(A.getUTCDate())+"T"+wA(A.getUTCHours())+":"+wA(A.getUTCMinutes())+":"+wA(A.getUTCSeconds())+"."+(A.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function iA(A){return"[object Object]"===Object.prototype.toString.call(A)}var TA=function(){function A(A,M){this.xf=M,this.f=A}return A.prototype["@@transducer/init"]=u.init,A.prototype["@@transducer/result"]=u.result,A.prototype["@@transducer/step"]=function(A,M){return this.f(M)?this.xf["@@transducer/step"](A,M):A},A}(),nA=T(o(["filter"],T(function(A,M){return new TA(A,M)}),function(A,M){return iA(M)?O(function(D,I){return A(M[I])&&(D[I]=M[I]),D},{},m(M)):function(A,M){for(var D=0,I=M.length,g=[];D":A(I,g)},g=function(A,M){return C(function(M){return eA(M)+": "+I(A[M])},M.slice().sort())};switch(Object.prototype.toString.call(M)){case"[object Arguments]":return"(function() { return arguments; }("+C(I,M).join(", ")+"))";case"[object Array]":return"["+C(I,M).concat(g(M,cA(function(A){return/^\d+$/.test(A)},m(M)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof M?"new Boolean("+I(M.valueOf())+")":M.toString();case"[object Date]":return"new Date("+(isNaN(M.valueOf())?I(NaN):eA(NA(M)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof M?"new Number("+I(M.valueOf())+")":1/M==-1/0?"-0":M.toString(10);case"[object String]":return"object"==typeof M?"new String("+I(M.valueOf())+")":eA(M);case"[object Undefined]":return"undefined";default:if("function"==typeof M.toString){var t=M.toString();if("[object Object]"!==t)return t}return"{"+g(M,m(M)).join(", ")+"}"}}(A,[])}),jA=T(tA),yA=function(){function A(A,M,D,I){this.valueFn=A,this.valueAcc=M,this.keyFn=D,this.xf=I,this.inputs={}}return A.prototype["@@transducer/init"]=u.init,A.prototype["@@transducer/result"]=function(A){var M;for(M in this.inputs)if(k(M,this.inputs)&&(A=this.xf["@@transducer/step"](A,this.inputs[M]))["@@transducer/reduced"]){A=A["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](A)},A.prototype["@@transducer/step"]=function(A,M){var D=this.keyFn(M);return this.inputs[D]=this.inputs[D]||[D,this.valueAcc],this.inputs[D][1]=this.valueFn(this.inputs[D][1],M),A},A}(),oA=c(4,[],o([],c(4,[],function(A,M,D,I){return new yA(A,M,D,I)}),function(A,M,D,I){return O(function(I,g){var t=D(g);return I[t]=A(k(t,I)?I[t]:M,g),I},{},I)})),uA=T(function(A,M){for(var D=[],I=0,g=A.length;I=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D},RA=function(A,M){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return function(A,M){var D=[],I=!0,g=!1,t=void 0;try{for(var e,w=A[Symbol.iterator]();!(I=(e=w.next()).done)&&(D.push(e.value),!M||D.length!==M);I=!0);}catch(A){g=!0,t=A}finally{try{!I&&w.return&&w.return()}finally{if(g)throw t}}return D}(A,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")},vA=K(nA(function(A){return void 0!==A}),mA,p(function(A){var M=RA(A,2),D=M[0],I=M[1];return D+"="+encodeURIComponent(I)}),lA("&")),WA=function(A,M){return M+(jA("?",M)?"&":"?")+vA(A)},PA=K(fA("&"),p(fA("=")),BA),VA=function(A,M,D){var I=void 0===D?"undefined":pA(D);if(I!==M)throw new TypeError("expected "+A+" to be of type "+M+" but was of type "+I)},XA=function(A,M,D){VA(A,"object",D),zA(function(A,D){return VA(D,M,A)},D)},ZA=function(){return Math.floor(Date.now()/1e3)},KA=function(A){return{createdAt:A.created_at,createdByUserId:A.created_by_id,deletedAt:A.deletedAt,id:A.id,isPrivate:A.private,name:A.name,updatedAt:A.updated_at,userIds:A.member_user_ids}},_A=function(A){return{avatarURL:A.avatar_url,createdAt:A.created_at,customData:A.custom_data,id:A.id,name:A.name,updatedAt:A.updated_at}},qA=function(A){return{lastSeenAt:A.last_seen_at,state:jA(A.state,["online","offline"])?A.state:"unknown",userId:A.user_id}},$A=function(A){return{id:A.id,senderId:A.user_id,roomId:A.room_id,text:A.text,createdAt:A.created_at,updatedAt:A.updated_at,attachment:A.attachment&&DM(A.attachment)}},AM=function(A){return{file:{name:A.file.name,bytes:A.file.bytes,lastModified:A.file.last_modified},link:A.resource_link,ttl:A.ttl}},MM=function(A){return{position:A.position,updatedAt:A.updated_at,userId:A.user_id,roomId:A.room_id,type:A.cursor_type}},DM=function(A){return{link:A.resource_link,type:A.type,fetchRequired:"true"===(M=A.resource_link,jA("?",M)?PA(fA("?",M)[1]):{}).chatkit_link};var M},IM=function A(){var M=this;GA(this,A),this.pendingSets=[],this.pendingGets=[],this.initialize=function(A){M.store=A,QA(function(A){var D=A.key,I=A.value;(0,A.resolve)(M.store[D]=I)},M.pendingSets),QA(function(A){var D=A.key;(0,A.resolve)(M.store[D])},M.pendingGets)},this.set=function(A,D){return M.store?Promise.resolve(M.store[A]=D):new Promise(function(I){M.pendingSets.push({key:A,value:D,resolve:I})})},this.get=function(A){return M.store?Promise.resolve(M.store[A]):new Promise(function(D){M.pendingGets.push({key:A,resolve:D})})},this.pop=function(A){return M.get(A).then(function(D){return delete M.store[A],D})},this.update=function(A,D){return M.get(A).then(function(I){return M.set(A,D(I))})},this.snapshot=function(){return M.store||{}},this.getSync=function(A){return M.store?M.store[A]:void 0}},gM=function(){function A(M,D){GA(this,A),this.avatarURL=M.avatarURL,this.createdAt=M.createdAt,this.customData=M.customData,this.id=M.id,this.name=M.name,this.updatedAt=M.updatedAt,this.presenceStore=D}return HA(A,[{key:"presence",get:function(){return this.presenceStore.getSync(this.id)||{lastSeenAt:void 0,state:"unknown",userId:this.id}}}]),A}(),tM=function A(M){var D=this,I=M.instance,g=M.presenceStore,t=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=function(A,M){return D.store.set(A,D.decorate(M))},this.get=function(A){return Promise.all([D.fetchUser(A),D.presenceStore.get(A)]).then(function(A){var M=RA(A,2),D=M[0];return M[1],D})},this.fetchUser=function(A){return D.fetchMissingUsers([A]).then(function(){return D.store.get(A)})},this.fetchMissingUsers=function(A){var M=uA(A,p(H("id"),R(D.store.snapshot()))),I=uA(M,m(D.reqs));return hA(I)>0&&D.fetchBasicUsers(I),Promise.all(R(dA(A,D.reqs)))},this.fetchBasicUsers=function(A){var M=D.instance.request({method:"GET",path:WA({user_ids:lA(",",A)},"/users_by_ids")}).then(function(M){var I=p(_A,JSON.parse(M));return QA(function(A){return D.set(A.id,A)},I),QA(function(A){delete D.reqs[A]},A),I}).catch(function(A){throw D.logger.warn("error fetching missing users:",A),A});QA(function(A){D.reqs[A]=M},A)},this.snapshot=this.store.snapshot,this.getSync=this.store.getSync,this.decorate=function(A){return A?new gM(A,D.presenceStore):void 0},this.instance=I,this.presenceStore=g,this.logger=t,this.reqs={}},eM=function(){function A(M,D){GA(this,A),this.createdAt=M.createdAt,this.createdByUserId=M.createdByUserId,this.deletedAt=M.deletedAt,this.id=M.id,this.isPrivate=M.isPrivate,this.name=M.name,this.updatedAt=M.updatedAt,this.userIds=M.userIds,this.userStore=D}return HA(A,[{key:"users",get:function(){var A=this;return nA(function(M){return jA(M.id,A.userIds)},R(this.userStore.snapshot()))}}]),A}(),wM=function A(M){var D=this,I=M.instance,g=M.userStore,t=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=v(function(A,M){return D.store.set(A,D.decorate(M)).then(function(A){return D.userStore.fetchMissingUsers(A.userIds).then(function(){return A})})}),this.get=function(A){return D.store.get(A).then(function(M){return M||D.fetchBasicRoom(A).then(D.set(A))})},this.pop=this.store.pop,this.addUserToRoom=function(A,M){return D.store.update(A,function(A){return A.userIds=SA(J(M,A.userIds)),A})},this.removeUserFromRoom=function(A,M){return D.store.update(A,function(A){return A.userIds=nA(function(A){return A!==M},A.userIds),A})},this.update=function(A,M){return D.store.update(A,function(A){return A.createdAt=M.createdAt||A.createdAt,A.createdByUserId=M.createdByUserId||A.createdByUserId,A.deletedAt=M.deletedAt||A.deletedAt,A.id=M.id||A.id,A.isPrivate=M.isPrivate||A.isPrivate,A.name=M.name||A.name,A.updatedAt=M.updatedAt||A.updatedAt,A.userIds=M.userIds||A.userIds,A})},this.fetchBasicRoom=function(A){return D.instance.request({method:"GET",path:"/rooms/"+A}).then(K(JSON.parse,KA)).catch(function(M){D.logger.warn("error fetching details for room "+A+":",M)})},this.snapshot=this.store.snapshot,this.getSync=this.store.getSync,this.decorate=function(A){return A?new eM(A,D.userStore):void 0},this.instance=I,this.userStore=g,this.logger=t},NM=function(){function A(M,D,I){GA(this,A),this.position=M.position,this.updatedAt=M.updatedAt,this.userId=M.userId,this.roomId=M.roomId,this.type=M.type,this.userStore=D,this.roomStore=I}return HA(A,[{key:"user",get:function(){return this.userStore.getSync(this.userId)}},{key:"room",get:function(){return this.roomStore.getSync(this.roomId)}}]),A}(),iM=function A(M){var D=this,I=M.instance,g=M.userStore,t=M.roomStore,e=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=function(A,M,I){return D.store.set(TM(A,M),D.decorate(I))},this.get=function(A,M){return D.store.get(TM(A,M)).then(function(I){return I||D.fetchBasicCursor(A,M).then(function(I){return D.set(A,M,I)})})},this.getSync=function(A,M){return D.store.getSync(TM(A,M))},this.fetchBasicCursor=function(A,M){return D.instance.request({method:"GET",path:"/cursors/0/rooms/"+M+"/users/"+encodeURIComponent(A)}).then(function(A){var M=JSON.parse(A);if(M)return MM(M)}).catch(function(A){throw D.logger.warn("error fetching cursor:",A),A})},this.decorate=function(A){return A?new NM(A,D.userStore,D.roomStore):void 0},this.instance=I,this.userStore=g,this.roomStore=t,this.logger=e},TM=function(A,M){return A+"/"+M},nM=function A(M){var D=this,I=M.hooks,g=M.userId,t=M.instance,e=M.logger;GA(this,A),this.sendThrottledRequest=function(A){var M=Date.now(),I=D.lastSentRequests[A];return I&&M-I<1e3?Promise.resolve():(D.lastSentRequests[A]=M,D.instance.request({method:"POST",path:"/rooms/"+A+"/events",json:{name:"typing_start",user_id:D.userId}}).catch(function(M){throw delete D.typingRequestSent[A],D.logger.warn("Error sending is_typing event in room "+A,M),M}))},this.onIsTyping=function(A,M){D.timers[A.id]||(D.timers[A.id]={}),D.timers[A.id][M.id]?clearTimeout(D.timers[A.id][M.id]):D.onStarted(A,M),D.timers[A.id][M.id]=setTimeout(function(){D.onStopped(A,M),delete D.timers[A.id][M.id]},1500)},this.onStarted=function(A,M){D.hooks.global.onUserStartedTyping&&D.hooks.global.onUserStartedTyping(A,M),D.hooks.rooms[A.id]&&D.hooks.rooms[A.id].onUserStartedTyping&&D.hooks.rooms[A.id].onUserStartedTyping(M)},this.onStopped=function(A,M){D.hooks.global.onUserStoppedTyping&&D.hooks.global.onUserStoppedTyping(A,M),D.hooks.rooms[A.id]&&D.hooks.rooms[A.id].onUserStoppedTyping&&D.hooks.rooms[A.id].onUserStoppedTyping(M)},this.hooks=I,this.userId=g,this.instance=t,this.logger=e,this.lastSentRequests={},this.timers={}},cM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"added_to_room":D.onAddedToRoom(M.data);break;case"removed_from_room":D.onRemovedFromRoom(M.data);break;case"user_joined":D.onUserJoined(M.data);break;case"user_left":D.onUserLeft(M.data);break;case"room_updated":D.onRoomUpdated(M.data);break;case"room_deleted":D.onRoomDeleted(M.data);break;case"typing_start":D.onIsTyping(M.data)}},this.onInitialState=function(A){var M=A.current_user,I=A.rooms;D.onSubscriptionEstablished({user:_A(M),basicRooms:p(KA,I)})},this.onAddedToRoom=function(A){var M=A.room,I=KA(M);D.roomStore.set(I.id,I).then(function(A){D.hooks.global.onAddedToRoom&&D.hooks.global.onAddedToRoom(A)})},this.onRemovedFromRoom=function(A){var M=A.room_id;D.roomStore.pop(M).then(function(A){A&&D.hooks.global.onRemovedFromRoom&&D.hooks.global.onRemovedFromRoom(A)})},this.onUserJoined=function(A){var M=A.room_id,I=A.user_id;D.roomStore.addUserToRoom(M,I).then(function(A){D.userStore.get(I).then(function(I){D.hooks.global.onUserJoinedRoom&&D.hooks.global.onUserJoinedRoom(A,I),D.hooks.rooms[M]&&D.hooks.rooms[M].onUserJoined&&D.hooks.rooms[M].onUserJoined(I)})})},this.onUserLeft=function(A){var M=A.room_id,I=A.user_id;D.roomStore.removeUserFromRoom(M,I).then(function(A){D.userStore.get(I).then(function(I){D.hooks.global.onUserLeftRoom&&D.hooks.global.onUserLeftRoom(A,I),D.hooks.rooms[M]&&D.hooks.rooms[M].onUserLeft&&D.hooks.rooms[M].onUserLeft(I)})})},this.onRoomUpdated=function(A){var M=A.room,I=KA(M);D.roomStore.update(I.id,I).then(function(A){D.hooks.global.onRoomUpdated&&D.hooks.global.onRoomUpdated(A)})},this.onRoomDeleted=function(A){var M=A.room_id;D.roomStore.pop(M).then(function(A){A&&D.hooks.global.onRoomDeleted&&D.hooks.global.onRoomDeleted(A)})},this.onIsTyping=function(A){var M=A.room_id,I=A.user_id;Promise.all([D.roomStore.get(M),D.userStore.get(I)]).then(function(A){var M=RA(A,2),I=M[0],g=M[1];return D.typingIndicators.onIsTyping(I,g)})},this.userId=M.userId,this.hooks=M.hooks,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.typingIndicators=M.typingIndicators,this.roomSubscriptions=M.roomSubscriptions,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("user subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:"/users",listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling user subscription",A)}}}]),A}(),EM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"presence_update":D.onPresenceUpdate(M.data);break;case"join_room_presence_update":D.onJoinRoomPresenceUpdate(M.data)}},this.onInitialState=function(A){var M=A.user_states;D.presenceStore.initialize(xA(H("userId"),p(qA,M))),D.onSubscriptionEstablished()},this.onPresenceUpdate=function(A){var M=qA(A);D.presenceStore.set(M.userId,M).then(function(A){return D.userStore.get(A.userId).then(function(M){switch(A.state){case"online":D.onCameOnline(M);break;case"offline":D.onWentOffline(M)}})})},this.onJoinRoomPresenceUpdate=function(A){var M=A.user_states;return QA(function(A){return D.presenceStore.set(A.userId,A)},p(qA,M))},this.onCameOnline=function(A){return D.callRelevantHooks("onUserCameOnline",A)},this.onWentOffline=function(A){return D.callRelevantHooks("onUserWentOffline",A)},this.callRelevantHooks=function(A,M){D.hooks.global[A]&&D.hooks.global[A](M),q(QA(function(I){var g=RA(I,2),t=g[0],e=g[1];return D.roomStore.get(t).then(function(D){jA(M.id,D.userIds)&&e[A](M)})}),nA(function(M){var D=RA(M,2);return D[0],void 0!==D[1][A]}),mA)(D.hooks.rooms)},this.userId=M.userId,this.hooks=M.hooks,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.presenceStore=M.presenceStore,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("presence subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:"/users/"+encodeURIComponent(A.userId)+"/presence",listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling presence subscription",A)}}}]),A}(),jM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"new_cursor":D.onNewCursor(M.data)}},this.onInitialState=function(A){var M=A.cursors;q(QA(function(A){return D.cursorStore.set(A.userId,A.roomId,A)}),p(MM))(M),D.onSubscriptionEstablished()},this.onNewCursor=function(A){var M=MM(A);D.cursorStore.set(M.userId,M.roomId,M).then(function(){D.cursorStore.get(M.userId,M.roomId).then(D.onNewCursorHook)})},this.onNewCursorHook=M.onNewCursorHook,this.path=M.path,this.cursorStore=M.cursorStore,this.instance=M.instance,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("cursor subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:A.path,listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling cursor subscription",A)}}}]),A}(),yM=function(){function A(M,D,I){GA(this,A),this.id=M.id,this.senderId=M.senderId,this.roomId=M.roomId,this.text=M.text,this.attachment=M.attachment,this.createdAt=M.createdAt,this.updatedAt=M.updatedAt,this.userStore=D,this.roomStore=I}return HA(A,[{key:"sender",get:function(){return this.userStore.getSync(this.senderId)}},{key:"room",get:function(){return this.roomStore.getSync(this.roomId)}}]),A}(),oM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"new_message":D.onNewMessage(M.data)}},this.onNewMessage=function(A){var M={message:new yM($A(A),D.userStore,D.roomStore),ready:!1};D.messageBuffer.push(M),D.userStore.fetchMissingUsers([M.message.senderId]).catch(function(A){D.logger.error("error fetching missing user information:",A)}).then(function(){M.ready=!0,D.flushBuffer()})},this.flushBuffer=function(){for(;!UA(D.messageBuffer)&&LA(D.messageBuffer).ready;){var A=D.messageBuffer.shift().message;D.hooks.rooms[D.roomId]&&D.hooks.rooms[D.roomId].onNewMessage&&D.hooks.rooms[D.roomId].onNewMessage(A)}},this.roomId=M.roomId,this.hooks=M.hooks,this.messageLimit=M.messageLimit,this.userId=M.userId,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.messageBuffer=[],this.logger=M.logger}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.sub=A.instance.subscribeResuming({path:"/rooms/"+A.roomId+"?"+vA({message_limit:A.messageLimit}),listeners:{onOpen:M,onError:D,onEvent:A.onEvent}})})}},{key:"cancel",value:function(){try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling message subscription",A)}}}]),A}(),uM=function(){function A(M){var D=M.messageSub,I=M.cursorSub;GA(this,A),this.messageSub=D,this.cursorSub=I}return HA(A,[{key:"cancel",value:function(){this.messageSub.cancel(),this.cursorSub.cancel()}}]),A}(),rM=function(){function A(M){var D=M.apiInstance,I=M.connectionTimeout,g=M.cursorsInstance,t=M.filesInstance,e=M.hooks,w=M.id,N=M.presenceInstance;GA(this,A),CM.call(this),this.hooks={global:e,rooms:{}},this.id=w,this.encodedId=encodeURIComponent(this.id),this.apiInstance=D,this.filesInstance=t,this.cursorsInstance=g,this.connectionTimeout=I,this.presenceInstance=N,this.logger=D.logger,this.presenceStore=new IM,this.userStore=new tM({instance:this.apiInstance,presenceStore:this.presenceStore,logger:this.logger}),this.roomStore=new wM({instance:this.apiInstance,userStore:this.userStore,logger:this.logger}),this.cursorStore=new iM({instance:this.cursorsInstance,userStore:this.userStore,roomStore:this.roomStore,logger:this.logger}),this.typingIndicators=new nM({hooks:this.hooks,userId:this.id,instance:this.apiInstance,logger:this.logger}),this.roomSubscriptions={},this.readCursorBuffer={}}return HA(A,[{key:"rooms",get:function(){return R(this.roomStore.snapshot())}},{key:"users",get:function(){return R(this.userStore.snapshot())}}]),A}(),CM=function(){var A=this;this.setReadCursor=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.position;return VA("roomId","number",D),VA("position","number",I),new Promise(function(M,g){void 0!==A.readCursorBuffer[D]?(A.readCursorBuffer[D].position=r(A.readCursorBuffer[D].position,I),A.readCursorBuffer[D].callbacks.push({resolve:M,reject:g})):(A.readCursorBuffer[D]={position:I,callbacks:[{resolve:M,reject:g}]},setTimeout(function(){A.setReadCursorRequest(bA({roomId:D},A.readCursorBuffer[D])),delete A.readCursorBuffer[D]},500))})},this.readCursor=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.userId,g=void 0===I?A.id:I;if(VA("roomId","number",D),VA("userId","string",g),g!==A.id&&!aA(D,A.roomSubscriptions)){var t=new TypeError("Must be subscribed to room "+D+" to access member's read cursors");throw A.logger.error(t),t}return A.cursorStore.getSync(g,D)},this.isTypingIn=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.typingIndicators.sendThrottledRequest(M)},this.createRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.name,I=M.addUserIds,g=JA(M,["name","addUserIds"]);return D&&VA("name","string",D),I&&function(A,M,D){if(!Array.isArray(D))throw new TypeError("expected "+A+" to be an array");D.forEach(function(M,D){return VA(A+"["+D+"]","string",M)})}("addUserIds",0,I),A.apiInstance.request({method:"POST",path:"/rooms",json:{created_by_id:A.id,name:D,private:!!g.private,user_ids:I}}).then(function(M){var D=KA(JSON.parse(M));return A.roomStore.set(D.id,D)}).catch(function(M){throw A.logger.warn("error creating room:",M),M})},this.getJoinableRooms=function(){return A.apiInstance.request({method:"GET",path:"/users/"+A.encodedId+"/rooms?joinable=true"}).then(K(JSON.parse,p(KA))).catch(function(M){throw A.logger.warn("error getting joinable rooms:",M),M})},this.joinRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.isMemberOf(M)?A.roomStore.get(M):A.apiInstance.request({method:"POST",path:"/users/"+A.encodedId+"/rooms/"+M+"/join"}).then(function(M){var D=KA(JSON.parse(M));return A.roomStore.set(D.id,D)}).catch(function(D){throw A.logger.warn("error joining room "+M+":",D),D})},this.leaveRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.roomStore.get(M).then(function(D){return A.apiInstance.request({method:"POST",path:"/users/"+A.encodedId+"/rooms/"+M+"/leave"}).then(function(){return A.roomStore.pop(M)}).then(function(){return D})}).catch(function(D){throw A.logger.warn("error leaving room "+M+":",D),D})},this.addUserToRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.userId,I=M.roomId;return VA("userId","string",D),VA("roomId","number",I),A.apiInstance.request({method:"PUT",path:"/rooms/"+I+"/users/add",json:{user_ids:[D]}}).then(function(){return A.roomStore.addUserToRoom(I,D)}).catch(function(M){throw A.logger.warn("error adding user "+D+" to room "+I+":",M),M})},this.removeUserFromRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.userId,I=M.roomId;return VA("userId","string",D),VA("roomId","number",I),A.apiInstance.request({method:"PUT",path:"/rooms/"+I+"/users/remove",json:{user_ids:[D]}}).then(function(){return A.roomStore.removeUserFromRoom(I,D)}).catch(function(M){throw A.logger.warn("error removing user "+D+" from room "+I+":",M),M})},this.sendMessage=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.text,I=M.roomId,g=M.attachment;return VA("text","string",D),VA("roomId","number",I),new Promise(function(M,D){void 0!==g&&QM(g)?M(A.uploadDataAttachment(I,g)):void 0!==g&&zM(g)?M({resource_link:g.link,type:g.type}):void 0!==g?D(new TypeError("attachment was malformed")):M()}).then(function(M){return A.apiInstance.request({method:"POST",path:"/rooms/"+I+"/messages",json:{text:D,attachment:M}})}).then(K(JSON.parse,H("message_id"))).catch(function(M){throw A.logger.warn("error sending message to room "+I+":",M),M})},this.fetchMessages=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.initialId,g=M.limit,t=M.direction;return VA("roomId","number",D),I&&VA("initialId","number",I),g&&VA("limit","number",g),t&&function(A,M,D){if(!jA(D,M))throw new TypeError("expected direction to be one of "+M+" but was "+D)}(0,["older","newer"],t),A.apiInstance.request({method:"GET",path:"/rooms/"+D+"/messages?"+vA({initial_id:I,limit:g,direction:t})}).then(function(M){var D=p(q(A.decorateMessage,$A),JSON.parse(M));return A.userStore.fetchMissingUsers(SA(p(H("senderId"),D))).then(function(){return FA(function(A,M){return A.id-M.id},D)})}).catch(function(M){throw A.logger.warn("error fetching messages from room "+D+":",M),M})},this.subscribeToRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.hooks,g=void 0===I?{}:I,t=M.messageLimit;return VA("roomId","number",D),XA("hooks","function",g),t&&VA("messageLimit","number",t),A.roomSubscriptions[D]&&A.roomSubscriptions[D].cancel(),A.hooks.rooms[D]=g,A.roomSubscriptions[D]=new uM({messageSub:new oM({roomId:D,hooks:A.hooks,messageLimit:t,userId:A.id,instance:A.apiInstance,userStore:A.userStore,roomStore:A.roomStore,logger:A.logger}),cursorSub:new jM({onNewCursorHook:function(M){A.hooks.rooms[D]&&A.hooks.rooms[D].onNewReadCursor&&0===M.type&&M.userId!==A.id&&A.hooks.rooms[D].onNewReadCursor(M)},path:"/cursors/0/rooms/"+D,cursorStore:A.cursorStore,instance:A.cursorsInstance,logger:A.logger,connectionTimeout:A.connectionTimeout})}),A.joinRoom({roomId:D}).then(function(M){return Promise.all([A.roomSubscriptions[D].messageSub.connect(),A.roomSubscriptions[D].cursorSub.connect()]).then(function(){return M})}).catch(function(M){throw A.logger.warn("error subscribing to room "+D+":",M),M})},this.fetchAttachment=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url;return A.filesInstance.tokenProvider.fetchToken().then(function(A){return w({method:"GET",headers:{Authorization:"Bearer "+A},url:M})}).then(K(JSON.parse,AM)).catch(function(M){throw A.logger.warn("error fetching attachment:",M),M})},this.updateRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.name,g=JA(M,["roomId","name"]);return VA("roomId","number",D),I&&VA("name","string",I),g.private&&VA("private","boolean",g.private),A.apiInstance.request({method:"PUT",path:"/rooms/"+D,json:{name:I,private:g.private}}).then(function(){}).catch(function(M){throw A.logger.warn("error updating room:",M),M})},this.deleteRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.apiInstance.request({method:"DELETE",path:"/rooms/"+M}).then(function(){}).catch(function(M){throw A.logger.warn("error deleting room:",M),M})},this.setReadCursorRequest=function(M){var D=M.roomId,I=M.position,g=M.callbacks;return A.cursorsInstance.request({method:"PUT",path:"/cursors/0/rooms/"+D+"/users/"+A.encodedId,json:{position:I}}).then(function(){return p(function(A){return A.resolve()},g)}).catch(function(M){A.logger.warn("error setting cursor:",M),p(function(A){return A.reject(M)},g)})},this.uploadDataAttachment=function(M,D){var I=D.file,g=D.name,t=new FormData;return t.append("file",I,g),A.filesInstance.request({method:"POST",path:"/rooms/"+M+"/users/"+A.encodedId+"/files/"+g,body:t}).then(JSON.parse)},this.isMemberOf=function(M){return jA(M,p(H("id"),A.rooms))},this.decorateMessage=function(M){return new yM(M,A.userStore,A.roomStore)},this.establishUserSubscription=function(){return A.userSubscription=new cM({hooks:A.hooks,userId:A.id,instance:A.apiInstance,userStore:A.userStore,roomStore:A.roomStore,typingIndicators:A.typingIndicators,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.userSubscription.connect().then(function(M){var D=M.user,I=M.basicRooms;A.avatarURL=D.avatarURL,A.createdAt=D.createdAt,A.customData=D.customData,A.name=D.name,A.updatedAt=D.updatedAt,A.roomStore.initialize(xA(H("id"),I))}).then(A.initializeUserStore).catch(function(M){throw A.logger.error("error establishing user subscription:",M),M})},this.establishPresenceSubscription=function(){return A.presenceSubscription=new EM({hooks:A.hooks,userId:A.id,instance:A.presenceInstance,userStore:A.userStore,roomStore:A.roomStore,presenceStore:A.presenceStore,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.presenceSubscription.connect().catch(function(M){throw A.logger.error("error establishing presence subscription:",M),M})},this.establishCursorSubscription=function(){return A.cursorSubscription=new jM({onNewCursorHook:function(M){A.hooks.global.onNewReadCursor&&0===M.type&&A.isMemberOf(M.roomId)&&A.hooks.global.onNewReadCursor(M)},path:"/cursors/0/users/"+A.encodedId,cursorStore:A.cursorStore,instance:A.cursorsInstance,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.cursorSubscription.connect().then(function(){return A.cursorStore.initialize({})}).catch(function(M){throw A.logger.error("error establishing cursor subscription:",M),M})},this.initializeUserStore=function(){return A.userStore.fetchMissingUsers(SA(W(H("userIds"),A.rooms))).catch(function(M){A.logger.warn("error fetching initial user information:",M)}).then(function(){return A.userStore.initialize({})})},this.disconnect=function(){A.userSubscription.cancel(),A.presenceSubscription.cancel(),A.cursorSubscription.cancel(),zA(function(A){return A.cancel()},A.roomSubscriptions)}},QM=function(A){var M=A.file,D=A.name;return void 0!==M&&void 0!==D&&(VA("attachment.file","object",M),VA("attachment.name","string",D),!0)},zM=function(A){var M=A.link,D=A.type;return void 0!==M&&void 0!==D&&(VA("attachment.link","string",M),VA("attachment.type","string",D),!0)};return{TokenProvider:function A(){var M=this,D=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},I=D.url,g=D.queryParams,t=D.headers;GA(this,A),this.fetchToken=function(){return M.cacheIsStale()?(M.req||M.fetchFreshToken()).then(function(A){var D=A.token,I=A.expiresIn;return M.cache(D,I),D}):Promise.resolve(M.cachedToken)},this.fetchFreshToken=function(){return M.req=w({method:"POST",url:WA(bA({user_id:M.userId},M.queryParams),M.url),body:vA({grant_type:"client_credentials"}),headers:bA({"content-type":"application/x-www-form-urlencoded"},M.headers)}).then(function(A){var D=JSON.parse(A),I=D.access_token,g=D.expires_in;return delete M.req,{token:I,expiresIn:g}}).catch(function(A){throw delete M.req,A}),M.req},this.cacheIsStale=function(){return!M.cachedToken||ZA()>M.cacheExpiresAt},this.cache=function(A,D){M.cachedToken=A,M.cacheExpiresAt=ZA()+D},this.clearCache=function(){M.cachedToken=void 0,M.cacheExpiresAt=void 0},this.setUserId=function(A){M.clearCache(),M.userId=A},VA("url","string",I),g&&VA("queryParams","object",g),t&&VA("headers","object",t),this.url=I,this.queryParams=g,this.headers=t},ChatManager:function A(){var M=this,D=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},I=D.instanceLocator,w=D.tokenProvider,N=D.userId,i=JA(D,["instanceLocator","tokenProvider","userId"]);GA(this,A),this.connect=function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};XA("hooks","function",A);var D=new rM({hooks:A,id:M.userId,apiInstance:M.apiInstance,filesInstance:M.filesInstance,cursorsInstance:M.cursorsInstance,presenceInstance:M.presenceInstance,connectionTimeout:M.connectionTimeout});return Promise.all([D.establishUserSubscription(),D.establishPresenceSubscription(),D.establishCursorSubscription()]).then(function(){return M.currentUser=D,D})},this.disconnect=function(){M.currentUser&&M.currentUser.disconnect()},VA("instanceLocator","string",I),VA("tokenProvider","object",w),VA("tokenProvider.fetchToken","function",w.fetchToken),VA("userId","string",N);var T=fA(":",I)[1];if(void 0===T)throw new TypeError("expected instanceLocator to be of the format x:y:z, but was "+I);var n=i.baseClient||new g({host:T+"."+t,logger:i.logger,sdkProduct:"chatkit",sdkVersion:"0.7.17"});"function"==typeof w.setUserId&&w.setUserId(N);var c={client:n,locator:I,logger:i.logger,tokenProvider:w};this.apiInstance=new e(bA({serviceName:"chatkit",serviceVersion:"v1"},c)),this.filesInstance=new e(bA({serviceName:"chatkit_files",serviceVersion:"v1"},c)),this.cursorsInstance=new e(bA({serviceName:"chatkit_cursors",serviceVersion:"v1"},c)),this.presenceInstance=new e(bA({serviceName:"chatkit_presence",serviceVersion:"v1"},c)),this.userId=N,this.connectionTimeout=i.connectionTimeout||1e4}}}()}).call(this,D(11))},function(A,M,D){var I=D(418);"string"==typeof I&&(I=[[A.i,I,""]]);var g={insert:"head",singleton:!1};D(28)(I,g);I.locals&&(A.exports=I.locals)},function(A,M,D){(A.exports=D(21)(!1)).push([A.i,"",""])},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0});var I=Object.assign||function(A){for(var M=1;M0?"playlist":"hidden"},A.showCourses=function(M){var D=A.state,I=D.videos,g=D.courses,t=D.linkStyle,w=I,N=g[M],i=w[M];return e.default.createElement("div",{key:M},e.default.createElement("div",{onClick:A.addToPlaylist,id:i,title:N,className:t},N),e.default.createElement("div",{className:"clear"}))},A.videoSource=function(){var M=A.state.playlist,D=Object.keys(M).length;if(0===D&&void 0!==M&&null!==M)return"https://www.youtube.com/embed/gfkTfcpWqAY";if(D>=1){for(var I=Object.values(M),g=I.length,t=1,e=I[0]+"?enablejsapi=1&playlist=";t0)return{value:Math.round(u),unit:"year"};var r=12*u+y.getMonth()-o.getMonth();if(Math.round(Math.abs(r))>0)return{value:Math.round(r),unit:"month"};var C=n/N;return{value:Math.round(C),unit:"week"}}var T={second:45,minute:45,hour:22,day:5},n={"aa-SAAHO":"ssy",aam:"aas",aar:"aa",abk:"ab",adp:"dz",afr:"af",aju:"jrb",aka:"ak",alb:"sq",als:"sq",amh:"am",ara:"ar",arb:"ar",arg:"an",arm:"hy","art-lojban":"jbo",asm:"as",aue:"ktz",ava:"av",ave:"ae",aym:"ay",ayr:"ay",ayx:"nun","az-AZ":"az-Latn-AZ",aze:"az",azj:"az",bak:"ba",bam:"bm",baq:"eu",bcc:"bal",bcl:"bik",bel:"be",ben:"bn",bgm:"bcg",bh:"bho",bih:"bho",bis:"bi",bjd:"drl",bod:"bo",bos:"bs",bre:"br","bs-BA":"bs-Latn-BA",bul:"bg",bur:"my",bxk:"luy",bxr:"bua",cat:"ca",ccq:"rki","cel-gaulish":"xtg-x-cel-gaulish",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cjr:"mom",cka:"cmr",cld:"syr",cmk:"xch",cmn:"zh",cnr:"sr-ME",cor:"kw",cos:"co",coy:"pij",cqu:"quh",cre:"cr",cwd:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",dgo:"doi",dhd:"mwr",dik:"din",diq:"zza",div:"dv",drh:"mn",drw:"fa-af",dut:"nl",dzo:"dz",ekk:"et",ell:"el",emk:"man",eng:"en",epo:"eo",esk:"ik",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fat:"ak",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",fuc:"ff",ful:"ff",gav:"dev",gaz:"om",gbo:"grb",geo:"ka",ger:"de",gfx:"vaj",ggn:"gvr",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gno:"gon",gre:"el",grn:"gn",gti:"nyc",gug:"gn",guj:"gu",guv:"duz",gya:"gba","ha-Latn-GH":"ha-GH","ha-Latn-NE":"ha-NE","ha-Latn-NG":"ha-NG",hat:"ht",hau:"ha",hbs:"sr-Latn",hdn:"hai",hea:"hmn",heb:"he",her:"hz",him:"srx",hin:"hi",hmo:"ho",hrr:"jal",hrv:"hr",hun:"hu",hye:"hy","i-ami":"ami","i-bnn":"bnn","i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","i-default":"en-x-i-default","i-enochian":"und-x-i-enochian","i-mingo":"see-x-i-mingo",ibi:"opa",ibo:"ig",ice:"is",ido:"io",iii:"ii",ike:"iu",iku:"iu",ile:"ie",ilw:"gal",in:"id",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",iw:"he",jav:"jv",jeg:"oyb",ji:"yi",jpn:"ja",jw:"jv",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",kgc:"tdf",kgh:"kml",khk:"mn",khm:"km",kik:"ki",kin:"rw",kir:"ky","kk-Cyrl-KZ":"kk-KZ",kmr:"ku",knc:"kr",kng:"kg",knn:"kok",koj:"kwv",kom:"kv",kon:"kg",kor:"ko",kpv:"kv",krm:"bmf","ks-Arab-IN":"ks-IN",ktr:"dtp",kua:"kj",kur:"ku",kvs:"gdj",kwq:"yam",kxe:"tvd","ky-Cyrl-KG":"ky-KG",kzj:"dtp",kzt:"dtp",lao:"lo",lat:"la",lav:"lv",lbk:"bnc",lii:"raq",lim:"li",lin:"ln",lit:"lt",lmm:"rmx",ltz:"lb",lub:"lu",lug:"lg",lvs:"lv",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",meg:"cir",mhr:"chm",mkd:"mk",mlg:"mg",mlt:"mt","mn-Cyrl-MN":"mn-MN",mnk:"man",mo:"ro",mol:"ro",mon:"mn",mri:"mi","ms-Latn-BN":"ms-BN","ms-Latn-MY":"ms-MY","ms-Latn-SG":"ms-SG",msa:"ms",mst:"mry",mup:"raj",mwj:"vaj",mya:"my",myt:"mry",nad:"xny",nau:"na",nav:"nv",nbl:"nr",ncp:"kdz",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nnx:"ngv",no:"nb","no-bok":"nb","no-BOKMAL":"nb","no-nyn":"nn","no-NYNORSK":"nn",nob:"nb",nor:"nb",npi:"ne",nts:"pij",nya:"ny",oci:"oc",ojg:"oj",oji:"oj",ori:"or",orm:"om",ory:"or",oss:"os",oun:"vaj","pa-IN":"pa-Guru-IN","pa-PK":"pa-Arab-PK",pan:"pa",pbu:"ps",pcr:"adx",per:"fa",pes:"fa",pli:"pi",plt:"mg",pmc:"huw",pmu:"phr",pnb:"lah",pol:"pl",por:"pt",ppa:"bfy",ppr:"lcq",prs:"fa-AF",pry:"prt",pus:"ps",puz:"pub",que:"qu",quz:"qu",rmy:"rom",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sca:"hle",scc:"sr",scr:"hr","sgn-BE-FR":"sfb","sgn-BE-NL":"vgt","sgn-CH-DE":"sgg",sh:"sr-Latn","shi-MA":"shi-Tfng-MA",sin:"si",skk:"oyb",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",spy:"kln",sqi:"sq","sr-BA":"sr-Cyrl-BA","sr-ME":"sr-Latn-ME","sr-RS":"sr-Cyrl-RS","sr-XK":"sr-Cyrl-XK",src:"sc",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swc:"sw-CD",swe:"sv",swh:"sw",tah:"ty",tam:"ta",tat:"tt",tdu:"dtp",tel:"te",tgk:"tg",tgl:"fil",tha:"th",thc:"tpo",thx:"oyb",tib:"bo",tie:"ras",tir:"ti",tkk:"twm",tl:"fil",tlw:"weo",tmp:"tyj",tne:"kak",tnf:"fa-af",ton:"to",tsf:"taj",tsn:"tn",tso:"ts",ttq:"tmh",tuk:"tk",tur:"tr",tw:"ak",twi:"ak","tzm-Latn-MA":"tzm-MA","ug-Arab-CN":"ug-CN",uig:"ug",ukr:"uk",umu:"del",uok:"ema",urd:"ur","uz-AF":"uz-Arab-AF","uz-UZ":"uz-Latn-UZ",uzb:"uz",uzn:"uz","vai-LR":"vai-Vaii-LR",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xba:"cax",xho:"xh",xia:"acn",xkh:"waw",xpe:"kpe",xsj:"suj",xsl:"den",ybd:"rki",ydd:"yi",yid:"yi",yma:"lrr",ymt:"mtm",yor:"yo",yos:"zom","yue-CN":"yue-Hans-CN","yue-HK":"yue-Hant-HK",yuu:"yug",zai:"zap","zh-CN":"zh-Hans-CN","zh-guoyu":"zh","zh-hakka":"hak","zh-HK":"zh-Hant-HK","zh-min-nan":"nan","zh-MO":"zh-Hant-MO","zh-SG":"zh-Hans-SG","zh-TW":"zh-Hant-TW","zh-xiang":"hsn","zh-min":"nan-x-zh-min",zha:"za",zho:"zh",zsm:"ms",zul:"zu",zyb:"za"},c={"en-150":"en-001","en-AG":"en-001","en-AI":"en-001","en-AU":"en-001","en-BB":"en-001","en-BM":"en-001","en-BS":"en-001","en-BW":"en-001","en-BZ":"en-001","en-CA":"en-001","en-CC":"en-001","en-CK":"en-001","en-CM":"en-001","en-CX":"en-001","en-CY":"en-001","en-DG":"en-001","en-DM":"en-001","en-ER":"en-001","en-FJ":"en-001","en-FK":"en-001","en-FM":"en-001","en-GB":"en-001","en-GD":"en-001","en-GG":"en-001","en-GH":"en-001","en-GI":"en-001","en-GM":"en-001","en-GY":"en-001","en-HK":"en-001","en-IE":"en-001","en-IL":"en-001","en-IM":"en-001","en-IN":"en-001","en-IO":"en-001","en-JE":"en-001","en-JM":"en-001","en-KE":"en-001","en-KI":"en-001","en-KN":"en-001","en-KY":"en-001","en-LC":"en-001","en-LR":"en-001","en-LS":"en-001","en-MG":"en-001","en-MO":"en-001","en-MS":"en-001","en-MT":"en-001","en-MU":"en-001","en-MW":"en-001","en-MY":"en-001","en-NA":"en-001","en-NF":"en-001","en-NG":"en-001","en-NR":"en-001","en-NU":"en-001","en-NZ":"en-001","en-PG":"en-001","en-PH":"en-001","en-PK":"en-001","en-PN":"en-001","en-PW":"en-001","en-RW":"en-001","en-SB":"en-001","en-SC":"en-001","en-SD":"en-001","en-SG":"en-001","en-SH":"en-001","en-SL":"en-001","en-SS":"en-001","en-SX":"en-001","en-SZ":"en-001","en-TC":"en-001","en-TK":"en-001","en-TO":"en-001","en-TT":"en-001","en-TV":"en-001","en-TZ":"en-001","en-UG":"en-001","en-VC":"en-001","en-VG":"en-001","en-VU":"en-001","en-WS":"en-001","en-ZA":"en-001","en-ZM":"en-001","en-ZW":"en-001","en-AT":"en-150","en-BE":"en-150","en-CH":"en-150","en-DE":"en-150","en-DK":"en-150","en-FI":"en-150","en-NL":"en-150","en-SE":"en-150","en-SI":"en-150","es-AR":"es-419","es-BO":"es-419","es-BR":"es-419","es-BZ":"es-419","es-CL":"es-419","es-CO":"es-419","es-CR":"es-419","es-CU":"es-419","es-DO":"es-419","es-EC":"es-419","es-GT":"es-419","es-HN":"es-419","es-MX":"es-419","es-NI":"es-419","es-PA":"es-419","es-PE":"es-419","es-PR":"es-419","es-PY":"es-419","es-SV":"es-419","es-US":"es-419","es-UY":"es-419","es-VE":"es-419","pt-AO":"pt-PT","pt-CH":"pt-PT","pt-CV":"pt-PT","pt-FR":"pt-PT","pt-GQ":"pt-PT","pt-GW":"pt-PT","pt-LU":"pt-PT","pt-MO":"pt-PT","pt-MZ":"pt-PT","pt-ST":"pt-PT","pt-TL":"pt-PT","zh-Hant-MO":"zh-Hant-HK"};function E(A){var M=Intl.getCanonicalLocales;return"function"==typeof M?M(A):Intl.NumberFormat.supportedLocalesOf(A||"")}function j(A,M,D){if(void 0===D&&(D=Error),!A)throw new D(M)}function y(A){var M=function(A){return function(M,D){for(var I={locale:""},g=0,t=D;g2){var a=N.indexOf("-x-");if(-1===a)N+=T;else N=N.slice(0,a)+T+N.slice(a,N.length);N=E(N)[0]}return i.locale=N,i}}function o(A,M){j(2===M.length,"key must have 2 elements");var D=A.length,I="-"+M+"-",g=A.indexOf(I);if(-1!==g){for(var t=g+4,e=t,w=t,N=!1;!N;){var i=A.indexOf("-",w);2===(-1===i?D-w:i-w)?N=!0:-1===i?(e=D,N=!0):(e=i,w=i+1)}return A.slice(t,e)}if(I="-"+M,-1!==(g=A.indexOf(I))&&g+3===D)return""}var u=/-u(?:-[0-9a-z]{2,8})+/gi;function r(A,M){for(var D=M;;){if(~A.indexOf(D))return D;var I=D.lastIndexOf("-");if(!~I)return;I>=2&&"-"===D[I-2]&&(I-=2),D=D.slice(0,I)}}function C(A,M,D){var I=[A];M[A]&&(A=M[A],I.push(A));var g=D[A];g&&I.push(g);for(var t=A.split("-"),e=t.length;e>1;e--)I.push(t.slice(0,e-1).join("-"));return I}function Q(A,M){for(var D=[],I=0,g=M;I0&&void 0!==arguments[0]?arguments[0]:{},M=A.promiseTypeSuffixes||T,D=A.promiseTypeDelimiter||"_";return function(A){var I=A.dispatch;return function(A){return function(w){var N=void 0,i=void 0;if(!w.payload)return A(w);var T=w.payload;if(g(T))N=T;else if(g(T.promise))N=T.promise,i=T.data;else{if("function"!=typeof T&&"function"!=typeof T.promise)return A(w);if(N=T.promise?T.promise():T(),i=T.promise?T.data:void 0,!g(N))return A(e({},w,{payload:N}))}var n=w.type,c=w.meta,E=t(M,3),j=E[0],y=E[1],o=E[2],u=function(A,M){return e({type:[n,M?o:y].join(D)},null===A||void 0===A?{}:{payload:A},void 0!==c?{meta:c}:{},M?{error:!0}:{})};return A(e({type:[n,j].join(D)},void 0!==i?{payload:i}:{},void 0!==c?{meta:c}:{})),N.then(function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,M=u(A,!1);return I(M),{value:A,action:M}},function(A){var M=u(A,!0);throw I(M),A})}}}}},function(A,M,D){"use strict";D.r(M);var I=D(2),g=D.n(I),t=function(A,M){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,M){A.__proto__=M}||function(A,M){for(var D in M)M.hasOwnProperty(D)&&(A[D]=M[D])})(A,M)};function e(A,M){function D(){this.constructor=A}t(A,M),A.prototype=null===M?Object.create(M):(D.prototype=M.prototype,new D)}var w=function(){return(w=Object.assign||function(A){for(var M,D=1,I=arguments.length;D0&&g[g.length-1])&&(6===t[0]||2===t[0])){e=0;continue}if(3===t[0]&&(!g||t[1]>g[0]&&t[1]0)&&!(I=t.next()).done;)e.push(I.value)}catch(A){g={error:A}}finally{try{I&&!I.done&&(D=t.return)&&D.call(t)}finally{if(g)throw g.error}}return e}var n,c=D(13);D.d(M,"isSupported",function(){return p}),D.d(M,"registerMessaging",function(){return m});var E,j,y=((n={})["only-available-in-window"]="This method is available in a Window context.",n["only-available-in-sw"]="This method is available in a service worker context.",n["should-be-overriden"]="This method should be overriden by extended classes.",n["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",n["permission-default"]="The required permissions were not granted and dismissed instead.",n["permission-blocked"]="The required permissions were not granted and blocked instead.",n["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",n["notifications-blocked"]="Notifications have been blocked.",n["failed-serviceworker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",n["sw-registration-expected"]="A service worker registration was the expected input.",n["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",n["invalid-saved-token"]="Unable to access details of the saved token.",n["sw-reg-redundant"]="The service worker being used for push was made redundant.",n["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$message}",n["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",n["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",n["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$message}",n["token-update-failed"]="A problem occured while updating the user from FCM: {$message}",n["token-update-no-token"]="FCM returned no token when updating the user to push.",n["use-sw-before-get-token"]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",n["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",n["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",n["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",n["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",n["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",n["unable-to-resubscribe"]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",n["no-fcm-token-for-resubscribe"]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",n["failed-to-delete-token"]="Unable to delete the currently saved token.",n["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",n["incorrect-gcm-sender-id"]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",n["bad-scope"]="The service worker scope must be a string with at least one character.",n["bad-vapid-key"]="The public VAPID key is not a Uint8Array with 65 bytes.",n["bad-subscription"]="The subscription must be a valid PushSubscription.",n["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",n["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",n["failed-delete-vapid-key"]="The VAPID key could not be deleted.",n["invalid-public-vapid-key"]="The public VAPID key must be a string.",n["use-public-key-before-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",n["public-vapid-key-decryption-failed"]="The public VAPID key did not equal 65 bytes when decrypted.",n),o=new c.ErrorFactory("messaging","Messaging",y),u=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),r="https://fcm.googleapis.com"; +function R(A){A.INTERNAL.registerService("installations",function(A){return z(A),{app:A,getId:function(){return function(A){return N(this,void 0,void 0,function(){var M,D,I;return i(this,function(g){switch(g.label){case 0:return[4,F(z(A))];case 1:return M=g.sent(),D=M.installationEntry,(I=M.registrationPromise)&&I.catch(function(){}),[2,D.fid]}})})}(A)},getToken:function(){return G(A)},delete:function(){return function(A){return N(this,void 0,void 0,function(){var M,D;return i(this,function(I){switch(I.label){case 0:return[4,h(M=z(A),function(A){if(!A||0!==A.registrationStatus)return A})];case 1:if(!(D=I.sent()))return[3,6];if(1!==D.registrationStatus)return[3,2];throw C.create("delete-pending-registration");case 2:if(2!==D.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw C.create("app-offline");case 3:return[4,J(M,D)];case 4:return I.sent(),[4,l(M)];case 5:I.sent(),I.label=6;case 6:return[2]}})})}(A)}}})}R(g.a)},function(A,M,D){var I=D(409);"string"==typeof I&&(I=[[A.i,I,""]]);var g={insert:"head",singleton:!1};D(28)(I,g);I.locals&&(A.exports=I.locals)},function(A,M,D){(A.exports=D(21)(!1)).push([A.i,'.App {\n text-align: center;\n}\n.clear {\n clear: both;\n content: "";\n}\n.App-logo {\n animation: App-logo-spin infinite 20s linear;\n height: 80px;\n}\n\n.App-header {\n background-color: #222;\n height: 150px;\n padding: 20px;\n color: white;\n}\n\n.App-title {\n font-size: 1.5em;\n}\n\n.App-intro {\n font-size: large;\n}\n@keyframes App-logo-spin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n}\n',""])},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0});var I=function(){function A(A,M){for(var D=0;D0){var e=g.substring(0,t),w=g.substring(t+2);M[e]=w}}return M}Object.defineProperty(M,"__esModule",{value:!0}),M.responseToHeadersObject=I;var g=function(){function A(A,M,D){this.statusCode=A,this.headers=M,this.info=D}return A.fromXHR=function(M){var D=M.responseText;try{D=JSON.parse(M.responseText)}catch(A){}return new A(M.status,I(M.getAllResponseHeaders()),D)},A}();M.ErrorResponse=g;var t=function(A){this.error=A};M.NetworkError=t,function(A){A[A.UNSENT=0]="UNSENT",A[A.OPENED=1]="OPENED",A[A.HEADERS_RECIEVED=2]="HEADERS_RECIEVED",A[A.LOADING=3]="LOADING",A[A.DONE=4]="DONE"}(M.XhrReadyState||(M.XhrReadyState={}))},function(A,M,D){var I;Object.defineProperty(M,"__esModule",{value:!0}),function(A){A[A.VERBOSE=1]="VERBOSE",A[A.DEBUG=2]="DEBUG",A[A.INFO=3]="INFO",A[A.WARNING=4]="WARNING",A[A.ERROR=5]="ERROR"}(I=M.LogLevel||(M.LogLevel={}));var g=function(){function A(A){void 0===A&&(A=2),this.threshold=A;var M=Array(),D="--------------------------------------------------------------------------------";window.console.group||(window.console.group=function(A){M.push(A),window.console.log("%c \nBEGIN GROUP: %c",D,A)}),window.console.groupEnd||(window.console.groupEnd=function(){window.console.log("END GROUP: %c\n%c",M.pop(),D)})}return A.prototype.verbose=function(){for(var A=[],M=0;M=this.threshold){var t="Logger."+I[M];D.length>1?(window.console.group(),D.forEach(function(M){g.errorAwareLog(A,M,t)}),window.console.groupEnd()):this.errorAwareLog(A,D[0],t)}},A.prototype.errorAwareLog=function(A,M,D){if(void 0!==M&&M.info&&M.info.error_uri){var I=M.info.error_description;A((I||"An error has occurred")+". More information can be found at "+M.info.error_uri+". Error object: ",M)}else A(D+": ",M)},A}();M.ConsoleLogger=g;var t=function(){function A(){}return A.prototype.verbose=function(){for(var A=[],M=0;MD?D:2*A},initialTimeoutMillis:M,limit:I,maxTimeoutMillis:D}};var g=function(A){this.waitTimeMillis=A};M.Retry=g;var t=function(A){this.error=A};M.DoNotRetry=t;var e=function(){function A(A,M,D){this.options=A,this.logger=M,this.retryUnsafeRequests=D,this.currentRetryCount=0,this.initialTimeoutMillis=A.initialTimeoutMillis,this.maxTimeoutMillis=A.maxTimeoutMillis,this.limit=A.limit,this.increaseTimeoutFunction=A.increaseTimeout,this.currentBackoffMillis=this.initialTimeoutMillis}return A.prototype.attemptRetry=function(A){return this.logger.verbose(this.constructor.name+": Error recieved",A),this.currentRetryCount>=this.limit&&this.limit>=0?(this.logger.verbose(this.constructor.name+": Retry count is over the maximum limit: "+this.limit),new t(A)):A instanceof I.ErrorResponse&&A.headers["Retry-After"]?(this.logger.verbose(this.constructor.name+": Retry-After header is present, retrying in "+A.headers["Retry-After"]),new g(1e3*parseInt(A.headers["Retry-After"],10))):A instanceof I.NetworkError||A instanceof I.ErrorResponse&&("GET"===(M=(M=A.headers["Request-Method"]).toUpperCase())||"HEAD"===M||"OPTIONS"===M||"SUBSCRIBE"===M)||this.retryUnsafeRequests?this.shouldSafeRetry(A):A instanceof I.NetworkError?this.shouldSafeRetry(A):(this.logger.verbose(this.constructor.name+": Error is not retryable",A),new t(A));var M},A.prototype.shouldSafeRetry=function(A){return A instanceof I.NetworkError?(this.logger.verbose(this.constructor.name+": It's a Network Error, will retry",A),new g(this.calulateMillisToRetry())):A instanceof I.ErrorResponse&&A.statusCode>=500&&A.statusCode<600?(this.logger.verbose(this.constructor.name+": Error 5xx, will retry"),new g(this.calulateMillisToRetry())):(this.logger.verbose(this.constructor.name+": Error is not retryable",A),new t(A))},A.prototype.calulateMillisToRetry=function(){return this.currentBackoffMillis=this.increaseTimeoutFunction(this.currentBackoffMillis),this.logger.verbose(this.constructor.name+": Retrying in "+this.currentBackoffMillis+"ms"),this.currentBackoffMillis},A}();M.RetryResolution=e},function(A,M,D){var I=this&&this.__assign||Object.assign||function(A){for(var M,D=1,I=arguments.length;D=200&&A.status<300?M(A.response):0!==A.status?D(I.ErrorResponse.fromXHR(A)):D(new I.NetworkError("No Connection")))},A}M.executeNetworkRequest=function(A,M){return new Promise(function(D,I){!function(A,M){M.json?A.send(JSON.stringify(M.json)):A.send(M.body)}(g(A(),D,I),M)})},M.sendRawRequest=function(A){return new Promise(function(M,D){var I=g(new window.XMLHttpRequest,M,D);if(I.open(A.method.toUpperCase(),A.url,!0),A.headers)for(var t in A.headers)A.headers.hasOwnProperty(t)&&I.setRequestHeader(t,A.headers[t]);I.send(A.body)})}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0),g=D(2);M.createResumingStrategy=function(A,M,D,I){var e=g.createRetryStrategyOptionsOrDefault(A),w=new g.RetryResolution(e,D);return function(A,I){return new t(D,I,M,A,w)}};var t=function(A,M,D,I,g){var t=this;this.unsubscribe=function(){t.state.unsubscribe()},this.onTransition=function(A){t.state=A},this.state=new e(this.onTransition,A,M,D,I,g)},e=function(){function A(A,M,D,I,g,t,e){var i=this;this.onTransition=A,this.logger=M,this.headers=D,this.nextSubscribeStrategy=I,this.listeners=g,this.retryResolution=t,this.initialEventId=e;var n=e;M.verbose("ResumingSubscription: transitioning to OpeningSubscriptionState"),n&&(D["Last-Event-Id"]=n,M.verbose("ResumingSubscription: initialEventId is "+n)),this.underlyingSubscription=I({onEnd:function(D){A(new T(M,g,D))},onError:function(e){A(new N(e,A,M,D,g,I,t,n))},onEvent:function(A){n=A.eventId,g.onEvent(A)},onOpen:function(D){A(new w(M,D,g,i.underlyingSubscription,A))},onRetrying:g.onRetrying},D)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),this.underlyingSubscription.unsubscribe()},A}(),w=function(){function A(A,M,D,I,g){this.logger=A,this.headers=M,this.listeners=D,this.underlyingSubscription=I,this.onTransition=g,A.verbose("ResumingSubscription: transitioning to OpenSubscriptionState"),D.onOpen(M)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),this.underlyingSubscription.unsubscribe()},A}(),N=function(){function A(A,M,D,t,e,N,i,c){var E=this;this.onTransition=M,this.logger=D,this.headers=t,this.listeners=e,this.nextSubscribeStrategy=N,this.retryResolution=i,D.verbose("ResumingSubscription: transitioning to ResumingSubscriptionState");var j=function(A,t){e.onRetrying();var w,N=((w=A)instanceof I.ErrorResponse&&(w.headers["Request-Method"]="SUBSCRIBE"),i.attemptRetry(w));N instanceof g.Retry?E.timeout=window.setTimeout(function(){y(t)},N.waitTimeMillis):M(new n(D,e,A))},y=function(A){D.verbose("ResumingSubscription: trying to re-establish the subscription"),A&&(D.verbose("ResumingSubscription: lastEventId: "+A),t["Last-Event-Id"]=A),E.underlyingSubscription=N({onEnd:function(A){M(new T(D,e,A))},onError:function(A){j(A,c)},onEvent:function(A){c=A.eventId,e.onEvent(A)},onOpen:function(A){M(new w(D,A,e,E.underlyingSubscription,M))},onRetrying:e.onRetrying},t)};j(A,c)}return A.prototype.unsubscribe=function(){this.onTransition(new i(this.logger)),window.clearTimeout(this.timeout),this.underlyingSubscription.unsubscribe()},A}(),i=function(){function A(A,M){this.logger=A,A.verbose("ResumingSubscription: transitioning to EndingSubscriptionState")}return A.prototype.unsubscribe=function(){throw new Error("Subscription is already ending")},A}(),T=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("ResumingSubscription: transitioning to EndedSubscriptionState"),M.onEnd(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}(),n=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("ResumingSubscription: transitioning to FailedSubscriptionState",D),M.onError(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0),g=D(2);M.createRetryingStrategy=function(A,M,D){var I=g.createRetryStrategyOptionsOrDefault(A),e=new g.RetryResolution(I,D);return function(A,I){return new t(D,I,A,M,e)}};var t=function(A,M,D,I,g){var t=this;this.unsubscribe=function(){t.state.unsubscribe()},this.onTransition=function(A){t.state=A},this.state=new e(this.onTransition,A,M,D,I,g)},e=function(){function A(A,M,D,I,g,t){var e=this;this.logger=M,this.headers=D,this.listeners=I,this.nextSubscribeStrategy=g,this.retryResolution=t,M.verbose("RetryingSubscription: transitioning to OpeningSubscriptionState"),this.underlyingSubscription=g({onEnd:function(D){return A(new i(M,I,D))},onError:function(e){return A(new w(e,A,M,D,I,g,t))},onEvent:I.onEvent,onOpen:function(D){return A(new N(M,I,D,e.underlyingSubscription,A))},onRetrying:I.onRetrying},D)}return A.prototype.unsubscribe=function(){throw this.underlyingSubscription.unsubscribe(),new Error("Method not implemented.")},A}(),w=function(){function A(A,M,D,t,e,w,n){var c=this;this.onTransition=M,this.logger=D,this.headers=t,this.listeners=e,this.nextSubscribeStrategy=w,this.retryResolution=n,D.verbose("RetryingSubscription: transitioning to RetryingSubscriptionState");var E=function(A){e.onRetrying();var t,w=((t=A)instanceof I.ErrorResponse&&(t.headers["Request-Method"]="SUBSCRIBE"),n.attemptRetry(t));w instanceof g.Retry?c.timeout=window.setTimeout(function(){j()},w.waitTimeMillis):M(new T(D,e,A))},j=function(){D.verbose("RetryingSubscription: trying to re-establish the subscription");var A=w({onEnd:function(A){return M(new i(D,e,A))},onError:function(A){return E(A)},onEvent:e.onEvent,onOpen:function(I){M(new N(D,e,I,A,M))},onRetrying:e.onRetrying},t)};E(A)}return A.prototype.unsubscribe=function(){window.clearTimeout(this.timeout),this.onTransition(new i(this.logger,this.listeners))},A}(),N=function(){function A(A,M,D,I,g){this.logger=A,this.listeners=M,this.headers=D,this.underlyingSubscription=I,this.onTransition=g,A.verbose("RetryingSubscription: transitioning to OpenSubscriptionState"),M.onOpen(D)}return A.prototype.unsubscribe=function(){this.underlyingSubscription.unsubscribe(),this.onTransition(new i(this.logger,this.listeners))},A}(),i=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("RetryingSubscription: transitioning to EndedSubscriptionState"),M.onEnd(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}(),T=function(){function A(A,M,D){this.logger=A,this.listeners=M,A.verbose("RetryingSubscription: transitioning to FailedSubscriptionState",D),M.onError(D)}return A.prototype.unsubscribe=function(){throw new Error("Subscription has already ended")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(0);M.createTokenProvidingStrategy=function(A,M,D){return D?function(I,t){return new g(M,I,t,D,A)}:A};var g=function(){function A(A,M,D,I,g){var w=this;this.logger=A,this.listeners=M,this.headers=D,this.tokenProvider=I,this.nextSubscribeStrategy=g,this.unsubscribe=function(){w.state.unsubscribe(),w.state=new e(w.logger)},this.state=new t(A,D,g),this.subscribe()}return A.prototype.subscribe=function(){var A=this;this.tokenProvider.fetchToken().then(function(M){var D=Object.assign({},A.listeners);A.state.subscribe(M,{onEnd:function(M){A.state=new e(A.logger),D.onEnd(M)},onError:function(I){A.isTokenExpiredError(I)?(A.tokenProvider.clearToken(M),A.subscribe()):(A.state=new e(A.logger),D.onError(I))},onEvent:A.listeners.onEvent,onOpen:A.listeners.onOpen})}).catch(function(M){A.logger.debug("TokenProvidingSubscription: error when fetching token:",M),A.state=new e(A.logger),A.listeners.onError(M)})},A.prototype.isTokenExpiredError=function(A){return A instanceof I.ErrorResponse&&401===A.statusCode&&"authentication/expired"===A.info},A}(),t=function(){function A(A,M,D){this.logger=A,this.headers=M,this.nextSubscribeStrategy=D,A.verbose("TokenProvidingSubscription: transitioning to ActiveState")}return A.prototype.subscribe=function(A,M){var D=this;this.putTokenIntoHeader(A),this.underlyingSubscription=this.nextSubscribeStrategy({onEnd:function(A){D.logger.verbose("TokenProvidingSubscription: subscription ended"),M.onEnd(A)},onError:function(A){D.logger.verbose("TokenProvidingSubscription: subscription errored:",A),M.onError(A)},onEvent:M.onEvent,onOpen:function(A){D.logger.verbose("TokenProvidingSubscription: subscription opened"),M.onOpen(A)},onRetrying:M.onRetrying},this.headers)},A.prototype.unsubscribe=function(){this.underlyingSubscription.unsubscribe()},A.prototype.putTokenIntoHeader=function(A){this.headers.Authorization="Bearer "+A,this.logger.verbose("TokenProvidingSubscription: token fetched: "+A)},A}(),e=function(){function A(A){this.logger=A,A.verbose("TokenProvidingSubscription: transitioning to InactiveState")}return A.prototype.subscribe=function(A,M){this.logger.verbose("TokenProvidingSubscription: subscribe called in Inactive state; doing nothing")},A.prototype.unsubscribe=function(){this.logger.verbose("TokenProvidingSubscription: unsubscribe called in Inactive state; doing nothing")},A}()},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.createTransportStrategy=function(A,M,D){return function(D,I){return M.subscribe(A,D,I)}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.HOST_BASE="pusherplatform.io"},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(3);M.BaseClient=I.BaseClient;var g=D(9);M.HOST_BASE=g.HOST_BASE;var t=D(15);M.Instance=t.default;var e=D(1);M.ConsoleLogger=e.ConsoleLogger,M.EmptyLogger=e.EmptyLogger;var w=D(0);M.ErrorResponse=w.ErrorResponse,M.NetworkError=w.NetworkError,M.responseToHeadersObject=w.responseToHeadersObject,M.XhrReadyState=w.XhrReadyState;var N=D(4);M.executeNetworkRequest=N.executeNetworkRequest,M.sendRawRequest=N.sendRawRequest;var i=D(5);M.createResumingStrategy=i.createResumingStrategy;var T=D(2);M.createRetryStrategyOptionsOrDefault=T.createRetryStrategyOptionsOrDefault,M.DoNotRetry=T.DoNotRetry,M.Retry=T.Retry,M.RetryResolution=T.RetryResolution;var n=D(6);M.createRetryingStrategy=n.createRetryingStrategy;var c=D(7);M.createTokenProvidingStrategy=c.createTokenProvidingStrategy;var E=D(8);M.createTransportStrategy=E.createTransportStrategy,M.default={BaseClient:I.BaseClient,ConsoleLogger:e.ConsoleLogger,EmptyLogger:e.EmptyLogger,Instance:t.default}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.subscribeStrategyListenersFromSubscriptionListeners=function(A){return{onEnd:A.onEnd,onError:A.onError,onEvent:A.onEvent,onOpen:A.onOpen,onRetrying:A.onRetrying}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0}),M.replaceMissingListenersWithNoOps=function(A){return{onEnd:A.onEnd||function(A){},onError:A.onError||function(A){},onEvent:A.onEvent||function(A){},onOpen:A.onOpen||function(A){},onRetrying:A.onRetrying||function(){},onSubscribe:A.onSubscribe||function(){}}}},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I,g=D(0);!function(A){A[A.UNOPENED=0]="UNOPENED",A[A.OPENING=1]="OPENING",A[A.OPEN=2]="OPEN",A[A.ENDING=3]="ENDING",A[A.ENDED=4]="ENDED"}(I=M.HttpTransportState||(M.HttpTransportState={}));var t=function(){function A(A,M){var D=this;return this.gotEOS=!1,this.lastNewlineIndex=0,this.state=I.UNOPENED,this.xhr=A,this.listeners=M,this.xhr.onreadystatechange=function(){switch(D.xhr.readyState){case g.XhrReadyState.UNSENT:case g.XhrReadyState.OPENED:case g.XhrReadyState.HEADERS_RECIEVED:D.assertStateIsIn(I.OPENING);break;case g.XhrReadyState.LOADING:D.onLoading();break;case g.XhrReadyState.DONE:D.onDone()}},this.state=I.OPENING,this.xhr.send(),this}return A.prototype.unsubscribe=function(){this.state=I.ENDED,this.xhr.abort(),this.listeners.onEnd&&this.listeners.onEnd(null)},A.prototype.onLoading=function(){if(this.assertStateIsIn(I.OPENING,I.OPEN,I.ENDING),200===this.xhr.status){this.state===I.OPENING&&(this.state=I.OPEN,window.console.log(g.responseToHeadersObject(this.xhr.getAllResponseHeaders())),this.listeners.onOpen&&this.listeners.onOpen(g.responseToHeadersObject(this.xhr.getAllResponseHeaders()))),this.assertStateIsIn(I.OPEN);var A=this.onChunk();this.assertStateIsIn(I.OPEN,I.ENDING),A&&(this.state=I.ENDED,A instanceof g.ErrorResponse&&204!==A.statusCode&&this.listeners.onError&&this.listeners.onError(A))}},A.prototype.onDone=function(){if(200===this.xhr.status){this.state===I.OPENING&&(this.state=I.OPEN,this.listeners.onOpen&&this.listeners.onOpen(g.responseToHeadersObject(this.xhr.getAllResponseHeaders()))),this.assertStateIsIn(I.OPEN,I.ENDING);var A=this.onChunk();A?(this.state=I.ENDED,204===A.statusCode?this.listeners.onEnd&&this.listeners.onEnd(null):this.listeners.onError&&this.listeners.onError(A)):this.state<=I.ENDING?this.listeners.onError&&this.listeners.onError(new Error("HTTP response ended without receiving EOS message")):this.listeners.onEnd&&this.listeners.onEnd(null)}else{if(this.assertStateIsIn(I.OPENING,I.OPEN,I.ENDED),this.state===I.ENDED)return;0===this.xhr.status?this.listeners.onError&&this.listeners.onError(new g.NetworkError("Connection lost.")):this.listeners.onError&&this.listeners.onError(g.ErrorResponse.fromXHR(this.xhr))}},A.prototype.onChunk=function(){this.assertStateIsIn(I.OPEN);var A=this.xhr.responseText,M=A.lastIndexOf("\n");if(M>this.lastNewlineIndex){var D=A.slice(this.lastNewlineIndex,M).split("\n");this.lastNewlineIndex=M;for(var g=0,t=D;gM-A.lastMessageRecievedTimestamp||(A.sendMessage(A.getMessage(16,M)),A.lastSentPingID=M,A.pongTimeout=window.setTimeout(function(){1e4>(new Date).getTime()-A.lastMessageRecievedTimestamp?A.pongTimeout=null:A.close(new t.NetworkError("Pong response wasn't recieved until timeout."))},1e4))}},3e4)},this.socket.onmessage=function(M){return A.receiveMessage(M)},this.socket.onerror=function(M){A.close(new t.NetworkError("Connection was lost."))},this.socket.onclose=function(M){if(A.forcedClose){var D=A.closedError?function(M){M.listeners.onError&&M.listeners.onError(A.closedError)}:function(A){A.listeners.onEnd&&A.listeners.onEnd(null)},I=!1===A.pendingSubscriptions.isEmpty()?A.pendingSubscriptions:A.subscriptions;I.getAllAsArray().forEach(D),I.removeAll(),A.closedError&&A.tryReconnectIfNeeded()}else A.tryReconnectIfNeeded()}},A.prototype.close=function(A){this.socket instanceof window.WebSocket&&(this.forcedClose=!0,this.closedError=A,this.socket.close(),window.clearTimeout(this.pingInterval),window.clearTimeout(this.pongTimeout),delete this.pongTimeout,this.lastSentPingID=null)},A.prototype.tryReconnectIfNeeded=function(){this.socket.readyState===g.Closed&&this.connect()},A.prototype.subscribePending=function(A,M,D,I){void 0!==I?(this.subscriptions.add(I,A,M,D),this.sendMessage(this.getMessage(100,I,A,D))):window.console.logger.debug("Subscription to path "+A+" has an undefined ID")},A.prototype.getMessage=function(A,M,D,I){return[A,M,D,I]},A.prototype.sendMessage=function(A){if(this.socket.readyState!==g.Open)return window.console.warn("Can't send in \""+g[this.socket.readyState]+'" state');this.socket.send(JSON.stringify(A))},A.prototype.subscription=function(A){return this.subscriptions.get(A)},A.prototype.receiveMessage=function(A){var M;this.lastMessageRecievedTimestamp=(new Date).getTime();try{M=JSON.parse(A.data)}catch(M){return void this.close(new Error("Message is not valid JSON format. Getting "+A.data))}var D=this.validateMessage(M);if(D)this.close(new Error(D.message));else{var I=M.shift();switch(I){case 17:return void this.onPongMessage(M);case 16:return void this.onPingMessage(M);case 99:return void this.onCloseMessage(M)}var g=M.shift(),t=this.subscription(g);if(t){var e=t.listeners;switch(I){case 101:this.onOpenMessage(M,g,e);break;case 102:this.onEventMessage(M,e);break;case 199:this.onEOSMessage(M,g,e);break;default:this.close(new Error("Recieved non existing type of message."))}}else this.close(new Error('Recieved message for non existing subscription id: "'+g+'"'))}},A.prototype.validateMessage=function(A){return Array.isArray(A)?A.length<1?new Error("Message is empty array: "+JSON.stringify(A)):null:new Error("Message is expected to be an array. Getting: "+JSON.stringify(A))},A.prototype.onOpenMessage=function(A,M,D){D.onOpen&&D.onOpen(A[1])},A.prototype.onEventMessage=function(A,M){if(3!==A.length)return new Error("Event message has "+A.length+" elements (expected 4)");var D=A[0],I=A[1],g=A[2];return"string"!=typeof D?new Error("Invalid event ID in message: "+JSON.stringify(A)):"object"!=typeof I||Array.isArray(I)?new Error("Invalid event headers in message: "+JSON.stringify(A)):void(M.onEvent&&M.onEvent({eventId:D,headers:I,body:g}))},A.prototype.onEOSMessage=function(A,M,D){if(this.subscriptions.remove(M),3===A.length){var I=A[0],g=A[1],e=A[2];"number"==typeof I?"object"!=typeof g||Array.isArray(g)?D.onError&&D.onError(new Error("Invalid EOS ElementsHeaders")):204!==I?D.onError&&D.onError(new t.ErrorResponse(I,g,e)):D.onEnd&&D.onEnd(null):D.onError&&D.onError(new Error("Invalid EOS Status Code"))}else D.onError&&D.onError(new Error("EOS message has "+A.length+" elements (expected 4)"))},A.prototype.onCloseMessage=function(A){var M=A[0],D=A[1];return A[2],"number"!=typeof M?this.close(new Error("Close message: Invalid EOS Status Code")):"object"!=typeof D||Array.isArray(D)?this.close(new Error("Close message: Invalid EOS ElementsHeaders")):void this.close()},A.prototype.onPongMessage=function(A){var M=A[0];this.lastSentPingID!==M&&this.close(new t.NetworkError("Didn't recieved pong with proper ID")),window.clearTimeout(this.pongTimeout),delete this.pongTimeout,this.lastSentPingID=null},A.prototype.onPingMessage=function(A){var M=A[0];this.sendMessage(this.getMessage(17,M))},A}();M.default=N},function(A,M,D){Object.defineProperty(M,"__esModule",{value:!0});var I=D(3),g=D(9),t=D(1),e=function(){function A(A){if(!A.locator)throw new Error("Expected `locator` property in Instance options!");var M=A.locator.split(":");if(3!==M.length)throw new Error("The instance locator supplied is invalid. Did you copy it correctly from the Pusher dashboard?");if(!A.serviceName)throw new Error("Expected `serviceName` property in Instance options!");if(!A.serviceVersion)throw new Error("Expected `serviceVersion` property in Instance options!");this.platformVersion=M[0],this.cluster=M[1],this.id=M[2],this.serviceName=A.serviceName,this.serviceVersion=A.serviceVersion,this.host=A.host||this.cluster+"."+g.HOST_BASE,this.logger=A.logger||new t.ConsoleLogger,this.client=A.client||new I.BaseClient({encrypted:A.encrypted,host:this.host,logger:this.logger}),this.tokenProvider=A.tokenProvider}return A.prototype.request=function(A,M){return A.path=this.absPath(A.path),null!=A.headers&&void 0!==A.headers||(A.headers={}),A.tokenProvider=A.tokenProvider||this.tokenProvider,this.client.request(A,M)},A.prototype.subscribeNonResuming=function(A){var M=A.headers||{},D=A.retryStrategyOptions||{},I=A.tokenProvider||this.tokenProvider;return this.client.subscribeNonResuming(this.absPath(A.path),M,A.listeners,D,I)},A.prototype.subscribeResuming=function(A){var M=A.headers||{},D=A.retryStrategyOptions||{},I=A.tokenProvider||this.tokenProvider;return this.client.subscribeResuming(this.absPath(A.path),M,A.listeners,D,A.initialEventId,I)},A.prototype.absPath=function(A){return("/services/"+this.serviceName+"/"+this.serviceVersion+"/"+this.id+"/"+A).replace(/\/+/g,"/").replace(/\/+$/,"")},A}();M.default=e}])},A.exports=D()}(A={exports:{}}),A.exports);(D=I)&&D.__esModule&&Object.prototype.hasOwnProperty.call(D,"default")&&D.default;var g=I.BaseClient,t=I.HOST_BASE,e=I.Instance,w=I.sendRawRequest;function N(A){return null!=A&&"object"==typeof A&&!0===A["@@functional/placeholder"]}function i(A){return function M(D){return 0===arguments.length||N(D)?M:A.apply(this,arguments)}}function T(A){return function M(D,I){switch(arguments.length){case 0:return M;case 1:return N(D)?M:i(function(M){return A(D,M)});default:return N(D)&&N(I)?M:N(D)?i(function(M){return A(M,I)}):N(I)?i(function(M){return A(D,M)}):A(D,I)}}}function n(A,M){switch(A){case 0:return function(){return M.apply(this,arguments)};case 1:return function(A){return M.apply(this,arguments)};case 2:return function(A,D){return M.apply(this,arguments)};case 3:return function(A,D,I){return M.apply(this,arguments)};case 4:return function(A,D,I,g){return M.apply(this,arguments)};case 5:return function(A,D,I,g,t){return M.apply(this,arguments)};case 6:return function(A,D,I,g,t,e){return M.apply(this,arguments)};case 7:return function(A,D,I,g,t,e,w){return M.apply(this,arguments)};case 8:return function(A,D,I,g,t,e,w,N){return M.apply(this,arguments)};case 9:return function(A,D,I,g,t,e,w,N,i){return M.apply(this,arguments)};case 10:return function(A,D,I,g,t,e,w,N,i,T){return M.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function c(A,M,D){return function(){for(var I=[],g=0,t=A,e=0;e=arguments.length)?w=M[e]:(w=arguments[g],g+=1),I[e]=w,N(w)||(t-=1),e+=1}return t<=0?D.apply(this,I):n(t,c(A,I,D))}}var E=T(function(A,M){return 1===A?i(M):n(A,c(A,[],M))});function j(A){return function M(D,I,g){switch(arguments.length){case 0:return M;case 1:return N(D)?M:T(function(M,I){return A(D,M,I)});case 2:return N(D)&&N(I)?M:N(D)?T(function(M,D){return A(M,I,D)}):N(I)?T(function(M,I){return A(D,M,I)}):i(function(M){return A(D,I,M)});default:return N(D)&&N(I)&&N(g)?M:N(D)&&N(I)?T(function(M,D){return A(M,D,g)}):N(D)&&N(g)?T(function(M,D){return A(M,I,D)}):N(I)&&N(g)?T(function(M,I){return A(D,M,I)}):N(D)?i(function(M){return A(M,I,g)}):N(I)?i(function(M){return A(D,M,g)}):N(g)?i(function(M){return A(D,I,M)}):A(D,I,g)}}}var y=Array.isArray||function(A){return null!=A&&A.length>=0&&"[object Array]"===Object.prototype.toString.call(A)};function o(A,M,D){return function(){if(0===arguments.length)return D();var I=Array.prototype.slice.call(arguments,0),g=I.pop();if(!y(g)){for(var t=0;tA?M:A});function C(A,M){for(var D=0,I=M.length,g=Array(I);D0&&A.hasOwnProperty(0)&&A.hasOwnProperty(A.length-1))}),B=function(){function A(A){this.f=A}return A.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},A.prototype["@@transducer/result"]=function(A){return A},A.prototype["@@transducer/step"]=function(A,M){return this.f(A,M)},A}(),a=T(function(A,M){return n(A.length,function(){return A.apply(M,arguments)})});function L(A,M,D){for(var I=D.next();!I.done;){if((M=A["@@transducer/step"](M,I.value))&&M["@@transducer/reduced"]){M=M["@@transducer/value"];break}I=D.next()}return A["@@transducer/result"](M)}function s(A,M,D,I){return A["@@transducer/result"](D[I](a(A["@@transducer/step"],A),M))}var x="undefined"!=typeof Symbol?Symbol.iterator:"@@iterator";function O(A,M,D){if("function"==typeof A&&(A=function(A){return new B(A)}(A)),z(D))return function(A,M,D){for(var I=0,g=D.length;I=0;)k(M=d[D],A)&&!f(I,M)&&(I[I.length]=M),D-=1;return I}:function(A){return Object(A)!==A?[]:Object.keys(A)}),p=T(o(["fantasy-land/map","map"],S,function(A,M){switch(Object.prototype.toString.call(M)){case"[object Function]":return E(M.length,function(){return A.call(this,M.apply(this,arguments))});case"[object Object]":return O(function(D,I){return D[I]=A(M[I]),D},{},m(M));default:return C(A,M)}})),G=T(function(A,M){for(var D=M,I=0;I=0;){if(D[w]===A)return I[w]===M;w-=1}switch(e){case"Map":return A.size===M.size&&DA(A.entries(),M.entries(),D.concat([A]),I.concat([M]));case"Set":return A.size===M.size&&DA(A.values(),M.values(),D.concat([A]),I.concat([M]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var N=m(A);if(N.length!==m(M).length)return!1;var i=D.concat([A]),T=I.concat([M]);for(w=N.length-1;w>=0;){var n=N[w];if(!k(n,M)||!IA(M[n],A[n],i,T))return!1;w-=1}return!0}var gA=T(function(A,M){return IA(A,M,[],[])});function tA(A,M){return function(A,M,D){var I,g;if("function"==typeof A.indexOf)switch(typeof M){case"number":if(0===M){for(I=1/M;D=0}function eA(A){return'"'+A.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var wA=function(A){return(A<10?"0":"")+A},NA="function"==typeof Date.prototype.toISOString?function(A){return A.toISOString()}:function(A){return A.getUTCFullYear()+"-"+wA(A.getUTCMonth()+1)+"-"+wA(A.getUTCDate())+"T"+wA(A.getUTCHours())+":"+wA(A.getUTCMinutes())+":"+wA(A.getUTCSeconds())+"."+(A.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function iA(A){return"[object Object]"===Object.prototype.toString.call(A)}var TA=function(){function A(A,M){this.xf=M,this.f=A}return A.prototype["@@transducer/init"]=u.init,A.prototype["@@transducer/result"]=u.result,A.prototype["@@transducer/step"]=function(A,M){return this.f(M)?this.xf["@@transducer/step"](A,M):A},A}(),nA=T(o(["filter"],T(function(A,M){return new TA(A,M)}),function(A,M){return iA(M)?O(function(D,I){return A(M[I])&&(D[I]=M[I]),D},{},m(M)):function(A,M){for(var D=0,I=M.length,g=[];D":A(I,g)},g=function(A,M){return C(function(M){return eA(M)+": "+I(A[M])},M.slice().sort())};switch(Object.prototype.toString.call(M)){case"[object Arguments]":return"(function() { return arguments; }("+C(I,M).join(", ")+"))";case"[object Array]":return"["+C(I,M).concat(g(M,cA(function(A){return/^\d+$/.test(A)},m(M)))).join(", ")+"]";case"[object Boolean]":return"object"==typeof M?"new Boolean("+I(M.valueOf())+")":M.toString();case"[object Date]":return"new Date("+(isNaN(M.valueOf())?I(NaN):eA(NA(M)))+")";case"[object Null]":return"null";case"[object Number]":return"object"==typeof M?"new Number("+I(M.valueOf())+")":1/M==-1/0?"-0":M.toString(10);case"[object String]":return"object"==typeof M?"new String("+I(M.valueOf())+")":eA(M);case"[object Undefined]":return"undefined";default:if("function"==typeof M.toString){var t=M.toString();if("[object Object]"!==t)return t}return"{"+g(M,m(M)).join(", ")+"}"}}(A,[])}),jA=T(tA),yA=function(){function A(A,M,D,I){this.valueFn=A,this.valueAcc=M,this.keyFn=D,this.xf=I,this.inputs={}}return A.prototype["@@transducer/init"]=u.init,A.prototype["@@transducer/result"]=function(A){var M;for(M in this.inputs)if(k(M,this.inputs)&&(A=this.xf["@@transducer/step"](A,this.inputs[M]))["@@transducer/reduced"]){A=A["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](A)},A.prototype["@@transducer/step"]=function(A,M){var D=this.keyFn(M);return this.inputs[D]=this.inputs[D]||[D,this.valueAcc],this.inputs[D][1]=this.valueFn(this.inputs[D][1],M),A},A}(),oA=c(4,[],o([],c(4,[],function(A,M,D,I){return new yA(A,M,D,I)}),function(A,M,D,I){return O(function(I,g){var t=D(g);return I[t]=A(k(t,I)?I[t]:M,g),I},{},I)})),uA=T(function(A,M){for(var D=[],I=0,g=A.length;I=0||Object.prototype.hasOwnProperty.call(A,I)&&(D[I]=A[I]);return D},RA=function(A,M){if(Array.isArray(A))return A;if(Symbol.iterator in Object(A))return function(A,M){var D=[],I=!0,g=!1,t=void 0;try{for(var e,w=A[Symbol.iterator]();!(I=(e=w.next()).done)&&(D.push(e.value),!M||D.length!==M);I=!0);}catch(A){g=!0,t=A}finally{try{!I&&w.return&&w.return()}finally{if(g)throw t}}return D}(A,M);throw new TypeError("Invalid attempt to destructure non-iterable instance")},vA=K(nA(function(A){return void 0!==A}),mA,p(function(A){var M=RA(A,2),D=M[0],I=M[1];return D+"="+encodeURIComponent(I)}),lA("&")),WA=function(A,M){return M+(jA("?",M)?"&":"?")+vA(A)},PA=K(fA("&"),p(fA("=")),BA),VA=function(A,M,D){var I=void 0===D?"undefined":pA(D);if(I!==M)throw new TypeError("expected "+A+" to be of type "+M+" but was of type "+I)},XA=function(A,M,D){VA(A,"object",D),zA(function(A,D){return VA(D,M,A)},D)},ZA=function(){return Math.floor(Date.now()/1e3)},KA=function(A){return{createdAt:A.created_at,createdByUserId:A.created_by_id,deletedAt:A.deletedAt,id:A.id,isPrivate:A.private,name:A.name,updatedAt:A.updated_at,userIds:A.member_user_ids}},_A=function(A){return{avatarURL:A.avatar_url,createdAt:A.created_at,customData:A.custom_data,id:A.id,name:A.name,updatedAt:A.updated_at}},qA=function(A){return{lastSeenAt:A.last_seen_at,state:jA(A.state,["online","offline"])?A.state:"unknown",userId:A.user_id}},$A=function(A){return{id:A.id,senderId:A.user_id,roomId:A.room_id,text:A.text,createdAt:A.created_at,updatedAt:A.updated_at,attachment:A.attachment&&DM(A.attachment)}},AM=function(A){return{file:{name:A.file.name,bytes:A.file.bytes,lastModified:A.file.last_modified},link:A.resource_link,ttl:A.ttl}},MM=function(A){return{position:A.position,updatedAt:A.updated_at,userId:A.user_id,roomId:A.room_id,type:A.cursor_type}},DM=function(A){return{link:A.resource_link,type:A.type,fetchRequired:"true"===(M=A.resource_link,jA("?",M)?PA(fA("?",M)[1]):{}).chatkit_link};var M},IM=function A(){var M=this;GA(this,A),this.pendingSets=[],this.pendingGets=[],this.initialize=function(A){M.store=A,QA(function(A){var D=A.key,I=A.value;(0,A.resolve)(M.store[D]=I)},M.pendingSets),QA(function(A){var D=A.key;(0,A.resolve)(M.store[D])},M.pendingGets)},this.set=function(A,D){return M.store?Promise.resolve(M.store[A]=D):new Promise(function(I){M.pendingSets.push({key:A,value:D,resolve:I})})},this.get=function(A){return M.store?Promise.resolve(M.store[A]):new Promise(function(D){M.pendingGets.push({key:A,resolve:D})})},this.pop=function(A){return M.get(A).then(function(D){return delete M.store[A],D})},this.update=function(A,D){return M.get(A).then(function(I){return M.set(A,D(I))})},this.snapshot=function(){return M.store||{}},this.getSync=function(A){return M.store?M.store[A]:void 0}},gM=function(){function A(M,D){GA(this,A),this.avatarURL=M.avatarURL,this.createdAt=M.createdAt,this.customData=M.customData,this.id=M.id,this.name=M.name,this.updatedAt=M.updatedAt,this.presenceStore=D}return HA(A,[{key:"presence",get:function(){return this.presenceStore.getSync(this.id)||{lastSeenAt:void 0,state:"unknown",userId:this.id}}}]),A}(),tM=function A(M){var D=this,I=M.instance,g=M.presenceStore,t=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=function(A,M){return D.store.set(A,D.decorate(M))},this.get=function(A){return Promise.all([D.fetchUser(A),D.presenceStore.get(A)]).then(function(A){var M=RA(A,2),D=M[0];return M[1],D})},this.fetchUser=function(A){return D.fetchMissingUsers([A]).then(function(){return D.store.get(A)})},this.fetchMissingUsers=function(A){var M=uA(A,p(H("id"),R(D.store.snapshot()))),I=uA(M,m(D.reqs));return hA(I)>0&&D.fetchBasicUsers(I),Promise.all(R(dA(A,D.reqs)))},this.fetchBasicUsers=function(A){var M=D.instance.request({method:"GET",path:WA({user_ids:lA(",",A)},"/users_by_ids")}).then(function(M){var I=p(_A,JSON.parse(M));return QA(function(A){return D.set(A.id,A)},I),QA(function(A){delete D.reqs[A]},A),I}).catch(function(A){throw D.logger.warn("error fetching missing users:",A),A});QA(function(A){D.reqs[A]=M},A)},this.snapshot=this.store.snapshot,this.getSync=this.store.getSync,this.decorate=function(A){return A?new gM(A,D.presenceStore):void 0},this.instance=I,this.presenceStore=g,this.logger=t,this.reqs={}},eM=function(){function A(M,D){GA(this,A),this.createdAt=M.createdAt,this.createdByUserId=M.createdByUserId,this.deletedAt=M.deletedAt,this.id=M.id,this.isPrivate=M.isPrivate,this.name=M.name,this.updatedAt=M.updatedAt,this.userIds=M.userIds,this.userStore=D}return HA(A,[{key:"users",get:function(){var A=this;return nA(function(M){return jA(M.id,A.userIds)},R(this.userStore.snapshot()))}}]),A}(),wM=function A(M){var D=this,I=M.instance,g=M.userStore,t=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=v(function(A,M){return D.store.set(A,D.decorate(M)).then(function(A){return D.userStore.fetchMissingUsers(A.userIds).then(function(){return A})})}),this.get=function(A){return D.store.get(A).then(function(M){return M||D.fetchBasicRoom(A).then(D.set(A))})},this.pop=this.store.pop,this.addUserToRoom=function(A,M){return D.store.update(A,function(A){return A.userIds=SA(J(M,A.userIds)),A})},this.removeUserFromRoom=function(A,M){return D.store.update(A,function(A){return A.userIds=nA(function(A){return A!==M},A.userIds),A})},this.update=function(A,M){return D.store.update(A,function(A){return A.createdAt=M.createdAt||A.createdAt,A.createdByUserId=M.createdByUserId||A.createdByUserId,A.deletedAt=M.deletedAt||A.deletedAt,A.id=M.id||A.id,A.isPrivate=M.isPrivate||A.isPrivate,A.name=M.name||A.name,A.updatedAt=M.updatedAt||A.updatedAt,A.userIds=M.userIds||A.userIds,A})},this.fetchBasicRoom=function(A){return D.instance.request({method:"GET",path:"/rooms/"+A}).then(K(JSON.parse,KA)).catch(function(M){D.logger.warn("error fetching details for room "+A+":",M)})},this.snapshot=this.store.snapshot,this.getSync=this.store.getSync,this.decorate=function(A){return A?new eM(A,D.userStore):void 0},this.instance=I,this.userStore=g,this.logger=t},NM=function(){function A(M,D,I){GA(this,A),this.position=M.position,this.updatedAt=M.updatedAt,this.userId=M.userId,this.roomId=M.roomId,this.type=M.type,this.userStore=D,this.roomStore=I}return HA(A,[{key:"user",get:function(){return this.userStore.getSync(this.userId)}},{key:"room",get:function(){return this.roomStore.getSync(this.roomId)}}]),A}(),iM=function A(M){var D=this,I=M.instance,g=M.userStore,t=M.roomStore,e=M.logger;GA(this,A),this.store=new IM,this.initialize=function(A){D.store.initialize(p(D.decorate,A))},this.set=function(A,M,I){return D.store.set(TM(A,M),D.decorate(I))},this.get=function(A,M){return D.store.get(TM(A,M)).then(function(I){return I||D.fetchBasicCursor(A,M).then(function(I){return D.set(A,M,I)})})},this.getSync=function(A,M){return D.store.getSync(TM(A,M))},this.fetchBasicCursor=function(A,M){return D.instance.request({method:"GET",path:"/cursors/0/rooms/"+M+"/users/"+encodeURIComponent(A)}).then(function(A){var M=JSON.parse(A);if(M)return MM(M)}).catch(function(A){throw D.logger.warn("error fetching cursor:",A),A})},this.decorate=function(A){return A?new NM(A,D.userStore,D.roomStore):void 0},this.instance=I,this.userStore=g,this.roomStore=t,this.logger=e},TM=function(A,M){return A+"/"+M},nM=function A(M){var D=this,I=M.hooks,g=M.userId,t=M.instance,e=M.logger;GA(this,A),this.sendThrottledRequest=function(A){var M=Date.now(),I=D.lastSentRequests[A];return I&&M-I<1e3?Promise.resolve():(D.lastSentRequests[A]=M,D.instance.request({method:"POST",path:"/rooms/"+A+"/events",json:{name:"typing_start",user_id:D.userId}}).catch(function(M){throw delete D.typingRequestSent[A],D.logger.warn("Error sending is_typing event in room "+A,M),M}))},this.onIsTyping=function(A,M){D.timers[A.id]||(D.timers[A.id]={}),D.timers[A.id][M.id]?clearTimeout(D.timers[A.id][M.id]):D.onStarted(A,M),D.timers[A.id][M.id]=setTimeout(function(){D.onStopped(A,M),delete D.timers[A.id][M.id]},1500)},this.onStarted=function(A,M){D.hooks.global.onUserStartedTyping&&D.hooks.global.onUserStartedTyping(A,M),D.hooks.rooms[A.id]&&D.hooks.rooms[A.id].onUserStartedTyping&&D.hooks.rooms[A.id].onUserStartedTyping(M)},this.onStopped=function(A,M){D.hooks.global.onUserStoppedTyping&&D.hooks.global.onUserStoppedTyping(A,M),D.hooks.rooms[A.id]&&D.hooks.rooms[A.id].onUserStoppedTyping&&D.hooks.rooms[A.id].onUserStoppedTyping(M)},this.hooks=I,this.userId=g,this.instance=t,this.logger=e,this.lastSentRequests={},this.timers={}},cM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"added_to_room":D.onAddedToRoom(M.data);break;case"removed_from_room":D.onRemovedFromRoom(M.data);break;case"user_joined":D.onUserJoined(M.data);break;case"user_left":D.onUserLeft(M.data);break;case"room_updated":D.onRoomUpdated(M.data);break;case"room_deleted":D.onRoomDeleted(M.data);break;case"typing_start":D.onIsTyping(M.data)}},this.onInitialState=function(A){var M=A.current_user,I=A.rooms;D.onSubscriptionEstablished({user:_A(M),basicRooms:p(KA,I)})},this.onAddedToRoom=function(A){var M=A.room,I=KA(M);D.roomStore.set(I.id,I).then(function(A){D.hooks.global.onAddedToRoom&&D.hooks.global.onAddedToRoom(A)})},this.onRemovedFromRoom=function(A){var M=A.room_id;D.roomStore.pop(M).then(function(A){A&&D.hooks.global.onRemovedFromRoom&&D.hooks.global.onRemovedFromRoom(A)})},this.onUserJoined=function(A){var M=A.room_id,I=A.user_id;D.roomStore.addUserToRoom(M,I).then(function(A){D.userStore.get(I).then(function(I){D.hooks.global.onUserJoinedRoom&&D.hooks.global.onUserJoinedRoom(A,I),D.hooks.rooms[M]&&D.hooks.rooms[M].onUserJoined&&D.hooks.rooms[M].onUserJoined(I)})})},this.onUserLeft=function(A){var M=A.room_id,I=A.user_id;D.roomStore.removeUserFromRoom(M,I).then(function(A){D.userStore.get(I).then(function(I){D.hooks.global.onUserLeftRoom&&D.hooks.global.onUserLeftRoom(A,I),D.hooks.rooms[M]&&D.hooks.rooms[M].onUserLeft&&D.hooks.rooms[M].onUserLeft(I)})})},this.onRoomUpdated=function(A){var M=A.room,I=KA(M);D.roomStore.update(I.id,I).then(function(A){D.hooks.global.onRoomUpdated&&D.hooks.global.onRoomUpdated(A)})},this.onRoomDeleted=function(A){var M=A.room_id;D.roomStore.pop(M).then(function(A){A&&D.hooks.global.onRoomDeleted&&D.hooks.global.onRoomDeleted(A)})},this.onIsTyping=function(A){var M=A.room_id,I=A.user_id;Promise.all([D.roomStore.get(M),D.userStore.get(I)]).then(function(A){var M=RA(A,2),I=M[0],g=M[1];return D.typingIndicators.onIsTyping(I,g)})},this.userId=M.userId,this.hooks=M.hooks,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.typingIndicators=M.typingIndicators,this.roomSubscriptions=M.roomSubscriptions,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("user subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:"/users",listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling user subscription",A)}}}]),A}(),EM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"presence_update":D.onPresenceUpdate(M.data);break;case"join_room_presence_update":D.onJoinRoomPresenceUpdate(M.data)}},this.onInitialState=function(A){var M=A.user_states;D.presenceStore.initialize(xA(H("userId"),p(qA,M))),D.onSubscriptionEstablished()},this.onPresenceUpdate=function(A){var M=qA(A);D.presenceStore.set(M.userId,M).then(function(A){return D.userStore.get(A.userId).then(function(M){switch(A.state){case"online":D.onCameOnline(M);break;case"offline":D.onWentOffline(M)}})})},this.onJoinRoomPresenceUpdate=function(A){var M=A.user_states;return QA(function(A){return D.presenceStore.set(A.userId,A)},p(qA,M))},this.onCameOnline=function(A){return D.callRelevantHooks("onUserCameOnline",A)},this.onWentOffline=function(A){return D.callRelevantHooks("onUserWentOffline",A)},this.callRelevantHooks=function(A,M){D.hooks.global[A]&&D.hooks.global[A](M),q(QA(function(I){var g=RA(I,2),t=g[0],e=g[1];return D.roomStore.get(t).then(function(D){jA(M.id,D.userIds)&&e[A](M)})}),nA(function(M){var D=RA(M,2);return D[0],void 0!==D[1][A]}),mA)(D.hooks.rooms)},this.userId=M.userId,this.hooks=M.hooks,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.presenceStore=M.presenceStore,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("presence subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:"/users/"+encodeURIComponent(A.userId)+"/presence",listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling presence subscription",A)}}}]),A}(),jM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"initial_state":D.onInitialState(M.data);break;case"new_cursor":D.onNewCursor(M.data)}},this.onInitialState=function(A){var M=A.cursors;q(QA(function(A){return D.cursorStore.set(A.userId,A.roomId,A)}),p(MM))(M),D.onSubscriptionEstablished()},this.onNewCursor=function(A){var M=MM(A);D.cursorStore.set(M.userId,M.roomId,M).then(function(){D.cursorStore.get(M.userId,M.roomId).then(D.onNewCursorHook)})},this.onNewCursorHook=M.onNewCursorHook,this.path=M.path,this.cursorStore=M.cursorStore,this.instance=M.instance,this.logger=M.logger,this.connectionTimeout=M.connectionTimeout}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.timeout=setTimeout(function(){D(new Error("cursor subscription timed out"))},A.connectionTimeout),A.onSubscriptionEstablished=function(D){clearTimeout(A.timeout),M(D)},A.sub=A.instance.subscribeNonResuming({path:A.path,listeners:{onError:function(M){clearTimeout(A.timeout),D(M)},onEvent:A.onEvent}})})}},{key:"cancel",value:function(){clearTimeout(this.timeout);try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling cursor subscription",A)}}}]),A}(),yM=function(){function A(M,D,I){GA(this,A),this.id=M.id,this.senderId=M.senderId,this.roomId=M.roomId,this.text=M.text,this.attachment=M.attachment,this.createdAt=M.createdAt,this.updatedAt=M.updatedAt,this.userStore=D,this.roomStore=I}return HA(A,[{key:"sender",get:function(){return this.userStore.getSync(this.senderId)}},{key:"room",get:function(){return this.roomStore.getSync(this.roomId)}}]),A}(),oM=function(){function A(M){var D=this;GA(this,A),this.onEvent=function(A){var M=A.body;switch(M.event_name){case"new_message":D.onNewMessage(M.data)}},this.onNewMessage=function(A){var M={message:new yM($A(A),D.userStore,D.roomStore),ready:!1};D.messageBuffer.push(M),D.userStore.fetchMissingUsers([M.message.senderId]).catch(function(A){D.logger.error("error fetching missing user information:",A)}).then(function(){M.ready=!0,D.flushBuffer()})},this.flushBuffer=function(){for(;!UA(D.messageBuffer)&&LA(D.messageBuffer).ready;){var A=D.messageBuffer.shift().message;D.hooks.rooms[D.roomId]&&D.hooks.rooms[D.roomId].onNewMessage&&D.hooks.rooms[D.roomId].onNewMessage(A)}},this.roomId=M.roomId,this.hooks=M.hooks,this.messageLimit=M.messageLimit,this.userId=M.userId,this.instance=M.instance,this.userStore=M.userStore,this.roomStore=M.roomStore,this.messageBuffer=[],this.logger=M.logger}return HA(A,[{key:"connect",value:function(){var A=this;return new Promise(function(M,D){A.sub=A.instance.subscribeResuming({path:"/rooms/"+A.roomId+"?"+vA({message_limit:A.messageLimit}),listeners:{onOpen:M,onError:D,onEvent:A.onEvent}})})}},{key:"cancel",value:function(){try{this.sub&&this.sub.unsubscribe()}catch(A){this.logger.debug("error when cancelling message subscription",A)}}}]),A}(),uM=function(){function A(M){var D=M.messageSub,I=M.cursorSub;GA(this,A),this.messageSub=D,this.cursorSub=I}return HA(A,[{key:"cancel",value:function(){this.messageSub.cancel(),this.cursorSub.cancel()}}]),A}(),rM=function(){function A(M){var D=M.apiInstance,I=M.connectionTimeout,g=M.cursorsInstance,t=M.filesInstance,e=M.hooks,w=M.id,N=M.presenceInstance;GA(this,A),CM.call(this),this.hooks={global:e,rooms:{}},this.id=w,this.encodedId=encodeURIComponent(this.id),this.apiInstance=D,this.filesInstance=t,this.cursorsInstance=g,this.connectionTimeout=I,this.presenceInstance=N,this.logger=D.logger,this.presenceStore=new IM,this.userStore=new tM({instance:this.apiInstance,presenceStore:this.presenceStore,logger:this.logger}),this.roomStore=new wM({instance:this.apiInstance,userStore:this.userStore,logger:this.logger}),this.cursorStore=new iM({instance:this.cursorsInstance,userStore:this.userStore,roomStore:this.roomStore,logger:this.logger}),this.typingIndicators=new nM({hooks:this.hooks,userId:this.id,instance:this.apiInstance,logger:this.logger}),this.roomSubscriptions={},this.readCursorBuffer={}}return HA(A,[{key:"rooms",get:function(){return R(this.roomStore.snapshot())}},{key:"users",get:function(){return R(this.userStore.snapshot())}}]),A}(),CM=function(){var A=this;this.setReadCursor=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.position;return VA("roomId","number",D),VA("position","number",I),new Promise(function(M,g){void 0!==A.readCursorBuffer[D]?(A.readCursorBuffer[D].position=r(A.readCursorBuffer[D].position,I),A.readCursorBuffer[D].callbacks.push({resolve:M,reject:g})):(A.readCursorBuffer[D]={position:I,callbacks:[{resolve:M,reject:g}]},setTimeout(function(){A.setReadCursorRequest(bA({roomId:D},A.readCursorBuffer[D])),delete A.readCursorBuffer[D]},500))})},this.readCursor=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.userId,g=void 0===I?A.id:I;if(VA("roomId","number",D),VA("userId","string",g),g!==A.id&&!aA(D,A.roomSubscriptions)){var t=new TypeError("Must be subscribed to room "+D+" to access member's read cursors");throw A.logger.error(t),t}return A.cursorStore.getSync(g,D)},this.isTypingIn=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.typingIndicators.sendThrottledRequest(M)},this.createRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.name,I=M.addUserIds,g=JA(M,["name","addUserIds"]);return D&&VA("name","string",D),I&&function(A,M,D){if(!Array.isArray(D))throw new TypeError("expected "+A+" to be an array");D.forEach(function(M,D){return VA(A+"["+D+"]","string",M)})}("addUserIds",0,I),A.apiInstance.request({method:"POST",path:"/rooms",json:{created_by_id:A.id,name:D,private:!!g.private,user_ids:I}}).then(function(M){var D=KA(JSON.parse(M));return A.roomStore.set(D.id,D)}).catch(function(M){throw A.logger.warn("error creating room:",M),M})},this.getJoinableRooms=function(){return A.apiInstance.request({method:"GET",path:"/users/"+A.encodedId+"/rooms?joinable=true"}).then(K(JSON.parse,p(KA))).catch(function(M){throw A.logger.warn("error getting joinable rooms:",M),M})},this.joinRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.isMemberOf(M)?A.roomStore.get(M):A.apiInstance.request({method:"POST",path:"/users/"+A.encodedId+"/rooms/"+M+"/join"}).then(function(M){var D=KA(JSON.parse(M));return A.roomStore.set(D.id,D)}).catch(function(D){throw A.logger.warn("error joining room "+M+":",D),D})},this.leaveRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.roomStore.get(M).then(function(D){return A.apiInstance.request({method:"POST",path:"/users/"+A.encodedId+"/rooms/"+M+"/leave"}).then(function(){return A.roomStore.pop(M)}).then(function(){return D})}).catch(function(D){throw A.logger.warn("error leaving room "+M+":",D),D})},this.addUserToRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.userId,I=M.roomId;return VA("userId","string",D),VA("roomId","number",I),A.apiInstance.request({method:"PUT",path:"/rooms/"+I+"/users/add",json:{user_ids:[D]}}).then(function(){return A.roomStore.addUserToRoom(I,D)}).catch(function(M){throw A.logger.warn("error adding user "+D+" to room "+I+":",M),M})},this.removeUserFromRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.userId,I=M.roomId;return VA("userId","string",D),VA("roomId","number",I),A.apiInstance.request({method:"PUT",path:"/rooms/"+I+"/users/remove",json:{user_ids:[D]}}).then(function(){return A.roomStore.removeUserFromRoom(I,D)}).catch(function(M){throw A.logger.warn("error removing user "+D+" from room "+I+":",M),M})},this.sendMessage=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.text,I=M.roomId,g=M.attachment;return VA("text","string",D),VA("roomId","number",I),new Promise(function(M,D){void 0!==g&&QM(g)?M(A.uploadDataAttachment(I,g)):void 0!==g&&zM(g)?M({resource_link:g.link,type:g.type}):void 0!==g?D(new TypeError("attachment was malformed")):M()}).then(function(M){return A.apiInstance.request({method:"POST",path:"/rooms/"+I+"/messages",json:{text:D,attachment:M}})}).then(K(JSON.parse,H("message_id"))).catch(function(M){throw A.logger.warn("error sending message to room "+I+":",M),M})},this.fetchMessages=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.initialId,g=M.limit,t=M.direction;return VA("roomId","number",D),I&&VA("initialId","number",I),g&&VA("limit","number",g),t&&function(A,M,D){if(!jA(D,M))throw new TypeError("expected direction to be one of "+M+" but was "+D)}(0,["older","newer"],t),A.apiInstance.request({method:"GET",path:"/rooms/"+D+"/messages?"+vA({initial_id:I,limit:g,direction:t})}).then(function(M){var D=p(q(A.decorateMessage,$A),JSON.parse(M));return A.userStore.fetchMissingUsers(SA(p(H("senderId"),D))).then(function(){return FA(function(A,M){return A.id-M.id},D)})}).catch(function(M){throw A.logger.warn("error fetching messages from room "+D+":",M),M})},this.subscribeToRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.hooks,g=void 0===I?{}:I,t=M.messageLimit;return VA("roomId","number",D),XA("hooks","function",g),t&&VA("messageLimit","number",t),A.roomSubscriptions[D]&&A.roomSubscriptions[D].cancel(),A.hooks.rooms[D]=g,A.roomSubscriptions[D]=new uM({messageSub:new oM({roomId:D,hooks:A.hooks,messageLimit:t,userId:A.id,instance:A.apiInstance,userStore:A.userStore,roomStore:A.roomStore,logger:A.logger}),cursorSub:new jM({onNewCursorHook:function(M){A.hooks.rooms[D]&&A.hooks.rooms[D].onNewReadCursor&&0===M.type&&M.userId!==A.id&&A.hooks.rooms[D].onNewReadCursor(M)},path:"/cursors/0/rooms/"+D,cursorStore:A.cursorStore,instance:A.cursorsInstance,logger:A.logger,connectionTimeout:A.connectionTimeout})}),A.joinRoom({roomId:D}).then(function(M){return Promise.all([A.roomSubscriptions[D].messageSub.connect(),A.roomSubscriptions[D].cursorSub.connect()]).then(function(){return M})}).catch(function(M){throw A.logger.warn("error subscribing to room "+D+":",M),M})},this.fetchAttachment=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).url;return A.filesInstance.tokenProvider.fetchToken().then(function(A){return w({method:"GET",headers:{Authorization:"Bearer "+A},url:M})}).then(K(JSON.parse,AM)).catch(function(M){throw A.logger.warn("error fetching attachment:",M),M})},this.updateRoom=function(){var M=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},D=M.roomId,I=M.name,g=JA(M,["roomId","name"]);return VA("roomId","number",D),I&&VA("name","string",I),g.private&&VA("private","boolean",g.private),A.apiInstance.request({method:"PUT",path:"/rooms/"+D,json:{name:I,private:g.private}}).then(function(){}).catch(function(M){throw A.logger.warn("error updating room:",M),M})},this.deleteRoom=function(){var M=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).roomId;return VA("roomId","number",M),A.apiInstance.request({method:"DELETE",path:"/rooms/"+M}).then(function(){}).catch(function(M){throw A.logger.warn("error deleting room:",M),M})},this.setReadCursorRequest=function(M){var D=M.roomId,I=M.position,g=M.callbacks;return A.cursorsInstance.request({method:"PUT",path:"/cursors/0/rooms/"+D+"/users/"+A.encodedId,json:{position:I}}).then(function(){return p(function(A){return A.resolve()},g)}).catch(function(M){A.logger.warn("error setting cursor:",M),p(function(A){return A.reject(M)},g)})},this.uploadDataAttachment=function(M,D){var I=D.file,g=D.name,t=new FormData;return t.append("file",I,g),A.filesInstance.request({method:"POST",path:"/rooms/"+M+"/users/"+A.encodedId+"/files/"+g,body:t}).then(JSON.parse)},this.isMemberOf=function(M){return jA(M,p(H("id"),A.rooms))},this.decorateMessage=function(M){return new yM(M,A.userStore,A.roomStore)},this.establishUserSubscription=function(){return A.userSubscription=new cM({hooks:A.hooks,userId:A.id,instance:A.apiInstance,userStore:A.userStore,roomStore:A.roomStore,typingIndicators:A.typingIndicators,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.userSubscription.connect().then(function(M){var D=M.user,I=M.basicRooms;A.avatarURL=D.avatarURL,A.createdAt=D.createdAt,A.customData=D.customData,A.name=D.name,A.updatedAt=D.updatedAt,A.roomStore.initialize(xA(H("id"),I))}).then(A.initializeUserStore).catch(function(M){throw A.logger.error("error establishing user subscription:",M),M})},this.establishPresenceSubscription=function(){return A.presenceSubscription=new EM({hooks:A.hooks,userId:A.id,instance:A.presenceInstance,userStore:A.userStore,roomStore:A.roomStore,presenceStore:A.presenceStore,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.presenceSubscription.connect().catch(function(M){throw A.logger.error("error establishing presence subscription:",M),M})},this.establishCursorSubscription=function(){return A.cursorSubscription=new jM({onNewCursorHook:function(M){A.hooks.global.onNewReadCursor&&0===M.type&&A.isMemberOf(M.roomId)&&A.hooks.global.onNewReadCursor(M)},path:"/cursors/0/users/"+A.encodedId,cursorStore:A.cursorStore,instance:A.cursorsInstance,logger:A.logger,connectionTimeout:A.connectionTimeout}),A.cursorSubscription.connect().then(function(){return A.cursorStore.initialize({})}).catch(function(M){throw A.logger.error("error establishing cursor subscription:",M),M})},this.initializeUserStore=function(){return A.userStore.fetchMissingUsers(SA(W(H("userIds"),A.rooms))).catch(function(M){A.logger.warn("error fetching initial user information:",M)}).then(function(){return A.userStore.initialize({})})},this.disconnect=function(){A.userSubscription.cancel(),A.presenceSubscription.cancel(),A.cursorSubscription.cancel(),zA(function(A){return A.cancel()},A.roomSubscriptions)}},QM=function(A){var M=A.file,D=A.name;return void 0!==M&&void 0!==D&&(VA("attachment.file","object",M),VA("attachment.name","string",D),!0)},zM=function(A){var M=A.link,D=A.type;return void 0!==M&&void 0!==D&&(VA("attachment.link","string",M),VA("attachment.type","string",D),!0)};return{TokenProvider:function A(){var M=this,D=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},I=D.url,g=D.queryParams,t=D.headers;GA(this,A),this.fetchToken=function(){return M.cacheIsStale()?(M.req||M.fetchFreshToken()).then(function(A){var D=A.token,I=A.expiresIn;return M.cache(D,I),D}):Promise.resolve(M.cachedToken)},this.fetchFreshToken=function(){return M.req=w({method:"POST",url:WA(bA({user_id:M.userId},M.queryParams),M.url),body:vA({grant_type:"client_credentials"}),headers:bA({"content-type":"application/x-www-form-urlencoded"},M.headers)}).then(function(A){var D=JSON.parse(A),I=D.access_token,g=D.expires_in;return delete M.req,{token:I,expiresIn:g}}).catch(function(A){throw delete M.req,A}),M.req},this.cacheIsStale=function(){return!M.cachedToken||ZA()>M.cacheExpiresAt},this.cache=function(A,D){M.cachedToken=A,M.cacheExpiresAt=ZA()+D},this.clearCache=function(){M.cachedToken=void 0,M.cacheExpiresAt=void 0},this.setUserId=function(A){M.clearCache(),M.userId=A},VA("url","string",I),g&&VA("queryParams","object",g),t&&VA("headers","object",t),this.url=I,this.queryParams=g,this.headers=t},ChatManager:function A(){var M=this,D=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},I=D.instanceLocator,w=D.tokenProvider,N=D.userId,i=JA(D,["instanceLocator","tokenProvider","userId"]);GA(this,A),this.connect=function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};XA("hooks","function",A);var D=new rM({hooks:A,id:M.userId,apiInstance:M.apiInstance,filesInstance:M.filesInstance,cursorsInstance:M.cursorsInstance,presenceInstance:M.presenceInstance,connectionTimeout:M.connectionTimeout});return Promise.all([D.establishUserSubscription(),D.establishPresenceSubscription(),D.establishCursorSubscription()]).then(function(){return M.currentUser=D,D})},this.disconnect=function(){M.currentUser&&M.currentUser.disconnect()},VA("instanceLocator","string",I),VA("tokenProvider","object",w),VA("tokenProvider.fetchToken","function",w.fetchToken),VA("userId","string",N);var T=fA(":",I)[1];if(void 0===T)throw new TypeError("expected instanceLocator to be of the format x:y:z, but was "+I);var n=i.baseClient||new g({host:T+"."+t,logger:i.logger,sdkProduct:"chatkit",sdkVersion:"0.7.17"});"function"==typeof w.setUserId&&w.setUserId(N);var c={client:n,locator:I,logger:i.logger,tokenProvider:w};this.apiInstance=new e(bA({serviceName:"chatkit",serviceVersion:"v1"},c)),this.filesInstance=new e(bA({serviceName:"chatkit_files",serviceVersion:"v1"},c)),this.cursorsInstance=new e(bA({serviceName:"chatkit_cursors",serviceVersion:"v1"},c)),this.presenceInstance=new e(bA({serviceName:"chatkit_presence",serviceVersion:"v1"},c)),this.userId=N,this.connectionTimeout=i.connectionTimeout||1e4}}}()}).call(this,D(11))},function(A,M,D){var I=D(418);"string"==typeof I&&(I=[[A.i,I,""]]);var g={insert:"head",singleton:!1};D(28)(I,g);I.locals&&(A.exports=I.locals)},function(A,M,D){(A.exports=D(21)(!1)).push([A.i,"",""])},function(A,M,D){"use strict";Object.defineProperty(M,"__esModule",{value:!0});var I=Object.assign||function(A){for(var M=1;M0?"playlist":"hidden"},A.showCourses=function(M){var D=A.state,I=D.videos,g=D.courses,t=D.linkStyle,w=I,N=g[M],i=w[M];return e.default.createElement("div",{key:M},e.default.createElement("div",{onClick:A.addToPlaylist,id:i,title:N,className:t},N),e.default.createElement("div",{className:"clear"}))},A.videoSource=function(){var M=A.state.playlist,D=Object.keys(M).length;if(0===D&&void 0!==M&&null!==M)return"https://www.youtube.com/embed/gfkTfcpWqAY";if(D>=1){for(var I=Object.values(M),g=I.length,t=1,e=I[0]+"?enablejsapi=1&playlist=";t0)return{value:Math.round(u),unit:"year"};var r=12*u+y.getMonth()-o.getMonth();if(Math.round(Math.abs(r))>0)return{value:Math.round(r),unit:"month"};var C=n/N;return{value:Math.round(C),unit:"week"}}var T={second:45,minute:45,hour:22,day:5},n={"aa-SAAHO":"ssy",aam:"aas",aar:"aa",abk:"ab",adp:"dz",afr:"af",aju:"jrb",aka:"ak",alb:"sq",als:"sq",amh:"am",ara:"ar",arb:"ar",arg:"an",arm:"hy","art-lojban":"jbo",asm:"as",aue:"ktz",ava:"av",ave:"ae",aym:"ay",ayr:"ay",ayx:"nun","az-AZ":"az-Latn-AZ",aze:"az",azj:"az",bak:"ba",bam:"bm",baq:"eu",bcc:"bal",bcl:"bik",bel:"be",ben:"bn",bgm:"bcg",bh:"bho",bih:"bho",bis:"bi",bjd:"drl",bod:"bo",bos:"bs",bre:"br","bs-BA":"bs-Latn-BA",bul:"bg",bur:"my",bxk:"luy",bxr:"bua",cat:"ca",ccq:"rki","cel-gaulish":"xtg-x-cel-gaulish",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cjr:"mom",cka:"cmr",cld:"syr",cmk:"xch",cmn:"zh",cnr:"sr-ME",cor:"kw",cos:"co",coy:"pij",cqu:"quh",cre:"cr",cwd:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",dgo:"doi",dhd:"mwr",dik:"din",diq:"zza",div:"dv",drh:"mn",drw:"fa-af",dut:"nl",dzo:"dz",ekk:"et",ell:"el",emk:"man",eng:"en",epo:"eo",esk:"ik",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fat:"ak",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",fuc:"ff",ful:"ff",gav:"dev",gaz:"om",gbo:"grb",geo:"ka",ger:"de",gfx:"vaj",ggn:"gvr",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gno:"gon",gre:"el",grn:"gn",gti:"nyc",gug:"gn",guj:"gu",guv:"duz",gya:"gba","ha-Latn-GH":"ha-GH","ha-Latn-NE":"ha-NE","ha-Latn-NG":"ha-NG",hat:"ht",hau:"ha",hbs:"sr-Latn",hdn:"hai",hea:"hmn",heb:"he",her:"hz",him:"srx",hin:"hi",hmo:"ho",hrr:"jal",hrv:"hr",hun:"hu",hye:"hy","i-ami":"ami","i-bnn":"bnn","i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","i-default":"en-x-i-default","i-enochian":"und-x-i-enochian","i-mingo":"see-x-i-mingo",ibi:"opa",ibo:"ig",ice:"is",ido:"io",iii:"ii",ike:"iu",iku:"iu",ile:"ie",ilw:"gal",in:"id",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",iw:"he",jav:"jv",jeg:"oyb",ji:"yi",jpn:"ja",jw:"jv",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",kgc:"tdf",kgh:"kml",khk:"mn",khm:"km",kik:"ki",kin:"rw",kir:"ky","kk-Cyrl-KZ":"kk-KZ",kmr:"ku",knc:"kr",kng:"kg",knn:"kok",koj:"kwv",kom:"kv",kon:"kg",kor:"ko",kpv:"kv",krm:"bmf","ks-Arab-IN":"ks-IN",ktr:"dtp",kua:"kj",kur:"ku",kvs:"gdj",kwq:"yam",kxe:"tvd","ky-Cyrl-KG":"ky-KG",kzj:"dtp",kzt:"dtp",lao:"lo",lat:"la",lav:"lv",lbk:"bnc",lii:"raq",lim:"li",lin:"ln",lit:"lt",lmm:"rmx",ltz:"lb",lub:"lu",lug:"lg",lvs:"lv",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",meg:"cir",mhr:"chm",mkd:"mk",mlg:"mg",mlt:"mt","mn-Cyrl-MN":"mn-MN",mnk:"man",mo:"ro",mol:"ro",mon:"mn",mri:"mi","ms-Latn-BN":"ms-BN","ms-Latn-MY":"ms-MY","ms-Latn-SG":"ms-SG",msa:"ms",mst:"mry",mup:"raj",mwj:"vaj",mya:"my",myt:"mry",nad:"xny",nau:"na",nav:"nv",nbl:"nr",ncp:"kdz",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nnx:"ngv",no:"nb","no-bok":"nb","no-BOKMAL":"nb","no-nyn":"nn","no-NYNORSK":"nn",nob:"nb",nor:"nb",npi:"ne",nts:"pij",nya:"ny",oci:"oc",ojg:"oj",oji:"oj",ori:"or",orm:"om",ory:"or",oss:"os",oun:"vaj","pa-IN":"pa-Guru-IN","pa-PK":"pa-Arab-PK",pan:"pa",pbu:"ps",pcr:"adx",per:"fa",pes:"fa",pli:"pi",plt:"mg",pmc:"huw",pmu:"phr",pnb:"lah",pol:"pl",por:"pt",ppa:"bfy",ppr:"lcq",prs:"fa-AF",pry:"prt",pus:"ps",puz:"pub",que:"qu",quz:"qu",rmy:"rom",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sca:"hle",scc:"sr",scr:"hr","sgn-BE-FR":"sfb","sgn-BE-NL":"vgt","sgn-CH-DE":"sgg",sh:"sr-Latn","shi-MA":"shi-Tfng-MA",sin:"si",skk:"oyb",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",spy:"kln",sqi:"sq","sr-BA":"sr-Cyrl-BA","sr-ME":"sr-Latn-ME","sr-RS":"sr-Cyrl-RS","sr-XK":"sr-Cyrl-XK",src:"sc",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swc:"sw-CD",swe:"sv",swh:"sw",tah:"ty",tam:"ta",tat:"tt",tdu:"dtp",tel:"te",tgk:"tg",tgl:"fil",tha:"th",thc:"tpo",thx:"oyb",tib:"bo",tie:"ras",tir:"ti",tkk:"twm",tl:"fil",tlw:"weo",tmp:"tyj",tne:"kak",tnf:"fa-af",ton:"to",tsf:"taj",tsn:"tn",tso:"ts",ttq:"tmh",tuk:"tk",tur:"tr",tw:"ak",twi:"ak","tzm-Latn-MA":"tzm-MA","ug-Arab-CN":"ug-CN",uig:"ug",ukr:"uk",umu:"del",uok:"ema",urd:"ur","uz-AF":"uz-Arab-AF","uz-UZ":"uz-Latn-UZ",uzb:"uz",uzn:"uz","vai-LR":"vai-Vaii-LR",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xba:"cax",xho:"xh",xia:"acn",xkh:"waw",xpe:"kpe",xsj:"suj",xsl:"den",ybd:"rki",ydd:"yi",yid:"yi",yma:"lrr",ymt:"mtm",yor:"yo",yos:"zom","yue-CN":"yue-Hans-CN","yue-HK":"yue-Hant-HK",yuu:"yug",zai:"zap","zh-CN":"zh-Hans-CN","zh-guoyu":"zh","zh-hakka":"hak","zh-HK":"zh-Hant-HK","zh-min-nan":"nan","zh-MO":"zh-Hant-MO","zh-SG":"zh-Hans-SG","zh-TW":"zh-Hant-TW","zh-xiang":"hsn","zh-min":"nan-x-zh-min",zha:"za",zho:"zh",zsm:"ms",zul:"zu",zyb:"za"},c={"en-150":"en-001","en-AG":"en-001","en-AI":"en-001","en-AU":"en-001","en-BB":"en-001","en-BM":"en-001","en-BS":"en-001","en-BW":"en-001","en-BZ":"en-001","en-CA":"en-001","en-CC":"en-001","en-CK":"en-001","en-CM":"en-001","en-CX":"en-001","en-CY":"en-001","en-DG":"en-001","en-DM":"en-001","en-ER":"en-001","en-FJ":"en-001","en-FK":"en-001","en-FM":"en-001","en-GB":"en-001","en-GD":"en-001","en-GG":"en-001","en-GH":"en-001","en-GI":"en-001","en-GM":"en-001","en-GY":"en-001","en-HK":"en-001","en-IE":"en-001","en-IL":"en-001","en-IM":"en-001","en-IN":"en-001","en-IO":"en-001","en-JE":"en-001","en-JM":"en-001","en-KE":"en-001","en-KI":"en-001","en-KN":"en-001","en-KY":"en-001","en-LC":"en-001","en-LR":"en-001","en-LS":"en-001","en-MG":"en-001","en-MO":"en-001","en-MS":"en-001","en-MT":"en-001","en-MU":"en-001","en-MW":"en-001","en-MY":"en-001","en-NA":"en-001","en-NF":"en-001","en-NG":"en-001","en-NR":"en-001","en-NU":"en-001","en-NZ":"en-001","en-PG":"en-001","en-PH":"en-001","en-PK":"en-001","en-PN":"en-001","en-PW":"en-001","en-RW":"en-001","en-SB":"en-001","en-SC":"en-001","en-SD":"en-001","en-SG":"en-001","en-SH":"en-001","en-SL":"en-001","en-SS":"en-001","en-SX":"en-001","en-SZ":"en-001","en-TC":"en-001","en-TK":"en-001","en-TO":"en-001","en-TT":"en-001","en-TV":"en-001","en-TZ":"en-001","en-UG":"en-001","en-VC":"en-001","en-VG":"en-001","en-VU":"en-001","en-WS":"en-001","en-ZA":"en-001","en-ZM":"en-001","en-ZW":"en-001","en-AT":"en-150","en-BE":"en-150","en-CH":"en-150","en-DE":"en-150","en-DK":"en-150","en-FI":"en-150","en-NL":"en-150","en-SE":"en-150","en-SI":"en-150","es-AR":"es-419","es-BO":"es-419","es-BR":"es-419","es-BZ":"es-419","es-CL":"es-419","es-CO":"es-419","es-CR":"es-419","es-CU":"es-419","es-DO":"es-419","es-EC":"es-419","es-GT":"es-419","es-HN":"es-419","es-MX":"es-419","es-NI":"es-419","es-PA":"es-419","es-PE":"es-419","es-PR":"es-419","es-PY":"es-419","es-SV":"es-419","es-US":"es-419","es-UY":"es-419","es-VE":"es-419","pt-AO":"pt-PT","pt-CH":"pt-PT","pt-CV":"pt-PT","pt-FR":"pt-PT","pt-GQ":"pt-PT","pt-GW":"pt-PT","pt-LU":"pt-PT","pt-MO":"pt-PT","pt-MZ":"pt-PT","pt-ST":"pt-PT","pt-TL":"pt-PT","zh-Hant-MO":"zh-Hant-HK"};function E(A){var M=Intl.getCanonicalLocales;return"function"==typeof M?M(A):Intl.NumberFormat.supportedLocalesOf(A||"")}function j(A,M,D){if(void 0===D&&(D=Error),!A)throw new D(M)}function y(A){var M=function(A){return function(M,D){for(var I={locale:""},g=0,t=D;g2){var a=N.indexOf("-x-");if(-1===a)N+=T;else N=N.slice(0,a)+T+N.slice(a,N.length);N=E(N)[0]}return i.locale=N,i}}function o(A,M){j(2===M.length,"key must have 2 elements");var D=A.length,I="-"+M+"-",g=A.indexOf(I);if(-1!==g){for(var t=g+4,e=t,w=t,N=!1;!N;){var i=A.indexOf("-",w);2===(-1===i?D-w:i-w)?N=!0:-1===i?(e=D,N=!0):(e=i,w=i+1)}return A.slice(t,e)}if(I="-"+M,-1!==(g=A.indexOf(I))&&g+3===D)return""}var u=/-u(?:-[0-9a-z]{2,8})+/gi;function r(A,M){for(var D=M;;){if(~A.indexOf(D))return D;var I=D.lastIndexOf("-");if(!~I)return;I>=2&&"-"===D[I-2]&&(I-=2),D=D.slice(0,I)}}function C(A,M,D){var I=[A];M[A]&&(A=M[A],I.push(A));var g=D[A];g&&I.push(g);for(var t=A.split("-"),e=t.length;e>1;e--)I.push(t.slice(0,e-1).join("-"));return I}function Q(A,M){for(var D=[],I=0,g=M;I0&&void 0!==arguments[0]?arguments[0]:{},M=A.promiseTypeSuffixes||T,D=A.promiseTypeDelimiter||"_";return function(A){var I=A.dispatch;return function(A){return function(w){var N=void 0,i=void 0;if(!w.payload)return A(w);var T=w.payload;if(g(T))N=T;else if(g(T.promise))N=T.promise,i=T.data;else{if("function"!=typeof T&&"function"!=typeof T.promise)return A(w);if(N=T.promise?T.promise():T(),i=T.promise?T.data:void 0,!g(N))return A(e({},w,{payload:N}))}var n=w.type,c=w.meta,E=t(M,3),j=E[0],y=E[1],o=E[2],u=function(A,M){return e({type:[n,M?o:y].join(D)},null===A||void 0===A?{}:{payload:A},void 0!==c?{meta:c}:{},M?{error:!0}:{})};return A(e({type:[n,j].join(D)},void 0!==i?{payload:i}:{},void 0!==c?{meta:c}:{})),N.then(function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,M=u(A,!1);return I(M),{value:A,action:M}},function(A){var M=u(A,!0);throw I(M),A})}}}}},function(A,M,D){"use strict";D.r(M);var I=D(2),g=D.n(I),t=function(A,M){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,M){A.__proto__=M}||function(A,M){for(var D in M)M.hasOwnProperty(D)&&(A[D]=M[D])})(A,M)};function e(A,M){function D(){this.constructor=A}t(A,M),A.prototype=null===M?Object.create(M):(D.prototype=M.prototype,new D)}var w=function(){return(w=Object.assign||function(A){for(var M,D=1,I=arguments.length;D0&&g[g.length-1])&&(6===t[0]||2===t[0])){e=0;continue}if(3===t[0]&&(!g||t[1]>g[0]&&t[1]0)&&!(I=t.next()).done;)e.push(I.value)}catch(A){g={error:A}}finally{try{I&&!I.done&&(D=t.return)&&D.call(t)}finally{if(g)throw g.error}}return e}var n,c=D(13);D.d(M,"isSupported",function(){return p}),D.d(M,"registerMessaging",function(){return m});var E,j,y=((n={})["only-available-in-window"]="This method is available in a Window context.",n["only-available-in-sw"]="This method is available in a service worker context.",n["should-be-overriden"]="This method should be overriden by extended classes.",n["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",n["permission-default"]="The required permissions were not granted and dismissed instead.",n["permission-blocked"]="The required permissions were not granted and blocked instead.",n["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",n["notifications-blocked"]="Notifications have been blocked.",n["failed-serviceworker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",n["sw-registration-expected"]="A service worker registration was the expected input.",n["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",n["invalid-saved-token"]="Unable to access details of the saved token.",n["sw-reg-redundant"]="The service worker being used for push was made redundant.",n["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$message}",n["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",n["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",n["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$message}",n["token-update-failed"]="A problem occured while updating the user from FCM: {$message}",n["token-update-no-token"]="FCM returned no token when updating the user to push.",n["use-sw-before-get-token"]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",n["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",n["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",n["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",n["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",n["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",n["unable-to-resubscribe"]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",n["no-fcm-token-for-resubscribe"]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",n["failed-to-delete-token"]="Unable to delete the currently saved token.",n["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",n["incorrect-gcm-sender-id"]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",n["bad-scope"]="The service worker scope must be a string with at least one character.",n["bad-vapid-key"]="The public VAPID key is not a Uint8Array with 65 bytes.",n["bad-subscription"]="The subscription must be a valid PushSubscription.",n["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",n["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",n["failed-delete-vapid-key"]="The VAPID key could not be deleted.",n["invalid-public-vapid-key"]="The public VAPID key must be a string.",n["use-public-key-before-get-token"]="The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used.",n["public-vapid-key-decryption-failed"]="The public VAPID key did not equal 65 bytes when decrypted.",n),o=new c.ErrorFactory("messaging","Messaging",y),u=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),r="https://fcm.googleapis.com"; /** * @license * Copyright 2018 Google Inc. @@ -2302,7 +2302,7 @@ function C(A,M){if(null==A||null==M)return!1;if(A===M)return!0;if(A.byteLength!= * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */!function(A){A.TYPE_OF_MSG="firebase-messaging-msg-type",A.DATA="firebase-messaging-msg-data"}(E||(E={})),function(A){A.PUSH_MSG_RECEIVED="push-msg-received",A.NOTIFICATION_CLICKED="notification-clicked"}(j||(j={}));var B=function(){function A(){}return A.prototype.getToken=function(A,M,D){return N(this,void 0,void 0,function(){var I,g,t,e,w,N,T,n;return i(this,function(i){switch(i.label){case 0:I=z(M.getKey("p256dh")),g=z(M.getKey("auth")),t="authorized_entity="+A+"&endpoint="+M.endpoint+"&encryption_key="+I+"&encryption_auth="+g,C(D.buffer,u.buffer)||(e=z(D),t+="&application_pub_key="+e),(w=new Headers).append("Content-Type","application/x-www-form-urlencoded"),N={method:"POST",headers:w,body:t},i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/subscribe",N)];case 2:return[4,i.sent().json()];case 3:return T=i.sent(),[3,5];case 4:throw i.sent(),o.create("token-subscribe-failed");case 5:if(T.error)throw n=T.error.message,o.create("token-subscribe-failed",{message:n});if(!T.token)throw o.create("token-subscribe-no-token");if(!T.pushSet)throw o.create("token-subscribe-no-push-set");return[2,{token:T.token,pushSet:T.pushSet}]}})})},A.prototype.updateToken=function(A,M,D,I,g){return N(this,void 0,void 0,function(){var t,e,w,N,T,n,c,E;return i(this,function(i){switch(i.label){case 0:t=z(I.getKey("p256dh")),e=z(I.getKey("auth")),w="push_set="+D+"&token="+M+"&authorized_entity="+A+"&endpoint="+I.endpoint+"&encryption_key="+t+"&encryption_auth="+e,C(g.buffer,u.buffer)||(N=z(g),w+="&application_pub_key="+N),(T=new Headers).append("Content-Type","application/x-www-form-urlencoded"),n={method:"POST",headers:T,body:w},i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/subscribe",n)];case 2:return[4,i.sent().json()];case 3:return c=i.sent(),[3,5];case 4:throw i.sent(),o.create("token-update-failed");case 5:if(c.error)throw E=c.error.message,o.create("token-update-failed",{message:E});if(!c.token)throw o.create("token-update-no-token");return[2,c.token]}})})},A.prototype.deleteToken=function(A,M,D){return N(this,void 0,void 0,function(){var I,g,t,e,w;return i(this,function(N){switch(N.label){case 0:I="authorized_entity="+A+"&token="+M+"&pushSet="+D,(g=new Headers).append("Content-Type","application/x-www-form-urlencoded"),t={method:"POST",headers:g,body:I},N.label=1;case 1:return N.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/unsubscribe",t)];case 2:return[4,N.sent().json()];case 3:if((e=N.sent()).error)throw w=e.error.message,o.create("token-unsubscribe-failed",{message:w});return[3,5];case 4:throw N.sent(),o.create("token-unsubscribe-failed");case 5:return[2]}})})},A}(); + */!function(A){A.TYPE_OF_MSG="firebase-messaging-msg-type",A.DATA="firebase-messaging-msg-data"}(E||(E={})),function(A){A.PUSH_MSG_RECIEVED="push-msg-recieved",A.NOTIFICATION_CLICKED="notification-clicked"}(j||(j={}));var B=function(){function A(){}return A.prototype.getToken=function(A,M,D){return N(this,void 0,void 0,function(){var I,g,t,e,w,N,T,n;return i(this,function(i){switch(i.label){case 0:I=z(M.getKey("p256dh")),g=z(M.getKey("auth")),t="authorized_entity="+A+"&endpoint="+M.endpoint+"&encryption_key="+I+"&encryption_auth="+g,C(D.buffer,u.buffer)||(e=z(D),t+="&application_pub_key="+e),(w=new Headers).append("Content-Type","application/x-www-form-urlencoded"),N={method:"POST",headers:w,body:t},i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/subscribe",N)];case 2:return[4,i.sent().json()];case 3:return T=i.sent(),[3,5];case 4:throw i.sent(),o.create("token-subscribe-failed");case 5:if(T.error)throw n=T.error.message,o.create("token-subscribe-failed",{message:n});if(!T.token)throw o.create("token-subscribe-no-token");if(!T.pushSet)throw o.create("token-subscribe-no-push-set");return[2,{token:T.token,pushSet:T.pushSet}]}})})},A.prototype.updateToken=function(A,M,D,I,g){return N(this,void 0,void 0,function(){var t,e,w,N,T,n,c,E;return i(this,function(i){switch(i.label){case 0:t=z(I.getKey("p256dh")),e=z(I.getKey("auth")),w="push_set="+D+"&token="+M+"&authorized_entity="+A+"&endpoint="+I.endpoint+"&encryption_key="+t+"&encryption_auth="+e,C(g.buffer,u.buffer)||(N=z(g),w+="&application_pub_key="+N),(T=new Headers).append("Content-Type","application/x-www-form-urlencoded"),n={method:"POST",headers:T,body:w},i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/subscribe",n)];case 2:return[4,i.sent().json()];case 3:return c=i.sent(),[3,5];case 4:throw i.sent(),o.create("token-update-failed");case 5:if(c.error)throw E=c.error.message,o.create("token-update-failed",{message:E});if(!c.token)throw o.create("token-update-no-token");return[2,c.token]}})})},A.prototype.deleteToken=function(A,M,D){return N(this,void 0,void 0,function(){var I,g,t,e,w;return i(this,function(N){switch(N.label){case 0:I="authorized_entity="+A+"&token="+M+"&pushSet="+D,(g=new Headers).append("Content-Type","application/x-www-form-urlencoded"),t={method:"POST",headers:g,body:I},N.label=1;case 1:return N.trys.push([1,4,,5]),[4,fetch(r+"/fcm/connect/unsubscribe",t)];case 2:return[4,N.sent().json()];case 3:if((e=N.sent()).error)throw w=e.error.message,o.create("token-unsubscribe-failed",{message:w});return[3,5];case 4:throw N.sent(),o.create("token-unsubscribe-failed");case 5:return[2]}})})},A}(); /** * @license * Copyright 2017 Google Inc. @@ -2398,7 +2398,7 @@ function C(A,M){if(null==A||null==M)return!1;if(A===M)return!0;if(A.byteLength!= * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - */(M,D,I)?Date.now()e&&console.warn("This browser only supports "+e+" actions.The remaining actions will not be displayed."),[2,g.showNotification(I,D)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(M)]:[3,5];case 4:return w.sent(),[2];case 5:return[2]}})})},M.prototype.onSubChange_=function(A){return N(this,void 0,void 0,function(){var A,M,D,I;return i(this,function(g){switch(g.label){case 0:return g.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return A=g.sent(),[3,3];case 2:throw M=g.sent(),o.create("unable-to-resubscribe",{message:M});case 3:return g.trys.push([3,5,,8]),[4,A.pushManager.getSubscription()];case 4:return g.sent(),[3,8];case 5:return D=g.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(A.scope)];case 6:if(!(I=g.sent()))throw D;return[4,this.deleteToken(I.fcmToken)];case 7:throw g.sent(),D;case 8:return[2]}})})},M.prototype.onNotificationClick_=function(A){return N(this,void 0,void 0,function(){var M,D,I,g;return i(this,function(t){switch(t.label){case 0:return A.notification&&A.notification.data&&A.notification.data.FCM_MSG?A.action?[2]:(A.stopImmediatePropagation(),A.notification.close(),(M=A.notification.data.FCM_MSG).notification&&(D=M.fcmOptions&&M.fcmOptions.link||M.notification.click_action)?[4,this.getWindowClient_(D)]:[2]):[2];case 1:return(I=t.sent())?[3,3]:[4,self.clients.openWindow(D)];case 2:return I=t.sent(),[3,5];case 3:return[4,I.focus()];case 4:I=t.sent(),t.label=5;case 5:return I?(delete M.notification,delete M.fcmOptions,g=F(j.NOTIFICATION_CLICKED,M),[2,this.attemptToMessageClient_(I,g)]):[2]}})})},M.prototype.getNotificationData_=function(A){var M;if(A&&"object"==typeof A.notification){var D=w({},A.notification);return D.data=w({},A.notification.data,((M={}).FCM_MSG=A,M)),D}},M.prototype.setBackgroundMessageHandler=function(A){if(!A||"function"!=typeof A)throw o.create("bg-handler-function-expected");this.bgMessageHandler=A},M.prototype.getWindowClient_=function(A){return N(this,void 0,void 0,function(){var M,D,I,g;return i(this,function(t){switch(t.label){case 0:return M=new URL(A,self.location.href).href,[4,d()];case 1:for(D=t.sent(),I=null,g=0;ge&&console.warn("This browser only supports "+e+" actions.The remaining actions will not be displayed."),[2,g.showNotification(I,D)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(M)]:[3,5];case 4:return w.sent(),[2];case 5:return[2]}})})},M.prototype.onSubChange_=function(A){return N(this,void 0,void 0,function(){var A,M,D,I;return i(this,function(g){switch(g.label){case 0:return g.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return A=g.sent(),[3,3];case 2:throw M=g.sent(),o.create("unable-to-resubscribe",{message:M});case 3:return g.trys.push([3,5,,8]),[4,A.pushManager.getSubscription()];case 4:return g.sent(),[3,8];case 5:return D=g.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(A.scope)];case 6:if(!(I=g.sent()))throw D;return[4,this.deleteToken(I.fcmToken)];case 7:throw g.sent(),D;case 8:return[2]}})})},M.prototype.onNotificationClick_=function(A){return N(this,void 0,void 0,function(){var M,D,I,g;return i(this,function(t){switch(t.label){case 0:return A.notification&&A.notification.data&&A.notification.data.FCM_MSG?A.action?[2]:(A.stopImmediatePropagation(),A.notification.close(),(M=A.notification.data.FCM_MSG).notification&&(D=M.fcmOptions&&M.fcmOptions.link||M.notification.click_action)?[4,this.getWindowClient_(D)]:[2]):[2];case 1:return(I=t.sent())?[3,3]:[4,self.clients.openWindow(D)];case 2:return I=t.sent(),[3,5];case 3:return[4,I.focus()];case 4:I=t.sent(),t.label=5;case 5:return I?(delete M.notification,delete M.fcmOptions,g=F(j.NOTIFICATION_CLICKED,M),[2,this.attemptToMessageClient_(I,g)]):[2]}})})},M.prototype.getNotificationData_=function(A){var M;if(A&&"object"==typeof A.notification){var D=w({},A.notification);return D.data=w({},A.notification.data,((M={}).FCM_MSG=A,M)),D}},M.prototype.setBackgroundMessageHandler=function(A){if(!A||"function"!=typeof A)throw o.create("bg-handler-function-expected");this.bgMessageHandler=A},M.prototype.getWindowClient_=function(A){return N(this,void 0,void 0,function(){var M,D,I,g;return i(this,function(t){switch(t.label){case 0:return M=new URL(A,self.location.href).href,[4,d()];case 1:for(D=t.sent(),I=null,g=0;g { - const { dispatchSocketError } = this.props; - console.log('Unauthorized:', reason); + const { dispatchSocketError, signOut } = this.props; + // console.log('Unauthorized:', reason); dispatchSocketError(reason); + signOut(); }); socket.on('disconnect', reason => { @@ -114,10 +121,16 @@ class Header extends Component { socket.on("join-alert", data => { const { dispatchUsersOnline } = this.props; dispatchUsersOnline(data); + console.log('You connected'); }); - socket.on("chat-message", data =>{ - const { name, message } = data; + socket.on("chat-message", data => { + const { chatInfo: { messages }, storeRecievedMessages } = this.props; + const { sender } = data; + let newMessages = {...messages}; + if (newMessages[sender]) newMessages[sender].push(data); + else newMessages[sender] = [data]; + storeRecievedMessages(newMessages); //do something when message recieved }); @@ -128,7 +141,8 @@ class Header extends Component { }); socket.on("user-connected", data => { - //do something when user connects + const { dispatchUsersOnline } = this.props; + dispatchUsersOnline(data); }); if (!socketOpen && !unAuthorizedConnection && token && uid) openSocket(this.props); } @@ -143,7 +157,7 @@ class Header extends Component { getUsers, getFriends, getFriendsRequests, - uploadUsersInfoToFB + uploadUsersInfoToFB, } = this.props; let { uid, avURL } = info; if (!fetched) getUsers(); @@ -167,11 +181,17 @@ class Header extends Component { // show nofication icon if there are incoming requests if (fetchedFriends && inComingRequests.length > 0 && notificationClass.includes('hidden')) this.setState({notificationClass:"fas fa-circle alert"}); else if (fetchFriends && inComingRequests.length === 0 && !notificationClass.includes('hidden')) this.setState({notificationClass:"fas fa-circle alert hidden"}); - - if (!socketOpen && !unAuthorizedConnection && token && uid) openSocket(this.props); + if (loggedIn && !socketOpen && !unAuthorizedConnection) { + clearInterval(this.reconnectTimer); + this.reconnectTimer = setInterval(() => { + console.log('trying to reconnect...'); + openSocket(this.props); + }, RECONNECT_TIMER); + } + else clearInterval(this.reconnectTimer); } - showMenu = ()=>{ + showMenu = () => { var menu = this.state.dropDownStyle; if ( menu !== "visible"){ this.setState({ @@ -212,10 +232,10 @@ class Header extends Component { "/"; return (
- { loggedIn? + { loggedIn ? : null } - { loggedIn? + { loggedIn ?
this.goTo("/home") }> this.goTo("/friends") }> @@ -234,7 +254,7 @@ class Header extends Component {
-
: + :
this.goTo(notFoundPath) }>
} @@ -247,10 +267,22 @@ Header.propTypes = { genInfo: PropTypes.object, info: PropTypes.object, loginInfo: PropTypes.object, + friendsInfo: PropTypes.object, + chatInfo: PropTypes.object, confirmLoggedIn: PropTypes.func.isRequired, updateGenInfo: PropTypes.func.isRequired, signOut: PropTypes.func.isRequired, - dispatchUsersOnline: PropTypes.func.isRequired + dispatchUsersOnline: PropTypes.func.isRequired, + getUsers: PropTypes.func, + openSocket: PropTypes.func, + closeSocket: PropTypes.func, + confirmUserToken: PropTypes, + logingStatusConfirmation: PropTypes.func, + dispatchSocketConnected: PropTypes.func, + dispatchSocketError: PropTypes.func, + getFriends: PropTypes.func, + getFriendsRequests: PropTypes.func, + uploadUsersInfoToFB: PropTypes.func, } const mapStateToProps = state => { @@ -258,7 +290,8 @@ const mapStateToProps = state => { genInfo: state.genInfo, info: state.genInfo.info, loginInfo: state.loginInfo, - friendsInfo: state.friendsInfo + friendsInfo: state.friendsInfo, + chatInfo: state.chatInfo } } @@ -276,11 +309,14 @@ const mapDispatchToProps = dispatch => { confirmUserToken: userToken => { dispatch(confirmToken(userToken)); }, + logingStatusConfirmation: (confirmLoggedIn, loginInfo, genInfo) => { + dispatch(checkLoginStatus(confirmLoggedIn, loginInfo, genInfo)); + }, dispatchSocketConnected: () => { dispatch(socketConnected()); }, dispatchSocketError: error => { - dispatch(alertSocketError(error)) + dispatch(alertSocketError(error)); }, getFriends: info => { dispatch(fetchFriends(info)); @@ -302,6 +338,9 @@ const mapDispatchToProps = dispatch => { }, dispatchUsersOnline: users => { dispatch(fetchedUsersOnline(users)); + }, + storeRecievedMessages: message => { + dispatch(dispatchRecievedMessage(message)); } } } diff --git a/src/app/components/MainComponent/App.js b/src/app/components/MainComponent/App.js index c755498..3f5baf9 100644 --- a/src/app/components/MainComponent/App.js +++ b/src/app/components/MainComponent/App.js @@ -26,9 +26,8 @@ class App extends Component { false : localStorage.getItem("exists"); /**Determine page to redirect to */ - if (uid) { - console.log(genInfo) + //console.log(genInfo) if (genInfo) this.props.sendGenInfo(genInfo); //check if user session is still valid if (sessionToken) checkSessionValidity(sessionToken); diff --git a/src/app/components/Messaging/ChatComponent.js b/src/app/components/Messaging/ChatComponent.js index 1aee0a0..bc257d7 100644 --- a/src/app/components/Messaging/ChatComponent.js +++ b/src/app/components/Messaging/ChatComponent.js @@ -1,36 +1,110 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; -import { Text, View, TextInput, TouchableOpacity } from 'react-native'; +import { + logout, + loginConfirmed, + connectToChatServer, + socket +} from 'reduxFiles/dispatchers/authDispatchers'; +import { + // dispatchRecievedMessage, + dispatchSentMessage +} from 'reduxFiles/dispatchers/chatDispatchers'; +import { TextInput, TouchableOpacity, Text, View, ScrollView } from 'react-native'; import styles from './localStyles/mainStyles'; -const ChatComponent = ({chatInfo: { selectedUser }, friendsInfo: { users }}) => { - useEffect(() => { - //console.log(chatInfo) - }, []) - return ( - - - - { users.map(user => { - if (user.uid === selectedUser ) return user.dname - })} - - - - +class ChatComponent extends React.Component { + state = { + message: '' + } + + tempStoreMessage = e => { + const message = e.target.value; + this.setState({message}); + } + + sendMessage = () => { + const { storeSentMessages, chatInfo: { selectedUser, messages }, genInfo: { info: { uid } } } = this.props; + const message = this.state.message; + const messageObj = {message, recipient: selectedUser, sender: uid}; + if (message.length) { + let newMessages = {...messages}; + if (newMessages[selectedUser]) newMessages[selectedUser].push(messageObj); + else newMessages[selectedUser] = [messageObj]; + storeSentMessages(newMessages) + socket.emit('sent-message', messageObj); + this.setState({message:''}); + } + else console.log('empty message') + } + render(){ + const { chatInfo: { selectedUser, messages }, friendsInfo: { users }, genInfo: { info: { uid } } } = this.props; + const enabledSend = (this.state.message).length; + + const displayMessages = () => { + return + { + Object.keys(messages).map(key => { + const usersMessages = messages[key] + if (String(key) === String(selectedUser)) { + return + { + Object.keys(usersMessages).map(key => { + const sender = usersMessages[key].sender; + const message = usersMessages[key].message; + if ( sender === selectedUser) { + return + { message } + + } + else if (String(sender) === String(uid)) { + return + { message } + + } + else return; + }) + } + + } + }) + } - - - - Send - + } + + return ( + + + + { users.map(user => { + if (user.uid === selectedUser ) return user.dname + })} + + + this.scrollView = ref} + onContentSizeChange={() => { + this.scrollView.scrollToEnd({animated: true}); + }} + style={styles.messagesContainer} + > + {displayMessages()} + + + + + Send + + - - ) + ) + } } ChatComponent.propTypes = { @@ -70,6 +144,9 @@ const mapDispatchToProps = dispatch => { }, updateGenInfo: genInfo => { dispatch(dispatchedGenInfo(genInfo)); + }, + storeSentMessages: message => { + dispatch(dispatchSentMessage(message)) } } } diff --git a/src/app/components/Messaging/localStyles/mainStyles.js b/src/app/components/Messaging/localStyles/mainStyles.js index 7195ca1..95ecf4b 100644 --- a/src/app/components/Messaging/localStyles/mainStyles.js +++ b/src/app/components/Messaging/localStyles/mainStyles.js @@ -13,21 +13,56 @@ const styles = StyleSheet.create({ borderWidth: 1.5, borderColor: '#D4D4D4', borderRadius: 3, - height: 50, + height: 30, }, userInfo: { - flex: 1 }, userName: { textTransform: 'capitalize' }, - messages: { - flex: 2, - minHeight: 50 + recievedContainer: { + display: 'block', + textAlign: 'left', + alignItems: 'flex-start', + alignContent: 'flex-start', + }, + recievedMsg: { + margin: 3, + padding: 3, + borderRadius: 3, + display: 'inline-block', + alignItems: 'flex-start', + color: "#000", + textAlign: 'left', + backgroundColor: "#16B5F3" + }, + sentContainer: { + flex: 1, + display: 'block', + alignContent: 'flex-end', + alignItems: 'flex-end', + textAlign: 'right', + }, + sentMsg: { + margin: 3, + padding: 3, + borderRadius: 3, + display: 'inline-block', + alignItems: 'flex-end', + textAlign: 'right', + color: "#000", + backgroundColor: "#16B5F3" + }, + messagesContainer: { + display: 'block', + height: '100%', + minHeight: 100 + }, + messagesSubContainer: { + display: 'block' }, inputContainer: { display: 'flex', - flex: 1, flexDirection: 'row' }, button: { @@ -36,10 +71,20 @@ const styles = StyleSheet.create({ justifyContent: 'center', borderRadius: 3, marginLeft: 10, + height: 30, backgroundColor: '#16B5F2' }, + disabledButton: { + flex: 1, + alignItems: 'center', + justifyContent: 'center', + borderRadius: 3, + marginLeft: 10, + height: 30, + backgroundColor: '#7F8787' + }, buttonText: { - alignText: 'center', + textAlign: 'center', color: '#fff' } }); diff --git a/src/app/misc/constants.js b/src/app/misc/constants.js index db3e94d..731f7cd 100644 --- a/src/app/misc/constants.js +++ b/src/app/misc/constants.js @@ -2,4 +2,5 @@ export const emailregex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+" export const devProfileURL = process.env.DEV_PROFILE_URL; export const payPalURL = process.env.PAYPAL_URL; export const devEmailAddress = process.env.DEV_EMAIL_ADDRESS; -export const REDIRECT_TIMER = 300; \ No newline at end of file +export const REDIRECT_TIMER = 300; +export const RECONNECT_TIMER = 6000; \ No newline at end of file diff --git a/src/app/redux/dispatchers/authDispatchers.js b/src/app/redux/dispatchers/authDispatchers.js index d389265..dab3c67 100644 --- a/src/app/redux/dispatchers/authDispatchers.js +++ b/src/app/redux/dispatchers/authDispatchers.js @@ -450,23 +450,24 @@ export const handleSignup = (email, password)=>{ } } -export const confirmToken = tokeId => { +export const confirmToken = tokenId => { return dispatch => { - const url = confirmTokenURL + tokeId; - if (tokeId) axios.post(url).then(result => { - let { data } = result; - let { error } = data; - if ( error && error.code === "auth/argument-error") { - dispatch(loginErrorAlert("error.sessionExpired")); + const url = confirmTokenURL + tokenId; + if (tokenId) axios.post(url).then(result => { + let { data } = result; + let { error } = data; + console.log(error.code) + if ( error && error.code === "auth/argument-error") { + dispatch(loginErrorAlert("error.sessionExpired")); + dispatch(logout()); + } + else dispatch(loginConfirmed()); + + }).catch(error=>{ + console.log(error.message) + dispatch(loginErrorAlert("error.loginFailure")); dispatch(logout()); - } - else dispatch(loginConfirmed()); - - }).catch(error=>{ - console.log(error.message) - dispatch(loginErrorAlert("error.loginFailure")); - dispatch(logout()); - }); + }); } } @@ -523,13 +524,13 @@ export const logout = () =>{ export const connectToChatServer = props => { return dispatch => { - const { genInfo: { info: { dname, chatkitUser: { token } } }, loginInfo: { socketOpen } } = props; - //console.log(token) - // console.log(socketOpen) - if (token && !socketOpen) { + const { genInfo: { info: { chatkitUser: { token } } }, loginInfo: { socketOpen } } = props; + const storedInfo = JSON.parse(localStorage.getItem('genInfo')); + const storedToken = storedInfo.chatkitUser.token; + if ((token || storedToken) && !socketOpen) { console.log('opening socket...') socket.open(); - socket.emit("user-joined", dname); + //socket.emit("user-joined", dname); dispatch(socketConnected()); } } @@ -544,6 +545,8 @@ export const disconnectFromChatServer = () => { export const alertSocketError = error => { return dispatch => { + // console.log('disconnected with error') + console.log(error) //socket.disconnect(); if (error.message && error.message === 'UNAUTHORIZED') dispatch(unAuthorizedAuthentication()); if (error.code === 'auth/id-token-expired') { diff --git a/src/app/redux/dispatchers/chatDispatchers.js b/src/app/redux/dispatchers/chatDispatchers.js index b72ad20..1392aba 100644 --- a/src/app/redux/dispatchers/chatDispatchers.js +++ b/src/app/redux/dispatchers/chatDispatchers.js @@ -1,6 +1,8 @@ import { FETCH_ONLINE_USERS_FULFILLED, - SET_USER_TO_CHAT + SET_USER_TO_CHAT, + MESSAGE_RECIEVED_DISPATCHED, + MESSAGE_SENT_DISPATCHED } from '../types'; export const fetchedUsersOnline = users => { @@ -14,4 +16,16 @@ export const setUserToChat = userId => { type: SET_USER_TO_CHAT, payload: userId } +} +export const dispatchSentMessage = message => { + return { + type: MESSAGE_SENT_DISPATCHED, + payload: message + } +} +export const dispatchRecievedMessage = message => { + return { + type: MESSAGE_RECIEVED_DISPATCHED, + payload: message + } } \ No newline at end of file diff --git a/src/app/redux/reducers/chatReducer.js b/src/app/redux/reducers/chatReducer.js index 5850fd3..2db1f5b 100644 --- a/src/app/redux/reducers/chatReducer.js +++ b/src/app/redux/reducers/chatReducer.js @@ -5,13 +5,15 @@ import { FETCH_MESSAGES_PENDING, FETCH_MESSAGES_FULFILLED, FETCH_MESSAGES_ERROR, - SET_USER_TO_CHAT + SET_USER_TO_CHAT, + MESSAGE_RECIEVED_DISPATCHED, + MESSAGE_SENT_DISPATCHED } from "../types"; const defaultState = { onlineUsers: null, selectedUser: null, - messages: null, + messages: {}, fetching: false, fetched: false, error: null @@ -43,6 +45,18 @@ const chatReducer = (state = defaultState, action) => { onlineUsers: action.payload }; } + case MESSAGE_RECIEVED_DISPATCHED: { + return { + ...state, + messages: action.payload + } + } + case MESSAGE_SENT_DISPATCHED: { + return { + ...state, + messages: action.payload + } + } case FETCH_MESSAGES_PENDING: { return { ...state, diff --git a/src/app/redux/types.js b/src/app/redux/types.js index 765f1e2..5d63dc6 100644 --- a/src/app/redux/types.js +++ b/src/app/redux/types.js @@ -48,4 +48,6 @@ export const FETCH_ONLINE_USERS_ERROR = "FETCH_ONLINE_USERS_ERROR"; export const FETCH_MESSAGES_FULFILLED = "FETCH_MESSAGES_FULFILLED"; export const FETCH_MESSAGES_PENDING = "FETCH_MESSAGES_PENDING"; export const FETCH_MESSAGES_ERROR = "FETCH_MESSAGES_ERROR"; -export const SET_USER_TO_CHAT = "SET_USER_TO_CHAT" +export const SET_USER_TO_CHAT = "SET_USER_TO_CHAT"; +export const MESSAGE_RECIEVED_DISPATCHED = "MESSAGE_RECIEVED_DISPATCHED"; +export const MESSAGE_SENT_DISPATCHED = "MESSAGE_SENT_DISPATCHED";