From c07af29f0dc8b32cfb7a47550cac7fcc4f10461a Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Sun, 30 Mar 2014 13:06:21 +0400 Subject: [PATCH] merged with master --- app.manifest | 3 +- js/app.js | 5 +- js/lib/mtproto.js | 115 +++++- js/lib/pq_worker.js | 1 + vendor/closure/long.js | 813 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 927 insertions(+), 10 deletions(-) create mode 100644 vendor/closure/long.js diff --git a/app.manifest b/app.manifest index 14834a43..62022ae4 100644 --- a/app.manifest +++ b/app.manifest @@ -1,5 +1,5 @@ CACHE MANIFEST -# Time: Sun Mar 30 2014 00:59:03 GMT+0400 (MSK) +# Time: Sun Mar 30 2014 13:06:21 GMT+0400 (MSK) CACHE: @@ -54,6 +54,7 @@ js/lib/aes_worker.js js/lib/mtproto.js js/lib/pq_worker.js js/lib/sha1_worker.js +vendor/closure/long.js vendor/console-polyfill/console-polyfill.js vendor/cryptoJS/crypto.js vendor/jsbn/jsbn_combined.js diff --git a/js/app.js b/js/app.js index 44a98f0e..06fc4a0e 100644 --- a/js/app.js +++ b/js/app.js @@ -16,10 +16,11 @@ angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui function BigInteger(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 nbi(){return new BigInteger(null)}function am1(t,i,r,n,o,e){for(;--e>=0;){var s=i*this[t++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function am2(t,i,r,n,o,e){for(var s=32767&i,h=i>>15;--e>=0;){var p=32767&this[t],u=this[t++]>>15,a=h*p+u*s;p=s*p+((32767&a)<<15)+r[n]+(1073741823&o),o=(p>>>30)+(a>>>15)+h*u+(o>>>30),r[n++]=1073741823&p}return o}function am3(t,i,r,n,o,e){for(var s=16383&i,h=i>>14;--e>=0;){var p=16383&this[t],u=this[t++]>>14,a=h*p+u*s;p=s*p+((16383&a)<<14)+r[n]+o,o=(p>>28)+(a>>14)+h*u,r[n++]=268435455&p}return o}function int2char(t){return BI_RM.charAt(t)}function intAt(t,i){var r=BI_RC[t.charCodeAt(i)];return null==r?-1:r}function bnpCopyTo(t){for(var i=this.t-1;i>=0;--i)t[i]=this[i];t.t=this.t,t.s=this.s}function bnpFromInt(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function nbv(t){var i=nbi();return i.fromInt(t),i}function bnpFromString(t,i,r){var n;if(16==i)n=4;else if(8==i)n=3;else if(256==i)n=8;else if(2==i)n=1;else if(32==i)n=5;else{if(4!=i)return void this.fromRadix(t,i);n=2}this.t=0,this.s=0;for(var o=t.length,e=!1,s=0;--o>=0;){var h=8==n?255&t[o]:intAt(t,o);0>h?"-"==t.charAt(o)&&(e=!0):(e=!1,0==s?this[this.t++]=h:s+n>this.DB?(this[this.t-1]|=(h&(1<>this.DB-s):this[this.t-1]|=h<=this.DB&&(s-=this.DB))}8==n&&0!=(128&t[0])&&r&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function bnToString(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,n=(1<0)for(h>h)>0&&(o=!0,e=int2char(r));s>=0;)i>h?(r=(this[s]&(1<>(h+=this.DB-i)):(r=this[s]>>(h-=i)&n,0>=h&&(h+=this.DB,--s)),r>0&&(o=!0),o&&(e+=int2char(r));return o?e:"0"}function bnNegate(){var t=nbi();return BigInteger.ZERO.subTo(this,t),t}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(i=r-t.t,0!=i)return this.s<0?-i:i;for(;--r>=0;)if(0!=(i=this[r]-t[r]))return i;return 0}function nbits(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 bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(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}function bnpDRShiftTo(t,i){for(var r=t;r=0;--r)i[r+s+1]=this[r]>>o|h,h=(this[r]&e)<=0;--r)i[r]=0;i[s]=h,i.t=this.t+s+1,i.s=this.s,i.clamp()}function bnpRShiftTo(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return void(i.t=0);var n=t%this.DB,o=this.DB-n,e=(1<>n;for(var s=r+1;s>n;n>0&&(i[this.t-r-1]|=(this.s&e)<r;)n+=this[r]-t[r],i[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}i.s=0>n?-1:0,-1>n?i[r++]=this.DV+n:n>0&&(i[r++]=n),i.t=r,i.clamp()}function bnpMultiplyTo(t,i){var r=this.abs(),n=t.abs(),o=r.t;for(i.t=o+n.t;--o>=0;)i[o]=0;for(o=0;o=0;)t[r]=0;for(r=0;r=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()}function bnpDivRemTo(t,i,r){var n=t.abs();if(!(n.t<=0)){var o=this.abs();if(o.t0?(n.lShiftTo(p,e),o.lShiftTo(p,r)):(n.copyTo(e),o.copyTo(r));var u=e.t,a=e[u-1];if(0!=a){var f=a*(1<1?e[u-2]>>this.F2:0),g=this.FV/f,b=(1<=0&&(r[r.t++]=1,r.subTo(v,r)),BigInteger.ONE.dlShiftTo(u,v),v.subTo(e,e);e.t=0;){var B=r[--m]==a?this.DM:Math.floor(r[m]*g+(r[m-1]+l)*b);if((r[m]+=e.am(0,B,r,c,0,u))0&&r.rShiftTo(p,r),0>s&&BigInteger.ZERO.subTo(r,r)}}}function bnMod(t){var i=nbi();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(BigInteger.ZERO)>0&&t.subTo(i,i),i}function Classic(t){this.m=t}function cConvert(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function cRevert(t){return t}function cReduce(t){t.divRemTo(this.m,null,t)}function cMulTo(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function cSqrTo(t,i){t.squareTo(i),this.reduce(i)}function bnpInvDigit(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var i=3&t;return i=i*(2-(15&t)*i)&15,i=i*(2-(255&t)*i)&255,i=i*(2-((65535&t)*i&65535))&65535,i=i*(2-t*i%this.DV)%this.DV,i>0?this.DV-i:-i}function Montgomery(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(i,i),i}function montRevert(t){var i=nbi();return t.copyTo(i),this.reduce(i),i}function montReduce(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var i=0;i>15)*this.mpl&this.um)<<15)&t.DM;for(r=i+this.m.t,t[r]+=this.m.am(0,n,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)}function montSqrTo(t,i){t.squareTo(i),this.reduce(i)}function montMulTo(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function bnpIsEven(){return 0==(this.t>0?1&this[0]:this.s)}function bnpExp(t,i){if(t>4294967295||1>t)return BigInteger.ONE;var r=nbi(),n=nbi(),o=i.convert(this),e=nbits(t)-1;for(o.copyTo(r);--e>=0;)if(i.sqrTo(r,n),(t&1<0)i.mulTo(n,o,r);else{var s=r;r=n,n=s}return i.revert(r)}function bnModPowInt(t,i){var r;return r=256>t||i.isEven()?new Classic(i):new Montgomery(i),this.exp(t,r)}function bnClone(){var t=nbi();return this.copyTo(t),t}function bnIntValue(){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)<>24}function bnShortValue(){return 0==this.t?this.s:this[0]<<16>>16}function bnpChunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function bnSigNum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function bnpToRadix(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),n=nbv(r),o=nbi(),e=nbi(),s="";for(this.divRemTo(n,o,e);o.signum()>0;)s=(r+e.intValue()).toString(t).substr(1)+s,o.divRemTo(n,o,e);return e.intValue().toString(t)+s}function bnpFromRadix(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),n=Math.pow(i,r),o=!1,e=0,s=0,h=0;hp?"-"==t.charAt(h)&&0==this.signum()&&(o=!0):(s=i*s+p,++e>=r&&(this.dMultiply(n),this.dAddOffset(s,0),e=0,s=0))}e>0&&(this.dMultiply(Math.pow(i,e)),this.dAddOffset(s,0)),o&&BigInteger.ZERO.subTo(this,this)}function bnpFromNumber(t,i,r){if("number"==typeof i)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(BigInteger.ONE.shiftLeft(t-1),op_or,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(BigInteger.ONE.shiftLeft(t-1),this);else{var n=new Array,o=7&t;n.length=(t>>3)+1,i.nextBytes(n),o>0?n[0]&=(1<0)for(o>o)!=(this.s&this.DM)>>o&&(r[e++]=n|this.s<=0;)8>o?(n=(this[i]&(1<>(o+=this.DB-8)):(n=this[i]>>(o-=8)&255,0>=o&&(o+=this.DB,--i)),t&&0!=(128&n)&&(n|=-256),0==e&&(128&this.s)!=(128&n)&&++e,(e>0||n!=this.s)&&(r[e++]=n);return r}function bnEquals(t){return 0==this.compareTo(t)}function bnMin(t){return this.compareTo(t)<0?this:t}function bnMax(t){return this.compareTo(t)>0?this:t}function bnpBitwiseTo(t,i,r){var n,o,e=Math.min(t.t,this.t);for(n=0;e>n;++n)r[n]=i(this[n],t[n]);if(t.tt?this.rShiftTo(-t,i):this.lShiftTo(t,i),i}function bnShiftRight(t){var i=nbi();return 0>t?this.lShiftTo(-t,i):this.rShiftTo(t,i),i}function lbit(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 bnGetLowestSetBit(){for(var t=0;t=this.t?0!=this.s:0!=(this[i]&1<r;)n+=this[r]+t[r],i[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}i.s=0>n?-1:0,n>0?i[r++]=n:-1>n&&(i[r++]=this.DV+n),i.t=r,i.clamp()}function bnAdd(t){var i=nbi();return this.addTo(t,i),i}function bnSubtract(t){var i=nbi();return this.subTo(t,i),i}function bnMultiply(t){var i=nbi();return this.multiplyTo(t,i),i}function bnSquare(){var t=nbi();return this.squareTo(t),t}function bnDivide(t){var i=nbi();return this.divRemTo(t,i,null),i}function bnRemainder(t){var i=nbi();return this.divRemTo(t,null,i),i}function bnDivideAndRemainder(t){var i=nbi(),r=nbi();return this.divRemTo(t,i,r),new Array(i,r)}function bnpDMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function bnpDAddOffset(t,i){if(0!=t){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]}}function NullExp(){}function nNop(t){return t}function nMulTo(t,i,r){t.multiplyTo(i,r)}function nSqrTo(t,i){t.squareTo(i)}function bnPow(t){return this.exp(t,new NullExp)}function bnpMultiplyLowerTo(t,i,r){var n=Math.min(this.t+t.t,i);for(r.s=0,r.t=n;n>0;)r[--n]=0;var o;for(o=r.t-this.t;o>n;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(o=Math.min(t.t,i);o>n;++n)this.am(0,t[n],r,n,0,i-n);r.clamp()}function bnpMultiplyUpperTo(t,i,r){--i;var n=r.t=this.t+t.t-i;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(i-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=nbi();return t.copyTo(i),this.reduce(i),i}function barrettRevert(t){return t}function barrettReduce(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)}function barrettSqrTo(t,i){t.squareTo(i),this.reduce(i)}function barrettMulTo(t,i,r){t.multiplyTo(i,r),this.reduce(r)}function bnModPow(t,i){var r,n,o=t.bitLength(),e=nbv(1);if(0>=o)return e;r=18>o?1:48>o?3:144>o?4:768>o?5:6,n=8>o?new Classic(i):i.isEven()?new Barrett(i):new Montgomery(i);var s=new Array,h=3,p=r-1,u=(1<1){var a=nbi();for(n.sqrTo(s[1],a);u>=h;)s[h]=nbi(),n.mulTo(a,s[h-2],s[h]),h+=2}var f,g,b=t.t-1,l=!0,m=nbi();for(o=nbits(t[b])-1;b>=0;){for(o>=p?f=t[b]>>o-p&u:(f=(t[b]&(1<0&&(f|=t[b-1]>>this.DB+o-p)),h=r;0==(1&f);)f>>=1,--h;if((o-=h)<0&&(o+=this.DB,--b),l)s[f].copyTo(e),l=!1;else{for(;h>1;)n.sqrTo(e,m),n.sqrTo(m,e),h-=2;h>0?n.sqrTo(e,m):(g=e,e=m,m=g),n.mulTo(m,s[f],e)}for(;b>=0&&0==(t[b]&1<e)return i;for(e>o&&(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}function bnpModInt(t){if(0>=t)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 n=this.t-1;n>=0;--n)r=(i*r+this[n])%t;return r}function bnModInverse(t){var i=t.isEven();if(this.isEven()&&i||0==t.signum())return BigInteger.ZERO;for(var r=t.clone(),n=this.clone(),o=nbv(1),e=nbv(0),s=nbv(0),h=nbv(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),i?(o.isEven()&&e.isEven()||(o.addTo(this,o),e.subTo(t,e)),o.rShiftTo(1,o)):e.isEven()||e.subTo(t,e),e.rShiftTo(1,e);for(;n.isEven();)n.rShiftTo(1,n),i?(s.isEven()&&h.isEven()||(s.addTo(this,s),h.subTo(t,h)),s.rShiftTo(1,s)):h.isEven()||h.subTo(t,h),h.rShiftTo(1,h);r.compareTo(n)>=0?(r.subTo(n,r),i&&o.subTo(s,o),e.subTo(h,e)):(n.subTo(r,n),i&&s.subTo(o,s),h.subTo(e,h))}return 0!=n.compareTo(BigInteger.ONE)?BigInteger.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h}function bnIsProbablePrime(t){var i,r=this.abs();if(1==r.t&&r[0]<=lowprimes[lowprimes.length-1]){for(i=0;in;)n*=lowprimes[o++];for(n=r.modInt(n);o>i;)if(n%lowprimes[i++]==0)return!1}return r.millerRabin(t)}function bnpMillerRabin(t){var i=this.subtract(BigInteger.ONE),r=i.getLowestSetBit();if(0>=r)return!1;var n=i.shiftRight(r);t=t+1>>1,t>lowprimes.length&&(t=lowprimes.length);for(var o=nbi(),e=0;t>e;++e){o.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(BigInteger.ONE)&&0!=s.compareTo(i)){for(var h=1;h++>8&255,rng_pool[rng_pptr++]^=t>>16&255,rng_pool[rng_pptr++]^=t>>24&255,rng_pptr>=rng_psize&&(rng_pptr-=rng_psize)}function rng_seed_time(){rng_seed_int((new Date).getTime())}function rng_get_byte(){if(null==rng_state){for(rng_seed_time(),rng_state=prng_newstate(),rng_state.init(rng_pool),rng_pptr=0;rng_pptri;++i)this.S[i]=i;for(r=0,i=0;256>i;++i)r=r+this.S[i]+t[i%t.length]&255,n=this.S[i],this.S[i]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function ARC4next(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function prng_newstate(){return new Arcfour}var dbits,canary=0xdeadbeefcafe,j_lm=15715070==(16777215&canary);j_lm&&"Microsoft Internet Explorer"==navigator.appName?(BigInteger.prototype.am=am2,dbits=30):j_lm&&"Netscape"!=navigator.appName?(BigInteger.prototype.am=am1,dbits=26):(BigInteger.prototype.am=am3,dbits=28),BigInteger.prototype.DB=dbits,BigInteger.prototype.DM=(1<=vv;++vv)BI_RC[rr++]=vv;for(rr="a".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;for(rr="A".charCodeAt(0),vv=10;36>vv;++vv)BI_RC[rr++]=vv;Classic.prototype.convert=cConvert,Classic.prototype.revert=cRevert,Classic.prototype.reduce=cReduce,Classic.prototype.mulTo=cMulTo,Classic.prototype.sqrTo=cSqrTo,Montgomery.prototype.convert=montConvert,Montgomery.prototype.revert=montRevert,Montgomery.prototype.reduce=montReduce,Montgomery.prototype.mulTo=montMulTo,Montgomery.prototype.sqrTo=montSqrTo,BigInteger.prototype.copyTo=bnpCopyTo,BigInteger.prototype.fromInt=bnpFromInt,BigInteger.prototype.fromString=bnpFromString,BigInteger.prototype.clamp=bnpClamp,BigInteger.prototype.dlShiftTo=bnpDLShiftTo,BigInteger.prototype.drShiftTo=bnpDRShiftTo,BigInteger.prototype.lShiftTo=bnpLShiftTo,BigInteger.prototype.rShiftTo=bnpRShiftTo,BigInteger.prototype.subTo=bnpSubTo,BigInteger.prototype.multiplyTo=bnpMultiplyTo,BigInteger.prototype.squareTo=bnpSquareTo,BigInteger.prototype.divRemTo=bnpDivRemTo,BigInteger.prototype.invDigit=bnpInvDigit,BigInteger.prototype.isEven=bnpIsEven,BigInteger.prototype.exp=bnpExp,BigInteger.prototype.toString=bnToString,BigInteger.prototype.negate=bnNegate,BigInteger.prototype.abs=bnAbs,BigInteger.prototype.compareTo=bnCompareTo,BigInteger.prototype.bitLength=bnBitLength,BigInteger.prototype.mod=bnMod,BigInteger.prototype.modPowInt=bnModPowInt,BigInteger.ZERO=nbv(0),BigInteger.ONE=nbv(1),NullExp.prototype.convert=nNop,NullExp.prototype.revert=nNop,NullExp.prototype.mulTo=nMulTo,NullExp.prototype.sqrTo=nSqrTo,Barrett.prototype.convert=barrettConvert,Barrett.prototype.revert=barrettRevert,Barrett.prototype.reduce=barrettReduce,Barrett.prototype.mulTo=barrettMulTo,Barrett.prototype.sqrTo=barrettSqrTo;var lowprimes=[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,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],lplim=(1<<26)/lowprimes[lowprimes.length-1];BigInteger.prototype.chunkSize=bnpChunkSize,BigInteger.prototype.toRadix=bnpToRadix,BigInteger.prototype.fromRadix=bnpFromRadix,BigInteger.prototype.fromNumber=bnpFromNumber,BigInteger.prototype.bitwiseTo=bnpBitwiseTo,BigInteger.prototype.changeBit=bnpChangeBit,BigInteger.prototype.addTo=bnpAddTo,BigInteger.prototype.dMultiply=bnpDMultiply,BigInteger.prototype.dAddOffset=bnpDAddOffset,BigInteger.prototype.multiplyLowerTo=bnpMultiplyLowerTo,BigInteger.prototype.multiplyUpperTo=bnpMultiplyUpperTo,BigInteger.prototype.modInt=bnpModInt,BigInteger.prototype.millerRabin=bnpMillerRabin,BigInteger.prototype.clone=bnClone,BigInteger.prototype.intValue=bnIntValue,BigInteger.prototype.byteValue=bnByteValue,BigInteger.prototype.shortValue=bnShortValue,BigInteger.prototype.signum=bnSigNum,BigInteger.prototype.toByteArray=bnToByteArray,BigInteger.prototype.equals=bnEquals,BigInteger.prototype.min=bnMin,BigInteger.prototype.max=bnMax,BigInteger.prototype.and=bnAnd,BigInteger.prototype.or=bnOr,BigInteger.prototype.xor=bnXor,BigInteger.prototype.andNot=bnAndNot,BigInteger.prototype.not=bnNot,BigInteger.prototype.shiftLeft=bnShiftLeft,BigInteger.prototype.shiftRight=bnShiftRight,BigInteger.prototype.getLowestSetBit=bnGetLowestSetBit,BigInteger.prototype.bitCount=bnBitCount,BigInteger.prototype.testBit=bnTestBit,BigInteger.prototype.setBit=bnSetBit,BigInteger.prototype.clearBit=bnClearBit,BigInteger.prototype.flipBit=bnFlipBit,BigInteger.prototype.add=bnAdd,BigInteger.prototype.subtract=bnSubtract,BigInteger.prototype.multiply=bnMultiply,BigInteger.prototype.divide=bnDivide,BigInteger.prototype.remainder=bnRemainder,BigInteger.prototype.divideAndRemainder=bnDivideAndRemainder,BigInteger.prototype.modPow=bnModPow,BigInteger.prototype.modInverse=bnModInverse,BigInteger.prototype.pow=bnPow,BigInteger.prototype.gcd=bnGCD,BigInteger.prototype.isProbablePrime=bnIsProbablePrime,BigInteger.prototype.square=bnSquare;var rng_state,rng_pool,rng_pptr;if(null==rng_pool){rng_pool=new Array,rng_pptr=0;var global="undefined"!=typeof window?window:this,t;if(global&&global.crypto&&global.crypto.getRandomValues){var ua=new Uint8Array(32);for(global.crypto.getRandomValues(ua),t=0;32>t;++t)rng_pool[rng_pptr++]=ua[t]}if("Netscape"==navigator.appName&&navigator.appVersion<"5"&&global&&global.crypto){var z=global.crypto.random(32);for(t=0;trng_pptr;)t=Math.floor(65536*Math.random()),rng_pool[rng_pptr++]=t>>>8,rng_pool[rng_pptr++]=255&t;rng_pptr=0,rng_seed_time()}SecureRandom.prototype.nextBytes=rng_get_bytes,Arcfour.prototype.init=ARC4init,Arcfour.prototype.next=ARC4next;var rng_psize=256; var CryptoJS=CryptoJS||function(t,e){var r={},i=r.lib={},n=i.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=i.WordArray=n.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;n>o;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else if(r.length>65535)for(var o=0;n>o;o+=4)e[i+o>>>2]=r[o>>>2];else for(var o=0;o>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],i=0;e>i;i+=4)r.push(4294967296*t.random()|0);return new o.init(r,e)}}),s=r.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;r>n;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;e>i;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new o.init(r,e/2)}},a=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;r>n;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;e>i;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new o.init(r,e)}},f=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(a.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return a.parse(unescape(encodeURIComponent(t)))}},h=i.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,i=r.words,n=r.sigBytes,s=this.blockSize,c=4*s,a=n/c;a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0);var f=a*s,h=t.min(4*f,n);if(f){for(var u=0;f>u;u+=s)this._doProcessBlock(i,u);var p=i.splice(0,f);r.sigBytes-=h}return new o.init(p,h)},clone:function(){var t=n.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),u=(i.Hasher=h.extend({cfg:n.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new u.HMAC.init(t,r).finalize(e)}}}),r.algo={});return r}(Math);CryptoJS.lib.Cipher||function(t){var e=CryptoJS,r=e.lib,i=r.Base,n=r.WordArray,o=r.BufferedBlockAlgorithm,s=e.enc,c=(s.Utf8,s.Base64),a=e.algo,f=a.EvpKDF,h=r.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?x:k}return function(e){return{encrypt:function(r,i,n){return t(i).encrypt(e,r,i,n)},decrypt:function(r,i,n){return t(i).decrypt(e,r,i,n)}}}}()}),u=(r.StreamCipher=h.extend({_doFinalize:function(){var t=this._process(!0);return t},blockSize:1}),e.mode={}),p=r.BlockCipherMode=i.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),l=u.CBC=function(){function e(e,r,i){var n=this._iv;if(n){var o=n;this._iv=t}else var o=this._prevBlock;for(var s=0;i>s;s++)e[r+s]^=o[s]}var r=p.extend();return r.Encryptor=r.extend({processBlock:function(t,r){var i=this._cipher,n=i.blockSize;e.call(this,t,r,n),i.encryptBlock(t,r),this._prevBlock=t.slice(r,r+n)}}),r.Decryptor=r.extend({processBlock:function(t,r){var i=this._cipher,n=i.blockSize,o=t.slice(r,r+n);i.decryptBlock(t,r),e.call(this,t,r,n),this._prevBlock=o}}),r}(),d=(u.IGE=function(){function e(t,e,r,i){for(var n=0;i>n;n++)t[r+n]^=e[n]}var r=p.extend();return r.Encryptor=r.extend({processBlock:function(r,i){var n=this._cipher,o=n.blockSize;this._ivp===t&&(this._ivp=this._iv.slice(0,o),this._iv2p=this._iv.slice(o,o+o));var s=r.slice(i,i+o);e(r,this._ivp,i,o),n.encryptBlock(r,i),e(r,this._iv2p,i,o),this._ivp=r.slice(i,i+o),this._iv2p=s}}),r.Decryptor=r.extend({processBlock:function(r,i){var n=this._cipher,o=n.blockSize;this._ivp===t&&(this._ivp=this._iv.slice(0,o),this._iv2p=this._iv.slice(o,2*o));var s=r.slice(i,i+o);e(r,this._iv2p,i,o),n.decryptBlock(r,i),e(r,this._ivp,i,o),this._ivp=s,this._iv2p=r.slice(i,i+o)}}),r}(),e.pad={}),v=d.Pkcs7={pad:function(t,e){for(var r=4*e,i=r-t.sigBytes%r,o=i<<24|i<<16|i<<8|i,s=[],c=0;i>c;c+=4)s.push(o);var a=n.create(s,i);t.concat(a)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},y=(d.NoPadding={pad:function(){},unpad:function(){}},r.BlockCipher=h.extend({cfg:h.cfg.extend({mode:l,padding:v}),reset:function(){h.reset.call(this);var t=this.cfg,e=t.iv,r=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var i=r.createEncryptor;else{var i=r.createDecryptor;this._minBufferSize=1}this._mode=i.call(r,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else{var e=this._process(!0);t.unpad(e)}return e},blockSize:4}),r.CipherParams=i.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),_=e.format={},g=_.OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;if(r)var i=n.create([1398893684,1701076831]).concat(r).concat(e);else var i=e;return i.toString(c)},parse:function(t){var e=c.parse(t),r=e.words;if(1398893684==r[0]&&1701076831==r[1]){var i=n.create(r.slice(2,4));r.splice(0,4),e.sigBytes-=16}return y.create({ciphertext:e,salt:i})}},k=r.SerializableCipher=i.extend({cfg:i.extend({format:g}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=t.createEncryptor(r,i),o=n.finalize(e),s=n.cfg;return y.create({ciphertext:o,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,r,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=t.createDecryptor(r,i).finalize(e.ciphertext);return n},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),B=e.kdf={},S=B.OpenSSL={execute:function(t,e,r,i){i||(i=n.random(8));var o=f.create({keySize:e+r}).compute(t,i),s=n.create(o.words.slice(e),4*r);return o.sigBytes=4*e,y.create({key:o,iv:s,salt:i})}},x=r.PasswordBasedCipher=k.extend({cfg:k.cfg.extend({kdf:S}),encrypt:function(t,e,r,i){i=this.cfg.extend(i);var n=i.kdf.execute(r,t.keySize,t.ivSize);i.iv=n.iv;var o=k.encrypt.call(this,t,e,n.key,i);return o.mixIn(n),o},decrypt:function(t,e,r,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var n=i.kdf.execute(r,t.keySize,t.ivSize,e.salt);i.iv=n.iv;var o=k.decrypt.call(this,t,e,n.key,i);return o}})}(),function(){var t=CryptoJS,e=t.lib,r=e.BlockCipher,i=t.algo,n=[],o=[],s=[],c=[],a=[],f=[],h=[],u=[],p=[],l=[];!function(){for(var t=[],e=0;256>e;e++)t[e]=128>e?e<<1:e<<1^283;for(var r=0,i=0,e=0;256>e;e++){var d=i^i<<1^i<<2^i<<3^i<<4;d=d>>>8^255&d^99,n[r]=d,o[d]=r;var v=t[r],y=t[v],_=t[y],g=257*t[d]^16843008*d;s[r]=g<<24|g>>>8,c[r]=g<<16|g>>>16,a[r]=g<<8|g>>>24,f[r]=g;var g=16843009*_^65537*y^257*v^16843008*r;h[d]=g<<24|g>>>8,u[d]=g<<16|g>>>16,p[d]=g<<8|g>>>24,l[d]=g,r?(r=v^t[t[t[_^v]]],i^=t[t[i]]):r=i=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=r.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes/4,i=this._nRounds=r+6,o=4*(i+1),s=this._keySchedule=[],c=0;o>c;c++)if(r>c)s[c]=e[c];else{var a=s[c-1];c%r?r>6&&c%r==4&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=a<<8|a>>>24,a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=d[c/r|0]<<24),s[c]=s[c-r]^a}for(var f=this._invKeySchedule=[],v=0;o>v;v++){var c=o-v;if(v%4)var a=s[c];else var a=s[c-4];f[v]=4>v||4>=c?a:h[n[a>>>24]]^u[n[a>>>16&255]]^p[n[a>>>8&255]]^l[n[255&a]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,c,a,f,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,h,u,p,l,o);var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,i,n,o,s,c){for(var a=this._nRounds,f=t[e]^r[0],h=t[e+1]^r[1],u=t[e+2]^r[2],p=t[e+3]^r[3],l=4,d=1;a>d;d++){var v=i[f>>>24]^n[h>>>16&255]^o[u>>>8&255]^s[255&p]^r[l++],y=i[h>>>24]^n[u>>>16&255]^o[p>>>8&255]^s[255&f]^r[l++],_=i[u>>>24]^n[p>>>16&255]^o[f>>>8&255]^s[255&h]^r[l++],g=i[p>>>24]^n[f>>>16&255]^o[h>>>8&255]^s[255&u]^r[l++];f=v,h=y,u=_,p=g}var v=(c[f>>>24]<<24|c[h>>>16&255]<<16|c[u>>>8&255]<<8|c[255&p])^r[l++],y=(c[h>>>24]<<24|c[u>>>16&255]<<16|c[p>>>8&255]<<8|c[255&f])^r[l++],_=(c[u>>>24]<<24|c[p>>>16&255]<<16|c[f>>>8&255]<<8|c[255&h])^r[l++],g=(c[p>>>24]<<24|c[f>>>16&255]<<16|c[h>>>8&255]<<8|c[255&u])^r[l++];t[e]=v,t[e+1]=y,t[e+2]=_,t[e+3]=g},keySize:8});t.AES=r._createHelper(v)}();var sha1;!function(t){function e(t){for(var e,r="",i=7;i>=0;--i)e=t>>>(i<<2)&15,r+=e.toString(16);return r}function r(t){for(var e,r=[],i=3;i>=0;--i)e=t>>8*i&255,r.push(e);return r}function i(t,e){return t<>>32-e}function n(t){t=t.replace(/[\u0080-\u07ff]/g,function(t){var e=t.charCodeAt(0);return String.fromCharCode(192|e>>6,128|63&e)}),t=t.replace(/[\u0080-\uffff]/g,function(t){var e=t.charCodeAt(0);return String.fromCharCode(224|e>>12,128|e>>6&63,128|63&e)});for(var e=t.length,r=new Uint8Array(e),i=0;e>i;++i)r[i]=t.charCodeAt(i);return r.buffer}function o(t){for(var e=t.length,r=new Uint8Array(e),i=0;e>i;++i)r[i]=t[i];return r.buffer}function s(t,s){var c;c=t instanceof ArrayBuffer?t:"[object Array]"==Object.prototype.toString.apply(t)?o(t):n(String(t));var h,u,p=1732584193,l=4023233417,d=2562383102,v=271733878,y=3285377520,_=c.byteLength,g=_<<3,k=g+65,B=Math.ceil(k/512)<<9,S=B>>>3,x=S>>>2,m=new f(x),C=m.bytes,w=new Uint32Array(80),z=new Uint8Array(c);for(h=0;_>h;++h)C[h]=z[h];for(C[_]=128,m.set(x-2,Math.floor(g/a)),m.set(x-1,4294967295&g),h=0;x>h;h+=16){for(u=0;16>u;++u)w[u]=m.get(h+u);for(;80>u;++u)w[u]=i(w[u-3]^w[u-8]^w[u-14]^w[u-16],1);var b,E,M,A=p,D=l,O=d,R=v,F=y;for(u=0;80>u;++u)20>u?(b=D&O|~D&R,E=1518500249):40>u?(b=D^O^R,E=1859775393):60>u?(b=D&O^D&R^O&R,E=2400959708):(b=D^O^R,E=3395469782),M=i(A,5)+b+F+E+w[u]&4294967295,F=R,R=O,O=i(D,30),D=A,A=M;p=p+A&4294967295,l=l+D&4294967295,d=d+O&4294967295,v=v+R&4294967295,y=y+F&4294967295}return s?r(p).concat(r(l),r(d),r(v),r(y)):e(p)+e(l)+e(d)+e(v)+e(y)}var c=Math.pow(2,24),a=Math.pow(2,32),f=function(){function t(t){this.bytes=new Uint8Array(t<<2)}return t.prototype.get=function(t){return t<<=2,this.bytes[t]*c+(this.bytes[t+1]<<16|this.bytes[t+2]<<8|this.bytes[t+3])},t.prototype.set=function(t,e){var r=Math.floor(e/c),i=e-r*c;t<<=2,this.bytes[t]=r,this.bytes[t+1]=i>>16,this.bytes[t+2]=i>>8&255,this.bytes[t+3]=255&i},t}();t.hash=s}(sha1||(sha1={})); (function(){"use strict";function t(t){throw t}function r(t,r){var e=t.split("."),i=c;!(e[0]in i)&&i.execScript&&i.execScript("var "+e[0]);for(var n;e.length&&(n=e.shift());)e.length||r===f?i=i[n]?i[n]:i[n]={}:i[n]=r}function e(t,r,e){var i,n="number"==typeof r?r:r=0,s="number"==typeof e?e:t.length;for(i=-1,n=7&s;n--;++r)i=i>>>8^g[255&(i^t[r])];for(n=s>>3;n--;r+=8)i=i>>>8^g[255&(i^t[r])],i=i>>>8^g[255&(i^t[r+1])],i=i>>>8^g[255&(i^t[r+2])],i=i>>>8^g[255&(i^t[r+3])],i=i>>>8^g[255&(i^t[r+4])],i=i>>>8^g[255&(i^t[r+5])],i=i>>>8^g[255&(i^t[r+6])],i=i>>>8^g[255&(i^t[r+7])];return(4294967295^i)>>>0}function i(){}function n(t){var r,e,i,n,s,a,h,o,u,f=t.length,c=0,p=Number.POSITIVE_INFINITY;for(o=0;f>o;++o)t[o]>c&&(c=t[o]),t[o]=i;){for(o=0;f>o;++o)if(t[o]===i){for(a=0,h=n,u=0;i>u;++u)a=a<<1|1&h,h>>=1;for(u=a;r>u;u+=s)e[u]=i<<16|o;++n}++i,n<<=1,s<<=1}return[e,c,p]}function s(r,e){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=l?new Uint8Array(r):r,this.o=!1,this.k=k,this.w=!1,(e||!(e={}))&&(e.index&&(this.c=e.index),e.bufferSize&&(this.j=e.bufferSize),e.bufferType&&(this.k=e.bufferType),e.resize&&(this.w=e.resize)),this.k){case m:this.a=32768,this.b=new(l?Uint8Array:Array)(32768+this.j+258);break;case k:this.a=0,this.b=new(l?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:t(Error("invalid inflate mode"))}}function a(r,e){for(var i,n=r.f,s=r.d,a=r.input,h=r.c;e>s;)i=a[h++],i===f&&t(Error("input buffer is broken")),n|=i<>>e,r.d=s-e,r.c=h,i}function h(t,r){for(var e,i,n,s=t.f,a=t.d,h=t.input,o=t.c,u=r[0],c=r[1];c>a&&(e=h[o++],e!==f);)s|=e<>>16,t.f=s>>n,t.d=a-n,t.c=o,65535&i}function o(t){function r(t,r,e){var i,n,s,o;for(o=0;t>o;)switch(i=h(this,r)){case 16:for(s=3+a(this,2);s--;)e[o++]=n;break;case 17:for(s=3+a(this,3);s--;)e[o++]=0;n=0;break;case 18:for(s=11+a(this,7);s--;)e[o++]=0;n=0;break;default:n=e[o++]=i}return e}var e,i,s,o,u=a(t,5)+257,f=a(t,5)+1,c=a(t,4)+4,p=new(l?Uint8Array:Array)(N.length);for(o=0;c>o;++o)p[N[o]]=a(t,3);e=n(p),i=new(l?Uint8Array:Array)(u),s=new(l?Uint8Array:Array)(f),t.l(n(r.call(t,u,e,i)),n(r.call(t,f,e,s)))}function u(t){this.input=t,this.c=0,this.m=[],this.s=!1}var f=void 0,c=this,l="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;new(l?Uint8Array:Array)(256);var p;for(p=0;256>p;++p)for(var y=p,b=7,y=y>>>1;y;y>>>=1)--b;var d=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],g=l?new Uint32Array(d):d;i.prototype.getName=function(){return this.name},i.prototype.getData=function(){return this.data},i.prototype.G=function(){return this.H},r("Zlib.GunzipMember",i),r("Zlib.GunzipMember.prototype.getName",i.prototype.getName),r("Zlib.GunzipMember.prototype.getData",i.prototype.getData),r("Zlib.GunzipMember.prototype.getMtime",i.prototype.G);var v,A=[];for(v=0;288>v;v++)switch(!0){case 143>=v:A.push([v+48,8]);break;case 255>=v:A.push([v-144+400,9]);break;case 279>=v:A.push([v-256+0,7]);break;case 287>=v:A.push([v-280+192,8]);break;default:t("invalid literal: "+v)}var w=function(){function r(r){switch(!0){case 3===r:return[257,r-3,0];case 4===r:return[258,r-4,0];case 5===r:return[259,r-5,0];case 6===r:return[260,r-6,0];case 7===r:return[261,r-7,0];case 8===r:return[262,r-8,0];case 9===r:return[263,r-9,0];case 10===r:return[264,r-10,0];case 12>=r:return[265,r-11,1];case 14>=r:return[266,r-13,1];case 16>=r:return[267,r-15,1];case 18>=r:return[268,r-17,1];case 22>=r:return[269,r-19,2];case 26>=r:return[270,r-23,2];case 30>=r:return[271,r-27,2];case 34>=r:return[272,r-31,2];case 42>=r:return[273,r-35,3];case 50>=r:return[274,r-43,3];case 58>=r:return[275,r-51,3];case 66>=r:return[276,r-59,3];case 82>=r:return[277,r-67,4];case 98>=r:return[278,r-83,4];case 114>=r:return[279,r-99,4];case 130>=r:return[280,r-115,4];case 162>=r:return[281,r-131,5];case 194>=r:return[282,r-163,5];case 226>=r:return[283,r-195,5];case 257>=r:return[284,r-227,5];case 258===r:return[285,r-258,0];default:t("invalid length: "+r)}}var e,i,n=[];for(e=3;258>=e;e++)i=r(e),n[e]=i[2]<<24|i[1]<<16|i[0];return n}();l&&new Uint32Array(w);var m=0,k=1;s.prototype.g=function(){for(;!this.o;){var r=a(this,3);switch(1&r&&(this.o=!0),r>>>=1){case 0:var e=this.input,i=this.c,n=this.b,s=this.a,h=f,u=f,c=f,p=n.length,y=f;switch(this.d=this.f=0,h=e[i++],h===f&&t(Error("invalid uncompressed block header: LEN (first byte)")),u=h,h=e[i++],h===f&&t(Error("invalid uncompressed block header: LEN (second byte)")),u|=h<<8,h=e[i++],h===f&&t(Error("invalid uncompressed block header: NLEN (first byte)")),c=h,h=e[i++],h===f&&t(Error("invalid uncompressed block header: NLEN (second byte)")),c|=h<<8,u===~c&&t(Error("invalid uncompressed block header: length verify")),i+u>e.length&&t(Error("input buffer is broken")),this.k){case m:for(;s+u>n.length;){if(y=p-s,u-=y,l)n.set(e.subarray(i,i+y),s),s+=y,i+=y;else for(;y--;)n[s++]=e[i++];this.a=s,n=this.e(),s=this.a}break;case k:for(;s+u>n.length;)n=this.e({t:2});break;default:t(Error("invalid inflate mode"))}if(l)n.set(e.subarray(i,i+u),s),s+=u,i+=u;else for(;u--;)n[s++]=e[i++];this.c=i,this.a=s,this.b=n;break;case 1:this.l(q,F);break;case 2:o(this);break;default:t(Error("unknown BTYPE: "+r))}}return this.q()};var U,E,z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],N=l?new Uint16Array(z):z,S=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],G=l?new Uint16Array(S):S,C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],x=l?new Uint8Array(C):C,I=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],M=l?new Uint16Array(I):I,Z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],j=l?new Uint8Array(Z):Z,D=new(l?Uint8Array:Array)(288);for(U=0,E=D.length;E>U;++U)D[U]=143>=U?8:255>=U?9:279>=U?7:8;var L,T,q=n(D),B=new(l?Uint8Array:Array)(30);for(L=0,T=B.length;T>L;++L)B[L]=5;var F=n(B);s.prototype.l=function(t,r){var e=this.b,i=this.a;this.r=t;for(var n,s,o,u,f=e.length-258;256!==(n=h(this,t));)if(256>n)i>=f&&(this.a=i,e=this.e(),i=this.a),e[i++]=n;else for(s=n-257,u=G[s],0=f&&(this.a=i,e=this.e(),i=this.a);u--;)e[i]=e[i++-o];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},s.prototype.C=function(t,r){var e=this.b,i=this.a;this.r=t;for(var n,s,o,u,f=e.length;256!==(n=h(this,t));)if(256>n)i>=f&&(e=this.e(),f=e.length),e[i++]=n;else for(s=n-257,u=G[s],0f&&(e=this.e(),f=e.length);u--;)e[i]=e[i++-o];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},s.prototype.e=function(){var t,r,e=new(l?Uint8Array:Array)(this.a-32768),i=this.a-32768,n=this.b;if(l)e.set(n.subarray(32768,e.length));else for(t=0,r=e.length;r>t;++t)e[t]=n[t+32768];if(this.i.push(e),this.n+=e.length,l)n.set(n.subarray(i,i+32768));else for(t=0;32768>t;++t)n[t]=n[i+t];return this.a=32768,n},s.prototype.D=function(t){var r,e,i,n,s=this.input.length/this.c+1|0,a=this.input,h=this.b;return t&&("number"==typeof t.t&&(s=t.t),"number"==typeof t.z&&(s+=t.z)),2>s?(e=(a.length-this.c)/this.r[2],n=258*(e/2)|0,i=nr;++r)for(t=h[r],i=0,n=t.length;n>i;++i)o[s++]=t[i];for(r=32768,e=this.a;e>r;++r)o[s++]=a[r];return this.i=[],this.buffer=o},s.prototype.A=function(){var t,r=this.a;return l?this.w?(t=new Uint8Array(r),t.set(this.b.subarray(0,r))):t=this.b.subarray(0,r):(this.b.length>r&&(this.b.length=r),t=this.b),this.buffer=t},u.prototype.F=function(){return this.s||this.g(),this.m.slice()},u.prototype.g=function(){for(var r=this.input.length;this.c>>0,e(o,f,f)!==d&&t(Error("invalid CRC-32 checksum: 0x"+e(o,f,f).toString(16)+" / 0x"+d.toString(16))),n.L=a=(g[v++]|g[v++]<<8|g[v++]<<16|g[v++]<<24)>>>0,(4294967295&o.length)!==a&&t(Error("invalid input size: "+(4294967295&o.length)+" / "+a)),this.m.push(n),this.c=v}this.s=!0;var A,w,m,k=this.m,U=0,E=0;for(A=0,w=k.length;w>A;++A)E+=k[A].data.length;if(l)for(m=new Uint8Array(E),A=0;w>A;++A)m.set(k[A].data,U),U+=k[A].data.length;else{for(m=[],A=0;w>A;++A)m[A]=k[A].data;m=Array.prototype.concat.apply([],m)}return m},r("Zlib.Gunzip",u),r("Zlib.Gunzip.prototype.decompress",u.prototype.g),r("Zlib.Gunzip.prototype.getMembers",u.prototype.F)}).call(this); +this.goog={provide:function(){},math:{}},goog.provide("goog.math.Long"),goog.math.Long=function(o,t){this.low_=0|o,this.high_=0|t},goog.math.Long.IntCache_={},goog.math.Long.fromInt=function(o){if(o>=-128&&128>o){var t=goog.math.Long.IntCache_[o];if(t)return t}var g=new goog.math.Long(0|o,0>o?-1:0);return o>=-128&&128>o&&(goog.math.Long.IntCache_[o]=g),g},goog.math.Long.fromNumber=function(o){return isNaN(o)||!isFinite(o)?goog.math.Long.ZERO:o<=-goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MIN_VALUE:o+1>=goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MAX_VALUE:0>o?goog.math.Long.fromNumber(-o).negate():new goog.math.Long(o%goog.math.Long.TWO_PWR_32_DBL_|0,o/goog.math.Long.TWO_PWR_32_DBL_|0)},goog.math.Long.fromBits=function(o,t){return new goog.math.Long(o,t)},goog.math.Long.fromString=function(o,t){if(0==o.length)throw Error("number format error: empty string");var g=t||10;if(2>g||g>36)throw Error("radix out of range: "+g);if("-"==o.charAt(0))return goog.math.Long.fromString(o.substring(1),g).negate();if(o.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+o);for(var n=goog.math.Long.fromNumber(Math.pow(g,8)),h=goog.math.Long.ZERO,r=0;ri){var e=goog.math.Long.fromNumber(Math.pow(g,i));h=h.multiply(e).add(goog.math.Long.fromNumber(a))}else h=h.multiply(n),h=h.add(goog.math.Long.fromNumber(a))}return h},goog.math.Long.TWO_PWR_16_DBL_=65536,goog.math.Long.TWO_PWR_24_DBL_=1<<24,goog.math.Long.TWO_PWR_32_DBL_=goog.math.Long.TWO_PWR_16_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_31_DBL_=goog.math.Long.TWO_PWR_32_DBL_/2,goog.math.Long.TWO_PWR_48_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_64_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_32_DBL_,goog.math.Long.TWO_PWR_63_DBL_=goog.math.Long.TWO_PWR_64_DBL_/2,goog.math.Long.ZERO=goog.math.Long.fromInt(0),goog.math.Long.ONE=goog.math.Long.fromInt(1),goog.math.Long.NEG_ONE=goog.math.Long.fromInt(-1),goog.math.Long.MAX_VALUE=goog.math.Long.fromBits(-1,2147483647),goog.math.Long.MIN_VALUE=goog.math.Long.fromBits(0,-2147483648),goog.math.Long.TWO_PWR_24_=goog.math.Long.fromInt(1<<24),goog.math.Long.prototype.toInt=function(){return this.low_},goog.math.Long.prototype.toNumber=function(){return this.high_*goog.math.Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},goog.math.Long.prototype.toString=function(o){var t=o||10;if(2>t||t>36)throw Error("radix out of range: "+t);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){var g=goog.math.Long.fromNumber(t),n=this.div(g),h=n.multiply(g).subtract(this);return n.toString(t)+h.toInt().toString(t)}return"-"+this.negate().toString(t)}for(var r=goog.math.Long.fromNumber(Math.pow(t,6)),h=this,i="";;){var a=h.div(r),e=h.subtract(a.multiply(r)).toInt(),m=e.toString(t);if(h=a,h.isZero())return m+i;for(;m.length<6;)m="0"+m;i=""+m+i}},goog.math.Long.prototype.getHighBits=function(){return this.high_},goog.math.Long.prototype.getLowBits=function(){return this.low_},goog.math.Long.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:goog.math.Long.TWO_PWR_32_DBL_+this.low_},goog.math.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(goog.math.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var o=0!=this.high_?this.high_:this.low_,t=31;t>0&&0==(o&1<0},goog.math.Long.prototype.greaterThanOrEqual=function(o){return this.compare(o)>=0},goog.math.Long.prototype.compare=function(o){if(this.equals(o))return 0;var t=this.isNegative(),g=o.isNegative();return t&&!g?-1:!t&&g?1:this.subtract(o).isNegative()?-1:1},goog.math.Long.prototype.negate=function(){return this.equals(goog.math.Long.MIN_VALUE)?goog.math.Long.MIN_VALUE:this.not().add(goog.math.Long.ONE)},goog.math.Long.prototype.add=function(o){var t=this.high_>>>16,g=65535&this.high_,n=this.low_>>>16,h=65535&this.low_,r=o.high_>>>16,i=65535&o.high_,a=o.low_>>>16,e=65535&o.low_,m=0,s=0,_=0,L=0;return L+=h+e,_+=L>>>16,L&=65535,_+=n+a,s+=_>>>16,_&=65535,s+=g+i,m+=s>>>16,s&=65535,m+=t+r,m&=65535,goog.math.Long.fromBits(_<<16|L,m<<16|s)},goog.math.Long.prototype.subtract=function(o){return this.add(o.negate())},goog.math.Long.prototype.multiply=function(o){if(this.isZero())return goog.math.Long.ZERO;if(o.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE))return o.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(o.equals(goog.math.Long.MIN_VALUE))return this.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(this.isNegative())return o.isNegative()?this.negate().multiply(o.negate()):this.negate().multiply(o).negate();if(o.isNegative())return this.multiply(o.negate()).negate();if(this.lessThan(goog.math.Long.TWO_PWR_24_)&&o.lessThan(goog.math.Long.TWO_PWR_24_))return goog.math.Long.fromNumber(this.toNumber()*o.toNumber());var t=this.high_>>>16,g=65535&this.high_,n=this.low_>>>16,h=65535&this.low_,r=o.high_>>>16,i=65535&o.high_,a=o.low_>>>16,e=65535&o.low_,m=0,s=0,_=0,L=0;return L+=h*e,_+=L>>>16,L&=65535,_+=n*e,s+=_>>>16,_&=65535,_+=h*a,s+=_>>>16,_&=65535,s+=g*e,m+=s>>>16,s&=65535,s+=n*a,m+=s>>>16,s&=65535,s+=h*i,m+=s>>>16,s&=65535,m+=t*e+g*a+n*i+h*r,m&=65535,goog.math.Long.fromBits(_<<16|L,m<<16|s)},goog.math.Long.prototype.div=function(o){if(o.isZero())throw Error("division by zero");if(this.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE)){if(o.equals(goog.math.Long.ONE)||o.equals(goog.math.Long.NEG_ONE))return goog.math.Long.MIN_VALUE;if(o.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ONE;var t=this.shiftRight(1),g=t.div(o).shiftLeft(1);if(g.equals(goog.math.Long.ZERO))return o.isNegative()?goog.math.Long.ONE:goog.math.Long.NEG_ONE;var n=this.subtract(o.multiply(g)),h=g.add(n.div(o));return h}if(o.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ZERO;if(this.isNegative())return o.isNegative()?this.negate().div(o.negate()):this.negate().div(o).negate();if(o.isNegative())return this.div(o.negate()).negate();for(var r=goog.math.Long.ZERO,n=this;n.greaterThanOrEqual(o);){for(var g=Math.max(1,Math.floor(n.toNumber()/o.toNumber())),i=Math.ceil(Math.log(g)/Math.LN2),a=48>=i?1:Math.pow(2,i-48),e=goog.math.Long.fromNumber(g),m=e.multiply(o);m.isNegative()||m.greaterThan(n);)g-=a,e=goog.math.Long.fromNumber(g),m=e.multiply(o);e.isZero()&&(e=goog.math.Long.ONE),r=r.add(e),n=n.subtract(m)}return r},goog.math.Long.prototype.modulo=function(o){return this.subtract(this.div(o).multiply(o))},goog.math.Long.prototype.not=function(){return goog.math.Long.fromBits(~this.low_,~this.high_)},goog.math.Long.prototype.and=function(o){return goog.math.Long.fromBits(this.low_&o.low_,this.high_&o.high_)},goog.math.Long.prototype.or=function(o){return goog.math.Long.fromBits(this.low_|o.low_,this.high_|o.high_)},goog.math.Long.prototype.xor=function(o){return goog.math.Long.fromBits(this.low_^o.low_,this.high_^o.high_)},goog.math.Long.prototype.shiftLeft=function(o){if(o&=63,0==o)return this;var t=this.low_;if(32>o){var g=this.high_;return goog.math.Long.fromBits(t<>>32-o)}return goog.math.Long.fromBits(0,t<o){var g=this.low_;return goog.math.Long.fromBits(g>>>o|t<<32-o,t>>o)}return goog.math.Long.fromBits(t>>o-32,t>=0?0:-1)},goog.math.Long.prototype.shiftRightUnsigned=function(o){if(o&=63,0==o)return this;var t=this.high_;if(32>o){var g=this.low_;return goog.math.Long.fromBits(g>>>o|t<<32-o,t>>>o)}return 32==o?goog.math.Long.fromBits(t,0):goog.math.Long.fromBits(t>>>o-32,0)}; Config=window.Config||{},Config.Schema=Config.Schema||{},Config.Schema.MTProto={constructors:[{id:"481674261",predicate:"vector",params:[],type:"Vector t"},{id:"85337187",predicate:"resPQ",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"pq",type:"bytes"},{name:"server_public_key_fingerprints",type:"Vector"}],type:"ResPQ"},{id:"-2083955988",predicate:"p_q_inner_data",params:[{name:"pq",type:"bytes"},{name:"p",type:"bytes"},{name:"q",type:"bytes"},{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"new_nonce",type:"int256"}],type:"P_Q_inner_data"},{id:"2043348061",predicate:"server_DH_params_fail",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"new_nonce_hash",type:"int128"}],type:"Server_DH_Params"},{id:"-790100132",predicate:"server_DH_params_ok",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"encrypted_answer",type:"bytes"}],type:"Server_DH_Params"},{id:"-1249309254",predicate:"server_DH_inner_data",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"g",type:"int"},{name:"dh_prime",type:"bytes"},{name:"g_a",type:"bytes"},{name:"server_time",type:"int"}],type:"Server_DH_inner_data"},{id:"1715713620",predicate:"client_DH_inner_data",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"retry_id",type:"long"},{name:"g_b",type:"bytes"}],type:"Client_DH_Inner_Data"},{id:"1003222836",predicate:"dh_gen_ok",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"new_nonce_hash1",type:"int128"}],type:"Set_client_DH_params_answer"},{id:"1188831161",predicate:"dh_gen_retry",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"new_nonce_hash2",type:"int128"}],type:"Set_client_DH_params_answer"},{id:"-1499615742",predicate:"dh_gen_fail",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"new_nonce_hash3",type:"int128"}],type:"Set_client_DH_params_answer"},{id:"-212046591",predicate:"rpc_result",params:[{name:"req_msg_id",type:"long"},{name:"result",type:"Object"}],type:"RpcResult"},{id:"558156313",predicate:"rpc_error",params:[{name:"error_code",type:"int"},{name:"error_message",type:"string"}],type:"RpcError"},{id:"1579864942",predicate:"rpc_answer_unknown",params:[],type:"RpcDropAnswer"},{id:"-847714938",predicate:"rpc_answer_dropped_running",params:[],type:"RpcDropAnswer"},{id:"-1539647305",predicate:"rpc_answer_dropped",params:[{name:"msg_id",type:"long"},{name:"seq_no",type:"int"},{name:"bytes",type:"int"}],type:"RpcDropAnswer"},{id:"155834844",predicate:"future_salt",params:[{name:"valid_since",type:"int"},{name:"valid_until",type:"int"},{name:"salt",type:"long"}],type:"FutureSalt"},{id:"-1370486635",predicate:"future_salts",params:[{name:"req_msg_id",type:"long"},{name:"now",type:"int"},{name:"salts",type:"vector"}],type:"FutureSalts"},{id:"880243653",predicate:"pong",params:[{name:"msg_id",type:"long"},{name:"ping_id",type:"long"}],type:"Pong"},{id:"-501201412",predicate:"destroy_session_ok",params:[{name:"session_id",type:"long"}],type:"DestroySessionRes"},{id:"1658015945",predicate:"destroy_session_none",params:[{name:"session_id",type:"long"}],type:"DestroySessionRes"},{id:"-1631450872",predicate:"new_session_created",params:[{name:"first_msg_id",type:"long"},{name:"unique_id",type:"long"},{name:"server_salt",type:"long"}],type:"NewSession"},{id:"1945237724",predicate:"msg_container",params:[{name:"messages",type:"vector<%Message>"}],type:"MessageContainer"},{id:"1538843921",predicate:"message",params:[{name:"msg_id",type:"long"},{name:"seqno",type:"int"},{name:"bytes",type:"int"},{name:"body",type:"Object"}],type:"Message"},{id:"-530561358",predicate:"msg_copy",params:[{name:"orig_message",type:"Message"}],type:"MessageCopy"},{id:"812830625",predicate:"gzip_packed",params:[{name:"packed_data",type:"bytes"}],type:"Object"},{id:"1658238041",predicate:"msgs_ack",params:[{name:"msg_ids",type:"Vector"}],type:"MsgsAck"},{id:"-1477445615",predicate:"bad_msg_notification",params:[{name:"bad_msg_id",type:"long"},{name:"bad_msg_seqno",type:"int"},{name:"error_code",type:"int"}],type:"BadMsgNotification"},{id:"-307542917",predicate:"bad_server_salt",params:[{name:"bad_msg_id",type:"long"},{name:"bad_msg_seqno",type:"int"},{name:"error_code",type:"int"},{name:"new_server_salt",type:"long"}],type:"BadMsgNotification"},{id:"2105940488",predicate:"msg_resend_req",params:[{name:"msg_ids",type:"Vector"}],type:"MsgResendReq"},{id:"-630588590",predicate:"msgs_state_req",params:[{name:"msg_ids",type:"Vector"}],type:"MsgsStateReq"},{id:"81704317",predicate:"msgs_state_info",params:[{name:"req_msg_id",type:"long"},{name:"info",type:"bytes"}],type:"MsgsStateInfo"},{id:"-1933520591",predicate:"msgs_all_info",params:[{name:"msg_ids",type:"Vector"},{name:"info",type:"bytes"}],type:"MsgsAllInfo"},{id:"661470918",predicate:"msg_detailed_info",params:[{name:"msg_id",type:"long"},{name:"answer_msg_id",type:"long"},{name:"bytes",type:"int"},{name:"status",type:"int"}],type:"MsgDetailedInfo"},{id:"-2137147681",predicate:"msg_new_detailed_info",params:[{name:"answer_msg_id",type:"long"},{name:"bytes",type:"int"},{name:"status",type:"int"}],type:"MsgDetailedInfo"}],methods:[{id:"1615239032",method:"req_pq",params:[{name:"nonce",type:"int128"}],type:"ResPQ"},{id:"-686627650",method:"req_DH_params",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"p",type:"bytes"},{name:"q",type:"bytes"},{name:"public_key_fingerprint",type:"long"},{name:"encrypted_data",type:"bytes"}],type:"Server_DH_Params"},{id:"-184262881",method:"set_client_DH_params",params:[{name:"nonce",type:"int128"},{name:"server_nonce",type:"int128"},{name:"encrypted_data",type:"bytes"}],type:"Set_client_DH_params_answer"},{id:"1491380032",method:"rpc_drop_answer",params:[{name:"req_msg_id",type:"long"}],type:"RpcDropAnswer"},{id:"-1188971260",method:"get_future_salts",params:[{name:"num",type:"int"}],type:"FutureSalts"},{id:"2059302892",method:"ping",params:[{name:"ping_id",type:"long"}],type:"Pong"},{id:"-213746804",method:"ping_delay_disconnect",params:[{name:"ping_id",type:"long"},{name:"disconnect_delay",type:"int"}],type:"Pong"},{id:"-414113498",method:"destroy_session",params:[{name:"session_id",type:"long"}],type:"DestroySessionRes"},{id:"-1835453025",method:"http_wait",params:[{name:"max_delay",type:"int"},{name:"wait_after",type:"int"},{name:"max_wait",type:"int"}],type:"HttpWait"}]},Config.Schema.API={constructors:[{id:"-1132882121",predicate:"boolFalse",params:[],type:"Bool"},{id:"-1720552011",predicate:"boolTrue",params:[],type:"Bool"},{id:"481674261",predicate:"vector",params:[],type:"Vector t"},{id:"-994444869",predicate:"error",params:[{name:"code",type:"int"},{name:"text",type:"string"}],type:"Error"},{id:"1450380236",predicate:"null",params:[],type:"Null"},{id:"2134579434",predicate:"inputPeerEmpty",params:[],type:"InputPeer"},{id:"2107670217",predicate:"inputPeerSelf",params:[],type:"InputPeer"},{id:"270785512",predicate:"inputPeerContact",params:[{name:"user_id",type:"int"}],type:"InputPeer"},{id:"-1690012891",predicate:"inputPeerForeign",params:[{name:"user_id",type:"int"},{name:"access_hash",type:"long"}],type:"InputPeer"},{id:"396093539",predicate:"inputPeerChat",params:[{name:"chat_id",type:"int"}],type:"InputPeer"},{id:"-1182234929",predicate:"inputUserEmpty",params:[],type:"InputUser"},{id:"-138301121",predicate:"inputUserSelf",params:[],type:"InputUser"},{id:"-2031530139",predicate:"inputUserContact",params:[{name:"user_id",type:"int"}],type:"InputUser"},{id:"1700689151",predicate:"inputUserForeign",params:[{name:"user_id",type:"int"},{name:"access_hash",type:"long"}],type:"InputUser"},{id:"-208488460",predicate:"inputPhoneContact",params:[{name:"client_id",type:"long"},{name:"phone",type:"string"},{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"InputContact"},{id:"-181407105",predicate:"inputFile",params:[{name:"id",type:"long"},{name:"parts",type:"int"},{name:"name",type:"string"},{name:"md5_checksum",type:"string"}],type:"InputFile"},{id:"-1771768449",predicate:"inputMediaEmpty",params:[],type:"InputMedia"},{id:"767900285",predicate:"inputMediaUploadedPhoto",params:[{name:"file",type:"InputFile"}],type:"InputMedia"},{id:"-1893027092",predicate:"inputMediaPhoto",params:[{name:"id",type:"InputPhoto"}],type:"InputMedia"},{id:"-104578748",predicate:"inputMediaGeoPoint",params:[{name:"geo_point",type:"InputGeoPoint"}],type:"InputMedia"},{id:"-1494984313",predicate:"inputMediaContact",params:[{name:"phone_number",type:"string"},{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"InputMedia"},{id:"1212668202",predicate:"inputMediaUploadedVideo",params:[{name:"file",type:"InputFile"},{name:"duration",type:"int"},{name:"w",type:"int"},{name:"h",type:"int"}],type:"InputMedia"},{id:"-433544891",predicate:"inputMediaUploadedThumbVideo",params:[{name:"file",type:"InputFile"},{name:"thumb",type:"InputFile"},{name:"duration",type:"int"},{name:"w",type:"int"},{name:"h",type:"int"}],type:"InputMedia"},{id:"2130852582",predicate:"inputMediaVideo",params:[{name:"id",type:"InputVideo"}],type:"InputMedia"},{id:"480546647",predicate:"inputChatPhotoEmpty",params:[],type:"InputChatPhoto"},{id:"-1809496270",predicate:"inputChatUploadedPhoto",params:[{name:"file",type:"InputFile"},{name:"crop",type:"InputPhotoCrop"}],type:"InputChatPhoto"},{id:"-1293828344",predicate:"inputChatPhoto",params:[{name:"id",type:"InputPhoto"},{name:"crop",type:"InputPhotoCrop"}],type:"InputChatPhoto"},{id:"-457104426",predicate:"inputGeoPointEmpty",params:[],type:"InputGeoPoint"},{id:"-206066487",predicate:"inputGeoPoint",params:[{name:"lat",type:"double"},{name:"long",type:"double"}],type:"InputGeoPoint"},{id:"483901197",predicate:"inputPhotoEmpty",params:[],type:"InputPhoto"},{id:"-74070332",predicate:"inputPhoto",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputPhoto"},{id:"1426648181",predicate:"inputVideoEmpty",params:[],type:"InputVideo"},{id:"-296249774",predicate:"inputVideo",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputVideo"},{id:"342061462",predicate:"inputFileLocation",params:[{name:"volume_id",type:"long"},{name:"local_id",type:"int"},{name:"secret",type:"long"}],type:"InputFileLocation"},{id:"1023632620",predicate:"inputVideoFileLocation",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputFileLocation"},{id:"-1377390588",predicate:"inputPhotoCropAuto",params:[],type:"InputPhotoCrop"},{id:"-644787419",predicate:"inputPhotoCrop",params:[{name:"crop_left",type:"double"},{name:"crop_top",type:"double"},{name:"crop_width",type:"double"}],type:"InputPhotoCrop"},{id:"1996904104",predicate:"inputAppEvent",params:[{name:"time",type:"double"},{name:"type",type:"string"},{name:"peer",type:"long"},{name:"data",type:"string"}],type:"InputAppEvent"},{id:"-1649296275",predicate:"peerUser",params:[{name:"user_id",type:"int"}],type:"Peer"},{id:"-1160714821",predicate:"peerChat",params:[{name:"chat_id",type:"int"}],type:"Peer"},{id:"-1432995067",predicate:"storage.fileUnknown",params:[],type:"storage.FileType"},{id:"8322574",predicate:"storage.fileJpeg",params:[],type:"storage.FileType"},{id:"-891180321",predicate:"storage.fileGif",params:[],type:"storage.FileType"},{id:"172975040",predicate:"storage.filePng",params:[],type:"storage.FileType"},{id:"-1373745011",predicate:"storage.filePdf",params:[],type:"storage.FileType"},{id:"1384777335",predicate:"storage.fileMp3",params:[],type:"storage.FileType"},{id:"1258941372",predicate:"storage.fileMov",params:[],type:"storage.FileType"},{id:"1086091090",predicate:"storage.filePartial",params:[],type:"storage.FileType"},{id:"-1278304028",predicate:"storage.fileMp4",params:[],type:"storage.FileType"},{id:"276907596",predicate:"storage.fileWebp",params:[],type:"storage.FileType"},{id:"2086234950",predicate:"fileLocationUnavailable",params:[{name:"volume_id",type:"long"},{name:"local_id",type:"int"},{name:"secret",type:"long"}],type:"FileLocation"},{id:"1406570614",predicate:"fileLocation",params:[{name:"dc_id",type:"int"},{name:"volume_id",type:"long"},{name:"local_id",type:"int"},{name:"secret",type:"long"}],type:"FileLocation"},{id:"537022650",predicate:"userEmpty",params:[{name:"id",type:"int"}],type:"User"},{id:"1912944108",predicate:"userSelf",params:[{name:"id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"phone",type:"string"},{name:"photo",type:"UserProfilePhoto"},{name:"status",type:"UserStatus"},{name:"inactive",type:"Bool"}],type:"User"},{id:"-218397927",predicate:"userContact",params:[{name:"id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"access_hash",type:"long"},{name:"phone",type:"string"},{name:"photo",type:"UserProfilePhoto"},{name:"status",type:"UserStatus"}],type:"User"},{id:"585682608",predicate:"userRequest",params:[{name:"id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"access_hash",type:"long"},{name:"phone",type:"string"},{name:"photo",type:"UserProfilePhoto"},{name:"status",type:"UserStatus"}],type:"User"},{id:"1377093789",predicate:"userForeign",params:[{name:"id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"access_hash",type:"long"},{name:"photo",type:"UserProfilePhoto"},{name:"status",type:"UserStatus"}],type:"User"},{id:"-1298475060",predicate:"userDeleted",params:[{name:"id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"User"},{id:"1326562017",predicate:"userProfilePhotoEmpty",params:[],type:"UserProfilePhoto"},{id:"-715532088",predicate:"userProfilePhoto",params:[{name:"photo_id",type:"long"},{name:"photo_small",type:"FileLocation"},{name:"photo_big",type:"FileLocation"}],type:"UserProfilePhoto"},{id:"164646985",predicate:"userStatusEmpty",params:[],type:"UserStatus"},{id:"-306628279",predicate:"userStatusOnline",params:[{name:"expires",type:"int"}],type:"UserStatus"},{id:"9203775",predicate:"userStatusOffline",params:[{name:"was_online",type:"int"}],type:"UserStatus"},{id:"-1683826688",predicate:"chatEmpty",params:[{name:"id",type:"int"}],type:"Chat"},{id:"1855757255",predicate:"chat",params:[{name:"id",type:"int"},{name:"title",type:"string"},{name:"photo",type:"ChatPhoto"},{name:"participants_count",type:"int"},{name:"date",type:"int"},{name:"left",type:"Bool"},{name:"version",type:"int"}],type:"Chat"},{id:"-83047359",predicate:"chatForbidden",params:[{name:"id",type:"int"},{name:"title",type:"string"},{name:"date",type:"int"}],type:"Chat"},{id:"1661886910",predicate:"chatFull",params:[{name:"id",type:"int"},{name:"participants",type:"ChatParticipants"},{name:"chat_photo",type:"Photo"},{name:"notify_settings",type:"PeerNotifySettings"}],type:"ChatFull"},{id:"-925415106",predicate:"chatParticipant",params:[{name:"user_id",type:"int"},{name:"inviter_id",type:"int"},{name:"date",type:"int"}],type:"ChatParticipant"},{id:"265468810",predicate:"chatParticipantsForbidden",params:[{name:"chat_id",type:"int"}],type:"ChatParticipants"},{id:"2017571861",predicate:"chatParticipants",params:[{name:"chat_id",type:"int"},{name:"admin_id",type:"int"},{name:"participants",type:"Vector"},{name:"version",type:"int"}],type:"ChatParticipants"},{id:"935395612",predicate:"chatPhotoEmpty",params:[],type:"ChatPhoto"},{id:"1632839530",predicate:"chatPhoto",params:[{name:"photo_small",type:"FileLocation"},{name:"photo_big",type:"FileLocation"}],type:"ChatPhoto"},{id:"-2082087340",predicate:"messageEmpty",params:[{name:"id",type:"int"}],type:"Message"},{id:"585853626",predicate:"message",params:[{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"to_id",type:"Peer"},{name:"out",type:"Bool"},{name:"unread",type:"Bool"},{name:"date",type:"int"},{name:"message",type:"string"},{name:"media",type:"MessageMedia"}],type:"Message"},{id:"99903492",predicate:"messageForwarded",params:[{name:"id",type:"int"},{name:"fwd_from_id",type:"int"},{name:"fwd_date",type:"int"},{name:"from_id",type:"int"},{name:"to_id",type:"Peer"},{name:"out",type:"Bool"},{name:"unread",type:"Bool"},{name:"date",type:"int"},{name:"message",type:"string"},{name:"media",type:"MessageMedia"}],type:"Message"},{id:"-1618124613",predicate:"messageService",params:[{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"to_id",type:"Peer"},{name:"out",type:"Bool"},{name:"unread",type:"Bool"},{name:"date",type:"int"},{name:"action",type:"MessageAction"}],type:"Message"},{id:"1038967584",predicate:"messageMediaEmpty",params:[],type:"MessageMedia"},{id:"-926655958",predicate:"messageMediaPhoto",params:[{name:"photo",type:"Photo"}],type:"MessageMedia"},{id:"-1563278704",predicate:"messageMediaVideo",params:[{name:"video",type:"Video"}],type:"MessageMedia"},{id:"1457575028",predicate:"messageMediaGeo",params:[{name:"geo",type:"GeoPoint"}],type:"MessageMedia"},{id:"1585262393",predicate:"messageMediaContact",params:[{name:"phone_number",type:"string"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"user_id",type:"int"}],type:"MessageMedia"},{id:"694364726",predicate:"messageMediaUnsupported",params:[{name:"bytes",type:"bytes"}],type:"MessageMedia"},{id:"-1230047312",predicate:"messageActionEmpty",params:[],type:"MessageAction"},{id:"-1503425638",predicate:"messageActionChatCreate",params:[{name:"title",type:"string"},{name:"users",type:"Vector"}],type:"MessageAction"},{id:"-1247687078",predicate:"messageActionChatEditTitle",params:[{name:"title",type:"string"}],type:"MessageAction"},{id:"2144015272",predicate:"messageActionChatEditPhoto",params:[{name:"photo",type:"Photo"}],type:"MessageAction"},{id:"-1780220945",predicate:"messageActionChatDeletePhoto",params:[],type:"MessageAction"},{id:"1581055051",predicate:"messageActionChatAddUser",params:[{name:"user_id",type:"int"}],type:"MessageAction"},{id:"-1297179892",predicate:"messageActionChatDeleteUser",params:[{name:"user_id",type:"int"}],type:"MessageAction"},{id:"558533855",predicate:"dialog",params:[{name:"peer",type:"Peer"},{name:"top_message",type:"int"},{name:"unread_count",type:"int"}],type:"Dialog"},{id:"590459437",predicate:"photoEmpty",params:[{name:"id",type:"long"}],type:"Photo"},{id:"582313809",predicate:"photo",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"},{name:"user_id",type:"int"},{name:"date",type:"int"},{name:"caption",type:"string"},{name:"geo",type:"GeoPoint"},{name:"sizes",type:"Vector"}],type:"Photo"},{id:"236446268",predicate:"photoSizeEmpty",params:[{name:"type",type:"string"}],type:"PhotoSize"},{id:"2009052699",predicate:"photoSize",params:[{name:"type",type:"string"},{name:"location",type:"FileLocation"},{name:"w",type:"int"},{name:"h",type:"int"},{name:"size",type:"int"}],type:"PhotoSize"},{id:"-374917894",predicate:"photoCachedSize",params:[{name:"type",type:"string"},{name:"location",type:"FileLocation"},{name:"w",type:"int"},{name:"h",type:"int"},{name:"bytes",type:"bytes"}],type:"PhotoSize"},{id:"-1056548696",predicate:"videoEmpty",params:[{name:"id",type:"long"}],type:"Video"},{id:"1510253727",predicate:"video",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"},{name:"user_id",type:"int"},{name:"date",type:"int"},{name:"caption",type:"string"},{name:"duration",type:"int"},{name:"size",type:"int"},{name:"thumb",type:"PhotoSize"},{name:"dc_id",type:"int"},{name:"w",type:"int"},{name:"h",type:"int"}],type:"Video"},{id:"286776671",predicate:"geoPointEmpty",params:[],type:"GeoPoint"},{id:"541710092",predicate:"geoPoint",params:[{name:"long",type:"double"},{name:"lat",type:"double"}],type:"GeoPoint"},{id:"-486486981",predicate:"auth.checkedPhone",params:[{name:"phone_registered",type:"Bool"},{name:"phone_invited",type:"Bool"}],type:"auth.CheckedPhone"},{id:"-269659687",predicate:"auth.sentCode",params:[{name:"phone_registered",type:"Bool"},{name:"phone_code_hash",type:"string"},{name:"send_call_timeout",type:"int"},{name:"is_password",type:"Bool"}],type:"auth.SentCode"},{id:"-155815004",predicate:"auth.authorization",params:[{name:"expires",type:"int"},{name:"user",type:"User"}],type:"auth.Authorization"},{id:"-543777747",predicate:"auth.exportedAuthorization",params:[{name:"id",type:"int"},{name:"bytes",type:"bytes"}],type:"auth.ExportedAuthorization"},{id:"-1195615476",predicate:"inputNotifyPeer",params:[{name:"peer",type:"InputPeer"}],type:"InputNotifyPeer"},{id:"423314455",predicate:"inputNotifyUsers",params:[],type:"InputNotifyPeer"},{id:"1251338318",predicate:"inputNotifyChats",params:[],type:"InputNotifyPeer"},{id:"-1540769658",predicate:"inputNotifyAll",params:[],type:"InputNotifyPeer"},{id:"-265263912",predicate:"inputPeerNotifyEventsEmpty",params:[],type:"InputPeerNotifyEvents"},{id:"-395694988",predicate:"inputPeerNotifyEventsAll",params:[],type:"InputPeerNotifyEvents"},{id:"1185074840",predicate:"inputPeerNotifySettings",params:[{name:"mute_until",type:"int"},{name:"sound",type:"string"},{name:"show_previews",type:"Bool"},{name:"events_mask",type:"int"}],type:"InputPeerNotifySettings"},{id:"-1378534221",predicate:"peerNotifyEventsEmpty",params:[],type:"PeerNotifyEvents"},{id:"1830677896",predicate:"peerNotifyEventsAll",params:[],type:"PeerNotifyEvents"},{id:"1889961234",predicate:"peerNotifySettingsEmpty",params:[],type:"PeerNotifySettings"},{id:"-1923214866",predicate:"peerNotifySettings",params:[{name:"mute_until",type:"int"},{name:"sound",type:"string"},{name:"show_previews",type:"Bool"},{name:"events_mask",type:"int"}],type:"PeerNotifySettings"},{id:"-860866985",predicate:"wallPaper",params:[{name:"id",type:"int"},{name:"title",type:"string"},{name:"sizes",type:"Vector"},{name:"color",type:"int"}],type:"WallPaper"},{id:"1997575642",predicate:"userFull",params:[{name:"user",type:"User"},{name:"link",type:"contacts.Link"},{name:"profile_photo",type:"Photo"},{name:"notify_settings",type:"PeerNotifySettings"},{name:"blocked",type:"Bool"},{name:"real_first_name",type:"string"},{name:"real_last_name",type:"string"}],type:"UserFull"},{id:"-116274796",predicate:"contact",params:[{name:"user_id",type:"int"},{name:"mutual",type:"Bool"}],type:"Contact"},{id:"-805141448",predicate:"importedContact",params:[{name:"user_id",type:"int"},{name:"client_id",type:"long"}],type:"ImportedContact"},{id:"1444661369",predicate:"contactBlocked",params:[{name:"user_id",type:"int"},{name:"date",type:"int"}],type:"ContactBlocked"},{id:"-360210539",predicate:"contactFound",params:[{name:"user_id",type:"int"}],type:"ContactFound"},{id:"1038193057",predicate:"contactSuggested",params:[{name:"user_id",type:"int"},{name:"mutual_contacts",type:"int"}],type:"ContactSuggested"},{id:"-1434994573",predicate:"contactStatus",params:[{name:"user_id",type:"int"},{name:"expires",type:"int"}],type:"ContactStatus"},{id:"909233996",predicate:"chatLocated",params:[{name:"chat_id",type:"int"},{name:"distance",type:"int"}],type:"ChatLocated"},{id:"322183672",predicate:"contacts.foreignLinkUnknown",params:[],type:"contacts.ForeignLink"},{id:"-1484775609",predicate:"contacts.foreignLinkRequested",params:[{name:"has_phone",type:"Bool"}],type:"contacts.ForeignLink"},{id:"468356321",predicate:"contacts.foreignLinkMutual",params:[],type:"contacts.ForeignLink"},{id:"-768992160",predicate:"contacts.myLinkEmpty",params:[],type:"contacts.MyLink"},{id:"1818882030",predicate:"contacts.myLinkRequested",params:[{name:"contact",type:"Bool"}],type:"contacts.MyLink"},{id:"-1035932711",predicate:"contacts.myLinkContact",params:[],type:"contacts.MyLink"},{id:"-322001931",predicate:"contacts.link",params:[{name:"my_link",type:"contacts.MyLink"},{name:"foreign_link",type:"contacts.ForeignLink"},{name:"user",type:"User"}],type:"contacts.Link"},{id:"1871416498",predicate:"contacts.contacts",params:[{name:"contacts",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.Contacts"},{id:"-1219778094",predicate:"contacts.contactsNotModified",params:[],type:"contacts.Contacts"},{id:"-775091636",predicate:"contacts.importedContacts",params:[{name:"imported",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.ImportedContacts"},{id:"471043349",predicate:"contacts.blocked",params:[{name:"blocked",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.Blocked"},{id:"-1878523231",predicate:"contacts.blockedSlice",params:[{name:"count",type:"int"},{name:"blocked",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.Blocked"},{id:"90570766",predicate:"contacts.found",params:[{name:"results",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.Found"},{id:"1447681221",predicate:"contacts.suggested",params:[{name:"results",type:"Vector"},{name:"users",type:"Vector"}],type:"contacts.Suggested"},{id:"364538944",predicate:"messages.dialogs",params:[{name:"dialogs",type:"Vector"},{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Dialogs"},{id:"1910543603",predicate:"messages.dialogsSlice",params:[{name:"count",type:"int"},{name:"dialogs",type:"Vector"},{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Dialogs"},{id:"-1938715001",predicate:"messages.messages",params:[{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Messages"},{id:"189033187",predicate:"messages.messagesSlice",params:[{name:"count",type:"int"},{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Messages"},{id:"1062078024",predicate:"messages.messageEmpty",params:[],type:"messages.Message"},{id:"-7289833",predicate:"messages.message",params:[{name:"message",type:"Message"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Message"},{id:"-1768654661",predicate:"messages.statedMessages",params:[{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"pts",type:"int"},{name:"seq",type:"int"}],type:"messages.StatedMessages"},{id:"-797251802",predicate:"messages.statedMessage",params:[{name:"message",type:"Message"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"pts",type:"int"},{name:"seq",type:"int"}],type:"messages.StatedMessage"},{id:"-772484260",predicate:"messages.sentMessage",params:[{name:"id",type:"int"},{name:"date",type:"int"},{name:"pts",type:"int"},{name:"seq",type:"int"}],type:"messages.SentMessage"},{id:"1089011754",predicate:"messages.chat",params:[{name:"chat",type:"Chat"},{name:"users",type:"Vector"}],type:"messages.Chat"},{id:"-2125411368",predicate:"messages.chats",params:[{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.Chats"},{id:"-438840932",predicate:"messages.chatFull",params:[{name:"full_chat",type:"ChatFull"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"messages.ChatFull"},{id:"-1210173710",predicate:"messages.affectedHistory",params:[{name:"pts",type:"int"},{name:"seq",type:"int"},{name:"offset",type:"int"}],type:"messages.AffectedHistory"},{id:"1474492012",predicate:"inputMessagesFilterEmpty",params:[],type:"MessagesFilter"},{id:"-1777752804",predicate:"inputMessagesFilterPhotos",params:[],type:"MessagesFilter"},{id:"-1614803355",predicate:"inputMessagesFilterVideo",params:[],type:"MessagesFilter"},{id:"1458172132",predicate:"inputMessagesFilterPhotoVideo",params:[],type:"MessagesFilter"},{id:"-1629621880",predicate:"inputMessagesFilterDocument",params:[],type:"MessagesFilter"},{id:"20626867",predicate:"updateNewMessage",params:[{name:"message",type:"Message"},{name:"pts",type:"int"}],type:"Update"},{id:"1318109142",predicate:"updateMessageID",params:[{name:"id",type:"int"},{name:"random_id",type:"long"}],type:"Update"},{id:"-966484431",predicate:"updateReadMessages",params:[{name:"messages",type:"Vector"},{name:"pts",type:"int"}],type:"Update"},{id:"-1456734682",predicate:"updateDeleteMessages",params:[{name:"messages",type:"Vector"},{name:"pts",type:"int"}],type:"Update"},{id:"-782376883",predicate:"updateRestoreMessages",params:[{name:"messages",type:"Vector"},{name:"pts",type:"int"}],type:"Update"},{id:"1806337288",predicate:"updateUserTyping",params:[{name:"user_id",type:"int"}],type:"Update"},{id:"1011273702",predicate:"updateChatUserTyping",params:[{name:"chat_id",type:"int"},{name:"user_id",type:"int"}],type:"Update"},{id:"125178264",predicate:"updateChatParticipants",params:[{name:"participants",type:"ChatParticipants"}],type:"Update"},{id:"469489699",predicate:"updateUserStatus",params:[{name:"user_id",type:"int"},{name:"status",type:"UserStatus"}],type:"Update"},{id:"-635250259",predicate:"updateUserName",params:[{name:"user_id",type:"int"},{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"Update"},{id:"-1791935732",predicate:"updateUserPhoto",params:[{name:"user_id",type:"int"},{name:"date",type:"int"},{name:"photo",type:"UserProfilePhoto"},{name:"previous",type:"Bool"}],type:"Update"},{id:"628472761",predicate:"updateContactRegistered",params:[{name:"user_id",type:"int"},{name:"date",type:"int"}],type:"Update"},{id:"1369737882",predicate:"updateContactLink",params:[{name:"user_id",type:"int"},{name:"my_link",type:"contacts.MyLink"},{name:"foreign_link",type:"contacts.ForeignLink"}],type:"Update"},{id:"1869154659",predicate:"updateActivation",params:[{name:"user_id",type:"int"}],type:"Update"},{id:"-1895411046",predicate:"updateNewAuthorization",params:[{name:"auth_key_id",type:"long"},{name:"date",type:"int"},{name:"device",type:"string"},{name:"location",type:"string"}],type:"Update"},{id:"-1519637954",predicate:"updates.state",params:[{name:"pts",type:"int"},{name:"qts",type:"int"},{name:"date",type:"int"},{name:"seq",type:"int"},{name:"unread_count",type:"int"}],type:"updates.State"},{id:"1567990072",predicate:"updates.differenceEmpty",params:[{name:"date",type:"int"},{name:"seq",type:"int"}],type:"updates.Difference"},{id:"16030880",predicate:"updates.difference",params:[{name:"new_messages",type:"Vector"},{name:"new_encrypted_messages",type:"Vector"},{name:"other_updates",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"state",type:"updates.State"}],type:"updates.Difference"},{id:"-1459938943",predicate:"updates.differenceSlice",params:[{name:"new_messages",type:"Vector"},{name:"new_encrypted_messages",type:"Vector"},{name:"other_updates",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"intermediate_state",type:"updates.State"}],type:"updates.Difference"},{id:"-484987010",predicate:"updatesTooLong",params:[],type:"Updates"},{id:"-738961532",predicate:"updateShortMessage",params:[{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"message",type:"string"},{name:"pts",type:"int"},{name:"date",type:"int"},{name:"seq",type:"int"}],type:"Updates"},{id:"724548942",predicate:"updateShortChatMessage",params:[{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"chat_id",type:"int"},{name:"message",type:"string"},{name:"pts",type:"int"},{name:"date",type:"int"},{name:"seq",type:"int"}],type:"Updates"},{id:"2027216577",predicate:"updateShort",params:[{name:"update",type:"Update"},{name:"date",type:"int"}],type:"Updates"},{id:"1918567619",predicate:"updatesCombined",params:[{name:"updates",type:"Vector"},{name:"users",type:"Vector"},{name:"chats",type:"Vector"},{name:"date",type:"int"},{name:"seq_start",type:"int"},{name:"seq",type:"int"}],type:"Updates"},{id:"1957577280",predicate:"updates",params:[{name:"updates",type:"Vector"},{name:"users",type:"Vector"},{name:"chats",type:"Vector"},{name:"date",type:"int"},{name:"seq",type:"int"}],type:"Updates"},{id:"-1916114267",predicate:"photos.photos",params:[{name:"photos",type:"Vector"},{name:"users",type:"Vector"}],type:"photos.Photos"},{id:"352657236",predicate:"photos.photosSlice",params:[{name:"count",type:"int"},{name:"photos",type:"Vector"},{name:"users",type:"Vector"}],type:"photos.Photos"},{id:"539045032",predicate:"photos.photo",params:[{name:"photo",type:"Photo"},{name:"users",type:"Vector"}],type:"photos.Photo"},{id:"157948117",predicate:"upload.file",params:[{name:"type",type:"storage.FileType"},{name:"mtime",type:"int"},{name:"bytes",type:"bytes"}],type:"upload.File"},{id:"784507964",predicate:"dcOption",params:[{name:"id",type:"int"},{name:"hostname",type:"string"},{name:"ip_address",type:"string"},{name:"port",type:"int"}],type:"DcOption"},{id:"777313652",predicate:"config",params:[{name:"date",type:"int"},{name:"test_mode",type:"Bool"},{name:"this_dc",type:"int"},{name:"dc_options",type:"Vector"},{name:"chat_size_max",type:"int"},{name:"broadcast_size_max",type:"int"}],type:"Config"},{id:"-1910892683",predicate:"nearestDc",params:[{name:"country",type:"string"},{name:"this_dc",type:"int"},{name:"nearest_dc",type:"int"}],type:"NearestDc"},{id:"-1987579119",predicate:"help.appUpdate",params:[{name:"id",type:"int"},{name:"critical",type:"Bool"},{name:"url",type:"string"},{name:"text",type:"string"}],type:"help.AppUpdate"},{id:"-1000708810",predicate:"help.noAppUpdate",params:[],type:"help.AppUpdate"},{id:"415997816",predicate:"help.inviteText",params:[{name:"message",type:"string"}],type:"help.InviteText"},{id:"1047852486",predicate:"messages.statedMessagesLinks",params:[{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"links",type:"Vector"},{name:"pts",type:"int"},{name:"seq",type:"int"}],type:"messages.StatedMessages"},{id:"-1448138623",predicate:"messages.statedMessageLink",params:[{name:"message",type:"Message"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"links",type:"Vector"},{name:"pts",type:"int"},{name:"seq",type:"int"}],type:"messages.StatedMessage"},{id:"-371504577",predicate:"messages.sentMessageLink",params:[{name:"id",type:"int"},{name:"date",type:"int"},{name:"pts",type:"int"},{name:"seq",type:"int"},{name:"links",type:"Vector"}],type:"messages.SentMessage"},{id:"1960072954",predicate:"inputGeoChat",params:[{name:"chat_id",type:"int"},{name:"access_hash",type:"long"}],type:"InputGeoChat"},{id:"1301143240",predicate:"inputNotifyGeoChatPeer",params:[{name:"peer",type:"InputGeoChat"}],type:"InputNotifyPeer"},{id:"1978329690",predicate:"geoChat",params:[{name:"id",type:"int"},{name:"access_hash",type:"long"},{name:"title",type:"string"},{name:"address",type:"string"},{name:"venue",type:"string"},{name:"geo",type:"GeoPoint"},{name:"photo",type:"ChatPhoto"},{name:"participants_count",type:"int"},{name:"date",type:"int"},{name:"checked_in",type:"Bool"},{name:"version",type:"int"}],type:"Chat"},{id:"1613830811",predicate:"geoChatMessageEmpty",params:[{name:"chat_id",type:"int"},{name:"id",type:"int"}],type:"GeoChatMessage"},{id:"1158019297",predicate:"geoChatMessage",params:[{name:"chat_id",type:"int"},{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"date",type:"int"},{name:"message",type:"string"},{name:"media",type:"MessageMedia"}],type:"GeoChatMessage"},{id:"-749755826",predicate:"geoChatMessageService",params:[{name:"chat_id",type:"int"},{name:"id",type:"int"},{name:"from_id",type:"int"},{name:"date",type:"int"},{name:"action",type:"MessageAction"}],type:"GeoChatMessage"},{id:"397498251",predicate:"geochats.statedMessage",params:[{name:"message",type:"GeoChatMessage"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"},{name:"seq",type:"int"}],type:"geochats.StatedMessage"},{id:"1224651367",predicate:"geochats.located",params:[{name:"results",type:"Vector"},{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"geochats.Located"},{id:"-783127119",predicate:"geochats.messages",params:[{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"geochats.Messages"},{id:"-1135057944",predicate:"geochats.messagesSlice",params:[{name:"count",type:"int"},{name:"messages",type:"Vector"},{name:"chats",type:"Vector"},{name:"users",type:"Vector"}],type:"geochats.Messages"},{id:"1862504124",predicate:"messageActionGeoChatCreate",params:[{name:"title",type:"string"},{name:"address",type:"string"}],type:"MessageAction"},{id:"209540062",predicate:"messageActionGeoChatCheckin",params:[],type:"MessageAction"},{id:"1516823543",predicate:"updateNewGeoChatMessage",params:[{name:"message",type:"GeoChatMessage"}],type:"Update"},{id:"1662091044",predicate:"wallPaperSolid",params:[{name:"id",type:"int"},{name:"title",type:"string"},{name:"bg_color",type:"int"},{name:"color",type:"int"}],type:"WallPaper"},{id:"314359194",predicate:"updateNewEncryptedMessage",params:[{name:"message",type:"EncryptedMessage"},{name:"qts",type:"int"}],type:"Update"},{id:"386986326",predicate:"updateEncryptedChatTyping",params:[{name:"chat_id",type:"int"}],type:"Update"},{id:"-1264392051",predicate:"updateEncryption",params:[{name:"chat",type:"EncryptedChat"},{name:"date",type:"int"}],type:"Update"},{id:"956179895",predicate:"updateEncryptedMessagesRead",params:[{name:"chat_id",type:"int"},{name:"max_date",type:"int"},{name:"date",type:"int"}],type:"Update"},{id:"-1417756512",predicate:"encryptedChatEmpty",params:[{name:"id",type:"int"}],type:"EncryptedChat"},{id:"1006044124",predicate:"encryptedChatWaiting",params:[{name:"id",type:"int"},{name:"access_hash",type:"long"},{name:"date",type:"int"},{name:"admin_id",type:"int"},{name:"participant_id",type:"int"}],type:"EncryptedChat"},{id:"-931638658",predicate:"encryptedChatRequested",params:[{name:"id",type:"int"},{name:"access_hash",type:"long"},{name:"date",type:"int"},{name:"admin_id",type:"int"},{name:"participant_id",type:"int"},{name:"g_a",type:"bytes"}],type:"EncryptedChat"},{id:"-94974410",predicate:"encryptedChat",params:[{name:"id",type:"int"},{name:"access_hash",type:"long"},{name:"date",type:"int"},{name:"admin_id",type:"int"},{name:"participant_id",type:"int"},{name:"g_a_or_b",type:"bytes"},{name:"key_fingerprint",type:"long"}],type:"EncryptedChat"},{id:"332848423",predicate:"encryptedChatDiscarded",params:[{name:"id",type:"int"}],type:"EncryptedChat"},{id:"-247351839",predicate:"inputEncryptedChat",params:[{name:"chat_id",type:"int"},{name:"access_hash",type:"long"}],type:"InputEncryptedChat"},{id:"-1038136962",predicate:"encryptedFileEmpty",params:[],type:"EncryptedFile"},{id:"1248893260",predicate:"encryptedFile",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"},{name:"size",type:"int"},{name:"dc_id",type:"int"},{name:"key_fingerprint",type:"int"}],type:"EncryptedFile"},{id:"406307684",predicate:"inputEncryptedFileEmpty",params:[],type:"InputEncryptedFile"},{id:"1690108678",predicate:"inputEncryptedFileUploaded",params:[{name:"id",type:"long"},{name:"parts",type:"int"},{name:"md5_checksum",type:"string"},{name:"key_fingerprint",type:"int"}],type:"InputEncryptedFile"},{id:"1511503333",predicate:"inputEncryptedFile",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputEncryptedFile"},{id:"-182231723",predicate:"inputEncryptedFileLocation",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputFileLocation"},{id:"-317144808",predicate:"encryptedMessage",params:[{name:"random_id",type:"long"},{name:"chat_id",type:"int"},{name:"date",type:"int"},{name:"bytes",type:"bytes"},{name:"file",type:"EncryptedFile"}],type:"EncryptedMessage"},{id:"594758406",predicate:"encryptedMessageService",params:[{name:"random_id",type:"long"},{name:"chat_id",type:"int"},{name:"date",type:"int"},{name:"bytes",type:"bytes"}],type:"EncryptedMessage"},{id:"-1717290801",predicate:"decryptedMessageLayer",params:[{name:"layer",type:"int"},{name:"message",type:"DecryptedMessage"}],type:"DecryptedMessageLayer"},{id:"528568095",predicate:"decryptedMessage",params:[{name:"random_id",type:"long"},{name:"random_bytes",type:"bytes"},{name:"message",type:"string"},{name:"media",type:"DecryptedMessageMedia"}],type:"DecryptedMessage"},{id:"-1438109059",predicate:"decryptedMessageService",params:[{name:"random_id",type:"long"},{name:"random_bytes",type:"bytes"},{name:"action",type:"DecryptedMessageAction"}],type:"DecryptedMessage"},{id:"144661578",predicate:"decryptedMessageMediaEmpty",params:[],type:"DecryptedMessageMedia"},{id:"846826124",predicate:"decryptedMessageMediaPhoto",params:[{name:"thumb",type:"bytes"},{name:"thumb_w",type:"int"},{name:"thumb_h",type:"int"},{name:"w",type:"int"},{name:"h",type:"int"},{name:"size",type:"int"},{name:"key",type:"bytes"},{name:"iv",type:"bytes"}],type:"DecryptedMessageMedia"},{id:"1290694387",predicate:"decryptedMessageMediaVideo",params:[{name:"thumb",type:"bytes"},{name:"thumb_w",type:"int"},{name:"thumb_h",type:"int"},{name:"duration",type:"int"},{name:"w",type:"int"},{name:"h",type:"int"},{name:"size",type:"int"},{name:"key",type:"bytes"},{name:"iv",type:"bytes"}],type:"DecryptedMessageMedia"},{id:"893913689",predicate:"decryptedMessageMediaGeoPoint",params:[{name:"lat",type:"double"},{name:"long",type:"double"}],type:"DecryptedMessageMedia"},{id:"1485441687",predicate:"decryptedMessageMediaContact",params:[{name:"phone_number",type:"string"},{name:"first_name",type:"string"},{name:"last_name",type:"string"},{name:"user_id",type:"int"}],type:"DecryptedMessageMedia"},{id:"-1586283796",predicate:"decryptedMessageActionSetMessageTTL",params:[{name:"ttl_seconds",type:"int"}],type:"DecryptedMessageAction"},{id:"-1058912715",predicate:"messages.dhConfigNotModified",params:[{name:"random",type:"bytes"}],type:"messages.DhConfig"},{id:"740433629",predicate:"messages.dhConfig",params:[{name:"g",type:"int"},{name:"p",type:"bytes"},{name:"version",type:"int"},{name:"random",type:"bytes"}],type:"messages.DhConfig"},{id:"1443858741",predicate:"messages.sentEncryptedMessage",params:[{name:"date",type:"int"}],type:"messages.SentEncryptedMessage"},{id:"-1802240206",predicate:"messages.sentEncryptedFile",params:[{name:"date",type:"int"},{name:"file",type:"EncryptedFile"}],type:"messages.SentEncryptedMessage"},{id:"-95482955",predicate:"inputFileBig",params:[{name:"id",type:"long"},{name:"parts",type:"int"},{name:"name",type:"string"}],type:"InputFile"},{id:"767652808",predicate:"inputEncryptedFileBigUploaded",params:[{name:"id",type:"long"},{name:"parts",type:"int"},{name:"key_fingerprint",type:"int"}],type:"InputEncryptedFile"},{id:"974056226",predicate:"updateChatParticipantAdd",params:[{name:"chat_id",type:"int"},{name:"user_id",type:"int"},{name:"inviter_id",type:"int"},{name:"version",type:"int"}],type:"Update"},{id:"1851755554",predicate:"updateChatParticipantDelete",params:[{name:"chat_id",type:"int"},{name:"user_id",type:"int"},{name:"version",type:"int"}],type:"Update"},{id:"-1906403213",predicate:"updateDcOptions",params:[{name:"dc_options",type:"Vector"}],type:"Update"},{id:"1638323254",predicate:"inputMediaUploadedAudio",params:[{name:"file",type:"InputFile"},{name:"duration",type:"int"}],type:"InputMedia"},{id:"-1986820223",predicate:"inputMediaAudio",params:[{name:"id",type:"InputAudio"}],type:"InputMedia"},{id:"887592125",predicate:"inputMediaUploadedDocument",params:[{name:"file",type:"InputFile"},{name:"file_name",type:"string"},{name:"mime_type",type:"string"}],type:"InputMedia"},{id:"1044831837",predicate:"inputMediaUploadedThumbDocument",params:[{name:"file",type:"InputFile"},{name:"thumb",type:"InputFile"},{name:"file_name",type:"string"},{name:"mime_type",type:"string"}],type:"InputMedia"},{id:"-779818943",predicate:"inputMediaDocument",params:[{name:"id",type:"InputDocument"}],type:"InputMedia"},{id:"802824708",predicate:"messageMediaDocument",params:[{name:"document",type:"Document"}],type:"MessageMedia"},{id:"-961117440",predicate:"messageMediaAudio",params:[{name:"audio",type:"Audio"}],type:"MessageMedia"},{id:"-648356732",predicate:"inputAudioEmpty",params:[],type:"InputAudio"},{id:"2010398975",predicate:"inputAudio",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputAudio"},{id:"1928391342",predicate:"inputDocumentEmpty",params:[],type:"InputDocument"},{id:"410618194",predicate:"inputDocument",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputDocument"},{id:"1960591437",predicate:"inputAudioFileLocation",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputFileLocation"},{id:"1313188841",predicate:"inputDocumentFileLocation",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"}],type:"InputFileLocation"},{id:"-1332395189",predicate:"decryptedMessageMediaDocument",params:[{name:"thumb",type:"bytes"},{name:"thumb_w",type:"int"},{name:"thumb_h",type:"int"},{name:"file_name",type:"string"},{name:"mime_type",type:"string"},{name:"size",type:"int"},{name:"key",type:"bytes"},{name:"iv",type:"bytes"}],type:"DecryptedMessageMedia"},{id:"1619031439",predicate:"decryptedMessageMediaAudio",params:[{name:"duration",type:"int"},{name:"size",type:"int"},{name:"key",type:"bytes"},{name:"iv",type:"bytes"}],type:"DecryptedMessageMedia"},{id:"1483311320",predicate:"audioEmpty",params:[{name:"id",type:"long"}],type:"Audio"},{id:"1114908135",predicate:"audio",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"},{name:"user_id",type:"int"},{name:"date",type:"int"},{name:"duration",type:"int"},{name:"size",type:"int"},{name:"dc_id",type:"int"}],type:"Audio"},{id:"922273905",predicate:"documentEmpty",params:[{name:"id",type:"long"}],type:"Document"},{id:"-1627626714",predicate:"document",params:[{name:"id",type:"long"},{name:"access_hash",type:"long"},{name:"user_id",type:"int"},{name:"date",type:"int"},{name:"file_name",type:"string"},{name:"mime_type",type:"string"},{name:"size",type:"int"},{name:"thumb",type:"PhotoSize"},{name:"dc_id",type:"int"}],type:"Document"},{id:"398898678",predicate:"help.support",params:[{name:"phone_number",type:"string"},{name:"user",type:"User"}],type:"help.Support"}],methods:[{id:"-878758099",method:"invokeAfterMsg",params:[{name:"msg_id",type:"long"},{name:"query",type:"!X"}],type:"X"},{id:"1036301552",method:"invokeAfterMsgs",params:[{name:"msg_ids",type:"Vector"},{name:"query",type:"!X"}],type:"X"},{id:"1877286395",method:"auth.checkPhone",params:[{name:"phone_number",type:"string"}],type:"auth.CheckedPhone"},{id:"1988976461",method:"auth.sendCode",params:[{name:"phone_number",type:"string"},{name:"sms_type",type:"int"},{name:"api_id",type:"int"},{name:"api_hash",type:"string"},{name:"lang_code",type:"string"}],type:"auth.SentCode"},{id:"63247716",method:"auth.sendCall",params:[{name:"phone_number",type:"string"},{name:"phone_code_hash",type:"string"}],type:"Bool"},{id:"453408308",method:"auth.signUp",params:[{name:"phone_number",type:"string"},{name:"phone_code_hash",type:"string"},{name:"phone_code",type:"string"},{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"auth.Authorization"},{id:"-1126886015",method:"auth.signIn",params:[{name:"phone_number",type:"string"},{name:"phone_code_hash",type:"string"},{name:"phone_code",type:"string"}],type:"auth.Authorization"},{id:"1461180992",method:"auth.logOut",params:[],type:"Bool"},{id:"-1616179942",method:"auth.resetAuthorizations",params:[],type:"Bool"},{id:"1998331287",method:"auth.sendInvites",params:[{name:"phone_numbers",type:"Vector"},{name:"message",type:"string"}],type:"Bool"},{id:"-440401971",method:"auth.exportAuthorization",params:[{name:"dc_id",type:"int"}],type:"auth.ExportedAuthorization"},{id:"-470837741",method:"auth.importAuthorization",params:[{name:"id",type:"int"},{name:"bytes",type:"bytes"}],type:"auth.Authorization"},{id:"1147957548",method:"account.registerDevice",params:[{name:"token_type",type:"int"},{name:"token",type:"string"},{name:"device_model",type:"string"},{name:"system_version",type:"string"},{name:"app_version",type:"string"},{name:"app_sandbox",type:"Bool"},{name:"lang_code",type:"string"}],type:"Bool"},{id:"1707432768",method:"account.unregisterDevice",params:[{name:"token_type",type:"int"},{name:"token",type:"string"}],type:"Bool"},{id:"-2067899501",method:"account.updateNotifySettings",params:[{name:"peer",type:"InputNotifyPeer"},{name:"settings",type:"InputPeerNotifySettings"}],type:"Bool"},{id:"313765169",method:"account.getNotifySettings",params:[{name:"peer",type:"InputNotifyPeer"}],type:"PeerNotifySettings"},{id:"-612493497",method:"account.resetNotifySettings",params:[],type:"Bool"},{id:"-259486360",method:"account.updateProfile",params:[{name:"first_name",type:"string"},{name:"last_name",type:"string"}],type:"User"},{id:"1713919532",method:"account.updateStatus",params:[{name:"offline",type:"Bool"}],type:"Bool"},{id:"-1068696894",method:"account.getWallPapers",params:[],type:"Vector"},{id:"227648840",method:"users.getUsers",params:[{name:"id",type:"Vector"}],type:"Vector"},{id:"-902781519",method:"users.getFullUser",params:[{name:"id",type:"InputUser"}],type:"UserFull"},{id:"-995929106",method:"contacts.getStatuses",params:[],type:"Vector"},{id:"583445000",method:"contacts.getContacts",params:[{name:"hash",type:"string"}],type:"contacts.Contacts"},{id:"-634342611",method:"contacts.importContacts",params:[{name:"contacts",type:"Vector"},{name:"replace",type:"Bool"}],type:"contacts.ImportedContacts"},{id:"301470424",method:"contacts.search",params:[{name:"q",type:"string"},{name:"limit",type:"int"}],type:"contacts.Found"},{id:"-847825880",method:"contacts.getSuggested",params:[{name:"limit",type:"int"}],type:"contacts.Suggested"},{id:"-1902823612",method:"contacts.deleteContact",params:[{name:"id",type:"InputUser"}],type:"contacts.Link"},{id:"1504393374",method:"contacts.deleteContacts",params:[{name:"id",type:"Vector"}],type:"Bool"},{id:"858475004",method:"contacts.block",params:[{name:"id",type:"InputUser"}],type:"Bool"},{id:"-448724803",method:"contacts.unblock",params:[{name:"id",type:"InputUser"}],type:"Bool"},{id:"-176409329",method:"contacts.getBlocked",params:[{name:"offset",type:"int"},{name:"limit",type:"int"}],type:"contacts.Blocked"},{id:"1109588596",method:"messages.getMessages",params:[{name:"id",type:"Vector"}],type:"messages.Messages"},{id:"-321970698",method:"messages.getDialogs",params:[{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"messages.Dialogs"},{id:"-1834885329",method:"messages.getHistory",params:[{name:"peer",type:"InputPeer"},{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"messages.Messages"},{id:"132772523",method:"messages.search",params:[{name:"peer",type:"InputPeer"},{name:"q",type:"string"},{name:"filter",type:"MessagesFilter"},{name:"min_date",type:"int"},{name:"max_date",type:"int"},{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"messages.Messages"},{id:"-1336990448",method:"messages.readHistory",params:[{name:"peer",type:"InputPeer"},{name:"max_id",type:"int"},{name:"offset",type:"int"}],type:"messages.AffectedHistory"},{id:"-185009311",method:"messages.deleteHistory",params:[{name:"peer",type:"InputPeer"},{name:"offset",type:"int"}],type:"messages.AffectedHistory"},{id:"351460618",method:"messages.deleteMessages",params:[{name:"id",type:"Vector"}],type:"Vector"},{id:"962567550",method:"messages.restoreMessages",params:[{name:"id",type:"Vector"}],type:"Vector"},{id:"682347368",method:"messages.receivedMessages",params:[{name:"max_id",type:"int"}],type:"Vector"},{id:"1905801705",method:"messages.setTyping",params:[{name:"peer",type:"InputPeer"},{name:"typing",type:"Bool"}],type:"Bool"},{id:"1289620139",method:"messages.sendMessage",params:[{name:"peer",type:"InputPeer"},{name:"message",type:"string"},{name:"random_id",type:"long"}],type:"messages.SentMessage"},{id:"-1547149962",method:"messages.sendMedia",params:[{name:"peer",type:"InputPeer"},{name:"media",type:"InputMedia"},{name:"random_id",type:"long"}],type:"messages.StatedMessage"},{id:"1363988751",method:"messages.forwardMessages",params:[{name:"peer",type:"InputPeer"},{name:"id",type:"Vector"}],type:"messages.StatedMessages"},{id:"1013621127",method:"messages.getChats",params:[{name:"id",type:"Vector"}],type:"messages.Chats"},{id:"998448230",method:"messages.getFullChat",params:[{name:"chat_id",type:"int"}],type:"messages.ChatFull"},{id:"-1262720843",method:"messages.editChatTitle",params:[{name:"chat_id",type:"int"},{name:"title",type:"string"}],type:"messages.StatedMessage"},{id:"-662601187",method:"messages.editChatPhoto",params:[{name:"chat_id",type:"int"},{name:"photo",type:"InputChatPhoto"}],type:"messages.StatedMessage"},{id:"787082910",method:"messages.addChatUser",params:[{name:"chat_id",type:"int"},{name:"user_id",type:"InputUser"},{name:"fwd_limit",type:"int"}],type:"messages.StatedMessage"},{id:"-1010447069",method:"messages.deleteChatUser",params:[{name:"chat_id",type:"int"},{name:"user_id",type:"InputUser"}],type:"messages.StatedMessage"},{id:"1100847854",method:"messages.createChat",params:[{name:"users",type:"Vector"},{name:"title",type:"string"}],type:"messages.StatedMessage"},{id:"-304838614",method:"updates.getState",params:[],type:"updates.State"},{id:"168039573",method:"updates.getDifference",params:[{name:"pts",type:"int"},{name:"date",type:"int"},{name:"qts",type:"int"}],type:"updates.Difference"},{id:"-285902432",method:"photos.updateProfilePhoto",params:[{name:"id",type:"InputPhoto"},{name:"crop",type:"InputPhotoCrop"}],type:"UserProfilePhoto"},{id:"-720397176",method:"photos.uploadProfilePhoto",params:[{name:"file",type:"InputFile"},{name:"caption",type:"string"},{name:"geo_point",type:"InputGeoPoint"},{name:"crop",type:"InputPhotoCrop"}],type:"photos.Photo"},{id:"-1291540959",method:"upload.saveFilePart",params:[{name:"file_id",type:"long"},{name:"file_part",type:"int"},{name:"bytes",type:"bytes"}],type:"Bool"},{id:"-475607115",method:"upload.getFile",params:[{name:"location",type:"InputFileLocation"},{name:"offset",type:"int"},{name:"limit",type:"int"}],type:"upload.File"},{id:"-990308245",method:"help.getConfig",params:[],type:"Config"},{id:"531836966",method:"help.getNearestDc",params:[],type:"NearestDc"},{id:"-938300290",method:"help.getAppUpdate",params:[{name:"device_model",type:"string"},{name:"system_version",type:"string"},{name:"app_version",type:"string"},{name:"lang_code",type:"string"}],type:"help.AppUpdate"},{id:"1862465352",method:"help.saveAppLog",params:[{name:"events",type:"Vector"}],type:"Bool"},{id:"-1532407418",method:"help.getInviteText",params:[{name:"lang_code",type:"string"}],type:"help.InviteText"},{id:"-1209117380",method:"photos.getUserPhotos",params:[{name:"user_id",type:"InputUser"},{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"photos.Photos"},{id:"66319602",method:"messages.forwardMessage",params:[{name:"peer",type:"InputPeer"},{name:"id",type:"int"},{name:"random_id",type:"long"}],type:"messages.StatedMessage"},{id:"1102776690",method:"messages.sendBroadcast",params:[{name:"contacts",type:"Vector"},{name:"message",type:"string"},{name:"media",type:"InputMedia"}],type:"messages.StatedMessages"},{id:"2132356495",method:"geochats.getLocated",params:[{name:"geo_point",type:"InputGeoPoint"},{name:"radius",type:"int"},{name:"limit",type:"int"}],type:"geochats.Located"},{id:"-515735953",method:"geochats.getRecents",params:[{name:"offset",type:"int"},{name:"limit",type:"int"}],type:"geochats.Messages"},{id:"1437853947",method:"geochats.checkin",params:[{name:"peer",type:"InputGeoChat"}],type:"geochats.StatedMessage"},{id:"1730338159",method:"geochats.getFullChat",params:[{name:"peer",type:"InputGeoChat"}],type:"messages.ChatFull"},{id:"1284383347",method:"geochats.editChatTitle",params:[{name:"peer",type:"InputGeoChat"},{name:"title",type:"string"},{name:"address",type:"string"}],type:"geochats.StatedMessage"},{id:"903355029",method:"geochats.editChatPhoto",params:[{name:"peer",type:"InputGeoChat"},{name:"photo",type:"InputChatPhoto"}],type:"geochats.StatedMessage"},{id:"-808598451",method:"geochats.search",params:[{name:"peer",type:"InputGeoChat"},{name:"q",type:"string"},{name:"filter",type:"MessagesFilter"},{name:"min_date",type:"int"},{name:"max_date",type:"int"},{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"geochats.Messages"},{id:"-1254131096",method:"geochats.getHistory",params:[{name:"peer",type:"InputGeoChat"},{name:"offset",type:"int"},{name:"max_id",type:"int"},{name:"limit",type:"int"}],type:"geochats.Messages"},{id:"146319145",method:"geochats.setTyping",params:[{name:"peer",type:"InputGeoChat"},{name:"typing",type:"Bool"}],type:"Bool"},{id:"102432836",method:"geochats.sendMessage",params:[{name:"peer",type:"InputGeoChat"},{name:"message",type:"string"},{name:"random_id",type:"long"}],type:"geochats.StatedMessage"},{id:"-1192173825",method:"geochats.sendMedia",params:[{name:"peer",type:"InputGeoChat"},{name:"media",type:"InputMedia"},{name:"random_id",type:"long"}],type:"geochats.StatedMessage"},{id:"235482646",method:"geochats.createGeoChat",params:[{name:"title",type:"string"},{name:"geo_point",type:"InputGeoPoint"},{name:"address",type:"string"},{name:"venue",type:"string"}],type:"geochats.StatedMessage"},{id:"651135312",method:"messages.getDhConfig",params:[{name:"version",type:"int"},{name:"random_length",type:"int"}],type:"messages.DhConfig"},{id:"-162681021",method:"messages.requestEncryption",params:[{name:"user_id",type:"InputUser"},{name:"random_id",type:"int"},{name:"g_a",type:"bytes"}],type:"EncryptedChat"},{id:"1035731989",method:"messages.acceptEncryption",params:[{name:"peer",type:"InputEncryptedChat"},{name:"g_b",type:"bytes"},{name:"key_fingerprint",type:"long"}],type:"EncryptedChat"},{id:"-304536635",method:"messages.discardEncryption",params:[{name:"chat_id",type:"int"}],type:"Bool"},{id:"2031374829",method:"messages.setEncryptedTyping",params:[{name:"peer",type:"InputEncryptedChat"},{name:"typing",type:"Bool"}],type:"Bool"},{id:"2135648522",method:"messages.readEncryptedHistory",params:[{name:"peer",type:"InputEncryptedChat"},{name:"max_date",type:"int"}],type:"Bool"},{id:"-1451792525",method:"messages.sendEncrypted",params:[{name:"peer",type:"InputEncryptedChat"},{name:"random_id",type:"long"},{name:"data",type:"bytes"}],type:"messages.SentEncryptedMessage"},{id:"-1701831834",method:"messages.sendEncryptedFile",params:[{name:"peer",type:"InputEncryptedChat"},{name:"random_id",type:"long"},{name:"data",type:"bytes"},{name:"file",type:"InputEncryptedFile"}],type:"messages.SentEncryptedMessage"},{id:"852769188",method:"messages.sendEncryptedService",params:[{name:"peer",type:"InputEncryptedChat"},{name:"random_id",type:"long"},{name:"data",type:"bytes"}],type:"messages.SentEncryptedMessage"},{id:"1436924774",method:"messages.receivedQueue",params:[{name:"max_qts",type:"int"}],type:"Vector"},{id:"-562337987",method:"upload.saveBigFilePart",params:[{name:"file_id",type:"long"},{name:"file_part",type:"int"},{name:"file_total_parts",type:"int"},{name:"bytes",type:"bytes"}],type:"Bool"},{id:"1769565673",method:"initConnection",params:[{name:"api_id",type:"int"},{name:"device_model",type:"string"},{name:"system_version",type:"string"},{name:"app_version",type:"string"},{name:"lang_code",type:"string"},{name:"query",type:"!X"}],type:"X"},{id:"-1663104819",method:"help.getSupport",params:[],type:"help.Support"},{id:"-576320196",method:"invokeWithLayer12",params:[{name:"query",type:"!X"}],type:"X"}]},Config.Schema.API.layer=12,Config.Emoji={"00a9":["©",["copyright"]],"00ae":["®",["registered"]],"203c":["‼",["bangbang"]],2049:["⁉",["interrobang"]],2122:["™",["tm"]],2139:["ℹ",["information_source"]],2194:["↔",["left_right_arrow"]],2195:["↕",["arrow_up_down"]],2196:["↖",["arrow_upper_left"]],2197:["↗",["arrow_upper_right"]],2198:["↘",["arrow_lower_right"]],2199:["↙",["arrow_lower_left"]],"21a9":["↩",["leftwards_arrow_with_hook"]],"21aa":["↪",["arrow_right_hook"]],"231a":["⌚",["watch"]],"231b":["⌛",["hourglass"]],"23e9":["⏩",["fast_forward"]],"23ea":["⏪",["rewind"]],"23eb":["⏫",["arrow_double_up"]],"23ec":["⏬",["arrow_double_down"]],"23f0":["⏰",["alarm_clock"]],"23f3":["⏳",["hourglass_flowing_sand"]],"24c2":["Ⓜ",["m"]],"25aa":["▪",["black_small_square"]],"25ab":["▫",["white_small_square"]],"25b6":["▶",["arrow_forward"]],"25c0":["◀",["arrow_backward"]],"25fb":["◻",["white_medium_square"]],"25fc":["◼",["black_medium_square"]],"25fd":["◽",["white_medium_small_square"]],"25fe":["◾",["black_medium_small_square"]],2600:["☀",["sunny"]],2601:["☁",["cloud"]],"260e":["☎",["phone","telephone"]],2611:["☑",["ballot_box_with_check"]],2614:["☔",["umbrella"]],2615:["☕",["coffee"]],"261d":["☝",["point_up"]],"263a":["☺",["relaxed"]],2648:["♈",["aries"]],2649:["♉",["taurus"]],"264a":["♊",["gemini"]],"264b":["♋",["cancer"]],"264c":["♌",["leo"]],"264d":["♍",["virgo"]],"264e":["♎",["libra"]],"264f":["♏",["scorpius"]],2650:["♐",["sagittarius"]],2651:["♑",["capricorn"]],2652:["♒",["aquarius"]],2653:["♓",["pisces"]],2660:["♠",["spades"]],2663:["♣",["clubs"]],2665:["♥",["hearts"]],2666:["♦",["diamonds"]],2668:["♨",["hotsprings"]],"267b":["♻",["recycle"]],"267f":["♿",["wheelchair"]],2693:["⚓",["anchor"]],"26a0":["⚠",["warning"]],"26a1":["⚡",["zap"]],"26aa":["⚪",["white_circle"]],"26ab":["⚫",["black_circle"]],"26bd":["⚽",["soccer"]],"26be":["⚾",["baseball"]],"26c4":["⛄",["snowman"]],"26c5":["⛅",["partly_sunny"]],"26ce":["⛎",["ophiuchus"]],"26d4":["⛔",["no_entry"]],"26ea":["⛪",["church"]],"26f2":["⛲",["fountain"]],"26f3":["⛳",["golf"]],"26f5":["⛵",["boat","sailboat"]],"26fa":["⛺",["tent"]],"26fd":["⛽",["fuelpump"]],2702:["✂",["scissors"]],2705:["✅",["white_check_mark"]],2708:["✈",["airplane"]],2709:["✉",["email","envelope"]],"270a":["✊",["fist"]],"270b":["✋",["hand","raised_hand"]],"270c":["✌",["v"]],"270f":["✏",["pencil2"]],2712:["✒",["black_nib"]],2714:["✔",["heavy_check_mark"]],2716:["✖",["heavy_multiplication_x"]],2728:["✨",["sparkles"]],2733:["✳",["eight_spoked_asterisk"]],2734:["✴",["eight_pointed_black_star"]],2744:["❄",["snowflake"]],2747:["❇",["sparkle"]],"274c":["❌",["x"]],"274e":["❎",["negative_squared_cross_mark"]],2753:["❓",["question"]],2754:["❔",["grey_question"]],2755:["❕",["grey_exclamation"]],2757:["❗",["exclamation","heavy_exclamation_mark"]],2764:["❤",["heart"],"<3"],2795:["➕",["heavy_plus_sign"]],2796:["➖",["heavy_minus_sign"]],2797:["➗",["heavy_division_sign"]],"27a1":["➡",["arrow_right"]],"27b0":["➰",["curly_loop"]],"27bf":["➿",["loop"]],2934:["⤴",["arrow_heading_up"]],2935:["⤵",["arrow_heading_down"]],"2b05":["⬅",["arrow_left"]],"2b06":["⬆",["arrow_up"]],"2b07":["⬇",["arrow_down"]],"2b1b":["⬛",["black_large_square"]],"2b1c":["⬜",["white_large_square"]],"2b50":["⭐",["star"]],"2b55":["⭕",["o"]],3030:["〰",["wavy_dash"]],"303d":["〽",["part_alternation_mark"]],3297:["㊗",["congratulations"]],3299:["㊙",["secret"]],"1f004":["🀄",["mahjong"]],"1f0cf":["🃏",["black_joker"]],"1f170":["🅰",["a"]],"1f171":["🅱",["b"]],"1f17e":["🅾",["o2"]],"1f17f":["🅿",["parking"]],"1f18e":["🆎",["ab"]],"1f191":["🆑",["cl"]],"1f192":["🆒",["cool"]],"1f193":["🆓",["free"]],"1f194":["🆔",["id"]],"1f195":["🆕",["new"]],"1f196":["🆖",["ng"]],"1f197":["🆗",["ok"]],"1f198":["🆘",["sos"]],"1f199":["🆙",["up"]],"1f19a":["🆚",["vs"]],"1f201":["🈁",["koko"]],"1f202":["🈂",["sa"]],"1f21a":["🈚",["u7121"]],"1f22f":["🈯",["u6307"]],"1f232":["🈲",["u7981"]],"1f233":["🈳",["u7a7a"]],"1f234":["🈴",["u5408"]],"1f235":["🈵",["u6e80"]],"1f236":["🈶",["u6709"]],"1f237":["🈷",["u6708"]],"1f238":["🈸",["u7533"]],"1f239":["🈹",["u5272"]],"1f23a":["🈺",["u55b6"]],"1f250":["🉐",["ideograph_advantage"]],"1f251":["🉑",["accept"]],"1f300":["🌀",["cyclone"]],"1f301":["🌁",["foggy"]],"1f302":["🌂",["closed_umbrella"]],"1f303":["🌃",["stars"]],"1f304":["🌄",["sunrise_over_mountains"]],"1f305":["🌅",["sunrise"]],"1f306":["🌆",["city_sunset"]],"1f307":["🌇",["city_sunrise"]],"1f308":["🌈",["rainbow"]],"1f309":["🌉",["bridge_at_night"]],"1f30a":["🌊",["ocean"]],"1f30b":["🌋",["volcano"]],"1f30c":["🌌",["milky_way"]],"1f30d":["🌍",["earth_africa"]],"1f30e":["🌎",["earth_americas"]],"1f30f":["🌏",["earth_asia"]],"1f310":["🌐",["globe_with_meridians"]],"1f311":["🌑",["new_moon"]],"1f312":["🌒",["waxing_crescent_moon"]],"1f313":["🌓",["first_quarter_moon"]],"1f314":["🌔",["moon","waxing_gibbous_moon"]],"1f315":["🌕",["full_moon"]],"1f316":["🌖",["waning_gibbous_moon"]],"1f317":["🌗",["last_quarter_moon"]],"1f318":["🌘",["waning_crescent_moon"]],"1f319":["🌙",["crescent_moon"]],"1f31a":["🌚",["new_moon_with_face"]],"1f31b":["🌛",["first_quarter_moon_with_face"]],"1f31c":["🌜",["last_quarter_moon_with_face"]],"1f31d":["🌝",["full_moon_with_face"]],"1f31e":["🌞",["sun_with_face"]],"1f31f":["🌟",["star2"]],"1f330":["🌰",["chestnut"]],"1f331":["🌱",["seedling"]],"1f332":["🌲",["evergreen_tree"]],"1f333":["🌳",["deciduous_tree"]],"1f334":["🌴",["palm_tree"]],"1f335":["🌵",["cactus"]],"1f337":["🌷",["tulip"]],"1f338":["🌸",["cherry_blossom"]],"1f339":["🌹",["rose"]],"1f33a":["🌺",["hibiscus"]],"1f33b":["🌻",["sunflower"]],"1f33c":["🌼",["blossom"]],"1f33d":["🌽",["corn"]],"1f33e":["🌾",["ear_of_rice"]],"1f33f":["🌿",["herb"]],"1f340":["🍀",["four_leaf_clover"]],"1f341":["🍁",["maple_leaf"]],"1f342":["🍂",["fallen_leaf"]],"1f343":["🍃",["leaves"]],"1f344":["🍄",["mushroom"]],"1f345":["🍅",["tomato"]],"1f346":["🍆",["eggplant"]],"1f347":["🍇",["grapes"]],"1f348":["🍈",["melon"]],"1f349":["🍉",["watermelon"]],"1f34a":["🍊",["tangerine"]],"1f34b":["🍋",["lemon"]],"1f34c":["🍌",["banana"]],"1f34d":["🍍",["pineapple"]],"1f34e":["🍎",["apple"]],"1f34f":["🍏",["green_apple"]],"1f350":["🍐",["pear"]],"1f351":["🍑",["peach"]],"1f352":["🍒",["cherries"]],"1f353":["🍓",["strawberry"]],"1f354":["🍔",["hamburger"]],"1f355":["🍕",["pizza"]],"1f356":["🍖",["meat_on_bone"]],"1f357":["🍗",["poultry_leg"]],"1f358":["🍘",["rice_cracker"]],"1f359":["🍙",["rice_ball"]],"1f35a":["🍚",["rice"]],"1f35b":["🍛",["curry"]],"1f35c":["🍜",["ramen"]],"1f35d":["🍝",["spaghetti"]],"1f35e":["🍞",["bread"]],"1f35f":["🍟",["fries"]],"1f360":["🍠",["sweet_potato"]],"1f361":["🍡",["dango"]],"1f362":["🍢",["oden"]],"1f363":["🍣",["sushi"]],"1f364":["🍤",["fried_shrimp"]],"1f365":["🍥",["fish_cake"]],"1f366":["🍦",["icecream"]],"1f367":["🍧",["shaved_ice"]],"1f368":["🍨",["ice_cream"]],"1f369":["🍩",["doughnut"]],"1f36a":["🍪",["cookie"]],"1f36b":["🍫",["chocolate_bar"]],"1f36c":["🍬",["candy"]],"1f36d":["🍭",["lollipop"]],"1f36e":["🍮",["custard"]],"1f36f":["🍯",["honey_pot"]],"1f370":["🍰",["cake"]],"1f371":["🍱",["bento"]],"1f372":["🍲",["stew"]],"1f373":["🍳",["egg"]],"1f374":["🍴",["fork_and_knife"]],"1f375":["🍵",["tea"]],"1f376":["🍶",["sake"]],"1f377":["🍷",["wine_glass"]],"1f378":["🍸",["cocktail"]],"1f379":["🍹",["tropical_drink"]],"1f37a":["🍺",["beer"]],"1f37b":["🍻",["beers"]],"1f37c":["🍼",["baby_bottle"]],"1f380":["🎀",["ribbon"]],"1f381":["🎁",["gift"]],"1f382":["🎂",["birthday"]],"1f383":["🎃",["jack_o_lantern"]],"1f384":["🎄",["christmas_tree"]],"1f385":["🎅",["santa"]],"1f386":["🎆",["fireworks"]],"1f387":["🎇",["sparkler"]],"1f388":["🎈",["balloon"]],"1f389":["🎉",["tada"]],"1f38a":["🎊",["confetti_ball"]],"1f38b":["🎋",["tanabata_tree"]],"1f38c":["🎌",["crossed_flags"]],"1f38d":["🎍",["bamboo"]],"1f38e":["🎎",["dolls"]],"1f38f":["🎏",["flags"]],"1f390":["🎐",["wind_chime"]],"1f391":["🎑",["rice_scene"]],"1f392":["🎒",["school_satchel"]],"1f393":["🎓",["mortar_board"]],"1f3a0":["🎠",["carousel_horse"]],"1f3a1":["🎡",["ferris_wheel"]],"1f3a2":["🎢",["roller_coaster"]],"1f3a3":["🎣",["fishing_pole_and_fish"]],"1f3a4":["🎤",["microphone"]],"1f3a5":["🎥",["movie_camera"]],"1f3a6":["🎦",["cinema"]],"1f3a7":["🎧",["headphones"]],"1f3a8":["🎨",["art"]],"1f3a9":["🎩",["tophat"]],"1f3aa":["🎪",["circus_tent"]],"1f3ab":["🎫",["ticket"]],"1f3ac":["🎬",["clapper"]],"1f3ad":["🎭",["performing_arts"]],"1f3ae":["🎮",["video_game"]],"1f3af":["🎯",["dart"]],"1f3b0":["🎰",["slot_machine"]],"1f3b1":["🎱",["8ball"]],"1f3b2":["🎲",["game_die"]],"1f3b3":["🎳",["bowling"]],"1f3b4":["🎴",["flower_playing_cards"]],"1f3b5":["🎵",["musical_note"]],"1f3b6":["🎶",["notes"]],"1f3b7":["🎷",["saxophone"]],"1f3b8":["🎸",["guitar"]],"1f3b9":["🎹",["musical_keyboard"]],"1f3ba":["🎺",["trumpet"]],"1f3bb":["🎻",["violin"]],"1f3bc":["🎼",["musical_score"]],"1f3bd":["🎽",["running_shirt_with_sash"]],"1f3be":["🎾",["tennis"]],"1f3bf":["🎿",["ski"]],"1f3c0":["🏀",["basketball"]],"1f3c1":["🏁",["checkered_flag"]],"1f3c2":["🏂",["snowboarder"]],"1f3c3":["🏃",["runner","running"]],"1f3c4":["🏄",["surfer"]],"1f3c6":["🏆",["trophy"]],"1f3c7":["🏇",["horse_racing"]],"1f3c8":["🏈",["football"]],"1f3c9":["🏉",["rugby_football"]],"1f3ca":["🏊",["swimmer"]],"1f3e0":["🏠",["house"]],"1f3e1":["🏡",["house_with_garden"]],"1f3e2":["🏢",["office"]],"1f3e3":["🏣",["post_office"]],"1f3e4":["🏤",["european_post_office"]],"1f3e5":["🏥",["hospital"]],"1f3e6":["🏦",["bank"]],"1f3e7":["🏧",["atm"]],"1f3e8":["🏨",["hotel"]],"1f3e9":["🏩",["love_hotel"]],"1f3ea":["🏪",["convenience_store"]],"1f3eb":["🏫",["school"]],"1f3ec":["🏬",["department_store"]],"1f3ed":["🏭",["factory"]],"1f3ee":["🏮",["izakaya_lantern","lantern"]],"1f3ef":["🏯",["japanese_castle"]],"1f3f0":["🏰",["european_castle"]],"1f400":["🐀",["rat"]],"1f401":["🐁",["mouse2"]],"1f402":["🐂",["ox"]],"1f403":["🐃",["water_buffalo"]],"1f404":["🐄",["cow2"]],"1f405":["🐅",["tiger2"]],"1f406":["🐆",["leopard"]],"1f407":["🐇",["rabbit2"]],"1f408":["🐈",["cat2"]],"1f409":["🐉",["dragon"]],"1f40a":["🐊",["crocodile"]],"1f40b":["🐋",["whale2"]],"1f40c":["🐌",["snail"]],"1f40d":["🐍",["snake"]],"1f40e":["🐎",["racehorse"]],"1f40f":["🐏",["ram"]],"1f410":["🐐",["goat"]],"1f411":["🐑",["sheep"]],"1f412":["🐒",["monkey"]],"1f413":["🐓",["rooster"]],"1f414":["🐔",["chicken"]],"1f415":["🐕",["dog2"]],"1f416":["🐖",["pig2"]],"1f417":["🐗",["boar"]],"1f418":["🐘",["elephant"]],"1f419":["🐙",["octopus"]],"1f41a":["🐚",["shell"]],"1f41b":["🐛",["bug"]],"1f41c":["🐜",["ant"]],"1f41d":["🐝",["bee","honeybee"]],"1f41e":["🐞",["beetle"]],"1f41f":["🐟",["fish"]],"1f420":["🐠",["tropical_fish"]],"1f421":["🐡",["blowfish"]],"1f422":["🐢",["turtle"]],"1f423":["🐣",["hatching_chick"]],"1f424":["🐤",["baby_chick"]],"1f425":["🐥",["hatched_chick"]],"1f426":["🐦",["bird"]],"1f427":["🐧",["penguin"]],"1f428":["🐨",["koala"]],"1f429":["🐩",["poodle"]],"1f42a":["🐪",["dromedary_camel"]],"1f42b":["🐫",["camel"]],"1f42c":["🐬",["dolphin","flipper"]],"1f42d":["🐭",["mouse"]],"1f42e":["🐮",["cow"]],"1f42f":["🐯",["tiger"]],"1f430":["🐰",["rabbit"]],"1f431":["🐱",["cat"]],"1f432":["🐲",["dragon_face"]],"1f433":["🐳",["whale"]],"1f434":["🐴",["horse"]],"1f435":["🐵",["monkey_face"]],"1f436":["🐶",["dog"]],"1f437":["🐷",["pig"]],"1f438":["🐸",["frog"]],"1f439":["🐹",["hamster"]],"1f43a":["🐺",["wolf"]],"1f43b":["🐻",["bear"]],"1f43c":["🐼",["panda_face"]],"1f43d":["🐽",["pig_nose"]],"1f43e":["🐾",["feet","paw_prints"]],"1f440":["👀",["eyes"]],"1f442":["👂",["ear"]],"1f443":["👃",["nose"]],"1f444":["👄",["lips"]],"1f445":["👅",["tongue"]],"1f446":["👆",["point_up_2"]],"1f447":["👇",["point_down"]],"1f448":["👈",["point_left"]],"1f449":["👉",["point_right"]],"1f44a":["👊",["facepunch","punch"]],"1f44b":["👋",["wave"]],"1f44c":["👌",["ok_hand"]],"1f44d":["👍",["+1","thumbsup"]],"1f44e":["👎",["-1","thumbsdown"]],"1f44f":["👏",["clap"]],"1f450":["👐",["open_hands"]],"1f451":["👑",["crown"]],"1f452":["👒",["womans_hat"]],"1f453":["👓",["eyeglasses"]],"1f454":["👔",["necktie"]],"1f455":["👕",["shirt","tshirt"]],"1f456":["👖",["jeans"]],"1f457":["👗",["dress"]],"1f458":["👘",["kimono"]],"1f459":["👙",["bikini"]],"1f45a":["👚",["womans_clothes"]],"1f45b":["👛",["purse"]],"1f45c":["👜",["handbag"]],"1f45d":["👝",["pouch"]],"1f45e":["👞",["mans_shoe","shoe"]],"1f45f":["👟",["athletic_shoe"]],"1f460":["👠",["high_heel"]],"1f461":["👡",["sandal"]],"1f462":["👢",["boot"]],"1f463":["👣",["footprints"]],"1f464":["👤",["bust_in_silhouette"]],"1f465":["👥",["busts_in_silhouette"]],"1f466":["👦",["boy"]],"1f467":["👧",["girl"]],"1f468":["👨",["man"]],"1f469":["👩",["woman"]],"1f46a":["👪",["family"]],"1f46b":["👫",["couple"]],"1f46c":["👬",["two_men_holding_hands"]],"1f46d":["👭",["two_women_holding_hands"]],"1f46e":["👮",["cop"]],"1f46f":["👯",["dancers"]],"1f470":["👰",["bride_with_veil"]],"1f471":["👱",["person_with_blond_hair"]],"1f472":["👲",["man_with_gua_pi_mao"]],"1f473":["👳",["man_with_turban"]],"1f474":["👴",["older_man"]],"1f475":["👵",["older_woman"]],"1f476":["👶",["baby"]],"1f477":["👷",["construction_worker"]],"1f478":["👸",["princess"]],"1f479":["👹",["japanese_ogre"]],"1f47a":["👺",["japanese_goblin"]],"1f47b":["👻",["ghost"]],"1f47c":["👼",["angel"]],"1f47d":["👽",["alien"]],"1f47e":["👾",["space_invader"]],"1f47f":["👿",["imp"]],"1f480":["💀",["skull"]],"1f481":["💁",["information_desk_person"]],"1f482":["💂",["guardsman"]],"1f483":["💃",["dancer"]],"1f484":["💄",["lipstick"]],"1f485":["💅",["nail_care"]],"1f486":["💆",["massage"]],"1f487":["💇",["haircut"]],"1f488":["💈",["barber"]],"1f489":["💉",["syringe"]],"1f48a":["💊",["pill"]],"1f48b":["💋",["kiss"]],"1f48c":["💌",["love_letter"]],"1f48d":["💍",["ring"]],"1f48e":["💎",["gem"]],"1f48f":["💏",["couplekiss"]],"1f490":["💐",["bouquet"]],"1f491":["💑",["couple_with_heart"]],"1f492":["💒",["wedding"]],"1f493":["💓",["heartbeat"]],"1f494":["💔",["broken_heart"],"t;t+=2)r.push(parseInt(e.substr(t,2),16));return r}function bytesToBase64(e){for(var t,n="",r=e.length,o=0,s=0;r>s;s++)t=s%3,o|=e[s]<<(16>>>t&24),(2===t||r-s===1)&&(n+=String.fromCharCode(uint6ToBase64(o>>>18&63),uint6ToBase64(o>>>12&63),uint6ToBase64(o>>>6&63),uint6ToBase64(63&o)),o=0);return n.replace(/A(?=A$|$)/g,"=")}function uint6ToBase64(e){return 26>e?e+65:52>e?e+71:62>e?e-4:62===e?43:63===e?47:65}function bytesCmp(e,t){var n=e.length;if(n!=t.length)return!1;for(var r=0;n>r;r++)if(e[r]!=t[r])return!1;return!0}function bytesXor(e,t){for(var n=e.length,r=[],o=0;n>o;++o)r[o]=e[o]^t[o];return r}function bytesToWords(e){for(var t=e.length,n=[],r=0;t>r;r++)n[r>>>2]|=e[r]<<24-r%4*8;return new CryptoJS.lib.WordArray.init(n,t)}function bytesFromWords(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++)r.push(t[o>>>2]>>>24-o%4*8&255);return r}function bytesFromBigInt(e,t){for(var n=e.toByteArray();!n[0]&&(!t||n.length>t);)n=n.slice(1);return n}function bytesToArrayBuffer(e){return new Uint8Array(e).buffer}function bytesFromArrayBuffer(e){for(var t=e.byteLength,n=new Uint8Array(e),r=[],o=0;t>o;++o)r[o]=n[o];return r}function longToInts(e){var t=bigStringInt(e).divideAndRemainder(bigint(4294967296));return[t[0].intValue(),t[1].intValue()]}function longToBytes(e){return bytesFromWords({words:longToInts(e),sigBytes:8}).reverse()}function longFromInts(e,t){return bigint(e).shiftLeft(32).add(bigint(t)).toString(10)}function intToUint(e){return e=parseInt(e),0>e&&(e+=4294967296),e}function uintToInt(e){return e>2147483647&&(e-=4294967296),e}function sha1Hash(e){var t=sha1.hash(e,!0);return t}function rsaEncrypt(e,t){var n=255-t.length;if(n>0){var r=new Array(n);(new SecureRandom).nextBytes(r),t=t.concat(r)}var o=new BigInteger(e.modulus,16),s=new BigInteger(e.exponent,16),i=new BigInteger(t),a=i.modPowInt(s,o),c=bytesFromBigInt(a,256);return c}function aesEncrypt(e,t,n){var r=16-e.length%16;if(r>0&&16>r){var o=new Array(r);(new SecureRandom).nextBytes(o),e=e.concat(o)}var s=CryptoJS.AES.encrypt(bytesToWords(e),bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}).ciphertext,i=bytesFromWords(s);return i}function aesDecrypt(e,t,n){var r=CryptoJS.AES.decrypt({ciphertext:bytesToWords(e)},bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}),o=bytesFromWords(r);return o}function gzipUncompress(e){var t=new Zlib.Gunzip(e).decompress();return t}function nextRandomInt(e){return Math.floor(Math.random()*e)}function pqPrimeFactorization(e){console.log("PQ start");for(var t,n=new BigInteger(e),r=0,o=0;3>o;o++){for(var s=(15&nextRandomInt(128))+17,i=bigint(nextRandomInt(1e9)+1),a=i.clone(),c=1<f;f++){++r;for(var h=i.clone(),u=i.clone(),d=bigint(s);!u.equals(BigInteger.ZERO);)u.and(BigInteger.ONE).equals(BigInteger.ZERO)||(d=d.add(h),d.compareTo(n)>0&&(d=d.subtract(n))),h=h.add(h),h.compareTo(n)>0&&(h=h.subtract(n)),u=u.shiftRight(1);i=d.clone();var l=i.compareTo(a)<0?a.subtract(i):i.subtract(a);if(t=l.gcd(n),!t.equals(BigInteger.ONE))break;0==(f&f-1)&&(a=i.clone())}if(t.compareTo(BigInteger.ONE)>0)break}var g,p,y=n.divide(t);return t.compareTo(y)>0?(g=y,p=t):(g=t,p=y),console.log("PQ finish",r+" iterations"),[bytesFromBigInt(g),bytesFromBigInt(p)]}function TLSerialization(e){return e=e||{},this.maxLength=e.startMaxLength||2048,this.offset=0,this.createBuffer(),this.mtproto=e.mtproto||!1,this}function TLDeserialization(e,t){return t=t||{},this.offset=0,this.buffer=e,this.intView=new Uint32Array(this.buffer),this.byteView=new Uint8Array(this.buffer),this.mtproto=t.mtproto||!1,this}TLSerialization.prototype.createBuffer=function(){this.buffer=new ArrayBuffer(this.maxLength),this.intView=new Int32Array(this.buffer),this.byteView=new Uint8Array(this.buffer)},TLSerialization.prototype.getArray=function(){var e=new ArrayBuffer(this.offset),t=new Int32Array(e);return t.set(this.intView.subarray(0,this.offset/4)),t},TLSerialization.prototype.getBuffer=function(){return this.getArray().buffer},TLSerialization.prototype.getBytes=function(){for(var e=[],t=0;t>>",e.toString(16),e,t),this.checkLength(4),this.intView[this.offset/4]=e,this.offset+=4},TLSerialization.prototype.storeInt=function(e,t){this.writeInt(e,(t||"")+":int")},TLSerialization.prototype.storeBool=function(e,t){e?this.writeInt(2574415285,(t||"")+":bool"):this.writeInt(3162085175,(t||"")+":bool")},TLSerialization.prototype.storeLongP=function(e,t,n){this.writeInt(t,(n||"")+":long[low]"),this.writeInt(e,(n||"")+":long[high]")},TLSerialization.prototype.storeLong=function(e,t){if(angular.isArray(e))return 2==e.length?this.storeLongP(e[0],e[1],t):this.storeIntBytes(e,64,t);var n=bigStringInt(e).divideAndRemainder(bigint(4294967296));this.writeInt(intToUint(n[1].intValue()),(t||"")+":long[low]"),this.writeInt(intToUint(n[0].intValue()),(t||"")+":long[high]")},TLSerialization.prototype.storeDouble=function(e){var t=new ArrayBuffer(8),n=new Int32Array(t),r=new Float64Array(t);r[0]=e,this.writeInt(n[0],(field||"")+":double[low]"),this.writeInt(n[1],(field||"")+":double[high]")},TLSerialization.prototype.storeString=function(e,t){this.debug&&console.log(">>>",e,(t||"")+":string");var n=unescape(encodeURIComponent(e));this.checkLength(n.length+8);var r=n.length;253>=r?this.byteView[this.offset++]=r:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&r,this.byteView[this.offset++]=(65280&r)>>8,this.byteView[this.offset++]=(16711680&r)>>16);for(var o=0;r>o;o++)this.byteView[this.offset++]=n.charCodeAt(o);for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeBytes=function(e,t){this.debug&&console.log(">>>",bytesToHex(e),(t||"")+":bytes"),this.checkLength(e.length+8);var n=e.length;253>=n?this.byteView[this.offset++]=n:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&n,this.byteView[this.offset++]=(65280&n)>>8,this.byteView[this.offset++]=(16711680&n)>>16);for(var r=0;n>r;r++)this.byteView[this.offset++]=e[r];for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeIntBytes=function(e,t,n){var r=e.length;if(t%32||8*r!=t)throw new Error("Invalid bits: "+t+", "+e.length);this.debug&&console.log(">>>",bytesToHex(e),(n||"")+":int"+t),this.checkLength(r);for(var o=0;r>o;o++)this.byteView[this.offset++]=e[o]},TLSerialization.prototype.storeRawBytes=function(e,t){var n=e.length;this.debug&&console.log(">>>",bytesToHex(e),t||""),this.checkLength(n);for(var r=0;n>r;r++)this.byteView[this.offset++]=e[r]},TLSerialization.prototype.storeMethod=function(e,t){var n,r=this.mtproto?Config.Schema.MTProto:Config.Schema.API,o=!1;for(n=0;n=4*this.intView.length)throw new Error("Nothing to fetch");var t=this.intView[this.offset/4];return this.debug&&console.log("<<<",t.toString(16),t,e),this.offset+=4,t},TLDeserialization.prototype.fetchInt=function(e){return this.readInt((e||"")+":int")},TLDeserialization.prototype.fetchDouble=function(e){var t=new ArrayBuffer(8),n=new Int32Array(t),r=new Float64Array(t);return n[0]=this.readInt((e||"")+":double[low]"),n[1]=this.readInt((e||"")+":double[high]"),r[0]},TLDeserialization.prototype.fetchLong=function(e){var t=this.readInt((e||"")+":long[low]"),n=this.readInt((e||"")+":long[high]"),r=bigint(n).shiftLeft(32).add(bigint(t)).toString();return r},TLDeserialization.prototype.fetchBool=function(e){var t=this.readInt((e||"")+":bool");if(2574415285==t)return!0;if(3162085175==t)return!1;throw new Error("Unknown Bool constructor "+t)},TLDeserialization.prototype.fetchString=function(e){var t=this.byteView[this.offset++];if(254==t)var t=this.byteView[this.offset++]|this.byteView[this.offset++]<<8|this.byteView[this.offset++]<<16;for(var n="",r=0;t>r;r++)n+=String.fromCharCode(this.byteView[this.offset++]);for(;this.offset%4;)this.offset++;try{var o=decodeURIComponent(escape(n))}catch(s){var o=n}return this.debug&&console.log("<<<",o,(e||"")+":string"),o},TLDeserialization.prototype.fetchBytes=function(e){var t=this.byteView[this.offset++];if(254==t)var t=this.byteView[this.offset++]|this.byteView[this.offset++]<<8|this.byteView[this.offset++]<<16;for(var n=[],r=0;t>r;r++)n.push(this.byteView[this.offset++]);for(;this.offset%4;)this.offset++;return this.debug&&console.log("<<<",bytesToHex(n),(e||"")+":bytes"),n},TLDeserialization.prototype.fetchIntBytes=function(e,t){if(e%32)throw new Error("Invalid bits: "+e);for(var n=e/8,r=[],o=0;n>o;o++)r.push(this.byteView[this.offset++]);return this.debug&&console.log("<<<",bytesToHex(r),(t||"")+":int"+e),r},TLDeserialization.prototype.fetchRawBytes=function(e,t){e===!1&&(e=this.readInt((t||"")+"_length"));for(var n=[],r=0;e>r;r++)n.push(this.byteView[this.offset++]);return this.debug&&console.log("<<<",bytesToHex(n),t||""),n},TLDeserialization.prototype.fetchObject=function(e,t){switch(e){case"int":return this.fetchInt(t);case"long":return this.fetchLong(t);case"int128":return this.fetchIntBytes(128,t);case"int256":return this.fetchIntBytes(256,t);case"int512":return this.fetchIntBytes(512,t);case"string":return this.fetchString(t);case"bytes":return this.fetchBytes(t);case"double":return this.fetchDouble(t);case"Bool":return this.fetchBool(t)}if(t=t||e||"Object","Vector"==e.substr(0,6)||"vector"==e.substr(0,6)){if("V"==e.charAt(0)){var n=this.readInt(t+"[id]");if(481674261!=n)throw new Error("Invalid vector constructor "+n)}var r=this.readInt(t+"[count]"),o=[];if(r>0)for(var s=e.substr(7,e.length-8),i=0;r>i;i++)o.push(this.fetchObject(s,t+"["+i+"]"));return o}var a=this.mtproto?Config.Schema.MTProto:Config.Schema.API,c=!1,f=!1;if("%"==e.charAt(0)){var h=e.substr(1);for(i=0;i=97&&e.charAt(0)<=122){for(i=0;ii[0]||r[0]==i[0]&&r[1]>=i[1])&&(i=[r[0],r[1]+4]),r=i,longFromInts(i[0],i[1])}function n(t,n){var s=t-Math.floor((n||tsNow())/1e3),i=Math.abs(o-s)>10;return e.set({server_time_offset:s}),r=[0,0],o=s,console.log("Apply server time",t,n,s,i),i}var r=[0,0],o=0;return e.get("server_time_offset").then(function(e){e&&(o=e)}),{generateID:t,applyServerTime:n}}]).factory("MtpAuthorizer",["MtpDcConfigurator","MtpRsaKeysManager","MtpSecureRandom","MtpMessageIdGenerator","$http","$q","$timeout",function(e,t,n,r,o,s,i){function a(t,n){var s=n.byteLength,i=new Int32Array(n),a=new TLSerialization;a.storeLongP(0,0,"auth_key_id"),a.storeLong(r.generateID(),"msg_id"),a.storeInt(s,"request_length");var c=a.getBuffer(),f=new Int32Array(c),h=c.byteLength,u=new ArrayBuffer(h+s),d=new Int32Array(u);return d.set(f),d.set(i,f.length),delete o.defaults.headers.post["Content-Type"],delete o.defaults.headers.common.Accept,"ArrayBufferView"in window||(d=d.buffer),o.post("http://"+e.chooseServer(t)+"/apiw1",d,{responseType:"arraybuffer",transformRequest:null,transformResponse:function(e){{var t=new TLDeserialization(e,{mtproto:!0});t.fetchLong("auth_key_id"),t.fetchLong("msg_id"),t.fetchInt("msg_len")}return rng_seed_time(),t}})}function c(e){var n=e.deferred,r=new TLSerialization({mtproto:!0});r.storeMethod("req_pq",{nonce:e.nonce}),console.log(dT(),"Send req_pq",bytesToHex(e.nonce)),a(e.dcID,r.getBuffer()).then(function(n){var r=n.data,o=r.fetchObject("ResPQ");if("resPQ"!=o._)throw new Error("resPQ response invalid: "+o._);if(!bytesCmp(e.nonce,o.nonce))throw new Error("resPQ nonce mismatch");if(e.serverNonce=o.server_nonce,e.pq=o.pq,e.fingerprints=o.server_public_key_fingerprints,console.log(dT(),"Got ResPQ",bytesToHex(e.serverNonce),bytesToHex(e.pq),e.fingerprints),e.publicKey=t.select(e.fingerprints),!e.publicKey)throw new Error("No public key found");console.log(dT(),"PQ factorization start");var s=pqPrimeFactorization(e.pq);e.p=s[0],e.q=s[1],f(e)},function(e){n.reject(e)}),i(function(){t.prepare()})}function f(e){var t=e.deferred;e.newNonce=new Array(32),n.nextBytes(e.newNonce);var r=new TLSerialization({mtproto:!0});r.storeObject({_:"p_q_inner_data",pq:e.pq,p:e.p,q:e.q,nonce:e.nonce,server_nonce:e.serverNonce,new_nonce:e.newNonce},"P_Q_inner_data","DECRYPTED_DATA");var o=sha1Hash(r.getBuffer()).concat(r.getBytes()),s=new TLSerialization({mtproto:!0});s.storeMethod("req_DH_params",{nonce:e.nonce,server_nonce:e.serverNonce,p:e.p,q:e.q,public_key_fingerprint:e.publicKey.fingerprint,encrypted_data:rsaEncrypt(e.publicKey,o)}),console.log(dT(),"Send req_DH_params"),a(e.dcID,s.getBuffer()).then(function(n){var r=n.data,o=r.fetchObject("Server_DH_Params","RESPONSE");if("server_DH_params_fail"!=o._&&"server_DH_params_ok"!=o._)return t.reject(new Error("Server_DH_Params response invalid: "+o._)),!1;if(!bytesCmp(e.nonce,o.nonce))return t.reject(new Error("Server_DH_Params nonce mismatch")),!1;if(!bytesCmp(e.serverNonce,o.server_nonce))return t.reject(new Error("Server_DH_Params server_nonce mismatch")),!1;if("server_DH_params_fail"==o._){var s=sha1Hash(e.newNonce).slice(-16);return bytesCmp(s,o.new_nonce_hash)?(t.reject(new Error("server_DH_params_fail")),!1):(t.reject(new Error("server_DH_params_fail new_nonce_hash mismatch")),!1)}try{h(e,o.encrypted_answer)}catch(i){return t.reject(i),!1}u(e)},function(e){t.reject(e)})}function h(e,t){e.localTime=tsNow(),e.tmpAesKey=sha1Hash(e.newNonce.concat(e.serverNonce)).concat(sha1Hash(e.serverNonce.concat(e.newNonce)).slice(0,12)),e.tmpAesIv=sha1Hash(e.serverNonce.concat(e.newNonce)).slice(12).concat(sha1Hash([].concat(e.newNonce,e.newNonce)),e.newNonce.slice(0,4));var n=aesDecrypt(t,e.tmpAesKey,e.tmpAesIv),o=n.slice(0,20),s=n.slice(20),i=bytesToArrayBuffer(s),a=new TLDeserialization(i,{mtproto:!0}),c=a.fetchObject("Server_DH_inner_data");if("server_DH_inner_data"!=c._)throw new Error("server_DH_inner_data response invalid: "+constructor);if(!bytesCmp(e.nonce,c.nonce))throw new Error("server_DH_inner_data nonce mismatch");if(!bytesCmp(e.serverNonce,c.server_nonce))throw new Error("server_DH_inner_data serverNonce mismatch");console.log(dT(),"Done decrypting answer"),e.g=c.g,e.dhPrime=c.dh_prime,e.gA=c.g_a,e.serverTime=c.server_time,e.retry=0;var f=a.getOffset();if(!bytesCmp(o,sha1Hash(s.slice(0,f))))throw new Error("server_DH_inner_data SHA1-hash mismatch");r.applyServerTime(e.serverTime,e.localTime)}function u(e){var t=e.deferred;e.b=new Array(256),n.nextBytes(e.b);var r=new BigInteger(e.b),o=new BigInteger(e.dhPrime),s=bytesFromBigInt(bigint(e.g).modPow(r,o)),i=new TLSerialization({mtproto:!0});i.storeObject({_:"client_DH_inner_data",nonce:e.nonce,server_nonce:e.serverNonce,retry_id:[0,e.retry++],g_b:s},"Client_DH_Inner_Data");var c=sha1Hash(i.getBuffer()).concat(i.getBytes()),f=aesEncrypt(c,e.tmpAesKey,e.tmpAesIv),h=new TLSerialization({mtproto:!0});h.storeMethod("set_client_DH_params",{nonce:e.nonce,server_nonce:e.serverNonce,encrypted_data:f}),console.log(dT(),"Send set_client_DH_params"),a(e.dcID,h.getBuffer()).then(function(n){var r=n.data,o=r.fetchObject("Set_client_DH_params_answer");if("dh_gen_ok"!=o._&&"dh_gen_retry"!=o._&&"dh_gen_fail"!=o._)return t.reject(new Error("Set_client_DH_params_answer response invalid: "+o._)),!1;if(!bytesCmp(e.nonce,o.nonce))return t.reject(new Error("Set_client_DH_params_answer nonce mismatch")),!1;if(!bytesCmp(e.serverNonce,o.server_nonce))return t.reject(new Error("Set_client_DH_params_answer server_nonce mismatch")),!1;var s=new BigInteger(e.b),i=new BigInteger(e.dhPrime),a=bytesFromBigInt(new BigInteger(e.gA).modPow(s,i)),c=sha1Hash(a),f=c.slice(0,8),h=c.slice(-8);switch(console.log(dT(),"Got Set_client_DH_params_answer",o._),o._){case"dh_gen_ok":var d=sha1Hash(e.newNonce.concat([1],f)).slice(-16);if(!bytesCmp(d,o.new_nonce_hash1))return t.reject(new Error("Set_client_DH_params_answer new_nonce_hash1 mismatch")),!1;var l=bytesXor(e.newNonce.slice(0,8),e.serverNonce.slice(0,8));e.authKeyID=h,e.authKey=a,e.serverSalt=l,t.resolve(e);break;case"dh_gen_retry":var g=sha1Hash(e.newNonce.concat([2],f)).slice(-16);return bytesCmp(g,o.new_nonce_hash2)?u(e):(t.reject(new Error("Set_client_DH_params_answer new_nonce_hash2 mismatch")),!1);case"dh_gen_fail":var p=sha1Hash(e.newNonce.concat([3],f)).slice(-16);return bytesCmp(p,o.new_nonce_hash3)?(t.reject(new Error("Set_client_DH_params_answer fail")),!1):(t.reject(new Error("Set_client_DH_params_answer new_nonce_hash3 mismatch")),!1)}},function(e){t.reject(e)})}function d(t){if(void 0!==l[t])return l[t];for(var n=[],r=0;16>r;r++)n.push(nextRandomInt(255));if(!e.chooseServer(t))return s.reject(new Error("No server found for dc "+t));var o={dcID:t,nonce:n,deferred:s.defer()};return i(function(){c(o)}),l[t]=o.deferred.promise}var l={};return{auth:d}}]).factory("MtpAesService",["$q",function(e){return{encrypt:function(t,n,r){return e.when(aesEncrypt(t,n,r))},decrypt:function(t,n,r){return e.when(aesDecrypt(t,n,r))}}}]).factory("MtpSha1Service",["$q",function(e){return{hash:function(t){var n=e.defer();return setTimeout(function(){n.resolve(sha1Hash(t))},0),n.promise}}}]).factory("MtpNetworkerFactory",["MtpDcConfigurator","MtpMessageIdGenerator","MtpSecureRandom","MtpSha1Service","MtpAesService","AppConfigManager","$http","$q","$timeout","$interval","$rootScope",function(e,t,n,r,o,s,i,a,c,f,h){function u(e,t,n,r){r=r||{},this.dcID=e,this.iii=l++,this.authKey=t,this.authKeyID=sha1Hash(t).slice(-8),this.serverSalt=n,this.upload=r.fileUpload||r.fileDownload||!1,this.updateSession(),this.currentRequests=0,this.checkConnectionPeriod=0,this.sentMessages={},this.serverMessages=[],this.clientMessages=[],this.pendingMessages={},this.pendingAcks=[],this.pendingResends=[],this.connectionInited=!1,this.pendingTimeouts=[],this.longPollInt=f(this.checkLongPoll.bind(this),1e4),this.checkLongPoll(),g||(g=!0,h.offline=!0,h.offlineConnecting=!0)}var d,l=0,g=!1;return h.retryOnline=function(){$(document.body).trigger("online")},u.prototype.updateSession=function(){console.log(dT(),"Update session"),this.seqNo=0,this.sessionID=new Array(8),n.nextBytes(this.sessionID)},u.prototype.updateSentMessage=function(e){var n=this.sentMessages[e];if(!n)return!1;var r=this;if(n.container){var o=[];angular.forEach(n.inner,function(e){var t=r.updateSentMessage(e);t&&o.push(t.msg_id)}),n.inner=o}return n.msg_id=t.generateID(),n.seq_no=this.generateSeqNo(n.notContentRelated||n.container),this.sentMessages[n.msg_id]=n,delete r.sentMessages[e],n},u.prototype.generateSeqNo=function(e){var t=2*this.seqNo;return e||(t++,this.seqNo++),t},u.prototype.wrapMtpCall=function(e,n,r){var o=new TLSerialization({mtproto:!0});o.storeMethod(e,n);var s=t.generateID(),i=this.generateSeqNo(),a={msg_id:s,seq_no:i,body:o.getBytes()};return window._debugMode&&console.log(dT(),"MT call",e,n,s,i),this.pushMessage(a,r)},u.prototype.wrapMtpMessage=function(e,n){n=n||{};var r=new TLSerialization({mtproto:!0});r.storeObject(e,"Object");var o=t.generateID(),s=this.generateSeqNo(n.notContentRelated),i={msg_id:o,seq_no:s,body:r.getBytes()};return window._debugMode&&console.log(dT(),"MT message",e,o,s),this.pushMessage(i,n)},u.prototype.wrapApiCall=function(e,n,r){var o=new TLSerialization(r);this.connectionInited||(o.storeInt(3718647100,"invokeWithLayer12"),o.storeInt(1769565673,"initConnection"),o.storeInt(2496,"api_id"),o.storeString(navigator.userAgent||"Unknown UserAgent","device_model"),o.storeString(navigator.platform||"Unknown Platform","system_version"),o.storeString("0.1","app_version"),o.storeString(navigator.language||"en","lang_code")),r.afterMessageID&&(o.storeInt(3416209197,"invokeAfterMsg"),o.storeLong(r.afterMessageID,"msg_id")),o.storeMethod(e,n);var s=t.generateID(),i=this.generateSeqNo(),a={msg_id:s,seq_no:i,body:o.getBytes(),isAPI:!0};return window._debugMode?console.log(dT(),"Api call",e,n,s,i,r):console.log(dT(),"Api call",e,s,i),this.pushMessage(a,r)},u.prototype.checkLongPoll=function(){var e=this.cleanupSent();if(this.longPollPending&&tsNow()=a)&&((o=h.sentMessages[t])&&(s.push(o),i+=o.body.length+32,o.isAPI?c=!0:o.longPoll&&(f=!0)),delete h.pendingMessages[t])}),c&&!f){var u=new TLSerialization({mtproto:!0});u.storeMethod("http_wait",{max_delay:0,wait_after:0,max_wait:25e3}),s.push({msg_id:t.generateID(),seq_no:this.generateSeqNo(),body:u.getBytes()})}if(s.length){var d=[];if(s.length>1){var l=new TLSerialization({mtproto:!0,startMaxLength:i+64});l.storeInt(1945237724,"CONTAINER[id]"),l.storeInt(s.length,"CONTAINER[count]");for(var g=[],n=0;ns;s++)this.processMessage(e.messages[s],n,r);break;case"bad_server_salt":console.log(dT(),"Bad server salt",e);var i=this.sentMessages[e.bad_msg_id];if(!i||i.seq_no!=e.bad_msg_seqno)throw console.log(e.bad_msg_id,e.bad_msg_seqno),new Error("Bad server salt for invalid message");this.applyServerSalt(e.new_server_salt),this.pushResend(e.bad_msg_id),this.ackMessage(n);break;case"bad_msg_notification":console.log(dT(),"Bad msg notification",e);var i=this.sentMessages[e.bad_msg_id];if(!i||i.seq_no!=e.bad_msg_seqno)throw console.log(e.bad_msg_id,e.bad_msg_seqno),new Error("Bad msg notification for invalid message");if(16==e.error_code||17==e.error_code){t.applyServerTime(bigStringInt(n).shiftRight(32).toString(10))&&this.updateSession();var a=this.updateSentMessage(e.bad_msg_id);this.pushResend(a.msg_id),this.ackMessage(n)}break;case"message":this.serverMessages.push(e.msg_id),this.processMessage(e.body,e.msg_id,r);break;case"new_session_created":this.ackMessage(n),this.processMessageAck(e.first_msg_id),this.applyServerSalt(e.server_salt),this.onSessionCreate(r,n);break;case"msgs_ack":for(var s=0;s=w||!t||!t.length)return!1;var n=t.shift(),r=n.activeDelta||1;v[e]+=r;b++;n.cb().then(function(t){v[e]-=r,o(e),n.deferred.resolve(t)},function(t){v[e]-=r,o(e),n.deferred.reject(t)})}function s(){if(l)return t.when(l);if(n.requestFileSystem=n.requestFileSystem||n.webkitRequestFileSystem,!n.requestFileSystem)return t.reject({type:"FS_BROWSER_UNSUPPORTED",description:"requestFileSystem not present"});var e=t.defer();return n.requestFileSystem(n.TEMPORARY,5242880,function(t){l=t,e.resolve()},function(t){e.reject(t)}),e.promise}function i(e,n){var r=t.defer();return e.onwriteend=function(){r.resolve()},e.onerror=function(){r.reject()},e.write(new Blob([bytesToArrayBuffer(n)])),r.promise}function a(e){switch(e._){case"inputVideoFileLocation":return"video"+e.id+".mp4";case"inputDocumentFileLocation":return"doc"+e.id;case"inputAudioFileLocation":return"audio"+e.id}return e.volume_id||console.trace("Empty location",e),e.volume_id+"_"+e.local_id+"_"+e.secret+".jpg"}function c(e){if(!e)return!1;var t=a(e);return _[t]||!1}function f(e,n){var r=a(e);if(p[r])return p[r];var o,c=t.defer(),f=function(e){c.reject(e),o&&o.truncate(0),f=angular.noop};return s().then(function(){l.root.getFile(r,{create:!1},function(e){c.resolve(_[r]=e.toURL())},function(){l.root.getFile(r,{create:!0},function(e){e.createWriter(function(t){o=t,i(t,n).then(function(){c.resolve(_[r]=e.toURL())},f)},f)},f)})},f),p[r]=c.promise}function h(n){var o=a(n),c=p[o]||y[o];if(c)return c;var f,h=t.defer(),u=function(e){h.reject(e),f&&f.truncate(0),u=angular.noop},d=function(){l.root.getFile(o,{create:!0},function(t){var s=r(n.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},n,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:n.dc_id,fileDownload:!0,createNetworker:!0})});t.createWriter(function(e){f=e,s.then(function(n){i(e,n.bytes).then(function(){h.resolve(_[o]=t.toURL())},u)},u)},u)},u)};return s().then(function(){l.root.getFile(o,{create:!1},function(e){e.file(function(t){t.size?h.resolve(_[o]=e.toURL()):(console.log("Small file empty",t),d())},u)},d)},function(){r(n.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},n,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:n.dc_id,fileDownload:!0,createNetworker:!0})}).then(function(e){h.resolve(_[o]="data:image/jpeg;base64,"+bytesToBase64(e.bytes))},u)}),y[o]=h.promise}function u(n,o,c,f,h){h=h||{},console.log(dT(),"Dload file",n,o,c);var u=a(o),d=p[u]||y[u];if(d)return d;var g,m=t.defer(),v=function(e){console.error(e),m.reject(e),g&&g.truncate(0),v=angular.noop},w=function(s){s.createWriter(function(a){g=a;for(var f,d=524288,l=t.when(),p=0;c>p;p+=d)f=t.defer(),function(t,f,l,g){return r(n,function(){return e.invokeApi("upload.getFile",{location:o,offset:f,limit:d},{dcID:n,fileDownload:!0,createNetworker:!0})},6).then(function(e){g.then(function(){return i(a,e.bytes).then(function(){l.resolve()},v).then(function(){t?m.resolve(_[u]=s.toURL(h.mime||"image/jpeg")):m.notify({done:f+d,total:c})})})})}(p+d>=c,p,f,l),l=f.promise},v)};return f?w(f):s().then(function(){l.root.getFile(u,{create:!1},function(e){e.file(function(t){t.size>=c?m.resolve(_[u]=e.toURL()):(console.log("File bad size",t,c),l.root.getFile(u,{create:!0},w,v))},v)},function(){l.root.getFile(u,{create:!0},w,v)})},function(){for(var s,i=[],a=c>30400?524288:4096,f=t.when(),d=0;c>d;d+=a)s=t.defer(),function(t,s,f,d){return r(n,function(){return e.invokeApi("upload.getFile",{location:o,offset:s,limit:a},{dcID:n,fileDownload:!0,createNetworker:!0})},6).then(function(e){d.then(function(){try{if(i.push(bytesToArrayBuffer(e.bytes)),f.resolve(),t){try{var n=new Blob(i,{type:h.mime||"image/jpeg"})}catch(r){window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;var o=new BlobBuilder;angular.forEach(i,function(e){o.append(e)});var n=o.getBlob(h.mime||"image/jpeg")}window.URL=window.URL||window.webkitURL,m.resolve(_[u]=URL.createObjectURL(n))}else m.notify({done:s+a,total:c})}catch(r){v(r)}},v)})}(d+a>=c,d,s,f),f=s.promise}),y[u]=m.promise}function d(n){var r=n.size,o=r>102400?524288:4096,s=Math.ceil(r/o),i=0;if(s>1500)return t.reject({type:"FILE_TOO_BIG"});var a,c=[nextRandomInt(4294967295),nextRandomInt(4294967295)],f=t.defer(),h=function(e){console.error("Error",e),f.reject(e),h=angular.noop},u=0,d={_:"inputFile",id:c,parts:s,name:n.name,md5_checksum:""},l=t.when();for(a=0;r>a;a+=o)!function(a,u){l=l.then(function(){var l=t.defer(),p=new FileReader,y=n.slice(a,a+o);return p.onloadend=function(t){if(t.target.readyState==FileReader.DONE){var n=g=g.then(function(){return e.invokeApi("upload.saveFilePart",{file_id:c,file_part:u,bytes:bytesFromArrayBuffer(t.target.result)},{startMaxLength:o+256,fileUpload:!0})},h);n.then(function(){i++,l.resolve(),i>=s?f.resolve(d):(console.log(dT(),"Progress",i*o/r),f.notify({done:i*o,total:r}))},h)}},p.readAsArrayBuffer(y),l.promise})}(a,u++);return f.promise}var l=!1,g=t.when(),p={},y={},_={},m={},v={},w=5,b=0;return{getCachedFile:c,downloadFile:u,downloadSmallFile:h,saveSmallFile:f,uploadFile:d}}]); +function bigint(e){return new BigInteger(e.toString(16),16)}function bigStringInt(e){return new BigInteger(e,10)}function dHexDump(e){for(var t=[],n=0;nt;t+=2)r.push(parseInt(e.substr(t,2),16));return r}function bytesToBase64(e){for(var t,n="",r=e.length,o=0,s=0;r>s;s++)t=s%3,o|=e[s]<<(16>>>t&24),(2===t||r-s===1)&&(n+=String.fromCharCode(uint6ToBase64(o>>>18&63),uint6ToBase64(o>>>12&63),uint6ToBase64(o>>>6&63),uint6ToBase64(63&o)),o=0);return n.replace(/A(?=A$|$)/g,"=")}function uint6ToBase64(e){return 26>e?e+65:52>e?e+71:62>e?e-4:62===e?43:63===e?47:65}function bytesCmp(e,t){var n=e.length;if(n!=t.length)return!1;for(var r=0;n>r;r++)if(e[r]!=t[r])return!1;return!0}function bytesXor(e,t){for(var n=e.length,r=[],o=0;n>o;++o)r[o]=e[o]^t[o];return r}function bytesToWords(e){for(var t=e.length,n=[],r=0;t>r;r++)n[r>>>2]|=e[r]<<24-r%4*8;return new CryptoJS.lib.WordArray.init(n,t)}function bytesFromWords(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++)r.push(t[o>>>2]>>>24-o%4*8&255);return r}function bytesFromBigInt(e,t){for(var n=e.toByteArray();!n[0]&&(!t||n.length>t);)n=n.slice(1);return n}function bytesToArrayBuffer(e){return new Uint8Array(e).buffer}function bytesFromArrayBuffer(e){for(var t=e.byteLength,n=new Uint8Array(e),r=[],o=0;t>o;++o)r[o]=n[o];return r}function longToInts(e){var t=bigStringInt(e).divideAndRemainder(bigint(4294967296));return[t[0].intValue(),t[1].intValue()]}function longToBytes(e){return bytesFromWords({words:longToInts(e),sigBytes:8}).reverse()}function longFromInts(e,t){return bigint(e).shiftLeft(32).add(bigint(t)).toString(10)}function intToUint(e){return e=parseInt(e),0>e&&(e+=4294967296),e}function uintToInt(e){return e>2147483647&&(e-=4294967296),e}function sha1Hash(e){var t=sha1.hash(e,!0);return t}function rsaEncrypt(e,t){var n=255-t.length;if(n>0){var r=new Array(n);(new SecureRandom).nextBytes(r),t=t.concat(r)}var o=new BigInteger(e.modulus,16),s=new BigInteger(e.exponent,16),i=new BigInteger(t),a=i.modPowInt(s,o),c=bytesFromBigInt(a,256);return c}function aesEncrypt(e,t,n){var r=16-e.length%16;if(r>0&&16>r){var o=new Array(r);(new SecureRandom).nextBytes(o),e=e.concat(o)}var s=CryptoJS.AES.encrypt(bytesToWords(e),bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}).ciphertext,i=bytesFromWords(s);return i}function aesDecrypt(e,t,n){var r=CryptoJS.AES.decrypt({ciphertext:bytesToWords(e)},bytesToWords(t),{iv:bytesToWords(n),padding:CryptoJS.pad.NoPadding,mode:CryptoJS.mode.IGE}),o=bytesFromWords(r);return o}function gzipUncompress(e){var t=new Zlib.Gunzip(e).decompress();return t}function nextRandomInt(e){return Math.floor(Math.random()*e)}function pqPrimeFactorization(e){var t=new BigInteger(e),n=!1;if(console.log("PQ start",e,t.bitLength()),t.bitLength()<=64)try{n=pqPrimeLong(goog.math.Long.fromString(t.toString(16),16))}catch(r){console.error(r)}return console.log(n),n===!1&&(n=pqPrimeBigInteger(t)),console.log("PQ finish"),n}function pqPrimeBigInteger(e){for(var t,n=0,r=0;3>r;r++){for(var o=(15&nextRandomInt(128))+17,s=bigint(nextRandomInt(1e9)+1),i=s.clone(),a=1<c;c++){++n;for(var h=s.clone(),f=s.clone(),u=bigint(o);!f.equals(BigInteger.ZERO);)f.and(BigInteger.ONE).equals(BigInteger.ZERO)||(u=u.add(h),u.compareTo(e)>0&&(u=u.subtract(e))),h=h.add(h),h.compareTo(e)>0&&(h=h.subtract(e)),f=f.shiftRight(1);s=u.clone();var g=s.compareTo(i)<0?i.subtract(s):s.subtract(i);if(t=g.gcd(e),!t.equals(BigInteger.ONE))break;0==(c&c-1)&&(i=s.clone())}if(t.compareTo(BigInteger.ONE)>0)break}var d,l,p=e.divide(t);return t.compareTo(p)>0?(d=p,l=t):(d=t,l=p),[bytesFromBigInt(d),bytesFromBigInt(l)]}function gcdLong(e,t){for(;e.notEquals(goog.math.Long.ZERO)&&t.notEquals(goog.math.Long.ZERO);){for(;t.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO);)t=t.shiftRight(1);for(;e.and(goog.math.Long.ONE).equals(goog.math.Long.ZERO);)e=e.shiftRight(1);e.compare(t)>0?e=e.subtract(t):t=t.subtract(e)}return t.equals(goog.math.Long.ZERO)?e:t}function pqPrimeLong(e){for(var t,n=0,r=0;3>r;r++){for(var o=(15&nextRandomInt(128))+17,s=goog.math.Long.fromInt(nextRandomInt(1e9)+1),i=new goog.math.Long(s.getLowBits(),s.getHighBits()),a=1<c;c++){++n;for(var h=new goog.math.Long(s.getLowBits(),s.getHighBits()),f=new goog.math.Long(s.getLowBits(),s.getHighBits()),u=goog.math.Long.fromInt(o);f.notEquals(goog.math.Long.ZERO);)f.and(goog.math.Long.ONE).notEquals(goog.math.Long.ZERO)&&(u=u.add(h),u.compare(e)>0&&(u=u.subtract(e))),h=h.add(h),h.compare(e)>0&&(h=h.subtract(e)),f=f.shiftRight(1);s=new goog.math.Long(u.getLowBits(),u.getHighBits());var g=s.compare(i)<0?i.subtract(s):s.subtract(i);if(t=gcdLong(g,e),t.notEquals(goog.math.Long.ONE))break;0==(c&c-1)&&(i=new goog.math.Long(s.getLowBits(),s.getHighBits()))}if(t.compare(goog.math.Long.ONE)>0)break}var d,l,p=e.div(t);return t.compare(p)>0?(d=p,l=t):(d=t,l=p),[bytesFromHex(d.toString(16)),bytesFromHex(l.toString(16))]}function TLSerialization(e){return e=e||{},this.maxLength=e.startMaxLength||2048,this.offset=0,this.createBuffer(),this.mtproto=e.mtproto||!1,this}function TLDeserialization(e,t){return t=t||{},this.offset=0,this.buffer=e,this.intView=new Uint32Array(this.buffer),this.byteView=new Uint8Array(this.buffer),this.mtproto=t.mtproto||!1,this}TLSerialization.prototype.createBuffer=function(){this.buffer=new ArrayBuffer(this.maxLength),this.intView=new Int32Array(this.buffer),this.byteView=new Uint8Array(this.buffer)},TLSerialization.prototype.getArray=function(){var e=new ArrayBuffer(this.offset),t=new Int32Array(e);return t.set(this.intView.subarray(0,this.offset/4)),t},TLSerialization.prototype.getBuffer=function(){return this.getArray().buffer},TLSerialization.prototype.getBytes=function(){for(var e=[],t=0;t>>",e.toString(16),e,t),this.checkLength(4),this.intView[this.offset/4]=e,this.offset+=4},TLSerialization.prototype.storeInt=function(e,t){this.writeInt(e,(t||"")+":int")},TLSerialization.prototype.storeBool=function(e,t){e?this.writeInt(2574415285,(t||"")+":bool"):this.writeInt(3162085175,(t||"")+":bool")},TLSerialization.prototype.storeLongP=function(e,t,n){this.writeInt(t,(n||"")+":long[low]"),this.writeInt(e,(n||"")+":long[high]")},TLSerialization.prototype.storeLong=function(e,t){if(angular.isArray(e))return 2==e.length?this.storeLongP(e[0],e[1],t):this.storeIntBytes(e,64,t);var n=bigStringInt(e).divideAndRemainder(bigint(4294967296));this.writeInt(intToUint(n[1].intValue()),(t||"")+":long[low]"),this.writeInt(intToUint(n[0].intValue()),(t||"")+":long[high]")},TLSerialization.prototype.storeDouble=function(e){var t=new ArrayBuffer(8),n=new Int32Array(t),r=new Float64Array(t);r[0]=e,this.writeInt(n[0],(field||"")+":double[low]"),this.writeInt(n[1],(field||"")+":double[high]")},TLSerialization.prototype.storeString=function(e,t){this.debug&&console.log(">>>",e,(t||"")+":string");var n=unescape(encodeURIComponent(e));this.checkLength(n.length+8);var r=n.length;253>=r?this.byteView[this.offset++]=r:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&r,this.byteView[this.offset++]=(65280&r)>>8,this.byteView[this.offset++]=(16711680&r)>>16);for(var o=0;r>o;o++)this.byteView[this.offset++]=n.charCodeAt(o);for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeBytes=function(e,t){this.debug&&console.log(">>>",bytesToHex(e),(t||"")+":bytes"),this.checkLength(e.length+8);var n=e.length;253>=n?this.byteView[this.offset++]=n:(this.byteView[this.offset++]=254,this.byteView[this.offset++]=255&n,this.byteView[this.offset++]=(65280&n)>>8,this.byteView[this.offset++]=(16711680&n)>>16);for(var r=0;n>r;r++)this.byteView[this.offset++]=e[r];for(;this.offset%4;)this.byteView[this.offset++]=0},TLSerialization.prototype.storeIntBytes=function(e,t,n){var r=e.length;if(t%32||8*r!=t)throw new Error("Invalid bits: "+t+", "+e.length);this.debug&&console.log(">>>",bytesToHex(e),(n||"")+":int"+t),this.checkLength(r);for(var o=0;r>o;o++)this.byteView[this.offset++]=e[o]},TLSerialization.prototype.storeRawBytes=function(e,t){var n=e.length;this.debug&&console.log(">>>",bytesToHex(e),t||""),this.checkLength(n);for(var r=0;n>r;r++)this.byteView[this.offset++]=e[r]},TLSerialization.prototype.storeMethod=function(e,t){var n,r=this.mtproto?Config.Schema.MTProto:Config.Schema.API,o=!1;for(n=0;n=4*this.intView.length)throw new Error("Nothing to fetch");var t=this.intView[this.offset/4];return this.debug&&console.log("<<<",t.toString(16),t,e),this.offset+=4,t},TLDeserialization.prototype.fetchInt=function(e){return this.readInt((e||"")+":int")},TLDeserialization.prototype.fetchDouble=function(e){var t=new ArrayBuffer(8),n=new Int32Array(t),r=new Float64Array(t);return n[0]=this.readInt((e||"")+":double[low]"),n[1]=this.readInt((e||"")+":double[high]"),r[0]},TLDeserialization.prototype.fetchLong=function(e){var t=this.readInt((e||"")+":long[low]"),n=this.readInt((e||"")+":long[high]"),r=bigint(n).shiftLeft(32).add(bigint(t)).toString();return r},TLDeserialization.prototype.fetchBool=function(e){var t=this.readInt((e||"")+":bool");if(2574415285==t)return!0;if(3162085175==t)return!1;throw new Error("Unknown Bool constructor "+t)},TLDeserialization.prototype.fetchString=function(e){var t=this.byteView[this.offset++];if(254==t)var t=this.byteView[this.offset++]|this.byteView[this.offset++]<<8|this.byteView[this.offset++]<<16;for(var n="",r=0;t>r;r++)n+=String.fromCharCode(this.byteView[this.offset++]);for(;this.offset%4;)this.offset++;try{var o=decodeURIComponent(escape(n))}catch(s){var o=n}return this.debug&&console.log("<<<",o,(e||"")+":string"),o},TLDeserialization.prototype.fetchBytes=function(e){var t=this.byteView[this.offset++];if(254==t)var t=this.byteView[this.offset++]|this.byteView[this.offset++]<<8|this.byteView[this.offset++]<<16;for(var n=[],r=0;t>r;r++)n.push(this.byteView[this.offset++]);for(;this.offset%4;)this.offset++;return this.debug&&console.log("<<<",bytesToHex(n),(e||"")+":bytes"),n},TLDeserialization.prototype.fetchIntBytes=function(e,t){if(e%32)throw new Error("Invalid bits: "+e);for(var n=e/8,r=[],o=0;n>o;o++)r.push(this.byteView[this.offset++]);return this.debug&&console.log("<<<",bytesToHex(r),(t||"")+":int"+e),r},TLDeserialization.prototype.fetchRawBytes=function(e,t){e===!1&&(e=this.readInt((t||"")+"_length"));for(var n=[],r=0;e>r;r++)n.push(this.byteView[this.offset++]);return this.debug&&console.log("<<<",bytesToHex(n),t||""),n},TLDeserialization.prototype.fetchObject=function(e,t){switch(e){case"int":return this.fetchInt(t);case"long":return this.fetchLong(t);case"int128":return this.fetchIntBytes(128,t);case"int256":return this.fetchIntBytes(256,t);case"int512":return this.fetchIntBytes(512,t);case"string":return this.fetchString(t);case"bytes":return this.fetchBytes(t);case"double":return this.fetchDouble(t);case"Bool":return this.fetchBool(t)}if(t=t||e||"Object","Vector"==e.substr(0,6)||"vector"==e.substr(0,6)){if("V"==e.charAt(0)){var n=this.readInt(t+"[id]");if(481674261!=n)throw new Error("Invalid vector constructor "+n)}var r=this.readInt(t+"[count]"),o=[];if(r>0)for(var s=e.substr(7,e.length-8),i=0;r>i;i++)o.push(this.fetchObject(s,t+"["+i+"]"));return o}var a=this.mtproto?Config.Schema.MTProto:Config.Schema.API,c=!1,h=!1;if("%"==e.charAt(0)){var f=e.substr(1);for(i=0;i=97&&e.charAt(0)<=122){for(i=0;ii[0]||r[0]==i[0]&&r[1]>=i[1])&&(i=[r[0],r[1]+4]),r=i,longFromInts(i[0],i[1])}function n(t,n){var s=t-Math.floor((n||tsNow())/1e3),i=Math.abs(o-s)>10;return e.set({server_time_offset:s}),r=[0,0],o=s,console.log("Apply server time",t,n,s,i),i}var r=[0,0],o=0;return e.get("server_time_offset").then(function(e){e&&(o=e)}),{generateID:t,applyServerTime:n}}]).factory("MtpAuthorizer",["MtpDcConfigurator","MtpRsaKeysManager","MtpSecureRandom","MtpMessageIdGenerator","$http","$q","$timeout",function(e,t,n,r,o,s,i){function a(t,n){var s=n.byteLength,i=new Int32Array(n),a=new TLSerialization;a.storeLongP(0,0,"auth_key_id"),a.storeLong(r.generateID(),"msg_id"),a.storeInt(s,"request_length");var c=a.getBuffer(),h=new Int32Array(c),f=c.byteLength,u=new ArrayBuffer(f+s),g=new Int32Array(u);return g.set(h),g.set(i,h.length),delete o.defaults.headers.post["Content-Type"],delete o.defaults.headers.common.Accept,"ArrayBufferView"in window||(g=g.buffer),o.post("http://"+e.chooseServer(t)+"/apiw1",g,{responseType:"arraybuffer",transformRequest:null,transformResponse:function(e){{var t=new TLDeserialization(e,{mtproto:!0});t.fetchLong("auth_key_id"),t.fetchLong("msg_id"),t.fetchInt("msg_len")}return rng_seed_time(),t}})}function c(e){var n=e.deferred,r=new TLSerialization({mtproto:!0});r.storeMethod("req_pq",{nonce:e.nonce}),console.log(dT(),"Send req_pq",bytesToHex(e.nonce)),a(e.dcID,r.getBuffer()).then(function(r){var o=r.data,s=o.fetchObject("ResPQ");if("resPQ"!=s._)throw new Error("resPQ response invalid: "+s._);if(!bytesCmp(e.nonce,s.nonce))throw new Error("resPQ nonce mismatch");if(e.serverNonce=s.server_nonce,e.pq=s.pq,e.fingerprints=s.server_public_key_fingerprints,console.log(dT(),"Got ResPQ",bytesToHex(e.serverNonce),bytesToHex(e.pq),e.fingerprints),e.publicKey=t.select(e.fingerprints),!e.publicKey)throw new Error("No public key found");if(console.log(dT(),"PQ factorization start"),window.Worker){var i=new Worker("js/lib/pq_worker.js");i.onmessage=function(t){e.p=t.data[0],e.q=t.data[1],console.log(dT(),"PQ factorization done"),h(e)},i.onerror=function(e){console.log("Worker error",e,e.stack),n.reject(e)},i.postMessage(e.pq)}else{var a=pqPrimeFactorization(e.pq);e.p=a[0],e.q=a[1],console.log(dT(),"PQ factorization done"),h(e)}},function(e){n.reject(e)}),i(function(){t.prepare()})}function h(e){var t=e.deferred;e.newNonce=new Array(32),n.nextBytes(e.newNonce);var r=new TLSerialization({mtproto:!0});r.storeObject({_:"p_q_inner_data",pq:e.pq,p:e.p,q:e.q,nonce:e.nonce,server_nonce:e.serverNonce,new_nonce:e.newNonce},"P_Q_inner_data","DECRYPTED_DATA");var o=sha1Hash(r.getBuffer()).concat(r.getBytes()),s=new TLSerialization({mtproto:!0});s.storeMethod("req_DH_params",{nonce:e.nonce,server_nonce:e.serverNonce,p:e.p,q:e.q,public_key_fingerprint:e.publicKey.fingerprint,encrypted_data:rsaEncrypt(e.publicKey,o)}),console.log(dT(),"Send req_DH_params"),a(e.dcID,s.getBuffer()).then(function(n){var r=n.data,o=r.fetchObject("Server_DH_Params","RESPONSE");if("server_DH_params_fail"!=o._&&"server_DH_params_ok"!=o._)return t.reject(new Error("Server_DH_Params response invalid: "+o._)),!1;if(!bytesCmp(e.nonce,o.nonce))return t.reject(new Error("Server_DH_Params nonce mismatch")),!1;if(!bytesCmp(e.serverNonce,o.server_nonce))return t.reject(new Error("Server_DH_Params server_nonce mismatch")),!1;if("server_DH_params_fail"==o._){var s=sha1Hash(e.newNonce).slice(-16);return bytesCmp(s,o.new_nonce_hash)?(t.reject(new Error("server_DH_params_fail")),!1):(t.reject(new Error("server_DH_params_fail new_nonce_hash mismatch")),!1)}try{f(e,o.encrypted_answer)}catch(i){return t.reject(i),!1}u(e)},function(e){t.reject(e)})}function f(e,t){e.localTime=tsNow(),e.tmpAesKey=sha1Hash(e.newNonce.concat(e.serverNonce)).concat(sha1Hash(e.serverNonce.concat(e.newNonce)).slice(0,12)),e.tmpAesIv=sha1Hash(e.serverNonce.concat(e.newNonce)).slice(12).concat(sha1Hash([].concat(e.newNonce,e.newNonce)),e.newNonce.slice(0,4));var n=aesDecrypt(t,e.tmpAesKey,e.tmpAesIv),o=n.slice(0,20),s=n.slice(20),i=bytesToArrayBuffer(s),a=new TLDeserialization(i,{mtproto:!0}),c=a.fetchObject("Server_DH_inner_data");if("server_DH_inner_data"!=c._)throw new Error("server_DH_inner_data response invalid: "+constructor);if(!bytesCmp(e.nonce,c.nonce))throw new Error("server_DH_inner_data nonce mismatch");if(!bytesCmp(e.serverNonce,c.server_nonce))throw new Error("server_DH_inner_data serverNonce mismatch");console.log(dT(),"Done decrypting answer"),e.g=c.g,e.dhPrime=c.dh_prime,e.gA=c.g_a,e.serverTime=c.server_time,e.retry=0;var h=a.getOffset();if(!bytesCmp(o,sha1Hash(s.slice(0,h))))throw new Error("server_DH_inner_data SHA1-hash mismatch");r.applyServerTime(e.serverTime,e.localTime)}function u(e){var t=e.deferred;e.b=new Array(256),n.nextBytes(e.b);var r=new BigInteger(e.b),o=new BigInteger(e.dhPrime),s=bytesFromBigInt(bigint(e.g).modPow(r,o)),i=new TLSerialization({mtproto:!0});i.storeObject({_:"client_DH_inner_data",nonce:e.nonce,server_nonce:e.serverNonce,retry_id:[0,e.retry++],g_b:s},"Client_DH_Inner_Data");var c=sha1Hash(i.getBuffer()).concat(i.getBytes()),h=aesEncrypt(c,e.tmpAesKey,e.tmpAesIv),f=new TLSerialization({mtproto:!0});f.storeMethod("set_client_DH_params",{nonce:e.nonce,server_nonce:e.serverNonce,encrypted_data:h}),console.log(dT(),"Send set_client_DH_params"),a(e.dcID,f.getBuffer()).then(function(n){var r=n.data,o=r.fetchObject("Set_client_DH_params_answer");if("dh_gen_ok"!=o._&&"dh_gen_retry"!=o._&&"dh_gen_fail"!=o._)return t.reject(new Error("Set_client_DH_params_answer response invalid: "+o._)),!1;if(!bytesCmp(e.nonce,o.nonce))return t.reject(new Error("Set_client_DH_params_answer nonce mismatch")),!1;if(!bytesCmp(e.serverNonce,o.server_nonce))return t.reject(new Error("Set_client_DH_params_answer server_nonce mismatch")),!1;var s=new BigInteger(e.b),i=new BigInteger(e.dhPrime),a=bytesFromBigInt(new BigInteger(e.gA).modPow(s,i)),c=sha1Hash(a),h=c.slice(0,8),f=c.slice(-8);switch(console.log(dT(),"Got Set_client_DH_params_answer",o._),o._){case"dh_gen_ok":var g=sha1Hash(e.newNonce.concat([1],h)).slice(-16);if(!bytesCmp(g,o.new_nonce_hash1))return t.reject(new Error("Set_client_DH_params_answer new_nonce_hash1 mismatch")),!1;var d=bytesXor(e.newNonce.slice(0,8),e.serverNonce.slice(0,8));e.authKeyID=f,e.authKey=a,e.serverSalt=d,t.resolve(e);break;case"dh_gen_retry":var l=sha1Hash(e.newNonce.concat([2],h)).slice(-16);return bytesCmp(l,o.new_nonce_hash2)?u(e):(t.reject(new Error("Set_client_DH_params_answer new_nonce_hash2 mismatch")),!1);case"dh_gen_fail":var p=sha1Hash(e.newNonce.concat([3],h)).slice(-16);return bytesCmp(p,o.new_nonce_hash3)?(t.reject(new Error("Set_client_DH_params_answer fail")),!1):(t.reject(new Error("Set_client_DH_params_answer new_nonce_hash3 mismatch")),!1)}},function(e){t.reject(e)})}function g(t){if(void 0!==d[t])return d[t];for(var n=[],r=0;16>r;r++)n.push(nextRandomInt(255));if(!e.chooseServer(t))return s.reject(new Error("No server found for dc "+t));var o={dcID:t,nonce:n,deferred:s.defer()};return i(function(){c(o)}),d[t]=o.deferred.promise}var d={};return{auth:g}}]).factory("MtpAesService",["$q",function(e){return{encrypt:function(t,n,r){return e.when(aesEncrypt(t,n,r))},decrypt:function(t,n,r){return e.when(aesDecrypt(t,n,r))}}}]).factory("MtpSha1Service",["$q",function(e){return{hash:function(t){var n=e.defer();return setTimeout(function(){n.resolve(sha1Hash(t))},0),n.promise}}}]).factory("MtpNetworkerFactory",["MtpDcConfigurator","MtpMessageIdGenerator","MtpSecureRandom","MtpSha1Service","MtpAesService","AppConfigManager","$http","$q","$timeout","$interval","$rootScope",function(e,t,n,r,o,s,i,a,c,h,f){function u(e,t,n,r){r=r||{},this.dcID=e,this.iii=d++,this.authKey=t,this.authKeyID=sha1Hash(t).slice(-8),this.serverSalt=n,this.upload=r.fileUpload||r.fileDownload||!1,this.updateSession(),this.currentRequests=0,this.checkConnectionPeriod=0,this.sentMessages={},this.serverMessages=[],this.clientMessages=[],this.pendingMessages={},this.pendingAcks=[],this.pendingResends=[],this.connectionInited=!1,this.pendingTimeouts=[],this.longPollInt=h(this.checkLongPoll.bind(this),1e4),this.checkLongPoll(),l||(l=!0,f.offline=!0,f.offlineConnecting=!0)}var g,d=0,l=!1;return f.retryOnline=function(){$(document.body).trigger("online")},u.prototype.updateSession=function(){console.log(dT(),"Update session"),this.seqNo=0,this.sessionID=new Array(8),n.nextBytes(this.sessionID)},u.prototype.updateSentMessage=function(e){var n=this.sentMessages[e];if(!n)return!1;var r=this;if(n.container){var o=[];angular.forEach(n.inner,function(e){var t=r.updateSentMessage(e);t&&o.push(t.msg_id)}),n.inner=o}return n.msg_id=t.generateID(),n.seq_no=this.generateSeqNo(n.notContentRelated||n.container),this.sentMessages[n.msg_id]=n,delete r.sentMessages[e],n},u.prototype.generateSeqNo=function(e){var t=2*this.seqNo;return e||(t++,this.seqNo++),t},u.prototype.wrapMtpCall=function(e,n,r){var o=new TLSerialization({mtproto:!0});o.storeMethod(e,n);var s=t.generateID(),i=this.generateSeqNo(),a={msg_id:s,seq_no:i,body:o.getBytes()};return window._debugMode&&console.log(dT(),"MT call",e,n,s,i),this.pushMessage(a,r)},u.prototype.wrapMtpMessage=function(e,n){n=n||{};var r=new TLSerialization({mtproto:!0});r.storeObject(e,"Object");var o=t.generateID(),s=this.generateSeqNo(n.notContentRelated),i={msg_id:o,seq_no:s,body:r.getBytes()};return window._debugMode&&console.log(dT(),"MT message",e,o,s),this.pushMessage(i,n)},u.prototype.wrapApiCall=function(e,n,r){var o=new TLSerialization(r);this.connectionInited||(o.storeInt(3718647100,"invokeWithLayer12"),o.storeInt(1769565673,"initConnection"),o.storeInt(2496,"api_id"),o.storeString(navigator.userAgent||"Unknown UserAgent","device_model"),o.storeString(navigator.platform||"Unknown Platform","system_version"),o.storeString("0.1","app_version"),o.storeString(navigator.language||"en","lang_code")),r.afterMessageID&&(o.storeInt(3416209197,"invokeAfterMsg"),o.storeLong(r.afterMessageID,"msg_id")),o.storeMethod(e,n);var s=t.generateID(),i=this.generateSeqNo(),a={msg_id:s,seq_no:i,body:o.getBytes(),isAPI:!0};return window._debugMode?console.log(dT(),"Api call",e,n,s,i,r):console.log(dT(),"Api call",e,s,i),this.pushMessage(a,r)},u.prototype.checkLongPoll=function(){var e=this.cleanupSent();if(this.longPollPending&&tsNow()=a)&&((o=f.sentMessages[t])&&(s.push(o),i+=o.body.length+32,o.isAPI?c=!0:o.longPoll&&(h=!0)),delete f.pendingMessages[t])}),c&&!h){var u=new TLSerialization({mtproto:!0});u.storeMethod("http_wait",{max_delay:0,wait_after:0,max_wait:25e3}),s.push({msg_id:t.generateID(),seq_no:this.generateSeqNo(),body:u.getBytes()})}if(s.length){var g=[];if(s.length>1){var d=new TLSerialization({mtproto:!0,startMaxLength:i+64});d.storeInt(1945237724,"CONTAINER[id]"),d.storeInt(s.length,"CONTAINER[count]");for(var l=[],n=0;ns;s++)this.processMessage(e.messages[s],n,r);break;case"bad_server_salt":console.log(dT(),"Bad server salt",e);var i=this.sentMessages[e.bad_msg_id];if(!i||i.seq_no!=e.bad_msg_seqno)throw console.log(e.bad_msg_id,e.bad_msg_seqno),new Error("Bad server salt for invalid message");this.applyServerSalt(e.new_server_salt),this.pushResend(e.bad_msg_id),this.ackMessage(n);break;case"bad_msg_notification":console.log(dT(),"Bad msg notification",e);var i=this.sentMessages[e.bad_msg_id];if(!i||i.seq_no!=e.bad_msg_seqno)throw console.log(e.bad_msg_id,e.bad_msg_seqno),new Error("Bad msg notification for invalid message");if(16==e.error_code||17==e.error_code){t.applyServerTime(bigStringInt(n).shiftRight(32).toString(10))&&this.updateSession();var a=this.updateSentMessage(e.bad_msg_id);this.pushResend(a.msg_id),this.ackMessage(n)}break;case"message":this.serverMessages.push(e.msg_id),this.processMessage(e.body,e.msg_id,r);break;case"new_session_created":this.ackMessage(n),this.processMessageAck(e.first_msg_id),this.applyServerSalt(e.server_salt),this.onSessionCreate(r,n);break;case"msgs_ack":for(var s=0;s=w||!t||!t.length)return!1;var n=t.shift(),r=n.activeDelta||1;_[e]+=r;b++;n.cb().then(function(t){_[e]-=r,o(e),n.deferred.resolve(t)},function(t){_[e]-=r,o(e),n.deferred.reject(t)})}function s(){if(d)return t.when(d);if(n.requestFileSystem=n.requestFileSystem||n.webkitRequestFileSystem,!n.requestFileSystem)return t.reject({type:"FS_BROWSER_UNSUPPORTED",description:"requestFileSystem not present"});var e=t.defer();return n.requestFileSystem(n.TEMPORARY,5242880,function(t){d=t,e.resolve()},function(t){e.reject(t)}),e.promise}function i(e,n){var r=t.defer();return e.onwriteend=function(){r.resolve()},e.onerror=function(){r.reject()},e.write(new Blob([bytesToArrayBuffer(n)])),r.promise}function a(e){switch(e._){case"inputVideoFileLocation":return"video"+e.id+".mp4";case"inputDocumentFileLocation":return"doc"+e.id;case"inputAudioFileLocation":return"audio"+e.id}return e.volume_id||console.trace("Empty location",e),e.volume_id+"_"+e.local_id+"_"+e.secret+".jpg"}function c(e){if(!e)return!1;var t=a(e);return m[t]||!1}function h(e,n){var r=a(e);if(p[r])return p[r];var o,c=t.defer(),h=function(e){c.reject(e),o&&o.truncate(0),h=angular.noop};return s().then(function(){d.root.getFile(r,{create:!1},function(e){c.resolve(m[r]=e.toURL())},function(){d.root.getFile(r,{create:!0},function(e){e.createWriter(function(t){o=t,i(t,n).then(function(){c.resolve(m[r]=e.toURL())},h)},h)},h)})},h),p[r]=c.promise}function f(n){var o=a(n),c=p[o]||y[o];if(c)return c;var h,f=t.defer(),u=function(e){f.reject(e),h&&h.truncate(0),u=angular.noop},g=function(){d.root.getFile(o,{create:!0},function(t){var s=r(n.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},n,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:n.dc_id,fileDownload:!0,createNetworker:!0})});t.createWriter(function(e){h=e,s.then(function(n){i(e,n.bytes).then(function(){f.resolve(m[o]=t.toURL())},u)},u)},u)},u)};return s().then(function(){d.root.getFile(o,{create:!1},function(e){e.file(function(t){t.size?f.resolve(m[o]=e.toURL()):(console.log("Small file empty",t),g())},u)},g)},function(){r(n.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},n,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:n.dc_id,fileDownload:!0,createNetworker:!0})}).then(function(e){f.resolve(m[o]="data:image/jpeg;base64,"+bytesToBase64(e.bytes))},u)}),y[o]=f.promise}function u(n,o,c,h,f){f=f||{},console.log(dT(),"Dload file",n,o,c);var u=a(o),g=p[u]||y[u];if(g)return g;var l,v=t.defer(),_=function(e){console.error(e),v.reject(e),l&&l.truncate(0),_=angular.noop},w=function(s){s.createWriter(function(a){l=a;for(var h,g=524288,d=t.when(),p=0;c>p;p+=g)h=t.defer(),function(t,h,d,l){return r(n,function(){return e.invokeApi("upload.getFile",{location:o,offset:h,limit:g},{dcID:n,fileDownload:!0,createNetworker:!0})},6).then(function(e){l.then(function(){return i(a,e.bytes).then(function(){d.resolve()},_).then(function(){t?v.resolve(m[u]=s.toURL(f.mime||"image/jpeg")):v.notify({done:h+g,total:c})})})})}(p+g>=c,p,h,d),d=h.promise},_)};return h?w(h):s().then(function(){d.root.getFile(u,{create:!1},function(e){e.file(function(t){t.size>=c?v.resolve(m[u]=e.toURL()):(console.log("File bad size",t,c),d.root.getFile(u,{create:!0},w,_))},_)},function(){d.root.getFile(u,{create:!0},w,_)})},function(){for(var s,i=[],a=c>30400?524288:4096,h=t.when(),g=0;c>g;g+=a)s=t.defer(),function(t,s,h,g){return r(n,function(){return e.invokeApi("upload.getFile",{location:o,offset:s,limit:a},{dcID:n,fileDownload:!0,createNetworker:!0})},6).then(function(e){g.then(function(){try{if(i.push(bytesToArrayBuffer(e.bytes)),h.resolve(),t){try{var n=new Blob(i,{type:f.mime||"image/jpeg"})}catch(r){window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder;var o=new BlobBuilder;angular.forEach(i,function(e){o.append(e)});var n=o.getBlob(f.mime||"image/jpeg")}window.URL=window.URL||window.webkitURL,v.resolve(m[u]=URL.createObjectURL(n))}else v.notify({done:s+a,total:c})}catch(r){_(r)}},_)})}(g+a>=c,g,s,h),h=s.promise}),y[u]=v.promise}function g(n){var r=n.size,o=r>102400?524288:4096,s=Math.ceil(r/o),i=0;if(s>1500)return t.reject({type:"FILE_TOO_BIG"});var a,c=[nextRandomInt(4294967295),nextRandomInt(4294967295)],h=t.defer(),f=function(e){console.error("Error",e),h.reject(e),f=angular.noop},u=0,g={_:"inputFile",id:c,parts:s,name:n.name,md5_checksum:""},d=t.when();for(a=0;r>a;a+=o)!function(a,u){d=d.then(function(){var d=t.defer(),p=new FileReader,y=n.slice(a,a+o);return p.onloadend=function(t){if(t.target.readyState==FileReader.DONE){var n=l=l.then(function(){return e.invokeApi("upload.saveFilePart",{file_id:c,file_part:u,bytes:bytesFromArrayBuffer(t.target.result)},{startMaxLength:o+256,fileUpload:!0})},f);n.then(function(){i++,d.resolve(),i>=s?h.resolve(g):(console.log(dT(),"Progress",i*o/r),h.notify({done:i*o,total:r}))},f)}},p.readAsArrayBuffer(y),d.promise})}(a,u++);return h.promise}var d=!1,l=t.when(),p={},y={},m={},v={},_={},w=5,b=0;return{getCachedFile:c,downloadFile:u,downloadSmallFile:f,saveSmallFile:h,uploadFile:g}}]); function dT(){return"["+(((new Date).getTime()-_logTimer)/1e3).toFixed(3)+"]"}function checkClick(e,t){return 1==e.which&&(e.ctrlKey||e.metaKey)||2==e.which?!0:(t||e.preventDefault(),!1)}function checkDragEvent(e){if(!e||e.target&&("IMG"==e.target.tagName||"A"==e.target.tagName))return!1;if(!e.dataTransfer||!e.dataTransfer.types)return!0;for(var t=0;t0,window._debugMode=location.search.indexOf("debug=1")>0,window._osX=-1!=(navigator.platform||"").toLowerCase().indexOf("mac")||-1!=(navigator.userAgent||"").toLowerCase().indexOf("mac"),window._retina=window.devicePixelRatio>1,window._osX||$("body").addClass("non_osx"),$("body").addClass(window._retina?"is_2x":"is_1x"),$(window).on("load",function(){setTimeout(function(){window.scrollTo(0,1)},0)}),angular.module("myApp",["ngRoute","ngAnimate","ngSanitize","ui.bootstrap","pasvaz.bindonce","mtproto.services","myApp.filters","myApp.services","myApp.templates","myApp.directives","myApp.controllers"]).config(["$locationProvider","$routeProvider","$compileProvider",function(e,o,i){var t,n,r,a,s,l,m,p={},d={};for(n=0;n0?{_:"inputPeerForeign",user_id:t,access_hash:e.getUser(t).access_hash||0}:0>t?{_:"inputPeerChat",chat_id:-t}:void 0},getPeerSearchText:function(a){var o;if(a>0)o=e.getUserSearchText(a);else if(0>a){var n=t.getChat(-a);o=n.title||""}return o},getOutputPeer:function(e){return e>0?{_:"peerUser",user_id:e}:{_:"peerChat",chat_id:-e}},getPeerID:function(e){if(angular.isObject(e))return e.user_id?e.user_id:-e.chat_id;var t="u"==e.charAt(0),a=e.substr(1).split("_");return t?a[0]:-a[0]||0},getPeer:function(a){return a>0?e.getUser(a):t.getChat(-a)},getPeerPhoto:function(a,o,n){return a>0?e.getUserPhoto(a,o):t.getChatPhoto(-a,n)}}}]).service("SearchIndexManager",function(){function e(){return{shortIndexes:{},fullTexts:{}}}function t(e){e=e.replace(n," ").replace(r,"").toLowerCase();for(var t in i)i.hasOwnProperty(t)&&(e=e.replace(i[t],t));return e}function a(e,a,o){if(void 0!==o.fullTexts[e])return!1;if(a=t(a),!a.length)return!1;var n=o.shortIndexes;o.fullTexts[e]=a,angular.forEach(a.split(" "),function(t){var a,o,r=Math.min(t.length,3);for(o=1;r>=o;o++)a=t.substr(0,o),void 0===n[a]?n[a]=[e]:n[a].push(e)})}function o(e,a){console.time("search");var o=a.shortIndexes,n=a.fullTexts;e=t(e);var r,i,s,d,c,u=e.split(" "),l=!1;for(i=0;ir.length)&&(l=r)}for(r={},s=0;s,<\s]+/g,r=/^\s+|\s$/g,i={a:/[áâäà]/g,e:/[éêëè]/g,i:/[íîïì]/g,o:/[óôöò]/g,u:/[úûüù]/g,c:/ç/g,ss:/ß/g};return{createIndex:e,indexObject:a,cleanSearchText:t,search:o}}).service("AppMessagesManager",["$q","$rootScope","$location","$filter","ApiUpdatesManager","AppUsersManager","AppChatsManager","AppPeersManager","AppPhotosManager","AppVideoManager","AppDocsManager","AppAudioManager","MtpApiManager","MtpApiFileManager","RichTextProcessor","NotificationsManager","SearchIndexManager",function(e,t,a,o,n,r,i,s,d,c,u,l,p,h,g,m,f){function _(t,a,o){var n=R;if(angular.isString(t)&&t.length){if(!o||G.query!==t){G.query=t;var d=f.search(t,B);G.dialogs=[],angular.forEach(R.dialogs,function(e){d[e.peerID]&&G.dialogs.push(e)}),G.count=G.dialogs.length}n=G}else G.query=!1;var c=0;if(a>0)for(c=0;cn.dialogs[c].top_message);c++);return null!==n.count&&n.dialogs.length==n.count||n.dialogs.length>=c+(o||1)?e.when({count:n.count,dialogs:n.dialogs.slice(c,c+(o||20))}):(o=o||20,p.invokeApi("messages.getDialogs",{offset:c,limit:o,max_id:a||0}).then(function(e){if(r.saveApiUsers(e.users),i.saveApiChats(e.chats),D(e.messages),a>0)for(c=0;cn.dialogs[c].top_message);c++);return n.count="messages.dialogsSlice"==e._?e.count:e.dialogs.length,n.dialogs.splice(c,n.dialogs.length-c),angular.forEach(e.dialogs,function(e){var t=s.getPeerID(e.peer),a=s.getPeerSearchText(t);f.indexObject(t,a,B),n.dialogs.push({peerID:t,top_message:e.top_message,unread_count:e.unread_count}),void 0===q[t]&&(q[t]={count:null,history:[e.top_message],pending:[]})}),{count:n.count,dialogs:n.dialogs.slice(c,c+o)}}))}function v(e,t,a,o){return p.invokeApi("messages.getHistory",{peer:e,offset:0,limit:a,max_id:t||0}).then(function(n){r.saveApiUsers(n.users),i.saveApiChats(n.chats),D(n.messages),o.count="messages.messagesSlice"==n._?n.count:n.messages.length;var s=0;if(t>0)for(s=0;so.history[s]);s++);return o.history.splice(s,o.history.length-s),angular.forEach(n.messages,function(e){o.history.push(e.id)}),a-=n.messages.length,a>0&&o.history.length1&&(c=Math.min(1e3,u[0].unread_count),o=c)}if(a>0)for(i=0;ir.history[i]);i++);return null!==r.count&&r.history.length==r.count||r.history.length>=i+(o||1)?e.when({count:r.count,history:d.concat(r.history.slice(i,i+(o||20))),unreadLimit:c}):(c&&(o=Math.max(20,c+2)),o=o||20,v(t,a,o,r).then(function(){if(i=0,a>0)for(i=0;ir.history[i]);i++);return{count:r.count,history:d.concat(r.history.slice(i,i+o)),unreadLimit:c}}))}function y(e,t,a,o,n){return p.invokeApi("messages.search",{peer:e,q:t||"",filter:a||{_:"inputMessagesFilterEmpty"},min_date:0,max_date:0,limit:n||20,max_id:o||0}).then(function(e){r.saveApiUsers(e.users),i.saveApiChats(e.chats),D(e.messages);var t="messages.messagesSlice"==e._?e.count:e.messages.length,a=[];return angular.forEach(e.messages,function(e){a.push(e.id)}),{count:t,history:a}})}function b(e){return p.invokeApi("messages.deleteMessages",{id:e}).then(function(e){return n.saveUpdate({_:"updateDeleteMessages",messages:e}),e})}function M(t,a,o){return n.saveSeq(a.seq)?a.offset?p.invokeApi(o,{peer:t,offset:a.offset,max_id:0}).then(function(e){return M(t,e,o)}):e.when():!1}function A(e){var a=s.getPeerID(e),o=q[a],n=F(a);if(!n[0]||!n[0].unread_count){if(!o||!o.history.length)return!1;var r,i,d=!1;for(u=o.history.length;u>=0;u--)if(r=o.history[u],i=T[r],i&&!i.out&&i.unread){d=!0;break}if(!d)return!1}var c=p.invokeApi("messages.readHistory",{peer:e,offset:0,max_id:0}).then(function(t){return M(e,t,"messages.readHistory")}).then(function(){n[0]&&(n[0].unread_count=0,t.$broadcast("dialog_unread",{peerID:a,count:0}))});if(o&&o.history.length){var r,i,u,a,n;for(u=0;u=0?(r="photo",i="photo."+a.type.split("/")[1]):"video/"==a.type.substr(0,6)?(r="video",i="video.mp4"):"audio/mpeg"==a.type||"audio/mp3"==a.type?(r="audio",i="audio.mp3"):(r="document",i="document."+a.type.split("/")[1]):(r="document",i="document."+a.type.split("/")[1]),a.name||(a.name=i),void 0===l&&(l=q[e]={count:null,history:[],pending:[]}),p.getUserID().then(function(o){var i={_:"messageMediaPending",type:r,file_name:a.name,size:a.size,progress:{percent:1,total:a.size}},m={_:"message",id:d,from_id:o,to_id:s.getOutputPeer(e),out:!0,unread:!0,date:tsNow()/1e3,message:"",media:i,random_id:u,pending:!0},f=function(e){var t=N[d];e?(m.error=!0,t&&(t.error=!0)):(delete m.error,t&&delete t.error)};m.send=function(){h.uploadFile(a).then(function(e){var t;switch(r){case"photo":t={_:"inputMediaUploadedPhoto",file:e};break;case"video":t={_:"inputMediaUploadedVideo",file:e,duration:0,w:0,h:0};break;case"audio":t={_:"inputMediaUploadedAudio",file:e,duration:0};break;case"document":default:t={_:"inputMediaUploadedDocument",file:e,file_name:a.name,mime_type:a.type}}p.invokeApi("messages.sendMedia",{peer:g,media:t,random_id:c}).then(function(e){n.saveSeq(e.seq)&&(n.saveUpdate({_:"updateMessageID",random_id:u,id:e.message.id}),m.date=e.message.date,m.id=e.message.id,m.media=e.message.media,n.saveUpdate({_:"updateNewMessage",message:m,pts:e.pts}))},function(){f(!0)})},function(){f(!0)},function(a){var o=N[d],n=Math.max(1,Math.floor(100*a.done/a.total));i.progress.done=a.done,i.progress.percent=n,o&&(o.media.progress.done=a.done,o.media.progress.percent=n,t.$broadcast("history_update",{peerID:e}))})},D([m]),l.pending.unshift(d),t.$broadcast("history_append",{peerID:e,messageID:d,my:!0}),m.send()}),j[u]=[e,d]}function k(e,a){var o=V--,r=[nextRandomInt(4294967295),nextRandomInt(4294967295)],i=bigint(r[0]).shiftLeft(32).add(bigint(r[1])).toString(),d=q[e],c=s.getInputPeerByID(e);void 0===d&&(d=q[e]={count:null,history:[],pending:[]}),p.getUserID().then(function(u){var l;switch(a._){case"inputMediaContact":l=angular.extend({},a,{_:"messageMediaContact"})}var h={_:"message",id:o,from_id:u,to_id:s.getOutputPeer(e),out:!0,unread:!0,date:tsNow()/1e3,message:"",media:l,random_id:i,pending:!0},g=function(e){var t=N[o];e?(h.error=!0,t&&(t.error=!0)):(delete h.error,t&&delete t.error)};h.send=function(){p.invokeApi("messages.sendMedia",{peer:c,media:a,random_id:r}).then(function(e){n.saveSeq(e.seq)&&(n.saveUpdate({_:"updateMessageID",random_id:i,id:e.message.id}),h.date=e.message.date,h.id=e.message.id,h.media=e.message.media,n.saveUpdate({_:"updateNewMessage",message:h,pts:e.pts}))},function(){g(!0)})},D([h]),d.pending.unshift(o),t.$broadcast("history_append",{peerID:e,messageID:o,my:!0}),h.send()}),j[i]=[e,o]}function I(e,t){return p.invokeApi("messages.forwardMessages",{peer:s.getInputPeerByID(e),id:t}).then(function(e){r.saveApiUsers(e.users),i.saveApiChats(e.chats),n.saveSeq(e.seq)&&angular.forEach(e.messages,function(t){n.saveUpdate({_:"updateNewMessage",message:t,pts:e.pts})})})}function P(e,t){var a=j[e];if(a){var o,n=a[0],r=a[1],i=q[n],s=!1,d=!1;for(o=0;ot?t:e.out?t:e.from_id}function E(e,t){if(void 0!==z[e])return z[e];var a=angular.copy(T[e])||{id:e};return a.fromUser=r.getUser(a.from_id),(a.chatID=a.to_id.chat_id)?(a.peerID=-a.chatID,a.peerData=i.getChat(a.chatID),a.peerString=i.getChatString(a.chatID)):(a.peerID=a.out?a.to_id.user_id:a.from_id,a.peerData=r.getUser(a.peerID),a.peerString=r.getUserString(a.peerID)),a.peerPhoto=s.getPeerPhoto(a.peerID,"User","Group"),a.unreadCount=t,"messageService"==a._&&a.action.user_id&&(a.action.user=r.getUser(a.action.user_id)),a.message&&a.message.length&&(a.richMessage=g.wrapRichText(a.message.substr(0,64),{noLinks:!0,noLinebreaks:!0})),a.dateText=o("dateOrTime")(a.date),z[e]=a}function x(e){if(void 0!==N[e])return N[e];var t=angular.copy(T[e])||{id:e};if(t.fromUser=r.getUser(t.from_id),t.fromPhoto=r.getUserPhoto(t.from_id,"User"),"messageForwarded"==t._&&(t.fwdUser=r.getUser(t.fwd_from_id)),t.media){switch(t.media._){case"messageMediaPhoto":t.media.photo=d.wrapForHistory(t.media.photo.id);break;case"messageMediaVideo":t.media.video=c.wrapForHistory(t.media.video.id);break;case"messageMediaDocument":t.media.document=u.wrapForHistory(t.media.document.id);break;case"messageMediaAudio":t.media.audio=l.wrapForHistory(t.media.audio.id);break;case"messageMediaContact":t.media.rFullName=g.wrapRichText(t.media.first_name+" "+(t.media.last_name||""),{noLinks:!0,noLinebreaks:!0})}t.media.user_id&&(t.media.user=r.getUser(t.media.user_id),t.media.userPhoto=r.getUserPhoto(t.media.user_id,"User"))}else if(t.action){switch(t.action._){case"messageActionChatEditPhoto":t.action.photo=d.wrapForHistory(t.action.photo.id);break;case"messageActionChatCreate":case"messageActionChatEditTitle":t.action.rTitle=g.wrapRichText(t.action.title,{noLinks:!0,noLinebreaks:!0})||"DELETED"}t.action.user_id&&(t.action.user=r.getUser(t.action.user_id),t.action.userPhoto=r.getUserPhoto(t.action.user_id,"User"))}return t.message&&t.message.length&&(t.richMessage=g.wrapRichText(t.message)),N[e]=t}function F(e){for(var t=0;t0?(c.title=(s.first_name||"")+(s.first_name&&s.last_name?" ":"")+(s.last_name||""),o=d,a=r.getUserString(n)):(c.title=(s.first_name||s.last_name||"Somebody")+" @ "+(i.getChat(-n).title||"Unknown chat"),o=i.getChatPhoto(-n,"Group"),a=i.getChatString(-n)),c.onclick=function(){t.$broadcast("history_focus",{peerString:a})},c.message=u,c.image=o.placeholder,c.key="msg"+e.id,o.location&&!o.location.empty?h.downloadSmallFile(o.location,o.size).then(function(t){c.image=t,e.unread&&m.notify(c)}):m.notify(c)}var T={},N={},z={},q={},R={count:null,dialogs:[]},j={},O={},H={},V=-1,B=f.createIndex(),G={query:!1};return m.start(),t.$on("apiUpdate",function(e,a){switch(a._){case"updateMessageID":O[a.id]=a.random_id;break;case"updateNewMessage":var o=a.message,n=C(o),r=q[n];if(void 0!==r){var i=q[n].history[0];if(o.id<=i)return!1}else r=q[n]={count:null,history:[],pending:[]};D([o]),null!==r.count&&r.count++,r.history.unshift(o.id);var d,c=O[o.id];c&&((d=P(c,o))&&t.$broadcast("history_update",{peerID:n}),delete O[o.id]),d||t.$broadcast("history_append",{peerID:n,messageID:o.id});var u,l=F(n);l.length?(u=l[0],R.dialogs.splice(l[1],1)):u={peerID:n,unread_count:0,top_message:!1},!o.out&&o.unread&&u.unread_count++,u.top_message=o.id,f.indexObject(n,s.getPeerSearchText(n),B),R.dialogs.unshift(u),t.$broadcast("dialogs_update",u),t.idle.isIDLE&&!o.out&&o.unread&&m.getPeerMuted(n).then(function(e){o.unread&&!e&&L(o)});break;case"updateReadMessages":var p,o,h,n,l,u,g={};for(h=0;hr&&(o=e,n=r)}),o}function s(e){var t=angular.copy(l[e])||{_:"photoEmpty"},a=260,o=260,n=i(t,a,o),r={placeholder:"img/placeholders/PhotoThumbConversation.gif",width:a,height:o};return n&&"photoSizeEmpty"!=n._?(n.w>n.h?r.height=parseInt(n.h*a/n.w):r.width=parseInt(n.w*o/n.h),r.location=n.location,r.size=n.size):(r.width=100,r.height=100),t.thumb=r,t}function d(e){if(l[e]){var a=l[e],n=$(window).width()-36,r=$(t).height()-150,s=i(a,n,r);s&&!s.preloaded&&(s.preloaded=!0,s.size?o.downloadFile(s.location.dc_id,{_:"inputFileLocation",volume_id:s.location.volume_id,local_id:s.location.local_id,secret:s.location.secret},s.size):o.downloadSmallFile(s.location))}}function c(e){var a=s(e),o=$(window).width()-36,r=$(t).height()-150,d=i(a,o,r),c={placeholder:"img/placeholders/PhotoThumbModal.gif"};return o>800&&(o-=200),c.width=o,c.height=r,d&&"photoSizeEmpty"!=d._&&(d.w/d.h>o/r?c.height=parseInt(d.h*o/d.w):(c.width=parseInt(d.w*r/d.h),c.width>o&&(c.height=parseInt(c.height*o/c.width),c.width=o)),c.width>=d.w&&c.height>=d.h&&(c.width=d.w,c.height=d.h),c.location=d.location,c.size=d.size),a.full=c,a.fromUser=n.getUser(a.user_id),a}function u(t){var o=a.$new(!0);o.photoID=t;e.open({templateUrl:"partials/photo_modal.html",controller:"PhotoModalController",scope:o,windowClass:"photo_modal_window"})}var l={};return a.preloadPhoto=d,a.openPhoto=u,{savePhoto:r,preloadPhoto:d,wrapForHistory:s,wrapForFull:c,openPhoto:u}}]).service("AppVideoManager",["$rootScope","$modal","$window","$timeout","MtpApiFileManager","AppUsersManager",function(e,t,a,o,n,r){function i(e){l[e.id]=e,e.thumb&&"photoCachedSize"==e.thumb._&&(n.saveSmallFile(e.thumb.location,e.thumb.bytes),e.thumb.size=e.thumb.bytes.length,delete e.thumb.bytes,e.thumb._="photoSize")}function s(e){if(void 0!==p[e])return p[e];var t=angular.copy(l[e]),a=200,o=200,n=t.thumb,r={placeholder:"img/placeholders/VideoThumbConversation.gif",width:a,height:o};return n&&"photoSizeEmpty"!=n._&&(n.w>n.h?r.height=parseInt(n.h*a/n.w):r.width=parseInt(n.w*o/n.h),r.location=n.location,r.size=n.size),t.thumb=r,p[e]=t}function d(e){var t=s(e),o=Math.min($(window).width()-60,542),n=$(a).height()-150,i={placeholder:"img/placeholders/VideoThumbModal.gif",width:o,height:n};return t.w&&t.h?t.w>t.h?i.height=parseInt(t.h*o/t.w):(i.width=parseInt(t.w*n/t.h),i.width>o&&(i.height=parseInt(i.height*o/i.width),i.width=o)):i.height=i.width=Math.min(o,n),t.full=i,t.fullThumb=angular.copy(t.thumb),t.fullThumb.width=i.width,t.fullThumb.height=i.height,t.fromUser=r.getUser(t.user_id),t}function c(a){var o=e.$new(!0);o.videoID=a,o.progress={enabled:!1},o.player={};t.open({templateUrl:"partials/video_modal.html",controller:"VideoModalController",scope:o})}function u(t,a,r){function i(t){console.log("dl progress",t),d.progress.done=t.done,d.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),e.$broadcast("history_update")}var s=l[t],d=p[t]||s||{},c={_:"inputVideoFileLocation",id:t,access_hash:a||s.access_hash};d.progress={enabled:!0,percent:1,total:s.size};var u="mp4",h="video/mpeg4",g="video"+t+"."+u;window.chrome&&chrome.fileSystem&&chrome.fileSystem.chooseEntry?chrome.fileSystem.chooseEntry({type:"saveFile",suggestedName:g,accepts:[{mimeTypes:[h],extensions:[u]}]},function(e){n.downloadFile(s.dc_id,c,s.size,e,{mime:h}).then(function(){delete d.progress,console.log("file save done")},function(e){console.log("video download failed",e),d.progress.enabled=!1},i)}):n.downloadFile(s.dc_id,c,s.size,null,{mime:h}).then(function(e){if(delete d.progress,r)return void window.open(e,"_blank");var t=$("Download").css({position:"absolute",top:1,left:1}).attr("href",e).attr("target","_blank").attr("download",g).appendTo("body");t[0].dataset.downloadurl=[h,g,e].join(":"),t[0].click(),o(function(){t.remove()},100)},function(e){console.log("video download failed",e),d.progress.enabled=!1},i)}var l={},p={};return e.openVideo=c,e.downloadVideo=u,{saveVideo:i,wrapForHistory:s,wrapForFull:d,openVideo:c}}]).service("AppDocsManager",["$rootScope","$modal","$window","$timeout","MtpApiFileManager",function(e,t,a,o,n){function r(e){d[e.id]=e,e.thumb&&"photoCachedSize"==e.thumb._&&(n.saveSmallFile(e.thumb.location,e.thumb.bytes),e.thumb.size=e.thumb.bytes.length,delete e.thumb.bytes,e.thumb._="photoSize")}function i(e){if(void 0!==c[e])return c[e];var t=angular.copy(d[e]),a=100,o=100,n=t.thumb,r={width:a,height:o};return n&&"photoSizeEmpty"!=n._?(n.w>n.h?r.height=parseInt(n.h*a/n.w):r.width=parseInt(n.w*o/n.h),r.location=n.location,r.size=n.size):r=!1,t.thumb=r,t.canDownload=!(window.chrome&&chrome.fileSystem&&chrome.fileSystem.chooseEntry),t.withPreview=t.canDownload&&t.mime_type.match(/^(image\/|application\/pdf)/),c[e]=t}function s(t,a,r){function i(t){console.log("dl progress",t),u.progress.done=t.done,u.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),e.$broadcast("history_update")}var s=d[t],u=c[t]||s||{},l={_:"inputDocumentFileLocation",id:t,access_hash:a||s.access_hash};if(u.progress={enabled:!0,percent:1,total:s.size},window.chrome&&chrome.fileSystem&&chrome.fileSystem.chooseEntry){var p=(s.file_name.split(".",2)||[])[1]||"";chrome.fileSystem.chooseEntry({type:"saveFile",suggestedName:s.file_name,accepts:[{mimeTypes:[s.mime_type],extensions:[p]}]},function(e){n.downloadFile(s.dc_id,l,s.size,e,{mime:s.mime_type}).then(function(){delete u.progress,console.log("file save done")},function(e){console.log("document download failed",e),u.progress.enabled=!1},i)})}else n.downloadFile(s.dc_id,l,s.size,null,{mime:s.mime_type}).then(function(e){if(delete u.progress,r)return void window.open(e,"_blank");var t=$("Download").css({position:"absolute",top:1,left:1}).attr("href",e).attr("target","_blank").attr("download",s.file_name).appendTo("body");t[0].dataset.downloadurl=[s.mime_type,s.file_name,e].join(":"),t[0].click(),o(function(){t.remove()},100)},function(e){console.log("document download failed",e),u.progress.enabled=!1},i)}var d={},c={};return e.downloadDoc=s,{saveDoc:r,wrapForHistory:i,downloadDoc:s}}]).service("AppAudioManager",["$rootScope","$modal","$window","$timeout","$sce","MtpApiFileManager",function(e,t,a,o,n,r){function i(e){c[e.id]=e}function s(e){if(void 0!==u[e])return u[e];var t=angular.copy(c[e]);return u[e]=t}function d(t,a){function i(t){console.log("dl progress",t),d.progress.done=t.done,d.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),e.$broadcast("history_update")}var s=c[t],d=u[t]||s||{},l={_:"inputAudioFileLocation",id:t,access_hash:a||s.access_hash};d.progress={enabled:!0,percent:1,total:s.size},r.downloadFile(s.dc_id,l,s.size,null,{mime:"audio/mpeg"}).then(function(t){delete d.progress,d.url=n.trustAsResourceUrl(t),d.autoplay=!0,o(function(){console.log("disable autoplay"),delete d.autoplay,e.$broadcast("history_update")},1e3)},function(e){console.log("document download failed",e),historyDoc.progress.enabled=!1},i)}var c={},u={};return e.openAudio=d,{saveAudio:i,wrapForHistory:s,openAudio:d}}]).service("ExternalResourcesManager",["$q","$http",function(e,t){function a(e){return void 0!==o[e]?o[e]:o[e]=t.get(e,{responseType:"blob",transformRequest:null}).then(function(e){return window.URL=window.URL||window.webkitURL,window.URL.createObjectURL(e.data)})}var o={};return{downloadImage:a}}]).service("ApiUpdatesManager",["$rootScope","MtpNetworkerFactory","AppUsersManager","AppChatsManager","AppPeersManager","MtpApiManager",function(e,t,a,o,n,r){function i(e){if(l.invalid)return!1;if(e.seq){if(!c(e.seq,e.seq_start))return!1;e.date&&(l.date=e.date)}switch(e._){case"updatesTooLong":s();break;case"updateShort":d(e.update);break;case"updatesCombined":case"updates":a.saveApiUsers(e.users),o.saveApiChats(e.chats);for(var t,i,u,t=0;t 0) { + a = a.subtract(b); + } else { + b = b.subtract(a); + } + } + return b.equals(goog.math.Long.ZERO) ? a : b; +} + +function pqPrimeLong(what) { + var it = 0, + g; + for (var i = 0; i < 3; i++) { + var q = (nextRandomInt(128) & 15) + 17, + x = goog.math.Long.fromInt(nextRandomInt(1000000000) + 1), + y = new goog.math.Long(x.getLowBits(), x.getHighBits()), + lim = 1 << (i + 18); + // console.log(x); + + for (var j = 1; j < lim; j++) { + ++it; + var a = new goog.math.Long(x.getLowBits(), x.getHighBits()), + b = new goog.math.Long(x.getLowBits(), x.getHighBits()), + c = goog.math.Long.fromInt(q); + + // console.log(a, b, c); + + while (b.notEquals(goog.math.Long.ZERO)) { + if (b.and(goog.math.Long.ONE).notEquals(goog.math.Long.ZERO)) { + c = c.add(a); + if (c.compare(what) > 0) { + c = c.subtract(what); + } + } + a = a.add(a); + if (a.compare(what) > 0) { + a = a.subtract(what); + } + b = b.shiftRight(1); + } + + x = new goog.math.Long(c.getLowBits(), c.getHighBits()); + var z = x.compare(y) < 0 ? y.subtract(x) : x.subtract(y); + g = gcdLong(z, what); + if (g.notEquals(goog.math.Long.ONE)) { + break; + } + if ((j & (j - 1)) == 0) { + y = new goog.math.Long(x.getLowBits(), x.getHighBits()); + } + } + if (g.compare(goog.math.Long.ONE) > 0) { + break; + } + } + + var f = what.div(g), P, Q; + + if (g.compare(f) > 0) { + P = f; + Q = g; + } else { + P = g; + Q = f; + } + + return [bytesFromHex(P.toString(16)), bytesFromHex(Q.toString(16))]; +} + function TLSerialization (options) { options = options || {}; @@ -1127,12 +1226,13 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu } console.log(dT(), 'PQ factorization start'); - if (!!window.Worker && false) { + if (!!window.Worker) { var worker = new Worker('js/lib/pq_worker.js'); worker.onmessage = function (e) { auth.p = e.data[0]; auth.q = e.data[1]; + console.log(dT(), 'PQ factorization done'); mtpSendReqDhParams(auth); }; worker.onerror = function(error) { @@ -1145,6 +1245,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu auth.p = pAndQ[0]; auth.q = pAndQ[1]; + console.log(dT(), 'PQ factorization done'); mtpSendReqDhParams(auth); } }, function (error) { diff --git a/js/lib/pq_worker.js b/js/lib/pq_worker.js index 6d0031b5..1eb8ba94 100644 --- a/js/lib/pq_worker.js +++ b/js/lib/pq_worker.js @@ -8,6 +8,7 @@ importScripts( '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', + '../../vendor/closure/long.js', '../../vendor/jsbn/jsbn_combined.js' ); diff --git a/vendor/closure/long.js b/vendor/closure/long.js new file mode 100644 index 00000000..e8a076d4 --- /dev/null +++ b/vendor/closure/long.js @@ -0,0 +1,813 @@ +// Copyright 2009 The Closure Library Authors. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS-IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/** + * @fileoverview Defines a Long class for representing a 64-bit two's-complement + * integer value, which faithfully simulates the behavior of a Java "long". This + * implementation is derived from LongLib in GWT. + * + */ + +/** + * This file also contains some modifications by Igor Zhukov in order to add custom scrollbars to EmojiMenu + * See keyword `MODIFICATION` in source code. + */ + +/*! MODIFICATION +The following line was added by Igor Zhukov in order to make library compatibile with other app parts +*/ +this.goog = {provide: function () {}, math: {}}; + + +goog.provide('goog.math.Long'); + + + +/** + * Constructs a 64-bit two's-complement integer, given its low and high 32-bit + * values as *signed* integers. See the from* functions below for more + * convenient ways of constructing Longs. + * + * The internal representation of a long is the two given signed, 32-bit values. + * We use 32-bit pieces because these are the size of integers on which + * Javascript performs bit-operations. For operations like addition and + * multiplication, we split each number into 16-bit pieces, which can easily be + * multiplied within Javascript's floating-point representation without overflow + * or change in sign. + * + * In the algorithms below, we frequently reduce the negative case to the + * positive case by negating the input(s) and then post-processing the result. + * Note that we must ALWAYS check specially whether those values are MIN_VALUE + * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + * a positive number, it overflows back into a negative). Not handling this + * case would often result in infinite recursion. + * + * @param {number} low The low (signed) 32 bits of the long. + * @param {number} high The high (signed) 32 bits of the long. + * @constructor + */ +goog.math.Long = function(low, high) { + /** + * @type {number} + * @private + */ + this.low_ = low | 0; // force into 32 signed bits. + + /** + * @type {number} + * @private + */ + this.high_ = high | 0; // force into 32 signed bits. +}; + + +// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the +// from* methods on which they depend. + + +/** + * A cache of the Long representations of small integer values. + * @type {!Object} + * @private + */ +goog.math.Long.IntCache_ = {}; + + +/** + * Returns a Long representing the given (32-bit) integer value. + * @param {number} value The 32-bit integer in question. + * @return {!goog.math.Long} The corresponding Long value. + */ +goog.math.Long.fromInt = function(value) { + if (-128 <= value && value < 128) { + var cachedObj = goog.math.Long.IntCache_[value]; + if (cachedObj) { + return cachedObj; + } + } + + var obj = new goog.math.Long(value | 0, value < 0 ? -1 : 0); + if (-128 <= value && value < 128) { + goog.math.Long.IntCache_[value] = obj; + } + return obj; +}; + + +/** + * Returns a Long representing the given value, provided that it is a finite + * number. Otherwise, zero is returned. + * @param {number} value The number in question. + * @return {!goog.math.Long} The corresponding Long value. + */ +goog.math.Long.fromNumber = function(value) { + if (isNaN(value) || !isFinite(value)) { + return goog.math.Long.ZERO; + } else if (value <= -goog.math.Long.TWO_PWR_63_DBL_) { + return goog.math.Long.MIN_VALUE; + } else if (value + 1 >= goog.math.Long.TWO_PWR_63_DBL_) { + return goog.math.Long.MAX_VALUE; + } else if (value < 0) { + return goog.math.Long.fromNumber(-value).negate(); + } else { + return new goog.math.Long( + (value % goog.math.Long.TWO_PWR_32_DBL_) | 0, + (value / goog.math.Long.TWO_PWR_32_DBL_) | 0); + } +}; + + +/** + * Returns a Long representing the 64-bit integer that comes by concatenating + * the given high and low bits. Each is assumed to use 32 bits. + * @param {number} lowBits The low 32-bits. + * @param {number} highBits The high 32-bits. + * @return {!goog.math.Long} The corresponding Long value. + */ +goog.math.Long.fromBits = function(lowBits, highBits) { + return new goog.math.Long(lowBits, highBits); +}; + + +/** + * Returns a Long representation of the given string, written using the given + * radix. + * @param {string} str The textual representation of the Long. + * @param {number=} opt_radix The radix in which the text is written. + * @return {!goog.math.Long} The corresponding Long value. + */ +goog.math.Long.fromString = function(str, opt_radix) { + if (str.length == 0) { + throw Error('number format error: empty string'); + } + + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (str.charAt(0) == '-') { + return goog.math.Long.fromString(str.substring(1), radix).negate(); + } else if (str.indexOf('-') >= 0) { + throw Error('number format error: interior "-" character: ' + str); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 8)); + + var result = goog.math.Long.ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i); + var value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = goog.math.Long.fromNumber(Math.pow(radix, size)); + result = result.multiply(power).add(goog.math.Long.fromNumber(value)); + } else { + result = result.multiply(radixToPower); + result = result.add(goog.math.Long.fromNumber(value)); + } + } + return result; +}; + + +// NOTE: the compiler should inline these constant values below and then remove +// these variables, so there should be no runtime penalty for these. + + +/** + * Number used repeated below in calculations. This must appear before the + * first call to any from* function below. + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_16_DBL_ = 1 << 16; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_24_DBL_ = 1 << 24; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_32_DBL_ = + goog.math.Long.TWO_PWR_16_DBL_ * goog.math.Long.TWO_PWR_16_DBL_; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_31_DBL_ = + goog.math.Long.TWO_PWR_32_DBL_ / 2; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_48_DBL_ = + goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_16_DBL_; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_64_DBL_ = + goog.math.Long.TWO_PWR_32_DBL_ * goog.math.Long.TWO_PWR_32_DBL_; + + +/** + * @type {number} + * @private + */ +goog.math.Long.TWO_PWR_63_DBL_ = + goog.math.Long.TWO_PWR_64_DBL_ / 2; + + +/** @type {!goog.math.Long} */ +goog.math.Long.ZERO = goog.math.Long.fromInt(0); + + +/** @type {!goog.math.Long} */ +goog.math.Long.ONE = goog.math.Long.fromInt(1); + + +/** @type {!goog.math.Long} */ +goog.math.Long.NEG_ONE = goog.math.Long.fromInt(-1); + + +/** @type {!goog.math.Long} */ +goog.math.Long.MAX_VALUE = + goog.math.Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); + + +/** @type {!goog.math.Long} */ +goog.math.Long.MIN_VALUE = goog.math.Long.fromBits(0, 0x80000000 | 0); + + +/** + * @type {!goog.math.Long} + * @private + */ +goog.math.Long.TWO_PWR_24_ = goog.math.Long.fromInt(1 << 24); + + +/** @return {number} The value, assuming it is a 32-bit integer. */ +goog.math.Long.prototype.toInt = function() { + return this.low_; +}; + + +/** @return {number} The closest floating-point representation to this value. */ +goog.math.Long.prototype.toNumber = function() { + return this.high_ * goog.math.Long.TWO_PWR_32_DBL_ + + this.getLowBitsUnsigned(); +}; + + +/** + * @param {number=} opt_radix The radix in which the text should be written. + * @return {string} The textual representation of this value. + * @override + */ +goog.math.Long.prototype.toString = function(opt_radix) { + var radix = opt_radix || 10; + if (radix < 2 || 36 < radix) { + throw Error('radix out of range: ' + radix); + } + + if (this.isZero()) { + return '0'; + } + + if (this.isNegative()) { + if (this.equals(goog.math.Long.MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = goog.math.Long.fromNumber(radix); + var div = this.div(radixLong); + var rem = div.multiply(radixLong).subtract(this); + return div.toString(radix) + rem.toInt().toString(radix); + } else { + return '-' + this.negate().toString(radix); + } + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = goog.math.Long.fromNumber(Math.pow(radix, 6)); + + var rem = this; + var result = ''; + while (true) { + var remDiv = rem.div(radixToPower); + var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); + var digits = intval.toString(radix); + + rem = remDiv; + if (rem.isZero()) { + return digits + result; + } else { + while (digits.length < 6) { + digits = '0' + digits; + } + result = '' + digits + result; + } + } +}; + + +/** @return {number} The high 32-bits as a signed value. */ +goog.math.Long.prototype.getHighBits = function() { + return this.high_; +}; + + +/** @return {number} The low 32-bits as a signed value. */ +goog.math.Long.prototype.getLowBits = function() { + return this.low_; +}; + + +/** @return {number} The low 32-bits as an unsigned value. */ +goog.math.Long.prototype.getLowBitsUnsigned = function() { + return (this.low_ >= 0) ? + this.low_ : goog.math.Long.TWO_PWR_32_DBL_ + this.low_; +}; + + +/** + * @return {number} Returns the number of bits needed to represent the absolute + * value of this Long. + */ +goog.math.Long.prototype.getNumBitsAbs = function() { + if (this.isNegative()) { + if (this.equals(goog.math.Long.MIN_VALUE)) { + return 64; + } else { + return this.negate().getNumBitsAbs(); + } + } else { + var val = this.high_ != 0 ? this.high_ : this.low_; + for (var bit = 31; bit > 0; bit--) { + if ((val & (1 << bit)) != 0) { + break; + } + } + return this.high_ != 0 ? bit + 33 : bit + 1; + } +}; + + +/** @return {boolean} Whether this value is zero. */ +goog.math.Long.prototype.isZero = function() { + return this.high_ == 0 && this.low_ == 0; +}; + + +/** @return {boolean} Whether this value is negative. */ +goog.math.Long.prototype.isNegative = function() { + return this.high_ < 0; +}; + + +/** @return {boolean} Whether this value is odd. */ +goog.math.Long.prototype.isOdd = function() { + return (this.low_ & 1) == 1; +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long equals the other. + */ +goog.math.Long.prototype.equals = function(other) { + return (this.high_ == other.high_) && (this.low_ == other.low_); +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long does not equal the other. + */ +goog.math.Long.prototype.notEquals = function(other) { + return (this.high_ != other.high_) || (this.low_ != other.low_); +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long is less than the other. + */ +goog.math.Long.prototype.lessThan = function(other) { + return this.compare(other) < 0; +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long is less than or equal to the other. + */ +goog.math.Long.prototype.lessThanOrEqual = function(other) { + return this.compare(other) <= 0; +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long is greater than the other. + */ +goog.math.Long.prototype.greaterThan = function(other) { + return this.compare(other) > 0; +}; + + +/** + * @param {goog.math.Long} other Long to compare against. + * @return {boolean} Whether this Long is greater than or equal to the other. + */ +goog.math.Long.prototype.greaterThanOrEqual = function(other) { + return this.compare(other) >= 0; +}; + + +/** + * Compares this Long with the given one. + * @param {goog.math.Long} other Long to compare against. + * @return {number} 0 if they are the same, 1 if the this is greater, and -1 + * if the given one is greater. + */ +goog.math.Long.prototype.compare = function(other) { + if (this.equals(other)) { + return 0; + } + + var thisNeg = this.isNegative(); + var otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) { + return -1; + } + if (!thisNeg && otherNeg) { + return 1; + } + + // at this point, the signs are the same, so subtraction will not overflow + if (this.subtract(other).isNegative()) { + return -1; + } else { + return 1; + } +}; + + +/** @return {!goog.math.Long} The negation of this value. */ +goog.math.Long.prototype.negate = function() { + if (this.equals(goog.math.Long.MIN_VALUE)) { + return goog.math.Long.MIN_VALUE; + } else { + return this.not().add(goog.math.Long.ONE); + } +}; + + +/** + * Returns the sum of this and the given Long. + * @param {goog.math.Long} other Long to add to this one. + * @return {!goog.math.Long} The sum of this and the given Long. + */ +goog.math.Long.prototype.add = function(other) { + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xFFFF; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xFFFF; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xFFFF; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 + b48; + c48 &= 0xFFFF; + return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + + +/** + * Returns the difference of this and the given Long. + * @param {goog.math.Long} other Long to subtract from this. + * @return {!goog.math.Long} The difference of this and the given Long. + */ +goog.math.Long.prototype.subtract = function(other) { + return this.add(other.negate()); +}; + + +/** + * Returns the product of this and the given long. + * @param {goog.math.Long} other Long to multiply with this. + * @return {!goog.math.Long} The product of this and the other. + */ +goog.math.Long.prototype.multiply = function(other) { + if (this.isZero()) { + return goog.math.Long.ZERO; + } else if (other.isZero()) { + return goog.math.Long.ZERO; + } + + if (this.equals(goog.math.Long.MIN_VALUE)) { + return other.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO; + } else if (other.equals(goog.math.Long.MIN_VALUE)) { + return this.isOdd() ? goog.math.Long.MIN_VALUE : goog.math.Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().multiply(other.negate()); + } else { + return this.negate().multiply(other).negate(); + } + } else if (other.isNegative()) { + return this.multiply(other.negate()).negate(); + } + + // If both longs are small, use float multiplication + if (this.lessThan(goog.math.Long.TWO_PWR_24_) && + other.lessThan(goog.math.Long.TWO_PWR_24_)) { + return goog.math.Long.fromNumber(this.toNumber() * other.toNumber()); + } + + // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high_ >>> 16; + var a32 = this.high_ & 0xFFFF; + var a16 = this.low_ >>> 16; + var a00 = this.low_ & 0xFFFF; + + var b48 = other.high_ >>> 16; + var b32 = other.high_ & 0xFFFF; + var b16 = other.low_ >>> 16; + var b00 = other.low_ & 0xFFFF; + + var c48 = 0, c32 = 0, c16 = 0, c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xFFFF; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xFFFF; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xFFFF; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xFFFF; + return goog.math.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); +}; + + +/** + * Returns this Long divided by the given one. + * @param {goog.math.Long} other Long by which to divide. + * @return {!goog.math.Long} This Long divided by the given one. + */ +goog.math.Long.prototype.div = function(other) { + if (other.isZero()) { + throw Error('division by zero'); + } else if (this.isZero()) { + return goog.math.Long.ZERO; + } + + if (this.equals(goog.math.Long.MIN_VALUE)) { + if (other.equals(goog.math.Long.ONE) || + other.equals(goog.math.Long.NEG_ONE)) { + return goog.math.Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + } else if (other.equals(goog.math.Long.MIN_VALUE)) { + return goog.math.Long.ONE; + } else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shiftRight(1); + var approx = halfThis.div(other).shiftLeft(1); + if (approx.equals(goog.math.Long.ZERO)) { + return other.isNegative() ? goog.math.Long.ONE : goog.math.Long.NEG_ONE; + } else { + var rem = this.subtract(other.multiply(approx)); + var result = approx.add(rem.div(other)); + return result; + } + } + } else if (other.equals(goog.math.Long.MIN_VALUE)) { + return goog.math.Long.ZERO; + } + + if (this.isNegative()) { + if (other.isNegative()) { + return this.negate().div(other.negate()); + } else { + return this.negate().div(other).negate(); + } + } else if (other.isNegative()) { + return this.div(other.negate()).negate(); + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + var res = goog.math.Long.ZERO; + var rem = this; + while (rem.greaterThanOrEqual(other)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2); + var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); + + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + var approxRes = goog.math.Long.fromNumber(approx); + var approxRem = approxRes.multiply(other); + while (approxRem.isNegative() || approxRem.greaterThan(rem)) { + approx -= delta; + approxRes = goog.math.Long.fromNumber(approx); + approxRem = approxRes.multiply(other); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) { + approxRes = goog.math.Long.ONE; + } + + res = res.add(approxRes); + rem = rem.subtract(approxRem); + } + return res; +}; + + +/** + * Returns this Long modulo the given one. + * @param {goog.math.Long} other Long by which to mod. + * @return {!goog.math.Long} This Long modulo the given one. + */ +goog.math.Long.prototype.modulo = function(other) { + return this.subtract(this.div(other).multiply(other)); +}; + + +/** @return {!goog.math.Long} The bitwise-NOT of this value. */ +goog.math.Long.prototype.not = function() { + return goog.math.Long.fromBits(~this.low_, ~this.high_); +}; + + +/** + * Returns the bitwise-AND of this Long and the given one. + * @param {goog.math.Long} other The Long with which to AND. + * @return {!goog.math.Long} The bitwise-AND of this and the other. + */ +goog.math.Long.prototype.and = function(other) { + return goog.math.Long.fromBits(this.low_ & other.low_, + this.high_ & other.high_); +}; + + +/** + * Returns the bitwise-OR of this Long and the given one. + * @param {goog.math.Long} other The Long with which to OR. + * @return {!goog.math.Long} The bitwise-OR of this and the other. + */ +goog.math.Long.prototype.or = function(other) { + return goog.math.Long.fromBits(this.low_ | other.low_, + this.high_ | other.high_); +}; + + +/** + * Returns the bitwise-XOR of this Long and the given one. + * @param {goog.math.Long} other The Long with which to XOR. + * @return {!goog.math.Long} The bitwise-XOR of this and the other. + */ +goog.math.Long.prototype.xor = function(other) { + return goog.math.Long.fromBits(this.low_ ^ other.low_, + this.high_ ^ other.high_); +}; + + +/** + * Returns this Long with bits shifted to the left by the given amount. + * @param {number} numBits The number of bits by which to shift. + * @return {!goog.math.Long} This shifted to the left by the given amount. + */ +goog.math.Long.prototype.shiftLeft = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var low = this.low_; + if (numBits < 32) { + var high = this.high_; + return goog.math.Long.fromBits( + low << numBits, + (high << numBits) | (low >>> (32 - numBits))); + } else { + return goog.math.Long.fromBits(0, low << (numBits - 32)); + } + } +}; + + +/** + * Returns this Long with bits shifted to the right by the given amount. + * @param {number} numBits The number of bits by which to shift. + * @return {!goog.math.Long} This shifted to the right by the given amount. + */ +goog.math.Long.prototype.shiftRight = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return goog.math.Long.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >> numBits); + } else { + return goog.math.Long.fromBits( + high >> (numBits - 32), + high >= 0 ? 0 : -1); + } + } +}; + + +/** + * Returns this Long with bits shifted to the right by the given amount, with + * the new top bits matching the current sign bit. + * @param {number} numBits The number of bits by which to shift. + * @return {!goog.math.Long} This shifted to the right by the given amount, with + * zeros placed into the new leading bits. + */ +goog.math.Long.prototype.shiftRightUnsigned = function(numBits) { + numBits &= 63; + if (numBits == 0) { + return this; + } else { + var high = this.high_; + if (numBits < 32) { + var low = this.low_; + return goog.math.Long.fromBits( + (low >>> numBits) | (high << (32 - numBits)), + high >>> numBits); + } else if (numBits == 32) { + return goog.math.Long.fromBits(high, 0); + } else { + return goog.math.Long.fromBits(high >>> (numBits - 32), 0); + } + } +}; \ No newline at end of file