-
Notifications
You must be signed in to change notification settings - Fork 7
/
browser.thinbus.js
1 lines (1 loc) · 28.4 KB
/
browser.thinbus.js
1
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).thinbus=t()}}(function(){return function t(i,r,s){function o(n,h){if(!r[n]){if(!i[n]){var u="function"==typeof require&&require;if(!h&&u)return u(n,!0);if(e)return e(n,!0);var f=new Error("Cannot find module '"+n+"'");throw f.code="MODULE_NOT_FOUND",f}var a=r[n]={exports:{}};i[n][0].call(a.exports,function(t){var r=i[n][1][t];return o(r||t)},a,a.exports,t,i,r,s)}return r[n].exports}for(var e="function"==typeof require&&require,n=0;n<s.length;n++)o(s[n]);return o}({"/thinbus-original-client.js":[function(t,i,r){var s=s||function(t,i){var r={},s=r.lib={},o=function(){},e=s.Base={extend:function(t){o.prototype=this;var i=new o;return t&&i.mixIn(t),i.hasOwnProperty("init")||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var i in t)t.hasOwnProperty(i)&&(this[i]=t[i]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},n=s.WordArray=e.extend({init:function(t,i){t=this.words=t||[],this.sigBytes=void 0!=i?i:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var i=this.words,r=t.words,s=this.sigBytes;if(t=t.sigBytes,this.clamp(),s%4)for(var o=0;o<t;o++)i[s+o>>>2]|=(r[o>>>2]>>>24-o%4*8&255)<<24-(s+o)%4*8;else if(65535<r.length)for(o=0;o<t;o+=4)i[s+o>>>2]=r[o>>>2];else i.push.apply(i,r);return this.sigBytes+=t,this},clamp:function(){var i=this.words,r=this.sigBytes;i[r>>>2]&=4294967295<<32-r%4*8,i.length=t.ceil(r/4)},clone:function(){var t=e.clone.call(this);return t.words=this.words.slice(0),t},random:function(i){for(var r=[],s=0;s<i;s+=4)r.push(4294967296*t.random()|0);return new n.init(r,i)}}),h=r.enc={},u=h.Hex={stringify:function(t){var i=t.words;t=t.sigBytes;for(var r=[],s=0;s<t;s++){var o=i[s>>>2]>>>24-s%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var i=t.length,r=[],s=0;s<i;s+=2)r[s>>>3]|=parseInt(t.substr(s,2),16)<<24-s%8*4;return new n.init(r,i/2)}},f=h.Latin1={stringify:function(t){var i=t.words;t=t.sigBytes;for(var r=[],s=0;s<t;s++)r.push(String.fromCharCode(i[s>>>2]>>>24-s%4*8&255));return r.join("")},parse:function(t){for(var i=t.length,r=[],s=0;s<i;s++)r[s>>>2]|=(255&t.charCodeAt(s))<<24-s%4*8;return new n.init(r,i)}},a=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},p=s.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new n.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=a.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(i){var r=this._data,s=r.words,o=r.sigBytes,e=this.blockSize,h=o/(4*e);if(i=(h=i?t.ceil(h):t.max((0|h)-this._minBufferSize,0))*e,o=t.min(4*i,o),i){for(var u=0;u<i;u+=e)this._doProcessBlock(s,u);u=s.splice(0,i),r.sigBytes-=o}return new n.init(u,o)},clone:function(){var t=e.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});s.Hasher=p.extend({cfg:e.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(i,r){return new t.init(r).finalize(i)}},_createHmacHelper:function(t){return function(i,r){return new c.HMAC.init(t,r).finalize(i)}}});var c=r.algo={};return r}(Math);!function(t){for(var i=s,r=(e=i.lib).WordArray,o=e.Hasher,e=i.algo,n=[],h=[],u=function(t){return 4294967296*(t-(0|t))|0},f=2,a=0;64>a;){var p;t:{p=f;for(var c=t.sqrt(p),l=2;l<=c;l++)if(!(p%l)){p=!1;break t}p=!0}p&&(8>a&&(n[a]=u(t.pow(f,.5))),h[a]=u(t.pow(f,1/3)),a++),f++}var m=[];e=e.SHA256=o.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(t,i){for(var r=this._hash.words,s=r[0],o=r[1],e=r[2],n=r[3],u=r[4],f=r[5],a=r[6],p=r[7],c=0;64>c;c++){if(16>c)m[c]=0|t[i+c];else{var l=m[c-15],d=m[c-2];m[c]=((l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3)+m[c-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+m[c-16]}l=p+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&f^~u&a)+h[c]+m[c],d=((s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22))+(s&o^s&e^o&e),p=a,a=f,f=u,u=n+l|0,n=e,e=o,o=s,s=l+d|0}r[0]=r[0]+s|0,r[1]=r[1]+o|0,r[2]=r[2]+e|0,r[3]=r[3]+n|0,r[4]=r[4]+u|0,r[5]=r[5]+f|0,r[6]=r[6]+a|0,r[7]=r[7]+p|0},_doFinalize:function(){var i=this._data,r=i.words,s=8*this._nDataBytes,o=8*i.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=t.floor(s/4294967296),r[15+(o+64>>>9<<4)]=s,i.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});i.SHA256=o._createHelper(e),i.HmacSHA256=o._createHmacHelper(e)}(Math);function o(t,i,r){null!=t&&("number"==typeof t?this.fromNumber(t,i,r):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function e(){return new o(null)}o.prototype.am=function(t,i,r,s,o,e){for(var n=16383&i,h=i>>14;--e>=0;){var u=16383&this[t],f=this[t++]>>14,a=h*u+f*n;o=((u=n*u+((16383&a)<<14)+r[s]+o)>>28)+(a>>14)+h*f,r[s++]=268435455&u}return o},o.prototype.DB=28,o.prototype.DM=268435455,o.prototype.DV=1<<28;o.prototype.FV=Math.pow(2,52),o.prototype.F1=24,o.prototype.F2=4;var n,h,u="0123456789abcdefghijklmnopqrstuvwxyz",f=new Array;for(n="0".charCodeAt(0),h=0;h<=9;++h)f[n++]=h;for(n="a".charCodeAt(0),h=10;h<36;++h)f[n++]=h;for(n="A".charCodeAt(0),h=10;h<36;++h)f[n++]=h;function a(t){return u.charAt(t)}function p(t,i){var r=f[t.charCodeAt(i)];return null==r?-1:r}function c(t){var i=e();return i.fromInt(t),i}function l(t){var i,r=1;return 0!=(i=t>>>16)&&(t=i,r+=16),0!=(i=t>>8)&&(t=i,r+=8),0!=(i=t>>4)&&(t=i,r+=4),0!=(i=t>>2)&&(t=i,r+=2),0!=(i=t>>1)&&(t=i,r+=1),r}function m(t){this.m=t}m.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},m.prototype.revert=function(t){return t},m.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},m.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},m.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};function d(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}d.prototype.convert=function(t){var i=e();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(o.ZERO)>0&&this.m.subTo(i,i),i},d.prototype.revert=function(t){var i=e();return t.copyTo(i),this.reduce(i),i},d.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i<this.m.t;++i){var r=32767&t[i],s=r*this.mpl+((r*this.mph+(t[i]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=i+this.m.t]+=this.m.am(0,s,t,i,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},d.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},d.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};o.prototype.copyTo=function(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s},o.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0},o.prototype.fromString=function(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var s=t.length,e=!1,n=0;--s>=0;){var h=8==r?255&t[s]:p(t,s);h<0?"-"==t.charAt(s)&&(e=!0):(e=!1,0==n?this[this.t++]=h:n+r>this.DB?(this[this.t-1]|=(h&(1<<this.DB-n)-1)<<n,this[this.t++]=h>>this.DB-n):this[this.t-1]|=h<<n,(n+=r)>=this.DB&&(n-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,n>0&&(this[this.t-1]|=(1<<this.DB-n)-1<<n)),this.clamp(),e&&o.ZERO.subTo(this,this)},o.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},o.prototype.dlShiftTo=function(t,i){var r;for(r=this.t-1;r>=0;--r)i[r+t]=this[r];for(r=t-1;r>=0;--r)i[r]=0;i.t=this.t+t,i.s=this.s},o.prototype.drShiftTo=function(t,i){for(var r=t;r<this.t;++r)i[r-t]=this[r];i.t=Math.max(this.t-t,0),i.s=this.s},o.prototype.lShiftTo=function(t,i){var r,s=t%this.DB,o=this.DB-s,e=(1<<o)-1,n=Math.floor(t/this.DB),h=this.s<<s&this.DM;for(r=this.t-1;r>=0;--r)i[r+n+1]=this[r]>>o|h,h=(this[r]&e)<<s;for(r=n-1;r>=0;--r)i[r]=0;i[n]=h,i.t=this.t+n+1,i.s=this.s,i.clamp()},o.prototype.rShiftTo=function(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)i.t=0;else{var s=t%this.DB,o=this.DB-s,e=(1<<s)-1;i[0]=this[r]>>s;for(var n=r+1;n<this.t;++n)i[n-r-1]|=(this[n]&e)<<o,i[n-r]=this[n]>>s;s>0&&(i[this.t-r-1]|=(this.s&e)<<o),i.t=this.t-r,i.clamp()}},o.prototype.subTo=function(t,i){for(var r=0,s=0,o=Math.min(t.t,this.t);r<o;)s+=this[r]-t[r],i[r++]=s&this.DM,s>>=this.DB;if(t.t<this.t){for(s-=t.s;r<this.t;)s+=this[r],i[r++]=s&this.DM,s>>=this.DB;s+=this.s}else{for(s+=this.s;r<t.t;)s-=t[r],i[r++]=s&this.DM,s>>=this.DB;s-=t.s}i.s=s<0?-1:0,s<-1?i[r++]=this.DV+s:s>0&&(i[r++]=s),i.t=r,i.clamp()},o.prototype.multiplyTo=function(t,i){var r=this.abs(),s=t.abs(),e=r.t;for(i.t=e+s.t;--e>=0;)i[e]=0;for(e=0;e<s.t;++e)i[e+r.t]=r.am(0,s[e],i,e,0,r.t);i.s=0,i.clamp(),this.s!=t.s&&o.ZERO.subTo(i,i)},o.prototype.squareTo=function(t){for(var i=this.abs(),r=t.t=2*i.t;--r>=0;)t[r]=0;for(r=0;r<i.t-1;++r){var s=i.am(r,i[r],t,2*r,0,1);(t[r+i.t]+=i.am(r+1,2*i[r],t,2*r+1,s,i.t-r-1))>=i.DV&&(t[r+i.t]-=i.DV,t[r+i.t+1]=1)}t.t>0&&(t[t.t-1]+=i.am(r,i[r],t,2*r,0,1)),t.s=0,t.clamp()},o.prototype.divRemTo=function(t,i,r){var s=t.abs();if(!(s.t<=0)){var n=this.abs();if(n.t<s.t)return null!=i&&i.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=e());var h=e(),u=this.s,f=t.s,a=this.DB-l(s[s.t-1]);a>0?(s.lShiftTo(a,h),n.lShiftTo(a,r)):(s.copyTo(h),n.copyTo(r));var p=h.t,c=h[p-1];if(0!=c){var m=c*(1<<this.F1)+(p>1?h[p-2]>>this.F2:0),d=this.FV/m,y=(1<<this.F1)/m,v=1<<this.F2,T=r.t,g=T-p,w=null==i?e():i;for(h.dlShiftTo(g,w),r.compareTo(w)>=0&&(r[r.t++]=1,r.subTo(w,r)),o.ONE.dlShiftTo(p,w),w.subTo(h,h);h.t<p;)h[h.t++]=0;for(;--g>=0;){var b=r[--T]==c?this.DM:Math.floor(r[T]*d+(r[T-1]+v)*y);if((r[T]+=h.am(0,b,r,g,0,p))<b)for(h.dlShiftTo(g,w),r.subTo(w,r);r[T]<--b;)r.subTo(w,r)}null!=i&&(r.drShiftTo(p,i),u!=f&&o.ZERO.subTo(i,i)),r.t=p,r.clamp(),a>0&&r.rShiftTo(a,r),u<0&&o.ZERO.subTo(r,r)}}},o.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i},o.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},o.prototype.exp=function(t,i){if(t>4294967295||t<1)return o.ONE;var r=e(),s=e(),n=i.convert(this),h=l(t)-1;for(n.copyTo(r);--h>=0;)if(i.sqrTo(r,s),(t&1<<h)>0)i.mulTo(s,n,r);else{var u=r;r=s,s=u}return i.revert(r)},o.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,s=(1<<i)-1,o=!1,e="",n=this.t,h=this.DB-n*this.DB%i;if(n-- >0)for(h<this.DB&&(r=this[n]>>h)>0&&(o=!0,e=a(r));n>=0;)h<i?(r=(this[n]&(1<<h)-1)<<i-h,r|=this[--n]>>(h+=this.DB-i)):(r=this[n]>>(h-=i)&s,h<=0&&(h+=this.DB,--n)),r>0&&(o=!0),o&&(e+=a(r));return o?e:"0"},o.prototype.negate=function(){var t=e();return o.ZERO.subTo(this,t),t},o.prototype.abs=function(){return this.s<0?this.negate():this},o.prototype.compareTo=function(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(0!=(i=r-t.t))return i;for(;--r>=0;)if(0!=(i=this[r]-t[r]))return i;return 0},o.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+l(this[this.t-1]^this.s&this.DM)},o.prototype.mod=function(t){var i=e();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(o.ZERO)>0&&t.subTo(i,i),i},o.prototype.modPowInt=function(t,i){var r;return r=t<256||i.isEven()?new m(i):new d(i),this.exp(t,r)},o.ZERO=c(0),o.ONE=c(1);function y(t,i){return t&i}function v(t,i){return t|i}function T(t,i){return t^i}function g(t,i){return t&~i}function w(t){if(0==t)return-1;var i=0;return 0==(65535&t)&&(t>>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function b(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function S(){}function B(t){return t}S.prototype.convert=B,S.prototype.revert=B,S.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r)},S.prototype.sqrTo=function(t,i){t.squareTo(i)};function D(t){this.r2=e(),this.q3=e(),o.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}D.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=e();return t.copyTo(i),this.reduce(i),i},D.prototype.revert=function(t){return t},D.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},D.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},D.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};var E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],x=(1<<26)/E[E.length-1];o.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},o.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),s=c(r),o=e(),n=e(),h="";for(this.divRemTo(s,o,n);o.signum()>0;)h=(r+n.intValue()).toString(t).substr(1)+h,o.divRemTo(s,o,n);return n.intValue().toString(t)+h},o.prototype.fromRadix=function(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),s=Math.pow(i,r),e=!1,n=0,h=0,u=0;u<t.length;++u){var f=p(t,u);f<0?"-"==t.charAt(u)&&0==this.signum()&&(e=!0):(h=i*h+f,++n>=r&&(this.dMultiply(s),this.dAddOffset(h,0),n=0,h=0))}n>0&&(this.dMultiply(Math.pow(i,n)),this.dAddOffset(h,0)),e&&o.ZERO.subTo(this,this)},o.prototype.fromNumber=function(t,i,r){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(o.ONE.shiftLeft(t-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(o.ONE.shiftLeft(t-1),this);else{var s=new Array,e=7&t;s.length=1+(t>>3),i.nextBytes(s),e>0?s[0]&=(1<<e)-1:s[0]=0,this.fromString(s,256)}},o.prototype.bitwiseTo=function(t,i,r){var s,o,e=Math.min(t.t,this.t);for(s=0;s<e;++s)r[s]=i(this[s],t[s]);if(t.t<this.t){for(o=t.s&this.DM,s=e;s<this.t;++s)r[s]=i(this[s],o);r.t=this.t}else{for(o=this.s&this.DM,s=e;s<t.t;++s)r[s]=i(o,t[s]);r.t=t.t}r.s=i(this.s,t.s),r.clamp()},o.prototype.changeBit=function(t,i){var r=o.ONE.shiftLeft(t);return this.bitwiseTo(r,i,r),r},o.prototype.addTo=function(t,i){for(var r=0,s=0,o=Math.min(t.t,this.t);r<o;)s+=this[r]+t[r],i[r++]=s&this.DM,s>>=this.DB;if(t.t<this.t){for(s+=t.s;r<this.t;)s+=this[r],i[r++]=s&this.DM,s>>=this.DB;s+=this.s}else{for(s+=this.s;r<t.t;)s+=t[r],i[r++]=s&this.DM,s>>=this.DB;s+=t.s}i.s=s<0?-1:0,s>0?i[r++]=s:s<-1&&(i[r++]=this.DV+s),i.t=r,i.clamp()},o.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},o.prototype.dAddOffset=function(t,i){for(;this.t<=i;)this[this.t++]=0;for(this[i]+=t;this[i]>=this.DV;)this[i]-=this.DV,++i>=this.t&&(this[this.t++]=0),++this[i]},o.prototype.multiplyLowerTo=function(t,i,r){var s=Math.min(this.t+t.t,i);for(r.s=0,r.t=s;s>0;)r[--s]=0;var o;for(o=r.t-this.t;s<o;++s)r[s+this.t]=this.am(0,t[s],r,s,0,this.t);for(o=Math.min(t.t,i);s<o;++s)this.am(0,t[s],r,s,0,i-s);r.clamp()},o.prototype.multiplyUpperTo=function(t,i,r){--i;var s=r.t=this.t+t.t-i;for(r.s=0;--s>=0;)r[s]=0;for(s=Math.max(i-this.t,0);s<t.t;++s)r[this.t+s-i]=this.am(i-s,t[s],r,0,0,this.t+s-i);r.clamp(),r.drShiftTo(1,r)},o.prototype.modInt=function(t){if(t<=0)return 0;var i=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==i)r=this[0]%t;else for(var s=this.t-1;s>=0;--s)r=(i*r+this[s])%t;return r},o.prototype.millerRabin=function(t){var i=this.subtract(o.ONE),r=i.getLowestSetBit();if(r<=0)return!1;var s=i.shiftRight(r);(t=t+1>>1)>E.length&&(t=E.length);for(var n=e(),h=0;h<t;++h){n.fromInt(E[h]);var u=n.modPow(s,this);if(0!=u.compareTo(o.ONE)&&0!=u.compareTo(i)){for(var f=1;f++<r&&0!=u.compareTo(i);)if(0==(u=u.modPowInt(2,this)).compareTo(o.ONE))return!1;if(0!=u.compareTo(i))return!1}}return!0},o.prototype.clone=function(){var t=e();return this.copyTo(t),t},o.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},o.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},o.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},o.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},o.prototype.toByteArray=function(){var t=this.t,i=new Array;i[0]=this.s;var r,s=this.DB-t*this.DB%8,o=0;if(t-- >0)for(s<this.DB&&(r=this[t]>>s)!=(this.s&this.DM)>>s&&(i[o++]=r|this.s<<this.DB-s);t>=0;)s<8?(r=(this[t]&(1<<s)-1)<<8-s,r|=this[--t]>>(s+=this.DB-8)):(r=this[t]>>(s-=8)&255,s<=0&&(s+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(i[o++]=r);return i},o.prototype.equals=function(t){return 0==this.compareTo(t)},o.prototype.min=function(t){return this.compareTo(t)<0?this:t},o.prototype.max=function(t){return this.compareTo(t)>0?this:t},o.prototype.and=function(t){var i=e();return this.bitwiseTo(t,y,i),i},o.prototype.or=function(t){var i=e();return this.bitwiseTo(t,v,i),i},o.prototype.xor=function(t){var i=e();return this.bitwiseTo(t,T,i),i},o.prototype.andNot=function(t){var i=e();return this.bitwiseTo(t,g,i),i},o.prototype.not=function(){for(var t=e(),i=0;i<this.t;++i)t[i]=this.DM&~this[i];return t.t=this.t,t.s=~this.s,t},o.prototype.shiftLeft=function(t){var i=e();return t<0?this.rShiftTo(-t,i):this.lShiftTo(t,i),i},o.prototype.shiftRight=function(t){var i=e();return t<0?this.lShiftTo(-t,i):this.rShiftTo(t,i),i},o.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+w(this[t]);return this.s<0?this.t*this.DB:-1},o.prototype.bitCount=function(){for(var t=0,i=this.s&this.DM,r=0;r<this.t;++r)t+=b(this[r]^i);return t},o.prototype.testBit=function(t){var i=Math.floor(t/this.DB);return i>=this.t?0!=this.s:0!=(this[i]&1<<t%this.DB)},o.prototype.setBit=function(t){return this.changeBit(t,v)},o.prototype.clearBit=function(t){return this.changeBit(t,g)},o.prototype.flipBit=function(t){return this.changeBit(t,T)},o.prototype.add=function(t){var i=e();return this.addTo(t,i),i},o.prototype.subtract=function(t){var i=e();return this.subTo(t,i),i},o.prototype.multiply=function(t){var i=e();return this.multiplyTo(t,i),i},o.prototype.divide=function(t){var i=e();return this.divRemTo(t,i,null),i},o.prototype.remainder=function(t){var i=e();return this.divRemTo(t,null,i),i},o.prototype.divideAndRemainder=function(t){var i=e(),r=e();return this.divRemTo(t,i,r),new Array(i,r)},o.prototype.modPow=function(t,i){var r,s,o=t.bitLength(),n=c(1);if(o<=0)return n;r=o<18?1:o<48?3:o<144?4:o<768?5:6,s=o<8?new m(i):i.isEven()?new D(i):new d(i);var h=new Array,u=3,f=r-1,a=(1<<r)-1;if(h[1]=s.convert(this),r>1){var p=e();for(s.sqrTo(h[1],p);u<=a;)h[u]=e(),s.mulTo(p,h[u-2],h[u]),u+=2}var y,v,T=t.t-1,g=!0,w=e();for(o=l(t[T])-1;T>=0;){for(o>=f?y=t[T]>>o-f&a:(y=(t[T]&(1<<o+1)-1)<<f-o,T>0&&(y|=t[T-1]>>this.DB+o-f)),u=r;0==(1&y);)y>>=1,--u;if((o-=u)<0&&(o+=this.DB,--T),g)h[y].copyTo(n),g=!1;else{for(;u>1;)s.sqrTo(n,w),s.sqrTo(w,n),u-=2;u>0?s.sqrTo(n,w):(v=n,n=w,w=v),s.mulTo(w,h[y],n)}for(;T>=0&&0==(t[T]&1<<o);)s.sqrTo(n,w),v=n,n=w,w=v,--o<0&&(o=this.DB-1,--T)}return s.revert(n)},o.prototype.modInverse=function(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return o.ZERO;for(var r=t.clone(),s=this.clone(),e=c(1),n=c(0),h=c(0),u=c(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(e.isEven()&&n.isEven()||(e.addTo(this,e),n.subTo(t,n)),e.rShiftTo(1,e)):n.isEven()||n.subTo(t,n),n.rShiftTo(1,n);for(;s.isEven();)s.rShiftTo(1,s),i?(h.isEven()&&u.isEven()||(h.addTo(this,h),u.subTo(t,u)),h.rShiftTo(1,h)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);r.compareTo(s)>=0?(r.subTo(s,r),i&&e.subTo(h,e),n.subTo(u,n)):(s.subTo(r,s),i&&h.subTo(e,h),u.subTo(n,u))}return 0!=s.compareTo(o.ONE)?o.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},o.prototype.pow=function(t){return this.exp(t,new S)},o.prototype.gcd=function(t){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var s=i;i=r,r=s}var o=i.getLowestSetBit(),e=r.getLowestSetBit();if(e<0)return i;for(o<e&&(e=o),e>0&&(i.rShiftTo(e,i),r.rShiftTo(e,r));i.signum()>0;)(o=i.getLowestSetBit())>0&&i.rShiftTo(o,i),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r));return e>0&&r.lShiftTo(e,r),r},o.prototype.isProbablePrime=function(t){var i,r=this.abs();if(1==r.t&&r[0]<=E[E.length-1]){for(i=0;i<E.length;++i)if(r[0]==E[i])return!0;return!1}if(r.isEven())return!1;for(i=1;i<E.length;){for(var s=E[i],o=i+1;o<E.length&&s<x;)s*=E[o++];for(s=r.modInt(s);i<o;)if(s%E[i++]==0)return!1}return r.millerRabin(t)},String.prototype.toIntArray=function(){for(var t,i,r,s=[],o=[],e=0,n=this+"\0\0\0",h=n.length-1;e<h;)t=n.charCodeAt(e++),i=n.charCodeAt(e+1),t<128?s.push(t):t<2048?(s.push(t>>>6&31|192),s.push(t>>>0&63|128)):55296!=(63488&t)?(s.push(t>>>12&15|224),s.push(t>>>6&63|128),s.push(t>>>0&63|128)):55296==(64512&t)&&56320==(64512&i)&&(r=65536+(63&i|(63&t)<<10),s.push(r>>>18&7|240),s.push(r>>>12&63|128),s.push(r>>>6&63|128),s.push(r>>>0&63|128),e++),s.length>3&&o.push(s.shift()<<0|s.shift()<<8|s.shift()<<16|s.shift()<<24);return o};var M=function(){var t=Array(256),i=0,r=0,s=0,o=Array(256),e=0;u(4294967295*Math.random());function n(t,i){var r=(65535&t)+(65535&i);return(t>>>16)+(i>>>16)+(r>>>16)<<16|65535&r}function h(){i=r=s=0;for(var n=0;n<256;++n)t[n]=o[n]=0;e=0}function u(i){var r,s,u,a,p,c,l,m,d;if(r=s=u=a=p=c=l=m=2654435769,i&&"string"==typeof i&&(i=i.toIntArray()),i&&"number"==typeof i&&(i=[i]),i instanceof Array)for(h(),d=0;d<i.length;d++)o[255&d]+="number"==typeof i[d]?i[d]:0;function y(){a=n(a,r^=s<<11),s=n(s,u),p=n(p,s^=u>>>2),u=n(u,a),c=n(c,u^=a<<8),a=n(a,p),l=n(l,a^=p>>>16),p=n(p,c),m=n(m,p^=c<<10),c=n(c,l),r=n(r,c^=l>>>4),l=n(l,m),s=n(s,l^=m<<8),m=n(m,r),u=n(u,m^=r>>>9),r=n(r,s)}for(d=0;d<4;d++)y();for(d=0;d<256;d+=8)i&&(r=n(r,o[d+0]),s=n(s,o[d+1]),u=n(u,o[d+2]),a=n(a,o[d+3]),p=n(p,o[d+4]),c=n(c,o[d+5]),l=n(l,o[d+6]),m=n(m,o[d+7])),y(),t[d+0]=r,t[d+1]=s,t[d+2]=u,t[d+3]=a,t[d+4]=p,t[d+5]=c,t[d+6]=l,t[d+7]=m;if(i)for(d=0;d<256;d+=8)r=n(r,t[d+0]),s=n(s,t[d+1]),u=n(u,t[d+2]),a=n(a,t[d+3]),p=n(p,t[d+4]),c=n(c,t[d+5]),l=n(l,t[d+6]),m=n(m,t[d+7]),y(),t[d+0]=r,t[d+1]=s,t[d+2]=u,t[d+3]=a,t[d+4]=p,t[d+5]=c,t[d+6]=l,t[d+7]=m;f(),e=256}function f(e){var h,u,f;for(e=e&&"number"==typeof e?Math.abs(Math.floor(e)):1;e--;)for(s=n(s,1),r=n(r,s),h=0;h<256;h++){switch(3&h){case 0:i^=i<<13;break;case 1:i^=i>>>6;break;case 2:i^=i<<2;break;case 3:i^=i>>>16}i=n(t[h+128&255],i),u=t[h],t[h]=f=n(t[u>>>2&255],n(i,r)),o[h]=r=n(t[f>>>10&255],u)}}return{reset:h,seed:u,prng:f,rand:function(){return e--||(f(),e=255),o[e]},internals:function(){return{a:i,b:r,c:s,m:t,r:o}}}}();M.random=function(){return.5+2.3283064365386963e-10*this.rand()};var A=function(){var t=!("undefined"==typeof window||!window.crypto||!window.crypto.getRandomValues)||!("undefined"==typeof window||!window.msCrypto||!window.msCrypto.getRandomValues);!function(){if(t)return!1;var i=+new Date+":"+Math.random();"undefined"!=typeof window&&window.cookie&&(i+=document.cookie);var r=s.SHA256||s.SHA1;M.seed(r(i))}();return{random:function(){var i;if(t){var r=window.crypto||window.msCrypto;i=new Int32Array(4),r.getRandomValues(i)}else{var s=+new Date%50;M.prng(1+s),i=new Array;for(var o=0;o<4;o++)i.push(M.rand())}var e="";for(o=0;o<4;o++){var n=i[o];n<0&&(n*=-1),e+=n.toString(16)}return e},isWebCryptoAPI:t,advance:function(i){if(!t)for(var r=+new Date+i,s=+new Date;s<r;){var o=s%5;M.prng(1+o),s=+new Date}}}}(),_=100;"undefined"!=typeof test_random16byteHexAdvance&&(_=test_random16byteHexAdvance),A.advance(_);function H(){"use strict";this.INIT=0,this.STEP_1=1,this.STEP_2=2,this.STEP_3=3,this.state=this.INIT,this.x=null,this.v=null,this.I=null,this.P=null,this.salt=null,this.B=null,this.A=null,this.a=null,this.k=null,this.u=null,this.S=null,this.K=null,this.M1str=null,this.check=function(t,i){if(void 0===t||null===t||""===t||"0"===t)throw new Error(i+" must not be null, empty or zero")},this.generateX=function(t,i,r){this.check(t,"salt"),this.check(i,"identity"),this.check(r,"password"),this.salt=t;for(var s=this.H(i+":"+r);"0"===s.substring(0,1);)s=s.substring(1);for(var o=(t+s).toUpperCase(),e=this.H(o);"0"===e.substring(0,1);)e=e.substring(1);return this.x=this.fromHex(e).mod(this.N()),this.x},this.computeSessionKey=function(t,i,r,s,o){this.check(t,"k"),this.check(i,"x"),this.check(r,"u"),this.check(s,"a"),this.check(o,"B");var e=r.multiply(i).add(s),n=this.g().modPow(i,this.N()).multiply(t);return o.subtract(n).modPow(e,this.N())}}H.prototype.toHex=function(t){"use strict";return t.toString(16)},H.prototype.fromHex=function(t){"use strict";return new o(""+t,16)},H.prototype.BigInteger=function(t,i){"use strict";return new o(""+t,i)},H.prototype.getState=function(){"use strict";return this.state},H.prototype.getSessionKey=function(t){"use strict";return null===this.S?null:(this.SS=this.toHex(this.S),void 0!==t&&!1===t?this.SS:(null===this.K&&(this.K=this.H(this.SS)),this.K))},H.prototype.getUserID=function(){"use strict";return this.I},H.prototype.generateRandomSalt=function(t){"use strict";var i=null;i=A.random();return this.H(new Date+":"+t+":"+i)},H.prototype.generateVerifier=function(t,i,r){"use strict";var s=this.generateX(t,i,r);return this.v=this.g().modPow(s,this.N()),this.toHex(this.v)},H.prototype.step1=function(t,i){"use strict";if(this.check(t,"identity"),this.check(i,"password"),this.I=t,this.P=i,this.state!==this.INIT)throw new Error("IllegalStateException not in state INIT");this.state=this.STEP_1},H.prototype.computeU=function(t,i){"use strict";this.check(t,"Astr"),this.check(i,"Bstr");var r=new o(""+this.H(t+i),16);if(o.ZERO.equals(r))throw new Error("SRP6Exception bad shared public value 'u' as u==0");return r},H.prototype.random16byteHex=function(){"use strict";return A.random()},H.prototype.randomA=function(t){"use strict";for(var i=this.toHex(t).length,r=this.BigInteger("0",10),s=this.BigInteger("1",10),o=r;r.equals(o);){for(var e=this.random16byteHex()+this.random16byteHex();e.length<i;)e+=this.random16byteHex();var n=this.BigInteger(e,16);o=this.BigInteger(this.H(this.I+":"+this.salt+":"+(new Date).getTime()),16).add(n).modPow(s,t)}return o},H.prototype.step2=function(t,i){"use strict";if(this.check(t,"s"),this.check(i,"BB"),this.state!==this.STEP_1)throw new Error("IllegalStateException not in state STEP_1");this.B=this.fromHex(i);var r=null;if(r=o.ZERO,this.B.mod(this.N()).equals(r))throw new Error("SRP6Exception bad server public value 'B' as B == 0 (mod N)");var s=this.generateX(t,this.I,this.P);this.P=null,this.a=this.randomA(this.N),this.A=this.g().modPow(this.a,this.N()),this.check(this.A,"A"),this.u=this.computeU(this.A.toString(16),i),this.S=this.computeSessionKey(this.k,s,this.u,this.a,this.B),this.check(this.S,"S");var e=this.toHex(this.A);for(this.M1str=this.H(e+i+this.toHex(this.S)),this.check(this.M1str,"M1str");"0"===this.M1str.substring(0,1);)this.M1str=this.M1str.substring(1);return this.state=this.STEP_2,{A:e,M1:this.M1str}},H.prototype.step3=function(t){"use strict";if(this.check(t),this.state!==this.STEP_2)throw new Error("IllegalStateException State violation: Session must be in STEP_2 state");for(var i=this.H(this.toHex(this.A)+this.M1str+this.toHex(this.S));"0"===i.substring(0,1);)i=i.substring(1);if(""+i!=""+t)throw new Error("SRP6Exception Bad server credentials");return this.state=this.STEP_3,!0},void 0!==i&&void 0!==i.exports&&(i.exports=function(t,i,r){function e(){}return(e.prototype=new H).N=function(){return new o(t,10)},e.prototype.g=function(){return new o(i,10)},e.prototype.H=function(t){return s.SHA256(t).toString().toLowerCase()},e.prototype.k=new o(r,16),e})},{}]},{},[])("/thinbus-original-client.js")});