diff --git a/semag/al2/js/firebase-auth.ecf3f748.js b/semag/al2/js/firebase-auth.ecf3f748.js new file mode 100644 index 00000000..6a241e76 --- /dev/null +++ b/semag/al2/js/firebase-auth.ecf3f748.js @@ -0,0 +1,2 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["firebase-auth"],{b7aa:function(t,e,n){"use strict";(function(t){var e=n("c23d"),i=n.n(e);(function(){var e,n="function"==typeof Object.defineProperties?Object.defineProperty:function(t,e,n){t!=Array.prototype&&t!=Object.prototype&&(t[e]=n.value)},r="undefined"!=typeof window&&window===this?this:"undefined"!=typeof t&&null!=t?t:this;function o(t,e){if(e){var i=r;t=t.split(".");for(var o=0;o>>0),T=0;function k(t,e,n){return t.call.apply(t.bind,arguments)}function E(t,e,n){if(!t)throw Error();if(2t.b&&(t.b++,e.next=t.a,t.a=e)}function x(){this.b=this.a=null}_(R,Error),R.prototype.name="CustomError",_(P,R),P.prototype.name="AssertionError",C.prototype.get=function(){if(0"}else o=void 0===t?"undefined":null===t?"null":typeof t;D("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}x.prototype.add=function(t,e){var n=M.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},U.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},U.prototype.reset=function(){this.next=this.b=this.a=null};var F=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(h(t))return h(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;ne?null:h(t)?t.charAt(e):t[e]}function W(t,e){return 0<=F(t,e)}function X(t,e){var n;return e=F(t,e),(n=0<=e)&&Array.prototype.splice.call(t,e,1),n}function J(t,e){q(t,(function(n,i){e.call(void 0,n,i,t)&&1==Array.prototype.splice.call(t,i,1).length&&0}))}function Y(t){return Array.prototype.concat.apply([],arguments)}function z(t){var e=t.length;if(0/g,bt=/"/g,yt=/'/g,wt=/\x00/g,It=/[\x00&<>"']/;function Tt(t,e){return-1!=t.indexOf(e)}function kt(t,e){return te?1:0}function Et(){this.a="",this.b=Ot}function St(t){return t instanceof Et&&t.constructor===Et&&t.b===Ot?t.a:(D("expected object of type SafeUrl, got '"+t+"' of type "+v(t)),"type_error:SafeUrl")}Et.prototype.qa=!0,Et.prototype.pa=function(){return this.a.toString()},Et.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var At=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function Nt(t){return t instanceof Et?t:(t="object"==typeof t&&t.qa?t.pa():String(t),At.test(t)||(t="about:invalid#zClosurez"),Rt(t))}var _t,Ot={};function Rt(t){var e=new Et;return e.a=t,e}Rt("about:blank");t:{var Pt=c.navigator;if(Pt){var Dt=Pt.userAgent;if(Dt){_t=Dt;break t}}_t=""}function Ct(t){return Tt(_t,t)}function Lt(){this.a="",this.b=Mt}function xt(t){return t instanceof Lt&&t.constructor===Lt&&t.b===Mt?t.a:(D("expected object of type SafeHtml, got '"+t+"' of type "+v(t)),"type_error:SafeHtml")}Lt.prototype.qa=!0,Lt.prototype.pa=function(){return this.a.toString()},Lt.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Mt={};function jt(t){var e=new Lt;return e.a=t,e}jt("");var Ut,Vt,Ft=jt("");function Kt(t){var e=dt(it(at));V(t,"HTMLIFrameElement"),t.src=ut(e).toString()}function qt(t,e){V(t,"HTMLScriptElement"),t.src=ut(e),null===d&&(e=c.document,d=(e=e.querySelector&&e.querySelector("script[nonce]"))&&(e=e.nonce||e.getAttribute("nonce"))&&l.test(e)?e:""),e=d,e&&t.setAttribute("nonce",e)}function Ht(t,e){for(var n=t.split("%s"),i="",r=Array.prototype.slice.call(arguments,1);r.length&&1")&&(t=t.replace(gt,">")),-1!=t.indexOf('"')&&(t=t.replace(bt,""")),-1!=t.indexOf("'")&&(t=t.replace(yt,"'")),-1!=t.indexOf("\0")&&(t=t.replace(wt,"�"))),t}function Gt(t){c.setTimeout((function(){throw t}),0)}function Wt(){var t=c.MessageChannel;if("undefined"===typeof t&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!Ct("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",Kt(t),document.documentElement.appendChild(t);var e=t.contentWindow;t=e.document,t.open(),t.write(xt(Ft)),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=S((function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()}),this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),"undefined"!==typeof t&&!Ct("Trident")&&!Ct("MSIE")){var e=new t,n={},i=n;return e.port1.onmessage=function(){if(void 0!==n.next){n=n.next;var t=n.yb;n.yb=null,t()}},function(t){i.next={yb:t},i=i.next,e.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){c.setTimeout(t,0)}}function Xt(t,e){Vt||Jt(),Yt||(Vt(),Yt=!0),zt.add(t,e)}function Jt(){if(c.Promise&&c.Promise.resolve){var t=c.Promise.resolve(void 0);Vt=function(){t.then($t)}}else Vt=function(){var t=$t;!y(c.setImmediate)||c.Window&&c.Window.prototype&&!Ct("Edge")&&c.Window.prototype.setImmediate==c.setImmediate?(Ut||(Ut=Wt()),Ut(t)):c.setImmediate(t)}}jt("
");var Yt=!1,zt=new x;function $t(){for(var t;t=j();){try{t.a.call(t.b)}catch(e){Gt(e)}L(M,t)}Yt=!1}function Zt(t,e){if(this.a=Qt,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=p)try{var n=this;t.call(e,(function(t){de(n,te,t)}),(function(t){if(!(t instanceof Te))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(e){}de(n,ee,t)}))}catch(i){de(this,ee,i)}}var Qt=0,te=2,ee=3;function ne(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}ne.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var ie=new C((function(){return new ne}),(function(t){t.reset()}));function re(t,e,n){var i=ie.get();return i.g=t,i.b=e,i.f=n,i}function oe(t){if(t instanceof Zt)return t;var e=new Zt(p);return de(e,te,t),e}function ae(t){return new Zt((function(e,n){n(t)}))}function se(t,e,n){pe(t,e,n,null)||Xt(A(e,t))}function ue(t){return new Zt((function(e,n){var i=t.length,r=[];if(i)for(var o,a=function(t,n){i--,r[t]=n,0==i&&e(r)},s=function(t){n(t)},u=0;uparseFloat(je)){Oe=String(Ve);break t}}Oe=je}var Fe,Ke={};function qe(t){return _e(t,(function(){for(var e=0,n=pt(String(Oe)).split("."),i=pt(String(t)).split("."),r=Math.max(n.length,i.length),o=0;0==e&&o=t.keyCode)&&(t.keyCode=-1)}catch(e){}},Je.prototype.f=function(){return this.a};var ze="closure_listenable_"+(1e6*Math.random()|0),$e=0;function Ze(t,e,n,i,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!i,this.Na=r,this.key=++$e,this.ra=this.Ia=!1}function Qe(t){t.ra=!0,t.listener=null,t.proxy=null,t.src=null,t.Na=null}function tn(t){this.src=t,this.a={},this.b=0}function en(t,e){var n=e.type;n in t.a&&X(t.a[n],e)&&(Qe(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function nn(t,e,n,i){for(var r=0;ri.keyCode||void 0!=i.returnValue)){t:{var r=!1;if(0==i.keyCode)try{i.keyCode=-1;break t}catch(a){r=!0}(r||void 0==i.returnValue)&&(i.returnValue=!0)}for(i=[],r=e.b;r;r=r.parentNode)i.push(r);for(t=t.type,r=i.length-1;0<=r;r--){e.b=i[r];var o=dn(i[r],t,!0,e);n=n&&o}for(r=0;r>>0);function bn(t){return y(t)?t:(t[gn]||(t[gn]=function(e){return t.handleEvent(e)}),t[gn])}function yn(){ke.call(this),this.u=new tn(this),this.Sb=this,this.Wa=null}function wn(t,e,n,i,r){t.u.add(String(e),n,!1,i,r)}function In(t,e,n,i,r){t.u.add(String(e),n,!0,i,r)}function Tn(t,e,n,i){if(e=t.u.a[String(e)],!e)return!0;e=e.concat();for(var r=!0,o=0;oe)throw Error("Bad port number "+e);t.l=e}else t.l=null}function Mn(t,e,n){e instanceof Yn?(t.a=e,ii(t.a,t.h)):(n||(e=qn(e,Xn)),t.a=new Yn(e,t.h))}function jn(t,e,n){t.a.set(e,n)}function Un(t,e){return t.a.get(e)}function Vn(t){return t instanceof Cn?new Cn(t):new Cn(t,void 0)}function Fn(t,e){var n=new Cn(null,void 0);return Ln(n,"https"),t&&(n.b=t),e&&(n.c=e),n}function Kn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function qn(t,e,n){return h(t)?(t=encodeURI(t).replace(e,Hn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Hn(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}Cn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(qn(e,Bn,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.i)&&t.push(qn(e,Bn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.l,null!=n&&t.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(qn(n,"/"==n.charAt(0)?Wn:Gn,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",qn(n,Jn)),t.join("")},Cn.prototype.resolve=function(t){var e=new Cn(this),n=!!t.f;n?Ln(e,t.f):n=!!t.i,n?e.i=t.i:n=!!t.b,n?e.b=t.b:n=null!=t.l;var i=t.c;if(n)xn(e,t.l);else if(n=!!t.c){if("/"!=i.charAt(0))if(this.b&&!this.c)i="/"+i;else{var r=e.c.lastIndexOf("/");-1!=r&&(i=e.c.substr(0,r+1)+i)}if(r=i,".."==r||"."==r)i="";else if(Tt(r,"./")||Tt(r,"/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");for(var o=[],a=0;a2*t.c&&On(t)))}function Qn(t,e){return zn(t),e=ni(t,e),Rn(t.a.b,e)}function ti(t,e,n){Zn(t,e),0"),o=o.join("")}return o=r.createElement(o),a&&(h(a)?o.className=a:g(a)?o.className=a.join(" "):ai(o,a)),2t)&&(!Pe||!Fe||9'),a.document.write(xt(t)),a.document.close())):(a=i.open(St(e).toString(),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(s){}return a}function Si(t){return new Zt((function(e){function n(){En(2e3).then((function(){if(t&&!t.closed)return n();e()}))}return n()}))}var Ai=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ni=/^[^@]+@[^@]+$/;function _i(){var t=null;return new Zt((function(e){"complete"==c.document.readyState?e():(t=function(){e()},cn(window,"load",t))})).s((function(e){throw hn(window,"load",t),e}))}function Oi(){return Ri(void 0)?_i().then((function(){return new Zt((function(t,e){var n=c.document,i=setTimeout((function(){e(Error("Cordova framework is not ready."))}),1e3);n.addEventListener("deviceready",(function(){clearTimeout(i),t()}),!1)}))})):ae(Error("Cordova must run in an Android or iOS file scheme."))}function Ri(t){return t=t||Ki(),!("file:"!==Wi()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function Pi(){var t=c.window;try{return!(!t||t==t.top)}catch(e){return!1}}function Di(){return"undefined"!==typeof c.WorkerGlobalScope&&"function"===typeof c.importScripts}function Ci(){return i.a.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":i.a.INTERNAL.hasOwnProperty("node")?"Node":Di()?"Worker":"Browser"}function Li(){var t=Ci();return"ReactNative"===t||"Node"===t}function xi(){for(var t=50,e=[];0e)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=Ki(),e=Ci(),this.b=Ti(t)||"ReactNative"===e}function er(){var t=c.document;return!t||"undefined"===typeof t.visibilityState||"visible"==t.visibilityState}function nr(){var t=c.document,e=null;return er()||!t?oe():new Zt((function(n){e=function(){er()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)})).s((function(n){throw t.removeEventListener("visibilitychange",e,!1),n}))}function ir(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(n){}return null}function rr(){return!(!qi("fireauth.oauthhelper",c)&&!qi("fireauth.iframe",c))}function or(){var t=c.navigator;return t&&t.serviceWorker&&t.serviceWorker.controller||null}function ar(){var t=c.navigator;return t&&t.serviceWorker?oe().then((function(){return t.serviceWorker.ready})).then((function(t){return t.active||null})).s((function(){return null})):oe(null)}tr.prototype.get=function(){var t=c.navigator;return!t||"boolean"!==typeof t.onLine||!Gi()&&"chrome-extension:"!==Wi()&&"undefined"===typeof t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var sr,ur={};function cr(t){ur[t]||(ur[t]=!0,"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(t))}try{var hr={};Object.defineProperty(hr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(hr,"abcd",{configurable:!0,enumerable:!0,value:2}),sr=2==hr.abcd}catch(ed){sr=!1}function fr(t,e,n){sr?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function lr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&fr(t,n,e[n])}function dr(t){var e={};return lr(e,t),e}function pr(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}function vr(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}function eo(){if(!$r){$r={},Zr={};for(var t=0;65>t;t++)$r[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),Zr[$r[t]]=t,62<=t&&(Zr["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}}function no(t){this.f=t.sub,N(),this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.c=t.firebase&&t.firebase.tenant||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function io(t){return(t=ro(t))&&t.sub&&t.iss&&t.aud&&t.exp?new no(t):null}function ro(t){if(!t)return null;if(t=t.split("."),3!=t.length)return null;t=t[1];for(var e=(4-t.length%4)%4,n=0;n Auth section -> Sign in method tab.",t):"http"==i||"https"==i?n=Ht("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",Ar.call(this,e,n)}function sa(t,e,n){Ar.call(this,t,n),t=e||{},t.Ab&&fr(this,"email",t.Ab),t.ba&&fr(this,"phoneNumber",t.ba),t.credential&&fr(this,"credential",t.credential),t.Qb&&fr(this,"tenantId",t.Qb)}function ua(t){if(t.code){var e=t.code||"";0==e.indexOf(_r)&&(e=e.substring(_r.length));var n={credential:Zo(t),Qb:t.tenantId};if(t.email)n.Ab=t.email;else if(t.phoneNumber)n.ba=t.phoneNumber;else if(!n.credential)return new Ar(e,t.message||void 0);return new sa(e,n,t.message)}return null}function ca(){}function ha(t){return t.c||(t.c=t.b())}function fa(){}function la(t){if(!t.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n=ka(this).value)for(y(e)&&(e=e()),t=new ma(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var Ea={},Sa=null;function Aa(t){var e;if(Sa||(Sa=new ga(""),Ea[""]=Sa,Sa.c=Ia),!(e=Ea[t])){e=new ga(t);var n=t.lastIndexOf("."),i=t.substr(n+1);n=Aa(t.substr(0,n)),n.b||(n.b={}),n.b[i]=e,e.a=n,Ea[t]=e}return e}function Na(t,e){t&&t.log(Ta,e,void 0)}function _a(t){this.f=t}function Oa(t){yn.call(this),this.o=t,this.readyState=Ra,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=Aa("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}_(_a,ca),_a.prototype.a=function(){return new Oa(this.f)},_a.prototype.b=function(t){return function(){return t}}({}),_(Oa,yn);var Ra=0;function Pa(t){t.c.read().then(t.ec.bind(t)).catch(t.Ma.bind(t))}function Da(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,Ca(t)}function Ca(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function La(t){yn.call(this),this.headers=new _n,this.B=t||null,this.c=!1,this.w=this.a=null,this.h=this.O=this.l="",this.f=this.J=this.i=this.I=!1,this.g=0,this.o=null,this.m=xa,this.v=this.P=!1}e=Oa.prototype,e.open=function(t,e){if(this.readyState!=Ra)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,Ca(this)},e.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.o.fetch(new Request(this.g,e)).then(this.jc.bind(this),this.Ma.bind(this))},e.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,Da(this,!1)),this.readyState=Ra},e.jc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,Ca(this)),this.a&&(this.readyState=3,Ca(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.hc.bind(this),this.Ma.bind(this)):"undefined"!==typeof c.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,Pa(this)):t.text().then(this.ic.bind(this),this.Ma.bind(this)))))},e.ec=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?Da(this,!0):Ca(this),3==this.readyState&&Pa(this)}},e.ic=function(t){this.a&&(this.response=this.responseText=t,Da(this,!0))},e.hc=function(t){this.a&&(this.response=t,Da(this,!0))},e.Ma=function(t){var e=this.h;e&&e.log(wa,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&Da(this,!0)},e.setRequestHeader=function(t,e){this.i.append(t,e)},e.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log(wa,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},e.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log(wa,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},_(La,yn);var xa="";La.prototype.b=Aa("goog.net.XhrIo");var Ma=/^https?$/i,ja=["POST","PUT"];function Ua(t,e,n,i,r){if(t.a)throw Error("[goog.net.XhrIo] Object is active with another request="+t.l+"; newUri="+e);n=n?n.toUpperCase():"GET",t.l=e,t.h="",t.O=n,t.I=!1,t.c=!0,t.a=t.B?t.B.a():ia.a(),t.w=t.B?ha(t.B):ha(ia),t.a.onreadystatechange=S(t.Lb,t);try{Na(t.b,Ya(t,"Opening Xhr")),t.J=!0,t.a.open(n,String(e),!0),t.J=!1}catch(a){return Na(t.b,Ya(t,"Error opening Xhr: "+a.message)),void Ka(t,a)}e=i||"";var o=new _n(t.headers);r&&Nn(r,(function(t,e){o.set(e,t)})),r=G(o.X()),i=c.FormData&&e instanceof c.FormData,!W(ja,n)||r||i||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach((function(t,e){this.a.setRequestHeader(e,t)}),t),t.m&&(t.a.responseType=t.m),"withCredentials"in t.a&&t.a.withCredentials!==t.P&&(t.a.withCredentials=t.P);try{Ga(t),0=e.l&&e.cancel())}this.v?this.v.call(this.o,this):this.u=!0,this.a||(t=new rs(this),Za(this),$a(this,!1,t))}},za.prototype.m=function(t,e){this.i=!1,$a(this,t,e)},za.prototype.then=function(t,e,n){var i,r,o=new Zt((function(t,e){i=t,r=e}));return ts(this,i,(function(t){t instanceof rs?o.cancel():r(t)})),o.then(t,e,n)},za.prototype.$goog_Thenable=!0,_(is,R),is.prototype.message="Deferred has already fired",is.prototype.name="AlreadyCalledError",_(rs,R),rs.prototype.message="Deferred was canceled",rs.prototype.name="CanceledError",os.prototype.c=function(){throw delete as[this.a],this.b};var as={};function ss(t){var e={},n=e.document||document,i=ut(t).toString(),r=document.createElement("SCRIPT"),o={Nb:r,Ga:void 0},a=new za(o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0e;e++){r=0|n[e-15],i=0|n[e-2];var o=(0|n[e-16])+((r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3)|0,a=(0|n[e-7])+((i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10)|0;n[e]=o+a|0}i=0|t.a[0],r=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],f=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var l=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&r^i&s^r&s)|0;a=c&h^~c&f,o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0,a=a+(0|Mc[e])|0,a=o+(a+(0|n[e])|0)|0,o=f,f=h,h=c,c=u+a|0,u=s,s=r,r=i,i=a+l|0}t.a[0]=t.a[0]+i|0,t.a[1]=t.a[1]+r|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+f|0,t.a[7]=t.a[7]+o|0}function Jc(t,e,n){void 0===n&&(n=e.length);var i=0,r=t.c;if(h(e))for(;i=o&&o==(0|o)))throw Error("message must be a byte array");t.f[r++]=o,r==t.b&&(Xc(t),r=0)}}t.c=r,t.g+=n}Kc.prototype.reset=function(){this.g=this.c=0,this.a=c.Int32Array?new Int32Array(this.h):z(this.h)};var Yc=[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 zc(){Kc.call(this,8,$c)}_(zc,Kc);var $c=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function Zc(t,e,n,i,r){this.u=t,this.i=e,this.l=n,this.m=i||null,this.o=r||null,this.h=e+":"+n,this.v=new Vc,this.g=new xc(this.h),this.f=null,this.b=[],this.a=this.c=null}function Qc(t){return new Ar("invalid-cordova-configuration",t)}function th(){for(var t=20,e=[];0e.c?Jc(e,Wc,56-e.c):Jc(e,Wc,e.b-(e.c-56));for(var i=63;56<=i;i--)e.f[i]=255&n,n/=256;for(Xc(e),i=n=0;i>r&255;return zr(t)}function nh(t,e,n,i,r){var o=th(),a=new ta(e,i,null,o,new Ar("no-auth-event"),null,r),s=qi("BuildInfo.packageName",c);if("string"!==typeof s)throw new Ar("invalid-cordova-configuration");var u=qi("BuildInfo.displayName",c),h={};if(Ki().toLowerCase().match(/iphone|ipad|ipod/))h.ibi=s;else{if(!Ki().toLowerCase().match(/android/))return ae(new Ar("operation-not-supported-in-this-environment"));h.apn=s}u&&(h.appDisplayName=u),o=eh(o),h.sessionId=o;var f=Uu(t.u,t.i,t.l,e,n,null,i,t.m,h,t.o,r);return t.ia().then((function(){var e=t.h;return t.v.a.set(jc,a.A(),e)})).then((function(){var e=qi("cordova.plugins.browsertab.isAvailable",c);if("function"!==typeof e)throw new Ar("invalid-cordova-configuration");var n=null;e((function(e){if(e){if(n=qi("cordova.plugins.browsertab.openUrl",c),"function"!==typeof n)throw new Ar("invalid-cordova-configuration");n(f)}else{if(n=qi("cordova.InAppBrowser.open",c),"function"!==typeof n)throw new Ar("invalid-cordova-configuration");e=Ki(),t.a=n(f,e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)||e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)?"_blank":"_system","location=yes")}}))}))}function ih(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}function qh(t,e){t.stop(),t.b=En(Kh(t,e)).then((function(){return nr()})).then((function(){return t.h()})).then((function(){qh(t,!0)})).s((function(e){t.i(e)&&qh(t,!1)}))}function Hh(t){this.f=t,this.b=this.a=null,this.c=0}function Bh(t,e){var n=e[gs],i=e.refreshToken;e=Wh(e.expiresIn),t.b=n,t.c=e,t.a=i}function Gh(t,e){t.b=e.b,t.a=e.a,t.c=e.c}function Wh(t){return N()+1e3*parseInt(t,10)}function Xh(t,e){return _s(t.f,e).then((function(e){return t.b=e.access_token,t.c=Wh(e.expires_in),t.a=e.refresh_token,{accessToken:t.b,expirationTime:t.c,refreshToken:t.a}})).s((function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e}))}function Jh(t,e){this.a=t||null,this.b=e||null,lr(this,{lastSignInTime:ir(e||null),creationTime:ir(t||null)})}function Yh(t){return new Jh(t.a,t.b)}function zh(t,e,n,i,r,o){lr(this,{uid:t,displayName:i||null,photoURL:r||null,email:n||null,phoneNumber:o||null,providerId:e})}function $h(t,e){for(var n in Xe.call(this,t),e)this[n]=e[n]}function Zh(t,e,n){this.I=[],this.l=t.apiKey,this.m=t.appName,this.o=t.authDomain||null,t=i.a.SDK_VERSION?Fi(i.a.SDK_VERSION):null,this.a=new vs(this.l,so(oo),t),this.b=new Hh(this.a),sf(this,e[gs]),Bh(this.b,e),fr(this,"refreshToken",this.b.a),ff(this,n||{}),yn.call(this),this.J=!1,this.o&&Bi()&&(this.i=Sh(this.o,this.l,this.m)),this.O=[],this.h=null,this.w=rf(this),this.W=S(this.Ha,this);var r=this;this.ga=null,this.va=function(t){r.sa(t.g)},this.Z=null,this.P=[],this.ua=function(t){tf(r,t.c)},this.Y=null}function Qh(t,e){t.Z&&hn(t.Z,"languageCodeChanged",t.va),(t.Z=e)&&an(e,"languageCodeChanged",t.va)}function tf(t,e){t.P=e,ks(t.a,i.a.SDK_VERSION?Fi(i.a.SDK_VERSION,t.P):null)}function ef(t,e){t.Y&&hn(t.Y,"frameworkChanged",t.ua),(t.Y=e)&&an(e,"frameworkChanged",t.ua)}function nf(t){try{return i.a.app(t.m).auth()}catch(e){throw new Ar("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+t.m+"'!")}}function rf(t){return new Fh((function(){return t.G(!0)}),(function(t){return!(!t||"auth/network-request-failed"!=t.code)}),(function(){var e=t.b.c-N()-3e5;return 0this.c-3e4?this.a?Xh(this,{grant_type:"refresh_token",refresh_token:this.a}):oe(null):oe({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},Jh.prototype.A=function(){return{lastLoginAt:this.b,createdAt:this.a}},_($h,Xe),_(Zh,yn),Zh.prototype.sa=function(t){this.ga=t,Ts(this.a,t)},Zh.prototype.ha=function(){return this.ga},Zh.prototype.Aa=function(){return z(this.P)},Zh.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())},fr(Zh.prototype,"providerId","firebase"),e=Zh.prototype,e.reload=function(){var t=this;return Of(this,df(this).then((function(){return yf(t).then((function(){return cf(t)})).then(lf)})))},e.dc=function(t){return this.G(t).then((function(t){return new Vh(t)}))},e.G=function(t){var e=this;return Of(this,df(this).then((function(){return e.b.getToken(t)})).then((function(t){if(!t)throw new Ar("internal-error");return t.accessToken!=e.ma&&(sf(e,t.accessToken),e.dispatchEvent(new $h("tokenChanged"))),gf(e,"refreshToken",t.refreshToken),t.accessToken})))},e.zc=function(t){if(t=t.users,!t||!t.length)throw new Ar("internal-error");t=t[0],ff(this,{uid:t.localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e=Tf(t),n=0;nthis.o&&(this.o=0),0==this.o&&ul(this)&&af(ul(this)),this.removeAuthTokenListener(t)},e.addAuthTokenListener=function(t){var e=this;this.m.push(t),ll(this,this.i.then((function(){e.l||W(e.m,t)&&t(cl(e))})))},e.removeAuthTokenListener=function(t){J(this.m,(function(e){return e==t}))},e.delete=function(){this.l=!0;for(var t=0;tr||r>=jl.length)throw new Ar("internal-error","Argument validator received an unsupported number of arguments.");n=jl[r],i=(i?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.M+".";break t}i=null}}if(i)throw new Ar("argument-error",t+" failed: "+i)}e=Al.prototype,e.Ba=function(){var t=this;return this.f?this.f:this.f=Cl(this,oe().then((function(){if(Gi()&&!Di())return _i();throw new Ar("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")})).then((function(){return t.m.g(t.v())})).then((function(e){return t.g=e,yu(t.o,ou,{})})).then((function(e){t.a[Ol]=e.recaptchaSiteKey})).s((function(e){throw t.f=null,e})))},e.render=function(){Ll(this);var t=this;return Cl(this,this.Ba().then((function(){if(null===t.c){var e=t.u;if(!t.i){var n=oi(e);e=ui("DIV"),n.appendChild(e)}t.c=t.g.render(e,t.a)}return t.c})))},e.verify=function(){Ll(this);var t=this;return Cl(this,this.render().then((function(e){return new Zt((function(n){var i=t.g.getResponse(e);if(i)n(i);else{var r=function(e){e&&(Dl(t,r),n(e))};t.l.push(r),t.i&&t.g.execute(t.c)}}))})))},e.reset=function(){Ll(this),null!==this.c&&this.g.reset(this.c)},e.clear=function(){Ll(this),this.B=!0,this.m.c();for(var t=0;t1e3*(a["i"]+e),c=e=>Math.round(e/1e3)-a["i"],g=({key:e,value:{v:t}})=>{const[s,r]=e.split(d);return{father:s,mother:r,timestamp:l(t)}},u=({father:e,mother:t,timestamp:s})=>{const r=[e,t].join(d);return{key:r,value:c(s)}},m=e=>Object.entries(e).map(([e,t])=>g({key:e,value:t})),y=e=>e.reduce((e,t)=>{const{key:s,value:r}=u(t);return e[s]=r,e},{}),f=1500;class R{constructor(e){this._history=[],this.reset=-1,this.onHandlerFinished=n()(e,f)}onProgressReceived(e){this.logger("progress received",e);const t=!e;t?this.onHandlerFinished():(this.reset=e.r||-1,this._history=m(e.h||{}),this._history=this._history.sort((e,t)=>e.timestamp-t.timestamp),this.onHandlerFinished(),this.logger("progress prepared ",this.history,this.reset))}onChildAdded(e,t=!1){const s=g(e);this.logger("onChildAdded",s),this._history.push(s),t||this.onHandlerFinished()}onChildRemoved(e,t=!1){const s=g(e);this.logger("onChildRemoved",s),this._history=this._history.filter(({father:e,mother:t})=>e!==s.father&&t!==s.mother),t||this.onHandlerFinished()}onResetChanged(e){this.reset=e,this._history=[],this.onHandlerFinished()}get history(){return[...this._history]}logger(...e){Object(r["q"])("firebase","[DATABASE]","[SYNC]","[DATA_HANDLER]",...e)}}var p=R,v=s("22a7"),E=s("2540"),S=s("b2eb");const H=S["HIDE_DURATION"];let b=null;const A=(e,t,s)=>{let r=t,i=!0;s.length&&(r=s[s.length-1].timestamp,i=!1);const{totalProgress:o}=v["a"].analyzeHistory(e.getters.elements,s),h=o.length;return{timestamp:r,reseted:i,count:h}},_=async(e,t)=>{e.getters.isPopupActive&&await E["a"].onHidePromise(),await Object(r["c"])(H),e.dispatch("popupShowWithData",{name:S["SYNC"],data:{...t,closable:!1}})};var T=({$store:e,remoteReset:t,remoteHistory:s})=>null!==b?b:(b=new Promise(r=>{const i={...A(e,t,s),onSuccess:e=>{r(e),b=null}};_(e,i)}),b),C=s("ded8");const P=(e,t)=>{if(-1===t)return!1;const s=!!e.getters.historyBefore(t).length;return e.dispatch("historyRemoveBeforeTimestamp",t),s},O=({store:e,remote:t})=>{let s=!1;return t.history.forEach(t=>{const r=Object(C["c"])([t.mother,t.father]);e.getters.hasMixed(r)||(e.commit("HISTORY_ADD",t),s=!0)}),s},k=({store:e,remote:t,local:s,handleReset:r=!0})=>{let i;r||e.commit("RESET_TIMESTAMP",-1);const o=!t.history.length;if(o)return i=!1,r&&(i=P(e,t.reset),i&&e.commit("RESET_TIMESTAMP",t.reset)),i;const h=!s.history.length;if(h)return e.dispatch("historySet",t.history),!0;if(i=O({store:e,remote:t}),r){const r=P(e,Math.max(t.reset,s.reset));r&&(i=!0)}return i};var w=k,M=s("cf19");const $=(e,t)=>{const s=t.every(({father:t,mother:s})=>e.getters.hasMixed([t,s])),r=e.getters.history.length===t.length;return s&&r},D=(e,t,s)=>{const r=!t.length;if(r){const t=!!e.getters.historyBefore(s).length;return t}const i=e.getters.history,o=e.getters.resetTimestamp,h=!i.length;if(h){const e=-1!==o,t=o!==s;return e&&t}return!$(e,t)},j=(e,t)=>{const s=y(e),r=y(t),i=!t.length,o=[],h=[];return Object.entries(r).forEach(([e,t])=>{s.hasOwnProperty(e)||o.push({key:e,value:t})}),Object.keys(s).forEach(e=>{if(!i){const{father:t="",mother:s=""}=g({key:e,value:{v:0}}),r=Object(M["b"])(t,a["g"]),i=Object(M["b"])(s,a["g"]);if(!r||!i)return}r.hasOwnProperty(e)||h.push(e)}),{add:o,remove:h}};class I{constructor(e,t){this.handleRemote=async()=>{const e=D(this.$store,this.remoteHistory,this.remoteReset);let t=!1;if(!e)return t=this.merge(),void this.handleSync(t);const s=await this.chooseSyncMethod();s===o["a"].MERGE&&(t=this.merge(!1)),s===o["a"].LOCAL&&(t=this.useLocal()),s===o["a"].REMOTE&&(t=this.useRemote()),this.handleSync(t)},this.$store=e,this._updateRemote=t,this.dataHandler=new p(this.handleRemote)}handleSync(e){if(this.$store.dispatch("userSynced"),e)return this.$store.dispatch("historyReload"),this.$store.dispatch("historyIntegrity"),void this.updateRemote();const t=!e&&this.remoteHistory.length{const t=e&&e.exists()?e.val():null;this.syncHandler.handle.onProgressReceived(t),this.log("progress snapshot",t)},this.onChildAdded=e=>{if(!e)return;const t={key:e.key,value:e.val()},s=this.detectSelfSent(this.added,e.key);this.syncHandler.handle.onChildAdded(t,s),this.log("child_added",e.key)},this.onChildRemoved=e=>{if(!e)return;const t={key:e.key,value:e.val()},s=this.detectSelfSent(this.added,e.key);this.syncHandler.handle.onChildRemoved(t,s),this.log("child_removed",e.key)},this.onResetUpdated=e=>{e&&(this.syncHandler.handle.onResetChanged(e.val()),this.log("reset child_changed",e.val()))},this.onProgressChange=()=>{this.syncHandler.onProgressChange()},this.updateRemote=({add:e,remove:t,reset:s=null})=>{null!==s&&this.progressRef.child("r").set(s),e.forEach(({key:e,value:t})=>{this.added[e]=!0,this.historyRef.child(e).set({v:t,_:Math.round(Date.now()/1e3)})}),t.forEach(e=>{this.removed[e]=!0,this.historyRef.child(e).remove()}),this.log("updateRemote",e,t,s)},this.firebase=e,this.destroy(),!t.getters.isLoggedIn)return;this.syncHandler=new L(t,this.updateRemote);const s=t.getters.user.uid;this.initRefs(s),this.initEvents(),this.initListeners()}initRefs(e){this.progressRef=this.firebase.database().ref(`users/${e}/progress`),this.historyRef=this.progressRef.child("h")}initEvents(){i["a"].on("HISTORY_UPDATE",this.onProgressChange),i["a"].on("PROGRESS_RESET",this.onProgressChange)}initListeners(){this.progressRef.once("value").then(this.onInitialValue);const e=Math.round(Date.now()/1e3);this.historyRef.orderByChild("_").startAt(e).on("child_added",this.onChildAdded),this.historyRef.on("child_removed",this.onChildRemoved),this.progressRef.child("r").on("value",this.onResetUpdated)}detectSelfSent(e,t){return!!t&&(!!e.hasOwnProperty(t)&&(delete e[t],!0))}sendNotificationsToken(e){if(!e)return Promise.reject();const t=this.firebase.database().ref(`tokens/${e}`);return t.set("w")}destroy(){this.progressRef&&(this.progressRef.child("h").off(),this.progressRef.child("r").off(),this.progressRef.off(),this.progressRef=null),this.historyRef&&(this.historyRef.off(),this.historyRef=null),this.syncHandler=null,i["a"].off("HISTORY_UPDATE",this.onProgressChange),i["a"].off("PROGRESS_RESET",this.onProgressChange)}log(...e){Object(r["q"])("firebase","[DATABASE]",...e)}}t["default"]=B},f2ce:function(e,t,s){"use strict";var r;s.d(t,"a",(function(){return r})),function(e){e["MERGE"]="merge",e["LOCAL"]="local",e["REMOTE"]="remote"}(r||(r={}));r.MERGE}}]); +//# sourceMappingURL=firebase-database-handler.7b726ca6.js.map \ No newline at end of file diff --git a/semag/al2/js/firebase-database.9405483c.js b/semag/al2/js/firebase-database.9405483c.js new file mode 100644 index 00000000..b2077799 --- /dev/null +++ b/semag/al2/js/firebase-database.9405483c.js @@ -0,0 +1,184 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["firebase-database"],{3523:function(t,e,n){"use strict";(function(r){function i(t){return t&&"object"===typeof t&&"default"in t?t["default"]:t}Object.defineProperty(e,"__esModule",{value:!0});var o=i(n("c23d")),s=n("9ab4"),a=n("cd51"),u=n("abfd"),h=function(){function t(t){this.domStorage_=t,this.prefix_="firebase:"}return t.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),a.stringify(e))},t.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:a.jsonEval(e)},t.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},t.prototype.prefixedName_=function(t){return this.prefix_+t},t.prototype.toString=function(){return this.domStorage_.toString()},t}(),l=function(){function t(){this.cache_={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},t.prototype.get=function(t){return a.contains(this.cache_,t)?this.cache_[t]:null},t.prototype.remove=function(t){delete this.cache_[t]},t}(),c=function(t){try{if("undefined"!==typeof window&&"undefined"!==typeof window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new h(e)}}catch(n){}return new l},p=c("localStorage"),d=c("sessionStorage"),f=new u.Logger("@firebase/database"),_="FIREBASE_DATABASE_EMULATOR_HOST",y=function(){var t=1;return function(){return t++}}(),v=function(t){var e=a.stringToByteArray(t),n=new a.Sha1;n.update(e);var r=n.digest();return a.base64.encodeByteArray(r)},g=function(){for(var t=[],e=0;en?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};function M(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}var W=function(t){a.assert(!P(t),"Invalid JSON number");var e,n,r,i,o,s,u,h=11,l=52,c=(1<=Math.pow(2,1-c)?(i=Math.min(Math.floor(Math.log(t)/Math.LN2),c),n=i+c,r=Math.round(t*Math.pow(2,l-i)-Math.pow(2,l))):(n=0,r=Math.round(t/Math.pow(2,1-c-l)))),s=[],o=l;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=h;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse(),u=s.join("");var p="";for(o=0;o<64;o+=8){var d=parseInt(u.substr(o,8),2).toString(16);1===d.length&&(d="0"+d),p+=d}return p.toLowerCase()},Q=function(){return!("object"!==typeof window||!window["chrome"]||!window["chrome"]["extension"]||/^chrome/.test(window.location.href))},q=function(){return"object"===typeof Windows&&"object"===typeof Windows.UI},U=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==t?n="Client doesn't have permission to access the desired data.":"unavailable"==t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r},V=new RegExp("^-?\\d{1,10}$"),H=function(t){if(V.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},j=function(t){try{t()}catch(e){setTimeout((function(){var t=e.stack||"";throw N("Exception was thrown by user callback.",t),e}),Math.floor(0))}},B=function(){var t="object"===typeof window&&window["navigator"]&&window["navigator"]["userAgent"]||"";return t.search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},Y=function(t,e){var n=setTimeout(t,e);return"object"===typeof n&&n["unref"]&&n["unref"](),n},K=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r0&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!0,configurable:!0}),t.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},t.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},t.prototype.popFront=function(){var e=this.pieceNum_;return e=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n0&&n.push(i[r])}return new t(n,0)},t.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;it.getLength())return!1;while(e0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=a.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=a.stringLength(t),this.parts_.length>0&&(this.byteLength_-=1)},t.prototype.checkValid_=function(){if(this.byteLength_>t.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>t.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},t}(),G="5",X="v",$="s",J="r",Z="f",tt="firebaseio.com",et="ls",nt="websocket",rt="long_polling",it=function(){function t(t,e,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=p.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&p.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){var n;if(a.assert("string"===typeof t,"typeof type must == string"),a.assert("object"===typeof e,"typeof params must == object"),t===nt)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==rt)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e["ns"]=this.namespace);var r=[];return M(e,(function(t,e){r.push(t+"="+e)})),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}(); +/** + * @license + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 ot(t){for(var e="",n=t.split("/"),r=0;r0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(o){}e+="/"+i}return e}function st(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=s.__values(t.split("&")),o=i.next();!o.done;o=i.next()){var a=o.value;if(0!==a.length){var u=a.split("=");2===u.length?r[decodeURIComponent(u[0])]=decodeURIComponent(u[1]):N("Invalid query segment '"+a+"' in query '"+t+"'")}}}catch(h){e={error:h}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}var at,ut,ht=function(t){var e=lt(t),n=e.namespace;"firebase"===e.domain&&S(e.host+" is no longer supported. Please use .firebaseio.com instead"),n&&"undefined"!=n||"localhost"===e.domain||S("Cannot parse Firebase url. Please use https://.firebaseio.com"),e.secure||I();var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new it(e.host,e.secure,n,r,"",n!=e.subdomain),path:new K(e.pathString)}},lt=function(t){var e="",n="",r="",i="",o="",s=!0,a="https",u=443;if("string"===typeof t){var h=t.indexOf("//");h>=0&&(a=t.substring(0,h-1),t=t.substring(h+2));var l=t.indexOf("/");-1===l&&(l=t.length);var c=t.indexOf("?");-1===c&&(c=t.length),e=t.substring(0,Math.min(l,c)),l=0?(s="https"===a||"wss"===a,u=parseInt(e.substring(h+1),10)):h=t.length;var d=e.split(".");3===d.length?(n=d[1],r=d[0].toLowerCase(),o=r):2===d.length?n=d[0]:"localhost"===d[0].slice(0,h).toLowerCase()&&(n="localhost"),"ns"in p&&(o=p["ns"])}return{host:e,port:u,domain:n,subdomain:r,secure:s,scheme:a,pathString:i,namespace:o}},ct=/[\[\].#$\/\u0000-\u001F\u007F]/,pt=/[\[\].#$\u0000-\u001F\u007F]/,dt=10485760,ft=function(t){return"string"===typeof t&&0!==t.length&&!ct.test(t)},_t=function(t){return"string"===typeof t&&0!==t.length&&!pt.test(t)},yt=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),_t(t)},vt=function(t){return null===t||"string"===typeof t||"number"===typeof t&&!P(t)||t&&"object"===typeof t&&a.contains(t,".sv")},gt=function(t,e,n,r,i){i&&void 0===n||mt(a.errorPrefix(t,e,i),n,r)},mt=function(t,e,n){var r=n instanceof K?new z(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+r.toErrorString());if("function"===typeof e)throw new Error(t+"contains a function "+r.toErrorString()+" with contents = "+e.toString());if(P(e))throw new Error(t+"contains "+e.toString()+" "+r.toErrorString());if("string"===typeof e&&e.length>dt/3&&a.stringLength(e)>dt)throw new Error(t+"contains a string greater than "+dt+" utf8 bytes "+r.toErrorString()+" ('"+e.substring(0,50)+"...')");if(e&&"object"===typeof e){var i=!1,o=!1;if(M(e,(function(e,n){if(".value"===e)i=!0;else if(".priority"!==e&&".sv"!==e&&(o=!0,!ft(e)))throw new Error(t+" contains an invalid key ("+e+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(e),mt(t,n,r),r.pop()})),i&&o)throw new Error(t+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},Ct=function(t,e){var n,r;for(n=0;n=0;i--)s[i]=t.charAt(r%64),r=Math.floor(r/64);a.assert(0===r,"Cannot push at time == 0");var u=s.join("");if(o){for(i=11;i>=0&&63===n[i];i--)n[i]=0;n[i]++}else for(i=0;i<12;i++)n[i]=Math.floor(64*Math.random());for(i=0;i<12;i++)u+=t.charAt(n[i]);return a.assert(20===u.length,"nextPushId: Length should be 20."),u}}(),Ot=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),At=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new Ot(D,t),r=new Ot(D,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return Ot.MIN},t}(),Ft=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return at},set:function(t){at=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(t,e){return k(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw a.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return Ot.MIN},e.prototype.maxPost=function(){return new Ot(x,at)},e.prototype.makePost=function(t,e){return a.assert("string"===typeof t,"KeyIndex indexValue must always be a string."),new Ot(t,at)},e.prototype.toString=function(){return".key"},e}(At),Lt=new Ft;function Mt(t){ut=t}var Wt,Qt,qt,Ut=function(t){return"number"===typeof t?"number:"+W(t):"string:"+t},Vt=function(t){if(t.isLeafNode()){var e=t.val();a.assert("string"===typeof e||"number"===typeof e||"object"===typeof e&&a.contains(e,".sv"),"Priority must be a string or number.")}else a.assert(t===ut||t.isEmpty(),"priority of unexpected type.");a.assert(t===ut||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Ht=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,a.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Vt(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return Wt},set:function(t){Wt=t},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.priorityNode_},t.prototype.updatePriority=function(e){return new t(this.value_,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(a.assert(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Ut(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?W(this.value_):this.value_,this.lazyHash_=v(t)}return this.lazyHash_},t.prototype.getValue=function(){return this.value_},t.prototype.compareTo=function(e){return e===t.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof t.__childrenNodeConstructor?-1:(a.assert(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))},t.prototype.compareToLeafNode_=function(e){var n=typeof e.value_,r=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(n),o=t.VALUE_TYPE_ORDER.indexOf(r);return a.assert(i>=0,"Unknown leaf type: "+n),a.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_0},t.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},t}(),$t=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:Zt.EMPTY_NODE,this.right=null!=o?o:Zt.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},t.prototype.minKey=function(){return this.min_().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r,i;return i=this,r=n(t,i.key),i=r<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return Zt.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()},t.prototype.remove=function(t,e){var n,r;if(n=this,e(t,n.key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return Zt.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},t.prototype.isRed_=function(){return this.color},t.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},t.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t},t.prototype.rotateLeft_=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight_=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},t.prototype.check_=function(){var t;if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");if(t=this.left.check_(),t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Jt=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new $t(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.check_=function(){return 0},t.prototype.isRed_=function(){return!1},t}(),Zt=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.comparator_=e,this.root_=n}return t.prototype.insert=function(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,$t.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,$t.BLACK,null,null))},t.prototype.get=function(t){var e,n=this.root_;while(!n.isEmpty()){if(e=this.comparator_(t,n.key),0===e)return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){var e,n=this.root_,r=null;while(!n.isEmpty()){if(e=this.comparator_(t,n.key),0===e){if(n.left.isEmpty())return r?r.key:null;n=n.left;while(!n.right.isEmpty())n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")},t.prototype.isEmpty=function(){return this.root_.isEmpty()},t.prototype.count=function(){return this.root_.count()},t.prototype.minKey=function(){return this.root_.minKey()},t.prototype.maxKey=function(){return this.root_.maxKey()},t.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},t.prototype.getIterator=function(t){return new Xt(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Xt(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Xt(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Xt(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new Jt,t}(),te=Math.log(2),ee=function(){function t(t){var e=function(t){return parseInt(Math.log(t)/te,10)},n=function(t){return parseInt(Array(t+1).join("1"),2)};this.count=e(t+1),this.current_=this.count-1;var r=n(this.count);this.bits_=t+1&r}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<0)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===he?-1:0},t.prototype.withIndex=function(e){if(e===Lt||this.indexMap_.hasIndex(e))return this;var n=this.indexMap_.addIndex(e,this.children_);return new t(this.children_,this.priorityNode_,n)},t.prototype.isIndexed=function(t){return t===Lt||this.indexMap_.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){var n=this.getIterator(Gt),r=e.getIterator(Gt),i=n.getNext(),o=r.getNext();while(i&&o){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.resolveIndex_=function(t){return t===Lt?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),ue=function(t){function e(){return t.call(this,new Zt(se),ae.EMPTY_NODE,ie.Default)||this}return s.__extends(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return ae.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(ae),he=new ue;Object.defineProperties(Ot,{MIN:{value:new Ot(D,ae.EMPTY_NODE)},MAX:{value:new Ot(x,he)}}),Ft.__EMPTY_NODE=ae.EMPTY_NODE,Ht.__childrenNodeConstructor=ae,Mt(he),Bt(he); +/** + * @license + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 le=!0;function ce(t,e){if(void 0===e&&(e=null),null===t)return ae.EMPTY_NODE;if("object"===typeof t&&".priority"in t&&(e=t[".priority"]),a.assert(null===e||"string"===typeof e||"number"===typeof e||"object"===typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"===typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!==typeof t||".sv"in t){var n=t;return new Ht(n,ce(e))}if(t instanceof Array||!le){var r=ae.EMPTY_NODE;return M(t,(function(e,n){if(a.contains(t,e)&&"."!==e.substring(0,1)){var i=ce(n);!i.isLeafNode()&&i.isEmpty()||(r=r.updateImmediateChild(e,i))}})),r.updatePriority(ce(e))}var i=[],o=!1,s=t;if(M(s,(function(t,e){if("."!==t.substring(0,1)){var n=ce(e);n.isEmpty()||(o=o||!n.getPriority().isEmpty(),i.push(new Ot(t,n)))}})),0==i.length)return ae.EMPTY_NODE;var u=ne(i,oe,(function(t){return t.name}),se);if(o){var h=ne(i,Gt.getCompare());return new ae(u,ce(e),new ie({".priority":h},{".priority":Gt}))}return new ae(u,ce(e),ie.Default)}jt(ce); +/** + * @license + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 pe,de,fe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?k(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return Ot.MIN},e.prototype.maxPost=function(){return Ot.MAX},e.prototype.makePost=function(t,e){var n=ce(t);return new Ot(e,n)},e.prototype.toString=function(){return".value"},e}(At),_e=new fe,ye=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,a.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return s.__extends(e,t),e.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?k(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=ce(t),r=ae.EMPTY_NODE.updateChild(this.indexPath_,n);return new Ot(e,r)},e.prototype.maxPost=function(){var t=ae.EMPTY_NODE.updateChild(this.indexPath_,he);return new Ot(x,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(At),ve=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return a.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return a.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return a.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return a.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){a.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),St("DataSnapshot.child",1,e,!1);var n=new K(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,Gt)},t.prototype.hasChild=function(t){a.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),St("DataSnapshot.hasChild",1,t,!1);var e=new K(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return a.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;if(a.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),a.validateCallback("DataSnapshot.forEach",1,e,!1),this.node_.isLeafNode())return!1;var r=this.node_;return!!r.forEachChild(this.index_,(function(r,i){return e(new t(i,n.ref_.child(r),Gt))}))},t.prototype.hasChildren=function(){return a.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),t.prototype.numChildren=function(){return a.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return a.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),ge=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+a.stringify(this.snapshot.exportVal())},t}(),me=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path.toString()+":cancel"},t}(),Ce=function(){function t(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new ge("value",this,new ve(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new me(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.callback_||!this.callback_||e.callback_===this.callback_&&e.context_===this.context_)},t.prototype.hasAnyCallback=function(){return null!==this.callback_},t}(),Ee=function(){function t(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,a.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new me(this,t,e):null},t.prototype.createEvent=function(t,e){a.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new ge(t.type,this,new ve(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){var n=this;if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var r=Object.keys(e.callbacks_),i=Object.keys(this.callbacks_),o=r.length,s=i.length;if(o===s){if(1===o){var a=r[0],u=i[0];return u===a&&(!e.callbacks_[a]||!this.callbacks_[u]||e.callbacks_[a]===this.callbacks_[u])}return i.every((function(t){return e.callbacks_[t]===n.callbacks_[t]}))}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),we=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return a.assert(pe,"Reference.ts has not been loaded"),pe},set:function(t){pe=t},enumerable:!0,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===Lt){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){var o=t.getIndexStartName();if(o!=D)throw new Error(r);if("string"!==typeof e)throw new Error(i)}if(t.hasEnd()){var s=t.getIndexEndName();if(s!=x)throw new Error(r);if("string"!==typeof n)throw new Error(i)}}else if(t.getIndex()===Gt){if(null!=e&&!vt(e)||null!=n&&!vt(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(a.assert(t.getIndex()instanceof ye||t.getIndex()===_e,"unknown index type."),null!=e&&"object"===typeof e||null!=n&&"object"===typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.queryParams_},t.prototype.getRef=function(){return a.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){a.validateArgCount("Query.on",2,4,arguments.length),bt("Query.on",1,e,!1),a.validateCallback("Query.on",2,n,!1);var o=t.getCancelAndContextArgs_("Query.on",r,i);if("value"===e)this.onValueEvent(n,o.cancel,o.context);else{var s={};s[e]=n,this.onChildEvent(s,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new Ce(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new Ee(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){a.validateArgCount("Query.off",0,3,arguments.length),bt("Query.off",1,t,!0),a.validateCallback("Query.off",2,e,!0),a.validateContextObject("Query.off",3,n,!0);var r=null,i=null;if("value"===t){var o=e||null;r=new Ce(o,null,n||null)}else t&&(e&&(i={},i[t]=e),r=new Ee(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;a.validateArgCount("Query.once",1,4,arguments.length),bt("Query.once",1,e,!1),a.validateCallback("Query.once",2,n,!0);var s=t.getCancelAndContextArgs_("Query.once",r,i),u=!0,h=new a.Deferred;h.promise.catch((function(){}));var l=function(t){u&&(u=!1,o.off(e,l),n&&n.bind(s.context)(t),h.resolve(t))};return this.on(e,l,(function(t){o.off(e,l),s.cancel&&s.cancel.bind(s.context)(t),h.reject(t)})),h.promise},t.prototype.limitToFirst=function(e){if(a.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=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 t(this.repo,this.path,this.queryParams_.limitToFirst(e),this.orderByCalled_)},t.prototype.limitToLast=function(e){if(a.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=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 t(this.repo,this.path,this.queryParams_.limitToLast(e),this.orderByCalled_)},t.prototype.orderByChild=function(e){if(a.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===e)throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===e)throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');St("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new K(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var r=new ye(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){a.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(Lt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){a.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(Gt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){a.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(_e);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),a.validateArgCount("Query.startAt",0,2,arguments.length),gt("Query.startAt",1,e,this.path,!0),Tt("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),a.validateArgCount("Query.endAt",0,2,arguments.length),gt("Query.endAt",1,e,this.path,!0),Tt("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.equalTo=function(t,e){if(a.validateArgCount("Query.equalTo",1,2,arguments.length),gt("Query.equalTo",1,t,this.path,!1),Tt("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return a.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return a.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},t.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=F(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(a.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){var n="Query.isEqual failed: First argument must be an instance of firebase.database.Query.";throw new Error(n)}var r=this.repo===e.repo,i=this.path.equals(e.path),o=this.queryIdentifier()===e.queryIdentifier();return r&&i&&o},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,a.validateCallback(t,3,r.cancel,!0),r.context=n,a.validateContextObject(t,4,r.context,!0);else if(e)if("object"===typeof e&&null!==e)r.context=e;else{if("function"!==typeof e)throw new Error(a.errorPrefix(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),be=function(){function t(){this.value=null,this.children=new Map}return t.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&&this.children.size>0){var e=t.getFront();if(t=t.popFront(),this.children.has(e)){var n=this.children.get(e);return n.find(t)}return null}return null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value=n,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(e,n);else{var r=e.getFront();this.children.has(r)||this.children.set(r,new t);var i=this.children.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.value=null,this.children.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var e=this.value;this.value=null;var n=this;return e.forEachChild(Gt,(function(t,e){n.remember(new K(t),e)})),this.forget(t)}if(this.children.size>0){var r=t.getFront();if(t=t.popFront(),this.children.has(r)){var i=this.children.get(r).forget(t);i&&this.children.delete(r)}return 0===this.children.size}return!0},t.prototype.forEachTree=function(t,e){null!==this.value?e(t,this.value):this.forEachChild((function(n,r){var i=new K(t.toString()+"/"+n);r.forEachTree(i,e)}))},t.prototype.forEachChild=function(t){this.children.forEach((function(e,n){t(n,e)}))},t}(),Te=function(t){return t=t||{},t["timestamp"]=t["timestamp"]||(new Date).getTime(),t},Se=function(t,e){return t&&"object"===typeof t?(a.assert(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t},Ne=function(t,e){var n=new be;return t.forEachTree(new K(""),(function(t,r){n.remember(t,Ie(r,e))})),n},Ie=function(t,e){var n,r=t.getPriority().val(),i=Se(r,e);if(t.isLeafNode()){var o=t,s=Se(o.getValue(),e);return s!==o.getValue()||i!==o.getPriority().val()?new Ht(s,ce(i)):t}var a=t;return n=a,i!==a.getPriority().val()&&(n=n.updatePriority(new Ht(i))),a.forEachChild(Gt,(function(t,r){var i=Ie(r,e);i!==r&&(n=n.updateImmediateChild(t,i))})),n};(function(t){t[t["OVERWRITE"]=0]="OVERWRITE",t[t["MERGE"]=1]="MERGE",t[t["ACK_USER_WRITE"]=2]="ACK_USER_WRITE",t[t["LISTEN_COMPLETE"]=3]="LISTEN_COMPLETE"})(de||(de={}));var Pe,Re,De=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,a.assert(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),xe=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=de.ACK_USER_WRITE,this.source=De.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return a.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new K(e));return new t(K.Empty,n,this.revert)}return a.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),ke=function(){return Pe||(Pe=new Zt(O)),Pe},Oe=function(){function t(t,e){void 0===e&&(e=ke()),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return M(e,(function(t,e){n=n.set(new K(t),e)})),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:K.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);if(null!=i){var o=new K(n).child(i.path);return{path:o,value:i.value}}return null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,(function(){return!0}))},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.set(e.popFront(),n),s=this.children.insert(r,o);return new t(this.value,s)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.setTree(e.popFront(),n),s=void 0;return s=o.isEmpty()?this.children.remove(r):this.children.insert(r,o),new t(this.value,s)},t.prototype.fold=function(t){return this.fold_(K.Empty,t)},t.prototype.fold_=function(t,e){var n={};return this.children.inorderTraversal((function(r,i){n[r]=i.fold_(t.child(r),e)})),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.findOnPath_(t,K.Empty,e)},t.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,K.Empty,e)},t.prototype.foreachOnPath_=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.foreach_(K.Empty,t)},t.prototype.foreach_=function(t,e){this.children.inorderTraversal((function(n,r){r.foreach_(t.child(n),e)})),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal((function(e,n){n.value&&t(e,n.value)}))},t.Empty=new t(null),t}(),Ae=function(){function t(t,e){this.source=t,this.path=e,this.type=de.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,K.Empty):new t(this.source,this.path.popFront())},t}(),Fe=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=de.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,K.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),Le=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=de.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new K(e));return n.isEmpty()?null:n.value?new Fe(this.source,K.Empty,n.value):new t(this.source,K.Empty,n)}return a.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},t}(),Me=function(){function t(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}return t.prototype.isFullyInitialized=function(){return this.fullyInitialized_},t.prototype.isFiltered=function(){return this.filtered_},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},t.prototype.getNode=function(){return this.node_},t}(),We=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new Me(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new Me(e,n,r))},t.prototype.getEventCache=function(){return this.eventCache_},t.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},t.prototype.getServerCache=function(){return this.serverCache_},t.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},t.Empty=new t(new Me(ae.EMPTY_NODE,!1,!1),new Me(ae.EMPTY_NODE,!1,!1)),t}(),Qe=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),qe=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,o){a.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()==n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Qe.childRemovedChange(e,s)):a.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(Qe.childAddedChange(e,n)):o.trackChildChange(Qe.childChangedChange(e,n,s))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(Gt,(function(t,r){e.hasChild(t)||n.trackChildChange(Qe.childRemovedChange(t,r))})),e.isLeafNode()||e.forEachChild(Gt,(function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(Qe.childChangedChange(e,r,i))}else n.trackChildChange(Qe.childAddedChange(e,r))}))),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?ae.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.index_},t}(),Ue=function(){function t(){this.changeMap=new Map}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;a.assert(e==Qe.CHILD_ADDED||e==Qe.CHILD_CHANGED||e==Qe.CHILD_REMOVED,"Only child changes supported for tracking"),a.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e==Qe.CHILD_ADDED&&i==Qe.CHILD_REMOVED)this.changeMap.set(n,Qe.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e==Qe.CHILD_REMOVED&&i==Qe.CHILD_ADDED)this.changeMap.delete(n);else if(e==Qe.CHILD_REMOVED&&i==Qe.CHILD_CHANGED)this.changeMap.set(n,Qe.childRemovedChange(n,r.oldSnap));else if(e==Qe.CHILD_CHANGED&&i==Qe.CHILD_ADDED)this.changeMap.set(n,Qe.childAddedChange(n,t.snapshotNode));else{if(e!=Qe.CHILD_CHANGED||i!=Qe.CHILD_CHANGED)throw a.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,Qe.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},t.prototype.getChanges=function(){return Array.from(this.changeMap.values())},t}(),Ve=function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}(),He=new Ve,je=function(){function t(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}return t.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Me(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),Be=function(){function t(t,e){this.viewCache=t,this.changes=e}return t}(),Ye=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){a.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),a.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,s,u=new Ue;if(n.type===de.OVERWRITE){var h=n;h.source.fromUser?o=this.applyUserOverwrite_(e,h.path,h.snap,r,i,u):(a.assert(h.source.fromServer,"Unknown source."),s=h.source.tagged||e.getServerCache().isFiltered()&&!h.path.isEmpty(),o=this.applyServerOverwrite_(e,h.path,h.snap,r,i,s,u))}else if(n.type===de.MERGE){var l=n;l.source.fromUser?o=this.applyUserMerge_(e,l.path,l.children,r,i,u):(a.assert(l.source.fromServer,"Unknown source."),s=l.source.tagged||e.getServerCache().isFiltered(),o=this.applyServerMerge_(e,l.path,l.children,r,i,s,u))}else if(n.type===de.ACK_USER_WRITE){var c=n;o=c.revert?this.revertUserWrite_(e,c.path,r,i,u):this.ackUserWrite_(e,c.path,c.affectedTree,r,i,u)}else{if(n.type!==de.LISTEN_COMPLETE)throw a.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(e,n.path,r,u)}var p=u.getChanges();return t.maybeAddValueEvent_(e,o,p),new Be(o,p)},t.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Qe.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,u=void 0;if(e.isEmpty())if(a.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var h=t.getCompleteServerSnap(),l=h instanceof ae?h:ae.EMPTY_NODE,c=n.calcCompleteEventChildren(l);s=this.filter_.updateFullNode(t.getEventCache().getNode(),c,i)}else{var p=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),p,i)}else{var d=e.getFront();if(".priority"==d){a.assert(1==e.getLength(),"Can't have a priority with additional path components");var f=o.getNode();u=t.getServerCache().getNode();var _=n.calcEventCacheAfterServerOverwrite(e,f,u);s=null!=_?this.filter_.updatePriority(f,_):o.getNode()}else{var y=e.popFront(),v=void 0;if(o.isCompleteForChild(d)){u=t.getServerCache().getNode();var g=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),u);v=null!=g?o.getNode().getImmediateChild(d).updateChild(y,g):o.getNode().getImmediateChild(d)}else v=n.calcCompleteChild(d,t.getServerCache());s=null!=v?this.filter_.updateChild(o.getNode(),d,v,y,r,i):o.getNode()}}return t.updateEventSnap(s,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},t.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,s){var a,u=t.getServerCache(),h=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())a=h.updateFullNode(u.getNode(),n,null);else if(h.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(e,n);a=h.updateFullNode(u.getNode(),l,null)}else{var c=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var p=e.popFront(),d=u.getNode().getImmediateChild(c),f=d.updateChild(p,n);a=".priority"==c?h.updatePriority(u.getNode(),f):h.updateChild(u.getNode(),c,f,p,He,null)}var _=t.updateServerSnap(a,u.isFullyInitialized()||e.isEmpty(),h.filtersNodes()),y=new je(r,_,i);return this.generateEventCacheAfterServerEvent_(_,e,r,y,s)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,u=t.getEventCache(),h=new je(r,t,i);if(e.isEmpty())a=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),s=t.updateEventSnap(a,!0,this.filter_.filtersNodes());else{var l=e.getFront();if(".priority"===l)a=this.filter_.updatePriority(t.getEventCache().getNode(),n),s=t.updateEventSnap(a,u.isFullyInitialized(),u.isFiltered());else{var c=e.popFront(),p=u.getNode().getImmediateChild(l),d=void 0;if(c.isEmpty())d=n;else{var f=h.getCompleteChild(l);d=null!=f?".priority"===c.getBack()&&f.getChild(c.parent()).isEmpty()?f:f.updateChild(c,n):ae.EMPTY_NODE}if(p.equals(d))s=t;else{var _=this.filter_.updateChild(u.getNode(),l,d,c,h,o);s=t.updateEventSnap(_,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return s},t.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.applyUserMerge_=function(e,n,r,i,o,s){var a=this,u=e;return r.foreach((function(r,h){var l=n.child(r);t.cacheHasChild_(e,l.getFront())&&(u=a.applyUserOverwrite_(u,l,h,i,o,s))})),r.foreach((function(r,h){var l=n.child(r);t.cacheHasChild_(e,l.getFront())||(u=a.applyUserOverwrite_(u,l,h,i,o,s))})),u},t.prototype.applyMerge_=function(t,e){return e.foreach((function(e,n){t=t.updateChild(e,n)})),t},t.prototype.applyServerMerge_=function(t,e,n,r,i,o,s){var a=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,h=t;u=e.isEmpty()?n:Oe.Empty.setTree(e,n);var l=t.getServerCache().getNode();return u.children.inorderTraversal((function(e,n){if(l.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),c=a.applyMerge_(u,n);h=a.applyServerOverwrite_(h,new K(e),c,r,i,o,s)}})),u.children.inorderTraversal((function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!l.hasChild(e)&&!u){var c=t.getServerCache().getNode().getImmediateChild(e),p=a.applyMerge_(c,n);h=a.applyServerOverwrite_(h,new K(e),p,r,i,o,s)}})),h},t.prototype.ackUserWrite_=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var s=t.getServerCache().isFiltered(),a=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&a.isFullyInitialized()||a.isCompleteForPath(e))return this.applyServerOverwrite_(t,e,a.getNode().getChild(e),r,i,s,o);if(e.isEmpty()){var u=Oe.Empty;return a.getNode().forEachChild(Lt,(function(t,e){u=u.set(new K(t),e)})),this.applyServerMerge_(t,e,u,r,i,s,o)}return t}var h=Oe.Empty;return n.foreach((function(t,n){var r=e.child(t);a.isCompleteForPath(r)&&(h=h.set(t,a.getNode().getChild(r)))})),this.applyServerMerge_(t,e,h,r,i,s,o)},t.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,He,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new je(n,t,r),u=t.getEventCache().getNode(),h=void 0;if(e.isEmpty()||".priority"===e.getFront()){var l=void 0;if(t.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var c=t.getServerCache().getNode();a.assert(c instanceof ae,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(c)}l=l,h=this.filter_.updateFullNode(u,l,i)}else{var p=e.getFront(),d=n.calcCompleteChild(p,t.getServerCache());null==d&&t.getServerCache().isCompleteForChild(p)&&(d=u.getImmediateChild(p)),h=null!=d?this.filter_.updateChild(u,p,d,e.popFront(),s,i):t.getEventCache().getNode().hasChild(p)?this.filter_.updateChild(u,p,ae.EMPTY_NODE,e.popFront(),s,i):u,h.isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap()),o.isLeafNode()&&(h=this.filter_.updateFullNode(h,o,i)))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(K.Empty),t.updateEventSnap(h,o,this.filter_.filtersNodes())},t}(),Ke=function(){function t(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach((function(t){t.type===Qe.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Qe.childMovedChange(t.childName,t.snapshotNode))})),this.generateEventsForType_(i,Qe.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,Qe.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,Qe.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,Qe.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,Qe.VALUE,t,n,e),i},t.prototype.generateEventsForType_=function(t,e,n,r,i){var o=this,s=n.filter((function(t){return t.type===e}));s.sort(this.compareChanges_.bind(this)),s.forEach((function(e){var n=o.materializeSingleChange_(e,i);r.forEach((function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.query_))}))}))},t.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type?t:(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_),t)},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw a.assertionError("Should only compare child_ events.");var n=new Ot(t.childName,t.snapshotNode),r=new Ot(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),ze=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new qe(n.getIndex()),i=n.getNodeFilter();this.processor_=new Ye(i);var o=e.getServerCache(),s=e.getEventCache(),a=r.updateFullNode(ae.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(ae.EMPTY_NODE,s.getNode(),null),h=new Me(a,o.isFullyInitialized(),r.filtersNodes()),l=new Me(u,s.isFullyInitialized(),i.filtersNodes());this.viewCache_=new We(l,h),this.eventGenerator_=new Ke(this.query_)}return t.prototype.getQuery=function(){return this.query_},t.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},t.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){a.assert(null==t,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach((function(t){e=e;var i=t.createCancelEvent(e,r);i&&n.push(i)}))}if(t){for(var i=[],o=0;othis.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},t.prototype.addMerge=function(t,e,n){a.assert(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},t.prototype.getWrite=function(t){for(var e=0;e=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);var i=r.visible,o=!1,s=this.allWrites_.length-1;while(i&&s>=0){var u=this.allWrites_[s];u.visible&&(s>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(o=!0)),s--}if(i){if(o)return this.resetTree_(),!0;if(r.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(r.path);else{var h=r.children;M(h,(function(t){e.visibleWrites_=e.visibleWrites_.removeWrite(r.path.child(t))}))}return!0}return!1},t.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(K.Empty)){var s=function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},a=t.layerTree_(this.allWrites_,s,e);l=n||ae.EMPTY_NODE;return a.apply(l)}return null}var u=this.visibleWrites_.getCompleteNode(e);if(null!=u)return u;var h=this.visibleWrites_.childCompoundWrite(e);if(h.isEmpty())return n;if(null!=n||h.hasCompleteWrite(K.Empty)){var l=n||ae.EMPTY_NODE;return h.apply(l)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=ae.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Gt,(function(t,e){n=n.updateImmediateChild(t,e)})),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Gt,(function(t,e){var r=i.childCompoundWrite(new K(t)).apply(e);n=n.updateImmediateChild(t,r)})),i.getCompleteChildren().forEach((function(t){n=n.updateImmediateChild(t.name,t.node)})),n}var o=this.visibleWrites_.childCompoundWrite(t);return o.getCompleteChildren().forEach((function(t){n=n.updateImmediateChild(t.name,t.node)})),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){a.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);if(null!=i)return i;if(n.isCompleteForChild(e)){var o=this.visibleWrites_.childCompoundWrite(r);return o.apply(n.getNode().getImmediateChild(e))}return null},t.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),u=a.getCompleteNode(K.Empty);if(null!=u)s=u;else{if(null==e)return[];s=a.apply(e)}if(s=s.withIndex(o),s.isEmpty()||s.isLeafNode())return[];var h=[],l=o.getCompare(),c=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),p=c.getNext();while(p&&h.length0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},t.DefaultFilter_=function(t){return t.visible},t.layerTree_=function(t,e,n){for(var r=Xe.Empty,i=0;i0&&!r)if(l){var g=null;this.listenProvider_.stopListening(t.queryForListening_(e),g)}else h.forEach((function(e){var n=i.queryToTagMap.get(t.makeQueryKey_(e));i.listenProvider_.stopListening(t.queryForListening_(e),n)}));this.removeTags_(h)}return a},t.prototype.calcCompleteEventCache=function(t,e){var n=!0,r=this.pendingWriteTree_,i=this.syncPointTree_.findOnPath(t,(function(e,n){var r=K.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i}));return r.calcCompleteEventCache(t,i,e,n)},t.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold((function(t,e,n){if(e&&e.hasCompleteView()){var r=e.getCompleteView();return[r]}var i=[];return e&&(i=e.getQueryViews()),M(n,(function(t,e){i=i.concat(e)})),i}))},t.prototype.removeTags_=function(e){for(var n=0;n0&&a.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)})),r&&this.server_.reportStats(n),Y(this.reportStats_.bind(this),Math.floor(2*Math.random()*cn))},t}(),dn=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;ndocument.domain="'+s+'";<\/script>'}var u=""+o+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(u),this.myIFrame.doc.close()}catch(h){w("frame writing exception"),h.stack&&w(h.stack),w(h)}}}return t.createIFrame_=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{var e=t.contentWindow.document;e||w("No IE domain setting required")}catch(r){var n=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var t=this;this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout((function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)}),Math.floor(0)));var e=this.onDisconnect;e&&(this.onDisconnect=null,e())},t.prototype.startLongPoll=function(t,e){this.myID=t,this.myPW=e,this.alive=!0;while(this.newRequest_());},t.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t[bn]=this.myID,t[Tn]=this.myPW,t[Sn]=this.currentSerial;var e=this.urlFn(t),n="",r=0;while(this.pendingSegs.length>0){var i=this.pendingSegs[0];if(!(i.d.length+kn+n.length<=xn))break;var o=this.pendingSegs.shift();n=n+"&"+In+r+"="+o.seg+"&"+Pn+r+"="+o.ts+"&"+Rn+r+"="+o.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},t.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e);var r=function(){n.outstandingRequests.delete(e),n.newRequest_()},i=setTimeout(r,Math.floor(An)),o=function(){clearTimeout(i),r()};this.addTag(t,o)},t.prototype.addTag=function(t,e){var n=this;a.isNodeSdk()?this.doNodeLongPoll(t,e):setTimeout((function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){w("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(i){}}),Math.floor(1))},t}(),Wn="";function Qn(t){Wn=t} +/** + * @license + * Copyright 2017 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 qn=16384,Un=45e3,Vn=null;"undefined"!==typeof MozWebSocket?Vn=MozWebSocket:"undefined"!==typeof WebSocket&&(Vn=WebSocket);var Hn=function(){function t(e,n,r,i){this.connId=e,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=b(this.connId),this.stats_=an.getCollection(n),this.connURL=t.connectionURL_(n,r,i)}return t.connectionURL_=function(t,e,n){var r={};return r[X]=G,!a.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf(tt)&&(r[J]=Z),e&&(r[$]=e),n&&(r[et]=n),t.connectionURL(nt,r)},t.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,p.set("previous_websocket_failure",!0);try{if(a.isNodeSdk()){var i=a.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/"+G+"/"+Wn+"/"+r.platform+"/"+i}},s=Object({NODE_ENV:"production",VUE_APP_NEWS_URL:"https://littlealchemy2.com/public/news/v1/w",VUE_APP_ENCYCLOPEDIA_ORIGIN:"https://littlealchemy2.com",BASE_URL:"/"}),u=0==this.connURL.indexOf("wss://")?s["HTTPS_PROXY"]||s["https_proxy"]:s["HTTP_PROXY"]||s["http_proxy"];u&&(o["proxy"]={origin:u}),this.mySock=new Vn(this.connURL,[],o)}else this.mySock=new Vn(this.connURL)}catch(l){this.log_("Error instantiating WebSocket.");var h=l.message||l.data;return h&&this.log_(h),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},t.prototype.start=function(){},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){var e=!1;if("undefined"!==typeof navigator&&navigator.userAgent){var n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&r.length>1&&parseFloat(r[1])<4.4&&(e=!0)}return!e&&null!==Vn&&!t.forceDisallow_},t.previouslyFailed=function(){return p.isInMemoryStorage||!0===p.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){p.remove("previous_websocket_failure")},t.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var n=a.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(a.assert(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},t.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t["data"];if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},t.prototype.send=function(t){this.resetKeepAlive();var e=a.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=L(e,qn);n.length>1&&this.sendString_(String(n.length));for(var r=0;r0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),Bn=6e4,Yn=5e3,Kn=10240,zn=102400,Gn="t",Xn="d",$n="s",Jn="r",Zn="e",tr="o",er="a",nr="n",rr="p",ir="h",or=function(){function t(t,e,n,r,i,o,s){this.id=t,this.repoInfo_=e,this.onMessage_=n,this.onReady_=r,this.onDisconnect_=i,this.onKill_=o,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=b("c:"+this.id+":"),this.transportManager_=new jn(e),this.log_("Connection created"),this.start_()}return t.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e["responsesRequiredToBeHealthy"]||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout((function(){t.conn_&&t.conn_.open(n,r)}),Math.floor(0));var i=e["healthyTimeout"]||0;i>0&&(this.healthyTimeout_=Y((function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&t.conn_.bytesReceived>zn?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes. Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&t.conn_.bytesSent>Kn?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes. Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))}),Math.floor(i)))},t.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.disconnReceiver_=function(t){var e=this;return function(n){t===e.conn_?e.onConnectionLost_(n):t===e.secondaryConn_?(e.log_("Secondary connection lost."),e.onSecondaryConnectionLost_()):e.log_("closing an old connection")}},t.prototype.connReceiver_=function(t){var e=this;return function(n){2!=e.state_&&(t===e.rx_?e.onPrimaryMessageReceived_(n):t===e.secondaryConn_?e.onSecondaryMessageReceived_(n):e.log_("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},t.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)},t.prototype.onSecondaryControl_=function(t){if(Gn in t){var e=t[Gn];e===er?this.upgradeIfSecondaryHealthy_():e===Jn?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):e===tr&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},t.prototype.onSecondaryMessageReceived_=function(t){var e=A("t",t),n=A("d",t);if("c"==e)this.onSecondaryControl_(n);else{if("d"!=e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.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:rr,d:{}}}))},t.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:er,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:nr,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},t.prototype.onPrimaryMessageReceived_=function(t){var e=A("t",t),n=A("d",t);"c"==e?this.onControl_(n):"d"==e&&this.onDataMessage_(n)},t.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},t.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},t.prototype.onControl_=function(t){var e=A(Gn,t);if(Xn in t){var n=t[Xn];if(e===ir)this.onHandshake_(n);else if(e===nr){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;rcr&&(this.reconnectDelay_=ar),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var e=(new Date).getTime()-this.lastConnectionAttemptTime_,n=Math.max(0,this.reconnectDelay_-e);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*lr)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+e.nextConnectionId_++,o=this,s=this.lastSessionId,u=!1,h=null,l=function(){h?h.close():(u=!0,r())},c=function(t){a.assert(h,"sendRequest call when we're not connected not allowed."),h.sendRequest(t)};this.realtime_={close:l,sendRequest:c};var p=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(p).then((function(e){u?w("getToken() completed but was canceled"):(w("getToken() completed. Creating connection."),o.authToken_=e&&e.accessToken,h=new or(i,o.repoInfo_,t,n,r,(function(t){N(t+" ("+o.repoInfo_.toString()+")"),o.interrupt(pr)}),s))})).then(null,(function(t){o.log_("Failed to get token: "+t),u||(a.CONSTANTS.NODE_ADMIN&&N(t),l())}))}},e.prototype.interrupt=function(t){w("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},e.prototype.resume=function(t){w("Resuming connection for reason: "+t),delete this.interruptReasons_[t],a.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=ar,this.realtime_||this.scheduleConnect_(0))},e.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},e.prototype.cancelSentTransactions_=function(){for(var t=0;t=dr&&(this.reconnectDelay_=hr,this.authTokenProvider_.notifyForInvalidToken()))},e.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t["msg"].replace("\n","\nFIREBASE: "))},e.prototype.restoreState_=function(){var t,e,n,r;this.tryAuth();try{for(var i=s.__values(this.listens.values()),o=i.next();!o.done;o=i.next()){var a=o.value;try{for(var u=(n=void 0,s.__values(a.values())),h=u.next();!h.done;h=u.next()){var l=h.value;this.sendListen_(l)}}catch(d){n={error:d}}finally{try{h&&!h.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}}catch(f){t={error:f}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}for(var c=0;c=200&&u.status<300){try{t=a.jsonEval(u.responseText)}catch(e){N("Failed to parse JSON response for "+s+": "+u.responseText)}n(null,t)}else 401!==u.status&&404!==u.status&&N("Got unsuccessful REST response for "+s+" Status: "+u.status),n(u.status);n=null}},u.open("GET",s,!0),u.send()}))},e}(sr),yr="repo_interrupt",vr=function(){function t(t,e,n){var i,o=this;if(this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new dn,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new be,this.persistentConnection_=null,i="undefined"!==typeof r&&Object({NODE_ENV:"production",VUE_APP_NEWS_URL:"https://littlealchemy2.com/public/news/v1/w",VUE_APP_ENCYCLOPEDIA_ORIGIN:"https://littlealchemy2.com",BASE_URL:"/"})[_]?new on(n):new nn(n),this.stats_=an.getCollection(t),e||B())this.server_=new _r(this.repoInfo_,this.onDataUpdate_.bind(this),i),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var s=n.options["databaseAuthVariableOverride"];if("undefined"!==typeof s&&null!==s){if("object"!==typeof s)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{a.stringify(s)}catch(u){throw new Error("Invalid authOverride provided: "+u)}}this.persistentConnection_=new fr(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,s),this.server_=this.persistentConnection_}i.addTokenChangeListener((function(t){o.server_.refreshAuthToken(t)})),this.statsReporter_=an.getOrCreateReporter(t,(function(){return new pn(o.stats_,o.server_)})),this.transactions_init_(),this.infoData_=new en,this.infoSyncTree_=new tn({startListening:function(t,e,n,r){var i=[],s=o.infoData_.getNode(t.path);return s.isEmpty()||(i=o.infoSyncTree_.applyServerOverwrite(t.path,s),setTimeout((function(){r("ok")}),0)),i},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new tn({startListening:function(t,e,n,r){return o.server_.listen(t,n,e,(function(e,n){var i=r(e,n);o.eventQueue_.raiseEventsForChangedPath(t.path,i)})),[]},stopListening:function(t,e){o.server_.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},t.prototype.name=function(){return this.repoInfo_.namespace},t.prototype.serverTime=function(){var t=this.infoData_.getNode(new K(".info/serverTimeOffset")),e=t.val()||0;return(new Date).getTime()+e},t.prototype.generateServerValues=function(){return Te({timestamp:this.serverTime()})},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new K(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var s=a.map(e,(function(t){return ce(t)}));o=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var u=ce(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var h=a.map(e,(function(t){return ce(t)}));o=this.serverSyncTree_.applyServerMerge(i,h)}else{var l=ce(e);o=this.serverSyncTree_.applyServerOverwrite(i,l)}var c=i;o.length>0&&(c=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(c,o)},t.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},t.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},t.prototype.onServerInfoUpdate_=function(t){var e=this;M(t,(function(t,n){e.updateInfo_(t,n)}))},t.prototype.updateInfo_=function(t,e){var n=new K("/.info/"+t),r=ce(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},t.prototype.getNextWriteId_=function(){return this.nextWriteId_++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.log_("set",{path:t.toString(),value:e,priority:n});var o=this.generateServerValues(),s=ce(e,n),a=Ie(s,o),u=this.getNextWriteId_(),h=this.serverSyncTree_.applyUserOverwrite(t,a,u,!0);this.eventQueue_.queueEvents(h),this.server_.put(t.toString(),s.val(!0),(function(e,n){var o="ok"===e;o||N("set at "+t+" failed: "+e);var s=i.serverSyncTree_.ackUserWrite(u,!o);i.eventQueue_.raiseEventsForChangedPath(t,s),i.callOnCompleteCallback(r,e,n)}));var l=this.abortTransactions_(t);this.rerunTransactions_(l),this.eventQueue_.raiseEventsForChangedPath(l,[])},t.prototype.update=function(t,e,n){var r=this;this.log_("update",{path:t.toString(),value:e});var i=!0,o=this.generateServerValues(),s={};if(M(e,(function(t,e){i=!1;var n=ce(e);s[t]=Ie(n,o)})),i)w("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var a=this.getNextWriteId_(),u=this.serverSyncTree_.applyUserMerge(t,s,a);this.eventQueue_.queueEvents(u),this.server_.merge(t.toString(),e,(function(e,i){var o="ok"===e;o||N("update at "+t+" failed: "+e);var s=r.serverSyncTree_.ackUserWrite(a,!o),u=s.length>0?r.rerunTransactions_(t):t;r.eventQueue_.raiseEventsForChangedPath(u,s),r.callOnCompleteCallback(n,e,i)})),M(e,(function(e){var n=r.abortTransactions_(t.child(e));r.rerunTransactions_(n)})),this.eventQueue_.raiseEventsForChangedPath(t,[])}},t.prototype.runOnDisconnectEvents_=function(){var t=this;this.log_("onDisconnectEvents");var e=this.generateServerValues(),n=Ne(this.onDisconnect_,e),r=[];n.forEachTree(K.Empty,(function(e,n){r=r.concat(t.serverSyncTree_.applyServerOverwrite(e,n));var i=t.abortTransactions_(e);t.rerunTransactions_(i)})),this.onDisconnect_=new be,this.eventQueue_.raiseEventsForChangedPath(K.Empty,r)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.server_.onDisconnectCancel(t.toString(),(function(r,i){"ok"===r&&n.onDisconnect_.forget(t),n.callOnCompleteCallback(e,r,i)}))},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=ce(e);this.server_.onDisconnectPut(t.toString(),i.val(!0),(function(e,o){"ok"===e&&r.onDisconnect_.remember(t,i),r.callOnCompleteCallback(n,e,o)}))},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=ce(e,n);this.server_.onDisconnectPut(t.toString(),o.val(!0),(function(e,n){"ok"===e&&i.onDisconnect_.remember(t,o),i.callOnCompleteCallback(r,e,n)}))},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(a.isEmpty(e))return w("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(t.toString(),e,(function(i,o){"ok"===i&&M(e,(function(e,n){var i=ce(n);r.onDisconnect_.remember(t.child(e),i)})),r.callOnCompleteCallback(n,i,o)}))},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt(yr)},t.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume(yr)},t.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!==typeof console){var e;t?(this.statsListener_||(this.statsListener_=new un(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=Object.keys(e).reduce((function(t,e){return Math.max(e.length,t)}),0);M(e,(function(t,e){for(var r=t,i=t.length;i=0;if(_)return null!=i&&i.trackChildChange(Qe.childChangedChange(e,n,p)),u.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Qe.childRemovedChange(e,p));var y=u.updateImmediateChild(e,ae.EMPTY_NODE),v=null!=d&&this.rangedFilter_.matches(d);return v?(null!=i&&i.trackChildChange(Qe.childAddedChange(d.name,d.node)),y.updateImmediateChild(d.name,d.node)):y}return n.isEmpty()?t:c&&o(l,h)>=0?(null!=i&&(i.trackChildChange(Qe.childRemovedChange(l.name,l.node)),i.trackChildChange(Qe.childAddedChange(e,n))),u.updateImmediateChild(e,n).updateImmediateChild(l.name,ae.EMPTY_NODE)):t},t}(),Cr=function(){function t(){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_=Gt}return t.prototype.hasStart=function(){return this.startSet_},t.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return a.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return a.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:D},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:x},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return a.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},t.prototype.getIndex=function(){return this.index_},t.prototype.copy_=function(){var e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e},t.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},t.prototype.limitToFirst=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},t.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},t.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},t.prototype.getQueryObject=function(){var e=t.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[e.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.index_!==Gt&&(n[e.INDEX]=this.index_.toString()),n},t.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==Gt},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new qe(this.getIndex()):this.hasLimit()?new mr(this):new gr(this)},t.prototype.toRestQueryStringParameters=function(){var e,n=t.REST_QUERY_CONSTANTS_,r={};return this.isDefault()?r:(this.index_===Gt?e=n.PRIORITY_INDEX:this.index_===_e?e=n.VALUE_INDEX:this.index_===Lt?e=n.KEY_INDEX:(a.assert(this.index_ instanceof ye,"Unrecognized index type!"),e=this.index_.toString()),r[n.ORDER_BY]=a.stringify(e),this.startSet_&&(r[n.START_AT]=a.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+a.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=a.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+a.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_),r)},t.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"},t.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"},t.DEFAULT=new t,t}(),Er=function(t){function e(e,n){var r=this;if(!(e instanceof vr))throw new Error("new Reference() no longer supported - use app.database().");return r=t.call(this,e,n,Cr.DEFAULT,!1)||this,r}return s.__extends(e,t),e.prototype.getKey=function(){return a.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return a.validateArgCount("Reference.child",1,1,arguments.length),"number"===typeof t?t=String(t):t instanceof K||(null===this.path.getFront()?Nt("Reference.child",1,t,!1):St("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){a.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){a.validateArgCount("Reference.root",0,0,arguments.length);var t=this;while(null!==t.getParent())t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){a.validateArgCount("Reference.set",1,2,arguments.length),It("Reference.set",this.path),gt("Reference.set",1,t,this.path,!1),a.validateCallback("Reference.set",2,e,!0);var n=new a.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(a.validateArgCount("Reference.update",1,2,arguments.length),It("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;M(this.node_.children,(function(r,i){e(new t(r,n,i))}))},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild((function(e){e.forEachDescendant(t,!0,n)})),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){var n=e?this:this.parent();while(null!==n){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild((function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)}))},t.prototype.path=function(){return new K(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},t.prototype.name=function(){return this.name_},t.prototype.parent=function(){return this.parent_},t.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},t.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=a.contains(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},t}();(function(t){t[t["RUN"]=0]="RUN",t[t["SENT"]=1]="SENT",t[t["COMPLETED"]=2]="COMPLETED",t[t["SENT_NEEDS_ABORT"]=3]="SENT_NEEDS_ABORT",t[t["NEEDS_ABORT"]=4]="NEEDS_ABORT"})(wr||(wr={})),vr.MAX_TRANSACTION_RETRIES_=25,vr.prototype.transactions_init_=function(){this.transactionQueueTree_=new Tr},vr.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},o=new Er(this,t);o.on("value",i);var s=function(){o.off("value",i)},u={path:t,update:e,onComplete:n,status:null,order:y(),applyLocally:r,retryCount:0,unwatcher:s,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},h=this.getLatestState_(t);u.currentInputSnapshot=h;var l=u.update(h.val());if(void 0===l){if(u.unwatcher(),u.currentOutputSnapshotRaw=null,u.currentOutputSnapshotResolved=null,u.onComplete){var c=new ve(u.currentInputSnapshot,new Er(this,u.path),Gt);u.onComplete(null,!1,c)}}else{mt("transaction failed: Data returned ",l,u.path),u.status=wr.RUN;var p=this.transactionQueueTree_.subTree(t),d=p.getValue()||[];d.push(u),p.setValue(d);var f=void 0;if("object"===typeof l&&null!==l&&a.contains(l,".priority"))f=a.safeGet(l,".priority"),a.assert(vt(f),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else{var _=this.serverSyncTree_.calcCompleteEventCache(t)||ae.EMPTY_NODE;f=_.getPriority().val()}f=f;var v=this.generateServerValues(),g=ce(l,f),m=Ie(g,v);u.currentOutputSnapshotRaw=g,u.currentOutputSnapshotResolved=m,u.currentWriteId=this.getNextWriteId_();var C=this.serverSyncTree_.applyUserOverwrite(t,m,u.currentWriteId,u.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,C),this.sendReadyTransactions_()}},vr.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||ae.EMPTY_NODE},vr.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);a.assert(n.length>0,"Sending zero length transaction queue");var r=n.every((function(t){return t.status===wr.RUN}));r&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild((function(t){e.sendReadyTransactions_(t)}))},vr.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map((function(t){return t.currentWriteId})),i=this.getLatestState_(t,r),o=i,s=i.hash(),u=0;u=vr.MAX_TRANSACTION_RETRIES_)l=!0,c="maxretry",r=r.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var p=this.getLatestState_(u.path,o);u.currentInputSnapshot=p;var d=t[s].update(p.val());if(void 0!==d){mt("transaction failed: Data returned ",d,u.path);var f=ce(d),_="object"===typeof d&&null!=d&&a.contains(d,".priority");_||(f=f.updatePriority(p.getPriority()));var y=u.currentWriteId,v=this.generateServerValues(),g=Ie(f,v);u.currentOutputSnapshotRaw=f,u.currentOutputSnapshotResolved=g,u.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(y),1),r=r.concat(this.serverSyncTree_.applyUserOverwrite(u.path,g,u.currentWriteId,u.applyLocally)),r=r.concat(this.serverSyncTree_.ackUserWrite(y,!0))}else l=!0,c="nodata",r=r.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,r),r=[],l&&(t[s].status=wr.COMPLETED,function(t){setTimeout(t,Math.floor(0))}(t[s].unwatcher),t[s].onComplete))if("nodata"===c){var m=new Er(this,t[s].path),C=t[s].currentInputSnapshot,E=new ve(C,m,Gt);n.push(t[s].onComplete.bind(null,null,!1,E))}else n.push(t[s].onComplete.bind(null,new Error(c),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s0?n:null)}t.forEachChild((function(t){e.pruneCompletedTransactionsBelowNode_(t)}))},vr.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor((function(t){e.abortTransactionsOnNode_(t)})),this.abortTransactionsOnNode_(r),r.forEachDescendant((function(t){e.abortTransactionsOnNode_(t)})),n},vr.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o=0;r--){var i=t[r];"."===i?t.splice(r,1):".."===i?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t){"string"!==typeof t&&(t+="");var e,n=0,r=-1,i=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!i){n=e+1;break}}else-1===r&&(i=!1,r=e+1);return-1===r?"":t.slice(n,r)}function i(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r=-1&&!r;o--){var s=o>=0?arguments[o]:t.cwd();if("string"!==typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(e=s+"/"+e,r="/"===s.charAt(0))}return e=n(i(e.split("/"),(function(t){return!!t})),!r).join("/"),(r?"/":"")+e||"."},e.normalize=function(t){var r=e.isAbsolute(t),s="/"===o(t,-1);return t=n(i(t.split("/"),(function(t){return!!t})),!r).join("/"),t||r||(t="."),t&&s&&(t+="/"),(r?"/":"")+t},e.isAbsolute=function(t){return"/"===t.charAt(0)},e.join=function(){var t=Array.prototype.slice.call(arguments,0);return e.normalize(i(t,(function(t,e){if("string"!==typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},e.relative=function(t,n){function r(t){for(var e=0;e=0;n--)if(""!==t[n])break;return e>n?[]:t.slice(e,n-e+1)}t=e.resolve(t).substr(1),n=e.resolve(n).substr(1);for(var i=r(t.split("/")),o=r(n.split("/")),s=Math.min(i.length,o.length),a=s,u=0;u=1;--o)if(e=t.charCodeAt(o),47===e){if(!i){r=o;break}}else i=!1;return-1===r?n?"/":".":n&&1===r?"/":t.slice(0,r)},e.basename=function(t,e){var n=r(t);return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},e.extname=function(t){"string"!==typeof t&&(t+="");for(var e=-1,n=0,r=-1,i=!0,o=0,s=t.length-1;s>=0;--s){var a=t.charCodeAt(s);if(47!==a)-1===r&&(i=!1,r=s+1),46===a?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!i){n=s+1;break}}return-1===e||-1===r||0===o||1===o&&e===r-1&&e===n+1?"":t.slice(e,r)};var o="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,n("7fb2"))}}]); +//# sourceMappingURL=firebase-database.9405483c.js.map \ No newline at end of file diff --git a/semag/al2/js/firebase-messaging.cc420f37.js b/semag/al2/js/firebase-messaging.cc420f37.js new file mode 100644 index 00000000..4ca57766 --- /dev/null +++ b/semag/al2/js/firebase-messaging.cc420f37.js @@ -0,0 +1,180 @@ +(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["firebase-messaging"],{"741f":function(e,t,n){"use strict";n.r(t);var r,o,i,s=n("c23d"),a=n.n(s),c=n("9ab4"),u=n("cd51"),d=(r={},r["only-available-in-window"]="This method is available in a Window context.",r["only-available-in-sw"]="This method is available in a service worker context.",r["should-be-overriden"]="This method should be overriden by extended classes.",r["bad-sender-id"]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",r["permission-default"]="The required permissions were not granted and dismissed instead.",r["permission-blocked"]="The required permissions were not granted and blocked instead.",r["unsupported-browser"]="This browser doesn't support the API's required to use the firebase SDK.",r["notifications-blocked"]="Notifications have been blocked.",r["failed-serviceworker-registration"]="We are unable to register the default service worker. {$browserErrorMessage}",r["sw-registration-expected"]="A service worker registration was the expected input.",r["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",r["invalid-saved-token"]="Unable to access details of the saved token.",r["sw-reg-redundant"]="The service worker being used for push was made redundant.",r["token-subscribe-failed"]="A problem occured while subscribing the user to FCM: {$errorInfo}",r["token-subscribe-no-token"]="FCM returned no token when subscribing the user to push.",r["token-subscribe-no-push-set"]="FCM returned an invalid response when getting an FCM token.",r["token-unsubscribe-failed"]="A problem occured while unsubscribing the user from FCM: {$errorInfo}",r["token-update-failed"]="A problem occured while updating the user from FCM: {$errorInfo}",r["token-update-no-token"]="FCM returned no token when updating the user to push.",r["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.",r["invalid-delete-token"]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",r["delete-token-not-found"]="The deletion attempt for token could not be performed as the token was not found.",r["delete-scope-not-found"]="The deletion attempt for service worker scope could not be performed as the scope was not found.",r["bg-handler-function-expected"]="The input to setBackgroundMessageHandler() must be a function.",r["no-window-client-to-msg"]="An attempt was made to message a non-existant window client.",r["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. {$errorInfo}",r["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.",r["failed-to-delete-token"]="Unable to delete the currently saved token.",r["no-sw-in-reg"]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",r["bad-scope"]="The service worker scope must be a string with at least one character.",r["bad-vapid-key"]="The public VAPID key is not a Uint8Array with 65 bytes.",r["bad-subscription"]="The subscription must be a valid PushSubscription.",r["bad-token"]="The FCM Token used for storage / lookup was not a valid token string.",r["bad-push-set"]="The FCM push set used for storage / lookup was not not a valid push set string.",r["failed-delete-vapid-key"]="The VAPID key could not be deleted.",r["invalid-public-vapid-key"]="The public VAPID key must be a string.",r["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.",r["public-vapid-key-decryption-failed"]="The public VAPID key did not equal 65 bytes when decrypted.",r),f=new u["ErrorFactory"]("messaging","Messaging",d),h=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]),l="https://fcm.googleapis.com"; +/** + * @license + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * 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 p(e,t){if(null==e||null==t)return!1;if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e),r=new DataView(t),o=0;oa&&console.warn("This browser only supports "+a+" actions.The remaining actions will not be displayed."),[2,i.showNotification(o,r)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(t)]:[3,5];case 4:return c.sent(),[2];case 5:return[2]}}))}))},t.prototype.onSubChange_=function(e){return Object(c["__awaiter"])(this,void 0,void 0,(function(){var e,t,n,r,o;return Object(c["__generator"])(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return e=i.sent(),[3,3];case 2:throw t=i.sent(),f.create("unable-to-resubscribe",{errorInfo:t});case 3:return i.trys.push([3,5,,8]),[4,e.pushManager.getSubscription()];case 4:return i.sent(),[3,8];case 5:return n=i.sent(),r=this.getTokenDetailsModel(),[4,r.getTokenDetailsFromSWScope(e.scope)];case 6:if(o=i.sent(),!o)throw n;return[4,this.deleteToken(o.fcmToken)];case 7:throw i.sent(),n;case 8:return[2]}}))}))},t.prototype.onNotificationClick_=function(e){return Object(c["__awaiter"])(this,void 0,void 0,(function(){var t,n,r,o;return Object(c["__generator"])(this,(function(s){switch(s.label){case 0:return e.notification&&e.notification.data&&e.notification.data[K]?e.action?[2]:(e.stopImmediatePropagation(),e.notification.close(),t=e.notification.data[K],t.notification?(n=t.fcmOptions&&t.fcmOptions.link||t.notification.click_action,n?[4,this.getWindowClient_(n)]:[2]):[2]):[2];case 1:return r=s.sent(),r?[3,3]:[4,self.clients.openWindow(n)];case 2:return r=s.sent(),[3,5];case 3:return[4,r.focus()];case 4:r=s.sent(),s.label=5;case 5:return r?(delete t.notification,delete t.fcmOptions,o=W(i.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(r,o)]):[2]}}))}))},t.prototype.getNotificationData_=function(e){var t;if(e&&"object"===typeof e.notification){var n=Object(c["__assign"])({},e.notification);return n.data=Object(c["__assign"])({},e.notification.data,(t={},t[K]=e,t)),n}},t.prototype.setBackgroundMessageHandler=function(e){if(!e||"function"!==typeof e)throw f.create("bg-handler-function-expected");this.bgMessageHandler=e},t.prototype.getWindowClient_=function(e){return Object(c["__awaiter"])(this,void 0,void 0,(function(){var t,n,r,o,i;return Object(c["__generator"])(this,(function(s){switch(s.label){case 0:return t=new URL(e,self.location.href).href,[4,A()];case 1:for(n=s.sent(),r=null,o=0;o0&&(h=o?o/2.5*(c/8):0,l=r.abs(t)+h,a=l/c),{destination:r.round(h),duration:a}};var h=e("transform");return t.extend(t,{hasTransform:!1!==h,hasPerspective:e("perspective")in i,hasTouch:"ontouchstart"in o,hasPointer:!(!o.PointerEvent&&!o.MSPointerEvent),hasTransition:e("transition")in i}),t.isBadAndroid=function(){var t=o.navigator.appVersion;if(/Android/.test(t)&&!/Chrome\/\d/.test(t)){var i=t.match(/Safari\/(\d+.\d)/);return!(i&&"object"===typeof i&&i.length>=2)||parseFloat(i[1])<535.19}return!1}(),t.extend(t.style={},{transform:h,transitionTimingFunction:e("transitionTimingFunction"),transitionDuration:e("transitionDuration"),transitionDelay:e("transitionDelay"),transformOrigin:e("transformOrigin")}),t.hasClass=function(t,i){var s=new RegExp("(^|\\s)"+i+"(\\s|$)");return s.test(t.className)},t.addClass=function(i,s){if(!t.hasClass(i,s)){var e=i.className.split(" ");e.push(s),i.className=e.join(" ")}},t.removeClass=function(i,s){if(t.hasClass(i,s)){var e=new RegExp("(^|\\s)"+s+"(\\s|$)","g");i.className=i.className.replace(e," ")}},t.offset=function(t){var i=-t.offsetLeft,s=-t.offsetTop;while(t=t.offsetParent)i-=t.offsetLeft,s-=t.offsetTop;return{left:i,top:s}},t.preventDefaultException=function(t,i){for(var s in i)if(i[s].test(t[s]))return!0;return!1},t.extend(t.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,pointerdown:3,pointermove:3,pointerup:3,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3}),t.extend(t.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(t){return r.sqrt(1- --t*t)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(t){var i=4;return(t-=1)*t*((i+1)*t+i)+1}},bounce:{style:"",fn:function(t){return(t/=1)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},elastic:{style:"",fn:function(t){var i=.22,s=.4;return 0===t?0:1==t?1:s*r.pow(2,-10*t)*r.sin((t-i/4)*(2*r.PI)/i)+1}}}),t.tap=function(t,i){var s=n.createEvent("Event");s.initEvent(i,!0,!0),s.pageX=t.pageX,s.pageY=t.pageY,t.target.dispatchEvent(s)},t.click=function(t){var i,s=t.target;/(SELECT|INPUT|TEXTAREA)/i.test(s.tagName)||(i=n.createEvent("MouseEvents"),i.initMouseEvent("click",!0,!0,t.view,1,s.screenX,s.screenY,s.clientX,s.clientY,t.ctrlKey,t.altKey,t.shiftKey,t.metaKey,0,null),i._constructed=!0,s.dispatchEvent(i))},t}();function l(t,i){for(var s in this.wrapper="string"==typeof t?n.querySelector(t):t,this.scroller=this.wrapper.children[0],this.scrollerStyle=this.scroller.style,this.options={resizeScrollbars:!0,mouseWheelSpeed:20,snapThreshold:.334,disablePointer:!a.hasPointer,disableTouch:a.hasPointer||!a.hasTouch,disableMouse:a.hasPointer||a.hasTouch,startX:0,startY:0,scrollY:!0,directionLockThreshold:5,momentum:!0,bounce:!0,bounceTime:600,bounceEasing:"",preventDefault:!0,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:!0,useTransition:!0,useTransform:!0,bindToWrapper:"undefined"===typeof o.onmousedown},i)this.options[s]=i[s];this.translateZ=this.options.HWCompositing&&a.hasPerspective?" translateZ(0)":"",this.options.useTransition=a.hasTransition&&this.options.useTransition,this.options.useTransform=a.hasTransform&&this.options.useTransform,this.options.eventPassthrough=!0===this.options.eventPassthrough?"vertical":this.options.eventPassthrough,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollY="vertical"!=this.options.eventPassthrough&&this.options.scrollY,this.options.scrollX="horizontal"!=this.options.eventPassthrough&&this.options.scrollX,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,this.options.bounceEasing="string"==typeof this.options.bounceEasing?a.ease[this.options.bounceEasing]||a.ease.circular:this.options.bounceEasing,this.options.resizePolling=void 0===this.options.resizePolling?60:this.options.resizePolling,!0===this.options.tap&&(this.options.tap="tap"),"scale"==this.options.shrinkScrollbars&&(this.options.useTransition=!1),this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1,3==this.options.probeType&&(this.options.useTransition=!1),this.x=0,this.y=0,this.directionX=0,this.directionY=0,this._events={},this._init(),this.refresh(),this.scrollTo(this.options.startX,this.options.startY),this.enable()}function c(t,i,s){var e=n.createElement("div"),o=n.createElement("div");return!0===s&&(e.style.cssText="position:absolute;z-index:9999",o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"),o.className="iScrollIndicator","h"==t?(!0===s&&(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",o.style.height="100%"),e.className="iScrollHorizontalScrollbar"):(!0===s&&(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",o.style.width="100%"),e.className="iScrollVerticalScrollbar"),e.style.cssText+=";overflow:hidden",i||(e.style.pointerEvents="none"),e.appendChild(o),e}function p(t,i){for(var s in this.wrapper="string"==typeof i.el?n.querySelector(i.el):i.el,this.wrapperStyle=this.wrapper.style,this.indicator=this.wrapper.children[0],this.indicatorStyle=this.indicator.style,this.scroller=t,this.options={listenX:!0,listenY:!0,interactive:!1,resize:!0,defaultScrollbars:!1,shrink:!1,fade:!1,speedRatioX:0,speedRatioY:0},i)this.options[s]=i[s];if(this.sizeRatioX=1,this.sizeRatioY=1,this.maxPosX=0,this.maxPosY=0,this.options.interactive&&(this.options.disableTouch||(a.addEvent(this.indicator,"touchstart",this),a.addEvent(o,"touchend",this)),this.options.disablePointer||(a.addEvent(this.indicator,a.prefixPointerEvent("pointerdown"),this),a.addEvent(o,a.prefixPointerEvent("pointerup"),this)),this.options.disableMouse||(a.addEvent(this.indicator,"mousedown",this),a.addEvent(o,"mouseup",this))),this.options.fade){this.wrapperStyle[a.style.transform]=this.scroller.translateZ;var e=a.style.transitionDuration;this.wrapperStyle[e]=a.isBadAndroid?"0.0001ms":"0ms";var r=this;a.isBadAndroid&&h((function(){"0.0001ms"===r.wrapperStyle[e]&&(r.wrapperStyle[e]="0s")})),this.wrapperStyle.opacity="0"}}l.prototype={version:"5.2.0",_init:function(){this._initEvents(),(this.options.scrollbars||this.options.indicators)&&this._initIndicators(),this.options.mouseWheel&&this._initWheel(),this.options.snap&&this._initSnap(),this.options.keyBindings&&this._initKeys()},destroy:function(){this._initEvents(!0),clearTimeout(this.resizeTimeout),this.resizeTimeout=null,this._execEvent("destroy")},_transitionEnd:function(t){t.target==this.scroller&&this.isInTransition&&(this._transitionTime(),this.resetPosition(this.options.bounceTime)||(this.isInTransition=!1,this._execEvent("scrollEnd")))},_start:function(t){var i;if(1!=a.eventType[t.type]&&(i=t.which?t.button:t.button<2?0:4==t.button?1:2,0!==i))return;if(this.enabled&&(!this.initiated||a.eventType[t.type]===this.initiated)){!this.options.preventDefault||a.isBadAndroid||a.preventDefaultException(t.target,this.options.preventDefaultException)||t.preventDefault();var s,e=t.touches?t.touches[0]:t;this.initiated=a.eventType[t.type],this.moved=!1,this.distX=0,this.distY=0,this.directionX=0,this.directionY=0,this.directionLocked=0,this.startTime=a.getTime(),this.options.useTransition&&this.isInTransition?(this._transitionTime(),this.isInTransition=!1,s=this.getComputedPosition(),this._translate(r.round(s.x),r.round(s.y)),this._execEvent("scrollEnd")):!this.options.useTransition&&this.isAnimating&&(this.isAnimating=!1,this._execEvent("scrollEnd")),this.startX=this.x,this.startY=this.y,this.absStartX=this.x,this.absStartY=this.y,this.pointX=e.pageX,this.pointY=e.pageY,this._execEvent("beforeScrollStart")}},_move:function(t){if(this.enabled&&a.eventType[t.type]===this.initiated){this.options.preventDefault&&t.preventDefault();var i,s,e,o,n=t.touches?t.touches[0]:t,h=n.pageX-this.pointX,l=n.pageY-this.pointY,c=a.getTime();if(this.pointX=n.pageX,this.pointY=n.pageY,this.distX+=h,this.distY+=l,e=r.abs(this.distX),o=r.abs(this.distY),!(c-this.endTime>300&&e<10&&o<10)){if(this.directionLocked||this.options.freeScroll||(e>o+this.options.directionLockThreshold?this.directionLocked="h":o>=e+this.options.directionLockThreshold?this.directionLocked="v":this.directionLocked="n"),"h"==this.directionLocked){if("vertical"==this.options.eventPassthrough)t.preventDefault();else if("horizontal"==this.options.eventPassthrough)return void(this.initiated=!1);l=0}else if("v"==this.directionLocked){if("horizontal"==this.options.eventPassthrough)t.preventDefault();else if("vertical"==this.options.eventPassthrough)return void(this.initiated=!1);h=0}h=this.hasHorizontalScroll?h:0,l=this.hasVerticalScroll?l:0,i=this.x+h,s=this.y+l,(i>0||i0?0:this.maxScrollX),(s>0||s0?0:this.maxScrollY),this.directionX=h>0?-1:h<0?1:0,this.directionY=l>0?-1:l<0?1:0,this.moved||this._execEvent("scrollStart"),this.moved=!0,this._translate(i,s),c-this.startTime>300&&(this.startTime=c,this.startX=this.x,this.startY=this.y,1==this.options.probeType&&this._execEvent("scroll")),this.options.probeType>1&&this._execEvent("scroll")}}},_end:function(t){if(this.enabled&&a.eventType[t.type]===this.initiated){this.options.preventDefault&&!a.preventDefaultException(t.target,this.options.preventDefaultException)&&t.preventDefault();t.changedTouches&&t.changedTouches[0];var i,s,e=a.getTime()-this.startTime,o=r.round(this.x),n=r.round(this.y),h=r.abs(o-this.startX),l=r.abs(n-this.startY),c=0,p="";if(this.isInTransition=0,this.initiated=0,this.endTime=a.getTime(),!this.resetPosition(this.options.bounceTime)){if(this.scrollTo(o,n),!this.moved)return this.options.tap&&a.tap(t,this.options.tap),this.options.click&&a.click(t),void this._execEvent("scrollCancel");if(this._events.flick&&e<200&&h<100&&l<100)this._execEvent("flick");else{if(this.options.momentum&&e<300&&(i=this.hasHorizontalScroll?a.momentum(this.x,this.startX,e,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:o,duration:0},s=this.hasVerticalScroll?a.momentum(this.y,this.startY,e,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:n,duration:0},o=i.destination,n=s.destination,c=r.max(i.duration,s.duration),this.isInTransition=1),this.options.snap){var d=this._nearestSnap(o,n);this.currentPage=d,c=this.options.snapSpeed||r.max(r.max(r.min(r.abs(o-d.x),1e3),r.min(r.abs(n-d.y),1e3)),300),o=d.x,n=d.y,this.directionX=0,this.directionY=0,p=this.options.bounceEasing}if(o!=this.x||n!=this.y)return(o>0||o0||n0?i=0:this.x0?s=0:this.y-1&&this._events[t].splice(s,1)}},_execEvent:function(t){if(this._events[t]){var i=0,s=this._events[t].length;if(s)for(;i0;var o=this.options.useTransition&&e.style;!s||o?(o&&(this._transitionTimingFunction(e.style),this._transitionTime(s)),this._translate(t,i)):this._animate(t,i,s,e.fn)},scrollToElement:function(t,i,s,e,o){if(t=t.nodeType?t:this.scroller.querySelector(t),t){var n=a.offset(t);n.left-=this.wrapperOffset.left,n.top-=this.wrapperOffset.top,!0===s&&(s=r.round(t.offsetWidth/2-this.wrapper.offsetWidth/2)),!0===e&&(e=r.round(t.offsetHeight/2-this.wrapper.offsetHeight/2)),n.left-=s||0,n.top-=e||0,n.left=n.left>0?0:n.left0?0:n.top0?e--:i<0&&e++,s>0?o--:s<0&&o++,void this.goToPage(e,o);e=this.x+r.round(this.hasHorizontalScroll?i:0),o=this.y+r.round(this.hasVerticalScroll?s:0),this.directionX=i>0?-1:i<0?1:0,this.directionY=s>0?-1:s<0?1:0,e>0?e=0:e0?o=0:o1&&this._execEvent("scroll")}},_initSnap:function(){this.currentPage={},"string"==typeof this.options.snap&&(this.options.snap=this.scroller.querySelectorAll(this.options.snap)),this.on("refresh",(function(){var t,i,s,e,o,n,h=0,a=0,l=0,c=this.options.snapStepX||this.wrapperWidth,p=this.options.snapStepY||this.wrapperHeight;if(this.pages=[],this.wrapperWidth&&this.wrapperHeight&&this.scrollerWidth&&this.scrollerHeight){if(!0===this.options.snap){s=r.round(c/2),e=r.round(p/2);while(l>-this.scrollerWidth){this.pages[h]=[],t=0,o=0;while(o>-this.scrollerHeight)this.pages[h][t]={x:r.max(l,this.maxScrollX),y:r.max(o,this.maxScrollY),width:c,height:p,cx:l-s,cy:o-e},o-=p,t++;l-=c,h++}}else for(n=this.options.snap,t=n.length,i=-1;hthis.maxScrollX&&a++;this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0),this.options.snapThreshold%1===0?(this.snapThresholdX=this.options.snapThreshold,this.snapThresholdY=this.options.snapThreshold):(this.snapThresholdX=r.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold),this.snapThresholdY=r.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold))}})),this.on("flick",(function(){var t=this.options.snapSpeed||r.max(r.max(r.min(r.abs(this.x-this.startX),1e3),r.min(r.abs(this.y-this.startY),1e3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,t)}))},_nearestSnap:function(t,i){if(!this.pages.length)return{x:0,y:0,pageX:0,pageY:0};var s=0,e=this.pages.length,o=0;if(r.abs(t-this.absStartX)0?t=0:t0?i=0:i=this.pages[s][0].cx){t=this.pages[s][0].x;break}for(e=this.pages[s].length;o=this.pages[0][o].cy){i=this.pages[0][o].y;break}return s==this.currentPage.pageX&&(s+=this.directionX,s<0?s=0:s>=this.pages.length&&(s=this.pages.length-1),t=this.pages[s][0].x),o==this.currentPage.pageY&&(o+=this.directionY,o<0?o=0:o>=this.pages[0].length&&(o=this.pages[0].length-1),i=this.pages[0][o].y),{x:t,y:i,pageX:s,pageY:o}},goToPage:function(t,i,s,e){e=e||this.options.bounceEasing,t>=this.pages.length?t=this.pages.length-1:t<0&&(t=0),i>=this.pages[t].length?i=this.pages[t].length-1:i<0&&(i=0);var o=this.pages[t][i].x,n=this.pages[t][i].y;s=void 0===s?this.options.snapSpeed||r.max(r.max(r.min(r.abs(o-this.x),1e3),r.min(r.abs(n-this.y),1e3)),300):s,this.currentPage={x:o,y:n,pageX:t,pageY:i},this.scrollTo(o,n,s,e)},next:function(t,i){var s=this.currentPage.pageX,e=this.currentPage.pageY;s++,s>=this.pages.length&&this.hasVerticalScroll&&(s=0,e++),this.goToPage(s,e,t,i)},prev:function(t,i){var s=this.currentPage.pageX,e=this.currentPage.pageY;s--,s<0&&this.hasVerticalScroll&&(s=0,e--),this.goToPage(s,e,t,i)},_initKeys:function(t){var i,s={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};if("object"==typeof this.options.keyBindings)for(i in this.options.keyBindings)"string"==typeof this.options.keyBindings[i]&&(this.options.keyBindings[i]=this.options.keyBindings[i].toUpperCase().charCodeAt(0));else this.options.keyBindings={};for(i in s)this.options.keyBindings[i]=this.options.keyBindings[i]||s[i];a.addEvent(o,"keydown",this),this.on("destroy",(function(){a.removeEvent(o,"keydown",this)}))},_key:function(t){if(this.enabled){var i,s=this.options.snap,e=s?this.currentPage.pageX:this.x,o=s?this.currentPage.pageY:this.y,n=a.getTime(),h=this.keyTime||0,l=.25;switch(this.options.useTransition&&this.isInTransition&&(i=this.getComputedPosition(),this._translate(r.round(i.x),r.round(i.y)),this.isInTransition=!1),this.keyAcceleration=n-h<200?r.min(this.keyAcceleration+l,50):0,t.keyCode){case this.options.keyBindings.pageUp:this.hasHorizontalScroll&&!this.hasVerticalScroll?e+=s?1:this.wrapperWidth:o+=s?1:this.wrapperHeight;break;case this.options.keyBindings.pageDown:this.hasHorizontalScroll&&!this.hasVerticalScroll?e-=s?1:this.wrapperWidth:o-=s?1:this.wrapperHeight;break;case this.options.keyBindings.end:e=s?this.pages.length-1:this.maxScrollX,o=s?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:e=0,o=0;break;case this.options.keyBindings.left:e+=s?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:o+=s?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:e-=s?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:o-=s?1:5+this.keyAcceleration>>0;break;default:return}s?this.goToPage(e,o):(e>0?(e=0,this.keyAcceleration=0):e0?(o=0,this.keyAcceleration=0):o=c)return o.isAnimating=!1,o._translate(t,i),void(o.resetPosition(o.options.bounceTime)||o._execEvent("scrollEnd"));m=(m-l)/s,f=e(m),d=(t-n)*f+n,u=(i-r)*f+r,o._translate(d,u),o.isAnimating&&h(p),3==o.options.probeType&&o._execEvent("scroll")}this.isAnimating=!0,p()},handleEvent:function(t){switch(t.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(t);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(t);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(t);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(t);break;case"wheel":case"DOMMouseScroll":case"mousewheel":this._wheel(t);break;case"keydown":this._key(t);break;case"click":this.enabled&&!t._constructed&&(t.preventDefault(),t.stopPropagation());break}}},p.prototype={handleEvent:function(t){switch(t.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(t);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(t);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(t);break}},destroy:function(){this.options.fadeScrollbars&&(clearTimeout(this.fadeTimeout),this.fadeTimeout=null),this.options.interactive&&(a.removeEvent(this.indicator,"touchstart",this),a.removeEvent(this.indicator,a.prefixPointerEvent("pointerdown"),this),a.removeEvent(this.indicator,"mousedown",this),a.removeEvent(o,"touchmove",this),a.removeEvent(o,a.prefixPointerEvent("pointermove"),this),a.removeEvent(o,"mousemove",this),a.removeEvent(o,"touchend",this),a.removeEvent(o,a.prefixPointerEvent("pointerup"),this),a.removeEvent(o,"mouseup",this)),this.options.defaultScrollbars&&this.wrapper.parentNode.removeChild(this.wrapper)},_start:function(t){var i=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.transitionTime(),this.initiated=!0,this.moved=!1,this.lastPointX=i.pageX,this.lastPointY=i.pageY,this.startTime=a.getTime(),this.options.disableTouch||a.addEvent(o,"touchmove",this),this.options.disablePointer||a.addEvent(o,a.prefixPointerEvent("pointermove"),this),this.options.disableMouse||a.addEvent(o,"mousemove",this),this.scroller._execEvent("beforeScrollStart")},_move:function(t){var i,s,e,o,n=t.touches?t.touches[0]:t,r=a.getTime();this.moved||this.scroller._execEvent("scrollStart"),this.moved=!0,i=n.pageX-this.lastPointX,this.lastPointX=n.pageX,s=n.pageY-this.lastPointY,this.lastPointY=n.pageY,e=this.x+i,o=this.y+s,this._pos(e,o),1==this.scroller.options.probeType&&r-this.startTime>300?(this.startTime=r,this.scroller._execEvent("scroll")):this.scroller.options.probeType>1&&this.scroller._execEvent("scroll"),t.preventDefault(),t.stopPropagation()},_end:function(t){if(this.initiated){if(this.initiated=!1,t.preventDefault(),t.stopPropagation(),a.removeEvent(o,"touchmove",this),a.removeEvent(o,a.prefixPointerEvent("pointermove"),this),a.removeEvent(o,"mousemove",this),this.scroller.options.snap){var i=this.scroller._nearestSnap(this.scroller.x,this.scroller.y),s=this.options.snapSpeed||r.max(r.max(r.min(r.abs(this.scroller.x-i.x),1e3),r.min(r.abs(this.scroller.y-i.y),1e3)),300);this.scroller.x==i.x&&this.scroller.y==i.y||(this.scroller.directionX=0,this.scroller.directionY=0,this.scroller.currentPage=i,this.scroller.scrollTo(i.x,i.y,s,this.scroller.options.bounceEasing))}this.moved&&this.scroller._execEvent("scrollEnd")}},transitionTime:function(t){t=t||0;var i=a.style.transitionDuration;if(this.indicatorStyle[i]=t+"ms",!t&&a.isBadAndroid){this.indicatorStyle[i]="0.0001ms";var s=this;h((function(){"0.0001ms"===s.indicatorStyle[i]&&(s.indicatorStyle[i]="0s")}))}},transitionTimingFunction:function(t){this.indicatorStyle[a.style.transitionTimingFunction]=t},refresh:function(){this.transitionTime(),this.options.listenX&&!this.options.listenY?this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block":"none":this.options.listenY&&!this.options.listenX?this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none":this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none",this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll?(a.addClass(this.wrapper,"iScrollBothScrollbars"),a.removeClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="8px":this.wrapper.style.bottom="8px")):(a.removeClass(this.wrapper,"iScrollBothScrollbars"),a.addClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="2px":this.wrapper.style.bottom="2px"));this.wrapper.offsetHeight;this.options.listenX&&(this.wrapperWidth=this.wrapper.clientWidth,this.options.resize?(this.indicatorWidth=r.max(r.round(this.wrapperWidth*this.wrapperWidth/(this.scroller.scrollerWidth||this.wrapperWidth||1)),8),this.indicatorStyle.width=this.indicatorWidth+"px"):this.indicatorWidth=this.indicator.clientWidth,this.maxPosX=this.wrapperWidth-this.indicatorWidth,"clip"==this.options.shrink?(this.minBoundaryX=8-this.indicatorWidth,this.maxBoundaryX=this.wrapperWidth-8):(this.minBoundaryX=0,this.maxBoundaryX=this.maxPosX),this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX),this.options.listenY&&(this.wrapperHeight=this.wrapper.clientHeight,this.options.resize?(this.indicatorHeight=r.max(r.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8),this.indicatorStyle.height=this.indicatorHeight+"px"):this.indicatorHeight=this.indicator.clientHeight,this.maxPosY=this.wrapperHeight-this.indicatorHeight,"clip"==this.options.shrink?(this.minBoundaryY=8-this.indicatorHeight,this.maxBoundaryY=this.wrapperHeight-8):(this.minBoundaryY=0,this.maxBoundaryY=this.maxPosY),this.maxPosY=this.wrapperHeight-this.indicatorHeight,this.sizeRatioY=this.options.speedRatioY||this.scroller.maxScrollY&&this.maxPosY/this.scroller.maxScrollY),this.updatePosition()},updatePosition:function(){var t=this.options.listenX&&r.round(this.sizeRatioX*this.scroller.x)||0,i=this.options.listenY&&r.round(this.sizeRatioY*this.scroller.y)||0;this.options.ignoreBoundaries||(tthis.maxBoundaryX?"scale"==this.options.shrink?(this.width=r.max(this.indicatorWidth-(t-this.maxPosX),8),this.indicatorStyle.width=this.width+"px",t=this.maxPosX+this.indicatorWidth-this.width):t=this.maxBoundaryX:"scale"==this.options.shrink&&this.width!=this.indicatorWidth&&(this.width=this.indicatorWidth,this.indicatorStyle.width=this.width+"px"),ithis.maxBoundaryY?"scale"==this.options.shrink?(this.height=r.max(this.indicatorHeight-3*(i-this.maxPosY),8),this.indicatorStyle.height=this.height+"px",i=this.maxPosY+this.indicatorHeight-this.height):i=this.maxBoundaryY:"scale"==this.options.shrink&&this.height!=this.indicatorHeight&&(this.height=this.indicatorHeight,this.indicatorStyle.height=this.height+"px")),this.x=t,this.y=i,this.scroller.options.useTransform?this.indicatorStyle[a.style.transform]="translate("+t+"px,"+i+"px)"+this.scroller.translateZ:(this.indicatorStyle.left=t+"px",this.indicatorStyle.top=i+"px")},_pos:function(t,i){t<0?t=0:t>this.maxPosX&&(t=this.maxPosX),i<0?i=0:i>this.maxPosY&&(i=this.maxPosY),t=this.options.listenX?r.round(t/this.sizeRatioX):this.scroller.x,i=this.options.listenY?r.round(i/this.sizeRatioY):this.scroller.y,this.scroller.scrollTo(t,i)},fade:function(t,i){if(!i||this.visible){clearTimeout(this.fadeTimeout),this.fadeTimeout=null;var s=t?250:500,e=t?0:300;t=t?"1":"0",this.wrapperStyle[a.style.transitionDuration]=s+"ms",this.fadeTimeout=setTimeout(function(t){this.wrapperStyle.opacity=t,this.visible=+t}.bind(this,t),e)}}},l.utils=a,t.exports?t.exports=l:(e=function(){return l}.call(i,s,i,t),void 0===e||(t.exports=e))})(window,document,Math)},a59a:function(t,i,s){"use strict";s.r(i);var e=s("54af"),o=s.n(e);function n(t){let i=t,s=-i.offsetLeft,e=-i.offsetTop;i=i.offsetParent;while(i)s-=i.offsetLeft,e-=e-i.offsetTop,i=i.offsetParent;return{left:s,top:e}}function r(t,i){const s="undefined"!==typeof t&&"undefined"!==typeof i;s&&0!==this.wrapperHeight?this.scrollerHeight=i:(this.wrapper.offsetHeight,this.wrapperHeight=this.wrapper.clientHeight,this.scrollerHeight=this.scroller.offsetHeight),this.maxScrollY=this.wrapperHeight-this.scrollerHeight,this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0,this.hasVerticalScroll||(this.maxScrollY=0,this.scrollerHeight=this.wrapperHeight),this.endTime=0,this.directionX=0,this.directionY=0,s||(this.wrapperOffset=n(this.wrapper)),this._execEvent("refresh"),this.resetPosition()}o.a.prototype.refresh=r;const{_start:h}=o.a.prototype;function a(t){"IMG"!==t.target.tagName&&h.call(this,t)}o.a.prototype._start=a,i["default"]=o.a}}]); +//# sourceMappingURL=iscroll.395ab9b8.js.map \ No newline at end of file