-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebcom.js
24 lines (24 loc) · 195 KB
/
webcom.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*!
* Webcom. Build realtime apps. Share and sync data instantly between your clients
*
* Module name: Webcom
* Version: 2.7.1
* Created: 2019-04-01T10:15:14.697Z
*
* Copyright (C) <2015-2019> Orange
*
* This software is confidential and proprietary information of Orange.
* You shall not disclose such Confidential Information and shall use it only in
* accordance with the terms of the agreement you entered into.
* Unauthorized copying of this file, via any medium is strictly prohibited.
*
* If you are Orange employee you shall use this software in accordance with
* the Orange Source Charter (http://opensource.itn.ftgroup/index.php/Orange_Source_Charter)
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Webcom=t():e.Webcom=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={exports:{},id:i,loaded:!1};return e[i].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){(function(i){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),u=o(a),s=n(9),l=o(s),c=n(1),d=o(c),h=n(2),f=o(h),p=n(19),v=o(p),_=n(18),y=o(_),g=n(92),m=o(g),b=n(93),k=o(b),C=n(63),w=o(C),E=n(10),S=o(E),P=n(94),N=o(P),O=n(3),A=r(O),T=n(4),D=r(T),R=n(101),I=n(30),M=r(I),x=n(11),W=n(5),j=r(W),L=n(13),F=n(74),V=n(37),U=r(V),Q=n(91),q=o(Q),H=function(e){function t(e,n){(0,d.default)(this,t);var i=void 0,r=void 0,o=void 0;if(e instanceof w.default)i=e,r=n;else{(0,x.validateArgCount)("new Webcom",1,2,arguments.length);var a=A.parseURL(arguments[0]),u=void 0;if(M.validateUrl("new Webcom",1,a),n instanceof N.default)u=n;else{if(n instanceof Object)o=n;else if(n)throw new Error("Expected a valid Webcom.Context or Options object for second argument to new Webcom()");u=N.default.getInstance()}o&&(a.repoInfo.options=o),i=u.getRepo(a.repoInfo),r=a.path}return(0,v.default)(this,(t.__proto__||(0,l.default)(t)).call(this,i,r))}return(0,y.default)(t,e),(0,f.default)(t,[{key:"persist",value:function(){(0,x.validateArgCount)("Webcom.persist",0,0,arguments.length),this.repo.persist()}},{key:"name",value:function(){return(0,x.validateArgCount)("Webcom.name",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()}},{key:"child",value:function(e){return(0,x.validateArgCount)("Webcom.child",1,1,arguments.length),D.isNumber(e)?e=String(e):e instanceof S.default||(null===this.path.getFront()?M.validateRootPathString("Webcom.child",1,e,!1):M.validatePathString("Webcom.child",1,e,!1)),new t(this.repo,this.path.child(e))}},{key:"parent",value:function(){(0,x.validateArgCount)("Webcom.parent",0,0,arguments.length);var e=this.path.parent();return null===e?null:new t(this.repo,e)}},{key:"root",value:function(){(0,x.validateArgCount)("Webcom.ref",0,0,arguments.length);for(var e=this;null!==e.parent();)e=e.parent();return e}},{key:"toString",value:function(){return(0,x.validateArgCount)("Webcom.toString",0,0,arguments.length),null===this.parent()?this.repo.toString():this.parent().toString()+"/"+(0,L.urlEncode)(this.name())}},{key:"set",value:function(e,t){(0,x.validateArgCount)("Webcom.set",1,2,arguments.length),(0,I.validateWritablePath)("Webcom.set",this.path),(0,I.validateWebcomDataArg)("Webcom.set",1,e,!1),(0,x.validateCallback)("Webcom.set",2,t,!0),this.repo.setWithPriority(this.path,e,null,t)}},{key:"update",value:function(e,t){if((0,x.validateArgCount)("Webcom.update",1,2,arguments.length),(0,I.validateWritablePath)("Webcom.update",this.path),D.isArray(e)){for(var n={},i=0;i<e.length;++i)n[""+i]=e[i];e=n,A.warn("Passing an Array to Webcom.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}if(M.validateWebcomObjectDataArg("Webcom.update",1,e,!1),(0,x.validateCallback)("Webcom.update",2,t,!0),j.contains(e,".priority"))throw new Error("update() does not currently support updating .priority.");this.repo.update(this.path,e,t)}},{key:"remove",value:function(e){(0,x.validateArgCount)("Webcom.remove",0,1,arguments.length),(0,I.validateWritablePath)("Webcom.remove",this.path),(0,x.validateCallback)("Webcom.remove",1,e,!0),this.set(null,e)}},{key:"transaction",value:function(e,t,n){if((0,x.validateArgCount)("Webcom.transaction",1,3,arguments.length),(0,I.validateWritablePath)("Webcom.transaction",this.path),(0,x.validateCallback)("Webcom.transaction",1,e,!1),(0,x.validateCallback)("Webcom.transaction",2,t,!0),M.validateBoolean("Webcom.transaction",3,n,!0),".length"===this.name()||".keys"===this.name())throw"Webcom.transaction failed: "+this.name()+" is a read-only object.";"undefined"==typeof n&&(n=!0),this.repo.startTransaction(this.path,e,t,n)}},{key:"push",value:function(e,t){(0,x.validateArgCount)("Webcom.push",0,2,arguments.length),(0,I.validateWritablePath)("Webcom.push",this.path),(0,I.validateWebcomDataArg)("Webcom.push",1,e,!0),(0,x.validateCallback)("Webcom.push",2,t,!0);var n=this.repo.serverTime(),i=(0,R.NextPushId)(n),r=this.child(i);return"undefined"!=typeof e&&null!==e&&r.set(e,t),r}},{key:"onDisconnect",value:function(){return new m.default(this.repo,this.path,this.name())}},{key:"auth",value:function(e,t){A.warn("Webcom.auth(cred, [onComplete]) is deprecated. Please use Webcom.authWithToken(cred, [onComplete]) instead."),this.authWithToken(e,t).catch(),this.repo.statsIncrementCounter("deprecated_auth(cred)")}},{key:"unauth",value:function(e){A.warn("Webcom.unauth([onComplete]) is deprecated. Please use Webcom.logout([onComplete]) instead."),this.logout(e),this.repo.statsIncrementCounter("deprecated_unauth()")}},{key:"resume",value:function(e){var t=this.getAuthClient(!1);e&&(this.registerAuthCallback(e),A.warn("Webcom.resume(callback) is deprecated. Please use Webcom.resume() and then Webcom.registerAuthCallback(callback) instead."),this.repo.statsIncrementCounter("deprecated_resume(callback)")),t.resumeSession()}},{key:"registerAuthCallback",value:function(e){return this.getAuthClient(!1).registerAuthCallback(e),e}},{key:"unregisterAuthCallback",value:function(e){this.getAuthClient(!1).unregisterAuthCallback(e)}},{key:"goOffline",value:function(){(0,x.validateArgCount)("Webcom.goOffline",0,0,arguments.length),N.default.getInstance().interrupt()}},{key:"goOnline",value:function(){(0,x.validateArgCount)("Webcom.goOnline",0,0,arguments.length),N.default.getInstance().resume()}},{key:"shouldBeOnline",value:function(){return this.repo.shouldBeOnline()}},{key:"getAuthClient",value:function(e){return this.client_||(this.client_=new F.Client(this,this.repo.internalHostUrl()),e&&this.client_.resumeSession()),this.client_}},{key:"authWithPrivateKey",value:function(e,t){return this.getAuthClient(!0).loginWithToken(e,t)}},{key:"authWithToken",value:function(e,t){return this.getAuthClient(!0).loginWithToken(e,t)}},{key:"authAnonymously",value:function(e){return this.getAuthClient(!0).loginAnonymously({},e)}},{key:"authWithCustomProvider",value:function(e,t,n){return this.getAuthClient(!0).loginWithCustomProvider(e,t,n)}},{key:"authWithPassword",value:function(e,t){return this.getAuthClient(!0).loginWithPassword(e,t)}},{key:"authWithPhone",value:function(e){return this.getAuthClient(!0).loginWithPhone(e)}},{key:"sendOtp",value:function(e,t,n){var i="Webcom:sendOtp";return(0,x.validateArgCount)(i,2,3,arguments.length),(0,x.validateString)(i,1,e,!1),(0,x.validateString)(i,2,t,!1),this.getAuthClient(!0).sendOtp(e,t,n)}},{key:"authWithOAuth",value:function(e,t,n){return this.getAuthClient(!0).loginWithOAuth(e,t,n)}},{key:"authWithWassup",value:function(e,t){return this.getAuthClient(!0).loginWithWassup(e,t)}},{key:"createUser",value:function(e,t){var n="Webcom:createUser",i=e;if("object"===("undefined"==typeof i?"undefined":(0,u.default)(i)))(0,x.validateArgCount)(n,1,2,arguments.length),(0,x.validateCallback)(n,2,t,!0),A.warn("Webcom.createUser(details, [onComplete]) is deprecated. Please use Webcom.addAccount(provider, details) instead."),this.repo.statsIncrementCounter("deprecated_createUser(details)");else{var r=arguments[2];(0,x.validateArgCount)(n,2,3,arguments.length),(0,x.validateCallback)(n,3,r,!0),i={email:e,password:t},t=r,A.warn("Webcom.createUser(email, password, [onComplete]) is deprecated. Please use Webcom.addAccount(provider, details) instead."),this.repo.statsIncrementCounter("deprecated_createUser(email,password)")}return this.getAuthClient(!0).createUser(i,t)}},{key:"addAccount",value:function(e,t,n){var i="Webcom:addAccount";return(0,x.validateArgCount)(i,2,3,arguments.length),(0,x.validateString)(i,1,e,!1),this.getAuthClient(!0).addAccount(e,t,n)}},{key:"removeIdentity",value:function(){var e="Webcom:removeIdentity";return(0,x.validateArgCount)(e,0,0,arguments.length),this.getAuthClient(!0).removeIdentity()}},{key:"removeAccount",value:function(){var e="Webcom:removeAccount";return(0,x.validateArgCount)(e,0,0,arguments.length),this.getAuthClient(!0).removeAccount()}},{key:"verifyIdentity",value:function(e,t,n){var i="Webcom:verifyIdentity";return(0,x.validateArgCount)(i,3,3,arguments.length),(0,x.validateString)(i,1,e,!1),(0,x.validateString)(i,2,t,!1),this.getAuthClient(!0).verifyIdentity(e,t,n)}},{key:"updateEmailPasswordProfile",value:function(e,t,n){A.warn("Webcom.updateEmailPasswordProfile([path], data, [onComplete]) is deprecated. Please use Webcom.updateIdentityProfile([path], data) instead."),this.repo.statsIncrementCounter("deprecated_updateEmailPasswordProfile(path,data)");var i="Webcom:updateEmailPasswordProfile";(0,x.validateArgCount)(i,1,3,arguments.length);var r=void 0,o=void 0;switch("undefined"==typeof t?"undefined":(0,u.default)(t)){case"undefined":o=e;break;case"function":o=e,n=t;break;default:r=e,o=t}return(0,x.validateString)(i,1,r,!0),(0,x.validateCallback)(i,3,n,!0),this.getAuthClient(!0).updateIdentityProfile(r,o,n)}},{key:"updateIdentityProfile",value:function(e,t){var n="Webcom:updateIdentityProfile";(0,x.validateArgCount)(n,1,2,arguments.length);var i=void 0,r=void 0;return t?((0,x.validateString)(n,1,e,!1),i=e,r=t):r=e,this.getAuthClient(!0).updateIdentityProfile(i,r)}},{key:"changePassword",value:function(e,t,n,i){var r="Webcom:changePassword";return(0,x.validateArgCount)(r,3,4,arguments.length),(0,x.validateCallback)(r,4,i,!0),this.getAuthClient(!0).changePassword(e,t,n,i)}},{key:"removeUser",value:function(e,t,n){A.warn("Webcom.removeUser(email, password, [onComplete]) is deprecated. Please use Webcom.removeAccount() instead."),this.repo.statsIncrementCounter("deprecated_removeUser(email,password)");var i="Webcom:removeUser";return(0,x.validateArgCount)(i,2,3,arguments.length),(0,x.validateCallback)(i,3,n,!0),this.getAuthClient(!0).removeUser(e,t,n)}},{key:"sendPasswordResetEmail",value:function(e,t){A.warn("Webcom.sendPasswordResetEmail(email, [onComplete]) is deprecated. Please use Webcom.sendPasswordResetCode(provider,id,[message]) instead."),this.repo.statsIncrementCounter("deprecated_sendPasswordResetEmail(email)");var n="Webcom:sendPasswordResetEmail";return(0,x.validateArgCount)(n,1,2,arguments.length),(0,x.validateCallback)(n,2,t,!0),this.getAuthClient(!0).sendPasswordResetEmail(e,t)}},{key:"sendPasswordResetCode",value:function(e,t,n){var i="Webcom:sendPasswordResetCode";return(0,x.validateArgCount)(i,2,3,arguments.length),(0,x.validateString)(i,1,e,!1),(0,x.validateString)(i,2,t,!1),this.getAuthClient(!0).sendPasswordResetCode(e,t,n)}},{key:"sendConfirmationEmail",value:function(e,t){A.warn("Webcom.sendConfirmationEmail(email, [onComplete]) is deprecated. Please use Webcom.sendVerificationCode(provider,id,[message]) instead."),this.repo.statsIncrementCounter("deprecated_sendConfirmationEmail(email)");var n="Webcom:sendConfirmationEmail";return(0,x.validateArgCount)(n,1,2,arguments.length),(0,x.validateCallback)(n,2,t,!0),this.getAuthClient(!0).sendConfirmationEmail(e,t)}},{key:"sendVerificationCode",value:function(e,t,n){var i="Webcom:sendVerificationCode";return(0,x.validateArgCount)(i,2,3,arguments.length),(0,x.validateString)(i,1,e,!1),(0,x.validateString)(i,2,t,!1),this.getAuthClient(!0).sendVerificationCode(e,t,n)}},{key:"logout",value:function(e){(0,x.validateArgCount)("Webcom:logout",0,1,arguments.length),this.getAuthClient(!1).logout(e)}},{key:"getOAuthConfig",value:function(){var e=this,t={};return["google","facebook","orange","mobileconnectOFR","mobileconnectOES","mobileconnectOJO","mobileconnectOMG","mobileconnectOMA","github","gitlab"].forEach(function(n){t[n]={signin_url:U.getApiHost()+"/auth/v2/"+e.repo.name()+"/"+n+"/signin?mode=code",callback_url:U.getApiHost()+"/auth/v2/"+e.repo.name()+"/"+n+"/callback"}}),t}}],[{key:"ServerValue",get:function(){return{TIMESTAMP:{".sv":"timestamp"}}}},{key:"SDK_VERSION",get:function(){return"2.7.1"}},{key:"INTERNAL",get:function(){return q.default}},{key:"Context",get:function(){return N.default}}]),t}(k.default);t.default=H,i.Webcom=H,e.exports=t.default}).call(t,function(){return this}())},function(e,t){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(123),o=i(r);t.default=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),(0,o.default)(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}()},function(e,t,n){(function(e){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function o(){return oe++}function a(e,t){if(!e)throw new Error("Webcom INTERNAL ASSERT FAILED:"+t)}function u(e,t){e||v(t)}function s(t){return e.btoa(window.unescape(encodeURIComponent(t))).replace(/[\+\/=]/g,function(e){switch(e){case"=":return".";case"/":return"_";case"+":return"-"}})}function l(e){try{if("undefined"!=typeof atob)return atob(e)}catch(e){h("base64DecodeIfNativeSupport failed: ",e)}return null}function c(e){return(0,te.fromBits)(ne.sha1.hash(e))}function d(){for(var e="",t=0;t<arguments.length;t++)e+=X.isArrayLike(arguments[t])?d.apply(null,arguments[t]):"object"===(0,B.default)(arguments[t])?(0,q.default)(arguments[t]):arguments[t],e+=" ";return e}function h(){if(se===!0&&(se=!1,null===le&&Y.SessionStorage.get("logging_enabled")===!0&&f(!0)),le){var e=d.apply(null,arguments);le(e)}}function f(e,n){a(!n||e===!0||e===!1,"Can't turn on custom loggers persistently."),e===!0?("undefined"!=typeof console&&("function"==typeof console.log?t.logger=le=(0,re.bind)(console.log,console):"object"===(0,B.default)(console.log)&&(t.logger=le=function(e){})),n&&Y.SessionStorage.set("logging_enabled",!0)):e?t.logger=le=e:(t.logger=le=null,Y.SessionStorage.remove("logging_enabled"))}function p(e){return function(){h(e,arguments)}}function v(){if("undefined"!=typeof console){"WEBCOM INTERNAL ERROR: "+d.apply(null,arguments);"undefined"!=typeof console.error}}function _(){var e=d.apply(null,arguments);throw new Error("WEBCOM FATAL ERROR: "+e)}function y(){if("undefined"!=typeof console){"WEBCOM WARNING: "+d.apply(null,arguments);"undefined"!=typeof console.warn}}function g(){"undefined"!=typeof window&&window.location&&window.location.protocol&&window.location.protocol.indexOf("https:")!==-1&&y("Insecure Webcom access from a secure page. Please use https in calls to new Webcom().")}function m(e){var t="",n="",i=!0,r="",o="",a=!0,u=void 0,s=void 0,l=void 0,c=void 0;return X.isString(e)&&(u=e.indexOf("//"),u>=0&&(o=e.substring(0,u-1),e=e.substring(u+2)),s=e.indexOf("/"),s===-1&&(s=e.length),t=e.substring(0,s),e=e.substring(s+1),l=t.split("."),c=e.split("/"),c.length>1&&"base"===c[0]?(i="https"===o||"wss"===o,n=c[1],r=b("/"+c.slice(2).join("/")),Y.PersistentStorage.set("host:"+ue+"/"+/base\/[^\/]*/.exec(e),t),(0,ie.setApiHost)((i?"https":"http")+("://"+t)),t=ue+"/base/"+n,Y.PersistentStorage.set("host:"+t,Y.PersistentStorage.get("host:"+t)+(i?"/_wss":"/_ws"))):_("Cannot parse Webcom url. Please check your url.")),i||g(),{repoInfo:new G.default(t,i,n,a),path:new z.default(r)}}function b(e){for(var t="",n=e.split("/"),i=0;i<n.length;i++)if(n[i].length>0){var r=n[i];try{r=(0,ee.urlDecode)(r)}catch(e){}t+="/"+r}return t}function k(e){return X.isNumber(e)&&(e!==e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY)}function C(t){if("complete"===document.readyState)t();else{var n=!1,i=function i(){return document.body?void(n||(n=!0,t())):void e.setTimeout(i,Math.floor(10))};document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&i()}),window.attachEvent("onload",i))}}function w(e,t){return e!==t?null===e?-1:null===t?1:("undefined"==typeof e?"undefined":(0,B.default)(e))!==("undefined"==typeof t?"undefined":(0,B.default)(t))?"number"==typeof e?-1:1:e>t?1:-1:0}function E(e,t){if(e===t)return 0;var n=M(e),i=M(t);return null!==n?null!==i?n-i===0?e.length-t.length:n-i:-1:null!==i?1:e<t?-1:1}function S(e,t){if(t&&e in t)return t[e];throw new Error("Missing required key ("+e+") in object: "+(0,q.default)(t))}function P(e){if("object"!==("undefined"==typeof e?"undefined":(0,B.default)(e))||null===e)return(0,q.default)(e);var t=(0,U.default)(e);t.sort();for(var n="{",i=0;i<t.length;i++)0!==i&&(n+=","),n+=(0,q.default)(t[i]),n+=":",n+=P(e[t[i]]);return n+="}"}function N(e,t){if(e.length<=t)return[e];for(var n=[],i=0;i<e.length;i+=t)n.push(e.substr(i,t));return n}function O(e,t){if(X.isArray(e))for(var n=0;n<e.length;++n)t(n,e[n]);else(0,Z.forEach)(e,t)}function A(e){a(!k(e),"Invalid JSON number");var t,n,i,r,o,u,s,l=11,c=52,d=(1<<l-1)-1;for(0===e?(n=0,i=0,t=1/e===-(1/0)?1:0):(t=e<0,e=Math.abs(e),e>=Math.pow(2,1-d)?(r=Math.min(Math.floor(Math.log(e)/Math.LN2),d),n=r+d,i=Math.round(e*Math.pow(2,c-r)-Math.pow(2,c))):(n=0,i=Math.round(e/Math.pow(2,1-d-c)))),u=[],o=c;o;o-=1)u.push(i%2?1:0),i=Math.floor(i/2);for(o=l;o;o-=1)u.push(n%2?1:0),n=Math.floor(n/2);u.push(t?1:0),u.reverse(),s=u.join("");var h="";for(o=0;o<64;o+=8){var f=parseInt(s.substr(o,8),2).toString(16);1===f.length&&(f="0"+f),h+=f}return h.toLowerCase()}function T(){return!("object"!==("undefined"==typeof window?"undefined":(0,B.default)(window))||!window.chrome||!window.chrome.extension||/^chrome/.test(window.location.href))}function D(){return"object"===("undefined"==typeof Windows?"undefined":(0,B.default)(Windows))&&"object"===(0,B.default)(Windows.UI)}function R(e){var t=null;return"too_big"===e?t="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===e?t="Client doesn't have permission to access the desired data.":"unavailable"===e&&(t="The service is unavailable"),t}function I(e){var t=R(e)||"Unknown Error",n=new Error(e+": "+t);return n.code=e.toUpperCase(),n}function M(e){if(ce.test(e)){var t=Number(e);if(t>=-2147483648&&t<=2147483647)return t}return null}function x(e){return"number"==typeof e?"number:"+A(e):"string:"+e}function W(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"ns",n="undefined"!=typeof window?window:e;return t.split(".").forEach(function(e){n=n[e]=n[e]||{}}),n}function j(e){ae=e}function L(){return ae}function F(){return"undefined"==typeof window}Object.defineProperty(t,"__esModule",{value:!0}),t.INTEGER_REGEXP_=t.logger=void 0;var V=n(25),U=r(V),Q=n(17),q=r(Q),H=n(6),B=r(H);t.LUIDGenerator=o,t.assert=a,t.assertWeak=u,t.base64Encode=s,t.base64DecodeIfNativeSupport=l,t.sha1=c,t.log=h,t.enableLogging=f,t.logWrapper=p,t.error=v,t.fatal=_,t.warn=y,t.warnIfPageIsSecure=g,t.parseURL=m,t.decodePath=b,t.isInvalidJSONNumber=k,t.executeWhenDOMReady=C,t.priorityCompare=w,t.nameCompare=E,t.requireKey=S,t.objectToUniqueKey=P,t.splitStringBySize=N,t.each=O,t.doubleToIEEE754String=A,t.isChromeExtensionContentScript=T,t.isWindowsStoreApp=D,t.getFriendlyErrorReason=R,t.errorForServerCode=I,t.tryParseInt=M,t.priorityHashText=x,t.getGlobalNamespace=W,t.setNodeProxy=j,t.getNodeProxy=L,t.isNodeEnv=F;var K=n(64),G=r(K),J=n(10),z=r(J),Y=n(12),$=n(4),X=i($),Z=n(5),ee=n(13),te=n(118),ne=n(120),ie=n(37),re=(n(16),n(8)),oe=1,ae=void 0,ue="io.datasync.orange.com",se=!0,le=t.logger=void 0;t.logger=le=null;var ce=t.INTEGER_REGEXP_=new RegExp("^-?\\d{1,10}$");t.default={assert:a,assertWeak:u,base64DecodeIfNativeSupport:l,base64Encode:s,decodePath:b,doubleToIEEE754String:A,each:O,error:v,getFriendlyErrorReason:R,errorForServerCode:I,executeWhenDOMReady:C,fatal:_,isChromeExtensionContentScript:T,isInvalidJSONNumber:k,isWindowsStoreApp:D,log:h,logger:le,logWrapper:p,LUIDGenerator:o,nameCompare:E,objectToUniqueKey:P,parseURL:m,priorityCompare:w,priorityHashText:x,requireKey:S,sha1:c,splitStringBySize:N,tryParseInt:M,warn:y,warnIfPageIsSecure:g,getGlobalNamespace:W,setNodeProxy:j,getNodeProxy:L}}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){var t="undefined"==typeof e?"undefined":(0,P.default)(e);if("object"===t){if(!e)return"null";if(e instanceof Array)return"array";if(e instanceof Object)return t;var n=Object.prototype.toString.call(e);if("[object Window]"===n)return"object";if("[object Array]"===n||"number"==typeof e.length&&"undefined"!=typeof e.splice&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("splice"))return"array";if("[object Function]"===n||"undefined"!=typeof e.call&&"undefined"!=typeof e.propertyIsEnumerable&&!e.propertyIsEnumerable("call"))return"function"}else if("function"===t&&"undefined"==typeof e.call)return"object";return t}function o(e){return"array"===r(e)}function a(e){var t=r(e);return"array"===t||"object"===t&&"number"==typeof e.length}function u(e){return"string"==typeof e}function s(e){return"boolean"==typeof e}function l(e){return"number"==typeof e}function c(e){return"function"===r(e)}function d(e){var t="undefined"==typeof e?"undefined":(0,P.default)(e);return"object"===t&&null!==e||"function"===t}function h(e){var t=new RegExp("^(https?://)?([a-z\\d]+:[a-z\\d%_.~+=-]+@)?((((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,})|([a-z\\d]+))|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$","i");return!!t.test(e)}function f(e){return void 0!==e}function p(){return(window.cordova||window.CordovaInAppBrowser||window.phonegap)&&/ios|iphone|ipod|ipad|android/i.test(navigator.userAgent)}function v(){return window.forge&&/ios|iphone|ipod|ipad|android/i.test(navigator.userAgent)}function _(){return!!window.Windows&&/^ms-appx:/.test(location.href)}function y(){return!!navigator.userAgent.match(/CriOS/)}function g(){return!!navigator.userAgent.match(/Twitter for iPhone/)}function m(){return!!navigator.userAgent.match(/FBAN\/FBIOS/)}function b(){return!!navigator.userAgent.match(/Windows Phone/)}function k(){return!!window.navigator.standalone}function C(){return!!navigator.userAgent.match(/PhantomJS/)}function w(){var e,t,n=-1,i=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName&&(e=/MSIE ([0-9]+[\.0-9]*)/,t=i.match(e),t&&t.length>1&&(n=parseFloat(t[1])),n<10)}function E(){try{var e=navigator.userAgent;return e.indexOf("Fennec/")!==-1||e.indexOf("Firefox/")!==-1&&e.indexOf("Android")!==-1}catch(e){}return!1}Object.defineProperty(t,"__esModule",{value:!0});var S=n(6),P=i(S);t.typeOf=r,t.isArray=o,t.isArrayLike=a,t.isString=u,t.isBoolean=s,t.isNumber=l,t.isFunction=c,t.isObject=d,t.isUrl=h,t.isDef=f,t.isMobileCordovaInAppBrowser=p,t.isMobileTriggerIoTab=v,t.isWindowsMetro=_,t.isChromeiOS=y,t.isTwitteriOS=g,t.isFacebookiOS=m,t.isWindowsPhone=b,t.isStandaloneiOS=k,t.isPhantomJS=C,t.isIeLT10=w,t.isFennec=E,t.default={typeOf:r,isDef:f,isArray:o,isArrayLike:a,isString:u,isBoolean:s,isNumber:l,isFunction:c,isObject:d,isUrl:h,isMobileCordovaInAppBrowser:p,isMobileTriggerIoTab:v,isWindowsMetro:_,isChromeiOS:y,isTwitteriOS:g,isFacebookiOS:m,isWindowsPhone:b,isStandaloneiOS:k,isPhantomJS:C,isIeLT10:w,isFennec:E}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function a(e,t,n){h(e).forEach(function(i){t.call(n,e[i],i,e)})}function u(e){return h(e).length}function s(e){return 0===h(e).length}function l(e){var t={};return a(e,function(e,n){t[n]=e}),t}Object.defineProperty(t,"__esModule",{value:!0}),t.getKeys=void 0;var c=n(25),d=i(c);t.contains=r,t.get=o,t.forEach=a,t.getCount=u,t.isEmpty=s,t.clone=l;var h=t.getKeys=function(e){return e&&e instanceof Object?(0,d.default)(e):[]};t.default={contains:r,forEach:a,getCount:u,isEmpty:s,clone:l,getKeys:h,get:o}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(127),o=i(r),a=n(126),u=i(a),s="function"==typeof u.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof u.default&&e.constructor===u.default&&e!==u.default.prototype?"symbol":typeof e};t.default="function"==typeof u.default&&"symbol"===s(o.default)?function(e){return"undefined"==typeof e?"undefined":s(e)}:function(e){return e&&"function"==typeof u.default&&e.constructor===u.default&&e!==u.default.prototype?"symbol":"undefined"==typeof e?"undefined":s(e)}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){(function(e){"use strict";function n(e,t){return t?a(e,t):e}function i(t){try{t()}catch(t){e.setTimeout(function(){throw t},Math.floor(0))}}function r(){}function o(){throw Error("unimplemented abstract method")}function a(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return e.bind.apply(e,[t].concat(i))}Object.defineProperty(t,"__esModule",{value:!0}),t.bindCallback=n,t.exceptionGuard=i,t.nullFunction=r,t.abstractMethod=o,t.bind=a,t.default={abstractMethod:o,exceptionGuard:i,nullFunction:r,bind:a,bindCallback:n}}).call(t,function(){return this}())},function(e,t,n){e.exports={default:n(133),__esModule:!0}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=function(){function e(t,n){if((0,o.default)(this,e),1===arguments.length){this.pieces_=t.split("/");for(var i=0,r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[i]=this.pieces_[r],i++);this.pieces_.length=i,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=n}return(0,u.default)(e,[{key:"getFront",value:function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]}},{key:"popFront",value:function(){var t=this.pieceNum_;return t<this.pieces_.length&&t++,new e(this.pieces_,t)}},{key:"getBack",value:function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null}},{key:"toString",value:function(){for(var e="",t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+this.pieces_[t]);return e||"/"}},{key:"parent",value:function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var t=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)t.push(this.pieces_[n]);return new e(t,0)}},{key:"child",value:function(t){for(var n=[],i=this.pieceNum_;i<this.pieces_.length;i++)n.push(this.pieces_[i]);if(t instanceof e)for(i=t.pieceNum_;i<t.pieces_.length;i++)n.push(t.pieces_[i]);else{var r=t.split("/");for(i=0;i<r.length;i++)r[i].length>0&&n.push(r[i])}return new e(n,0)}},{key:"isEmpty",value:function(){return this.pieceNum_>=this.pieces_.length}},{key:"length",value:function(){return this.pieces_.length-this.pieceNum_}},{key:"contains",value:function(e){var t=this.pieceNum_,n=e.pieceNum_;if(this.length()>e.length())return!1;for(;t<this.pieces_.length;){if(this.pieces_[t]!==e.pieces_[n])return!1;++t,++n}return!0}}],[{key:"RelativePath",value:function(t,n){var i=t.getFront(),r=n.getFront();if(null===i)return n;if(i===r)return e.RelativePath(t.popFront(),n.popFront());throw"INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+t+")"}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){(function(e){"use strict";function i(t,n){var i=n();if(i){if(i=(0,v.formatError)(i),!t)throw i;return e.setTimeout(function(){t(i)},0),!1}return!0}function r(e,t,n,r,o){return i(o,function(){if(!e.includes(t))return{code:"CLIENT_ERROR",message:"Transport "+r+" is not supported for this request: "+t+" "+n+"."}})}function o(e,t,n,i){var r;if(i<t?r="at least "+t:i>n&&(r=0===n?"none":"no more than "+n),r){var o=e+" failed: Was called with "+i+(1===i?" argument.":" arguments.")+" Expects "+r+".";throw new Error(o)}}function a(e,t,n,i){var r="";switch(t){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:(0,_.assert)(!1,"errorPrefix_ called with argumentNumber > 4. Need to update it?")}var o=e+" failed: ";return"string"==typeof i&&(o+="the '"+i+":' field of the "),o+=r+" argument "}function u(){return y.apply(void 0,[p.isString,"must be a valid webcom namespace."].concat(Array.prototype.slice.call(arguments)))}function s(){return y.apply(void 0,[p.isFunction,"must be a valid function."].concat(Array.prototype.slice.call(arguments)))}function l(){return y.apply(void 0,[p.isString,"must be a valid string."].concat(Array.prototype.slice.call(arguments)))}function c(){return y.apply(void 0,[function(e){return null!==e&&(0,p.isObject)(e)},"must be a valid context object."].concat(Array.prototype.slice.call(arguments)))}function d(e){return(0,p.isString)(e)&&g.test(e)}function h(e){return(0,p.isString)(e)}function f(e){return(0,p.isString)(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.validateWithCallback=i,t.validateHttpMethod=r,t.validateArgCount=o,t.errorPrefix=a,t.validateNamespace=u,t.validateCallback=s,t.validateString=l,t.validateContextObject=c,t.isValidEmail=d,t.isValidPassword=h,t.isValidNamespace=f;var p=n(4),v=n(79),_=n(3),y=function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];if((!i[3]||(0,p.isDef)(i[2]))&&!e(i[2]))throw i.splice(2,1),new Error(a.apply(void 0,i)+t)},g=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})+$/;t.default={errorPrefix:a,validateArgCount:o,validateCallback:s,validateContextObject:c,validateNamespace:u,validateString:l,isValidEmail:d,isValidPassword:h,isValidNamespace:f,validateHttpMethod:r,validateWithCallback:i}}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){try{if("undefined"!=typeof window&&"undefined"!=typeof window[e]){var t=window[e];return t.setItem("webcom:sentinel","cache"),t.removeItem("webcom:sentinel"),new a.default(t)}}catch(e){}return new s.default}Object.defineProperty(t,"__esModule",{value:!0}),t.SessionStorage=t.PersistentStorage=void 0;var o=n(99),a=i(o),u=n(100),s=i(u);t.PersistentStorage=r("localStorage"),t.SessionStorage=r("sessionStorage")},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){return encodeURIComponent(String(e))}function o(e){return decodeURIComponent(e.replace(/\+/g," "))}function a(){var e=2147483648;return Math.floor(Math.random()*e).toString(36)+Math.abs(Math.floor(Math.random()*e)^Date.now()).toString(36)}function u(e){var t=document.createElement("a");return t.href=e,{protocol:t.protocol.replace(":",""),host:t.hostname,port:t.port,query:t.search,params:s(t.search),hash:t.hash.replace("#",""),path:t.pathname.replace(/^([^\/])/,"/$1")}}function s(e){for(var t={},n=e.replace(/^\?/,"").split("&"),i=0;i<n.length;i++)if(n[i]){var r=n[i].split("=");t[r[0]]=r[1]}return t}function l(e){if(!e)return"";var t=[];return(0,_.default)(e).forEach(function(n){var i=e[n];void 0!==i&&null!==i&&("object"===("undefined"==typeof i?"undefined":(0,p.default)(i))&&(i=(0,h.default)(i)),t.push(encodeURIComponent(n)+"="+encodeURIComponent(i)))}),t.join("&")}function c(e,t){return e.indexOf("?")===-1&&(e+="?"),e.endsWith("?")||(e+="&"),e+=l(t)}Object.defineProperty(t,"__esModule",{value:!0});var d=n(17),h=i(d),f=n(6),p=i(f),v=n(25),_=i(v);t.urlEncode=r,t.urlDecode=o,
t.getRandomString=a,t.parseUrl=u,t.parseQuerystring=s,t.formatQueryString=l,t.addQueryParameters=c,t.default={urlDecode:o,urlEncode:r,getRandomString:a,parseQuerystring:s,parseUrl:u,formatQueryString:l,addQueryParameters:c}},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var i=n(84),r=n(46);e.exports=function(e){return i(r(e))}},function(e,t,n){"use strict";function i(){return d.apply(void 0,["forEach"].concat(Array.prototype.slice.call(arguments)))}function r(){return d.apply(void 0,["map"].concat(Array.prototype.slice.call(arguments)))}function o(){return d.apply(void 0,["every"].concat(Array.prototype.slice.call(arguments)))}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return i&&(t=(0,c.bind)(t,i)),d("reduce",e,t,n,i)}function u(e,t,n){for(var i=e.length,r=(0,l.isString)(e)?e.split(""):e,o=0;o<i;o++)if(o in r&&t.call(n,r[o],o,e))return o;return-1}function s(e,t,n){var i=u(e,t,n);return i<0?null:(0,l.isString)(e)?e.charAt(i):e[i]}Object.defineProperty(t,"__esModule",{value:!0}),t.forEach=i,t.map=r,t.every=o,t.reduce=a,t.findIndex=u,t.find=s;var l=n(4),c=n(8),d=function(e,t){for(var n=arguments.length,i=Array(n>2?n-2:0),r=2;r<n;r++)i[r-2]=arguments[r];return t[e].apply(t,i)};t.default={forEach:i,map:r,reduce:a,find:s,findIndex:u}},function(e,t,n){e.exports={default:n(128),__esModule:!0}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(125),o=i(r),a=n(122),u=i(a),s=n(6),l=i(s);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":(0,l.default)(t)));e.prototype=(0,u.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(6),o=i(r);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":(0,o.default)(t))&&"function"!=typeof t?e:t}},function(e,t,n){e.exports=!n(26)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(14),r=n(7),o=n(81),a=n(27),u="prototype",s=function(e,t,n){var l,c,d,h=e&s.F,f=e&s.G,p=e&s.S,v=e&s.P,_=e&s.B,y=e&s.W,g=f?r:r[t]||(r[t]={}),m=g[u],b=f?i:p?i[t]:(i[t]||{})[u];f&&(n=t);for(l in n)c=!h&&b&&void 0!==b[l],c&&l in g||(d=c?b[l]:n[l],g[l]=f&&"function"!=typeof b[l]?n[l]:_&&c?o(d,i):y&&b[l]==d?function(e){var t=function(t,n,i){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,i)}return e.apply(this,arguments)};return t[u]=e[u],t}(d):v&&"function"==typeof d?o(Function.call,d):d,v&&((g.virtual||(g.virtual={}))[l]=d,e&s.R&&m&&!m[l]&&a(m,l,d)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var i=n(31),r=n(83),o=n(58),a=Object.defineProperty;t.f=n(20)?Object.defineProperty:function(e,t,n){if(i(e),t=o(t,!0),i(n),r)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return C.priorityCompare(e.priority,t.priority)||(0,k.nameCompare)(e.name,t.name)}function a(e,t){return(0,k.nameCompare)(e.name,t.name)}function u(e,t){if(null===e)return O;var n=null;if("object"===("undefined"==typeof e?"undefined":(0,c.default)(e))&&".priority"in e?n=e[".priority"]:"undefined"!=typeof t&&(n=t),C.assert(null===n||"string"==typeof n||"number"==typeof n||"object"===("undefined"==typeof n?"undefined":(0,c.default)(n))&&".sv"in n,"Invalid priority type found: "+("undefined"==typeof n?"undefined":(0,c.default)(n))),"object"===("undefined"==typeof e?"undefined":(0,c.default)(e))&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!==("undefined"==typeof e?"undefined":(0,c.default)(e))||".sv"in e){var i=e;return new g.default(i,n)}if(e instanceof Array||!A){var r=O,o=e;return(0,w.forEach)(o,function(e,t){if((0,w.contains)(o,t)&&"."!==t.substring(0,1)){var n=u(e);!n.isLeafNode()&&n.isEmpty()||(r=r.updateImmediateChild(t,n))}}),r.updatePriority(n)}var a=[],l={},d=!1,h=e;C.each(h,function(e,t){if("string"!=typeof t||"."!==t.substring(0,1)){var n=u(h[t]);n.isEmpty()||(d=d||null!==n.getPriority(),a.push({name:t,priority:n.getPriority()}),l[t]=n)}});var f=s(a,l,!1);if(d){var p=s(a,l,!0);return new b.default(f,p,n)}return new _.default(f,n)}function s(e,t,n){var i=n?o:a;e.sort(i);var r=function i(r,o){var a,u,s=o-r;if(0===s)return null;if(1===s)return a=e[r].name,u=n?e[r]:a,new E.LLRBNode(u,t[a],E.LLRBNode.BLACK,null,null);var l=parseInt(s/2,10)+r,c=i(r,l),d=i(l+1,o);return a=e[l].name,u=n?e[l]:a,new E.LLRBNode(u,t[a],E.LLRBNode.BLACK,c,d)},u=function(i){for(var o=null,a=null,u=e.length,s=function(e){o?(o.left=e,o=e):(a=e,o=e)},l=function(i,o){var a=u-i,l=u;u-=i;var c=r(a+1,l),d=e[a].name,h=n?e[a]:d;s(new E.LLRBNode(h,t[d],o,null,c))},c=0;c<i.count;++c){var d=i.nextBitIsOne(),h=Math.pow(2,i.count-(c+1));d?l(h,E.LLRBNode.BLACK):(l(h,E.LLRBNode.BLACK),l(h,E.LLRBNode.RED))}return a},s=new N(e.length),l=u(s);return i=n?o:k.nameCompare,null!==l?new S.default(i,l):new S.default(i)}Object.defineProperty(t,"__esModule",{value:!0}),t.EMPTY_NODE=t.Base12Num=void 0;var l=n(6),c=r(l),d=n(1),h=r(d),f=n(2),p=r(f);t.NAME_AND_PRIORITY_COMPARATOR=o,t.NAME_ONLY_COMPARATOR=a,t.NodeFromJSON=u,t.buildChildSet=s;var v=n(33),_=r(v),y=n(34),g=r(y),m=n(67),b=r(m),k=n(3),C=i(k),w=n(5),E=n(42),S=r(E),P=Math.log(2),N=t.Base12Num=function(){function e(t){(0,h.default)(this,e);var n=function(e){return parseInt(Math.log(e)/P,10)},i=function(e){return parseInt(Array(e+1).join("1"),2)};this.count=n(t+1),this.current_=this.count-1;var r=i(this.count);this.bits_=t+1&r}return(0,p.default)(e,[{key:"nextBitIsOne",value:function(){var e=!(this.bits_&1<<this.current_);return this.current_--,e}}]),e}(),O=t.EMPTY_NODE=new _.default,A=!0;t.default={EMPTY_NODE:O,NAME_AND_PRIORITY_COMPARATOR:o,NAME_ONLY_COMPARATOR:a,NodeFromJSON:u,buildChildSet:s}},function(e,t,n){e.exports={default:n(134),__esModule:!0}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var i=n(23),r=n(39);e.exports=n(20)?function(e,t,n){return i.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){var i=n(88),r=n(47);e.exports=Object.keys||function(e){return i(e,r)}},function(e,t,n){var i=n(56)("wks"),r=n(41),o=n(14).Symbol,a="function"==typeof o,u=e.exports=function(e){return i[e]||(i[e]=a&&o[e]||(a?o:r)("Symbol."+e))};u.store=i},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return(0,S.isString)(e)&&0!==e.length&&!N.test(e)}function o(e){return(0,S.isString)(e)&&0!==e.length&&!O.test(e)}function a(e){return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),o(e)}function u(e,t,n,i){i&&!(0,S.isDef)(n)||s((0,w.errorPrefix)(e,t,i),n)}function s(e,t,n,i){if(n||(n=0),i=i||[],!(0,S.isDef)(t))throw new Error(e+"contains undefined"+l(i));if(P.isFunction(t))throw new Error(e+"contains a function"+l(i)+" with contents: "+t.toString());if((0,E.isInvalidJSONNumber)(t))throw new Error(e+"contains "+t.toString()+l(i));if(n>T)throw new TypeError(e+"contains a cyclic object value ("+i.slice(0,100).join(".")+"...)");if((0,S.isString)(t)&&t.length>A/3&&(0,C.stringToByteArray)(t).length>A)throw new Error(e+"contains a string greater than "+A+" utf8 bytes"+l(i)+" ('"+t.substring(0,50)+"...')");if((0,S.isObject)(t))for(var o in t)if((0,k.contains)(t,o)){var a=t[o];if(".priority"!==o&&".value"!==o&&".sv"!==o&&!r(o))throw new Error(e+"contains an invalid key ("+o+")"+l(i)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');i.push(o),s(e,a,n+1,i),i.pop()}}function l(e){return 0===e.length?"":" in property '"+e.join(".")+"'"}function c(e,t,n,i){if(!i||(0,S.isDef)(n)){if(!(0,S.isObject)(n)||P.isArray(n))throw new Error((0,w.errorPrefix)(e,t,i)+" must be an Object containing the children to replace.");u(e,t,n,i)}}function d(e,t,n,i){if((!i||(0,S.isDef)(n))&&!(null===n||(0,S.isNumber)(n)||(0,S.isString)(n)||(0,S.isObject)(n)&&(0,k.contains)(n,".sv")))throw new Error((0,w.errorPrefix)(e,t,i)+"must be a valid webcom priority (a string, number, or null).")}function h(e,t,n,i){if(!i||(0,S.isDef)(n))switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error((0,w.errorPrefix)(e,t,i)+'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function f(e,t,n,i){if((!i||(0,S.isDef)(n))&&!r(n))throw new Error((0,w.errorPrefix)(e,t,i)+'was an invalid key: "'+n+'". Webcom keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function p(e,t,n,i){if((!i||(0,S.isDef)(n))&&!o(n))throw new Error((0,w.errorPrefix)(e,t,i)+'was an invalid path: "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function v(e,t,n,i){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),p(e,t,n,i)}function _(e,t){if(".info"===t.getFront())throw new Error(e+" failed: Can't modify data under /.info/")}function y(e,t,n){var i=n.path.toString();if(!(0,S.isString)(n.repoInfo.host)||0===n.repoInfo.host.length||!r(n.repoInfo.namespace)||0!==i.length&&!a(i))throw new Error((0,w.errorPrefix)(e,t,!1)+'must be a valid webcom URL and the path can\'t contain ".", "#", "$", "[", or "]".')}function g(e,t,n,i){if((!i||(0,S.isDef)(n))&&!(0,S.isUrl)(n))throw new Error((0,w.errorPrefix)(e,t,i)+"must be a valid credential (a string).")}function m(e,t,n,i){if((!i||(0,S.isDef)(n))&&!(0,S.isString)(n))throw new Error((0,w.errorPrefix)(e,t,i)+"must be a valid credential (a string).")}function b(e,t,n,i){if((!i||(0,S.isDef)(n))&&!P.isBoolean(n))throw new Error((0,w.errorPrefix)(e,t,i)+"must be a boolean.")}Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_DEPTH_SIZE_=t.MAX_LEAF_SIZE_=t.INVALID_PATH_REGEX_=t.INVALID_KEY_REGEX_=void 0,t.isValidKey=r,t.isValidPathString=o,t.isValidRootPathString=a,t.validateWebcomDataArg=u,t.validateWebcomData=s,t.pathLocation_=l,t.validateWebcomObjectDataArg=c,t.validatePriority=d,t.validateEventType=h,t.validateKey=f,t.validatePathString=p,t.validateRootPathString=v,t.validateWritablePath=_,t.validateUrl=y,t.validateUri=g,t.validateCredential=m,t.validateBoolean=b;var k=n(5),C=n(121),w=n(11),E=n(3),S=n(4),P=i(S),N=t.INVALID_KEY_REGEX_=/[\[\].#$\/\u0000-\u001F\u007F]/,O=t.INVALID_PATH_REGEX_=/[\[\].#$\u0000-\u001F\u007F]/,A=t.MAX_LEAF_SIZE_=10485760,T=t.MAX_DEPTH_SIZE_=1e3;t.default={isValidKey:r,isValidPathString:o,isValidRootPathString:a,pathLocation_:l,validateBoolean:b,validateCredential:m,validateEventType:h,validateWebcomData:s,validateWebcomDataArg:u,validateWebcomObjectDataArg:c,validateKey:f,validatePathString:p,validatePriority:d,validateRootPathString:v,validateUrl:y,validateWritablePath:_}},function(e,t,n){var i=n(32);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.ChildrenNode=void 0;var r=n(9),o=i(r),a=n(25),u=i(a),s=n(1),l=i(s),c=n(2),d=i(c),h=n(45),f=i(h),p=n(3),v=n(42),_=i(v),y=n(34),g=i(y),m=/^(0|[1-9][0-9]*)$/,b=t.ChildrenNode=function(){function e(t,n){(0,l.default)(this,e),this.children_=t||new _.default(p.nameCompare),this.priority_="undefined"!=typeof n?n:null}return(0,d.default)(e,[{key:"isLeafNode",value:function(){return!1}},{key:"getPriority",value:function(){return this.priority_}},{key:"updatePriority",value:function(t){return new e(this.children_,t)}},{key:"updateValue",value:function(e){return new g.default(e,this.priority_)}},{key:"updateImmediateChild",value:function(t,n){var i=this.children_.remove(t);return n&&n.isEmpty()&&(n=null),null!==n&&(i=i.insert(t,n)),n&&null!==n.getPriority()?new Webcom.INTERNAL.SortedChildrenNode(i,null,this.priority_):new e(i,this.priority_)}},{key:"updateChild",value:function(e,t){var n=e.getFront();if(null===n)return t;var i=this.getImmediateChild(n).updateChild(e.popFront(),t);return this.updateImmediateChild(n,i)}},{key:"isEmpty",value:function(){return this.children_.isEmpty()}},{key:"numChildren",value:function(){return this.children_.count()}},{key:"val",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"withArrays";if(this.isEmpty())return null;var t="export"===e,n="withArrays"===e,i={},r=0,o=0,a=n;if(this.forEachChild(function(t,n){i[t]=n.val(e),r++,a&&(m.test(t)?o=Math.max(o,Number(t)):a=!1)}),a&&o<2*r){var s=[];return(0,u.default)(i).forEach(function(e){return s[e]=i[e]}),s}return t&&null!==this.getPriority()&&(i[".priority"]=this.getPriority()),i}},{key:"hash",value:function(){var e="";return null!==this.getPriority()&&(e+="priority:"+(0,p.priorityHashText)(this.getPriority())+":"),this.forEachChild(function(t,n){var i=n.hash();""!==i&&(e+=":"+t+":"+i)}),""===e?"":(0,p.sha1)(e)}},{key:"getImmediateChild",value:function(t){var n=this.children_.get(t);return null===n?new e:n}},{key:"getChild",value:function(e){var t=e.getFront();return null===t?this:this.getImmediateChild(t).getChild(e.popFront())}},{key:"getPredecessorChildName",value:function(e){return this.children_.getPredecessorKey(e)}},{key:"getFirstChildName",value:function(){return this.children_.minKey()}},{key:"getLastChildName",value:function(){return this.children_.maxKey()}},{key:"forEachChild",value:function(e){return this.children_.inorderTraversal(e)}},{key:"forEachChildReverse",value:function(e){return this.children_.reverseTraversal(e)}},{key:"getIterator",value:function(){return this.children_.getIterator()}},{key:"toString",value:function(){return(0,f.default)(e.prototype.__proto__||(0,o.default)(e.prototype),"toString",this).call(this)}}]),e}();t.default=b},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.LeafNode=void 0;var o=n(9),a=r(o),u=n(6),s=r(u),l=n(1),c=r(l),d=n(2),h=r(d),f=n(45),p=r(f),v=n(3),_=i(v),y=n(33),g=r(y),m=t.LeafNode=function(){function e(t,n){(0,c.default)(this,e),this.value_=t,_.assert(null!==this.value_,"LeafNode shouldn't be created with null value."),this.priority_="undefined"!=typeof n?n:null}return(0,h.default)(e,[{key:"isLeafNode",value:function(){return!0}},{key:"getPriority",value:function(){return this.priority_}},{key:"updatePriority",value:function(t){return new e(this.value_,t)}},{key:"updateValue",value:function(t){return new e(t,this.priority_)}},{key:"getImmediateChild",value:function(){return new g.default}},{key:"getChild",value:function(e){return null===e.getFront()?this:new g.default}},{key:"getPredecessorChildName",value:function(){return null}},{key:"updateImmediateChild",value:function(e,t){return(new g.default).updateImmediateChild(e,t).updatePriority(this.priority_)}},{key:"updateChild",value:function(e,t){var n=e.getFront();return null===n?t:this.updateImmediateChild(n,(new g.default).updateChild(e.popFront(),t))}},{key:"isEmpty",value:function(){return!1}},{key:"numChildren",value:function(){return 0}},{key:"val",value:function(e){return e&&null!==this.getPriority()?{".value":this.getValue(),".priority":this.getPriority()}:this.getValue()}},{key:"hash",value:function(){var e="";null!==this.getPriority()&&(e+="priority:"+_.priorityHashText(this.getPriority())+":");var t=(0,s.default)(this.value_);return e+=t+":",e+="number"===t?_.doubleToIEEE754String(this.value_):this.value_,_.sha1(e)}},{key:"getValue",value:function(){return this.value_}},{key:"toString",value:function(){return(0,p.default)(e.prototype.__proto__||(0,a.default)(e.prototype),"toString",this).call(this)}}]),e}();t.default=m},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.TreeNode=void 0;var o=n(2),a=r(o),u=n(1),s=r(u),l=n(10),c=r(l),d=n(5),h=i(d),f=n(3),p=t.TreeNode=function e(){(0,s.default)(this,e),this.children={},this.childCount=0,this.value=null},v=function(){function e(t,n,i){(0,s.default)(this,e),this.name_=t?t:"",this.parent_=n?n:null,this.node_=i?i:new p}return(0,a.default)(e,[{key:"subTree",value:function(t){for(var n,i=t instanceof c.default?t:new c.default(t),r=this;null!==(n=i.getFront());){var o=h.get(r.node_.children,n)||new p;r=new e(n,r,o),i=i.popFront()}return r}},{key:"getValue",value:function(){return this.node_.value}},{key:"setValue",value:function(e){(0,f.assert)("undefined"!=typeof e,"Cannot set value to undefined"),this.node_.value=e,this.updateParents_()}},{key:"clear",value:function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()}},{key:"hasChildren",value:function(){return this.node_.childCount>0}},{key:"isEmpty",value:function(){return null===this.getValue()&&!this.hasChildren()}},{key:"forEachChild",value:function(t){for(var n in this.node_.children)this.node_.children.hasOwnProperty(n)&&t(new e(n,this,this.node_.children[n]))}},{key:"forEachDescendant",value:function(e,t,n){t&&!n&&e(this),this.forEachChild(function(t){t.forEachDescendant(e,!0,n)}),t&&n&&e(this)}},{key:"forEachAncestor",value:function(e,t){for(var n=t?this:this.parent();null!==n;){if(e(n))return!0;n=n.parent()}return!1}},{key:"forEachImmediateDescendantWithValue",value:function(e){this.forEachChild(function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)})}},{key:"path",value:function(){return new c.default(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)}},{key:"name",value:function(){return this.name_}},{key:"parent",value:function(){return this.parent_}},{key:"updateParents_",value:function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)}},{key:"updateChild_",value:function(e,t){var n=t.isEmpty(),i=h.contains(this.node_.children,e);n&&i?(delete this.node_.children[e],this.node_.childCount--,this.updateParents_()):n||i||(this.node_.children[e]=t.node_,this.node_.childCount++,this.updateParents_())}}]),e}();t.default=v},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=function(){function e(t,n,i,r){(0,o.default)(this,e),this.type=t,this.snapshotNode=n,this.childName=i,this.prevName=r}return(0,u.default)(e,null,[{key:"CHILD_ADDED",get:function(){return"child_added"}},{key:"CHILD_REMOVED",get:function(){return"child_removed"}},{key:"CHILD_CHANGED",get:function(){return"child_changed"}},{key:"CHILD_MOVED",get:function(){return"child_moved"}},{key:"VALUE",get:function(){return"value"}}]),e}();t.default=s,e.exports=t.default},function(e,t){"use strict";function n(e){r=/http(?:s)?:\/\/[^\/]*/.exec(e)[0]}function i(){return r}Object.defineProperty(t,"__esModule",{value:!0}),t.setApiHost=n,t.getApiHost=i;var r="";t.default={setApiHost:n,getApiHost:i}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var i=n(46);e.exports=function(e){return Object(i(e))}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){return e<t?-1:e>t?1:0}Object.defineProperty(t,"__esModule",{value:!0}),t.LLRBNode=t.SortedMapIterator=t.LLRBEmptyNode=void 0;var o=n(1),a=i(o),u=n(2),s=i(u),l=t.LLRBEmptyNode=function(){function e(){(0,a.default)(this,e)}return(0,s.default)(e,[{key:"copy",value:function(){return this}},{key:"insert",value:function(e,t,n){return new v(e,t,null)}},{key:"remove",value:function(e,t){return this}},{key:"count",value:function(){return 0}},{key:"isEmpty",value:function(){return!0}},{key:"inorderTraversal",value:function(e){return!1}},{key:"reverseTraversal",value:function(e){return!1}},{key:"minKey",value:function(){return null}},{key:"maxKey",value:function(){return null}},{key:"check_",value:function(){return 0}},{key:"isRed_",value:function(){return!1}}]),e}(),c=new l,d=!0,h=!1,f=function(){function e(t,n){(0,a.default)(this,e),this.comparator_=t?t:r,this.root_=n?n:c}return(0,s.default)(e,[{key:"insert",value:function(t,n){return new e(this.comparator_,this.root_.insert(t,n,this.comparator_).copy(null,null,v.BLACK,null,null))}},{key:"remove",value:function(t){return new e(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,v.BLACK,null,null))}},{key:"get",value:function(e){for(var t,n=this.root_;!n.isEmpty();){if(t=this.comparator_(e,n.key),0===t)return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null}},{key:"getPredecessorKey",value:function(e){for(var t,n=this.root_,i=null;!n.isEmpty();){if(t=this.comparator_(e,n.key),0===t){if(n.left.isEmpty())return i?i.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}t<0?n=n.left:t>0&&(i=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")}},{key:"isEmpty",value:function(){return this.root_.isEmpty()}},{key:"count",value:function(){return this.root_.count()}},{key:"minKey",value:function(){return this.root_.minKey()}},{key:"maxKey",value:function(){return this.root_.maxKey()}},{key:"inorderTraversal",value:function(e){return this.root_.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.root_.reverseTraversal(e)}},{key:"getIterator",value:function(e){return new p(this.root_,e)}}]),e}();t.default=f;var p=t.SortedMapIterator=function(){function e(t,n){for((0,a.default)(this,e),this.resultGenerator_=n,this.nodeStack_=[];!t.isEmpty();)this.nodeStack_.push(t),t=t.left}return(0,s.default)(e,[{key:"getNext",value:function(){if(0===this.nodeStack_.length)return null;var e,t=this.nodeStack_.pop();for(e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value},t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e}}]),e}(),v=t.LLRBNode=function(){function e(t,n,i,r,o){(0,a.default)(this,e),this.key=t,this.value=n,this.color=null!=i?i:d,this.left=null!=r?r:c,this.right=null!=o?o:c}return(0,s.default)(e,[{key:"copy",value:function(t,n,i,r,o){return new e(null!=t?t:this.key,null!=n?n:this.value,null!=i?i:this.color,null!=r?r:this.left,null!=o?o:this.right)}},{key:"count",value:function(){return this.left.count()+1+this.right.count()}},{key:"isEmpty",value:function(){return!1}},{key:"inorderTraversal",value:function(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}},{key:"reverseTraversal",value:function(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}},{key:"min_",value:function(){return this.left.isEmpty()?this:this.left.min_()}},{key:"minKey",value:function(){return this.min_().key}},{key:"maxKey",value:function(){return this.right.isEmpty()?this.key:this.right.maxKey()}},{key:"insert",value:function(e,t,n){var i,r;return r=this,i=n(e,r.key),r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp_()}},{key:"removeMin_",value:function(){var e;return this.left.isEmpty()?c:(e=this,e.left.isRed_()||e.left.left.isRed_()||(e=e.moveRedLeft_()),e=e.copy(null,null,null,e.left.removeMin_(),null),e.fixUp_())}},{key:"remove",value:function(e,t){var n,i;if(n=this,t(e,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(e,t),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===t(e,n.key)){if(n.right.isEmpty())return c;i=n.right.min_(),n=n.copy(i.key,i.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.fixUp_()}},{key:"isRed_",value:function(){return this.color}},{key:"fixUp_",value:function(){var e=this;return e.right.isRed_()&&!e.left.isRed_()&&(e=e.rotateLeft_()),e.left.isRed_()&&e.left.left.isRed_()&&(e=e.rotateRight_()),e.left.isRed_()&&e.right.isRed_()&&(e=e.colorFlip_()),e}},{key:"moveRedLeft_",value:function(){var e=this.colorFlip_();return e.right.left.isRed_()&&(e=e.copy(null,null,null,null,e.right.rotateRight_()),e=e.rotateLeft_(),e=e.colorFlip_()),e}},{key:"moveRedRight_",value:function(){var e=this.colorFlip_();return e.left.left.isRed_()&&(e=e.rotateRight_(),e=e.colorFlip_()),e}},{key:"rotateLeft_",value:function(){var e;return e=this.copy(null,null,d,null,this.right.left),this.right.copy(null,null,this.color,e,null)}},{key:"rotateRight_",value:function(){var e;return e=this.copy(null,null,d,this.left.right,null),this.left.copy(null,null,this.color,null,e)}},{key:"colorFlip_",value:function(){var e,t;return e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null),this.copy(null,null,!this.color,e,t)}},{key:"checkMaxDepth_",value:function(){var e;return e=this.check_(),Math.pow(2,e)<=this.count()+1}},{key:"check_",value:function(){var e;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(e=this.left.check_(),e!==this.right.check_())throw new Error("Black depths differ");return e+(this.isRed_()?0:1)}}]),e}();v.RED=d,v.BLACK=h},function(e,t){"use strict";function n(e,t,n){return e=c(e.slice(t/32),32-(31&t)).slice(1),void 0===n?e:a(e,n-t)}function i(e,t,n){var i,r=Math.floor(-t-n&31);return i=(t+n-1^t)&-32?e[t/32|0]<<32-r^e[t/32+1|0]>>>r:e[t/32|0]>>>r,i&(1<<n)-1}function r(e,t){if(0===e.length||0===t.length)return e.concat(t);var n=e[e.length-1],i=s(n);return 32===i?e.concat(t):c(t,i,0|n,e.slice(0,e.length-1))}function o(e){var t,n=e.length;return 0===n?0:(t=e[n-1],32*(n-1)+s(t))}function a(e,t){if(32*e.length<t)return e;e=e.slice(0,Math.ceil(t/32));var n=e.length;return t&=31,n>0&&t&&(e[n-1]=u(t,e[n-1]&2147483648>>t-1,1)),e}function u(e,t,n){return 32===e?t:(n?0|t:t<<32-e)+1099511627776*e}function s(e){return Math.round(e/1099511627776)||32}function l(e,t){if(o(e)!==o(t))return!1;var n,i=0;for(n=0;n<e.length;n++)i|=e[n]^t[n];return 0===i}function c(e,t,n,i){var r,o,a=0;for(void 0===i&&(i=[]);t>=32;t-=32)i.push(n),n=0;if(0===t)return i.concat(e);for(r=0;r<e.length;r++)i.push(n|e[r]>>>t),n=e[r]<<32-t;return a=e.length?e[e.length-1]:0,o=s(a),i.push(u(t+o&31,t+o>32?n:i.pop(),1)),i}function d(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}function h(e){var t,n,i=65280;for(t=0;t<e.length;++t)n=e[t],e[t]=n>>>24|n>>>8&i|(n&i)<<8|n<<24;return e}Object.defineProperty(t,"__esModule",{value:!0}),t.bitSlice=n,t.extract=i,t.concat=r,t.bitLength=o,t.clamp=a,t.partial=u,t.getPartial=s,t.equal=l,t._shiftRight=c,t._xor4=d,t.byteswapM=h},function(e,t,n){e.exports={default:n(129),__esModule:!0}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(9),o=i(r),a=n(124),u=i(a);t.default=function e(t,n,i){null===t&&(t=Function.prototype);var r=(0,u.default)(t,n);if(void 0===r){var a=(0,o.default)(t);return null===a?void 0:e(a,n,i)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(i)}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){e.exports={}},function(e,t){e.exports=!0},function(e,t,n){var i=n(31),r=n(149),o=n(47),a=n(55)("IE_PROTO"),u=function(){},s="prototype",l=function(){var e,t=n(82)("iframe"),i=o.length,r="<",a=">";for(t.style.display="none",n(142).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write(r+"script"+a+"document.F=Object"+r+"/script"+a),e.close(),l=e.F;i--;)delete l[s][o[i]];return l()};e.exports=Object.create||function(e,t){var n;return null!==e?(u[s]=i(e),n=new u,u[s]=null,n[a]=e):n=l(),void 0===t?n:r(n,t)}},function(e,t,n){var i=n(38),r=n(39),o=n(15),a=n(58),u=n(22),s=n(83),l=Object.getOwnPropertyDescriptor;t.f=n(20)?l:function(e,t){if(e=o(e),t=a(t,!0),s)try{return l(e,t)}catch(e){}if(u(e,t))return r(!i.f.call(e,t),e[t])}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var i=n(21),r=n(7),o=n(26);e.exports=function(e,t){var n=(r.Object||{})[e]||Object[e],a={};a[e]=t(n),i(i.S+i.F*o(function(){n(1)}),"Object",a)}},function(e,t,n){var i=n(23).f,r=n(22),o=n(29)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,o)&&i(e,o,{configurable:!0,value:t})}},function(e,t,n){var i=n(56)("keys"),r=n(41);e.exports=function(e){return i[e]||(i[e]=r(e))}},function(e,t,n){var i=n(14),r="__core-js_shared__",o=i[r]||(i[r]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t,n){var i=n(32);e.exports=function(e,t){if(!i(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!i(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){var i=n(14),r=n(7),o=n(49),a=n(60),u=n(23).f;e.exports=function(e){var t=r.Symbol||(r.Symbol=o?{}:i.Symbol||{});"_"==e.charAt(0)||e in t||u(t,e,{value:a.f(e)})}},function(e,t,n){t.f=n(29)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(10),l=i(s),c=n(30),d=n(11),h=n(4),f=function(){function e(t,n){(0,o.default)(this,e),this.ref_=n,this.node_=t}return(0,u.default)(e,[{key:"val",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.val",0,0,arguments.length),this.node_.val()}},{key:"rawVal",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.rawVal",0,0,arguments.length),this.node_.val("raw")}},{key:"exportVal",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.exportVal",0,0,arguments.length),this.node_.val("export")}},{key:"child",value:function(t){(0,d.validateArgCount)("Webcom.DataSnapshot.child",0,1,arguments.length),(0,h.isNumber)(t)&&(t=String(t)),(0,c.validatePathString)("Webcom.DataSnapshot.child",1,t,!1);var n=new l.default(t),i=this.ref_.child(n);return new e(this.node_.getChild(n),i)}},{key:"hasChild",value:function(e){(0,d.validateArgCount)("Webcom.DataSnapshot.hasChild",1,1,arguments.length),(0,c.validatePathString)("Webcom.DataSnapshot.hasChild",1,e,!1);var t=new l.default(e);return!this.node_.getChild(t).isEmpty()}},{key:"getPriority",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.getPriority",0,0,arguments.length),
this.node_.getPriority()}},{key:"forEach",value:function(t){if((0,d.validateArgCount)("Webcom.DataSnapshot.forEach",1,1,arguments.length),(0,d.validateCallback)("Webcom.DataSnapshot.forEach",1,t,!1),this.node_.isLeafNode())return!1;var n=this;return this.node_.forEachChild(function(i,r){return t(new e(r,n.ref_.child(i)))})}},{key:"hasChildren",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()}},{key:"name",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.name",0,0,arguments.length),this.ref_.name()}},{key:"numChildren",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()}},{key:"ref",value:function(){return(0,d.validateArgCount)("Webcom.DataSnapshot.ref",0,0,arguments.length),this.ref_}}]),e}();t.default=f,e.exports=t.default},function(e,t,n){(function(i){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),u=o(a),s=n(1),l=o(s),c=n(2),d=o(c),h=n(103),f=o(h),p=n(105),v=o(p),_=n(10),y=o(_),g=n(77),m=o(g),b=n(3),k=r(b),C=(n(5),n(4)),w=n(16),E=n(8),S=r(E),P=1e3,N=3e5,O=3e4,A=1.3,T=3e4,D=0,R=0,I=function(){function e(t,n,r,o,a,u){(0,l.default)(this,e),this.id=D++,this.log_=k.logWrapper("p:"+this.id+":"),this.shouldReconnect_=!0,this.listens_={},this.outstandingPuts_=[],this.outstandingPutCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=P,this.maxReconnectDelay_=N,this.onDataUpdate_=n||S.nullFunction,this.onConnectStatus_=r||S.nullFunction,this.onAuthStatus_=o||S.nullFunction,this.onServerInfoUpdate_=a||S.nullFunction,this.getServerDataHashForPath_=u||S.nullFunction,this.repoInfo_=t,this.securityDebugCallback_=null,this.requestCBHash_={},this.requestNumber_=0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,this.scheduleConnect_(0),v.default.getInstance().on("visible",this.onVisible_,this),t.host.indexOf("fblocal")!==-1||"__karma__"in(i||window)||f.default.getInstance().on("online",this.onOnline_,this)}return(0,d.default)(e,[{key:"sendRequest_",value:function(e,t,n){var i=++this.requestNumber_,r={r:i,a:e,b:t};this.log_((0,u.default)(r)),k.assert(this.connected_,"sendRequest_ call when we're not connected not allowed."),this.realtime_.sendRequest(r),n&&(this.requestCBHash_[i]=n)}},{key:"listen",value:function(e,t){var n=e.toString(),i=e.path().toString();this.listens_[i]=this.listens_[i]||{},k.assert(!this.listens_[i][n],"listen() called twice for same path/queryId."),this.listens_[i][n]={queries:e.queries(),onComplete:t},this.connected_&&this.sendListen_(i,n,e.queries(),t)}},{key:"sendListen_",value:function(e,t,n,i){var r=this;this.log_("Listen on "+e+" for "+t);var o={p:e},a=(0,w.map)(n,function(e){return e.queryObject()});"{}"!==t&&(o.q=a),o.h=this.getServerDataHashForPath_(e),this.sendRequest_("l",o,function(n){r.log_("listen response",n);var o=n.s;"ok"!==o&&r.removeListen_(e,t),i&&i(o)})}},{key:"auth",value:function(e,t,n){this.credential_={cred:e,firstRequestSent:!1,callback:t,cancelCallback:n},this.log_("Authenticating using credential: "+this.credential_),this.tryAuth(),this.reduceReconnectDelayIfAdminCredential_(e)}},{key:"reduceReconnectDelayIfAdminCredential_",value:function(e){var t=40===e.length;(t||this.isAdminAuthToken_(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=O)}},{key:"isAdminAuthToken_",value:function(e){var t;try{var n=e.split(".");if(3!==n.length)return!1;var i=k.base64DecodeIfNativeSupport(n[1]);if(null!==i&&(t=JSON.parse(i),null!==t)){var r=t.p;return"admin"===r||"super"===r}}catch(e){k.log("isAdminAuthToken_ failed",e)}return!1}},{key:"unauth",value:function(e){delete this.credential_,this.onAuthStatus_(!1),this.connected_&&this.sendRequest_("unauth",{},function(t){var n=t.s,i=t.d;e(n,i)})}},{key:"tryAuth",value:function(){var e=this.credential_,t=this;if(e)if(this.connected_){var n={cred:e.cred};this.sendRequest_("auth",n,function(n){var i=n.s,r=n.d||"error";"ok"!==i&&t.credential_===e&&delete t.credential_,t.onAuthStatus_("ok"===i),e.firstRequestSent?"ok"!==i&&e.cancelCallback&&e.cancelCallback(i,r):(e.firstRequestSent=!0,e.callback&&e.callback(i,r))})}else this.repoInfo_.options.persist&&(this.onAuthStatus_(!0),e.callback&&e.callback("ok",null))}},{key:"unlisten",value:function(e,t,n){var i=e.toString(),r=this.removeListen_(i,t);r&&this.connected_&&this.sendUnlisten_(i,t,n)}},{key:"sendUnlisten_",value:function(e,t,n){this.log_("Unlisten on "+e+" for "+t);var i={p:e},r=(0,w.map)(n,function(e){return e.queryObject()});"{}"!==t&&(i.q=r),this.sendRequest_("u",i)}},{key:"onDisconnectPut",value:function(e,t,n){this.connected_?this.sendOnDisconnect_("o",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:n})}},{key:"onDisconnectMerge",value:function(e,t,n){this.connected_?this.sendOnDisconnect_("om",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:n})}},{key:"onDisconnectCancel",value:function(e,t){this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}},{key:"sendOnDisconnect_",value:function(e,t,n,r){var o=this,a={p:t,d:n};o.log_("onDisconnect "+e,a),this.sendRequest_(e,a,function(e){r&&i.setTimeout(function(){r(e.s,e.d)},Math.floor(0))})}},{key:"put",value:function(e,t,n,i){this.putInternal("p",e,t,n,i)}},{key:"merge",value:function(e,t,n,i){this.putInternal("m",e,t,n,i)}},{key:"putInternal",value:function(e,t,n,i,r){var o={p:t,d:n};(0,C.isDef)(r)&&(o.h=r),this.outstandingPuts_.push({action:e,request:o,onComplete:i}),this.outstandingPutCount_++;var a=this.outstandingPuts_.length-1;this.connected_&&this.sendPut_(a)}},{key:"sendPut_",value:function(e){var t=this,n=this.outstandingPuts_[e].action,i=this.outstandingPuts_[e].request,r=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest_(n,i,function(i){t.log_(n+" response",i),delete t.outstandingPuts_[e],t.outstandingPutCount_--,0===t.outstandingPutCount_&&(t.outstandingPuts_=[]),r&&r(i.s,i.d)})}},{key:"reportStats",value:function(e){if(this.connected_){var t={c:e};this.log_("reportStats",t),this.sendRequest_("s",t)}}},{key:"onDataMessage_",value:function(e){if("r"in e){this.log_("from server: "+(0,u.default)(e));var t=e.r,n=this.requestCBHash_[t];n&&(delete this.requestCBHash_[t],n(e.b))}else{if("error"in e)throw"A server-side error has occurred: "+e.error;"a"in e&&this.onDataPush_(e.a,e.b)}}},{key:"onDataPush_",value:function(e,t){this.log_("handleServerMessage",e,t),"d"===e?this.onDataUpdate_(t.p,t.d,!1):"m"===e?this.onDataUpdate_(t.p,t.d,!0):"c"===e?this.onListenRevoked_(t.p,t.q,t.d):"ac"===e?this.onAuthRevoked_(t.s,t.d):"sd"===e?this.onSecurityDebugPacket_(t):k.error("Unrecognized action received from server: "+(0,u.default)(e)+"\nAre you using the latest client?")}},{key:"onReady_",value:function(e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=Date.now(),this.handleTimestamp_(e),this.restoreState_(),this.onConnectStatus_(!0)}},{key:"scheduleConnect_",value:function(e){k.assert(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_||0===this.establishConnectionTimer_?(this.log_("Schedule connection establishment, clearing previous scheduling before"),i.clearTimeout(this.establishConnectionTimer_)):this.log_("Schedule connection establishment");var t=this;this.establishConnectionTimer_=i.setTimeout(function(){t.establishConnectionTimer_=null,t.establishConnection_()},Math.floor(e))}},{key:"onVisible_",value:function(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=P,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}},{key:"onOnline_",value:function(e){e?(this.log_("Browser went online. Reconnecting."),this.reconnectDelay_=P,this.shouldReconnect_=!0,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection; don't reconnect."),this.shouldReconnect_=!1,this.realtime_&&this.realtime_.close())}},{key:"onRealtimeDisconnect_",value:function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.shouldReconnect_){if(this.visible_){if(this.lastConnectionEstablishedTime_){var e=Date.now()-this.lastConnectionEstablishedTime_;e>T&&(this.reconnectDelay_=P),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=Date.now();var t=Date.now()-this.lastConnectionAttemptTime_,n=Math.max(0,this.reconnectDelay_-t);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,this.reconnectDelay_*A)}else for(var i in this.requestCBHash_)delete this.requestCBHash_[i];this.onConnectStatus_(!1)}},{key:"establishConnection_",value:function(){if(this.shouldReconnect_){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=Date.now(),this.lastConnectionEstablishedTime_=null;var e=S.bind(this.onDataMessage_,this),t=S.bind(this.onReady_,this),n=S.bind(this.onRealtimeDisconnect_,this),i=this.id+":"+R++,r=this;this.realtime_=new m.default(i,this.repoInfo_,e,t,n,function(e){k.warn(e+" ("+r.repoInfo_.toString()+")"),r.shouldReconnect_=!1}),this.log_("New connection set")}}},{key:"interrupt",value:function(){this.shouldReconnect_=!1,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(i.clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}},{key:"resume",value:function(){this.shouldReconnect_=!0,this.reconnectDelay_=P,this.connected_||this.scheduleConnect_(0)}},{key:"handleTimestamp_",value:function(e){var t=e-Date.now();this.onServerInfoUpdate_({serverTimeOffset:t})}},{key:"cancelSentTransactions_",value:function(){for(var e,t=0;t<this.outstandingPuts_.length;t++)e=this.outstandingPuts_[t],e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--);0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}},{key:"onListenRevoked_",value:function(e,t,n){var i;i=t?(0,w.map)(t,function(e){return k.ObjectToUniqueKey(e)}).join("$"):"{}";var r;r=n?n:"permission_denied";var o=this.removeListen_(e,i);o&&o.onComplete&&o.onComplete(r)}},{key:"removeListen_",value:function(e,t){var n=new y.default(e).toString();t||(t="{}");var i=this.listens_[n][t];return delete this.listens_[n][t],i}},{key:"onAuthRevoked_",value:function(e,t){var n=this.credential_;delete this.credential_,n&&n.cancelCallback&&n.cancelCallback(e,t),this.onAuthStatus_(!1)}},{key:"onSecurityDebugPacket_",value:function(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&"undefined"!=typeof console}},{key:"restoreState_",value:function(){this.tryAuth();for(var e in this.listens_)for(var t in this.listens_[e]){var n=this.listens_[e][t];this.sendListen_(e,t,n.queries,n.onComplete)}for(var i=0;i<this.outstandingPuts_.length;i++)this.outstandingPuts_[i]&&this.sendPut_(i);for(;this.onDisconnectRequestQueue_.length;){var r=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(r.action,r.pathString,r.data,r.onComplete)}}}]),e}();t.default=I,e.exports=t.default}).call(t,function(){return this}())},function(e,t,n){(function(i){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),u=o(a),s=n(1),l=o(s),c=n(2),d=o(c),h=n(69),f=r(h),p=n(98),v=o(p),_=n(68),y=o(_),g=n(62),m=o(g),b=n(96),k=o(b),C=n(95),w=o(C),E=n(65),S=o(E),P=n(66),N=o(P),O=n(10),A=o(O),T=n(104),D=r(T),R=n(24),I=n(3),M=n(4),x=n(8),W=n(5),j=r(W),L=n(16),F=r(L),V=n(12),U=n(61),Q=o(U),q=n(35),H=o(q),B=n(30),K={RUN:1,SENT:2,COMPLETED:3,SENT_NEEDS_ABORT:4,NEEDS_ABORT:5},G=25,J=function(){function e(t){(0,l.default)(this,e),this.repoInfo_=t,this.stats_=f.getCollection(t),this.connection_=new m.default(this.repoInfo_,(0,x.bind)(this.onDataUpdate_,this),(0,x.bind)(this.onConnectStatus_,this),(0,x.bind)(this.onAuthStatus_,this),(0,x.bind)(this.onServerInfoUpdate_,this),(0,x.bind)(this.getServerDataHashForPath_,this)),this.authCallbacks_=[],this.statsReporter_=f.getOrCreateReporter(t,(0,x.bind)(function(){return new v.default(this.stats_,this.connection_)},this)),this.transactions_init_&&this.transactions_init_(),this.persistor_=t.options.persist?{key:"cache:"+t.host,storage:V.PersistentStorage}:void 0,this.data_=new k.default(this.persistor_?(0,R.NodeFromJSON)(this.persistor_.storage.get(this.persistor_.key)):void 0),this.viewManager_=new w.default(this.connection_,this.data_.visibleData),this.infoData_=new S.default,this.infoViewManager_=new w.default(null,this.infoData_),this.updateInfo_("connected",!1),this.updateInfo_("authenticated",!1),this.onDisconnect_=new N.default,this.dataUpdateCount=0,this.log_("New Repo: "+t)}return(0,d.default)(e,[{key:"persist",value:function(){this.persistor_&&this.persistor_.storage.set(this.persistor_.key,this.data_.visibleData.rootNode_.val("raw"))}},{key:"toString",value:function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}},{key:"protocol",value:function(){return this.repoInfo_.secure?"https://":"http://"}},{key:"name",value:function(){return this.repoInfo_.namespace}},{key:"host",value:function(){return this.repoInfo_.host}},{key:"internalHostUrl",value:function(){return this.repoInfo_.needsQueryParam()?this.protocol()+this.repoInfo_.internalHost:null}},{key:"serverTime",value:function(){var e=this.infoData_.getNode(new A.default(".info/serverTimeOffset")),t=e.val()||0;return Date.now()+t}},{key:"generateServerValues",value:function(){return D.generateWithValues({timestamp:this.serverTime()})}},{key:"onDataUpdate_",value:function(e,t,n){this.dataUpdateCount++,this.interceptServerDataCallback_&&(t=this.interceptServerDataCallback_(e,t));var i,r,o=[];e.length>=9&&e.lastIndexOf(".priority")===e.length-9?(i=new A.default(e.substring(0,e.length-9)),r=this.data_.serverData.getNode(i).updatePriority(t),o.push(i)):n?(i=new A.default(e),r=this.data_.serverData.getNode(i),j.forEach(t,function(e,t){var n=new A.default(t);".priority"===t?r=r.updatePriority(e):(r=r.updateChild(n,(0,R.NodeFromJSON)(e)),o.push(i.child(t)))})):(i=new A.default(e),r=(0,R.NodeFromJSON)(t),o.push(i));for(var a,u=this.viewManager_.pruneUpdateNode(i,r,this.data_.mergedData,n?t:null),s=!1,l=0;l<u.length;++l)a=u[l],s=this.data_.updateServerData(a.path,a.node)||s;s&&(i=this.rerunTransactionsAndUpdateVisibleData_(i)),this.viewManager_.raiseEventsForChange(i,o)}},{key:"interceptServerData_",value:function(e){this.interceptServerDataCallback_=e}},{key:"onConnectStatus_",value:function(e){this.updateInfo_("connected",e),e===!1&&this.runOnDisconnectEvents_()}},{key:"onServerInfoUpdate_",value:function(e){var t=this;(0,I.each)(e,function(e,n){t.updateInfo_(n,e)})}},{key:"getServerDataHashForPath_",value:function(e){var t=new A.default(e);return this.data_.serverData.getNode(t).hash()}},{key:"onAuthStatus_",value:function(e){this.updateInfo_("authenticated",e)}},{key:"updateInfo_",value:function(e,t){var n=new A.default("/.info/"+e);this.infoData_.updateSnapshot(n,(0,R.NodeFromJSON)(t)),this.infoViewManager_.raiseEventsForChange(n,[n])}},{key:"auth",value:function(e,t,n){var i=this;this.connection_.auth(e,function(e,n){i.callOnCompleteCallback(t,e,n)},function(e,t){if((0,I.warn)("auth() was canceled: "+t),n){var i=new Error(t);i.code=e.toUpperCase(),n(i)}})}},{key:"unauth",value:function(e){var t=this;this.connection_.unauth(function(n,i){t.callOnCompleteCallback(e,n,i)})}},{key:"setWithPriority",value:function(e,t,n,i){this.log_("set",{path:e.toString(),value:t,priority:n});var r=this.generateServerValues(),o=(0,R.NodeFromJSON)(t,n),a=D.resolveDeferredValueSnapshot(o,r),u=this.viewManager_.pruneUpdateNode(e,a,this.data_.mergedData,null),s=this.data_.set(e,u),l=this;this.connection_.put(e.toString(),o.val("export"),function(t,n){var r="ok"===t;r||(0,I.warn)("set at "+e+" failed: "+t),l.data_.setCompleted(s),l.data_.mergeServerAndPendingData(e);var o=l.rerunTransactionsAndUpdateVisibleData_(e);l.viewManager_.raiseEventsForChange(o,[]),l.callOnCompleteCallback(i,t,n)});var c=this.abortTransactions_(e);this.rerunTransactionsAndUpdateVisibleData_(c),this.viewManager_.raiseEventsForChange(c,[e])}},{key:"update",value:function(e,t,n){this.log_("update",{path:e.toString(),value:t});var i=this.data_.visibleData.getNode(e),r=!0,o=[],a=this.generateServerValues(),u=[];for(var s in t){r=!1;var l=(0,R.NodeFromJSON)(t[s]),c=D.resolveDeferredValueSnapshot(l,a);i=i.updateImmediateChild(s,c);var d=e.child(s);o.push(d);var h=this.viewManager_.pruneUpdateNode(d,c,this.data_.mergedData,null);u=u.concat(this.data_.set(e,h))}if(r)return(0,I.log)("update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");var f=this;this.connection_.merge(e.toString(),t,function(t,i){var r="ok"===t;r||(0,I.warn)("update at "+e+" failed: "+t),f.data_.setCompleted(u),f.data_.mergeServerAndPendingData(e);var o=f.rerunTransactionsAndUpdateVisibleData_(e);f.viewManager_.raiseEventsForChange(o,[]),f.callOnCompleteCallback(n,t,i)});var p=this.abortTransactions_(e);this.rerunTransactionsAndUpdateVisibleData_(p),f.viewManager_.raiseEventsForChange(p,o)}},{key:"setPriority",value:function(e,t,n){this.log_("setPriority",{path:e.toString(),priority:t});var i=this.generateServerValues(),r=D.resolveDeferredValue(t,i),o=this.data_.mergedData.getNode(e).updatePriority(r),a=this.viewManager_.pruneUpdateNode(e,o,this.data_.mergedData,null),u=this.data_.set(e,a),s=this;this.connection_.put(e.toString()+"/.priority",t,function(t,i){"permission_denied"===t&&(0,I.warn)("setPriority at "+e+" failed: "+t),s.data_.setCompleted(u),s.data_.mergeServerAndPendingData(e);var r=s.rerunTransactionsAndUpdateVisibleData_(e);s.viewManager_.raiseEventsForChange(r,[]),s.callOnCompleteCallback(n,t,i)});var l=this.rerunTransactionsAndUpdateVisibleData_(e);s.viewManager_.raiseEventsForChange(l,[])}},{key:"runOnDisconnectEvents_",value:function(){this.log_("onDisconnectEvents");var e=this,t=[],n=this.generateServerValues(),i=D.resolveDeferredValueTree(this.onDisconnect_,n);i.forEachTree(new A.default(""),function(n,i){var r=e.viewManager_.pruneUpdateNode(n,i,e.data_.mergedData,null);t.push.apply(t,e.data_.set(n,r));var o=e.abortTransactions_(n);e.rerunTransactionsAndUpdateVisibleData_(o),e.viewManager_.raiseEventsForChange(o,[n])}),this.data_.setCompleted(t),this.onDisconnect_=new N.default}},{key:"onDisconnectCancel",value:function(e,t){var n=this;this.connection_.onDisconnectCancel(e.toString(),function(i,r){"ok"===i&&n.onDisconnect_.forget(e),n.callOnCompleteCallback(t,i,r)})}},{key:"onDisconnectSet",value:function(e,t,n){var i=this,r=(0,R.NodeFromJSON)(t);this.connection_.onDisconnectPut(e.toString(),r.val("export"),function(t,o){"ok"===t&&i.onDisconnect_.remember(e,r),i.callOnCompleteCallback(n,t,o)})}},{key:"onDisconnectSetWithPriority",value:function(e,t,n,i){var r=this,o=(0,R.NodeFromJSON)(t,n);this.connection_.onDisconnectPut(e.toString(),o.val("export"),function(t,n){"ok"===t&&r.onDisconnect_.remember(e,o),r.callOnCompleteCallback(i,t,n)})}},{key:"onDisconnectUpdate",value:function(e,t,n){var i=!0;for(var r in t)i=!1;if(i)return(0,I.log)("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");var o=this;this.connection_.onDisconnectMerge(e.toString(),t,function(i,r){if("ok"===i)for(var a in t){var u=(0,R.NodeFromJSON)(t[a]);o.onDisconnect_.remember(e.child(a),u)}o.callOnCompleteCallback(n,i,r)})}},{key:"addEventCallbackForQuery",value:function(e,t,n,i,r){".info"===e.path.getFront()?this.infoViewManager_.addEventCallbackForQuery(e,t,n,i,r):this.viewManager_.addEventCallbackForQuery(e,t,n,i,r)}},{key:"removeEventCallbackForQuery",value:function(e,t,n,i){if(".info"===e.path.getFront())this.infoViewManager_.removeEventCallbackForQuery(e,t,n,i);else{var r=this.viewManager_.removeEventCallbackForQuery(e,t,n,i);if(null!==r){var o=this.data_.forgetPath(e.path,r);o&&((0,I.assert)(this.data_.visibleData.rootNode_===this.viewManager_.oldDataNode_,"We should have raised any outstanding events by now. Else, we'll blow them away."),this.data_.visibleData.updateSnapshot(e.path,this.data_.mergedData.getNode(e.path)),this.viewManager_.oldDataNode_=this.data_.visibleData.rootNode_)}}}},{key:"interrupt",value:function(){this.connection_.interrupt()}},{key:"resume",value:function(){this.connection_.resume()}},{key:"shouldBeOnline",value:function(){return this.connection_.shouldReconnect_}},{key:"stats",value:function e(t){if("undefined"!=typeof console){var e;t?(this.statsListener_||(this.statsListener_=new y.default(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=F.reduce(j.getKeys(e),function(e,t,n,i){return Math.max(t.length,e)},0);for(var i in e)for(var r=(e[i],i.length);r<n+2;r++)i+=" "}}},{key:"statsIncrementCounter",value:function(e){this.stats_.incrementCounter(e),this.statsReporter_.includeStat(e)}},{key:"log_",value:function(){(0,I.log)("r:"+this.connection_.id+":",arguments)}},{key:"callOnCompleteCallback",value:function(e,t,n){e&&(0,x.exceptionGuard)(function(){if("ok"===t)e(null,n);else{var i=t||"ERROR",r=i,o=(0,I.getFriendlyErrorReason)(t)||n,a=void 0;o&&(r+=": "+o),a=new Error(r),a.code=i,e(a)}})}},{key:"transactions_init_",value:function(){this.transactionQueueTree_=new H.default,this.transactionResultData_=new S.default}},{key:"startTransaction",value:function(e,t,n,i){this.log_("transaction on "+e);var r=this,o=!1,a=function(){if(!o){o=!0,r.pruneResultData_();var t=c.update(r.transactionResultData_.getNode(e).val("raw"));if((0,M.isDef)(t)){(0,B.validateWebcomData)("transaction failed: Data returned ",t),c.status=K.RUN;var n=r.transactionQueueTree_.subTree(e),i=n.getValue()||[];i.push(c),n.setValue(i);var a;if("object"===("undefined"==typeof t?"undefined":(0,u.default)(t))&&null!==t&&(0,W.contains)(t,".priority"))a=t[".priority"];else{var s=r.data_.mergedData.getNode(e);a=s.getPriority()}var l=r.generateServerValues(),d=(0,R.NodeFromJSON)(t,a),h=D.resolveDeferredValueSnapshot(d,l);r.transactionResultData_.updateSnapshot(e,h),c.applyLocally&&(r.data_.visibleData.updateSnapshot(e,h),r.viewManager_.raiseEventsForChange(e,[e])),r.sendReadyTransactions_()}else if(c.unwatcher(),c.onComplete){var f=r.getSnapshot_(e);c.onComplete(null,!1,f)}}},s=new Webcom(this,e),l=function(){s.off("value",a)},c={path:e,update:t,onComplete:n,status:null,order:(0,I.LUIDGenerator)(),applyLocally:i,retryCount:0,unwatcher:l,abortReason:null};s.on("value",a)}},{key:"sendReadyTransactions_",value:function(e){var t=e||this.transactionQueueTree_;if(e||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);(0,I.assert)(n.length>0);var i=F.every(n,function(e){return e.status===K.RUN});i&&this.sendTransactionQueue_(t.path(),n)}else if(t.hasChildren()){var r=this;t.forEachChild(function(e){r.sendReadyTransactions_(e)})}}},{key:"sendTransactionQueue_",value:function(e,t){for(var n=0;n<t.length;n++)(0,I.assert)(t[n].status===K.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),t[n].status=K.SENT,t[n].retryCount++;var i=this.data_.mergedData.getNode(e).hash();this.data_.mergedData.updateSnapshot(e,this.data_.visibleData.getNode(e));var r=this.transactionResultData_.getNode(e).val("export"),o=(0,I.LUIDGenerator)(),a=this.pathsWithLocallyAppliedChanges(t);for(n=0;n<a.length;n++)this.data_.pendingPuts.subTree(a[n]).setValue(o);var u=this;this.connection_.put(e.toString(),r,function(i){for(u.log_("transaction put response",{path:e.toString(),status:i}),n=0;n<a.length;n++){var r=u.data_.pendingPuts.subTree(a[n]),s=r.getValue();(0,I.assert)(null!==s,"sendTransactionQueue_: pendingPut should not be null."),s===o&&(r.setValue(null),u.data_.mergedData.updateSnapshot(a[n],u.data_.serverData.getNode(a[n])))}if("ok"===i){var l=[];for(n=0;n<t.length;n++){if(t[n].status=K.COMPLETED,t[n].onComplete){var c=u.getSnapshot_(t[n].path);l.push((0,x.bind)(t[n].onComplete,null,null,!0,c))}t[n].unwatcher()}for(u.pruneCompletedTransactionsBelowNode_(u.transactionQueueTree_.subTree(e)),u.sendReadyTransactions_(),n=0;n<l.length;n++)(0,x.exceptionGuard)(l[n])}else{if("hash_differs"===i)for(n=0;n<t.length;n++)t[n].status===K.SENT_NEEDS_ABORT?t[n].status=K.NEEDS_ABORT:t[n].status=K.RUN;else for((0,I.warn)("transaction at "+e+" failed: "+i),n=0;n<t.length;n++)t[n].status=K.NEEDS_ABORT,t[n].abortReason=i;var d=u.rerunTransactionsAndUpdateVisibleData_(e);u.viewManager_.raiseEventsForChange(d,[e])}},i)}},{key:"pathsWithLocallyAppliedChanges",value:function(e){for(var t={},n=0;n<e.length;n++)e[n].applyLocally&&(t[e[n].path.toString()]=e[n].path);var i=[];for(var r in t)i.push(t[r]);return i}},{key:"rerunTransactionsAndUpdateVisibleData_",value:function(e){var t=this.getAncestorTransactionNode_(e),n=t.path(),i=this.buildTransactionQueue_(t);return this.rerunTransactionQueue_(i,n),n}},{key:"rerunTransactionQueue_",value:function(e,t){if(this.data_.visibleData.updateSnapshot(t,this.data_.mergedData.getNode(t)),this.transactionResultData_.updateSnapshot(t,this.data_.mergedData.getNode(t)),0!==e.length){for(var n=this.data_.visibleData.getNode(t),r=n,o=[],a=0;a<e.length;a++){var s,l=A.default.RelativePath(t,e[a].path),c=!1;if((0,I.assert)(null!==l,"rerunTransactionsUnderNode_: relativePath should not be null."),e[a].status===K.NEEDS_ABORT)c=!0,s=e[a].abortReason;else if(e[a].status===K.RUN)if(e[a].retryCount>=G)c=!0,s="maxretry";else{var d=n.getChild(l),h=e[a].update(d.val("raw"));if((0,M.isDef)(h)){(0,B.validateWebcomData)("transaction failed: Data returned ",h);var f=(0,R.NodeFromJSON)(h),p="object"===("undefined"==typeof h?"undefined":(0,u.default)(h))&&null!=h&&(0,W.contains)(h,".priority");p||(f=f.updatePriority(d.getPriority())),n=n.updateChild(l,f),e[a].applyLocally&&(r=r.updateChild(l,f))}else c=!0,s="nodata"}if(c&&(e[a].status=K.COMPLETED,function(e){i.setTimeout(e,Math.floor(0))}(e[a].unwatcher),e[a].onComplete)){var v=new Webcom(this,e[a].path),_=new Q.default(n.getChild(l),v);"nodata"===s?o.push((0,x.bind)(e[a].onComplete,null,null,!1,_)):o.push((0,x.bind)(e[a].onComplete,null,new Error(s),!1,_))}}for(this.transactionResultData_.updateSnapshot(t,n),this.data_.visibleData.updateSnapshot(t,r),this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_),a=0;a<o.length;a++)(0,x.exceptionGuard)(o[a]);this.sendReadyTransactions_()}}},{key:"getAncestorTransactionNode_",value:function(e){for(var t,n=this.transactionQueueTree_;null!==(t=e.getFront())&&null===n.getValue();)n=n.subTree(t),e=e.popFront();return n}},{key:"buildTransactionQueue_",value:function(e){var t=[];return this.aggregateTransactionQueuesForNode_(e,t),t.sort(function(e,t){return e.order-t.order}),t}},{key:"aggregateTransactionQueuesForNode_",value:function(e,t){var n=e.getValue();if(null!==n)for(var i=0;i<n.length;i++)t.push(n[i]);var r=this;e.forEachChild(function(e){r.aggregateTransactionQueuesForNode_(e,t)})}},{key:"pruneCompletedTransactionsBelowNode_",value:function(e){var t=e.getValue();if(t){for(var n=0,i=0;i<t.length;i++)t[i].status!==K.COMPLETED&&(t[n]=t[i],n++);t.length=n,e.setValue(t.length>0?t:null)}var r=this;e.forEachChild(function(e){r.pruneCompletedTransactionsBelowNode_(e)})}},{key:"abortTransactions_",value:function(e){var t=this.getAncestorTransactionNode_(e).path(),n=this.transactionQueueTree_.subTree(e),i=this;return n.forEachAncestor(function(e){i.abortTransactionsOnNode_(e)}),this.abortTransactionsOnNode_(n),n.forEachDescendant(function(e){i.abortTransactionsOnNode_(e)}),t}},{key:"abortTransactionsOnNode_",value:function(e){var t=e.getValue();if(null!==t){for(var n=[],i=-1,r=0;r<t.length;r++)if(t[r].status===K.SENT_NEEDS_ABORT);else if(t[r].status===K.SENT)(0,I.assert)(i===r-1,"All SENT items should be at beginning of queue."),i=r,t[r].status=K.SENT_NEEDS_ABORT,t[r].abortReason="set";else if((0,I.assert)(t[r].status===K.RUN),t[r].unwatcher(),t[r].onComplete){var o=null;n.push((0,x.bind)(t[r].onComplete,null,new Error("set"),!1,o))}for(i===-1?e.setValue(null):t.length=i+1,r=0;r<n.length;r++)(0,x.exceptionGuard)(n[r])}}},{key:"getSnapshot_",value:function(e){var t=new Webcom(this,e);return new Q.default(this.transactionResultData_.getNode(e),t)}},{key:"pruneResultData_",value:function(){this.transactionResultData_.rootNode_=this.pruneResultDataHelper_(this.transactionResultData_.rootNode_,this.data_.mergedData.rootNode_,this.transactionQueueTree_)}},{key:"pruneResultDataHelper_",value:function(e,t,n){var i=this;if(n.isEmpty())return t;if(null!=n.getValue())return e;var r=t;return n.forEachChild(function(n){var o=n.name(),a=new A.default(o),u=i.pruneResultDataHelper_(e.getChild(a),t.getChild(a),n);r=r.updateImmediateChild(o,u)}),r}}]),e}();t.default=J,e.exports=t.default}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(12),l=function(){function e(t,n,i,r){(0,o.default)(this,e),this.host=t.toLowerCase(),t.indexOf("/")>0?this.domain=this.host.replace(/\/.*$/,""):this.domain=this.host.substr(this.host.indexOf(".")+1),this.secure=n,this.namespace=i,this.webSocketOnly=r,this.internalHost=s.PersistentStorage.get("host:"+t)||this.host,this.options={}}return(0,u.default)(e,[{key:"needsQueryParam",value:function(){return this.host!==this.internalHost}},{key:"isCacheableHost",value:function(){return"s-"===this.internalHost.substr(0,2)}},{key:"updateHost",value:function(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&s.PersistentStorage.set("host:"+this.host,this.internalHost))}},{key:"toString",value:function(){return(this.secure?"https://":"http://")+this.host}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=n(45),d=i(c),h=n(24),f=function(){function e(t){(0,u.default)(this,e),this.rootNode_=t||h.EMPTY_NODE}return(0,l.default)(e,[{key:"getNode",value:function(e){return this.rootNode_.getChild(e)}},{key:"updateSnapshot",value:function(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}},{key:"toString",value:function(){return(0,d.default)(e.prototype.__proto__||(0,o.default)(e.prototype),"toString",this).call(this)}}]),e}();t.default=f,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(10),l=i(s),c=n(70),d=i(c),h=function(){function e(){(0,o.default)(this,e),this.value_=null,this.children_=null}return(0,u.default)(e,[{key:"find",value:function(e){if(null!=this.value_)return this.value_.getChild(e);if(e.isEmpty()||null==this.children_)return null;var t=e.getFront();if(e=e.popFront(),this.children_.contains(t)){var n=this.children_.get(t);return n.find(e)}return null}},{key:"remember",value:function(t,n){if(t.isEmpty())this.value_=n,this.children_=null;else if(null!==this.value_)this.value_=this.value_.updateChild(t,n);else{null==this.children_&&(this.children_=new d.default);var i=t.getFront();
this.children_.contains(i)||this.children_.add(i,new e);var r=this.children_.get(i);t=t.popFront(),r.remember(t,n)}}},{key:"forget",value:function(e){if(e.isEmpty())return this.value_=null,this.children_=null,!0;if(null!==this.value_){if(this.value_.isLeafNode())return!1;var t=this.value_;this.value_=null;var n=this;return t.forEachChild(function(e,t){n.remember(new l.default(e),t)}),this.forget(e)}if(null!==this.children_){var i=e.getFront();if(e=e.popFront(),this.children_.contains(i)){var r=this.children_.get(i).forget(e);r&&this.children_.remove(i)}return!!this.children_.isEmpty()&&(this.children_=null,!0)}return!0}},{key:"forEachTree",value:function(e,t){null!==this.value_?t(e,this.value_):this.forEachChild(function(n,i){var r=new l.default(e.toString()+"/"+n);i.forEachTree(r,t)})}},{key:"forEachChild",value:function(e){null!==this.children_&&this.children_.each(function(t,n){e(t,n)})}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.SortedChildrenNode=void 0;var r=n(9),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=n(19),d=i(c),h=n(18),f=i(h),p=n(42),v=i(p),_=n(33),y=i(_),g=n(3),m=function(e,t){return(0,g.priorityCompare)(e.priority,t.priority)||(0,g.nameCompare)(e.name,t.name)},b=t.SortedChildrenNode=function(e){function t(e,n,i){(0,u.default)(this,t);var r=(0,d.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e,i));return null===n&&(n=new v.default(m),e.inorderTraversal(function(e,t){n=n.insert({name:e,priority:t.getPriority()},t)})),r.sortedChildren_=n,r}return(0,f.default)(t,e),(0,l.default)(t,[{key:"updateImmediateChild",value:function(e,n){var i=this.getImmediateChild(e),r=this.children_,o=this.sortedChildren_;return null!==i&&(r=r.remove(e),o=o.remove({name:e,priority:i.getPriority()})),n&&n.isEmpty()&&(n=null),null!==n&&(r=r.insert(e,n),o=o.insert({name:e,priority:n.getPriority()},n)),new t(r,o,this.getPriority())}},{key:"getPredecessorChildName",value:function(e,t){var n=this.sortedChildren_.getPredecessorKey({name:e,priority:t.getPriority()});return n?n.name:null}},{key:"forEachChild",value:function(e){return this.sortedChildren_.inorderTraversal(function(t,n){return e(t.name,n)})}},{key:"forEachChildReverse",value:function(e){return this.sortedChildren_.reverseTraversal(function(t,n){return e(t.name,n)})}},{key:"getIterator",value:function(){return this.sortedChildren_.getIterator(function(e,t){return{key:e.name,value:t}})}},{key:"getFirstChildName",value:function(){return this.sortedChildren_.isEmpty()?null:this.sortedChildren_.minKey().name}},{key:"getLastChildName",value:function(){return this.sortedChildren_.isEmpty()?null:this.sortedChildren_.maxKey().name}}]),t}(y.default);t.default=b},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(5),l=function(){function e(t){(0,o.default)(this,e),this.collection_=t,this.last_=null}return(0,u.default)(e,[{key:"get",value:function(){var e=this.collection_.get(),t=(0,s.clone)(e);if(this.last_)for(var n in this.last_)this.last_.hasOwnProperty(n)&&(t[n]=t[n]-this.last_[n]);return this.last_=e,t}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=e.toString();return s[t]||(s[t]=new u.default),s[t]}function o(e,t){var n=e.toString();return l[n]||(l[n]=t()),l[n]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCollection=r,t.getOrCreateReporter=o;var a=n(97),u=i(a),s={},l={};t.default={getCollection:r,getOrCreateReporter:o}},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o),u=n(2),s=r(u),l=n(5),c=i(l),d=function(){function e(){(0,a.default)(this,e),this.set={}}return(0,s.default)(e,[{key:"add",value:function(e,t){this.set[e]=null===t||t}},{key:"contains",value:function(e){return c.contains(this.set,e)}},{key:"get",value:function(e){return this.contains(e)?this.set[e]:void 0}},{key:"remove",value:function(e){delete this.set[e]}},{key:"clear",value:function(){this.set={}}},{key:"isEmpty",value:function(){return c.isEmpty(this.set)}},{key:"count",value:function(){return c.getCount(this.set)}},{key:"each",value:function(e){c.forEach(this.set,function(t,n){e(n,t)})}},{key:"keys",value:function e(){var e=[];return c.forEach(this.set,function(t,n){e.push(n)}),e}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(3),l=n(4),c=n(8),d=n(16),h=function(){function e(t){(0,o.default)(this,e),(0,s.assert)((0,l.isArray)(t)&&t.length>0,"Requires a non-empty array"),this.allowedEvents_=t,this.listeners_={}}return(0,u.default)(e,[{key:"trigger",value:function(e){for(var t=this.listeners_[e]||[],n=0;n<t.length;n++)t[n].callback.apply(t[n].context,Array.prototype.slice.call(arguments,1))}},{key:"on",value:function(e,t,n){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:n});var i=this.getInitialEvent(e);i&&t.apply(n,i)}},{key:"off",value:function(e,t,n){this.validateEventType_(e);for(var i=this.listeners_[e]||[],r=0;r<i.length;r++)if(i[r].callback===t&&(!n||n===i[r].context))return void i.splice(r,1)}},{key:"validateEventType_",value:function(e){(0,s.assert)((0,d.find)(this.allowedEvents_,function(t){return t===e}),"Unknown event: "+e)}},{key:"getInitialEvent",value:function(){(0,c.abstractMethod)()}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(36),l=i(s),c=n(5),d=n(24),h=n(4),f=function(){function e(t,n){(0,o.default)(this,e),this.diffMaskTree_=t,this.onDiffCallback_=n}return(0,u.default)(e,[{key:"propagateDiffUpward_",value:function(e,t,n,i,r){for(;null!==e.parent();){var o=t.getChild(e),a=n.getChild(e),u=e.parent();if(!this.diffMaskTree_||this.diffMaskTree_.subTree(u).getValue()){var s,c=n.getChild(u),d=[],h=e.getBack();o.isEmpty()?(s=c.getPredecessorChildName(h,a),d.push(new l.default("child_added",a,h,s))):a.isEmpty()?d.push(new l.default("child_removed",o,h)):(s=c.getPredecessorChildName(h,a),r&&d.push(new l.default("child_moved",a,h,s)),i&&d.push(new l.default("child_changed",a,h,s))),this.onDiffCallback_(u,c,d)}r&&(r=!1,i=!0),e=u}}},{key:"diffRecursive_",value:function(e,t,n){var i,r=[];return t===n?i=!1:t.isLeafNode()&&n.isLeafNode()?i=t.getValue()!==n.getValue():t.isLeafNode()?(this.diffChildrenRecursive_(e,d.EMPTY_NODE,n,r),i=!0):n.isLeafNode()?(this.diffChildrenRecursive_(e,t,d.EMPTY_NODE,r),i=!0):i=this.diffChildrenRecursive_(e,t,n,r),i?this.onDiffCallback_(e,n,r):t.getPriority()!==n.getPriority()&&this.onDiffCallback_(e,n,null),i}},{key:"diffChildrenRecursive_",value:function(e,t,n,i){var r,o,a,u,s,f,p,v=!1,_=!this.diffMaskTree_||!this.diffMaskTree_.subTree(e).isEmpty(),y=[],g=[],m=[],b=[],k={},C={};for(r=t.getIterator(),a=r.getNext(),o=n.getIterator(),u=o.getNext();null!==a||null!==u;){var w=this.compareChildren_(a,u);if(w<0){var E=(0,c.get)(k,a.key);(0,h.isDef)(E)?(m.push({from:a,to:y[E]}),y[E]=null):(C[a.key]=g.length,g.push(a)),v=!0,a=r.getNext()}else if(w>0){var S=(0,c.get)(C,u.key);(0,h.isDef)(S)?(m.push({from:g[S],to:u}),g[S]=null):(k[u.key]=y.length,y.push(u)),v=!0,u=o.getNext()}else s=e.child(u.key),p=this.diffRecursive_(s,a.value,u.value),p&&(b.push(u),v=!0),a.value.getPriority()!==u.value.getPriority()&&(m.push({from:a,to:u}),v=!0),a=r.getNext(),u=o.getNext();if(!_&&v)return!0}for(var P,N=0;N<g.length;N++)P=g[N],P&&(s=e.child(P.key),this.diffRecursive_(s,P.value,d.EMPTY_NODE),i.push(new l.default("child_removed",P.value,P.key)));for(N=0;N<y.length;N++){var O=y[N];O&&(s=e.child(O.key),f=n.getPredecessorChildName(O.key,O.value),this.diffRecursive_(s,d.EMPTY_NODE,O.value),i.push(new l.default("child_added",O.value,O.key,f)))}for(N=0;N<m.length;N++){var A=m[N].from,T=m[N].to;s=e.child(T.key),f=n.getPredecessorChildName(T.key,T.value),i.push(new l.default("child_moved",T.value,T.key,f)),p=this.diffRecursive_(s,A.value,T.value),p&&b.push(T)}for(N=0;N<b.length;N++){var D=b[N];f=n.getPredecessorChildName(D.key,D.value),i.push(new l.default("child_changed",D.value,D.key,f))}return v}},{key:"compareChildren_",value:function(e,t){return null===e?1:null===t?-1:e.key===t.key?0:(0,d.NAME_AND_PRIORITY_COMPARATOR)({name:e.key,priority:e.value.getPriority()},{name:t.key,priority:t.value.getPriority()})}}],[{key:"Diff",value:function(t,n,i,r,o){var a=t.getChild(i),u=n.getChild(i),s=new e(r,o),l=s.diffRecursive_(i,a,u),c=!a.isEmpty()&&!u.isEmpty()&&a.getPriority()!==u.getPriority();(l||c)&&s.propagateDiffUpward_(i,t,n,l,c)}}]),e}();t.default=f,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(36),l=i(s),c=n(107),d=i(c),h=n(61),f=i(h),p=n(3),v=n(8),_=function(){function e(t){(0,o.default)(this,e),this.query_=t,this.callbacks_=[],this.eventQueue_=new d.default}return(0,u.default)(e,[{key:"getQuery",value:function(){return this.query_}},{key:"addEventCallback",value:function(e,t,n,i){this.callbacks_.push({type:e,callback:t,cancel:n,context:i});var r=[],o=this.generateChangesForSnapshot(this.snapshotNode_);this.isComplete_&&o.push(new l.default("value",this.snapshotNode_));for(var a=0;a<o.length;a++)if(o[a].type===e){var u=new Webcom(this.query_.repo,this.query_.path);o[a].childName&&(u=u.child(o[a].childName)),r.push({callback:(0,v.bindCallback)(t,i),snapshot:new f.default(o[a].snapshotNode,u),prevName:o[a].prevName})}this.eventQueue_.queueEvents(r)}},{key:"removeEventCallback",value:function(e,t,n){for(var i,r=!1,o=this.callbacks_.length-1;o>=0&&(i=this.callbacks_[o],e&&i.type!==e||t&&i.callback!==t||n&&i.context!==n||(this.callbacks_.splice(o,1),r=!0,!e||!t));o--);return r}},{key:"hasCallbacks",value:function(){return this.callbacks_.length>0}},{key:"processChanges",value:function(e,t){t=this.processChanges_(e,t),null!==t&&this.queueEventsForChanges_(t)}},{key:"raiseCancelEvents",value:function(e){for(var t,n=0;n<this.callbacks_.length;n++)t=this.callbacks_[n],t.cancel&&(0,v.bindCallback)(t.cancel,t.context)(e)}},{key:"queueEventsForChanges_",value:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=i.type,o=new Webcom(this.query_.repo,this.query_.path);e[n].childName&&(o=o.child(e[n].childName));var a=new f.default(e[n].snapshotNode,o);"value"!==i.type||a.hasChildren()?"value"!==i.type&&(r+=" "+a.name()):r+="("+a.val()+")",(0,p.log)(this.query_.repo.connection_.id+": event:"+this.query_.path+":"+this.query_.queryIdentifier()+":"+r);for(var u,s=0;s<this.callbacks_.length;s++)u=this.callbacks_[s],e[n].type===u.type&&t.push({callback:(0,v.bindCallback)(u.callback,u.context),snapshot:a,prevName:i.prevName})}this.eventQueue_.queueEvents(t)}},{key:"raiseQueuedEvents",value:function(){this.eventQueue_.raiseQueuedEvents()}},{key:"generateChangesForSnapshot",value:function(e){var t=[];if(!e.isLeafNode()){var n=null;e.forEachChild(function(e,i){t.push(new l.default(l.default.CHILD_ADDED,i,e,n)),n=e})}return t}},{key:"isComplete",value:function(){return this.isComplete_}},{key:"markComplete",value:function(){this.isComplete_||(this.isComplete_=!0,this.queueEventsForChanges_([new l.default("value",this.snapshotNode_)]))}},{key:"processChanges_",value:function(){(0,v.abstractMethod)()}},{key:"getChildRelevance",value:function(){(0,v.abstractMethod)()}}]),e}();t.default=_,e.exports=t.default},function(e,t,n){(function(e){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.onOpen=t.Client=void 0;var o=n(25),a=r(o),u=n(44),s=r(u),l=n(1),c=r(l),d=n(2),h=r(d),f=n(90),p=r(f),v=n(37),_=i(v),y=n(110),g=n(111),m=i(g),b=n(12),k=n(4),C=i(k),w=n(112),E=i(w),S=n(75),P=i(S),N=n(113),O=i(N),A=n(114),T=i(A),D=n(76),R=i(D),I=n(13),M=n(8),x=n(3),W=n(11),j=i(W),L="undefined"==typeof window?e:window,F=L.Webcom?L.Webcom.SDK_VERSION:"0.0.0",V=function(e){T.onOpen(e)},U=function(){return R.isAvailable()?R:P},Q={facebook:{height:650,width:680},google:{height:460,width:490},github:{height:760,width:340},gitlab:{height:710,width:800},orange:{height:700,width:1e3},mobileconnectOFR:{height:540,width:700}},q=function(e,t){var n=new p.default(e);return t&&(n=n.then(function(e){return t(null,e)},function(e){throw t(e,null),e})),n},H=function(){function t(n,i){function r(t,n,i){e.setTimeout(function(){t(n,i)},0)}function o(e,t,n){var i=!!t||"undefined"==typeof e.user;if(!i){var o=void 0,a=void 0;e.user&&e.user.webcomAuthToken&&(o=e.user.webcomAuthToken),n&&n.webcomAuthToken&&(a=n.webcomAuthToken),i=(o||a)&&o!==a}e.user=n||null,i&&r((0,M.bind)(e.cb,e.ctx),t,n)}(0,c.default)(this,t),this.mRef=n,this.mNamespace=n.repo.name();var a="undefined"!=typeof window&&"file:"===window.location.protocol&&!C.isPhantomJS()&&!C.isMobileCordovaInAppBrowser();if(a){var u="WebcomSimpleLogin(): Due to browser security restrictions, loading applications via `file://*` URLs will prevent popup-based authentication providers from working properly. When testing locally, you'll need to run a barebones webserver on your machine rather than loading your test files via `file://*`. The easiest way to run a barebones server on your local machine is to `cd` to the root directory of your code and run `python -m SimpleHTTPServer`, which will allow you to access your content via `http://127.0.0.1:8000/*`.";(0,x.warn)(u)}i&&_.setApiHost(i),this.mLoginStateChange=function(e,t){this.mRef.repo.authCallbacks_.forEach(function(n){return o(n,e,t)})}}return(0,h.default)(t,[{key:"registerAuthCallback",value:function(e,t){this.mRef.repo.authCallbacks_.push({cb:e,ctx:t})}},{key:"unregisterAuthCallback",value:function(e,t){for(var n=!1,i=this.mRef.repo.authCallbacks_,r=i.length-1;r>=0;r--){var o=i[r];if(!(e&&o.cb!==e||t&&o.ctx!==t)&&(i.splice(r,1),n=!0,e))break}return n}},{key:"setApiHost",value:function(e){_.setApiHost(e)}},{key:"resumeSession",value:function(){var e=this,t=void 0,n=void 0;try{n=b.SessionStorage.get("requestId"),b.SessionStorage.remove("requestId")}catch(e){}if(n){var i=P;R.isAvailable()&&(i=R),i.open(_.getApiHost()+"/auth/v2/"+e.mNamespace+"/session/"+n,{},function(t,n){n&&n.token&&n.user?e.attemptAuth(n.token,n.user,!0):t?(m.clear(),e.mLoginStateChange(t)):(m.clear(),e.mLoginStateChange(null,null))})}else t=m.get(),t&&t.token&&t.user?e.attemptAuth(t.token,t.user,!1):e.mLoginStateChange(null,null)}},{key:"attemptAuth",value:function(e,t,n,i,r){var o=this;this.mRef.repo.auth(e,function(a,u){a?(m.clear(),o.mLoginStateChange(null,null),r&&r()):(n&&m.set({token:e,user:t,sessionKey:t.sessionKey}),"function"==typeof u&&u(),delete t.sessionKey,t.webcomAuthToken=e,o.mLoginStateChange(null,t),i&&i(t))},function(){m.clear(),o.mLoginStateChange(null,null),r&&r()})}},{key:"_loginTransport",value:function(e,t,n){var i=this;return q(function(n,r){t.v=F,E[e](i.mNamespace,t,i._tokenResponseCallback(function(e){return e},n,r))},n)}},{key:"_tokenResponseCallback",value:function(e,t,n){var i=this;return function(r,o){var a=e(o);if(r||!a.token){var u=(0,y.format)(r);i.mLoginStateChange(u,null),n(u)}else{var s=a.token,l=a.user;i.attemptAuth(s,l,!0,function(e){t(e)},function(e){n(e)})}}}},{key:"loginWithToken",value:function(e,t){var n="WebcomSimpleLogin.loginWithToken()";j.validateArgCount(n,1,2,arguments.length),j.validateString(n,1,arguments[0],!1);var i=this;return q(function(t,n){U().open(_.getApiHost()+"/auth/v2/"+i.mNamespace+"/decode",{token:e},i._tokenResponseCallback(function(t){return{token:e,user:t.data}},t,n))},t)}},{key:"loginAnonymously",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n="WebcomSimpleLogin.loginAnonymously()";return j.validateArgCount(n,0,2,arguments.length),this._loginTransport("anonymous",e,t)}},{key:"loginWithPassword",value:function(e,t){var n="WebcomSimpleLogin.loginWithPassword()";return j.validateArgCount(n,1,2,arguments.length),this._loginTransport("login",e,t)}},{key:"loginWithPhone",value:function(e,t){return this._loginTransport("authWithPhone",e,t)}},{key:"sendOtp",value:function(e,t,n){return this.manageUsers("sendOtp",{provider:e,id:t,message:n})}},{key:"loginWithCustomProvider",value:function(e,t,n){var i="WebcomSimpleLogin.loginWithCustomProvider()";return j.validateArgCount(i,2,3,arguments.length),j.validateString(i,1,arguments[0],!1),j.validateString(i,2,arguments[1],!1),this._loginTransport("custom",{provider:e,token:t},n)}},{key:"loginWithOAuth",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i="WebcomSimpleLogin.loginWithOAuth()";j.validateArgCount(i,1,3,arguments.length),j.validateString(i,1,arguments[0],!1),t.mode=t.mode||"popup";var r=t.mode;return"code"===r?this.loginViaOAuthCode(e,t,n):this.loginViaOAuth(e,t,n)}},{key:"loginWithWassup",value:function(e,t){var n="WebcomSimpleLogin.loginWithWassup()",i=e.mcc;j.validateString(n,1,i,!1,"mcc");var r=this;return q(function(e,t){U().open(_.getApiHost()+"/auth/v2/"+r.mNamespace+"/wassup/signin",{mcc:i},r._tokenResponseCallback(function(e){return e},e,t))},t)}},{key:"logout",value:function(e){m.clear(),this.mRef.repo.unauth(e),this.mLoginStateChange(null,null)}},{key:"loginViaOAuthCode",value:function(e,t,n){t.v=F,!t.code||!t.state;var i=this,r=_.getApiHost()+"/auth/v2/"+this.mNamespace+"/"+e+"/callback";return q(function(e,n){U().open(r,t,i._tokenResponseCallback(function(e){return e},e,n))},n)}},{key:"loginViaOAuth",value:function(e,t,n){var i=this,r=_.getApiHost()+"/auth/v2/"+i.mNamespace+"/"+e+"/signin";t.v=F;var o={menubar:0,location:0,resizable:0,scrollbars:1,status:0,dialog:1,width:700,height:375};(0,s.default)(o,Q[e]),t.height&&(o.height=t.height,delete t.height),t.width&&(o.width=t.width,delete t.width);var u=function(){return C.isMobileCordovaInAppBrowser()?"mobile-phonegap":C.isMobileTriggerIoTab()?"mobile-triggerio":C.isWindowsMetro()?"windows-metro":"desktop"}(),l=void 0;if("desktop"===u?!function(){l=T;var e=[];(0,a.default)(o).forEach(function(t){e.push(t+"="+o[t])}),t.options={relay_url:_.getApiHost()+"/auth/v2/relay",window_features:e.join(",")}}():"mobile-phonegap"===u?l=CordovaInAppBrowser:"mobile-triggerio"===u?l=TriggerIoTab:"windows-metro"===u&&(l=WindowsMetroAuthBroker),"redirect"===t.mode||C.isChromeiOS()||C.isWindowsPhone()||C.isStandaloneiOS()||C.isTwitteriOS()||C.isFacebookiOS()){var c=(0,I.getRandomString)()+(0,I.getRandomString)();try{b.SessionStorage.set("requestId",c)}catch(e){}return t.from=c,t.to||(t.to=window.location.href),void O.open(r,t)}return q(function(e,n){l.open(r,t,function(t,r){if(r&&r.token&&r.user)i.attemptAuth(r.token,r.user,!0,function(t){e(t)},function(e){n(e)});else{var o=t||{code:"UNKNOWN_ERROR",message:"An unknown error occurred."};"unknown closed window"===t?o={code:"USER_DENIED",message:"User cancelled the authentication request."}:r&&r.error&&(o=r.error),o=(0,y.format)(o),i.mLoginStateChange(o),n(o)}})},n)}},{key:"manageUsers",value:function(e,t,n){var i=this.mNamespace;return q(function(n,r){E[e](i,t,function(e,t){if(e){var i=(0,y.format)(e);r(i)}else n(t)})},n)}},{key:"createUser",value:function(e,t){return this.manageUsers("createUser",e,t)}},{key:"addAccount",value:function(e,t,n){return this.manageUsers("addAccount",{provider:e,details:t,message:n})}},{key:"removeIdentity",value:function(){var e=void 0,t=void 0;try{var n=this.currentAuthData("removeIdentity");e=n.token,t=n.auth}catch(e){return p.default.reject(e)}return this.manageUsers("removeIdentity",{provider:t.provider,token:e,id:t.providerUid})}},{key:"removeAccount",value:function(){var e=void 0,t=void 0;try{var n=this.currentAuthData("removeAccount");e=n.token,t=n.auth}catch(e){return p.default.reject(e)}return this.manageUsers("removeAccount",{token:e,uid:t.uid})}},{key:"verifyIdentity",value:function(e,t,n){return n.auth&&(n.challenge=n.auth.verificationPending,delete n.auth),this._loginTransport("verifyIdentity",{provider:e,id:t,verificationData:n})}},{key:"updateIdentityProfile",value:function(e,t,n){var i=void 0,r=void 0;try{var o=this.currentAuthData("updateIdentityProfile");i=o.token,r=o.auth}catch(e){return q(function(t,n){n(e)},n)}return this.manageUsers("updateIdentityProfile",{token:i,id:r.providerUid,provider:r.provider,json:t,path:e||""},n)}},{key:"currentAuthData",value:function e(t){var e=m.get(),n=void 0,i=void 0;if(!e)throw{code:"AUTH_MISSING",message:"Webcom:"+t+" failed: needs to be authenticated"};return n=e.token,i=e.user||{},{token:n,auth:i}}},{key:"changePassword",value:function(e,t,n,i){return this.manageUsers("changePassword",{email:e,password:t,newPassword:n},function(e){return i&&i(e)})}},{key:"removeUser",value:function(e,t,n){return this.manageUsers("removeUser",{email:e,password:t},function(e){return n&&n(e)})}},{key:"sendPasswordResetEmail",value:function(e,t){return this.manageUsers("sendPasswordResetEmail",{email:e},function(e){return t&&t(e)})}},{key:"sendPasswordResetCode",value:function(e,t,n){return this.manageUsers("sendPasswordResetCode",{provider:e,id:t,message:n})}},{key:"sendVerificationCode",value:function(e,t,n){return this.manageUsers("sendVerificationCode",{provider:e,id:t,message:n})}},{key:"sendConfirmationEmail",value:function(e,t){return this.manageUsers("sendConfirmationEmail",{email:e},function(e){return t&&t(e)})}}]),t}();t.default=H,t.Client=H,t.onOpen=V}).call(t,function(){return this}())},function(e,t,n){(function(e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(){return"_JSONP"+(new Date).getTime()+Math.floor(100*Math.random())}function o(t){e.setTimeout(function(){delete(0,d.getGlobalNamespace)(v)[t];var e=document.getElementById(t);e&&e.parentNode.removeChild(e)},0)}function a(e,t){(0,d.getGlobalNamespace)(v)[e]=function(n){var i=n.error||null;delete n.error,t(i,n),o(e)}}function u(t,n,i){e.setTimeout(function(){try{var e=document.createElement("script");e.type="text/javascript",e.id=t,e.async=!0,e.src=n,e.onerror=function(){var e=document.getElementById(t);null!==e&&e.parentNode.removeChild(e),i&&i((0,h.formatError)({code:"SERVER_ERROR",message:"An unknown server error occurred."}))},document.getElementsByTagName("head")[0].appendChild(e)}catch(e){i&&i((0,h.formatError)({code:"SERVER_ERROR",message:"An unknown server error occurred."}))}},0)}function s(e,t,n){var i=t.options||{},o=(i.method||"GET").toUpperCase();if(delete t.options,(0,p.validateHttpMethod)(["GET"],o,e,"JSONP",n)){var s=r();(0,c.default)(t,{transport:"jsonp",callback:v+"."+s}),e=(0,f.addQueryParameters)(e,t),a(s,n),u(s,e,n)}}Object.defineProperty(t,"__esModule",{value:!0});var l=n(44),c=i(l);t.open=s;var d=n(3),h=n(79),f=n(13),p=n(11),v="Webcom._SimpleLoginJSONP";t.default={open:s}}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){var i=new XMLHttpRequest,r=t.options||{},o=(r.method||"GET").toUpperCase(),a=r.contentType||"application/x-www-form-urlencoded",s={Accept:"application/json"},c=!1;i.onreadystatechange=function(){if(!c&&4===i.readyState){var t={},r=void 0;c=!0;var o=i.status>=400&&i.status<500;if(i.status>=200&&i.status<300||304===i.status||o||1223===i.status)try{i.responseText.toString().length>0&&(t=JSON.parse(i.responseText)),r=t.error||null,r?("object"!==("undefined"==typeof r?"undefined":(0,f.default)(r))&&(r={code:t.status,message:r},delete t.status),delete t.error):o&&(r="UNKNOWN_ERROR")}catch(e){r="UNKNOWN_ERROR"}else r=i.status?"RESPONSE_PAYLOAD_ERROR":{code:"NETWORK_ERROR",message:"Connection to "+e+" failed."};return n&&n(r,t)}},t&&(delete t.options,"GET"===o?(e.indexOf("?")===-1&&(e+="?"),e+=(0,p.formatQueryString)(t),t=null):"POST"!==o&&"PUT"!==o&&"PATCH"!==o||("application/x-www-form-urlencoded"===a?t=(0,p.formatQueryString)(t):"application/json"===a&&(t=(0,d.default)(t.json||t)),s["Content-Type"]=a)),i.open(o,e,!0),(0,l.default)(s,r.headers||{}),(0,u.default)(s).forEach(function(e){i.setRequestHeader(e,s[e])}),i.send(t)}function o(){return"undefined"!=typeof window&&window.XMLHttpRequest&&!(0,v.isIeLT10)()}Object.defineProperty(t,"__esModule",{value:!0});var a=n(25),u=i(a),s=n(44),l=i(s),c=n(17),d=i(c),h=n(6),f=i(h);t.open=r,t.isAvailable=o;var p=n(13),v=n(4);t.default={open:r,isAvailable:o}},function(e,t,n){(function(i){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(1),u=o(a),s=n(2),l=o(s),c=n(3),d=r(c),h=n(115),f=o(h),p=n(78),v=n(12),_=6e4,y=5e3,g=10240,m=102400,b=0,k=1,C=2,w="t",E="d",S="s",P="r",N="e",O="o",A="a",T="n",D="p",R="h",I=function(){function e(t,n,i,r,o,a){(0,u.default)(this,e),this.id=t,this.log_=d.logWrapper("c:"+this.id+":"),this.onMessage_=i,this.onReady_=r,this.onDisconnect_=o,this.onKill_=a,this.repoInfo_=n,this.pendingDataMessages=[],this.connectionCount=0,this.transportManager_=new f.default(n),this.state_=b,this.log_("Connection created"),this.start_()}return(0,l.default)(e,[{key:"start_",value:function(){var e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var t=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1;var r=this;i.setTimeout(function(){r.conn_&&r.conn_.open(t,n)},Math.floor(0));var o=e.healthyTimeout||0;o>0&&(this.healthyTimeout_=i.setTimeout(function(){r.healthyTimeout_=null,r.isHealthy_||(r.conn_&&r.conn_.bytesReceived>m?(r.log_("Connection exceeded healthy timeout but has received "+r.conn_.bytesReceived+" bytes. Marking connection healthy."),r.isHealthy_=!0,r.conn_.markConnectionHealthy()):r.conn_&&r.conn_.bytesSent>g?r.log_("Connection exceeded healthy timeout but has sent "+r.conn_.bytesSent+" bytes. Leaving connection alive."):(r.log_("Closing unhealthy connection after timeout."),r.close()))},Math.floor(o)))}},{key:"nextTransportId_",value:function(){return"c:"+this.id+":"+this.connectionCount++}},{key:"disconnReceiver_",value:function(e){var t=this;return function(n){e===t.conn_?t.onConnectionLost_(n):e===t.secondaryConn_?(t.log_("Secondary connection lost."),t.onSecondaryConnectionLost_()):t.log_("closing an old connection")}}},{key:"connReceiver_",value:function(e){var t=this;return function(n){t.state_!==C&&(e===t.rx_?t.onPrimaryMessageReceived_(n):e===t.secondaryConn_?t.onSecondaryMessageReceived_(n):t.log_("message on old connection"))}}},{key:"sendRequest",value:function(e){var t={t:"d",d:e};this.sendData_(t)}},{key:"tryCleanupConnection",value: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)}},{key:"onSecondaryControl_",value:function(e){if(w in e){var t=e[w];t===A?this.upgradeIfSecondaryHealthy_():t===P?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):t===O&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}},{key:"onSecondaryMessageReceived_",value:function(e){var t=(0,c.requireKey)("t",e),n=(0,c.requireKey)("d",e);if("c"===t)this.onSecondaryControl_(n);else{if("d"!==t)throw new Error("Unknown protocol layer: "+t);this.pendingDataMessages.push(n)}}},{key:"upgradeIfSecondaryHealthy_",value: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:D,d:{}}}))}},{key:"proceedWithUpgrade_",value:function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:A,d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:T,d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}},{key:"onPrimaryMessageReceived_",value:function(e){var t=(0,c.requireKey)("t",e),n=(0,c.requireKey)("d",e);"c"===t?this.onControl_(n):"d"===t&&this.onDataMessage_(n)}},{key:"onDataMessage_",value:function(e){this.onPrimaryResponse_(),this.onMessage_(e)}},{key:"onPrimaryResponse_",value:function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}},{key:"onControl_",value:function(e){var t=(0,c.requireKey)(w,e);if(E in e){var n=e[E];if(t===R)this.onHandshake_(n);else if(t===T){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var i=0;i<this.pendingDataMessages.length;++i)this.onDataMessage_(this.pendingDataMessages[i]);this.pendingDataMessages=[],this.tryCleanupConnection()}else t===S?this.onConnectionShutdown_(n):t===P?this.onReset_(n):t===N?d.error("Server Error: "+n):t===O?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):d.error("Unknown control packet command: "+t)}}},{key:"onHandshake_",value:function(e){var t=e.ts,n=e.v,i=e.h;this.sessionId=e.s,this.repoInfo_.updateHost(i),this.state_===b&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),p.PROTOCOL_VERSION!==n&&d.warn("Protocol version mismatch detected"),this.tryStartUpgrade_())}},{key:"tryStartUpgrade_",value:function(){var e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}},{key:"startUpgrade_",value:function(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var t=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,n);var r=this;i.setTimeout(function(){r.secondaryConn_&&(r.log_("Timed out trying to upgrade."),r.secondaryConn_.close())},Math.floor(_))}},{key:"onReset_",value:function(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.updateHost(e),this.state_===k?this.close():(this.closeConnections_(),this.start_())}},{key:"onConnectionEstablished_",value:function(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=k,this.onReady_&&(this.onReady_(t),this.onReady_=null);var n=this;0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):i.setTimeout(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(y))}},{key:"sendPingOnPrimaryIfNecessary_",value:function(){this.isHealthy_||this.state_!==k||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:D,d:{}}}))}},{key:"onSecondaryConnectionLost_",value:function(){var e=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==e&&this.rx_!==e||this.close()}},{key:"onConnectionLost_",value:function(e){this.conn_=null,e||this.state_!==b?this.state_===k&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(v.PersistentStorage.remove("host:"+this.repoInfo_.host),
this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}},{key:"onConnectionShutdown_",value:function(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}},{key:"sendData_",value:function(e){if(this.state_!==k)throw"Connection is not connected";this.tx_.send(e)}},{key:"close",value:function(){this.state_!==C&&(this.log_("Closing realtime connection."),this.state_=C,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}},{key:"closeConnections_",value:function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),"number"==typeof this.healthyTimeout_&&(i.clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}]),e}();t.default=I,e.exports=t.default}).call(t,function(){return this}())},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=t.PROTOCOL_VERSION="5",i=t.VERSION_PARAM="v",r=t.SESSION_PARAM="s";t.default={PROTOCOL_VERSION:n,VERSION_PARAM:i,SESSION_PARAM:r}},function(e,t){"use strict";function n(e){e||(e={});var t=new Error(e.message);return t.code=e.code||"UNKNOWN_ERROR",t}Object.defineProperty(t,"__esModule",{value:!0}),t.formatError=n,t.default={formatError:n}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var i=n(138);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var i=n(32),r=n(14).document,o=i(r)&&i(r.createElement);e.exports=function(e){return o?r.createElement(e):{}}},function(e,t,n){e.exports=!n(20)&&!n(26)(function(){return 7!=Object.defineProperty(n(82)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(80);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,n){"use strict";var i=n(49),r=n(21),o=n(89),a=n(27),u=n(22),s=n(48),l=n(144),c=n(54),d=n(87),h=n(29)("iterator"),f=!([].keys&&"next"in[].keys()),p="@@iterator",v="keys",_="values",y=function(){return this};e.exports=function(e,t,n,g,m,b,k){l(n,t,g);var C,w,E,S=function(e){if(!f&&e in A)return A[e];switch(e){case v:return function(){return new n(this,e)};case _:return function(){return new n(this,e)}}return function(){return new n(this,e)}},P=t+" Iterator",N=m==_,O=!1,A=e.prototype,T=A[h]||A[p]||m&&A[m],D=T||S(m),R=m?N?S("entries"):D:void 0,I="Array"==t?A.entries||T:T;if(I&&(E=d(I.call(new e)),E!==Object.prototype&&(c(E,P,!0),i||u(E,h)||a(E,h,y))),N&&T&&T.name!==_&&(O=!0,D=function(){return T.call(this)}),i&&!k||!f&&!O&&A[h]||a(A,h,D),s[t]=D,s[P]=y,m)if(C={values:N?D:S(_),keys:b?D:S(v),entries:R},k)for(w in C)w in A||o(A,w,C[w]);else r(r.P+r.F*(f||O),t,C);return C}},function(e,t,n){var i=n(88),r=n(47).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,r)}},function(e,t,n){var i=n(22),r=n(40),o=n(55)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=r(e),i(e,o)?e[o]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var i=n(22),r=n(15),o=n(140)(!1),a=n(55)("IE_PROTO");e.exports=function(e,t){var n,u=r(e),s=0,l=[];for(n in u)n!=a&&i(u,n)&&l.push(n);for(;t.length>s;)i(u,n=t[s++])&&(~o(l,n)||l.push(n));return l}},function(e,t,n){e.exports=n(27)},function(e,t,n){(function(t){var i="undefined"==typeof window?t:window;e.exports={default:i.Promise||n(170),__esModule:!0}}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=g.default.prototype.hash;g.default.prototype.hash=e;var n=C.default.prototype.hash;return C.default.prototype.hash=e,function(){g.default.prototype.hash=t,C.default.prototype.hash=n}}function o(e){return e.queryIdentifier()}function a(e){return e.repo.connection_.listens_}function u(e){return e.repo.connection_.realtime_}function s(e,t){e.repo.connection_.securityDebugCallback_=t}function l(e,t){e.repo.stats(t)}function c(e,t){e.repo.statsIncrementCounter(t)}function d(e){return e.repo.dataUpdateCount}function h(e,t){return e.repo.interceptServerData_(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.onPopupOpen=t.SortedChildrenNode=t.SessionStorage=t.PersistentStorage=t.ConnectionTarget=t.RealTimeConnection=t.DataConnection=void 0,t.hijackHash=r,t.queryIdentifier=o,t.listens=a,t.refConnection=u,t.setSecurityDebugCallback=s,t.stats=l,t.statsIncrementCounter=c,t.dataUpdateCount=d,t.interceptServerData=h;var f=n(62),p=i(f),v=n(64),_=i(v),y=n(33),g=i(y),m=n(67),b=i(m),k=n(34),C=i(k),w=n(77),E=i(w),S=n(74),P=n(12);t.DataConnection=p.default,t.RealTimeConnection=E.default,t.ConnectionTarget=_.default,t.PersistentStorage=P.PersistentStorage,t.SessionStorage=P.SessionStorage,t.SortedChildrenNode=b.default,t.onPopupOpen=S.onOpen,t.default={hijackHash:r,queryIdentifier:o,listens:a,refConnection:u,setSecurityDebugCallback:s,stats:l,statsIncrementCounter:c,dataUpdateCount:d,interceptServerData:h,DataConnection:p.default,RealTimeConnection:E.default,ConnectionTarget:_.default,PersistentStorage:P.PersistentStorage,SessionStorage:P.SessionStorage,onPopupOpen:S.onOpen,SortedChildrenNode:b.default}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(3),l=n(30),c=n(11),d=n(4),h=function(){function e(t,n,i){(0,o.default)(this,e),this.repo_=t,this.path_=n,this.name_=i}return(0,u.default)(e,[{key:"cancel",value:function(e){(0,c.validateArgCount)("Webcom. onDisconnect().cancel",0,1,arguments.length),(0,c.validateCallback)("Webcom. onDisconnect().cancel",1,e,!0),this.repo_.onDisconnectCancel(this.path_,e)}},{key:"remove",value:function(e){(0,c.validateArgCount)("Webcom. onDisconnect().remove",0,1,arguments.length),(0,l.validateWritablePath)("Webcom. onDisconnect().remove",this.path_),(0,c.validateCallback)("Webcom. onDisconnect().remove",1,e,!0),this.repo_.onDisconnectSet(this.path_,null,e)}},{key:"set",value:function(e,t){(0,c.validateArgCount)("Webcom. onDisconnect().set",1,2,arguments.length),(0,l.validateWritablePath)("Webcom. onDisconnect().set",this.path_),(0,l.validateWebcomDataArg)("Webcom. onDisconnect().set",1,e,!1),(0,c.validateCallback)("Webcom. onDisconnect().set",2,t,!0),this.repo_.onDisconnectSet(this.path_,e,t)}},{key:"setWithPriority",value:function(e,t,n){if((0,c.validateArgCount)("Webcom. onDisconnect().setWithPriority",2,3,arguments.length),(0,l.validateWritablePath)("Webcom. onDisconnect().setWithPriority",this.path_),(0,l.validateWebcomDataArg)("Webcom. onDisconnect().setWithPriority",1,e,!1),(0,l.validatePriority)("Webcom. onDisconnect().setWithPriority",2,t,!1),(0,c.validateCallback)("Webcom. onDisconnect().setWithPriority",3,n,!0),".length"===this.name_||".keys"===this.name_)throw"Webcom. onDisconnect().setWithPriority failed: "+this.name_+" is a read-only object.";this.repo_.onDisconnectSetWithPriority(this.path_,e,t,n)}},{key:"update",value:function(e,t){if((0,c.validateArgCount)("Webcom. onDisconnect().update",1,2,arguments.length),(0,l.validateWritablePath)("Webcom. onDisconnect().update",this.path_),(0,d.isArray)(e)){for(var n={},i=0;i<e.length;++i)n[""+i]=e[i];e=n,(0,s.warn)("Passing an Array to Webcom. onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}(0,l.validateWebcomObjectDataArg)("Webcom. onDisconnect().update",1,e,!1),(0,c.validateCallback)("Webcom. onDisconnect().update",2,t,!0),this.repo_.onDisconnectUpdate(this.path_,e,t)}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(6),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=n(3),d=n(30),h=n(11),f=n(8),p=n(4),v=function(){function e(t,n,i,r,o){if((0,u.default)(this,e),this.repo=t,this.path=n,this.itemLimit=i,this.startName=r,this.endName=o,(0,p.isDef)(this.startName)&&(0,p.isDef)(this.endName)&&(0,p.isDef)(this.itemLimit))throw"Query: Can't combine startAt(), endAt(), and limit()."}return(0,l.default)(e,[{key:"pathString",value:function(){return this.path.toString()}},{key:"ref",value:function(){return(0,h.validateArgCount)("Query.ref",0,0,arguments.length),new Webcom(this.repo,this.path)}},{key:"on",value:function(e,t,n,i){(0,h.validateArgCount)("Query.on",2,4,arguments.length),(0,d.validateEventType)("Query.on",1,e,!1),(0,h.validateCallback)("Query.on",2,t,!1);var r=this.getCancelAndContextArgs_("Query.on",n,i);return this.repo.addEventCallbackForQuery(this,e,t,r.cancel,r.context),t}},{key:"off",value:function(e,t,n){(0,h.validateArgCount)("Query.off",0,3,arguments.length),(0,d.validateEventType)("Query.off",1,e,!0),(0,h.validateCallback)("Query.off",2,t,!0),(0,h.validateContextObject)("Query.off",3,n,!0),this.repo.removeEventCallbackForQuery(this,e,t,n)}},{key:"once",value:function(e,t,n,i){(0,h.validateArgCount)("Query.once",2,4,arguments.length),(0,d.validateEventType)("Query.once",1,e,!1),(0,h.validateCallback)("Query.once",2,t,!1);var r=this.getCancelAndContextArgs_("Query.once",n,i),o=this,a=!0,u=function n(i){a&&(a=!1,o.off(e,n),(0,f.bind)(t,r.context)(i))};this.on(e,u,function(t){o.off(e,u),r.cancel&&(0,f.bind)(r.cancel,r.context)(t)})}},{key:"limit",value:function(t){if((0,h.validateArgCount)("Query.limit",1,1,arguments.length),!(0,p.isNumber)(t)||Math.floor(t)!==t||t<=0)throw"Query.limit: First argument must be a positive integer.";return new e(this.repo,this.path,t,this.startName,this.endName)}},{key:"startAt",value:function(t){return(0,h.validateArgCount)("Query.startAt",0,1,arguments.length),(0,d.validateKey)("Query.startAt",1,t,!0),(0,p.isDef)(t)||(t=null),new e(this.repo,this.path,this.itemLimit,t,this.endName)}},{key:"endAt",value:function(t){return(0,h.validateArgCount)("Query.endAt",0,1,arguments.length),(0,d.validateKey)("Query.endAt",1,t,!0),new e(this.repo,this.path,this.itemLimit,this.startName,t)}},{key:"equalTo",value:function(e){return(0,h.validateArgCount)("Query.equalTo",1,1,arguments.length),(0,d.validateKey)("Query.equalTo",1,e,!0),this.startAt(e).endAt(e)}},{key:"queryObject",value:function(){var e={};return(0,p.isDef)(this.startName)&&(e.sn=this.startName),(0,p.isDef)(this.endName)&&(e.en=this.endName),(0,p.isDef)(this.itemLimit)&&(e.l=this.itemLimit),(0,p.isDef)(this.startName)&&null===this.startName&&(e.vf="l"),e}},{key:"queryIdentifier",value:function(){var e=this.queryObject(),t=(0,c.objectToUniqueKey)(e);return"{}"===t?"default":t}},{key:"getCancelAndContextArgs_",value:function(e,t,n){var i={};if(t&&n)i.cancel=t,(0,h.validateCallback)(e,3,i.cancel,!0),i.context=n,(0,h.validateContextObject)(e,4,i.context,!0);else if(t)if("object"===("undefined"==typeof t?"undefined":(0,o.default)(t))&&null!==t)i.context=t;else{if("function"!=typeof t)throw new Error((0,h.errorPrefix_)(e,3,!0)+"must either be a cancel callback or a context object.");i.cancel=t}return i}}]),e}();t.default=v,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(1),a=i(o),u=n(2),s=i(u),l=n(63),c=i(l),d=n(5),h=function(){function e(){(0,a.default)(this,e),this.repos_={}}return(0,s.default)(e,[{key:"interrupt",value:function(){for(var e in this.repos_)this.repos_[e].interrupt()}},{key:"resume",value:function(){for(var e in this.repos_)this.repos_[e].resume()}},{key:"getRepo",value:function(e){var t=e.toString(),n=(0,d.get)(this.repos_,t);return n||(n=new c.default(e),this.repos_[t]=n),n}}],[{key:"getInstance",value:function(){return r||(r=new e),r}}]),e}();t.default=h,e.exports=t.default},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o),u=n(2),s=r(u),l=n(106),c=r(l),d=n(108),h=r(d),f=n(109),p=r(f),v=n(72),_=r(v),y=n(35),g=r(y),m=n(10),b=r(m),k=n(24),C=n(3),w=i(C),E=n(5),S=i(E),P=n(8),N=i(P),O=n(16),A=function(){function e(t,n){(0,a.default)(this,e),this.connection_=t,this.data_=n,this.oldDataNode_=n.rootNode_,this.viewsTree_=new g.default}return(0,s.default)(e,[{key:"addEventCallbackForQuery",value:function(e,t,n,i,r){var o=e.path,a=this.viewsTree_.subTree(o),u=a.getValue();null===u?(u=new h.default,a.setValue(u)):w.assert(!u.isEmpty(),"We shouldn't be storing empty QueryMaps");var s,l=e.queryIdentifier();if(u.contains(l))s=u.get(l),s.addEventCallback(t,n,i,r),s.raiseQueuedEvents();else{var c=this.data_.rootNode_.getChild(o);s=this.createView_(e,c),this.ensureListening_(a,u,l,s),s.addEventCallback(t,n,i,r);var d=this.viewsTree_.subTree(o).forEachAncestor(function(e){if(e.getValue()&&e.getValue().defaultView()&&e.getValue().defaultView().isComplete())return!0},!0);d=d||null===this.connection_&&!this.data_.getNode(o).isEmpty(),d&&s.markComplete(),s.raiseQueuedEvents()}}},{key:"removeCallbackForQuery_",value:function(e,t,n,i,r){var o=e.get(t),a=o&&o.removeEventCallback(n,i,r)&&!o.hasCallbacks();return a&&e.remove(t),a}},{key:"doRemoveQueries_",value:function(e,t,n,i,r){var o=t?t.queryIdentifier():null,a=[];if(o&&"default"!==o)this.removeCallbackForQuery_(e,o,n,i,r)&&a.push(o);else{var u=this;(0,O.forEach)(e.keys(),function(t){u.removeCallbackForQuery_(e,t,n,i,r)&&a.push(t)})}return a}},{key:"removeEventCallbackForQuery",value:function(e,t,n,i){var r=e.path,o=this.viewsTree_.subTree(r),a=o.getValue();return null===a?null:this.removeQueries_(a,e,t,n,i)}},{key:"removeQueries_",value:function(e,t,n,i,r){var o=e.path(),a=this.viewsTree_.subTree(o),u=this.doRemoveQueries_(e,t,n,i,r);e.isEmpty()&&a.setValue(null);var s=this.hasActiveAncestor(a);if(u.length>0&&!s){for(var l=a,c=a.parent(),d=!1;!d&&c;){var h=c.getValue();if(h){w.assert(!h.hasActiveDefaultQuery());var f=l.name(),p=!1;h.each(function(e,t){p=t.hasChild(f)||p}),p&&(d=!0)}l=c,c=c.parent()}var v=null;if(!e.hasActiveDefaultQuery()){var _=e.removeStopListener();v=this.collectListeners_(a,!0),_&&_()}return d?null:v}return null}},{key:"markQueriesComplete",value:function(e,t){var n=this.viewsTree_.subTree(e);n.forEachDescendant(function(e){var t=e.getValue();t&&t.each(function(e,t){t.markComplete()})},t,!0)}},{key:"raiseEventsForChange",value:function(e,t){var n=this,i=this.oldDataNode_,r=this.data_.rootNode_;this.oldDataNode_=r;for(var o={},a=0;a<t.length;a++)o[t[a].toString()]=!0;var u=function(e){do{if(o[e.toString()])return!0;e=e.parent()}while(null!==e);return!1},s=function(t,i,r){if(e.contains(t)){var o=u(t);o&&n.markQueriesComplete(t,!1),n.processChanges(t,i,r),o&&n.markQueriesComplete(t,!0)}else n.processChanges(t,i,r)};_.default.Diff(i,r,e,this.viewsTree_,s),u(e)&&this.markQueriesComplete(e,!0),this.raiseQueuedEvents_(e)}},{key:"raiseQueuedEvents_",value:function(e){var t=this.viewsTree_.subTree(e);t.forEachDescendant(function(e){var t=e.getValue();t&&t.each(function(e,t){t.raiseQueuedEvents()})},!0,!0),t.forEachAncestor(function(e){var t=e.getValue();t&&t.each(function(e,t){t.raiseQueuedEvents()})},!1)}},{key:"processChanges",value:function(e,t,n){var i=this.viewsTree_.subTree(e).getValue();null!==i&&i.each(function(e,i){i.processChanges(t,n)})}},{key:"hasActiveAncestor",value:function(e){return e.forEachAncestor(function(e){return e.getValue()&&e.getValue().hasActiveDefaultQuery()})}},{key:"ensureListening_",value:function(e,t,n,i){if(t.hasActiveDefaultQuery()||this.hasActiveAncestor(e))t.setView(n,i);else{var r,o;t.isEmpty()||(r=t.toString(),o=t.queries()),t.setView(n,i),t.setActive(this.startListening(t)),r&&o&&this.connection_.unlisten(t.path(),r,o)}t.hasActiveDefaultQuery()&&e.forEachDescendant(function(e){var t=e.getValue();t&&t.deactivate()})}},{key:"collectListeners_",value:function(e,t){var n=[],i=this,r=function e(r){var o=r.getValue();if(o&&o.hasDefaultQuery())n.push(o.path()),t&&!o.isActive()&&o.setActive(i.startListening(o));else{if(t&&o){o.isActive()||o.setActive(i.startListening(o));var a={};o.each(function(e,t){t.snapshotNode_.forEachChild(function(e){if(!S.contains(a,e)){a[e]=!0;var t=o.path().child(e);n.push(t)}})})}r.forEachChild(e)}};return r(e),n}},{key:"startListening",value:function(e){if(this.connection_){var t,n=this,i=this.connection_,r=e.path(),o=e.toString(),a=e.queries(),u=function(){t=!0,i.unlisten(r,o,a)},s=e.keys(),l=e.hasDefaultQuery();return!this.connection_.connected_&&this.connection_.repoInfo_.options.persist&&(l?this.markQueriesComplete(e.path(),!0):(0,O.forEach)(s,function(t){var n=e.get(t);n&&n.markComplete()})),this.connection_.listen(e,function(i){if("ok"!==i){var r=w.errorForServerCode(i);w.warn("on() or once() for "+e.path().toString()+" failed: "+r.toString()),n.raiseCancelEventsForQuery_(e,r)}else t||(l?n.markQueriesComplete(e.path(),!0):(0,O.forEach)(s,function(t){var n=e.get(t);n&&n.markComplete()}),n.raiseQueuedEvents_(e.path()))}),u}return N.nullFunction}},{key:"raiseCancelEventsForQuery_",value:function(e,t){e&&(e.each(function(e,n){n.raiseCancelEvents(t)}),this.removeQueries_(e))}},{key:"createView_",value:function(e,t){return"default"===e.queryIdentifier()?new c.default(e,t):new p.default(e,t)}},{key:"getChildRelevance",value:function(e,t,n,i){var r={},o=function(e){(0,E.forEach)(e,function(e,t){if(e===p.default.IN_VIEW)r[t]=p.default.IN_VIEW;else{var n=S.get(r,t)||e;n===e?r[t]=e:r[t]=p.default.IN_VIEW}})};return t.each(function(t,r){o(r.getChildRelevance(e,n,i))}),n.isLeafNode()||n.forEachChild(function(e){S.contains(r,e)||(r[e]=p.default.OUT_OF_VIEW)}),r}},{key:"getAncestorUpdate",value:function(e,t,n){for(var i=this.viewsTree_.subTree(e),r=i.parent(),o=[];null!==r;){var a=r.getValue();if(null!==a){if(a.hasDefaultQuery())return[{path:e,node:t}];var u=this.getChildRelevance(e,a,t,n),s=S.get(u,i.name());if(s===p.default.IN_VIEW||s===p.default.ENTERING_VIEW)return[{path:e,node:t}];s===p.default.LEAVING_VIEW&&o.push({path:e,node:k.EMPTY_NODE})}i=r,r=r.parent()}return o}},{key:"pruneNonDefaultQuery",value:function(e,t,n,i){var r=e.path(),o=this.getChildRelevance(r,e,n,i),a=k.EMPTY_NODE,u=[],s=this;return(0,E.forEach)(o,function(e,o){var l=new b.default(o);e===p.default.IN_VIEW||e===p.default.ENTERING_VIEW?a=a.updateImmediateChild(o,n.getChild(l)):e===p.default.LEAVING_VIEW?(u.push({path:r.child(o),node:k.EMPTY_NODE}),u=u.concat(s.pruneObjectToListeners_(n.getChild(l),t.subTree(l),i))):u=u.concat(s.pruneObjectToListeners_(n.getChild(l),t.subTree(l),i))}),[{path:r,node:a}].concat(u)}},{key:"pruneUpdateNode",value:function(e,t,n){var i=this.getAncestorUpdate(e,t,n);if(1===i.length&&(!i[0].node.isEmpty()||t.isEmpty()))return i;var r=this.viewsTree_.subTree(e),o=r.getValue();return null!==o?o.hasDefaultQuery()?i.push({path:e,node:t}):i=i.concat(this.pruneNonDefaultQuery(o,r,t,n)):i=i.concat(this.pruneObjectToListeners_(t,r,n)),i}},{key:"pruneObjectToListeners_",value:function(e,t,n){var i=t.getValue();if(null!==i)return i.hasDefaultQuery()?[{path:t.path(),node:e}]:this.pruneNonDefaultQuery(i,t,e,n);var r=[],o=this;return t.forEachChild(function(t){var i;i=e.isLeafNode()?k.EMPTY_NODE:e.getImmediateChild(t.name());var a=o.pruneObjectToListeners_(i,t,n);r=r.concat(a)}),r}}]),e}();t.default=A,e.exports=t.default},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.WebcomData=void 0;var o=n(1),a=r(o),u=n(2),s=r(u),l=n(65),c=r(l),d=n(35),h=r(d),f=n(3),p=i(f),v=n(24),_=n(16),y=t.WebcomData=function(){function e(t){(0,a.default)(this,e),this.serverData=new c.default,this.mergedData=new c.default,this.visibleData=new c.default(t),this.pendingPuts=new h.default}return(0,s.default)(e,[{key:"updateServerData",value:function(e,t){return this.serverData.updateSnapshot(e,t),this.mergeServerAndPendingData(e)}},{key:"mergeServerAndPendingData",value:function(t){for(var n=this.serverData.getNode(t),i=this.mergedData.getNode(t),r=this.pendingPuts.subTree(t),o=!1,a=r;null!==a;){if(null!==a.getValue()){o=!0;break}a=a.parent()}if(o)return!1;var u=e.mergeSnapshotNodes_(n,i,r);return u!==i&&(this.mergedData.updateSnapshot(t,u),!0)}},{key:"set",value:function(e,t){var n=this,i=[];return(0,_.forEach)(t,function(e){var t=e.path,r=e.node,o=p.LUIDGenerator();n.pendingPuts.subTree(t).setValue(o),n.mergedData.updateSnapshot(t,r),i.push({path:t,setId:o})}),i}},{key:"setCompleted",value:function(e){var t=this;(0,_.forEach)(e,function(e){var n=e.setId,i=e.path,r=t.pendingPuts.subTree(i),o=r.getValue();null!==o&&o===n&&r.setValue(null)})}},{key:"forgetPath",value:function(e,t){for(var n=[],i=0;i<t.length;++i)n[i]=this.serverData.getNode(t[i]);for(this.serverData.updateSnapshot(e,v.EMPTY_NODE),i=0;i<t.length;++i)this.serverData.updateSnapshot(t[i],n[i]);return this.mergeServerAndPendingData(e)}}],[{key:"mergeSnapshotNodes_",value:function(t,n,i){return i.isEmpty()?t:null!==i.getValue()?n:(t=t||v.EMPTY_NODE,i.forEachChild(function(r){var o=r.name(),a=t.getImmediateChild(o),u=n.getImmediateChild(o),s=i.subTree(o),l=e.mergeSnapshotNodes_(a,u,s);t=t.updateImmediateChild(o,l)}),t)}}]),e}();t.default=y},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(4),l=n(5),c=function(){function e(){(0,o.default)(this,e),this.counters_={}}return(0,u.default)(e,[{key:"incrementCounter",value:function(e,t){(0,s.isDef)(t)||(t=1),(0,l.contains)(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}},{key:"get",value:function(){return(0,l.clone)(this.counters_)}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){(function(i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o),u=n(2),s=r(u),l=n(68),c=r(l),d=n(8),h=n(5),f=1e4,p=3e4,v=3e5,_=function(){function e(t,n){(0,a.default)(this,e),this.statsToReport_={},this.statsListener_=new c.default(t),this.connection_=n;var r=f+(p-f)*Math.random();i.setTimeout((0,d.bind)(this.reportStats_,this),Math.floor(r))}return(0,s.default)(e,[{key:"includeStat",value:function(e){this.statsToReport_[e]=!0}},{key:"reportStats_",value:function(){var e=this.statsListener_.get(),t={},n=!1;for(var r in e)e[r]>0&&(0,h.contains)(this.statsToReport_,r)&&(t[r]=e[r],n=!0);n&&this.connection_.reportStats(t),i.setTimeout((0,d.bind)(this.reportStats_,this),Math.floor(2*Math.random()*v))}}]),e}();t.default=_,e.exports=t.default}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=function(){function e(t){(0,u.default)(this,e),this.domStorage_=t,this.prefix_="webcom:"}return(0,l.default)(e,[{key:"isInMemoryStorage",get:function(){return!1}}]),(0,l.default)(e,[{key:"set",value:function(e,t){null===t?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),(0,o.default)(t))}},{key:"get",value:function(e){var t=this.domStorage_.getItem(this.prefixedName_(e));return null===t?null:JSON.parse(t)}},{key:"remove",value:function(e){this.domStorage_.removeItem(this.prefixedName_(e))}},{key:"prefixedName_",value:function(e){return this.prefix_+e}}]),e}();t.default=c,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(5),l=function(){function e(){(0,o.default)(this,e),this.cache_={}}return(0,u.default)(e,[{key:"isInMemoryStorage",get:function(){return!0}}]),(0,u.default)(e,[{key:"set",value:function(e,t){null===t?delete this.cache_[e]:this.cache_[e]=t}},{key:"get",value:function(e){return(0,s.contains)(this.cache_,e)?this.cache_[e]:null}},{key:"remove",value:function(e){delete this.cache_[e]}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";function i(e){var t=e===a;a=e;for(var n=new Array(8),i=7;i>=0;i--)n[i]=o.charAt(e%64),e=Math.floor(e/64);(0,r.assert)(0===e,"Cannot push at time == 0");var s=n.join("");if(t){for(i=11;i>=0&&63===u[i];i--)u[i]=0;u[i]++}else for(i=0;i<12;i++)u[i]=Math.floor(64*Math.random());for(i=0;i<12;i++)s+=o.charAt(u[i]);return(0,r.assert)(20===s.length,"NextPushId: Length should be 20."),s}Object.defineProperty(t,"__esModule",{value:!0}),t.NextPushId=i;var r=n(3),o="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",a=0,u=[];t.default={NextPushId:i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){},e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(9),a=i(o),u=n(1),s=i(u),l=n(19),c=i(l),d=n(2),h=i(d),f=n(18),p=i(f),v=n(71),_=i(v),y=n(3),g=function(e){function t(){(0,s.default)(this,t);var e=(0,c.default)(this,(t.__proto__||(0,a.default)(t)).call(this,["online"]));if("undefined"!=typeof window&&"undefined"!=typeof window.addEventListener){var n=e;window.addEventListener("online",function(){n.online_||n.trigger("online",!0),n.online_=!0},!1),window.addEventListener("offline",function(){n.online_&&n.trigger("online",!1),n.online_=!1},!1)}return e}return(0,p.default)(t,e),(0,h.default)(t,null,[{key:"getInstance",value:function(){return r||(r=new t),r}}]),(0,h.default)(t,[{key:"getInitialEvent",value:function(e){return(0,y.assert)("online"===e,"Unknown event type: "+e),void 0===this.online_&&("undefined"!=typeof window&&window.initialEvent?this.online_=!!window.initialEvent.online:this.online_=!0),[this.online_]}}]),t}(_.default);t.default=g,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e){return e=e||{},e.timestamp=e.timestamp||Date.now(),e}function o(e,t){return e&&"object"===("undefined"==typeof e?"undefined":(0,l.default)(e))?((0,_.assert)(".sv"in e,"Unexpected leaf node or priority contents"),t[e[".sv"]]):e}function a(e,t){var n=new v.default;return e.forEachTree(new f.default(""),function(e,i){n.remember(e,u(i,t))}),n}function u(e,t){var n,i=o(e.getPriority(),t);if(e.isLeafNode()){var r=o(e.getValue(),t);return r!==e.getValue()||i!==e.getPriority()?new d.default(r,i):e}return n=e,i!==e.getPriority()&&(n=n.updatePriority(i)),e.forEachChild(function(e,i){var r=u(i,t);r!==i&&(n=n.updateImmediateChild(e,r))}),n}Object.defineProperty(t,"__esModule",{value:!0});var s=n(6),l=i(s);t.generateWithValues=r,t.resolveDeferredValue=o,t.resolveDeferredValueTree=a,t.resolveDeferredValueSnapshot=u;var c=n(34),d=i(c),h=n(10),f=i(h),p=n(66),v=i(p),_=n(3);t.default={generateWithValues:r,resolveDeferredValue:o,resolveDeferredValueSnapshot:u,resolveDeferredValueTree:a}},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(9),a=i(o),u=n(1),s=i(u),l=n(19),c=i(l),d=n(2),h=i(d),f=n(18),p=i(f),v=n(71),_=i(v),y=n(3),g=function(e){function t(){(0,s.default)(this,t);var e,n,e,n,i=(0,c.default)(this,(t.__proto__||(0,a.default)(t)).call(this,["visible"]));if("undefined"!=typeof document&&"undefined"!=typeof document.addEventListener&&("undefined"!=typeof document.hidden?(n="visibilitychange",e="hidden"):"undefined"!=typeof document.mozHidden?(n="mozvisibilitychange",e="mozHidden"):"undefined"!=typeof document.msHidden?(n="msvisibilitychange",e="msHidden"):"undefined"!=typeof document.webkitHidden&&(n="webkitvisibilitychange",e="webkitHidden")),i.visible_=!0,n){var r=i;document.addEventListener(n,function(){var t=!document[e];t!==r.visible_&&(r.visible_=t,r.trigger("visible",t))},!1)}return i}return(0,p.default)(t,e),(0,h.default)(t,null,[{key:"getInstance",value:function(){return r||(r=new t),r}}]),(0,h.default)(t,[{key:"getInitialEvent",value:function(e){return(0,y.assert)("visible"===e,"Unknown event type: "+e),[this.visible_]}}]),t}(_.default);t.default=g,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=n(19),d=i(c),h=n(18),f=i(h),p=n(73),v=i(p),_=n(36),y=i(_),g=function(e){function t(e,n){(0,u.default)(this,t);var i=(0,d.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e));return i.snapshotNode_=n,i}return(0,f.default)(t,e),(0,l.default)(t,[{key:"processChanges_",value:function(e,t){return this.snapshotNode_=e,this.isComplete_&&null!==t&&t.push(new y.default("value",this.snapshotNode_)),t}},{key:"getChildRelevance",value:function(e,t,n){return{}}}]),t}(v.default);t.default=g,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=i(r),a=n(2),u=i(a),s=n(8),l=function(){function e(){(0,o.default)(this,e),this.events=[]}return(0,u.default)(e,[{key:"queueEvents",value:function(e){if(0!==e.length)for(var t=0;t<e.length;t++)this.events.push(e[t])}},{key:"raiseQueuedEvents",value:function(){for(var e=0;e<this.events.length;e++)if(this.events[e]){var t=this.events[e];this.events[e]=null,this.raiseEvent_(t)}this.events=[]}},{key:"raiseEvent_",value:function(e){var t=e.callback,n=e.snapshot,i=e.prevName;(0,s.exceptionGuard)(function(){t(n,i)})}}]),e}();t.default=l,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=i(r),a=n(1),u=i(a),s=n(2),l=i(s),c=n(19),d=i(c),h=n(18),f=i(h),p=n(70),v=i(p),_=n(16),y=function(e){function t(){(0,u.default)(this,t);var e=(0,d.default)(this,(t.__proto__||(0,o.default)(t)).call(this));return e.stopListener_=null,e.path_=null,e}return(0,f.default)(t,e),(0,l.default)(t,[{key:"setActive",value:function(e){this.stopListener_=e}},{key:"isActive",value:function(){return null!==this.stopListener_}},{key:"setView",value:function(e,t){this.add(e,t),this.path_||(this.path_=t.getQuery().path)}},{key:"deactivate",value:function(){this.stopListener_&&this.stopListener_(),this.stopListener_=null}},{key:"removeStopListener",value:function(){var e=this.stopListener_;return this.stopListener_=null,e}},{key:"hasDefaultQuery",value:function(){return this.contains("default")}},{key:"hasActiveDefaultQuery",value:function(){return null!==this.stopListener_&&this.hasDefaultQuery()}},{key:"defaultView",value:function(){return this.hasDefaultQuery()?this.get("default"):null}},{key:"path",value:function(){return this.path_}},{key:"toString",value:function(){return(0,_.map)(this.keys(),function(e){return"default"===e?"{}":e}).join("$")}},{key:"queries",value:function e(){var e=[];return this.each(function(t,n){e.push(n.getQuery())}),e}}]),t}(v.default);t.default=y,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(9),o=i(r),a=n(1),u=i(a),s=n(19),l=i(s),c=n(2),d=i(c),h=n(18),f=i(h),p=n(73),v=i(p),_=n(36),y=i(_),g=n(72),m=i(g),b=n(10),k=i(b),C=n(35),w=i(C),E=n(24),S=n(3),P=n(5),N=n(4),O=function(e){function t(e,n){(0,u.default)(this,t);var i=(0,l.default)(this,(t.__proto__||(0,o.default)(t)).call(this,e));return i.snapshotNode_=E.EMPTY_NODE,i.processChanges_(n,i.generateChangesForSnapshot(n)),i}return(0,f.default)(t,e),
(0,d.default)(t,null,[{key:"ENTERING_VIEW",get:function(){return 1}},{key:"LEAVING_VIEW",get:function(){return 2}},{key:"IN_VIEW",get:function(){return 3}},{key:"OUT_OF_VIEW",get:function(){return 4}}]),(0,d.default)(t,[{key:"processChanges_",value:function(e,t){if(null===t)return t;var n=[],i=this.query_;(0,N.isDef)(i.startName)&&null!==i.startName&&n.push(function(e){return(0,S.nameCompare)(e,i.startName)>=0}),(0,N.isDef)(i.endName)&&n.push(function(e){return(0,S.nameCompare)(e,i.endName)<=0});var r=null,o=null;(0,N.isDef)(this.query_.itemLimit)&&(o=this.getLimitName_(e,n,this.query_.itemLimit,!0),o&&n.push(function(e){return(0,S.nameCompare)(e,o)>=0}));for(var a=[],u=[],s=[],l=[],c=0;c<t.length;c++){var d=t[c].type,h=t[c].childName,f=t[c].snapshotNode;switch(d){case y.default.CHILD_ADDED:this.meetsConstraints_(n,h,f)&&(this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,f),u.push(t[c]));break;case y.default.CHILD_REMOVED:this.snapshotNode_.getImmediateChild(h).isEmpty()||(this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,null),a.push(t[c]));break;case y.default.CHILD_CHANGED:!this.snapshotNode_.getImmediateChild(h).isEmpty()&&this.meetsConstraints_(n,h,f)&&(this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,f),l.push(t[c]));break;case y.default.CHILD_MOVED:var p=!this.snapshotNode_.getImmediateChild(h).isEmpty(),v=this.meetsConstraints_(n,h,f);p?v?(this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,f),s.push(t[c])):(a.push(new y.default("child_removed",this.snapshotNode_.getImmediateChild(h),h)),this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,null)):v&&(this.snapshotNode_=this.snapshotNode_.updateImmediateChild(h,f),u.push(t[c]))}}var _=r||o;if(_){var g=null!==o,m=g?this.snapshotNode_.getFirstChildName():this.snapshotNode_.getLastChildName(),b=g?e.forEachChildReverse:e.forEachChild,k=!1,C=!1,w=this;b.call(e,function(e,t){return C||null!==m||(C=!0),!(!C||!k)||(k?(a.push(new y.default("child_removed",w.snapshotNode_.getImmediateChild(e),e)),w.snapshotNode_=w.snapshotNode_.updateImmediateChild(e,null)):C&&(u.push(new y.default("child_added",t,e)),w.snapshotNode_=w.snapshotNode_.updateImmediateChild(e,t)),m===e&&(C=!0),void(e===_&&(k=!0)))})}var E,P;for(c=0;c<u.length;c++)E=u[c],P=this.snapshotNode_.getPredecessorChildName(E.childName,E.snapshotNode),a.push(new y.default("child_added",E.snapshotNode,E.childName,P));for(c=0;c<s.length;c++)E=s[c],P=this.snapshotNode_.getPredecessorChildName(E.childName,E.snapshotNode),a.push(new y.default("child_moved",E.snapshotNode,E.childName,P));for(c=0;c<l.length;c++)E=l[c],P=this.snapshotNode_.getPredecessorChildName(E.childName,E.snapshotNode),a.push(new y.default("child_changed",E.snapshotNode,E.childName,P));return this.isComplete_&&a.length>0&&a.push(new y.default("value",this.snapshotNode_)),a}},{key:"getLimitName_",value:function(e,t,n,i){if(e.isLeafNode())return null;var r=i?e.forEachChildReverse:e.forEachChild,o=this,a=null;return r.call(e,function(e,i){if(o.meetsConstraints_(t,e,i)&&(a=e,n--,0===n))return!0}),a}},{key:"meetsConstraints_",value:function(e,t,n){for(var i=0;i<e.length;i++)if(!e[i](t,n.getPriority()))return!1;return!0}},{key:"hasChild",value:function(e){return this.snapshotNode_.getImmediateChild(e)!==E.EMPTY_NODE}},{key:"getChildRelevance",value:function(e,n,i){var r={};this.snapshotNode_.isLeafNode()||this.snapshotNode_.forEachChild(function(e){r[e]=t.IN_VIEW});var o=this.snapshotNode_,a=i.getNode(new k.default("")),u=new w.default,s=this.query_.path,l=u.subTree(s);l.setValue(!0);var c=E.EMPTY_NODE.updateChild(e,n),d=this,h=function(e,t,n){null!==n&&e.toString()===d.query_.path.toString()&&d.processChanges_(t,n)};return m.default.Diff(a,c,e,u,h),this.snapshotNode_.isLeafNode()?(0,P.forEach)(r,function(e,n){r[n]=t.LEAVING_VIEW}):(this.snapshotNode_.forEachChild(function(e){(0,P.contains)(r,e)||(r[e]=t.ENTERING_VIEW)}),(0,P.forEach)(r,function(e,n){d.snapshotNode_.getImmediateChild(n).isEmpty()&&(r[n]=t.LEAVING_VIEW)})),this.snapshotNode_=o,r}}]),t}(v.default);t.default=O,e.exports=t.default},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t){var n,i,r,o={},l=arguments.length;if(2===l)n=e,i=t;else if(1===l)if("object"===("undefined"==typeof e?"undefined":(0,a.default)(e))&&e.code&&e.message){if(0===e.message.indexOf(u))return e;n=e.code,i=e.message,o=e.data}else"string"==typeof e&&(n=e,i=s[n]);else n="UNKNOWN_ERROR",i=s[n];try{r=new Error(u+i)}catch(e){}return r.code=n,o&&(r.data=o),r}Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),a=i(o);t.format=r;var u="WebcomSimpleLogin: ",s={UNKNOWN_ERROR:"An unknown error occurred.",INVALID_EMAIL:"Invalid email specified.",INVALID_PASSWORD:"Invalid password specified.",USER_DENIED:"User cancelled the authentication request.",RESPONSE_PAYLOAD_ERROR:"Unable to parse response payload.",TRIGGER_IO_TABS:'The "forge.tabs" module required when using Webcom Simple Login and Trigger.io. Without this module included and enabled, login attempts to OAuth authentication providers will not be able to complete.'};t.default={format:r}},function(e,t,n){"use strict";function i(e){a.PersistentStorage.set(u,e)}function r(){return a.PersistentStorage.get(u)}function o(){a.PersistentStorage.remove(u)}Object.defineProperty(t,"__esModule",{value:!0}),t.set=i,t.get=r,t.clear=o;var a=n(12),u="session";t.default={set:i,get:r,clear:o}},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e,t,n){T("/v2/"+e+"/anonymous/signin",1,t,n)}function o(e,t,n){t.options={method:"POST"},T("/v2/"+e+"/password/signin",1,t,n)}function a(e,t,n){var i={options:{method:"POST",contentType:"application/json"},json:t};T("/v2/"+e+"/phone/signin",0,i,n)}function u(e,t,n){t.options={method:"POST"},T("/v2/"+e+"/custom."+t.provider+"/signin",1,t,n)}function s(e,t,n){t.options={method:"POST"},T("/v2/"+e+"/password/identities/"+encodeURIComponent(t.email),7,t,n)}function l(e,t,n){t.options={method:"POST",contentType:"application/json"},t.json=t.details,T("/v2/"+e+"/"+t.provider+"/identities?"+(0,O.formatQueryString)(t.message),0,t,n)}function c(e,t,n){t.options={method:"POST",contentType:"application/json"},t.json={},T("/v2/"+e+"/"+t.provider+"/identities/"+t.id+"/reset",0,t,n)}function d(e,t,n){t.options={method:"POST",contentType:"aplication/json"},t.json={},T("/v2/"+e+"/"+t.provider+"/identities/"+t.id+"/sendVerification",0,t,n)}function h(e,t,n){t.options={method:"DELETE",headers:{Authorization:"Bearer "+t.token}},T("/v2/"+e+"/"+t.provider+"/identities/"+t.id,0,t,n)}function f(e,t,n){t.options={method:"DELETE",headers:{Authorization:"Bearer "+t.token}},T("/v2/"+e+"/accounts/"+t.uid,0,t,n)}function p(e,t,n){t.options={method:"POST",contentType:"application/json"},t.json=t.verificationData,T("/v2/"+e+"/"+t.provider+"/identities/"+t.id+"/verify",0,t,n)}function v(e,t,n){t.options={method:"PUT",contentType:"application/json",headers:{Authorization:"Bearer "+t.token}},T("/v2/"+e+"/"+t.provider+"/identities/"+encodeURIComponent(t.id)+"/providerProfile/"+t.path,0,t,n)}function _(e,t,n){t.options={method:"PUT"},T("/v2/"+e+"/password/identities/"+encodeURIComponent(t.email)+"/password",15,t,n)}function y(e,t,n){t.base=e,T("/base/remove",7,t,n)}function g(e,t,n){T("/v2/"+e+"/password/identities/"+encodeURIComponent(t.email)+"/reset",3,t,n)}function m(e,t,n){T("/v2/"+e+"/password/identities/"+encodeURIComponent(t.email)+"/resendConfirmation",3,t,n)}function b(e,t,n){t.options={method:"POST",contentType:"application/json"},t.json=t.id,T("/v2/"+e+"/"+t.provider+"/otps?"+(0,O.formatQueryString)(t.message),0,t,n)}Object.defineProperty(t,"__esModule",{value:!0}),t.anonymous=r,t.login=o,t.authWithPhone=a,t.custom=u,t.createUser=s,t.addAccount=l,t.sendPasswordResetCode=c,t.sendVerificationCode=d,t.removeIdentity=h,t.removeAccount=f,t.verifyIdentity=p,t.updateIdentityProfile=v,t.changePassword=_,t.removeUser=y,t.sendPasswordResetEmail=g,t.sendConfirmationEmail=m,t.sendOtp=b;var k=n(37),C=n(11),w=i(C),E=n(76),S=i(E),P=n(75),N=i(P),O=n(13),A=function(){return S.isAvailable()?S:N},T=function(e,t,n,i){var r=(0,k.getApiHost)()+"/auth"+e,o=2&t,a=4&t,u=8&t;return o&&!w.isValidEmail(n.email)?i&&i("INVALID_EMAIL"):a&&!w.isValidPassword(u?n.newPassword:n.password)?i&&i("INVALID_PASSWORD"):void A().open(r,n,i)}},function(e,t,n){"use strict";function i(e,t){var n=t.options||{},i=(n.method||"GET").toUpperCase();delete t.options,(0,o.validateHttpMethod)(["GET"],i,e,"JSONP")&&(window.location=(0,r.addQueryParameters)(e,t))}Object.defineProperty(t,"__esModule",{value:!0}),t.open=i;var r=n(13),o=n(11);t.default={open:i}},function(e,t,n){(function(e){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener&&e.addEventListener(t,n,!1)}function o(e,t,n){e.detachEvent?e.detachEvent("on"+t,n):e.removeEventListener&&e.removeEventListener(t,n,!1)}function a(e){/^https?:\/\//.test(e)||(e=window.location.href);var t=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(e);return t?t[1]:e}function u(){for(var e=window.location,t=window.opener.frames,n=e.protocol+"//"+e.host,i=t.length-1;i>=0;i--)try{if(0===t[i].location.href.indexOf(n)&&t[i].name===y)return t[i]}catch(e){}}function s(e,t,n){var i=function(){return n?e?t.method&&"GET"!==t.method.toUpperCase()?"only GET method is supported":t.relay_url?void 0:"missing required 'relay_url' parameter":"missing required 'url' parameter":"missing required callback argument"};return(0,_.validateWithCallback)(n,function(){var e=i();if(e)return{code:"CLIENT_ERROR",message:"Transport WinChan: "+e}})}function l(t,n,i){function u(t){if(d&&document.body.removeChild(d),d=void 0,k&&(k=e.clearInterval(k)),o(window,"message",l),o(window,"unload",u),b&&!t)try{b.close()}catch(e){_.postMessage(g,h)}b=_=void 0}function l(e){try{if(e.origin!==h)return u(),void(i&&(i({code:"INVALID_ORIGIN",message:"The origin of the popup window is unexpected: '"+e.origin+"' instead of '"+h+"'."}),i=null));var t=JSON.parse(e.data);"ready"===t.a?_.postMessage(C,h):"error"===t.a?(u(),i&&(i(t.d),i=null)):"response"===t.a&&(u(t.forceKeepWindowOpen),i&&(i(null,t.d),i=null))}catch(e){}}var c=n.options||{};if(delete n.options,s(t,c,i)){t=(0,v.addQueryParameters)(t,n),c.window_name||(c.window_name=null),c.window_features&&!(0,p.isFennec)()||(c.window_features=void 0);var d,h=a(t);if(h!==a(c.relay_url))return e.setTimeout(function(){i("invalid arguments: origin of url and relay_url must match")},0);var _;m&&(d=document.createElement("iframe"),d.setAttribute("src",c.relay_url),d.style.display="none",d.setAttribute("name",y),document.body.appendChild(d),_=d.contentWindow);var b=window.open(t,c.window_name,c.window_features);_||(_=b);var k=e.setInterval(function(){b&&b.closed&&(u(),i&&(i("unknown closed window"),i=null))},500),C=(0,f.default)({a:"request",d:c.params});return r(window,"unload",u),r(window,"message",l),{close:u,focus:function(){if(b)try{b.focus()}catch(e){}}}}}function c(t){function n(e){e=(0,f.default)(e),m?l.doPost(e,s):l.postMessage(e,s)}function i(r){var a;try{a=JSON.parse(r.data)}catch(e){}a&&"request"===a.a&&(o(window,"message",i),s=r.origin,t&&e.setTimeout(function(){t(s,a.d,function(e,i){c=!i,t=void 0,n({a:"response",d:e,forceKeepWindowOpen:i})})},0))}function a(e){if(c&&e.data===g)try{window.close()}catch(e){}}var s="*",l=m?u():window.opener,c=!0;if(!l)throw"can't find relay frame";r(m?l:window,"message",i),r(m?l:window,"message",a);try{n({a:"ready"})}catch(e){r(l,"load",function(){n({a:"ready"})})}var d=function(){try{o(m?l:window,"message",a)}catch(e){}t&&n({a:"error",d:"client closed window"}),t=void 0;try{window.close()}catch(e){}};return r(window,"unload",d),{detach:function(){o(window,"unload",d)}}}function d(){return JSON&&JSON.parse&&f.default&&window.postMessage}Object.defineProperty(t,"__esModule",{value:!0});var h=n(17),f=i(h);t.open=l,t.onOpen=c,t.isAvailable=d;var p=n(4),v=n(13),_=n(11),y="__winchan_relay_frame",g="die",m=function(){var e,t,n=-1,i="undefined"!=typeof navigator?navigator.userAgent||"":"";return"undefined"!=typeof navigator&&"Microsoft Internet Explorer"===navigator.appName?(e=/MSIE ([0-9]+[\.0-9]*)/,t=i.match(e),t&&t.length>1&&(n=parseFloat(t[1]))):i.indexOf("Trident")>-1&&(e=/rv:([0-9]{2}[\.0-9]*)/,t=i.match(e),t&&t.length>1&&(n=parseFloat(t[1]))),n>=8}();t.default={open:l,onOpen:c,isAvailable:d}}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o),u=n(2),s=r(u),l=n(116),c=r(l),d=n(3),h=i(d),f=[c.default],p=function(){function e(t){(0,a.default)(this,e),this.initTransports_(t)}return(0,s.default)(e,[{key:"initTransports_",value:function(e){var t=c.default&&c.default.isAvailable(),n=t&&!c.default.previouslyFailed();if(e.webSocketOnly&&(t||h.warn("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[c.default];else{var i=this.transports_=[];h.each(f,function(e,t){t&&t.isAvailable()&&i.push(t)})}}},{key:"initialTransport",value:function(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")}},{key:"upgradeTransport",value:function(){return this.transports_.length>1?this.transports_[1]:null}}]),e}();t.default=p,e.exports=t.default},function(e,t,n){(function(i){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),u=o(a),s=n(1),l=o(s),c=n(2),d=o(c),h=n(78),f=r(h),p=n(69),v=n(102),_=(o(v),n(3)),y=r(_),g=n(12),m=16384,b=45e3,k=null;"undefined"!=typeof MozWebSocket?k=MozWebSocket:"undefined"!=typeof WebSocket&&(k=WebSocket);var C=!1,w=function(){function e(t,n,i){(0,l.default)(this,e),this.connId=t,this.log_=y.logWrapper(this.connId),this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.stats_=(0,p.getCollection)(n),this.connURL=(n.secure?"wss://":"ws://")+n.internalHost+"/.ws?"+f.VERSION_PARAM+"="+f.PROTOCOL_VERSION,n.needsQueryParam()&&(this.connURL=this.connURL+"&ns="+n.namespace),i&&(this.connURL=this.connURL+"&"+f.SESSION_PARAM+"="+i)}return(0,d.default)(e,[{key:"responsesRequiredToBeHealthy",get:function(){return 2}},{key:"healthyTimeout",get:function(){return 3e4}}]),(0,d.default)(e,[{key:"open",value:function(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.mySock=new k(this.connURL),this.everConnected_=!1,g.PersistentStorage.set("previous_websocket_failure",!0);var n=this;this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(e){n.log_("Websocket connection was disconnected: "+e.code),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(e){n.log_("Websocket received a message"),n.handleIncomingFrame(e)},this.mySock.onerror=function(e){n.log_("WebSocket error. Closing connection.");var t=e.message||e.data;t&&n.log_(t),n.onClosed_()}}},{key:"start",value:function(){}},{key:"markConnectionHealthy",value:function(){g.PersistentStorage.remove("previous_websocket_failure")}},{key:"appendFrame_",value:function(e){if(this.frames.push(e),this.frames.length===this.totalFrames){var t=this.frames.join("");this.frames=null;var n=JSON.parse(t);this.onMessage(n)}}},{key:"handleNewFrameCount_",value:function(e){this.totalFrames=e,this.frames=[]}},{key:"extractFrameCount_",value:function(e){if(y.assert(null===this.frames,"We already have a frame buffer"),e.length<=6){var t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}},{key:"handleIncomingFrame",value:function(e){if(null!==this.mySock){var t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(t);else{var n=this.extractFrameCount_(t);null!==n&&this.appendFrame_(n)}}}},{key:"send",value:function(e){this.resetKeepAlive(),this.log_("Sending data");var t=(0,u.default)(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var n=y.splitStringBySize(t,m);n.length>1&&this.mySock.send(String(n.length));for(var i=0;i<n.length;i++)this.mySock.send(n[i])}},{key:"shutdown_",value:function(){this.isClosed_=!0,this.keepaliveTimer&&(i.clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}},{key:"onClosed_",value:function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}},{key:"close",value:function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}},{key:"resetKeepAlive",value:function(){var e=this;i.clearInterval(this.keepaliveTimer),this.keepaliveTimer=i.setInterval(function(){e.mySock&&e.mySock.send("0"),e.resetKeepAlive()},Math.floor(b))}}],[{key:"forceDisallow",value:function(){C=!0}},{key:"isAvailable",value:function(){var e=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var t=/Android ([0-9]*\.[0-9]*)/,n=navigator.userAgent.match(t);n&&n.length>1&&parseFloat(n[1])<4.4&&(e=!0)}return!e&&null!==k&&!C}},{key:"previouslyFailed",value:function(){return g.PersistentStorage.isInMemoryStorage||g.PersistentStorage.get("previous_websocket_failure")===!0}}]),e}();t.default=w,e.exports=t.default}).call(t,function(){return this}())},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.exception=void 0;var r=n(1),o=i(r),a=n(2),u=i(a),s=function(){function e(t){(0,o.default)(this,e),this.message=t}return(0,u.default)(e,[{key:"toString",value:function(){return"CORRUPT: "+this.message}}]),e}(),l=function(){function e(t){(0,o.default)(this,e),this.message=t}return(0,u.default)(e,[{key:"toString",value:function(){return"INVALID: "+this.message}}]),e}(),c=function(){function e(t){(0,o.default)(this,e),this.message=t}return(0,u.default)(e,[{key:"toString",value:function(){return"BUG: "+this.message}}]),e}(),d=function(){function e(t){(0,o.default)(this,e),this.message=t}return(0,u.default)(e,[{key:"toString",value:function(){return"NOT READY: "+this.message}}]),e}(),h=t.exception={corrupt:s,invalid:l,bug:c,notReady:d};t.default={exception:h}},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e,t,n){var i,r="",o=0,a=l,s=0,c=u.bitLength(e);for(n&&(a=a.substr(0,62)+"-_"),i=0;6*r.length<c;)r+=a.charAt((s^e[i]>>>o)>>>26),o<6?(s=e[i]<<6-o,o+=26,i++):(s<<=6,o-=6);for(;3&r.length&&!t;)r+="=";return r}function o(e,t){e=e.replace(/\s|=/g,"");var n,i,r=[],o=0,a=l,c=0;for(t&&(a=a.substr(0,62)+"-_"),n=0;n<e.length;n++){if(i=a.indexOf(e.charAt(n)),i<0)throw new s.exception.invalid("this isn't base64!");o>26?(o-=26,r.push(c^i>>>o),c=i<<32-o):(o+=6,c^=i<<32-o)}return 56&o&&r.push(u.partial(56&o,c,1)),r}Object.defineProperty(t,"__esModule",{value:!0}),t.fromBits=r,t.toBits=o;var a=n(43),u=i(a),s=n(117),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){var t,n,i="",r=u.bitLength(e);for(t=0;t<r/8;t++)0===(3&t)&&(n=e[t/4]),i+=String.fromCharCode(n>>>24),n<<=8;return decodeURIComponent(escape(i))}function o(e){e=unescape(encodeURIComponent(e));var t,n=[],i=0;for(t=0;t<e.length;t++)i=i<<8|e.charCodeAt(t),3===(3&t)&&(n.push(i),i=0);return 3&t&&n.push(u.partial(8*(3&t),i)),n}Object.defineProperty(t,"__esModule",{value:!0}),t.fromBits=r,t.toBits=o;var a=n(43),u=i(a)},function(e,t,n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.sha1=void 0;var o=n(1),a=r(o),u=n(2),s=r(u),l=n(43),c=i(l),d=n(119),h=512,f=[1732584193,4023233417,2562383102,271733878,3285377520],p=[1518500249,1859775393,2400959708,3395469782],v=t.sha1=function(){function e(t){(0,a.default)(this,e),t?(this._h=t._h.slice(0),this._buffer=t._buffer.slice(0),this._length=t._length):this.reset()}return(0,s.default)(e,[{key:"reset",value:function(){return this._h=f.slice(0),this._buffer=[],this._length=0,this}},{key:"update",value:function(e){"string"==typeof e&&(e=(0,d.toBits)(e));var t,n=this._buffer=c.concat(this._buffer,e),i=this._length,r=this._length=i+c.bitLength(e);for(t=h+i&-h;t<=r;t+=h)this._block(n.splice(0,16));return this}},{key:"finalize",value:function(){var e,t=this._buffer,n=this._h;for(t=c.concat(t,[c.partial(1,1)]),e=t.length+2;15&e;e++)t.push(0);for(t.push(Math.floor(this._length/4294967296)),t.push(0|this._length);t.length;)this._block(t.splice(0,16));return this.reset(),n}},{key:"_f",value:function(e,t,n,i){return e<=19?t&n|~t&i:e<=39?t^n^i:e<=59?t&n|t&i|n&i:e<=79?t^n^i:void 0}},{key:"_S",value:function(e,t){return t<<e|t>>>32-e}},{key:"_block",value:function(e){var t,n,i,r,o,a,u,s=e.slice(0),l=this._h;for(i=l[0],r=l[1],o=l[2],a=l[3],u=l[4],t=0;t<=79;t++)t>=16&&(s[t]=this._S(1,s[t-3]^s[t-8]^s[t-14]^s[t-16])),n=this._S(5,i)+this._f(t,r,o,a)+u+s[t]+p[Math.floor(t/20)]|0,u=a,a=o,o=this._S(30,r),r=i,i=n;l[0]=l[0]+i|0,l[1]=l[1]+r|0,l[2]=l[2]+o|0,l[3]=l[3]+a|0,l[4]=l[4]+u|0}}],[{key:"hash",value:function(t){return(new e).update(t).finalize()}}]),e}();t.default=v},function(e,t,n){"use strict";function i(e){for(var t,n,i,o=[],a=0,u=0;u<e.length;u++)t=e.charCodeAt(u),t>=55296&&t<=56319&&(n=t-55296,u++,(0,r.assert)(u<e.length,"Surrogate pair missing trail surrogate."),i=e.charCodeAt(u)-56320,t=65536+(n<<10)+i),t<128?o[a++]=t:t<2048?(o[a++]=t>>6|192,o[a++]=63&t|128):t<65536?(o[a++]=t>>12|224,o[a++]=t>>6&63|128,o[a++]=63&t|128):(o[a++]=t>>18|240,o[a++]=t>>12&63|128,o[a++]=t>>6&63|128,o[a++]=63&t|128);return o}Object.defineProperty(t,"__esModule",{value:!0}),t.stringToByteArray=i;var r=n(3);t.default={stringToByteArray:i}},function(e,t,n){e.exports={default:n(130),__esModule:!0}},function(e,t,n){e.exports={default:n(131),__esModule:!0}},function(e,t,n){e.exports={default:n(132),__esModule:!0}},function(e,t,n){e.exports={default:n(135),__esModule:!0}},function(e,t,n){e.exports={default:n(136),__esModule:!0}},function(e,t,n){e.exports={default:n(137),__esModule:!0}},function(e,t,n){var i=n(7),r=i.JSON||(i.JSON={stringify:JSON.stringify});e.exports=function(e){return r.stringify.apply(r,arguments)}},function(e,t,n){n(156),e.exports=n(7).Object.assign},function(e,t,n){n(157);var i=n(7).Object;e.exports=function(e,t){return i.create(e,t)}},function(e,t,n){n(158);var i=n(7).Object;e.exports=function(e,t,n){return i.defineProperty(e,t,n)}},function(e,t,n){n(159);var i=n(7).Object;e.exports=function(e,t){return i.getOwnPropertyDescriptor(e,t)}},function(e,t,n){n(160),e.exports=n(7).Object.getPrototypeOf},function(e,t,n){n(161),e.exports=n(7).Object.keys},function(e,t,n){n(162),e.exports=n(7).Object.setPrototypeOf},function(e,t,n){n(165),n(163),n(166),n(167),e.exports=n(7).Symbol},function(e,t,n){n(164),n(168),e.exports=n(60).f("iterator")},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t){e.exports=function(){}},function(e,t,n){var i=n(15),r=n(154),o=n(153);e.exports=function(e){return function(t,n,a){var u,s=i(t),l=r(s.length),c=o(a,l);if(e&&n!=n){for(;l>c;)if(u=s[c++],u!=u)return!0}else for(;l>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var i=n(28),r=n(52),o=n(38);e.exports=function(e){var t=i(e),n=r.f;if(n)for(var a,u=n(e),s=o.f,l=0;u.length>l;)s.call(e,a=u[l++])&&t.push(a);return t}},function(e,t,n){e.exports=n(14).document&&document.documentElement},function(e,t,n){var i=n(80);e.exports=Array.isArray||function(e){return"Array"==i(e)}},function(e,t,n){"use strict";var i=n(50),r=n(39),o=n(54),a={};n(27)(a,n(29)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(a,{next:r(1,n)}),o(e,t+" Iterator")}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){var i=n(28),r=n(15);e.exports=function(e,t){for(var n,o=r(e),a=i(o),u=a.length,s=0;u>s;)if(o[n=a[s++]]===t)return n}},function(e,t,n){var i=n(41)("meta"),r=n(32),o=n(22),a=n(23).f,u=0,s=Object.isExtensible||function(){return!0},l=!n(26)(function(){return s(Object.preventExtensions({}))}),c=function(e){a(e,i,{value:{i:"O"+ ++u,w:{}}})},d=function(e,t){if(!r(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,i)){if(!s(e))return"F";if(!t)return"E";c(e)}return e[i].i},h=function(e,t){if(!o(e,i)){if(!s(e))return!0;if(!t)return!1;c(e)}return e[i].w},f=function(e){return l&&p.NEED&&s(e)&&!o(e,i)&&c(e),e},p=e.exports={KEY:i,NEED:!1,fastKey:d,getWeak:h,onFreeze:f}},function(e,t,n){"use strict";var i=n(28),r=n(52),o=n(38),a=n(40),u=n(84),s=Object.assign;e.exports=!s||n(26)(function(){var e={},t={},n=Symbol(),i="abcdefghijklmnopqrst";return e[n]=7,i.split("").forEach(function(e){t[e]=e}),7!=s({},e)[n]||Object.keys(s({},t)).join("")!=i})?function(e,t){for(var n=a(e),s=arguments.length,l=1,c=r.f,d=o.f;s>l;)for(var h,f=u(arguments[l++]),p=c?i(f).concat(c(f)):i(f),v=p.length,_=0;v>_;)d.call(f,h=p[_++])&&(n[h]=f[h]);return n}:s},function(e,t,n){var i=n(23),r=n(31),o=n(28);e.exports=n(20)?Object.defineProperties:function(e,t){r(e);for(var n,a=o(t),u=a.length,s=0;u>s;)i.f(e,n=a[s++],t[n]);return e}},function(e,t,n){var i=n(15),r=n(86).f,o={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],u=function(e){try{return r(e)}catch(e){return a.slice()}};e.exports.f=function(e){return a&&"[object Window]"==o.call(e)?u(e):r(i(e))}},function(e,t,n){var i=n(32),r=n(31),o=function(e,t){if(r(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,i){try{i=n(81)(Function.call,n(51).f(Object.prototype,"__proto__").set,2),i(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,n){return o(e,n),t?e.__proto__=n:i(e,n),e}}({},!1):void 0),check:o}},function(e,t,n){var i=n(57),r=n(46);e.exports=function(e){return function(t,n){var o,a,u=String(r(t)),s=i(n),l=u.length;return s<0||s>=l?e?"":void 0:(o=u.charCodeAt(s),o<55296||o>56319||s+1===l||(a=u.charCodeAt(s+1))<56320||a>57343?e?u.charAt(s):o:e?u.slice(s,s+2):(o-55296<<10)+(a-56320)+65536)}}},function(e,t,n){var i=n(57),r=Math.max,o=Math.min;e.exports=function(e,t){return e=i(e),e<0?r(e+t,0):o(e,t)}},function(e,t,n){var i=n(57),r=Math.min;e.exports=function(e){return e>0?r(i(e),9007199254740991):0}},function(e,t,n){"use strict";var i=n(139),r=n(145),o=n(48),a=n(15);e.exports=n(85)(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,r(1)):"keys"==t?r(0,n):"values"==t?r(0,e[n]):r(0,[n,e[n]])},"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(e,t,n){var i=n(21);i(i.S+i.F,"Object",{assign:n(148)})},function(e,t,n){var i=n(21);i(i.S,"Object",{create:n(50)})},function(e,t,n){var i=n(21);i(i.S+i.F*!n(20),"Object",{defineProperty:n(23).f})},function(e,t,n){var i=n(15),r=n(51).f;n(53)("getOwnPropertyDescriptor",function(){return function(e,t){return r(i(e),t)}})},function(e,t,n){var i=n(40),r=n(87);n(53)("getPrototypeOf",function(){return function(e){return r(i(e))}})},function(e,t,n){var i=n(40),r=n(28);n(53)("keys",function(){return function(e){return r(i(e))}})},function(e,t,n){var i=n(21);i(i.S,"Object",{setPrototypeOf:n(151).set})},function(e,t){},function(e,t,n){"use strict";var i=n(152)(!0);n(85)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){"use strict";var i=n(14),r=n(22),o=n(20),a=n(21),u=n(89),s=n(147).KEY,l=n(26),c=n(56),d=n(54),h=n(41),f=n(29),p=n(60),v=n(59),_=n(146),y=n(141),g=n(143),m=n(31),b=n(15),k=n(58),C=n(39),w=n(50),E=n(150),S=n(51),P=n(23),N=n(28),O=S.f,A=P.f,T=E.f,D=i.Symbol,R=i.JSON,I=R&&R.stringify,M="prototype",x=f("_hidden"),W=f("toPrimitive"),j={}.propertyIsEnumerable,L=c("symbol-registry"),F=c("symbols"),V=c("op-symbols"),U=Object[M],Q="function"==typeof D,q=i.QObject,H=!q||!q[M]||!q[M].findChild,B=o&&l(function(){return 7!=w(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a})?function(e,t,n){var i=O(U,t);i&&delete U[t],A(e,t,n),i&&e!==U&&A(U,t,i)}:A,K=function(e){var t=F[e]=w(D[M]);return t._k=e,t},G=Q&&"symbol"==typeof D.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof D},J=function(e,t,n){return e===U&&J(V,t,n),m(e),t=k(t,!0),m(n),r(F,t)?(n.enumerable?(r(e,x)&&e[x][t]&&(e[x][t]=!1),n=w(n,{enumerable:C(0,!1)})):(r(e,x)||A(e,x,C(1,{})),e[x][t]=!0),B(e,t,n)):A(e,t,n)},z=function(e,t){m(e);for(var n,i=y(t=b(t)),r=0,o=i.length;o>r;)J(e,n=i[r++],t[n]);return e},Y=function(e,t){return void 0===t?w(e):z(w(e),t)},$=function(e){var t=j.call(this,e=k(e,!0));return!(this===U&&r(F,e)&&!r(V,e))&&(!(t||!r(this,e)||!r(F,e)||r(this,x)&&this[x][e])||t)},X=function(e,t){if(e=b(e),t=k(t,!0),e!==U||!r(F,t)||r(V,t)){var n=O(e,t);return!n||!r(F,t)||r(e,x)&&e[x][t]||(n.enumerable=!0),n}},Z=function(e){for(var t,n=T(b(e)),i=[],o=0;n.length>o;)r(F,t=n[o++])||t==x||t==s||i.push(t);return i},ee=function(e){for(var t,n=e===U,i=T(n?V:b(e)),o=[],a=0;i.length>a;)!r(F,t=i[a++])||n&&!r(U,t)||o.push(F[t]);return o};Q||(D=function(){if(this instanceof D)throw TypeError("Symbol is not a constructor!");var e=h(arguments.length>0?arguments[0]:void 0),t=function(n){this===U&&t.call(V,n),r(this,x)&&r(this[x],e)&&(this[x][e]=!1),B(this,e,C(1,n))};return o&&H&&B(U,e,{configurable:!0,set:t}),K(e)},u(D[M],"toString",function(){return this._k}),S.f=X,P.f=J,n(86).f=E.f=Z,n(38).f=$,n(52).f=ee,o&&!n(49)&&u(U,"propertyIsEnumerable",$,!0),p.f=function(e){return K(f(e))}),a(a.G+a.W+a.F*!Q,{Symbol:D});for(var te="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ne=0;te.length>ne;)f(te[ne++]);for(var te=N(f.store),ne=0;te.length>ne;)v(te[ne++]);a(a.S+a.F*!Q,"Symbol",{for:function(e){return r(L,e+="")?L[e]:L[e]=D(e)},keyFor:function(e){if(G(e))return _(L,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){H=!0},useSimple:function(){H=!1}}),a(a.S+a.F*!Q,"Object",{create:Y,defineProperty:J,defineProperties:z,getOwnPropertyDescriptor:X,getOwnPropertyNames:Z,getOwnPropertySymbols:ee}),R&&a(a.S+a.F*(!Q||l(function(){var e=D();return"[null]"!=I([e])||"{}"!=I({a:e})||"{}"!=I(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!G(e)){for(var t,n,i=[e],r=1;arguments.length>r;)i.push(arguments[r++]);return t=i[1],"function"==typeof t&&(n=t),!n&&g(t)||(t=function(e,t){if(n&&(t=n.call(this,e,t)),!G(t))return t}),i[1]=t,I.apply(R,i)}}}),D[M][W]||n(27)(D[M],W,D[M].valueOf),d(D,"Symbol"),d(Math,"Math",!0),d(i.JSON,"JSON",!0)},function(e,t,n){n(59)("asyncIterator")},function(e,t,n){n(59)("observable")},function(e,t,n){n(155);for(var i=n(14),r=n(27),o=n(48),a=n(29)("toStringTag"),u=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],s=0;s<5;s++){var l=u[s],c=i[l],d=c&&c.prototype;d&&!d[a]&&r(d,a,l),o[l]=o.Array}},function(e,t){function n(){
throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function r(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function o(e){if(d===clearTimeout)return clearTimeout(e);if((d===i||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){v&&f&&(v=!1,f.length?p=f.concat(p):_=-1,p.length&&u())}function u(){if(!v){var e=r(a);v=!0;for(var t=p.length;t;){for(f=p,p=[];++_<t;)f&&f[_].run();_=-1,t=p.length}f=null,v=!1,o(e)}}function s(e,t){this.fun=e,this.array=t}function l(){}var c,d,h=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{d="function"==typeof clearTimeout?clearTimeout:i}catch(e){d=i}}();var f,p=[],v=!1,_=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];p.push(new s(e,t)),1!==p.length||v||r(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(e,t,n){(function(t){!function(n){function i(){}function r(e,t){return function(){e.apply(t,arguments)}}function o(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],d(e,this)}function a(e,t){for(;3===e._state;)e=e._value;return 0===e._state?void e._deferreds.push(t):(e._handled=!0,void o._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null===n)return void(1===e._state?u:s)(t.promise,e._value);var i;try{i=n(e._value)}catch(e){return void s(t.promise,e)}u(t.promise,i)}))}function u(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void l(e);if("function"==typeof n)return void d(r(n,t),e)}e._state=1,e._value=t,l(e)}catch(t){s(e,t)}}function s(e,t){e._state=2,e._value=t,l(e)}function l(e){2===e._state&&0===e._deferreds.length&&o._immediateFn(function(){e._handled||o._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function c(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function d(e,t){var n=!1;try{e(function(e){n||(n=!0,u(t,e))},function(e){n||(n=!0,s(t,e))})}catch(e){if(n)return;n=!0,s(t,e)}}var h=setTimeout;o.prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){var n=new this.constructor(i);return a(this,new c(e,t,n)),n},o.all=function(e){var t=Array.prototype.slice.call(e);return new o(function(e,n){function i(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var u=a.then;if("function"==typeof u)return void u.call(a,function(e){i(o,e)},n)}t[o]=a,0===--r&&e(t)}catch(e){n(e)}}if(0===t.length)return e([]);for(var r=t.length,o=0;o<t.length;o++)i(o,t[o])})},o.resolve=function(e){return e&&"object"==typeof e&&e.constructor===o?e:new o(function(t){t(e)})},o.reject=function(e){return new o(function(t,n){n(e)})},o.race=function(e){return new o(function(t,n){for(var i=0,r=e.length;i<r;i++)e[i].then(t,n)})},o._immediateFn="function"==typeof t&&function(e){t(e)}||function(e){h(e,0)},o._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console},o._setImmediateFn=function(e){o._immediateFn=e},o._setUnhandledRejectionFn=function(e){o._unhandledRejectionFn=e},"undefined"!=typeof e&&e.exports?e.exports=o:n.Promise||(n.Promise=o)}(this)}).call(t,n(172).setImmediate)},function(e,t,n){(function(e,t){!function(e,n){"use strict";function i(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var i={callback:e,args:t};return v[p]=i,f(p),p++}function r(e){delete v[e]}function o(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(n,i)}}function a(e){if(_)setTimeout(a,0,e);else{var t=v[e];if(t){_=!0;try{o(t)}finally{r(e),_=!1}}}}function u(){f=function(e){t.nextTick(function(){a(e)})}}function s(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}function l(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&a(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),f=function(n){e.postMessage(t+n,"*")}}function c(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;a(t)},f=function(t){e.port2.postMessage(t)}}function d(){var e=y.documentElement;f=function(t){var n=y.createElement("script");n.onreadystatechange=function(){a(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function h(){f=function(e){setTimeout(a,0,e)}}if(!e.setImmediate){var f,p=1,v={},_=!1,y=e.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(e);g=g&&g.setTimeout?g:e,"[object process]"==={}.toString.call(e.process)?u():s()?l():e.MessageChannel?c():y&&"onreadystatechange"in y.createElement("script")?d():h(),g.setImmediate=i,g.clearImmediate=r}}("undefined"==typeof self?"undefined"==typeof e?this:e:self)}).call(t,function(){return this}(),n(169))},function(e,t,n){function i(e,t){this._id=e,this._clearFn=t}var r=Function.prototype.apply;t.setTimeout=function(){return new i(r.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new i(r.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(171),t.setImmediate=setImmediate,t.clearImmediate=clearImmediate}])});