tweb/public/crypto.worker.b0045a30f964b...

2 lines
24 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(()=>{"use strict";var e,t,n={410:(e,t,n)=>{n.d(t,{GO:()=>o,ZP:()=>i});const r=n(1267).Z.debug,o="undefined"!=typeof window?window:self,i=r},4762:(e,t,n)=>{n.d(t,{IS_FIREFOX:()=>f,IS_SAFARI:()=>i});var r=n(6761);const o=navigator?navigator.userAgent:null,i=(navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i),navigator.userAgent.toLowerCase().indexOf("android"),/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor),(/iPad|iPhone|iPod/.test(navigator.platform)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)&&r.Z.MSStream,!!("safari"in r.Z)||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))),f=navigator.userAgent.toLowerCase().indexOf("firefox")>-1;(void 0===navigator.maxTouchPoints||navigator.maxTouchPoints>0)&&navigator.userAgent.search(/iOS|iPhone OS|Android|BlackBerry|BB10|Series ?[64]0|J2ME|MIDP|opera mini|opera mobi|mobi.+Gecko|Windows Phone/i)},1352:(e,t,n)=>{n.d(t,{N5:()=>o,SU:()=>r,kC:()=>i});const r="undefined"!=typeof ServiceWorkerGlobalScope&&self instanceof ServiceWorkerGlobalScope,o="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&!r,i=o||r,f=(e,...t)=>{try{e.postMessage(...t)}catch(e){console.error("[worker] postMessage error:",e,t)}},c=(e,...t)=>{self.clients.matchAll({includeUncontrolled:!1,type:"window"}).then((n=>{n.length&&n.slice(e?0:-1).forEach((e=>{f(e,...t)}))}))};r&&c.bind(null,!1),r&&c.bind(null,!0)},6991:(e,t,n)=>{function r(...e){const t=e.reduce(((e,t)=>e+(t.byteLength||t.length)),0),n=new Uint8Array(t);let r=0;return e.forEach((e=>{n.set(e instanceof ArrayBuffer?new Uint8Array(e):e,r),r+=e.byteLength||e.length})),n}Uint8Array.prototype.concat=function(...e){return r(this,...e)},Uint8Array.prototype.toJSON=function(){return[...this]},Promise.prototype.finally=Promise.prototype.finally||function(e){const t=t=>Promise.resolve(e()).then(t);return this.then((e=>t((()=>e))),(e=>t((()=>Promise.reject(e)))))};var o=n(4736),i=n.n(o);i()(Number.MAX_SAFE_INTEGER);const f=i()(i()[2]).pow(64),c=f.divide(i()[2]);function a(e,t=256){return i().fromArray(e instanceof Uint8Array?[...e]:e,t)}function s(e){return new Uint8Array(e.toArray(256).value)}function u(e,t,n){const r=a(e),o=a(t),i=a(n);return s(r.modPow(o,i))}var h=n(745),l=n.n(h),d=n(6761),y=n(153),p=n(410),v=n(1352);class g extends y.Z{constructor(){super("CRYPTO"),this.lastIndex=-1}invokeCryptoNew({method:e,args:t,transfer:n}){const r={method:e,args:t},o=this.listeners.invoke;if(null==o?void 0:o.length){let e=o[0].callback(r);return v.kC||e instanceof Promise||(e=Promise.resolve(e)),e}const i="aes-encrypt"===e||"aes-decrypt"===e?this.lastIndex=(this.lastIndex+1)%this.sendPorts.length:0;return this.invoke("invoke",r,void 0,this.sendPorts[i],n)}invokeCrypto(e,...t){return this.invokeCryptoNew({method:e,args:t})}}const w=new g;p.GO&&(p.GO.cryptoMessagePort=w);const b=w;function m(e){const t=e.length,n=8*t;let r=i()(e[0]).and(127).shiftLeft(n-8);for(let o=1;o<t;++o){const t=n-8*(o+1),f=i()(e[o]);r=r.or(t?f.shiftLeft(t):f)}return r}const A=["1f609","1f60d","1f61b","1f62d","1f631","1f621","1f60e","1f634","1f635","1f608","1f62c","1f607","1f60f","1f46e","1f477","1f482","1f476","1f468","1f469","1f474","1f475","1f63b","1f63d","1f640","1f47a","1f648","1f649","1f64a","1f480","1f47d","1f4a9","1f525","1f4a5","1f4a4","1f442","1f440","1f443","1f445","1f444","1f44d","1f44e","1f44c","1f44a","270c","270b","1f450","1f446","1f447","1f449","1f448","1f64f","1f44f","1f4aa","1f6b6","1f3c3","1f483","1f46b","1f46a","1f46c","1f46d","1f485","1f3a9","1f451","1f452","1f45f","1f45e","1f460","1f455","1f457","1f456","1f459","1f45c","1f453","1f380","1f484","1f49b","1f499","1f49c","1f49a","1f48d","1f48e","1f436","1f43a","1f431","1f42d","1f439","1f430","1f438","1f42f","1f428","1f43b","1f437","1f42e","1f417","1f434","1f411","1f418","1f43c","1f427","1f425","1f414","1f40d","1f422","1f41b","1f41d","1f41c","1f41e","1f40c","1f419","1f41a","1f41f","1f42c","1f40b","1f410","1f40a","1f42b","1f340","1f339","1f33b","1f341","1f33e","1f344","1f335","1f334","1f333","1f31e","1f31a","1f319","1f30e","1f30b","26a1","2614","2744","26c4","1f300","1f308","1f30a","1f393","1f386","1f383","1f47b","1f385","1f384","1f381","1f388","1f52e","1f3a5","1f4f7","1f4bf","1f4bb","260e","1f4e1","1f4fa","1f4fb","1f509","1f514","23f3","23f0","231a","1f512","1f511","1f50e","1f4a1","1f526","1f50c","1f50b","1f6bf","1f6bd","1f527","1f528","1f6aa","1f6ac","1f4a3","1f52b","1f52a","1f48a","1f489","1f4b0","1f4b5","1f4b3","2709","1f4eb","1f4e6","1f4c5","1f4c1","2702","1f4cc","1f4ce","2712","270f","1f4d0","1f4da","1f52c","1f52d","1f3a8","1f3ac","1f3a4","1f3a7","1f3b5","1f3b9","1f3bb","1f3ba","1f3b8","1f47e","1f3ae","1f0cf","1f3b2","1f3af","1f3c8","1f3c0","26bd","26be","1f3be","1f3b1","1f3c9","1f3b3","1f3c1","1f3c7","1f3c6","1f3ca","1f3c4","2615","1f37c","1f37a","1f377","1f374","1f355","1f354","1f35f","1f357","1f371","1f35a","1f35c","1f361","1f373","1f35e","1f369","1f366","1f382","1f370","1f36a","1f36b","1f36d","1f36f","1f34e","1f34f","1f34a","1f34b","1f352","1f347","1f349","1f353","1f351","1f34c","1f350","1f34d","1f346","1f345","1f33d","1f3e1","1f3e5","1f3e6","26ea","1f3f0","26fa","1f3ed","1f5fb","1f5fd","1f3a0","1f3a1","26f2","1f3a2","1f6a2","1f6a4","2693","1f680","2708","1f681","1f682","1f68b","1f68e","1f68c","1f699","1f697","1f695","1f69b","1f6a8","1f694","1f692","1f691","1f6b2","1f6a0","1f69c","1f6a6","26a0","1f6a7","26fd","1f3b0","1f5ff","1f3aa","1f3ad","1f1ef-1f1f5","1f1f0-1f1f7","1f1e9-1f1ea","1f1e8-1f1f3","1f1fa-1f1f8","1f1eb-1f1f7","1f1ea-1f1f8","1f1ee-1f1f9","1f1f7-1f1fa","1f1ec-1f1e7","0031-20e3","0032-20e3","0033-20e3","0034-20e3","0035-20e3","0036-20e3","0037-20e3","0038-20e3","0039-20e3","0030-20e3","1f51f","2757","2753","2665","2666","1f4af","1f517","1f531","1f534","1f535","1f536","1f537"];function k(e){if(!crypto||!("getRandomValues"in crypto))throw new Error("NO_SECURE_RANDOM");return crypto.getRandomValues(e),e}function S(e,t=16,n,o=!1,i=!1){const f=e.byteLength||e.length,c=o?t-f:t-f%t;if(c>0&&c<t){const t=new Uint8Array(c);if(n)for(let e=0;e<c;++e)t[e]=0;else k(t);return e instanceof ArrayBuffer?(i?r(t,e):r(e,t)).buffer:e instanceof Uint8Array?i?r(t,e):r(e,t):i?[...t].concat(e):e.concat([...t])}return e}function P(e){const t=e.length,n=new Uint8Array(Math.ceil(t/2));let r=0;t%2&&(n[r++]=parseInt(e.charAt(0),16));for(let o=r;o<t;o+=2)n[r++]=parseInt(e.substr(o,2),16);return n}function U(e){return e instanceof Uint8Array?e:"string"==typeof e?(new TextEncoder).encode(e):new Uint8Array(e)}var C=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function f(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(f,c)}a((r=r.apply(e,t||[])).next())}))},x=new Uint8Array(256),K=new Uint8Array(256),E=new Uint32Array(256),L=new Uint32Array(256),O=new Uint32Array(256),F=new Uint32Array(256),_=new Uint32Array(256),I=new Uint32Array(256),z=new Uint32Array(256),N=new Uint32Array(256);function Z(e){if(e instanceof Uint32Array)return e;if("string"==typeof e){if(e.length%4!=0)for(var t=e.length%4;t<=4;t++)e+="\0x00";var n=new Uint32Array(e.length/4);for(t=0;t<e.length;t+=4)n[t/4]=(o=t,(r=e).charCodeAt(o)<<24^r.charCodeAt(o+1)<<16^r.charCodeAt(o+2)<<8^r.charCodeAt(o+3));return n}var r,o;if(e instanceof Uint8Array){for(n=new Uint32Array(e.length/4),t=0;t<e.length;t+=4)n[t/4]=e[t]<<24^e[t+1]<<16^e[t+2]<<8^e[t+3];return n}throw new Error("Unable to create 32-bit words")}function M(e,t,n){void 0===n&&(n=e);for(var r=0;r<e.length;r++)n[r]=e[r]^t[r]}!function(){for(var e,t,n,r,o,i=new Uint8Array(256),f=new Uint8Array(256),c=0,a=0,s=0;s<256;s++)i[s]=s<<1^283*(s>>7),f[i[s]^s]=s;for(;!x[c];c^=e||1)n=(n=a^a<<1^a<<2^a<<3^a<<4)>>8^255&n^99,x[c]=n,K[n]=c,o=16843009*i[t=i[e=i[c]]]^65537*t^257*e^16843008*c,r=257*i[n]^16843008*n,E[c]=r=r<<24^r>>>8,L[c]=r=r<<24^r>>>8,O[c]=r=r<<24^r>>>8,F[c]=r=r<<24^r>>>8,_[n]=o=o<<24^o>>>8,I[n]=o=o<<24^o>>>8,z[n]=o=o<<24^o>>>8,N[n]=o=o<<24^o>>>8,a=f[a]||1}();var R=function(){function e(e){var t=Z(e);if(4!==t.length&&6!==t.length&&8!==t.length)throw new Error("Invalid key size");this.encKey=new Uint32Array(4*t.length+28),this.decKey=new Uint32Array(4*t.length+28),this.encKey.set(t);for(var n,r=1,o=t.length;o<4*t.length+28;o++)n=this.encKey[o-1],(o%t.length==0||8===t.length&&o%t.length==4)&&(n=x[n>>>24]<<24^x[n>>16&255]<<16^x[n>>8&255]<<8^x[255&n],o%t.length==0&&(n=n<<8^n>>>24^r<<24,r=r<<1^283*(r>>7))),this.encKey[o]=this.encKey[o-t.length]^n;for(var i=0;o;i++,o--)n=this.encKey[3&i?o:o-4],this.decKey[i]=o<=4||i<4?n:_[x[n>>>24]]^I[x[n>>16&255]]^z[x[n>>8&255]]^N[x[255&n]]}return e.prototype.encrypt=function(e){for(var t,n,r,o=Z(e),i=new Uint32Array(4),f=o[0]^this.encKey[0],c=o[1]^this.encKey[1],a=o[2]^this.encKey[2],s=o[3]^this.encKey[3],u=this.encKey.length/4-2,h=4,l=0;l<u;l++)t=E[f>>>24]^L[c>>16&255]^O[a>>8&255]^F[255&s]^this.encKey[h],n=E[c>>>24]^L[a>>16&255]^O[s>>8&255]^F[255&f]^this.encKey[h+1],r=E[a>>>24]^L[s>>16&255]^O[f>>8&255]^F[255&c]^this.encKey[h+2],s=E[s>>>24]^L[f>>16&255]^O[c>>8&255]^F[255&a]^this.encKey[h+3],f=t,c=n,a=r,h+=4;for(l=0;l<4;l++)i[l]=x[f>>>24]<<24^x[c>>16&255]<<16^x[a>>8&255]<<8^x[255&s]^this.encKey[h++],t=f,f=c,c=a,a=s,s=t;return i},e.prototype.decrypt=function(e){for(var t,n,r,o=Z(e),i=new Uint32Array(4),f=o[0]^this.decKey[0],c=o[3]^this.decKey[1],a=o[2]^this.decKey[2],s=o[1]^this.decKey[3],u=this.decKey.length/4-2,h=4,l=0;l<u;l++)t=_[f>>>24]^I[c>>16&255]^z[a>>8&255]^N[255&s]^this.decKey[h],n=_[c>>>24]^I[a>>16&255]^z[s>>8&255]^N[255&f]^this.decKey[h+1],r=_[a>>>24]^I[s>>16&255]^z[f>>8&255]^N[255&c]^this.decKey[h+2],s=_[s>>>24]^I[f>>16&255]^z[c>>8&255]^N[255&a]^this.decKey[h+3],f=t,c=n,a=r,h+=4;for(l=0;l<4;l++)i[3&-l]=K[f>>>24]<<24^K[c>>16&255]<<16^K[a>>8&255]<<8^K[255&s]^this.decKey[h++],t=f,f=c,c=a,a=s,s=t;return i},e}(),T=function(){function e(e,t,n){void 0===n&&(n=16),this.key=Z(e),this.iv=Z(t),this.cipher=new R(e),this.blockSize=n/4}return e.prototype.encrypt=function(e,t){for(var n=Z(e),r=t||new Uint32Array(n.length),o=this.iv.subarray(this.blockSize,this.iv.length),i=this.iv.subarray(0,this.blockSize),f=new Uint32Array(this.blockSize),c=0;c<n.length;c+=this.blockSize){var a=n.subarray(c,c+this.blockSize);M(a,i,f);var s=this.cipher.encrypt(f);M(s,o),o=a,i=s;for(var u=c,h=0;u<n.length&&h<4;u++,h++)r[u]=s[h]}return r},e.prototype.decrypt=function(e,t){for(var n=Z(e),r=t||new Uint32Array(n.length),o=this.iv.subarray(this.blockSize,this.iv.length),i=this.iv.subarray(0,this.blockSize),f=new Uint32Array(this.blockSize),c=0;c<r.length;c+=this.blockSize){var a=n.subarray(c,c+this.blockSize);M(a,o,f);var s=this.cipher.decrypt(f);M(s,i),i=a,o=s;for(var u=c,h=0;u<r.length&&h<4;u++,h++)r[u]=s[h]}return r},e}();function B(e){const t=U(e),n=[];for(let e=0,r=t.length;e<r;++e)n[e>>>2]|=t[e]<<24-e%4*8;return new Uint32Array(n)}function W(e,t,n,r=!0){return function(e){const t=new Uint8Array(e.byteLength);for(let n=0,r=4*e.length;n<r;++n)t[n]=e[n>>>2]>>>24-n%4*8&255;return t}(new T(B(t),B(n))[r?"encrypt":"decrypt"](B(e)))}!function(){function e(e,t,n){if(void 0===n&&(n=16),this.offset=0,this.key=Z(e),this.counter=Z(t),this.cipher=new R(e),this.blockSize=n/4,4!==this.counter.length)throw new Error("AES-CTR mode counter must be 16 bytes length")}e.prototype.encrypt=function(e,t){for(var n=Z(e),r=t||new Uint32Array(n.length),o=this.offset,i=0;i<n.length;i+=this.blockSize){for(var f=this.cipher.encrypt(this.counter),c=i,a=o;c<n.length&&a<this.blockSize;c++,a++)r[c]=f[a]^n[c];n.length-i>=this.blockSize&&this.incrementCounter(),o&&(i-=o,o=0)}return this.offset=(this.offset+n.length%4)%4,r},e.prototype.decrypt=function(e,t){return this.encrypt(e,t)},e.prototype.incrementCounter=function(){for(var e=this.counter.length-1;e>=0&&!(++this.counter[e]<4294967295);e--);}}();const G={8:new Uint8Array(1),16:new Uint16Array(1),32:new Uint32Array(1)};function j(e,t){return i().randBetween(e,t,(()=>function(e){const t=G[e];return crypto.getRandomValues(t),t[0]}(32)/4294967295))}function q(e){const t=i()[2];if(e.remainder(t).isZero())return t;const n=i()(1e3);let r,o,f,c,a,s,u;do{r=j(i().one,e.minus(1))}while(r.isZero()||r.eq(e.minus(t)));f=j(i().one,e.minus(1)),a=i().one,s=i().one;const h=i()("FFFFFFFFFFFFFFFF",16).minus(e).plus(1),l=n=>((n=(n=n.pow(t).mod(e)).add(r)).lesser(r)&&(n=n.add(h)),n.mod(e));do{o=f;for(let e=0;i()(e).lesser(a);++e)f=l(f);let t=i().zero;do{c=f;const r=i().min(n,a.minus(t));for(let t=0;i()(t).lesser(r);++t)f=l(f),s=s.multiply(o.greater(f)?o.minus(f):f.minus(o)).mod(e);u=i().gcd(s,e),t=t.add(n)}while(t.lesser(a)&&u.eq(i().one));a=a.shiftLeft(i().one)}while(u.eq(i().one));if(u.eq(e))do{c=l(c),u=i().gcd(o.minus(c).abs(),e)}while(u.eq(i().one));return u}const D="undefined"!=typeof window&&"crypto"in window?window.crypto.subtle:self.crypto.subtle;var J=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function f(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(f,c)}a((r=r.apply(e,t||[])).next())}))};class ${constructor(e,t,n){this.mode=e,this.cryptoKey=t,this.queue=[],this.counter=a(n)}update(e){return J(this,void 0,void 0,(function*(){return new Promise((t=>{this.queue.push({data:e,resolve:t}),this.release()}))}))}release(){return J(this,void 0,void 0,(function*(){if(!this.releasing){for(this.releasing=!0;this.queue.length;){const{data:e,resolve:t}=this.queue.shift();t(yield this._update(e))}this.releasing=!1}}))}perform(e){return J(this,void 0,void 0,(function*(){return yield D[this.mode]({name:"AES-CTR",counter:S(s(this.counter),16,!0,!0,!0),length:128},this.cryptoKey,e)}))}_update(e){return J(this,void 0,void 0,(function*(){let t,n=e;if(this.leftLength){const e=this.leftLength,r=16-e,o=new Uint8Array(e).concat(n.slice(0,r)),i=yield this.perform(o);t=new Uint8Array(i.slice(e)),n=n.slice(r),this.counter=this.counter.add(1)}const r=new Uint8Array(yield this.perform(n)),o=t?t.concat(r):r;let i=n.length;const f=i%16;i-=f;const c=i/16;return this.counter=this.counter.add(c),this.leftLength=f||void 0,o}))}}var V=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function f(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(f,c)}a((r=r.apply(e,t||[])).next())}))};const X=new Map;let H=-1;console.log("CryptoWorker start");const Y={sha1:function(e){return D.digest("SHA-1",U(e)).then((e=>new Uint8Array(e)))},sha256:function(e){return D.digest("SHA-256",U(e)).then((e=>new Uint8Array(e)))},pbkdf2:function(e,t,n){return r=this,o=void 0,f=function*(){const r=yield D.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]);return D.deriveBits({name:"PBKDF2",salt:t,iterations:n,hash:{name:"SHA-512"}},r,512).then((e=>new Uint8Array(e)))},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{a(f.next(e))}catch(e){t(e)}}function c(e){try{a(f.throw(e))}catch(e){t(e)}}function a(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,c)}a((f=f.apply(r,o||[])).next())}));var r,o,i,f},"aes-encrypt":function(e,t,n){return W(S(e),t,n,!0)},"aes-decrypt":function(e,t,n){return W(e,t,n,!1)},"rsa-encrypt":function(e,t){return u(e,P(t.exponent),P(t.modulus))},factorize:function(e){let t=function(e){const t=a(e),n=[],r=[];let o=q(t);n.push(t.divide(o)),n.push(o);do{const e=n.pop();if(!e.eq(i().one))if(e.isPrime(!0)){r.push(e);for(let t=0;t<n.length;++t){let r=n[t];if(r.mod(e).isZero()){do{r=r.divide(e)}while(r.mod(e).isZero());n[t]=r}}}else o=q(e),n.push(e.divide(o)),n.push(o)}while(n.length);return r}(e);t.sort(((e,t)=>e.compare(t))),t.length>2&&(t=[t.splice(t.length-2,1)[0],t.reduce(((e,t)=>e.multiply(t)),i().one)]);const n=t[0],r=t[t.length-1];return(n.lesser(r)?[n,r]:[r,n]).map((e=>s(e)))},"mod-pow":u,gzipUncompress:function(e,t){return l().inflate(e,t?{to:"string"}:void 0)},computeSRP:function(e,t,n){return C(this,void 0,void 0,(function*(){const o=n?t.new_algo:t.current_algo,f=a(o.p),c=i()(o.g),u=yield function(e,t,n){return C(this,void 0,void 0,(function*(){let o=yield b.invokeCrypto("sha256",r(t,(new TextEncoder).encode(e),t));o=r(n,o,n),o=yield b.invokeCrypto("sha256",o);let i=yield b.invokeCrypto("pbkdf2",new Uint8Array(o),t,1e5);return i=r(n,i,n),o=yield b.invokeCrypto("sha256",i),o}))}(e,o.salt1,o.salt2),h=i()(function(e){const t=e.length,n=new Array(t);for(let r=0;r<t;++r)n[r]=(e[r]<16?"0":"")+(e[r]||0).toString(16);return n.join("")}(u),16),l=function(e,t){return e instanceof Uint8Array||(e=U(e)),S(e,t,!0,!0,!0)},d=c.modPow(h,f),y=e=>{const t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=4)t[n]=e[n+3],t[n+1]=e[n+2],t[n+2]=e[n+1],t[n+3]=e[n];return t};if(n)return l(s(d),256);const p=a(t.srp_B),v=l(s(f),256),g=l(s(c),256),w=l(s(p),256),m=a(yield b.invokeCrypto("sha256",r(v,g))).multiply(d).mod(f),A=(e,t)=>{const n=t.subtract(e);return!(n.isNegative()||n.bitLength().toJSNumber()<1984||e.bitLength().toJSNumber()<1984||Math.floor((e.bitLength().toJSNumber()+7)/8)>256)},{a:k,a_for_hash:P,u:x}=yield(()=>C(this,void 0,void 0,(function*(){for(;;){const e=a(y(t.secure_random)),n=c.modPow(e,f);if(A(n,f)){const t=s(n),o=a(yield b.invokeCrypto("sha256",r(t,w)));if(!o.isZero()&&!o.isNegative())return{a:e,a_for_hash:t,u:o}}}})))();let K;K=p.greater(m)?p:p.add(f),K=K.subtract(m).mod(f);const E=x.multiply(h),L=k.add(E),O=K.modPow(L,f),F=yield b.invokeCrypto("sha256",l(s(O),256));let _=yield b.invokeCrypto("sha256",v);_=function(e,t){const n=e.length,r=new Uint8Array(n);for(let o=0;o<n;++o)r[o]=e[o]^t[o];return r}(_,yield b.invokeCrypto("sha256",g));const I=r(_,yield b.invokeCrypto("sha256",o.salt1),yield b.invokeCrypto("sha256",o.salt2),P,w,F),z=yield b.invokeCrypto("sha256",I);return{_:"inputCheckPasswordSRP",srp_id:t.srp_id,A:new Uint8Array(P),M1:z}}))},"generate-dh":function(e){return t=this,n=void 0,o=function*(){const{p:t,g:n}=e,r=(e=>{for(;;){const t=k(new Uint8Array(e.length)),n=a(t);if(!n.greater(i().one))continue;const r=a(e);if(n.lesser(r.subtract(i().one)))return t}})(t),o=P(n.toString(16)),f=S(yield b.invokeCrypto("mod-pow",o,r,t),256,!0,!0,!0);return{a:r,g_a:f,g_a_hash:yield b.invokeCrypto("sha256",f),p:t}},new((r=void 0)||(r=Promise))((function(e,i){function f(e){try{a(o.next(e))}catch(e){i(e)}}function c(e){try{a(o.throw(e))}catch(e){i(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(f,c)}a((o=o.apply(t,n||[])).next())}));var t,n,r,o},"compute-dh-key":function(e,t,n){return r=this,o=void 0,s=function*(){const r=yield b.invokeCrypto("mod-pow",e,t,n);var o;return{key:r,key_fingerprint:(o=a((yield b.invokeCrypto("sha1",r)).slice(-8).reverse()),o.greater(c)?o.minus(f):o).toString(10)}},new((i=void 0)||(i=Promise))((function(e,t){function n(e){try{c(s.next(e))}catch(e){t(e)}}function f(e){try{c(s.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(n,f)}c((s=s.apply(r,o||[])).next())}));var r,o,i,s},"get-emojis-fingerprint":function(e,t){return n=this,r=void 0,i=function*(){const n=e.concat(t),r=yield b.invokeCrypto("sha256",n),o=[],i=A.length;for(let e=0;e!=r.length;e+=8){const t=m(r.slice(e,e+8)).mod(i).toJSNumber(),n=A[t];o.push(n)}return o},new((o=void 0)||(o=Promise))((function(e,t){function f(e){try{a(i.next(e))}catch(e){t(e)}}function c(e){try{a(i.throw(e))}catch(e){t(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(f,c)}a((i=i.apply(n,r||[])).next())}));var n,r,o,i},"aes-ctr-prepare":function({encKey:e,encIv:t,decKey:n,decIv:r}){return V(this,void 0,void 0,(function*(){const o=++H,i=[["encrypt",e],["decrypt",n]].map((([e,t])=>D.importKey("raw",t,{name:"AES-CTR"},!1,[e]))),[f,c]=yield Promise.all(i),a={enc:new $("encrypt",f,t.slice()),dec:new $("decrypt",c,r.slice())};return X.set(o,a),o}))},"aes-ctr-process":function({id:e,data:t,operation:n}){return V(this,void 0,void 0,(function*(){const r=X.get(e);return yield("encrypt"===n?r.enc:r.dec).update(t)}))},"aes-ctr-destroy":function(e){X.delete(e)}};b.addMultipleEventsListeners({invoke:({method:e,args:t})=>Y[e](...t),terminate:()=>{d.Z.close()}}),"undefined"!=typeof MessageChannel&&function(e,t,n){const r=(n,r)=>{e.attachListenPort(n),r&&e.attachSendPort(r),null==t||t(n)};e.setOnPortDisconnect(void 0),"undefined"!=typeof SharedWorkerGlobalScope?d.Z.addEventListener("connect",(e=>r(e.source,e.source))):"undefined"!=typeof ServiceWorkerGlobalScope?r(d.Z,null):r(d.Z,d.Z)}(b,(e=>{const t=new MessageChannel;b.attachPort(t.port1),b.invokeVoid("port",void 0,e,[t.port2])}))},5003:(e,t,n)=>{n.d(t,{kg:()=>d});var r,o=n(410),i=n(4762),f=n(1352),c=n(5289);!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Log=4]="Log",e[e.Debug=8]="Debug"}(r||(r={}));const a=[r.None,r.Error,r.Warn,r.Log,r.Debug],s=!(i.IS_SAFARI||i.IS_FIREFOX),u="",h="",l=[["debug",r.Debug],["info",r.Log],["warn",r.Warn],["error",r.Error],["assert",r.Error],["trace",r.Log],["group",r.Log],["groupCollapsed",r.Log],["groupEnd",r.Log]];function d(e,t=r.Log|r.Warn|r.Error,n=!1,i=""){let y;o.ZP||n||(t=r.Error),s?i||(f.SU?i=u:f.N5&&(i=h)):i="";const p=i;i=i?`%s ${i}%s`:"%s";const v=function(...n){return t&r.Log&&console.log(i,(0,c.Z)(),e,...n)};return l.forEach((([n,r])=>{v[n]=function(...o){return t&r&&console[n](i,(0,c.Z)(),e,...o)}})),v.setPrefix=function(t){y=t,e="["+t+"]"},v.setPrefix(e),v.setLevel=function(e){t=a.slice(0,e+1).reduce(((e,t)=>e|t),0)},v.bindPrefix=function(e){return d(`${y}] [${e}`,t,n,p)},v}}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={id:e,loaded:!1,exports:{}};return n[e].call(i.exports,i,i.exports,o),i.loaded=!0,i.exports}o.m=n,o.x=()=>{var e=o.O(void 0,[699,211,85],(()=>o(6991)));return o.O(e)},e=[],o.O=(t,n,r,i)=>{if(!n){var f=1/0;for(u=0;u<e.length;u++){for(var[n,r,i]=e[u],c=!0,a=0;a<n.length;a++)(!1&i||f>=i)&&Object.keys(o.O).every((e=>o.O[e](n[a])))?n.splice(a--,1):(c=!1,i<f&&(f=i));if(c){e.splice(u--,1);var s=r();void 0!==s&&(t=s)}}return t}i=i||0;for(var u=e.length;u>0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[n,r,i]},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>85===e?"85.887945ef5f43bc205112.bundle.js":{211:"npm.big-integer",699:"npm.pako"}[e]+"."+{211:"363d763daad0ee4e2741",699:"89deb457201f16c93925"}[e]+".chunk.js",o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var t=o.g.document;if(!e&&t&&(t.currentScript&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");n.length&&(e=n[n.length-1].src)}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{if(void 0!==o){var e=o.u,t=o.e,n={},r={};o.u=function(t){return e(t)+(n.hasOwnProperty(t)?"?"+n[t]:"")},o.e=function(i){return t(i).catch((function(t){var f=r.hasOwnProperty(i)?r[i]:999999;if(f<1){var c=e(i);throw t.message="Loading chunk "+i+" failed after 999999 retries.\n("+c+")",t.request=c,t}return new Promise((function(e){setTimeout((function(){var t=Date.now();n[i]=t,r[i]=f-1,e(o.e(i))}),3e3)}))}))}}})(),(()=>{var e={589:1};o.f.i=(t,n)=>{e[t]||importScripts(o.p+o.u(t))};var t=this.webpackChunktweb=this.webpackChunktweb||[],n=t.push.bind(t);t.push=t=>{var[r,i,f]=t;for(var c in i)o.o(i,c)&&(o.m[c]=i[c]);for(f&&f(o);r.length;)e[r.pop()]=1;n(t)}})(),t=o.x,o.x=()=>Promise.all([699,211,85].map(o.e,o)).then(t),o.x()})();
//# sourceMappingURL=crypto.worker.b0045a30f964b72ba240.chunk.js.map