UNPKG

wilddog

Version:

wilddog,realtime,websocket

96 lines 139 kB
(function(ns){var CLIENT_VERSION = "2.5.17";var CLIENT_TYPE ="NODE";ns.wrapper=function(goog,wd){ var h,n=this;function p(a){return void 0!==a}function aa(){}function ba(a){a.ac=function(){return a.jf?a.jf:a.jf=new a}} function ca(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null"; else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function da(a){return"array"==ca(a)}function q(a){return"string"==typeof a}function fa(a){return"number"==typeof a}function ga(a){return"function"==ca(a)}function ha(a){var b=typeof a;return"object"==b&&null!=a||"function"==b}function ia(a,b,c){return a.call.apply(a.bind,arguments)} function ja(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function r(a,b,c){r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ia:ja;return r.apply(null,arguments)} function ka(a,b){var c=a.split("."),d=n;c[0]in d||!d.execScript||d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&p(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}function la(a,b){function c(){}c.prototype=b.prototype;a.yh=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.qh=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};var ma={};function na(a){this.M=a}na.prototype.Of=function(a){this.M.bind(this.M.Ha.Na,a)};na.prototype.addAuthTokenListener=na.prototype.Of;na.prototype.Fg=function(){this.M.unbind(this.M.Ha.Na,listener)};na.prototype.removeAuthTokenListener=na.prototype.Fg;na.prototype.Nf=function(a){this.M.bind(this.M.Ha.cd,a)};na.prototype.addAuthRevokListener=na.prototype.Nf;na.prototype.Eg=function(){this.M.unbind(this.M.Ha.cd,listener)};na.prototype.removeAuthRevokListener=na.prototype.Eg;function oa(a){return/^\s*$/.test(a)?!1:/^[\],:{}\s\u2028\u2029]*$/.test(a.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))}function pa(a){a=String(a);if(oa(a))try{return eval("("+a+")")}catch(b){}throw Error("Invalid JSON string: "+a);}function qa(){this.Od=void 0} function ra(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(da(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),e=d[f],ra(a,a.Od?a.Od.call(d,String(f),e):e,c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");f="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(e=b[d],"function"!=typeof e&&(c.push(f),sa(d,c),c.push(":"),ra(a,a.Od?a.Od.call(b,d,e):e,c),f=","));c.push("}");return}}switch(typeof b){case "string":sa(b, c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var ta={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},ua=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g; function sa(a,b){b.push('"',a.replace(ua,function(a){var b=ta[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),ta[a]=b);return b}),'"')};function va(a){return"undefined"!==typeof JSON&&p(JSON.parse)?JSON.parse(a):pa(a)}function t(a){if("undefined"!==typeof JSON&&p(JSON.stringify))a=JSON.stringify(a);else{var b=[];ra(new qa,a,b);a=b.join("")}return a};function wa(){this.nb=-1};function xa(){this.nb=64;this.W=[];this.ie=[];this.Lf=[];this.Jd=[];this.Jd[0]=128;for(var a=1;a<this.nb;++a)this.Jd[a]=0;this.ae=this.gc=0;this.reset()}la(xa,wa);xa.prototype.reset=function(){this.W[0]=1732584193;this.W[1]=4023233417;this.W[2]=2562383102;this.W[3]=271733878;this.W[4]=3285377520;this.ae=this.gc=0}; function ya(a,b,c){c||(c=0);var d=a.Lf;if(q(b))for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.W[0];c=a.W[1];for(var g=a.W[2],k=a.W[3],l=a.W[4],m,e=0;80>e;e++)40>e?20>e?(f=k^c&(g^k),m=1518500249):(f=c^g^k,m=1859775393):60>e?(f=c&g|k&(c|g),m=2400959708):(f=c^g^k,m=3395469782),f=(b<< 5|b>>>27)+f+l+m+d[e]&4294967295,l=k,k=g,g=(c<<30|c>>>2)&4294967295,c=b,b=f;a.W[0]=a.W[0]+b&4294967295;a.W[1]=a.W[1]+c&4294967295;a.W[2]=a.W[2]+g&4294967295;a.W[3]=a.W[3]+k&4294967295;a.W[4]=a.W[4]+l&4294967295} xa.prototype.update=function(a,b){if(null!=a){p(b)||(b=a.length);for(var c=b-this.nb,d=0,e=this.ie,f=this.gc;d<b;){if(0==f)for(;d<=c;)ya(this,a,d),d+=this.nb;if(q(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.nb){ya(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.nb){ya(this,e);f=0;break}}this.gc=f;this.ae+=b}}; xa.prototype.digest=function(){var a=[],b=8*this.ae;56>this.gc?this.update(this.Jd,56-this.gc):this.update(this.Jd,this.nb-(this.gc-56));for(var c=this.nb-1;56<=c;c--)this.ie[c]=b&255,b/=256;ya(this,this.ie);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.W[c]>>d&255,++b;return a};function za(a){if(Error.captureStackTrace)Error.captureStackTrace(this,za);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))}la(za,Error);za.prototype.name="CustomError";var Aa=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Ba=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Ca=Array.prototype.filter?function(a,b,c){return Array.prototype.filter.call(a, b,c)}:function(a,b,c){for(var d=a.length,e=[],f=0,g=q(a)?a.split(""):a,k=0;k<d;k++)if(k in g){var l=g[k];b.call(c,l,k,a)&&(e[f++]=l)}return e},Da=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Ea=Array.prototype.reduce?function(a,b,c,d){d&&(b=r(b,d));return Array.prototype.reduce.call(a,b,c)}:function(a,b,c,d){var e=c;Ba(a,function(c,g){e=b.call(d, e,c,g,a)});return e},Fa=Array.prototype.every?function(a,b,c){return Array.prototype.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&!b.call(c,e[f],f,a))return!1;return!0};function Ga(a,b){var c=Ha(a,b,void 0);return 0>c?null:q(a)?a.charAt(c):a[c]}function Ha(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return f;return-1}function Ia(a,b){var c=Aa(a,b);0<=c&&Array.prototype.splice.call(a,c,1)} function Ja(a,b){a.sort(b||Ka)}function Ka(a,b){return a>b?1:a<b?-1:0};var La;a:{var Ma=n.navigator;if(Ma){var Na=Ma.userAgent;if(Na){La=Na;break a}}La=""};function u(a,b){for(var c in a)b.call(void 0,a[c],c,a)}function Oa(a,b){var c={},d;for(d in a)c[d]=b.call(void 0,a[d],d,a);return c}function Pa(a,b){for(var c in a)if(!b.call(void 0,a[c],c,a))return!1;return!0}function Qa(a){var b=0,c;for(c in a)b++;return b}function Ra(a){for(var b in a)return b}function Sa(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function Ta(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}function Ua(a,b){return null!==a&&b in a} function Va(a,b){for(var c in a)if(a[c]==b)return!0;return!1}function Wa(a,b,c){for(var d in a)if(b.call(c,a[d],d,a))return d}function Xa(a,b){var c=Wa(a,b,void 0);return c&&a[c]}function Ya(a){for(var b in a)return!1;return!0}function Za(a){var b={},c;for(c in a)b[c]=a[c];return b}var $a="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "); function ab(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<$a.length;f++)c=$a[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var bb=null,cb=null;function db(a){var b="";eb(a,function(a){b+=String.fromCharCode(a)});return b}function eb(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=cb[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}fb();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),k=c(64);if(64===k&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=k&&b(g<<6&192|k))}} function fb(){if(!bb){bb={};cb={};for(var a=0;65>a;a++)bb[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),cb[bb[a]]=a,62<=a&&(cb["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var gb=function(){var a=1;return function(){return a++}}();function v(a,b){if(!a)throw hb(b);}function hb(a){return Error("Wilddog ("+wilddog.Re+") INTERNAL ASSERT FAILED: "+a)}function ib(a){try{return"NODE"==CLIENT_TYPE?(new Buffer(a,"base64")).toString("utf8"):"undefined"!==typeof atob?atob(a):db(a)}catch(b){jb("base64Decode failed: ",b)}return null} function kb(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);55296<=e&&56319>=e&&(e-=55296,d++,v(d<a.length,"Surrogate pair missing trail surrogate."),e=65536+(e<<10)+(a.charCodeAt(d)-56320));128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(65536>e?b[c++]=e>>12|224:(b[c++]=e>>18|240,b[c++]=e>>12&63|128),b[c++]=e>>6&63|128),b[c++]=e&63|128)}a=new xa;a.update(b);b=a.digest();fb();a=bb;c=[];for(d=0;d<b.length;d+=3){var f=b[d],g=(e=d+1<b.length)?b[d+1]:0,k=d+2<b.length,l=k?b[d+2]:0,m=f>>2,f=(f&3)<< 4|g>>4,g=(g&15)<<2|l>>6,l=l&63;k||(l=64,e||(g=64));c.push(a[m],a[f],a[g],a[l])}return c.join("")}function lb(a){for(var b="",c=0;c<arguments.length;c++)var d=arguments[c],e=ca(d),b="array"==e||"object"==e&&"number"==typeof d.length?b+lb.apply(null,arguments[c]):"object"===typeof arguments[c]?b+t(arguments[c]):b+arguments[c],b=b+" ";return b}var mb=null,nb=!0;function jb(a){!0===nb&&(nb=!1,null===mb&&!0===w.get("logging_enabled")&&Wilddog.Ze(!0));if(mb){var b=lb.apply(null,arguments);mb(b)}} function ob(a){return function(){jb(a,arguments)}}function pb(a){if("undefined"!==typeof console){var b="WILDDOG INTERNAL ERROR: "+lb.apply(null,arguments);"undefined"!==typeof console.error?console.error(b):console.log(b)}}function qb(a){var b=lb.apply(null,arguments);throw Error("WILDDOG FATAL ERROR: "+b);}function x(a){if("undefined"!==typeof console){var b="WILDDOG WARNING: "+lb.apply(null,arguments);"undefined"!==typeof console.warn?console.warn(b):console.log(b)}} function rb(a){var b="",c="",d="",e="",f=!0,g="https",k=443;if(q(a)){var l=a.indexOf("//");0<=l&&(g=a.substring(0,l-1),a=a.substring(l+2));l=a.indexOf("/");-1===l&&(l=a.length);b=a.substring(0,l);e="";a=a.substring(l).split("/");for(l=0;l<a.length;l++)if(0<a[l].length){var m=a[l];try{m=decodeURIComponent(m.replace(/\+/g," "))}catch(B){}e+="/"+m}a=b.split(".");3===a.length?(c=a[1],d=a[0].toLowerCase()):2===a.length&&(c=a[0]);l=b.indexOf(":");0<=l&&(f="https"===g||"wss"===g,k=b.substring(l+1),isFinite(k)&& (k=String(k)),k=q(k)?/^\s*-?0x/i.test(k)?parseInt(k,16):parseInt(k,10):NaN)}return{host:b,port:k,domain:c,$g:d,Pb:f,scheme:g,ub:e}}function sb(a){return fa(a)&&(a!=a||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)}function tb(a,b){if(a===b)return 0;if("[MIN_NAME]"===a||"[MAX_NAME]"===b)return-1;if("[MIN_NAME]"===b||"[MAX_NAME]"===a)return 1;var c=ub(a),d=ub(b);return null!==c?null!==d?0==c-d?a.length-b.length:c-d:-1:null!==d?1:a<b?-1:1} function vb(a){if("object"!==typeof a||null===a)return t(a);var b=[],c;for(c in a)b.push(c);b.sort();c="{";for(var d=0;d<b.length;d++)0!==d&&(c+=","),c+=t(b[d]),c+=":",c+=vb(a[b[d]]);return c+"}"}function wb(a,b){if(da(a))for(var c=0;c<a.length;++c)b(c,a[c]);else u(a,b)} function xb(a){v(!sb(a),"Invalid JSON number");var b,c,d,e;0===a?(d=c=0,b=-Infinity===1/a?1:0):(b=0>a,a=Math.abs(a),a>=Math.pow(2,-1022)?(d=Math.min(Math.floor(Math.log(a)/Math.LN2),1023),c=d+1023,d=Math.round(a*Math.pow(2,52-d)-Math.pow(2,52))):(c=0,d=Math.round(a/Math.pow(2,-1074))));e=[];for(a=52;a;--a)e.push(d%2?1:0),d=Math.floor(d/2);for(a=11;a;--a)e.push(c%2?1:0),c=Math.floor(c/2);e.push(b?1:0);e.reverse();b=e.join("");c="";for(a=0;64>a;a+=8)d=parseInt(b.substr(a,8),2).toString(16),1===d.length&& (d="0"+d),c+=d;return c.toLowerCase()}var yb=/^-?\d{1,10}$/;function ub(a){return yb.test(a)&&(a=Number(a),-2147483648<=a&&2147483647>=a)?a:null}function zb(a){try{a()}catch(b){setTimeout(function(){x("Exception was thrown by user callback.",b.stack||"");throw b;},Math.floor(0))}}function y(a,b){if(ga(a)){var c=Array.prototype.slice.call(arguments,1).slice();zb(function(){a.apply(null,c)})}};function Ab(a){v(da(a)&&0<a.length,"Requires a non-empty array");this.Pf=a;this.tb={}}Ab.prototype.be=function(a,b){for(var c=this.tb[a]||[],d=0;d<c.length;d++)if(c[d].Df){var e=c.splice(d,1)[0];e.zb.apply(e.context,Array.prototype.slice.call(arguments,1))}else c[d].zb.apply(c[d].context,Array.prototype.slice.call(arguments,1))};Ab.prototype.Ib=function(a,b,c){Bb(this,a);this.tb[a]=this.tb[a]||[];this.tb[a].push({zb:b,context:c,Df:!1});(a=this.od(a))&&b.apply(c,[a])}; Ab.prototype.Hd=function(a,b,c){Bb(this,a);var d=this.od(a);d?b.apply(c,[d]):(this.tb[a]=this.tb[a]||[],this.tb[a].push({zb:b,context:c,Df:!0}))};Ab.prototype.mc=function(a,b,c){Bb(this,a);a=this.tb[a]||[];for(var d=0;d<a.length;d++)if(a[d].zb===b&&(!c||c===a[d].context)){a.splice(d,1);break}};function Bb(a,b){v(Ga(a.Pf,function(a){return a===b}),"Unknown event: "+b)};function z(a,b){Ab.call(this,["authStateChanged","authTokenExpired"]);this.Mf={Cf:!1};this.Se={};Object.defineProperty(this,"name",{value:b,writable:!1});Object.defineProperty(this,"options",{value:a,writable:!1});this.INTERNAL=new na(this)}la(z,Ab);function Cb(a,b){z.prototype[a]=function(){return b(this)}} z.prototype.bg=function(a,b){var c=!0,d;for(d in Db)if(Db.hasOwnProperty(d)&&Db[d]===a){c=!1;break}if(c)throw Error("Unknown event "+a);this.Se[a]=b;switch(a){case Db.Na:this.Mf.Cf=b&&b.Cf}this.be(a,b)};z.prototype.emit=z.prototype.bg;z.prototype.Sf=function(a,b){this.Hd(a,b)};z.prototype.bindOnce=z.prototype.Sf;z.prototype.bind=function(a,b){this.Ib(a,b)};z.prototype.bind=z.prototype.bind;z.prototype.dh=function(a,b){this.mc(a,b)};z.prototype.unbind=z.prototype.dh;z.prototype.od=function(a){switch(a){case Db.Na:return this.Se[Db.Na]}return null}; var Db={Na:"authStateChanged",cd:"authTokenExpired"};z.prototype.Ha=Db;function Eb(a,b,c,d,e,f){this.uid=e;this.displayName=a;this.phone=f;this.email=b;this.photoURL=c;this.providerId=d};function Fb(a,b,c){this.ga=c;this.$f=a;this.Ig=b;this.Ed=0;this.sd=null}Fb.prototype.get=function(){var a;0<this.Ed?(this.Ed--,a=this.sd,this.sd=a.next,a.next=null):a=this.$f();return a};Fb.prototype.put=function(a){this.Ig(a);this.Ed<this.ga&&(this.Ed++,a.next=this.sd,this.sd=a)};function Gb(){this.ee=this.wc=null}var Ib=new Fb(function(){return new Hb},function(a){a.reset()},100);Gb.prototype.add=function(a,b){var c=Ib.get();c.set(a,b);this.ee?this.ee.next=c:this.wc=c;this.ee=c};Gb.prototype.remove=function(){var a=null;this.wc&&(a=this.wc,this.wc=this.wc.next,this.wc||(this.ee=null),a.next=null);return a};function Hb(){this.next=this.scope=this.pe=null}Hb.prototype.set=function(a,b){this.pe=a;this.scope=b;this.next=null}; Hb.prototype.reset=function(){this.next=this.scope=this.pe=null};function Jb(a){n.setTimeout(function(){throw a;},0)}var Kb; function Lb(){var a=n.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&-1==La.indexOf("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,a=r(function(a){if(("*"==d||a.origin== d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&-1==La.indexOf("Trident")&&-1==La.indexOf("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(p(c.next)){c=c.next;var a=c.pb;c.pb=null;a()}};return function(a){d.next={pb:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(a){var b= document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){n.setTimeout(a,0)}};function Mb(a,b){Nb||Ob();Pb||(Nb(),Pb=!0);Qb.add(a,b)}var Nb;function Ob(){var a=n.Promise;if(-1!=String(a).indexOf("[native code]")){var b=a.resolve(void 0);Nb=function(){b.then(Rb)}}else Nb=function(){var a=Rb,b;!(b=!ga(n.setImmediate))&&(b=n.Window&&n.Window.prototype)&&(b=-1==La.indexOf("Edge")&&n.Window.prototype.setImmediate==n.setImmediate);b?(Kb||(Kb=Lb()),Kb(a)):n.setImmediate(a)}}var Pb=!1,Qb=new Gb; function Rb(){for(var a;a=Qb.remove();){try{a.pe.call(a.scope)}catch(b){Jb(b)}Ib.put(a)}Pb=!1};function Sb(a,b){this.da=Tb;this.Af=void 0;this.Vb=this.ob=this.Ea=null;this.pd=this.ne=!1;if(a!=aa)try{var c=this;a.call(b,function(a){Ub(c,Vb,a)},function(a){if(!(a instanceof Wb))try{if(a instanceof Error)throw a;throw Error("Promise rejected.");}catch(e){}Ub(c,Xb,a)})}catch(d){Ub(this,Xb,d)}}var Tb=0,Vb=2,Xb=3;function Yb(){this.next=this.context=this.nc=this.Rc=this.w=null;this.Zc=!1}Yb.prototype.reset=function(){this.context=this.nc=this.Rc=this.w=null;this.Zc=!1}; var Zb=new Fb(function(){return new Yb},function(a){a.reset()},100);function $b(a,b,c){var d=Zb.get();d.Rc=a;d.nc=b;d.context=c;return d}Sb.prototype.then=function(a,b,c){return ac(this,ga(a)?a:null,ga(b)?b:null,c)};Sb.prototype.then=Sb.prototype.then;Sb.prototype.$goog_Thenable=!0;h=Sb.prototype;h.bh=function(a,b){return ac(this,null,a,b)};h.cancel=function(a){this.da==Tb&&Mb(function(){var b=new Wb(a);bc(this,b)},this)}; function bc(a,b){if(a.da==Tb)if(a.Ea){var c=a.Ea;if(c.ob){for(var d=0,e=null,f=null,g=c.ob;g&&(g.Zc||(d++,g.w==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(c.da==Tb&&1==d?bc(c,b):(f?(d=f,d.next==c.Vb&&(c.Vb=d),d.next=d.next.next):cc(c),dc(c,e,Xb,b)))}a.Ea=null}else Ub(a,Xb,b)}function ec(a,b){a.ob||a.da!=Vb&&a.da!=Xb||fc(a);a.Vb?a.Vb.next=b:a.ob=b;a.Vb=b} function ac(a,b,c,d){var e=$b(null,null,null);e.w=new Sb(function(a,g){e.Rc=b?function(c){try{var e=b.call(d,c);a(e)}catch(m){g(m)}}:a;e.nc=c?function(b){try{var e=c.call(d,b);!p(e)&&b instanceof Wb?g(b):a(e)}catch(m){g(m)}}:g});e.w.Ea=a;ec(a,e);return e.w}h.eh=function(a){this.da=Tb;Ub(this,Vb,a)};h.fh=function(a){this.da=Tb;Ub(this,Xb,a)}; function Ub(a,b,c){if(a.da==Tb){a===c&&(b=Xb,c=new TypeError("Promise cannot resolve to itself"));a.da=1;var d;a:{var e=c,f=a.eh,g=a.fh;if(e instanceof Sb)ec(e,$b(f||aa,g||null,a)),d=!0;else{var k;if(e)try{k=!!e.$goog_Thenable}catch(m){k=!1}else k=!1;if(k)e.then(f,g,a),d=!0;else{if(ha(e))try{var l=e.then;if(ga(l)){gc(e,l,f,g,a);d=!0;break a}}catch(m){g.call(a,m);d=!0;break a}d=!1}}}d||(a.Af=c,a.da=b,a.Ea=null,fc(a),b!=Xb||c instanceof Wb||hc(a,c))}} function gc(a,b,c,d,e){function f(a){k||(k=!0,d.call(e,a))}function g(a){k||(k=!0,c.call(e,a))}var k=!1;try{b.call(a,g,f)}catch(l){f(l)}}function fc(a){a.ne||(a.ne=!0,Mb(a.eg,a))}function cc(a){var b=null;a.ob&&(b=a.ob,a.ob=b.next,b.next=null);a.ob||(a.Vb=null);return b}h.eg=function(){for(var a;a=cc(this);)dc(this,a,this.da,this.Af);this.ne=!1}; function dc(a,b,c,d){if(c==Xb&&b.nc&&!b.Zc)for(;a&&a.pd;a=a.Ea)a.pd=!1;if(b.w)b.w.Ea=null,ic(b,c,d);else try{b.Zc?b.Rc.call(b.context):ic(b,c,d)}catch(e){jc.call(null,e)}Zb.put(b)}function ic(a,b,c){b==Vb?a.Rc.call(a.context,c):a.nc&&a.nc.call(a.context,c)}function hc(a,b){a.pd=!0;Mb(function(){a.pd&&jc.call(null,b)})}var jc=Jb;function Wb(a){za.call(this,a)}la(Wb,za);Wb.prototype.name="cancel";var kc="undefined"!=typeof Promise?Promise:"undefined"!=typeof n.Promise?n.Promise:Sb;n.setTimeout||(n.setTimeout=function(){setTimeout.apply(null,arguments)});Sb.prototype["catch"]=Sb.prototype.bh;function A(){var a=this;this.reject=this.resolve=null;this.u=new kc(function(b,c){a.resolve=b;a.reject=c})}function C(a,b){return function(c,d){c?a.reject(c):a.resolve(d);ga(b)&&(lc(a.u),1===b.length?b(c):b(c,d))}}function lc(a){a.then(void 0,aa)};function D(a,b,c,d,e){Eb.call(this,b.displayName,b.email,b.photoURL,b.providerId,b.uid,b.phone);this.isAnonymous="anonymous"===this.providerId;this.emailVerified=!0===c;this.phoneVerified=!0===d;this.providerData=e||[];this.refreshToken=null;Object.defineProperty(this,"__authManager",{value:a,writable:!1})}la(D,Eb);ka("wd.User",D);D.prototype["delete"]=function(a){var b=new A;mc(this.__authManager,this.Ka(),C(b,a));return b.u};D.prototype["delete"]=D.prototype["delete"]; D.prototype.Ka=function(){return(this.__authManager.Wa||null).idToken};D.prototype.getToken=D.prototype.Ka;D.prototype.te=function(){return this.phone};D.prototype.getPhone=D.prototype.te; D.prototype.link=function(a,b){E("wilddog.User.link",1,2,arguments.length);nc("wilddog.User.link",a);var c=a.provider,d=new A,e={};e.idToken=this.Ka();"password"==c?(e.email=a.email,e.password=a.password,oc(this.__authManager,e,C(d,b))):(e.providerId=a.provider,e.accessToken=a.accessToken,e.openId=a.openId||"",e.authType="link",pc(this.__authManager,e,C(d,b)));return d.u};D.prototype.link=D.prototype.link; D.prototype.gh=function(a,b){E("wilddog.User.unlink",1,2,arguments.length);qc("wilddog.User.unlink",1,a);var c=new A,d=this;rc(this.__authManager,"unlink",{idToken:this.Ka(),deleteProvider:[a]},C(c,function(c,f){f&&(d.providerData=d.providerData.filter(function(b){if(b.providerId!=a)return b}),0===d.providerData.length&&sc(d.__authManager));b&&b(c,f)}));return c.u};D.prototype.unlink=D.prototype.gh; D.prototype.qg=function(a,b){E("wilddog.auth().signInWithPopup",1,2,arguments.length);nc("wilddog.auth().signInWithPopup",a);var c=new A;tc(this.__authManager,a,{authType:"link",idToken:this.Ka()},C(c,b));return c.u};D.prototype.linkWithPopup=D.prototype.qg;D.prototype.rg=function(a,b){E("wilddog.auth().signInWithPopup",1,2,arguments.length);nc("wilddog.auth().signInWithPopup",a);var c=new A;uc(this.__authManager,a,{authType:"link",idToken:this.Ka()},C(c,b));return c.u}; D.prototype.linkWithRedirect=D.prototype.rg;D.prototype.kh=function(a,b){E("wilddog.User.updateProfile",1,2,arguments.length);nc("wilddog.User.updateProfile",a);var c=new A;a.idToken=this.Ka();rc(this.__authManager,"profile",a,C(c,b));return c.u};D.prototype.updateProfile=D.prototype.kh;D.prototype.hh=function(a,b){E("wilddog.User.updateEmail",1,2,arguments.length);qc("wilddog.User.updateEmail",1,a);var c=new A;oc(this.__authManager,{email:a,idToken:this.Ka()},C(c,b));return c.u}; D.prototype.updateEmail=D.prototype.hh;D.prototype.jh=function(a,b){E("wilddog.User.updatePhone",1,2,arguments.length);qc("wilddog.User.updatePhone",1,a);var c=new A;oc(this.__authManager,{phoneNumber:a,idToken:this.Ka()},C(c,b));return c.u};D.prototype.updatePhone=D.prototype.jh;D.prototype.mh=function(a,b){E("wilddog.User.verifiyPhone",1,2,arguments.length);qc("wilddog.User.verifiyPhone",1,a);var c=new A;vc(this.__authManager,{phoneNumber:this.te(),smsCode:a},C(c,b));return c.u}; D.prototype.verifiyPhone=D.prototype.mh;D.prototype.ih=function(a,b){E("wilddog.User.updatePassword",1,2,arguments.length);qc("wilddog.User.updatePassword",1,a);var c=new A;oc(this.__authManager,{password:a,idToken:this.Ka()},C(c,b));return c.u};D.prototype.updatePassword=D.prototype.ih; D.prototype.Jg=function(a){E("wilddog.User.sendEmailVerification",0,1,arguments.length);F("wilddog.User.sendEmailVerification",1,a,!0);var b=new A;wc(this.__authManager,{idToken:this.Ka(),requestType:"VERIFY_EMAIL"},C(b,a));return b.u};D.prototype.sendEmailVerification=D.prototype.Jg; D.prototype.Mg=function(a){E("wilddog.User.sendPhoneVerification",0,1,arguments.length);F("wilddog.User.sendPhoneVerification",1,a,!0);var b=new A;xc(this.__authManager,{phoneNumber:this.te(),type:"PHONE_VERIFY"},C(b,a));return b.u};D.prototype.sendPhoneVerification=D.prototype.Mg;D.prototype.reload=function(a){E("wilddog.User.reload",0,1,arguments.length);F("wilddog.User.reload",1,a,!0);var b=new A;yc(this.__authManager,this.Ka(),C(b,a));return b.u};D.prototype.reload=D.prototype.reload; D.prototype.Dg=function(a,b){E("wilddog.User.reload",1,2,arguments.length);F("wilddog.User.reload",2,b,!0);if(!a||!a.provider)throw Error("Unknown credential object.");var c=new A;pc(this.__authManager,a,C(c,b));return c.u};D.prototype.reauthenticate=D.prototype.Dg;function zc(a){var b="POST";switch(a.providerId||a.provider){case "password":a="verifyPassword";break;case "anonymous":a="verifyAnonymous";break;case "custom":a="verifyCustomToken";break;default:a="credential",b="GET"}if(!a)throw Error("Unknown provider '"+provider+"'.");return{path:a,method:b}};function Ac(a){if(a&&a.users&&a.users[0])return a=a.users[0],new Eb(a.displayName,a.email,a.photoUrl,a.providerId,a.localId,a.phoneNumber);throw Error("Bad response format.");}function Bc(a,b){var c=Ac(b);if(!c)return null;var d=b.users[0],e=d.providerUserInfo.map(function(a){a.photoURL=a.photoUrl;delete a.photoUrl;return a});return new D(a,c,d.emailVerified,d.phoneNumberVerified,e)};var Cc="auth.wilddog.com";function Dc(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function G(a,b){if(Object.prototype.hasOwnProperty.call(a,b))return a[b]}function Ec(a,b){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b(c,a[c])}function Fc(a){var b={};Ec(a,function(a,d){b[a]=d});return b};function Gc(a){var b={},c={},d={},e="";try{var f=a.split("."),g=ib(f[0])||"",k=ib(f[1])||"",b=va(g),c=va(k),e=f[2],d=c.d||{};delete c.d}catch(l){console.warn("error",l)}return{th:b,ke:c,data:d,vh:e}}function Hc(a){a=Gc(a).ke;return"object"===typeof a&&a.hasOwnProperty("iat")?G(a,"iat"):null};function Ic(a,b,c){this.Ge=["session",b.Kd,b.xc,a].join(":");this.Zd=c}Ic.prototype.set=function(a,b){if(!b)if(this.Zd.length)b=this.Zd[0];else throw Error("wd.auth.SessionManager : No storage options available!");b.set(this.Ge,a)};Ic.prototype.get=function(){var a=Da(this.Zd,r(this.lg,this)),a=Ca(a,function(a){return null!==a});Ja(a,function(a,c){return Hc(c.idToken)-Hc(a.idToken)});return 0<a.length?a.shift():null};Ic.prototype.lg=function(a){try{var b=a.get(this.Ge);if(b.idToken)return b;this.clear(a)}catch(c){}return null}; Ic.prototype.clear=function(){var a=this;Ba(this.Zd,function(b){b.remove(a.Ge)})};var Jc={NETWORK_ERROR:"Unable to contact the Wilddog server.",SERVER_ERROR:"An unknown server error occurred.",TRANSPORT_UNAVAILABLE:"There are no login transports available for the requested method.",REQUEST_INTERRUPTED:"The browser redirected the page before the login request could complete.",USER_CANCELLED:"The user cancelled authentication."};function Kc(a){var b=G(Jc,a),b=Error(b,a);b.code=a;return b};function Lc(a,b,c){this.gd=a||{};this.Yc=b||{};this.$=c||{};this.gd.remember||(this.gd.remember="default")}var Mc=["remember","redirectTo"];function Nc(a){var b={},c={};Ec(a||{},function(a,e){0<=Aa(Mc,a)?b[a]=e:c[a]=e});return new Lc(b,{},c)};function Oc(a){this.Cc=a;this.Ld="wilddog:"}h=Oc.prototype;h.set=function(a,b){null==b?this.Cc.removeItem(this.Ld+a):this.Cc.setItem(this.Ld+a,t(b))};h.get=function(a){a=this.Cc.getItem(this.Ld+a);return null==a?null:va(a)};h.remove=function(a){this.Cc.removeItem(this.Ld+a)};h.ye=!1;h.toString=function(){return this.Cc.toString()};function Pc(){this.yc={}}Pc.prototype.set=function(a,b){null==b?delete this.yc[a]:this.yc[a]=b};Pc.prototype.get=function(a){return Dc(this.yc,a)?this.yc[a]:null};Pc.prototype.remove=function(a){delete this.yc[a]};Pc.prototype.ye=!0;function Qc(a){try{if("undefined"!==typeof window&&"undefined"!==typeof window[a]){var b=window[a];b.setItem("wilddog:sentinel","cache");b.removeItem("wilddog:sentinel");return new Oc(b)}}catch(c){}return new Pc}var Rc=Qc("localStorage"),Sc=Qc("sessionStorage");function Tc(a){var b=[];Ec(a,function(a,d){da(d)?Ba(d,function(c){b.push(encodeURIComponent(a)+"="+encodeURIComponent(c))}):b.push(encodeURIComponent(a)+"="+encodeURIComponent(d))});return b.length?"&"+b.join("&"):""}function Uc(a){var b={};a=a.replace(/^\?/,"").split("&");Ba(a,function(a){a&&(a=a.split("="),b[a[0]]=a[1])});return b};function Vc(a){a.method||(a.method="GET");a.headers||(a.headers={});a.headers["Content-Type"]||(a.headers["Content-Type"]="application/json");a.headers["Content-Type"]=a.headers["Content-Type"].toLowerCase();this.options=a} Vc.prototype.open=function(a,b,c){var d=rb(a);a=this.options.method;var e;try{var f="http"===d.scheme?require("http"):require("https")}catch(l){}var g={Accept:"application/json;text/plain"};ab(g,this.options.headers);d={host:d.host.split(":")[0],path:d.ub,method:this.options.method.toUpperCase()};if("GET"===a)d.path+=(/\?/.test(d.path)?"":"?")+Tc(b),e=null;else{var k=this.options.headers["Content-Type"];"application/json"===k&&(e=t(b));"application/x-www-form-urlencoded"===k&&(e=Tc(b));g["Content-Length"]= Buffer.byteLength(e,"utf8")}d.headers=g;b=f.request(d,function(a){var b="";a.setEncoding("utf8");a.on("data",function(a){b+=a});a.on("end",function(){try{b=va(b+"")}catch(B){}c&&(c(null,b),c=null)})});"GET"!==a&&b.write(e);b.on("error",function(a){a&&a.code&&("ENOTFOUND"===a.code||"ENETDOWN"===a.code)?c(Kc("NETWORK_ERROR")):c(Kc("SERVER_ERROR"));c=null});b.end()};Vc.isAvailable=function(){return"NODE"==CLIENT_TYPE};function Wc(a){var b=[];a.forEach(function(a){null!=this.nf[a]&&b.push(this.nf[a])},Xc);return b}var w=Sc,Xc=new function(){this.nf={NodeHttp:Vc}};function Yc(a,b,c){this.fb=a;this.M=a.app;this.Ub=b;this.rc=new Ic(this.M.name,b,[Rc,w]);this.Wa=null;this.Jb=c;Zc(this)}function $c(a){var b=w.get("redirect_request_id");a=a.rc.get();return b||a&&a.idToken}function Zc(a){w.get("redirect_request_id")&&ad(a);var b=a.rc.get();b&&b.idToken?yc(a,b.idToken,function(c,d){if(!c&&d){var e={signIn:!0};e.currentUser=d;e.idToken=b.idToken;bd(a,e,{});cd(a,e)}else cd(a,null)}):cd(a,null)} function dd(a,b,c,d){b&&b.idToken?ed(a,b.idToken,c,function(a,b){d(a,b)}):(cd(a,null),d(Error("No idToken found in response.")))}function ed(a,b,c,d){yc(a,b,function(e,f){if(!e&&f){var g={signIn:!0};g.currentUser=f;g.idToken=b;bd(a,g,c);cd(a,g);d(null,f)}else cd(a,null),d(e)})}function sc(a,b){a.M.bindOnce(a.M.Ha.Na,function(){cd(a,null);b&&b(null)})} function pc(a,b,c){fd(a);var d=new Lc({},{},b||{});b=zc(b);d.$._method=b.method;var e=Wc(["XHR","JSONP","NodeHttp","WxHttp"]);gd(a,e,"/auth/"+b.path,d,function(a,b){y(c,a,b)})}function hd(a,b){fd(a);var c=new Lc({},{},{}),d=Wc(["WxImplicit"]);gd(a,d,"/auth/wxapp",c,function(a,c){y(b,a,c)})} function tc(a,b,c,d){fd(a);var e=Wc(["Popup","Cordova"]);requestInfo=Nc(c);height=width=625;b.id?(requestInfo.$.providerId=b.id,requestInfo.$.scope=b.scope||"",requestInfo.$.appId=a.Ub.xc,requestInfo.Yc.window_features="menubar=yes,modal=yes,alwaysRaised=yeslocation=yes,resizable=yes,scrollbars=yes,status=yes,height="+height+",width="+width+",top="+("object"===typeof screen?.5*(screen.height-height):0)+",left="+("object"===typeof screen?.5*(screen.width-width):0),requestInfo.Yc.relay_url=id(a.Ub.xc), requestInfo.Yc.requestWithCredential=r(a.cb,a),gd(a,e,"/auth/oauth",requestInfo,function(a,b){y(d,a,b)})):setTimeout(function(){y(d,Kc("TRANSPORT_UNAVAILABLE_FOR_UNKNOWN_PROVIDER"))},0)}function uc(a,b,c,d){fd(a);var e=Wc(["Redirect"]);c=Nc(c);b.id?(c.$.providerId=b.id,c.$.scope=b.scope||"",c.$.appId=a.Ub.xc,w.set("redirect_client_options",c.gd),gd(a,e,"/auth/oauth",c,function(a,b){y(d,a,b)})):y(d,Kc("TRANSPORT_UNAVAILABLE"))} function ad(a){var b=w.get("redirect_request_id");if(b){var c=w.get("redirect_client_options"),d=Wc(["XHR","JSONP"]);serverParams={requestId:b,requestKey:jd()};transportOptions={};requestInfo=new Lc(c,transportOptions,serverParams);try{document.location.hash=document.location.hash.replace(/&__wilddog_request_key=([a-zA-z0-9]*)/,"")}catch(e){}gd(a,d,"/auth/session",requestInfo,function(){w.remove("redirect_request_id");w.remove("redirect_client_options")}.bind(a))}} function kd(a,b,c){fd(a);b=Nc(b);b.$._method="POST";a.cb("/auth/signupNewUser",b,function(b,e){!b&&e&&e.idToken?ed(a,e.idToken,null,function(a,b){y(c,a,b)}):y(c,b)})} function rc(a,b,c,d){var e={idToken:c.idToken},f=c.photoURL||a.Wa.currentUser.photoURL,g=c.displayName||a.Wa.currentUser.displayName;switch(b){case "unlink":e.deleteProvider=c.deleteProvider;break;case "profile":e.photoUrl=f,e.displayName=g}ld(a,e,function(b,c){b?y(d,b):(a.Wa.currentUser.displayName=g,a.Wa.currentUser.photoURL=f,bd(a,a.Wa),y(d,b,c))})}function oc(a,b,c){ld(a,b,function(b,e){b?y(c,b):dd(a,e,{},c)})} function ld(a,b,c){b=Nc(b);b.$._method="POST";b.$.idToken=a.Wa.idToken;a.cb("/auth/setAccountInfo",b,function(a,b){a?c(a):c(a,b)})}function yc(a,b,c){fd(a);b=Nc({idToken:b});b.$._method="POST";a.cb("/auth/getAccountInfo",b,function(b,e){b?c(b):c(b,Bc(a,e))})}function mc(a,b,c){fd(a);b=Nc({idToken:b});b.$._method="POST";a.cb("/auth/deleteAccount",b,function(b,e){!b&&e&&"ok"==e.status&&a.Wa&&sc(a);y(c,b)})} function wc(a,b,c){fd(a);b=Nc(b);b.$._method="POST";a.cb("/auth/getOobConfirmationCode",b,function(a,b){y(c,a,b)})}Yc.prototype.oe=function(a,b){fd(this);var c=Nc({email:a});c.$._method="POST";this.cb("/auth/getProvider",c,function(a,c){a?y(b,a):y(b,a,c.allProviders||[])})};Yc.prototype.cb=function(a,b,c){var d=Wc(["XHR","JSONP","NodeHttp","WxHttp"]);md(this,d,a,b,c)}; function gd(a,b,c,d,e){md(a,b,c,d,function(b,c){!b&&c&&c.idToken?dd(a,c,d.gd,function(a,b){a?e(a):e(null,b)}):e(b||Kc("UNKNOWN_ERROR"))})} function md(a,b,c,d,e){b=Ca(b,function(a){return"function"===typeof a.isAvailable&&a.isAvailable()});0===b.length?setTimeout(function(){e(Kc("TRANSPORT_UNAVAILABLE"))},0):(b=b.shift(),d.Yc.method=d.$._method,b=new b(d.Yc),d=Fc(d.$),d.v=CLIENT_TYPE+CLIENT_VERSION,d.transport="json",d.suppress_status_codes=!0,a=nd()+"/"+a.Ub.xc+c,b.open(a,d,function(a,b){if(a)e(a);else if(b&&b.error){var c=Error(b.message);c.code=b.errcode;e(c)}else e(null,b)}))} function bd(a,b,c){a.rc.clear();c=c||{};var d=Rc;"sessionOnly"===c.remember&&(d=w);"none"!==c.remember&&a.rc.set(b,d)}function cd(a,b){a.Wa=b;a.fb.currentUser=b&&b.signIn?b.currentUser:null;a.Jb&&a.Jb(null!==b);b&&b.signIn||a.rc.clear();a.M.emit(a.M.Ha.Na,b||{signIn:!1})}function fd(a){if(a.Ub.kf&&"auth.wilddog.com"===Cc)throw Error("This custom Wilddog server ('"+a.Ub.domain+"') does not support delegated login.");} function vc(a,b,c){b=Nc(b);b.$._method="POST";a.cb("/auth/verifyPhone",b,function(b,e){!b&&e&&"ok"==e.status&&a.fb.currentUser&&(a.fb.currentUser.phoneVerified=!0);!b&&e&&e.idToken?ed(a,e.idToken,null,function(a){y(c,a)}):y(c,b)})}function od(a,b,c){fd(a);b=Nc(b);b.$._method="POST";a.cb("/auth/resetPhonePassword",b,function(a,b){a?y(c,a):y(c,a,b)})}function xc(a,b,c){fd(a);b=Nc(b);b.$._method="POST";a.cb("/auth/sendSmsCode",b,function(a,b){y(c,a,b)})};function E(a,b,c,d){var e;d<b?e="at least "+b:d>c&&(e=0===c?"none":"no more than "+c);if(e)throw Error(a+" failed: Was called with "+d+(1===d?" argument.":" arguments.")+" Expects "+e+".");}function pd(a,b,c){switch(b){case 1:b=c?"first":"First";break;case 2:b=c?"second":"Second";break;case 3:b=c?"third":"Third";break;case 4:b=c?"fourth":"Fourth";break;default:throw Error("errorPrefix called with argumentNumber > 4. Need to update it?");}return a+" failed: "+(b+" argument ")} function F(a,b,c,d){if((!d||p(c))&&!ga(c))throw Error(pd(a,b,d)+"must be a valid function.");}function qd(a,b,c){if(p(c)&&(!ha(c)||null===c))throw Error(pd(a,b,!0)+"must be a valid context object.");};function H(a,b){if(1==arguments.length){this.C=a.split("/");for(var c=0,d=0;d<this.C.length;d++)0<this.C[d].length&&(this.C[c]=this.C[d],c++);this.C.length=c;this.ca=0}else this.C=a,this.ca=b}function I(a,b){var c=J(a);if(null===c)return b;if(c===J(b))return I(K(a),K(b));throw Error("INTERNAL ERROR: innerPath ("+b+") is not within outerPath ("+a+")");}function J(a){return a.ca>=a.C.length?null:a.C[a.ca]}function rd(a){return a.C.length-a.ca} function K(a){var b=a.ca;b<a.C.length&&b++;return new H(a.C,b)}function sd(a){return a.ca<a.C.length?a.C[a.C.length-1]:null}h=H.prototype;h.toString=function(){for(var a="",b=this.ca;b<this.C.length;b++)""!==this.C[b]&&(a+="/"+this.C[b]);return a||"/"};h.slice=function(a){return this.C.slice(this.ca+(a||0))};h.parent=function(){if(this.ca>=this.C.length)return null;for(var a=[],b=this.ca;b<this.C.length-1;b++)a.push(this.C[b]);return new H(a,0)}; h.w=function(a){for(var b=[],c=this.ca;c<this.C.length;c++)b.push(this.C[c]);if(a instanceof H)for(c=a.ca;c<a.C.length;c++)b.push(a.C[c]);else for(a=a.split("/"),c=0;c<a.length;c++)0<a[c].length&&b.push(a[c]);return new H(b,0)};h.f=function(){return this.ca>=this.C.length};h.fa=function(a){if(rd(this)!==rd(a))return!1;for(var b=this.ca,c=a.ca;b<=this.C.length;b++,c++)if(this.C[b]!==a.C[c])return!1;return!0}; h.contains=function(a){var b=this.ca,c=a.ca;if(rd(this)>rd(a))return!1;for(;b<this.C.length;){if(this.C[b]!==a.C[c])return!1;++b;++c}return!0};var L=new H("");function td(a,b){this.ab=a.slice();this.Oa=Math.max(1,this.ab.length);this.af=b;for(var c=0;c<this.ab.length;c++)this.Oa+=ud(this.ab[c]);vd(this)}td.prototype.push=function(a){0<this.ab.length&&(this.Oa+=1);this.ab.push(a);this.Oa+=ud(a);vd(this)};td.prototype.pop=function(){var a=this.ab.pop();this.Oa-=ud(a);0<this.ab.length&&--this.Oa}; function vd(a){if(768<a.Oa)throw Error(a.af+"has a key path longer than 768 bytes ("+a.Oa+").");if(32<a.ab.length)throw Error(a.af+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+xd(a));}function xd(a){return 0==a.ab.length?"":"in property '"+a.ab.join(".")+"'"};function ud(a){for(var b=0,c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b++:2048>d?b+=2:55296<=d&&56319>=d?(b+=4,c++):b+=3}return b};var yd=/[\[\].#$\/\u0000-\u001F\u007F]/,zd=/[\[\].#$\u0000-\u001F\u007F]/;function Ad(a){return q(a)&&0!==a.length&&!yd.test(a)}function Bd(a){return null===a||q(a)||fa(a)&&!sb(a)||ha(a)&&Dc(a,".sv")}function Cd(a,b,c,d){d&&!p(b)||Dd(pd(a,1,d),b,c)} function Dd(a,b,c){c instanceof H&&(c=new td(c,a));if(!p(b))throw Error(a+"contains undefined "+xd(c));if(ga(b))throw Error(a+"contains a function "+xd(c)+" with contents: "+b.toString());if(sb(b))throw Error(a+"contains "+b.toString()+" "+xd(c));if(q(b)&&b.length>10485760/3&&10485760<ud(b))throw Error(a+"contains a string greater than 10485760 utf8 bytes "+xd(c)+" ('"+b.substring(0,50)+"...')");if(ha(b)){var d=!1,e=!1;Ec(b,function(b,g){if(".value"===b)d=!0;else if(".priority"!==b&&".sv"!==b&&(e= !0,!Ad(b)))throw Error(a+" contains an invalid key ("+b+") "+xd(c)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');c.push(b);Dd(a,g,c);c.pop()});if(d&&e)throw Error(a+' contains ".value" child '+xd(c)+" in addition to actual children.");}} function Ed(a,b){var c,d;for(c=0;c<b.length;c++){d=b[c];for(var e=d.slice(),f=0;f<e.length;f++)if((".priority"!==e[f]||f!==e.length-1)&&!Ad(e[f]))throw Error(a+"contains an invalid key ("+e[f]+") in path "+d.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');}b.sort(H.rh);e=null;for(c=0;c<b.length;c++){d=b[c];if(null!==e&&e.contains(d))throw Error(a+"contains a path "+e.toString()+" that is ancestor of another path "+d.toString());e=d}} function Fd(a,b,c){var d=pd(a,1,!1);if(!ha(b)||da(b))throw Error(d+" must be an Object containing the children to replace.");if(Dc(b,".value"))throw Error(d+' must not contain ".value". To overwrite with a leaf value, just use .set() instead.');var e=[];Ec(b,function(a,b){var f=new H(a);Dd(d,b,c.w(f));if(".priority"===sd(f)&&!Bd(b))throw Error(d+"contains an invalid value for '"+f.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");e.push(f)}); Ed(d,e)}function Gd(a,b,c){if(sb(c))throw Error(pd(a,b,!1)+"is "+c.toString()+", but must be a valid Wilddog priority (a string, finite number, server value, or null).");if(!Bd(c))throw Error(pd(a,b,!1)+"must be a valid Wilddog priority (a string, finite number, server value, or null).");} function Hd(a,b,c){if(!c||p(b))switch(b){case "value":case "child_added":case "child_removed":case "child_changed":case "child_moved":break;default:throw Error(pd(a,1,c)+'must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".');}}function Id(a,b,c,d){if((!d||p(c))&&!Ad(c))throw Error(pd(a,b,d)+'was an invalid key: "'+c+'". Wilddog keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").');} function Jd(a,b){if(!q(b)||0===b.length||zd.test(b))throw Error(pd(a,1,!1)+'was an invalid path: "'+b+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"');}function Ld(a,b){b&&(b=b.replace(/^\/*\.info(\/|$)/,"/"));Jd(a,b)}function Md(a,b){if(".info"===J(b))throw Error(a+" failed: Can't modify data under /.info/");}function qc(a,b,c){if(!q(c))throw Error(pd(a,b,!1)+"must be a valid string.");} function nc(a,b){if(!ha(b)||null===b)throw Error(pd(a,1,!1)+"must be a valid object.");};function Nd(a){this.fb=a}Nd.prototype.jg=function(){return this.fb.Ve};Nd.prototype.getAuthRevokListener=Nd.prototype.jg;function N(a){if(!a.options.authDomain)throw Error("Could not find 'authDomain' in options.");var b=this;this.Qf=function(a){var b=/^([a-zA-Z0-9\-_]+)\.([a-z]+)\.com/.exec(a.toLowerCase());if(!b)throw Error("Bad 'authDomain' format '"+a+"'.");return{xc:b[1],xh:b[2],ph:b[0],Kd:"",kf:"wilddog"!==b[2]}}(a.options.authDomain);this.app=a;this.ea=new Yc(this,this.Qf);this.Ve=function(a){var c=b.ea;a=a.reason;c.fb.currentUser&&(c.rc.clear(),c.Wa=null,c.fb.currentUser=null,c.M.emit(c.M.Ha.Na,{signIn:!1,reason:a}), c.Jb&&c.Jb(!1))};this.app.bind(this.app.Ha.cd,this.Ve);this.INTERNAL=new Nd(this)}N.prototype.tg=function(a){function b(b){(b&&b.signIn||!$c(c.ea))&&setTimeout(function(){a(b&&b.signIn?b.currentUser:null)},0)}var c=this;E("wilddog.auth().onAuthStateChanged",1,1,arguments.length);F("wilddog.auth().onAuthStateChanged",1,a,!1);this.app.bind(this.app.Ha.Na,b);return function(){c.app.unbind(c.app.Ha.Na,b)}};N.prototype.onAuthStateChanged=N.prototype.tg; N.prototype.Qg=function(a){E("wilddog.auth().signInAnonymously",0,1,arguments.length);F("wilddog.auth().signInAnonymously",1,a,!0);var b=new A;kd(this.ea,{},C(b,a));return b.u};N.prototype.signInAnonymously=N.prototype.Qg;N.prototype.Rg=function(a){E("wilddog.auth().signInAnonymously",0,1,arguments.length);F("wilddog.auth().signInAnonymously",1,a,!0);var b=new A;hd(this.ea,C(b,a));return b.u};N.prototype.signInWeapp=N.prototype.Rg; N.prototype.Kg=function(a,b){E("wilddog.auth().sendPasswordResetEmail",1,2,arguments.length);F("wilddog.auth().sendPasswordResetEmail",2,b,!0);var c=new A;wc(this.ea,{requestType:"RESET_PASSWORD",email:a},C(c,b));return c.u};N.prototype.sendPasswordResetEmail=N.prototype.Kg;N.prototype.Lg=function(a,b){E("wilddog.auth().sendPasswordResetSms",1,2,arguments.length);F("wilddog.auth().sendPasswordResetSms",2,b,!0);var c=new A;xc(this.ea,{type:"PASSWORD_RESET",phoneNumber:a},C(c,b));return c.u}; N.prototype.sendPasswordResetSms=N.prototype.Lg;N.prototype.Xf=function(a,b,c,d){E("wilddog.auth().sendPasswordResetSms",3,4,arguments.length);F("wilddog.auth().sendPasswordResetSms",4,d,!0);qc("wilddog.auth().sendPasswordResetSms",2,b);var e=new A;od(this.ea,{phoneNumber:a,password:c,smsCode:b},C(e,d));return e.u};N.prototype.confirmPasswordResetSms=N.prototype.Xf; N.prototype.oe=function(a,b){E("wilddog.auth().fetchProvidersForEmail",1,2,arguments.length);F("wilddog.auth().fetchProvidersForEmail",2,b,!0);var c=new A;this.ea.oe(a,C(c,b));return c.u};N.prototype.fetchProvidersForEmail=N.prototype.oe;N.prototype.Tg=function(a,b){E("wilddog.auth().signInWithCustomToken",1,2,arguments.length);F("wilddog.auth().signInWithCustomToken",2,b,!0);var c=new A;pc(this.ea,{providerId:"custom",token:a},C(c,b));return c.u};N.prototype.signInWithCustomToken=N.prototype.Tg; N.prototype.Ug=function(a,b,c){E("wilddog.auth().signInWithEmailAndPassword",2,3,arguments.length);F("wilddog.auth().signInWithEmailAndPassword",3,c,!0);var d=new A;pc(this.ea,{providerId:"password",password:b,email:a},C(d,c));return d.u};N.prototype.signInWithEmailAndPassword=N.prototype.Ug; N.prototype.Vg=function(a,b,c){E("wilddog.auth().signInWithPhoneAndPassword",2,3,arguments.length);F("wilddog.auth().signInWithPhoneAndPassword",3,c,!0);var d=new A;pc(this.ea,{providerId:"password",password:b,phoneNumber:a},C(d,c));return d.u};N.prototype.signInWithPhoneAndPassword=N.prototype.Vg;N.prototype.Yg=function(a){E("wilddog.auth().signOut",0,1,arguments.length);F("wilddog.auth().signOut",1,a,!0);var b=new A;sc(this.ea,C(b,a));return b.u};N.prototype.signOut=N.prototype.Yg; N.prototype.Yf=function(a,b,c){E("wilddog.auth().createUserWithEmailAndPassword",2,3,arguments.length);F("wilddog.auth().createUserWithEmailAndPassword",3,c,!0);var d=new A;kd(this.ea,{email:a,password:b},C(d,c));return d.u};N.prototype.createUserWithEmailAndPassword=N.prototype.Yf; N.prototype.Zf=function(a,b,c){E("wilddog.auth().createUserWithPhoneAndPassword",2,3,arguments.length);F("wilddog.auth().createUserWithPhoneAndPassword",3,c,!0);var d=new A;kd(this.ea,{phoneNumber:a,password:b},C(d,c));return d.u};N.prototype.createUserWithPhoneAndPassword=N.prototype.Zf;N.prototype.Wg=function(a,b){E("wilddog.auth().signInWithPopup",1,2,arguments.length);nc("wilddog.auth().signInWithPopup",a);var c=new A;tc(this.ea,a,{authType:"login"},C(c,b));return c.u}; N.prototype.signInWithPopup=N.prototype.Wg;N.prototype.Xg=function(a,b){E("wilddog.auth().signInWithRedirect",1,2,arguments.length);nc("wilddog.auth().signInWithRedirect",a);var c=new A;uc(this.ea,a,{authType:"login"},C(c,b));return c.u};N.prototype.signInWithRedirect=N.prototype.Xg; N.prototype.Sg=function(a,b){E("wilddog.auth().signInWithCredential",1,2,arguments.length);nc("wilddog.auth().signInWithCredential",a);var c={};"password"==a.provider?(c.providerId=a.provider,c.email=a.email,c.phoneNumber=a.phone,c.password=a.password):(c.providerId=a.provider,c.accessToken=a.accessToken,c.openId=a.openId||a.email);c.authType="login";var d=new A;pc(this.ea,c,C(d,b));return d.u};N.prototype.signInWithCredential=N.prototype.Sg;function Od(){this.Ye="DEFAULT";this.sg={};this.$c={};this.he=this.app=null}Od.prototype.og=function(a,b){var c=b||this.Ye;this.$c[c]=new z(a,c);b==this.Ye||null==b?this.app=this.$c[c]:this[c]=this.$c[c];return this.$c[c]};Od.prototype.initializeApp=Od.prototype.og;Od.prototype.He=function(a,b){this.sg[a]=b;Cb(a,b);this[a]=function(){if(this.app)return this.app[a]();throw Error("Default application not initialized!Please call wilddog.initializeApp first.");}};Od.prototype.regService=Od.prototype.He; Od.prototype.Re=CLIENT_VERSION;Od.prototype.SDK_VERSION=Od.prototype.Re;var Pd=new Od;function Qd(a,b){return tb(a.name,b.name)}function Rd(a,b){return tb(a,b)};function Sd(){}var Td={};function Ud(a){return r(a.compare,a)}Sd.prototype.ud=function(a,b){return 0!==this.compare(new O("[MIN_NAME]",a),new O("[MIN_NAME]",b))};function Vd(a){this.ic=a}la(Vd,Sd);h=Vd.prototype;h.Gc=function(a){return!a.S(this.ic).f()};h.compare=function(a,b){var c=a.node.S(this.ic),d=b.node.S(this.ic),c=c.Ac(d);return 0===c?tb(a.name,b.name):c};h.Lc=function(a,b){var c=P(a),c=Q.V(this.ic,c);return new O(b,c)};h.Mc=function(){var a=Q.V(this.ic,Wd);return new O("[MAX_NAME]",a)}; h.toString=function(){return this.ic};function Xd(){}la(Xd,Sd);h=Xd.prototype;h.compare=function(a,b){var c=a.node.H(),d=b.node.H(),c=c.Ac(d);return 0===c?tb(a.name,b.name):c};h.Gc=function(a){return!a.H().f()};h.ud=function(a,b){return!a.H().fa(b.H())};h.Mc=function(){return new O("[MAX_NAME]",new Yd("[PRIORITY-POST]",Wd))};h.Lc=function(a,b){var c=P(a);return new O(b,new Yd("[PRIORITY-POST]",c))};h.toString=function(){return".priority"};var R=new Xd;function Zd(){}la(Zd,Sd);h=Zd.prototype; h.compare=function(a,b){return tb(a.name,b.name)};h.Gc=function(){throw hb("KeyIndex.isDefinedOn not expected to be called.");};h.ud=function(){return!1};h.Mc=function(){return new O("[MAX_NAME]",Q)};h.Lc=function(a){v(q(a),"KeyIndex indexValue must always be a string.");return new O(a,Q)};h.toString=function(){return".key"};var $d=new Zd;function ae(){}la(ae,Sd);h=ae.prototype;h.compare=function(a,b){var c=a.node.Ac(b.node);return 0===c?tb(a.name,b.name):c};h.Gc=function(){return!0}; h.ud=function(a,b){return!a.fa(b)};h.Mc=function(){return be};h.Lc=function(a,b){var c=P(a);return new O(b,c)};h.toString=function(){return".value"};var ce=new ae;function de(a,b){this.vd=a;this.jc=b}de.prototype.get=function(a){var b=G(this.vd,a);if(!b)throw Error("No index defined for "+a);return b===Td?null:b};function ee(a,b,c){var d=Oa(a.vd,function(d,f){var e=G(a.jc,f);v(e,"Missing index implementation for "+f);if(d===Td){if(e.Gc(b.node)){for(var k=[],l=c.cc(fe),m=S(l);m;)m.name!=b.name&&k.push(m),m=S(l);k.push(b);return ge(k,Ud(e))}return Td}e=c.get(b.name);k=d;e&&(k=k.remove(new O(b.name,e)));return k.Ya(b,b.node)});return new de(d,a.jc)} function he(a,b,c){var d=Oa(a.vd,functio