secure-webstore
Advanced tools
Comparing version 1.1.1 to 1.2.1
@@ -1,2 +0,2 @@ | ||
!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("SecureStore",[],r):"object"==typeof exports?exports.SecureStore=r():t.SecureStore=r()}(window,(function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=0)}([function(t,r,e){const n=e(1),o=e(2);t.exports={Store:class{constructor(t,r){if(!t||!r)throw new Error("Store name and passphrase required");this.storeName=t,this.store=new n.Store(t,t),this.passphrase=r}async init(){try{let t=await n.get("__key",this.store);t||(t=await o.genEncryptedMasterKey(this.passphrase),await n.set("__key",t,this.store)),this.encMasterKey=t,this.key=await o.decryptMasterKey(this.passphrase,this.encMasterKey),window.addEventListener("freeze",()=>{this.close()})}catch(t){throw new Error(t.message)}}async updatePassphrase(t,r){try{const e=await o.updatePassphraseKey(t,r,this.encMasterKey);await n.set("__key",e,this.store),this.encMasterKey=e}catch(t){throw new Error(t.message)}}async set(t,r){return r=await o.encrypt(this.key,r),n.set(t,r,this.store)}async get(t){let r,e;try{const e=await n.get(t,this.store);r=await o.decrypt(this.key,e)}catch(t){e=t}return new Promise((t,n)=>r?e?n(e):void t(r):t(r))}del(t){return n.del(t,this.store)}keys(){return n.keys(this.store)}clear(){return n.clear(this.store)}close(){return n.close(this.store)}destroy(){return new Promise((t,r)=>{this.close();const e=window.indexedDB.deleteDatabase(this.storeName);e.onsuccess=r=>{t(r)},e.onerror=t=>{r(t)}})}async export(){const t={},r=await this.keys();if(r)for(const e of r){const r=await n.get(e,this.store);t[e]=r}return t}async import(t){if(!t||0===Object.keys(t).length)throw new Error("No data provided");if("[object Object]"!==Object.prototype.toString.call(t))throw new Error("Data must be a valid JSON object");for(const r of Object.keys(t))await n.set(r,t[r],this.store)}},_idb:n}},function(t,r,e){"use strict";e.r(r),e.d(r,"Store",(function(){return n})),e.d(r,"get",(function(){return s})),e.d(r,"set",(function(){return a})),e.d(r,"del",(function(){return u})),e.d(r,"clear",(function(){return f})),e.d(r,"keys",(function(){return h})),e.d(r,"close",(function(){return c}));class n{constructor(t="keyval-store",r="keyval"){this.storeName=r,this._dbName=t,this._storeName=r,this._init()}_withIDBStore(t,r){return this._init(),this._dbp.then(e=>new Promise((n,o)=>{const i=e.transaction(this.storeName,t);i.oncomplete=()=>n(),i.onabort=i.onerror=()=>o(i.error),r(i.objectStore(this.storeName))}))}_init(){this._dbp||(this._dbp=new Promise((t,r)=>{const e=window.indexedDB.open(this._dbName,1);e.onerror=()=>r(e.error),e.onsuccess=()=>t(e.result),e.onupgradeneeded=()=>{e.result.createObjectStore(this._storeName)}}).then(t=>(t.onclose=()=>{this._dbp=void 0},t.onversionchange=t=>{null===t.newVersion&&(console.log("Got delete request for db"),t.target.close())},t)))}_close(){return this._init(),this._dbp.then(t=>{t.close(),this._dbp=void 0})}}let o;function i(){return o||(o=new n),o}function s(t,r=i()){let e;return r._withIDBStore("readonly",r=>{e=r.get(t)}).then(()=>e.result)}function a(t,r,e=i()){return e._withIDBStore("readwrite",e=>{e.put(r,t)})}function u(t,r=i()){return r._withIDBStore("readwrite",r=>{r.delete(t)})}function f(t=i()){return t._withIDBStore("readwrite",t=>{t.clear()})}function h(t=i()){const r=[];return t._withIDBStore("readonly",t=>{(t.openKeyCursor||t.openCursor).call(t).onsuccess=function(){this.result&&(r.push(this.result.key),this.result.continue())}}).then(()=>r)}function c(t=i()){return t._close()}},function(t,r,e){(function(r){const e=t=>{if(!t.type||"secret"!==t.type)throw new Error("Invalid key type")},n=(t=16)=>{const e=window.crypto.getRandomValues(new Uint8Array(t));return r.from(e)},o=(t=16,r="hex")=>(r&&i(r),n(t).toString(r)),i=t=>{if("hex"!==t&&"base64"!==t)throw new Error("Invalid encoding")},s=(t,e="raw",n="AES-GCM")=>{const o="raw"===e?r.from(t,"base64"):t;return window.crypto.subtle.importKey(e,o,{name:n},!0,["encrypt","decrypt"])},a=async(t,r="raw")=>{const e=await window.crypto.subtle.exportKey(r,t);return"raw"===r?new Uint8Array(e):e},u=async(t,r,e)=>{const n=await window.crypto.subtle.encrypt(e,t,r);return new Uint8Array(n)},f=async(t,r,e)=>{try{const n=await window.crypto.subtle.decrypt(e,t,r);return new Uint8Array(n)}catch(t){if("Unsupported state or unable to authenticate data"===t.message)throw new Error("Unable to decrypt data")}},h=async(t,o,i="hex")=>{e(t);const s={iv:n("AES-GCM"===t.algorithm.name?12:16),plaintext:r.from(JSON.stringify(o))},a={name:t.algorithm.name,iv:s.iv},f=await u(t,s.plaintext,a);return{ciphertext:r.from(f).toString(i),iv:r.from(s.iv).toString(i)}},c=async(t,n,o="hex")=>{e(t);const i={ciphertext:Object.prototype.hasOwnProperty.call(n,"ciphertext")?r.from(n.ciphertext,o):"",iv:Object.prototype.hasOwnProperty.call(n,"iv")?r.from(n.iv,o):""},s={name:t.algorithm.name,iv:i.iv};try{const e=await f(t,i.ciphertext,s);return JSON.parse(r.from(e).toString())}catch(t){throw new Error("Unable to decrypt data")}},p=async(t,e,n,o)=>{n<1e4&&console.warn("Less than 10000 :(");const i=await window.crypto.subtle.importKey("raw","string"==typeof t?r.from(t):t,"PBKDF2",!1,["deriveBits","deriveKey"]),s=await window.crypto.subtle.deriveBits({name:"PBKDF2",salt:e||new Uint8Array([]),iterations:n||1e5,hash:o||"SHA-256"},i,128);return new Uint8Array(s)},l=async(t,e=n(16),o=1e5,i="SHA-256")=>{(t=>{if("string"!=typeof t||""===t)throw new Error("Not a valid value")})(t);const a=await p(t,e,o,i),u=await s(a);return{derivationParams:{salt:r.from(e).toString("hex"),iterations:o,hashAlgo:i},key:u}},y=async(t,e)=>{if(!e.encryptedMasterKey||!e.derivationParams)throw new Error("Missing properties from master key");const{derivationParams:n,encryptedMasterKey:o}=e,{salt:i,iterations:a,hashAlgo:u}=n,f="string"==typeof i?r.from(i,"hex"):i,h=await p(t,f,a,u),l=await s(h);try{const t=await c(l,o),e=r.from(t,"hex");return window.crypto.subtle.importKey("raw",e,{name:"AES-GCM"},!0,["encrypt","decrypt"])}catch(t){throw new Error("Wrong passphrase")}};t.exports={genId:(t=32)=>o(Math.floor(t/2)),hash:async(t,e="hex",n="SHA-256")=>{const o=await window.crypto.subtle.digest({name:n},"string"==typeof t?r.from(t):t);return r.from(o).toString(e)},genKeyPair:(t=!0,r="P-256")=>window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:r},t,["sign","verify"]),importPublicKey:(t,e="P-256",n="base64")=>window.crypto.subtle.importKey("spki",r.from(t,n),{name:"ECDSA",namedCurve:e},!0,["verify"]),importPrivateKey:(t,e="P-256",n="base64")=>window.crypto.subtle.importKey("pkcs8",r.from(t,n),{name:"ECDSA",namedCurve:e},!0,["sign"]),exportPublicKey:async(t,e="base64")=>{const n=await window.crypto.subtle.exportKey("spki",t);return"raw"===e?new Uint8Array(n):r.from(n).toString(e)},exportPrivateKey:async(t,e="base64")=>{const n=await window.crypto.subtle.exportKey("pkcs8",t);return"raw"===e?new Uint8Array(n):r.from(n).toString(e)},sign:async(t,e,n="base64",o="SHA-256")=>{const i=await window.crypto.subtle.sign({name:"ECDSA",hash:{name:"SHA-256"}},t,r.from(JSON.stringify(e)));return"raw"===n?new Uint8Array(i):r.from(i).toString(n)},verify:async(t,e,n,o="base64",i="SHA-256")=>window.crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},t,r.from(n,o),r.from(JSON.stringify(e))),genAESKey:(t=!0,r="AES-GCM",e=128)=>window.crypto.subtle.generateKey({name:r,length:e},t,["decrypt","encrypt"]),importKey:s,exportKey:a,encrypt:h,decrypt:c,encryptBuffer:u,decryptBuffer:f,genEncryptedMasterKey:async(t,r,e,n)=>{const i=await l(t,r,e,n),s=await o(32,"hex"),a=await h(i.key,s);return{derivationParams:i.derivationParams,encryptedMasterKey:a}},decryptMasterKey:y,updatePassphraseKey:async(t,e,n,o,i,s)=>{const u=await y(t,n),f=await l(e,o,i,s),c=r.from(await a(u)).toString("hex"),p=await h(f.key,c);return{derivationParams:f.derivationParams,encryptedMasterKey:p}},_genRandomBuffer:n,_genRandomBufferAsStr:o}}).call(this,e(3).Buffer)},function(t,r,e){"use strict";(function(t){ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("SecureStore",[],e):"object"==typeof exports?exports.SecureStore=e():t.SecureStore=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{a(n.next(t))}catch(t){i(t)}}function s(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}a((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},i=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e._idb=e.Store=void 0;var u=r(1),s=r(2),a=function(){function t(t,e){if(this.storeName=t,this.passphrase=e,!t||!e)throw new Error("Store name and passphrase required");this.store=new u.Store(t,t)}return Object.defineProperty(t.prototype,"key",{get:function(){if(!this._key)throw new Error("Master key not initialized");return this._key},enumerable:!1,configurable:!0}),t.prototype.init=function(){return n(this,void 0,void 0,(function(){var t,e,r,n=this;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,6,,7]),[4,u.get("__key",this.store)];case 1:return(t=o.sent())?[3,4]:[4,s.genEncryptedMasterKey(this.passphrase)];case 2:return t=o.sent(),[4,u.set("__key",t,this.store)];case 3:o.sent(),o.label=4;case 4:return this.encMasterKey=t,e=this,[4,s.decryptMasterKey(this.passphrase,this.encMasterKey)];case 5:return e._key=o.sent(),window.addEventListener("freeze",(function(){n.close()})),[3,7];case 6:throw r=o.sent(),new Error(r.message);case 7:return[2]}}))}))},t.prototype.updatePassphrase=function(t,e){return n(this,void 0,void 0,(function(){var r,n;return o(this,(function(o){switch(o.label){case 0:if(o.trys.push([0,3,,4]),!this.encMasterKey)throw new Error("No password to update set");return[4,s.updatePassphraseKey(t,e,this.encMasterKey)];case 1:return r=o.sent(),[4,u.set("__key",r,this.store)];case 2:return o.sent(),this.encMasterKey=r,[3,4];case 3:throw n=o.sent(),new Error(n.message);case 4:return[2]}}))}))},t.prototype.set=function(t,e){return n(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,s.encrypt(this.key,e)];case 1:return e=r.sent(),[2,u.set(t,e,this.store)]}}))}))},t.prototype.get=function(t){return n(this,void 0,void 0,(function(){var e;return o(this,(function(r){switch(r.label){case 0:return[4,u.get(t,this.store)];case 1:return(e=r.sent())?[4,s.decrypt(this.key,e)]:[2,e];case 2:return[2,r.sent()]}}))}))},t.prototype.del=function(t){return u.del(t,this.store)},t.prototype.keys=function(){return u.keys(this.store)},t.prototype.clear=function(){return u.clear(this.store)},t.prototype.close=function(){return u.close(this.store)},t.prototype.destroy=function(){var t=this;return new Promise((function(e,r){t.close();var n=window.indexedDB.deleteDatabase(t.storeName);n.onsuccess=function(t){e(t)},n.onerror=function(t){r(t)}}))},t.prototype.export=function(){return n(this,void 0,void 0,(function(){var t,e,r,n,s,a,f,c,h;return o(this,(function(o){switch(o.label){case 0:return t={},[4,this.keys()];case 1:if(!(e=o.sent()))return[3,9];o.label=2;case 2:o.trys.push([2,7,8,9]),r=i(e),n=r.next(),o.label=3;case 3:return n.done?[3,6]:"string"!=typeof(s=n.value)&&"number"!=typeof s?[3,5]:[4,u.get(s,this.store)];case 4:a=o.sent(),t[s]=a,o.label=5;case 5:return n=r.next(),[3,3];case 6:return[3,9];case 7:return f=o.sent(),c={error:f},[3,9];case 8:try{n&&!n.done&&(h=r.return)&&h.call(r)}finally{if(c)throw c.error}return[7];case 9:return[2,t]}}))}))},t.prototype.import=function(t){return n(this,void 0,void 0,(function(){var e,r,n,s,a,f;return o(this,(function(o){switch(o.label){case 0:if(!t||0===Object.keys(t).length)throw new Error("No data provided");if("[object Object]"!==Object.prototype.toString.call(t))throw new Error("Data must be a valid JSON object");o.label=1;case 1:o.trys.push([1,6,7,8]),e=i(Object.keys(t)),r=e.next(),o.label=2;case 2:return r.done?[3,5]:(n=r.value,[4,u.set(n,t[n],this.store)]);case 3:o.sent(),o.label=4;case 4:return r=e.next(),[3,2];case 5:return[3,8];case 6:return s=o.sent(),a={error:s},[3,8];case 7:try{r&&!r.done&&(f=e.return)&&f.call(e)}finally{if(a)throw a.error}return[7];case 8:return[2]}}))}))},t}();e.Store=a;var f=u;e._idb=f},function(t,e,r){"use strict";var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{a(n.next(t))}catch(t){i(t)}}function s(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}a((n=n.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.close=e.keys=e.clear=e.del=e.set=e.get=e.Store=void 0;var i,u=function(){function t(t,e){void 0===t&&(t="keyval-store"),void 0===e&&(e="keyval"),this.storeName=e,this._dbName=t,this._storeName=e,this._init()}return t.prototype._withIDBStore=function(t,e){return n(this,void 0,void 0,(function(){var r,n,i=this;return o(this,(function(o){switch(o.label){case 0:return[4,this._init()];case 1:return r=o.sent(),[4,new Promise((function(o,u){var s=r.transaction(i.storeName,t);s.oncomplete=function(){return o()},s.onabort=s.onerror=function(){return u(s.error)},n=e(s.objectStore(i.storeName))}))];case 2:return o.sent(),[2,n]}}))}))},t.prototype._init=function(){return n(this,void 0,void 0,(function(){var t,e=this;return o(this,(function(r){switch(r.label){case 0:return this._dbp?[2,this._dbp]:(t=this,[4,new Promise((function(t,r){var n=window.indexedDB.open(e._dbName,1);n.onerror=function(){return r(n.error)},n.onsuccess=function(){return t(n.result)},n.onupgradeneeded=function(){n.result.createObjectStore(e._storeName)}}))]);case 1:return t._dbp=r.sent(),this._dbp.onclose=function(){e._dbp=void 0},this._dbp.onversionchange=function(t){var r;null===t.newVersion&&(console.log("Got delete request for db"),null===(r=e._dbp)||void 0===r||r.close())},[2,this._dbp]}}))}))},t.prototype._close=function(){var t;null===(t=this._dbp)||void 0===t||t.close()},t}();function s(){return i||(i=new u),i}e.Store=u,e.get=function(t,e){return void 0===e&&(e=s()),n(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return[4,e._withIDBStore("readonly",(function(e){return e.get(t)}))];case 1:return[2,r.sent().result]}}))}))},e.set=function(t,e,r){return void 0===r&&(r=s()),r._withIDBStore("readwrite",(function(r){r.put(e,t)}))},e.del=function(t,e){return void 0===e&&(e=s()),e._withIDBStore("readwrite",(function(e){e.delete(t)}))},e.clear=function(t){return void 0===t&&(t=s()),t._withIDBStore("readwrite",(function(t){t.clear()}))},e.keys=function(t){return void 0===t&&(t=s()),t._withIDBStore("readonly",(function(t){var e=[];return(t.openKeyCursor||t.openCursor).call(t).onsuccess=function(){this.result&&(e.push(this.result.key),this.result.continue())},e}))},e.close=function(t){return void 0===t&&(t=s()),t._close()}},function(t,e,r){window,t.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";(function(t){var r=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function u(t){try{a(n.next(t))}catch(t){i(t)}}function s(t){try{a(n.throw(t))}catch(t){i(t)}}function a(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(u,s)}a((n=n.apply(t,e||[])).next())}))},n=this&&this.__generator||function(t,e){var r,n,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;u;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,n=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e._genRandomBufferAsStr=e._genRandomBuffer=e.updatePassphraseKey=e.decryptMasterKey=e.genEncryptedMasterKey=e.decryptBuffer=e.encryptBuffer=e.decrypt=e.encrypt=e.exportKey=e.importKey=e.genAESKey=e.verify=e.sign=e.exportPrivateKey=e.exportPublicKey=e.importPrivateKey=e.importPublicKey=e.genKeyPair=e.hash=e.genId=void 0;var o=function(t){if(!t.type||"secret"!==t.type)throw new Error("Invalid key type")},i=function(e){void 0===e&&(e=16);var r=window.crypto.getRandomValues(new Uint8Array(e));return t.from(r)},u=function(t,e){return void 0===t&&(t=16),void 0===e&&(e="hex"),e&&s(e),i(t).toString(e)},s=function(t){if("hex"!==t&&"base64"!==t)throw new Error("Invalid encoding")};e.genId=function(t){return void 0===t&&(t=32),u(Math.floor(t/2))},e.hash=function(e,o,i){return void 0===o&&(o="hex"),void 0===i&&(i="SHA-256"),r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.digest({name:i},"string"==typeof e?t.from(e):e)];case 1:return r=n.sent(),[2,t.from(r).toString(o)]}}))}))},e.genKeyPair=function(t,e){return void 0===t&&(t=!0),void 0===e&&(e="P-256"),window.crypto.subtle.generateKey({name:"ECDSA",namedCurve:e},t,["sign","verify"])},e.importPublicKey=function(e,r,n){return void 0===r&&(r="P-256"),void 0===n&&(n="base64"),window.crypto.subtle.importKey("spki","string"==typeof e?t.from(e,n):e,{name:"ECDSA",namedCurve:r},!0,["verify"])},e.importPrivateKey=function(e,r,n){return void 0===r&&(r="P-256"),void 0===n&&(n="base64"),window.crypto.subtle.importKey("pkcs8","string"==typeof e?t.from(e,n):e,{name:"ECDSA",namedCurve:r},!0,["sign"])},e.exportPublicKey=function(e,o){return void 0===o&&(o="base64"),r(this,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.exportKey("spki",e)];case 1:return r=n.sent(),[2,"raw"===o?new Uint8Array(r):t.from(r).toString(o)]}}))}))},e.exportPrivateKey=function(e,o){return void 0===o&&(o="base64"),r(this,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.exportKey("pkcs8",e)];case 1:return r=n.sent(),[2,"raw"===o?new Uint8Array(r):t.from(r).toString(o)]}}))}))},e.sign=function(e,o,i,u){return void 0===i&&(i="base64"),void 0===u&&(u="SHA-256"),r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.sign({name:"ECDSA",hash:{name:u}},e,t.from(JSON.stringify(o)))];case 1:return r=n.sent(),[2,"raw"===i?new Uint8Array(r):t.from(r).toString(i)]}}))}))},e.verify=function(e,o,i,u,s){return void 0===u&&(u="base64"),void 0===s&&(s="SHA-256"),r(void 0,void 0,void 0,(function(){return n(this,(function(r){return[2,window.crypto.subtle.verify({name:"ECDSA",hash:{name:s}},e,t.from(i,u),t.from(JSON.stringify(o)))]}))}))},e.genAESKey=function(t,e,r){return void 0===t&&(t=!0),void 0===e&&(e="AES-GCM"),void 0===r&&(r=128),window.crypto.subtle.generateKey({name:e,length:r},t,["decrypt","encrypt"])};var a=function(e,r,n){void 0===r&&(r="raw"),void 0===n&&(n="AES-GCM");var o="raw"===r?t.from(e,"base64"):e;return window.crypto.subtle.importKey(r,o,{name:n},!0,["encrypt","decrypt"])};e.importKey=a;var f=function(t,e){return void 0===e&&(e="raw"),r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.exportKey(e,t)];case 1:return r=n.sent(),[2,"raw"===e?new Uint8Array(r):r]}}))}))};e.exportKey=f;var c=function(t,e,o){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,window.crypto.subtle.encrypt(o,t,e)];case 1:return r=n.sent(),[2,new Uint8Array(r)]}}))}))};e.encryptBuffer=c;var h=function(t,e,o){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,window.crypto.subtle.decrypt(o,t,e)];case 1:return r=n.sent(),[2,new Uint8Array(r)];case 2:if("Unsupported state or unable to authenticate data"===n.sent().message)throw new Error("Unable to decrypt data");return[3,3];case 3:return[2]}}))}))};e.decryptBuffer=h;var l=function(e,u,s){return void 0===s&&(s="hex"),r(void 0,void 0,void 0,(function(){var r,a,f;return n(this,(function(n){switch(n.label){case 0:return o(e),r={iv:i("AES-GCM"===e.algorithm.name?12:16),plaintext:t.from(JSON.stringify(u))},a={name:e.algorithm.name,iv:r.iv},[4,c(e,r.plaintext,a)];case 1:return f=n.sent(),[2,{ciphertext:t.from(f).toString(s),iv:t.from(r.iv).toString(s)}]}}))}))};e.encrypt=l;var p=function(e,i,u){return void 0===u&&(u="hex"),r(void 0,void 0,void 0,(function(){var r,s,a;return n(this,(function(n){switch(n.label){case 0:o(e),r={ciphertext:t.from(Object.prototype.hasOwnProperty.call(i,"ciphertext")?i.ciphertext:"",u),iv:Object.prototype.hasOwnProperty.call(i,"iv")?t.from(i.iv,u):""},s={name:e.algorithm.name,iv:r.iv},n.label=1;case 1:return n.trys.push([1,3,,4]),[4,h(e,r.ciphertext,s)];case 2:if(void 0===(a=n.sent()))throw new Error;return[2,JSON.parse(t.from(a).toString())];case 3:throw n.sent(),new Error("Unable to decrypt data");case 4:return[2]}}))}))};e.decrypt=p;var y=function(e,o,i,u){return r(void 0,void 0,void 0,(function(){var r,s;return n(this,(function(n){switch(n.label){case 0:return i<1e4&&console.warn("Less than 10000 :("),[4,window.crypto.subtle.importKey("raw","string"==typeof e?t.from(e):e,"PBKDF2",!1,["deriveBits","deriveKey"])];case 1:return r=n.sent(),[4,window.crypto.subtle.deriveBits({name:"PBKDF2",salt:o||new Uint8Array([]),iterations:i||1e5,hash:u||"SHA-256"},r,128)];case 2:return s=n.sent(),[2,new Uint8Array(s)]}}))}))},d=function(e,o,u,s){return void 0===o&&(o=i(16)),void 0===u&&(u=1e5),void 0===s&&(s="SHA-256"),r(void 0,void 0,void 0,(function(){var r,i;return n(this,(function(n){switch(n.label){case 0:return function(t){if("string"!=typeof t||""===t)throw new Error("Not a valid value")}(e),[4,y(e,o,u,s)];case 1:return r=n.sent(),[4,a(r)];case 2:return i=n.sent(),[2,{derivationParams:{salt:t.from(o).toString("hex"),iterations:u,hashAlgo:s},key:i}]}}))}))};e.genEncryptedMasterKey=function(t,e,o,i){return r(void 0,void 0,void 0,(function(){var r,s,a;return n(this,(function(n){switch(n.label){case 0:return[4,d(t,e,o,i)];case 1:return r=n.sent(),s=u(32,"hex"),[4,l(r.key,s)];case 2:return a=n.sent(),[2,{derivationParams:r.derivationParams,encryptedMasterKey:a}]}}))}))},e.updatePassphraseKey=function(e,o,i,u,s,a){return r(void 0,void 0,void 0,(function(){var r,c,h,p,y,w;return n(this,(function(n){switch(n.label){case 0:return[4,v(e,i)];case 1:return r=n.sent(),[4,d(o,u,s,a)];case 2:return c=n.sent(),y=(p=t).from,[4,f(r)];case 3:return h=y.apply(p,[n.sent()]).toString("hex"),[4,l(c.key,h)];case 4:return w=n.sent(),[2,{derivationParams:c.derivationParams,encryptedMasterKey:w}]}}))}))};var v=function(e,o){return r(void 0,void 0,void 0,(function(){var r,i,u,s,f,c,h,l,d,v;return n(this,(function(n){switch(n.label){case 0:if(!o.encryptedMasterKey||!o.derivationParams)throw new Error("Missing properties from master key");return r=o.derivationParams,i=o.encryptedMasterKey,u=r.salt,s=r.iterations,f=r.hashAlgo,c="string"==typeof u?t.from(u,"hex"):u,[4,y(e,c,s,f)];case 1:return h=n.sent(),[4,a(h)];case 2:l=n.sent(),n.label=3;case 3:return n.trys.push([3,5,,6]),[4,p(l,i)];case 4:return d=n.sent(),v=t.from(d,"hex"),[2,window.crypto.subtle.importKey("raw",v,{name:"AES-GCM"},!0,["encrypt","decrypt"])];case 5:throw n.sent(),new Error("Wrong passphrase");case 6:return[2]}}))}))};e.decryptMasterKey=v;var w=i;e._genRandomBuffer=w;var g=u;e._genRandomBufferAsStr=g}).call(this,r(1).Buffer)},function(t,e,r){"use strict";(function(t){ | ||
/*! | ||
@@ -8,3 +8,3 @@ * The buffer module from node.js, for the browser. | ||
*/ | ||
var n=e(5),o=e(6),i=e(7);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,r){if(s()<r)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=u.prototype:(null===t&&(t=new u(r)),t.length=r),t}function u(t,r,e){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return f(this,t,r,e)}function f(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);u.TYPED_ARRAY_SUPPORT?(t=r).__proto__=u.prototype:t=p(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!u.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(r,e),o=(t=a(t,n)).write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(u.isBuffer(r)){var e=0|l(r.length);return 0===(t=a(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?a(t,0):p(t,r);if("Buffer"===r.type&&i(r.data))return p(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function c(t,r){if(h(r),t=a(t,r<0?0:0|l(r)),!u.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function p(t,r){var e=r.length<0?0:0|l(r.length);t=a(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function l(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function y(t,r){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return j(t).length;default:if(n)return N(t).length;r=(""+r).toLowerCase(),n=!0}}function w(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,r,e);case"utf8":case"utf-8":return R(this,r,e);case"ascii":return B(this,r,e);case"latin1":case"binary":return U(this,r,e);case"base64":return P(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function g(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function d(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=u.from(r,n)),u.isBuffer(r))return 0===r.length?-1:m(t,r,e,n,o);if("number"==typeof r)return r&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):m(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function m(t,r,e,n,o){var i,s=1,a=t.length,u=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;s=2,a/=2,u/=2,e/=2}function f(t,r){return 1===s?t[r]:t.readUInt16BE(r*s)}if(o){var h=-1;for(i=e;i<a;i++)if(f(t,i)===f(r,-1===h?0:i-h)){if(-1===h&&(h=i),i-h+1===u)return h*s}else-1!==h&&(i-=i-h),h=-1}else for(e+u>a&&(e=a-u),i=e;i>=0;i--){for(var c=!0,p=0;p<u;p++)if(f(t,i+p)!==f(r,p)){c=!1;break}if(c)return i}return-1}function v(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a=parseInt(r.substr(2*s,2),16);if(isNaN(a))return s;t[e+s]=a}return s}function b(t,r,e,n){return F(N(r,t.length-e),t,e,n)}function A(t,r,e,n){return F(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function E(t,r,e,n){return A(t,r,e,n)}function _(t,r,e,n){return F(j(r),t,e,n)}function S(t,r,e,n){return F(function(t,r){for(var e,n,o,i=[],s=0;s<t.length&&!((r-=2)<0);++s)e=t.charCodeAt(s),n=e>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function P(t,r,e){return 0===r&&e===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(r,e))}function R(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,s,a,u,f=t[o],h=null,c=f>239?4:f>223?3:f>191?2:1;if(o+c<=e)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(h=u);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(u=(15&f)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:i=t[o+1],s=t[o+2],a=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),o+=c}return function(t){var r=t.length;if(r<=4096)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return e}(n)}r.Buffer=u,r.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},r.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),r.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,r,e){return f(null,t,r,e)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,r,e){return function(t,r,e,n){return h(r),r<=0?a(t,r):void 0!==e?"string"==typeof n?a(t,r).fill(e,n):a(t,r).fill(e):a(t,r)}(null,t,r,e)},u.allocUnsafe=function(t){return c(null,t)},u.allocUnsafeSlow=function(t){return c(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,r){if(!u.isBuffer(t)||!u.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,r){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=u.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var s=t[e];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},u.byteLength=y,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)g(this,r,r+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)g(this,r,r+3),g(this,r+1,r+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)g(this,r,r+7),g(this,r+1,r+6),g(this,r+2,r+5),g(this,r+3,r+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?R(this,0,t):w.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,r,e,n,o){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),s=(e>>>=0)-(r>>>=0),a=Math.min(i,s),f=this.slice(n,o),h=t.slice(r,e),c=0;c<a;++c)if(f[c]!==h[c]){i=f[c],s=h[c];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},u.prototype.indexOf=function(t,r,e){return d(this,t,r,e,!0)},u.prototype.lastIndexOf=function(t,r,e){return d(this,t,r,e,!1)},u.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return v(this,t,r,e);case"utf8":case"utf-8":return b(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return _(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function B(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function U(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function T(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=L(t[i]);return o}function x(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function M(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function O(t,r,e,n,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function I(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function C(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function Y(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function D(t,r,e,n,i){return i||Y(t,0,e,4),o.write(t,r,e,n,23,4),e+4}function k(t,r,e,n,i){return i||Y(t,0,e,8),o.write(t,r,e,n,52,8),e+8}u.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),u.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=u.prototype;else{var o=r-t;e=new u(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},u.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},u.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},u.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},u.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},u.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||O(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},u.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||O(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},u.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},u.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):I(this,t,r,!0),r+2},u.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):I(this,t,r,!1),r+2},u.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):C(this,t,r,!0),r+4},u.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},u.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);O(this,t,r,e,o-1,-o)}var i=0,s=1,a=0;for(this[r]=255&t;++i<e&&(s*=256);)t<0&&0===a&&0!==this[r+i-1]&&(a=1),this[r+i]=(t/s>>0)-a&255;return r+e},u.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);O(this,t,r,e,o-1,-o)}var i=e-1,s=1,a=0;for(this[r+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[r+i+1]&&(a=1),this[r+i]=(t/s>>0)-a&255;return r+e},u.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},u.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):I(this,t,r,!0),r+2},u.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):I(this,t,r,!1),r+2},u.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):C(this,t,r,!0),r+4},u.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||O(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):C(this,t,r,!1),r+4},u.prototype.writeFloatLE=function(t,r,e){return D(this,t,r,!0,e)},u.prototype.writeFloatBE=function(t,r,e){return D(this,t,r,!1,e)},u.prototype.writeDoubleLE=function(t,r,e){return k(this,t,r,!0,e)},u.prototype.writeDoubleBE=function(t,r,e){return k(this,t,r,!1,e)},u.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},u.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var s=u.isBuffer(t)?t:N(new u(t,n).toString()),a=s.length;for(i=0;i<e-r;++i)this[i+r]=s[i%a]}return this};var K=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((e=t.charCodeAt(s))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(K,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function F(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}}).call(this,e(4))},function(t,r){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";r.byteLength=function(t){var r=f(t),e=r[0],n=r[1];return 3*(e+n)/4-n},r.toByteArray=function(t){var r,e,n=f(t),s=n[0],a=n[1],u=new i(function(t,r,e){return 3*(r+e)/4-e}(0,s,a)),h=0,c=a>0?s-4:s;for(e=0;e<c;e+=4)r=o[t.charCodeAt(e)]<<18|o[t.charCodeAt(e+1)]<<12|o[t.charCodeAt(e+2)]<<6|o[t.charCodeAt(e+3)],u[h++]=r>>16&255,u[h++]=r>>8&255,u[h++]=255&r;2===a&&(r=o[t.charCodeAt(e)]<<2|o[t.charCodeAt(e+1)]>>4,u[h++]=255&r);1===a&&(r=o[t.charCodeAt(e)]<<10|o[t.charCodeAt(e+1)]<<4|o[t.charCodeAt(e+2)]>>2,u[h++]=r>>8&255,u[h++]=255&r);return u},r.fromByteArray=function(t){for(var r,e=t.length,o=e%3,i=[],s=0,a=e-o;s<a;s+=16383)i.push(h(t,s,s+16383>a?a:s+16383));1===o?(r=t[e-1],i.push(n[r>>2]+n[r<<4&63]+"==")):2===o&&(r=(t[e-2]<<8)+t[e-1],i.push(n[r>>10]+n[r>>4&63]+n[r<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)n[a]=s[a],o[s.charCodeAt(a)]=a;function f(t){var r=t.length;if(r%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return-1===e&&(e=r),[e,e===r?0:4-e%4]}function h(t,r,e){for(var o,i,s=[],a=r;a<e;a+=3)o=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),s.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,r){r.read=function(t,r,e,n,o){var i,s,a=8*o-n-1,u=(1<<a)-1,f=u>>1,h=-7,c=e?o-1:0,p=e?-1:1,l=t[r+c];for(c+=p,i=l&(1<<-h)-1,l>>=-h,h+=a;h>0;i=256*i+t[r+c],c+=p,h-=8);for(s=i&(1<<-h)-1,i>>=-h,h+=n;h>0;s=256*s+t[r+c],c+=p,h-=8);if(0===i)i=1-f;else{if(i===u)return s?NaN:1/0*(l?-1:1);s+=Math.pow(2,n),i-=f}return(l?-1:1)*s*Math.pow(2,i-n)},r.write=function(t,r,e,n,o,i){var s,a,u,f=8*i-o-1,h=(1<<f)-1,c=h>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:i-1,y=n?1:-1,w=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(a=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),r*(u=Math.pow(2,-s))<1&&(s--,u*=2),(r+=s+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(s++,u/=2),s+c>=h?(a=0,s=h):s+c>=1?(a=(r*u-1)*Math.pow(2,o),s+=c):(a=r*Math.pow(2,c-1)*Math.pow(2,o),s=0));o>=8;t[e+l]=255&a,l+=y,a/=256,o-=8);for(s=s<<o|a,f+=o;f>0;t[e+l]=255&s,l+=y,s/=256,f-=8);t[e+l-y]|=128*w}},function(t,r){var e={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}}])})); | ||
var n=r(3),o=r(4),i=r(5);function u(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(u()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=a.prototype:(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,r){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return h(this,t)}return f(this,t,e,r)}function f(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n),a.TYPED_ARRAY_SUPPORT?(t=e).__proto__=a.prototype:t=l(t,e),t}(t,e,r,n):"string"==typeof e?function(t,e,r){if("string"==typeof r&&""!==r||(r="utf8"),!a.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|y(e,r),o=(t=s(t,n)).write(e,r);return o!==n&&(t=t.slice(0,o)),t}(t,e,r):function(t,e){if(a.isBuffer(e)){var r=0|p(e.length);return 0===(t=s(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?s(t,0):l(t,e);if("Buffer"===e.type&&i(e.data))return l(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function h(t,e){if(c(e),t=s(t,e<0?0:0|p(e)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function l(t,e){var r=e.length<0?0:0|p(e.length);t=s(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=u())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u().toString(16)+" bytes");return 0|t}function y(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return L(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(n)return L(t).length;e=(""+e).toLowerCase(),n=!0}}function d(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,r);case"utf8":case"utf-8":return R(this,e,r);case"ascii":return x(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return P(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:g(t,e,r,n,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):g(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function g(t,e,r,n,o){var i,u=1,s=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;u=2,s/=2,a/=2,r/=2}function f(t,e){return 1===u?t[e]:t.readUInt16BE(e*u)}if(o){var c=-1;for(i=r;i<s;i++)if(f(t,i)===f(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===a)return c*u}else-1!==c&&(i-=i-c),c=-1}else for(r+a>s&&(r=s-a),i=r;i>=0;i--){for(var h=!0,l=0;l<a;l++)if(f(t,i+l)!==f(e,l)){h=!1;break}if(h)return i}return-1}function b(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var u=0;u<n;++u){var s=parseInt(e.substr(2*u,2),16);if(isNaN(s))return u;t[r+u]=s}return u}function m(t,e,r,n){return z(L(e,t.length-r),t,r,n)}function _(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return _(t,e,r,n)}function A(t,e,r,n){return z(N(e),t,r,n)}function S(t,e,r,n){return z(function(t,e){for(var r,n,o,i=[],u=0;u<t.length&&!((e-=2)<0);++u)n=(r=t.charCodeAt(u))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function P(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function R(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,u,s,a,f=t[o],c=null,h=f>239?4:f>223?3:f>191?2:1;if(o+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(c=a);break;case 3:i=t[o+1],u=t[o+2],128==(192&i)&&128==(192&u)&&(a=(15&f)<<12|(63&i)<<6|63&u)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:i=t[o+1],u=t[o+2],s=t[o+3],128==(192&i)&&128==(192&u)&&128==(192&s)&&(a=(15&f)<<18|(63&i)<<12|(63&u)<<6|63&s)>65535&&a<1114112&&(c=a)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}function x(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function B(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function T(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=j(t[i]);return o}function U(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function O(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function k(t,e,r,n){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-r,2);o<i;++o)t[r+o]=(e&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function I(t,e,r,n){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-r,4);o<i;++o)t[r+o]=e>>>8*(n?o:3-o)&255}function K(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,i){return i||K(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function Y(t,e,r,n,i){return i||K(t,0,r,8),o.write(t,e,r,n,52,8),r+8}e.Buffer=a,e.SlowBuffer=function(t){return+t!=t&&(t=0),a.alloc(+t)},e.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=u(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,r){return f(null,t,e,r)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,r){return function(t,e,r,n){return c(e),e<=0?s(t,e):void 0!==r?"string"==typeof n?s(t,e).fill(r,n):s(t,e).fill(r):s(t,e)}(null,t,e,r)},a.allocUnsafe=function(t){return h(null,t)},a.allocUnsafeSlow=function(t){return h(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,o=0,i=Math.min(r,n);o<i;++o)if(t[o]!==e[o]){r=t[o],n=e[o];break}return r<n?-1:n<r?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=a.allocUnsafe(e),o=0;for(r=0;r<t.length;++r){var u=t[r];if(!a.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(n,o),o+=u.length}return n},a.byteLength=y,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?R(this,0,t):d.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,r,n,o){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),u=(r>>>=0)-(e>>>=0),s=Math.min(i,u),f=this.slice(n,o),c=t.slice(e,r),h=0;h<s;++h)if(f[h]!==c[h]){i=f[h],u=c[h];break}return i<u?-1:u<i?1:0},a.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},a.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},a.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},a.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return _(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),a.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=a.prototype;else{var o=e-t;r=new a(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},a.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},a.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},a.prototype.readUInt8=function(t,e){return e||O(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||O(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||O(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||O(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},a.prototype.readInt8=function(t,e){return e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||O(t,4,this.length),o.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||O(t,4,this.length),o.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||O(t,8,this.length),o.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||O(t,8,this.length),o.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){t=+t,e|=0,r|=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},a.prototype.writeUIntBE=function(t,e,r,n){t=+t,e|=0,r|=0,n||M(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):I(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=0,u=1,s=0;for(this[e]=255&t;++i<r&&(u*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var o=Math.pow(2,8*r-1);M(this,t,e,r,o-1,-o)}var i=r-1,u=1,s=0;for(this[e+i]=255&t;--i>=0&&(u*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/u>>0)-s&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):k(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):k(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):I(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):I(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return Y(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return Y(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var o,i=n-r;if(this===t&&r<e&&e<n)for(o=i-1;o>=0;--o)t[o+e]=this[o+r];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+i),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{var u=a.isBuffer(t)?t:L(new a(t,n).toString()),s=u.length;for(i=0;i<r-e;++i)this[i+e]=u[i%s]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function L(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],u=0;u<n;++u){if((r=t.charCodeAt(u))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(u+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function N(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(D,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}}).call(this,r(2))},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";e.byteLength=function(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=f(t),u=n[0],s=n[1],a=new i(function(t,e,r){return 3*(e+r)/4-r}(0,u,s)),c=0,h=s>0?u-4:u;for(r=0;r<h;r+=4)e=o[t.charCodeAt(r)]<<18|o[t.charCodeAt(r+1)]<<12|o[t.charCodeAt(r+2)]<<6|o[t.charCodeAt(r+3)],a[c++]=e>>16&255,a[c++]=e>>8&255,a[c++]=255&e;return 2===s&&(e=o[t.charCodeAt(r)]<<2|o[t.charCodeAt(r+1)]>>4,a[c++]=255&e),1===s&&(e=o[t.charCodeAt(r)]<<10|o[t.charCodeAt(r+1)]<<4|o[t.charCodeAt(r+2)]>>2,a[c++]=e>>8&255,a[c++]=255&e),a},e.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],u=0,s=r-o;u<s;u+=16383)i.push(c(t,u,u+16383>s?s:u+16383));return 1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),i.join("")};for(var n=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=u.length;s<a;++s)n[s]=u[s],o[u.charCodeAt(s)]=s;function f(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var o,i,u=[],s=e;s<r;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),u.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return u.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,r,n,o){var i,u,s=8*o-n-1,a=(1<<s)-1,f=a>>1,c=-7,h=r?o-1:0,l=r?-1:1,p=t[e+h];for(h+=l,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+t[e+h],h+=l,c-=8);for(u=i&(1<<-c)-1,i>>=-c,c+=n;c>0;u=256*u+t[e+h],h+=l,c-=8);if(0===i)i=1-f;else{if(i===a)return u?NaN:1/0*(p?-1:1);u+=Math.pow(2,n),i-=f}return(p?-1:1)*u*Math.pow(2,i-n)},e.write=function(t,e,r,n,o,i){var u,s,a,f=8*i-o-1,c=(1<<f)-1,h=c>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,d=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,u=c):(u=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-u))<1&&(u--,a*=2),(e+=u+h>=1?l/a:l*Math.pow(2,1-h))*a>=2&&(u++,a/=2),u+h>=c?(s=0,u=c):u+h>=1?(s=(e*a-1)*Math.pow(2,o),u+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,o),u=0));o>=8;t[r+p]=255&s,p+=y,s/=256,o-=8);for(u=u<<o|s,f+=o;f>0;t[r+p]=255&u,p+=y,u/=256,f-=8);t[r+p-y]|=128*d}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}}])}])})); | ||
//# sourceMappingURL=secure-webstore.js.map |
{ | ||
"name": "secure-webstore", | ||
"version": "1.1.1", | ||
"version": "1.2.1", | ||
"description": "Secure IndexedDB store using encryption", | ||
@@ -18,4 +18,4 @@ "author": "Andrei Sambra", | ||
}, | ||
"main": "dist/securestore.js", | ||
"module": "src/index.js", | ||
"main": "dist/secure-webstore.js", | ||
"module": "src/secure-webstore.js", | ||
"scripts": { | ||
@@ -27,3 +27,3 @@ "build": "webpack -p", | ||
"dependencies": { | ||
"easy-web-crypto": "^1.0.1" | ||
"easy-web-crypto": "^1.2.1" | ||
}, | ||
@@ -36,2 +36,4 @@ "devDependencies": { | ||
"standard": "^13.1.0", | ||
"ts-loader": "^8.0.2", | ||
"typescript": "^3.9.7", | ||
"webpack": "^4.39.2", | ||
@@ -38,0 +40,0 @@ "webpack-cli": "^3.3.6" |
@@ -14,2 +14,4 @@ # Secure-webstore | ||
Huge thanks to [@Jopie64](https://github.com/Jopie64) for Typescriptifying the source! | ||
## Usage | ||
@@ -16,0 +18,0 @@ |
const path = require('path') | ||
module.exports = { | ||
entry: './src/index.js', | ||
entry: './src/secure-webstore.ts', | ||
target: 'web', | ||
devtool: 'source-map', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.tsx?$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/, | ||
}, | ||
], | ||
}, | ||
output: { | ||
@@ -16,3 +25,6 @@ path: path.resolve(__dirname, 'dist'), | ||
fs: 'empty' | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js', '.json'] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14
683
121
161117
9
1
Updatedeasy-web-crypto@^1.2.1