diff --git a/README.md b/README.md index 0d528bb96..7116f8dc9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ For correct work of JS SDK you must include the library in your html before `qu ```html - + ``` ## Bower and RequireJS diff --git a/bower.json b/bower.json index 2cc1ecd81..fcc422e35 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "quickblox", "description": "QuickBlox JavaScript SDK", - "version": "2.2.3", + "version": "2.3.0", "homepage": "https://quickblox.com/developers/Javascript", "main": "quickblox.js", "license": "Apache 2.0", diff --git a/package.json b/package.json index 5d8b23d33..ee27dbde7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "quickblox", "description": "QuickBlox JavaScript SDK", - "version": "2.2.3", + "version": "2.3.0", "homepage": "https://quickblox.com/developers/Javascript", "main": "src/qbMain.js", "license": [ diff --git a/quickblox.min.js b/quickblox.min.js index 039e1f5e4..9b8b0cc8f 100644 --- a/quickblox.min.js +++ b/quickblox.min.js @@ -1,21 +1,20 @@ -/* QuickBlox JavaScript SDK - v2.2.3 - 2016-09-28 */ +/* QuickBlox JavaScript SDK - v2.3.0 - 2016-09-28 */ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.QB=a()}}(function(){var define,module,exports;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gf;f++){var g=255&c[f>>>2]>>>24-8*(f%4);b[d+f>>>2]|=g<<24-8*((d+f)%4)}else if(c.length>65535)for(var f=0;e>f;f+=4)b[d+f>>>2]=c[f>>>2];else b.push.apply(b,c);return this.sigBytes+=e,this},clamp:function(){var b=this.words,c=this.sigBytes;b[c>>>2]&=4294967295<<32-8*(c%4),b.length=a.ceil(c/4)},clone:function(){var a=e.clone.call(this);return a.words=this.words.slice(0),a},random:function(b){for(var c=[],d=0;b>d;d+=4)c.push(0|4294967296*a.random());return new f.init(c,b)}}),g=c.enc={},h=g.Hex={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=255&b[e>>>2]>>>24-8*(e%4);d.push((f>>>4).toString(16)),d.push((15&f).toString(16))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d+=2)c[d>>>3]|=parseInt(a.substr(d,2),16)<<24-4*(d%8);return new f.init(c,b/2)}},i=g.Latin1={stringify:function(a){for(var b=a.words,c=a.sigBytes,d=[],e=0;c>e;e++){var f=255&b[e>>>2]>>>24-8*(e%4);d.push(String.fromCharCode(f))}return d.join("")},parse:function(a){for(var b=a.length,c=[],d=0;b>d;d++)c[d>>>2]|=(255&a.charCodeAt(d))<<24-8*(d%4);return new f.init(c,b)}},j=g.Utf8={stringify:function(a){try{return decodeURIComponent(escape(i.stringify(a)))}catch(a){throw Error("Malformed UTF-8 data")}},parse:function(a){return i.parse(unescape(encodeURIComponent(a)))}},k=d.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a)),this._data.concat(a),this._nDataBytes+=a.sigBytes},_process:function(b){var c=this._data,d=c.words,e=c.sigBytes,g=this.blockSize,h=4*g,i=e/h;i=b?a.ceil(i):a.max((0|i)-this._minBufferSize,0);var j=i*g,k=a.min(4*j,e);if(j){for(var l=0;j>l;l+=g)this._doProcessBlock(d,l);var m=d.splice(0,j);c.sigBytes-=k}return new f.init(m,k)},clone:function(){var a=e.clone.call(this);return a._data=this._data.clone(),a},_minBufferSize:0});d.Hasher=k.extend({cfg:e.extend(),init:function(a){this.cfg=this.cfg.extend(a),this.reset()},reset:function(){k.reset.call(this),this._doReset()},update:function(a){return this._append(a),this._process(),this},finalize:function(a){a&&this._append(a);var b=this._doFinalize();return b},blockSize:16,_createHelper:function(a){return function(b,c){return new a.init(c).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return new l.HMAC.init(a,c).finalize(b)}}});var l=c.algo={};return c}(Math);return a})},{}],2:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core"),a("./sha1"),a("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],e):e(d.CryptoJS)}(this,function(a){return a.HmacSHA1})},{"./core":1,"./hmac":3,"./sha1":4}],3:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){!function(){var b=a,c=b.lib,d=c.Base,e=b.enc,f=e.Utf8,g=b.algo;g.HMAC=d.extend({init:function(a,b){a=this._hasher=new a.init,"string"==typeof b&&(b=f.parse(b));var c=a.blockSize,d=4*c;b.sigBytes>d&&(b=a.finalize(b)),b.clamp();for(var e=this._oKey=b.clone(),g=this._iKey=b.clone(),h=e.words,i=g.words,j=0;c>j;j++)h[j]^=1549556828,i[j]^=909522486;e.sigBytes=g.sigBytes=d,this.reset()},reset:function(){var a=this._hasher;a.reset(),a.update(this._iKey)},update:function(a){return this._hasher.update(a),this},finalize:function(a){var b=this._hasher,c=b.finalize(a);b.reset();var d=b.finalize(this._oKey.clone().concat(c));return d}})}()})},{"./core":1}],4:[function(a,b,c){!function(d,e){"object"==typeof c?b.exports=c=e(a("./core")):"function"==typeof define&&define.amd?define(["./core"],e):e(d.CryptoJS)}(this,function(a){return function(){var b=a,c=b.lib,d=c.WordArray,e=c.Hasher,f=b.algo,g=[],h=f.SHA1=e.extend({_doReset:function(){this._hash=new d.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(a,b){for(var c=this._hash.words,d=c[0],e=c[1],f=c[2],h=c[3],i=c[4],j=0;80>j;j++){if(16>j)g[j]=0|a[b+j];else{var k=g[j-3]^g[j-8]^g[j-14]^g[j-16];g[j]=k<<1|k>>>31}var l=(d<<5|d>>>27)+i+g[j];l+=20>j?(e&f|~e&h)+1518500249:40>j?(e^f^h)+1859775393:60>j?(e&f|e&h|f&h)-1894007588:(e^f^h)-899497514,i=h,h=f,f=e<<30|e>>>2,e=d,d=l}c[0]=0|c[0]+d,c[1]=0|c[1]+e,c[2]=0|c[2]+f,c[3]=0|c[3]+h,c[4]=0|c[4]+i},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;return b[d>>>5]|=128<<24-d%32,b[(d+64>>>9<<4)+14]=Math.floor(c/4294967296),b[(d+64>>>9<<4)+15]=c,a.sigBytes=4*b.length,this._process(),this._hash},clone:function(){var a=e.clone.call(this);return a._hash=this._hash.clone(),a}});b.SHA1=e._createHelper(h),b.HmacSHA1=e._createHmacHelper(h)}(),a.SHA1})},{"./core":1}],5:[function(a,b,c){},{}],6:[function(a,b,c){function d(a,b){return n.isUndefined(b)?""+b:n.isNumber(b)&&!isFinite(b)?b.toString():n.isFunction(b)||n.isRegExp(b)?b.toString():b}function e(a,b){return n.isString(a)?a.length=0;f--)if(g[f]!=h[f])return!1;for(f=g.length-1;f>=0;f--)if(e=g[f],!i(a[e],b[e]))return!1;return!0}function l(a,b){return!(!a||!b)&&("[object RegExp]"==Object.prototype.toString.call(b)?b.test(a):a instanceof b||b.call({},a)===!0)}function m(a,b,c,d){var e;n.isString(c)&&(d=c,c=null);try{b()}catch(a){e=a}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&g(e,c,"Missing expected exception"+d),!a&&l(e,c)&&g(e,c,"Got unwanted exception"+d),a&&e&&c&&!l(e,c)||!a&&e)throw e}var n=a("util/"),o=Array.prototype.slice,p=Object.prototype.hasOwnProperty,q=b.exports=h;q.AssertionError=function(a){this.name="AssertionError",this.actual=a.actual,this.expected=a.expected,this.operator=a.operator,a.message?(this.message=a.message,this.generatedMessage=!1):(this.message=f(this),this.generatedMessage=!0);var b=a.stackStartFunction||g;if(Error.captureStackTrace)Error.captureStackTrace(this,b);else{var c=new Error;if(c.stack){var d=c.stack,e=b.name,h=d.indexOf("\n"+e);if(h>=0){var i=d.indexOf("\n",h+1);d=d.substring(i+1)}this.stack=d}}},n.inherits(q.AssertionError,Error),q.fail=g,q.ok=h,q.equal=function(a,b,c){a!=b&&g(a,b,c,"==",q.equal)},q.notEqual=function(a,b,c){a==b&&g(a,b,c,"!=",q.notEqual)},q.deepEqual=function(a,b,c){i(a,b)||g(a,b,c,"deepEqual",q.deepEqual)},q.notDeepEqual=function(a,b,c){i(a,b)&&g(a,b,c,"notDeepEqual",q.notDeepEqual)},q.strictEqual=function(a,b,c){a!==b&&g(a,b,c,"===",q.strictEqual)},q.notStrictEqual=function(a,b,c){a===b&&g(a,b,c,"!==",q.notStrictEqual)},q.throws=function(a,b,c){m.apply(this,[!0].concat(o.call(arguments)))},q.doesNotThrow=function(a,b){m.apply(this,[!1].concat(o.call(arguments)))},q.ifError=function(a){if(a)throw a};var r=Object.keys||function(a){var b=[];for(var c in a)p.call(a,c)&&b.push(c);return b}},{"util/":224}],7:[function(a,b,c){arguments[4][5][0].apply(c,arguments)},{dup:5}],8:[function(a,b,c){(function(b){"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(a){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,b<0?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;c>>1;return c&&(a.parent=Z),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return R(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return U(a).length;default:if(d)return R(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b=0|b,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),b<0&&(b=0),c>this.length&&(c=this.length),c<=b)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(l<55296||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&l<1114112&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=$)return String.fromCharCode.apply(String,a);for(var c="",d=0;dd)&&(c=d);for(var e="",f=b;fc)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||ba.length)throw new RangeError("index out of range")}function J(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e>>8*(d?e:1-e)}function K(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||ba.length)throw new RangeError("index out of range");if(c<0)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(aa,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Q(a){return a<16?"0"+a.toString(16):a.toString(16)}function R(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function S(a){for(var b=[],c=0;c>8,e=c%256,f.push(e),f.push(d);return f}function U(a){return W.toByteArray(O(a))}function V(a,b,c,d){for(var e=0;e=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var W=a("base64-js"),X=a("ieee754"),Y=a("isarray");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var Z={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);e0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),""},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(b<0&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c,a<0&&(a=0)):a>c&&(a=c),b<0?(b+=c,b<0&&(b=0)):b>c&&(b=c),b0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b=0|b,c=0|c,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=a<0?1:0;for(this[b]=255&a;++f>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=a<0?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b=0;e--)a[e+b]=this[e+c];else if(g<1e3||!f.TYPED_ARRAY_SUPPORT)for(e=0;e=this.length)throw new RangeError("start out of bounds");if(c<0||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;d0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new f(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,e=0;d>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function e(a){function b(a){return d.charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var e,f,g,h=a.length%3,i="";for(e=0,g=a.length-h;e>2),i+=b(f<<4&63),i+="==";break;case 2:f=(a[a.length-2]<<8)+a[a.length-1],i+=b(f>>10),i+=b(f>>4&63),i+=b(f<<2&63),i+="="}return i}var f="undefined"!=typeof Uint8Array?Uint8Array:Array,g="+".charCodeAt(0),h="/".charCodeAt(0),i="0".charCodeAt(0),j="a".charCodeAt(0),k="A".charCodeAt(0),l="-".charCodeAt(0),m="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=e}("undefined"==typeof c?this.base64js={}:c)},{}],10:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],11:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],12:[function(a,b,c){"use strict";c.randomBytes=c.rng=c.pseudoRandomBytes=c.prng=a("randombytes"),c.createHash=c.Hash=a("create-hash"),c.createHmac=c.Hmac=a("create-hmac");var d=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(Object.keys(a("browserify-sign/algos")));c.getHashes=function(){return d};var e=a("pbkdf2");c.pbkdf2=e.pbkdf2,c.pbkdf2Sync=e.pbkdf2Sync;var f=a("browserify-cipher");["Cipher","createCipher","Cipheriv","createCipheriv","Decipher","createDecipher","Decipheriv","createDecipheriv","getCiphers","listCiphers"].forEach(function(a){c[a]=f[a]});var g=a("diffie-hellman");["DiffieHellmanGroup","createDiffieHellmanGroup","getDiffieHellman","createDiffieHellman","DiffieHellman"].forEach(function(a){c[a]=g[a]});var h=a("browserify-sign");["createSign","Sign","createVerify","Verify"].forEach(function(a){c[a]=h[a]}),c.createECDH=a("create-ecdh");var i=a("public-encrypt");["publicEncrypt","privateEncrypt","publicDecrypt","privateDecrypt"].forEach(function(a){c[a]=i[a]}),["createCredentials"].forEach(function(a){c[a]=function(){throw new Error(["sorry, "+a+" is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join("\n"))}})},{"browserify-cipher":13,"browserify-sign":43, -"browserify-sign/algos":42,"create-ecdh":110,"create-hash":136,"create-hmac":149,"diffie-hellman":150,pbkdf2:157,"public-encrypt":158,randombytes:203}],13:[function(a,b,c){function d(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return f(a,e.key,e.iv)}function e(a,b){var c,d;if(a=a.toLowerCase(),m[a])c=m[a].key,d=m[a].iv;else{if(!l[a])throw new TypeError("invalid suite type");c=8*l[a].key,d=l[a].iv}var e=i(b,!1,c,d);return g(a,e.key,e.iv)}function f(a,b,c){if(a=a.toLowerCase(),m[a])return j.createCipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a});throw new TypeError("invalid suite type")}function g(a,b,c){if(a=a.toLowerCase(),m[a])return j.createDecipheriv(a,b,c);if(l[a])return new k({key:b,iv:c,mode:a,decrypt:!0});throw new TypeError("invalid suite type")}function h(){return Object.keys(l).concat(j.getCiphers())}var i=a("evp_bytestokey"),j=a("browserify-aes/browser"),k=a("browserify-des"),l=a("browserify-des/modes"),m=a("browserify-aes/modes");c.createCipher=c.Cipher=d,c.createCipheriv=c.Cipheriv=f,c.createDecipher=c.Decipher=e,c.createDecipheriv=c.Decipheriv=g,c.listCiphers=c.getCiphers=h},{"browserify-aes/browser":16,"browserify-aes/modes":20,"browserify-des":31,"browserify-des/modes":32,evp_bytestokey:41}],14:[function(a,b,c){(function(a){function b(a){var b,c;return b=a>h||a<0?(c=Math.abs(a)%h,a<0?h-c:c):a}function d(a){for(var b=0;b>>8^255&c^99,this.SBOX[e]=c,this.INV_SBOX[c]=e,f=a[e],g=a[f],h=a[g],d=257*a[c]^16843008*c,this.SUB_MIX[0][e]=d<<24|d>>>8,this.SUB_MIX[1][e]=d<<16|d>>>16,this.SUB_MIX[2][e]=d<<8|d>>>24,this.SUB_MIX[3][e]=d,d=16843009*h^65537*g^257*f^16843008*e,this.INV_SUB_MIX[0][c]=d<<24|d>>>8,this.INV_SUB_MIX[1][c]=d<<16|d>>>16,this.INV_SUB_MIX[2][c]=d<<8|d>>>24,this.INV_SUB_MIX[3][c]=d,0===e?e=i=1:(e=f^a[a[a[h^f]]],i^=a[a[i]]);return!0};var i=new e;g.blockSize=16,g.prototype.blockSize=g.blockSize,g.keySize=32,g.prototype.keySize=g.keySize,g.prototype._doReset=function(){var a,b,c,d,e,f;for(c=this._key,b=c.length,this._nRounds=b+6,e=4*(this._nRounds+1),this._keySchedule=[],d=0;d>>24,f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f],f^=i.RCON[d/b|0]<<24):b>6&&d%b===4?f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f]:void 0,this._keySchedule[d-b]^f);for(this._invKeySchedule=[],a=0;a>>24]]^i.INV_SUB_MIX[1][i.SBOX[f>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[f>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&f]];return!0},g.prototype.encryptBlock=function(b){b=f(new a(b));var c=this._doCryptBlock(b,this._keySchedule,i.SUB_MIX,i.SBOX),d=new a(16);return d.writeUInt32BE(c[0],0),d.writeUInt32BE(c[1],4),d.writeUInt32BE(c[2],8),d.writeUInt32BE(c[3],12),d},g.prototype.decryptBlock=function(b){b=f(new a(b));var c=[b[3],b[1]];b[1]=c[0],b[3]=c[1];var d=this._doCryptBlock(b,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX),e=new a(16);return e.writeUInt32BE(d[0],0),e.writeUInt32BE(d[3],4),e.writeUInt32BE(d[2],8),e.writeUInt32BE(d[1],12),e},g.prototype.scrub=function(){d(this._keySchedule),d(this._invKeySchedule),d(this._key)},g.prototype._doCryptBlock=function(a,c,d,e){var f,g,h,i,j,k,l,m,n;g=a[0]^c[0],h=a[1]^c[1],i=a[2]^c[2],j=a[3]^c[3],f=4;for(var o=1;o>>24]^d[1][h>>>16&255]^d[2][i>>>8&255]^d[3][255&j]^c[f++],l=d[0][h>>>24]^d[1][i>>>16&255]^d[2][j>>>8&255]^d[3][255&g]^c[f++],m=d[0][i>>>24]^d[1][j>>>16&255]^d[2][g>>>8&255]^d[3][255&h]^c[f++],n=d[0][j>>>24]^d[1][g>>>16&255]^d[2][h>>>8&255]^d[3][255&i]^c[f++],g=k,h=l,i=m,j=n;return k=(e[g>>>24]<<24|e[h>>>16&255]<<16|e[i>>>8&255]<<8|e[255&j])^c[f++],l=(e[h>>>24]<<24|e[i>>>16&255]<<16|e[j>>>8&255]<<8|e[255&g])^c[f++],m=(e[i>>>24]<<24|e[j>>>16&255]<<16|e[g>>>8&255]<<8|e[255&h])^c[f++],n=(e[j>>>24]<<24|e[g>>>16&255]<<16|e[h>>>8&255]<<8|e[255&i])^c[f++],[b(k),b(l),b(m),b(n)]},c.AES=g}).call(this,a("buffer").Buffer)},{buffer:8}],15:[function(a,b,c){(function(c){function d(a,b,e,h){if(!(this instanceof d))return new d(a,b,e);g.call(this),this._finID=c.concat([e,new c([0,0,0,1])]),e=c.concat([e,new c([0,0,0,2])]),this._cipher=new f.AES(b),this._prev=new c(e.length),this._cache=new c(""),this._secCache=new c(""),this._decrypt=h,this._alen=0,this._len=0,e.copy(this._prev),this._mode=a;var j=new c(4);j.fill(0),this._ghash=new i(this._cipher.encryptBlock(j)),this._authTag=null,this._called=!1}function e(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=-1;++e16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache};var p={ECB:a("./modes/ecb"),CBC:a("./modes/cbc"),CFB:a("./modes/cfb"),CFB8:a("./modes/cfb8"),CFB1:a("./modes/cfb1"),OFB:a("./modes/ofb"),CTR:a("./modes/ctr"),GCM:a("./modes/ctr")};c.createDecipher=h,c.createDecipheriv=g}).call(this,a("buffer").Buffer)},{"./aes":14,"./authCipher":15,"./modes":20,"./modes/cbc":21,"./modes/cfb":22,"./modes/cfb1":23,"./modes/cfb8":24,"./modes/ctr":25,"./modes/ecb":26,"./modes/ofb":27,"./streamCipher":30,buffer:8,"cipher-base":29,evp_bytestokey:41,inherits:205}],18:[function(a,b,c){(function(b){function d(a,c,f){return this instanceof d?(i.call(this),this._cache=new e,this._cipher=new h.AES(c),this._prev=new b(f.length),f.copy(this._prev),this._mode=a,void(this._autopadding=!0)):new d(a,c,f)}function e(){return this instanceof e?void(this.cache=new b("")):new e}function f(a,c,e){var f=k[a.toLowerCase()];if(!f)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=new b(e)),"string"==typeof c&&(c=new b(c)),c.length!==f.key/8)throw new TypeError("invalid key length "+c.length);if(e.length!==f.iv)throw new TypeError("invalid iv length "+e.length);return"stream"===f.type?new m(o[f.mode],c,e):"auth"===f.type?new n(o[f.mode],c,e):new d(o[f.mode],c,e)}function g(a,b){var c=k[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=l(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./aes"),i=a("cipher-base"),j=a("inherits"),k=a("./modes"),l=a("evp_bytestokey"),m=a("./streamCipher"),n=a("./authCipher");j(d,i),d.prototype._update=function(a){this._cache.add(a);for(var c,d,e=[];c=this._cache.get();)d=this._mode.encrypt(this,c),e.push(d);return b.concat(e)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if("10101010101010101010101010101010"!==a.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=b.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,c=new b(a),d=-1;++di||a<0?(c=Math.abs(a)%i,a<0?i-c:c):a}function g(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}var h=new a(16);h.fill(0),b.exports=c,c.prototype.ghash=function(a){for(var b=-1;++b0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(h)},c.prototype.update=function(b){this.cache=a.concat([this.cache,b]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},c.prototype.final=function(b,c){return this.cache.length&&this.ghash(a.concat([this.cache,h],16)),this.ghash(e([0,b,0,c])),this.state};var i=Math.pow(2,32)}).call(this,a("buffer").Buffer)},{buffer:8}],20:[function(a,b,c){c["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},c["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},c["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},c["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},c["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},c["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},c.aes128=c["aes-128-cbc"],c.aes192=c["aes-192-cbc"],c.aes256=c["aes-256-cbc"],c["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},c["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},c["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},c["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},c["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},c["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},c["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},c["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},c["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},c["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},c["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},c["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},c["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},c["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},c["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},c["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},c["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},c["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],21:[function(a,b,c){var d=a("buffer-xor");c.encrypt=function(a,b){var c=d(b,a._prev);return a._prev=a._cipher.encryptBlock(c),a._prev},c.decrypt=function(a,b){var c=a._prev;a._prev=b;var e=a._cipher.decryptBlock(b);return d(e,c)}},{"buffer-xor":28}],22:[function(a,b,c){(function(b){function d(a,c,d){var f=c.length,g=e(c,a._cache);return a._cache=a._cache.slice(f),a._prev=b.concat([a._prev,d?c:g]),g}var e=a("buffer-xor");c.encrypt=function(a,c,e){for(var f,g=new b("");c.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=new b("")),!(a._cache.length<=c.length)){g=b.concat([g,d(a,c,e)]);break}f=a._cache.length,g=b.concat([g,d(a,c.slice(0,f),e)]),c=c.slice(f)}return g}}).call(this,a("buffer").Buffer)},{buffer:8,"buffer-xor":28}],23:[function(a,b,c){(function(a){function b(a,b,c){for(var e,f,g,h=-1,i=8,j=0;++h>h%8,a._prev=d(a._prev,c?f:g);return j}function d(b,c){var d=b.length,e=-1,f=new a(b.length);for(b=a.concat([b,new a([c])]);++e>7;return f}c.encrypt=function(c,d,e){for(var f=d.length,g=new a(f),h=-1;++h0;d--)b+=this._buffer(a,b),c+=this._flushBuffer(e,c);return b+=this._buffer(a,b),e},d.prototype.final=function(a){var b;a&&(b=this.update(a));var c;return c="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),b?b.concat(c):c},d.prototype._pad=function(a,b){if(0===b)return!1;for(;b>>1];c=i.r28shl(c,g),d=i.r28shl(d,g),i.pc2(c,d,a.keys,e)}},e.prototype._update=function(a,b,c,d){var e=this._desState,f=i.readUInt32BE(a,b),g=i.readUInt32BE(a,b+4);i.ip(f,g,e.tmp,0),f=e.tmp[0],g=e.tmp[1],"encrypt"===this.type?this._encrypt(e,f,g,e.tmp,0):this._decrypt(e,f,g,e.tmp,0),f=e.tmp[0],g=e.tmp[1],i.writeUInt32BE(c,f,d),i.writeUInt32BE(c,g,d+4)},e.prototype._pad=function(a,b){for(var c=a.length-b,d=b;d>>0,f=n}i.rip(g,f,d,e)},e.prototype._decrypt=function(a,b,c,d,e){for(var f=c,g=b,h=a.keys.length-2;h>=0;h-=2){var j=a.keys[h],k=a.keys[h+1];i.expand(f,a.tmp,0),j^=a.tmp[0],k^=a.tmp[1];var l=i.substitute(j,k),m=i.permute(l),n=f;f=(g^m)>>>0,g=n}i.rip(f,g,d,e)}},{"../des":34,inherits:205,"minimalistic-assert":40}],38:[function(a,b,c){"use strict";function d(a,b){f.equal(b.length,24,"Invalid key length");var c=b.slice(0,8),d=b.slice(8,16),e=b.slice(16,24);"encrypt"===a?this.ciphers=[j.create({type:"encrypt",key:c}),j.create({type:"decrypt",key:d}),j.create({type:"encrypt",key:e})]:this.ciphers=[j.create({type:"decrypt",key:e}),j.create({type:"encrypt",key:d}),j.create({type:"decrypt",key:c})]}function e(a){i.call(this,a);var b=new d(this.type,this.options.key);this._edeState=b}var f=a("minimalistic-assert"),g=a("inherits"),h=a("../des"),i=h.Cipher,j=h.DES;g(e,i),b.exports=e,e.create=function(a){return new e(a)},e.prototype._update=function(a,b,c,d){var e=this._edeState;e.ciphers[0]._update(a,b,c,d),e.ciphers[1]._update(c,d,c,d),e.ciphers[2]._update(c,d,c,d)},e.prototype._pad=j.prototype._pad,e.prototype._unpad=j.prototype._unpad},{"../des":34,inherits:205,"minimalistic-assert":40}],39:[function(a,b,c){"use strict";c.readUInt32BE=function(a,b){var c=a[0+b]<<24|a[1+b]<<16|a[2+b]<<8|a[3+b];return c>>>0},c.writeUInt32BE=function(a,b,c){a[0+c]=b>>>24,a[1+c]=b>>>16&255,a[2+c]=b>>>8&255,a[3+c]=255&b},c.ip=function(a,b,c,d){for(var e=0,f=0,g=6;g>=0;g-=2){for(var h=0;h<=24;h+=8)e<<=1,e|=b>>>h+g&1;for(var h=0;h<=24;h+=8)e<<=1,e|=a>>>h+g&1}for(var g=6;g>=0;g-=2){for(var h=1;h<=25;h+=8)f<<=1,f|=b>>>h+g&1;for(var h=1;h<=25;h+=8)f<<=1,f|=a>>>h+g&1}c[d+0]=e>>>0,c[d+1]=f>>>0},c.rip=function(a,b,c,d){for(var e=0,f=0,g=0;g<4;g++)for(var h=24;h>=0;h-=8)e<<=1,e|=b>>>h+g&1,e<<=1,e|=a>>>h+g&1;for(var g=4;g<8;g++)for(var h=24;h>=0;h-=8)f<<=1,f|=b>>>h+g&1,f<<=1,f|=a>>>h+g&1;c[d+0]=e>>>0,c[d+1]=f>>>0},c.pc1=function(a,b,c,d){for(var e=0,f=0,g=7;g>=5;g--){for(var h=0;h<=24;h+=8)e<<=1,e|=b>>h+g&1;for(var h=0;h<=24;h+=8)e<<=1,e|=a>>h+g&1}for(var h=0;h<=24;h+=8)e<<=1,e|=b>>h+g&1;for(var g=1;g<=3;g++){for(var h=0;h<=24;h+=8)f<<=1,f|=b>>h+g&1;for(var h=0;h<=24;h+=8)f<<=1,f|=a>>h+g&1}for(var h=0;h<=24;h+=8)f<<=1,f|=a>>h+g&1;c[d+0]=e>>>0,c[d+1]=f>>>0},c.r28shl=function(a,b){return a<>>28-b};var d=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];c.pc2=function(a,b,c,e){for(var f=0,g=0,h=d.length>>>1,i=0;i>>d[i]&1;for(var i=h;i>>d[i]&1;c[e+0]=f>>>0,c[e+1]=g>>>0},c.expand=function(a,b,c){var d=0,e=0;d=(1&a)<<5|a>>>27;for(var f=23;f>=15;f-=4)d<<=6,d|=a>>>f&63;for(var f=11;f>=3;f-=4)e|=a>>>f&63,e<<=6;e|=(31&a)<<1|a>>>31,b[c+0]=d>>>0,b[c+1]=e>>>0};var e=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];c.substitute=function(a,b){for(var c=0,d=0;d<4;d++){var f=a>>>18-6*d&63,g=e[64*d+f];c<<=4,c|=g}for(var d=0;d<4;d++){var f=b>>>18-6*d&63,g=e[256+64*d+f];c<<=4,c|=g}return c>>>0};var f=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];c.permute=function(a){for(var b=0,c=0;c>>f[c]&1;return b>>>0},c.padSplit=function(a,b,c){for(var d=a.toString(2);d.length0&&n.push(g),n.push(a),b&&n.push(b),g=e(c.concat(n)),n=[],h=0,d>0)for(;;){if(0===d)break;if(h===g.length)break;k[i++]=g[h],d--,h++}if(f>0&&h!==g.length)for(;;){if(0===f)break;if(h===g.length)break;l[j++]=g[h],f--,h++}if(0===d&&0===f)break}for(h=0;h=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function h(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g=49?h-49+10:h>=17?h-17+10:h}return e}function i(a){for(var b=new Array(a.bitLength()),c=0;c>>e}return b}function j(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function k(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function l(a,b,c){var d=new m;return d.mulp(a,b,c)}function m(a,b){this.x=a,this.y=b}function n(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function o(){n.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){n.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function q(){n.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function r(){n.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function s(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function t(a){s.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var u;try{u=a("buffer").Buffer}catch(a){}f.isBN=function(a){return a instanceof f||null!==a&&"object"==typeof a&&a.constructor.wordSize===f.wordSize&&Array.isArray(a.words)},f.max=function(a,b){return a.cmp(b)>0?a:b},f.min=function(a,b){return a.cmp(b)<0?a:b},f.prototype._init=function(a,b,c){if("number"==typeof a)return this._initNumber(a,b,c);if("object"==typeof a)return this._initArray(a,b,c);"hex"===b&&(b=16),d(b===(0|b)&&b>=2&&b<=36),a=a.toString().replace(/\s+/g,"");var e=0;"-"===a[0]&&e++,16===b?this._parseHex(a,e):this._parseBase(a,b,e),"-"===a[0]&&(this.negative=1),this.strip(),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initNumber=function(a,b,c){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[67108863&a],this.length=1):a<4503599627370496?(this.words=[67108863&a,a/67108864&67108863],this.length=2):(d(a<9007199254740992),this.words=[67108863&a,a/67108864&67108863,1],this.length=3),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initArray=function(a,b,c){if(d("number"==typeof a.length),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var e=0;e=0;e-=3)g=a[e]|a[e-1]<<8|a[e-2]<<16,this.words[f]|=g<>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);else if("le"===c)for(e=0,f=0;e>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);return this.strip()},f.prototype._parseHex=function(a,b){this.length=Math.ceil((a.length-b)/6),this.words=new Array(this.length);for(var c=0;c=b;c-=6)e=g(a,c,c+6),this.words[d]|=e<>>26-f&4194303,f+=24,f>=26&&(f-=26,d++);c+6!==b&&(e=g(a,b,c+6),this.words[d]|=e<>>26-f&4194303),this.strip()},f.prototype._parseBase=function(a,b,c){this.words=[0],this.length=1;for(var d=0,e=1;e<=67108863;e*=b)d++;d--,e=e/b|0;for(var f=a.length-c,g=f%d,i=Math.min(f,f-g)+c,j=0,k=c;k1&&0===this.words[this.length-1];)this.length--;return this._normSign()},f.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?""};var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];f.prototype.toString=function(a,b){a=a||10,b=0|b||1;var c;if(16===a||"hex"===a){c="";for(var e=0,f=0,g=0;g>>24-e&16777215,c=0!==f||g!==this.length-1?v[6-i.length]+i+c:i+c,e+=2,e>=26&&(e-=26,g--)}for(0!==f&&(c=f.toString(16)+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(a===(0|a)&&a>=2&&a<=36){var j=w[a],k=x[a];c="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(k).toString(a);l=l.idivn(k),c=l.isZero()?m+c:v[j-m.length]+m+c}for(this.isZero()&&(c="0"+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}d(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var a=this.words[0];return 2===this.length?a+=67108864*this.words[1]:3===this.length&&1===this.words[2]?a+=4503599627370496+67108864*this.words[1]:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-a:a},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(a,b){return d("undefined"!=typeof u),this.toArrayLike(u,a,b)},f.prototype.toArray=function(a,b){return this.toArrayLike(Array,a,b)},f.prototype.toArrayLike=function(a,b,c){var e=this.byteLength(),f=c||Math.max(1,e);d(e<=f,"byte array longer than desired length"),d(f>0,"Requested array length <= 0"),this.strip();var g,h,i="le"===b,j=new a(f),k=this.clone();if(i){for(h=0;!k.isZero();h++)g=k.andln(255),k.iushrn(8),j[h]=g;for(;h=4096&&(c+=13,b>>>=13),b>=64&&(c+=7,b>>>=7),b>=8&&(c+=4,b>>>=4),b>=2&&(c+=2,b>>>=2),c+b},f.prototype._zeroBits=function(a){if(0===a)return 26;var b=a,c=0;return 0===(8191&b)&&(c+=13,b>>>=13),0===(127&b)&&(c+=7,b>>>=7),0===(15&b)&&(c+=4,b>>>=4),0===(3&b)&&(c+=2,b>>>=2),0===(1&b)&&c++,c},f.prototype.bitLength=function(){var a=this.words[this.length-1],b=this._countBits(a);return 26*(this.length-1)+b},f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,b=0;ba.length?this.clone().ior(a):a.clone().ior(this)},f.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},f.prototype.iuand=function(a){var b;b=this.length>a.length?a:this;for(var c=0;ca.length?this.clone().iand(a):a.clone().iand(this)},f.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},f.prototype.iuxor=function(a){var b,c;this.length>a.length?(b=this,c=a):(b=a,c=this);for(var d=0;da.length?this.clone().ixor(a):a.clone().ixor(this)},f.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},f.prototype.inotn=function(a){d("number"==typeof a&&a>=0);var b=0|Math.ceil(a/26),c=a%26;this._expand(b),c>0&&b--;for(var e=0;e0&&(this.words[e]=~this.words[e]&67108863>>26-c),this.strip()},f.prototype.notn=function(a){return this.clone().inotn(a)},f.prototype.setn=function(a,b){d("number"==typeof a&&a>=0);var c=a/26|0,e=a%26;return this._expand(c+1),b?this.words[c]=this.words[c]|1<a.length?(c=this,d=a):(c=a,d=this);for(var e=0,f=0;f>>26;for(;0!==e&&f>>26;if(this.length=c.length,0!==e)this.words[this.length]=e,this.length++;else if(c!==this)for(;fa.length?this.clone().iadd(a):a.clone().iadd(this)},f.prototype.isub=function(a){if(0!==a.negative){a.negative=0;var b=this.iadd(a);return a.negative=1,b._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var c=this.cmp(a);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;var d,e;c>0?(d=this,e=a):(d=a,e=this);for(var f=0,g=0;g>26,this.words[g]=67108863&b;for(;0!==f&&g>26,this.words[g]=67108863&b;if(0===f&&g>>13,n=0|g[1],o=8191&n,p=n>>>13,q=0|g[2],r=8191&q,s=q>>>13,t=0|g[3],u=8191&t,v=t>>>13,w=0|g[4],x=8191&w,y=w>>>13,z=0|g[5],A=8191&z,B=z>>>13,C=0|g[6],D=8191&C,E=C>>>13,F=0|g[7],G=8191&F,H=F>>>13,I=0|g[8],J=8191&I,K=I>>>13,L=0|g[9],M=8191&L,N=L>>>13,O=0|h[0],P=8191&O,Q=O>>>13,R=0|h[1],S=8191&R,T=R>>>13,U=0|h[2],V=8191&U,W=U>>>13,X=0|h[3],Y=8191&X,Z=X>>>13,$=0|h[4],_=8191&$,aa=$>>>13,ba=0|h[5],ca=8191&ba,da=ba>>>13,ea=0|h[6],fa=8191&ea,ga=ea>>>13,ha=0|h[7],ia=8191&ha,ja=ha>>>13,ka=0|h[8],la=8191&ka,ma=ka>>>13,na=0|h[9],oa=8191&na,pa=na>>>13;c.negative=a.negative^b.negative,c.length=19,d=Math.imul(l,P),e=Math.imul(l,Q),e=e+Math.imul(m,P)|0,f=Math.imul(m,Q);var qa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(qa>>>26)|0,qa&=67108863,d=Math.imul(o,P),e=Math.imul(o,Q),e=e+Math.imul(p,P)|0,f=Math.imul(p,Q),d=d+Math.imul(l,S)|0,e=e+Math.imul(l,T)|0,e=e+Math.imul(m,S)|0,f=f+Math.imul(m,T)|0;var ra=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ra>>>26)|0,ra&=67108863,d=Math.imul(r,P),e=Math.imul(r,Q),e=e+Math.imul(s,P)|0,f=Math.imul(s,Q),d=d+Math.imul(o,S)|0,e=e+Math.imul(o,T)|0,e=e+Math.imul(p,S)|0,f=f+Math.imul(p,T)|0,d=d+Math.imul(l,V)|0,e=e+Math.imul(l,W)|0,e=e+Math.imul(m,V)|0,f=f+Math.imul(m,W)|0;var sa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(sa>>>26)|0,sa&=67108863,d=Math.imul(u,P),e=Math.imul(u,Q),e=e+Math.imul(v,P)|0,f=Math.imul(v,Q),d=d+Math.imul(r,S)|0,e=e+Math.imul(r,T)|0,e=e+Math.imul(s,S)|0,f=f+Math.imul(s,T)|0,d=d+Math.imul(o,V)|0,e=e+Math.imul(o,W)|0,e=e+Math.imul(p,V)|0,f=f+Math.imul(p,W)|0,d=d+Math.imul(l,Y)|0,e=e+Math.imul(l,Z)|0,e=e+Math.imul(m,Y)|0,f=f+Math.imul(m,Z)|0;var ta=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ta>>>26)|0,ta&=67108863,d=Math.imul(x,P),e=Math.imul(x,Q),e=e+Math.imul(y,P)|0,f=Math.imul(y,Q),d=d+Math.imul(u,S)|0,e=e+Math.imul(u,T)|0,e=e+Math.imul(v,S)|0,f=f+Math.imul(v,T)|0,d=d+Math.imul(r,V)|0,e=e+Math.imul(r,W)|0,e=e+Math.imul(s,V)|0,f=f+Math.imul(s,W)|0,d=d+Math.imul(o,Y)|0,e=e+Math.imul(o,Z)|0,e=e+Math.imul(p,Y)|0,f=f+Math.imul(p,Z)|0,d=d+Math.imul(l,_)|0,e=e+Math.imul(l,aa)|0,e=e+Math.imul(m,_)|0,f=f+Math.imul(m,aa)|0;var ua=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ua>>>26)|0,ua&=67108863,d=Math.imul(A,P),e=Math.imul(A,Q),e=e+Math.imul(B,P)|0,f=Math.imul(B,Q),d=d+Math.imul(x,S)|0,e=e+Math.imul(x,T)|0,e=e+Math.imul(y,S)|0,f=f+Math.imul(y,T)|0,d=d+Math.imul(u,V)|0,e=e+Math.imul(u,W)|0,e=e+Math.imul(v,V)|0,f=f+Math.imul(v,W)|0,d=d+Math.imul(r,Y)|0,e=e+Math.imul(r,Z)|0,e=e+Math.imul(s,Y)|0,f=f+Math.imul(s,Z)|0,d=d+Math.imul(o,_)|0,e=e+Math.imul(o,aa)|0,e=e+Math.imul(p,_)|0,f=f+Math.imul(p,aa)|0,d=d+Math.imul(l,ca)|0,e=e+Math.imul(l,da)|0,e=e+Math.imul(m,ca)|0,f=f+Math.imul(m,da)|0;var va=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(va>>>26)|0,va&=67108863,d=Math.imul(D,P),e=Math.imul(D,Q),e=e+Math.imul(E,P)|0,f=Math.imul(E,Q),d=d+Math.imul(A,S)|0,e=e+Math.imul(A,T)|0,e=e+Math.imul(B,S)|0,f=f+Math.imul(B,T)|0,d=d+Math.imul(x,V)|0,e=e+Math.imul(x,W)|0,e=e+Math.imul(y,V)|0,f=f+Math.imul(y,W)|0,d=d+Math.imul(u,Y)|0,e=e+Math.imul(u,Z)|0,e=e+Math.imul(v,Y)|0,f=f+Math.imul(v,Z)|0,d=d+Math.imul(r,_)|0,e=e+Math.imul(r,aa)|0,e=e+Math.imul(s,_)|0,f=f+Math.imul(s,aa)|0,d=d+Math.imul(o,ca)|0,e=e+Math.imul(o,da)|0,e=e+Math.imul(p,ca)|0,f=f+Math.imul(p,da)|0,d=d+Math.imul(l,fa)|0,e=e+Math.imul(l,ga)|0,e=e+Math.imul(m,fa)|0,f=f+Math.imul(m,ga)|0;var wa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(wa>>>26)|0,wa&=67108863,d=Math.imul(G,P),e=Math.imul(G,Q),e=e+Math.imul(H,P)|0,f=Math.imul(H,Q),d=d+Math.imul(D,S)|0,e=e+Math.imul(D,T)|0,e=e+Math.imul(E,S)|0,f=f+Math.imul(E,T)|0,d=d+Math.imul(A,V)|0,e=e+Math.imul(A,W)|0,e=e+Math.imul(B,V)|0,f=f+Math.imul(B,W)|0,d=d+Math.imul(x,Y)|0,e=e+Math.imul(x,Z)|0,e=e+Math.imul(y,Y)|0,f=f+Math.imul(y,Z)|0,d=d+Math.imul(u,_)|0,e=e+Math.imul(u,aa)|0,e=e+Math.imul(v,_)|0,f=f+Math.imul(v,aa)|0,d=d+Math.imul(r,ca)|0,e=e+Math.imul(r,da)|0,e=e+Math.imul(s,ca)|0,f=f+Math.imul(s,da)|0,d=d+Math.imul(o,fa)|0,e=e+Math.imul(o,ga)|0,e=e+Math.imul(p,fa)|0,f=f+Math.imul(p,ga)|0,d=d+Math.imul(l,ia)|0,e=e+Math.imul(l,ja)|0,e=e+Math.imul(m,ia)|0,f=f+Math.imul(m,ja)|0;var xa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(xa>>>26)|0,xa&=67108863,d=Math.imul(J,P),e=Math.imul(J,Q),e=e+Math.imul(K,P)|0,f=Math.imul(K,Q),d=d+Math.imul(G,S)|0,e=e+Math.imul(G,T)|0,e=e+Math.imul(H,S)|0,f=f+Math.imul(H,T)|0,d=d+Math.imul(D,V)|0,e=e+Math.imul(D,W)|0,e=e+Math.imul(E,V)|0,f=f+Math.imul(E,W)|0,d=d+Math.imul(A,Y)|0,e=e+Math.imul(A,Z)|0,e=e+Math.imul(B,Y)|0,f=f+Math.imul(B,Z)|0,d=d+Math.imul(x,_)|0,e=e+Math.imul(x,aa)|0,e=e+Math.imul(y,_)|0,f=f+Math.imul(y,aa)|0,d=d+Math.imul(u,ca)|0,e=e+Math.imul(u,da)|0,e=e+Math.imul(v,ca)|0,f=f+Math.imul(v,da)|0,d=d+Math.imul(r,fa)|0,e=e+Math.imul(r,ga)|0,e=e+Math.imul(s,fa)|0,f=f+Math.imul(s,ga)|0,d=d+Math.imul(o,ia)|0,e=e+Math.imul(o,ja)|0,e=e+Math.imul(p,ia)|0,f=f+Math.imul(p,ja)|0,d=d+Math.imul(l,la)|0,e=e+Math.imul(l,ma)|0,e=e+Math.imul(m,la)|0,f=f+Math.imul(m,ma)|0;var ya=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ya>>>26)|0,ya&=67108863,d=Math.imul(M,P),e=Math.imul(M,Q),e=e+Math.imul(N,P)|0,f=Math.imul(N,Q),d=d+Math.imul(J,S)|0,e=e+Math.imul(J,T)|0,e=e+Math.imul(K,S)|0,f=f+Math.imul(K,T)|0,d=d+Math.imul(G,V)|0,e=e+Math.imul(G,W)|0,e=e+Math.imul(H,V)|0,f=f+Math.imul(H,W)|0,d=d+Math.imul(D,Y)|0,e=e+Math.imul(D,Z)|0,e=e+Math.imul(E,Y)|0,f=f+Math.imul(E,Z)|0,d=d+Math.imul(A,_)|0,e=e+Math.imul(A,aa)|0,e=e+Math.imul(B,_)|0,f=f+Math.imul(B,aa)|0,d=d+Math.imul(x,ca)|0,e=e+Math.imul(x,da)|0,e=e+Math.imul(y,ca)|0,f=f+Math.imul(y,da)|0,d=d+Math.imul(u,fa)|0,e=e+Math.imul(u,ga)|0,e=e+Math.imul(v,fa)|0,f=f+Math.imul(v,ga)|0,d=d+Math.imul(r,ia)|0,e=e+Math.imul(r,ja)|0,e=e+Math.imul(s,ia)|0,f=f+Math.imul(s,ja)|0,d=d+Math.imul(o,la)|0,e=e+Math.imul(o,ma)|0,e=e+Math.imul(p,la)|0,f=f+Math.imul(p,ma)|0,d=d+Math.imul(l,oa)|0,e=e+Math.imul(l,pa)|0,e=e+Math.imul(m,oa)|0,f=f+Math.imul(m,pa)|0;var za=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(za>>>26)|0,za&=67108863,d=Math.imul(M,S),e=Math.imul(M,T),e=e+Math.imul(N,S)|0,f=Math.imul(N,T),d=d+Math.imul(J,V)|0,e=e+Math.imul(J,W)|0,e=e+Math.imul(K,V)|0,f=f+Math.imul(K,W)|0,d=d+Math.imul(G,Y)|0,e=e+Math.imul(G,Z)|0,e=e+Math.imul(H,Y)|0,f=f+Math.imul(H,Z)|0,d=d+Math.imul(D,_)|0,e=e+Math.imul(D,aa)|0,e=e+Math.imul(E,_)|0,f=f+Math.imul(E,aa)|0,d=d+Math.imul(A,ca)|0,e=e+Math.imul(A,da)|0,e=e+Math.imul(B,ca)|0,f=f+Math.imul(B,da)|0,d=d+Math.imul(x,fa)|0,e=e+Math.imul(x,ga)|0,e=e+Math.imul(y,fa)|0,f=f+Math.imul(y,ga)|0,d=d+Math.imul(u,ia)|0,e=e+Math.imul(u,ja)|0,e=e+Math.imul(v,ia)|0,f=f+Math.imul(v,ja)|0,d=d+Math.imul(r,la)|0,e=e+Math.imul(r,ma)|0,e=e+Math.imul(s,la)|0,f=f+Math.imul(s,ma)|0,d=d+Math.imul(o,oa)|0,e=e+Math.imul(o,pa)|0,e=e+Math.imul(p,oa)|0,f=f+Math.imul(p,pa)|0;var Aa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Aa>>>26)|0,Aa&=67108863,d=Math.imul(M,V),e=Math.imul(M,W),e=e+Math.imul(N,V)|0,f=Math.imul(N,W),d=d+Math.imul(J,Y)|0,e=e+Math.imul(J,Z)|0,e=e+Math.imul(K,Y)|0,f=f+Math.imul(K,Z)|0,d=d+Math.imul(G,_)|0,e=e+Math.imul(G,aa)|0,e=e+Math.imul(H,_)|0,f=f+Math.imul(H,aa)|0,d=d+Math.imul(D,ca)|0,e=e+Math.imul(D,da)|0,e=e+Math.imul(E,ca)|0,f=f+Math.imul(E,da)|0,d=d+Math.imul(A,fa)|0,e=e+Math.imul(A,ga)|0,e=e+Math.imul(B,fa)|0,f=f+Math.imul(B,ga)|0,d=d+Math.imul(x,ia)|0,e=e+Math.imul(x,ja)|0,e=e+Math.imul(y,ia)|0,f=f+Math.imul(y,ja)|0,d=d+Math.imul(u,la)|0,e=e+Math.imul(u,ma)|0,e=e+Math.imul(v,la)|0,f=f+Math.imul(v,ma)|0,d=d+Math.imul(r,oa)|0,e=e+Math.imul(r,pa)|0,e=e+Math.imul(s,oa)|0,f=f+Math.imul(s,pa)|0;var Ba=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ba>>>26)|0,Ba&=67108863,d=Math.imul(M,Y),e=Math.imul(M,Z),e=e+Math.imul(N,Y)|0,f=Math.imul(N,Z),d=d+Math.imul(J,_)|0,e=e+Math.imul(J,aa)|0,e=e+Math.imul(K,_)|0,f=f+Math.imul(K,aa)|0,d=d+Math.imul(G,ca)|0,e=e+Math.imul(G,da)|0,e=e+Math.imul(H,ca)|0,f=f+Math.imul(H,da)|0,d=d+Math.imul(D,fa)|0,e=e+Math.imul(D,ga)|0,e=e+Math.imul(E,fa)|0,f=f+Math.imul(E,ga)|0,d=d+Math.imul(A,ia)|0,e=e+Math.imul(A,ja)|0,e=e+Math.imul(B,ia)|0,f=f+Math.imul(B,ja)|0,d=d+Math.imul(x,la)|0,e=e+Math.imul(x,ma)|0,e=e+Math.imul(y,la)|0,f=f+Math.imul(y,ma)|0,d=d+Math.imul(u,oa)|0,e=e+Math.imul(u,pa)|0,e=e+Math.imul(v,oa)|0,f=f+Math.imul(v,pa)|0;var Ca=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,d=Math.imul(M,_),e=Math.imul(M,aa),e=e+Math.imul(N,_)|0,f=Math.imul(N,aa),d=d+Math.imul(J,ca)|0,e=e+Math.imul(J,da)|0,e=e+Math.imul(K,ca)|0,f=f+Math.imul(K,da)|0,d=d+Math.imul(G,fa)|0,e=e+Math.imul(G,ga)|0,e=e+Math.imul(H,fa)|0,f=f+Math.imul(H,ga)|0,d=d+Math.imul(D,ia)|0,e=e+Math.imul(D,ja)|0,e=e+Math.imul(E,ia)|0,f=f+Math.imul(E,ja)|0,d=d+Math.imul(A,la)|0,e=e+Math.imul(A,ma)|0,e=e+Math.imul(B,la)|0,f=f+Math.imul(B,ma)|0,d=d+Math.imul(x,oa)|0,e=e+Math.imul(x,pa)|0,e=e+Math.imul(y,oa)|0,f=f+Math.imul(y,pa)|0;var Da=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Da>>>26)|0,Da&=67108863,d=Math.imul(M,ca),e=Math.imul(M,da),e=e+Math.imul(N,ca)|0,f=Math.imul(N,da),d=d+Math.imul(J,fa)|0,e=e+Math.imul(J,ga)|0,e=e+Math.imul(K,fa)|0,f=f+Math.imul(K,ga)|0,d=d+Math.imul(G,ia)|0,e=e+Math.imul(G,ja)|0,e=e+Math.imul(H,ia)|0,f=f+Math.imul(H,ja)|0,d=d+Math.imul(D,la)|0,e=e+Math.imul(D,ma)|0,e=e+Math.imul(E,la)|0,f=f+Math.imul(E,ma)|0,d=d+Math.imul(A,oa)|0,e=e+Math.imul(A,pa)|0,e=e+Math.imul(B,oa)|0,f=f+Math.imul(B,pa)|0;var Ea=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ea>>>26)|0,Ea&=67108863,d=Math.imul(M,fa),e=Math.imul(M,ga),e=e+Math.imul(N,fa)|0,f=Math.imul(N,ga),d=d+Math.imul(J,ia)|0,e=e+Math.imul(J,ja)|0,e=e+Math.imul(K,ia)|0,f=f+Math.imul(K,ja)|0,d=d+Math.imul(G,la)|0,e=e+Math.imul(G,ma)|0,e=e+Math.imul(H,la)|0,f=f+Math.imul(H,ma)|0,d=d+Math.imul(D,oa)|0,e=e+Math.imul(D,pa)|0,e=e+Math.imul(E,oa)|0,f=f+Math.imul(E,pa)|0;var Fa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,d=Math.imul(M,ia),e=Math.imul(M,ja),e=e+Math.imul(N,ia)|0,f=Math.imul(N,ja),d=d+Math.imul(J,la)|0,e=e+Math.imul(J,ma)|0,e=e+Math.imul(K,la)|0,f=f+Math.imul(K,ma)|0,d=d+Math.imul(G,oa)|0,e=e+Math.imul(G,pa)|0,e=e+Math.imul(H,oa)|0,f=f+Math.imul(H,pa)|0;var Ga=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,d=Math.imul(M,la),e=Math.imul(M,ma),e=e+Math.imul(N,la)|0,f=Math.imul(N,ma),d=d+Math.imul(J,oa)|0,e=e+Math.imul(J,pa)|0,e=e+Math.imul(K,oa)|0,f=f+Math.imul(K,pa)|0;var Ha=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,d=Math.imul(M,oa),e=Math.imul(M,pa),e=e+Math.imul(N,oa)|0,f=Math.imul(N,pa);var Ia=(j+d|0)+((8191&e)<<13)|0;return j=(f+(e>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i[0]=qa,i[1]=ra,i[2]=sa,i[3]=ta,i[4]=ua,i[5]=va,i[6]=wa,i[7]=xa,i[8]=ya,i[9]=za,i[10]=Aa,i[11]=Ba,i[12]=Ca,i[13]=Da,i[14]=Ea,i[15]=Fa,i[16]=Ga,i[17]=Ha,i[18]=Ia,0!==j&&(i[19]=j,c.length++),c};Math.imul||(y=j),f.prototype.mulTo=function(a,b){var c,d=this.length+a.length;return c=10===this.length&&10===a.length?y(this,a,b):d<63?j(this,a,b):d<1024?k(this,a,b):l(this,a,b)},m.prototype.makeRBT=function(a){for(var b=new Array(a),c=f.prototype._countBits(a)-1,d=0;d>=1;return d},m.prototype.permute=function(a,b,c,d,e,f){for(var g=0;g>>=1)e++;return 1<>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b=0);var e;e=b?(b-b%26)/26:0;var f=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<g)for(this.length-=g,j=0;j=0&&(0!==k||j>=e);j--){var l=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}return i&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){return d(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){return this.clone().ishln(a)},f.prototype.ushln=function(a){return this.clone().iushln(a)},f.prototype.shrn=function(a){return this.clone().ishrn(a)},f.prototype.ushrn=function(a){return this.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26,e=1<=0);var b=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),0!==b&&c++,this.length=Math.min(c,this.length),0!==b){var e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},f.prototype.isubn=function(a){if(d("number"==typeof a),d(a<67108864),a<0)return this.iaddn(-a);if(0!==this.negative)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(i/67108864|0),this.words[e+c]=67108863&g}for(;e>26,this.words[e+c]=67108863&g;if(0===h)return this.strip();for(d(h===-1),h=0,e=0;e>26,this.words[e]=67108863&g;return this.negative=1,this.strip()},f.prototype._wordDiv=function(a,b){var c=this.length-a.length,d=this.clone(),e=a,g=0|e.words[e.length-1],h=this._countBits(g);c=26-h,0!==c&&(e=e.ushln(c),d.iushln(c),g=0|e.words[e.length-1]);var i,j=d.length-e.length;if("mod"!==b){i=new f(null),i.length=j+1,i.words=new Array(i.length);for(var k=0;k=0;m--){var n=67108864*(0|d.words[e.length+m])+(0|d.words[e.length+m-1]);for(n=Math.min(n/g|0,67108863),d._ishlnsubmul(e,n,m);0!==d.negative;)n--,d.negative=0,d._ishlnsubmul(e,1,m),d.isZero()||(d.negative^=1);i&&(i.words[m]=n)}return i&&i.strip(),d.strip(),"div"!==b&&0!==c&&d.iushrn(c),{div:i||null,mod:d}},f.prototype.divmod=function(a,b,c){if(d(!a.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var e,g,h;return 0!==this.negative&&0===a.negative?(h=this.neg().divmod(a,b),"mod"!==b&&(e=h.div.neg()),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.iadd(a)),{div:e,mod:g}):0===this.negative&&0!==a.negative?(h=this.divmod(a.neg(),b),"mod"!==b&&(e=h.div.neg()),{div:e,mod:h.mod}):0!==(this.negative&a.negative)?(h=this.neg().divmod(a.neg(),b),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.isub(a)),{div:h.div,mod:g}):a.length>this.length||this.cmp(a)<0?{div:new f(0),mod:this}:1===a.length?"div"===b?{div:this.divn(a.words[0]),mod:null}:"mod"===b?{div:null,mod:new f(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new f(this.modn(a.words[0]))}:this._wordDiv(a,b)},f.prototype.div=function(a){return this.divmod(a,"div",!1).div},f.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},f.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},f.prototype.divRound=function(a){var b=this.divmod(a);if(b.mod.isZero())return b.div;var c=0!==b.div.negative?b.mod.isub(a):b.mod,d=a.ushrn(1),e=a.andln(1),f=c.cmp(d);return f<0||1===e&&0===f?b.div:0!==b.div.negative?b.div.isubn(1):b.div.iaddn(1)},f.prototype.modn=function(a){d(a<=67108863);for(var b=(1<<26)%a,c=0,e=this.length-1;e>=0;e--)c=(b*c+(0|this.words[e]))%a;return c},f.prototype.idivn=function(a){d(a<=67108863);for(var b=0,c=this.length-1;c>=0;c--){var e=(0|this.words[c])+67108864*b;this.words[c]=e/a|0,b=e%a}return this.strip()},f.prototype.divn=function(a){return this.clone().idivn(a)},f.prototype.egcd=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=new f(0),i=new f(1),j=0;b.isEven()&&c.isEven();)b.iushrn(1),c.iushrn(1),++j;for(var k=c.clone(),l=b.clone();!b.isZero();){for(var m=0,n=1;0===(b.words[0]&n)&&m<26;++m,n<<=1);if(m>0)for(b.iushrn(m);m-- >0;)(e.isOdd()||g.isOdd())&&(e.iadd(k),g.isub(l)),e.iushrn(1),g.iushrn(1);for(var o=0,p=1;0===(c.words[0]&p)&&o<26;++o,p<<=1);if(o>0)for(c.iushrn(o);o-- >0;)(h.isOdd()||i.isOdd())&&(h.iadd(k),i.isub(l)),h.iushrn(1),i.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(h),g.isub(i)):(c.isub(b),h.isub(e),i.isub(g))}return{a:h,b:i,gcd:c.iushln(j)}},f.prototype._invmp=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=c.clone();b.cmpn(1)>0&&c.cmpn(1)>0;){for(var i=0,j=1;0===(b.words[0]&j)&&i<26;++i,j<<=1);if(i>0)for(b.iushrn(i);i-- >0;)e.isOdd()&&e.iadd(h),e.iushrn(1);for(var k=0,l=1;0===(c.words[0]&l)&&k<26;++k,l<<=1);if(k>0)for(c.iushrn(k);k-- >0;)g.isOdd()&&g.iadd(h),g.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(g)):(c.isub(b),g.isub(e))}var m;return m=0===b.cmpn(1)?e:g,m.cmpn(0)<0&&m.iadd(a),m},f.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var b=this.clone(),c=a.clone();b.negative=0,c.negative=0;for(var d=0;b.isEven()&&c.isEven();d++)b.iushrn(1),c.iushrn(1);for(;;){for(;b.isEven();)b.iushrn(1);for(;c.isEven();)c.iushrn(1);var e=b.cmp(c);if(e<0){var f=b;b=c,c=f}else if(0===e||0===c.cmpn(1))break;b.isub(c)}return c.iushln(d)},f.prototype.invm=function(a){return this.egcd(a).a.umod(a)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(a){return this.words[0]&a},f.prototype.bincn=function(a){d("number"==typeof a);var b=a%26,c=(a-b)/26,e=1<>>26,h&=67108863,this.words[g]=h}return 0!==f&&(this.words[g]=f,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(a){var b=a<0;if(0!==this.negative&&!b)return-1;if(0===this.negative&&b)return 1;this.strip();var c;if(this.length>1)c=1;else{b&&(a=-a),d(a<=67108863,"Number is too big");var e=0|this.words[0];c=e===a?0:ea.length)return 1;if(this.length=0;c--){var d=0|this.words[c],e=0|a.words[c];if(d!==e){de&&(b=1);break}}return b},f.prototype.gtn=function(a){return 1===this.cmpn(a)},f.prototype.gt=function(a){return 1===this.cmp(a)},f.prototype.gten=function(a){return this.cmpn(a)>=0},f.prototype.gte=function(a){return this.cmp(a)>=0},f.prototype.ltn=function(a){return this.cmpn(a)===-1},f.prototype.lt=function(a){return this.cmp(a)===-1},f.prototype.lten=function(a){return this.cmpn(a)<=0},f.prototype.lte=function(a){return this.cmp(a)<=0},f.prototype.eqn=function(a){return 0===this.cmpn(a)},f.prototype.eq=function(a){return 0===this.cmp(a)},f.red=function(a){return new s(a)},f.prototype.toRed=function(a){return d(!this.red,"Already a number in reduction context"),d(0===this.negative,"red works only with positives"),a.convertTo(this)._forceRed(a)},f.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(a){return this.red=a,this},f.prototype.forceRed=function(a){return d(!this.red,"Already a number in reduction context"),this._forceRed(a)},f.prototype.redAdd=function(a){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},f.prototype.redIAdd=function(a){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},f.prototype.redSub=function(a){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},f.prototype.redISub=function(a){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},f.prototype.redShl=function(a){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},f.prototype.redMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},f.prototype.redIMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},f.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(a){return d(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var z={k256:null,p224:null,p192:null,p25519:null};n.prototype._tmp=function(){var a=new f(null);return a.words=new Array(Math.ceil(this.n/13)),a},n.prototype.ireduce=function(a){var b,c=a;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),b=c.bitLength();while(b>this.n);var d=b0?c.isub(this.p):c.strip(),c},n.prototype.split=function(a,b){a.iushrn(this.n,0,b)},n.prototype.imulK=function(a){return a.imul(this.k)},e(o,n),o.prototype.split=function(a,b){for(var c=4194303,d=Math.min(a.length,9),e=0;e>>22,f=g}f>>>=22,a.words[e-10]=f,0===f&&a.length>10?a.length-=10:a.length-=9},o.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var b=0,c=0;c>>=26,a.words[c]=e,b=d}return 0!==b&&(a.words[a.length++]=b),a},f._prime=function a(b){if(z[b])return z[b];var a;if("k256"===b)a=new o;else if("p224"===b)a=new p;else if("p192"===b)a=new q;else{if("p25519"!==b)throw new Error("Unknown prime "+b);a=new r}return z[b]=a,a},s.prototype._verify1=function(a){d(0===a.negative,"red works only with positives"),d(a.red,"red works only with red numbers")},s.prototype._verify2=function(a,b){d(0===(a.negative|b.negative),"red works only with positives"),d(a.red&&a.red===b.red,"red works only with red numbers")},s.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},s.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},s.prototype.add=function(a,b){this._verify2(a,b);var c=a.add(b);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},s.prototype.iadd=function(a,b){this._verify2(a,b);var c=a.iadd(b);return c.cmp(this.m)>=0&&c.isub(this.m),c},s.prototype.sub=function(a,b){this._verify2(a,b);var c=a.sub(b);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},s.prototype.isub=function(a,b){this._verify2(a,b);var c=a.isub(b);return c.cmpn(0)<0&&c.iadd(this.m),c},s.prototype.shl=function(a,b){return this._verify1(a),this.imod(a.ushln(b))},s.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},s.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},s.prototype.isqr=function(a){return this.imul(a,a.clone())},s.prototype.sqr=function(a){return this.mul(a,a)},s.prototype.sqrt=function(a){if(a.isZero())return a.clone();var b=this.m.andln(3);if(d(b%2===1),3===b){var c=this.m.add(new f(1)).iushrn(2);return this.pow(a,c)}for(var e=this.m.subn(1),g=0;!e.isZero()&&0===e.andln(1);)g++,e.iushrn(1);d(!e.isZero());var h=new f(1).toRed(this),i=h.redNeg(),j=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new f(2*k*k).toRed(this);0!==this.pow(k,j).cmp(i);)k.redIAdd(i);for(var l=this.pow(k,e),m=this.pow(a,e.addn(1).iushrn(1)),n=this.pow(a,e),o=g;0!==n.cmp(h);){for(var p=n,q=0;0!==p.cmp(h);q++)p=p.redSqr();d(q=0;e--){for(var k=b.words[e],l=j-1;l>=0;l--){var m=k>>l&1;g!==d[0]&&(g=this.sqr(g)),0!==m||0!==h?(h<<=1,h|=m,i++,(i===c||0===e&&0===l)&&(g=this.mul(g,d[h]),i=0,h=0)):i=0}j=26}return g},s.prototype.convertTo=function(a){var b=a.umod(this.m);return b===a?b.clone():b},s.prototype.convertFrom=function(a){var b=a.clone();return b.red=null,b},f.mont=function(a){return new t(a)},e(t,s),t.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},t.prototype.convertFrom=function(a){var b=this.imod(a.mul(this.rinv));return b.red=null,b},t.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var c=a.imul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),f=e;return e.cmp(this.m)>=0?f=e.isub(this.m):e.cmpn(0)<0&&(f=e.iadd(this.m)),f._forceRed(this)},t.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new f(0)._forceRed(this);var c=a.mul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),g=e;return e.cmp(this.m)>=0?g=e.isub(this.m):e.cmpn(0)<0&&(g=e.iadd(this.m)),g._forceRed(this)},t.prototype.invm=function(a){var b=this.imod(a._invmp(this.m).mul(this.r2));return b._forceRed(this)}}("undefined"==typeof b||b,this)},{}],46:[function(a,b,c){(function(c){function d(a){var b=f(a),c=b.toRed(g.mont(a.modulus)).redPow(new g(a.publicExponent)).fromRed();return{blinder:c,unblinder:b.invm(a.modulus)}}function e(a,b){var e=d(b),f=b.modulus.byteLength(),h=(g.mont(b.modulus),new g(a).mul(e.blinder).umod(b.modulus)),i=h.toRed(g.mont(b.prime1)),j=h.toRed(g.mont(b.prime2)),k=b.coefficient,l=b.prime1,m=b.prime2,n=i.redPow(b.exponent1),o=j.redPow(b.exponent2);n=n.fromRed(),o=o.fromRed();var p=n.isub(o).imul(k).umod(l);return p.imul(m),o.iadd(p),new c(o.imul(e.unblinder).umod(b.modulus).toArray(!1,f))}function f(a){for(var b=a.modulus.byteLength(),c=new g(h(b));c.cmp(a.modulus)>=0||!c.umod(a.prime1)||!c.umod(a.prime2);)c=new g(h(b));return c}var g=a("bn.js"),h=a("randombytes");b.exports=e,e.getr=f}).call(this,a("buffer").Buffer)},{"bn.js":45,buffer:8,randombytes:203}],47:[function(a,b,c){"use strict";var d=c;d.version=a("../package.json").version,d.utils=a("./elliptic/utils"),d.rand=a("brorand"),d.hmacDRBG=a("./elliptic/hmac-drbg"),d.curve=a("./elliptic/curve"),d.curves=a("./elliptic/curves"),d.ec=a("./elliptic/ec"),d.eddsa=a("./elliptic/eddsa")},{"../package.json":70,"./elliptic/curve":50,"./elliptic/curves":53,"./elliptic/ec":54,"./elliptic/eddsa":57,"./elliptic/hmac-drbg":60,"./elliptic/utils":62,brorand:63}],48:[function(a,b,c){"use strict";function d(a,b){this.type=a,this.p=new f(b.p,16),this.red=b.prime?f.red(b.prime):f.mont(this.p),this.zero=new f(0).toRed(this.red),this.one=new f(1).toRed(this.red),this.two=new f(2).toRed(this.red),this.n=b.n&&new f(b.n,16),this.g=b.g&&this.pointFromJSON(b.g,b.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function e(a,b){this.curve=a,this.type=b,this.precomputed=null}var f=a("bn.js"),g=a("../../elliptic"),h=g.utils,i=h.getNAF,j=h.getJSF,k=h.assert;b.exports=d,d.prototype.point=function(){throw new Error("Not implemented")},d.prototype.validate=function(){throw new Error("Not implemented")},d.prototype._fixedNafMul=function(a,b){k(a.precomputed);var c=a._getDoubles(),d=i(b,1),e=(1<=g;b--)h=(h<<1)+d[b];f.push(h)}for(var j=this.jpoint(null,null,null),l=this.jpoint(null,null,null),m=e;m>0;m--){for(var g=0;g=0;h--){for(var b=0;h>=0&&0===f[h];h--)b++;if(h>=0&&b++,g=g.dblp(b),h<0)break;var j=f[h];k(0!==j),g="affine"===a.type?j>0?g.mixedAdd(e[j-1>>1]):g.mixedAdd(e[-j-1>>1].neg()):j>0?g.add(e[j-1>>1]):g.add(e[-j-1>>1].neg())}return"affine"===a.type?g.toP():g},d.prototype._wnafMulAdd=function(a,b,c,d,e){for(var f=this._wnafT1,g=this._wnafT2,h=this._wnafT3,k=0,l=0;l=1;l-=2){var o=l-1,p=l;if(1===f[o]&&1===f[p]){var q=[b[o],null,null,b[p]];0===b[o].y.cmp(b[p].y)?(q[1]=b[o].add(b[p]),q[2]=b[o].toJ().mixedAdd(b[p].neg())):0===b[o].y.cmp(b[p].y.redNeg())?(q[1]=b[o].toJ().mixedAdd(b[p]),q[2]=b[o].add(b[p].neg())):(q[1]=b[o].toJ().mixedAdd(b[p]),q[2]=b[o].toJ().mixedAdd(b[p].neg()));var r=[-3,-1,-5,-7,0,7,5,1,3],s=j(c[o],c[p]);k=Math.max(s[0].length,k),h[o]=new Array(k),h[p]=new Array(k);for(var t=0;t=0;l--){for(var y=0;l>=0;){for(var z=!0,t=0;t=0&&y++,w=w.dblp(y),l<0)break;for(var t=0;t0?m=g[t][A-1>>1]:A<0&&(m=g[t][-A-1>>1].neg()),w="affine"===m.type?w.mixedAdd(m):w.add(m))}}for(var l=0;l=Math.ceil((a.bitLength()+1)/b.step)},e.prototype._getDoubles=function(a,b){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],d=this,e=0;e":""},e.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},e.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),f=d.redAdd(b),g=f.redSub(c),h=d.redSub(b),i=e.redMul(g),j=f.redMul(h),k=e.redMul(h),l=g.redMul(f);return this.curve.point(i,j,l,k)},e.prototype._projDbl=function(){var a,b,c,d=this.x.redAdd(this.y).redSqr(),e=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var g=this.curve._mulA(e),h=g.redAdd(f);if(this.zOne)a=d.redSub(e).redSub(f).redMul(h.redSub(this.curve.two)),b=h.redMul(g.redSub(f)),c=h.redSqr().redSub(h).redSub(h);else{var i=this.z.redSqr(),j=h.redSub(i).redISub(i);a=d.redSub(e).redISub(f).redMul(j),b=h.redMul(g.redSub(f)),c=h.redMul(j)}}else{var g=e.redAdd(f),i=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=g.redSub(i).redSub(i);a=this.curve._mulC(d.redISub(g)).redMul(j),b=this.curve._mulC(g).redMul(e.redISub(f)),c=g.redMul(j)}return this.curve.point(a,b,c)},e.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},e.prototype._extAdd=function(a){var b=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),c=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),d=this.t.redMul(this.curve.dd).redMul(a.t),e=this.z.redMul(a.z.redAdd(a.z)),f=c.redSub(b),g=e.redSub(d),h=e.redAdd(d),i=c.redAdd(b),j=f.redMul(g),k=h.redMul(i),l=f.redMul(i),m=g.redMul(h);return this.curve.point(j,k,m,l)},e.prototype._projAdd=function(a){var b,c,d=this.z.redMul(a.z),e=d.redSqr(),f=this.x.redMul(a.x),g=this.y.redMul(a.y),h=this.curve.d.redMul(f).redMul(g),i=e.redSub(h),j=e.redAdd(h),k=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(f).redISub(g),l=d.redMul(i).redMul(k);return this.curve.twisted?(b=d.redMul(j).redMul(g.redSub(this.curve._mulA(f))),c=i.redMul(j)):(b=d.redMul(j).redMul(g.redSub(f)),c=this.curve._mulC(i).redMul(j)),this.curve.point(l,b,c)},e.prototype.add=function(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)},e.prototype.mul=function(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)},e.prototype.mulAdd=function(a,b,c){return this.curve._wnafMulAdd(1,[this,b],[a,c],2,!1)},e.prototype.jmulAdd=function(a,b,c){return this.curve._wnafMulAdd(1,[this,b],[a,c],2,!0)},e.prototype.normalize=function(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this},e.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},e.prototype.getX=function(){return this.normalize(),this.x.fromRed()},e.prototype.getY=function(){return this.normalize(),this.y.fromRed()},e.prototype.eq=function(a){return this===a||0===this.getX().cmp(a.getX())&&0===this.getY().cmp(a.getY())},e.prototype.eqXToP=function(a){var b=a.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(b))return!0;for(var c=a.clone(),d=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(b.redIAdd(d),0===this.x.cmp(b))return!0}return!1},e.prototype.toP=e.prototype.normalize,e.prototype.mixedAdd=e.prototype.add},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],50:[function(a,b,c){"use strict";var d=c;d.base=a("./base"),d.short=a("./short"),d.mont=a("./mont"),d.edwards=a("./edwards")},{"./base":48,"./edwards":49,"./mont":51,"./short":52}],51:[function(a,b,c){"use strict";function d(a){i.call(this,"mont",a),this.a=new g(a.a,16).toRed(this.red),this.b=new g(a.b,16).toRed(this.red),this.i4=new g(4).toRed(this.red).redInvm(),this.two=new g(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function e(a,b,c){i.BasePoint.call(this,a,"projective"),null===b&&null===c?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new g(b,16),this.z=new g(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var f=a("../curve"),g=a("bn.js"),h=a("inherits"),i=f.base,j=a("../../elliptic"),k=j.utils;h(d,i),b.exports=d,d.prototype.validate=function(a){var b=a.normalize().x,c=b.redSqr(),d=c.redMul(b).redAdd(c.redMul(this.a)).redAdd(b),e=d.redSqrt();return 0===e.redSqr().cmp(d)},h(e,i.BasePoint),d.prototype.decodePoint=function(a,b){return this.point(k.toArray(a,b),1)},d.prototype.point=function(a,b){return new e(this,a,b)},d.prototype.pointFromJSON=function(a){return e.fromJSON(this,a)},e.prototype.precompute=function(){},e.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},e.fromJSON=function(a,b){return new e(a,b[0],b[1]||a.one)},e.prototype.inspect=function(){return this.isInfinity()?"":""},e.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},e.prototype.dbl=function(){var a=this.x.redAdd(this.z),b=a.redSqr(),c=this.x.redSub(this.z),d=c.redSqr(),e=b.redSub(d),f=b.redMul(d),g=e.redMul(d.redAdd(this.curve.a24.redMul(e)));return this.curve.point(f,g)},e.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.diffAdd=function(a,b){var c=this.x.redAdd(this.z),d=this.x.redSub(this.z),e=a.x.redAdd(a.z),f=a.x.redSub(a.z),g=f.redMul(c),h=e.redMul(d),i=b.z.redMul(g.redAdd(h).redSqr()),j=b.x.redMul(g.redISub(h).redSqr());return this.curve.point(i,j)},e.prototype.mul=function(a){for(var b=a.clone(),c=this,d=this.curve.point(null,null),e=this,f=[];0!==b.cmpn(0);b.iushrn(1))f.push(b.andln(1));for(var g=f.length-1;g>=0;g--)0===f[g]?(c=c.diffAdd(d,e),d=d.dbl()):(d=c.diffAdd(d,e),c=c.dbl());return d},e.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.eq=function(a){return 0===this.getX().cmp(a.getX())},e.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},e.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],52:[function(a,b,c){"use strict";function d(a){k.call(this,"short",a),this.a=new i(a.a,16).toRed(this.red),this.b=new i(a.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(a),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function e(a,b,c,d){k.BasePoint.call(this,a,"affine"),null===b&&null===c?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(b,16),this.y=new i(c,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(a,b,c,d){k.BasePoint.call(this,a,"jacobian"),null===b&&null===c&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(b,16),this.y=new i(c,16),this.z=new i(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var g=a("../curve"),h=a("../../elliptic"),i=a("bn.js"),j=a("inherits"),k=g.base,l=h.utils.assert;j(d,k),b.exports=d,d.prototype._getEndomorphism=function(a){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var b,c;if(a.beta)b=new i(a.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);b=d[0].cmp(d[1])<0?d[0]:d[1],b=b.toRed(this.red)}if(a.lambda)c=new i(a.lambda,16);else{var e=this._getEndoRoots(this.n);0===this.g.mul(e[0]).x.cmp(this.g.x.redMul(b))?c=e[0]:(c=e[1],l(0===this.g.mul(c).x.cmp(this.g.x.redMul(b))))}var f;return f=a.basis?a.basis.map(function(a){return{a:new i(a.a,16),b:new i(a.b,16)}}):this._getEndoBasis(c),{beta:b,lambda:c,basis:f}}},d.prototype._getEndoRoots=function(a){var b=a===this.p?this.red:i.mont(a),c=new i(2).toRed(b).redInvm(),d=c.redNeg(),e=new i(3).toRed(b).redNeg().redSqrt().redMul(c),f=d.redAdd(e).fromRed(),g=d.redSub(e).fromRed();return[f,g]},d.prototype._getEndoBasis=function(a){for(var b,c,d,e,f,g,h,j,k,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),m=a,n=this.n.clone(),o=new i(1),p=new i(0),q=new i(0),r=new i(1),s=0;0!==m.cmpn(0);){var t=n.div(m);j=n.sub(t.mul(m)),k=q.sub(t.mul(o));var u=r.sub(t.mul(p));if(!d&&j.cmp(l)<0)b=h.neg(),c=o,d=j.neg(),e=k;else if(d&&2===++s)break;h=j,n=m,m=j,q=o,o=k,r=p,p=u}f=j.neg(),g=k;var v=d.sqr().add(e.sqr()),w=f.sqr().add(g.sqr());return w.cmp(v)>=0&&(f=b,g=c),d.negative&&(d=d.neg(),e=e.neg()),f.negative&&(f=f.neg(),g=g.neg()),[{a:d,b:e},{a:f,b:g}]},d.prototype._endoSplit=function(a){var b=this.endo.basis,c=b[0],d=b[1],e=d.b.mul(a).divRound(this.n),f=c.b.neg().mul(a).divRound(this.n),g=e.mul(c.a),h=f.mul(d.a),i=e.mul(c.b),j=f.mul(d.b),k=a.sub(g).sub(h),l=i.add(j).neg();return{k1:k,k2:l}},d.prototype.pointFromX=function(a,b){a=new i(a,16),a.red||(a=a.toRed(this.red));var c=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),d=c.redSqrt();if(0!==d.redSqr().redSub(c).cmp(this.zero))throw new Error("invalid point");var e=d.fromRed().isOdd();return(b&&!e||!b&&e)&&(d=d.redNeg()),this.point(a,d)},d.prototype.validate=function(a){if(a.inf)return!0;var b=a.x,c=a.y,d=this.a.redMul(b),e=b.redSqr().redMul(b).redIAdd(d).redIAdd(this.b);return 0===c.redSqr().redISub(e).cmpn(0); -},d.prototype._endoWnafMulAdd=function(a,b,c){for(var d=this._endoWnafT1,e=this._endoWnafT2,f=0;f":""},e.prototype.isInfinity=function(){return this.inf},e.prototype.add=function(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(0===this.x.cmp(a.x))return this.curve.point(null,null);var b=this.y.redSub(a.y);0!==b.cmpn(0)&&(b=b.redMul(this.x.redSub(a.x).redInvm()));var c=b.redSqr().redISub(this.x).redISub(a.x),d=b.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,d)},e.prototype.dbl=function(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(0===a.cmpn(0))return this.curve.point(null,null);var b=this.curve.a,c=this.x.redSqr(),d=a.redInvm(),e=c.redAdd(c).redIAdd(c).redIAdd(b).redMul(d),f=e.redSqr().redISub(this.x.redAdd(this.x)),g=e.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,g)},e.prototype.getX=function(){return this.x.fromRed()},e.prototype.getY=function(){return this.y.fromRed()},e.prototype.mul=function(a){return a=new i(a,16),this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)},e.prototype.mulAdd=function(a,b,c){var d=[this,b],e=[a,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,e):this.curve._wnafMulAdd(1,d,e,2)},e.prototype.jmulAdd=function(a,b,c){var d=[this,b],e=[a,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,e,!0):this.curve._wnafMulAdd(1,d,e,2,!0)},e.prototype.eq=function(a){return this===a||this.inf===a.inf&&(this.inf||0===this.x.cmp(a.x)&&0===this.y.cmp(a.y))},e.prototype.neg=function(a){if(this.inf)return this;var b=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var c=this.precomputed,d=function(a){return a.neg()};b.precomputed={naf:c.naf&&{wnd:c.naf.wnd,points:c.naf.points.map(d)},doubles:c.doubles&&{step:c.doubles.step,points:c.doubles.points.map(d)}}}return b},e.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a},j(f,k.BasePoint),d.prototype.jpoint=function(a,b,c){return new f(this,a,b,c)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),b=a.redSqr(),c=this.x.redMul(b),d=this.y.redMul(b).redMul(a);return this.curve.point(c,d)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var b=a.z.redSqr(),c=this.z.redSqr(),d=this.x.redMul(b),e=a.x.redMul(c),f=this.y.redMul(b.redMul(a.z)),g=a.y.redMul(c.redMul(this.z)),h=d.redSub(e),i=f.redSub(g);if(0===h.cmpn(0))return 0!==i.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var j=h.redSqr(),k=j.redMul(h),l=d.redMul(j),m=i.redSqr().redIAdd(k).redISub(l).redISub(l),n=i.redMul(l.redISub(m)).redISub(f.redMul(k)),o=this.z.redMul(a.z).redMul(h);return this.curve.jpoint(m,n,o)},f.prototype.mixedAdd=function(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var b=this.z.redSqr(),c=this.x,d=a.x.redMul(b),e=this.y,f=a.y.redMul(b).redMul(this.z),g=c.redSub(d),h=e.redSub(f);if(0===g.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var i=g.redSqr(),j=i.redMul(g),k=c.redMul(i),l=h.redSqr().redIAdd(j).redISub(k).redISub(k),m=h.redMul(k.redISub(l)).redISub(e.redMul(j)),n=this.z.redMul(g);return this.curve.jpoint(l,m,n)},f.prototype.dblp=function(a){if(0===a)return this;if(this.isInfinity())return this;if(!a)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var b=this,c=0;c=0)return!1;if(c.redIAdd(e),0===this.x.cmp(c))return!0}return!1},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],53:[function(a,b,c){"use strict";function d(a){"short"===a.type?this.curve=new h.curve.short(a):"edwards"===a.type?this.curve=new h.curve.edwards(a):this.curve=new h.curve.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function e(a,b){Object.defineProperty(f,a,{configurable:!0,enumerable:!0,get:function(){var c=new d(b);return Object.defineProperty(f,a,{configurable:!0,enumerable:!0,value:c}),c}})}var f=c,g=a("hash.js"),h=a("../elliptic"),i=h.utils.assert;f.PresetCurve=d,e("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:g.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),e("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:g.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),e("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:g.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),e("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:g.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),e("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:g.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),e("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:g.sha256,gRed:!1,g:["9"]}),e("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:g.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var j;try{j=a("./precomputed/secp256k1")}catch(a){j=void 0}e("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:g.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",j]})},{"../elliptic":47,"./precomputed/secp256k1":61,"hash.js":64}],54:[function(a,b,c){"use strict";function d(a){return this instanceof d?("string"==typeof a&&(h(f.curves.hasOwnProperty(a),"Unknown curve "+a),a=f.curves[a]),a instanceof f.curves.PresetCurve&&(a={curve:a}),this.curve=a.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=a.curve.g,this.g.precompute(a.curve.n.bitLength()+1),void(this.hash=a.hash||a.curve.hash)):new d(a)}var e=a("bn.js"),f=a("../../elliptic"),g=f.utils,h=g.assert,i=a("./key"),j=a("./signature");b.exports=d,d.prototype.keyPair=function(a){return new i(this,a)},d.prototype.keyFromPrivate=function(a,b){return i.fromPrivate(this,a,b)},d.prototype.keyFromPublic=function(a,b){return i.fromPublic(this,a,b)},d.prototype.genKeyPair=function(a){a||(a={});for(var b=new f.hmacDRBG({hash:this.hash,pers:a.pers,entropy:a.entropy||f.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),c=this.n.byteLength(),d=this.n.sub(new e(2));;){var g=new e(b.generate(c));if(!(g.cmp(d)>0))return g.iaddn(1),this.keyFromPrivate(g)}},d.prototype._truncateToN=function(a,b){var c=8*a.byteLength()-this.n.bitLength();return c>0&&(a=a.ushrn(c)),!b&&a.cmp(this.n)>=0?a.sub(this.n):a},d.prototype.sign=function(a,b,c,d){"object"==typeof c&&(d=c,c=null),d||(d={}),b=this.keyFromPrivate(b,c),a=this._truncateToN(new e(a,16));for(var g=this.n.byteLength(),h=b.getPrivate().toArray("be",g),i=a.toArray("be",g),k=new f.hmacDRBG({hash:this.hash,entropy:h,nonce:i,pers:d.pers,persEnc:d.persEnc}),l=this.n.sub(new e(1)),m=0;!0;m++){var n=d.k?d.k(m):new e(k.generate(this.n.byteLength()));if(n=this._truncateToN(n,!0),!(n.cmpn(1)<=0||n.cmp(l)>=0)){var o=this.g.mul(n);if(!o.isInfinity()){var p=o.getX(),q=p.umod(this.n);if(0!==q.cmpn(0)){var r=n.invm(this.n).mul(q.mul(b.getPrivate()).iadd(a));if(r=r.umod(this.n),0!==r.cmpn(0)){var s=(o.getY().isOdd()?1:0)|(0!==p.cmp(q)?2:0);return d.canonical&&r.cmp(this.nh)>0&&(r=this.n.sub(r),s^=1),new j({r:q,s:r,recoveryParam:s})}}}}}},d.prototype.verify=function(a,b,c,d){a=this._truncateToN(new e(a,16)),c=this.keyFromPublic(c,d),b=new j(b,"hex");var f=b.r,g=b.s;if(f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;if(g.cmpn(1)<0||g.cmp(this.n)>=0)return!1;var h=g.invm(this.n),i=h.mul(a).umod(this.n),k=h.mul(f).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(i,c.getPublic(),k);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(f)}var l=this.g.jmulAdd(i,c.getPublic(),k);return!l.isInfinity()&&l.eqXToP(f)},d.prototype.recoverPubKey=function(a,b,c,d){h((3&c)===c,"The recovery param is more than two bits"),b=new j(b,d);var f=this.n,g=new e(a),i=b.r,k=b.s,l=1&c,m=c>>1;if(i.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");i=m?this.curve.pointFromX(i.add(this.curve.n),l):this.curve.pointFromX(i,l);var n=f.sub(g),o=b.r.invm(f);return this.g.mulAdd(n,i,k).mul(o)},d.prototype.getKeyRecoveryParam=function(a,b,c,d){if(b=new j(b,d),null!==b.recoveryParam)return b.recoveryParam;for(var e=0;e<4;e++){var f;try{f=this.recoverPubKey(a,b,e)}catch(a){continue}if(f.eq(c))return e}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":47,"./key":55,"./signature":56,"bn.js":45}],55:[function(a,b,c){"use strict";function d(a,b){this.ec=a,this.priv=null,this.pub=null,b.priv&&this._importPrivate(b.priv,b.privEnc),b.pub&&this._importPublic(b.pub,b.pubEnc)}var e=a("bn.js");b.exports=d,d.fromPublic=function(a,b,c){return b instanceof d?b:new d(a,{pub:b,pubEnc:c})},d.fromPrivate=function(a,b,c){return b instanceof d?b:new d(a,{priv:b,privEnc:c})},d.prototype.validate=function(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},d.prototype.getPublic=function(a,b){return"string"==typeof a&&(b=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),b?this.pub.encode(b,a):this.pub},d.prototype.getPrivate=function(a){return"hex"===a?this.priv.toString(16,2):this.priv},d.prototype._importPrivate=function(a,b){this.priv=new e(a,b||16),this.priv=this.priv.umod(this.ec.curve.n)},d.prototype._importPublic=function(a,b){return a.x||a.y?void(this.pub=this.ec.curve.point(a.x,a.y)):void(this.pub=this.ec.curve.decodePoint(a,b))},d.prototype.derive=function(a){return a.mul(this.priv).getX()},d.prototype.sign=function(a,b,c){return this.ec.sign(a,this,b,c)},d.prototype.verify=function(a,b){return this.ec.verify(a,b,this)},d.prototype.inspect=function(){return""}},{"bn.js":45}],56:[function(a,b,c){"use strict";function d(a,b){return a instanceof d?a:void(this._importDER(a,b)||(l(a.r&&a.s,"Signature without r or s"),this.r=new i(a.r,16),this.s=new i(a.s,16),void 0===a.recoveryParam?this.recoveryParam=null:this.recoveryParam=a.recoveryParam))}function e(){this.place=0}function f(a,b){var c=a[b.place++];if(!(128&c))return c;for(var d=15&c,e=0,f=0,g=b.place;f>>3);for(a.push(128|c);--c;)a.push(b>>>(c<<3)&255);a.push(b)}var i=a("bn.js"),j=a("../../elliptic"),k=j.utils,l=k.assert;b.exports=d,d.prototype._importDER=function(a,b){a=k.toArray(a,b);var c=new e;if(48!==a[c.place++])return!1;var d=f(a,c);if(d+c.place!==a.length)return!1;if(2!==a[c.place++])return!1;var g=f(a,c),h=a.slice(c.place,g+c.place);if(c.place+=g,2!==a[c.place++])return!1;var j=f(a,c);if(a.length!==j+c.place)return!1;var l=a.slice(c.place,j+c.place);return 0===h[0]&&128&h[1]&&(h=h.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new i(h),this.s=new i(l),this.recoveryParam=null,!0},d.prototype.toDER=function(a){var b=this.r.toArray(),c=this.s.toArray();for(128&b[0]&&(b=[0].concat(b)),128&c[0]&&(c=[0].concat(c)),b=g(b),c=g(c);!(c[0]||128&c[1]);)c=c.slice(1);var d=[2];h(d,b.length),d=d.concat(b),d.push(2),h(d,c.length);var e=d.concat(c),f=[48];return h(f,e.length),f=f.concat(e),k.encode(f,a)}},{"../../elliptic":47,"bn.js":45}],57:[function(a,b,c){"use strict";function d(a){if(h("ed25519"===a,"only tested with ed25519 so far"),!(this instanceof d))return new d(a);var a=f.curves[a].curve;this.curve=a,this.g=a.g,this.g.precompute(a.n.bitLength()+1),this.pointClass=a.point().constructor,this.encodingLength=Math.ceil(a.n.bitLength()/8),this.hash=e.sha512}var e=a("hash.js"),f=a("../../elliptic"),g=f.utils,h=g.assert,i=g.parseBytes,j=a("./key"),k=a("./signature");b.exports=d,d.prototype.sign=function(a,b){a=i(a);var c=this.keyFromSecret(b),d=this.hashInt(c.messagePrefix(),a),e=this.g.mul(d),f=this.encodePoint(e),g=this.hashInt(f,c.pubBytes(),a).mul(c.priv()),h=d.add(g).umod(this.curve.n);return this.makeSignature({R:e,S:h,Rencoded:f})},d.prototype.verify=function(a,b,c){a=i(a),b=this.makeSignature(b);var d=this.keyFromPublic(c),e=this.hashInt(b.Rencoded(),d.pubBytes(),a),f=this.g.mul(b.S()),g=b.R().add(d.pub().mul(e));return g.eq(f)},d.prototype.hashInt=function(){for(var a=this.hash(),b=0;b=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(b,c,e)}var e=a("hash.js"),f=a("../elliptic"),g=f.utils,h=g.assert;b.exports=d,d.prototype._init=function(a,b,c){var d=a.concat(b).concat(c);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var e=0;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(c||[])),this.reseed=1},d.prototype.generate=function(a,b,c,d){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof b&&(d=c,c=b,b=null),c&&(c=g.toArray(c,d),this._update(c));for(var e=[];e.lengthh||a<0?(c=Math.abs(a)%h,a<0?h-c:c):a}function d(a){for(var b=0;b>>8^255&c^99,this.SBOX[e]=c,this.INV_SBOX[c]=e,f=a[e],g=a[f],h=a[g],d=257*a[c]^16843008*c,this.SUB_MIX[0][e]=d<<24|d>>>8,this.SUB_MIX[1][e]=d<<16|d>>>16,this.SUB_MIX[2][e]=d<<8|d>>>24,this.SUB_MIX[3][e]=d,d=16843009*h^65537*g^257*f^16843008*e,this.INV_SUB_MIX[0][c]=d<<24|d>>>8,this.INV_SUB_MIX[1][c]=d<<16|d>>>16,this.INV_SUB_MIX[2][c]=d<<8|d>>>24,this.INV_SUB_MIX[3][c]=d,0===e?e=i=1:(e=f^a[a[a[h^f]]],i^=a[a[i]]);return!0};var i=new e;g.blockSize=16,g.prototype.blockSize=g.blockSize,g.keySize=32,g.prototype.keySize=g.keySize,g.prototype._doReset=function(){var a,b,c,d,e,f;for(c=this._key,b=c.length,this._nRounds=b+6,e=4*(this._nRounds+1),this._keySchedule=[],d=0;d>>24,f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f],f^=i.RCON[d/b|0]<<24):b>6&&d%b===4?f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f]:void 0,this._keySchedule[d-b]^f);for(this._invKeySchedule=[],a=0;a>>24]]^i.INV_SUB_MIX[1][i.SBOX[f>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[f>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&f]];return!0},g.prototype.encryptBlock=function(b){b=f(new a(b));var c=this._doCryptBlock(b,this._keySchedule,i.SUB_MIX,i.SBOX),d=new a(16);return d.writeUInt32BE(c[0],0),d.writeUInt32BE(c[1],4),d.writeUInt32BE(c[2],8),d.writeUInt32BE(c[3],12),d},g.prototype.decryptBlock=function(b){b=f(new a(b));var c=[b[3],b[1]];b[1]=c[0],b[3]=c[1];var d=this._doCryptBlock(b,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX),e=new a(16);return e.writeUInt32BE(d[0],0),e.writeUInt32BE(d[3],4),e.writeUInt32BE(d[2],8),e.writeUInt32BE(d[1],12),e},g.prototype.scrub=function(){d(this._keySchedule),d(this._invKeySchedule),d(this._key)},g.prototype._doCryptBlock=function(a,c,d,e){var f,g,h,i,j,k,l,m,n;g=a[0]^c[0],h=a[1]^c[1],i=a[2]^c[2],j=a[3]^c[3],f=4;for(var o=1;o>>24]^d[1][h>>>16&255]^d[2][i>>>8&255]^d[3][255&j]^c[f++],l=d[0][h>>>24]^d[1][i>>>16&255]^d[2][j>>>8&255]^d[3][255&g]^c[f++],m=d[0][i>>>24]^d[1][j>>>16&255]^d[2][g>>>8&255]^d[3][255&h]^c[f++],n=d[0][j>>>24]^d[1][g>>>16&255]^d[2][h>>>8&255]^d[3][255&i]^c[f++],g=k,h=l,i=m,j=n;return k=(e[g>>>24]<<24|e[h>>>16&255]<<16|e[i>>>8&255]<<8|e[255&j])^c[f++],l=(e[h>>>24]<<24|e[i>>>16&255]<<16|e[j>>>8&255]<<8|e[255&g])^c[f++],m=(e[i>>>24]<<24|e[j>>>16&255]<<16|e[g>>>8&255]<<8|e[255&h])^c[f++],n=(e[j>>>24]<<24|e[g>>>16&255]<<16|e[h>>>8&255]<<8|e[255&i])^c[f++],[b(k),b(l),b(m),b(n)]},c.AES=g}).call(this,a("buffer").Buffer)},{buffer:8}],15:[function(a,b,c){(function(c){function d(a,b,e,h){if(!(this instanceof d))return new d(a,b,e);g.call(this),this._finID=c.concat([e,new c([0,0,0,1])]),e=c.concat([e,new c([0,0,0,2])]),this._cipher=new f.AES(b),this._prev=new c(e.length),this._cache=new c(""),this._secCache=new c(""),this._decrypt=h,this._alen=0,this._len=0,e.copy(this._prev),this._mode=a;var j=new c(4);j.fill(0),this._ghash=new i(this._cipher.encryptBlock(j)),this._authTag=null,this._called=!1}function e(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=-1;++e16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache};var p={ECB:a("./modes/ecb"),CBC:a("./modes/cbc"),CFB:a("./modes/cfb"),CFB8:a("./modes/cfb8"),CFB1:a("./modes/cfb1"),OFB:a("./modes/ofb"),CTR:a("./modes/ctr"),GCM:a("./modes/ctr")};c.createDecipher=h,c.createDecipheriv=g}).call(this,a("buffer").Buffer)},{"./aes":14,"./authCipher":15,"./modes":20,"./modes/cbc":21,"./modes/cfb":22,"./modes/cfb1":23,"./modes/cfb8":24,"./modes/ctr":25,"./modes/ecb":26,"./modes/ofb":27,"./streamCipher":30,buffer:8,"cipher-base":29,evp_bytestokey:41,inherits:205}],18:[function(a,b,c){(function(b){function d(a,c,f){return this instanceof d?(i.call(this),this._cache=new e,this._cipher=new h.AES(c),this._prev=new b(f.length),f.copy(this._prev),this._mode=a,void(this._autopadding=!0)):new d(a,c,f)}function e(){return this instanceof e?void(this.cache=new b("")):new e}function f(a,c,e){var f=k[a.toLowerCase()];if(!f)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=new b(e)),"string"==typeof c&&(c=new b(c)),c.length!==f.key/8)throw new TypeError("invalid key length "+c.length);if(e.length!==f.iv)throw new TypeError("invalid iv length "+e.length);return"stream"===f.type?new m(o[f.mode],c,e):"auth"===f.type?new n(o[f.mode],c,e):new d(o[f.mode],c,e)}function g(a,b){var c=k[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=l(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./aes"),i=a("cipher-base"),j=a("inherits"),k=a("./modes"),l=a("evp_bytestokey"),m=a("./streamCipher"),n=a("./authCipher");j(d,i),d.prototype._update=function(a){this._cache.add(a);for(var c,d,e=[];c=this._cache.get();)d=this._mode.encrypt(this,c),e.push(d);return b.concat(e)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if("10101010101010101010101010101010"!==a.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=b.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,c=new b(a),d=-1;++di||a<0?(c=Math.abs(a)%i,a<0?i-c:c):a}function g(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}var h=new a(16);h.fill(0),b.exports=c,c.prototype.ghash=function(a){for(var b=-1;++b0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(h)},c.prototype.update=function(b){this.cache=a.concat([this.cache,b]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},c.prototype.final=function(b,c){return this.cache.length&&this.ghash(a.concat([this.cache,h],16)),this.ghash(e([0,b,0,c])),this.state};var i=Math.pow(2,32)}).call(this,a("buffer").Buffer)},{buffer:8}],20:[function(a,b,c){c["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},c["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},c["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},c["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},c["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},c["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},c.aes128=c["aes-128-cbc"],c.aes192=c["aes-192-cbc"],c.aes256=c["aes-256-cbc"],c["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},c["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},c["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},c["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},c["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},c["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},c["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},c["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},c["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},c["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},c["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},c["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},c["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},c["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},c["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},c["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},c["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},c["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},{}],21:[function(a,b,c){var d=a("buffer-xor");c.encrypt=function(a,b){var c=d(b,a._prev);return a._prev=a._cipher.encryptBlock(c),a._prev},c.decrypt=function(a,b){var c=a._prev;a._prev=b;var e=a._cipher.decryptBlock(b);return d(e,c)}},{"buffer-xor":28}],22:[function(a,b,c){(function(b){function d(a,c,d){var f=c.length,g=e(c,a._cache);return a._cache=a._cache.slice(f),a._prev=b.concat([a._prev,d?c:g]),g}var e=a("buffer-xor");c.encrypt=function(a,c,e){for(var f,g=new b("");c.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=new b("")),!(a._cache.length<=c.length)){g=b.concat([g,d(a,c,e)]);break}f=a._cache.length,g=b.concat([g,d(a,c.slice(0,f),e)]),c=c.slice(f)}return g}}).call(this,a("buffer").Buffer)},{buffer:8,"buffer-xor":28}],23:[function(a,b,c){(function(a){function b(a,b,c){for(var e,f,g,h=-1,i=8,j=0;++h>h%8,a._prev=d(a._prev,c?f:g);return j}function d(b,c){var d=b.length,e=-1,f=new a(b.length);for(b=a.concat([b,new a([c])]);++e>7;return f}c.encrypt=function(c,d,e){for(var f=d.length,g=new a(f),h=-1;++h0;d--)b+=this._buffer(a,b),c+=this._flushBuffer(e,c);return b+=this._buffer(a,b),e},d.prototype.final=function(a){var b;a&&(b=this.update(a));var c;return c="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),b?b.concat(c):c},d.prototype._pad=function(a,b){if(0===b)return!1;for(;b>>1];c=i.r28shl(c,g),d=i.r28shl(d,g),i.pc2(c,d,a.keys,e)}},e.prototype._update=function(a,b,c,d){var e=this._desState,f=i.readUInt32BE(a,b),g=i.readUInt32BE(a,b+4);i.ip(f,g,e.tmp,0),f=e.tmp[0],g=e.tmp[1],"encrypt"===this.type?this._encrypt(e,f,g,e.tmp,0):this._decrypt(e,f,g,e.tmp,0),f=e.tmp[0],g=e.tmp[1],i.writeUInt32BE(c,f,d),i.writeUInt32BE(c,g,d+4)},e.prototype._pad=function(a,b){for(var c=a.length-b,d=b;d>>0,f=n}i.rip(g,f,d,e)},e.prototype._decrypt=function(a,b,c,d,e){for(var f=c,g=b,h=a.keys.length-2;h>=0;h-=2){var j=a.keys[h],k=a.keys[h+1];i.expand(f,a.tmp,0),j^=a.tmp[0],k^=a.tmp[1];var l=i.substitute(j,k),m=i.permute(l),n=f;f=(g^m)>>>0,g=n}i.rip(f,g,d,e)}},{"../des":34,inherits:205,"minimalistic-assert":40}],38:[function(a,b,c){"use strict";function d(a,b){f.equal(b.length,24,"Invalid key length");var c=b.slice(0,8),d=b.slice(8,16),e=b.slice(16,24);"encrypt"===a?this.ciphers=[j.create({type:"encrypt",key:c}),j.create({type:"decrypt",key:d}),j.create({type:"encrypt",key:e})]:this.ciphers=[j.create({type:"decrypt",key:e}),j.create({type:"encrypt",key:d}),j.create({type:"decrypt",key:c})]}function e(a){i.call(this,a);var b=new d(this.type,this.options.key);this._edeState=b}var f=a("minimalistic-assert"),g=a("inherits"),h=a("../des"),i=h.Cipher,j=h.DES;g(e,i),b.exports=e,e.create=function(a){return new e(a)},e.prototype._update=function(a,b,c,d){var e=this._edeState;e.ciphers[0]._update(a,b,c,d),e.ciphers[1]._update(c,d,c,d),e.ciphers[2]._update(c,d,c,d)},e.prototype._pad=j.prototype._pad,e.prototype._unpad=j.prototype._unpad},{"../des":34,inherits:205,"minimalistic-assert":40}],39:[function(a,b,c){"use strict";c.readUInt32BE=function(a,b){var c=a[0+b]<<24|a[1+b]<<16|a[2+b]<<8|a[3+b];return c>>>0},c.writeUInt32BE=function(a,b,c){a[0+c]=b>>>24,a[1+c]=b>>>16&255,a[2+c]=b>>>8&255,a[3+c]=255&b},c.ip=function(a,b,c,d){for(var e=0,f=0,g=6;g>=0;g-=2){for(var h=0;h<=24;h+=8)e<<=1,e|=b>>>h+g&1;for(var h=0;h<=24;h+=8)e<<=1,e|=a>>>h+g&1}for(var g=6;g>=0;g-=2){for(var h=1;h<=25;h+=8)f<<=1,f|=b>>>h+g&1;for(var h=1;h<=25;h+=8)f<<=1,f|=a>>>h+g&1}c[d+0]=e>>>0,c[d+1]=f>>>0},c.rip=function(a,b,c,d){for(var e=0,f=0,g=0;g<4;g++)for(var h=24;h>=0;h-=8)e<<=1,e|=b>>>h+g&1,e<<=1,e|=a>>>h+g&1;for(var g=4;g<8;g++)for(var h=24;h>=0;h-=8)f<<=1,f|=b>>>h+g&1,f<<=1,f|=a>>>h+g&1;c[d+0]=e>>>0,c[d+1]=f>>>0},c.pc1=function(a,b,c,d){for(var e=0,f=0,g=7;g>=5;g--){for(var h=0;h<=24;h+=8)e<<=1,e|=b>>h+g&1;for(var h=0;h<=24;h+=8)e<<=1,e|=a>>h+g&1}for(var h=0;h<=24;h+=8)e<<=1,e|=b>>h+g&1;for(var g=1;g<=3;g++){for(var h=0;h<=24;h+=8)f<<=1,f|=b>>h+g&1;for(var h=0;h<=24;h+=8)f<<=1,f|=a>>h+g&1}for(var h=0;h<=24;h+=8)f<<=1,f|=a>>h+g&1;c[d+0]=e>>>0,c[d+1]=f>>>0},c.r28shl=function(a,b){return a<>>28-b};var d=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];c.pc2=function(a,b,c,e){for(var f=0,g=0,h=d.length>>>1,i=0;i>>d[i]&1;for(var i=h;i>>d[i]&1;c[e+0]=f>>>0,c[e+1]=g>>>0},c.expand=function(a,b,c){var d=0,e=0;d=(1&a)<<5|a>>>27;for(var f=23;f>=15;f-=4)d<<=6,d|=a>>>f&63;for(var f=11;f>=3;f-=4)e|=a>>>f&63,e<<=6;e|=(31&a)<<1|a>>>31,b[c+0]=d>>>0,b[c+1]=e>>>0};var e=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];c.substitute=function(a,b){for(var c=0,d=0;d<4;d++){var f=a>>>18-6*d&63,g=e[64*d+f];c<<=4,c|=g}for(var d=0;d<4;d++){var f=b>>>18-6*d&63,g=e[256+64*d+f];c<<=4,c|=g}return c>>>0};var f=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];c.permute=function(a){for(var b=0,c=0;c>>f[c]&1;return b>>>0},c.padSplit=function(a,b,c){for(var d=a.toString(2);d.length0&&n.push(g),n.push(a),b&&n.push(b),g=e(c.concat(n)),n=[],h=0,d>0)for(;;){if(0===d)break;if(h===g.length)break;k[i++]=g[h],d--,h++}if(f>0&&h!==g.length)for(;;){if(0===f)break;if(h===g.length)break;l[j++]=g[h],f--,h++}if(0===d&&0===f)break}for(h=0;h=49&&g<=54?g-49+10:g>=17&&g<=22?g-17+10:15&g}return d}function h(a,b,c,d){for(var e=0,f=Math.min(a.length,c),g=b;g=49?h-49+10:h>=17?h-17+10:h}return e}function i(a){for(var b=new Array(a.bitLength()),c=0;c>>e}return b}function j(a,b,c){c.negative=b.negative^a.negative;var d=a.length+b.length|0;c.length=d,d=d-1|0;var e=0|a.words[0],f=0|b.words[0],g=e*f,h=67108863&g,i=g/67108864|0;c.words[0]=h;for(var j=1;j>>26,l=67108863&i,m=Math.min(j,b.length-1),n=Math.max(0,j-a.length+1);n<=m;n++){var o=j-n|0;e=0|a.words[o],f=0|b.words[n],g=e*f+l,k+=g/67108864|0,l=67108863&g}c.words[j]=0|l,i=0|k}return 0!==i?c.words[j]=0|i:c.length--,c.strip()}function k(a,b,c){c.negative=b.negative^a.negative,c.length=a.length+b.length;for(var d=0,e=0,f=0;f>>26)|0,e+=g>>>26,g&=67108863}c.words[f]=h,d=g,g=e}return 0!==d?c.words[f]=d:c.length--,c.strip()}function l(a,b,c){var d=new m;return d.mulp(a,b,c)}function m(a,b){this.x=a,this.y=b}function n(a,b){this.name=a,this.p=new f(b,16),this.n=this.p.bitLength(),this.k=new f(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function o(){n.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function p(){n.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function q(){n.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function r(){n.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function s(a){if("string"==typeof a){var b=f._prime(a);this.m=b.p,this.prime=b}else d(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}function t(a){s.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new f(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof b?b.exports=f:c.BN=f,f.BN=f,f.wordSize=26;var u;try{u=a("buffer").Buffer}catch(a){}f.isBN=function(a){return a instanceof f||null!==a&&"object"==typeof a&&a.constructor.wordSize===f.wordSize&&Array.isArray(a.words)},f.max=function(a,b){return a.cmp(b)>0?a:b},f.min=function(a,b){return a.cmp(b)<0?a:b},f.prototype._init=function(a,b,c){if("number"==typeof a)return this._initNumber(a,b,c);if("object"==typeof a)return this._initArray(a,b,c);"hex"===b&&(b=16),d(b===(0|b)&&b>=2&&b<=36),a=a.toString().replace(/\s+/g,"");var e=0;"-"===a[0]&&e++,16===b?this._parseHex(a,e):this._parseBase(a,b,e),"-"===a[0]&&(this.negative=1),this.strip(),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initNumber=function(a,b,c){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[67108863&a],this.length=1):a<4503599627370496?(this.words=[67108863&a,a/67108864&67108863],this.length=2):(d(a<9007199254740992),this.words=[67108863&a,a/67108864&67108863,1],this.length=3),"le"===c&&this._initArray(this.toArray(),b,c)},f.prototype._initArray=function(a,b,c){if(d("number"==typeof a.length),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var e=0;e=0;e-=3)g=a[e]|a[e-1]<<8|a[e-2]<<16,this.words[f]|=g<>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);else if("le"===c)for(e=0,f=0;e>>26-h&67108863,h+=24,h>=26&&(h-=26,f++);return this.strip()},f.prototype._parseHex=function(a,b){this.length=Math.ceil((a.length-b)/6),this.words=new Array(this.length);for(var c=0;c=b;c-=6)e=g(a,c,c+6),this.words[d]|=e<>>26-f&4194303,f+=24,f>=26&&(f-=26,d++);c+6!==b&&(e=g(a,b,c+6),this.words[d]|=e<>>26-f&4194303),this.strip()},f.prototype._parseBase=function(a,b,c){this.words=[0],this.length=1;for(var d=0,e=1;e<=67108863;e*=b)d++;d--,e=e/b|0;for(var f=a.length-c,g=f%d,i=Math.min(f,f-g)+c,j=0,k=c;k1&&0===this.words[this.length-1];)this.length--;return this._normSign()},f.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},f.prototype.inspect=function(){return(this.red?""};var v=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];f.prototype.toString=function(a,b){a=a||10,b=0|b||1;var c;if(16===a||"hex"===a){c="";for(var e=0,f=0,g=0;g>>24-e&16777215,c=0!==f||g!==this.length-1?v[6-i.length]+i+c:i+c,e+=2,e>=26&&(e-=26,g--)}for(0!==f&&(c=f.toString(16)+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}if(a===(0|a)&&a>=2&&a<=36){var j=w[a],k=x[a];c="";var l=this.clone();for(l.negative=0;!l.isZero();){var m=l.modn(k).toString(a);l=l.idivn(k),c=l.isZero()?m+c:v[j-m.length]+m+c}for(this.isZero()&&(c="0"+c);c.length%b!==0;)c="0"+c;return 0!==this.negative&&(c="-"+c),c}d(!1,"Base should be between 2 and 36")},f.prototype.toNumber=function(){var a=this.words[0];return 2===this.length?a+=67108864*this.words[1]:3===this.length&&1===this.words[2]?a+=4503599627370496+67108864*this.words[1]:this.length>2&&d(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-a:a},f.prototype.toJSON=function(){return this.toString(16)},f.prototype.toBuffer=function(a,b){return d("undefined"!=typeof u),this.toArrayLike(u,a,b)},f.prototype.toArray=function(a,b){return this.toArrayLike(Array,a,b)},f.prototype.toArrayLike=function(a,b,c){var e=this.byteLength(),f=c||Math.max(1,e);d(e<=f,"byte array longer than desired length"),d(f>0,"Requested array length <= 0"),this.strip();var g,h,i="le"===b,j=new a(f),k=this.clone();if(i){for(h=0;!k.isZero();h++)g=k.andln(255),k.iushrn(8),j[h]=g;for(;h=4096&&(c+=13,b>>>=13),b>=64&&(c+=7,b>>>=7),b>=8&&(c+=4,b>>>=4),b>=2&&(c+=2,b>>>=2),c+b},f.prototype._zeroBits=function(a){if(0===a)return 26;var b=a,c=0;return 0===(8191&b)&&(c+=13,b>>>=13),0===(127&b)&&(c+=7,b>>>=7),0===(15&b)&&(c+=4,b>>>=4),0===(3&b)&&(c+=2,b>>>=2),0===(1&b)&&c++,c},f.prototype.bitLength=function(){var a=this.words[this.length-1],b=this._countBits(a);return 26*(this.length-1)+b},f.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,b=0;ba.length?this.clone().ior(a):a.clone().ior(this)},f.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},f.prototype.iuand=function(a){var b;b=this.length>a.length?a:this;for(var c=0;ca.length?this.clone().iand(a):a.clone().iand(this)},f.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},f.prototype.iuxor=function(a){var b,c;this.length>a.length?(b=this,c=a):(b=a,c=this);for(var d=0;da.length?this.clone().ixor(a):a.clone().ixor(this)},f.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},f.prototype.inotn=function(a){d("number"==typeof a&&a>=0);var b=0|Math.ceil(a/26),c=a%26;this._expand(b),c>0&&b--;for(var e=0;e0&&(this.words[e]=~this.words[e]&67108863>>26-c),this.strip()},f.prototype.notn=function(a){return this.clone().inotn(a)},f.prototype.setn=function(a,b){d("number"==typeof a&&a>=0);var c=a/26|0,e=a%26;return this._expand(c+1),b?this.words[c]=this.words[c]|1<a.length?(c=this,d=a):(c=a,d=this);for(var e=0,f=0;f>>26;for(;0!==e&&f>>26;if(this.length=c.length,0!==e)this.words[this.length]=e,this.length++;else if(c!==this)for(;fa.length?this.clone().iadd(a):a.clone().iadd(this)},f.prototype.isub=function(a){if(0!==a.negative){a.negative=0;var b=this.iadd(a);return a.negative=1,b._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var c=this.cmp(a);if(0===c)return this.negative=0,this.length=1,this.words[0]=0,this;var d,e;c>0?(d=this,e=a):(d=a,e=this);for(var f=0,g=0;g>26,this.words[g]=67108863&b;for(;0!==f&&g>26,this.words[g]=67108863&b;if(0===f&&g>>13,n=0|g[1],o=8191&n,p=n>>>13,q=0|g[2],r=8191&q,s=q>>>13,t=0|g[3],u=8191&t,v=t>>>13,w=0|g[4],x=8191&w,y=w>>>13,z=0|g[5],A=8191&z,B=z>>>13,C=0|g[6],D=8191&C,E=C>>>13,F=0|g[7],G=8191&F,H=F>>>13,I=0|g[8],J=8191&I,K=I>>>13,L=0|g[9],M=8191&L,N=L>>>13,O=0|h[0],P=8191&O,Q=O>>>13,R=0|h[1],S=8191&R,T=R>>>13,U=0|h[2],V=8191&U,W=U>>>13,X=0|h[3],Y=8191&X,Z=X>>>13,$=0|h[4],_=8191&$,aa=$>>>13,ba=0|h[5],ca=8191&ba,da=ba>>>13,ea=0|h[6],fa=8191&ea,ga=ea>>>13,ha=0|h[7],ia=8191&ha,ja=ha>>>13,ka=0|h[8],la=8191&ka,ma=ka>>>13,na=0|h[9],oa=8191&na,pa=na>>>13;c.negative=a.negative^b.negative,c.length=19,d=Math.imul(l,P),e=Math.imul(l,Q),e=e+Math.imul(m,P)|0,f=Math.imul(m,Q);var qa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(qa>>>26)|0,qa&=67108863,d=Math.imul(o,P),e=Math.imul(o,Q),e=e+Math.imul(p,P)|0,f=Math.imul(p,Q),d=d+Math.imul(l,S)|0,e=e+Math.imul(l,T)|0,e=e+Math.imul(m,S)|0,f=f+Math.imul(m,T)|0;var ra=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ra>>>26)|0,ra&=67108863,d=Math.imul(r,P),e=Math.imul(r,Q),e=e+Math.imul(s,P)|0,f=Math.imul(s,Q),d=d+Math.imul(o,S)|0,e=e+Math.imul(o,T)|0,e=e+Math.imul(p,S)|0,f=f+Math.imul(p,T)|0,d=d+Math.imul(l,V)|0,e=e+Math.imul(l,W)|0,e=e+Math.imul(m,V)|0,f=f+Math.imul(m,W)|0;var sa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(sa>>>26)|0,sa&=67108863,d=Math.imul(u,P),e=Math.imul(u,Q),e=e+Math.imul(v,P)|0,f=Math.imul(v,Q),d=d+Math.imul(r,S)|0,e=e+Math.imul(r,T)|0,e=e+Math.imul(s,S)|0,f=f+Math.imul(s,T)|0,d=d+Math.imul(o,V)|0,e=e+Math.imul(o,W)|0,e=e+Math.imul(p,V)|0,f=f+Math.imul(p,W)|0,d=d+Math.imul(l,Y)|0,e=e+Math.imul(l,Z)|0,e=e+Math.imul(m,Y)|0,f=f+Math.imul(m,Z)|0;var ta=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ta>>>26)|0,ta&=67108863,d=Math.imul(x,P),e=Math.imul(x,Q),e=e+Math.imul(y,P)|0,f=Math.imul(y,Q),d=d+Math.imul(u,S)|0,e=e+Math.imul(u,T)|0,e=e+Math.imul(v,S)|0,f=f+Math.imul(v,T)|0,d=d+Math.imul(r,V)|0,e=e+Math.imul(r,W)|0,e=e+Math.imul(s,V)|0,f=f+Math.imul(s,W)|0,d=d+Math.imul(o,Y)|0,e=e+Math.imul(o,Z)|0,e=e+Math.imul(p,Y)|0,f=f+Math.imul(p,Z)|0,d=d+Math.imul(l,_)|0,e=e+Math.imul(l,aa)|0,e=e+Math.imul(m,_)|0,f=f+Math.imul(m,aa)|0;var ua=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ua>>>26)|0,ua&=67108863,d=Math.imul(A,P),e=Math.imul(A,Q),e=e+Math.imul(B,P)|0,f=Math.imul(B,Q),d=d+Math.imul(x,S)|0,e=e+Math.imul(x,T)|0,e=e+Math.imul(y,S)|0,f=f+Math.imul(y,T)|0,d=d+Math.imul(u,V)|0,e=e+Math.imul(u,W)|0,e=e+Math.imul(v,V)|0,f=f+Math.imul(v,W)|0,d=d+Math.imul(r,Y)|0,e=e+Math.imul(r,Z)|0,e=e+Math.imul(s,Y)|0,f=f+Math.imul(s,Z)|0,d=d+Math.imul(o,_)|0,e=e+Math.imul(o,aa)|0,e=e+Math.imul(p,_)|0,f=f+Math.imul(p,aa)|0,d=d+Math.imul(l,ca)|0,e=e+Math.imul(l,da)|0,e=e+Math.imul(m,ca)|0,f=f+Math.imul(m,da)|0;var va=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(va>>>26)|0,va&=67108863,d=Math.imul(D,P),e=Math.imul(D,Q),e=e+Math.imul(E,P)|0,f=Math.imul(E,Q),d=d+Math.imul(A,S)|0,e=e+Math.imul(A,T)|0,e=e+Math.imul(B,S)|0,f=f+Math.imul(B,T)|0,d=d+Math.imul(x,V)|0,e=e+Math.imul(x,W)|0,e=e+Math.imul(y,V)|0,f=f+Math.imul(y,W)|0,d=d+Math.imul(u,Y)|0,e=e+Math.imul(u,Z)|0,e=e+Math.imul(v,Y)|0,f=f+Math.imul(v,Z)|0,d=d+Math.imul(r,_)|0,e=e+Math.imul(r,aa)|0,e=e+Math.imul(s,_)|0,f=f+Math.imul(s,aa)|0,d=d+Math.imul(o,ca)|0,e=e+Math.imul(o,da)|0,e=e+Math.imul(p,ca)|0,f=f+Math.imul(p,da)|0,d=d+Math.imul(l,fa)|0,e=e+Math.imul(l,ga)|0,e=e+Math.imul(m,fa)|0,f=f+Math.imul(m,ga)|0;var wa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(wa>>>26)|0,wa&=67108863,d=Math.imul(G,P),e=Math.imul(G,Q),e=e+Math.imul(H,P)|0,f=Math.imul(H,Q),d=d+Math.imul(D,S)|0,e=e+Math.imul(D,T)|0,e=e+Math.imul(E,S)|0,f=f+Math.imul(E,T)|0,d=d+Math.imul(A,V)|0,e=e+Math.imul(A,W)|0,e=e+Math.imul(B,V)|0,f=f+Math.imul(B,W)|0,d=d+Math.imul(x,Y)|0,e=e+Math.imul(x,Z)|0,e=e+Math.imul(y,Y)|0,f=f+Math.imul(y,Z)|0,d=d+Math.imul(u,_)|0,e=e+Math.imul(u,aa)|0,e=e+Math.imul(v,_)|0,f=f+Math.imul(v,aa)|0,d=d+Math.imul(r,ca)|0,e=e+Math.imul(r,da)|0,e=e+Math.imul(s,ca)|0,f=f+Math.imul(s,da)|0,d=d+Math.imul(o,fa)|0,e=e+Math.imul(o,ga)|0,e=e+Math.imul(p,fa)|0,f=f+Math.imul(p,ga)|0,d=d+Math.imul(l,ia)|0,e=e+Math.imul(l,ja)|0,e=e+Math.imul(m,ia)|0,f=f+Math.imul(m,ja)|0;var xa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(xa>>>26)|0,xa&=67108863,d=Math.imul(J,P),e=Math.imul(J,Q),e=e+Math.imul(K,P)|0,f=Math.imul(K,Q),d=d+Math.imul(G,S)|0,e=e+Math.imul(G,T)|0,e=e+Math.imul(H,S)|0,f=f+Math.imul(H,T)|0,d=d+Math.imul(D,V)|0,e=e+Math.imul(D,W)|0,e=e+Math.imul(E,V)|0,f=f+Math.imul(E,W)|0,d=d+Math.imul(A,Y)|0,e=e+Math.imul(A,Z)|0,e=e+Math.imul(B,Y)|0,f=f+Math.imul(B,Z)|0,d=d+Math.imul(x,_)|0,e=e+Math.imul(x,aa)|0,e=e+Math.imul(y,_)|0,f=f+Math.imul(y,aa)|0,d=d+Math.imul(u,ca)|0,e=e+Math.imul(u,da)|0,e=e+Math.imul(v,ca)|0,f=f+Math.imul(v,da)|0,d=d+Math.imul(r,fa)|0,e=e+Math.imul(r,ga)|0,e=e+Math.imul(s,fa)|0,f=f+Math.imul(s,ga)|0,d=d+Math.imul(o,ia)|0,e=e+Math.imul(o,ja)|0,e=e+Math.imul(p,ia)|0,f=f+Math.imul(p,ja)|0,d=d+Math.imul(l,la)|0,e=e+Math.imul(l,ma)|0,e=e+Math.imul(m,la)|0,f=f+Math.imul(m,ma)|0;var ya=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(ya>>>26)|0,ya&=67108863,d=Math.imul(M,P),e=Math.imul(M,Q),e=e+Math.imul(N,P)|0,f=Math.imul(N,Q),d=d+Math.imul(J,S)|0,e=e+Math.imul(J,T)|0,e=e+Math.imul(K,S)|0,f=f+Math.imul(K,T)|0,d=d+Math.imul(G,V)|0,e=e+Math.imul(G,W)|0,e=e+Math.imul(H,V)|0,f=f+Math.imul(H,W)|0,d=d+Math.imul(D,Y)|0,e=e+Math.imul(D,Z)|0,e=e+Math.imul(E,Y)|0,f=f+Math.imul(E,Z)|0,d=d+Math.imul(A,_)|0,e=e+Math.imul(A,aa)|0,e=e+Math.imul(B,_)|0,f=f+Math.imul(B,aa)|0,d=d+Math.imul(x,ca)|0,e=e+Math.imul(x,da)|0,e=e+Math.imul(y,ca)|0,f=f+Math.imul(y,da)|0,d=d+Math.imul(u,fa)|0,e=e+Math.imul(u,ga)|0,e=e+Math.imul(v,fa)|0,f=f+Math.imul(v,ga)|0,d=d+Math.imul(r,ia)|0,e=e+Math.imul(r,ja)|0,e=e+Math.imul(s,ia)|0,f=f+Math.imul(s,ja)|0,d=d+Math.imul(o,la)|0,e=e+Math.imul(o,ma)|0,e=e+Math.imul(p,la)|0,f=f+Math.imul(p,ma)|0,d=d+Math.imul(l,oa)|0,e=e+Math.imul(l,pa)|0,e=e+Math.imul(m,oa)|0,f=f+Math.imul(m,pa)|0;var za=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(za>>>26)|0,za&=67108863,d=Math.imul(M,S),e=Math.imul(M,T),e=e+Math.imul(N,S)|0,f=Math.imul(N,T),d=d+Math.imul(J,V)|0,e=e+Math.imul(J,W)|0,e=e+Math.imul(K,V)|0,f=f+Math.imul(K,W)|0,d=d+Math.imul(G,Y)|0,e=e+Math.imul(G,Z)|0,e=e+Math.imul(H,Y)|0,f=f+Math.imul(H,Z)|0,d=d+Math.imul(D,_)|0,e=e+Math.imul(D,aa)|0,e=e+Math.imul(E,_)|0,f=f+Math.imul(E,aa)|0,d=d+Math.imul(A,ca)|0,e=e+Math.imul(A,da)|0,e=e+Math.imul(B,ca)|0,f=f+Math.imul(B,da)|0,d=d+Math.imul(x,fa)|0,e=e+Math.imul(x,ga)|0,e=e+Math.imul(y,fa)|0,f=f+Math.imul(y,ga)|0,d=d+Math.imul(u,ia)|0,e=e+Math.imul(u,ja)|0,e=e+Math.imul(v,ia)|0,f=f+Math.imul(v,ja)|0,d=d+Math.imul(r,la)|0,e=e+Math.imul(r,ma)|0,e=e+Math.imul(s,la)|0,f=f+Math.imul(s,ma)|0,d=d+Math.imul(o,oa)|0,e=e+Math.imul(o,pa)|0,e=e+Math.imul(p,oa)|0,f=f+Math.imul(p,pa)|0;var Aa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Aa>>>26)|0,Aa&=67108863,d=Math.imul(M,V),e=Math.imul(M,W),e=e+Math.imul(N,V)|0,f=Math.imul(N,W),d=d+Math.imul(J,Y)|0,e=e+Math.imul(J,Z)|0,e=e+Math.imul(K,Y)|0,f=f+Math.imul(K,Z)|0,d=d+Math.imul(G,_)|0,e=e+Math.imul(G,aa)|0,e=e+Math.imul(H,_)|0,f=f+Math.imul(H,aa)|0,d=d+Math.imul(D,ca)|0,e=e+Math.imul(D,da)|0,e=e+Math.imul(E,ca)|0,f=f+Math.imul(E,da)|0,d=d+Math.imul(A,fa)|0,e=e+Math.imul(A,ga)|0,e=e+Math.imul(B,fa)|0,f=f+Math.imul(B,ga)|0,d=d+Math.imul(x,ia)|0,e=e+Math.imul(x,ja)|0,e=e+Math.imul(y,ia)|0,f=f+Math.imul(y,ja)|0,d=d+Math.imul(u,la)|0,e=e+Math.imul(u,ma)|0,e=e+Math.imul(v,la)|0,f=f+Math.imul(v,ma)|0,d=d+Math.imul(r,oa)|0,e=e+Math.imul(r,pa)|0,e=e+Math.imul(s,oa)|0,f=f+Math.imul(s,pa)|0;var Ba=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ba>>>26)|0,Ba&=67108863,d=Math.imul(M,Y),e=Math.imul(M,Z),e=e+Math.imul(N,Y)|0,f=Math.imul(N,Z),d=d+Math.imul(J,_)|0,e=e+Math.imul(J,aa)|0,e=e+Math.imul(K,_)|0,f=f+Math.imul(K,aa)|0,d=d+Math.imul(G,ca)|0,e=e+Math.imul(G,da)|0,e=e+Math.imul(H,ca)|0,f=f+Math.imul(H,da)|0,d=d+Math.imul(D,fa)|0,e=e+Math.imul(D,ga)|0,e=e+Math.imul(E,fa)|0,f=f+Math.imul(E,ga)|0,d=d+Math.imul(A,ia)|0,e=e+Math.imul(A,ja)|0,e=e+Math.imul(B,ia)|0,f=f+Math.imul(B,ja)|0,d=d+Math.imul(x,la)|0,e=e+Math.imul(x,ma)|0,e=e+Math.imul(y,la)|0,f=f+Math.imul(y,ma)|0,d=d+Math.imul(u,oa)|0,e=e+Math.imul(u,pa)|0,e=e+Math.imul(v,oa)|0,f=f+Math.imul(v,pa)|0;var Ca=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,d=Math.imul(M,_),e=Math.imul(M,aa),e=e+Math.imul(N,_)|0,f=Math.imul(N,aa),d=d+Math.imul(J,ca)|0,e=e+Math.imul(J,da)|0,e=e+Math.imul(K,ca)|0,f=f+Math.imul(K,da)|0,d=d+Math.imul(G,fa)|0,e=e+Math.imul(G,ga)|0,e=e+Math.imul(H,fa)|0,f=f+Math.imul(H,ga)|0,d=d+Math.imul(D,ia)|0,e=e+Math.imul(D,ja)|0,e=e+Math.imul(E,ia)|0,f=f+Math.imul(E,ja)|0,d=d+Math.imul(A,la)|0,e=e+Math.imul(A,ma)|0,e=e+Math.imul(B,la)|0,f=f+Math.imul(B,ma)|0,d=d+Math.imul(x,oa)|0,e=e+Math.imul(x,pa)|0,e=e+Math.imul(y,oa)|0,f=f+Math.imul(y,pa)|0;var Da=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Da>>>26)|0,Da&=67108863,d=Math.imul(M,ca),e=Math.imul(M,da),e=e+Math.imul(N,ca)|0,f=Math.imul(N,da),d=d+Math.imul(J,fa)|0,e=e+Math.imul(J,ga)|0,e=e+Math.imul(K,fa)|0,f=f+Math.imul(K,ga)|0,d=d+Math.imul(G,ia)|0,e=e+Math.imul(G,ja)|0,e=e+Math.imul(H,ia)|0,f=f+Math.imul(H,ja)|0,d=d+Math.imul(D,la)|0,e=e+Math.imul(D,ma)|0,e=e+Math.imul(E,la)|0,f=f+Math.imul(E,ma)|0,d=d+Math.imul(A,oa)|0,e=e+Math.imul(A,pa)|0,e=e+Math.imul(B,oa)|0,f=f+Math.imul(B,pa)|0;var Ea=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ea>>>26)|0,Ea&=67108863,d=Math.imul(M,fa),e=Math.imul(M,ga),e=e+Math.imul(N,fa)|0,f=Math.imul(N,ga),d=d+Math.imul(J,ia)|0,e=e+Math.imul(J,ja)|0,e=e+Math.imul(K,ia)|0,f=f+Math.imul(K,ja)|0,d=d+Math.imul(G,la)|0,e=e+Math.imul(G,ma)|0,e=e+Math.imul(H,la)|0,f=f+Math.imul(H,ma)|0,d=d+Math.imul(D,oa)|0,e=e+Math.imul(D,pa)|0,e=e+Math.imul(E,oa)|0,f=f+Math.imul(E,pa)|0;var Fa=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Fa>>>26)|0,Fa&=67108863,d=Math.imul(M,ia),e=Math.imul(M,ja),e=e+Math.imul(N,ia)|0,f=Math.imul(N,ja),d=d+Math.imul(J,la)|0,e=e+Math.imul(J,ma)|0,e=e+Math.imul(K,la)|0,f=f+Math.imul(K,ma)|0,d=d+Math.imul(G,oa)|0,e=e+Math.imul(G,pa)|0,e=e+Math.imul(H,oa)|0,f=f+Math.imul(H,pa)|0;var Ga=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ga>>>26)|0,Ga&=67108863,d=Math.imul(M,la),e=Math.imul(M,ma),e=e+Math.imul(N,la)|0,f=Math.imul(N,ma),d=d+Math.imul(J,oa)|0,e=e+Math.imul(J,pa)|0,e=e+Math.imul(K,oa)|0,f=f+Math.imul(K,pa)|0;var Ha=(j+d|0)+((8191&e)<<13)|0;j=(f+(e>>>13)|0)+(Ha>>>26)|0,Ha&=67108863,d=Math.imul(M,oa),e=Math.imul(M,pa),e=e+Math.imul(N,oa)|0,f=Math.imul(N,pa);var Ia=(j+d|0)+((8191&e)<<13)|0;return j=(f+(e>>>13)|0)+(Ia>>>26)|0,Ia&=67108863,i[0]=qa,i[1]=ra,i[2]=sa,i[3]=ta,i[4]=ua,i[5]=va,i[6]=wa,i[7]=xa,i[8]=ya,i[9]=za,i[10]=Aa,i[11]=Ba,i[12]=Ca,i[13]=Da,i[14]=Ea,i[15]=Fa,i[16]=Ga,i[17]=Ha,i[18]=Ia,0!==j&&(i[19]=j,c.length++),c};Math.imul||(y=j),f.prototype.mulTo=function(a,b){var c,d=this.length+a.length;return c=10===this.length&&10===a.length?y(this,a,b):d<63?j(this,a,b):d<1024?k(this,a,b):l(this,a,b)},m.prototype.makeRBT=function(a){for(var b=new Array(a),c=f.prototype._countBits(a)-1,d=0;d>=1;return d},m.prototype.permute=function(a,b,c,d,e,f){for(var g=0;g>>=1)e++;return 1<>>=13,c[2*g+1]=8191&f,f>>>=13;for(g=2*b;g>=26,b+=e/67108864|0,b+=f>>>26,this.words[c]=67108863&f}return 0!==b&&(this.words[c]=b,this.length++),this},f.prototype.muln=function(a){return this.clone().imuln(a)},f.prototype.sqr=function(){return this.mul(this)},f.prototype.isqr=function(){return this.imul(this.clone())},f.prototype.pow=function(a){var b=i(a);if(0===b.length)return new f(1);for(var c=this,d=0;d=0);var b,c=a%26,e=(a-c)/26,f=67108863>>>26-c<<26-c;if(0!==c){var g=0;for(b=0;b>>26-c}g&&(this.words[b]=g,this.length++)}if(0!==e){for(b=this.length-1;b>=0;b--)this.words[b+e]=this.words[b];for(b=0;b=0);var e;e=b?(b-b%26)/26:0;var f=a%26,g=Math.min((a-f)/26,this.length),h=67108863^67108863>>>f<g)for(this.length-=g,j=0;j=0&&(0!==k||j>=e);j--){var l=0|this.words[j];this.words[j]=k<<26-f|l>>>f,k=l&h}return i&&0!==k&&(i.words[i.length++]=k),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},f.prototype.ishrn=function(a,b,c){return d(0===this.negative),this.iushrn(a,b,c)},f.prototype.shln=function(a){return this.clone().ishln(a)},f.prototype.ushln=function(a){return this.clone().iushln(a)},f.prototype.shrn=function(a){return this.clone().ishrn(a)},f.prototype.ushrn=function(a){return this.clone().iushrn(a)},f.prototype.testn=function(a){d("number"==typeof a&&a>=0);var b=a%26,c=(a-b)/26,e=1<=0);var b=a%26,c=(a-b)/26;if(d(0===this.negative,"imaskn works only with positive numbers"),0!==b&&c++,this.length=Math.min(c,this.length),0!==b){var e=67108863^67108863>>>b<=67108864;b++)this.words[b]-=67108864,b===this.length-1?this.words[b+1]=1:this.words[b+1]++;return this.length=Math.max(this.length,b+1),this},f.prototype.isubn=function(a){if(d("number"==typeof a),d(a<67108864),a<0)return this.iaddn(-a);if(0!==this.negative)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var b=0;b>26)-(i/67108864|0),this.words[e+c]=67108863&g}for(;e>26,this.words[e+c]=67108863&g;if(0===h)return this.strip();for(d(h===-1),h=0,e=0;e>26,this.words[e]=67108863&g;return this.negative=1,this.strip()},f.prototype._wordDiv=function(a,b){var c=this.length-a.length,d=this.clone(),e=a,g=0|e.words[e.length-1],h=this._countBits(g);c=26-h,0!==c&&(e=e.ushln(c),d.iushln(c),g=0|e.words[e.length-1]);var i,j=d.length-e.length;if("mod"!==b){i=new f(null),i.length=j+1,i.words=new Array(i.length);for(var k=0;k=0;m--){var n=67108864*(0|d.words[e.length+m])+(0|d.words[e.length+m-1]);for(n=Math.min(n/g|0,67108863), +d._ishlnsubmul(e,n,m);0!==d.negative;)n--,d.negative=0,d._ishlnsubmul(e,1,m),d.isZero()||(d.negative^=1);i&&(i.words[m]=n)}return i&&i.strip(),d.strip(),"div"!==b&&0!==c&&d.iushrn(c),{div:i||null,mod:d}},f.prototype.divmod=function(a,b,c){if(d(!a.isZero()),this.isZero())return{div:new f(0),mod:new f(0)};var e,g,h;return 0!==this.negative&&0===a.negative?(h=this.neg().divmod(a,b),"mod"!==b&&(e=h.div.neg()),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.iadd(a)),{div:e,mod:g}):0===this.negative&&0!==a.negative?(h=this.divmod(a.neg(),b),"mod"!==b&&(e=h.div.neg()),{div:e,mod:h.mod}):0!==(this.negative&a.negative)?(h=this.neg().divmod(a.neg(),b),"div"!==b&&(g=h.mod.neg(),c&&0!==g.negative&&g.isub(a)),{div:h.div,mod:g}):a.length>this.length||this.cmp(a)<0?{div:new f(0),mod:this}:1===a.length?"div"===b?{div:this.divn(a.words[0]),mod:null}:"mod"===b?{div:null,mod:new f(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new f(this.modn(a.words[0]))}:this._wordDiv(a,b)},f.prototype.div=function(a){return this.divmod(a,"div",!1).div},f.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},f.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},f.prototype.divRound=function(a){var b=this.divmod(a);if(b.mod.isZero())return b.div;var c=0!==b.div.negative?b.mod.isub(a):b.mod,d=a.ushrn(1),e=a.andln(1),f=c.cmp(d);return f<0||1===e&&0===f?b.div:0!==b.div.negative?b.div.isubn(1):b.div.iaddn(1)},f.prototype.modn=function(a){d(a<=67108863);for(var b=(1<<26)%a,c=0,e=this.length-1;e>=0;e--)c=(b*c+(0|this.words[e]))%a;return c},f.prototype.idivn=function(a){d(a<=67108863);for(var b=0,c=this.length-1;c>=0;c--){var e=(0|this.words[c])+67108864*b;this.words[c]=e/a|0,b=e%a}return this.strip()},f.prototype.divn=function(a){return this.clone().idivn(a)},f.prototype.egcd=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=new f(0),i=new f(1),j=0;b.isEven()&&c.isEven();)b.iushrn(1),c.iushrn(1),++j;for(var k=c.clone(),l=b.clone();!b.isZero();){for(var m=0,n=1;0===(b.words[0]&n)&&m<26;++m,n<<=1);if(m>0)for(b.iushrn(m);m-- >0;)(e.isOdd()||g.isOdd())&&(e.iadd(k),g.isub(l)),e.iushrn(1),g.iushrn(1);for(var o=0,p=1;0===(c.words[0]&p)&&o<26;++o,p<<=1);if(o>0)for(c.iushrn(o);o-- >0;)(h.isOdd()||i.isOdd())&&(h.iadd(k),i.isub(l)),h.iushrn(1),i.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(h),g.isub(i)):(c.isub(b),h.isub(e),i.isub(g))}return{a:h,b:i,gcd:c.iushln(j)}},f.prototype._invmp=function(a){d(0===a.negative),d(!a.isZero());var b=this,c=a.clone();b=0!==b.negative?b.umod(a):b.clone();for(var e=new f(1),g=new f(0),h=c.clone();b.cmpn(1)>0&&c.cmpn(1)>0;){for(var i=0,j=1;0===(b.words[0]&j)&&i<26;++i,j<<=1);if(i>0)for(b.iushrn(i);i-- >0;)e.isOdd()&&e.iadd(h),e.iushrn(1);for(var k=0,l=1;0===(c.words[0]&l)&&k<26;++k,l<<=1);if(k>0)for(c.iushrn(k);k-- >0;)g.isOdd()&&g.iadd(h),g.iushrn(1);b.cmp(c)>=0?(b.isub(c),e.isub(g)):(c.isub(b),g.isub(e))}var m;return m=0===b.cmpn(1)?e:g,m.cmpn(0)<0&&m.iadd(a),m},f.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var b=this.clone(),c=a.clone();b.negative=0,c.negative=0;for(var d=0;b.isEven()&&c.isEven();d++)b.iushrn(1),c.iushrn(1);for(;;){for(;b.isEven();)b.iushrn(1);for(;c.isEven();)c.iushrn(1);var e=b.cmp(c);if(e<0){var f=b;b=c,c=f}else if(0===e||0===c.cmpn(1))break;b.isub(c)}return c.iushln(d)},f.prototype.invm=function(a){return this.egcd(a).a.umod(a)},f.prototype.isEven=function(){return 0===(1&this.words[0])},f.prototype.isOdd=function(){return 1===(1&this.words[0])},f.prototype.andln=function(a){return this.words[0]&a},f.prototype.bincn=function(a){d("number"==typeof a);var b=a%26,c=(a-b)/26,e=1<>>26,h&=67108863,this.words[g]=h}return 0!==f&&(this.words[g]=f,this.length++),this},f.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},f.prototype.cmpn=function(a){var b=a<0;if(0!==this.negative&&!b)return-1;if(0===this.negative&&b)return 1;this.strip();var c;if(this.length>1)c=1;else{b&&(a=-a),d(a<=67108863,"Number is too big");var e=0|this.words[0];c=e===a?0:ea.length)return 1;if(this.length=0;c--){var d=0|this.words[c],e=0|a.words[c];if(d!==e){de&&(b=1);break}}return b},f.prototype.gtn=function(a){return 1===this.cmpn(a)},f.prototype.gt=function(a){return 1===this.cmp(a)},f.prototype.gten=function(a){return this.cmpn(a)>=0},f.prototype.gte=function(a){return this.cmp(a)>=0},f.prototype.ltn=function(a){return this.cmpn(a)===-1},f.prototype.lt=function(a){return this.cmp(a)===-1},f.prototype.lten=function(a){return this.cmpn(a)<=0},f.prototype.lte=function(a){return this.cmp(a)<=0},f.prototype.eqn=function(a){return 0===this.cmpn(a)},f.prototype.eq=function(a){return 0===this.cmp(a)},f.red=function(a){return new s(a)},f.prototype.toRed=function(a){return d(!this.red,"Already a number in reduction context"),d(0===this.negative,"red works only with positives"),a.convertTo(this)._forceRed(a)},f.prototype.fromRed=function(){return d(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},f.prototype._forceRed=function(a){return this.red=a,this},f.prototype.forceRed=function(a){return d(!this.red,"Already a number in reduction context"),this._forceRed(a)},f.prototype.redAdd=function(a){return d(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},f.prototype.redIAdd=function(a){return d(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},f.prototype.redSub=function(a){return d(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},f.prototype.redISub=function(a){return d(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},f.prototype.redShl=function(a){return d(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},f.prototype.redMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},f.prototype.redIMul=function(a){return d(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},f.prototype.redSqr=function(){return d(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},f.prototype.redISqr=function(){return d(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},f.prototype.redSqrt=function(){return d(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},f.prototype.redInvm=function(){return d(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},f.prototype.redNeg=function(){return d(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},f.prototype.redPow=function(a){return d(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var z={k256:null,p224:null,p192:null,p25519:null};n.prototype._tmp=function(){var a=new f(null);return a.words=new Array(Math.ceil(this.n/13)),a},n.prototype.ireduce=function(a){var b,c=a;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),b=c.bitLength();while(b>this.n);var d=b0?c.isub(this.p):c.strip(),c},n.prototype.split=function(a,b){a.iushrn(this.n,0,b)},n.prototype.imulK=function(a){return a.imul(this.k)},e(o,n),o.prototype.split=function(a,b){for(var c=4194303,d=Math.min(a.length,9),e=0;e>>22,f=g}f>>>=22,a.words[e-10]=f,0===f&&a.length>10?a.length-=10:a.length-=9},o.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var b=0,c=0;c>>=26,a.words[c]=e,b=d}return 0!==b&&(a.words[a.length++]=b),a},f._prime=function a(b){if(z[b])return z[b];var a;if("k256"===b)a=new o;else if("p224"===b)a=new p;else if("p192"===b)a=new q;else{if("p25519"!==b)throw new Error("Unknown prime "+b);a=new r}return z[b]=a,a},s.prototype._verify1=function(a){d(0===a.negative,"red works only with positives"),d(a.red,"red works only with red numbers")},s.prototype._verify2=function(a,b){d(0===(a.negative|b.negative),"red works only with positives"),d(a.red&&a.red===b.red,"red works only with red numbers")},s.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},s.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},s.prototype.add=function(a,b){this._verify2(a,b);var c=a.add(b);return c.cmp(this.m)>=0&&c.isub(this.m),c._forceRed(this)},s.prototype.iadd=function(a,b){this._verify2(a,b);var c=a.iadd(b);return c.cmp(this.m)>=0&&c.isub(this.m),c},s.prototype.sub=function(a,b){this._verify2(a,b);var c=a.sub(b);return c.cmpn(0)<0&&c.iadd(this.m),c._forceRed(this)},s.prototype.isub=function(a,b){this._verify2(a,b);var c=a.isub(b);return c.cmpn(0)<0&&c.iadd(this.m),c},s.prototype.shl=function(a,b){return this._verify1(a),this.imod(a.ushln(b))},s.prototype.imul=function(a,b){return this._verify2(a,b),this.imod(a.imul(b))},s.prototype.mul=function(a,b){return this._verify2(a,b),this.imod(a.mul(b))},s.prototype.isqr=function(a){return this.imul(a,a.clone())},s.prototype.sqr=function(a){return this.mul(a,a)},s.prototype.sqrt=function(a){if(a.isZero())return a.clone();var b=this.m.andln(3);if(d(b%2===1),3===b){var c=this.m.add(new f(1)).iushrn(2);return this.pow(a,c)}for(var e=this.m.subn(1),g=0;!e.isZero()&&0===e.andln(1);)g++,e.iushrn(1);d(!e.isZero());var h=new f(1).toRed(this),i=h.redNeg(),j=this.m.subn(1).iushrn(1),k=this.m.bitLength();for(k=new f(2*k*k).toRed(this);0!==this.pow(k,j).cmp(i);)k.redIAdd(i);for(var l=this.pow(k,e),m=this.pow(a,e.addn(1).iushrn(1)),n=this.pow(a,e),o=g;0!==n.cmp(h);){for(var p=n,q=0;0!==p.cmp(h);q++)p=p.redSqr();d(q=0;e--){for(var k=b.words[e],l=j-1;l>=0;l--){var m=k>>l&1;g!==d[0]&&(g=this.sqr(g)),0!==m||0!==h?(h<<=1,h|=m,i++,(i===c||0===e&&0===l)&&(g=this.mul(g,d[h]),i=0,h=0)):i=0}j=26}return g},s.prototype.convertTo=function(a){var b=a.umod(this.m);return b===a?b.clone():b},s.prototype.convertFrom=function(a){var b=a.clone();return b.red=null,b},f.mont=function(a){return new t(a)},e(t,s),t.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},t.prototype.convertFrom=function(a){var b=this.imod(a.mul(this.rinv));return b.red=null,b},t.prototype.imul=function(a,b){if(a.isZero()||b.isZero())return a.words[0]=0,a.length=1,a;var c=a.imul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),f=e;return e.cmp(this.m)>=0?f=e.isub(this.m):e.cmpn(0)<0&&(f=e.iadd(this.m)),f._forceRed(this)},t.prototype.mul=function(a,b){if(a.isZero()||b.isZero())return new f(0)._forceRed(this);var c=a.mul(b),d=c.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),e=c.isub(d).iushrn(this.shift),g=e;return e.cmp(this.m)>=0?g=e.isub(this.m):e.cmpn(0)<0&&(g=e.iadd(this.m)),g._forceRed(this)},t.prototype.invm=function(a){var b=this.imod(a._invmp(this.m).mul(this.r2));return b._forceRed(this)}}("undefined"==typeof b||b,this)},{}],46:[function(a,b,c){(function(c){function d(a){var b=f(a),c=b.toRed(g.mont(a.modulus)).redPow(new g(a.publicExponent)).fromRed();return{blinder:c,unblinder:b.invm(a.modulus)}}function e(a,b){var e=d(b),f=b.modulus.byteLength(),h=(g.mont(b.modulus),new g(a).mul(e.blinder).umod(b.modulus)),i=h.toRed(g.mont(b.prime1)),j=h.toRed(g.mont(b.prime2)),k=b.coefficient,l=b.prime1,m=b.prime2,n=i.redPow(b.exponent1),o=j.redPow(b.exponent2);n=n.fromRed(),o=o.fromRed();var p=n.isub(o).imul(k).umod(l);return p.imul(m),o.iadd(p),new c(o.imul(e.unblinder).umod(b.modulus).toArray(!1,f))}function f(a){for(var b=a.modulus.byteLength(),c=new g(h(b));c.cmp(a.modulus)>=0||!c.umod(a.prime1)||!c.umod(a.prime2);)c=new g(h(b));return c}var g=a("bn.js"),h=a("randombytes");b.exports=e,e.getr=f}).call(this,a("buffer").Buffer)},{"bn.js":45,buffer:8,randombytes:203}],47:[function(a,b,c){"use strict";var d=c;d.version=a("../package.json").version,d.utils=a("./elliptic/utils"),d.rand=a("brorand"),d.hmacDRBG=a("./elliptic/hmac-drbg"),d.curve=a("./elliptic/curve"),d.curves=a("./elliptic/curves"),d.ec=a("./elliptic/ec"),d.eddsa=a("./elliptic/eddsa")},{"../package.json":70,"./elliptic/curve":50,"./elliptic/curves":53,"./elliptic/ec":54,"./elliptic/eddsa":57,"./elliptic/hmac-drbg":60,"./elliptic/utils":62,brorand:63}],48:[function(a,b,c){"use strict";function d(a,b){this.type=a,this.p=new f(b.p,16),this.red=b.prime?f.red(b.prime):f.mont(this.p),this.zero=new f(0).toRed(this.red),this.one=new f(1).toRed(this.red),this.two=new f(2).toRed(this.red),this.n=b.n&&new f(b.n,16),this.g=b.g&&this.pointFromJSON(b.g,b.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var c=this.n&&this.p.div(this.n);!c||c.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function e(a,b){this.curve=a,this.type=b,this.precomputed=null}var f=a("bn.js"),g=a("../../elliptic"),h=g.utils,i=h.getNAF,j=h.getJSF,k=h.assert;b.exports=d,d.prototype.point=function(){throw new Error("Not implemented")},d.prototype.validate=function(){throw new Error("Not implemented")},d.prototype._fixedNafMul=function(a,b){k(a.precomputed);var c=a._getDoubles(),d=i(b,1),e=(1<=g;b--)h=(h<<1)+d[b];f.push(h)}for(var j=this.jpoint(null,null,null),l=this.jpoint(null,null,null),m=e;m>0;m--){for(var g=0;g=0;h--){for(var b=0;h>=0&&0===f[h];h--)b++;if(h>=0&&b++,g=g.dblp(b),h<0)break;var j=f[h];k(0!==j),g="affine"===a.type?j>0?g.mixedAdd(e[j-1>>1]):g.mixedAdd(e[-j-1>>1].neg()):j>0?g.add(e[j-1>>1]):g.add(e[-j-1>>1].neg())}return"affine"===a.type?g.toP():g},d.prototype._wnafMulAdd=function(a,b,c,d,e){for(var f=this._wnafT1,g=this._wnafT2,h=this._wnafT3,k=0,l=0;l=1;l-=2){var o=l-1,p=l;if(1===f[o]&&1===f[p]){var q=[b[o],null,null,b[p]];0===b[o].y.cmp(b[p].y)?(q[1]=b[o].add(b[p]),q[2]=b[o].toJ().mixedAdd(b[p].neg())):0===b[o].y.cmp(b[p].y.redNeg())?(q[1]=b[o].toJ().mixedAdd(b[p]),q[2]=b[o].add(b[p].neg())):(q[1]=b[o].toJ().mixedAdd(b[p]),q[2]=b[o].toJ().mixedAdd(b[p].neg()));var r=[-3,-1,-5,-7,0,7,5,1,3],s=j(c[o],c[p]);k=Math.max(s[0].length,k),h[o]=new Array(k),h[p]=new Array(k);for(var t=0;t=0;l--){for(var y=0;l>=0;){for(var z=!0,t=0;t=0&&y++,w=w.dblp(y),l<0)break;for(var t=0;t0?m=g[t][A-1>>1]:A<0&&(m=g[t][-A-1>>1].neg()),w="affine"===m.type?w.mixedAdd(m):w.add(m))}}for(var l=0;l=Math.ceil((a.bitLength()+1)/b.step)},e.prototype._getDoubles=function(a,b){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],d=this,e=0;e":""},e.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},e.prototype._extDbl=function(){var a=this.x.redSqr(),b=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(a),e=this.x.redAdd(this.y).redSqr().redISub(a).redISub(b),f=d.redAdd(b),g=f.redSub(c),h=d.redSub(b),i=e.redMul(g),j=f.redMul(h),k=e.redMul(h),l=g.redMul(f);return this.curve.point(i,j,l,k)},e.prototype._projDbl=function(){var a,b,c,d=this.x.redAdd(this.y).redSqr(),e=this.x.redSqr(),f=this.y.redSqr();if(this.curve.twisted){var g=this.curve._mulA(e),h=g.redAdd(f);if(this.zOne)a=d.redSub(e).redSub(f).redMul(h.redSub(this.curve.two)),b=h.redMul(g.redSub(f)),c=h.redSqr().redSub(h).redSub(h);else{var i=this.z.redSqr(),j=h.redSub(i).redISub(i);a=d.redSub(e).redISub(f).redMul(j),b=h.redMul(g.redSub(f)),c=h.redMul(j)}}else{var g=e.redAdd(f),i=this.curve._mulC(this.c.redMul(this.z)).redSqr(),j=g.redSub(i).redSub(i);a=this.curve._mulC(d.redISub(g)).redMul(j),b=this.curve._mulC(g).redMul(e.redISub(f)),c=g.redMul(j)}return this.curve.point(a,b,c)},e.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},e.prototype._extAdd=function(a){var b=this.y.redSub(this.x).redMul(a.y.redSub(a.x)),c=this.y.redAdd(this.x).redMul(a.y.redAdd(a.x)),d=this.t.redMul(this.curve.dd).redMul(a.t),e=this.z.redMul(a.z.redAdd(a.z)),f=c.redSub(b),g=e.redSub(d),h=e.redAdd(d),i=c.redAdd(b),j=f.redMul(g),k=h.redMul(i),l=f.redMul(i),m=g.redMul(h);return this.curve.point(j,k,m,l)},e.prototype._projAdd=function(a){var b,c,d=this.z.redMul(a.z),e=d.redSqr(),f=this.x.redMul(a.x),g=this.y.redMul(a.y),h=this.curve.d.redMul(f).redMul(g),i=e.redSub(h),j=e.redAdd(h),k=this.x.redAdd(this.y).redMul(a.x.redAdd(a.y)).redISub(f).redISub(g),l=d.redMul(i).redMul(k);return this.curve.twisted?(b=d.redMul(j).redMul(g.redSub(this.curve._mulA(f))),c=i.redMul(j)):(b=d.redMul(j).redMul(g.redSub(f)),c=this.curve._mulC(i).redMul(j)),this.curve.point(l,b,c)},e.prototype.add=function(a){return this.isInfinity()?a:a.isInfinity()?this:this.curve.extended?this._extAdd(a):this._projAdd(a)},e.prototype.mul=function(a){return this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve._wnafMul(this,a)},e.prototype.mulAdd=function(a,b,c){return this.curve._wnafMulAdd(1,[this,b],[a,c],2,!1)},e.prototype.jmulAdd=function(a,b,c){return this.curve._wnafMulAdd(1,[this,b],[a,c],2,!0)},e.prototype.normalize=function(){if(this.zOne)return this;var a=this.z.redInvm();return this.x=this.x.redMul(a),this.y=this.y.redMul(a),this.t&&(this.t=this.t.redMul(a)),this.z=this.curve.one,this.zOne=!0,this},e.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},e.prototype.getX=function(){return this.normalize(),this.x.fromRed()},e.prototype.getY=function(){return this.normalize(),this.y.fromRed()},e.prototype.eq=function(a){return this===a||0===this.getX().cmp(a.getX())&&0===this.getY().cmp(a.getY())},e.prototype.eqXToP=function(a){var b=a.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(b))return!0;for(var c=a.clone(),d=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(b.redIAdd(d),0===this.x.cmp(b))return!0}return!1},e.prototype.toP=e.prototype.normalize,e.prototype.mixedAdd=e.prototype.add},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],50:[function(a,b,c){"use strict";var d=c;d.base=a("./base"),d.short=a("./short"),d.mont=a("./mont"),d.edwards=a("./edwards")},{"./base":48,"./edwards":49,"./mont":51,"./short":52}],51:[function(a,b,c){"use strict";function d(a){i.call(this,"mont",a),this.a=new g(a.a,16).toRed(this.red),this.b=new g(a.b,16).toRed(this.red),this.i4=new g(4).toRed(this.red).redInvm(),this.two=new g(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function e(a,b,c){i.BasePoint.call(this,a,"projective"),null===b&&null===c?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new g(b,16),this.z=new g(c,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var f=a("../curve"),g=a("bn.js"),h=a("inherits"),i=f.base,j=a("../../elliptic"),k=j.utils;h(d,i),b.exports=d,d.prototype.validate=function(a){var b=a.normalize().x,c=b.redSqr(),d=c.redMul(b).redAdd(c.redMul(this.a)).redAdd(b),e=d.redSqrt();return 0===e.redSqr().cmp(d)},h(e,i.BasePoint),d.prototype.decodePoint=function(a,b){return this.point(k.toArray(a,b),1)},d.prototype.point=function(a,b){return new e(this,a,b)},d.prototype.pointFromJSON=function(a){return e.fromJSON(this,a)},e.prototype.precompute=function(){},e.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},e.fromJSON=function(a,b){return new e(a,b[0],b[1]||a.one)},e.prototype.inspect=function(){return this.isInfinity()?"":""},e.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},e.prototype.dbl=function(){var a=this.x.redAdd(this.z),b=a.redSqr(),c=this.x.redSub(this.z),d=c.redSqr(),e=b.redSub(d),f=b.redMul(d),g=e.redMul(d.redAdd(this.curve.a24.redMul(e)));return this.curve.point(f,g)},e.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.diffAdd=function(a,b){var c=this.x.redAdd(this.z),d=this.x.redSub(this.z),e=a.x.redAdd(a.z),f=a.x.redSub(a.z),g=f.redMul(c),h=e.redMul(d),i=b.z.redMul(g.redAdd(h).redSqr()),j=b.x.redMul(g.redISub(h).redSqr());return this.curve.point(i,j)},e.prototype.mul=function(a){for(var b=a.clone(),c=this,d=this.curve.point(null,null),e=this,f=[];0!==b.cmpn(0);b.iushrn(1))f.push(b.andln(1));for(var g=f.length-1;g>=0;g--)0===f[g]?(c=c.diffAdd(d,e),d=d.dbl()):(d=c.diffAdd(d,e),c=c.dbl());return d},e.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},e.prototype.eq=function(a){return 0===this.getX().cmp(a.getX())},e.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},e.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],52:[function(a,b,c){"use strict";function d(a){k.call(this,"short",a),this.a=new i(a.a,16).toRed(this.red),this.b=new i(a.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(a),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function e(a,b,c,d){k.BasePoint.call(this,a,"affine"),null===b&&null===c?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(b,16),this.y=new i(c,16),d&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function f(a,b,c,d){k.BasePoint.call(this,a,"jacobian"),null===b&&null===c&&null===d?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(b,16),this.y=new i(c,16),this.z=new i(d,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var g=a("../curve"),h=a("../../elliptic"),i=a("bn.js"),j=a("inherits"),k=g.base,l=h.utils.assert;j(d,k),b.exports=d,d.prototype._getEndomorphism=function(a){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var b,c;if(a.beta)b=new i(a.beta,16).toRed(this.red);else{var d=this._getEndoRoots(this.p);b=d[0].cmp(d[1])<0?d[0]:d[1],b=b.toRed(this.red)}if(a.lambda)c=new i(a.lambda,16);else{var e=this._getEndoRoots(this.n);0===this.g.mul(e[0]).x.cmp(this.g.x.redMul(b))?c=e[0]:(c=e[1],l(0===this.g.mul(c).x.cmp(this.g.x.redMul(b))))}var f;return f=a.basis?a.basis.map(function(a){return{a:new i(a.a,16),b:new i(a.b,16)}}):this._getEndoBasis(c),{beta:b,lambda:c,basis:f}}},d.prototype._getEndoRoots=function(a){var b=a===this.p?this.red:i.mont(a),c=new i(2).toRed(b).redInvm(),d=c.redNeg(),e=new i(3).toRed(b).redNeg().redSqrt().redMul(c),f=d.redAdd(e).fromRed(),g=d.redSub(e).fromRed();return[f,g]},d.prototype._getEndoBasis=function(a){for(var b,c,d,e,f,g,h,j,k,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),m=a,n=this.n.clone(),o=new i(1),p=new i(0),q=new i(0),r=new i(1),s=0;0!==m.cmpn(0);){var t=n.div(m);j=n.sub(t.mul(m)),k=q.sub(t.mul(o));var u=r.sub(t.mul(p));if(!d&&j.cmp(l)<0)b=h.neg(),c=o,d=j.neg(),e=k;else if(d&&2===++s)break;h=j,n=m,m=j,q=o,o=k,r=p,p=u}f=j.neg(),g=k;var v=d.sqr().add(e.sqr()),w=f.sqr().add(g.sqr());return w.cmp(v)>=0&&(f=b,g=c),d.negative&&(d=d.neg(),e=e.neg()),f.negative&&(f=f.neg(),g=g.neg()),[{a:d,b:e},{a:f,b:g}]},d.prototype._endoSplit=function(a){var b=this.endo.basis,c=b[0],d=b[1],e=d.b.mul(a).divRound(this.n),f=c.b.neg().mul(a).divRound(this.n),g=e.mul(c.a),h=f.mul(d.a),i=e.mul(c.b),j=f.mul(d.b),k=a.sub(g).sub(h),l=i.add(j).neg();return{k1:k,k2:l}},d.prototype.pointFromX=function(a,b){a=new i(a,16),a.red||(a=a.toRed(this.red));var c=a.redSqr().redMul(a).redIAdd(a.redMul(this.a)).redIAdd(this.b),d=c.redSqrt();if(0!==d.redSqr().redSub(c).cmp(this.zero))throw new Error("invalid point");var e=d.fromRed().isOdd();return(b&&!e||!b&&e)&&(d=d.redNeg()),this.point(a,d)},d.prototype.validate=function(a){if(a.inf)return!0;var b=a.x,c=a.y,d=this.a.redMul(b),e=b.redSqr().redMul(b).redIAdd(d).redIAdd(this.b);return 0===c.redSqr().redISub(e).cmpn(0)},d.prototype._endoWnafMulAdd=function(a,b,c){for(var d=this._endoWnafT1,e=this._endoWnafT2,f=0;f":""},e.prototype.isInfinity=function(){return this.inf},e.prototype.add=function(a){if(this.inf)return a;if(a.inf)return this;if(this.eq(a))return this.dbl();if(this.neg().eq(a))return this.curve.point(null,null);if(0===this.x.cmp(a.x))return this.curve.point(null,null);var b=this.y.redSub(a.y);0!==b.cmpn(0)&&(b=b.redMul(this.x.redSub(a.x).redInvm()));var c=b.redSqr().redISub(this.x).redISub(a.x),d=b.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,d)},e.prototype.dbl=function(){if(this.inf)return this;var a=this.y.redAdd(this.y);if(0===a.cmpn(0))return this.curve.point(null,null);var b=this.curve.a,c=this.x.redSqr(),d=a.redInvm(),e=c.redAdd(c).redIAdd(c).redIAdd(b).redMul(d),f=e.redSqr().redISub(this.x.redAdd(this.x)),g=e.redMul(this.x.redSub(f)).redISub(this.y);return this.curve.point(f,g)},e.prototype.getX=function(){return this.x.fromRed()},e.prototype.getY=function(){return this.y.fromRed()},e.prototype.mul=function(a){return a=new i(a,16),this._hasDoubles(a)?this.curve._fixedNafMul(this,a):this.curve.endo?this.curve._endoWnafMulAdd([this],[a]):this.curve._wnafMul(this,a)},e.prototype.mulAdd=function(a,b,c){var d=[this,b],e=[a,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,e):this.curve._wnafMulAdd(1,d,e,2)},e.prototype.jmulAdd=function(a,b,c){var d=[this,b],e=[a,c];return this.curve.endo?this.curve._endoWnafMulAdd(d,e,!0):this.curve._wnafMulAdd(1,d,e,2,!0)},e.prototype.eq=function(a){return this===a||this.inf===a.inf&&(this.inf||0===this.x.cmp(a.x)&&0===this.y.cmp(a.y))},e.prototype.neg=function(a){if(this.inf)return this;var b=this.curve.point(this.x,this.y.redNeg());if(a&&this.precomputed){var c=this.precomputed,d=function(a){return a.neg()};b.precomputed={naf:c.naf&&{wnd:c.naf.wnd,points:c.naf.points.map(d)},doubles:c.doubles&&{step:c.doubles.step,points:c.doubles.points.map(d)}}}return b},e.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var a=this.curve.jpoint(this.x,this.y,this.curve.one);return a},j(f,k.BasePoint),d.prototype.jpoint=function(a,b,c){return new f(this,a,b,c)},f.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var a=this.z.redInvm(),b=a.redSqr(),c=this.x.redMul(b),d=this.y.redMul(b).redMul(a);return this.curve.point(c,d)},f.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},f.prototype.add=function(a){if(this.isInfinity())return a;if(a.isInfinity())return this;var b=a.z.redSqr(),c=this.z.redSqr(),d=this.x.redMul(b),e=a.x.redMul(c),f=this.y.redMul(b.redMul(a.z)),g=a.y.redMul(c.redMul(this.z)),h=d.redSub(e),i=f.redSub(g);if(0===h.cmpn(0))return 0!==i.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var j=h.redSqr(),k=j.redMul(h),l=d.redMul(j),m=i.redSqr().redIAdd(k).redISub(l).redISub(l),n=i.redMul(l.redISub(m)).redISub(f.redMul(k)),o=this.z.redMul(a.z).redMul(h);return this.curve.jpoint(m,n,o)},f.prototype.mixedAdd=function(a){if(this.isInfinity())return a.toJ();if(a.isInfinity())return this;var b=this.z.redSqr(),c=this.x,d=a.x.redMul(b),e=this.y,f=a.y.redMul(b).redMul(this.z),g=c.redSub(d),h=e.redSub(f);if(0===g.cmpn(0))return 0!==h.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var i=g.redSqr(),j=i.redMul(g),k=c.redMul(i),l=h.redSqr().redIAdd(j).redISub(k).redISub(k),m=h.redMul(k.redISub(l)).redISub(e.redMul(j)),n=this.z.redMul(g);return this.curve.jpoint(l,m,n)},f.prototype.dblp=function(a){if(0===a)return this;if(this.isInfinity())return this;if(!a)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var b=this,c=0;c=0)return!1;if(c.redIAdd(e),0===this.x.cmp(c))return!0}return!1},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":47,"../curve":50,"bn.js":45,inherits:205}],53:[function(a,b,c){"use strict";function d(a){"short"===a.type?this.curve=new h.curve.short(a):"edwards"===a.type?this.curve=new h.curve.edwards(a):this.curve=new h.curve.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function e(a,b){Object.defineProperty(f,a,{configurable:!0,enumerable:!0,get:function(){var c=new d(b);return Object.defineProperty(f,a,{configurable:!0,enumerable:!0,value:c}),c}})}var f=c,g=a("hash.js"),h=a("../elliptic"),i=h.utils.assert;f.PresetCurve=d,e("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:g.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),e("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:g.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),e("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:g.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),e("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:g.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),e("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:g.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),e("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:g.sha256,gRed:!1,g:["9"]}),e("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:g.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var j;try{j=a("./precomputed/secp256k1")}catch(a){j=void 0}e("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:g.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",j]})},{"../elliptic":47,"./precomputed/secp256k1":61,"hash.js":64}],54:[function(a,b,c){"use strict";function d(a){return this instanceof d?("string"==typeof a&&(h(f.curves.hasOwnProperty(a),"Unknown curve "+a),a=f.curves[a]),a instanceof f.curves.PresetCurve&&(a={curve:a}),this.curve=a.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=a.curve.g,this.g.precompute(a.curve.n.bitLength()+1),void(this.hash=a.hash||a.curve.hash)):new d(a)}var e=a("bn.js"),f=a("../../elliptic"),g=f.utils,h=g.assert,i=a("./key"),j=a("./signature");b.exports=d,d.prototype.keyPair=function(a){return new i(this,a)},d.prototype.keyFromPrivate=function(a,b){return i.fromPrivate(this,a,b)},d.prototype.keyFromPublic=function(a,b){return i.fromPublic(this,a,b)},d.prototype.genKeyPair=function(a){a||(a={});for(var b=new f.hmacDRBG({hash:this.hash,pers:a.pers,entropy:a.entropy||f.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),c=this.n.byteLength(),d=this.n.sub(new e(2));;){var g=new e(b.generate(c));if(!(g.cmp(d)>0))return g.iaddn(1),this.keyFromPrivate(g)}},d.prototype._truncateToN=function(a,b){var c=8*a.byteLength()-this.n.bitLength();return c>0&&(a=a.ushrn(c)),!b&&a.cmp(this.n)>=0?a.sub(this.n):a},d.prototype.sign=function(a,b,c,d){"object"==typeof c&&(d=c,c=null),d||(d={}),b=this.keyFromPrivate(b,c),a=this._truncateToN(new e(a,16));for(var g=this.n.byteLength(),h=b.getPrivate().toArray("be",g),i=a.toArray("be",g),k=new f.hmacDRBG({hash:this.hash,entropy:h,nonce:i,pers:d.pers,persEnc:d.persEnc}),l=this.n.sub(new e(1)),m=0;!0;m++){var n=d.k?d.k(m):new e(k.generate(this.n.byteLength()));if(n=this._truncateToN(n,!0),!(n.cmpn(1)<=0||n.cmp(l)>=0)){var o=this.g.mul(n);if(!o.isInfinity()){var p=o.getX(),q=p.umod(this.n);if(0!==q.cmpn(0)){var r=n.invm(this.n).mul(q.mul(b.getPrivate()).iadd(a));if(r=r.umod(this.n),0!==r.cmpn(0)){var s=(o.getY().isOdd()?1:0)|(0!==p.cmp(q)?2:0);return d.canonical&&r.cmp(this.nh)>0&&(r=this.n.sub(r),s^=1),new j({r:q,s:r,recoveryParam:s})}}}}}},d.prototype.verify=function(a,b,c,d){a=this._truncateToN(new e(a,16)),c=this.keyFromPublic(c,d),b=new j(b,"hex");var f=b.r,g=b.s;if(f.cmpn(1)<0||f.cmp(this.n)>=0)return!1;if(g.cmpn(1)<0||g.cmp(this.n)>=0)return!1;var h=g.invm(this.n),i=h.mul(a).umod(this.n),k=h.mul(f).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(i,c.getPublic(),k);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(f)}var l=this.g.jmulAdd(i,c.getPublic(),k);return!l.isInfinity()&&l.eqXToP(f)},d.prototype.recoverPubKey=function(a,b,c,d){h((3&c)===c,"The recovery param is more than two bits"),b=new j(b,d);var f=this.n,g=new e(a),i=b.r,k=b.s,l=1&c,m=c>>1;if(i.cmp(this.curve.p.umod(this.curve.n))>=0&&m)throw new Error("Unable to find sencond key candinate");i=m?this.curve.pointFromX(i.add(this.curve.n),l):this.curve.pointFromX(i,l);var n=f.sub(g),o=b.r.invm(f);return this.g.mulAdd(n,i,k).mul(o)},d.prototype.getKeyRecoveryParam=function(a,b,c,d){if(b=new j(b,d),null!==b.recoveryParam)return b.recoveryParam;for(var e=0;e<4;e++){var f;try{f=this.recoverPubKey(a,b,e)}catch(a){continue}if(f.eq(c))return e}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":47,"./key":55,"./signature":56,"bn.js":45}],55:[function(a,b,c){"use strict";function d(a,b){this.ec=a,this.priv=null,this.pub=null,b.priv&&this._importPrivate(b.priv,b.privEnc),b.pub&&this._importPublic(b.pub,b.pubEnc)}var e=a("bn.js");b.exports=d,d.fromPublic=function(a,b,c){return b instanceof d?b:new d(a,{pub:b,pubEnc:c})},d.fromPrivate=function(a,b,c){return b instanceof d?b:new d(a,{priv:b,privEnc:c})},d.prototype.validate=function(){var a=this.getPublic();return a.isInfinity()?{result:!1,reason:"Invalid public key"}:a.validate()?a.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},d.prototype.getPublic=function(a,b){return"string"==typeof a&&(b=a,a=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),b?this.pub.encode(b,a):this.pub},d.prototype.getPrivate=function(a){return"hex"===a?this.priv.toString(16,2):this.priv},d.prototype._importPrivate=function(a,b){this.priv=new e(a,b||16),this.priv=this.priv.umod(this.ec.curve.n)},d.prototype._importPublic=function(a,b){return a.x||a.y?void(this.pub=this.ec.curve.point(a.x,a.y)):void(this.pub=this.ec.curve.decodePoint(a,b))},d.prototype.derive=function(a){return a.mul(this.priv).getX()},d.prototype.sign=function(a,b,c){return this.ec.sign(a,this,b,c)},d.prototype.verify=function(a,b){return this.ec.verify(a,b,this)},d.prototype.inspect=function(){return""}},{"bn.js":45}],56:[function(a,b,c){"use strict";function d(a,b){return a instanceof d?a:void(this._importDER(a,b)||(l(a.r&&a.s,"Signature without r or s"),this.r=new i(a.r,16),this.s=new i(a.s,16),void 0===a.recoveryParam?this.recoveryParam=null:this.recoveryParam=a.recoveryParam))}function e(){this.place=0}function f(a,b){var c=a[b.place++];if(!(128&c))return c;for(var d=15&c,e=0,f=0,g=b.place;f>>3);for(a.push(128|c);--c;)a.push(b>>>(c<<3)&255);a.push(b)}var i=a("bn.js"),j=a("../../elliptic"),k=j.utils,l=k.assert;b.exports=d,d.prototype._importDER=function(a,b){a=k.toArray(a,b);var c=new e;if(48!==a[c.place++])return!1;var d=f(a,c);if(d+c.place!==a.length)return!1;if(2!==a[c.place++])return!1;var g=f(a,c),h=a.slice(c.place,g+c.place);if(c.place+=g,2!==a[c.place++])return!1;var j=f(a,c);if(a.length!==j+c.place)return!1;var l=a.slice(c.place,j+c.place);return 0===h[0]&&128&h[1]&&(h=h.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new i(h),this.s=new i(l),this.recoveryParam=null,!0},d.prototype.toDER=function(a){var b=this.r.toArray(),c=this.s.toArray();for(128&b[0]&&(b=[0].concat(b)),128&c[0]&&(c=[0].concat(c)),b=g(b),c=g(c);!(c[0]||128&c[1]);)c=c.slice(1);var d=[2];h(d,b.length),d=d.concat(b),d.push(2),h(d,c.length);var e=d.concat(c),f=[48];return h(f,e.length),f=f.concat(e),k.encode(f,a)}},{"../../elliptic":47,"bn.js":45}],57:[function(a,b,c){"use strict";function d(a){if(h("ed25519"===a,"only tested with ed25519 so far"),!(this instanceof d))return new d(a);var a=f.curves[a].curve;this.curve=a,this.g=a.g,this.g.precompute(a.n.bitLength()+1),this.pointClass=a.point().constructor,this.encodingLength=Math.ceil(a.n.bitLength()/8),this.hash=e.sha512}var e=a("hash.js"),f=a("../../elliptic"),g=f.utils,h=g.assert,i=g.parseBytes,j=a("./key"),k=a("./signature");b.exports=d,d.prototype.sign=function(a,b){a=i(a);var c=this.keyFromSecret(b),d=this.hashInt(c.messagePrefix(),a),e=this.g.mul(d),f=this.encodePoint(e),g=this.hashInt(f,c.pubBytes(),a).mul(c.priv()),h=d.add(g).umod(this.curve.n);return this.makeSignature({R:e,S:h,Rencoded:f})},d.prototype.verify=function(a,b,c){a=i(a),b=this.makeSignature(b);var d=this.keyFromPublic(c),e=this.hashInt(b.Rencoded(),d.pubBytes(),a),f=this.g.mul(b.S()),g=b.R().add(d.pub().mul(e));return g.eq(f)},d.prototype.hashInt=function(){for(var a=this.hash(),b=0;b=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(b,c,e)}var e=a("hash.js"),f=a("../elliptic"),g=f.utils,h=g.assert;b.exports=d,d.prototype._init=function(a,b,c){var d=a.concat(b).concat(c);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var e=0;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(a.concat(c||[])),this.reseed=1},d.prototype.generate=function(a,b,c,d){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof b&&(d=c,c=b,b=null),c&&(c=g.toArray(c,d),this._update(c));for(var e=[];e.length>8,g=255&e;f?c.push(f,g):c.push(g)}return c}function e(a){return 1===a.length?"0"+a:a}function f(a){for(var b="",c=0;c=0;){var f;if(e.isOdd()){var g=e.andln(d-1);f=g>(d>>1)-1?(d>>1)-g:g,e.isubn(f)}else f=0;c.push(f);for(var h=0!==e.cmpn(0)&&0===e.andln(d-1)?b+1:1,i=1;i0||b.cmpn(-e)>0;){var f=a.andln(3)+d&3,g=b.andln(3)+e&3;3===f&&(f=-1),3===g&&(g=-1);var h;if(0===(1&f))h=0;else{var i=a.andln(7)+d&7;h=3!==i&&5!==i||2!==g?f:-f}c[0].push(h);var j;if(0===(1&g))j=0;else{var i=b.andln(7)+e&7;j=3!==i&&5!==i||2!==f?g:-g}c[1].push(j),2*d===h+1&&(d=1-d),2*e===j+1&&(e=1-e),a.iushrn(1),b.iushrn(1)}return c}function i(a,b,c){var d="_"+b;a.prototype[b]=function(){return void 0!==this[d]?this[d]:this[d]=c.call(this)}}function j(a){return"string"==typeof a?l.toArray(a,"hex"):a}function k(a){return new m(a,"hex","le")}var l=c,m=a("bn.js");l.assert=function(a,b){if(!a)throw new Error(b||"Assertion failed")},l.toArray=d,l.zero2=e,l.toHex=f,l.encode=function(a,b){return"hex"===b?f(a):a},l.getNAF=g,l.getJSF=h,l.cachedProperty=i,l.parseBytes=j,l.intFromLE=k},{"bn.js":45}],63:[function(a,b,c){function d(a){this.rand=a}var e;if(b.exports=function(a){return e||(e=new d(null)),e.generate(a)},b.exports.Rand=d,d.prototype.generate=function(a){return this._rand(a)},"object"==typeof window)window.crypto&&window.crypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return window.crypto.getRandomValues(b),b}:window.msCrypto&&window.msCrypto.getRandomValues?d.prototype._rand=function(a){var b=new Uint8Array(a);return window.msCrypto.getRandomValues(b),b}:d.prototype._rand=function(){throw new Error("Not implemented yet")};else try{var f=a("crypto");d.prototype._rand=function(a){return f.randomBytes(a)}}catch(a){d.prototype._rand=function(a){for(var b=new Uint8Array(a),c=0;c=this._delta8){a=this.pending;var c=a.length%this._delta8;this.pending=a.slice(a.length-c,a.length),0===this.pending.length&&(this.pending=null),a=f.join32(a,0,a.length-c,this.endian);for(var d=0;d>>24&255,d[e++]=a>>>16&255,d[e++]=a>>>8&255,d[e++]=255&a}else{d[e++]=255&a,d[e++]=a>>>8&255,d[e++]=a>>>16&255,d[e++]=a>>>24&255,d[e++]=0,d[e++]=0,d[e++]=0,d[e++]=0;for(var f=8;fthis.blockSize&&(a=(new this.Hash).update(a).digest()),g(a.length<=this.blockSize);for(var b=a.length;b>>3}function o(a){return F(a,17)^F(a,19)^a>>>10}function p(a,b,c,d){return 0===a?i(b,c,d):1===a||3===a?k(b,c,d):2===a?j(b,c,d):void 0}function q(a,b,c,d,e,f){var g=a&c^~a&e;return g<0&&(g+=4294967296),g}function r(a,b,c,d,e,f){var g=b&d^~b&f;return g<0&&(g+=4294967296),g}function s(a,b,c,d,e,f){var g=a&c^a&e^c&e;return g<0&&(g+=4294967296),g}function t(a,b,c,d,e,f){var g=b&d^b&f^d&f;return g<0&&(g+=4294967296),g}function u(a,b){var c=K(a,b,28),d=K(b,a,2),e=K(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function v(a,b){var c=L(a,b,28),d=L(b,a,2),e=L(b,a,7),f=c^d^e;return f<0&&(f+=4294967296),f}function w(a,b){var c=K(a,b,14),d=K(a,b,18),e=K(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function x(a,b){var c=L(a,b,14),d=L(a,b,18),e=L(b,a,9),f=c^d^e;return f<0&&(f+=4294967296),f}function y(a,b){var c=K(a,b,1),d=K(a,b,8),e=M(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function z(a,b){var c=L(a,b,1),d=L(a,b,8),e=N(a,b,7),f=c^d^e;return f<0&&(f+=4294967296),f}function A(a,b){var c=K(a,b,19),d=K(b,a,29),e=M(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}function B(a,b){var c=L(a,b,19),d=L(b,a,29),e=N(a,b,6),f=c^d^e;return f<0&&(f+=4294967296),f}var C=a("../hash"),D=C.utils,E=D.assert,F=D.rotr32,G=D.rotl32,H=D.sum32,I=D.sum32_4,J=D.sum32_5,K=D.rotr64_hi,L=D.rotr64_lo,M=D.shr64_hi,N=D.shr64_lo,O=D.sum64,P=D.sum64_hi,Q=D.sum64_lo,R=D.sum64_4_hi,S=D.sum64_4_lo,T=D.sum64_5_hi,U=D.sum64_5_lo,V=C.common.BlockHash,W=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],X=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Y=[1518500249,1859775393,2400959708,3395469782];D.inherits(d,V),c.sha256=d,d.blockSize=512,d.outSize=256,d.hmacStrength=192,d.padLength=64,d.prototype._update=function(a,b){for(var c=this.W,d=0;d<16;d++)c[d]=a[b+d];for(;d>8,g=255&e;f?c.push(f,g):c.push(g)}else for(var d=0;d>>24|a>>>8&65280|a<<8&16711680|(255&a)<<24;return b>>>0}function g(a,b){for(var c="",d=0;d>>0}return f}function k(a,b){for(var c=new Array(4*a.length),d=0,e=0;d>>24,c[e+1]=f>>>16&255,c[e+2]=f>>>8&255,c[e+3]=255&f):(c[e+3]=f>>>24,c[e+2]=f>>>16&255,c[e+1]=f>>>8&255,c[e]=255&f)}return c}function l(a,b){return a>>>b|a<<32-b}function m(a,b){return a<>>32-b}function n(a,b){return a+b>>>0}function o(a,b,c){return a+b+c>>>0}function p(a,b,c,d){return a+b+c+d>>>0}function q(a,b,c,d,e){return a+b+c+d+e>>>0}function r(a,b){if(!a)throw new Error(b||"Assertion failed")}function s(a,b,c,d){var e=a[b],f=a[b+1],g=d+f>>>0,h=(g>>0,a[b+1]=g}function t(a,b,c,d){var e=b+d>>>0,f=(e>>0}function u(a,b,c,d){var e=b+d;return e>>>0}function v(a,b,c,d,e,f,g,h){var i=0,j=b;j=j+d>>>0,i+=j>>0,i+=j>>0,i+=j>>0}function w(a,b,c,d,e,f,g,h){var i=b+d+f+h;return i>>>0}function x(a,b,c,d,e,f,g,h,i,j){var k=0,l=b;l=l+d>>>0,k+=l>>0,k+=l>>0,k+=l>>0,k+=l>>0}function y(a,b,c,d,e,f,g,h,i,j){var k=b+d+f+h+j;return k>>>0}function z(a,b,c){var d=b<<32-c|a>>>c;return d>>>0}function A(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}function B(a,b,c){return a>>>c}function C(a,b,c){var d=a<<32-c|b>>>c;return d>>>0}var D=c,E=a("inherits");D.toArray=d,D.toHex=e,D.htonl=f,D.toHex32=g,D.zero2=h,D.zero8=i,D.join32=j,D.split32=k,D.rotr32=l,D.rotl32=m,D.sum32=n,D.sum32_3=o,D.sum32_4=p,D.sum32_5=q,D.assert=r,D.inherits=E,c.sum64=s,c.sum64_hi=t,c.sum64_lo=u,c.sum64_4_hi=v,c.sum64_4_lo=w,c.sum64_5_hi=x,c.sum64_5_lo=y,c.rotr64_hi=z,c.rotr64_lo=A,c.shr64_hi=B,c.shr64_lo=C},{inherits:205}],70:[function(a,b,c){b.exports={name:"elliptic",version:"6.3.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},keywords:["EC","Elliptic","curve","Cryptography"],author:{name:"Fedor Indutny",email:"fedor@indutny.com"},license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},gitHead:"c53f5cf3d832c0073eb4a4ed423a464cbce68f3e",_id:"elliptic@6.3.1",_shasum:"17781f2109ab0ec686b146bdcff5d2e8c6aeceda",_from:"elliptic@>=6.0.0 <7.0.0",_npmVersion:"3.8.6",_nodeVersion:"6.0.0",_npmUser:{name:"indutny",email:"fedor@indutny.com"},dist:{shasum:"17781f2109ab0ec686b146bdcff5d2e8c6aeceda",tarball:"https://registry.npmjs.org/elliptic/-/elliptic-6.3.1.tgz"},maintainers:[{name:"indutny",email:"fedor@indutny.com"}],_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/elliptic-6.3.1.tgz_1465921413402_0.5202967382501811"},directories:{},_resolved:"http://registry.npmjs.org/elliptic/-/elliptic-6.3.1.tgz"}},{}],71:[function(a,b,c){b.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],72:[function(a,b,c){var d=a("asn1.js"),e=d.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});c.RSAPrivateKey=e;var f=d.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});c.RSAPublicKey=f;var g=d.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(h),this.key("subjectPublicKey").bitstr())});c.PublicKey=g;var h=d.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),i=d.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(h),this.key("subjectPrivateKey").octstr())});c.PrivateKey=i;var j=d.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});c.EncryptedPrivateKey=j;var k=d.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});c.DSAPrivateKey=k,c.DSAparam=d.define("DSAparam",function(){this.int()});var l=d.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(m),this.key("publicKey").optional().explicit(1).bitstr())});c.ECPrivateKey=l;var m=d.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});c.signature=d.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"asn1.js":75}],73:[function(a,b,c){(function(c){var d=/Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m,e=/^-----BEGIN (.*) KEY-----\r?\n/m,f=/^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m,g=a("evp_bytestokey"),h=a("browserify-aes");b.exports=function(a,b){var i,j=a.toString(),k=j.match(d);if(k){var l="aes"+k[1],m=new c(k[2],"hex"),n=new c(k[3].replace(/\r?\n/g,""),"base64"),o=g(b,m.slice(0,8),parseInt(k[1],10)).key,p=[],q=h.createDecipheriv(l,o,m);p.push(q.update(n)),p.push(q.final()),i=c.concat(p)}else{var r=j.match(f);i=new c(r[2].replace(/\r?\n/g,""),"base64")}var s=j.match(e)[1]+" KEY";return{tag:s,data:i}}}).call(this,a("buffer").Buffer)},{"browserify-aes":92,buffer:8,evp_bytestokey:107}],74:[function(a,b,c){(function(c){function d(a){var b;"object"!=typeof a||c.isBuffer(a)||(b=a.passphrase,a=a.key),"string"==typeof a&&(a=new c(a));var d,g,i=h(a,b),j=i.tag,k=i.data;switch(j){case"PUBLIC KEY":switch(g=f.PublicKey.decode(k,"der"),d=g.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPublicKey.decode(g.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return g.subjectPrivateKey=g.subjectPublicKey,{type:"ec",data:g};case"1.2.840.10040.4.1":return g.algorithm.params.pub_key=f.DSAparam.decode(g.subjectPublicKey.data,"der"),{type:"dsa",data:g.algorithm.params};default:throw new Error("unknown key id "+d)}throw new Error("unknown key type "+j);case"ENCRYPTED PRIVATE KEY":k=f.EncryptedPrivateKey.decode(k,"der"),k=e(k,b);case"PRIVATE KEY":switch(g=f.PrivateKey.decode(k,"der"),d=g.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPrivateKey.decode(g.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:g.algorithm.curve,privateKey:f.ECPrivateKey.decode(g.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return g.algorithm.params.priv_key=f.DSAparam.decode(g.subjectPrivateKey,"der"),{type:"dsa",params:g.algorithm.params};default:throw new Error("unknown key id "+d)}throw new Error("unknown key type "+j);case"RSA PUBLIC KEY":return f.RSAPublicKey.decode(k,"der");case"RSA PRIVATE KEY":return f.RSAPrivateKey.decode(k,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:f.DSAPrivateKey.decode(k,"der")};case"EC PRIVATE KEY":return k=f.ECPrivateKey.decode(k,"der"),{curve:k.parameters.value,privateKey:k.privateKey};default:throw new Error("unknown key type "+j)}}function e(a,b){var d=a.algorithm.decrypt.kde.kdeparams.salt,e=parseInt(a.algorithm.decrypt.kde.kdeparams.iters.toString(),10),f=g[a.algorithm.decrypt.cipher.algo.join(".")],h=a.algorithm.decrypt.cipher.iv,k=a.subjectPrivateKey,l=parseInt(f.split("-")[1],10)/8,m=j.pbkdf2Sync(b,d,e,l),n=i.createDecipheriv(f,m,h),o=[];return o.push(n.update(k)),o.push(n.final()),c.concat(o)}var f=a("./asn1"),g=a("./aesid.json"),h=a("./fixProc"),i=a("browserify-aes"),j=a("pbkdf2");b.exports=d,d.signature=f.signature}).call(this,a("buffer").Buffer)},{"./aesid.json":71,"./asn1":72,"./fixProc":73,"browserify-aes":92,buffer:8,pbkdf2:157}],75:[function(a,b,c){var d=c;d.bignum=a("bn.js"),d.define=a("./asn1/api").define,d.base=a("./asn1/base"),d.constants=a("./asn1/constants"),d.decoders=a("./asn1/decoders"),d.encoders=a("./asn1/encoders")},{"./asn1/api":76,"./asn1/base":78,"./asn1/constants":82,"./asn1/decoders":84,"./asn1/encoders":87,"bn.js":45}],76:[function(a,b,c){function d(a,b){this.name=a,this.body=b,this.decoders={},this.encoders={}}var e=a("../asn1"),f=a("inherits"),g=c;g.define=function(a,b){return new d(a,b)},d.prototype._createNamed=function(b){var c;try{c=a("vm").runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(a){c=function(a){this._initNamed(a)}}return f(c,b),c.prototype._initNamed=function(a){b.call(this,a)},new c(this)},d.prototype._getDecoder=function(a){return a=a||"der",this.decoders.hasOwnProperty(a)||(this.decoders[a]=this._createNamed(e.decoders[a])),this.decoders[a]},d.prototype.decode=function(a,b,c){return this._getDecoder(b).decode(a,c)},d.prototype._getEncoder=function(a){return a=a||"der",this.encoders.hasOwnProperty(a)||(this.encoders[a]=this._createNamed(e.encoders[a])),this.encoders[a]},d.prototype.encode=function(a,b,c){return this._getEncoder(b).encode(a,c)}},{"../asn1":75,inherits:205,vm:225}],77:[function(a,b,c){function d(a,b){return g.call(this,b),h.isBuffer(a)?(this.base=a,this.offset=0,void(this.length=a.length)):void this.error("Input not Buffer")}function e(a,b){if(Array.isArray(a))this.length=0,this.value=a.map(function(a){return a instanceof e||(a=new e(a,b)),this.length+=a.length,a},this);else if("number"==typeof a){if(!(0<=a&&a<=255))return b.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if("string"==typeof a)this.value=a,this.length=h.byteLength(a);else{if(!h.isBuffer(a))return b.error("Unsupported type: "+typeof a);this.value=a,this.length=a.length}}var f=a("inherits"),g=a("../base").Reporter,h=a("buffer").Buffer;f(d,g),c.DecoderBuffer=d,d.prototype.save=function(){return{offset:this.offset,reporter:g.prototype.save.call(this)}},d.prototype.restore=function(a){var b=new d(this.base);return b.offset=a.offset,b.length=this.offset,this.offset=a.offset,g.prototype.restore.call(this,a.reporter),b},d.prototype.isEmpty=function(){return this.offset===this.length},d.prototype.readUInt8=function(a){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(a||"DecoderBuffer overrun")},d.prototype.skip=function(a,b){if(!(this.offset+a<=this.length))return this.error(b||"DecoderBuffer overrun");var c=new d(this.base);return c._reporterState=this._reporterState,c.offset=this.offset,c.length=this.offset+a,this.offset+=a,c},d.prototype.raw=function(a){return this.base.slice(a?a.offset:this.offset,this.length)},c.EncoderBuffer=e,e.prototype.join=function(a,b){return a||(a=new h(this.length)),b||(b=0),0===this.length?a:(Array.isArray(this.value)?this.value.forEach(function(c){c.join(a,b),b+=c.length}):("number"==typeof this.value?a[b]=this.value:"string"==typeof this.value?a.write(this.value,b):h.isBuffer(this.value)&&this.value.copy(a,b),b+=this.length),a)}},{"../base":78,buffer:8,inherits:205}],78:[function(a,b,c){var d=c;d.Reporter=a("./reporter").Reporter,d.DecoderBuffer=a("./buffer").DecoderBuffer,d.EncoderBuffer=a("./buffer").EncoderBuffer,d.Node=a("./node")},{"./buffer":77,"./node":79,"./reporter":80}],79:[function(a,b,c){function d(a,b){var c={};this._baseState=c,c.enc=a,c.parent=b||null,c.children=null,c.tag=null,c.args=null,c.reverseArgs=null,c.choice=null,c.optional=!1,c.any=!1,c.obj=!1,c.use=null,c.useDecoder=null,c.key=null,c.default=null,c.explicit=null,c.implicit=null,c.contains=null,c.parent||(c.children=[],this._wrap())}var e=a("../base").Reporter,f=a("../base").EncoderBuffer,g=a("../base").DecoderBuffer,h=a("minimalistic-assert"),i=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],j=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(i),k=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];b.exports=d;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];d.prototype.clone=function(){var a=this._baseState,b={};l.forEach(function(c){b[c]=a[c]});var c=new this.constructor(b.parent);return c._baseState=b,c},d.prototype._wrap=function(){var a=this._baseState;j.forEach(function(b){this[b]=function(){var c=new this.constructor(this);return a.children.push(c),c[b].apply(c,arguments)}},this)},d.prototype._init=function(a){var b=this._baseState;h(null===b.parent),a.call(this),b.children=b.children.filter(function(a){return a._baseState.parent===this},this),h.equal(b.children.length,1,"Root node can have only one child")},d.prototype._useArgs=function(a){var b=this._baseState,c=a.filter(function(a){return a instanceof this.constructor},this);a=a.filter(function(a){return!(a instanceof this.constructor)},this),0!==c.length&&(h(null===b.children),b.children=c,c.forEach(function(a){a._baseState.parent=this},this)),0!==a.length&&(h(null===b.args),b.args=a,b.reverseArgs=a.map(function(a){if("object"!=typeof a||a.constructor!==Object)return a;var b={};return Object.keys(a).forEach(function(c){c==(0|c)&&(c|=0);var d=a[c];b[d]=c}),b}))},k.forEach(function(a){d.prototype[a]=function(){var b=this._baseState;throw new Error(a+" not implemented for encoding: "+b.enc)}}),i.forEach(function(a){d.prototype[a]=function(){var b=this._baseState,c=Array.prototype.slice.call(arguments);return h(null===b.tag),b.tag=a,this._useArgs(c),this}}),d.prototype.use=function(a){var b=this._baseState;return h(null===b.use),b.use=a,this},d.prototype.optional=function(){var a=this._baseState;return a.optional=!0,this},d.prototype.def=function(a){var b=this._baseState;return h(null===b.default),b.default=a,b.optional=!0,this},d.prototype.explicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.explicit=a,this},d.prototype.implicit=function(a){var b=this._baseState;return h(null===b.explicit&&null===b.implicit),b.implicit=a,this},d.prototype.obj=function(){var a=this._baseState,b=Array.prototype.slice.call(arguments);return a.obj=!0,0!==b.length&&this._useArgs(b),this},d.prototype.key=function(a){var b=this._baseState;return h(null===b.key),b.key=a,this},d.prototype.any=function(){var a=this._baseState;return a.any=!0,this},d.prototype.choice=function(a){var b=this._baseState;return h(null===b.choice),b.choice=a,this._useArgs(Object.keys(a).map(function(b){return a[b]})),this},d.prototype.contains=function(a){var b=this._baseState;return h(null===b.use),b.contains=a,this},d.prototype._decode=function(a,b){var c=this._baseState;if(null===c.parent)return a.wrapResult(c.children[0]._decode(a,b));var d=c.default,e=!0,f=null;if(null!==c.key&&(f=a.enterKey(c.key)),c.optional){var h=null;if(null!==c.explicit?h=c.explicit:null!==c.implicit?h=c.implicit:null!==c.tag&&(h=c.tag),null!==h||c.any){if(e=this._peekTag(a,h,c.any),a.isError(e))return e}else{var i=a.save();try{null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),e=!0}catch(a){e=!1}a.restore(i)}}var j;if(c.obj&&e&&(j=a.enterObject()),e){if(null!==c.explicit){var k=this._decodeTag(a,c.explicit);if(a.isError(k))return k;a=k}var l=a.offset;if(null===c.use&&null===c.choice){if(c.any)var i=a.save();var m=this._decodeTag(a,null!==c.implicit?c.implicit:c.tag,c.any);if(a.isError(m))return m;c.any?d=a.raw(i):a=m}if(b&&b.track&&null!==c.tag&&b.track(a.path(),l,a.length,"tagged"),b&&b.track&&null!==c.tag&&b.track(a.path(),a.offset,a.length,"content"),d=c.any?d:null===c.choice?this._decodeGeneric(c.tag,a,b):this._decodeChoice(a,b),a.isError(d))return d;if(c.any||null!==c.choice||null===c.children||c.children.forEach(function(c){c._decode(a,b)}),c.contains&&("octstr"===c.tag||"bitstr"===c.tag)){var n=new g(d);d=this._getUse(c.contains,a._reporterState.obj)._decode(n,b)}}return c.obj&&e&&(d=a.leaveObject(j)),null===c.key||null===d&&e!==!0?null!==f&&a.exitKey(f):a.leaveKey(f,c.key,d),d},d.prototype._decodeGeneric=function(a,b,c){var d=this._baseState;return"seq"===a||"set"===a?null:"seqof"===a||"setof"===a?this._decodeList(b,a,d.args[0],c):/str$/.test(a)?this._decodeStr(b,a,c):"objid"===a&&d.args?this._decodeObjid(b,d.args[0],d.args[1],c):"objid"===a?this._decodeObjid(b,null,null,c):"gentime"===a||"utctime"===a?this._decodeTime(b,a,c):"null_"===a?this._decodeNull(b,c):"bool"===a?this._decodeBool(b,c):"int"===a||"enum"===a?this._decodeInt(b,d.args&&d.args[0],c):null!==d.use?this._getUse(d.use,b._reporterState.obj)._decode(b,c):b.error("unknown tag: "+a)},d.prototype._getUse=function(a,b){var c=this._baseState;return c.useDecoder=this._use(a,b),h(null===c.useDecoder._baseState.parent),c.useDecoder=c.useDecoder._baseState.children[0],c.implicit!==c.useDecoder._baseState.implicit&&(c.useDecoder=c.useDecoder.clone(),c.useDecoder._baseState.implicit=c.implicit),c.useDecoder},d.prototype._decodeChoice=function(a,b){var c=this._baseState,d=null,e=!1;return Object.keys(c.choice).some(function(f){var g=a.save(),h=c.choice[f];try{var i=h._decode(a,b);if(a.isError(i))return!1;d={type:f,value:i},e=!0}catch(b){return a.restore(g),!1}return!0},this),e?d:a.error("Choice not matched")},d.prototype._createEncoderBuffer=function(a){return new f(a,this.reporter)},d.prototype._encode=function(a,b,c){var d=this._baseState;if(null===d.default||d.default!==a){var e=this._encodeValue(a,b,c);if(void 0!==e&&!this._skipDefault(e,b,c))return e}},d.prototype._encodeValue=function(a,b,c){var d=this._baseState;if(null===d.parent)return d.children[0]._encode(a,b||new e);var f=null;if(this.reporter=b,d.optional&&void 0===a){if(null===d.default)return;a=d.default}var g=null,h=!1;if(d.any)f=this._createEncoderBuffer(a);else if(d.choice)f=this._encodeChoice(a,b);else if(d.contains)g=this._getUse(d.contains,c)._encode(a,b),h=!0;else if(d.children)g=d.children.map(function(c){if("null_"===c._baseState.tag)return c._encode(null,b,a);if(null===c._baseState.key)return b.error("Child should have a key");var d=b.enterKey(c._baseState.key);if("object"!=typeof a)return b.error("Child expected, but input is not object");var e=c._encode(a[c._baseState.key],b,a);return b.leaveKey(d),e},this).filter(function(a){return a}),g=this._createEncoderBuffer(g);else if("seqof"===d.tag||"setof"===d.tag){if(!d.args||1!==d.args.length)return b.error("Too many args for : "+d.tag);if(!Array.isArray(a))return b.error("seqof/setof, but data is not Array");var i=this.clone();i._baseState.implicit=null,g=this._createEncoderBuffer(a.map(function(c){var d=this._baseState;return this._getUse(d.args[0],a)._encode(c,b)},i))}else null!==d.use?f=this._getUse(d.use,c)._encode(a,b):(g=this._encodePrimitive(d.tag,a),h=!0);var f;if(!d.any&&null===d.choice){var j=null!==d.implicit?d.implicit:d.tag,k=null===d.implicit?"universal":"context";null===j?null===d.use&&b.error("Tag could be ommited only for .use()"):null===d.use&&(f=this._encodeComposite(j,h,k,g))}return null!==d.explicit&&(f=this._encodeComposite(d.explicit,!1,"context",f)),f},d.prototype._encodeChoice=function(a,b){var c=this._baseState,d=c.choice[a.type];return d||h(!1,a.type+" not found in "+JSON.stringify(Object.keys(c.choice))),d._encode(a.value,b)},d.prototype._encodePrimitive=function(a,b){var c=this._baseState;if(/str$/.test(a))return this._encodeStr(b,a);if("objid"===a&&c.args)return this._encodeObjid(b,c.reverseArgs[0],c.args[1]);if("objid"===a)return this._encodeObjid(b,null,null);if("gentime"===a||"utctime"===a)return this._encodeTime(b,a);if("null_"===a)return this._encodeNull();if("int"===a||"enum"===a)return this._encodeInt(b,c.args&&c.reverseArgs[0]);if("bool"===a)return this._encodeBool(b);throw new Error("Unsupported tag: "+a)},d.prototype._isNumstr=function(a){return/^[0-9 ]*$/.test(a)},d.prototype._isPrintstr=function(a){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(a)}},{"../base":78,"minimalistic-assert":89}],80:[function(a,b,c){function d(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}function e(a,b){this.path=a,this.rethrow(b)}var f=a("inherits");c.Reporter=d,d.prototype.isError=function(a){return a instanceof e},d.prototype.save=function(){var a=this._reporterState;return{obj:a.obj,pathLen:a.path.length}},d.prototype.restore=function(a){var b=this._reporterState;b.obj=a.obj,b.path=b.path.slice(0,a.pathLen)},d.prototype.enterKey=function(a){return this._reporterState.path.push(a)},d.prototype.exitKey=function(a){var b=this._reporterState;b.path=b.path.slice(0,a-1)},d.prototype.leaveKey=function(a,b,c){var d=this._reporterState;this.exitKey(a),null!==d.obj&&(d.obj[b]=c)},d.prototype.path=function(){return this._reporterState.path.join("/")},d.prototype.enterObject=function(){var a=this._reporterState,b=a.obj;return a.obj={},b},d.prototype.leaveObject=function(a){var b=this._reporterState,c=b.obj;return b.obj=a,c},d.prototype.error=function(a){var b,c=this._reporterState,d=a instanceof e;if(b=d?a:new e(c.path.map(function(a){return"["+JSON.stringify(a)+"]"}).join(""),a.message||a,a.stack),!c.options.partial)throw b;return d||c.errors.push(b),b},d.prototype.wrapResult=function(a){var b=this._reporterState;return b.options.partial?{result:this.isError(a)?null:a,errors:b.errors}:a},f(e,Error),e.prototype.rethrow=function(a){if(this.message=a+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(a){this.stack=a.stack}return this}},{inherits:205}],81:[function(a,b,c){var d=a("../constants");c.tagClass={0:"universal",1:"application",2:"context",3:"private"},c.tagClassByName=d._reverse(c.tagClass),c.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},c.tagByName=d._reverse(c.tag)},{"../constants":82}],82:[function(a,b,c){var d=c;d._reverse=function(a){var b={};return Object.keys(a).forEach(function(c){(0|c)==c&&(c=0|c);var d=a[c];b[d]=c}),b},d.der=a("./der")},{"./der":81}],83:[function(a,b,c){function d(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new e,this.tree._init(a.body)}function e(a){j.Node.call(this,"der",a)}function f(a,b){var c=a.readUInt8(b);if(a.isError(c))return c;var d=l.tagClass[c>>6],e=0===(32&c);if(31===(31&c)){var f=c;for(c=0;128===(128&f);){if(f=a.readUInt8(b),a.isError(f))return f;c<<=7,c|=127&f}}else c&=31;var g=l.tag[c];return{cls:d,primitive:e,tag:c,tagStr:g}}function g(a,b,c){var d=a.readUInt8(c);if(a.isError(d))return d;if(!b&&128===d)return null;if(0===(128&d))return d;var e=127&d;if(e>=4)return a.error("length octect is too long");d=0;for(var f=0;f=31?d.error("Multi-octet tag encoding unsupported"):(b||(e|=32),e|=l.tagClassByName[c||"universal"]<<6)}var h=a("inherits"),i=a("buffer").Buffer,j=a("../../asn1"),k=j.base,l=j.constants.der;b.exports=d,d.prototype.encode=function(a,b){return this.tree._encode(a,b).join()},h(e,k.Node),e.prototype._encodeComposite=function(a,b,c,d){var e=g(a,b,c,this.reporter);if(d.length<128){var f=new i(2);return f[0]=e,f[1]=d.length,this._createEncoderBuffer([f,d])}for(var h=1,j=d.length;j>=256;j>>=8)h++;var f=new i(2+h);f[0]=e,f[1]=128|h;for(var j=1+h,k=d.length;k>0;j--,k>>=8)f[j]=255&k;return this._createEncoderBuffer([f,d])},e.prototype._encodeStr=function(a,b){if("bitstr"===b)return this._createEncoderBuffer([0|a.unused,a.data]);if("bmpstr"===b){for(var c=new i(2*a.length),d=0;d=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d=128;f>>=7)e++}for(var g=new i(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!i.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new i(c)}if(i.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new i(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(a<128)return this._createEncoderBuffer(a);if(a<256)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new i(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e.default)return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e.default,b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;dh||a<0?(c=Math.abs(a)%h,a<0?h-c:c):a}function d(a){for(var b=0;b>>8^255&c^99,this.SBOX[e]=c,this.INV_SBOX[c]=e,f=a[e],g=a[f],h=a[g],d=257*a[c]^16843008*c,this.SUB_MIX[0][e]=d<<24|d>>>8,this.SUB_MIX[1][e]=d<<16|d>>>16,this.SUB_MIX[2][e]=d<<8|d>>>24,this.SUB_MIX[3][e]=d,d=16843009*h^65537*g^257*f^16843008*e,this.INV_SUB_MIX[0][c]=d<<24|d>>>8,this.INV_SUB_MIX[1][c]=d<<16|d>>>16,this.INV_SUB_MIX[2][c]=d<<8|d>>>24,this.INV_SUB_MIX[3][c]=d,0===e?e=i=1:(e=f^a[a[a[h^f]]],i^=a[a[i]]);return!0};var i=new e;g.blockSize=16,g.prototype.blockSize=g.blockSize,g.keySize=32,g.prototype.keySize=g.keySize,g.prototype._doReset=function(){var a,b,c,d,e,f;for(c=this._key,b=c.length,this._nRounds=b+6,e=4*(this._nRounds+1),this._keySchedule=[],d=0;d>>24,f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f],f^=i.RCON[d/b|0]<<24):b>6&&d%b===4?f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f]:void 0,this._keySchedule[d-b]^f);for(this._invKeySchedule=[],a=0;a>>24]]^i.INV_SUB_MIX[1][i.SBOX[f>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[f>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&f]];return!0},g.prototype.encryptBlock=function(b){b=f(new a(b));var c=this._doCryptBlock(b,this._keySchedule,i.SUB_MIX,i.SBOX),d=new a(16);return d.writeUInt32BE(c[0],0),d.writeUInt32BE(c[1],4),d.writeUInt32BE(c[2],8),d.writeUInt32BE(c[3],12),d},g.prototype.decryptBlock=function(b){b=f(new a(b));var c=[b[3],b[1]];b[1]=c[0],b[3]=c[1];var d=this._doCryptBlock(b,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX),e=new a(16);return e.writeUInt32BE(d[0],0),e.writeUInt32BE(d[3],4),e.writeUInt32BE(d[2],8),e.writeUInt32BE(d[1],12),e},g.prototype.scrub=function(){d(this._keySchedule),d(this._invKeySchedule),d(this._key)},g.prototype._doCryptBlock=function(a,c,d,e){var f,g,h,i,j,k,l,m,n;g=a[0]^c[0],h=a[1]^c[1],i=a[2]^c[2],j=a[3]^c[3],f=4;for(var o=1;o>>24]^d[1][h>>>16&255]^d[2][i>>>8&255]^d[3][255&j]^c[f++],l=d[0][h>>>24]^d[1][i>>>16&255]^d[2][j>>>8&255]^d[3][255&g]^c[f++],m=d[0][i>>>24]^d[1][j>>>16&255]^d[2][g>>>8&255]^d[3][255&h]^c[f++],n=d[0][j>>>24]^d[1][g>>>16&255]^d[2][h>>>8&255]^d[3][255&i]^c[f++],g=k,h=l,i=m,j=n;return k=(e[g>>>24]<<24|e[h>>>16&255]<<16|e[i>>>8&255]<<8|e[255&j])^c[f++],l=(e[h>>>24]<<24|e[i>>>16&255]<<16|e[j>>>8&255]<<8|e[255&g])^c[f++],m=(e[i>>>24]<<24|e[j>>>16&255]<<16|e[g>>>8&255]<<8|e[255&h])^c[f++],n=(e[j>>>24]<<24|e[g>>>16&255]<<16|e[h>>>8&255]<<8|e[255&i])^c[f++],[b(k),b(l),b(m),b(n)]},c.AES=g}).call(this,a("buffer").Buffer)},{buffer:8}],91:[function(a,b,c){(function(c){function d(a,b,e,h){if(!(this instanceof d))return new d(a,b,e);g.call(this),this._finID=c.concat([e,new c([0,0,0,1])]),e=c.concat([e,new c([0,0,0,2])]),this._cipher=new f.AES(b),this._prev=new c(e.length),this._cache=new c(""),this._secCache=new c(""),this._decrypt=h,this._alen=0,this._len=0,e.copy(this._prev),this._mode=a;var j=new c(4);j.fill(0),this._ghash=new i(this._cipher.encryptBlock(j)),this._authTag=null,this._called=!1}function e(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=-1;++e16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache};var p={ECB:a("./modes/ecb"),CBC:a("./modes/cbc"),CFB:a("./modes/cfb"),CFB8:a("./modes/cfb8"),CFB1:a("./modes/cfb1"),OFB:a("./modes/ofb"),CTR:a("./modes/ctr"),GCM:a("./modes/ctr")};c.createDecipher=h,c.createDecipheriv=g}).call(this,a("buffer").Buffer)},{"./aes":90,"./authCipher":91,"./modes":96,"./modes/cbc":97,"./modes/cfb":98,"./modes/cfb1":99,"./modes/cfb8":100,"./modes/ctr":101,"./modes/ecb":102,"./modes/ofb":103,"./streamCipher":106,buffer:8,"cipher-base":105,evp_bytestokey:107,inherits:205}],94:[function(a,b,c){(function(b){function d(a,c,f){return this instanceof d?(i.call(this),this._cache=new e,this._cipher=new h.AES(c),this._prev=new b(f.length),f.copy(this._prev),this._mode=a,void(this._autopadding=!0)):new d(a,c,f)}function e(){return this instanceof e?void(this.cache=new b("")):new e}function f(a,c,e){var f=k[a.toLowerCase()];if(!f)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=new b(e)),"string"==typeof c&&(c=new b(c)),c.length!==f.key/8)throw new TypeError("invalid key length "+c.length);if(e.length!==f.iv)throw new TypeError("invalid iv length "+e.length);return"stream"===f.type?new m(o[f.mode],c,e):"auth"===f.type?new n(o[f.mode],c,e):new d(o[f.mode],c,e)}function g(a,b){var c=k[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=l(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./aes"),i=a("cipher-base"),j=a("inherits"),k=a("./modes"),l=a("evp_bytestokey"),m=a("./streamCipher"),n=a("./authCipher");j(d,i),d.prototype._update=function(a){this._cache.add(a);for(var c,d,e=[];c=this._cache.get();)d=this._mode.encrypt(this,c),e.push(d);return b.concat(e)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if("10101010101010101010101010101010"!==a.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=b.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,c=new b(a),d=-1;++di||a<0?(c=Math.abs(a)%i,a<0?i-c:c):a}function g(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}var h=new a(16);h.fill(0),b.exports=c,c.prototype.ghash=function(a){for(var b=-1;++b0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(h)},c.prototype.update=function(b){this.cache=a.concat([this.cache,b]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},c.prototype.final=function(b,c){return this.cache.length&&this.ghash(a.concat([this.cache,h],16)),this.ghash(e([0,b,0,c])),this.state};var i=Math.pow(2,32)}).call(this,a("buffer").Buffer)},{buffer:8}],96:[function(a,b,c){arguments[4][20][0].apply(c,arguments)},{dup:20}],97:[function(a,b,c){arguments[4][21][0].apply(c,arguments)},{"buffer-xor":104,dup:21}],98:[function(a,b,c){(function(b){function d(a,c,d){var f=c.length,g=e(c,a._cache);return a._cache=a._cache.slice(f),a._prev=b.concat([a._prev,d?c:g]),g}var e=a("buffer-xor");c.encrypt=function(a,c,e){for(var f,g=new b("");c.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=new b("")),!(a._cache.length<=c.length)){g=b.concat([g,d(a,c,e)]);break}f=a._cache.length,g=b.concat([g,d(a,c.slice(0,f),e)]),c=c.slice(f)}return g}}).call(this,a("buffer").Buffer)},{buffer:8,"buffer-xor":104}],99:[function(a,b,c){(function(a){function b(a,b,c){for(var e,f,g,h=-1,i=8,j=0;++h>h%8,a._prev=d(a._prev,c?f:g);return j}function d(b,c){var d=b.length,e=-1,f=new a(b.length);for(b=a.concat([b,new a([c])]);++e>7;return f}c.encrypt=function(c,d,e){for(var f=d.length,g=new a(f),h=-1;++h0&&n.push(g),n.push(a),b&&n.push(b),g=e(c.concat(n)),n=[],h=0,d>0)for(;;){if(0===d)break;if(h===g.length)break;k[i++]=g[h],d--,h++}if(f>0&&h!==g.length)for(;;){if(0===f)break;if(h===g.length)break;l[j++]=g[h],f--,h++}if(0===d&&0===f)break}for(h=0;h0&&c.ishrn(d),c}function j(a,b){a=i(a,b),a=a.mod(b);var d=new c(a.toArray());if(d.length=b)throw new Error("invalid sig")}var h=a("./curves"),i=a("elliptic"),j=a("parse-asn1"),k=a("bn.js"),l=i.ec;b.exports=d}).call(this,a("buffer").Buffer)},{"./curves":44,"bn.js":45,buffer:8,elliptic:47,"parse-asn1":74}],110:[function(a,b,c){(function(c){function d(a){this.curveType=h[a],this.curveType||(this.curveType={name:a}),this.curve=new f.ec(this.curveType.name),this.keys=void 0}function e(a,b,d){Array.isArray(a)||(a=a.toArray());var e=new c(a);if(d&&e.length>5]|=128<>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,k=271733878,l=0;l>16)+(b>>16)+(c>>16);return d<<16|65535&c}function k(a,b){return a<>>32-b}var l=a("./helpers");b.exports=function(a){return l.hash(a,d,16); -}},{"./helpers":137}],139:[function(a,b,c){(function(c){function d(a){e.call(this),this.hashMode="string"==typeof a,this.hashMode?this[a]=this._finalOrDigest:this.final=this._finalOrDigest,this._decoder=null,this._encoding=null}var e=a("stream").Transform,f=a("inherits"),g=a("string_decoder").StringDecoder;b.exports=d,f(d,e),d.prototype.update=function(a,b,d){"string"==typeof a&&(a=new c(a,b));var e=this._update(a);return this.hashMode?this:(d&&(e=this._toString(e,d)),e)},d.prototype.setAutoPadding=function(){},d.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},d.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},d.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},d.prototype._transform=function(a,b,c){var d;try{this.hashMode?this._update(a):this.push(this._update(a))}catch(a){d=a}finally{c(d)}},d.prototype._flush=function(a){var b;try{this.push(this._final())}catch(a){b=a}finally{a(b)}},d.prototype._finalOrDigest=function(a){var b=this._final()||new c("");return a&&(b=this._toString(b,a,!0)),b},d.prototype._toString=function(a,b,c){if(this._decoder||(this._decoder=new g(b),this._encoding=b),this._encoding!==b)throw new Error("can't switch encodings");var d=this._decoder.write(a);return c&&(d+=this._decoder.end()),d}}).call(this,a("buffer").Buffer)},{buffer:8,inherits:205,stream:220,string_decoder:221}],140:[function(a,b,c){(function(a){function c(a){for(var b=[],c=0,d=0;c>>5]|=a[c]<<24-d%32;return b}function d(a){for(var b=[],c=0;c<32*a.length;c+=8)b.push(a[c>>>5]>>>24-c%32&255);return b}function e(a,b,c){for(var d=0;d<16;d++){var e=c+d,l=b[e];b[e]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}var s,t,u,v,w,x,y,z,A,B;x=s=a[0],y=t=a[1],z=u=a[2],A=v=a[3],B=w=a[4];var C;for(d=0;d<80;d+=1)C=s+b[c+m[d]]|0,C+=d<16?f(t,u,v)+q[0]:d<32?g(t,u,v)+q[1]:d<48?h(t,u,v)+q[2]:d<64?i(t,u,v)+q[3]:j(t,u,v)+q[4],C=0|C,C=k(C,o[d]),C=C+w|0,s=w,w=v,v=k(u,10),u=t,t=C,C=x+b[c+n[d]]|0,C+=d<16?j(y,z,A)+r[0]:d<32?i(y,z,A)+r[1]:d<48?h(y,z,A)+r[2]:d<64?g(y,z,A)+r[3]:f(y,z,A)+r[4],C=0|C,C=k(C,p[d]),C=C+B|0,x=B,B=A,A=k(z,10),z=y,y=C;C=a[1]+u+A|0,a[1]=a[2]+v+B|0,a[2]=a[3]+w+x|0,a[3]=a[4]+s+y|0,a[4]=a[0]+t+z|0,a[0]=C}function f(a,b,c){return a^b^c}function g(a,b,c){return a&b|~a&c}function h(a,b,c){return(a|~b)^c}function i(a,b,c){return a&c|b&~c}function j(a,b,c){return a^(b|~c)}function k(a,b){return a<>>32-b}function l(b){var f=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof b&&(b=new a(b,"utf8"));var g=c(b),h=8*b.length,i=8*b.length;g[h>>>5]|=128<<24-h%32,g[(h+64>>>9<<4)+14]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);for(var j=0;j>>24)|4278255360&(k<<24|k>>>8)}var l=d(f);return new a(l)}var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],n=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],o=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],q=[0,1518500249,1859775393,2400959708,2840853838],r=[1352829926,1548603684,1836072691,2053994217,0];b.exports=l}).call(this,a("buffer").Buffer)},{buffer:8}],141:[function(a,b,c){(function(a){function c(b,c){this._block=new a(b),this._finalSize=c,this._blockSize=b,this._len=0,this._s=0}c.prototype.update=function(b,c){"string"==typeof b&&(c=c||"utf8",b=new a(b,c));for(var d=this._len+=b.length,e=this._s||0,f=0,g=this._block;e=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(b,this._blockSize-4);var c=this._update(this._block)||this._hash();return a?c.toString(a):c},c.prototype._update=function(){throw new Error("_update must be implemented by subclass")},b.exports=c}).call(this,a("buffer").Buffer)},{buffer:8}],142:[function(a,b,c){var c=b.exports=function(a){a=a.toLowerCase();var b=c[a];if(!b)throw new Error(a+" is not supported (we accept pull requests)");return new b};c.sha=a("./sha"),c.sha1=a("./sha1"),c.sha224=a("./sha224"),c.sha256=a("./sha256"),c.sha384=a("./sha384"),c.sha512=a("./sha512")},{"./sha":143,"./sha1":144,"./sha224":145,"./sha256":146,"./sha384":147,"./sha512":148}],143:[function(a,b,c){(function(c){function d(){this.init(),this._w=k,i.call(this,64,56)}function e(a){return a<<5|a>>>27}function f(a){return a<<30|a>>>2}function g(a,b,c,d){return 0===a?b&c|~b&d:2===a?b&c|b&d|c&d:b^c^d}var h=a("inherits"),i=a("./hash"),j=[1518500249,1859775393,-1894007588,-899497514],k=new Array(80);h(d,i),d.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,h=0|this._c,i=0|this._d,k=0|this._e,l=0;l<16;++l)b[l]=a.readInt32BE(4*l);for(;l<80;++l)b[l]=b[l-3]^b[l-8]^b[l-14]^b[l-16];for(var m=0;m<80;++m){var n=~~(m/20),o=e(c)+g(n,d,h,i)+k+b[m]+j[n]|0;k=i,i=h,h=f(d),d=c,c=o}this._a=c+this._a|0,this._b=d+this._b|0,this._c=h+this._c|0,this._d=i+this._d|0,this._e=k+this._e|0},d.prototype._hash=function(){var a=new c(20);return a.writeInt32BE(0|this._a,0),a.writeInt32BE(0|this._b,4),a.writeInt32BE(0|this._c,8),a.writeInt32BE(0|this._d,12),a.writeInt32BE(0|this._e,16),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],144:[function(a,b,c){(function(c){function d(){this.init(),this._w=l,j.call(this,64,56)}function e(a){return a<<1|a>>>31}function f(a){return a<<5|a>>>27}function g(a){return a<<30|a>>>2}function h(a,b,c,d){return 0===a?b&c|~b&d:2===a?b&c|b&d|c&d:b^c^d}var i=a("inherits"),j=a("./hash"),k=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);i(d,j),d.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,i=0|this._c,j=0|this._d,l=0|this._e,m=0;m<16;++m)b[m]=a.readInt32BE(4*m);for(;m<80;++m)b[m]=e(b[m-3]^b[m-8]^b[m-14]^b[m-16]);for(var n=0;n<80;++n){var o=~~(n/20),p=f(c)+h(o,d,i,j)+l+b[n]+k[o]|0;l=j,j=i,i=g(d),d=c,c=p}this._a=c+this._a|0,this._b=d+this._b|0,this._c=i+this._c|0,this._d=j+this._d|0,this._e=l+this._e|0},d.prototype._hash=function(){var a=new c(20);return a.writeInt32BE(0|this._a,0),a.writeInt32BE(0|this._b,4),a.writeInt32BE(0|this._c,8),a.writeInt32BE(0|this._d,12),a.writeInt32BE(0|this._e,16),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],145:[function(a,b,c){(function(c){function d(){this.init(),this._w=h,g.call(this,64,56)}var e=a("inherits"),f=a("./sha256"),g=a("./hash"),h=new Array(64);e(d,f),d.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},d.prototype._hash=function(){var a=new c(28);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,"./sha256":146,buffer:8,inherits:205}],146:[function(a,b,c){(function(c){function d(){this.init(),this._w=n,l.call(this,64,56)}function e(a,b,c){return c^a&(b^c)}function f(a,b,c){return a&b|c&(a|b)}function g(a){return(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10)}function h(a){return(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7)}function i(a){return(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3}function j(a){return(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10}var k=a("inherits"),l=a("./hash"),m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=new Array(64);k(d,l),d.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,k=0|this._c,l=0|this._d,n=0|this._e,o=0|this._f,p=0|this._g,q=0|this._h,r=0;r<16;++r)b[r]=a.readInt32BE(4*r);for(;r<64;++r)b[r]=j(b[r-2])+b[r-7]+i(b[r-15])+b[r-16]|0;for(var s=0;s<64;++s){var t=q+h(n)+e(n,o,p)+m[s]+b[s]|0,u=g(c)+f(c,d,k)|0;q=p,p=o,o=n,n=l+t|0,l=k,k=d,d=c,c=t+u|0}this._a=c+this._a|0,this._b=d+this._b|0,this._c=k+this._c|0,this._d=l+this._d|0,this._e=n+this._e|0,this._f=o+this._f|0,this._g=p+this._g|0,this._h=q+this._h|0},d.prototype._hash=function(){var a=new c(32);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a.writeInt32BE(this._h,28),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],147:[function(a,b,c){(function(c){function d(){this.init(),this._w=h,g.call(this,128,112)}var e=a("inherits"),f=a("./sha512"),g=a("./hash"),h=new Array(160);e(d,f),d.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},d.prototype._hash=function(){function a(a,c,d){b.writeInt32BE(a,d),b.writeInt32BE(c,d+4)}var b=new c(48);return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),b},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,"./sha512":148,buffer:8,inherits:205}],148:[function(a,b,c){(function(c){function d(){this.init(),this._w=q,o.call(this,128,112)}function e(a,b,c){return c^a&(b^c)}function f(a,b,c){return a&b|c&(a|b)}function g(a,b){return(a>>>28|b<<4)^(b>>>2|a<<30)^(b>>>7|a<<25)}function h(a,b){return(a>>>14|b<<18)^(a>>>18|b<<14)^(b>>>9|a<<23)}function i(a,b){return(a>>>1|b<<31)^(a>>>8|b<<24)^a>>>7}function j(a,b){return(a>>>1|b<<31)^(a>>>8|b<<24)^(a>>>7|b<<25)}function k(a,b){return(a>>>19|b<<13)^(b>>>29|a<<3)^a>>>6}function l(a,b){return(a>>>19|b<<13)^(b>>>29|a<<3)^(a>>>6|b<<26)}function m(a,b){return a>>>0>>0?1:0}var n=a("inherits"),o=a("./hash"),p=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],q=new Array(160);n(d,o),d.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._ah,d=0|this._bh,n=0|this._ch,o=0|this._dh,q=0|this._eh,r=0|this._fh,s=0|this._gh,t=0|this._hh,u=0|this._al,v=0|this._bl,w=0|this._cl,x=0|this._dl,y=0|this._el,z=0|this._fl,A=0|this._gl,B=0|this._hl,C=0;C<32;C+=2)b[C]=a.readInt32BE(4*C),b[C+1]=a.readInt32BE(4*C+4);for(;C<160;C+=2){var D=b[C-30],E=b[C-30+1],F=i(D,E),G=j(E,D);D=b[C-4],E=b[C-4+1];var H=k(D,E),I=l(E,D),J=b[C-14],K=b[C-14+1],L=b[C-32],M=b[C-32+1],N=G+K|0,O=F+J+m(N,G)|0;N=N+I|0,O=O+H+m(N,I)|0,N=N+M|0,O=O+L+m(N,M)|0,b[C]=O,b[C+1]=N}for(var P=0;P<160;P+=2){O=b[P],N=b[P+1];var Q=f(c,d,n),R=f(u,v,w),S=g(c,u),T=g(u,c),U=h(q,y),V=h(y,q),W=p[P],X=p[P+1],Y=e(q,r,s),Z=e(y,z,A),$=B+V|0,_=t+U+m($,B)|0;$=$+Z|0,_=_+Y+m($,Z)|0,$=$+X|0,_=_+W+m($,X)|0,$=$+N|0,_=_+O+m($,N)|0;var aa=T+R|0,ba=S+Q+m(aa,T)|0;t=s,B=A,s=r,A=z,r=q,z=y,y=x+$|0,q=o+_+m(y,x)|0,o=n,x=w,n=d,w=v,d=c,v=u,u=$+aa|0,c=_+ba+m(u,$)|0}this._al=this._al+u|0,this._bl=this._bl+v|0,this._cl=this._cl+w|0,this._dl=this._dl+x|0,this._el=this._el+y|0,this._fl=this._fl+z|0,this._gl=this._gl+A|0,this._hl=this._hl+B|0,this._ah=this._ah+c+m(this._al,u)|0,this._bh=this._bh+d+m(this._bl,v)|0,this._ch=this._ch+n+m(this._cl,w)|0,this._dh=this._dh+o+m(this._dl,x)|0,this._eh=this._eh+q+m(this._el,y)|0,this._fh=this._fh+r+m(this._fl,z)|0,this._gh=this._gh+s+m(this._gl,A)|0,this._hh=this._hh+t+m(this._hl,B)|0},d.prototype._hash=function(){function a(a,c,d){b.writeInt32BE(a,d),b.writeInt32BE(c,d+4)}var b=new c(64);return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56),b},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],149:[function(a,b,c){(function(c){"use strict";function d(a,b){g.call(this),a=a.toLowerCase(),"string"==typeof b&&(b=new c(b));var d="sha512"===a||"sha384"===a?128:64;this._alg=a,this._key=b,b.length>d?b=e(a).update(b).digest():b.lengtha;)c.ishrn(1);if(c.isEven()&&c.iadd(m),c.testn(1)||c.iadd(n),b.cmp(n)){if(!b.cmp(o))for(;c.mod(p).cmp(q);)c.iadd(s)}else for(;c.mod(j).cmp(r);)c.iadd(s);if(d=c.shrn(1),e(d)&&e(c)&&f(d)&&f(c)&&l.test(d)&&l.test(c))return c}}var h=a("randombytes");b.exports=g,g.simpleSieve=e,g.fermatTest=f;var i=a("bn.js"),j=new i(24),k=a("miller-rabin"),l=new k,m=new i(1),n=new i(2),o=new i(5),p=(new i(16),new i(8),new i(10)),q=new i(3),r=(new i(7),new i(11)),s=new i(4),t=(new i(12),null)},{"bn.js":154,"miller-rabin":155,randombytes:203}],153:[function(a,b,c){b.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],154:[function(a,b,c){arguments[4][45][0].apply(c,arguments)},{dup:45}],155:[function(a,b,c){function d(a){this.rand=a||new f.Rand}var e=a("bn.js"),f=a("brorand");b.exports=d,d.create=function(a){return new d(a)},d.prototype._rand=function(a){var b=a.bitLength(),c=this.rand.generate(Math.ceil(b/8));c[0]|=3;var d=7&b;return 0!==d&&(c[c.length-1]>>=7-d),new e(c)},d.prototype.test=function(a,b,c){var d=a.bitLength(),f=e.mont(a),g=new e(1).toRed(f);b||(b=Math.max(1,d/48|0));for(var h=a.subn(1),i=h.subn(1),j=0;!h.testn(j);j++);for(var k=a.shrn(j),l=h.toRed(f),m=!0;b>0;b--){var n=this._rand(i);c&&c(n);var o=n.toRed(f).redPow(k);if(0!==o.cmp(g)&&0!==o.cmp(l)){for(var p=1;p0;b--){var l=this._rand(h),m=a.gcd(l);if(0!==m.cmpn(1))return m;var n=l.toRed(d).redPow(j);if(0!==n.cmp(f)&&0!==n.cmp(k)){for(var o=1;og)throw new TypeError("Bad key length");h=h||"sha1",b.isBuffer(a)||(a=new b(a,"binary")),b.isBuffer(c)||(c=new b(c,"binary"));var i,j=1,k=new b(e),l=new b(c.length+4);c.copy(l,0,0,c.length);for(var m,n,o=1;o<=j;o++){l.writeUInt32BE(o,c.length);var p=f(h,a).update(l).digest();i||(i=p.length,n=new b(i),j=Math.ceil(e/i),m=e-(j-1)*i),p.copy(n,0,0,i);for(var q=1;q=0||!c.umod(a.prime1)||!c.umod(a.prime2);)c=new g(h(b));return c}var g=a("bn.js"),h=a("randombytes");b.exports=e,e.getr=f}).call(this,a("buffer").Buffer)},{"bn.js":160,buffer:8,randombytes:203}],162:[function(a,b,c){arguments[4][71][0].apply(c,arguments)},{dup:71}],163:[function(a,b,c){arguments[4][72][0].apply(c,arguments)},{"asn1.js":166,dup:72}],164:[function(a,b,c){(function(c){var d=/Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m,e=/^-----BEGIN (.*) KEY-----\r?\n/m,f=/^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m,g=a("evp_bytestokey"),h=a("browserify-aes");b.exports=function(a,b){var i,j=a.toString(),k=j.match(d);if(k){var l="aes"+k[1],m=new c(k[2],"hex"),n=new c(k[3].replace(/\r?\n/g,""),"base64"),o=g(b,m.slice(0,8),parseInt(k[1],10)).key,p=[],q=h.createDecipheriv(l,o,m); -p.push(q.update(n)),p.push(q.final()),i=c.concat(p)}else{var r=j.match(f);i=new c(r[2].replace(/\r?\n/g,""),"base64")}var s=j.match(e)[1]+" KEY";return{tag:s,data:i}}}).call(this,a("buffer").Buffer)},{"browserify-aes":183,buffer:8,evp_bytestokey:198}],165:[function(a,b,c){(function(c){function d(a){var b;"object"!=typeof a||c.isBuffer(a)||(b=a.passphrase,a=a.key),"string"==typeof a&&(a=new c(a));var d,g,i=h(a,b),j=i.tag,k=i.data;switch(j){case"PUBLIC KEY":switch(g=f.PublicKey.decode(k,"der"),d=g.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPublicKey.decode(g.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return g.subjectPrivateKey=g.subjectPublicKey,{type:"ec",data:g};case"1.2.840.10040.4.1":return g.algorithm.params.pub_key=f.DSAparam.decode(g.subjectPublicKey.data,"der"),{type:"dsa",data:g.algorithm.params};default:throw new Error("unknown key id "+d)}throw new Error("unknown key type "+j);case"ENCRYPTED PRIVATE KEY":k=f.EncryptedPrivateKey.decode(k,"der"),k=e(k,b);case"PRIVATE KEY":switch(g=f.PrivateKey.decode(k,"der"),d=g.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return f.RSAPrivateKey.decode(g.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:g.algorithm.curve,privateKey:f.ECPrivateKey.decode(g.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return g.algorithm.params.priv_key=f.DSAparam.decode(g.subjectPrivateKey,"der"),{type:"dsa",params:g.algorithm.params};default:throw new Error("unknown key id "+d)}throw new Error("unknown key type "+j);case"RSA PUBLIC KEY":return f.RSAPublicKey.decode(k,"der");case"RSA PRIVATE KEY":return f.RSAPrivateKey.decode(k,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:f.DSAPrivateKey.decode(k,"der")};case"EC PRIVATE KEY":return k=f.ECPrivateKey.decode(k,"der"),{curve:k.parameters.value,privateKey:k.privateKey};default:throw new Error("unknown key type "+j)}}function e(a,b){var d=a.algorithm.decrypt.kde.kdeparams.salt,e=parseInt(a.algorithm.decrypt.kde.kdeparams.iters.toString(),10),f=g[a.algorithm.decrypt.cipher.algo.join(".")],h=a.algorithm.decrypt.cipher.iv,k=a.subjectPrivateKey,l=parseInt(f.split("-")[1],10)/8,m=j.pbkdf2Sync(b,d,e,l),n=i.createDecipheriv(f,m,h),o=[];return o.push(n.update(k)),o.push(n.final()),c.concat(o)}var f=a("./asn1"),g=a("./aesid.json"),h=a("./fixProc"),i=a("browserify-aes"),j=a("pbkdf2");b.exports=d,d.signature=f.signature}).call(this,a("buffer").Buffer)},{"./aesid.json":162,"./asn1":163,"./fixProc":164,"browserify-aes":183,buffer:8,pbkdf2:157}],166:[function(a,b,c){arguments[4][75][0].apply(c,arguments)},{"./asn1/api":167,"./asn1/base":169,"./asn1/constants":173,"./asn1/decoders":175,"./asn1/encoders":178,"bn.js":160,dup:75}],167:[function(a,b,c){arguments[4][76][0].apply(c,arguments)},{"../asn1":166,dup:76,inherits:205,vm:225}],168:[function(a,b,c){arguments[4][77][0].apply(c,arguments)},{"../base":169,buffer:8,dup:77,inherits:205}],169:[function(a,b,c){arguments[4][78][0].apply(c,arguments)},{"./buffer":168,"./node":170,"./reporter":171,dup:78}],170:[function(a,b,c){arguments[4][79][0].apply(c,arguments)},{"../base":169,dup:79,"minimalistic-assert":180}],171:[function(a,b,c){arguments[4][80][0].apply(c,arguments)},{dup:80,inherits:205}],172:[function(a,b,c){arguments[4][81][0].apply(c,arguments)},{"../constants":173,dup:81}],173:[function(a,b,c){arguments[4][82][0].apply(c,arguments)},{"./der":172,dup:82}],174:[function(a,b,c){arguments[4][83][0].apply(c,arguments)},{"../../asn1":166,dup:83,inherits:205}],175:[function(a,b,c){arguments[4][84][0].apply(c,arguments)},{"./der":174,"./pem":176,dup:84}],176:[function(a,b,c){arguments[4][85][0].apply(c,arguments)},{"./der":174,buffer:8,dup:85,inherits:205}],177:[function(a,b,c){arguments[4][86][0].apply(c,arguments)},{"../../asn1":166,buffer:8,dup:86,inherits:205}],178:[function(a,b,c){arguments[4][87][0].apply(c,arguments)},{"./der":177,"./pem":179,dup:87}],179:[function(a,b,c){arguments[4][88][0].apply(c,arguments)},{"./der":177,dup:88,inherits:205}],180:[function(a,b,c){arguments[4][40][0].apply(c,arguments)},{dup:40}],181:[function(a,b,c){(function(a){function b(a){var b,c;return b=a>h||a<0?(c=Math.abs(a)%h,a<0?h-c:c):a}function d(a){for(var b=0;b>>8^255&c^99,this.SBOX[e]=c,this.INV_SBOX[c]=e,f=a[e],g=a[f],h=a[g],d=257*a[c]^16843008*c,this.SUB_MIX[0][e]=d<<24|d>>>8,this.SUB_MIX[1][e]=d<<16|d>>>16,this.SUB_MIX[2][e]=d<<8|d>>>24,this.SUB_MIX[3][e]=d,d=16843009*h^65537*g^257*f^16843008*e,this.INV_SUB_MIX[0][c]=d<<24|d>>>8,this.INV_SUB_MIX[1][c]=d<<16|d>>>16,this.INV_SUB_MIX[2][c]=d<<8|d>>>24,this.INV_SUB_MIX[3][c]=d,0===e?e=i=1:(e=f^a[a[a[h^f]]],i^=a[a[i]]);return!0};var i=new e;g.blockSize=16,g.prototype.blockSize=g.blockSize,g.keySize=32,g.prototype.keySize=g.keySize,g.prototype._doReset=function(){var a,b,c,d,e,f;for(c=this._key,b=c.length,this._nRounds=b+6,e=4*(this._nRounds+1),this._keySchedule=[],d=0;d>>24,f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f],f^=i.RCON[d/b|0]<<24):b>6&&d%b===4?f=i.SBOX[f>>>24]<<24|i.SBOX[f>>>16&255]<<16|i.SBOX[f>>>8&255]<<8|i.SBOX[255&f]:void 0,this._keySchedule[d-b]^f);for(this._invKeySchedule=[],a=0;a>>24]]^i.INV_SUB_MIX[1][i.SBOX[f>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[f>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[255&f]];return!0},g.prototype.encryptBlock=function(b){b=f(new a(b));var c=this._doCryptBlock(b,this._keySchedule,i.SUB_MIX,i.SBOX),d=new a(16);return d.writeUInt32BE(c[0],0),d.writeUInt32BE(c[1],4),d.writeUInt32BE(c[2],8),d.writeUInt32BE(c[3],12),d},g.prototype.decryptBlock=function(b){b=f(new a(b));var c=[b[3],b[1]];b[1]=c[0],b[3]=c[1];var d=this._doCryptBlock(b,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX),e=new a(16);return e.writeUInt32BE(d[0],0),e.writeUInt32BE(d[3],4),e.writeUInt32BE(d[2],8),e.writeUInt32BE(d[1],12),e},g.prototype.scrub=function(){d(this._keySchedule),d(this._invKeySchedule),d(this._key)},g.prototype._doCryptBlock=function(a,c,d,e){var f,g,h,i,j,k,l,m,n;g=a[0]^c[0],h=a[1]^c[1],i=a[2]^c[2],j=a[3]^c[3],f=4;for(var o=1;o>>24]^d[1][h>>>16&255]^d[2][i>>>8&255]^d[3][255&j]^c[f++],l=d[0][h>>>24]^d[1][i>>>16&255]^d[2][j>>>8&255]^d[3][255&g]^c[f++],m=d[0][i>>>24]^d[1][j>>>16&255]^d[2][g>>>8&255]^d[3][255&h]^c[f++],n=d[0][j>>>24]^d[1][g>>>16&255]^d[2][h>>>8&255]^d[3][255&i]^c[f++],g=k,h=l,i=m,j=n;return k=(e[g>>>24]<<24|e[h>>>16&255]<<16|e[i>>>8&255]<<8|e[255&j])^c[f++],l=(e[h>>>24]<<24|e[i>>>16&255]<<16|e[j>>>8&255]<<8|e[255&g])^c[f++],m=(e[i>>>24]<<24|e[j>>>16&255]<<16|e[g>>>8&255]<<8|e[255&h])^c[f++],n=(e[j>>>24]<<24|e[g>>>16&255]<<16|e[h>>>8&255]<<8|e[255&i])^c[f++],[b(k),b(l),b(m),b(n)]},c.AES=g}).call(this,a("buffer").Buffer)},{buffer:8}],182:[function(a,b,c){(function(c){function d(a,b,e,h){if(!(this instanceof d))return new d(a,b,e);g.call(this),this._finID=c.concat([e,new c([0,0,0,1])]),e=c.concat([e,new c([0,0,0,2])]),this._cipher=new f.AES(b),this._prev=new c(e.length),this._cache=new c(""),this._secCache=new c(""),this._decrypt=h,this._alen=0,this._len=0,e.copy(this._prev),this._mode=a;var j=new c(4);j.fill(0),this._ghash=new i(this._cipher.encryptBlock(j)),this._authTag=null,this._called=!1}function e(a,b){var c=0;a.length!==b.length&&c++;for(var d=Math.min(a.length,b.length),e=-1;++e16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b}else if(this.cache.length>=16)return b=this.cache.slice(0,16),this.cache=this.cache.slice(16),b;return null},e.prototype.flush=function(){if(this.cache.length)return this.cache};var p={ECB:a("./modes/ecb"),CBC:a("./modes/cbc"),CFB:a("./modes/cfb"),CFB8:a("./modes/cfb8"),CFB1:a("./modes/cfb1"),OFB:a("./modes/ofb"),CTR:a("./modes/ctr"),GCM:a("./modes/ctr")};c.createDecipher=h,c.createDecipheriv=g}).call(this,a("buffer").Buffer)},{"./aes":181,"./authCipher":182,"./modes":187,"./modes/cbc":188,"./modes/cfb":189,"./modes/cfb1":190,"./modes/cfb8":191,"./modes/ctr":192,"./modes/ecb":193,"./modes/ofb":194,"./streamCipher":197,buffer:8,"cipher-base":196,evp_bytestokey:198,inherits:205}],185:[function(a,b,c){(function(b){function d(a,c,f){return this instanceof d?(i.call(this),this._cache=new e,this._cipher=new h.AES(c),this._prev=new b(f.length),f.copy(this._prev),this._mode=a,void(this._autopadding=!0)):new d(a,c,f)}function e(){return this instanceof e?void(this.cache=new b("")):new e}function f(a,c,e){var f=k[a.toLowerCase()];if(!f)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=new b(e)),"string"==typeof c&&(c=new b(c)),c.length!==f.key/8)throw new TypeError("invalid key length "+c.length);if(e.length!==f.iv)throw new TypeError("invalid iv length "+e.length);return"stream"===f.type?new m(o[f.mode],c,e):"auth"===f.type?new n(o[f.mode],c,e):new d(o[f.mode],c,e)}function g(a,b){var c=k[a.toLowerCase()];if(!c)throw new TypeError("invalid suite type");var d=l(b,!1,c.key,c.iv);return f(a,d.key,d.iv)}var h=a("./aes"),i=a("cipher-base"),j=a("inherits"),k=a("./modes"),l=a("evp_bytestokey"),m=a("./streamCipher"),n=a("./authCipher");j(d,i),d.prototype._update=function(a){this._cache.add(a);for(var c,d,e=[];c=this._cache.get();)d=this._mode.encrypt(this,c),e.push(d);return b.concat(e)},d.prototype._final=function(){var a=this._cache.flush();if(this._autopadding)return a=this._mode.encrypt(this,a),this._cipher.scrub(),a;if("10101010101010101010101010101010"!==a.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},d.prototype.setAutoPadding=function(a){return this._autopadding=!!a,this},e.prototype.add=function(a){this.cache=b.concat([this.cache,a])},e.prototype.get=function(){if(this.cache.length>15){var a=this.cache.slice(0,16);return this.cache=this.cache.slice(16),a}return null},e.prototype.flush=function(){for(var a=16-this.cache.length,c=new b(a),d=-1;++di||a<0?(c=Math.abs(a)%i,a<0?i-c:c):a}function g(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]}var h=new a(16);h.fill(0),b.exports=c,c.prototype.ghash=function(a){for(var b=-1;++b0;a--)f[a]=f[a]>>>1|(1&f[a-1])<<31;f[0]=f[0]>>>1,c&&(f[0]=f[0]^225<<24)}this.state=e(h)},c.prototype.update=function(b){this.cache=a.concat([this.cache,b]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},c.prototype.final=function(b,c){return this.cache.length&&this.ghash(a.concat([this.cache,h],16)),this.ghash(e([0,b,0,c])),this.state};var i=Math.pow(2,32)}).call(this,a("buffer").Buffer)},{buffer:8}],187:[function(a,b,c){arguments[4][20][0].apply(c,arguments)},{dup:20}],188:[function(a,b,c){arguments[4][21][0].apply(c,arguments)},{"buffer-xor":195,dup:21}],189:[function(a,b,c){(function(b){function d(a,c,d){var f=c.length,g=e(c,a._cache);return a._cache=a._cache.slice(f),a._prev=b.concat([a._prev,d?c:g]),g}var e=a("buffer-xor");c.encrypt=function(a,c,e){for(var f,g=new b("");c.length;){if(0===a._cache.length&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=new b("")),!(a._cache.length<=c.length)){g=b.concat([g,d(a,c,e)]);break}f=a._cache.length,g=b.concat([g,d(a,c.slice(0,f),e)]),c=c.slice(f)}return g}}).call(this,a("buffer").Buffer)},{buffer:8,"buffer-xor":195}],190:[function(a,b,c){(function(a){function b(a,b,c){for(var e,f,g,h=-1,i=8,j=0;++h>h%8,a._prev=d(a._prev,c?f:g);return j}function d(b,c){var d=b.length,e=-1,f=new a(b.length);for(b=a.concat([b,new a([c])]);++e>7;return f}c.encrypt=function(c,d,e){for(var f=d.length,g=new a(f),h=-1;++h0&&n.push(g),n.push(a),b&&n.push(b),g=e(c.concat(n)),n=[],h=0,d>0)for(;;){if(0===d)break;if(h===g.length)break;k[i++]=g[h],d--,h++}if(f>0&&h!==g.length)for(;;){if(0===f)break;if(h===g.length)break;l[j++]=g[h],f--,h++}if(0===d&&0===f)break}for(h=0;h=b.length){f++;break}var g=b.slice(2,e-1);b.slice(e-1,e);if(("0002"!==d.toString("hex")&&!c||"0001"!==d.toString("hex")&&c)&&f++,g.length<8&&f++,f)throw new Error("decryption error");return b.slice(e)}function f(a,b){a=new c(a),b=new c(b);var d=0,e=a.length;a.length!==b.length&&(d++,e=Math.min(a.length,b.length));for(var f=-1;++fl||new j(b).cmp(i.modulus)>=0)throw new Error("decryption error");var n;n=f?m(new j(b),i):k(b,i);var o=new c(l-n.length);if(o.fill(0),n=c.concat([o,n],l),4===h)return d(i,n);if(1===h)return e(i,n,f);if(3===h)return n;throw new Error("unknown padding")}}).call(this,a("buffer").Buffer)},{"./mgf":159,"./withPublic":201,"./xor":202,"bn.js":160,"browserify-rsa":161,buffer:8,"create-hash":136,"parse-asn1":165}],200:[function(a,b,c){(function(c){function d(a,b){var d=a.modulus.byteLength(),e=b.length,f=i("sha1").update(new c("")).digest(),g=f.length,m=2*g;if(e>d-m-2)throw new Error("message too long");var n=new c(d-e-m-2);n.fill(0);var o=d-g-1,p=h(g),q=k(c.concat([f,n,new c([1]),b],o),j(p,o)),r=k(p,j(q,g));return new l(c.concat([new c([0]),r,q],d))}function e(a,b,d){var e=b.length,g=a.modulus.byteLength();if(e>g-11)throw new Error("message too long");var h;return d?(h=new c(g-e-3),h.fill(255)):h=f(g-e-3),new l(c.concat([new c([0,d?1:2]),h,new c([0]),b],g))}function f(a,b){for(var d,e=new c(a),f=0,g=h(2*a),i=0;f=0)throw new Error("data too long for modulus")}return c?n(h,i):m(h,i)}}).call(this,a("buffer").Buffer)},{"./mgf":159,"./withPublic":201,"./xor":202,"bn.js":160,"browserify-rsa":161,buffer:8,"create-hash":136,"parse-asn1":165,randombytes:203}],201:[function(a,b,c){(function(c){function d(a,b){return new c(a.toRed(e.mont(b.modulus)).redPow(new e(b.publicExponent)).fromRed().toArray())}var e=a("bn.js");b.exports=d}).call(this,a("buffer").Buffer)},{"bn.js":160,buffer:8}],202:[function(a,b,c){b.exports=function(a,b){for(var c=a.length,d=-1;++d65536)throw new Error("requested too many random bytes");var f=new c.Uint8Array(b);b>0&&g.getRandomValues(f);var h=new d(f.buffer);return"function"==typeof e?a.nextTick(function(){e(null,h)}):h}var g=c.crypto||c.msCrypto;g&&g.getRandomValues?b.exports=f:b.exports=e}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{_process:208,buffer:8}],204:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;i0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],205:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],206:[function(a,b,c){b.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],207:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],208:[function(a,b,c){function d(){m&&k&&(m=!1,k.length?l=k.concat(l):n=-1,l.length&&e())}function e(){if(!m){var a=h(d);m=!0;for(var b=l.length;b;){for(k=l,l=[];++n1)for(var c=1;c0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event"); -a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length=E)a=E;else{a--;for(var b=1;b<32;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:isNaN(a)||B.isNull(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:a<=0?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||B.isString(b)||B.isNullOrUndefined(b)||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(D("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?c.nextTick(function(){m(a)}):m(a))}function m(a){D("emit readable"),a.emit("readable"),s(a)}function n(a,b){b.readingMore||(b.readingMore=!0,c.nextTick(function(){o(a,b)}))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=e)c=f?d.join(""):y.concat(d,e),d.length=0;else if(a0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,c.nextTick(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function v(a,b){for(var c=0,d=a.length;c0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return D("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?u(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&u(this),null;var d=b.needReadable;D("need readable",d),(0===b.length||b.length-a0?t(a,b):null,B.isNull(e)&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&u(this),B.isNull(e)||this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){D("onunpipe"),a===l&&f()}function e(){D("onend"),a.end()}function f(){D("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){D("ondata");var c=a.write(b);!1===c&&(D("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){D("onerror",b),k(),a.removeListener("error",h),0===z.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){D("onfinish"),a.removeListener("close",i),k()}function k(){D("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];break;default:m.pipes.push(a)}m.pipesCount+=1,D("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?c.nextTick(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?x(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(D("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e1){for(var c=[],d=0;d=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:8}],222:[function(a,b,c){function d(a,b){this._id=a,this._clearFn=b}var e=a("process/browser.js").nextTick,f=Function.prototype.apply,g=Array.prototype.slice,h={},i=0;c.setTimeout=function(){return new d(f.call(setTimeout,window,arguments),clearTimeout)},c.setInterval=function(){return new d(f.call(setInterval,window,arguments),clearInterval)},c.clearTimeout=c.clearInterval=function(a){a.close()},d.prototype.unref=d.prototype.ref=function(){},d.prototype.close=function(){this._clearFn.call(window,this._id)},c.enroll=function(a,b){clearTimeout(a._idleTimeoutId),a._idleTimeout=b},c.unenroll=function(a){clearTimeout(a._idleTimeoutId),a._idleTimeout=-1},c._unrefActive=c.active=function(a){clearTimeout(a._idleTimeoutId);var b=a._idleTimeout;b>=0&&(a._idleTimeoutId=setTimeout(function(){a._onTimeout&&a._onTimeout()},b))},c.setImmediate="function"==typeof setImmediate?setImmediate:function(a){var b=i++,d=!(arguments.length<2)&&g.call(arguments,1);return h[b]=!0,e(function(){h[b]&&(d?a.apply(null,d):a.call(null),c.clearImmediate(b))}),b},c.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(a){delete h[a]}},{"process/browser.js":208}],223:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],224:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(d<0)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;g-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return a<10?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),h=d[c];c=0&&(this.availableSaslMechanisms=this.availableSaslMechanisms.splice(b,1))},b.exports=d}).call(this,"/node_modules\\node-xmpp-client\\lib")},{"./authentication/anonymous":229,"./authentication/digestmd5":230,"./authentication/external":231,"./authentication/plain":233,"./authentication/xoauth2":234,"./sasl":236,"./session":237,buffer:8,child_process:5,debug:239,"node-xmpp-core":245,path:7}],229:[function(a,b,c){"use strict";function d(){}var e=a("./mechanism"),f=a("node-xmpp-core").inherits;f(d,e),d.prototype.name="ANONYMOUS",d.prototype.auth=function(){return this.authzid},d.prototype.match=function(){return!0},b.exports=d},{"./mechanism":232,"node-xmpp-core":245}],230:[function(a,b,c){"use strict";function d(a,b){var c=m.createHash?m.createHash("md5"):new n;return c.update(a,"binary").digest(b||"binary")}function e(a){return d(a,"hex")}function f(a){for(var b={};a;){var c;(c=/^(.+?)=(.*?[^\\]),\s*(.*)/.exec(a))?(b[c[1]]=c[2].replace(/"/g,""),a=c[3]):(c=/^(.+?)=(.+?),\s*(.*)/.exec(a))?(b[c[1]]=c[2],a=c[3]):(c=/^(.+?)="(.*?[^\\])"$/.exec(a))?(b[c[1]]=c[2],a=c[3]):(c=/^(.+?)=(.+?)$/.exec(a))?(b[c[1]]=c[2],a=c[3]):a=null}return b}function g(a){var b="";for(var c in a){var d=a[c];d&&(b+=","+c+'="'+d+'"')}return b.substr(1)}function h(a,b,c){for(;a.length0?(b.emit("connect"),b.processResponse(d),c.nextTick(b.mayRequest.bind(b))):b.emit("error","Invalid parameters"))})}var e=a("events").EventEmitter,f=a("node-xmpp-core"),g=f.inherits,h=f.ltx,i=a("request"),j=a("debug")("xmpp:client:bosh");g(d,e),d.prototype.contentType="text/xml; charset=utf-8",d.prototype.send=function(a){this.queue.push(a.root()),c.nextTick(this.mayRequest.bind(this))},d.prototype.startStream=function(){var a=this;this.rid++,this.request({to:this.jid.domain,"xmpp:restart":"true"},[],function(b,d){b?(a.emit("error",b),a.emit("disconnect"),a.emit("end"),delete a.sid,a.emit("close")):(a.streamOpened=!0,d&&a.processResponse(d),c.nextTick(a.mayRequest.bind(a)))})},d.prototype.processResponse=function(a){if(j("process bosh server response "+a.toString()),a&&a.children)for(var b=0;b0&&this.currentRequests=400)return c(new Error("HTTP status "+g.statusCode));var j;try{j=h.parse(i)}catch(a){return c(a)}j&&"terminate"===j.attrs.type&&j.attrs.condition?c(new Error(j.attrs.condition)):j?c(null,j):c(new Error("no "))}),this.currentRequests++},b.exports=d}).call(this,a("_process"))},{_process:208,debug:239,events:204,"node-xmpp-core":245,request:5}],236:[function(a,b,c){"use strict";function d(a,b,c){var d,e=[],f={};return Array.isArray(c)&&(e=e.concat(c)),e.forEach(function(a){f[a.prototype.name]=a}),f[b]&&a.indexOf(b)>=0&&(d=f[b]),e.forEach(function(b){!d&&a.indexOf(b.prototype.name)>=0&&(d=b)}),d?new d:null}function e(a,b){var c=b||[],d=[];return c.forEach(function(b){var c=b.prototype.match;c(a)&&d.push(b)}),d}var f=a("./authentication/mechanism");c.selectMechanism=d,c.detectMechanisms=e,c.AbstractMechanism=f},{"./authentication/mechanism":232}],237:[function(a,b,c){(function(c){"use strict";function d(a){f.call(this),this.setOptions(a),a.websocket&&a.websocket.url?(n("start websocket connection"),this._setupWebsocketConnection(a)):a.bosh&&a.bosh.url?(n("start bosh connection"),this._setupBoshConnection(a)):(n("start socket connection"),this._setupSocketConnection(a))}var e=a("tls"),f=a("events").EventEmitter,g=a("node-xmpp-core"),h=g.inherits,i=g.Connection,j=g.JID,k=g.SRV,l=a("./bosh"),m=a("./websockets"),n=a("debug")("xmpp:client:session");h(d,f),d.prototype._setupSocketConnection=function(a){var b={xmlns:{"":a.xmlns},streamAttrs:{version:"1.0",to:this.jid.domain},serialized:a.serialized};for(var c in a)c in b||(b[c]=a[c]);if(this.connection=new i(b),this._addConnectionListeners(),a.host)this._socketConnectionToHost(a);else{if(!k)throw new Error("Cannot load SRV");this._performSrvLookup(a)}},d.prototype._socketConnectionToHost=function(a){var b=this;a.legacySSL?(this.connection.allowTLS=!1,this.connection.connect({socket:function(){return e.connect(a.port||5223,a.host,a.credentials||{},function(){this.socket.authorized?b.emit("connect",this.socket):b.emit("error","unauthorized")}.bind(this))}})):(a.credentials&&(this.connection.credentials=e.createSecureContext(a.credentials)),a.disallowTLS&&(this.connection.allowTLS=!1),this.connection.listen({socket:function(){c.nextTick(function(){this.socket.connect(a.port||5222,a.host)}.bind(this));var b=a.socket;return a.socket=null,b}}))},d.prototype._performSrvLookup=function(a){if(a.legacySSL)throw new Error("LegacySSL mode does not support DNS lookups");a.credentials&&(this.connection.credentials=e.createSecureContext(a.credentials)),a.disallowTLS&&(this.connection.allowTLS=!1),this.connection.listen({socket:k.connect({socket:a.socket,services:["_xmpp-client._tcp"],domain:this.jid.domain,defaultPort:5222})})},d.prototype._setupBoshConnection=function(a){this.connection=new l({jid:this.jid,bosh:a.bosh}),this._addConnectionListeners(),this.connection.on("connected",function(){this.connection.startStream&&this.connection.startStream()}.bind(this))},d.prototype._setupWebsocketConnection=function(a){this.connection=new m({jid:this.jid,websocket:a.websocket}),this._addConnectionListeners(),this.connection.on("connected",function(){this.connection.startStream&&this.connection.startStream()}.bind(this))},d.prototype.setOptions=function(a){this.jid="string"==typeof a.jid?new j(a.jid):a.jid,this.password=a.password,this.preferredSaslMechanism=a.preferredSaslMechanism,this.api_key=a.api_key,this.access_token=a.access_token,this.oauth2_token=a.oauth2_token,this.oauth2_auth=a.oauth2_auth,this.register=a.register,"string"==typeof a.actAs?this.actAs=new j(a.actAs):this.actAs=a.actAs},d.prototype._addConnectionListeners=function(a){a=a||this.connection,a.on("stanza",this.onStanza.bind(this)),a.on("drain",this.emit.bind(this,"drain")),a.on("end",this.emit.bind(this,"end")),a.on("close",this.emit.bind(this,"close")),a.on("error",this.emit.bind(this,"error")),a.on("connect",this.emit.bind(this,"connect")),a.on("reconnect",this.emit.bind(this,"reconnect")),a.on("disconnect",this.emit.bind(this,"disconnect")),a.startStream&&(a.on("connect",function(){a.startStream()}),this.on("auth",function(){a.startStream()}))},d.prototype.pause=function(){this.connection&&this.connection.pause&&this.connection.pause()},d.prototype.resume=function(){this.connection&&this.connection.resume&&this.connection.resume()},d.prototype.send=function(a){return!!this.connection&&this.connection.send(a)},d.prototype.end=function(){this.connection&&this.connection.end()},d.prototype.onStanza=function(){},b.exports=d}).call(this,a("_process"))},{"./bosh":235,"./websockets":238,_process:208,debug:239,events:204,"node-xmpp-core":245,tls:5}],238:[function(a,b,c){"use strict";function d(a){e.call(this),this.url=a.websocket.url,this.jid=a.jid,this.xmlns={"":n},this.websocket=new l(this.url,["xmpp"]),this.websocket.onopen=this.onopen.bind(this),this.websocket.onmessage=this.onmessage.bind(this),this.websocket.onclose=this.onclose.bind(this),this.websocket.onerror=this.onerror.bind(this)}var e=a("events").EventEmitter,f=a("node-xmpp-core"),g=f.Element,h=f.StreamParser,i=f.Connection,j=f.inherits,k=a("ws"),l=k.Server?k:window.WebSocket,m=a("debug")("xmpp:client:websocket"),n="urn:ietf:params:xml:ns:xmpp-framing";j(d,e),d.prototype.maxStanzaSize=65535,d.prototype.xmppVersion="1.0",d.prototype.onopen=function(){this.startParser(),this.emit("connected")},d.prototype.startParser=function(){var a=this;this.parser=new h.StreamParser(this.maxStanzaSize),this.parser.on("start",function(b){a.streamAttrs=b,a.streamNsAttrs={};for(var c in b)"xmlns"!==c&&"xmlns:"!==c.substr(0,6)||(a.streamNsAttrs[c]=b[c]);a.emit("streamStart",b)}),this.parser.on("stanza",function(b){a.onStanza(b)}),this.parser.on("error",this.onerror.bind(this)),this.parser.on("end",function(){a.stopParser(),a.end()})},d.prototype.stopParser=function(){this.parser&&delete this.parser},d.prototype.onmessage=function(a){m("ws msg <--",a.data),a&&a.data&&this.parser&&this.parser.write(a.data)},d.prototype.onStanza=function(a){a.is("error",i.NS_STREAM)?this.emit("error",a):this.emit("stanza",a)},d.prototype.startStream=function(){var a={};for(var b in this.xmlns)this.xmlns.hasOwnProperty(b)&&(b?a["xmlns:"+b]=this.xmlns[b]:a.xmlns=this.xmlns[b]);this.xmppVersion&&(a.version=this.xmppVersion),this.streamTo&&(a.to=this.streamTo),this.jid&&(a.to=this.jid.domain),this.send(new g("open",a)),this.streamOpened=!0},d.prototype.send=function(a){a.root&&(a=a.root()),!a.attrs.xmlns&&(a.is("iq")||a.is("presence")||a.is("message"))&&(a.attrs.xmlns="jabber:client"),a=a.toString(),m("ws send -->",a),this.websocket.send(a)},d.prototype.onclose=function(){this.emit("disconnect"),this.emit("close")},d.prototype.end=function(){this.send(new g("close",{xmlns:n})),this.emit("disconnect"),this.emit("end"),this.websocket&&this.websocket.close()},d.prototype.onerror=function(a){this.emit("error",a)},b.exports=d},{debug:239,events:204,"node-xmpp-core":245,ws:7}],239:[function(a,b,c){function d(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function e(){var a=arguments,b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+c.humanize(this.diff),!b)return a;var d="color: "+this.color;a=[a[0],d,"color: inherit"].concat(Array.prototype.slice.call(a,1));var e=0,f=0;return a[0].replace(/%[a-z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,d),a}function f(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function g(a){try{null==a?c.storage.removeItem("debug"):c.storage.debug=a}catch(a){}}function h(){var a;try{a=c.storage.debug}catch(a){}return a}function i(){try{return window.localStorage}catch(a){}}c=b.exports=a("./debug"),c.log=f,c.formatArgs=e,c.save=g,c.load=h,c.useColors=d,c.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),c.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],c.formatters.j=function(a){return JSON.stringify(a)},c.enable(h())},{"./debug":240}],240:[function(a,b,c){function d(){return c.colors[k++%c.colors.length]}function e(a){function b(){}function e(){var a=e,b=+new Date,f=b-(j||b);a.diff=f,a.prev=j,a.curr=b,j=b,null==a.useColors&&(a.useColors=c.useColors()),null==a.color&&a.useColors&&(a.color=d());var g=Array.prototype.slice.call(arguments);g[0]=c.coerce(g[0]),"string"!=typeof g[0]&&(g=["%o"].concat(g));var h=0;g[0]=g[0].replace(/%([a-z%])/g,function(b,d){if("%%"===b)return b;h++;var e=c.formatters[d];if("function"==typeof e){var f=g[h];b=e.call(a,f),g.splice(h,1),h--}return b}),"function"==typeof c.formatArgs&&(g=c.formatArgs.apply(a,g));var i=e.log||c.log||console.log.bind(console);i.apply(a,g)}b.enabled=!1,e.enabled=!0;var f=c.enabled(a)?e:b;return f.namespace=a,f}function f(a){c.save(a);for(var b=(a||"").split(/[\s,]+/),d=b.length,e=0;e1e4)){var b=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a);if(b){var c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*l;case"days":case"day":case"d":return c*k;case"hours":case"hour":case"hrs":case"hr":case"h":return c*j;case"minutes":case"minute":case"mins":case"min":case"m":return c*i;case"seconds":case"second":case"secs":case"sec":case"s":return c*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c}}}}function e(a){return a>=k?Math.round(a/k)+"d":a>=j?Math.round(a/j)+"h":a>=i?Math.round(a/i)+"m":a>=h?Math.round(a/h)+"s":a+"ms"}function f(a){return g(a,k,"day")||g(a,j,"hour")||g(a,i,"minute")||g(a,h,"second")||a+" ms"}function g(a,b,c){if(!(a>>32-b}function f(a,b,c,d,f,g,h){return e(a+(b&c|~b&d)+f+g|0,h)+b|0}function g(a,b,c,d,f,g,h){return e(a+(b&d|c&~d)+f+g|0,h)+b|0}function h(a,b,c,d,f,g,h){return e(a+(b^c^d)+f+g|0,h)+b|0}function i(a,b,c,d,f,g,h){return e(a+(c^(b|~d))+f+g|0,h)+b|0}var j=a("inherits"),k=a("hash-base"),l=new Array(16);j(d,k),d.prototype._update=function(){for(var a=l,b=0;b<16;++b)a[b]=this._block.readInt32LE(4*b);var c=this._a,d=this._b,e=this._c,j=this._d;c=f(c,d,e,j,a[0],3614090360,7),j=f(j,c,d,e,a[1],3905402710,12),e=f(e,j,c,d,a[2],606105819,17),d=f(d,e,j,c,a[3],3250441966,22),c=f(c,d,e,j,a[4],4118548399,7),j=f(j,c,d,e,a[5],1200080426,12),e=f(e,j,c,d,a[6],2821735955,17),d=f(d,e,j,c,a[7],4249261313,22),c=f(c,d,e,j,a[8],1770035416,7),j=f(j,c,d,e,a[9],2336552879,12),e=f(e,j,c,d,a[10],4294925233,17),d=f(d,e,j,c,a[11],2304563134,22),c=f(c,d,e,j,a[12],1804603682,7),j=f(j,c,d,e,a[13],4254626195,12),e=f(e,j,c,d,a[14],2792965006,17),d=f(d,e,j,c,a[15],1236535329,22),c=g(c,d,e,j,a[1],4129170786,5),j=g(j,c,d,e,a[6],3225465664,9),e=g(e,j,c,d,a[11],643717713,14),d=g(d,e,j,c,a[0],3921069994,20),c=g(c,d,e,j,a[5],3593408605,5),j=g(j,c,d,e,a[10],38016083,9),e=g(e,j,c,d,a[15],3634488961,14),d=g(d,e,j,c,a[4],3889429448,20),c=g(c,d,e,j,a[9],568446438,5),j=g(j,c,d,e,a[14],3275163606,9),e=g(e,j,c,d,a[3],4107603335,14),d=g(d,e,j,c,a[8],1163531501,20),c=g(c,d,e,j,a[13],2850285829,5),j=g(j,c,d,e,a[2],4243563512,9),e=g(e,j,c,d,a[7],1735328473,14),d=g(d,e,j,c,a[12],2368359562,20),c=h(c,d,e,j,a[5],4294588738,4),j=h(j,c,d,e,a[8],2272392833,11),e=h(e,j,c,d,a[11],1839030562,16),d=h(d,e,j,c,a[14],4259657740,23),c=h(c,d,e,j,a[1],2763975236,4),j=h(j,c,d,e,a[4],1272893353,11),e=h(e,j,c,d,a[7],4139469664,16),d=h(d,e,j,c,a[10],3200236656,23),c=h(c,d,e,j,a[13],681279174,4),j=h(j,c,d,e,a[0],3936430074,11),e=h(e,j,c,d,a[3],3572445317,16),d=h(d,e,j,c,a[6],76029189,23),c=h(c,d,e,j,a[9],3654602809,4),j=h(j,c,d,e,a[12],3873151461,11),e=h(e,j,c,d,a[15],530742520,16),d=h(d,e,j,c,a[2],3299628645,23),c=i(c,d,e,j,a[0],4096336452,6),j=i(j,c,d,e,a[7],1126891415,10),e=i(e,j,c,d,a[14],2878612391,15),d=i(d,e,j,c,a[5],4237533241,21),c=i(c,d,e,j,a[12],1700485571,6),j=i(j,c,d,e,a[3],2399980690,10),e=i(e,j,c,d,a[10],4293915773,15),d=i(d,e,j,c,a[1],2240044497,21),c=i(c,d,e,j,a[8],1873313359,6),j=i(j,c,d,e,a[15],4264355552,10),e=i(e,j,c,d,a[6],2734768916,15),d=i(d,e,j,c,a[13],1309151649,21),c=i(c,d,e,j,a[4],4149444226,6),j=i(j,c,d,e,a[11],3174756917,10),e=i(e,j,c,d,a[2],718787259,15),d=i(d,e,j,c,a[9],3951481745,21),this._a=this._a+c|0,this._b=this._b+d|0,this._c=this._c+e|0,this._d=this._d+j|0},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var a=new c(16);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a},b.exports=d}).call(this,a("buffer").Buffer)},{buffer:8,"hash-base":243,inherits:244}],243:[function(a,b,c){(function(c){"use strict";function d(a){e.call(this),this._block=new c(a),this._blockSize=a,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var e=a("stream").Transform,f=a("inherits");f(d,e),d.prototype._transform=function(a,b,d){var e=null;try{"buffer"!==b&&(a=new c(a,b)),this.update(a)}catch(a){e=a}d(e)},d.prototype._flush=function(a){var b=null;try{this.push(this._digest())}catch(a){b=a}a(b)},d.prototype.update=function(a,b){if(!c.isBuffer(a)&&"string"!=typeof a)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");c.isBuffer(a)||(a=new c(a,b));for(var d=this._block,e=0;this._blockOffset+a.length-e>=this._blockSize;){for(var f=this._blockOffset;f0;++g)this._length[g]+=h,h=this._length[g]/4294967296|0,h>0&&(this._length[g]-=4294967296*h);return this},d.prototype._update=function(a){throw new Error("_update is not implemented")},d.prototype.digest=function(a){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var b=this._digest();return void 0!==a&&(b=b.toString(a)),b},d.prototype._digest=function(){throw new Error("_digest is not implemented")},b.exports=d}).call(this,a("buffer").Buffer)},{buffer:8,inherits:244,stream:220}],244:[function(a,b,c){arguments[4][205][0].apply(c,arguments)},{dup:205}],245:[function(a,b,c){"use strict";var d=a("./lib/Connection"),e=a("./lib/StreamParser"),f=a("node-xmpp-jid"),g=a("node-xmpp-stanza"),h=a("inherits");c.SRV=a("./lib/SRV"),c.exportCoreUtils=function(a){a.Connection=d,a.StreamParser=e,a.JID=f,a.inherits=h,a.stanza=g,a.Stanza=g.Stanza,a.createStanza=g.createStanza,a.IQ=g.IQ,a.Presence=g.Presence,a.Message=g.Message,a.Parser=g.Parser,a.parse=g.parse,a.ltx=g.ltx,a.createElement=g.createElement,a.Element=g.Element,a.escapeXML=g.escapeXML,a.escapeXMLText=g.escapeXMLText},c.exportCoreUtils(c)},{"./lib/Connection":246,"./lib/SRV":247,"./lib/StreamParser":248,inherits:249,"node-xmpp-jid":262,"node-xmpp-stanza":266}],246:[function(a,b,c){"use strict";function d(a,b){var c=o({},b);return c.initialDelay=b&&(b.initialReconnectDelay||b.reconnectDelay)||s,c.maxDelay=b&&b.maxReconnectDelay||t,c.immediate=b&&b.socket&&"function"!=typeof b.socket,c.type=b&&b.delayType,c.emitter=a,c}function e(a){h.call(this),this.streamAttrs=a&&a.streamAttrs||{},this.xmlns=a&&a.xmlns||{},this.xmlns.stream=q,this.streamOpen=a&&a.streamOpen||u,this.streamClose=a&&a.streamClose||v,this.rejectUnauthorized=!(!a||!a.rejectUnauthorized),this.serialized=!(!a||!a.serialized),this.requestCert=!(!a||!a.requestCert),this.servername=a&&a.servername,this.boundOnData=this.onData.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundEmitData=this.emit.bind(this,"data"),this.boundEmitDrain=this.emit.bind(this,"drain"),this._setupSocket(d(this,a)),this.once("reconnect",function(){this.reconnect=a&&a.reconnect})}function f(a){return a.children?a.children.reduce(function(a,b){return a+f(b)},""):a}var g=a("net"),h=a("events").EventEmitter,i=a("inherits"),j=a("node-xmpp-stanza").Element,k=a("reconnect-core"),l=a("./StreamParser"),m=a("node-xmpp-tls-connect"),n=a("debug")("xmpp:connection"),o=a("lodash.assign"),p="urn:ietf:params:xml:ns:xmpp-tls",q="http://etherx.jabber.org/streams",r="urn:ietf:params:xml:ns:xmpp-streams",s=1e3,t=3e4,u="stream:stream",v="";i(e,h),e.prototype.NS_XMPP_TLS=p,e.NS_STREAM=q,e.prototype.NS_XMPP_STREAMS=r,e.prototype.allowTLS=!0,e.prototype._setupSocket=function(a){n("setup socket");var b={},c=k(function(a){var d=this.socket;return"on"===a.preserve?(a.preserve=b,b=a):a=b=a.preserve?a.preserve:a||b,"function"==typeof a.socket?(n("use lazy socket"),this.socket=a.socket.call(this)):(n("use standard socket"),this.socket=a.socket,a.socket=null,this.socket&&this.once("connect",function(){c.options.immediate=!1})),this.socket=this.socket||new g.Socket,d!==this.socket&&this.setupStream(),this.socket}.bind(this));c(c.options=a);var d=this.end;this.end=this.disconnect=function(){this.closeStream(),d()},this.on("connection",function(){this.parser||this.startParser()}),this.on("end",function(){b={}})},e.prototype.setupStream=function(){n("setup stream"),this.socket.on("end",this.onEnd.bind(this)),this.socket.on("data",this.boundOnData),this.socket.on("close",this.boundOnClose),this.socket.on("data",this.boundEmitData),this.socket.on("drain",this.boundEmitDrain),this.socket.on("error",function(){}),this.socket.serializeStanza||(this.serialized?this.socket.serializeStanza=function(a,b){a.write(function(a){b(a)})}:this.socket.serializeStanza=function(a,b){b(a.toString())})},e.prototype.pause=function(){this.socket.pause&&this.socket.pause()},e.prototype.resume=function(){this.socket.resume&&this.socket.resume()},e.prototype.send=function(a){if(this.socket&&this.streamOpened){if(!this.socket.writable)return void this.socket.end();n("send: "+a.toString());var b=!0;if(a.root){var c=this.rmXmlns(a.root());this.socket.serializeStanza(c,function(a){b=this.write(a)}.bind(this.socket))}else b=this.socket.write(a);return b}},e.prototype.startParser=function(){var a=this;this.parser=new l.StreamParser(this.maxStanzaSize),this.parser.on("streamStart",function(b){a.streamNsAttrs={};for(var c in b)"xmlns"!==c&&"xmlns:"!==c.substr(0,6)||(a.streamNsAttrs[c]=b[c]);a.emit("streamStart",b)}),this.parser.on("stanza",function(b){a.onStanza(a.addStreamNs(b))}),this.parser.on("error",function(b){a.error(b.condition||"internal-server-error",b.message)}),this.parser.once("end",function(){a.stopParser(),a.reconnect?a.once("reconnect",a.startParser.bind(a)):a.end()})},e.prototype.stopParser=function(){if(this.parser){var a=this.parser;this.parser=null,a.end()}},e.prototype.openStream=function(){var a={};for(var b in this.xmlns)this.xmlns.hasOwnProperty(b)&&(b?a["xmlns:"+b]=this.xmlns[b]:a.xmlns=this.xmlns[b]);for(b in this.streamAttrs)this.streamAttrs.hasOwnProperty(b)&&(a[b]=this.streamAttrs[b]);this.streamTo&&(a.to=this.streamTo);var c,d=new j(this.streamOpen,a);if("stream:stream"===d.name){d.t(" ");var e=d.toString();c=e.substr(0,e.indexOf(" "))}else c=d.toString();this.streamOpened=!0,this.send(c)},e.prototype.startStream=e.prototype.openStream,e.prototype.closeStream=function(){this.send(this.streamClose),this.streamOpened=!1},e.prototype.endStream=e.prototype.closeStream,e.prototype.onData=function(a){n("receive: "+a.toString("utf8")),this.parser&&this.parser.write(a)},e.prototype.setSecure=function(a,b,c){this.socket.removeListener("data",this.boundOnData),this.socket.removeListener("data",this.boundEmitData),this.socket.removeListener("drain",this.boundEmitDrain),this.socket.removeListener("close",this.boundOnClose), -this.socket.clearTimer&&this.socket.clearTimer();var d=m({socket:this.socket,rejectUnauthorized:this.rejectUnauthorized,credentials:a||this.credentials,requestCert:this.requestCert,isServer:!!b,servername:b&&c},function(){this.isSecure=!0,this.once("disconnect",function(){this.isSecure=!1}),d.emit("connect",d)}.bind(this));d.on("clientError",this.emit.bind(this,"error")),this.reconnect||(this.reconnect=!0,this.once("reconnect",function(){this.reconnect=!1})),this.stopParser(),this.listen({socket:d,preserve:"on"})},e.prototype.onStanza=function(a){if(a.is("error",q)){var b=new Error(""+f(a));b.stanza=a,this.socket.emit("error",b)}else a.is("features",this.NS_STREAM)&&this.allowTLS&&!this.isSecure&&a.getChild("starttls",this.NS_XMPP_TLS)?this.send(new j("starttls",{xmlns:this.NS_XMPP_TLS})):this.allowTLS&&a.is("proceed",this.NS_XMPP_TLS)?this.setSecure():this.emit("stanza",a)},e.prototype.addStreamNs=function(a){for(var b in this.streamNsAttrs)a.attrs[b]||"xmlns"===b&&this.streamNsAttrs[b]===this.xmlns[""]||(a.attrs[b]=this.streamNsAttrs[b]);return a},e.prototype.rmXmlns=function(a){for(var b in this.xmlns){var c=b?"xmlns:"+b:"xmlns";a.attrs[c]===this.xmlns[b]&&(a.attrs[c]=null)}return a},e.prototype.onEnd=function(){this.closeStream(),this.reconnect||this.emit("end")},e.prototype.onClose=function(){this.reconnect||this.emit("close")},e.prototype.error=function(a,b){if(this.emit("error",new Error(b)),this.socket&&this.socket.writable){this.streamOpened||this.openStream();var c=new j("stream:error");c.c(a,{xmlns:r}),b&&c.c("text",{xmlns:r,"xml:lang":"en"}).t(b),this.send(c),this.end()}},b.exports=e},{"./StreamParser":248,debug:239,events:204,inherits:249,"lodash.assign":250,net:5,"node-xmpp-stanza":266,"node-xmpp-tls-connect":274,"reconnect-core":275}],247:[function(a,b,c){"use strict";function d(a,b){return a=parseInt(a,10),b=parseInt(b,10),ab?1:0}function e(a){var b={};a.forEach(function(a){b.hasOwnProperty(a.priority)||(b[a.priority]=[]),b[a.priority].push(a)});var c=[];return Object.keys(b).sort(d).forEach(function(a){var d=b[a],e=0;d.forEach(function(a){e+=a.weight});var f=Math.floor(Math.random()*e);e=0;var g=d[0];d.forEach(function(a){e+=a.weight,f0?null:c,d)};i.lookup(a,e)}function h(a,b){function c(){a.removeListener("connect",c),a.removeListener("disconnect",d)}function d(){var d=b.shift();d?a.socket.connect(d.port,d.name):c()}return a.on("connect",c),a.on("disconnect",d),d()}var i=a("dns");c.connect=function(a){function b(d){var e=this;!e.socket&&a.socket?("function"==typeof a.socket?e.socket=a.socket.call(this):e.socket=a.socket,a.socket=null):d||(e.socket=null);var i=c.shift();return i?f(i+"."+a.domain,function(a,c){!a&&c?h(e,c):b.call(e,"retry")}):g(a.domain,function(b,d){d&&d.length>0?(d=d.map(function(b){return{name:b,port:a.defaultPort}}),h(e,d)):e.reconnect?(c=a.services.slice(),e.socket=null):(b=b||new Error("No addresses resolved for "+a.domain),e.emit("error",b))}),e.socket}var c=a.services.slice();return b}},{dns:5}],248:[function(a,b,c){"use strict";function d(a){f.call(this);var b=this,c=a&&a.Element||j,d=a&&a.Parser||g;this.maxStanzaSize=a&&a.maxStanzaSize,this.parser=new d,this.bytesParsed=0,this.bytesParsedOnStanzaBegin=0,this.parser.on("startElement",function(a,d){if(b.element||"stream:stream"!==a){var e;b.element?(e=new c(a,d),b.element=b.element.cnode(e)):(e=new i(a,d),b.element=e,b.bytesParsedOnStanzaBegin=b.bytesParsed)}else b.emit("streamStart",d)}),this.parser.on("endElement",function(a){b.element||"stream:stream"!==a?b.element&&a===b.element.name?b.element.parent?b.element=b.element.parent:(b.emit("stanza",b.element),delete b.element,delete b.bytesParsedOnStanzaBegin):b.error("xml-not-well-formed","XML parse error"):b.end()}),this.parser.on("text",function(a){b.element&&b.element.t(a)}),this.parser.on("entityDecl",function(){b.error("xml-not-well-formed","No entity declarations allowed"),b.end()}),this.parser.on("error",this.emit.bind(this,"error"))}var e=a("inherits"),f=a("events").EventEmitter,g=a("ltx/lib/parsers/ltx"),h=a("node-xmpp-stanza"),i=h.Stanza,j=h.Element;e(d,f),d.prototype.checkXMLHeader=function(a){var b=a.indexOf("");if(b>=0&&c>=0&&bthis.bytesParsedOnStanzaBegin+this.maxStanzaSize)return void this.error("policy-violation","Maximum stanza size exceeded");this.bytesParsed+=a.length,this.parser.write(a)}},d.prototype.end=function(a){a&&this.write(a),delete this.parser,this.emit("end")},d.prototype.error=function(a,b){var c=new Error(b);c.condition=a,this.emit("error",c)},d.StreamParser=d,b.exports=d},{events:204,inherits:249,"ltx/lib/parsers/ltx":260,"node-xmpp-stanza":266}],249:[function(a,b,c){arguments[4][205][0].apply(c,arguments)},{dup:205}],250:[function(a,b,c){function d(a,b,c){switch(c.length){case 0:return a.call(b);case 1:return a.call(b,c[0]);case 2:return a.call(b,c[0],c[1]);case 3:return a.call(b,c[0],c[1],c[2])}return a.apply(b,c)}function e(a){return function(b){return null==b?void 0:b[a]}}function f(a,b){for(var c=-1,d=Array(a);++c1?c[e-1]:void 0,g=e>2?c[2]:void 0;for(f=a.length>3&&"function"==typeof f?(e--,f):void 0,g&&o(c[0],c[1],g)&&(f=e<3?void 0:f,e=1),b=Object(b);++d-1&&a%1==0&&a-1&&a%1==0&&a<=A}function w(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}function x(a){return!!a&&"object"==typeof a}function y(a){return"string"==typeof a||!R(a)&&x(a)&&I.call(a)==E}function z(a){var b=p(a);if(!b&&!s(a))return O(a);var c=m(a),d=!!c,e=c||[],f=e.length;for(var g in a)!i(a,g)||d&&("length"==g||n(g,f))||b&&"constructor"==g||e.push(g);return e}var A=9007199254740991,B="[object Arguments]",C="[object Function]",D="[object GeneratorFunction]",E="[object String]",F=/^(?:0|[1-9]\d*)$/,G=Object.prototype,H=G.hasOwnProperty,I=G.toString,J=G.propertyIsEnumerable,K=Object.getPrototypeOf,L=Object.keys,M=Math.max,N=!J.call({valueOf:1},"valueOf"),O=g(L,Object),P=e("length"),Q=g(K,Object),R=Array.isArray,S=l(function(a,b){if(N||p(b)||s(b))return void k(b,z(b),a);for(var c in b)H.call(b,c)&&h(a,c,b[c])});b.exports=S},{}],251:[function(a,b,c){"use strict";var d=a("./lib/parse"),e=a("./lib/Parser"),f=a("./lib/escape"),g=a("./lib/Element"),h=a("./lib/equal"),i=a("./lib/createElement"),j=a("./lib/tag"),k=a("./lib/is");c=b.exports=j,c.Element=g,c.equal=h.equal,c.nameEqual=h.name,c.attrsEqual=h.attrs,c.childrenEqual=h.children,c.isNode=k.isNode,c.isElement=k.isElement,c.isText=k.isText,c.createElement=i,c.escapeXML=f.escapeXML,c.unescapeXML=f.unescapeXML,c.escapeXMLText=f.escapeXMLText,c.unescapeXMLText=f.unescapeXMLText,c.Parser=e,c.parse=d,c.tag=j},{"./lib/Element":252,"./lib/Parser":253,"./lib/createElement":255,"./lib/equal":256,"./lib/escape":257,"./lib/is":258,"./lib/parse":259,"./lib/tag":261}],252:[function(a,b,c){"use strict";function d(a,b){this.name=a,this.parent=null,this.children=[],this.attrs={},this.setAttrs(b)}var e=a("./escape"),f=e.escapeXML,g=e.escapeXMLText,h=a("./equal"),i=h.equal,j=h.name,k=h.attrs,l=h.children,m=a("./clone");d.prototype.is=function(a,b){return this.getName()===a&&(!b||this.getNS()===b)},d.prototype.getName=function(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name},d.prototype.getNS=function(){if(this.name.indexOf(":")>=0){var a=this.name.substr(0,this.name.indexOf(":"));return this.findNS(a)}return this.findNS()},d.prototype.findNS=function(a){if(a){var b="xmlns:"+a;if(this.attrs[b])return this.attrs[b];if(this.parent)return this.parent.findNS(a)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}},d.prototype.getXmlns=function(){var a={};this.parent&&(a=this.parent.getXmlns());for(var b in this.attrs){var c=b.match("xmlns:?(.*)");this.attrs.hasOwnProperty(b)&&c&&(a[this.attrs[b]]=c[1])}return a},d.prototype.setAttrs=function(a){"string"==typeof a?this.attrs.xmlns=a:a&&Object.keys(a).forEach(function(b){this.attrs[b]=a[b]},this)},d.prototype.getAttr=function(a,b){if(!b)return this.attrs[a];var c=this.getXmlns();return c[b]?this.attrs[[c[b],a].join(":")]:null},d.prototype.getChild=function(a,b){return this.getChildren(a,b)[0]},d.prototype.getChildren=function(a,b){for(var c=[],d=0;d");for(var b=0;b")},d.prototype.write=function(a){a("<"),a(this.name);for(var b in this.attrs){var c=this.attrs[b];null!=c&&(a(" "),a(b),a('="'),"string"!=typeof c&&(c=c.toString()),a(f(c)),a('"'))}0===this.children.length?a("/>"):this._addChildren(a)},d.prototype.nameEquals=function(a){return j(this,a)},d.prototype.attrsEquals=function(a){return k(this,a)},d.prototype.childrenEquals=function(a){return l(this,a)},d.prototype.equals=function(a){return i(this,a)},b.exports=d},{"./clone":254,"./equal":256,"./escape":257}],253:[function(a,b,c){"use strict";var d=a("events").EventEmitter,e=a("inherits"),f=a("./Element"),g=a("./parsers/ltx"),h=function(a){d.call(this);var b=this.Parser=a&&a.Parser||this.DefaultParser,c=this.Element=a&&a.Element||this.DefaultElement;this.parser=new b;var e,f=this;this.parser.on("startElement",function(a,b){var d=new c(a,b);e=e?e.cnode(d):d}),this.parser.on("endElement",function(a){e&&a===e.name&&(e.parent?e=e.parent:f.tree||(f.tree=e,e=void 0))}),this.parser.on("text",function(a){e&&e.t(a)}),this.parser.on("error",function(a){f.error=a,f.emit("error",a)})};e(h,d),h.prototype.DefaultParser=g,h.prototype.DefaultElement=f,h.prototype.write=function(a){this.parser.write(a)},h.prototype.end=function(a){this.parser.end(a),this.error||(this.tree?this.emit("tree",this.tree):this.emit("error",new Error("Incomplete document")))},b.exports=h},{"./Element":252,"./parsers/ltx":260,events:204,inherits:249}],254:[function(a,b,c){"use strict";b.exports=function a(b){for(var a=new b.constructor(b.name,b.attrs),c=0;c":">",'"':""","'":"'"},g={"&":"&","&":"&","<":"<","<":"<",">":">",">":">",""":'"',""":'"',"'":"'","'":"'"};c.escapeXML=function(a){return a.replace(/&|<|>|"|'/g,d)},c.unescapeXML=function(a){return a.replace(/&(amp|#38|lt|#60|gt|#62|quot|#34|apos|#39);/g,e)},c.escapeXMLText=function(a){return a.replace(/&|<|>/g,d)},c.unescapeXMLText=function(a){return a.replace(/&(amp|#38|lt|#60|gt|#62);/g,e)}},{}],258:[function(a,b,c){"use strict";var d=a("./Element");b.exports.isNode=function(a){return a instanceof d||"string"==typeof a},b.exports.isElement=function(a){return a instanceof d},b.exports.isText=function(a){return"string"==typeof a}},{"./Element":252}],259:[function(a,b,c){"use strict";var d=a("./Parser");b.exports=function(a,b){var c;c="function"==typeof b?new b:new d(b);var e=null,f=null;if(c.on("tree",function(a){e=a}),c.on("error",function(a){f=a}),c.write(a),c.end(),f)throw f;return e}},{"./Parser":253}],260:[function(a,b,c){"use strict";var d=a("inherits"),e=a("events").EventEmitter,f=a("../escape").unescapeXML,g=0,h=1,i=2,j=3,k=4,l=5,m=6,n=7,o=b.exports=function(){e.call(this);var a,b,c,d,o,p,q,r=g,s=0;this._handleTagOpening=function(a,b,c){a?this.emit("endElement",b):(this.emit("startElement",b,c),o&&this.emit("endElement",b))},this.write=function(e){function t(){if("number"==typeof s){var a=e.slice(s,u);return s=void 0,a}}"string"!=typeof e&&(e=e.toString());var u=0;for(a&&(e=a+e,u+=a.length,a=null);u32&&(s=u,r=k);break;case k:(v<=32||61===v)&&(q=t(),u--,r=l);break;case l:61===v&&(r=m);break;case m:34!==v&&39!==v||(p=v,r=n,s=u+1);break;case n:if(v===p){var x=f(t());c[q]=x,q=void 0,r=j}}}"number"==typeof s&&s<=e.length&&(a=e.slice(s),s=0)}};d(o,e),o.prototype.end=function(a){a&&this.write(a),this.write=function(){}}},{"../escape":257,events:204,inherits:249}],261:[function(a,b,c){"use strict";var d=a("./escape").escapeXML,e=a("./parse");b.exports=function(){for(var a=arguments[0],b="",c=1;c|@/g);return c!==-1},b.exports.escape=function(a){return null===a?null:a.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(//g,"\\3e").replace(/@/g,"\\40").replace(/\3a/g,"c3a")},b.exports.unescape=function(a){return null===a?null:a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}},{}],265:[function(a,b,c){"use strict";var d=a("./JID");b.exports=function(){for(var a=arguments[0],b=Array.prototype.slice.call(arguments,1),c="",e=0;e0&&(g=!1),g){var i=b.subject.CN;if(l.isArray(i))for(var k=0,m=i.length;k0&&this.backoff_.failAfter(this.failAfter_),this.state_=e.State_.RUNNING,this.doCall_()},e.prototype.doCall_=function(){var a=["call"].concat(this.arguments_);f.EventEmitter.prototype.emit.apply(this,a);var b=this.handleFunctionCallback_.bind(this);this.function_.apply(null,this.arguments_.concat(b))},e.prototype.doCallback_=function(){var a=this.results_[this.results_.length-1];this.callback_.apply(null,a)},e.prototype.handleFunctionCallback_=function(){if(!this.isAborted()){var a=Array.prototype.slice.call(arguments);this.results_.push(a),f.EventEmitter.prototype.emit.apply(this,["callback"].concat(a)),a[0]?this.backoff_.backoff(a[0]):(this.state_=e.State_.COMPLETED,this.doCallback_())}},e.prototype.handleBackoff_=function(a,b,c){this.emit("backoff",a,b,c)},b.exports=e},{"./backoff":277,"./strategy/fibonacci":280,events:204,util:224}],279:[function(a,b,c){function d(a){f.call(this,a),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var e=a("util"),f=a("./strategy");e.inherits(d,f),d.prototype.next_=function(){return this.backoffDelay_=Math.min(this.nextBackoffDelay_,this.getMaxDelay()),this.nextBackoffDelay_=2*this.backoffDelay_,this.backoffDelay_},d.prototype.reset_=function(){this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()},b.exports=d},{"./strategy":281,util:224}],280:[function(a,b,c){function d(a){f.call(this,a),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var e=a("util"),f=a("./strategy");e.inherits(d,f),d.prototype.next_=function(){var a=Math.min(this.nextBackoffDelay_,this.getMaxDelay());return this.nextBackoffDelay_+=this.backoffDelay_,this.backoffDelay_=a,a},d.prototype.reset_=function(){this.nextBackoffDelay_=this.getInitialDelay(),this.backoffDelay_=0},b.exports=d},{"./strategy":281,util:224}],281:[function(a,b,c){function d(a){return void 0!==a&&null!==a}function e(a){if(a=a||{},d(a.initialDelay)&&a.initialDelay<1)throw new Error("The initial timeout must be greater than 0.");if(d(a.maxDelay)&&a.maxDelay<1)throw new Error("The maximal timeout must be greater than 0.");if(this.initialDelay_=a.initialDelay||100,this.maxDelay_=a.maxDelay||1e4,this.maxDelay_<=this.initialDelay_)throw new Error("The maximal backoff delay must be greater than the initial backoff delay.");if(d(a.randomisationFactor)&&(a.randomisationFactor<0||a.randomisationFactor>1))throw new Error("The randomisation factor must be between 0 and 1.");this.randomisationFactor_=a.randomisationFactor||0}a("events"),a("util");e.prototype.getMaxDelay=function(){return this.maxDelay_},e.prototype.getInitialDelay=function(){return this.initialDelay_},e.prototype.next=function(){var a=this.next_(),b=1+Math.random()*this.randomisationFactor_,c=Math.round(a*b);return c},e.prototype.next_=function(){throw new Error("BackoffStrategy.next_() unimplemented.")},e.prototype.reset=function(){this.reset_()},e.prototype.reset_=function(){throw new Error("BackoffStrategy.reset_() unimplemented.")},b.exports=e},{events:204,util:224}],282:[function(a,b,c){!function(b){if(function(a,b){"function"==typeof define&&define.amd?define("strophe-base64",function(){return b()}):a.Base64=b()}(this,function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b={encode:function(b){var c,d,e,f,g,h,i,j="",k=0;do c=b.charCodeAt(k++),d=b.charCodeAt(k++),e=b.charCodeAt(k++),f=c>>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?(g=(3&c)<<4,h=i=64):isNaN(e)&&(i=64),j=j+a.charAt(f)+a.charAt(g)+a.charAt(h)+a.charAt(i);while(k>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(c),64!=h&&(j+=String.fromCharCode(d)),64!=i&&(j+=String.fromCharCode(e));while(k>5]|=128<<24-d%32,a[(d+64>>9<<4)+15]=d;var g,h,i,j,k,l,m,n,o=new Array(80),p=1732584193,q=-271733879,r=-1732584194,s=271733878,t=-1009589776;for(g=0;g16&&(d=a(d,8*b.length));for(var e=new Array(16),f=new Array(16),h=0;h<16;h++)e[h]=909522486^d[h],f[h]=1549556828^d[h];var i=a(e.concat(g(c)),512+8*c.length);return a(f.concat(i),672)}function e(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function f(a,b){return a<>>32-b}function g(a){for(var b=[],c=255,d=0;d<8*a.length;d+=8)b[d>>5]|=(a.charCodeAt(d/8)&c)<<24-d%32;return b}function h(a){for(var b="",c=255,d=0;d<32*a.length;d+=8)b+=String.fromCharCode(a[d>>5]>>>24-d%32&c);return b}function i(a){for(var b,c,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e="",f=0;f<4*a.length;f+=3)for(b=(a[f>>2]>>8*(3-f%4)&255)<<16|(a[f+1>>2]>>8*(3-(f+1)%4)&255)<<8|a[f+2>>2]>>8*(3-(f+2)%4)&255,c=0;c<4;c++)e+=8*f+6*c>32*a.length?"=":d.charAt(b>>6*(3-c)&63);return e}return{b64_hmac_sha1:function(a,b){return i(d(a,b))},b64_sha1:function(b){return i(a(g(b),8*b.length))},binb2str:h,core_hmac_sha1:d,str_hmac_sha1:function(a,b){return h(d(a,b))},str_sha1:function(b){return h(a(g(b),8*b.length))}}}),function(a,b){"function"==typeof define&&define.amd?define("strophe-md5",function(){return b()}):a.MD5=b()}(this,function(a){var b=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},c=function(a,b){return a<>>32-b},d=function(a){for(var b=[],c=0;c<8*a.length;c+=8)b[c>>5]|=(255&a.charCodeAt(c/8))<>5]>>>c%32&255);return b},f=function(a){for(var b="0123456789abcdef",c="",d=0;d<4*a.length;d++)c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15);return c},g=function(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)},h=function(a,b,c,d,e,f,h){return g(b&c|~b&d,a,b,e,f,h)},i=function(a,b,c,d,e,f,h){return g(b&d|c&~d,a,b,e,f,h)},j=function(a,b,c,d,e,f,h){return g(b^c^d,a,b,e,f,h)},k=function(a,b,c,d,e,f,h){return g(c^(b|~d),a,b,e,f,h)},l=function(a,c){a[c>>5]|=128<>>9<<4)+14]=c;for(var d,e,f,g,l=1732584193,m=-271733879,n=-1732584194,o=271733878,p=0;p=0&&c<=127?d+=a.charAt(b):c>2047?(d+=String.fromCharCode(224|c>>12&15),d+=String.fromCharCode(128|c>>6&63),d+=String.fromCharCode(128|c>>0&63)):(d+=String.fromCharCode(192|c>>6&31),d+=String.fromCharCode(128|c>>0&63));return d},addCookies:function(a){var b,c,d,e,f,g,h;for(b in a||{})f="",g="",h="",c=a[b],d="object"==typeof c,e=escape(unescape(d?c.value:c)),d&&(f=c.expires?";expires="+c.expires:"",g=c.domain?";domain="+c.domain:"",h=c.path?";path="+c.path:""),document.cookie=b+"="+e+f+g+h}};return a}),function(a,b){return"function"==typeof define&&define.amd?void define("strophe-polyfill",[],function(){return b()}):b()}(this,function(){Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice,d=Array.prototype.concat,e=c.call(arguments,1);return function(){return b.apply(a?a:this,d.call(e,c.call(arguments,0)))}}),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length,c=Number(arguments[1])||0;for(c=c<0?Math.ceil(c):Math.floor(c),c<0&&(c+=b);c0)for(var c=0;c/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,""")},xmlunescape:function(a){return a=a.replace(/\&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,'"')},xmlTextNode:function(a){return i.xmlGenerator().createTextNode(a)},xmlHtmlNode:function(a){var b;if(window.DOMParser){var c=new DOMParser;b=c.parseFromString(a,"text/xml")}else b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);return b},getText:function(a){if(!a)return null;var b="";0===a.childNodes.length&&a.nodeType==i.ElementType.TEXT&&(b+=a.nodeValue);for(var c=0;c0&&(g=h.join("; "),c.setAttribute(f,g))}else c.setAttribute(f,g);for(b=0;b/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(a){return"string"!=typeof a?a:a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(a){return a.indexOf("@")<0?null:a.split("@")[0]},getDomainFromJid:function(a){var b=i.getBareJidFromJid(a);if(b.indexOf("@")<0)return b;var c=b.split("@");return c.splice(0,1),c.join("@")},getResourceFromJid:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),b.join("/"))},getBareJidFromJid:function(a){return a?a.split("/")[0]:null},log:function(a,b){},debug:function(a){this.log(this.LogLevel.DEBUG,a)},info:function(a){this.log(this.LogLevel.INFO,a)},warn:function(a){this.log(this.LogLevel.WARN,a)},error:function(a){this.log(this.LogLevel.ERROR,a)},fatal:function(a){this.log(this.LogLevel.FATAL,a)},serialize:function(a){var b;if(!a)return null;"function"==typeof a.tree&&(a=a.tree());var c,d,e=a.nodeName;for(a.getAttribute("_realname")&&(e=a.getAttribute("_realname")),b="<"+e,c=0;c0){for(b+=">",c=0;c"}b+=""}else b+="/>";return b},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(a,b){i._connectionPlugins[a]=b}},i.Builder=function(a,b){"presence"!=a&&"message"!=a&&"iq"!=a||(b&&!b.xmlns?b.xmlns=i.NS.CLIENT:b||(b={xmlns:i.NS.CLIENT})),this.nodeTree=i.xmlElement(a,b),this.node=this.nodeTree},i.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return i.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},attrs:function(a){for(var b in a)a.hasOwnProperty(b)&&(void 0===a[b]?this.node.removeAttribute(b):this.node.setAttribute(b,a[b]));return this},c:function(a,b,c){var d=i.xmlElement(a,b,c);return this.node.appendChild(d),"string"!=typeof c&&"number"!=typeof c&&(this.node=d),this},cnode:function(a){var b,c=i.xmlGenerator();try{b=void 0!==c.importNode}catch(a){b=!1}var d=b?c.importNode(a,!0):i.copyElement(a);return this.node.appendChild(d),this.node=d,this},t:function(a){var b=i.xmlTextNode(a);return this.node.appendChild(b),this},h:function(a){var b=document.createElement("body");b.innerHTML=a;for(var c=i.createHtml(b);c.childNodes.length>0;)this.node.appendChild(c.childNodes[0]);return this}},i.Handler=function(a,b,c,d,e,f,g){this.handler=a,this.ns=b,this.name=c,this.type=d,this.id=e,this.options=g||{matchBare:!1},this.options.matchBare||(this.options.matchBare=!1),this.options.matchBare?this.from=f?i.getBareJidFromJid(f):null:this.from=f,this.user=!0},i.Handler.prototype={isMatch:function(a){var b,c=null;if(c=this.options.matchBare?i.getBareJidFromJid(a.getAttribute("from")):a.getAttribute("from"),b=!1,this.ns){var d=this;i.forEachChild(a,null,function(a){a.getAttribute("xmlns")==d.ns&&(b=!0)}),b=b||a.getAttribute("xmlns")==this.ns}else b=!0;var e=a.getAttribute("type");return!(!b||this.name&&!i.isTagEqual(a,this.name)||this.type&&(Array.isArray(this.type)?this.type.indexOf(e)==-1:e!=this.type)||this.id&&a.getAttribute("id")!=this.id||this.from&&c!=this.from)},run:function(a){var b=null;try{b=this.handler(a)}catch(a){throw a.sourceURL?i.fatal("error: "+this.handler+" "+a.sourceURL+":"+a.line+" - "+a.name+": "+a.message):a.fileName?("undefined"!=typeof console&&(console.trace(),console.error(this.handler," - error - ",a,a.message)),i.fatal("error: "+this.handler+" "+a.fileName+":"+a.lineNumber+" - "+a.name+": "+a.message)):i.fatal("error: "+a.message+"\n"+a.stack),a}return b},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},i.TimedHandler=function(a,b){this.period=a,this.handler=b,this.lastCalled=(new Date).getTime(),this.user=!0},i.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},i.Connection=function(a,b){this.service=a,this.options=b||{};var c=this.options.protocol||"";0===a.indexOf("ws:")||0===a.indexOf("wss:")||0===c.indexOf("ws")?this._proto=new i.Websocket(this):this._proto=new i.Bosh(this),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this),100),d.addCookies(this.options.cookies);for(var e in i._connectionPlugins)if(i._connectionPlugins.hasOwnProperty(e)){var f=i._connectionPlugins[e],g=function(){};g.prototype=f,this[e]=new g,this[e].init(this)}},i.Connection.prototype={reset:function(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});return"string"==typeof a||"number"==typeof a?b+":"+a:b+""},connect:function(a,b,c,d,e,f,g){this.jid=a,this.authzid=i.getBareJidFromJid(this.jid),this.authcid=g||i.getNodeFromJid(this.jid),this.pass=b,this.servtype="xmpp",this.connect_callback=c,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=i.getDomainFromJid(this.jid),this._changeConnectStatus(i.Status.CONNECTING,null),this._proto._connect(d,e,f)},attach:function(a,b,c,d,e,f,g){if(!(this._proto instanceof i.Bosh))throw{name:"StropheSessionError",message:'The "attach" method can only be used with a BOSH connection.'};this._proto._attach(a,b,c,d,e,f,g)},restore:function(a,b,c,d,e){if(!this._sessionCachingSupported())throw{name:"StropheSessionError",message:'The "restore" method can only be used with a BOSH connection.'};this._proto._restore(a,b,c,d,e)},_sessionCachingSupported:function(){if(this._proto instanceof i.Bosh){if(!JSON)return!1;try{window.sessionStorage.setItem("_strophe_","_strophe_"),window.sessionStorage.removeItem("_strophe_")}catch(a){return!1}return!0}return!1},xmlInput:function(a){},xmlOutput:function(a){},rawInput:function(a){},rawOutput:function(a){},nextValidRid:function(a){},send:function(a){if(null!==a){if("function"==typeof a.sort)for(var b=0;b=0&&this.addHandlers.splice(b,1)},disconnect:function(a){if(this._changeConnectStatus(i.Status.DISCONNECTING,a),i.info("Disconnect was called because: "+a),this.connected){var b=!1;this.disconnecting=!0,this.authenticated&&(b=h({xmlns:i.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(b)}else i.info("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests()},_changeConnectStatus:function(a,b){for(var c in i._connectionPlugins)if(i._connectionPlugins.hasOwnProperty(c)){var d=this[c];if(d.statusChanged)try{d.statusChanged(a,b)}catch(a){i.error(""+c+" plugin caused an exception changing status: "+a)}}if(this.connect_callback)try{this.connect_callback(a,b)}catch(a){i.error("User connection callback caused an exception: "+a)}},_doDisconnect:function(a){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),i.info("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(i.Status.DISCONNECTED,a),this.connected=!1},_dataRecv:function(a,b){i.info("_dataRecv called");var c=this._proto._reqToData(a);if(null!==c){this.xmlInput!==i.Connection.prototype.xmlInput&&(c.nodeName===this._proto.strip&&c.childNodes.length?this.xmlInput(c.childNodes[0]):this.xmlInput(c)),this.rawInput!==i.Connection.prototype.rawInput&&(b?this.rawInput(b):this.rawInput(i.serialize(c)));for(var d,e;this.removeHandlers.length>0;)e=this.removeHandlers.pop(),d=this.handlers.indexOf(e),d>=0&&this.handlers.splice(d,1);for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();var f,g,h=c.getAttribute("type");if(null!==h&&"terminate"==h){if(this.disconnecting)return;return f=c.getAttribute("condition"),g=c.getElementsByTagName("conflict"),null!==f?("remote-stream-error"==f&&g.length>0&&(f="conflict"),this._changeConnectStatus(i.Status.CONNFAIL,f)):this._changeConnectStatus(i.Status.CONNFAIL,"unknown"),void this._doDisconnect(f)}var j=this;i.forEachChild(c,null,function(a){var b,c;for(c=j.handlers,j.handlers=[],b=0;b0:d.getElementsByTagName("stream:features").length>0||d.getElementsByTagName("features").length>0;var g,h,j=d.getElementsByTagName("mechanism"),k=[],l=!1;if(!f)return void this._proto._no_auth_received(b);if(j.length>0)for(g=0;g0,(l=this._authentication.legacy_auth||k.length>0)?void(this.do_authentication!==!1&&this.authenticate(k)):void this._proto._no_auth_received(b)}}},authenticate:function(a){var c;for(c=0;ca[d].prototype.priority&&(d=f);if(d!=c){var h=a[c];a[c]=a[d],a[d]=h}}var j=!1;for(c=0;c0&&(b="conflict"),this._changeConnectStatus(i.Status.AUTHFAIL,b),!1}var d,e=a.getElementsByTagName("bind");return e.length>0?(d=e[0].getElementsByTagName("jid"),void(d.length>0&&(this.jid=i.getText(d[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send(g({type:"set",id:"_session_auth_2"}).c("session",{xmlns:i.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null))))):(i.info("SASL binding failed."),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1)},_sasl_session_cb:function(a){if("result"==a.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null);else if("error"==a.getAttribute("type"))return i.info("Session creation failed."),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1;return!1},_sasl_failure_cb:function(a){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1},_auth2_cb:function(a){return"result"==a.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null)):"error"==a.getAttribute("type")&&(this._changeConnectStatus(i.Status.AUTHFAIL,null),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(a,b){var c=new i.TimedHandler(a,b);return c.user=!1,this.addTimeds.push(c),c},_addSysHandler:function(a,b,c,d,e){var f=new i.Handler(a,b,c,d,e);return f.user=!1,this.addHandlers.push(f),f},_onDisconnectTimeout:function(){return i.info("_onDisconnectTimeout was called"),this._changeConnectStatus(i.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var a,b,c,d;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;)b=this.removeTimeds.pop(),a=this.timedHandlers.indexOf(b),a>=0&&this.timedHandlers.splice(a,1);var e=(new Date).getTime();for(d=[],a=0;a0&&(c="conflict"),this._conn._changeConnectStatus(a.Status.CONNFAIL,c)):this._conn._changeConnectStatus(a.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(c),a.Status.CONNFAIL;this.sid||(this.sid=b.getAttribute("sid"));var f=b.getAttribute("requests");f&&(this.window=parseInt(f,10));var g=b.getAttribute("hold");g&&(this.hold=parseInt(g,10));var h=b.getAttribute("wait");h&&(this.wait=parseInt(h,10))},_disconnect:function(a){this._sendTerminate(a)},_doDisconnect:function(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)},_emptyQueue:function(){return 0===this._requests.length},_hitError:function(b){this.errors++,a.warn("request errored, status: "+b+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()},_no_auth_received:function(b){b=b?b.bind(this._conn):this._conn._connect_cb.bind(this._conn);var c=this._buildBody();this._requests.push(new a.Request(c.tree(),this._onRequestStateChange.bind(this,b.bind(this._conn)),c.tree().getAttribute("rid"))),this._throttledRequestHandler()},_onDisconnectTimeout:function(){this._abortAllRequests()},_abortAllRequests:function(){for(var a;this._requests.length>0;)a=this._requests.pop(),a.abort=!0,a.xhr.abort(),a.xhr.onreadystatechange=function(){}},_onIdle:function(){var b=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===b.length&&!this._conn.disconnecting&&(a.info("no requests during idle cycle, sending blank request"),b.push(null)),!this._conn.paused){if(this._requests.length<2&&b.length>0){for(var c=this._buildBody(),d=0;d0){var e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(a.TIMEOUT*this.wait)&&(a.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(a.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_onRequestStateChange:function(b,c){if(a.debug("request id "+c.id+"."+c.sends+" state changed to "+c.xhr.readyState),c.abort)return void(c.abort=!1);var d;if(4==c.xhr.readyState){d=0;try{d=c.xhr.status}catch(a){}if("undefined"==typeof d&&(d=0),this.disconnecting&&d>=400)return void this._hitError(d);var e=this._requests[0]==c,f=this._requests[1]==c;(d>0&&d<500||c.sends>5)&&(this._removeRequest(c),a.debug("request id "+c.id+" should now be removed")),200==d?((f||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(a.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(c.rid)+1),a.debug("request id "+c.id+"."+c.sends+" got 200"),b(c),this.errors=0):(a.error("request id "+c.id+"."+c.sends+" error "+d+" happened"),(0===d||d>=400&&d<600||d>=12e3)&&(this._hitError(d),d>=400&&d<500&&(this._conn._changeConnectStatus(a.Status.DISCONNECTING,null),this._conn._doDisconnect()))),d>0&&d<500||c.sends>5||this._throttledRequestHandler()}},_processRequest:function(b){var c=this,d=this._requests[b],e=-1;try{4==d.xhr.readyState&&(e=d.xhr.status)}catch(c){a.error("caught an error in _requests["+b+"], reqStatus: "+e)}if("undefined"==typeof e&&(e=-1),d.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();var f=d.age(),g=!isNaN(f)&&f>Math.floor(a.TIMEOUT*this.wait),h=null!==d.dead&&d.timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait),i=4==d.xhr.readyState&&(e<1||e>=500);if((g||h||i)&&(h&&a.error("Request "+this._requests[b].id+" timed out (secondary), restarting"),d.abort=!0,d.xhr.abort(),d.xhr.onreadystatechange=function(){},this._requests[b]=new a.Request(d.xmlData,d.origFunc,d.rid,d.sends),d=this._requests[b]),0===d.xhr.readyState){a.debug("request id "+d.id+"."+d.sends+" posting");try{var j=this._conn.options.contentType||"text/xml; charset=utf-8";d.xhr.open("POST",this._conn.service,!this._conn.options.sync),d.xhr.setRequestHeader("Content-Type",j),this._conn.options.withCredentials&&(d.xhr.withCredentials=!0)}catch(b){return a.error("XHR open failed."),this._conn.connected||this._conn._changeConnectStatus(a.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var k=function(){if(d.date=new Date,c._conn.options.customHeaders){var a=c._conn.options.customHeaders;for(var b in a)a.hasOwnProperty(b)&&d.xhr.setRequestHeader(b,a[b])}d.xhr.send(d.data)};if(d.sends>1){var l=1e3*Math.min(Math.floor(a.TIMEOUT*this.wait),Math.pow(d.sends,3));setTimeout(function(){k()},l)}else k();d.sends++,this._conn.xmlOutput!==a.Connection.prototype.xmlOutput&&(d.xmlData.nodeName===this.strip&&d.xmlData.childNodes.length?this._conn.xmlOutput(d.xmlData.childNodes[0]):this._conn.xmlOutput(d.xmlData)),this._conn.rawOutput!==a.Connection.prototype.rawOutput&&this._conn.rawOutput(d.data)}else a.debug("_processRequest: "+(0===b?"first":"second")+" request has readyState of "+d.xhr.readyState)},_removeRequest:function(b){a.debug("removing request");var c;for(c=this._requests.length-1;c>=0;c--)b==this._requests[c]&&this._requests.splice(c,1);b.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(a){var b=this._requests[a];null===b.dead&&(b.dead=new Date),this._processRequest(a)},_reqToData:function(a){try{return a.getResponse()}catch(a){if("parsererror"!=a)throw a;this._conn.disconnect("strophe-parsererror")}},_sendTerminate:function(b){a.info("_sendTerminate was called");var c=this._buildBody().attrs({type:"terminate"});b&&c.cnode(b.tree());var d=new a.Request(c.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),c.tree().getAttribute("rid"));this._requests.push(d),this._throttledRequestHandler()},_send:function(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this._conn),100)},_sendRestart:function(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)},_throttledRequestHandler:function(){this._requests?a.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):a.debug("_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid): "+d);var e=b.getAttribute("version");return"string"!=typeof e?c="Missing version in ":"1.0"!==e&&(c="Wrong version in : "+e),!c||(this._conn._changeConnectStatus(a.Status.CONNFAIL,c),this._conn._doDisconnect(),!1)},_connect_cb_wrapper:function(b){if(0===b.data.indexOf("\s*)*/,"");if(""===c)return;var d=(new DOMParser).parseFromString(c,"text/xml").documentElement;this._conn.xmlInput(d),this._conn.rawInput(b.data),this._handleStreamStart(d)&&this._connect_cb(d)}else if(0===b.data.indexOf(" tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){a.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(a){return""+a+""},_closeSocket:function(){if(this.socket)try{this.socket.close()}catch(a){}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(){this._conn.connected&&!this._conn.disconnecting?(a.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):a.info("Websocket closed")},_no_auth_received:function(b){a.error("Server did not send any auth methods"),this._conn._changeConnectStatus(a.Status.CONNFAIL,"Server did not send any auth methods"),b&&(b=b.bind(this._conn))(),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(b){a.error("Websocket error "+b),this._conn._changeConnectStatus(a.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()},_onIdle:function(){var b=this._conn._data;if(b.length>0&&!this._conn.paused){for(var c=0;c=0||a.indexOf(">")>=0||a.indexOf("<")>=0},m=function(a){return""},e=function(a){return a.replace("]]>","]]]]>")},c.processors=i,c.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}},c.ValidationError=function(a){function b(a){this.message=a}return n(b,a),b}(Error),c.Builder=function(){function a(a){var b,d,e;this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e)}return a.prototype.buildObject=function(a){var b,e,f,g,h;return b=this.options.attrkey,e=this.options.charkey,1===Object.keys(a).length&&this.options.rootName===c.defaults[.2].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,f=function(a){return function(c,d){var g,h,i,k,l,n;if("object"!=typeof d)a.options.cdata&&j(d)?c.raw(m(d)):c.txt(d);else for(l in d)if(o.call(d,l))if(h=d[l],l===b){if("object"==typeof h)for(g in h)n=h[g],c=c.att(g,n)}else if(l===e)c=a.options.cdata&&j(h)?c.raw(m(h)):c.txt(h);else if(Array.isArray(h))for(k in h)o.call(h,k)&&(i=h[k],c="string"==typeof i?a.options.cdata&&j(i)?c.ele(l).raw(m(i)).up():c.ele(l,i).up():f(c.ele(l),i).up());else"object"==typeof h?c=f(c.ele(l),h).up():"string"==typeof h&&a.options.cdata&&j(h)?c=c.ele(l).raw(m(h)).up():(null==h&&(h=""),c=c.ele(l,h.toString()).up());return c}}(this),g=d.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),f(g,a).end(this.options.renderOpts)},a}(),c.Parser=function(a){function d(a){this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var b,d,e;if(!(this instanceof c.Parser))return new c.Parser(a);this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return n(d,a),d.prototype.processAsync=function(){var a,b;try{return this.remaining.length<=this.options.chunkSize?(a=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(a),this.saxParser.close()):(a=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(a),l(this.processAsync))}catch(a){if(b=a,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(b)}},d.prototype.assignOrPush=function(a,b,c){return b in a?(a[b]instanceof Array||(a[b]=[a[b]]),a[b].push(c)):this.options.explicitArray?a[b]=[c]:a[b]=c},d.prototype.reset=function(){var a,b,c,d;return this.removeAllListeners(),this.saxParser=k.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(a){return function(b){if(a.saxParser.resume(),!a.saxParser.errThrown)return a.saxParser.errThrown=!0,a.emit("error",b)}}(this),this.saxParser.onend=function(a){return function(){if(!a.saxParser.ended)return a.saxParser.ended=!0,a.emit("end",a.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],a=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(c){return function(e){var f,g,i,j,k;if(i={},i[b]="",!c.options.ignoreAttrs){k=e.attributes;for(f in k)o.call(k,f)&&(a in i||c.options.mergeAttrs||(i[a]={}),g=c.options.attrValueProcessors?h(c.options.attrValueProcessors,e.attributes[f]):e.attributes[f],j=c.options.attrNameProcessors?h(c.options.attrNameProcessors,f):f,c.options.mergeAttrs?c.assignOrPush(i,j,g):i[a][j]=g)}return i["#name"]=c.options.tagNameProcessors?h(c.options.tagNameProcessors,e.name):e.name,c.options.xmlns&&(i[c.options.xmlnskey]={uri:e.uri,local:e.local}),d.push(i)}}(this),this.saxParser.onclosetag=function(a){return function(){var c,e,f,i,j,k,l,m,n,p,q;if(l=d.pop(),k=l["#name"],a.options.explicitChildren&&a.options.preserveChildrenOrder||delete l["#name"],l.cdata===!0&&(c=l.cdata, -delete l.cdata),p=d[d.length-1],l[b].match(/^\s*$/)&&!c?(e=l[b],delete l[b]):(a.options.trim&&(l[b]=l[b].trim()),a.options.normalize&&(l[b]=l[b].replace(/\s{2,}/g," ").trim()),l[b]=a.options.valueProcessors?h(a.options.valueProcessors,l[b]):l[b],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])),g(l)&&(l=""!==a.options.emptyTag?a.options.emptyTag:e),null!=a.options.validator){q="/"+function(){var a,b,c;for(c=[],a=0,b=d.length;a0&&(j[a.options.childkey]=l),l=j;return d.length>0?a.assignOrPush(p,k,l):(a.options.explicitRoot&&(n=l,l={},l[k]=n),a.resultObject=l,a.saxParser.ended=!0,a.emit("end",a.resultObject))}}(this),c=function(a){return function(c){var e,f;if(f=d[d.length-1])return f[b]+=c,a.options.explicitChildren&&a.options.preserveChildrenOrder&&a.options.charsAsChildren&&(a.options.includeWhiteChars||""!==c.replace(/\\n/g,"").trim())&&(f[a.options.childkey]=f[a.options.childkey]||[],e={"#name":"__text__"},e[b]=c,a.options.normalize&&(e[b]=e[b].replace(/\s{2,}/g," ").trim()),f[a.options.childkey].push(e)),f}}(this),this.saxParser.ontext=c,this.saxParser.oncdata=function(a){return function(a){var b;if(b=c(a))return b.cdata=!0}}(this)},d.prototype.parseString=function(a,c){var d;null!=c&&"function"==typeof c&&(this.on("end",function(a){return this.reset(),c(null,a)}),this.on("error",function(a){return this.reset(),c(a)}));try{return a=a.toString(),""===a.trim()?(this.emit("end",null),!0):(a=b.stripBOM(a),this.options.async?(this.remaining=a,l(this.processAsync),this.saxParser):this.saxParser.write(a).close())}catch(a){if(d=a,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",d),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw d}},d}(f.EventEmitter),c.parseString=function(a,b,d){var e,f,g;return null!=d?("function"==typeof d&&(e=d),"object"==typeof b&&(f=b)):("function"==typeof b&&(e=b),f={}),g=new c.Parser(f),g.parseString(a,e)}}).call(this)},{"./bom":283,"./processors":284,events:204,sax:286,timers:222,xmlbuilder:303}],286:[function(a,b,c){(function(b){!function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);var e=this;f(e),e.q=e.c="",e.bufferCheckPosition=c.MAX_BUFFER_LENGTH,e.opt=b||{},e.opt.lowercase=e.opt.lowercase||e.opt.lowercasetags,e.looseCase=e.opt.lowercase?"toLowerCase":"toUpperCase",e.tags=[],e.closed=e.closedRoot=e.sawRoot=!1,e.tag=e.error=null,e.strict=!!a,e.noscript=!(!a&&!e.opt.noscript),e.state=U.BEGIN,e.strictEntities=e.opt.strictEntities,e.ENTITIES=e.strictEntities?Object.create(c.XML_ENTITIES):Object.create(c.ENTITIES),e.attribList=[],e.opt.xmlns&&(e.ns=Object.create(P)),e.trackPosition=e.opt.position!==!1,e.trackPosition&&(e.position=e.line=e.column=0),n(e,"onready")}function e(a){for(var b=Math.max(c.MAX_BUFFER_LENGTH,10),d=0,e=0,f=D.length;eb)switch(D[e]){case"textNode":p(a);break;case"cdata":o(a,"oncdata",a.cdata),a.cdata="";break;case"script":o(a,"onscript",a.script),a.script="";break;default:r(a,"Max buffer length exceeded: "+D[e])}d=Math.max(d,g)}var h=c.MAX_BUFFER_LENGTH-d;a.bufferCheckPosition=h+a.position}function f(a){for(var b=0,c=D.length;b",a.tagName="",void(a.state=U.SCRIPT);o(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){var e=a.tags[b];if(e.name===d)break;t(a,"Unexpected close tag")}if(b<0)return t(a,"Unmatched closing tag: "+a.tagName),a.textNode+="",void(a.state=U.TEXT);a.tagName=c;for(var f=a.tags.length;f-- >b;){var g=a.tag=a.tags.pop();a.tagName=a.tag.name,o(a,"onclosetag",a.tagName);var h={};for(var i in g.ns)h[i]=g.ns[i];var j=a.tags[a.tags.length-1]||a;a.opt.xmlns&&g.ns!==j.ns&&Object.keys(g.ns).forEach(function(b){var c=g.ns[b];o(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=U.TEXT}function z(a){var b,c=a.entity,d=c.toLowerCase(),e="";return a.ENTITIES[c]?a.ENTITIES[c]:a.ENTITIES[d]?a.ENTITIES[d]:(c=d,"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),b=parseInt(c,16),e=b.toString(16)):(c=c.slice(1),b=parseInt(c,10),e=b.toString(10))),c=c.replace(/^0+/,""),e.toLowerCase()!==c?(t(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(b))}function A(a,b){"<"===b?(a.state=U.OPEN_WAKA,a.startTagPosition=a.position):m(G,b)&&(t(a,"Non-whitespace before first tag."),a.textNode=b,a.state=U.TEXT)}function B(a,b){var c="";return b"===d?(o(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=U.TEXT):l(J,d)?(b.state=U.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case U.SGML_DECL_QUOTED:d===b.q&&(b.state=U.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case U.DOCTYPE:">"===d?(b.state=U.TEXT,o(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=U.DOCTYPE_DTD:l(J,d)&&(b.state=U.DOCTYPE_QUOTED,b.q=d));continue;case U.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=U.DOCTYPE);continue;case U.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=U.DOCTYPE:l(J,d)&&(b.state=U.DOCTYPE_DTD_QUOTED,b.q=d);continue;case U.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=U.DOCTYPE_DTD,b.q="");continue;case U.COMMENT:"-"===d?b.state=U.COMMENT_ENDING:b.comment+=d;continue;case U.COMMENT_ENDING:"-"===d?(b.state=U.COMMENT_ENDED,b.comment=q(b.opt,b.comment),b.comment&&o(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=U.COMMENT);continue;case U.COMMENT_ENDED:">"!==d?(t(b,"Malformed comment"),b.comment+="--"+d,b.state=U.COMMENT):b.state=U.TEXT;continue;case U.CDATA:"]"===d?b.state=U.CDATA_ENDING:b.cdata+=d;continue;case U.CDATA_ENDING:"]"===d?b.state=U.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=U.CDATA);continue;case U.CDATA_ENDING_2:">"===d?(b.cdata&&o(b,"oncdata",b.cdata),o(b,"onclosecdata"),b.cdata="",b.state=U.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=U.CDATA);continue;case U.PROC_INST:"?"===d?b.state=U.PROC_INST_ENDING:l(G,d)?b.state=U.PROC_INST_BODY:b.procInstName+=d;continue;case U.PROC_INST_BODY:if(!b.procInstBody&&l(G,d))continue;"?"===d?b.state=U.PROC_INST_ENDING:b.procInstBody+=d;continue;case U.PROC_INST_ENDING:">"===d?(o(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=U.TEXT):(b.procInstBody+="?"+d,b.state=U.PROC_INST_BODY);continue;case U.OPEN_TAG:l(R,d)?b.tagName+=d:(u(b),">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:(m(G,d)&&t(b,"Invalid character in tag name"),b.state=U.ATTRIB));continue;case U.OPEN_TAG_SLASH:">"===d?(x(b,!0),y(b)):(t(b,"Forward-slash in opening tag not followed by >"),b.state=U.ATTRIB);continue;case U.ATTRIB:if(l(G,d))continue;">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME:"="===d?b.state=U.ATTRIB_VALUE:">"===d?(t(b,"Attribute without value"),b.attribValue=b.attribName,w(b),x(b)):l(G,d)?b.state=U.ATTRIB_NAME_SAW_WHITE:l(R,d)?b.attribName+=d:t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=U.ATTRIB_VALUE;else{if(l(G,d))continue;t(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",o(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?x(b):l(Q,d)?(b.attribName=d,b.state=U.ATTRIB_NAME):(t(b,"Invalid attribute name"),b.state=U.ATTRIB)}continue;case U.ATTRIB_VALUE:if(l(G,d))continue;l(J,d)?(b.q=d,b.state=U.ATTRIB_VALUE_QUOTED):(t(b,"Unquoted attribute value"),b.state=U.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case U.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}w(b),b.q="",b.state=U.ATTRIB_VALUE_CLOSED;continue;case U.ATTRIB_VALUE_CLOSED:l(G,d)?b.state=U.ATTRIB:">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(t(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_VALUE_UNQUOTED:if(m(K,d)){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}w(b),">"===d?x(b):b.state=U.ATTRIB;continue;case U.CLOSE_TAG:if(b.tagName)">"===d?y(b):l(R,d)?b.tagName+=d:b.script?(b.script+=""===d?y(b):t(b,"Invalid characters in closing tag");continue;case U.TEXT_ENTITY:case U.ATTRIB_VALUE_ENTITY_Q:case U.ATTRIB_VALUE_ENTITY_U:var h,i;switch(b.state){case U.TEXT_ENTITY:h=U.TEXT,i="textNode";break;case U.ATTRIB_VALUE_ENTITY_Q:h=U.ATTRIB_VALUE_QUOTED,i="attribValue";break;case U.ATTRIB_VALUE_ENTITY_U:h=U.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=z(b),b.entity="",b.state=h):l(b.entity.length?T:S,d)?b.entity+=d:(t(b,"Invalid character in entity name"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}}return b.position>=b.bufferCheckPosition&&e(b),b}c.parser=function(a,b){return new d(a,b)},c.SAXParser=d,c.SAXStream=i,c.createStream=h,c.MAX_BUFFER_LENGTH=65536;var D=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];c.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){}b.prototype=a;var c=new b;return c}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),d.prototype={end:function(){s(this)},write:C,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){g(this)}};var E;try{E=a("stream").Stream}catch(a){E=function(){}}var F=c.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});i.prototype=Object.create(E.prototype,{constructor:{value:i}}),i.prototype.write=function(c){if("function"==typeof b&&"function"==typeof b.isBuffer&&b.isBuffer(c)){if(!this._decoder){var d=a("string_decoder").StringDecoder;this._decoder=new d("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},i.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},i.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||F.indexOf(a)===-1||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),E.prototype.on.call(c,a,b)};var G="\r\n\t ",H="0124356789",I="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",J="'\"",K=G+">",L="[CDATA[",M="DOCTYPE",N="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",P={xml:N,xmlns:O};G=j(G),H=j(H),I=j(I);var Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;J=j(J),K=j(K);var U=0;c.STATE={BEGIN:U++,BEGIN_WHITESPACE:U++,TEXT:U++,TEXT_ENTITY:U++,OPEN_WAKA:U++,SGML_DECL:U++,SGML_DECL_QUOTED:U++,DOCTYPE:U++,DOCTYPE_QUOTED:U++,DOCTYPE_DTD:U++,DOCTYPE_DTD_QUOTED:U++,COMMENT_STARTING:U++,COMMENT:U++,COMMENT_ENDING:U++,COMMENT_ENDED:U++,CDATA:U++,CDATA_ENDING:U++,CDATA_ENDING_2:U++,PROC_INST:U++,PROC_INST_BODY:U++,PROC_INST_ENDING:U++,OPEN_TAG:U++,OPEN_TAG_SLASH:U++,ATTRIB:U++,ATTRIB_NAME:U++,ATTRIB_NAME_SAW_WHITE:U++,ATTRIB_VALUE:U++,ATTRIB_VALUE_QUOTED:U++,ATTRIB_VALUE_CLOSED:U++,ATTRIB_VALUE_UNQUOTED:U++,ATTRIB_VALUE_ENTITY_Q:U++,ATTRIB_VALUE_ENTITY_U:U++,CLOSE_TAG:U++,CLOSE_TAG_SAW_WHITE:U++,SCRIPT:U++,SCRIPT_ENDING:U++},c.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(c.ENTITIES).forEach(function(a){var b=c.ENTITIES[a],d="number"==typeof b?String.fromCharCode(b):b;c.ENTITIES[a]=d});for(var V in c.STATE)c.STATE[c.STATE[V]]=V;U=c.STATE,String.fromCodePoint||!function(){var a=String.fromCharCode,b=Math.floor,c=function(){var c,d,e=16384,f=[],g=-1,h=arguments.length;if(!h)return"";for(var i="";++g1114111||b(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?f.push(j):(j-=65536,c=(j>>10)+55296,d=j%1024+56320,f.push(c,d)),(g+1===h||f.length>e)&&(i+=a.apply(null,f),f.length=0)}return i};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:c,configurable:!0,writable:!0}):String.fromCodePoint=c}()}("undefined"==typeof c?this.sax={}:c)}).call(this,a("buffer").Buffer)},{buffer:8,stream:220,string_decoder:221}],287:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing attribute name of element "+a.name);if(null==c)throw new Error("Missing attribute value for attribute "+b+" of element "+a.name);this.name=this.stringify.attName(b),this.value=this.stringify.attValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){return" "+this.name+'="'+this.value+'"'},a}()}).call(this)},{"lodash/create":400}],288:[function(a,b,c){(function(){var c,d,e,f,g;g=a("./XMLStringifier"),d=a("./XMLDeclaration"),e=a("./XMLDocType"),f=a("./XMLElement"),b.exports=c=function(){function a(a,b){var c,d;if(null==a)throw new Error("Root element needs a name");null==b&&(b={}),this.options=b,this.stringify=new g(b),d=new f(this,"doc"),c=d.element(a),c.isRoot=!0,c.documentObject=this,this.rootObject=c,b.headless||(c.declaration(b),null==b.pubID&&null==b.sysID||c.doctype(b))}return a.prototype.root=function(){return this.rootObject},a.prototype.end=function(a){return this.toString(a)},a.prototype.toString=function(a){var b,c,d,e,f,g,h,i;return e=(null!=a?a.pretty:void 0)||!1,b=null!=(g=null!=a?a.indent:void 0)?g:" ",d=null!=(h=null!=a?a.offset:void 0)?h:0,c=null!=(i=null!=a?a.newline:void 0)?i:"\n",f="",null!=this.xmldec&&(f+=this.xmldec.toString(a)),null!=this.doctype&&(f+=this.doctype.toString(a)),f+=this.rootObject.toString(a),e&&f.slice(-c.length)===c&&(f=f.slice(0,-c.length)),f},a}()}).call(this)},{"./XMLDeclaration":295,"./XMLDocType":296,"./XMLElement":297,"./XMLStringifier":301}],289:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400}],290:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing comment text");this.text=this.stringify.comment(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400}],291:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c,d,e,f){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");if(null==c)throw new Error("Missing DTD attribute name");if(!d)throw new Error("Missing DTD attribute type");if(!e)throw new Error("Missing DTD attribute default");if(0!==e.indexOf("#")&&(e="#"+e),!e.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(f&&!e.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(b),this.attributeName=this.stringify.attName(c),this.attributeType=this.stringify.dtdAttType(d),this.defaultValue=this.stringify.dtdAttDefault(f),this.defaultValueType=e}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],292:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.eleName(b),this.value=this.stringify.dtdElementValue(c)}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],293:[function(a,b,c){(function(){var c,d,e;d=a("lodash/create"),e=a("lodash/isObject"),b.exports=c=function(){function a(a,b,c,d){if(this.stringify=a.stringify,null==c)throw new Error("Missing entity name");if(null==d)throw new Error("Missing entity value");if(this.pe=!!b,this.name=this.stringify.eleName(c),e(d)){if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity");if(null!=d.pubID&&(this.pubID=this.stringify.dtdPubID(d.pubID)),null!=d.sysID&&(this.sysID=this.stringify.dtdSysID(d.sysID)),null!=d.nData&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}else this.value=this.stringify.dtdEntityValue(d)}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400,"lodash/isObject":414}],294:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing notation name");if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(b),null!=c.pubID&&(this.pubID=this.stringify.dtdPubID(c.pubID)),null!=c.sysID&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],295:[function(a,b,c){(function(){var c,d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("lodash/create"),f=a("lodash/isObject"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c,d,e){var g;b.__super__.constructor.call(this,a),f(c)&&(g=c,c=g.version,d=g.encoding,e=g.standalone),c||(c="1.0"),this.version=this.stringify.xmlVersion(c),null!=d&&(this.encoding=this.stringify.xmlEncoding(d)),null!=e&&(this.standalone=this.stringify.xmlStandalone(e))}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400,"lodash/isObject":414}],296:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l;k=a("lodash/create"),l=a("lodash/isObject"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDTDAttList"),g=a("./XMLDTDEntity"),f=a("./XMLDTDElement"),h=a("./XMLDTDNotation"),j=a("./XMLProcessingInstruction"),b.exports=i=function(){function a(a,b,c){var d,e;this.documentObject=a,this.stringify=this.documentObject.stringify,this.children=[],l(b)&&(d=b,b=d.pubID,c=d.sysID),null==c&&(e=[b,c],c=e[0],b=e[1]),null!=b&&(this.pubID=this.stringify.dtdPubID(b)),null!=c&&(this.sysID=this.stringify.dtdSysID(c))}return a.prototype.element=function(a,b){var c;return c=new f(this,a,b),this.children.push(c),this},a.prototype.attList=function(a,b,c,d,f){var g;return g=new e(this,a,b,c,d,f),this.children.push(g),this},a.prototype.entity=function(a,b){var c;return c=new g(this,(!1),a,b), -this.children.push(c),this},a.prototype.pEntity=function(a,b){var c;return c=new g(this,(!0),a,b),this.children.push(c),this},a.prototype.notation=function(a,b){var c;return c=new h(this,a,b),this.children.push(c),this},a.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},a.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},a.prototype.instruction=function(a,b){var c;return c=new j(this,a,b),this.children.push(c),this},a.prototype.root=function(){return this.documentObject.root()},a.prototype.document=function(){return this.documentObject},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(i=(null!=a?a.pretty:void 0)||!1,e=null!=(k=null!=a?a.indent:void 0)?k:" ",h=null!=(l=null!=a?a.offset:void 0)?l:0,g=null!=(m=null!=a?a.newline:void 0)?m:"\n",b||(b=0),o=new Array(b+h+1).join(e),j="",i&&(j+=o),j+="0){for(j+=" [",i&&(j+=g),n=this.children,d=0,f=n.length;d",p&&(q+=n);else if(p&&1===this.children.length&&null!=this.children[0].value)q+=">",q+=this.children[0].value,q+="",q+=n;else{for(q+=">",p&&(q+=n),w=this.children,i=0,k=w.length;i",p&&(q+=n)}return q},b.prototype.att=function(a,b){return this.attribute(a,b)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.a=function(a,b){return this.attribute(a,b)},b.prototype.i=function(a,b){return this.instruction(a,b)},b}(e)}).call(this)},{"./XMLAttribute":287,"./XMLNode":298,"./XMLProcessingInstruction":299,"lodash/create":400,"lodash/every":402,"lodash/isFunction":412,"lodash/isObject":414}],298:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l,m,n={}.hasOwnProperty;m=a("lodash/isObject"),l=a("lodash/isFunction"),k=a("lodash/isEmpty"),g=null,c=null,d=null,e=null,f=null,i=null,j=null,b.exports=h=function(){function b(b){this.parent=b,this.options=this.parent.options,this.stringify=this.parent.stringify,null===g&&(g=a("./XMLElement"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDeclaration"),f=a("./XMLDocType"),i=a("./XMLRaw"),j=a("./XMLText"))}return b.prototype.element=function(a,b,c){var d,e,f,g,h,i,j,o,p,q;if(i=null,null==b&&(b={}),b=b.valueOf(),m(b)||(p=[b,c],c=p[0],b=p[1]),null!=a&&(a=a.valueOf()),Array.isArray(a))for(f=0,j=a.length;f/))throw new Error("Invalid CDATA text: "+a);return this.assertLegalChar(a)},a.prototype.comment=function(a){if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(a)},a.prototype.raw=function(a){return""+a||""},a.prototype.attName=function(a){return""+a||""},a.prototype.attValue=function(a){return a=""+a||"",this.attEscape(a)},a.prototype.insTarget=function(a){return""+a||""},a.prototype.insValue=function(a){if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return a},a.prototype.xmlVersion=function(a){if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},a.prototype.xmlEncoding=function(a){if(a=""+a||"",!a.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/))throw new Error("Invalid encoding: "+a);return a},a.prototype.xmlStandalone=function(a){return a?"yes":"no"},a.prototype.dtdPubID=function(a){return""+a||""},a.prototype.dtdSysID=function(a){return""+a||""},a.prototype.dtdElementValue=function(a){return""+a||""},a.prototype.dtdAttType=function(a){return""+a||""},a.prototype.dtdAttDefault=function(a){return null!=a?""+a||"":a},a.prototype.dtdEntityValue=function(a){return""+a||""},a.prototype.dtdNData=function(a){return""+a||""},a.prototype.convertAttKey="@",a.prototype.convertPIKey="?",a.prototype.convertTextKey="#text",a.prototype.convertCDataKey="#cdata",a.prototype.convertCommentKey="#comment",a.prototype.convertRawKey="#raw",a.prototype.assertLegalChar=function(a){var b,c;if(b=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,c=a.match(b))throw new Error("Invalid character ("+c+") in string: "+a+" at index "+c.index);return a},a.prototype.elEscape=function(a){var b;return b=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(b,"&").replace(//g,">").replace(/\r/g," ")},a.prototype.attEscape=function(a){var b;return b=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(b,"&").replace(/1?c[f-1]:void 0,h=f>2?c[2]:void 0;for(g=a.length>3&&"function"==typeof g?(f--,g):void 0,h&&e(c[0],c[1],h)&&(g=f<3?void 0:g,f=1),b=Object(b);++dl))return!1;var n=j.get(a);if(n)return n==b;var o=-1,p=!0,q=i&g?new e:void 0;for(j.set(a,b);++o-1&&a%1==0&&a-1}var e=a("./_assocIndexOf");b.exports=d},{"./_assocIndexOf":320}],378:[function(a,b,c){function d(a,b){var c=this.__data__,d=e(c,a);return d<0?c.push([a,b]):c[d][1]=b,this}var e=a("./_assocIndexOf");b.exports=d},{"./_assocIndexOf":320}],379:[function(a,b,c){function d(){this.__data__={hash:new e,map:new(g||f),string:new e}}var e=a("./_Hash"),f=a("./_ListCache"),g=a("./_Map");b.exports=d},{"./_Hash":305,"./_ListCache":306,"./_Map":307}],380:[function(a,b,c){function d(a){return e(this,a).delete(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],381:[function(a,b,c){function d(a){return e(this,a).get(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],382:[function(a,b,c){function d(a){return e(this,a).has(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],383:[function(a,b,c){function d(a,b){return e(this,a).set(a,b),this}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],384:[function(a,b,c){function d(a){var b=-1,c=Array(a.size);return a.forEach(function(a,d){c[++b]=[d,a]}),c}b.exports=d},{}],385:[function(a,b,c){function d(a,b){return function(c){return null!=c&&(c[a]===b&&(void 0!==b||a in Object(c)))}}b.exports=d},{}],386:[function(a,b,c){var d=a("./_getNative"),e=d(Object,"create");b.exports=e},{"./_getNative":355}],387:[function(a,b,c){(function(c){var d=a("./_checkGlobal"),e=d("object"==typeof c&&c),f=d("object"==typeof self&&self),g=d("object"==typeof this&&this),h=e||f||g||Function("return this")();b.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_checkGlobal":343}],388:[function(a,b,c){function d(a){return this.__data__.set(a,e),this}var e="__lodash_hash_undefined__";b.exports=d},{}],389:[function(a,b,c){function d(a){return this.__data__.has(a)}b.exports=d},{}],390:[function(a,b,c){function d(a){var b=-1,c=Array(a.size);return a.forEach(function(a){c[++b]=a}),c}b.exports=d},{}],391:[function(a,b,c){function d(){this.__data__=new e}var e=a("./_ListCache");b.exports=d},{"./_ListCache":306}],392:[function(a,b,c){function d(a){return this.__data__.delete(a)}b.exports=d},{}],393:[function(a,b,c){function d(a){return this.__data__.get(a)}b.exports=d},{}],394:[function(a,b,c){function d(a){return this.__data__.has(a)}b.exports=d},{}],395:[function(a,b,c){function d(a,b){var c=this.__data__;return c instanceof e&&c.__data__.length==g&&(c=this.__data__=new f(c.__data__)),c.set(a,b),this}var e=a("./_ListCache"),f=a("./_MapCache"),g=200;b.exports=d},{"./_ListCache":306,"./_MapCache":308}],396:[function(a,b,c){var d=a("./memoize"),e=a("./toString"),f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,g=/\\(\\)?/g,h=d(function(a){var b=[];return e(a).replace(f,function(a,c,d,e){b.push(d?e.replace(g,"$1"):c||a)}),b});b.exports=h},{"./memoize":420,"./toString":427}],397:[function(a,b,c){function d(a){if("string"==typeof a||e(a))return a;var b=a+"";return"0"==b&&1/a==-f?"-0":b}var e=a("./isSymbol"),f=1/0;b.exports=d},{"./isSymbol":417}],398:[function(a,b,c){function d(a){if(null!=a){try{return e.call(a)}catch(a){}try{return a+""}catch(a){}}return""}var e=Function.prototype.toString;b.exports=d},{}],399:[function(a,b,c){var d=a("./_assignValue"),e=a("./_copyObject"),f=a("./_createAssigner"),g=a("./isArrayLike"),h=a("./_isPrototype"),i=a("./keys"),j=Object.prototype,k=j.hasOwnProperty,l=j.propertyIsEnumerable,m=!l.call({valueOf:1},"valueOf"),n=f(function(a,b){if(m||h(b)||g(b))return void e(b,i(b),a);for(var c in b)k.call(b,c)&&d(a,c,b[c])});b.exports=n},{"./_assignValue":319,"./_copyObject":344,"./_createAssigner":346,"./_isPrototype":372,"./isArrayLike":408,"./keys":419}],400:[function(a,b,c){function d(a,b){var c=f(a);return b?e(c,b):c}var e=a("./_baseAssign"),f=a("./_baseCreate");b.exports=d},{"./_baseAssign":321,"./_baseCreate":322}],401:[function(a,b,c){function d(a,b){return a===b||a!==a&&b!==b}b.exports=d},{}],402:[function(a,b,c){function d(a,b,c){var d=h(a)?e:f;return c&&i(a,b,c)&&(b=void 0),d(a,g(b,3))}var e=a("./_arrayEvery"),f=a("./_baseEvery"),g=a("./_baseIteratee"),h=a("./isArray"),i=a("./_isIterateeCall");b.exports=d},{"./_arrayEvery":317,"./_baseEvery":324,"./_baseIteratee":334,"./_isIterateeCall":368,"./isArray":407}],403:[function(a,b,c){function d(a,b,c){var d=null==a?void 0:e(a,b);return void 0===d?c:d}var e=a("./_baseGet");b.exports=d},{"./_baseGet":327}],404:[function(a,b,c){function d(a,b){return null!=a&&f(a,b,e)}var e=a("./_baseHasIn"),f=a("./_hasPath");b.exports=d},{"./_baseHasIn":329,"./_hasPath":359}],405:[function(a,b,c){function d(a){return a}b.exports=d},{}],406:[function(a,b,c){function d(a){return e(a)&&h.call(a,"callee")&&(!j.call(a,"callee")||i.call(a)==f)}var e=a("./isArrayLikeObject"),f="[object Arguments]",g=Object.prototype,h=g.hasOwnProperty,i=g.toString,j=g.propertyIsEnumerable;b.exports=d},{"./isArrayLikeObject":409}],407:[function(a,b,c){var d=Array.isArray;b.exports=d},{}],408:[function(a,b,c){function d(a){return null!=a&&g(e(a))&&!f(a)}var e=a("./_getLength"),f=a("./isFunction"),g=a("./isLength");b.exports=d},{"./_getLength":352,"./isFunction":412,"./isLength":413}],409:[function(a,b,c){function d(a){return f(a)&&e(a)}var e=a("./isArrayLike"),f=a("./isObjectLike");b.exports=d},{"./isArrayLike":408,"./isObjectLike":415}],410:[function(a,b,c){var d=a("./_root"),e=a("./stubFalse"),f="object"==typeof c&&c,g=f&&"object"==typeof b&&b,h=g&&g.exports===f,i=h?d.Buffer:void 0,j=i?function(a){return a instanceof i}:e;b.exports=j},{"./_root":387,"./stubFalse":423}],411:[function(a,b,c){function d(a){if(h(a)&&(g(a)||l(a)||j(a.splice)||f(a)||i(a)))return!a.length;if(k(a)){var b=e(a);if(b==n||b==o)return!a.size}for(var c in a)if(q.call(a,c))return!1;return!(s&&m(a).length)}var e=a("./_getTag"),f=a("./isArguments"),g=a("./isArray"),h=a("./isArrayLike"),i=a("./isBuffer"),j=a("./isFunction"),k=a("./isObjectLike"),l=a("./isString"),m=a("./keys"),n="[object Map]",o="[object Set]",p=Object.prototype,q=p.hasOwnProperty,r=p.propertyIsEnumerable,s=!r.call({valueOf:1},"valueOf");b.exports=d},{"./_getTag":357,"./isArguments":406,"./isArray":407,"./isArrayLike":408,"./isBuffer":410,"./isFunction":412,"./isObjectLike":415,"./isString":416,"./keys":419}],412:[function(a,b,c){function d(a){var b=e(a)?i.call(a):"";return b==f||b==g}var e=a("./isObject"),f="[object Function]",g="[object GeneratorFunction]",h=Object.prototype,i=h.toString;b.exports=d},{"./isObject":414}],413:[function(a,b,c){function d(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=e}var e=9007199254740991;b.exports=d},{}],414:[function(a,b,c){function d(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}b.exports=d},{}],415:[function(a,b,c){function d(a){return!!a&&"object"==typeof a}b.exports=d},{}],416:[function(a,b,c){function d(a){return"string"==typeof a||!e(a)&&f(a)&&i.call(a)==g}var e=a("./isArray"),f=a("./isObjectLike"),g="[object String]",h=Object.prototype,i=h.toString;b.exports=d},{"./isArray":407,"./isObjectLike":415}],417:[function(a,b,c){function d(a){return"symbol"==typeof a||e(a)&&h.call(a)==f}var e=a("./isObjectLike"),f="[object Symbol]",g=Object.prototype,h=g.toString;b.exports=d},{"./isObjectLike":415}],418:[function(a,b,c){function d(a){return f(a)&&e(a.length)&&!!E[G.call(a)]}var e=a("./isLength"),f=a("./isObjectLike"),g="[object Arguments]",h="[object Array]",i="[object Boolean]",j="[object Date]",k="[object Error]",l="[object Function]",m="[object Map]",n="[object Number]",o="[object Object]",p="[object RegExp]",q="[object Set]",r="[object String]",s="[object WeakMap]",t="[object ArrayBuffer]",u="[object DataView]",v="[object Float32Array]",w="[object Float64Array]",x="[object Int8Array]",y="[object Int16Array]",z="[object Int32Array]",A="[object Uint8Array]",B="[object Uint8ClampedArray]",C="[object Uint16Array]",D="[object Uint32Array]",E={};E[v]=E[w]=E[x]=E[y]=E[z]=E[A]=E[B]=E[C]=E[D]=!0,E[g]=E[h]=E[t]=E[i]=E[u]=E[j]=E[k]=E[l]=E[m]=E[n]=E[o]=E[p]=E[q]=E[r]=E[s]=!1;var F=Object.prototype,G=F.toString;b.exports=d},{"./isLength":413,"./isObjectLike":415}],419:[function(a,b,c){function d(a){var b=j(a);if(!b&&!h(a))return f(a);var c=g(a),d=!!c,k=c||[],l=k.length;for(var m in a)!e(a,m)||d&&("length"==m||i(m,l))||b&&"constructor"==m||k.push(m);return k}var e=a("./_baseHas"),f=a("./_baseKeys"),g=a("./_indexKeys"),h=a("./isArrayLike"),i=a("./_isIndex"),j=a("./_isPrototype");b.exports=d},{"./_baseHas":328,"./_baseKeys":335,"./_indexKeys":365,"./_isIndex":367,"./_isPrototype":372,"./isArrayLike":408}],420:[function(a,b,c){function d(a,b){if("function"!=typeof a||b&&"function"!=typeof b)throw new TypeError(f);var c=function(){var d=arguments,e=b?b.apply(this,d):d[0],f=c.cache;if(f.has(e))return f.get(e);var g=a.apply(this,d);return c.cache=f.set(e,g),g};return c.cache=new(d.Cache||e),c}var e=a("./_MapCache"),f="Expected a function";d.Cache=e,b.exports=d},{"./_MapCache":308}],421:[function(a,b,c){function d(a){return g(a)?e(h(a)):f(a)}var e=a("./_baseProperty"),f=a("./_basePropertyDeep"),g=a("./_isKey"),h=a("./_toKey");b.exports=d},{"./_baseProperty":338,"./_basePropertyDeep":339,"./_isKey":369,"./_toKey":397}],422:[function(a,b,c){function d(a,b){if("function"!=typeof a)throw new TypeError(g);return b=h(void 0===b?a.length-1:f(b),0),function(){for(var c=arguments,d=-1,f=h(c.length-b,0),g=Array(f);++d"),l=o.jid.user+"@"+o.jid._domain+"/"+o.jid._resource,"function"==typeof b&&b(null,!0)}),o.on("connect",function(){r.QBLog("[QBChat] client is connected"),e._enableCarbons()}),o.on("reconnect",function(){r.QBLog("[QBChat] client is reconnected"),e._isDisconnected=!0,e._isLogout=!0}),o.on("disconnect",function(){r.QBLog("[QBChat] client is disconnected"),e._isDisconnected=!0,e._isLogout=!0,b(null,null)}),o.on("stanza",function(a){r.QBLog("[QBChat] RECV",a.toString()),a.is("presence")?e._onPresence(a):a.is("iq")?e._onIQ(a):a.is("message")&&("headline"===a.attrs.type?e._onSystemMessageListener(a):e._onMessage(a))}),o.on("offline",function(){r.QBLog("[QBChat] client goes offline"),e._isDisconnected=!0,e._isLogout=!0}),o.on("error",function(a){r.QBLog("[QBChat] client got error",a),e._isDisconnected=!0,e._isLogout=!0,c=r.getError(422,"Status.ERROR - An error has occurred"),"function"==typeof b&&(console.log("error callback"),b(c,null))}))},send:function(a,b){var c=r.getEnv().browser?$msg:n.Stanza,d={from:l,to:this.helpers.jidOrUserId(a),type:b.type?b.type:"chat",id:b.id?b.id:r.getBsonObjectId()},e=p.createStanza(c,d);b.body&&e.c("body",{xmlns:p.MARKERS.CLIENT}).t(b.body).up(),b.markable&&e.c("markable",{xmlns:p.MARKERS.CHAT}).up(),r.getEnv().browser&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}),e=p.filledExtraParams(e,b.extension)),m.send(e)),r.getEnv().node&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}),e=p.filledExtraParams(e,b.extension)),o.send(e))},sendSystemMessage:function(a,b){var c=r.getEnv().browser?$msg:n.Stanza,d={type:"headline",id:b.id?b.id:r.getBsonObjectId(),to:this.helpers.jidOrUserId(a)},e=p.createStanza(c,d);r.getEnv().browser&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications").up(),e=p.filledExtraParams(e,b.extension)),m.send(e)),r.getEnv().node&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications"),e=p.filledExtraParams(e,b.extension)),o.send(e))},sendIsTypingStatus:function(a){var b={from:l,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("composing",{xmlns:p.MARKERS.STATES}),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendIsStopTypingStatus:function(a){var b={from:l,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("paused",{xmlns:p.MARKERS.STATES}),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendDeliveredStatus:function(a){var b={type:"chat",from:l,id:r.getBsonObjectId(),to:this.helpers.jidOrUserId(a.userId)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("received",{xmlns:p.MARKERS.MARKERS,id:a.messageId}).up(),d.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("dialog_id").t(a.dialogId),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendReadStatus:function(a){var b={type:"chat",from:l,to:this.helpers.jidOrUserId(a.userId),id:r.getBsonObjectId()},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("displayed",{xmlns:p.MARKERS.MARKERS,id:a.messageId}).up(),d.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("dialog_id").t(a.dialogId),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},disconnect:function(){t={},this._isLogout=!0,l="",r.getEnv().browser?(m.flush(),m.disconnect()):r.getEnv().node&&o.end()},addListener:function(a,b){function c(){return b(),a.live!==!1}if(r.getEnv().node)throw new Error(u);return m.addHandler(c,null,a.name||null,a.type||null,a.id||null,a.from||null)},deleteListener:function(a){if(r.getEnv().node)throw new Error(u);m.deleteHandler(a)},_enableCarbons:function(a){var b={type:"set",from:l,id:p.getUniqueId("enableCarbons")},c=r.getEnv().browser?$iq:n.Stanza,d=p.createStanza(c,b,"iq");d.c("enable",{xmlns:p.MARKERS.CARBONS}),r.getEnv().browser?m.sendIQ(d):r.getEnv().node&&o.send(d)}},e.prototype={get:function(a){function b(a){return r.getEnv().browser?a.getElementsByTagName("item"):r.getEnv().node?a.getChild("query").children:void 0}function c(c){for(var e=b(c),f=0,g=e.length;f=0;s--){var t=a.items[s];k[t.user_id]={action:t.action,mutualBlock:t.mutualBlock===!0}}q=Object.keys(k);var u={type:"set",from:l,id:p.getUniqueId("edit")},v=r.getEnv().browser?$iq:n.Stanza,w=p.createStanza(v,u,"iq");w.c("query",{xmlns:p.MARKERS.PRIVACY}).c("list",{name:a.name});for(var y=0,s=0,z=q.length;y-1?"groupchat":"chat";else{if("number"!=typeof a)throw new Error(u);b="chat"}return b},getRecipientId:function(a,b){var c=null;return a.forEach(function(a,d,e){a!=b&&(c=a)}),c},getUserJid:function(a,b){return b?a+"-"+b+"@"+q.endpoints.chat:a+"-"+q.creds.appId+"@"+q.endpoints.chat},getUserNickWithMucDomain:function(a){return q.endpoints.muc+"/"+a},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},getDialogIdFromNode:function(a){return a.indexOf("@")<0?null:a.split("@")[0].split("_")[1]},getRoomJidFromDialogId:function(a){return q.creds.appId+"_"+a+"@"+q.endpoints.muc},getRoomJid:function(a){return a+"/"+this.getIdFromNode(l)},getIdFromResource:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),parseInt(b.join("/")))},getBsonObjectId:function(){return r.getBsonObjectId()},getUserIdFromRoomJid:function(a){var b=a.toString().split("/");return 0===b.length?null:b[b.length-1]},getUniqueId:function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});return"string"==typeof a||"number"==typeof a?b+":"+a:b+""}},b.exports=d},{"../qbConfig":443,"../qbUtils":447,"./qbChatHelpers":430,"node-xmpp-client":227,"strophe.js":282}],430:[function(a,b,c){var d=a("../qbUtils"),e=a("../qbConfig"),f="Unknown interface. SDK support browser / node env.",g={CLIENT:"jabber:client",CHAT:"urn:xmpp:chat-markers:0",STATES:"http://jabber.org/protocol/chatstates",MARKERS:"urn:xmpp:chat-markers:0",CARBONS:"urn:xmpp:carbons:2",ROSTER:"jabber:iq:roster",MUC:"http://jabber.org/protocol/muc",PRIVACY:"jabber:iq:privacy"},h={MARKERS:g,getMyselfJid:function(a){return d.getEnv().browser?a.jid:d.getEnv().node?nClient.jid.user+"@"+nClient.jid._domain+"/"+nClient.jid._resource:void 0},buildUserJid:function(a){var b;return"userId"in a?(b=a.userId+"-"+e.creds.appId+"@"+e.endpoints.chat,"resource"in a&&(b=userJid+"/"+a.resource)):"jid"in a&&(b=a.jid),b},createStanza:function(a,b,c){var e;return d.getEnv().browser?e=a(b):d.getEnv().node&&(e=new a(c?c:"message",b)),e},getAttr:function(a,b){var c;if("function"==typeof a.getAttribute)c=a.getAttribute(b);else{if(!a.attrs)throw f;c=a.attrs[b]}return c?c:null},getElement:function(a,b){var c;if("function"==typeof a.querySelector)c=a.querySelector(b);else{if("function"!=typeof a.getChild)throw f;c=a.getChild(b)}return c?c:null},getElementText:function(a,b){var c,d;if("function"==typeof a.querySelector)c=a.querySelector(b),d=c?c.textContent:null;else{if("function"!=typeof a.getChildText)throw f;d=a.getChildText(b)}return d?d:null},_JStoXML:function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},_XMLtoJS:function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;e1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a},filledExtraParams:function(a,b,c){var e=this;return Object.keys(b).forEach(function(c){"attachments"===c?b[c].forEach(function(b){a.c("attachment",b).up()}):"object"==typeof b[c]?e._JStoXML(c,b[c],a):d.getEnv().browser?a.c(c).t(b[c]).up():d.getEnv().node&&a.getChild("extraParams").c(c).t(b[c]).up()}),a.up(),a},parseExtraParams:function(a){if(!a)return null;var b,c={},e=[];if(d.getEnv().browser){for(var f=0,g=a.childNodes.length;f1){var l=a.childNodes[f].textContent.length;if(l>4096){for(var m="",j=0;j0&&(c.attachments=e)}else if(d.getEnv().node)for(var f=0,g=a.children.length;f0&&(e[c]=a[c]);g.QBLog("[GeoProxy]","update",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a.id),data:{geo_data:e},type:"PUT"},function(a,c){a?b(a,null):b(a,c.geo_datum)})},get:function(a,b){g.QBLog("[GeoProxy]","get",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a)},function(a,c){a?b(a,null):b(null,c.geo_datum)})},list:function(a,b){"function"==typeof a&&(b=a,a=void 0),g.QBLog("[GeoProxy]","find",a),this.service.ajax({url:g.getUrl(h),data:a},b)},delete:function(a,b){g.QBLog("[GeoProxy]","delete",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a),type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})},purge:function(a,b){g.QBLog("[GeoProxy]","purge",a),this.service.ajax({url:g.getUrl(f.urls.geodata),data:{days:a},type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})}},b.exports=d},{"../qbConfig":443,"../qbUtils":447}],434:[function(a,b,c){(function(c){function d(a){this.service=a,this.subscriptions=new e(a),this.events=new f(a),this.base64Encode=function(a){return i?btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)})):new c(a).toString("base64")}}function e(a){this.service=a}function f(a){this.service=a}var g=a("../qbConfig"),h=a("../qbUtils"),i="undefined"!=typeof window;e.prototype={create:function(a,b){h.QBLog("[SubscriptionsProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.subscriptions),type:"POST",data:a},b)},list:function(a){h.QBLog("[SubscriptionsProxy]","list"),this.service.ajax({url:h.getUrl(g.urls.subscriptions)},a)},delete:function(a,b){h.QBLog("[SubscriptionsProxy]","delete",a);var c={type:"DELETE",dataType:"text",url:h.getUrl(g.urls.subscriptions,a)};this.service.ajax(c,function(a,c){a?b(a,null):b(null,!0)})}},f.prototype={create:function(a,b){h.QBLog("[EventsProxy]","create",a);var c={event:a};this.service.ajax({url:h.getUrl(g.urls.events),type:"POST",data:c},b)},list:function(a,b){"function"==typeof a&&"undefined"==typeof b&&(b=a,a=null),h.QBLog("[EventsProxy]","list",a),this.service.ajax({url:h.getUrl(g.urls.events),data:a},b)},get:function(a,b){h.QBLog("[EventsProxy]","get",a),this.service.ajax({url:h.getUrl(g.urls.events,a)},b)},status:function(a,b){h.QBLog("[EventsProxy]","status",a),this.service.ajax({url:h.getUrl(g.urls.events,a+"/status")},b)},delete:function(a,b){h.QBLog("[EventsProxy]","delete",a),this.service.ajax({url:h.getUrl(g.urls.events,a),dataType:"text",type:"DELETE"},b)}},b.exports=d}).call(this,a("buffer").Buffer)},{"../qbConfig":443,"../qbUtils":447,buffer:8}],435:[function(a,b,c){function d(a){this.service=a}function e(a){var b=a.field in j?"date":typeof a.value;return(a.value instanceof Array||i.isArray(a.value))&&("object"==b&&(b=typeof a.value[0]),a.value=a.value.toString()),[b,a.field,a.param,a.value].join(" ")}function f(a){var b=a.field in j?"date":a.field in k?"number":"string";return[a.sort,b,a.field].join(" ")}var g=a("../qbConfig"),h=a("../qbUtils"),i=a("util"),j=["created_at","updated_at","last_request_at"],k=["id","external_user_id"],l=g.urls.users+"/password/reset";d.prototype={listUsers:function(a,b){h.QBLog("[UsersProxy]","listUsers",arguments.length>1?a:"");var c,d={},i=[];"function"==typeof a&&"undefined"==typeof b&&(b=a,a={}),a.filter&&(a.filter instanceof Array?a.filter.forEach(function(a){c=e(a),i.push(c)}):(c=e(a.filter),i.push(c)),d.filter=i),a.order&&(d.order=f(a.order)),a.page&&(d.page=a.page),a.per_page&&(d.per_page=a.per_page),this.service.ajax({url:h.getUrl(g.urls.users),data:d},b)},get:function(a,b){h.QBLog("[UsersProxy]","get",a);var c;"number"==typeof a?(c=a,a={}):a.login?c="by_login":a.full_name?c="by_full_name":a.facebook_id?c="by_facebook_id":a.twitter_id?c="by_twitter_id":a.email?c="by_email":a.tags?c="by_tags":a.external&&(c="external/"+a.external,a={}),this.service.ajax({url:h.getUrl(g.urls.users,c),data:a},function(a,c){a?b(a,null):b(null,c.user||c)})},create:function(a,b){h.QBLog("[UsersProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.users),type:"POST",data:{user:a}},function(a,c){a?b(a,null):b(null,c.user)})},update:function(a,b,c){h.QBLog("[UsersProxy]","update",a,b),this.service.ajax({url:h.getUrl(g.urls.users,a),type:"PUT",data:{user:b}},function(a,b){a?c(a,null):c(null,b.user)})},delete:function(a,b){h.QBLog("[UsersProxy]","delete",a);var c;"number"==typeof a?c=a:a.external&&(c="external/"+a.external),this.service.ajax({url:h.getUrl(g.urls.users,c),type:"DELETE",dataType:"text"},b)},resetPassword:function(a,b){h.QBLog("[UsersProxy]","resetPassword",a),this.service.ajax({url:h.getUrl(l),data:{email:a}},b)}},b.exports=d},{"../qbConfig":443,"../qbUtils":447,util:224}],436:[function(a,b,c){function d(a,b,c,d){navigator.mozGetUserMedia?a.getStats(b,function(a){var b=[];a.forEach(function(a){b.push(a)}),c(b)},d):a.getStats(function(a){var b=[];a.result().forEach(function(a){var c={};a.names().forEach(function(b){c[b]=a.stat(b)}),c.id=a.id,c.type=a.type,c.timestamp=a.timestamp,b.push(c)}),c(b)})}var e=a("../../qbConfig"),f=a("./qbWebRTCHelpers"),g=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,h=window.RTCSessionDescription||window.mozRTCSessionDescription,i=window.RTCIceCandidate||window.mozRTCIceCandidate;g.State={NEW:1,CONNECTING:2,CHECKING:3,CONNECTED:4,DISCONNECTED:5,FAILED:6,CLOSED:7,COMPLETED:8},g.prototype.init=function(a,b,c,d){f.trace("RTCPeerConnection init. userID: "+b+", sessionID: "+c+", type: "+d),this.delegate=a,this.sessionID=c,this.userID=b,this.type=d,this.remoteSDP=null,this.state=g.State.NEW,this.onicecandidate=this.onIceCandidateCallback,this.onaddstream=this.onAddRemoteStreamCallback,this.onsignalingstatechange=this.onSignalingStateCallback,this.oniceconnectionstatechange=this.onIceConnectionStateCallback,this.dialingTimer=null,this.answerTimeInterval=0,this.statsReportTimer=null,this.reconnectTimer=0,this.iceCandidates=[]},g.prototype.release=function(){this._clearDialingTimer(),this._clearStatsReportTimer(),"closed"!==this.signalingState&&this.close()},g.prototype.updateRemoteSDP=function(a){if(!a)throw new Error("sdp string can't be empty.");this.remoteSDP=a},g.prototype.getRemoteSDP=function(){return this.remoteSDP},g.prototype.setRemoteSessionDescription=function(a,b,c){function d(){c(null)}function e(a){c(a)}var f=new h({sdp:b,type:a});this.setRemoteDescription(f,d,e)},g.prototype.addLocalStream=function(a){if(!a)throw new Error("'RTCPeerConnection.addStream' error: stream is 'null'.");this.addStream(a)},g.prototype.getAndSetLocalSessionDescription=function(a){function b(b){d.setLocalDescription(b,function(){a(null)},c)}function c(b){a(b)}var d=this;d.state=g.State.CONNECTING,"offer"===d.type?d.createOffer(b,c):d.createAnswer(b,c)},g.prototype.addCandidates=function(a){for(var b,c=0,d=a.length;c0&&(this.delegate.processIceCandidates(this,this.iceCandidates),this.iceCandidates.length=0)},g.prototype.onIceCandidateCallback=function(a){var b=a.candidate;if(b){var c={sdpMLineIndex:b.sdpMLineIndex,sdpMid:b.sdpMid,candidate:b.candidate};"stable"===this.signalingState?this.delegate.processIceCandidates(this,[c]):this.iceCandidates.push(c)}},g.prototype.onAddRemoteStreamCallback=function(a){var b=this;"function"==typeof this.delegate._onRemoteStreamListener&&this.delegate._onRemoteStreamListener(this.userID,a.stream),b._getStatsWrap()},g.prototype.onIceConnectionStateCallback=function(){var a=this.iceConnectionState;if(f.trace("onIceConnectionStateCallback: "+this.iceConnectionState),"function"==typeof this.delegate._onSessionConnectionStateChangedListener){var b=null;"checking"===a?(this.state=g.State.CHECKING,b=f.SessionConnectionState.CONNECTING):"connected"===a?(this._clearWaitingReconnectTimer(),this.state=g.State.CONNECTED,b=f.SessionConnectionState.CONNECTED):"completed"===a?(this._clearWaitingReconnectTimer(),this.state=g.State.COMPLETED,b=f.SessionConnectionState.COMPLETED):"failed"===a?(this.state=g.State.FAILED,b=f.SessionConnectionState.FAILED):"disconnected"===a?(this._startWaitingReconnectTimer(),this.state=g.State.DISCONNECTED,b=f.SessionConnectionState.DISCONNECTED):"closed"===a&&(this.state=g.State.CLOSED,b=f.SessionConnectionState.CLOSED),b&&this.delegate._onSessionConnectionStateChangedListener(this.userID,b)}},g.prototype._clearStatsReportTimer=function(){this.statsReportTimer&&(clearInterval(this.statsReportTimer),this.statsReportTimer=null)},g.prototype._getStatsWrap=function(){var a,b=this,c=1==b.delegate.callType?b.getLocalStreams()[0].getVideoTracks()[0]:b.getLocalStreams()[0].getAudioTracks()[0];if(e.webrtc&&e.webrtc.statsReportTimeInterval){if(isNaN(+e.webrtc.statsReportTimeInterval))return void f.traceError("statsReportTimeInterval ("+e.webrtc.statsReportTimeInterval+") must be integer.");a=1e3*e.webrtc.statsReportTimeInterval;var g=function(){d(b,c,function(a){b.delegate._onCallStatsReport(b.userID,a,null)},function(a){f.traceError("_getStats error. "+a.name+": "+a.message),b.delegate._onCallStatsReport(b.userID,null,a)})};f.trace("Stats tracker has been started."),b.statsReportTimer=setInterval(g,a)}},g.prototype._clearWaitingReconnectTimer=function(){this.waitingReconnectTimeoutCallback&&(f.trace("_clearWaitingReconnectTimer"),clearTimeout(this.waitingReconnectTimeoutCallback),this.waitingReconnectTimeoutCallback=null)},g.prototype._startWaitingReconnectTimer=function(){var a=this,b=1e3*e.webrtc.disconnectTimeInterval,c=function(){f.trace("waitingReconnectTimeoutCallback"),clearTimeout(a.waitingReconnectTimeoutCallback),a.release(),a.delegate._closeSessionIfAllConnectionsClosed()};f.trace("_startWaitingReconnectTimer, timeout: "+b),a.waitingReconnectTimeoutCallback=setTimeout(c,b)},g.prototype._clearDialingTimer=function(){this.dialingTimer&&(f.trace("_clearDialingTimer"),clearInterval(this.dialingTimer),this.dialingTimer=null,this.answerTimeInterval=0)},g.prototype._startDialingTimer=function(a,b){var c=this,d=1e3*e.webrtc.dialingTimeInterval;f.trace("_startDialingTimer, dialingTimeInterval: "+d);var g=function(a,b,d){d||(c.answerTimeInterval+=1e3*e.webrtc.dialingTimeInterval),f.trace("_dialingCallback, answerTimeInterval: "+c.answerTimeInterval),c.answerTimeInterval>=1e3*e.webrtc.answerTimeInterval?(c._clearDialingTimer(),b&&c.delegate.processOnNotAnswer(c)):c.delegate.processCall(c,a)};c.dialingTimer=setInterval(g,d,a,b,!1),g(a,b,!0)},b.exports=g},{"../../qbConfig":443,"./qbWebRTCHelpers":438}],437:[function(a,b,c){"use strict";function d(a,b){return d.__instance?d.__instance:this===window?new d:(d.__instance=this,this.connection=b,this.signalingProcessor=new h(a,this,b),this.signalingProvider=new i(a,b),this.SessionConnectionState=j.SessionConnectionState,this.CallType=j.CallType,this.PeerConnectionState=k.State,void(this.sessions={}))}function e(a,b){var c=!1,d=b.sort();return a.length&&a.forEach(function(a){var b=a.sort();c=b.length==d.length&&b.every(function(a,b){return a===d[b]})}),c}function f(a){var b=[];return Object.keys(a).length>0&&Object.keys(a).forEach(function(c,d,e){var f=a[c];f.state!==g.State.NEW&&f.state!==g.State.ACTIVE||b.push(f.opponentsIDs)}),b}var g=a("./qbWebRTCSession"),h=a("./qbWebRTCSignalingProcessor"),i=a("./qbWebRTCSignalingProvider"),j=a("./qbWebRTCHelpers"),k=a("./qbRTCPeerConnection"),l=a("./qbWebRTCSignalingConstants"),m=a("../../qbUtils");d.prototype.getMediaDevices=function(a){var b=[],c="Browser does not support output device selection.";return new Promise(function(d,e){navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices().then(function(c){a?(c.forEach(function(c,d){c.kind===a&&b.push(c)}),d(b)):d(c)}):(e(c),j.traceWarning(c))})},d.prototype.sessions={},d.prototype.createNewSession=function(a,b,c){var d=f(this.sessions),g=c||j.getIdFromNode(this.connection.jid),h=!1,i=b||2;if(!a)throw new Error("Can't create a session without the opponentsIDs.");if(h=e(d,a))throw new Error("Can't create a session with the same opponentsIDs. There is a session already in NEW or ACTIVE state.");return this._createAndStoreSession(null,g,a,i)},d.prototype._createAndStoreSession=function(a,b,c,d){var e=new g(a,b,c,d,this.signalingProvider,j.getIdFromNode(this.connection.jid));return e.onUserNotAnswerListener=this.onUserNotAnswerListener,e.onRemoteStreamListener=this.onRemoteStreamListener,e.onSessionConnectionStateChangedListener=this.onSessionConnectionStateChangedListener,e.onSessionCloseListener=this.onSessionCloseListener,e.onCallStatsReport=this.onCallStatsReport,this.sessions[e.ID]=e,e},d.prototype.clearSession=function(a){delete d.sessions[a]},d.prototype.isExistNewOrActiveSessionExceptSessionID=function(a){var b=this,c=!1;return Object.keys(b.sessions).length>0&&Object.keys(b.sessions).forEach(function(d,e,f){var h=b.sessions[d];h.state!==g.State.NEW&&h.state!==g.State.ACTIVE||h.ID!==a&&(c=!0)}),c},d.prototype._onCallListener=function(a,b,c){var d=JSON.parse(JSON.stringify(c));if(j.trace("onCall. UserID:"+a+". SessionID: "+b),this.isExistNewOrActiveSessionExceptSessionID(b))j.trace("User with id "+a+" is busy at the moment."),delete c.sdp,delete c.platform,c.sessionID=b,this.signalingProvider.sendMessage(a,c,l.SignalingType.REJECT),"function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onCall",b,a,d);else{var e=this.sessions[b];e||(e=this._createAndStoreSession(b,c.callerID,c.opponentsIDs,c.callType),this._cleanupExtension(d),"function"==typeof this.onCallListener&&m.safeCallbackCall(this.onCallListener,e,d)),e.processOnCall(a,c)}},d.prototype._onAcceptListener=function(a,b,c){var d=this.sessions[b];if(j.trace("onAccept. UserID:"+a+". SessionID: "+b),d)if(d.state===g.State.ACTIVE){var e=JSON.parse(JSON.stringify(c));this._cleanupExtension(e),"function"==typeof this.onAcceptCallListener&&m.safeCallbackCall(this.onAcceptCallListener,d,a,e),d.processOnAccept(a,c)}else"function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onAccept",d,a,e),j.traceWarning("Ignore 'onAccept', the session( "+b+" ) has invalid state.");else j.traceError("Ignore 'onAccept', there is no information about session "+b+" by some reason.")},d.prototype._onRejectListener=function(a,b,c){var d=this,e=d.sessions[b];if(j.trace("onReject. UserID:"+a+". SessionID: "+b),e){var f=JSON.parse(JSON.stringify(c));d._cleanupExtension(f),"function"==typeof this.onRejectCallListener&&m.safeCallbackCall(d.onRejectCallListener,e,a,f),e.processOnReject(a,c)}else j.traceError("Ignore 'onReject', there is no information about session "+b+" by some reason.")},d.prototype._onStopListener=function(a,b,c){j.trace("onStop. UserID:"+a+". SessionID: "+b);var d=this.sessions[b],e=JSON.parse(JSON.stringify(c));!d||d.state!==g.State.ACTIVE&&d.state!==g.State.NEW?("function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onStop",d,a,e),j.traceError("Ignore 'onStop', there is no information about session "+b+" by some reason.")):(this._cleanupExtension(e),"function"==typeof this.onStopCallListener&&m.safeCallbackCall(this.onStopCallListener,d,a,e),d.processOnStop(a,c))},d.prototype._onIceCandidatesListener=function(a,b,c){var d=this.sessions[b];j.trace("onIceCandidates. UserID:"+a+". SessionID: "+b+". ICE candidates count: "+c.iceCandidates.length),d?d.state===g.State.ACTIVE?d.processOnIceCandidates(a,c):j.traceWarning("Ignore 'OnIceCandidates', the session ( "+b+" ) has invalid state."):j.traceError("Ignore 'OnIceCandidates', there is no information about session "+b+" by some reason.")},d.prototype._onUpdateListener=function(a,b,c){var d=this.sessions[b];j.trace("onUpdate. UserID:"+a+". SessionID: "+b+". Extension: "+JSON.stringify(c)),"function"==typeof this.onUpdateCallListener&&m.safeCallbackCall(this.onUpdateCallListener,d,a,c)},d.prototype._cleanupExtension=function(a){delete a.platform,delete a.sdp,delete a.opponentsIDs,delete a.callerID,delete a.callType},b.exports=d},{"../../qbUtils":447,"./qbRTCPeerConnection":436,"./qbWebRTCHelpers":438,"./qbWebRTCSession":439,"./qbWebRTCSignalingConstants":440,"./qbWebRTCSignalingProcessor":441,"./qbWebRTCSignalingProvider":442}],438:[function(a,b,c){var d=a("../../qbConfig"),e={};e={getUserJid:function(a,b){return a+"-"+b+"@"+d.endpoints.chat},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},trace:function(a){d.debug&&console.log("[QBWebRTC]:",a)},traceWarning:function(a){d.debug&&console.warn("[QBWebRTC]:",a)},traceError:function(a){d.debug&&console.error("[QBWebRTC]:",a); -},getLocalTime:function(){var a=(new Date).toString().split(" ");return a.slice(1,5).join("-")},dataURItoBlob:function(a,b){for(var c=[],d=window.atob(a.split(",")[1]),e=0,f=d.length;e0){var g=(b.acceptCallTime-b.startCallTime)/1e3;b._startWaitingOfferOrAnswerTimer(g),e.forEach(function(a,c,d){b.currentUserID>a&&b._callInternal(a,{},!0)})}},d.prototype._acceptInternal=function(a,b){var c=this,d=this.peerConnections[a];d?(d.addLocalStream(this.localStream),d.setRemoteSessionDescription("offer",d.getRemoteSDP(),function(e){e?k.traceError("'setRemoteSessionDescription' error: "+e):(k.trace("'setRemoteSessionDescription' success"),d.getAndSetLocalSessionDescription(function(e){e?k.trace("getAndSetLocalSessionDescription error: "+e):(b.sessionID=c.ID,b.callType=c.callType,b.callerID=c.initiatorID,b.opponentsIDs=c.opponentsIDs,b.sdp=d.localDescription.sdp,c.signalingProvider.sendMessage(a,b,l.SignalingType.ACCEPT))}))})):k.traceError("Can't accept the call, there is no information about peer connection by some reason.")},d.prototype.reject=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Reject, extension: "+JSON.stringify(c)),b.state=d.State.REJECTED,b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.REJECT)}b._close()},d.prototype.stop=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Stop, extension: "+JSON.stringify(c)),b.state=d.State.HUNGUP,b.answerTimer&&b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.STOP)}b._close()},d.prototype.closeConnection=function(a){var b=this,c=this.peerConnections[a];if(!c)return k.traceWarn("Not found connection with user ("+a+")"),!1;try{c.release()}catch(a){k.traceError(a)}finally{b._closeSessionIfAllConnectionsClosed()}},d.prototype.update=function(a){var b=this,c={};if(k.trace("Update, extension: "+JSON.stringify(a)),null==a)return void k.trace("extension is null, no parameters to update");c=f(a),c.sessionID=this.ID;for(var d in b.peerConnections){var e=b.peerConnections[d];b.signalingProvider.sendMessage(e.userID,c,l.SignalingType.PARAMETERS_CHANGED)}},d.prototype.mute=function(a){this._muteStream(0,a)},d.prototype.unmute=function(a){this._muteStream(1,a)},d.snapshot=function(a){var b,c,d=document.getElementById(a),e=document.createElement("canvas"),f=e.getContext("2d");if(d)return e.width=d.clientWidth,e.height=d.clientHeight,"scaleX(-1)"===d.style.transform&&(f.translate(e.width,0),f.scale(-1,1)),f.drawImage(d,0,0,d.clientWidth,d.clientHeight),b=e.toDataURL(),c=k.dataURItoBlob(b,"image/png"),c.name="snapshot_"+getLocalTime()+".png",c.url=b,c},d.filter=function(a,b){var c=document.getElementById(a);c&&(c.style.webkitFilter=b,c.style.filter=b)},d.prototype.processOnCall=function(a,b){var c=this,e=c._uniqueOpponentsIDs();e.forEach(function(e,f,g){var h=c.peerConnections[e];if(h)e==a&&(h.updateRemoteSDP(b.sdp),a!=c.initiatorID&&c.state===d.State.ACTIVE&&c._acceptInternal(a,{}));else{var i;i=e!=a&&c.currentUserID>e?c._createPeer(e,"offer"):c._createPeer(e,"answer"),c.peerConnections[e]=i,e==a&&(i.updateRemoteSDP(b.sdp),c._startAnswerTimer())}})},d.prototype.processOnAccept=function(a,b){var c=this.peerConnections[a];c?(c._clearDialingTimer(),c.setRemoteSessionDescription("answer",b.sdp,function(a){a?k.traceError("'setRemoteSessionDescription' error: "+a):k.trace("'setRemoteSessionDescription' success")})):k.traceError("Ignore 'OnAccept', there is no information about peer connection by some reason.")},d.prototype.processOnReject=function(a,b){var c=this.peerConnections[a];this._clearWaitingOfferOrAnswerTimer(),c?c.release():k.traceError("Ignore 'OnReject', there is no information about peer connection by some reason."),this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnStop=function(a,b){var c=this;if(this._clearAnswerTimer(),a===c.initiatorID)Object.keys(c.peerConnections).length?Object.keys(c.peerConnections).forEach(function(a){c.peerConnections[a].release()}):k.traceError("Ignore 'OnStop', there is no information about peer connections by some reason.");else{var d=c.peerConnections[a];d?d.release():k.traceError("Ignore 'OnStop', there is no information about peer connection by some reason.")}this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnIceCandidates=function(a,b){var c=this.peerConnections[a];c?c.addCandidates(b.iceCandidates):k.traceError("Ignore 'OnIceCandidates', there is no information about peer connection by some reason.")},d.prototype.processCall=function(a,b){var b=b||{};b.sessionID=this.ID,b.callType=this.callType,b.callerID=this.initiatorID,b.opponentsIDs=this.opponentsIDs,b.sdp=a.localDescription.sdp,this.signalingProvider.sendMessage(a.userID,b,l.SignalingType.CALL)},d.prototype.processIceCandidates=function(a,b){var c={};c.sessionID=this.ID,c.callType=this.callType,c.callerID=this.initiatorID,c.opponentsIDs=this.opponentsIDs,this.signalingProvider.sendCandidate(a.userID,b,c)},d.prototype.processOnNotAnswer=function(a){k.trace("Answer timeout callback for session "+this.ID+" for user "+a.userID),this._clearWaitingOfferOrAnswerTimer(),a.release(),"function"==typeof this.onUserNotAnswerListener&&j.safeCallbackCall(this.onUserNotAnswerListener,this,a.userID),this._closeSessionIfAllConnectionsClosed()},d.prototype._onRemoteStreamListener=function(a,b){"function"==typeof this.onRemoteStreamListener&&j.safeCallbackCall(this.onRemoteStreamListener,this,a,b)},d.prototype._onCallStatsReport=function(a,b,c){"function"==typeof this.onCallStatsReport&&j.safeCallbackCall(this.onCallStatsReport,this,a,b,c)},d.prototype._onSessionConnectionStateChangedListener=function(a,b){var c=this;"function"==typeof c.onSessionConnectionStateChangedListener&&j.safeCallbackCall(c.onSessionConnectionStateChangedListener,c,a,b)},d.prototype._createPeer=function(a,b){if(!i)throw new Error("_createPeer error: RTCPeerConnection() is not supported in your browser");this.startCallTime=new Date;var c={iceServers:g(h.webrtc.iceServers)};k.trace("_createPeer, iceServers: "+JSON.stringify(c));var d=new i(c);return d.init(this,a,this.ID,b),d},d.prototype._close=function(){k.trace("_close");for(var a in this.peerConnections){var b=this.peerConnections[a];try{b.release()}catch(a){console.warn("Peer close error:",a)}}this._closeLocalMediaStream(),this.state=d.State.CLOSED,"function"==typeof this.onSessionCloseListener&&j.safeCallbackCall(this.onSessionCloseListener,this)},d.prototype._closeSessionIfAllConnectionsClosed=function(){var a=!0;for(var b in this.peerConnections){var c=this.peerConnections[b];if("closed"!==c.signalingState){a=!1;break}}k.trace("All peer connections closed: "+a),a&&(this._closeLocalMediaStream(),"function"==typeof this.onSessionCloseListener&&this.onSessionCloseListener(this),this.state=d.State.CLOSED)},d.prototype._closeLocalMediaStream=function(){this.localStream&&(this.localStream.getAudioTracks().forEach(function(a){a.stop()}),this.localStream.getVideoTracks().forEach(function(a){a.stop()}),this.localStream=null)},d.prototype._muteStream=function(a,b){return"audio"===b&&this.localStream.getAudioTracks().length>0?void this.localStream.getAudioTracks().forEach(function(b){b.enabled=!!a}):"video"===b&&this.localStream.getVideoTracks().length>0?void this.localStream.getVideoTracks().forEach(function(b){b.enabled=!!a}):void 0},d.prototype._clearAnswerTimer=function(){this.answerTimer&&(k.trace("_clearAnswerTimer"),clearTimeout(this.answerTimer),this.answerTimer=null)},d.prototype._startAnswerTimer=function(){k.trace("_startAnswerTimer");var a=this,b=function(){k.trace("_answerTimeoutCallback"),"function"==typeof a.onSessionCloseListener&&a._close(),a.answerTimer=null},c=1e3*h.webrtc.answerTimeInterval;this.answerTimer=setTimeout(b,c)},d.prototype._clearWaitingOfferOrAnswerTimer=function(){this.waitingOfferOrAnswerTimer&&(k.trace("_clearWaitingOfferOrAnswerTimer"),clearTimeout(this.waitingOfferOrAnswerTimer),this.waitingOfferOrAnswerTimer=null)},d.prototype._startWaitingOfferOrAnswerTimer=function(a){var b=this,c=h.webrtc.answerTimeInterval-a<0?1:h.webrtc.answerTimeInterval-a,d=function(){k.trace("waitingOfferOrAnswerTimeoutCallback"),Object.keys(b.peerConnections).length>0&&Object.keys(b.peerConnections).forEach(function(a){var c=b.peerConnections[a];c.state!==i.State.CONNECTING&&c.state!==i.State.NEW||b.processOnNotAnswer(c)}),b.waitingOfferOrAnswerTimer=null};k.trace("_startWaitingOfferOrAnswerTimer, timeout: "+c),this.waitingOfferOrAnswerTimer=setTimeout(d,1e3*c)},d.prototype._uniqueOpponentsIDs=function(){var a=this,b=[];return this.initiatorID!==this.currentUserID&&b.push(this.initiatorID),this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype._uniqueOpponentsIDsWithoutInitiator=function(){var a=this,b=[];return this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype.toString=function(){return"ID: "+this.ID+", initiatorID: "+this.initiatorID+", opponentsIDs: "+this.opponentsIDs+", state: "+this.state+", callType: "+this.callType},b.exports=d},{"../../qbConfig":443,"../../qbUtils":447,"./qbRTCPeerConnection":436,"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440}],440:[function(a,b,c){function d(){}d.MODULE_ID="WebRTCVideoChat",d.SignalingType={CALL:"call",ACCEPT:"accept",REJECT:"reject",STOP:"hangUp",CANDIDATE:"iceCandidates",PARAMETERS_CHANGED:"update"},b.exports=d},{}],441:[function(a,b,c){function d(a,b,c){var d=this;d.service=a,d.delegate=b,d.connection=c,this._onMessage=function(a){var b=a.getAttribute("from"),c=a.querySelector("extraParams"),g=a.querySelector("delay"),h=e.getIdFromNode(b),i=d._getExtension(c);if(g||i.moduleIdentifier!==f.MODULE_ID)return!0;var j=i.sessionID,k=i.signalType;switch(delete i.moduleIdentifier,delete i.sessionID,delete i.signalType,k){case f.SignalingType.CALL:"function"==typeof d.delegate._onCallListener&&d.delegate._onCallListener(h,j,i);break;case f.SignalingType.ACCEPT:"function"==typeof d.delegate._onAcceptListener&&d.delegate._onAcceptListener(h,j,i);break;case f.SignalingType.REJECT:"function"==typeof d.delegate._onRejectListener&&d.delegate._onRejectListener(h,j,i);break;case f.SignalingType.STOP:"function"==typeof d.delegate._onStopListener&&d.delegate._onStopListener(h,j,i);break;case f.SignalingType.CANDIDATE:"function"==typeof d.delegate._onIceCandidatesListener&&d.delegate._onIceCandidatesListener(h,j,i);break;case f.SignalingType.PARAMETERS_CHANGED:"function"==typeof d.delegate._onUpdateListener&&d.delegate._onUpdateListener(h,j,i)}return!0},this._getExtension=function(a){if(!a)return null;for(var b,c,e,f,g={},h=[],i=[],j=0,k=a.childNodes.length;j1){var r=a.childNodes[j].textContent.length;if(r>4096){for(var s="",t=0;t0&&(g.iceCandidates=h),i.length>0&&(g.opponentsIDs=i),g},this._XMLtoJS=function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;e1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a}}a("strophe.js");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants");b.exports=d},{"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440,"strophe.js":282}],442:[function(a,b,c){function d(a,b){this.service=a,this.connection=b}a("strophe.js");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants"),g=a("../../qbUtils"),h=a("../../qbConfig");d.prototype.sendCandidate=function(a,b,c){var d=c||{};d.iceCandidates=b,this.sendMessage(a,d,f.SignalingType.CANDIDATE)},d.prototype.sendMessage=function(a,b,c){var d,i,j=b||{},k=this;j.moduleIdentifier=f.MODULE_ID,j.signalType=c,j.platform="web",i={to:e.getUserJid(a,h.creds.appId),type:"headline",id:g.getBsonObjectId()},d=$msg(i).c("extraParams",{xmlns:Strophe.NS.CLIENT}),Object.keys(j).forEach(function(a){"iceCandidates"===a?(d=d.c("iceCandidates"),j[a].forEach(function(a){d=d.c("iceCandidate"),Object.keys(a).forEach(function(b){d.c(b).t(a[b]).up()}),d.up()}),d.up()):"opponentsIDs"===a?(d=d.c("opponentsIDs"),j[a].forEach(function(a){d=d.c("opponentID").t(a).up()}),d.up()):"object"==typeof j[a]?k._JStoXML(a,j[a],d):d.c(a).t(j[a]).up()}),this.connection.send(d)},d.prototype._JStoXML=function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},b.exports=d},{"../../qbConfig":443,"../../qbUtils":447,"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440,"strophe.js":282}],443:[function(a,b,c){var d={version:"2.2.3",creds:{appId:"",authKey:"",authSecret:""},endpoints:{api:"api.quickblox.com",chat:"chat.quickblox.com",muc:"muc.chat.quickblox.com"},chatProtocol:{bosh:"https://chat.quickblox.com:5281",websocket:"wss://chat.quickblox.com:5291",active:2},webrtc:{answerTimeInterval:60,dialingTimeInterval:5,disconnectTimeInterval:30,statsReportTimeInterval:!1,iceServers:[{url:"stun:stun.l.google.com:19302"},{url:"stun:turn.quickblox.com",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnsingapor.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnsingapore.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnireland.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnireland.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"}]},urls:{session:"session",login:"login",users:"users",chat:"chat",blobs:"blobs",geodata:"geodata",pushtokens:"push_tokens",subscriptions:"subscriptions",events:"events",data:"data",type:".json"},on:{sessionExpired:null},timeout:null,debug:{mode:0,file:null},addISOTime:!1};d.set=function(a){"object"==typeof a.endpoints&&a.endpoints.chat&&(d.endpoints.muc="muc."+a.endpoints.chat,d.chatProtocol.bosh="https://"+a.endpoints.chat+":5281",d.chatProtocol.websocket="wss://"+a.endpoints.chat+":5291"),Object.keys(a).forEach(function(b){"set"!==b&&d.hasOwnProperty(b)&&("object"!=typeof a[b]?d[b]=a[b]:Object.keys(a[b]).forEach(function(c){d[b].hasOwnProperty(c)&&(d[b][c]=a[b][c])})),"iceServers"===b&&(d.webrtc.iceServers=a[b])})},b.exports=d},{}],444:[function(a,b,c){function d(){}var e=a("./qbConfig"),f=a("./qbUtils"),g="undefined"!=typeof window;d.prototype={init:function(b,c,d,h){h&&"object"==typeof h&&e.set(h);var i=a("./qbProxy");this.service=new i;var j,k=a("./modules/qbAuth"),l=a("./modules/qbUsers"),m=a("./modules/qbChat"),n=a("./modules/qbContent"),o=a("./modules/qbLocation"),p=a("./modules/qbPushNotifications"),q=a("./modules/qbData");if(g){var r=a("./qbStrophe");if(j=new r,f.isWebRTCAvailble()){var s=a("./modules/webrtc/qbWebRTCClient");this.webrtc=new s(this.service,j||null)}else this.webrtc=!1}else this.webrtc=!1;this.auth=new k(this.service),this.users=new l(this.service),this.chat=new m(this.service,this.webrtc?this.webrtc.signalingProcessor:null,j||null),this.content=new n(this.service),this.location=new o(this.service),this.pushnotifications=new p(this.service),this.data=new q(this.service),"string"!=typeof b||c&&"number"!=typeof c||d?(e.creds.appId=b,e.creds.authKey=c,e.creds.authSecret=d):("number"==typeof c&&(e.creds.appId=c),this.service.setSession({token:b}))},getSession:function(a){this.auth.getSession(a)},createSession:function(a,b){this.auth.createSession(a,b)},destroySession:function(a){this.auth.destroySession(a)},login:function(a,b){this.auth.login(a,b)},logout:function(a){this.auth.logout(a)}};var h=new d;h.QuickBlox=d,b.exports=h},{"./modules/qbAuth":428,"./modules/qbChat":429,"./modules/qbContent":431,"./modules/qbData":432,"./modules/qbLocation":433,"./modules/qbPushNotifications":434,"./modules/qbUsers":435,"./modules/webrtc/qbWebRTCClient":437,"./qbConfig":443,"./qbProxy":445,"./qbStrophe":446,"./qbUtils":447}],445:[function(a,b,c){function d(){this.qbInst={config:e,session:null}}var e=a("./qbConfig"),f=a("./qbUtils"),g=e.version,h="undefined"!=typeof window;if(!h)var i=a("request");var j=h&&window.jQuery&&window.jQuery.ajax||h&&window.Zepto&&window.Zepto.ajax;if(h&&!j)throw new Error("Quickblox requires jQuery or Zepto");d.prototype={setSession:function(a){this.qbInst.session=a},getSession:function(){return this.qbInst.session},handleResponse:function(a,b,c,d){!a||"function"!=typeof e.on.sessionExpired||"Unauthorized"!==a.message&&"401 Unauthorized"!==a.status?a?c(a,null):(e.addISOTime&&(b=f.injectISOTimes(b)),c(null,b)):e.on.sessionExpired(function(){c(a,b)},d)},ajax:function(a,b){f.QBLog("[ServiceProxy]","Request: ",a.type||"GET",{data:JSON.stringify(c)});var c,d=this;a.data&&a.data.file?(c=JSON.parse(JSON.stringify(a)),c.data.file="..."):c=a;var k=function(c){c&&(d.setSession(c),d.ajax(a,b))},l={url:a.url,type:a.type||"GET",dataType:a.dataType||"json",data:a.data||" ",timeout:e.timeout,beforeSend:function(a,b){b.url.indexOf("s3.amazonaws.com")===-1&&d.qbInst.session&&d.qbInst.session.token&&(a.setRequestHeader("QB-Token",d.qbInst.session.token),a.setRequestHeader("QB-SDK","JS "+g+" - Client"))},success:function(c,g,h){f.QBLog("[ServiceProxy]","Response: ",{data:JSON.stringify(c)}),a.url.indexOf(e.urls.session)===-1?d.handleResponse(null,c,b,k):b(null,c)},error:function(c,g,h){f.QBLog("[ServiceProxy]","ajax error",c.status,h,c);var i={code:c.status,status:g,message:h,detail:c.responseText};a.url.indexOf(e.urls.session)===-1?d.handleResponse(i,null,b,k):b(i,null)}};if(!h)var m="json"===l.dataType,n=a.url.indexOf("s3.amazonaws.com")===-1&&d.qbInst&&d.qbInst.session&&d.qbInst.session.token||!1,o={url:l.url,method:l.type,timeout:e.timeout,json:m&&!a.isFileUpload?l.data:null,headers:n?{"QB-Token":d.qbInst.session.token,"QB-SDK":"JS "+g+" - Server"}:null},p=function(a,c,f){if(a||200!==c.statusCode&&201!==c.statusCode&&202!==c.statusCode){var g;try{g={code:c&&c.statusCode||a&&a.code,status:c&&c.headers&&c.headers.status||"error",message:f||a&&a.errno,detail:f&&f.errors||a&&a.syscall}}catch(b){g=a}o.url.indexOf(e.urls.session)===-1?d.handleResponse(g,null,b,k):b(g,null)}else o.url.indexOf(e.urls.session)===-1?d.handleResponse(null,f,b,k):b(null,f)};if("boolean"!=typeof a.contentType&&"string"!=typeof a.contentType||(l.contentType=a.contentType),"boolean"==typeof a.processData&&(l.processData=a.processData),h)j(l);else{var q=i(o,p);if(m){if(a.isFileUpload){var r=q.form();Object.keys(l.data).forEach(function(a,b,c){"file"===a?r.append(a,l.data[a].data,{filename:l.data[a].name}):r.append(a,l.data[a])})}}else{var r=q.form();Object.keys(l.data).forEach(function(a,b,c){r.append(a,l.data[a])})}}}},b.exports=d},{"./qbConfig":443,"./qbUtils":447,request:5}],446:[function(a,b,c){"use strict";function d(){var a=1===f.active?f.bosh:f.websocket,b=new Strophe.Connection(a);return 1===f.active?(b.xmlInput=function(a){if(a.childNodes[0])for(var b=0,c=a.childNodes.length;b16777215&&(h.increment=0),"00000000".substr(0,8-a.length)+a+"000000".substr(0,6-h.machine.length)+h.machine+"0000".substr(0,4-h.pid.length)+h.pid+"000000".substr(0,6-b.length)+b},injectISOTimes:function(a){if(a.created_at)"number"==typeof a.created_at&&(a.iso_created_at=new Date(1e3*a.created_at).toISOString()),"number"==typeof a.updated_at&&(a.iso_updated_at=new Date(1e3*a.updated_at).toISOString());else if(a.items)for(var b=0,c=a.items.length;b=40)return this.reporter.error("Second objid identifier OOB");a.splice(0,2,40*a[0]+a[1])}for(var e=0,d=0;d=128;f>>=7)e++}for(var g=new i(e),h=g.length-1,d=a.length-1;d>=0;d--){var f=a[d];for(g[h--]=127&f;(f>>=7)>0;)g[h--]=128|127&f}return this._createEncoderBuffer(g)},e.prototype._encodeTime=function(a,b){var c,d=new Date(a);return"gentime"===b?c=[f(d.getFullYear()),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):"utctime"===b?c=[f(d.getFullYear()%100),f(d.getUTCMonth()+1),f(d.getUTCDate()),f(d.getUTCHours()),f(d.getUTCMinutes()),f(d.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+b+" time is not supported yet"),this._encodeStr(c,"octstr")},e.prototype._encodeNull=function(){return this._createEncoderBuffer("")},e.prototype._encodeInt=function(a,b){if("string"==typeof a){if(!b)return this.reporter.error("String int or enum given, but no values map");if(!b.hasOwnProperty(a))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(a));a=b[a]}if("number"!=typeof a&&!i.isBuffer(a)){var c=a.toArray();!a.sign&&128&c[0]&&c.unshift(0),a=new i(c)}if(i.isBuffer(a)){var d=a.length;0===a.length&&d++;var e=new i(d);return a.copy(e),0===a.length&&(e[0]=0),this._createEncoderBuffer(e)}if(a<128)return this._createEncoderBuffer(a);if(a<256)return this._createEncoderBuffer([0,a]);for(var d=1,f=a;f>=256;f>>=8)d++;for(var e=new Array(d),f=e.length-1;f>=0;f--)e[f]=255&a,a>>=8;return 128&e[0]&&e.unshift(0),this._createEncoderBuffer(new i(e))},e.prototype._encodeBool=function(a){return this._createEncoderBuffer(a?255:0)},e.prototype._use=function(a,b){return"function"==typeof a&&(a=a(b)),a._getEncoder("der").tree},e.prototype._skipDefault=function(a,b,c){var d,e=this._baseState;if(null===e.default)return!1;var f=a.join();if(void 0===e.defaultBuffer&&(e.defaultBuffer=this._encodeValue(e.default,b,c).join()),f.length!==e.defaultBuffer.length)return!1;for(d=0;d0&&c.ishrn(d),c}function j(a,b){a=i(a,b),a=a.mod(b);var d=new c(a.toArray());if(d.length=b)throw new Error("invalid sig")}var h=a("./curves"),i=a("elliptic"),j=a("parse-asn1"),k=a("bn.js"),l=i.ec;b.exports=d}).call(this,a("buffer").Buffer)},{"./curves":44,"bn.js":45,buffer:8,elliptic:47,"parse-asn1":74}],110:[function(a,b,c){(function(c){function d(a){this.curveType=h[a],this.curveType||(this.curveType={name:a}),this.curve=new f.ec(this.curveType.name),this.keys=void 0}function e(a,b,d){Array.isArray(a)||(a=a.toArray());var e=new c(a);if(d&&e.length>5]|=128<>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,k=271733878,l=0;l>16)+(b>>16)+(c>>16);return d<<16|65535&c}function k(a,b){return a<>>32-b}var l=a("./helpers");b.exports=function(a){return l.hash(a,d,16)}},{"./helpers":137}],139:[function(a,b,c){arguments[4][29][0].apply(c,arguments)},{buffer:8,dup:29,inherits:205,stream:220,string_decoder:221}],140:[function(a,b,c){(function(a){function c(a){for(var b=[],c=0,d=0;c>>5]|=a[c]<<24-d%32;return b}function d(a){for(var b=[],c=0;c<32*a.length;c+=8)b.push(a[c>>>5]>>>24-c%32&255);return b}function e(a,b,c){for(var d=0;d<16;d++){var e=c+d,l=b[e];b[e]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}var s,t,u,v,w,x,y,z,A,B;x=s=a[0],y=t=a[1],z=u=a[2],A=v=a[3],B=w=a[4];var C;for(d=0;d<80;d+=1)C=s+b[c+m[d]]|0,C+=d<16?f(t,u,v)+q[0]:d<32?g(t,u,v)+q[1]:d<48?h(t,u,v)+q[2]:d<64?i(t,u,v)+q[3]:j(t,u,v)+q[4],C=0|C,C=k(C,o[d]),C=C+w|0,s=w,w=v,v=k(u,10),u=t,t=C,C=x+b[c+n[d]]|0,C+=d<16?j(y,z,A)+r[0]:d<32?i(y,z,A)+r[1]:d<48?h(y,z,A)+r[2]:d<64?g(y,z,A)+r[3]:f(y,z,A)+r[4],C=0|C,C=k(C,p[d]),C=C+B|0,x=B,B=A,A=k(z,10),z=y,y=C;C=a[1]+u+A|0,a[1]=a[2]+v+B|0,a[2]=a[3]+w+x|0,a[3]=a[4]+s+y|0,a[4]=a[0]+t+z|0,a[0]=C}function f(a,b,c){return a^b^c}function g(a,b,c){return a&b|~a&c}function h(a,b,c){return(a|~b)^c}function i(a,b,c){return a&c|b&~c}function j(a,b,c){return a^(b|~c)}function k(a,b){return a<>>32-b}function l(b){var f=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof b&&(b=new a(b,"utf8"));var g=c(b),h=8*b.length,i=8*b.length;g[h>>>5]|=128<<24-h%32,g[(h+64>>>9<<4)+14]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);for(var j=0;j>>24)|4278255360&(k<<24|k>>>8)}var l=d(f);return new a(l)}var m=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],n=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],o=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],p=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],q=[0,1518500249,1859775393,2400959708,2840853838],r=[1352829926,1548603684,1836072691,2053994217,0];b.exports=l}).call(this,a("buffer").Buffer)},{buffer:8}],141:[function(a,b,c){(function(a){function c(b,c){this._block=new a(b),this._finalSize=c,this._blockSize=b,this._len=0,this._s=0}c.prototype.update=function(b,c){"string"==typeof b&&(c=c||"utf8",b=new a(b,c));for(var d=this._len+=b.length,e=this._s||0,f=0,g=this._block;e=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(b,this._blockSize-4);var c=this._update(this._block)||this._hash();return a?c.toString(a):c},c.prototype._update=function(){throw new Error("_update must be implemented by subclass")},b.exports=c}).call(this,a("buffer").Buffer)},{buffer:8}],142:[function(a,b,c){var c=b.exports=function(a){a=a.toLowerCase();var b=c[a];if(!b)throw new Error(a+" is not supported (we accept pull requests)");return new b};c.sha=a("./sha"),c.sha1=a("./sha1"),c.sha224=a("./sha224"),c.sha256=a("./sha256"),c.sha384=a("./sha384"),c.sha512=a("./sha512")},{"./sha":143,"./sha1":144,"./sha224":145,"./sha256":146,"./sha384":147,"./sha512":148}],143:[function(a,b,c){(function(c){function d(){this.init(),this._w=k,i.call(this,64,56)}function e(a){return a<<5|a>>>27}function f(a){return a<<30|a>>>2}function g(a,b,c,d){return 0===a?b&c|~b&d:2===a?b&c|b&d|c&d:b^c^d}var h=a("inherits"),i=a("./hash"),j=[1518500249,1859775393,-1894007588,-899497514],k=new Array(80);h(d,i),d.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,h=0|this._c,i=0|this._d,k=0|this._e,l=0;l<16;++l)b[l]=a.readInt32BE(4*l);for(;l<80;++l)b[l]=b[l-3]^b[l-8]^b[l-14]^b[l-16];for(var m=0;m<80;++m){var n=~~(m/20),o=e(c)+g(n,d,h,i)+k+b[m]+j[n]|0;k=i,i=h,h=f(d),d=c,c=o}this._a=c+this._a|0,this._b=d+this._b|0,this._c=h+this._c|0,this._d=i+this._d|0,this._e=k+this._e|0},d.prototype._hash=function(){var a=new c(20);return a.writeInt32BE(0|this._a,0),a.writeInt32BE(0|this._b,4),a.writeInt32BE(0|this._c,8),a.writeInt32BE(0|this._d,12),a.writeInt32BE(0|this._e,16),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],144:[function(a,b,c){(function(c){function d(){this.init(),this._w=l,j.call(this,64,56)}function e(a){return a<<1|a>>>31}function f(a){return a<<5|a>>>27}function g(a){return a<<30|a>>>2}function h(a,b,c,d){return 0===a?b&c|~b&d:2===a?b&c|b&d|c&d:b^c^d}var i=a("inherits"),j=a("./hash"),k=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);i(d,j),d.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,i=0|this._c,j=0|this._d,l=0|this._e,m=0;m<16;++m)b[m]=a.readInt32BE(4*m);for(;m<80;++m)b[m]=e(b[m-3]^b[m-8]^b[m-14]^b[m-16]);for(var n=0;n<80;++n){var o=~~(n/20),p=f(c)+h(o,d,i,j)+l+b[n]+k[o]|0;l=j,j=i,i=g(d),d=c,c=p}this._a=c+this._a|0,this._b=d+this._b|0,this._c=i+this._c|0,this._d=j+this._d|0,this._e=l+this._e|0},d.prototype._hash=function(){var a=new c(20);return a.writeInt32BE(0|this._a,0),a.writeInt32BE(0|this._b,4),a.writeInt32BE(0|this._c,8),a.writeInt32BE(0|this._d,12),a.writeInt32BE(0|this._e,16),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],145:[function(a,b,c){(function(c){function d(){this.init(),this._w=h,g.call(this,64,56)}var e=a("inherits"),f=a("./sha256"),g=a("./hash"),h=new Array(64);e(d,f),d.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},d.prototype._hash=function(){var a=new c(28);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,"./sha256":146,buffer:8,inherits:205}],146:[function(a,b,c){(function(c){function d(){this.init(),this._w=n,l.call(this,64,56)}function e(a,b,c){return c^a&(b^c)}function f(a,b,c){return a&b|c&(a|b)}function g(a){return(a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10)}function h(a){return(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7)}function i(a){return(a>>>7|a<<25)^(a>>>18|a<<14)^a>>>3}function j(a){return(a>>>17|a<<15)^(a>>>19|a<<13)^a>>>10}var k=a("inherits"),l=a("./hash"),m=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=new Array(64);k(d,l),d.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._a,d=0|this._b,k=0|this._c,l=0|this._d,n=0|this._e,o=0|this._f,p=0|this._g,q=0|this._h,r=0;r<16;++r)b[r]=a.readInt32BE(4*r);for(;r<64;++r)b[r]=j(b[r-2])+b[r-7]+i(b[r-15])+b[r-16]|0;for(var s=0;s<64;++s){var t=q+h(n)+e(n,o,p)+m[s]+b[s]|0,u=g(c)+f(c,d,k)|0;q=p,p=o,o=n,n=l+t|0,l=k,k=d,d=c,c=t+u|0}this._a=c+this._a|0,this._b=d+this._b|0,this._c=k+this._c|0,this._d=l+this._d|0,this._e=n+this._e|0,this._f=o+this._f|0,this._g=p+this._g|0,this._h=q+this._h|0},d.prototype._hash=function(){var a=new c(32);return a.writeInt32BE(this._a,0),a.writeInt32BE(this._b,4),a.writeInt32BE(this._c,8),a.writeInt32BE(this._d,12),a.writeInt32BE(this._e,16),a.writeInt32BE(this._f,20),a.writeInt32BE(this._g,24),a.writeInt32BE(this._h,28),a},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],147:[function(a,b,c){(function(c){function d(){this.init(),this._w=h,g.call(this,128,112)}var e=a("inherits"),f=a("./sha512"),g=a("./hash"),h=new Array(160);e(d,f),d.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},d.prototype._hash=function(){function a(a,c,d){b.writeInt32BE(a,d),b.writeInt32BE(c,d+4)}var b=new c(48);return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),b},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,"./sha512":148,buffer:8,inherits:205}],148:[function(a,b,c){(function(c){function d(){this.init(),this._w=q,o.call(this,128,112)}function e(a,b,c){return c^a&(b^c)}function f(a,b,c){return a&b|c&(a|b)}function g(a,b){return(a>>>28|b<<4)^(b>>>2|a<<30)^(b>>>7|a<<25)}function h(a,b){return(a>>>14|b<<18)^(a>>>18|b<<14)^(b>>>9|a<<23)}function i(a,b){return(a>>>1|b<<31)^(a>>>8|b<<24)^a>>>7}function j(a,b){return(a>>>1|b<<31)^(a>>>8|b<<24)^(a>>>7|b<<25)}function k(a,b){return(a>>>19|b<<13)^(b>>>29|a<<3)^a>>>6}function l(a,b){return(a>>>19|b<<13)^(b>>>29|a<<3)^(a>>>6|b<<26)}function m(a,b){return a>>>0>>0?1:0}var n=a("inherits"),o=a("./hash"),p=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],q=new Array(160);n(d,o),d.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},d.prototype._update=function(a){for(var b=this._w,c=0|this._ah,d=0|this._bh,n=0|this._ch,o=0|this._dh,q=0|this._eh,r=0|this._fh,s=0|this._gh,t=0|this._hh,u=0|this._al,v=0|this._bl,w=0|this._cl,x=0|this._dl,y=0|this._el,z=0|this._fl,A=0|this._gl,B=0|this._hl,C=0;C<32;C+=2)b[C]=a.readInt32BE(4*C),b[C+1]=a.readInt32BE(4*C+4);for(;C<160;C+=2){var D=b[C-30],E=b[C-30+1],F=i(D,E),G=j(E,D);D=b[C-4],E=b[C-4+1];var H=k(D,E),I=l(E,D),J=b[C-14],K=b[C-14+1],L=b[C-32],M=b[C-32+1],N=G+K|0,O=F+J+m(N,G)|0;N=N+I|0,O=O+H+m(N,I)|0,N=N+M|0,O=O+L+m(N,M)|0,b[C]=O,b[C+1]=N}for(var P=0;P<160;P+=2){O=b[P],N=b[P+1];var Q=f(c,d,n),R=f(u,v,w),S=g(c,u),T=g(u,c),U=h(q,y),V=h(y,q),W=p[P],X=p[P+1],Y=e(q,r,s),Z=e(y,z,A),$=B+V|0,_=t+U+m($,B)|0;$=$+Z|0,_=_+Y+m($,Z)|0,$=$+X|0,_=_+W+m($,X)|0,$=$+N|0,_=_+O+m($,N)|0;var aa=T+R|0,ba=S+Q+m(aa,T)|0;t=s,B=A,s=r,A=z,r=q,z=y,y=x+$|0,q=o+_+m(y,x)|0,o=n,x=w,n=d,w=v,d=c,v=u,u=$+aa|0,c=_+ba+m(u,$)|0}this._al=this._al+u|0,this._bl=this._bl+v|0,this._cl=this._cl+w|0,this._dl=this._dl+x|0,this._el=this._el+y|0,this._fl=this._fl+z|0,this._gl=this._gl+A|0,this._hl=this._hl+B|0,this._ah=this._ah+c+m(this._al,u)|0,this._bh=this._bh+d+m(this._bl,v)|0,this._ch=this._ch+n+m(this._cl,w)|0,this._dh=this._dh+o+m(this._dl,x)|0,this._eh=this._eh+q+m(this._el,y)|0,this._fh=this._fh+r+m(this._fl,z)|0,this._gh=this._gh+s+m(this._gl,A)|0,this._hh=this._hh+t+m(this._hl,B)|0},d.prototype._hash=function(){function a(a,c,d){b.writeInt32BE(a,d),b.writeInt32BE(c,d+4)}var b=new c(64);return a(this._ah,this._al,0),a(this._bh,this._bl,8),a(this._ch,this._cl,16),a(this._dh,this._dl,24),a(this._eh,this._el,32),a(this._fh,this._fl,40),a(this._gh,this._gl,48),a(this._hh,this._hl,56), +b},b.exports=d}).call(this,a("buffer").Buffer)},{"./hash":141,buffer:8,inherits:205}],149:[function(a,b,c){(function(c){"use strict";function d(a,b){g.call(this),a=a.toLowerCase(),"string"==typeof b&&(b=new c(b));var d="sha512"===a||"sha384"===a?128:64;this._alg=a,this._key=b,b.length>d?b=e(a).update(b).digest():b.lengtha;)c.ishrn(1);if(c.isEven()&&c.iadd(m),c.testn(1)||c.iadd(n),b.cmp(n)){if(!b.cmp(o))for(;c.mod(p).cmp(q);)c.iadd(s)}else for(;c.mod(j).cmp(r);)c.iadd(s);if(d=c.shrn(1),e(d)&&e(c)&&f(d)&&f(c)&&l.test(d)&&l.test(c))return c}}var h=a("randombytes");b.exports=g,g.simpleSieve=e,g.fermatTest=f;var i=a("bn.js"),j=new i(24),k=a("miller-rabin"),l=new k,m=new i(1),n=new i(2),o=new i(5),p=(new i(16),new i(8),new i(10)),q=new i(3),r=(new i(7),new i(11)),s=new i(4),t=(new i(12),null)},{"bn.js":154,"miller-rabin":155,randombytes:203}],153:[function(a,b,c){b.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],154:[function(a,b,c){arguments[4][45][0].apply(c,arguments)},{dup:45}],155:[function(a,b,c){function d(a){this.rand=a||new f.Rand}var e=a("bn.js"),f=a("brorand");b.exports=d,d.create=function(a){return new d(a)},d.prototype._rand=function(a){var b=a.bitLength(),c=this.rand.generate(Math.ceil(b/8));c[0]|=3;var d=7&b;return 0!==d&&(c[c.length-1]>>=7-d),new e(c)},d.prototype.test=function(a,b,c){var d=a.bitLength(),f=e.mont(a),g=new e(1).toRed(f);b||(b=Math.max(1,d/48|0));for(var h=a.subn(1),i=h.subn(1),j=0;!h.testn(j);j++);for(var k=a.shrn(j),l=h.toRed(f),m=!0;b>0;b--){var n=this._rand(i);c&&c(n);var o=n.toRed(f).redPow(k);if(0!==o.cmp(g)&&0!==o.cmp(l)){for(var p=1;p0;b--){var l=this._rand(h),m=a.gcd(l);if(0!==m.cmpn(1))return m;var n=l.toRed(d).redPow(j);if(0!==n.cmp(f)&&0!==n.cmp(k)){for(var o=1;og)throw new TypeError("Bad key length");h=h||"sha1",b.isBuffer(a)||(a=new b(a,"binary")),b.isBuffer(c)||(c=new b(c,"binary"));var i,j=1,k=new b(e),l=new b(c.length+4);c.copy(l,0,0,c.length);for(var m,n,o=1;o<=j;o++){l.writeUInt32BE(o,c.length);var p=f(h,a).update(l).digest();i||(i=p.length,n=new b(i),j=Math.ceil(e/i),m=e-(j-1)*i),p.copy(n,0,0,i);for(var q=1;q=b.length){f++;break}var g=b.slice(2,e-1);b.slice(e-1,e);if(("0002"!==d.toString("hex")&&!c||"0001"!==d.toString("hex")&&c)&&f++,g.length<8&&f++,f)throw new Error("decryption error");return b.slice(e)}function f(a,b){a=new c(a),b=new c(b);var d=0,e=a.length;a.length!==b.length&&(d++,e=Math.min(a.length,b.length));for(var f=-1;++fl||new j(b).cmp(i.modulus)>=0)throw new Error("decryption error");var n;n=f?m(new j(b),i):k(b,i);var o=new c(l-n.length);if(o.fill(0),n=c.concat([o,n],l),4===h)return d(i,n);if(1===h)return e(i,n,f);if(3===h)return n;throw new Error("unknown padding")}}).call(this,a("buffer").Buffer)},{"./mgf":159,"./withPublic":201,"./xor":202,"bn.js":160,"browserify-rsa":161,buffer:8,"create-hash":136,"parse-asn1":165}],200:[function(a,b,c){(function(c){function d(a,b){var d=a.modulus.byteLength(),e=b.length,f=i("sha1").update(new c("")).digest(),g=f.length,m=2*g;if(e>d-m-2)throw new Error("message too long");var n=new c(d-e-m-2);n.fill(0);var o=d-g-1,p=h(g),q=k(c.concat([f,n,new c([1]),b],o),j(p,o)),r=k(p,j(q,g));return new l(c.concat([new c([0]),r,q],d))}function e(a,b,d){var e=b.length,g=a.modulus.byteLength();if(e>g-11)throw new Error("message too long");var h;return d?(h=new c(g-e-3),h.fill(255)):h=f(g-e-3),new l(c.concat([new c([0,d?1:2]),h,new c([0]),b],g))}function f(a,b){for(var d,e=new c(a),f=0,g=h(2*a),i=0;f=0)throw new Error("data too long for modulus")}return c?n(h,i):m(h,i)}}).call(this,a("buffer").Buffer)},{"./mgf":159,"./withPublic":201,"./xor":202,"bn.js":160,"browserify-rsa":161,buffer:8,"create-hash":136,"parse-asn1":165,randombytes:203}],201:[function(a,b,c){(function(c){function d(a,b){return new c(a.toRed(e.mont(b.modulus)).redPow(new e(b.publicExponent)).fromRed().toArray())}var e=a("bn.js");b.exports=d}).call(this,a("buffer").Buffer)},{"bn.js":160,buffer:8}],202:[function(a,b,c){b.exports=function(a,b){for(var c=a.length,d=-1;++d65536)throw new Error("requested too many random bytes");var f=new c.Uint8Array(b);b>0&&g.getRandomValues(f);var h=new d(f.buffer);return"function"==typeof e?a.nextTick(function(){e(null,h)}):h}var g=c.crypto||c.msCrypto;g&&g.getRandomValues?b.exports=f:b.exports=e}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},a("buffer").Buffer)},{_process:208,buffer:8}],204:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||a<0||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;throw TypeError('Uncaught, unspecified "error" event.')}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(d=arguments.length,f=new Array(d-1),i=1;i0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())}return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-- >0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(d<0)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?e(a._events[b])?1:a._events[b].length:0}},{}],205:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],206:[function(a,b,c){b.exports=function(a){return!(null==a||!(a._isBuffer||a.constructor&&"function"==typeof a.constructor.isBuffer&&a.constructor.isBuffer(a)))}},{}],207:[function(a,b,c){b.exports=Array.isArray||function(a){return"[object Array]"==Object.prototype.toString.call(a)}},{}],208:[function(a,b,c){function d(){m&&k&&(m=!1,k.length?l=k.concat(l):n=-1,l.length&&e())}function e(){if(!m){var a=h(d);m=!0;for(var b=l.length;b;){for(k=l,l=[];++n1)for(var c=1;c0)if(b.ended&&!e){var h=new Error("stream.push() after EOF");a.emit("error",h)}else if(b.endEmitted&&e){var h=new Error("stream.unshift() after end event");a.emit("error",h)}else!b.decoder||e||d||(c=b.decoder.write(c)),e||(b.reading=!1),b.flowing&&0===b.length&&!b.sync?(a.emit("data",c),a.read(0)):(b.length+=b.objectMode?1:c.length,e?b.buffer.unshift(c):b.buffer.push(c),b.needReadable&&l(a)),n(a,b);else e||(b.reading=!1);return g(b)}function g(a){return!a.ended&&(a.needReadable||a.length=E)a=E;else{a--;for(var b=1;b<32;b<<=1)a|=a>>b;a++}return a}function i(a,b){return 0===b.length&&b.ended?0:b.objectMode?0===a?0:1:isNaN(a)||B.isNull(a)?b.flowing&&b.buffer.length?b.buffer[0].length:b.length:a<=0?0:(a>b.highWaterMark&&(b.highWaterMark=h(a)),a>b.length?b.ended?b.length:(b.needReadable=!0,0):a)}function j(a,b){var c=null;return B.isBuffer(b)||B.isString(b)||B.isNullOrUndefined(b)||a.objectMode||(c=new TypeError("Invalid non-string/buffer chunk")),c}function k(a,b){if(b.decoder&&!b.ended){var c=b.decoder.end();c&&c.length&&(b.buffer.push(c),b.length+=b.objectMode?1:c.length)}b.ended=!0,l(a)}function l(a){var b=a._readableState;b.needReadable=!1,b.emittedReadable||(D("emitReadable",b.flowing),b.emittedReadable=!0,b.sync?c.nextTick(function(){m(a)}):m(a))}function m(a){D("emit readable"),a.emit("readable"),s(a)}function n(a,b){b.readingMore||(b.readingMore=!0,c.nextTick(function(){ +o(a,b)}))}function o(a,b){for(var c=b.length;!b.reading&&!b.flowing&&!b.ended&&b.length=e)c=f?d.join(""):y.concat(d,e),d.length=0;else if(a0)throw new Error("endReadable called on non-empty stream");b.endEmitted||(b.ended=!0,c.nextTick(function(){b.endEmitted||0!==b.length||(b.endEmitted=!0,a.readable=!1,a.emit("end"))}))}function v(a,b){for(var c=0,d=a.length;c0)&&(b.emittedReadable=!1),0===a&&b.needReadable&&(b.length>=b.highWaterMark||b.ended))return D("read: emitReadable",b.length,b.ended),0===b.length&&b.ended?u(this):l(this),null;if(a=i(a,b),0===a&&b.ended)return 0===b.length&&u(this),null;var d=b.needReadable;D("need readable",d),(0===b.length||b.length-a0?t(a,b):null,B.isNull(e)&&(b.needReadable=!0,a=0),b.length-=a,0!==b.length||b.ended||(b.needReadable=!0),c!==a&&b.ended&&0===b.length&&u(this),B.isNull(e)||this.emit("data",e),e},e.prototype._read=function(a){this.emit("error",new Error("not implemented"))},e.prototype.pipe=function(a,b){function d(a){D("onunpipe"),a===l&&f()}function e(){D("onend"),a.end()}function f(){D("cleanup"),a.removeListener("close",i),a.removeListener("finish",j),a.removeListener("drain",q),a.removeListener("error",h),a.removeListener("unpipe",d),l.removeListener("end",e),l.removeListener("end",f),l.removeListener("data",g),!m.awaitDrain||a._writableState&&!a._writableState.needDrain||q()}function g(b){D("ondata");var c=a.write(b);!1===c&&(D("false write response, pause",l._readableState.awaitDrain),l._readableState.awaitDrain++,l.pause())}function h(b){D("onerror",b),k(),a.removeListener("error",h),0===z.listenerCount(a,"error")&&a.emit("error",b)}function i(){a.removeListener("finish",j),k()}function j(){D("onfinish"),a.removeListener("close",i),k()}function k(){D("unpipe"),l.unpipe(a)}var l=this,m=this._readableState;switch(m.pipesCount){case 0:m.pipes=a;break;case 1:m.pipes=[m.pipes,a];break;default:m.pipes.push(a)}m.pipesCount+=1,D("pipe count=%d opts=%j",m.pipesCount,b);var n=(!b||b.end!==!1)&&a!==c.stdout&&a!==c.stderr,o=n?e:f;m.endEmitted?c.nextTick(o):l.once("end",o),a.on("unpipe",d);var q=p(l);return a.on("drain",q),l.on("data",g),a._events&&a._events.error?x(a._events.error)?a._events.error.unshift(h):a._events.error=[h,a._events.error]:a.on("error",h),a.once("close",i),a.once("finish",j),a.emit("pipe",l),m.flowing||(D("pipe resume"),l.resume()),a},e.prototype.unpipe=function(a){var b=this._readableState;if(0===b.pipesCount)return this;if(1===b.pipesCount)return a&&a!==b.pipes?this:(a||(a=b.pipes),b.pipes=null,b.pipesCount=0,b.flowing=!1,a&&a.emit("unpipe",this),this);if(!a){var c=b.pipes,d=b.pipesCount;b.pipes=null,b.pipesCount=0,b.flowing=!1;for(var e=0;e1){for(var c=[],d=0;d=this.charLength-this.charReceived?this.charLength-this.charReceived:a.length;if(a.copy(this.charBuffer,this.charReceived,0,c),this.charReceived+=c,this.charReceived=55296&&d<=56319)){if(this.charReceived=this.charLength=0,0===a.length)return b;break}this.charLength+=this.surrogateSize,b=""}this.detectIncompleteChar(a);var e=a.length;this.charLength&&(a.copy(this.charBuffer,0,a.length-this.charReceived,e),e-=this.charReceived),b+=a.toString(this.encoding,0,e);var e=b.length-1,d=b.charCodeAt(e);if(d>=55296&&d<=56319){var f=this.surrogateSize;return this.charLength+=f,this.charReceived+=f,this.charBuffer.copy(this.charBuffer,f,0,f),a.copy(this.charBuffer,0,0,f),b.substring(0,e)}return b},j.prototype.detectIncompleteChar=function(a){for(var b=a.length>=3?3:a.length;b>0;b--){var c=a[a.length-b];if(1==b&&c>>5==6){this.charLength=2;break}if(b<=2&&c>>4==14){this.charLength=3;break}if(b<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=b},j.prototype.end=function(a){var b="";if(a&&a.length&&(b=this.write(a)),this.charReceived){var c=this.charReceived,d=this.charBuffer,e=this.encoding;b+=d.slice(0,c).toString(e)}return b}},{buffer:8}],222:[function(a,b,c){function d(a,b){this._id=a,this._clearFn=b}var e=a("process/browser.js").nextTick,f=Function.prototype.apply,g=Array.prototype.slice,h={},i=0;c.setTimeout=function(){return new d(f.call(setTimeout,window,arguments),clearTimeout)},c.setInterval=function(){return new d(f.call(setInterval,window,arguments),clearInterval)},c.clearTimeout=c.clearInterval=function(a){a.close()},d.prototype.unref=d.prototype.ref=function(){},d.prototype.close=function(){this._clearFn.call(window,this._id)},c.enroll=function(a,b){clearTimeout(a._idleTimeoutId),a._idleTimeout=b},c.unenroll=function(a){clearTimeout(a._idleTimeoutId),a._idleTimeout=-1},c._unrefActive=c.active=function(a){clearTimeout(a._idleTimeoutId);var b=a._idleTimeout;b>=0&&(a._idleTimeoutId=setTimeout(function(){a._onTimeout&&a._onTimeout()},b))},c.setImmediate="function"==typeof setImmediate?setImmediate:function(a){var b=i++,d=!(arguments.length<2)&&g.call(arguments,1);return h[b]=!0,e(function(){h[b]&&(d?a.apply(null,d):a.call(null),c.clearImmediate(b))}),b},c.clearImmediate="function"==typeof clearImmediate?clearImmediate:function(a){delete h[a]}},{"process/browser.js":208}],223:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],224:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(d<0)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;g-1&&(h=f?h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return a<10?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(a){return"[Circular]"}default:return a}}),h=d[c];c=0&&(this.availableSaslMechanisms=this.availableSaslMechanisms.splice(b,1))},b.exports=d}).call(this,"/node_modules\\node-xmpp-client\\lib")},{"./authentication/anonymous":229,"./authentication/digestmd5":230,"./authentication/external":231,"./authentication/plain":233,"./authentication/xoauth2":234,"./sasl":236,"./session":237,buffer:8,child_process:5,debug:239,"node-xmpp-core":245,path:7}],229:[function(a,b,c){"use strict";function d(){}var e=a("./mechanism"),f=a("node-xmpp-core").inherits;f(d,e),d.prototype.name="ANONYMOUS",d.prototype.auth=function(){return this.authzid},d.prototype.match=function(){return!0},b.exports=d},{"./mechanism":232,"node-xmpp-core":245}],230:[function(a,b,c){"use strict";function d(a,b){var c=m.createHash?m.createHash("md5"):new n;return c.update(a,"binary").digest(b||"binary")}function e(a){return d(a,"hex")}function f(a){for(var b={};a;){var c;(c=/^(.+?)=(.*?[^\\]),\s*(.*)/.exec(a))?(b[c[1]]=c[2].replace(/"/g,""),a=c[3]):(c=/^(.+?)=(.+?),\s*(.*)/.exec(a))?(b[c[1]]=c[2],a=c[3]):(c=/^(.+?)="(.*?[^\\])"$/.exec(a))?(b[c[1]]=c[2],a=c[3]):(c=/^(.+?)=(.+?)$/.exec(a))?(b[c[1]]=c[2],a=c[3]):a=null}return b}function g(a){var b="";for(var c in a){var d=a[c];d&&(b+=","+c+'="'+d+'"')}return b.substr(1)}function h(a,b,c){for(;a.length0?(b.emit("connect"),b.processResponse(d),c.nextTick(b.mayRequest.bind(b))):b.emit("error","Invalid parameters"))})}var e=a("events").EventEmitter,f=a("node-xmpp-core"),g=f.inherits,h=f.ltx,i=a("request"),j=a("debug")("xmpp:client:bosh");g(d,e),d.prototype.contentType="text/xml; charset=utf-8",d.prototype.send=function(a){this.queue.push(a.root()),c.nextTick(this.mayRequest.bind(this))},d.prototype.startStream=function(){var a=this;this.rid++,this.request({to:this.jid.domain,"xmpp:restart":"true"},[],function(b,d){b?(a.emit("error",b),a.emit("disconnect"),a.emit("end"),delete a.sid,a.emit("close")):(a.streamOpened=!0,d&&a.processResponse(d),c.nextTick(a.mayRequest.bind(a)))})},d.prototype.processResponse=function(a){if(j("process bosh server response "+a.toString()),a&&a.children)for(var b=0;b0&&this.currentRequests=400)return c(new Error("HTTP status "+g.statusCode));var j;try{j=h.parse(i)}catch(a){return c(a)}j&&"terminate"===j.attrs.type&&j.attrs.condition?c(new Error(j.attrs.condition)):j?c(null,j):c(new Error("no "))}),this.currentRequests++},b.exports=d}).call(this,a("_process"))},{_process:208,debug:239,events:204,"node-xmpp-core":245,request:5}],236:[function(a,b,c){"use strict";function d(a,b,c){var d,e=[],f={};return Array.isArray(c)&&(e=e.concat(c)),e.forEach(function(a){f[a.prototype.name]=a}),f[b]&&a.indexOf(b)>=0&&(d=f[b]),e.forEach(function(b){!d&&a.indexOf(b.prototype.name)>=0&&(d=b)}),d?new d:null}function e(a,b){var c=b||[],d=[];return c.forEach(function(b){var c=b.prototype.match;c(a)&&d.push(b)}),d}var f=a("./authentication/mechanism");c.selectMechanism=d,c.detectMechanisms=e,c.AbstractMechanism=f},{"./authentication/mechanism":232}],237:[function(a,b,c){(function(c){"use strict";function d(a){f.call(this),this.setOptions(a),a.websocket&&a.websocket.url?(n("start websocket connection"),this._setupWebsocketConnection(a)):a.bosh&&a.bosh.url?(n("start bosh connection"),this._setupBoshConnection(a)):(n("start socket connection"),this._setupSocketConnection(a))}var e=a("tls"),f=a("events").EventEmitter,g=a("node-xmpp-core"),h=g.inherits,i=g.Connection,j=g.JID,k=g.SRV,l=a("./bosh"),m=a("./websockets"),n=a("debug")("xmpp:client:session");h(d,f),d.prototype._setupSocketConnection=function(a){var b={xmlns:{"":a.xmlns},streamAttrs:{version:"1.0",to:this.jid.domain},serialized:a.serialized};for(var c in a)c in b||(b[c]=a[c]);if(this.connection=new i(b),this._addConnectionListeners(),a.host)this._socketConnectionToHost(a);else{if(!k)throw new Error("Cannot load SRV");this._performSrvLookup(a)}},d.prototype._socketConnectionToHost=function(a){var b=this;a.legacySSL?(this.connection.allowTLS=!1,this.connection.connect({socket:function(){return e.connect(a.port||5223,a.host,a.credentials||{},function(){this.socket.authorized?b.emit("connect",this.socket):b.emit("error","unauthorized")}.bind(this))}})):(a.credentials&&(this.connection.credentials=e.createSecureContext(a.credentials)),a.disallowTLS&&(this.connection.allowTLS=!1),this.connection.listen({socket:function(){c.nextTick(function(){this.socket.connect(a.port||5222,a.host)}.bind(this));var b=a.socket;return a.socket=null,b}}))},d.prototype._performSrvLookup=function(a){if(a.legacySSL)throw new Error("LegacySSL mode does not support DNS lookups");a.credentials&&(this.connection.credentials=e.createSecureContext(a.credentials)),a.disallowTLS&&(this.connection.allowTLS=!1),this.connection.listen({socket:k.connect({socket:a.socket,services:["_xmpp-client._tcp"],domain:this.jid.domain,defaultPort:5222})})},d.prototype._setupBoshConnection=function(a){this.connection=new l({jid:this.jid,bosh:a.bosh}),this._addConnectionListeners(),this.connection.on("connected",function(){this.connection.startStream&&this.connection.startStream()}.bind(this))},d.prototype._setupWebsocketConnection=function(a){this.connection=new m({jid:this.jid,websocket:a.websocket}),this._addConnectionListeners(),this.connection.on("connected",function(){this.connection.startStream&&this.connection.startStream()}.bind(this))},d.prototype.setOptions=function(a){this.jid="string"==typeof a.jid?new j(a.jid):a.jid,this.password=a.password,this.preferredSaslMechanism=a.preferredSaslMechanism,this.api_key=a.api_key,this.access_token=a.access_token,this.oauth2_token=a.oauth2_token,this.oauth2_auth=a.oauth2_auth,this.register=a.register,"string"==typeof a.actAs?this.actAs=new j(a.actAs):this.actAs=a.actAs},d.prototype._addConnectionListeners=function(a){a=a||this.connection,a.on("stanza",this.onStanza.bind(this)),a.on("drain",this.emit.bind(this,"drain")),a.on("end",this.emit.bind(this,"end")),a.on("close",this.emit.bind(this,"close")),a.on("error",this.emit.bind(this,"error")),a.on("connect",this.emit.bind(this,"connect")),a.on("reconnect",this.emit.bind(this,"reconnect")),a.on("disconnect",this.emit.bind(this,"disconnect")),a.startStream&&(a.on("connect",function(){a.startStream()}),this.on("auth",function(){a.startStream()}))},d.prototype.pause=function(){this.connection&&this.connection.pause&&this.connection.pause()},d.prototype.resume=function(){this.connection&&this.connection.resume&&this.connection.resume()},d.prototype.send=function(a){return!!this.connection&&this.connection.send(a)},d.prototype.end=function(){this.connection&&this.connection.end()},d.prototype.onStanza=function(){},b.exports=d}).call(this,a("_process"))},{"./bosh":235,"./websockets":238,_process:208,debug:239,events:204,"node-xmpp-core":245,tls:5}],238:[function(a,b,c){"use strict";function d(a){e.call(this),this.url=a.websocket.url,this.jid=a.jid,this.xmlns={"":n},this.websocket=new l(this.url,["xmpp"]),this.websocket.onopen=this.onopen.bind(this),this.websocket.onmessage=this.onmessage.bind(this),this.websocket.onclose=this.onclose.bind(this),this.websocket.onerror=this.onerror.bind(this)}var e=a("events").EventEmitter,f=a("node-xmpp-core"),g=f.Element,h=f.StreamParser,i=f.Connection,j=f.inherits,k=a("ws"),l=k.Server?k:window.WebSocket,m=a("debug")("xmpp:client:websocket"),n="urn:ietf:params:xml:ns:xmpp-framing";j(d,e),d.prototype.maxStanzaSize=65535,d.prototype.xmppVersion="1.0",d.prototype.onopen=function(){this.startParser(),this.emit("connected")},d.prototype.startParser=function(){var a=this;this.parser=new h.StreamParser(this.maxStanzaSize),this.parser.on("start",function(b){a.streamAttrs=b,a.streamNsAttrs={};for(var c in b)"xmlns"!==c&&"xmlns:"!==c.substr(0,6)||(a.streamNsAttrs[c]=b[c]);a.emit("streamStart",b)}),this.parser.on("stanza",function(b){a.onStanza(b)}),this.parser.on("error",this.onerror.bind(this)),this.parser.on("end",function(){a.stopParser(),a.end()})},d.prototype.stopParser=function(){this.parser&&delete this.parser},d.prototype.onmessage=function(a){m("ws msg <--",a.data),a&&a.data&&this.parser&&this.parser.write(a.data)},d.prototype.onStanza=function(a){a.is("error",i.NS_STREAM)?this.emit("error",a):this.emit("stanza",a)},d.prototype.startStream=function(){var a={};for(var b in this.xmlns)this.xmlns.hasOwnProperty(b)&&(b?a["xmlns:"+b]=this.xmlns[b]:a.xmlns=this.xmlns[b]);this.xmppVersion&&(a.version=this.xmppVersion),this.streamTo&&(a.to=this.streamTo),this.jid&&(a.to=this.jid.domain),this.send(new g("open",a)),this.streamOpened=!0},d.prototype.send=function(a){a.root&&(a=a.root()),!a.attrs.xmlns&&(a.is("iq")||a.is("presence")||a.is("message"))&&(a.attrs.xmlns="jabber:client"),a=a.toString(),m("ws send -->",a),this.websocket.send(a)},d.prototype.onclose=function(){this.emit("disconnect"),this.emit("close")},d.prototype.end=function(){this.send(new g("close",{xmlns:n})),this.emit("disconnect"),this.emit("end"),this.websocket&&this.websocket.close()},d.prototype.onerror=function(a){this.emit("error",a)},b.exports=d},{debug:239,events:204,"node-xmpp-core":245,ws:7}],239:[function(a,b,c){function d(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function e(){var a=arguments,b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+c.humanize(this.diff),!b)return a;var d="color: "+this.color;a=[a[0],d,"color: inherit"].concat(Array.prototype.slice.call(a,1));var e=0,f=0;return a[0].replace(/%[a-z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,d),a}function f(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function g(a){try{null==a?c.storage.removeItem("debug"):c.storage.debug=a}catch(a){}}function h(){var a;try{a=c.storage.debug}catch(a){}return a}function i(){try{return window.localStorage}catch(a){}}c=b.exports=a("./debug"),c.log=f,c.formatArgs=e,c.save=g,c.load=h,c.useColors=d,c.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),c.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],c.formatters.j=function(a){return JSON.stringify(a)},c.enable(h())},{"./debug":240}],240:[function(a,b,c){function d(){return c.colors[k++%c.colors.length]}function e(a){function b(){}function e(){var a=e,b=+new Date,f=b-(j||b);a.diff=f,a.prev=j,a.curr=b,j=b,null==a.useColors&&(a.useColors=c.useColors()),null==a.color&&a.useColors&&(a.color=d());var g=Array.prototype.slice.call(arguments);g[0]=c.coerce(g[0]),"string"!=typeof g[0]&&(g=["%o"].concat(g));var h=0;g[0]=g[0].replace(/%([a-z%])/g,function(b,d){if("%%"===b)return b;h++;var e=c.formatters[d];if("function"==typeof e){var f=g[h];b=e.call(a,f),g.splice(h,1),h--}return b}),"function"==typeof c.formatArgs&&(g=c.formatArgs.apply(a,g));var i=e.log||c.log||console.log.bind(console);i.apply(a,g)}b.enabled=!1,e.enabled=!0;var f=c.enabled(a)?e:b;return f.namespace=a,f}function f(a){c.save(a);for(var b=(a||"").split(/[\s,]+/),d=b.length,e=0;e1e4)){var b=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a);if(b){var c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*l;case"days":case"day":case"d":return c*k;case"hours":case"hour":case"hrs":case"hr":case"h":return c*j;case"minutes":case"minute":case"mins":case"min":case"m":return c*i;case"seconds":case"second":case"secs":case"sec":case"s":return c*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c}}}}function e(a){return a>=k?Math.round(a/k)+"d":a>=j?Math.round(a/j)+"h":a>=i?Math.round(a/i)+"m":a>=h?Math.round(a/h)+"s":a+"ms"}function f(a){return g(a,k,"day")||g(a,j,"hour")||g(a,i,"minute")||g(a,h,"second")||a+" ms"}function g(a,b,c){if(!(a>>32-b}function f(a,b,c,d,f,g,h){return e(a+(b&c|~b&d)+f+g|0,h)+b|0}function g(a,b,c,d,f,g,h){return e(a+(b&d|c&~d)+f+g|0,h)+b|0}function h(a,b,c,d,f,g,h){return e(a+(b^c^d)+f+g|0,h)+b|0}function i(a,b,c,d,f,g,h){return e(a+(c^(b|~d))+f+g|0,h)+b|0}var j=a("inherits"),k=a("hash-base"),l=new Array(16);j(d,k),d.prototype._update=function(){for(var a=l,b=0;b<16;++b)a[b]=this._block.readInt32LE(4*b);var c=this._a,d=this._b,e=this._c,j=this._d;c=f(c,d,e,j,a[0],3614090360,7),j=f(j,c,d,e,a[1],3905402710,12),e=f(e,j,c,d,a[2],606105819,17),d=f(d,e,j,c,a[3],3250441966,22),c=f(c,d,e,j,a[4],4118548399,7),j=f(j,c,d,e,a[5],1200080426,12),e=f(e,j,c,d,a[6],2821735955,17),d=f(d,e,j,c,a[7],4249261313,22),c=f(c,d,e,j,a[8],1770035416,7),j=f(j,c,d,e,a[9],2336552879,12),e=f(e,j,c,d,a[10],4294925233,17),d=f(d,e,j,c,a[11],2304563134,22),c=f(c,d,e,j,a[12],1804603682,7),j=f(j,c,d,e,a[13],4254626195,12),e=f(e,j,c,d,a[14],2792965006,17),d=f(d,e,j,c,a[15],1236535329,22),c=g(c,d,e,j,a[1],4129170786,5),j=g(j,c,d,e,a[6],3225465664,9),e=g(e,j,c,d,a[11],643717713,14),d=g(d,e,j,c,a[0],3921069994,20),c=g(c,d,e,j,a[5],3593408605,5),j=g(j,c,d,e,a[10],38016083,9),e=g(e,j,c,d,a[15],3634488961,14),d=g(d,e,j,c,a[4],3889429448,20),c=g(c,d,e,j,a[9],568446438,5),j=g(j,c,d,e,a[14],3275163606,9),e=g(e,j,c,d,a[3],4107603335,14),d=g(d,e,j,c,a[8],1163531501,20),c=g(c,d,e,j,a[13],2850285829,5),j=g(j,c,d,e,a[2],4243563512,9),e=g(e,j,c,d,a[7],1735328473,14),d=g(d,e,j,c,a[12],2368359562,20),c=h(c,d,e,j,a[5],4294588738,4),j=h(j,c,d,e,a[8],2272392833,11),e=h(e,j,c,d,a[11],1839030562,16),d=h(d,e,j,c,a[14],4259657740,23),c=h(c,d,e,j,a[1],2763975236,4),j=h(j,c,d,e,a[4],1272893353,11),e=h(e,j,c,d,a[7],4139469664,16),d=h(d,e,j,c,a[10],3200236656,23),c=h(c,d,e,j,a[13],681279174,4),j=h(j,c,d,e,a[0],3936430074,11),e=h(e,j,c,d,a[3],3572445317,16),d=h(d,e,j,c,a[6],76029189,23),c=h(c,d,e,j,a[9],3654602809,4),j=h(j,c,d,e,a[12],3873151461,11),e=h(e,j,c,d,a[15],530742520,16),d=h(d,e,j,c,a[2],3299628645,23),c=i(c,d,e,j,a[0],4096336452,6),j=i(j,c,d,e,a[7],1126891415,10),e=i(e,j,c,d,a[14],2878612391,15),d=i(d,e,j,c,a[5],4237533241,21),c=i(c,d,e,j,a[12],1700485571,6),j=i(j,c,d,e,a[3],2399980690,10),e=i(e,j,c,d,a[10],4293915773,15),d=i(d,e,j,c,a[1],2240044497,21),c=i(c,d,e,j,a[8],1873313359,6),j=i(j,c,d,e,a[15],4264355552,10),e=i(e,j,c,d,a[6],2734768916,15),d=i(d,e,j,c,a[13],1309151649,21),c=i(c,d,e,j,a[4],4149444226,6),j=i(j,c,d,e,a[11],3174756917,10),e=i(e,j,c,d,a[2],718787259,15),d=i(d,e,j,c,a[9],3951481745,21),this._a=this._a+c|0,this._b=this._b+d|0,this._c=this._c+e|0,this._d=this._d+j|0},d.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var a=new c(16);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a},b.exports=d}).call(this,a("buffer").Buffer)},{buffer:8,"hash-base":243,inherits:244}],243:[function(a,b,c){(function(c){"use strict";function d(a){e.call(this),this._block=new c(a),this._blockSize=a,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}var e=a("stream").Transform,f=a("inherits");f(d,e),d.prototype._transform=function(a,b,d){var e=null;try{"buffer"!==b&&(a=new c(a,b)),this.update(a)}catch(a){e=a}d(e)},d.prototype._flush=function(a){var b=null;try{this.push(this._digest())}catch(a){b=a}a(b)},d.prototype.update=function(a,b){if(!c.isBuffer(a)&&"string"!=typeof a)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");c.isBuffer(a)||(a=new c(a,b));for(var d=this._block,e=0;this._blockOffset+a.length-e>=this._blockSize;){for(var f=this._blockOffset;f0;++g)this._length[g]+=h,h=this._length[g]/4294967296|0,h>0&&(this._length[g]-=4294967296*h);return this},d.prototype._update=function(a){throw new Error("_update is not implemented")},d.prototype.digest=function(a){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var b=this._digest();return void 0!==a&&(b=b.toString(a)),b},d.prototype._digest=function(){throw new Error("_digest is not implemented")},b.exports=d}).call(this,a("buffer").Buffer)},{buffer:8,inherits:244,stream:220}],244:[function(a,b,c){arguments[4][205][0].apply(c,arguments)},{dup:205}],245:[function(a,b,c){"use strict";var d=a("./lib/Connection"),e=a("./lib/StreamParser"),f=a("node-xmpp-jid"),g=a("node-xmpp-stanza"),h=a("inherits");c.SRV=a("./lib/SRV"),c.exportCoreUtils=function(a){a.Connection=d,a.StreamParser=e,a.JID=f,a.inherits=h,a.stanza=g,a.Stanza=g.Stanza,a.createStanza=g.createStanza,a.IQ=g.IQ,a.Presence=g.Presence,a.Message=g.Message,a.Parser=g.Parser,a.parse=g.parse,a.ltx=g.ltx,a.createElement=g.createElement,a.Element=g.Element,a.escapeXML=g.escapeXML,a.escapeXMLText=g.escapeXMLText},c.exportCoreUtils(c)},{"./lib/Connection":246,"./lib/SRV":247,"./lib/StreamParser":248,inherits:249,"node-xmpp-jid":262,"node-xmpp-stanza":266}],246:[function(a,b,c){"use strict";function d(a,b){var c=o({},b);return c.initialDelay=b&&(b.initialReconnectDelay||b.reconnectDelay)||s,c.maxDelay=b&&b.maxReconnectDelay||t,c.immediate=b&&b.socket&&"function"!=typeof b.socket,c.type=b&&b.delayType,c.emitter=a,c}function e(a){h.call(this),this.streamAttrs=a&&a.streamAttrs||{},this.xmlns=a&&a.xmlns||{},this.xmlns.stream=q,this.streamOpen=a&&a.streamOpen||u,this.streamClose=a&&a.streamClose||v,this.rejectUnauthorized=!(!a||!a.rejectUnauthorized),this.serialized=!(!a||!a.serialized),this.requestCert=!(!a||!a.requestCert),this.servername=a&&a.servername,this.boundOnData=this.onData.bind(this),this.boundOnClose=this.onClose.bind(this),this.boundEmitData=this.emit.bind(this,"data"),this.boundEmitDrain=this.emit.bind(this,"drain"),this._setupSocket(d(this,a)),this.once("reconnect",function(){this.reconnect=a&&a.reconnect})}function f(a){return a.children?a.children.reduce(function(a,b){return a+f(b)},""):a}var g=a("net"),h=a("events").EventEmitter,i=a("inherits"),j=a("node-xmpp-stanza").Element,k=a("reconnect-core"),l=a("./StreamParser"),m=a("node-xmpp-tls-connect"),n=a("debug")("xmpp:connection"),o=a("lodash.assign"),p="urn:ietf:params:xml:ns:xmpp-tls",q="http://etherx.jabber.org/streams",r="urn:ietf:params:xml:ns:xmpp-streams",s=1e3,t=3e4,u="stream:stream",v="";i(e,h),e.prototype.NS_XMPP_TLS=p,e.NS_STREAM=q,e.prototype.NS_XMPP_STREAMS=r,e.prototype.allowTLS=!0,e.prototype._setupSocket=function(a){n("setup socket");var b={},c=k(function(a){var d=this.socket;return"on"===a.preserve?(a.preserve=b,b=a):a=b=a.preserve?a.preserve:a||b,"function"==typeof a.socket?(n("use lazy socket"),this.socket=a.socket.call(this)):(n("use standard socket"),this.socket=a.socket,a.socket=null,this.socket&&this.once("connect",function(){c.options.immediate=!1})),this.socket=this.socket||new g.Socket,d!==this.socket&&this.setupStream(),this.socket}.bind(this));c(c.options=a);var d=this.end;this.end=this.disconnect=function(){this.closeStream(),d()},this.on("connection",function(){this.parser||this.startParser()}),this.on("end",function(){b={}})},e.prototype.setupStream=function(){n("setup stream"),this.socket.on("end",this.onEnd.bind(this)),this.socket.on("data",this.boundOnData),this.socket.on("close",this.boundOnClose),this.socket.on("data",this.boundEmitData),this.socket.on("drain",this.boundEmitDrain),this.socket.on("error",function(){}),this.socket.serializeStanza||(this.serialized?this.socket.serializeStanza=function(a,b){a.write(function(a){b(a)})}:this.socket.serializeStanza=function(a,b){b(a.toString())})},e.prototype.pause=function(){this.socket.pause&&this.socket.pause()},e.prototype.resume=function(){this.socket.resume&&this.socket.resume()},e.prototype.send=function(a){if(this.socket&&this.streamOpened){if(!this.socket.writable)return void this.socket.end();n("send: "+a.toString());var b=!0;if(a.root){var c=this.rmXmlns(a.root());this.socket.serializeStanza(c,function(a){b=this.write(a)}.bind(this.socket))}else b=this.socket.write(a);return b}},e.prototype.startParser=function(){var a=this;this.parser=new l.StreamParser(this.maxStanzaSize),this.parser.on("streamStart",function(b){a.streamNsAttrs={};for(var c in b)"xmlns"!==c&&"xmlns:"!==c.substr(0,6)||(a.streamNsAttrs[c]=b[c]);a.emit("streamStart",b)}),this.parser.on("stanza",function(b){a.onStanza(a.addStreamNs(b))}),this.parser.on("error",function(b){a.error(b.condition||"internal-server-error",b.message)}),this.parser.once("end",function(){a.stopParser(),a.reconnect?a.once("reconnect",a.startParser.bind(a)):a.end()})},e.prototype.stopParser=function(){if(this.parser){var a=this.parser;this.parser=null,a.end()}},e.prototype.openStream=function(){var a={};for(var b in this.xmlns)this.xmlns.hasOwnProperty(b)&&(b?a["xmlns:"+b]=this.xmlns[b]:a.xmlns=this.xmlns[b]);for(b in this.streamAttrs)this.streamAttrs.hasOwnProperty(b)&&(a[b]=this.streamAttrs[b]);this.streamTo&&(a.to=this.streamTo);var c,d=new j(this.streamOpen,a);if("stream:stream"===d.name){d.t(" ");var e=d.toString();c=e.substr(0,e.indexOf(" "))}else c=d.toString();this.streamOpened=!0,this.send(c)},e.prototype.startStream=e.prototype.openStream,e.prototype.closeStream=function(){this.send(this.streamClose),this.streamOpened=!1},e.prototype.endStream=e.prototype.closeStream,e.prototype.onData=function(a){n("receive: "+a.toString("utf8")),this.parser&&this.parser.write(a)},e.prototype.setSecure=function(a,b,c){this.socket.removeListener("data",this.boundOnData),this.socket.removeListener("data",this.boundEmitData),this.socket.removeListener("drain",this.boundEmitDrain),this.socket.removeListener("close",this.boundOnClose),this.socket.clearTimer&&this.socket.clearTimer();var d=m({socket:this.socket,rejectUnauthorized:this.rejectUnauthorized,credentials:a||this.credentials,requestCert:this.requestCert,isServer:!!b,servername:b&&c},function(){this.isSecure=!0,this.once("disconnect",function(){this.isSecure=!1}),d.emit("connect",d)}.bind(this));d.on("clientError",this.emit.bind(this,"error")),this.reconnect||(this.reconnect=!0,this.once("reconnect",function(){this.reconnect=!1})),this.stopParser(),this.listen({socket:d,preserve:"on"})},e.prototype.onStanza=function(a){if(a.is("error",q)){var b=new Error(""+f(a));b.stanza=a,this.socket.emit("error",b)}else a.is("features",this.NS_STREAM)&&this.allowTLS&&!this.isSecure&&a.getChild("starttls",this.NS_XMPP_TLS)?this.send(new j("starttls",{xmlns:this.NS_XMPP_TLS})):this.allowTLS&&a.is("proceed",this.NS_XMPP_TLS)?this.setSecure():this.emit("stanza",a)},e.prototype.addStreamNs=function(a){for(var b in this.streamNsAttrs)a.attrs[b]||"xmlns"===b&&this.streamNsAttrs[b]===this.xmlns[""]||(a.attrs[b]=this.streamNsAttrs[b]);return a},e.prototype.rmXmlns=function(a){for(var b in this.xmlns){var c=b?"xmlns:"+b:"xmlns";a.attrs[c]===this.xmlns[b]&&(a.attrs[c]=null)}return a},e.prototype.onEnd=function(){ +this.closeStream(),this.reconnect||this.emit("end")},e.prototype.onClose=function(){this.reconnect||this.emit("close")},e.prototype.error=function(a,b){if(this.emit("error",new Error(b)),this.socket&&this.socket.writable){this.streamOpened||this.openStream();var c=new j("stream:error");c.c(a,{xmlns:r}),b&&c.c("text",{xmlns:r,"xml:lang":"en"}).t(b),this.send(c),this.end()}},b.exports=e},{"./StreamParser":248,debug:239,events:204,inherits:249,"lodash.assign":250,net:5,"node-xmpp-stanza":266,"node-xmpp-tls-connect":274,"reconnect-core":275}],247:[function(a,b,c){"use strict";function d(a,b){return a=parseInt(a,10),b=parseInt(b,10),ab?1:0}function e(a){var b={};a.forEach(function(a){b.hasOwnProperty(a.priority)||(b[a.priority]=[]),b[a.priority].push(a)});var c=[];return Object.keys(b).sort(d).forEach(function(a){var d=b[a],e=0;d.forEach(function(a){e+=a.weight});var f=Math.floor(Math.random()*e);e=0;var g=d[0];d.forEach(function(a){e+=a.weight,f0?null:c,d)};i.lookup(a,e)}function h(a,b){function c(){a.removeListener("connect",c),a.removeListener("disconnect",d)}function d(){var d=b.shift();d?a.socket.connect(d.port,d.name):c()}return a.on("connect",c),a.on("disconnect",d),d()}var i=a("dns");c.connect=function(a){function b(d){var e=this;!e.socket&&a.socket?("function"==typeof a.socket?e.socket=a.socket.call(this):e.socket=a.socket,a.socket=null):d||(e.socket=null);var i=c.shift();return i?f(i+"."+a.domain,function(a,c){!a&&c?h(e,c):b.call(e,"retry")}):g(a.domain,function(b,d){d&&d.length>0?(d=d.map(function(b){return{name:b,port:a.defaultPort}}),h(e,d)):e.reconnect?(c=a.services.slice(),e.socket=null):(b=b||new Error("No addresses resolved for "+a.domain),e.emit("error",b))}),e.socket}var c=a.services.slice();return b}},{dns:5}],248:[function(a,b,c){"use strict";function d(a){f.call(this);var b=this,c=a&&a.Element||j,d=a&&a.Parser||g;this.maxStanzaSize=a&&a.maxStanzaSize,this.parser=new d,this.bytesParsed=0,this.bytesParsedOnStanzaBegin=0,this.parser.on("startElement",function(a,d){if(b.element||"stream:stream"!==a){var e;b.element?(e=new c(a,d),b.element=b.element.cnode(e)):(e=new i(a,d),b.element=e,b.bytesParsedOnStanzaBegin=b.bytesParsed)}else b.emit("streamStart",d)}),this.parser.on("endElement",function(a){b.element||"stream:stream"!==a?b.element&&a===b.element.name?b.element.parent?b.element=b.element.parent:(b.emit("stanza",b.element),delete b.element,delete b.bytesParsedOnStanzaBegin):b.error("xml-not-well-formed","XML parse error"):b.end()}),this.parser.on("text",function(a){b.element&&b.element.t(a)}),this.parser.on("entityDecl",function(){b.error("xml-not-well-formed","No entity declarations allowed"),b.end()}),this.parser.on("error",this.emit.bind(this,"error"))}var e=a("inherits"),f=a("events").EventEmitter,g=a("ltx/lib/parsers/ltx"),h=a("node-xmpp-stanza"),i=h.Stanza,j=h.Element;e(d,f),d.prototype.checkXMLHeader=function(a){var b=a.indexOf("");if(b>=0&&c>=0&&bthis.bytesParsedOnStanzaBegin+this.maxStanzaSize)return void this.error("policy-violation","Maximum stanza size exceeded");this.bytesParsed+=a.length,this.parser.write(a)}},d.prototype.end=function(a){a&&this.write(a),delete this.parser,this.emit("end")},d.prototype.error=function(a,b){var c=new Error(b);c.condition=a,this.emit("error",c)},d.StreamParser=d,b.exports=d},{events:204,inherits:249,"ltx/lib/parsers/ltx":260,"node-xmpp-stanza":266}],249:[function(a,b,c){arguments[4][205][0].apply(c,arguments)},{dup:205}],250:[function(a,b,c){function d(a,b,c){switch(c.length){case 0:return a.call(b);case 1:return a.call(b,c[0]);case 2:return a.call(b,c[0],c[1]);case 3:return a.call(b,c[0],c[1],c[2])}return a.apply(b,c)}function e(a){return function(b){return null==b?void 0:b[a]}}function f(a,b){for(var c=-1,d=Array(a);++c1?c[e-1]:void 0,g=e>2?c[2]:void 0;for(f=a.length>3&&"function"==typeof f?(e--,f):void 0,g&&o(c[0],c[1],g)&&(f=e<3?void 0:f,e=1),b=Object(b);++d-1&&a%1==0&&a-1&&a%1==0&&a<=A}function w(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}function x(a){return!!a&&"object"==typeof a}function y(a){return"string"==typeof a||!R(a)&&x(a)&&I.call(a)==E}function z(a){var b=p(a);if(!b&&!s(a))return O(a);var c=m(a),d=!!c,e=c||[],f=e.length;for(var g in a)!i(a,g)||d&&("length"==g||n(g,f))||b&&"constructor"==g||e.push(g);return e}var A=9007199254740991,B="[object Arguments]",C="[object Function]",D="[object GeneratorFunction]",E="[object String]",F=/^(?:0|[1-9]\d*)$/,G=Object.prototype,H=G.hasOwnProperty,I=G.toString,J=G.propertyIsEnumerable,K=Object.getPrototypeOf,L=Object.keys,M=Math.max,N=!J.call({valueOf:1},"valueOf"),O=g(L,Object),P=e("length"),Q=g(K,Object),R=Array.isArray,S=l(function(a,b){if(N||p(b)||s(b))return void k(b,z(b),a);for(var c in b)H.call(b,c)&&h(a,c,b[c])});b.exports=S},{}],251:[function(a,b,c){"use strict";var d=a("./lib/parse"),e=a("./lib/Parser"),f=a("./lib/escape"),g=a("./lib/Element"),h=a("./lib/equal"),i=a("./lib/createElement"),j=a("./lib/tag"),k=a("./lib/is");c=b.exports=j,c.Element=g,c.equal=h.equal,c.nameEqual=h.name,c.attrsEqual=h.attrs,c.childrenEqual=h.children,c.isNode=k.isNode,c.isElement=k.isElement,c.isText=k.isText,c.createElement=i,c.escapeXML=f.escapeXML,c.unescapeXML=f.unescapeXML,c.escapeXMLText=f.escapeXMLText,c.unescapeXMLText=f.unescapeXMLText,c.Parser=e,c.parse=d,c.tag=j},{"./lib/Element":252,"./lib/Parser":253,"./lib/createElement":255,"./lib/equal":256,"./lib/escape":257,"./lib/is":258,"./lib/parse":259,"./lib/tag":261}],252:[function(a,b,c){"use strict";function d(a,b){this.name=a,this.parent=null,this.children=[],this.attrs={},this.setAttrs(b)}var e=a("./escape"),f=e.escapeXML,g=e.escapeXMLText,h=a("./equal"),i=h.equal,j=h.name,k=h.attrs,l=h.children,m=a("./clone");d.prototype.is=function(a,b){return this.getName()===a&&(!b||this.getNS()===b)},d.prototype.getName=function(){return this.name.indexOf(":")>=0?this.name.substr(this.name.indexOf(":")+1):this.name},d.prototype.getNS=function(){if(this.name.indexOf(":")>=0){var a=this.name.substr(0,this.name.indexOf(":"));return this.findNS(a)}return this.findNS()},d.prototype.findNS=function(a){if(a){var b="xmlns:"+a;if(this.attrs[b])return this.attrs[b];if(this.parent)return this.parent.findNS(a)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}},d.prototype.getXmlns=function(){var a={};this.parent&&(a=this.parent.getXmlns());for(var b in this.attrs){var c=b.match("xmlns:?(.*)");this.attrs.hasOwnProperty(b)&&c&&(a[this.attrs[b]]=c[1])}return a},d.prototype.setAttrs=function(a){"string"==typeof a?this.attrs.xmlns=a:a&&Object.keys(a).forEach(function(b){this.attrs[b]=a[b]},this)},d.prototype.getAttr=function(a,b){if(!b)return this.attrs[a];var c=this.getXmlns();return c[b]?this.attrs[[c[b],a].join(":")]:null},d.prototype.getChild=function(a,b){return this.getChildren(a,b)[0]},d.prototype.getChildren=function(a,b){for(var c=[],d=0;d");for(var b=0;b")},d.prototype.write=function(a){a("<"),a(this.name);for(var b in this.attrs){var c=this.attrs[b];null!=c&&(a(" "),a(b),a('="'),"string"!=typeof c&&(c=c.toString()),a(f(c)),a('"'))}0===this.children.length?a("/>"):this._addChildren(a)},d.prototype.nameEquals=function(a){return j(this,a)},d.prototype.attrsEquals=function(a){return k(this,a)},d.prototype.childrenEquals=function(a){return l(this,a)},d.prototype.equals=function(a){return i(this,a)},b.exports=d},{"./clone":254,"./equal":256,"./escape":257}],253:[function(a,b,c){"use strict";var d=a("events").EventEmitter,e=a("inherits"),f=a("./Element"),g=a("./parsers/ltx"),h=function(a){d.call(this);var b=this.Parser=a&&a.Parser||this.DefaultParser,c=this.Element=a&&a.Element||this.DefaultElement;this.parser=new b;var e,f=this;this.parser.on("startElement",function(a,b){var d=new c(a,b);e=e?e.cnode(d):d}),this.parser.on("endElement",function(a){e&&a===e.name&&(e.parent?e=e.parent:f.tree||(f.tree=e,e=void 0))}),this.parser.on("text",function(a){e&&e.t(a)}),this.parser.on("error",function(a){f.error=a,f.emit("error",a)})};e(h,d),h.prototype.DefaultParser=g,h.prototype.DefaultElement=f,h.prototype.write=function(a){this.parser.write(a)},h.prototype.end=function(a){this.parser.end(a),this.error||(this.tree?this.emit("tree",this.tree):this.emit("error",new Error("Incomplete document")))},b.exports=h},{"./Element":252,"./parsers/ltx":260,events:204,inherits:249}],254:[function(a,b,c){"use strict";b.exports=function a(b){for(var a=new b.constructor(b.name,b.attrs),c=0;c":">",'"':""","'":"'"},g={"&":"&","&":"&","<":"<","<":"<",">":">",">":">",""":'"',""":'"',"'":"'","'":"'"};c.escapeXML=function(a){return a.replace(/&|<|>|"|'/g,d)},c.unescapeXML=function(a){return a.replace(/&(amp|#38|lt|#60|gt|#62|quot|#34|apos|#39);/g,e)},c.escapeXMLText=function(a){return a.replace(/&|<|>/g,d)},c.unescapeXMLText=function(a){return a.replace(/&(amp|#38|lt|#60|gt|#62);/g,e)}},{}],258:[function(a,b,c){"use strict";var d=a("./Element");b.exports.isNode=function(a){return a instanceof d||"string"==typeof a},b.exports.isElement=function(a){return a instanceof d},b.exports.isText=function(a){return"string"==typeof a}},{"./Element":252}],259:[function(a,b,c){"use strict";var d=a("./Parser");b.exports=function(a,b){var c;c="function"==typeof b?new b:new d(b);var e=null,f=null;if(c.on("tree",function(a){e=a}),c.on("error",function(a){f=a}),c.write(a),c.end(),f)throw f;return e}},{"./Parser":253}],260:[function(a,b,c){"use strict";var d=a("inherits"),e=a("events").EventEmitter,f=a("../escape").unescapeXML,g=0,h=1,i=2,j=3,k=4,l=5,m=6,n=7,o=b.exports=function(){e.call(this);var a,b,c,d,o,p,q,r=g,s=0;this._handleTagOpening=function(a,b,c){a?this.emit("endElement",b):(this.emit("startElement",b,c),o&&this.emit("endElement",b))},this.write=function(e){function t(){if("number"==typeof s){var a=e.slice(s,u);return s=void 0,a}}"string"!=typeof e&&(e=e.toString());var u=0;for(a&&(e=a+e,u+=a.length,a=null);u32&&(s=u,r=k);break;case k:(v<=32||61===v)&&(q=t(),u--,r=l);break;case l:61===v&&(r=m);break;case m:34!==v&&39!==v||(p=v,r=n,s=u+1);break;case n:if(v===p){var x=f(t());c[q]=x,q=void 0,r=j}}}"number"==typeof s&&s<=e.length&&(a=e.slice(s),s=0)}};d(o,e),o.prototype.end=function(a){a&&this.write(a),this.write=function(){}}},{"../escape":257,events:204,inherits:249}],261:[function(a,b,c){"use strict";var d=a("./escape").escapeXML,e=a("./parse");b.exports=function(){for(var a=arguments[0],b="",c=1;c|@/g);return c!==-1},b.exports.escape=function(a){return null===a?null:a.replace(/^\s+|\s+$/g,"").replace(/\\/g,"\\5c").replace(/ /g,"\\20").replace(/\"/g,"\\22").replace(/\&/g,"\\26").replace(/\'/g,"\\27").replace(/\//g,"\\2f").replace(/:/g,"\\3a").replace(//g,"\\3e").replace(/@/g,"\\40").replace(/\3a/g,"c3a")},b.exports.unescape=function(a){return null===a?null:a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")}},{}],265:[function(a,b,c){"use strict";var d=a("./JID");b.exports=function(){for(var a=arguments[0],b=Array.prototype.slice.call(arguments,1),c="",e=0;e0&&(g=!1),g){var i=b.subject.CN;if(l.isArray(i))for(var k=0,m=i.length;k0&&this.backoff_.failAfter(this.failAfter_),this.state_=e.State_.RUNNING,this.doCall_()},e.prototype.doCall_=function(){var a=["call"].concat(this.arguments_);f.EventEmitter.prototype.emit.apply(this,a);var b=this.handleFunctionCallback_.bind(this);this.function_.apply(null,this.arguments_.concat(b))},e.prototype.doCallback_=function(){var a=this.results_[this.results_.length-1];this.callback_.apply(null,a)}, +e.prototype.handleFunctionCallback_=function(){if(!this.isAborted()){var a=Array.prototype.slice.call(arguments);this.results_.push(a),f.EventEmitter.prototype.emit.apply(this,["callback"].concat(a)),a[0]?this.backoff_.backoff(a[0]):(this.state_=e.State_.COMPLETED,this.doCallback_())}},e.prototype.handleBackoff_=function(a,b,c){this.emit("backoff",a,b,c)},b.exports=e},{"./backoff":277,"./strategy/fibonacci":280,events:204,util:224}],279:[function(a,b,c){function d(a){f.call(this,a),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var e=a("util"),f=a("./strategy");e.inherits(d,f),d.prototype.next_=function(){return this.backoffDelay_=Math.min(this.nextBackoffDelay_,this.getMaxDelay()),this.nextBackoffDelay_=2*this.backoffDelay_,this.backoffDelay_},d.prototype.reset_=function(){this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()},b.exports=d},{"./strategy":281,util:224}],280:[function(a,b,c){function d(a){f.call(this,a),this.backoffDelay_=0,this.nextBackoffDelay_=this.getInitialDelay()}var e=a("util"),f=a("./strategy");e.inherits(d,f),d.prototype.next_=function(){var a=Math.min(this.nextBackoffDelay_,this.getMaxDelay());return this.nextBackoffDelay_+=this.backoffDelay_,this.backoffDelay_=a,a},d.prototype.reset_=function(){this.nextBackoffDelay_=this.getInitialDelay(),this.backoffDelay_=0},b.exports=d},{"./strategy":281,util:224}],281:[function(a,b,c){function d(a){return void 0!==a&&null!==a}function e(a){if(a=a||{},d(a.initialDelay)&&a.initialDelay<1)throw new Error("The initial timeout must be greater than 0.");if(d(a.maxDelay)&&a.maxDelay<1)throw new Error("The maximal timeout must be greater than 0.");if(this.initialDelay_=a.initialDelay||100,this.maxDelay_=a.maxDelay||1e4,this.maxDelay_<=this.initialDelay_)throw new Error("The maximal backoff delay must be greater than the initial backoff delay.");if(d(a.randomisationFactor)&&(a.randomisationFactor<0||a.randomisationFactor>1))throw new Error("The randomisation factor must be between 0 and 1.");this.randomisationFactor_=a.randomisationFactor||0}a("events"),a("util");e.prototype.getMaxDelay=function(){return this.maxDelay_},e.prototype.getInitialDelay=function(){return this.initialDelay_},e.prototype.next=function(){var a=this.next_(),b=1+Math.random()*this.randomisationFactor_,c=Math.round(a*b);return c},e.prototype.next_=function(){throw new Error("BackoffStrategy.next_() unimplemented.")},e.prototype.reset=function(){this.reset_()},e.prototype.reset_=function(){throw new Error("BackoffStrategy.reset_() unimplemented.")},b.exports=e},{events:204,util:224}],282:[function(a,b,c){!function(b){if(function(a,b){"function"==typeof define&&define.amd?define("strophe-base64",function(){return b()}):a.Base64=b()}(this,function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b={encode:function(b){var c,d,e,f,g,h,i,j="",k=0;do c=b.charCodeAt(k++),d=b.charCodeAt(k++),e=b.charCodeAt(k++),f=c>>2,g=(3&c)<<4|d>>4,h=(15&d)<<2|e>>6,i=63&e,isNaN(d)?(g=(3&c)<<4,h=i=64):isNaN(e)&&(i=64),j=j+a.charAt(f)+a.charAt(g)+a.charAt(h)+a.charAt(i);while(k>4,d=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(c),64!=h&&(j+=String.fromCharCode(d)),64!=i&&(j+=String.fromCharCode(e));while(k>5]|=128<<24-d%32,a[(d+64>>9<<4)+15]=d;var g,h,i,j,k,l,m,n,o=new Array(80),p=1732584193,q=-271733879,r=-1732584194,s=271733878,t=-1009589776;for(g=0;g16&&(d=a(d,8*b.length));for(var e=new Array(16),f=new Array(16),h=0;h<16;h++)e[h]=909522486^d[h],f[h]=1549556828^d[h];var i=a(e.concat(g(c)),512+8*c.length);return a(f.concat(i),672)}function e(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c}function f(a,b){return a<>>32-b}function g(a){for(var b=[],c=255,d=0;d<8*a.length;d+=8)b[d>>5]|=(a.charCodeAt(d/8)&c)<<24-d%32;return b}function h(a){for(var b="",c=255,d=0;d<32*a.length;d+=8)b+=String.fromCharCode(a[d>>5]>>>24-d%32&c);return b}function i(a){for(var b,c,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e="",f=0;f<4*a.length;f+=3)for(b=(a[f>>2]>>8*(3-f%4)&255)<<16|(a[f+1>>2]>>8*(3-(f+1)%4)&255)<<8|a[f+2>>2]>>8*(3-(f+2)%4)&255,c=0;c<4;c++)e+=8*f+6*c>32*a.length?"=":d.charAt(b>>6*(3-c)&63);return e}return{b64_hmac_sha1:function(a,b){return i(d(a,b))},b64_sha1:function(b){return i(a(g(b),8*b.length))},binb2str:h,core_hmac_sha1:d,str_hmac_sha1:function(a,b){return h(d(a,b))},str_sha1:function(b){return h(a(g(b),8*b.length))}}}),function(a,b){"function"==typeof define&&define.amd?define("strophe-md5",function(){return b()}):a.MD5=b()}(this,function(a){var b=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},c=function(a,b){return a<>>32-b},d=function(a){for(var b=[],c=0;c<8*a.length;c+=8)b[c>>5]|=(255&a.charCodeAt(c/8))<>5]>>>c%32&255);return b},f=function(a){for(var b="0123456789abcdef",c="",d=0;d<4*a.length;d++)c+=b.charAt(a[d>>2]>>d%4*8+4&15)+b.charAt(a[d>>2]>>d%4*8&15);return c},g=function(a,d,e,f,g,h){return b(c(b(b(d,a),b(f,h)),g),e)},h=function(a,b,c,d,e,f,h){return g(b&c|~b&d,a,b,e,f,h)},i=function(a,b,c,d,e,f,h){return g(b&d|c&~d,a,b,e,f,h)},j=function(a,b,c,d,e,f,h){return g(b^c^d,a,b,e,f,h)},k=function(a,b,c,d,e,f,h){return g(c^(b|~d),a,b,e,f,h)},l=function(a,c){a[c>>5]|=128<>>9<<4)+14]=c;for(var d,e,f,g,l=1732584193,m=-271733879,n=-1732584194,o=271733878,p=0;p=0&&c<=127?d+=a.charAt(b):c>2047?(d+=String.fromCharCode(224|c>>12&15),d+=String.fromCharCode(128|c>>6&63),d+=String.fromCharCode(128|c>>0&63)):(d+=String.fromCharCode(192|c>>6&31),d+=String.fromCharCode(128|c>>0&63));return d},addCookies:function(a){var b,c,d,e,f,g,h;for(b in a||{})f="",g="",h="",c=a[b],d="object"==typeof c,e=escape(unescape(d?c.value:c)),d&&(f=c.expires?";expires="+c.expires:"",g=c.domain?";domain="+c.domain:"",h=c.path?";path="+c.path:""),document.cookie=b+"="+e+f+g+h}};return a}),function(a,b){return"function"==typeof define&&define.amd?void define("strophe-polyfill",[],function(){return b()}):b()}(this,function(){Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice,d=Array.prototype.concat,e=c.call(arguments,1);return function(){return b.apply(a?a:this,d.call(e,c.call(arguments,0)))}}),Array.isArray||(Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)}),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){var b=this.length,c=Number(arguments[1])||0;for(c=c<0?Math.ceil(c):Math.floor(c),c<0&&(c+=b);c0)for(var c=0;c/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,""")},xmlunescape:function(a){return a=a.replace(/\&/g,"&"),a=a.replace(/</g,"<"),a=a.replace(/>/g,">"),a=a.replace(/'/g,"'"),a=a.replace(/"/g,'"')},xmlTextNode:function(a){return i.xmlGenerator().createTextNode(a)},xmlHtmlNode:function(a){var b;if(window.DOMParser){var c=new DOMParser;b=c.parseFromString(a,"text/xml")}else b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);return b},getText:function(a){if(!a)return null;var b="";0===a.childNodes.length&&a.nodeType==i.ElementType.TEXT&&(b+=a.nodeValue);for(var c=0;c0&&(g=h.join("; "),c.setAttribute(f,g))}else c.setAttribute(f,g);for(b=0;b/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(a){return"string"!=typeof a?a:a.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(a){return a.indexOf("@")<0?null:a.split("@")[0]},getDomainFromJid:function(a){var b=i.getBareJidFromJid(a);if(b.indexOf("@")<0)return b;var c=b.split("@");return c.splice(0,1),c.join("@")},getResourceFromJid:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),b.join("/"))},getBareJidFromJid:function(a){return a?a.split("/")[0]:null},log:function(a,b){},debug:function(a){this.log(this.LogLevel.DEBUG,a)},info:function(a){this.log(this.LogLevel.INFO,a)},warn:function(a){this.log(this.LogLevel.WARN,a)},error:function(a){this.log(this.LogLevel.ERROR,a)},fatal:function(a){this.log(this.LogLevel.FATAL,a)},serialize:function(a){var b;if(!a)return null;"function"==typeof a.tree&&(a=a.tree());var c,d,e=a.nodeName;for(a.getAttribute("_realname")&&(e=a.getAttribute("_realname")),b="<"+e,c=0;c0){for(b+=">",c=0;c"}b+=""}else b+="/>";return b},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(a,b){i._connectionPlugins[a]=b}},i.Builder=function(a,b){"presence"!=a&&"message"!=a&&"iq"!=a||(b&&!b.xmlns?b.xmlns=i.NS.CLIENT:b||(b={xmlns:i.NS.CLIENT})),this.nodeTree=i.xmlElement(a,b),this.node=this.nodeTree},i.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return i.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},attrs:function(a){for(var b in a)a.hasOwnProperty(b)&&(void 0===a[b]?this.node.removeAttribute(b):this.node.setAttribute(b,a[b]));return this},c:function(a,b,c){var d=i.xmlElement(a,b,c);return this.node.appendChild(d),"string"!=typeof c&&"number"!=typeof c&&(this.node=d),this},cnode:function(a){var b,c=i.xmlGenerator();try{b=void 0!==c.importNode}catch(a){b=!1}var d=b?c.importNode(a,!0):i.copyElement(a);return this.node.appendChild(d),this.node=d,this},t:function(a){var b=i.xmlTextNode(a);return this.node.appendChild(b),this},h:function(a){var b=document.createElement("body");b.innerHTML=a;for(var c=i.createHtml(b);c.childNodes.length>0;)this.node.appendChild(c.childNodes[0]);return this}},i.Handler=function(a,b,c,d,e,f,g){this.handler=a,this.ns=b,this.name=c,this.type=d,this.id=e,this.options=g||{matchBare:!1},this.options.matchBare||(this.options.matchBare=!1),this.options.matchBare?this.from=f?i.getBareJidFromJid(f):null:this.from=f,this.user=!0},i.Handler.prototype={isMatch:function(a){var b,c=null;if(c=this.options.matchBare?i.getBareJidFromJid(a.getAttribute("from")):a.getAttribute("from"),b=!1,this.ns){var d=this;i.forEachChild(a,null,function(a){a.getAttribute("xmlns")==d.ns&&(b=!0)}),b=b||a.getAttribute("xmlns")==this.ns}else b=!0;var e=a.getAttribute("type");return!(!b||this.name&&!i.isTagEqual(a,this.name)||this.type&&(Array.isArray(this.type)?this.type.indexOf(e)==-1:e!=this.type)||this.id&&a.getAttribute("id")!=this.id||this.from&&c!=this.from)},run:function(a){var b=null;try{b=this.handler(a)}catch(a){throw a.sourceURL?i.fatal("error: "+this.handler+" "+a.sourceURL+":"+a.line+" - "+a.name+": "+a.message):a.fileName?("undefined"!=typeof console&&(console.trace(),console.error(this.handler," - error - ",a,a.message)),i.fatal("error: "+this.handler+" "+a.fileName+":"+a.lineNumber+" - "+a.name+": "+a.message)):i.fatal("error: "+a.message+"\n"+a.stack),a}return b},toString:function(){return"{Handler: "+this.handler+"("+this.name+","+this.id+","+this.ns+")}"}},i.TimedHandler=function(a,b){this.period=a,this.handler=b,this.lastCalled=(new Date).getTime(),this.user=!0},i.TimedHandler.prototype={run:function(){return this.lastCalled=(new Date).getTime(),this.handler()},reset:function(){this.lastCalled=(new Date).getTime()},toString:function(){return"{TimedHandler: "+this.handler+"("+this.period+")}"}},i.Connection=function(a,b){this.service=a,this.options=b||{};var c=this.options.protocol||"";0===a.indexOf("ws:")||0===a.indexOf("wss:")||0===c.indexOf("ws")?this._proto=new i.Websocket(this):this._proto=new i.Bosh(this),this.jid="",this.domain=null,this.features=null,this._sasl_data={},this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this._idleTimeout=null,this._disconnectTimeout=null,this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.do_authentication=!0,this.paused=!1,this.restored=!1,this._data=[],this._uniqueId=0,this._sasl_success_handler=null,this._sasl_failure_handler=null,this._sasl_challenge_handler=null,this.maxRetries=5,this._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this),100),d.addCookies(this.options.cookies);for(var e in i._connectionPlugins)if(i._connectionPlugins.hasOwnProperty(e)){var f=i._connectionPlugins[e],g=function(){};g.prototype=f,this[e]=new g,this[e].init(this)}},i.Connection.prototype={reset:function(){this._proto._reset(),this.do_session=!1,this.do_bind=!1,this.timedHandlers=[],this.handlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._authentication={},this.authenticated=!1,this.connected=!1,this.disconnecting=!1,this.restored=!1,this._data=[],this._requests=[],this._uniqueId=0},pause:function(){this.paused=!0},resume:function(){this.paused=!1},getUniqueId:function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});return"string"==typeof a||"number"==typeof a?b+":"+a:b+""},connect:function(a,b,c,d,e,f,g){this.jid=a,this.authzid=i.getBareJidFromJid(this.jid),this.authcid=g||i.getNodeFromJid(this.jid),this.pass=b,this.servtype="xmpp",this.connect_callback=c,this.disconnecting=!1,this.connected=!1,this.authenticated=!1,this.restored=!1,this.domain=i.getDomainFromJid(this.jid),this._changeConnectStatus(i.Status.CONNECTING,null),this._proto._connect(d,e,f)},attach:function(a,b,c,d,e,f,g){if(!(this._proto instanceof i.Bosh))throw{name:"StropheSessionError",message:'The "attach" method can only be used with a BOSH connection.'};this._proto._attach(a,b,c,d,e,f,g)},restore:function(a,b,c,d,e){if(!this._sessionCachingSupported())throw{name:"StropheSessionError",message:'The "restore" method can only be used with a BOSH connection.'};this._proto._restore(a,b,c,d,e)},_sessionCachingSupported:function(){if(this._proto instanceof i.Bosh){if(!JSON)return!1;try{window.sessionStorage.setItem("_strophe_","_strophe_"),window.sessionStorage.removeItem("_strophe_")}catch(a){return!1}return!0}return!1},xmlInput:function(a){},xmlOutput:function(a){},rawInput:function(a){},rawOutput:function(a){},nextValidRid:function(a){},send:function(a){if(null!==a){if("function"==typeof a.sort)for(var b=0;b=0&&this.addHandlers.splice(b,1)},disconnect:function(a){if(this._changeConnectStatus(i.Status.DISCONNECTING,a),i.info("Disconnect was called because: "+a),this.connected){var b=!1;this.disconnecting=!0,this.authenticated&&(b=h({xmlns:i.NS.CLIENT,type:"unavailable"})),this._disconnectTimeout=this._addSysTimedHandler(3e3,this._onDisconnectTimeout.bind(this)),this._proto._disconnect(b)}else i.info("Disconnect was called before Strophe connected to the server"),this._proto._abortAllRequests()},_changeConnectStatus:function(a,b){for(var c in i._connectionPlugins)if(i._connectionPlugins.hasOwnProperty(c)){var d=this[c];if(d.statusChanged)try{d.statusChanged(a,b)}catch(a){i.error(""+c+" plugin caused an exception changing status: "+a)}}if(this.connect_callback)try{this.connect_callback(a,b)}catch(a){i.error("User connection callback caused an exception: "+a)}},_doDisconnect:function(a){"number"==typeof this._idleTimeout&&clearTimeout(this._idleTimeout),null!==this._disconnectTimeout&&(this.deleteTimedHandler(this._disconnectTimeout),this._disconnectTimeout=null),i.info("_doDisconnect was called"),this._proto._doDisconnect(),this.authenticated=!1,this.disconnecting=!1,this.restored=!1,this.handlers=[],this.timedHandlers=[],this.removeTimeds=[],this.removeHandlers=[],this.addTimeds=[],this.addHandlers=[],this._changeConnectStatus(i.Status.DISCONNECTED,a),this.connected=!1},_dataRecv:function(a,b){i.info("_dataRecv called");var c=this._proto._reqToData(a);if(null!==c){this.xmlInput!==i.Connection.prototype.xmlInput&&(c.nodeName===this._proto.strip&&c.childNodes.length?this.xmlInput(c.childNodes[0]):this.xmlInput(c)),this.rawInput!==i.Connection.prototype.rawInput&&(b?this.rawInput(b):this.rawInput(i.serialize(c)));for(var d,e;this.removeHandlers.length>0;)e=this.removeHandlers.pop(),d=this.handlers.indexOf(e),d>=0&&this.handlers.splice(d,1);for(;this.addHandlers.length>0;)this.handlers.push(this.addHandlers.pop());if(this.disconnecting&&this._proto._emptyQueue())return void this._doDisconnect();var f,g,h=c.getAttribute("type");if(null!==h&&"terminate"==h){if(this.disconnecting)return;return f=c.getAttribute("condition"),g=c.getElementsByTagName("conflict"),null!==f?("remote-stream-error"==f&&g.length>0&&(f="conflict"),this._changeConnectStatus(i.Status.CONNFAIL,f)):this._changeConnectStatus(i.Status.CONNFAIL,"unknown"),void this._doDisconnect(f)}var j=this;i.forEachChild(c,null,function(a){var b,c;for(c=j.handlers,j.handlers=[],b=0;b0:d.getElementsByTagName("stream:features").length>0||d.getElementsByTagName("features").length>0;var g,h,j=d.getElementsByTagName("mechanism"),k=[],l=!1;if(!f)return void this._proto._no_auth_received(b);if(j.length>0)for(g=0;g0,(l=this._authentication.legacy_auth||k.length>0)?void(this.do_authentication!==!1&&this.authenticate(k)):void this._proto._no_auth_received(b)}}},authenticate:function(a){var c;for(c=0;ca[d].prototype.priority&&(d=f);if(d!=c){var h=a[c];a[c]=a[d],a[d]=h}}var j=!1;for(c=0;c0&&(b="conflict"),this._changeConnectStatus(i.Status.AUTHFAIL,b),!1}var d,e=a.getElementsByTagName("bind");return e.length>0?(d=e[0].getElementsByTagName("jid"),void(d.length>0&&(this.jid=i.getText(d[0]),this.do_session?(this._addSysHandler(this._sasl_session_cb.bind(this),null,null,null,"_session_auth_2"),this.send(g({type:"set",id:"_session_auth_2"}).c("session",{xmlns:i.NS.SESSION}).tree())):(this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null))))):(i.info("SASL binding failed."),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1)},_sasl_session_cb:function(a){if("result"==a.getAttribute("type"))this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null);else if("error"==a.getAttribute("type"))return i.info("Session creation failed."),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1;return!1},_sasl_failure_cb:function(a){return this._sasl_success_handler&&(this.deleteHandler(this._sasl_success_handler),this._sasl_success_handler=null),this._sasl_challenge_handler&&(this.deleteHandler(this._sasl_challenge_handler),this._sasl_challenge_handler=null),this._sasl_mechanism&&this._sasl_mechanism.onFailure(),this._changeConnectStatus(i.Status.AUTHFAIL,null),!1},_auth2_cb:function(a){return"result"==a.getAttribute("type")?(this.authenticated=!0,this._changeConnectStatus(i.Status.CONNECTED,null)):"error"==a.getAttribute("type")&&(this._changeConnectStatus(i.Status.AUTHFAIL,null),this.disconnect("authentication failed")),!1},_addSysTimedHandler:function(a,b){var c=new i.TimedHandler(a,b);return c.user=!1,this.addTimeds.push(c),c},_addSysHandler:function(a,b,c,d,e){var f=new i.Handler(a,b,c,d,e);return f.user=!1,this.addHandlers.push(f),f},_onDisconnectTimeout:function(){return i.info("_onDisconnectTimeout was called"),this._changeConnectStatus(i.Status.CONNTIMEOUT,null),this._proto._onDisconnectTimeout(),this._doDisconnect(),!1},_onIdle:function(){for(var a,b,c,d;this.addTimeds.length>0;)this.timedHandlers.push(this.addTimeds.pop());for(;this.removeTimeds.length>0;)b=this.removeTimeds.pop(),a=this.timedHandlers.indexOf(b),a>=0&&this.timedHandlers.splice(a,1);var e=(new Date).getTime();for(d=[],a=0;a0&&(c="conflict"),this._conn._changeConnectStatus(a.Status.CONNFAIL,c)):this._conn._changeConnectStatus(a.Status.CONNFAIL,"unknown"),this._conn._doDisconnect(c),a.Status.CONNFAIL;this.sid||(this.sid=b.getAttribute("sid"));var f=b.getAttribute("requests");f&&(this.window=parseInt(f,10));var g=b.getAttribute("hold");g&&(this.hold=parseInt(g,10));var h=b.getAttribute("wait");h&&(this.wait=parseInt(h,10))},_disconnect:function(a){this._sendTerminate(a)},_doDisconnect:function(){this.sid=null,this.rid=Math.floor(4294967295*Math.random()),this._conn._sessionCachingSupported()&&window.sessionStorage.removeItem("strophe-bosh-session"),this._conn.nextValidRid(this.rid)},_emptyQueue:function(){return 0===this._requests.length},_hitError:function(b){this.errors++,a.warn("request errored, status: "+b+", number of errors: "+this.errors),this.errors>4&&this._conn._onDisconnectTimeout()},_no_auth_received:function(b){b=b?b.bind(this._conn):this._conn._connect_cb.bind(this._conn);var c=this._buildBody();this._requests.push(new a.Request(c.tree(),this._onRequestStateChange.bind(this,b.bind(this._conn)),c.tree().getAttribute("rid"))),this._throttledRequestHandler()},_onDisconnectTimeout:function(){this._abortAllRequests()},_abortAllRequests:function(){for(var a;this._requests.length>0;)a=this._requests.pop(),a.abort=!0,a.xhr.abort(),a.xhr.onreadystatechange=function(){}},_onIdle:function(){var b=this._conn._data;if(this._conn.authenticated&&0===this._requests.length&&0===b.length&&!this._conn.disconnecting&&(a.info("no requests during idle cycle, sending blank request"),b.push(null)),!this._conn.paused){if(this._requests.length<2&&b.length>0){for(var c=this._buildBody(),d=0;d0){var e=this._requests[0].age();null!==this._requests[0].dead&&this._requests[0].timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),e>Math.floor(a.TIMEOUT*this.wait)&&(a.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(a.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_onRequestStateChange:function(b,c){if(a.debug("request id "+c.id+"."+c.sends+" state changed to "+c.xhr.readyState),c.abort)return void(c.abort=!1);var d;if(4==c.xhr.readyState){d=0;try{d=c.xhr.status}catch(a){}if("undefined"==typeof d&&(d=0),this.disconnecting&&d>=400)return void this._hitError(d);var e=this._requests[0]==c,f=this._requests[1]==c;(d>0&&d<500||c.sends>5)&&(this._removeRequest(c),a.debug("request id "+c.id+" should now be removed")),200==d?((f||e&&this._requests.length>0&&this._requests[0].age()>Math.floor(a.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(c.rid)+1),a.debug("request id "+c.id+"."+c.sends+" got 200"),b(c),this.errors=0):(a.error("request id "+c.id+"."+c.sends+" error "+d+" happened"),(0===d||d>=400&&d<600||d>=12e3)&&(this._hitError(d),d>=400&&d<500&&(this._conn._changeConnectStatus(a.Status.DISCONNECTING,null),this._conn._doDisconnect()))),d>0&&d<500||c.sends>5||this._throttledRequestHandler()}},_processRequest:function(b){var c=this,d=this._requests[b],e=-1;try{4==d.xhr.readyState&&(e=d.xhr.status)}catch(c){a.error("caught an error in _requests["+b+"], reqStatus: "+e)}if("undefined"==typeof e&&(e=-1),d.sends>this._conn.maxRetries)return void this._conn._onDisconnectTimeout();var f=d.age(),g=!isNaN(f)&&f>Math.floor(a.TIMEOUT*this.wait),h=null!==d.dead&&d.timeDead()>Math.floor(a.SECONDARY_TIMEOUT*this.wait),i=4==d.xhr.readyState&&(e<1||e>=500);if((g||h||i)&&(h&&a.error("Request "+this._requests[b].id+" timed out (secondary), restarting"),d.abort=!0,d.xhr.abort(),d.xhr.onreadystatechange=function(){},this._requests[b]=new a.Request(d.xmlData,d.origFunc,d.rid,d.sends),d=this._requests[b]),0===d.xhr.readyState){a.debug("request id "+d.id+"."+d.sends+" posting");try{var j=this._conn.options.contentType||"text/xml; charset=utf-8";d.xhr.open("POST",this._conn.service,!this._conn.options.sync),d.xhr.setRequestHeader("Content-Type",j),this._conn.options.withCredentials&&(d.xhr.withCredentials=!0)}catch(b){return a.error("XHR open failed."),this._conn.connected||this._conn._changeConnectStatus(a.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var k=function(){if(d.date=new Date,c._conn.options.customHeaders){var a=c._conn.options.customHeaders;for(var b in a)a.hasOwnProperty(b)&&d.xhr.setRequestHeader(b,a[b])}d.xhr.send(d.data)};if(d.sends>1){var l=1e3*Math.min(Math.floor(a.TIMEOUT*this.wait),Math.pow(d.sends,3));setTimeout(function(){k()},l)}else k();d.sends++,this._conn.xmlOutput!==a.Connection.prototype.xmlOutput&&(d.xmlData.nodeName===this.strip&&d.xmlData.childNodes.length?this._conn.xmlOutput(d.xmlData.childNodes[0]):this._conn.xmlOutput(d.xmlData)),this._conn.rawOutput!==a.Connection.prototype.rawOutput&&this._conn.rawOutput(d.data)}else a.debug("_processRequest: "+(0===b?"first":"second")+" request has readyState of "+d.xhr.readyState)},_removeRequest:function(b){a.debug("removing request");var c;for(c=this._requests.length-1;c>=0;c--)b==this._requests[c]&&this._requests.splice(c,1);b.xhr.onreadystatechange=function(){},this._throttledRequestHandler()},_restartRequest:function(a){var b=this._requests[a];null===b.dead&&(b.dead=new Date),this._processRequest(a)},_reqToData:function(a){try{return a.getResponse()}catch(a){if("parsererror"!=a)throw a;this._conn.disconnect("strophe-parsererror")}},_sendTerminate:function(b){a.info("_sendTerminate was called");var c=this._buildBody().attrs({type:"terminate"});b&&c.cnode(b.tree());var d=new a.Request(c.tree(),this._onRequestStateChange.bind(this,this._conn._dataRecv.bind(this._conn)),c.tree().getAttribute("rid"));this._requests.push(d),this._throttledRequestHandler()},_send:function(){clearTimeout(this._conn._idleTimeout),this._throttledRequestHandler(),this._conn._idleTimeout=setTimeout(function(){this._onIdle()}.bind(this._conn),100)},_sendRestart:function(){this._throttledRequestHandler(),clearTimeout(this._conn._idleTimeout)},_throttledRequestHandler:function(){this._requests?a.debug("_throttledRequestHandler called with "+this._requests.length+" requests"):a.debug("_throttledRequestHandler called with undefined requests"),this._requests&&0!==this._requests.length&&(this._requests.length>0&&this._processRequest(0),this._requests.length>1&&Math.abs(this._requests[0].rid-this._requests[1].rid): "+d);var e=b.getAttribute("version");return"string"!=typeof e?c="Missing version in ":"1.0"!==e&&(c="Wrong version in : "+e),!c||(this._conn._changeConnectStatus(a.Status.CONNFAIL,c),this._conn._doDisconnect(),!1)},_connect_cb_wrapper:function(b){if(0===b.data.indexOf("\s*)*/,"");if(""===c)return;var d=(new DOMParser).parseFromString(c,"text/xml").documentElement;this._conn.xmlInput(d),this._conn.rawInput(b.data),this._handleStreamStart(d)&&this._connect_cb(d)}else if(0===b.data.indexOf(" tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){a.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(a){return""+a+""},_closeSocket:function(){if(this.socket)try{this.socket.close()}catch(a){}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(){this._conn.connected&&!this._conn.disconnecting?(a.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):a.info("Websocket closed")},_no_auth_received:function(b){a.error("Server did not send any auth methods"),this._conn._changeConnectStatus(a.Status.CONNFAIL,"Server did not send any auth methods"),b&&(b=b.bind(this._conn))(),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(b){a.error("Websocket error "+b),this._conn._changeConnectStatus(a.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()},_onIdle:function(){var b=this._conn._data;if(b.length>0&&!this._conn.paused){for(var c=0;c=0||a.indexOf(">")>=0||a.indexOf("<")>=0},m=function(a){return""},e=function(a){return a.replace("]]>","]]]]>")},c.processors=i,c.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}},c.ValidationError=function(a){function b(a){this.message=a}return n(b,a),b}(Error),c.Builder=function(){function a(a){var b,d,e;this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e)}return a.prototype.buildObject=function(a){var b,e,f,g,h;return b=this.options.attrkey,e=this.options.charkey,1===Object.keys(a).length&&this.options.rootName===c.defaults[.2].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,f=function(a){return function(c,d){var g,h,i,k,l,n;if("object"!=typeof d)a.options.cdata&&j(d)?c.raw(m(d)):c.txt(d);else for(l in d)if(o.call(d,l))if(h=d[l],l===b){if("object"==typeof h)for(g in h)n=h[g],c=c.att(g,n)}else if(l===e)c=a.options.cdata&&j(h)?c.raw(m(h)):c.txt(h);else if(Array.isArray(h))for(k in h)o.call(h,k)&&(i=h[k],c="string"==typeof i?a.options.cdata&&j(i)?c.ele(l).raw(m(i)).up():c.ele(l,i).up():f(c.ele(l),i).up());else"object"==typeof h?c=f(c.ele(l),h).up():"string"==typeof h&&a.options.cdata&&j(h)?c=c.ele(l).raw(m(h)).up():(null==h&&(h=""),c=c.ele(l,h.toString()).up());return c}}(this),g=d.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),f(g,a).end(this.options.renderOpts)},a}(),c.Parser=function(a){function d(a){this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var b,d,e;if(!(this instanceof c.Parser))return new c.Parser(a);this.options={},d=c.defaults[.2];for(b in d)o.call(d,b)&&(e=d[b],this.options[b]=e);for(b in a)o.call(a,b)&&(e=a[b],this.options[b]=e);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return n(d,a),d.prototype.processAsync=function(){var a,b;try{return this.remaining.length<=this.options.chunkSize?(a=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(a),this.saxParser.close()):(a=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(a),l(this.processAsync))}catch(a){if(b=a,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(b)}},d.prototype.assignOrPush=function(a,b,c){return b in a?(a[b]instanceof Array||(a[b]=[a[b]]),a[b].push(c)):this.options.explicitArray?a[b]=[c]:a[b]=c},d.prototype.reset=function(){var a,b,c,d;return this.removeAllListeners(),this.saxParser=k.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(a){return function(b){if(a.saxParser.resume(),!a.saxParser.errThrown)return a.saxParser.errThrown=!0,a.emit("error",b)}}(this),this.saxParser.onend=function(a){return function(){if(!a.saxParser.ended)return a.saxParser.ended=!0,a.emit("end",a.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,d=[],a=this.options.attrkey,b=this.options.charkey,this.saxParser.onopentag=function(c){return function(e){var f,g,i,j,k;if(i={},i[b]="",!c.options.ignoreAttrs){k=e.attributes;for(f in k)o.call(k,f)&&(a in i||c.options.mergeAttrs||(i[a]={}),g=c.options.attrValueProcessors?h(c.options.attrValueProcessors,e.attributes[f]):e.attributes[f],j=c.options.attrNameProcessors?h(c.options.attrNameProcessors,f):f,c.options.mergeAttrs?c.assignOrPush(i,j,g):i[a][j]=g)}return i["#name"]=c.options.tagNameProcessors?h(c.options.tagNameProcessors,e.name):e.name,c.options.xmlns&&(i[c.options.xmlnskey]={uri:e.uri,local:e.local}),d.push(i)}}(this),this.saxParser.onclosetag=function(a){return function(){var c,e,f,i,j,k,l,m,n,p,q;if(l=d.pop(),k=l["#name"],a.options.explicitChildren&&a.options.preserveChildrenOrder||delete l["#name"],l.cdata===!0&&(c=l.cdata,delete l.cdata),p=d[d.length-1],l[b].match(/^\s*$/)&&!c?(e=l[b],delete l[b]):(a.options.trim&&(l[b]=l[b].trim()),a.options.normalize&&(l[b]=l[b].replace(/\s{2,}/g," ").trim()),l[b]=a.options.valueProcessors?h(a.options.valueProcessors,l[b]):l[b],1===Object.keys(l).length&&b in l&&!a.EXPLICIT_CHARKEY&&(l=l[b])),g(l)&&(l=""!==a.options.emptyTag?a.options.emptyTag:e),null!=a.options.validator){q="/"+function(){var a,b,c;for(c=[],a=0,b=d.length;a0&&(j[a.options.childkey]=l),l=j;return d.length>0?a.assignOrPush(p,k,l):(a.options.explicitRoot&&(n=l, +l={},l[k]=n),a.resultObject=l,a.saxParser.ended=!0,a.emit("end",a.resultObject))}}(this),c=function(a){return function(c){var e,f;if(f=d[d.length-1])return f[b]+=c,a.options.explicitChildren&&a.options.preserveChildrenOrder&&a.options.charsAsChildren&&(a.options.includeWhiteChars||""!==c.replace(/\\n/g,"").trim())&&(f[a.options.childkey]=f[a.options.childkey]||[],e={"#name":"__text__"},e[b]=c,a.options.normalize&&(e[b]=e[b].replace(/\s{2,}/g," ").trim()),f[a.options.childkey].push(e)),f}}(this),this.saxParser.ontext=c,this.saxParser.oncdata=function(a){return function(a){var b;if(b=c(a))return b.cdata=!0}}(this)},d.prototype.parseString=function(a,c){var d;null!=c&&"function"==typeof c&&(this.on("end",function(a){return this.reset(),c(null,a)}),this.on("error",function(a){return this.reset(),c(a)}));try{return a=a.toString(),""===a.trim()?(this.emit("end",null),!0):(a=b.stripBOM(a),this.options.async?(this.remaining=a,l(this.processAsync),this.saxParser):this.saxParser.write(a).close())}catch(a){if(d=a,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",d),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw d}},d}(f.EventEmitter),c.parseString=function(a,b,d){var e,f,g;return null!=d?("function"==typeof d&&(e=d),"object"==typeof b&&(f=b)):("function"==typeof b&&(e=b),f={}),g=new c.Parser(f),g.parseString(a,e)}}).call(this)},{"./bom":283,"./processors":284,events:204,sax:286,timers:222,xmlbuilder:303}],286:[function(a,b,c){(function(b){!function(c){function d(a,b){if(!(this instanceof d))return new d(a,b);var e=this;f(e),e.q=e.c="",e.bufferCheckPosition=c.MAX_BUFFER_LENGTH,e.opt=b||{},e.opt.lowercase=e.opt.lowercase||e.opt.lowercasetags,e.looseCase=e.opt.lowercase?"toLowerCase":"toUpperCase",e.tags=[],e.closed=e.closedRoot=e.sawRoot=!1,e.tag=e.error=null,e.strict=!!a,e.noscript=!(!a&&!e.opt.noscript),e.state=U.BEGIN,e.strictEntities=e.opt.strictEntities,e.ENTITIES=e.strictEntities?Object.create(c.XML_ENTITIES):Object.create(c.ENTITIES),e.attribList=[],e.opt.xmlns&&(e.ns=Object.create(P)),e.trackPosition=e.opt.position!==!1,e.trackPosition&&(e.position=e.line=e.column=0),n(e,"onready")}function e(a){for(var b=Math.max(c.MAX_BUFFER_LENGTH,10),d=0,e=0,f=D.length;eb)switch(D[e]){case"textNode":p(a);break;case"cdata":o(a,"oncdata",a.cdata),a.cdata="";break;case"script":o(a,"onscript",a.script),a.script="";break;default:r(a,"Max buffer length exceeded: "+D[e])}d=Math.max(d,g)}var h=c.MAX_BUFFER_LENGTH-d;a.bufferCheckPosition=h+a.position}function f(a){for(var b=0,c=D.length;b",a.tagName="",void(a.state=U.SCRIPT);o(a,"onscript",a.script),a.script=""}var b=a.tags.length,c=a.tagName;a.strict||(c=c[a.looseCase]());for(var d=c;b--;){var e=a.tags[b];if(e.name===d)break;t(a,"Unexpected close tag")}if(b<0)return t(a,"Unmatched closing tag: "+a.tagName),a.textNode+="",void(a.state=U.TEXT);a.tagName=c;for(var f=a.tags.length;f-- >b;){var g=a.tag=a.tags.pop();a.tagName=a.tag.name,o(a,"onclosetag",a.tagName);var h={};for(var i in g.ns)h[i]=g.ns[i];var j=a.tags[a.tags.length-1]||a;a.opt.xmlns&&g.ns!==j.ns&&Object.keys(g.ns).forEach(function(b){var c=g.ns[b];o(a,"onclosenamespace",{prefix:b,uri:c})})}0===b&&(a.closedRoot=!0),a.tagName=a.attribValue=a.attribName="",a.attribList.length=0,a.state=U.TEXT}function z(a){var b,c=a.entity,d=c.toLowerCase(),e="";return a.ENTITIES[c]?a.ENTITIES[c]:a.ENTITIES[d]?a.ENTITIES[d]:(c=d,"#"===c.charAt(0)&&("x"===c.charAt(1)?(c=c.slice(2),b=parseInt(c,16),e=b.toString(16)):(c=c.slice(1),b=parseInt(c,10),e=b.toString(10))),c=c.replace(/^0+/,""),e.toLowerCase()!==c?(t(a,"Invalid character entity"),"&"+a.entity+";"):String.fromCodePoint(b))}function A(a,b){"<"===b?(a.state=U.OPEN_WAKA,a.startTagPosition=a.position):m(G,b)&&(t(a,"Non-whitespace before first tag."),a.textNode=b,a.state=U.TEXT)}function B(a,b){var c="";return b"===d?(o(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=U.TEXT):l(J,d)?(b.state=U.SGML_DECL_QUOTED,b.sgmlDecl+=d):b.sgmlDecl+=d;continue;case U.SGML_DECL_QUOTED:d===b.q&&(b.state=U.SGML_DECL,b.q=""),b.sgmlDecl+=d;continue;case U.DOCTYPE:">"===d?(b.state=U.TEXT,o(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=d,"["===d?b.state=U.DOCTYPE_DTD:l(J,d)&&(b.state=U.DOCTYPE_QUOTED,b.q=d));continue;case U.DOCTYPE_QUOTED:b.doctype+=d,d===b.q&&(b.q="",b.state=U.DOCTYPE);continue;case U.DOCTYPE_DTD:b.doctype+=d,"]"===d?b.state=U.DOCTYPE:l(J,d)&&(b.state=U.DOCTYPE_DTD_QUOTED,b.q=d);continue;case U.DOCTYPE_DTD_QUOTED:b.doctype+=d,d===b.q&&(b.state=U.DOCTYPE_DTD,b.q="");continue;case U.COMMENT:"-"===d?b.state=U.COMMENT_ENDING:b.comment+=d;continue;case U.COMMENT_ENDING:"-"===d?(b.state=U.COMMENT_ENDED,b.comment=q(b.opt,b.comment),b.comment&&o(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+d,b.state=U.COMMENT);continue;case U.COMMENT_ENDED:">"!==d?(t(b,"Malformed comment"),b.comment+="--"+d,b.state=U.COMMENT):b.state=U.TEXT;continue;case U.CDATA:"]"===d?b.state=U.CDATA_ENDING:b.cdata+=d;continue;case U.CDATA_ENDING:"]"===d?b.state=U.CDATA_ENDING_2:(b.cdata+="]"+d,b.state=U.CDATA);continue;case U.CDATA_ENDING_2:">"===d?(b.cdata&&o(b,"oncdata",b.cdata),o(b,"onclosecdata"),b.cdata="",b.state=U.TEXT):"]"===d?b.cdata+="]":(b.cdata+="]]"+d,b.state=U.CDATA);continue;case U.PROC_INST:"?"===d?b.state=U.PROC_INST_ENDING:l(G,d)?b.state=U.PROC_INST_BODY:b.procInstName+=d;continue;case U.PROC_INST_BODY:if(!b.procInstBody&&l(G,d))continue;"?"===d?b.state=U.PROC_INST_ENDING:b.procInstBody+=d;continue;case U.PROC_INST_ENDING:">"===d?(o(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=U.TEXT):(b.procInstBody+="?"+d,b.state=U.PROC_INST_BODY);continue;case U.OPEN_TAG:l(R,d)?b.tagName+=d:(u(b),">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:(m(G,d)&&t(b,"Invalid character in tag name"),b.state=U.ATTRIB));continue;case U.OPEN_TAG_SLASH:">"===d?(x(b,!0),y(b)):(t(b,"Forward-slash in opening tag not followed by >"),b.state=U.ATTRIB);continue;case U.ATTRIB:if(l(G,d))continue;">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME:"="===d?b.state=U.ATTRIB_VALUE:">"===d?(t(b,"Attribute without value"),b.attribValue=b.attribName,w(b),x(b)):l(G,d)?b.state=U.ATTRIB_NAME_SAW_WHITE:l(R,d)?b.attribName+=d:t(b,"Invalid attribute name");continue;case U.ATTRIB_NAME_SAW_WHITE:if("="===d)b.state=U.ATTRIB_VALUE;else{if(l(G,d))continue;t(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",o(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",">"===d?x(b):l(Q,d)?(b.attribName=d,b.state=U.ATTRIB_NAME):(t(b,"Invalid attribute name"),b.state=U.ATTRIB)}continue;case U.ATTRIB_VALUE:if(l(G,d))continue;l(J,d)?(b.q=d,b.state=U.ATTRIB_VALUE_QUOTED):(t(b,"Unquoted attribute value"),b.state=U.ATTRIB_VALUE_UNQUOTED,b.attribValue=d);continue;case U.ATTRIB_VALUE_QUOTED:if(d!==b.q){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=d;continue}w(b),b.q="",b.state=U.ATTRIB_VALUE_CLOSED;continue;case U.ATTRIB_VALUE_CLOSED:l(G,d)?b.state=U.ATTRIB:">"===d?x(b):"/"===d?b.state=U.OPEN_TAG_SLASH:l(Q,d)?(t(b,"No whitespace between attributes"),b.attribName=d,b.attribValue="",b.state=U.ATTRIB_NAME):t(b,"Invalid attribute name");continue;case U.ATTRIB_VALUE_UNQUOTED:if(m(K,d)){"&"===d?b.state=U.ATTRIB_VALUE_ENTITY_U:b.attribValue+=d;continue}w(b),">"===d?x(b):b.state=U.ATTRIB;continue;case U.CLOSE_TAG:if(b.tagName)">"===d?y(b):l(R,d)?b.tagName+=d:b.script?(b.script+=""===d?y(b):t(b,"Invalid characters in closing tag");continue;case U.TEXT_ENTITY:case U.ATTRIB_VALUE_ENTITY_Q:case U.ATTRIB_VALUE_ENTITY_U:var h,i;switch(b.state){case U.TEXT_ENTITY:h=U.TEXT,i="textNode";break;case U.ATTRIB_VALUE_ENTITY_Q:h=U.ATTRIB_VALUE_QUOTED,i="attribValue";break;case U.ATTRIB_VALUE_ENTITY_U:h=U.ATTRIB_VALUE_UNQUOTED,i="attribValue"}";"===d?(b[i]+=z(b),b.entity="",b.state=h):l(b.entity.length?T:S,d)?b.entity+=d:(t(b,"Invalid character in entity name"),b[i]+="&"+b.entity+d,b.entity="",b.state=h);continue;default:throw new Error(b,"Unknown state: "+b.state)}}return b.position>=b.bufferCheckPosition&&e(b),b}c.parser=function(a,b){return new d(a,b)},c.SAXParser=d,c.SAXStream=i,c.createStream=h,c.MAX_BUFFER_LENGTH=65536;var D=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];c.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(a){function b(){}b.prototype=a;var c=new b;return c}),Object.keys||(Object.keys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}),d.prototype={end:function(){s(this)},write:C,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){g(this)}};var E;try{E=a("stream").Stream}catch(a){E=function(){}}var F=c.EVENTS.filter(function(a){return"error"!==a&&"end"!==a});i.prototype=Object.create(E.prototype,{constructor:{value:i}}),i.prototype.write=function(c){if("function"==typeof b&&"function"==typeof b.isBuffer&&b.isBuffer(c)){if(!this._decoder){var d=a("string_decoder").StringDecoder;this._decoder=new d("utf8")}c=this._decoder.write(c)}return this._parser.write(c.toString()),this.emit("data",c),!0},i.prototype.end=function(a){return a&&a.length&&this.write(a),this._parser.end(),!0},i.prototype.on=function(a,b){var c=this;return c._parser["on"+a]||F.indexOf(a)===-1||(c._parser["on"+a]=function(){var b=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);b.splice(0,0,a),c.emit.apply(c,b)}),E.prototype.on.call(c,a,b)};var G="\r\n\t ",H="0124356789",I="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",J="'\"",K=G+">",L="[CDATA[",M="DOCTYPE",N="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",P={xml:N,xmlns:O};G=j(G),H=j(H),I=j(I);var Q=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,R=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,S=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,T=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;J=j(J),K=j(K);var U=0;c.STATE={BEGIN:U++,BEGIN_WHITESPACE:U++,TEXT:U++,TEXT_ENTITY:U++,OPEN_WAKA:U++,SGML_DECL:U++,SGML_DECL_QUOTED:U++,DOCTYPE:U++,DOCTYPE_QUOTED:U++,DOCTYPE_DTD:U++,DOCTYPE_DTD_QUOTED:U++,COMMENT_STARTING:U++,COMMENT:U++,COMMENT_ENDING:U++,COMMENT_ENDED:U++,CDATA:U++,CDATA_ENDING:U++,CDATA_ENDING_2:U++,PROC_INST:U++,PROC_INST_BODY:U++,PROC_INST_ENDING:U++,OPEN_TAG:U++,OPEN_TAG_SLASH:U++,ATTRIB:U++,ATTRIB_NAME:U++,ATTRIB_NAME_SAW_WHITE:U++,ATTRIB_VALUE:U++,ATTRIB_VALUE_QUOTED:U++,ATTRIB_VALUE_CLOSED:U++,ATTRIB_VALUE_UNQUOTED:U++,ATTRIB_VALUE_ENTITY_Q:U++,ATTRIB_VALUE_ENTITY_U:U++,CLOSE_TAG:U++,CLOSE_TAG_SAW_WHITE:U++,SCRIPT:U++,SCRIPT_ENDING:U++},c.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},c.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(c.ENTITIES).forEach(function(a){var b=c.ENTITIES[a],d="number"==typeof b?String.fromCharCode(b):b;c.ENTITIES[a]=d});for(var V in c.STATE)c.STATE[c.STATE[V]]=V;U=c.STATE,String.fromCodePoint||!function(){var a=String.fromCharCode,b=Math.floor,c=function(){var c,d,e=16384,f=[],g=-1,h=arguments.length;if(!h)return"";for(var i="";++g1114111||b(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?f.push(j):(j-=65536,c=(j>>10)+55296,d=j%1024+56320,f.push(c,d)),(g+1===h||f.length>e)&&(i+=a.apply(null,f),f.length=0)}return i};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:c,configurable:!0,writable:!0}):String.fromCodePoint=c}()}("undefined"==typeof c?this.sax={}:c)}).call(this,a("buffer").Buffer)},{buffer:8,stream:220,string_decoder:221}],287:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing attribute name of element "+a.name);if(null==c)throw new Error("Missing attribute value for attribute "+b+" of element "+a.name);this.name=this.stringify.attName(b),this.value=this.stringify.attValue(c)}return a.prototype.clone=function(){return d(a.prototype,this)},a.prototype.toString=function(a,b){return" "+this.name+'="'+this.value+'"'},a}()}).call(this)},{"lodash/create":400}],288:[function(a,b,c){(function(){var c,d,e,f,g;g=a("./XMLStringifier"),d=a("./XMLDeclaration"),e=a("./XMLDocType"),f=a("./XMLElement"),b.exports=c=function(){function a(a,b){var c,d;if(null==a)throw new Error("Root element needs a name");null==b&&(b={}),this.options=b,this.stringify=new g(b),d=new f(this,"doc"),c=d.element(a),c.isRoot=!0,c.documentObject=this,this.rootObject=c,b.headless||(c.declaration(b),null==b.pubID&&null==b.sysID||c.doctype(b))}return a.prototype.root=function(){return this.rootObject},a.prototype.end=function(a){return this.toString(a)},a.prototype.toString=function(a){var b,c,d,e,f,g,h,i;return e=(null!=a?a.pretty:void 0)||!1,b=null!=(g=null!=a?a.indent:void 0)?g:" ",d=null!=(h=null!=a?a.offset:void 0)?h:0,c=null!=(i=null!=a?a.newline:void 0)?i:"\n",f="",null!=this.xmldec&&(f+=this.xmldec.toString(a)),null!=this.doctype&&(f+=this.doctype.toString(a)),f+=this.rootObject.toString(a),e&&f.slice(-c.length)===c&&(f=f.slice(0,-c.length)),f},a}()}).call(this)},{"./XMLDeclaration":295,"./XMLDocType":296,"./XMLElement":297,"./XMLStringifier":301}],289:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing CDATA text");this.text=this.stringify.cdata(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400}],290:[function(a,b,c){(function(){var c,d,e,f=function(a,b){function c(){this.constructor=a}for(var d in b)g.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},g={}.hasOwnProperty;e=a("lodash/create"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c){if(b.__super__.constructor.call(this,a),null==c)throw new Error("Missing comment text");this.text=this.stringify.comment(c)}return f(b,a),b.prototype.clone=function(){return e(b.prototype,this)},b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400}],291:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c,d,e,f){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");if(null==c)throw new Error("Missing DTD attribute name");if(!d)throw new Error("Missing DTD attribute type");if(!e)throw new Error("Missing DTD attribute default");if(0!==e.indexOf("#")&&(e="#"+e),!e.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT");if(f&&!e.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT");this.elementName=this.stringify.eleName(b),this.attributeName=this.stringify.attName(c),this.attributeType=this.stringify.dtdAttType(d),this.defaultValue=this.stringify.dtdAttDefault(f),this.defaultValueType=e}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],292:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing DTD element name");c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.eleName(b),this.value=this.stringify.dtdElementValue(c)}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],293:[function(a,b,c){(function(){var c,d,e;d=a("lodash/create"),e=a("lodash/isObject"),b.exports=c=function(){function a(a,b,c,d){if(this.stringify=a.stringify,null==c)throw new Error("Missing entity name");if(null==d)throw new Error("Missing entity value");if(this.pe=!!b,this.name=this.stringify.eleName(c),e(d)){if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity");if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity");if(null!=d.pubID&&(this.pubID=this.stringify.dtdPubID(d.pubID)),null!=d.sysID&&(this.sysID=this.stringify.dtdSysID(d.sysID)),null!=d.nData&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity")}else this.value=this.stringify.dtdEntityValue(d)}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400,"lodash/isObject":414}],294:[function(a,b,c){(function(){var c,d;d=a("lodash/create"),b.exports=c=function(){function a(a,b,c){if(this.stringify=a.stringify,null==b)throw new Error("Missing notation name");if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity");this.name=this.stringify.eleName(b),null!=c.pubID&&(this.pubID=this.stringify.dtdPubID(c.pubID)),null!=c.sysID&&(this.sysID=this.stringify.dtdSysID(c.sysID))}return a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},a}()}).call(this)},{"lodash/create":400}],295:[function(a,b,c){(function(){var c,d,e,f,g=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},h={}.hasOwnProperty;e=a("lodash/create"),f=a("lodash/isObject"),d=a("./XMLNode"),b.exports=c=function(a){function b(a,c,d,e){var g;b.__super__.constructor.call(this,a),f(c)&&(g=c,c=g.version,d=g.encoding,e=g.standalone),c||(c="1.0"),this.version=this.stringify.xmlVersion(c),null!=d&&(this.encoding=this.stringify.xmlEncoding(d)),null!=e&&(this.standalone=this.stringify.xmlStandalone(e))}return g(b,a),b.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k;return f=(null!=a?a.pretty:void 0)||!1,c=null!=(h=null!=a?a.indent:void 0)?h:" ",e=null!=(i=null!=a?a.offset:void 0)?i:0,d=null!=(j=null!=a?a.newline:void 0)?j:"\n",b||(b=0),k=new Array(b+e+1).join(c),g="",f&&(g+=k),g+="",f&&(g+=d),g},b}(d)}).call(this)},{"./XMLNode":298,"lodash/create":400,"lodash/isObject":414}],296:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l;k=a("lodash/create"),l=a("lodash/isObject"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDTDAttList"),g=a("./XMLDTDEntity"),f=a("./XMLDTDElement"),h=a("./XMLDTDNotation"),j=a("./XMLProcessingInstruction"),b.exports=i=function(){function a(a,b,c){var d,e;this.documentObject=a,this.stringify=this.documentObject.stringify,this.children=[],l(b)&&(d=b,b=d.pubID,c=d.sysID),null==c&&(e=[b,c],c=e[0],b=e[1]),null!=b&&(this.pubID=this.stringify.dtdPubID(b)),null!=c&&(this.sysID=this.stringify.dtdSysID(c))}return a.prototype.element=function(a,b){var c;return c=new f(this,a,b),this.children.push(c),this},a.prototype.attList=function(a,b,c,d,f){var g;return g=new e(this,a,b,c,d,f),this.children.push(g),this},a.prototype.entity=function(a,b){var c;return c=new g(this,(!1),a,b),this.children.push(c),this},a.prototype.pEntity=function(a,b){var c;return c=new g(this,(!0),a,b),this.children.push(c),this},a.prototype.notation=function(a,b){var c;return c=new h(this,a,b),this.children.push(c),this},a.prototype.cdata=function(a){var b;return b=new c(this,a),this.children.push(b),this},a.prototype.comment=function(a){var b;return b=new d(this,a),this.children.push(b),this},a.prototype.instruction=function(a,b){var c;return c=new j(this,a,b),this.children.push(c),this},a.prototype.root=function(){return this.documentObject.root()},a.prototype.document=function(){return this.documentObject},a.prototype.toString=function(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o;if(i=(null!=a?a.pretty:void 0)||!1,e=null!=(k=null!=a?a.indent:void 0)?k:" ",h=null!=(l=null!=a?a.offset:void 0)?l:0,g=null!=(m=null!=a?a.newline:void 0)?m:"\n",b||(b=0),o=new Array(b+h+1).join(e),j="",i&&(j+=o),j+="0){for(j+=" [",i&&(j+=g),n=this.children,d=0,f=n.length;d",p&&(q+=n);else if(p&&1===this.children.length&&null!=this.children[0].value)q+=">",q+=this.children[0].value,q+="",q+=n;else{for(q+=">",p&&(q+=n),w=this.children,i=0,k=w.length;i",p&&(q+=n)}return q},b.prototype.att=function(a,b){return this.attribute(a,b)},b.prototype.ins=function(a,b){return this.instruction(a,b)},b.prototype.a=function(a,b){return this.attribute(a,b)},b.prototype.i=function(a,b){return this.instruction(a,b)},b}(e)}).call(this)},{"./XMLAttribute":287,"./XMLNode":298,"./XMLProcessingInstruction":299,"lodash/create":400,"lodash/every":402,"lodash/isFunction":412,"lodash/isObject":414}],298:[function(a,b,c){(function(){var c,d,e,f,g,h,i,j,k,l,m,n={}.hasOwnProperty;m=a("lodash/isObject"),l=a("lodash/isFunction"),k=a("lodash/isEmpty"),g=null,c=null,d=null,e=null,f=null,i=null,j=null,b.exports=h=function(){function b(b){this.parent=b,this.options=this.parent.options,this.stringify=this.parent.stringify,null===g&&(g=a("./XMLElement"),c=a("./XMLCData"),d=a("./XMLComment"),e=a("./XMLDeclaration"),f=a("./XMLDocType"),i=a("./XMLRaw"),j=a("./XMLText"))}return b.prototype.element=function(a,b,c){var d,e,f,g,h,i,j,o,p,q;if(i=null,null==b&&(b={}),b=b.valueOf(),m(b)||(p=[b,c],c=p[0],b=p[1]),null!=a&&(a=a.valueOf()),Array.isArray(a))for(f=0,j=a.length;f/))throw new Error("Invalid CDATA text: "+a);return this.assertLegalChar(a)},a.prototype.comment=function(a){if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(a)},a.prototype.raw=function(a){return""+a||""},a.prototype.attName=function(a){return""+a||""},a.prototype.attValue=function(a){return a=""+a||"",this.attEscape(a)},a.prototype.insTarget=function(a){return""+a||""},a.prototype.insValue=function(a){if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return a},a.prototype.xmlVersion=function(a){if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},a.prototype.xmlEncoding=function(a){if(a=""+a||"",!a.match(/^[A-Za-z](?:[A-Za-z0-9._-]|-)*$/))throw new Error("Invalid encoding: "+a);return a},a.prototype.xmlStandalone=function(a){return a?"yes":"no"},a.prototype.dtdPubID=function(a){return""+a||""},a.prototype.dtdSysID=function(a){return""+a||""},a.prototype.dtdElementValue=function(a){return""+a||""},a.prototype.dtdAttType=function(a){return""+a||""},a.prototype.dtdAttDefault=function(a){return null!=a?""+a||"":a},a.prototype.dtdEntityValue=function(a){return""+a||""},a.prototype.dtdNData=function(a){return""+a||""},a.prototype.convertAttKey="@",a.prototype.convertPIKey="?",a.prototype.convertTextKey="#text",a.prototype.convertCDataKey="#cdata",a.prototype.convertCommentKey="#comment",a.prototype.convertRawKey="#raw",a.prototype.assertLegalChar=function(a){var b,c;if(b=this.allowSurrogateChars?/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]/:/[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]/,c=a.match(b))throw new Error("Invalid character ("+c+") in string: "+a+" at index "+c.index);return a},a.prototype.elEscape=function(a){var b;return b=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(b,"&").replace(//g,">").replace(/\r/g," ")},a.prototype.attEscape=function(a){var b;return b=this.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(b,"&").replace(/1?c[f-1]:void 0,h=f>2?c[2]:void 0;for(g=a.length>3&&"function"==typeof g?(f--,g):void 0,h&&e(c[0],c[1],h)&&(g=f<3?void 0:g,f=1),b=Object(b);++dl))return!1;var n=j.get(a);if(n)return n==b;var o=-1,p=!0,q=i&g?new e:void 0;for(j.set(a,b);++o-1&&a%1==0&&a-1}var e=a("./_assocIndexOf");b.exports=d},{"./_assocIndexOf":320}],378:[function(a,b,c){function d(a,b){var c=this.__data__,d=e(c,a);return d<0?c.push([a,b]):c[d][1]=b,this}var e=a("./_assocIndexOf");b.exports=d},{"./_assocIndexOf":320}],379:[function(a,b,c){function d(){this.__data__={hash:new e,map:new(g||f),string:new e}}var e=a("./_Hash"),f=a("./_ListCache"),g=a("./_Map");b.exports=d},{"./_Hash":305,"./_ListCache":306,"./_Map":307}],380:[function(a,b,c){function d(a){return e(this,a).delete(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],381:[function(a,b,c){function d(a){return e(this,a).get(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],382:[function(a,b,c){function d(a){return e(this,a).has(a)}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],383:[function(a,b,c){function d(a,b){return e(this,a).set(a,b),this}var e=a("./_getMapData");b.exports=d},{"./_getMapData":353}],384:[function(a,b,c){function d(a){var b=-1,c=Array(a.size);return a.forEach(function(a,d){c[++b]=[d,a]}),c}b.exports=d},{}],385:[function(a,b,c){function d(a,b){return function(c){return null!=c&&(c[a]===b&&(void 0!==b||a in Object(c)))}}b.exports=d},{}],386:[function(a,b,c){var d=a("./_getNative"),e=d(Object,"create");b.exports=e},{"./_getNative":355}],387:[function(a,b,c){(function(c){var d=a("./_checkGlobal"),e=d("object"==typeof c&&c),f=d("object"==typeof self&&self),g=d("object"==typeof this&&this),h=e||f||g||Function("return this")();b.exports=h}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_checkGlobal":343}],388:[function(a,b,c){function d(a){return this.__data__.set(a,e),this}var e="__lodash_hash_undefined__";b.exports=d},{}],389:[function(a,b,c){function d(a){return this.__data__.has(a)}b.exports=d},{}],390:[function(a,b,c){function d(a){var b=-1,c=Array(a.size);return a.forEach(function(a){c[++b]=a}),c}b.exports=d},{}],391:[function(a,b,c){function d(){this.__data__=new e}var e=a("./_ListCache");b.exports=d},{"./_ListCache":306}],392:[function(a,b,c){function d(a){return this.__data__.delete(a)}b.exports=d},{}],393:[function(a,b,c){function d(a){return this.__data__.get(a)}b.exports=d},{}],394:[function(a,b,c){function d(a){return this.__data__.has(a)}b.exports=d},{}],395:[function(a,b,c){function d(a,b){var c=this.__data__;return c instanceof e&&c.__data__.length==g&&(c=this.__data__=new f(c.__data__)),c.set(a,b),this}var e=a("./_ListCache"),f=a("./_MapCache"),g=200;b.exports=d},{"./_ListCache":306,"./_MapCache":308}],396:[function(a,b,c){var d=a("./memoize"),e=a("./toString"),f=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,g=/\\(\\)?/g,h=d(function(a){var b=[];return e(a).replace(f,function(a,c,d,e){b.push(d?e.replace(g,"$1"):c||a)}),b});b.exports=h},{"./memoize":420,"./toString":427}],397:[function(a,b,c){function d(a){if("string"==typeof a||e(a))return a;var b=a+"";return"0"==b&&1/a==-f?"-0":b}var e=a("./isSymbol"),f=1/0;b.exports=d},{"./isSymbol":417}],398:[function(a,b,c){function d(a){if(null!=a){try{return e.call(a)}catch(a){}try{return a+""}catch(a){}}return""}var e=Function.prototype.toString;b.exports=d},{}],399:[function(a,b,c){var d=a("./_assignValue"),e=a("./_copyObject"),f=a("./_createAssigner"),g=a("./isArrayLike"),h=a("./_isPrototype"),i=a("./keys"),j=Object.prototype,k=j.hasOwnProperty,l=j.propertyIsEnumerable,m=!l.call({valueOf:1},"valueOf"),n=f(function(a,b){if(m||h(b)||g(b))return void e(b,i(b),a);for(var c in b)k.call(b,c)&&d(a,c,b[c])});b.exports=n},{"./_assignValue":319,"./_copyObject":344,"./_createAssigner":346,"./_isPrototype":372,"./isArrayLike":408,"./keys":419}],400:[function(a,b,c){function d(a,b){var c=f(a);return b?e(c,b):c}var e=a("./_baseAssign"),f=a("./_baseCreate");b.exports=d},{"./_baseAssign":321,"./_baseCreate":322}],401:[function(a,b,c){function d(a,b){return a===b||a!==a&&b!==b}b.exports=d},{}],402:[function(a,b,c){function d(a,b,c){var d=h(a)?e:f;return c&&i(a,b,c)&&(b=void 0),d(a,g(b,3))}var e=a("./_arrayEvery"),f=a("./_baseEvery"),g=a("./_baseIteratee"),h=a("./isArray"),i=a("./_isIterateeCall");b.exports=d},{"./_arrayEvery":317,"./_baseEvery":324,"./_baseIteratee":334,"./_isIterateeCall":368,"./isArray":407}],403:[function(a,b,c){function d(a,b,c){var d=null==a?void 0:e(a,b);return void 0===d?c:d}var e=a("./_baseGet");b.exports=d},{"./_baseGet":327}],404:[function(a,b,c){function d(a,b){return null!=a&&f(a,b,e)}var e=a("./_baseHasIn"),f=a("./_hasPath");b.exports=d},{"./_baseHasIn":329,"./_hasPath":359}],405:[function(a,b,c){function d(a){return a}b.exports=d},{}],406:[function(a,b,c){function d(a){return e(a)&&h.call(a,"callee")&&(!j.call(a,"callee")||i.call(a)==f)}var e=a("./isArrayLikeObject"),f="[object Arguments]",g=Object.prototype,h=g.hasOwnProperty,i=g.toString,j=g.propertyIsEnumerable;b.exports=d},{"./isArrayLikeObject":409}],407:[function(a,b,c){var d=Array.isArray;b.exports=d},{}],408:[function(a,b,c){function d(a){return null!=a&&g(e(a))&&!f(a)}var e=a("./_getLength"),f=a("./isFunction"),g=a("./isLength");b.exports=d},{"./_getLength":352,"./isFunction":412,"./isLength":413}],409:[function(a,b,c){function d(a){return f(a)&&e(a)}var e=a("./isArrayLike"),f=a("./isObjectLike");b.exports=d},{"./isArrayLike":408,"./isObjectLike":415}],410:[function(a,b,c){var d=a("./_root"),e=a("./stubFalse"),f="object"==typeof c&&c,g=f&&"object"==typeof b&&b,h=g&&g.exports===f,i=h?d.Buffer:void 0,j=i?function(a){return a instanceof i}:e;b.exports=j},{"./_root":387,"./stubFalse":423}],411:[function(a,b,c){function d(a){if(h(a)&&(g(a)||l(a)||j(a.splice)||f(a)||i(a)))return!a.length;if(k(a)){var b=e(a);if(b==n||b==o)return!a.size}for(var c in a)if(q.call(a,c))return!1;return!(s&&m(a).length)}var e=a("./_getTag"),f=a("./isArguments"),g=a("./isArray"),h=a("./isArrayLike"),i=a("./isBuffer"),j=a("./isFunction"),k=a("./isObjectLike"),l=a("./isString"),m=a("./keys"),n="[object Map]",o="[object Set]",p=Object.prototype,q=p.hasOwnProperty,r=p.propertyIsEnumerable,s=!r.call({valueOf:1},"valueOf");b.exports=d},{"./_getTag":357,"./isArguments":406,"./isArray":407,"./isArrayLike":408,"./isBuffer":410,"./isFunction":412,"./isObjectLike":415,"./isString":416,"./keys":419}],412:[function(a,b,c){function d(a){var b=e(a)?i.call(a):"";return b==f||b==g}var e=a("./isObject"),f="[object Function]",g="[object GeneratorFunction]",h=Object.prototype,i=h.toString;b.exports=d},{"./isObject":414}],413:[function(a,b,c){function d(a){return"number"==typeof a&&a>-1&&a%1==0&&a<=e}var e=9007199254740991;b.exports=d},{}],414:[function(a,b,c){function d(a){var b=typeof a;return!!a&&("object"==b||"function"==b)}b.exports=d},{}],415:[function(a,b,c){function d(a){return!!a&&"object"==typeof a}b.exports=d},{}],416:[function(a,b,c){function d(a){return"string"==typeof a||!e(a)&&f(a)&&i.call(a)==g}var e=a("./isArray"),f=a("./isObjectLike"),g="[object String]",h=Object.prototype,i=h.toString;b.exports=d},{"./isArray":407,"./isObjectLike":415}],417:[function(a,b,c){function d(a){return"symbol"==typeof a||e(a)&&h.call(a)==f}var e=a("./isObjectLike"),f="[object Symbol]",g=Object.prototype,h=g.toString;b.exports=d},{"./isObjectLike":415}],418:[function(a,b,c){function d(a){return f(a)&&e(a.length)&&!!E[G.call(a)]}var e=a("./isLength"),f=a("./isObjectLike"),g="[object Arguments]",h="[object Array]",i="[object Boolean]",j="[object Date]",k="[object Error]",l="[object Function]",m="[object Map]",n="[object Number]",o="[object Object]",p="[object RegExp]",q="[object Set]",r="[object String]",s="[object WeakMap]",t="[object ArrayBuffer]",u="[object DataView]",v="[object Float32Array]",w="[object Float64Array]",x="[object Int8Array]",y="[object Int16Array]",z="[object Int32Array]",A="[object Uint8Array]",B="[object Uint8ClampedArray]",C="[object Uint16Array]",D="[object Uint32Array]",E={};E[v]=E[w]=E[x]=E[y]=E[z]=E[A]=E[B]=E[C]=E[D]=!0,E[g]=E[h]=E[t]=E[i]=E[u]=E[j]=E[k]=E[l]=E[m]=E[n]=E[o]=E[p]=E[q]=E[r]=E[s]=!1;var F=Object.prototype,G=F.toString;b.exports=d},{"./isLength":413,"./isObjectLike":415}],419:[function(a,b,c){function d(a){var b=j(a);if(!b&&!h(a))return f(a);var c=g(a),d=!!c,k=c||[],l=k.length;for(var m in a)!e(a,m)||d&&("length"==m||i(m,l))||b&&"constructor"==m||k.push(m);return k}var e=a("./_baseHas"),f=a("./_baseKeys"),g=a("./_indexKeys"),h=a("./isArrayLike"),i=a("./_isIndex"),j=a("./_isPrototype");b.exports=d},{"./_baseHas":328,"./_baseKeys":335,"./_indexKeys":365,"./_isIndex":367,"./_isPrototype":372,"./isArrayLike":408}],420:[function(a,b,c){function d(a,b){if("function"!=typeof a||b&&"function"!=typeof b)throw new TypeError(f);var c=function(){var d=arguments,e=b?b.apply(this,d):d[0],f=c.cache;if(f.has(e))return f.get(e);var g=a.apply(this,d);return c.cache=f.set(e,g),g};return c.cache=new(d.Cache||e),c}var e=a("./_MapCache"),f="Expected a function";d.Cache=e,b.exports=d},{"./_MapCache":308}],421:[function(a,b,c){function d(a){return g(a)?e(h(a)):f(a)}var e=a("./_baseProperty"),f=a("./_basePropertyDeep"),g=a("./_isKey"),h=a("./_toKey");b.exports=d},{"./_baseProperty":338,"./_basePropertyDeep":339,"./_isKey":369,"./_toKey":397}],422:[function(a,b,c){function d(a,b){if("function"!=typeof a)throw new TypeError(g);return b=h(void 0===b?a.length-1:f(b),0),function(){for(var c=arguments,d=-1,f=h(c.length-b,0),g=Array(f);++d"),l=o.jid.user+"@"+o.jid._domain+"/"+o.jid._resource,"function"==typeof b&&b(null,!0)}),o.on("connect",function(){r.QBLog("[QBChat] client is connected"),e._enableCarbons()}),o.on("reconnect",function(){r.QBLog("[QBChat] client is reconnected"),e._isDisconnected=!0,e._isLogout=!0}),o.on("disconnect",function(){r.QBLog("[QBChat] client is disconnected"),e._isDisconnected=!0,e._isLogout=!0,b(null,null)}),o.on("stanza",function(a){r.QBLog("[QBChat] RECV",a.toString()),a.is("presence")?e._onPresence(a):a.is("iq")?e._onIQ(a):a.is("message")&&("headline"===a.attrs.type?e._onSystemMessageListener(a):e._onMessage(a))}),o.on("offline",function(){r.QBLog("[QBChat] client goes offline"),e._isDisconnected=!0,e._isLogout=!0}),o.on("error",function(a){r.QBLog("[QBChat] client got error",a),e._isDisconnected=!0,e._isLogout=!0,c=r.getError(422,"Status.ERROR - An error has occurred"),"function"==typeof b&&(console.log("error callback"),b(c,null))}))},send:function(a,b){var c=r.getEnv().browser?$msg:n.Stanza,d={from:l,to:this.helpers.jidOrUserId(a),type:b.type?b.type:"chat",id:b.id?b.id:r.getBsonObjectId()},e=p.createStanza(c,d);b.body&&e.c("body",{xmlns:p.MARKERS.CLIENT}).t(b.body).up(),b.markable&&e.c("markable",{xmlns:p.MARKERS.CHAT}).up(),r.getEnv().browser&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}),e=p.filledExtraParams(e,b.extension)),m.send(e)),r.getEnv().node&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}),e=p.filledExtraParams(e,b.extension)),o.send(e))},sendSystemMessage:function(a,b){var c=r.getEnv().browser?$msg:n.Stanza,d={type:"headline",id:b.id?b.id:r.getBsonObjectId(),to:this.helpers.jidOrUserId(a)},e=p.createStanza(c,d);r.getEnv().browser&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications").up(),e=p.filledExtraParams(e,b.extension)),m.send(e)),r.getEnv().node&&(b.extension&&(e.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("moduleIdentifier").t("SystemNotifications"),e=p.filledExtraParams(e,b.extension)),o.send(e))},sendIsTypingStatus:function(a){var b={from:l,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("composing",{xmlns:p.MARKERS.STATES}),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendIsStopTypingStatus:function(a){var b={from:l,to:this.helpers.jidOrUserId(a),type:this.helpers.typeChat(a)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("paused",{xmlns:p.MARKERS.STATES}),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendDeliveredStatus:function(a){var b={type:"chat",from:l,id:r.getBsonObjectId(),to:this.helpers.jidOrUserId(a.userId)},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("received",{xmlns:p.MARKERS.MARKERS,id:a.messageId}).up(),d.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("dialog_id").t(a.dialogId),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},sendReadStatus:function(a){var b={type:"chat",from:l,to:this.helpers.jidOrUserId(a.userId),id:r.getBsonObjectId()},c=r.getEnv().browser?$msg:n.Stanza,d=p.createStanza(c,b);d.c("displayed",{xmlns:p.MARKERS.MARKERS,id:a.messageId}).up(),d.c("extraParams",{xmlns:p.MARKERS.CLIENT}).c("dialog_id").t(a.dialogId),r.getEnv().browser?m.send(d):r.getEnv().node&&o.send(d)},disconnect:function(){t={},this._isLogout=!0,l="",r.getEnv().browser?(m.flush(),m.disconnect()):r.getEnv().node&&o.end()},addListener:function(a,b){function c(){return b(),a.live!==!1}if(r.getEnv().node)throw new Error(u);return m.addHandler(c,null,a.name||null,a.type||null,a.id||null,a.from||null)},deleteListener:function(a){if(r.getEnv().node)throw new Error(u);m.deleteHandler(a)},_enableCarbons:function(a){var b={type:"set",from:l,id:p.getUniqueId("enableCarbons")},c=r.getEnv().browser?$iq:n.Stanza,d=p.createStanza(c,b,"iq");d.c("enable",{xmlns:p.MARKERS.CARBONS}),r.getEnv().browser?m.sendIQ(d):r.getEnv().node&&o.send(d)}},e.prototype={get:function(a){function b(a){return r.getEnv().browser?a.getElementsByTagName("item"):r.getEnv().node?a.getChild("query").children:void 0}function c(c){for(var e=b(c),f=0,g=e.length;f=0;s--){var t=a.items[s];k[t.user_id]={action:t.action,mutualBlock:t.mutualBlock===!0}}q=Object.keys(k);var u={type:"set",from:l,id:p.getUniqueId("edit")},v=r.getEnv().browser?$iq:n.Stanza,w=p.createStanza(v,u,"iq");w.c("query",{xmlns:p.MARKERS.PRIVACY}).c("list",{name:a.name});for(var y=0,s=0,z=q.length;y-1?"groupchat":"chat";else{if("number"!=typeof a)throw new Error(u);b="chat"}return b},getRecipientId:function(a,b){var c=null;return a.forEach(function(a,d,e){a!=b&&(c=a)}),c},getUserJid:function(a,b){return b?a+"-"+b+"@"+q.endpoints.chat:a+"-"+q.creds.appId+"@"+q.endpoints.chat},getUserNickWithMucDomain:function(a){return q.endpoints.muc+"/"+a},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},getDialogIdFromNode:function(a){return a.indexOf("@")<0?null:a.split("@")[0].split("_")[1]},getRoomJidFromDialogId:function(a){return q.creds.appId+"_"+a+"@"+q.endpoints.muc},getRoomJid:function(a){return a+"/"+this.getIdFromNode(l)},getIdFromResource:function(a){var b=a.split("/");return b.length<2?null:(b.splice(0,1),parseInt(b.join("/")))},getBsonObjectId:function(){return r.getBsonObjectId()},getUserIdFromRoomJid:function(a){var b=a.toString().split("/");return 0===b.length?null:b[b.length-1]},getUniqueId:function(a){var b="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)});return"string"==typeof a||"number"==typeof a?b+":"+a:b+""}},b.exports=d},{"../qbConfig":443,"../qbUtils":447,"./qbChatHelpers":430,"node-xmpp-client":227,"strophe.js":282}],430:[function(a,b,c){var d=a("../qbUtils"),e=a("../qbConfig"),f="Unknown interface. SDK support browser / node env.",g={CLIENT:"jabber:client",CHAT:"urn:xmpp:chat-markers:0",STATES:"http://jabber.org/protocol/chatstates",MARKERS:"urn:xmpp:chat-markers:0",CARBONS:"urn:xmpp:carbons:2",ROSTER:"jabber:iq:roster",MUC:"http://jabber.org/protocol/muc",PRIVACY:"jabber:iq:privacy"},h={MARKERS:g,getMyselfJid:function(a){return d.getEnv().browser?a.jid:d.getEnv().node?nClient.jid.user+"@"+nClient.jid._domain+"/"+nClient.jid._resource:void 0},buildUserJid:function(a){var b;return"userId"in a?(b=a.userId+"-"+e.creds.appId+"@"+e.endpoints.chat,"resource"in a&&(b=userJid+"/"+a.resource)):"jid"in a&&(b=a.jid),b},createStanza:function(a,b,c){var e;return d.getEnv().browser?e=a(b):d.getEnv().node&&(e=new a(c?c:"message",b)),e},getAttr:function(a,b){var c;if("function"==typeof a.getAttribute)c=a.getAttribute(b);else{if(!a.attrs)throw f;c=a.attrs[b]}return c?c:null},getElement:function(a,b){var c;if("function"==typeof a.querySelector)c=a.querySelector(b);else{if("function"!=typeof a.getChild)throw f;c=a.getChild(b)}return c?c:null},getElementText:function(a,b){var c,d;if("function"==typeof a.querySelector)c=a.querySelector(b),d=c?c.textContent:null;else{if("function"!=typeof a.getChildText)throw f;d=a.getChildText(b)}return d?d:null},_JStoXML:function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},_XMLtoJS:function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;e1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a},filledExtraParams:function(a,b,c){var e=this;return Object.keys(b).forEach(function(c){"attachments"===c?b[c].forEach(function(b){a.c("attachment",b).up()}):"object"==typeof b[c]?e._JStoXML(c,b[c],a):d.getEnv().browser?a.c(c).t(b[c]).up():d.getEnv().node&&a.getChild("extraParams").c(c).t(b[c]).up()}),a.up(),a},parseExtraParams:function(a){if(!a)return null;var b,c={},e=[];if(d.getEnv().browser){for(var f=0,g=a.childNodes.length;f1){var l=a.childNodes[f].textContent.length;if(l>4096){for(var m="",j=0;j0&&(c.attachments=e)}else if(d.getEnv().node)for(var f=0,g=a.children.length;f0&&(e[c]=a[c]);g.QBLog("[GeoProxy]","update",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a.id),data:{geo_data:e},type:"PUT"},function(a,c){a?b(a,null):b(a,c.geo_datum)})},get:function(a,b){g.QBLog("[GeoProxy]","get",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a)},function(a,c){a?b(a,null):b(null,c.geo_datum)})},list:function(a,b){"function"==typeof a&&(b=a,a=void 0),g.QBLog("[GeoProxy]","find",a),this.service.ajax({url:g.getUrl(h),data:a},b)},delete:function(a,b){g.QBLog("[GeoProxy]","delete",a),this.service.ajax({url:g.getUrl(f.urls.geodata,a),type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})},purge:function(a,b){g.QBLog("[GeoProxy]","purge",a),this.service.ajax({url:g.getUrl(f.urls.geodata),data:{days:a},type:"DELETE",dataType:"text"},function(a,c){a?b(a,null):b(null,!0)})}},b.exports=d},{"../qbConfig":443,"../qbUtils":447}],434:[function(a,b,c){(function(c){function d(a){this.service=a,this.subscriptions=new e(a),this.events=new f(a),this.base64Encode=function(a){return i?btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,function(a,b){return String.fromCharCode("0x"+b)})):new c(a).toString("base64")}}function e(a){this.service=a}function f(a){this.service=a}var g=a("../qbConfig"),h=a("../qbUtils"),i="undefined"!=typeof window;e.prototype={create:function(a,b){h.QBLog("[SubscriptionsProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.subscriptions),type:"POST",data:a},b)},list:function(a){h.QBLog("[SubscriptionsProxy]","list"),this.service.ajax({url:h.getUrl(g.urls.subscriptions)},a)},delete:function(a,b){h.QBLog("[SubscriptionsProxy]","delete",a);var c={type:"DELETE",dataType:"text",url:h.getUrl(g.urls.subscriptions,a)};this.service.ajax(c,function(a,c){a?b(a,null):b(null,!0)})}},f.prototype={create:function(a,b){h.QBLog("[EventsProxy]","create",a);var c={event:a};this.service.ajax({url:h.getUrl(g.urls.events),type:"POST",data:c},b)},list:function(a,b){"function"==typeof a&&"undefined"==typeof b&&(b=a,a=null),h.QBLog("[EventsProxy]","list",a),this.service.ajax({url:h.getUrl(g.urls.events),data:a},b)},get:function(a,b){h.QBLog("[EventsProxy]","get",a),this.service.ajax({url:h.getUrl(g.urls.events,a)},b)},status:function(a,b){h.QBLog("[EventsProxy]","status",a),this.service.ajax({url:h.getUrl(g.urls.events,a+"/status")},b)},delete:function(a,b){h.QBLog("[EventsProxy]","delete",a),this.service.ajax({url:h.getUrl(g.urls.events,a),dataType:"text",type:"DELETE"},b)}},b.exports=d}).call(this,a("buffer").Buffer)},{"../qbConfig":443,"../qbUtils":447,buffer:8}],435:[function(a,b,c){function d(a){this.service=a}function e(a){var b=a.field in j?"date":typeof a.value;return(a.value instanceof Array||i.isArray(a.value))&&("object"==b&&(b=typeof a.value[0]),a.value=a.value.toString()),[b,a.field,a.param,a.value].join(" ")}function f(a){var b=a.field in j?"date":a.field in k?"number":"string";return[a.sort,b,a.field].join(" ")}var g=a("../qbConfig"),h=a("../qbUtils"),i=a("util"),j=["created_at","updated_at","last_request_at"],k=["id","external_user_id"],l=g.urls.users+"/password/reset";d.prototype={listUsers:function(a,b){h.QBLog("[UsersProxy]","listUsers",arguments.length>1?a:"");var c,d={},i=[];"function"==typeof a&&"undefined"==typeof b&&(b=a,a={}),a.filter&&(a.filter instanceof Array?a.filter.forEach(function(a){c=e(a),i.push(c)}):(c=e(a.filter),i.push(c)),d.filter=i),a.order&&(d.order=f(a.order)),a.page&&(d.page=a.page),a.per_page&&(d.per_page=a.per_page),this.service.ajax({url:h.getUrl(g.urls.users),data:d},b)},get:function(a,b){h.QBLog("[UsersProxy]","get",a);var c;"number"==typeof a?(c=a,a={}):a.login?c="by_login":a.full_name?c="by_full_name":a.facebook_id?c="by_facebook_id":a.twitter_id?c="by_twitter_id":a.email?c="by_email":a.tags?c="by_tags":a.external&&(c="external/"+a.external,a={}),this.service.ajax({url:h.getUrl(g.urls.users,c),data:a},function(a,c){a?b(a,null):b(null,c.user||c)})},create:function(a,b){h.QBLog("[UsersProxy]","create",a),this.service.ajax({url:h.getUrl(g.urls.users),type:"POST",data:{user:a}},function(a,c){a?b(a,null):b(null,c.user)})},update:function(a,b,c){h.QBLog("[UsersProxy]","update",a,b),this.service.ajax({url:h.getUrl(g.urls.users,a),type:"PUT",data:{user:b}},function(a,b){a?c(a,null):c(null,b.user)})},delete:function(a,b){h.QBLog("[UsersProxy]","delete",a);var c;"number"==typeof a?c=a:a.external&&(c="external/"+a.external),this.service.ajax({url:h.getUrl(g.urls.users,c),type:"DELETE",dataType:"text"},b)},resetPassword:function(a,b){h.QBLog("[UsersProxy]","resetPassword",a),this.service.ajax({url:h.getUrl(l),data:{email:a}},b)}},b.exports=d},{"../qbConfig":443,"../qbUtils":447,util:224}],436:[function(a,b,c){function d(a,b,c,d){navigator.mozGetUserMedia?a.getStats(b,function(a){var b=[];a.forEach(function(a){b.push(a)}),c(b)},d):a.getStats(function(a){var b=[];a.result().forEach(function(a){var c={};a.names().forEach(function(b){c[b]=a.stat(b)}),c.id=a.id,c.type=a.type,c.timestamp=a.timestamp,b.push(c)}),c(b)})}var e=a("../../qbConfig"),f=a("./qbWebRTCHelpers"),g=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection,h=window.RTCSessionDescription||window.mozRTCSessionDescription,i=window.RTCIceCandidate||window.mozRTCIceCandidate;g.State={NEW:1,CONNECTING:2,CHECKING:3,CONNECTED:4,DISCONNECTED:5,FAILED:6,CLOSED:7,COMPLETED:8},g.prototype.init=function(a,b,c,d){f.trace("RTCPeerConnection init. userID: "+b+", sessionID: "+c+", type: "+d),this.delegate=a,this.sessionID=c,this.userID=b,this.type=d,this.remoteSDP=null,this.state=g.State.NEW,this.onicecandidate=this.onIceCandidateCallback,this.onaddstream=this.onAddRemoteStreamCallback,this.onsignalingstatechange=this.onSignalingStateCallback,this.oniceconnectionstatechange=this.onIceConnectionStateCallback,this.dialingTimer=null,this.answerTimeInterval=0,this.statsReportTimer=null,this.reconnectTimer=0,this.iceCandidates=[]},g.prototype.release=function(){this._clearDialingTimer(),this._clearStatsReportTimer(),"closed"!==this.signalingState&&this.close()},g.prototype.updateRemoteSDP=function(a){if(!a)throw new Error("sdp string can't be empty.");this.remoteSDP=a},g.prototype.getRemoteSDP=function(){return this.remoteSDP},g.prototype.setRemoteSessionDescription=function(a,b,c){function d(){c(null)}function e(a){c(a)}var f=new h({sdp:b,type:a});this.setRemoteDescription(f,d,e)},g.prototype.addLocalStream=function(a){if(!a)throw new Error("'RTCPeerConnection.addStream' error: stream is 'null'.");this.addStream(a)},g.prototype.getAndSetLocalSessionDescription=function(a){function b(b){d.setLocalDescription(b,function(){a(null)},c)}function c(b){a(b)}var d=this;d.state=g.State.CONNECTING,"offer"===d.type?d.createOffer(b,c):d.createAnswer(b,c)},g.prototype.addCandidates=function(a){for(var b,c=0,d=a.length;c0&&(this.delegate.processIceCandidates(this,this.iceCandidates),this.iceCandidates.length=0)},g.prototype.onIceCandidateCallback=function(a){var b=a.candidate;if(b){var c={sdpMLineIndex:b.sdpMLineIndex,sdpMid:b.sdpMid,candidate:b.candidate};"stable"===this.signalingState?this.delegate.processIceCandidates(this,[c]):this.iceCandidates.push(c)}},g.prototype.onAddRemoteStreamCallback=function(a){var b=this;"function"==typeof this.delegate._onRemoteStreamListener&&this.delegate._onRemoteStreamListener(this.userID,a.stream),b._getStatsWrap()},g.prototype.onIceConnectionStateCallback=function(){var a=this.iceConnectionState;if(f.trace("onIceConnectionStateCallback: "+this.iceConnectionState),"function"==typeof this.delegate._onSessionConnectionStateChangedListener){var b=null;"checking"===a?(this.state=g.State.CHECKING,b=f.SessionConnectionState.CONNECTING):"connected"===a?(this._clearWaitingReconnectTimer(),this.state=g.State.CONNECTED,b=f.SessionConnectionState.CONNECTED):"completed"===a?(this._clearWaitingReconnectTimer(),this.state=g.State.COMPLETED,b=f.SessionConnectionState.COMPLETED):"failed"===a?(this.state=g.State.FAILED,b=f.SessionConnectionState.FAILED):"disconnected"===a?(this._startWaitingReconnectTimer(),this.state=g.State.DISCONNECTED,b=f.SessionConnectionState.DISCONNECTED):"closed"===a&&(this.state=g.State.CLOSED,b=f.SessionConnectionState.CLOSED),b&&this.delegate._onSessionConnectionStateChangedListener(this.userID,b)}},g.prototype._clearStatsReportTimer=function(){this.statsReportTimer&&(clearInterval(this.statsReportTimer),this.statsReportTimer=null)},g.prototype._getStatsWrap=function(){var a,b=this,c=1==b.delegate.callType?b.getLocalStreams()[0].getVideoTracks()[0]:b.getLocalStreams()[0].getAudioTracks()[0];if(e.webrtc&&e.webrtc.statsReportTimeInterval){if(isNaN(+e.webrtc.statsReportTimeInterval))return void f.traceError("statsReportTimeInterval ("+e.webrtc.statsReportTimeInterval+") must be integer.");a=1e3*e.webrtc.statsReportTimeInterval;var g=function(){d(b,c,function(a){b.delegate._onCallStatsReport(b.userID,a,null)},function(a){f.traceError("_getStats error. "+a.name+": "+a.message),b.delegate._onCallStatsReport(b.userID,null,a)})};f.trace("Stats tracker has been started."),b.statsReportTimer=setInterval(g,a)}},g.prototype._clearWaitingReconnectTimer=function(){this.waitingReconnectTimeoutCallback&&(f.trace("_clearWaitingReconnectTimer"),clearTimeout(this.waitingReconnectTimeoutCallback),this.waitingReconnectTimeoutCallback=null)},g.prototype._startWaitingReconnectTimer=function(){var a=this,b=1e3*e.webrtc.disconnectTimeInterval,c=function(){f.trace("waitingReconnectTimeoutCallback"),clearTimeout(a.waitingReconnectTimeoutCallback),a.release(),a.delegate._closeSessionIfAllConnectionsClosed()};f.trace("_startWaitingReconnectTimer, timeout: "+b),a.waitingReconnectTimeoutCallback=setTimeout(c,b)},g.prototype._clearDialingTimer=function(){this.dialingTimer&&(f.trace("_clearDialingTimer"),clearInterval(this.dialingTimer),this.dialingTimer=null,this.answerTimeInterval=0)},g.prototype._startDialingTimer=function(a,b){var c=this,d=1e3*e.webrtc.dialingTimeInterval;f.trace("_startDialingTimer, dialingTimeInterval: "+d);var g=function(a,b,d){d||(c.answerTimeInterval+=1e3*e.webrtc.dialingTimeInterval),f.trace("_dialingCallback, answerTimeInterval: "+c.answerTimeInterval),c.answerTimeInterval>=1e3*e.webrtc.answerTimeInterval?(c._clearDialingTimer(),b&&c.delegate.processOnNotAnswer(c)):c.delegate.processCall(c,a)};c.dialingTimer=setInterval(g,d,a,b,!1),g(a,b,!0)},b.exports=g},{"../../qbConfig":443,"./qbWebRTCHelpers":438}],437:[function(a,b,c){"use strict";function d(a,b){return d.__instance?d.__instance:this===window?new d:(d.__instance=this,this.connection=b,this.signalingProcessor=new h(a,this,b),this.signalingProvider=new i(a,b),this.SessionConnectionState=j.SessionConnectionState,this.CallType=j.CallType,this.PeerConnectionState=k.State,void(this.sessions={}))}function e(a,b){var c=!1,d=b.sort();return a.length&&a.forEach(function(a){var b=a.sort();c=b.length==d.length&&b.every(function(a,b){return a===d[b]})}),c}function f(a){var b=[];return Object.keys(a).length>0&&Object.keys(a).forEach(function(c,d,e){var f=a[c];f.state!==g.State.NEW&&f.state!==g.State.ACTIVE||b.push(f.opponentsIDs)}),b}var g=a("./qbWebRTCSession"),h=a("./qbWebRTCSignalingProcessor"),i=a("./qbWebRTCSignalingProvider"),j=a("./qbWebRTCHelpers"),k=a("./qbRTCPeerConnection"),l=a("./qbWebRTCSignalingConstants"),m=a("../../qbUtils");d.prototype.getMediaDevices=function(a){var b=[],c="Browser does not support output device selection.";return new Promise(function(d,e){navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices?navigator.mediaDevices.enumerateDevices().then(function(c){a?(c.forEach(function(c,d){c.kind===a&&b.push(c)}),d(b)):d(c)}):(e(c),j.traceWarning(c))})},d.prototype.sessions={},d.prototype.createNewSession=function(a,b,c){var d=f(this.sessions),g=c||j.getIdFromNode(this.connection.jid),h=!1,i=b||2;if(!a)throw new Error("Can't create a session without the opponentsIDs.");if(h=e(d,a))throw new Error("Can't create a session with the same opponentsIDs. There is a session already in NEW or ACTIVE state.");return this._createAndStoreSession(null,g,a,i)},d.prototype._createAndStoreSession=function(a,b,c,d){var e=new g(a,b,c,d,this.signalingProvider,j.getIdFromNode(this.connection.jid));return e.onUserNotAnswerListener=this.onUserNotAnswerListener,e.onRemoteStreamListener=this.onRemoteStreamListener,e.onSessionConnectionStateChangedListener=this.onSessionConnectionStateChangedListener,e.onSessionCloseListener=this.onSessionCloseListener,e.onCallStatsReport=this.onCallStatsReport,this.sessions[e.ID]=e,e},d.prototype.clearSession=function(a){delete d.sessions[a]},d.prototype.isExistNewOrActiveSessionExceptSessionID=function(a){var b=this,c=!1;return Object.keys(b.sessions).length>0&&Object.keys(b.sessions).forEach(function(d,e,f){var h=b.sessions[d];h.state!==g.State.NEW&&h.state!==g.State.ACTIVE||h.ID!==a&&(c=!0)}),c},d.prototype._onCallListener=function(a,b,c){var d=JSON.parse(JSON.stringify(c));if(j.trace("onCall. UserID:"+a+". SessionID: "+b),this.isExistNewOrActiveSessionExceptSessionID(b))j.trace("User with id "+a+" is busy at the moment."),delete c.sdp,delete c.platform,c.sessionID=b,this.signalingProvider.sendMessage(a,c,l.SignalingType.REJECT),"function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onCall",b,a,d);else{var e=this.sessions[b];e||(e=this._createAndStoreSession(b,c.callerID,c.opponentsIDs,c.callType),this._cleanupExtension(d),"function"==typeof this.onCallListener&&m.safeCallbackCall(this.onCallListener,e,d)),e.processOnCall(a,c)}},d.prototype._onAcceptListener=function(a,b,c){var d=this.sessions[b];if(j.trace("onAccept. UserID:"+a+". SessionID: "+b),d)if(d.state===g.State.ACTIVE){var e=JSON.parse(JSON.stringify(c));this._cleanupExtension(e),"function"==typeof this.onAcceptCallListener&&m.safeCallbackCall(this.onAcceptCallListener,d,a,e),d.processOnAccept(a,c)}else"function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onAccept",d,a,e),j.traceWarning("Ignore 'onAccept', the session( "+b+" ) has invalid state.");else j.traceError("Ignore 'onAccept', there is no information about session "+b+" by some reason.")},d.prototype._onRejectListener=function(a,b,c){var d=this,e=d.sessions[b];if(j.trace("onReject. UserID:"+a+". SessionID: "+b),e){var f=JSON.parse(JSON.stringify(c));d._cleanupExtension(f),"function"==typeof this.onRejectCallListener&&m.safeCallbackCall(d.onRejectCallListener,e,a,f),e.processOnReject(a,c)}else j.traceError("Ignore 'onReject', there is no information about session "+b+" by some reason.")},d.prototype._onStopListener=function(a,b,c){j.trace("onStop. UserID:"+a+". SessionID: "+b);var d=this.sessions[b],e=JSON.parse(JSON.stringify(c));!d||d.state!==g.State.ACTIVE&&d.state!==g.State.NEW?("function"==typeof this.onInvalidEventsListener&&m.safeCallbackCall(this.onInvalidEventsListener,"onStop",d,a,e),j.traceError("Ignore 'onStop', there is no information about session "+b+" by some reason.")):(this._cleanupExtension(e),"function"==typeof this.onStopCallListener&&m.safeCallbackCall(this.onStopCallListener,d,a,e),d.processOnStop(a,c))},d.prototype._onIceCandidatesListener=function(a,b,c){var d=this.sessions[b];j.trace("onIceCandidates. UserID:"+a+". SessionID: "+b+". ICE candidates count: "+c.iceCandidates.length),d?d.state===g.State.ACTIVE?d.processOnIceCandidates(a,c):j.traceWarning("Ignore 'OnIceCandidates', the session ( "+b+" ) has invalid state."):j.traceError("Ignore 'OnIceCandidates', there is no information about session "+b+" by some reason.")},d.prototype._onUpdateListener=function(a,b,c){var d=this.sessions[b];j.trace("onUpdate. UserID:"+a+". SessionID: "+b+". Extension: "+JSON.stringify(c)),"function"==typeof this.onUpdateCallListener&&m.safeCallbackCall(this.onUpdateCallListener,d,a,c)},d.prototype._cleanupExtension=function(a){delete a.platform,delete a.sdp,delete a.opponentsIDs,delete a.callerID,delete a.callType},b.exports=d},{"../../qbUtils":447,"./qbRTCPeerConnection":436,"./qbWebRTCHelpers":438,"./qbWebRTCSession":439,"./qbWebRTCSignalingConstants":440,"./qbWebRTCSignalingProcessor":441,"./qbWebRTCSignalingProvider":442}],438:[function(a,b,c){var d=a("../../qbConfig"),e={};e={getUserJid:function(a,b){return a+"-"+b+"@"+d.endpoints.chat},getIdFromNode:function(a){return a.indexOf("@")<0?null:parseInt(a.split("@")[0].split("-")[0])},trace:function(a){d.debug&&console.log("[QBWebRTC]:",a)},traceWarning:function(a){d.debug&&console.warn("[QBWebRTC]:",a)},traceError:function(a){d.debug&&console.error("[QBWebRTC]:",a)},getLocalTime:function(){var a=(new Date).toString().split(" ");return a.slice(1,5).join("-")},dataURItoBlob:function(a,b){for(var c=[],d=window.atob(a.split(",")[1]),e=0,f=d.length;e0){var g=(b.acceptCallTime-b.startCallTime)/1e3;b._startWaitingOfferOrAnswerTimer(g),e.forEach(function(a,c,d){b.currentUserID>a&&b._callInternal(a,{},!0)})}},d.prototype._acceptInternal=function(a,b){var c=this,d=this.peerConnections[a];d?(d.addLocalStream(this.localStream),d.setRemoteSessionDescription("offer",d.getRemoteSDP(),function(e){e?k.traceError("'setRemoteSessionDescription' error: "+e):(k.trace("'setRemoteSessionDescription' success"),d.getAndSetLocalSessionDescription(function(e){e?k.trace("getAndSetLocalSessionDescription error: "+e):(b.sessionID=c.ID,b.callType=c.callType,b.callerID=c.initiatorID,b.opponentsIDs=c.opponentsIDs,b.sdp=d.localDescription.sdp,c.signalingProvider.sendMessage(a,b,l.SignalingType.ACCEPT))}))})):k.traceError("Can't accept the call, there is no information about peer connection by some reason.")},d.prototype.reject=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Reject, extension: "+JSON.stringify(c)),b.state=d.State.REJECTED,b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.REJECT)}b._close()},d.prototype.stop=function(a){var b=this,c=f(a),e=Object.keys(b.peerConnections).length;if(k.trace("Stop, extension: "+JSON.stringify(c)),b.state=d.State.HUNGUP,b.answerTimer&&b._clearAnswerTimer(),c.sessionID=b.ID,c.callType=b.callType,c.callerID=b.initiatorID,c.opponentsIDs=b.opponentsIDs,e>0)for(var g in b.peerConnections){var h=b.peerConnections[g];b.signalingProvider.sendMessage(h.userID,c,l.SignalingType.STOP)}b._close()},d.prototype.closeConnection=function(a){var b=this,c=this.peerConnections[a];if(!c)return k.traceWarn("Not found connection with user ("+a+")"),!1;try{c.release()}catch(a){k.traceError(a)}finally{b._closeSessionIfAllConnectionsClosed()}},d.prototype.update=function(a){var b=this,c={};if(k.trace("Update, extension: "+JSON.stringify(a)),null==a)return void k.trace("extension is null, no parameters to update");c=f(a),c.sessionID=this.ID;for(var d in b.peerConnections){var e=b.peerConnections[d];b.signalingProvider.sendMessage(e.userID,c,l.SignalingType.PARAMETERS_CHANGED)}},d.prototype.mute=function(a){this._muteStream(0,a)},d.prototype.unmute=function(a){this._muteStream(1,a)},d.snapshot=function(a){var b,c,d=document.getElementById(a),e=document.createElement("canvas"),f=e.getContext("2d");if(d)return e.width=d.clientWidth,e.height=d.clientHeight,"scaleX(-1)"===d.style.transform&&(f.translate(e.width,0),f.scale(-1,1)),f.drawImage(d,0,0,d.clientWidth,d.clientHeight),b=e.toDataURL(),c=k.dataURItoBlob(b,"image/png"),c.name="snapshot_"+getLocalTime()+".png",c.url=b,c},d.filter=function(a,b){var c=document.getElementById(a);c&&(c.style.webkitFilter=b,c.style.filter=b)},d.prototype.processOnCall=function(a,b){var c=this,e=c._uniqueOpponentsIDs();e.forEach(function(e,f,g){var h=c.peerConnections[e];if(h)e==a&&(h.updateRemoteSDP(b.sdp),a!=c.initiatorID&&c.state===d.State.ACTIVE&&c._acceptInternal(a,{}));else{var i;i=e!=a&&c.currentUserID>e?c._createPeer(e,"offer"):c._createPeer(e,"answer"),c.peerConnections[e]=i,e==a&&(i.updateRemoteSDP(b.sdp),c._startAnswerTimer())}})},d.prototype.processOnAccept=function(a,b){var c=this.peerConnections[a];c?(c._clearDialingTimer(),c.setRemoteSessionDescription("answer",b.sdp,function(a){a?k.traceError("'setRemoteSessionDescription' error: "+a):k.trace("'setRemoteSessionDescription' success")})):k.traceError("Ignore 'OnAccept', there is no information about peer connection by some reason.")},d.prototype.processOnReject=function(a,b){var c=this.peerConnections[a];this._clearWaitingOfferOrAnswerTimer(),c?c.release():k.traceError("Ignore 'OnReject', there is no information about peer connection by some reason."),this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnStop=function(a,b){var c=this;if(this._clearAnswerTimer(),a===c.initiatorID)Object.keys(c.peerConnections).length?Object.keys(c.peerConnections).forEach(function(a){c.peerConnections[a].release()}):k.traceError("Ignore 'OnStop', there is no information about peer connections by some reason.");else{var d=c.peerConnections[a];d?d.release():k.traceError("Ignore 'OnStop', there is no information about peer connection by some reason.")}this._closeSessionIfAllConnectionsClosed()},d.prototype.processOnIceCandidates=function(a,b){var c=this.peerConnections[a];c?c.addCandidates(b.iceCandidates):k.traceError("Ignore 'OnIceCandidates', there is no information about peer connection by some reason.")},d.prototype.processCall=function(a,b){var b=b||{};b.sessionID=this.ID,b.callType=this.callType,b.callerID=this.initiatorID,b.opponentsIDs=this.opponentsIDs,b.sdp=a.localDescription.sdp,this.signalingProvider.sendMessage(a.userID,b,l.SignalingType.CALL)},d.prototype.processIceCandidates=function(a,b){var c={};c.sessionID=this.ID,c.callType=this.callType,c.callerID=this.initiatorID,c.opponentsIDs=this.opponentsIDs,this.signalingProvider.sendCandidate(a.userID,b,c)},d.prototype.processOnNotAnswer=function(a){k.trace("Answer timeout callback for session "+this.ID+" for user "+a.userID),this._clearWaitingOfferOrAnswerTimer(),a.release(),"function"==typeof this.onUserNotAnswerListener&&j.safeCallbackCall(this.onUserNotAnswerListener,this,a.userID),this._closeSessionIfAllConnectionsClosed()},d.prototype._onRemoteStreamListener=function(a,b){"function"==typeof this.onRemoteStreamListener&&j.safeCallbackCall(this.onRemoteStreamListener,this,a,b)},d.prototype._onCallStatsReport=function(a,b,c){"function"==typeof this.onCallStatsReport&&j.safeCallbackCall(this.onCallStatsReport,this,a,b,c)},d.prototype._onSessionConnectionStateChangedListener=function(a,b){var c=this;"function"==typeof c.onSessionConnectionStateChangedListener&&j.safeCallbackCall(c.onSessionConnectionStateChangedListener,c,a,b)},d.prototype._createPeer=function(a,b){if(!i)throw new Error("_createPeer error: RTCPeerConnection() is not supported in your browser");this.startCallTime=new Date;var c={iceServers:g(h.webrtc.iceServers)};k.trace("_createPeer, iceServers: "+JSON.stringify(c));var d=new i(c);return d.init(this,a,this.ID,b),d},d.prototype._close=function(){k.trace("_close");for(var a in this.peerConnections){var b=this.peerConnections[a];try{b.release()}catch(a){console.warn("Peer close error:",a)}}this._closeLocalMediaStream(),this.state=d.State.CLOSED,"function"==typeof this.onSessionCloseListener&&j.safeCallbackCall(this.onSessionCloseListener,this)},d.prototype._closeSessionIfAllConnectionsClosed=function(){var a=!0;for(var b in this.peerConnections){var c=this.peerConnections[b];if("closed"!==c.signalingState){a=!1;break}}k.trace("All peer connections closed: "+a),a&&(this._closeLocalMediaStream(),"function"==typeof this.onSessionCloseListener&&this.onSessionCloseListener(this),this.state=d.State.CLOSED)},d.prototype._closeLocalMediaStream=function(){this.localStream&&(this.localStream.getAudioTracks().forEach(function(a){a.stop()}),this.localStream.getVideoTracks().forEach(function(a){a.stop()}),this.localStream=null)},d.prototype._muteStream=function(a,b){return"audio"===b&&this.localStream.getAudioTracks().length>0?void this.localStream.getAudioTracks().forEach(function(b){b.enabled=!!a}):"video"===b&&this.localStream.getVideoTracks().length>0?void this.localStream.getVideoTracks().forEach(function(b){b.enabled=!!a}):void 0},d.prototype._clearAnswerTimer=function(){this.answerTimer&&(k.trace("_clearAnswerTimer"),clearTimeout(this.answerTimer),this.answerTimer=null)},d.prototype._startAnswerTimer=function(){k.trace("_startAnswerTimer");var a=this,b=function(){k.trace("_answerTimeoutCallback"),"function"==typeof a.onSessionCloseListener&&a._close(),a.answerTimer=null},c=1e3*h.webrtc.answerTimeInterval;this.answerTimer=setTimeout(b,c)},d.prototype._clearWaitingOfferOrAnswerTimer=function(){this.waitingOfferOrAnswerTimer&&(k.trace("_clearWaitingOfferOrAnswerTimer"),clearTimeout(this.waitingOfferOrAnswerTimer),this.waitingOfferOrAnswerTimer=null)},d.prototype._startWaitingOfferOrAnswerTimer=function(a){var b=this,c=h.webrtc.answerTimeInterval-a<0?1:h.webrtc.answerTimeInterval-a,d=function(){k.trace("waitingOfferOrAnswerTimeoutCallback"),Object.keys(b.peerConnections).length>0&&Object.keys(b.peerConnections).forEach(function(a){var c=b.peerConnections[a];c.state!==i.State.CONNECTING&&c.state!==i.State.NEW||b.processOnNotAnswer(c)}),b.waitingOfferOrAnswerTimer=null};k.trace("_startWaitingOfferOrAnswerTimer, timeout: "+c),this.waitingOfferOrAnswerTimer=setTimeout(d,1e3*c)},d.prototype._uniqueOpponentsIDs=function(){var a=this,b=[];return this.initiatorID!==this.currentUserID&&b.push(this.initiatorID),this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype._uniqueOpponentsIDsWithoutInitiator=function(){var a=this,b=[];return this.opponentsIDs.forEach(function(c,d,e){c!=a.currentUserID&&b.push(parseInt(c))}),b},d.prototype.toString=function(){return"ID: "+this.ID+", initiatorID: "+this.initiatorID+", opponentsIDs: "+this.opponentsIDs+", state: "+this.state+", callType: "+this.callType},b.exports=d},{"../../qbConfig":443,"../../qbUtils":447,"./qbRTCPeerConnection":436,"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440}],440:[function(a,b,c){function d(){}d.MODULE_ID="WebRTCVideoChat",d.SignalingType={CALL:"call",ACCEPT:"accept",REJECT:"reject",STOP:"hangUp",CANDIDATE:"iceCandidates",PARAMETERS_CHANGED:"update"},b.exports=d},{}],441:[function(a,b,c){function d(a,b,c){var d=this;d.service=a,d.delegate=b,d.connection=c,this._onMessage=function(a){var b=a.getAttribute("from"),c=a.querySelector("extraParams"),g=a.querySelector("delay"),h=e.getIdFromNode(b),i=d._getExtension(c);if(g||i.moduleIdentifier!==f.MODULE_ID)return!0;var j=i.sessionID,k=i.signalType;switch(delete i.moduleIdentifier,delete i.sessionID,delete i.signalType,k){case f.SignalingType.CALL:"function"==typeof d.delegate._onCallListener&&d.delegate._onCallListener(h,j,i);break;case f.SignalingType.ACCEPT:"function"==typeof d.delegate._onAcceptListener&&d.delegate._onAcceptListener(h,j,i);break;case f.SignalingType.REJECT:"function"==typeof d.delegate._onRejectListener&&d.delegate._onRejectListener(h,j,i);break;case f.SignalingType.STOP:"function"==typeof d.delegate._onStopListener&&d.delegate._onStopListener(h,j,i);break;case f.SignalingType.CANDIDATE:"function"==typeof d.delegate._onIceCandidatesListener&&d.delegate._onIceCandidatesListener(h,j,i);break;case f.SignalingType.PARAMETERS_CHANGED:"function"==typeof d.delegate._onUpdateListener&&d.delegate._onUpdateListener(h,j,i)}return!0},this._getExtension=function(a){if(!a)return null;for(var b,c,e,f,g={},h=[],i=[],j=0,k=a.childNodes.length;j1){var r=a.childNodes[j].textContent.length;if(r>4096){for(var s="",t=0;t0&&(g.iceCandidates=h),i.length>0&&(g.opponentsIDs=i),g},this._XMLtoJS=function(a,b,c){var d=this;a[b]={};for(var e=0,f=c.childNodes.length;e1?a[b]=d._XMLtoJS(a[b],c.childNodes[e].tagName,c.childNodes[e]):a[b][c.childNodes[e].tagName]=c.childNodes[e].textContent;return a}}a("strophe.js");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants");b.exports=d},{"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440,"strophe.js":282}],442:[function(a,b,c){function d(a,b){this.service=a,this.connection=b}a("strophe.js");var e=a("./qbWebRTCHelpers"),f=a("./qbWebRTCSignalingConstants"),g=a("../../qbUtils"),h=a("../../qbConfig");d.prototype.sendCandidate=function(a,b,c){var d=c||{};d.iceCandidates=b,this.sendMessage(a,d,f.SignalingType.CANDIDATE)},d.prototype.sendMessage=function(a,b,c){var d,i,j=b||{},k=this;j.moduleIdentifier=f.MODULE_ID,j.signalType=c,j.platform="web",i={to:e.getUserJid(a,h.creds.appId),type:"headline",id:g.getBsonObjectId()},d=$msg(i).c("extraParams",{xmlns:Strophe.NS.CLIENT}),Object.keys(j).forEach(function(a){"iceCandidates"===a?(d=d.c("iceCandidates"),j[a].forEach(function(a){d=d.c("iceCandidate"),Object.keys(a).forEach(function(b){d.c(b).t(a[b]).up()}),d.up()}),d.up()):"opponentsIDs"===a?(d=d.c("opponentsIDs"),j[a].forEach(function(a){d=d.c("opponentID").t(a).up()}),d.up()):"object"==typeof j[a]?k._JStoXML(a,j[a],d):d.c(a).t(j[a]).up()}),this.connection.send(d)},d.prototype._JStoXML=function(a,b,c){var d=this;c.c(a),Object.keys(b).forEach(function(a){"object"==typeof b[a]?d._JStoXML(a,b[a],c):c.c(a).t(b[a]).up()}),c.up()},b.exports=d},{"../../qbConfig":443,"../../qbUtils":447,"./qbWebRTCHelpers":438,"./qbWebRTCSignalingConstants":440,"strophe.js":282}],443:[function(a,b,c){var d={version:"2.3.0",creds:{appId:"",authKey:"",authSecret:""},endpoints:{api:"api.quickblox.com",chat:"chat.quickblox.com",muc:"muc.chat.quickblox.com"},chatProtocol:{bosh:"https://chat.quickblox.com:5281",websocket:"wss://chat.quickblox.com:5291",active:2},webrtc:{answerTimeInterval:60,dialingTimeInterval:5,disconnectTimeInterval:30,statsReportTimeInterval:!1,iceServers:[{url:"stun:stun.l.google.com:19302"},{url:"stun:turn.quickblox.com",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turn.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnsingapor.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnsingapore.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnireland.quickblox.com:3478?transport=udp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"},{url:"turn:turnireland.quickblox.com:3478?transport=tcp",username:"quickblox",credential:"baccb97ba2d92d71e26eb9886da5f1e0"}]},urls:{session:"session",login:"login",users:"users",chat:"chat",blobs:"blobs",geodata:"geodata",pushtokens:"push_tokens",subscriptions:"subscriptions",events:"events",data:"data",type:".json"},on:{sessionExpired:null},timeout:null,debug:{mode:0,file:null},addISOTime:!1};d.set=function(a){"object"==typeof a.endpoints&&a.endpoints.chat&&(d.endpoints.muc="muc."+a.endpoints.chat,d.chatProtocol.bosh="https://"+a.endpoints.chat+":5281",d.chatProtocol.websocket="wss://"+a.endpoints.chat+":5291"),Object.keys(a).forEach(function(b){"set"!==b&&d.hasOwnProperty(b)&&("object"!=typeof a[b]?d[b]=a[b]:Object.keys(a[b]).forEach(function(c){d[b].hasOwnProperty(c)&&(d[b][c]=a[b][c])})),"iceServers"===b&&(d.webrtc.iceServers=a[b])})},b.exports=d},{}],444:[function(a,b,c){function d(){}var e=a("./qbConfig"),f=a("./qbUtils"),g="undefined"!=typeof window;d.prototype={init:function(b,c,d,h){h&&"object"==typeof h&&e.set(h);var i=a("./qbProxy");this.service=new i;var j,k=a("./modules/qbAuth"),l=a("./modules/qbUsers"),m=a("./modules/qbChat"),n=a("./modules/qbContent"),o=a("./modules/qbLocation"),p=a("./modules/qbPushNotifications"),q=a("./modules/qbData");if(g){var r=a("./qbStrophe");if(j=new r,f.isWebRTCAvailble()){var s=a("./modules/webrtc/qbWebRTCClient");this.webrtc=new s(this.service,j||null)}else this.webrtc=!1}else this.webrtc=!1;this.auth=new k(this.service),this.users=new l(this.service),this.chat=new m(this.service,this.webrtc?this.webrtc.signalingProcessor:null,j||null),this.content=new n(this.service),this.location=new o(this.service),this.pushnotifications=new p(this.service),this.data=new q(this.service),"string"!=typeof b||c&&"number"!=typeof c||d?(e.creds.appId=b,e.creds.authKey=c,e.creds.authSecret=d):("number"==typeof c&&(e.creds.appId=c),this.service.setSession({token:b}))},getSession:function(a){this.auth.getSession(a)},createSession:function(a,b){this.auth.createSession(a,b)},destroySession:function(a){this.auth.destroySession(a)},login:function(a,b){this.auth.login(a,b)},logout:function(a){this.auth.logout(a)}};var h=new d;h.QuickBlox=d,b.exports=h},{"./modules/qbAuth":428,"./modules/qbChat":429,"./modules/qbContent":431,"./modules/qbData":432,"./modules/qbLocation":433,"./modules/qbPushNotifications":434,"./modules/qbUsers":435,"./modules/webrtc/qbWebRTCClient":437,"./qbConfig":443,"./qbProxy":445,"./qbStrophe":446,"./qbUtils":447}],445:[function(a,b,c){function d(){this.qbInst={config:e,session:null}}var e=a("./qbConfig"),f=a("./qbUtils"),g=e.version,h="undefined"!=typeof window;if(!h)var i=a("request");var j=h&&window.jQuery&&window.jQuery.ajax||h&&window.Zepto&&window.Zepto.ajax;if(h&&!j)throw new Error("Quickblox requires jQuery or Zepto");d.prototype={setSession:function(a){this.qbInst.session=a},getSession:function(){return this.qbInst.session},handleResponse:function(a,b,c,d){!a||"function"!=typeof e.on.sessionExpired||"Unauthorized"!==a.message&&"401 Unauthorized"!==a.status?a?c(a,null):(e.addISOTime&&(b=f.injectISOTimes(b)),c(null,b)):e.on.sessionExpired(function(){c(a,b)},d)},ajax:function(a,b){f.QBLog("[ServiceProxy]","Request: ",a.type||"GET",{data:JSON.stringify(c)});var c,d=this;a.data&&a.data.file?(c=JSON.parse(JSON.stringify(a)),c.data.file="..."):c=a;var k=function(c){c&&(d.setSession(c),d.ajax(a,b))},l={url:a.url,type:a.type||"GET",dataType:a.dataType||"json",data:a.data||" ",timeout:e.timeout,beforeSend:function(a,b){b.url.indexOf("s3.amazonaws.com")===-1&&d.qbInst.session&&d.qbInst.session.token&&(a.setRequestHeader("QB-Token",d.qbInst.session.token),a.setRequestHeader("QB-SDK","JS "+g+" - Client"))},success:function(c,g,h){f.QBLog("[ServiceProxy]","Response: ",{data:JSON.stringify(c)}),a.url.indexOf(e.urls.session)===-1?d.handleResponse(null,c,b,k):b(null,c)},error:function(c,g,h){f.QBLog("[ServiceProxy]","ajax error",c.status,h,c);var i={code:c.status,status:g,message:h,detail:c.responseText};a.url.indexOf(e.urls.session)===-1?d.handleResponse(i,null,b,k):b(i,null)}};if(!h)var m="json"===l.dataType,n=a.url.indexOf("s3.amazonaws.com")===-1&&d.qbInst&&d.qbInst.session&&d.qbInst.session.token||!1,o={url:l.url,method:l.type,timeout:e.timeout,json:m&&!a.isFileUpload?l.data:null,headers:n?{"QB-Token":d.qbInst.session.token,"QB-SDK":"JS "+g+" - Server"}:null},p=function(a,c,f){if(a||200!==c.statusCode&&201!==c.statusCode&&202!==c.statusCode){var g;try{g={code:c&&c.statusCode||a&&a.code,status:c&&c.headers&&c.headers.status||"error",message:f||a&&a.errno,detail:f&&f.errors||a&&a.syscall}}catch(b){g=a}o.url.indexOf(e.urls.session)===-1?d.handleResponse(g,null,b,k):b(g,null)}else o.url.indexOf(e.urls.session)===-1?d.handleResponse(null,f,b,k):b(null,f)};if("boolean"!=typeof a.contentType&&"string"!=typeof a.contentType||(l.contentType=a.contentType),"boolean"==typeof a.processData&&(l.processData=a.processData),h)j(l);else{var q=i(o,p);if(m){if(a.isFileUpload){var r=q.form();Object.keys(l.data).forEach(function(a,b,c){"file"===a?r.append(a,l.data[a].data,{filename:l.data[a].name}):r.append(a,l.data[a])})}}else{var r=q.form();Object.keys(l.data).forEach(function(a,b,c){r.append(a,l.data[a])})}}}},b.exports=d},{"./qbConfig":443,"./qbUtils":447,request:5}],446:[function(a,b,c){"use strict";function d(){var a=1===f.active?f.bosh:f.websocket,b=new Strophe.Connection(a);return 1===f.active?(b.xmlInput=function(a){if(a.childNodes[0])for(var b=0,c=a.childNodes.length;b16777215&&(h.increment=0),"00000000".substr(0,8-a.length)+a+"000000".substr(0,6-h.machine.length)+h.machine+"0000".substr(0,4-h.pid.length)+h.pid+"000000".substr(0,6-b.length)+b},injectISOTimes:function(a){if(a.created_at)"number"==typeof a.created_at&&(a.iso_created_at=new Date(1e3*a.created_at).toISOString()),"number"==typeof a.updated_at&&(a.iso_updated_at=new Date(1e3*a.updated_at).toISOString());else if(a.items)for(var b=0,c=a.items.length;b