/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./node_modules/crypto-js/aes.js":
/*!***************************************!*\
  !*** ./node_modules/crypto-js/aes.js ***!
  \***************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var BlockCipher = C_lib.BlockCipher;
	    var C_algo = C.algo;

	    // Lookup tables
	    var SBOX = [];
	    var INV_SBOX = [];
	    var SUB_MIX_0 = [];
	    var SUB_MIX_1 = [];
	    var SUB_MIX_2 = [];
	    var SUB_MIX_3 = [];
	    var INV_SUB_MIX_0 = [];
	    var INV_SUB_MIX_1 = [];
	    var INV_SUB_MIX_2 = [];
	    var INV_SUB_MIX_3 = [];

	    // Compute lookup tables
	    (function () {
	        // Compute double table
	        var d = [];
	        for (var i = 0; i < 256; i++) {
	            if (i < 128) {
	                d[i] = i << 1;
	            } else {
	                d[i] = (i << 1) ^ 0x11b;
	            }
	        }

	        // Walk GF(2^8)
	        var x = 0;
	        var xi = 0;
	        for (var i = 0; i < 256; i++) {
	            // Compute sbox
	            var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
	            sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
	            SBOX[x] = sx;
	            INV_SBOX[sx] = x;

	            // Compute multiplication
	            var x2 = d[x];
	            var x4 = d[x2];
	            var x8 = d[x4];

	            // Compute sub bytes, mix columns tables
	            var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
	            SUB_MIX_0[x] = (t << 24) | (t >>> 8);
	            SUB_MIX_1[x] = (t << 16) | (t >>> 16);
	            SUB_MIX_2[x] = (t << 8)  | (t >>> 24);
	            SUB_MIX_3[x] = t;

	            // Compute inv sub bytes, inv mix columns tables
	            var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
	            INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
	            INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
	            INV_SUB_MIX_2[sx] = (t << 8)  | (t >>> 24);
	            INV_SUB_MIX_3[sx] = t;

	            // Compute next counter
	            if (!x) {
	                x = xi = 1;
	            } else {
	                x = x2 ^ d[d[d[x8 ^ x2]]];
	                xi ^= d[d[xi]];
	            }
	        }
	    }());

	    // Precomputed Rcon lookup
	    var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];

	    /**
	     * AES block cipher algorithm.
	     */
	    var AES = C_algo.AES = BlockCipher.extend({
	        _doReset: function () {
	            var t;

	            // Skip reset of nRounds has been set before and key did not change
	            if (this._nRounds && this._keyPriorReset === this._key) {
	                return;
	            }

	            // Shortcuts
	            var key = this._keyPriorReset = this._key;
	            var keyWords = key.words;
	            var keySize = key.sigBytes / 4;

	            // Compute number of rounds
	            var nRounds = this._nRounds = keySize + 6;

	            // Compute number of key schedule rows
	            var ksRows = (nRounds + 1) * 4;

	            // Compute key schedule
	            var keySchedule = this._keySchedule = [];
	            for (var ksRow = 0; ksRow < ksRows; ksRow++) {
	                if (ksRow < keySize) {
	                    keySchedule[ksRow] = keyWords[ksRow];
	                } else {
	                    t = keySchedule[ksRow - 1];

	                    if (!(ksRow % keySize)) {
	                        // Rot word
	                        t = (t << 8) | (t >>> 24);

	                        // Sub word
	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];

	                        // Mix Rcon
	                        t ^= RCON[(ksRow / keySize) | 0] << 24;
	                    } else if (keySize > 6 && ksRow % keySize == 4) {
	                        // Sub word
	                        t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
	                    }

	                    keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
	                }
	            }

	            // Compute inv key schedule
	            var invKeySchedule = this._invKeySchedule = [];
	            for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
	                var ksRow = ksRows - invKsRow;

	                if (invKsRow % 4) {
	                    var t = keySchedule[ksRow];
	                } else {
	                    var t = keySchedule[ksRow - 4];
	                }

	                if (invKsRow < 4 || ksRow <= 4) {
	                    invKeySchedule[invKsRow] = t;
	                } else {
	                    invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
	                                               INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
	                }
	            }
	        },

	        encryptBlock: function (M, offset) {
	            this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
	        },

	        decryptBlock: function (M, offset) {
	            // Swap 2nd and 4th rows
	            var t = M[offset + 1];
	            M[offset + 1] = M[offset + 3];
	            M[offset + 3] = t;

	            this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);

	            // Inv swap 2nd and 4th rows
	            var t = M[offset + 1];
	            M[offset + 1] = M[offset + 3];
	            M[offset + 3] = t;
	        },

	        _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
	            // Shortcut
	            var nRounds = this._nRounds;

	            // Get input, add round key
	            var s0 = M[offset]     ^ keySchedule[0];
	            var s1 = M[offset + 1] ^ keySchedule[1];
	            var s2 = M[offset + 2] ^ keySchedule[2];
	            var s3 = M[offset + 3] ^ keySchedule[3];

	            // Key schedule row counter
	            var ksRow = 4;

	            // Rounds
	            for (var round = 1; round < nRounds; round++) {
	                // Shift rows, sub bytes, mix columns, add round key
	                var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
	                var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
	                var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
	                var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];

	                // Update state
	                s0 = t0;
	                s1 = t1;
	                s2 = t2;
	                s3 = t3;
	            }

	            // Shift rows, sub bytes, add round key
	            var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
	            var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
	            var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
	            var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];

	            // Set output
	            M[offset]     = t0;
	            M[offset + 1] = t1;
	            M[offset + 2] = t2;
	            M[offset + 3] = t3;
	        },

	        keySize: 256/32
	    });

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.AES.decrypt(ciphertext, key, cfg);
	     */
	    C.AES = BlockCipher._createHelper(AES);
	}());


	return CryptoJS.AES;

}));

/***/ }),

/***/ "./node_modules/crypto-js/blowfish.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/blowfish.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var BlockCipher = C_lib.BlockCipher;
	    var C_algo = C.algo;

	    const N = 16;

	    //Origin pbox and sbox, derived from PI
	    const ORIG_P = [
	        0x243F6A88, 0x85A308D3, 0x13198A2E, 0x03707344,
	        0xA4093822, 0x299F31D0, 0x082EFA98, 0xEC4E6C89,
	        0x452821E6, 0x38D01377, 0xBE5466CF, 0x34E90C6C,
	        0xC0AC29B7, 0xC97C50DD, 0x3F84D5B5, 0xB5470917,
	        0x9216D5D9, 0x8979FB1B
	    ];

	    const ORIG_S = [
	        [   0xD1310BA6, 0x98DFB5AC, 0x2FFD72DB, 0xD01ADFB7,
	            0xB8E1AFED, 0x6A267E96, 0xBA7C9045, 0xF12C7F99,
	            0x24A19947, 0xB3916CF7, 0x0801F2E2, 0x858EFC16,
	            0x636920D8, 0x71574E69, 0xA458FEA3, 0xF4933D7E,
	            0x0D95748F, 0x728EB658, 0x718BCD58, 0x82154AEE,
	            0x7B54A41D, 0xC25A59B5, 0x9C30D539, 0x2AF26013,
	            0xC5D1B023, 0x286085F0, 0xCA417918, 0xB8DB38EF,
	            0x8E79DCB0, 0x603A180E, 0x6C9E0E8B, 0xB01E8A3E,
	            0xD71577C1, 0xBD314B27, 0x78AF2FDA, 0x55605C60,
	            0xE65525F3, 0xAA55AB94, 0x57489862, 0x63E81440,
	            0x55CA396A, 0x2AAB10B6, 0xB4CC5C34, 0x1141E8CE,
	            0xA15486AF, 0x7C72E993, 0xB3EE1411, 0x636FBC2A,
	            0x2BA9C55D, 0x741831F6, 0xCE5C3E16, 0x9B87931E,
	            0xAFD6BA33, 0x6C24CF5C, 0x7A325381, 0x28958677,
	            0x3B8F4898, 0x6B4BB9AF, 0xC4BFE81B, 0x66282193,
	            0x61D809CC, 0xFB21A991, 0x487CAC60, 0x5DEC8032,
	            0xEF845D5D, 0xE98575B1, 0xDC262302, 0xEB651B88,
	            0x23893E81, 0xD396ACC5, 0x0F6D6FF3, 0x83F44239,
	            0x2E0B4482, 0xA4842004, 0x69C8F04A, 0x9E1F9B5E,
	            0x21C66842, 0xF6E96C9A, 0x670C9C61, 0xABD388F0,
	            0x6A51A0D2, 0xD8542F68, 0x960FA728, 0xAB5133A3,
	            0x6EEF0B6C, 0x137A3BE4, 0xBA3BF050, 0x7EFB2A98,
	            0xA1F1651D, 0x39AF0176, 0x66CA593E, 0x82430E88,
	            0x8CEE8619, 0x456F9FB4, 0x7D84A5C3, 0x3B8B5EBE,
	            0xE06F75D8, 0x85C12073, 0x401A449F, 0x56C16AA6,
	            0x4ED3AA62, 0x363F7706, 0x1BFEDF72, 0x429B023D,
	            0x37D0D724, 0xD00A1248, 0xDB0FEAD3, 0x49F1C09B,
	            0x075372C9, 0x80991B7B, 0x25D479D8, 0xF6E8DEF7,
	            0xE3FE501A, 0xB6794C3B, 0x976CE0BD, 0x04C006BA,
	            0xC1A94FB6, 0x409F60C4, 0x5E5C9EC2, 0x196A2463,
	            0x68FB6FAF, 0x3E6C53B5, 0x1339B2EB, 0x3B52EC6F,
	            0x6DFC511F, 0x9B30952C, 0xCC814544, 0xAF5EBD09,
	            0xBEE3D004, 0xDE334AFD, 0x660F2807, 0x192E4BB3,
	            0xC0CBA857, 0x45C8740F, 0xD20B5F39, 0xB9D3FBDB,
	            0x5579C0BD, 0x1A60320A, 0xD6A100C6, 0x402C7279,
	            0x679F25FE, 0xFB1FA3CC, 0x8EA5E9F8, 0xDB3222F8,
	            0x3C7516DF, 0xFD616B15, 0x2F501EC8, 0xAD0552AB,
	            0x323DB5FA, 0xFD238760, 0x53317B48, 0x3E00DF82,
	            0x9E5C57BB, 0xCA6F8CA0, 0x1A87562E, 0xDF1769DB,
	            0xD542A8F6, 0x287EFFC3, 0xAC6732C6, 0x8C4F5573,
	            0x695B27B0, 0xBBCA58C8, 0xE1FFA35D, 0xB8F011A0,
	            0x10FA3D98, 0xFD2183B8, 0x4AFCB56C, 0x2DD1D35B,
	            0x9A53E479, 0xB6F84565, 0xD28E49BC, 0x4BFB9790,
	            0xE1DDF2DA, 0xA4CB7E33, 0x62FB1341, 0xCEE4C6E8,
	            0xEF20CADA, 0x36774C01, 0xD07E9EFE, 0x2BF11FB4,
	            0x95DBDA4D, 0xAE909198, 0xEAAD8E71, 0x6B93D5A0,
	            0xD08ED1D0, 0xAFC725E0, 0x8E3C5B2F, 0x8E7594B7,
	            0x8FF6E2FB, 0xF2122B64, 0x8888B812, 0x900DF01C,
	            0x4FAD5EA0, 0x688FC31C, 0xD1CFF191, 0xB3A8C1AD,
	            0x2F2F2218, 0xBE0E1777, 0xEA752DFE, 0x8B021FA1,
	            0xE5A0CC0F, 0xB56F74E8, 0x18ACF3D6, 0xCE89E299,
	            0xB4A84FE0, 0xFD13E0B7, 0x7CC43B81, 0xD2ADA8D9,
	            0x165FA266, 0x80957705, 0x93CC7314, 0x211A1477,
	            0xE6AD2065, 0x77B5FA86, 0xC75442F5, 0xFB9D35CF,
	            0xEBCDAF0C, 0x7B3E89A0, 0xD6411BD3, 0xAE1E7E49,
	            0x00250E2D, 0x2071B35E, 0x226800BB, 0x57B8E0AF,
	            0x2464369B, 0xF009B91E, 0x5563911D, 0x59DFA6AA,
	            0x78C14389, 0xD95A537F, 0x207D5BA2, 0x02E5B9C5,
	            0x83260376, 0x6295CFA9, 0x11C81968, 0x4E734A41,
	            0xB3472DCA, 0x7B14A94A, 0x1B510052, 0x9A532915,
	            0xD60F573F, 0xBC9BC6E4, 0x2B60A476, 0x81E67400,
	            0x08BA6FB5, 0x571BE91F, 0xF296EC6B, 0x2A0DD915,
	            0xB6636521, 0xE7B9F9B6, 0xFF34052E, 0xC5855664,
	            0x53B02D5D, 0xA99F8FA1, 0x08BA4799, 0x6E85076A   ],
	        [   0x4B7A70E9, 0xB5B32944, 0xDB75092E, 0xC4192623,
	            0xAD6EA6B0, 0x49A7DF7D, 0x9CEE60B8, 0x8FEDB266,
	            0xECAA8C71, 0x699A17FF, 0x5664526C, 0xC2B19EE1,
	            0x193602A5, 0x75094C29, 0xA0591340, 0xE4183A3E,
	            0x3F54989A, 0x5B429D65, 0x6B8FE4D6, 0x99F73FD6,
	            0xA1D29C07, 0xEFE830F5, 0x4D2D38E6, 0xF0255DC1,
	            0x4CDD2086, 0x8470EB26, 0x6382E9C6, 0x021ECC5E,
	            0x09686B3F, 0x3EBAEFC9, 0x3C971814, 0x6B6A70A1,
	            0x687F3584, 0x52A0E286, 0xB79C5305, 0xAA500737,
	            0x3E07841C, 0x7FDEAE5C, 0x8E7D44EC, 0x5716F2B8,
	            0xB03ADA37, 0xF0500C0D, 0xF01C1F04, 0x0200B3FF,
	            0xAE0CF51A, 0x3CB574B2, 0x25837A58, 0xDC0921BD,
	            0xD19113F9, 0x7CA92FF6, 0x94324773, 0x22F54701,
	            0x3AE5E581, 0x37C2DADC, 0xC8B57634, 0x9AF3DDA7,
	            0xA9446146, 0x0FD0030E, 0xECC8C73E, 0xA4751E41,
	            0xE238CD99, 0x3BEA0E2F, 0x3280BBA1, 0x183EB331,
	            0x4E548B38, 0x4F6DB908, 0x6F420D03, 0xF60A04BF,
	            0x2CB81290, 0x24977C79, 0x5679B072, 0xBCAF89AF,
	            0xDE9A771F, 0xD9930810, 0xB38BAE12, 0xDCCF3F2E,
	            0x5512721F, 0x2E6B7124, 0x501ADDE6, 0x9F84CD87,
	            0x7A584718, 0x7408DA17, 0xBC9F9ABC, 0xE94B7D8C,
	            0xEC7AEC3A, 0xDB851DFA, 0x63094366, 0xC464C3D2,
	            0xEF1C1847, 0x3215D908, 0xDD433B37, 0x24C2BA16,
	            0x12A14D43, 0x2A65C451, 0x50940002, 0x133AE4DD,
	            0x71DFF89E, 0x10314E55, 0x81AC77D6, 0x5F11199B,
	            0x043556F1, 0xD7A3C76B, 0x3C11183B, 0x5924A509,
	            0xF28FE6ED, 0x97F1FBFA, 0x9EBABF2C, 0x1E153C6E,
	            0x86E34570, 0xEAE96FB1, 0x860E5E0A, 0x5A3E2AB3,
	            0x771FE71C, 0x4E3D06FA, 0x2965DCB9, 0x99E71D0F,
	            0x803E89D6, 0x5266C825, 0x2E4CC978, 0x9C10B36A,
	            0xC6150EBA, 0x94E2EA78, 0xA5FC3C53, 0x1E0A2DF4,
	            0xF2F74EA7, 0x361D2B3D, 0x1939260F, 0x19C27960,
	            0x5223A708, 0xF71312B6, 0xEBADFE6E, 0xEAC31F66,
	            0xE3BC4595, 0xA67BC883, 0xB17F37D1, 0x018CFF28,
	            0xC332DDEF, 0xBE6C5AA5, 0x65582185, 0x68AB9802,
	            0xEECEA50F, 0xDB2F953B, 0x2AEF7DAD, 0x5B6E2F84,
	            0x1521B628, 0x29076170, 0xECDD4775, 0x619F1510,
	            0x13CCA830, 0xEB61BD96, 0x0334FE1E, 0xAA0363CF,
	            0xB5735C90, 0x4C70A239, 0xD59E9E0B, 0xCBAADE14,
	            0xEECC86BC, 0x60622CA7, 0x9CAB5CAB, 0xB2F3846E,
	            0x648B1EAF, 0x19BDF0CA, 0xA02369B9, 0x655ABB50,
	            0x40685A32, 0x3C2AB4B3, 0x319EE9D5, 0xC021B8F7,
	            0x9B540B19, 0x875FA099, 0x95F7997E, 0x623D7DA8,
	            0xF837889A, 0x97E32D77, 0x11ED935F, 0x16681281,
	            0x0E358829, 0xC7E61FD6, 0x96DEDFA1, 0x7858BA99,
	            0x57F584A5, 0x1B227263, 0x9B83C3FF, 0x1AC24696,
	            0xCDB30AEB, 0x532E3054, 0x8FD948E4, 0x6DBC3128,
	            0x58EBF2EF, 0x34C6FFEA, 0xFE28ED61, 0xEE7C3C73,
	            0x5D4A14D9, 0xE864B7E3, 0x42105D14, 0x203E13E0,
	            0x45EEE2B6, 0xA3AAABEA, 0xDB6C4F15, 0xFACB4FD0,
	            0xC742F442, 0xEF6ABBB5, 0x654F3B1D, 0x41CD2105,
	            0xD81E799E, 0x86854DC7, 0xE44B476A, 0x3D816250,
	            0xCF62A1F2, 0x5B8D2646, 0xFC8883A0, 0xC1C7B6A3,
	            0x7F1524C3, 0x69CB7492, 0x47848A0B, 0x5692B285,
	            0x095BBF00, 0xAD19489D, 0x1462B174, 0x23820E00,
	            0x58428D2A, 0x0C55F5EA, 0x1DADF43E, 0x233F7061,
	            0x3372F092, 0x8D937E41, 0xD65FECF1, 0x6C223BDB,
	            0x7CDE3759, 0xCBEE7460, 0x4085F2A7, 0xCE77326E,
	            0xA6078084, 0x19F8509E, 0xE8EFD855, 0x61D99735,
	            0xA969A7AA, 0xC50C06C2, 0x5A04ABFC, 0x800BCADC,
	            0x9E447A2E, 0xC3453484, 0xFDD56705, 0x0E1E9EC9,
	            0xDB73DBD3, 0x105588CD, 0x675FDA79, 0xE3674340,
	            0xC5C43465, 0x713E38D8, 0x3D28F89E, 0xF16DFF20,
	            0x153E21E7, 0x8FB03D4A, 0xE6E39F2B, 0xDB83ADF7   ],
	        [   0xE93D5A68, 0x948140F7, 0xF64C261C, 0x94692934,
	            0x411520F7, 0x7602D4F7, 0xBCF46B2E, 0xD4A20068,
	            0xD4082471, 0x3320F46A, 0x43B7D4B7, 0x500061AF,
	            0x1E39F62E, 0x97244546, 0x14214F74, 0xBF8B8840,
	            0x4D95FC1D, 0x96B591AF, 0x70F4DDD3, 0x66A02F45,
	            0xBFBC09EC, 0x03BD9785, 0x7FAC6DD0, 0x31CB8504,
	            0x96EB27B3, 0x55FD3941, 0xDA2547E6, 0xABCA0A9A,
	            0x28507825, 0x530429F4, 0x0A2C86DA, 0xE9B66DFB,
	            0x68DC1462, 0xD7486900, 0x680EC0A4, 0x27A18DEE,
	            0x4F3FFEA2, 0xE887AD8C, 0xB58CE006, 0x7AF4D6B6,
	            0xAACE1E7C, 0xD3375FEC, 0xCE78A399, 0x406B2A42,
	            0x20FE9E35, 0xD9F385B9, 0xEE39D7AB, 0x3B124E8B,
	            0x1DC9FAF7, 0x4B6D1856, 0x26A36631, 0xEAE397B2,
	            0x3A6EFA74, 0xDD5B4332, 0x6841E7F7, 0xCA7820FB,
	            0xFB0AF54E, 0xD8FEB397, 0x454056AC, 0xBA489527,
	            0x55533A3A, 0x20838D87, 0xFE6BA9B7, 0xD096954B,
	            0x55A867BC, 0xA1159A58, 0xCCA92963, 0x99E1DB33,
	            0xA62A4A56, 0x3F3125F9, 0x5EF47E1C, 0x9029317C,
	            0xFDF8E802, 0x04272F70, 0x80BB155C, 0x05282CE3,
	            0x95C11548, 0xE4C66D22, 0x48C1133F, 0xC70F86DC,
	            0x07F9C9EE, 0x41041F0F, 0x404779A4, 0x5D886E17,
	            0x325F51EB, 0xD59BC0D1, 0xF2BCC18F, 0x41113564,
	            0x257B7834, 0x602A9C60, 0xDFF8E8A3, 0x1F636C1B,
	            0x0E12B4C2, 0x02E1329E, 0xAF664FD1, 0xCAD18115,
	            0x6B2395E0, 0x333E92E1, 0x3B240B62, 0xEEBEB922,
	            0x85B2A20E, 0xE6BA0D99, 0xDE720C8C, 0x2DA2F728,
	            0xD0127845, 0x95B794FD, 0x647D0862, 0xE7CCF5F0,
	            0x5449A36F, 0x877D48FA, 0xC39DFD27, 0xF33E8D1E,
	            0x0A476341, 0x992EFF74, 0x3A6F6EAB, 0xF4F8FD37,
	            0xA812DC60, 0xA1EBDDF8, 0x991BE14C, 0xDB6E6B0D,
	            0xC67B5510, 0x6D672C37, 0x2765D43B, 0xDCD0E804,
	            0xF1290DC7, 0xCC00FFA3, 0xB5390F92, 0x690FED0B,
	            0x667B9FFB, 0xCEDB7D9C, 0xA091CF0B, 0xD9155EA3,
	            0xBB132F88, 0x515BAD24, 0x7B9479BF, 0x763BD6EB,
	            0x37392EB3, 0xCC115979, 0x8026E297, 0xF42E312D,
	            0x6842ADA7, 0xC66A2B3B, 0x12754CCC, 0x782EF11C,
	            0x6A124237, 0xB79251E7, 0x06A1BBE6, 0x4BFB6350,
	            0x1A6B1018, 0x11CAEDFA, 0x3D25BDD8, 0xE2E1C3C9,
	            0x44421659, 0x0A121386, 0xD90CEC6E, 0xD5ABEA2A,
	            0x64AF674E, 0xDA86A85F, 0xBEBFE988, 0x64E4C3FE,
	            0x9DBC8057, 0xF0F7C086, 0x60787BF8, 0x6003604D,
	            0xD1FD8346, 0xF6381FB0, 0x7745AE04, 0xD736FCCC,
	            0x83426B33, 0xF01EAB71, 0xB0804187, 0x3C005E5F,
	            0x77A057BE, 0xBDE8AE24, 0x55464299, 0xBF582E61,
	            0x4E58F48F, 0xF2DDFDA2, 0xF474EF38, 0x8789BDC2,
	            0x5366F9C3, 0xC8B38E74, 0xB475F255, 0x46FCD9B9,
	            0x7AEB2661, 0x8B1DDF84, 0x846A0E79, 0x915F95E2,
	            0x466E598E, 0x20B45770, 0x8CD55591, 0xC902DE4C,
	            0xB90BACE1, 0xBB8205D0, 0x11A86248, 0x7574A99E,
	            0xB77F19B6, 0xE0A9DC09, 0x662D09A1, 0xC4324633,
	            0xE85A1F02, 0x09F0BE8C, 0x4A99A025, 0x1D6EFE10,
	            0x1AB93D1D, 0x0BA5A4DF, 0xA186F20F, 0x2868F169,
	            0xDCB7DA83, 0x573906FE, 0xA1E2CE9B, 0x4FCD7F52,
	            0x50115E01, 0xA70683FA, 0xA002B5C4, 0x0DE6D027,
	            0x9AF88C27, 0x773F8641, 0xC3604C06, 0x61A806B5,
	            0xF0177A28, 0xC0F586E0, 0x006058AA, 0x30DC7D62,
	            0x11E69ED7, 0x2338EA63, 0x53C2DD94, 0xC2C21634,
	            0xBBCBEE56, 0x90BCB6DE, 0xEBFC7DA1, 0xCE591D76,
	            0x6F05E409, 0x4B7C0188, 0x39720A3D, 0x7C927C24,
	            0x86E3725F, 0x724D9DB9, 0x1AC15BB4, 0xD39EB8FC,
	            0xED545578, 0x08FCA5B5, 0xD83D7CD3, 0x4DAD0FC4,
	            0x1E50EF5E, 0xB161E6F8, 0xA28514D9, 0x6C51133C,
	            0x6FD5C7E7, 0x56E14EC4, 0x362ABFCE, 0xDDC6C837,
	            0xD79A3234, 0x92638212, 0x670EFA8E, 0x406000E0  ],
	        [   0x3A39CE37, 0xD3FAF5CF, 0xABC27737, 0x5AC52D1B,
	            0x5CB0679E, 0x4FA33742, 0xD3822740, 0x99BC9BBE,
	            0xD5118E9D, 0xBF0F7315, 0xD62D1C7E, 0xC700C47B,
	            0xB78C1B6B, 0x21A19045, 0xB26EB1BE, 0x6A366EB4,
	            0x5748AB2F, 0xBC946E79, 0xC6A376D2, 0x6549C2C8,
	            0x530FF8EE, 0x468DDE7D, 0xD5730A1D, 0x4CD04DC6,
	            0x2939BBDB, 0xA9BA4650, 0xAC9526E8, 0xBE5EE304,
	            0xA1FAD5F0, 0x6A2D519A, 0x63EF8CE2, 0x9A86EE22,
	            0xC089C2B8, 0x43242EF6, 0xA51E03AA, 0x9CF2D0A4,
	            0x83C061BA, 0x9BE96A4D, 0x8FE51550, 0xBA645BD6,
	            0x2826A2F9, 0xA73A3AE1, 0x4BA99586, 0xEF5562E9,
	            0xC72FEFD3, 0xF752F7DA, 0x3F046F69, 0x77FA0A59,
	            0x80E4A915, 0x87B08601, 0x9B09E6AD, 0x3B3EE593,
	            0xE990FD5A, 0x9E34D797, 0x2CF0B7D9, 0x022B8B51,
	            0x96D5AC3A, 0x017DA67D, 0xD1CF3ED6, 0x7C7D2D28,
	            0x1F9F25CF, 0xADF2B89B, 0x5AD6B472, 0x5A88F54C,
	            0xE029AC71, 0xE019A5E6, 0x47B0ACFD, 0xED93FA9B,
	            0xE8D3C48D, 0x283B57CC, 0xF8D56629, 0x79132E28,
	            0x785F0191, 0xED756055, 0xF7960E44, 0xE3D35E8C,
	            0x15056DD4, 0x88F46DBA, 0x03A16125, 0x0564F0BD,
	            0xC3EB9E15, 0x3C9057A2, 0x97271AEC, 0xA93A072A,
	            0x1B3F6D9B, 0x1E6321F5, 0xF59C66FB, 0x26DCF319,
	            0x7533D928, 0xB155FDF5, 0x03563482, 0x8ABA3CBB,
	            0x28517711, 0xC20AD9F8, 0xABCC5167, 0xCCAD925F,
	            0x4DE81751, 0x3830DC8E, 0x379D5862, 0x9320F991,
	            0xEA7A90C2, 0xFB3E7BCE, 0x5121CE64, 0x774FBE32,
	            0xA8B6E37E, 0xC3293D46, 0x48DE5369, 0x6413E680,
	            0xA2AE0810, 0xDD6DB224, 0x69852DFD, 0x09072166,
	            0xB39A460A, 0x6445C0DD, 0x586CDECF, 0x1C20C8AE,
	            0x5BBEF7DD, 0x1B588D40, 0xCCD2017F, 0x6BB4E3BB,
	            0xDDA26A7E, 0x3A59FF45, 0x3E350A44, 0xBCB4CDD5,
	            0x72EACEA8, 0xFA6484BB, 0x8D6612AE, 0xBF3C6F47,
	            0xD29BE463, 0x542F5D9E, 0xAEC2771B, 0xF64E6370,
	            0x740E0D8D, 0xE75B1357, 0xF8721671, 0xAF537D5D,
	            0x4040CB08, 0x4EB4E2CC, 0x34D2466A, 0x0115AF84,
	            0xE1B00428, 0x95983A1D, 0x06B89FB4, 0xCE6EA048,
	            0x6F3F3B82, 0x3520AB82, 0x011A1D4B, 0x277227F8,
	            0x611560B1, 0xE7933FDC, 0xBB3A792B, 0x344525BD,
	            0xA08839E1, 0x51CE794B, 0x2F32C9B7, 0xA01FBAC9,
	            0xE01CC87E, 0xBCC7D1F6, 0xCF0111C3, 0xA1E8AAC7,
	            0x1A908749, 0xD44FBD9A, 0xD0DADECB, 0xD50ADA38,
	            0x0339C32A, 0xC6913667, 0x8DF9317C, 0xE0B12B4F,
	            0xF79E59B7, 0x43F5BB3A, 0xF2D519FF, 0x27D9459C,
	            0xBF97222C, 0x15E6FC2A, 0x0F91FC71, 0x9B941525,
	            0xFAE59361, 0xCEB69CEB, 0xC2A86459, 0x12BAA8D1,
	            0xB6C1075E, 0xE3056A0C, 0x10D25065, 0xCB03A442,
	            0xE0EC6E0E, 0x1698DB3B, 0x4C98A0BE, 0x3278E964,
	            0x9F1F9532, 0xE0D392DF, 0xD3A0342B, 0x8971F21E,
	            0x1B0A7441, 0x4BA3348C, 0xC5BE7120, 0xC37632D8,
	            0xDF359F8D, 0x9B992F2E, 0xE60B6F47, 0x0FE3F11D,
	            0xE54CDA54, 0x1EDAD891, 0xCE6279CF, 0xCD3E7E6F,
	            0x1618B166, 0xFD2C1D05, 0x848FD2C5, 0xF6FB2299,
	            0xF523F357, 0xA6327623, 0x93A83531, 0x56CCCD02,
	            0xACF08162, 0x5A75EBB5, 0x6E163697, 0x88D273CC,
	            0xDE966292, 0x81B949D0, 0x4C50901B, 0x71C65614,
	            0xE6C6C7BD, 0x327A140A, 0x45E1D006, 0xC3F27B9A,
	            0xC9AA53FD, 0x62A80F00, 0xBB25BFE2, 0x35BDD2F6,
	            0x71126905, 0xB2040222, 0xB6CBCF7C, 0xCD769C2B,
	            0x53113EC0, 0x1640E3D3, 0x38ABBD60, 0x2547ADF0,
	            0xBA38209C, 0xF746CE76, 0x77AFA1C5, 0x20756060,
	            0x85CBFE4E, 0x8AE88DD8, 0x7AAAF9B0, 0x4CF9AA7E,
	            0x1948C25C, 0x02FB8A8C, 0x01C36AE4, 0xD6EBE1F9,
	            0x90D4F869, 0xA65CDEA0, 0x3F09252D, 0xC208E69F,
	            0xB74E6132, 0xCE77E25B, 0x578FDFE3, 0x3AC372E6  ]
	    ];

	    var BLOWFISH_CTX = {
	        pbox: [],
	        sbox: []
	    }

	    function F(ctx, x){
	        let a = (x >> 24) & 0xFF;
	        let b = (x >> 16) & 0xFF;
	        let c = (x >> 8) & 0xFF;
	        let d = x & 0xFF;

	        let y = ctx.sbox[0][a] + ctx.sbox[1][b];
	        y = y ^ ctx.sbox[2][c];
	        y = y + ctx.sbox[3][d];

	        return y;
	    }

	    function BlowFish_Encrypt(ctx, left, right){
	        let Xl = left;
	        let Xr = right;
	        let temp;

	        for(let i = 0; i < N; ++i){
	            Xl = Xl ^ ctx.pbox[i];
	            Xr = F(ctx, Xl) ^ Xr;

	            temp = Xl;
	            Xl = Xr;
	            Xr = temp;
	        }

	        temp = Xl;
	        Xl = Xr;
	        Xr = temp;

	        Xr = Xr ^ ctx.pbox[N];
	        Xl = Xl ^ ctx.pbox[N + 1];

	        return {left: Xl, right: Xr};
	    }

	    function BlowFish_Decrypt(ctx, left, right){
	        let Xl = left;
	        let Xr = right;
	        let temp;

	        for(let i = N + 1; i > 1; --i){
	            Xl = Xl ^ ctx.pbox[i];
	            Xr = F(ctx, Xl) ^ Xr;

	            temp = Xl;
	            Xl = Xr;
	            Xr = temp;
	        }

	        temp = Xl;
	        Xl = Xr;
	        Xr = temp;

	        Xr = Xr ^ ctx.pbox[1];
	        Xl = Xl ^ ctx.pbox[0];

	        return {left: Xl, right: Xr};
	    }

	    /**
	     * Initialization ctx's pbox and sbox.
	     *
	     * @param {Object} ctx The object has pbox and sbox.
	     * @param {Array} key An array of 32-bit words.
	     * @param {int} keysize The length of the key.
	     *
	     * @example
	     *
	     *     BlowFishInit(BLOWFISH_CTX, key, 128/32);
	     */
	    function BlowFishInit(ctx, key, keysize)
	    {
	        for(let Row = 0; Row < 4; Row++)
	        {
	            ctx.sbox[Row] = [];
	            for(let Col = 0; Col < 256; Col++)
	            {
	                ctx.sbox[Row][Col] = ORIG_S[Row][Col];
	            }
	        }

	        let keyIndex = 0;
	        for(let index = 0; index < N + 2; index++)
	        {
	            ctx.pbox[index] = ORIG_P[index] ^ key[keyIndex];
	            keyIndex++;
	            if(keyIndex >= keysize)
	            {
	                keyIndex = 0;
	            }
	        }

	        let Data1 = 0;
	        let Data2 = 0;
	        let res = 0;
	        for(let i = 0; i < N + 2; i += 2)
	        {
	            res = BlowFish_Encrypt(ctx, Data1, Data2);
	            Data1 = res.left;
	            Data2 = res.right;
	            ctx.pbox[i] = Data1;
	            ctx.pbox[i + 1] = Data2;
	        }

	        for(let i = 0; i < 4; i++)
	        {
	            for(let j = 0; j < 256; j += 2)
	            {
	                res = BlowFish_Encrypt(ctx, Data1, Data2);
	                Data1 = res.left;
	                Data2 = res.right;
	                ctx.sbox[i][j] = Data1;
	                ctx.sbox[i][j + 1] = Data2;
	            }
	        }

	        return true;
	    }

	    /**
	     * Blowfish block cipher algorithm.
	     */
	    var Blowfish = C_algo.Blowfish = BlockCipher.extend({
	        _doReset: function () {
	            // Skip reset of nRounds has been set before and key did not change
	            if (this._keyPriorReset === this._key) {
	                return;
	            }

	            // Shortcuts
	            var key = this._keyPriorReset = this._key;
	            var keyWords = key.words;
	            var keySize = key.sigBytes / 4;

	            //Initialization pbox and sbox
	            BlowFishInit(BLOWFISH_CTX, keyWords, keySize);
	        },

	        encryptBlock: function (M, offset) {
	            var res = BlowFish_Encrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
	            M[offset] = res.left;
	            M[offset + 1] = res.right;
	        },

	        decryptBlock: function (M, offset) {
	            var res = BlowFish_Decrypt(BLOWFISH_CTX, M[offset], M[offset + 1]);
	            M[offset] = res.left;
	            M[offset + 1] = res.right;
	        },

	        blockSize: 64/32,

	        keySize: 128/32,

	        ivSize: 64/32
	    });

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.Blowfish.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.Blowfish.decrypt(ciphertext, key, cfg);
	     */
	    C.Blowfish = BlockCipher._createHelper(Blowfish);
	}());


	return CryptoJS.Blowfish;

}));

/***/ }),

/***/ "./node_modules/crypto-js/cipher-core.js":
/*!***********************************************!*\
  !*** ./node_modules/crypto-js/cipher-core.js ***!
  \***********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Cipher core components.
	 */
	CryptoJS.lib.Cipher || (function (undefined) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Base = C_lib.Base;
	    var WordArray = C_lib.WordArray;
	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;
	    var C_enc = C.enc;
	    var Utf8 = C_enc.Utf8;
	    var Base64 = C_enc.Base64;
	    var C_algo = C.algo;
	    var EvpKDF = C_algo.EvpKDF;

	    /**
	     * Abstract base cipher template.
	     *
	     * @property {number} keySize This cipher's key size. Default: 4 (128 bits)
	     * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)
	     * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.
	     * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
	     */
	    var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {WordArray} iv The IV to use for this operation.
	         */
	        cfg: Base.extend(),

	        /**
	         * Creates this cipher in encryption mode.
	         *
	         * @param {WordArray} key The key.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {Cipher} A cipher instance.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
	         */
	        createEncryptor: function (key, cfg) {
	            return this.create(this._ENC_XFORM_MODE, key, cfg);
	        },

	        /**
	         * Creates this cipher in decryption mode.
	         *
	         * @param {WordArray} key The key.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {Cipher} A cipher instance.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
	         */
	        createDecryptor: function (key, cfg) {
	            return this.create(this._DEC_XFORM_MODE, key, cfg);
	        },

	        /**
	         * Initializes a newly created cipher.
	         *
	         * @param {number} xformMode Either the encryption or decryption transormation mode constant.
	         * @param {WordArray} key The key.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @example
	         *
	         *     var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
	         */
	        init: function (xformMode, key, cfg) {
	            // Apply config defaults
	            this.cfg = this.cfg.extend(cfg);

	            // Store transform mode and key
	            this._xformMode = xformMode;
	            this._key = key;

	            // Set initial values
	            this.reset();
	        },

	        /**
	         * Resets this cipher to its initial state.
	         *
	         * @example
	         *
	         *     cipher.reset();
	         */
	        reset: function () {
	            // Reset data buffer
	            BufferedBlockAlgorithm.reset.call(this);

	            // Perform concrete-cipher logic
	            this._doReset();
	        },

	        /**
	         * Adds data to be encrypted or decrypted.
	         *
	         * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
	         *
	         * @return {WordArray} The data after processing.
	         *
	         * @example
	         *
	         *     var encrypted = cipher.process('data');
	         *     var encrypted = cipher.process(wordArray);
	         */
	        process: function (dataUpdate) {
	            // Append
	            this._append(dataUpdate);

	            // Process available blocks
	            return this._process();
	        },

	        /**
	         * Finalizes the encryption or decryption process.
	         * Note that the finalize operation is effectively a destructive, read-once operation.
	         *
	         * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
	         *
	         * @return {WordArray} The data after final processing.
	         *
	         * @example
	         *
	         *     var encrypted = cipher.finalize();
	         *     var encrypted = cipher.finalize('data');
	         *     var encrypted = cipher.finalize(wordArray);
	         */
	        finalize: function (dataUpdate) {
	            // Final data update
	            if (dataUpdate) {
	                this._append(dataUpdate);
	            }

	            // Perform concrete-cipher logic
	            var finalProcessedData = this._doFinalize();

	            return finalProcessedData;
	        },

	        keySize: 128/32,

	        ivSize: 128/32,

	        _ENC_XFORM_MODE: 1,

	        _DEC_XFORM_MODE: 2,

	        /**
	         * Creates shortcut functions to a cipher's object interface.
	         *
	         * @param {Cipher} cipher The cipher to create a helper for.
	         *
	         * @return {Object} An object with encrypt and decrypt shortcut functions.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
	         */
	        _createHelper: (function () {
	            function selectCipherStrategy(key) {
	                if (typeof key == 'string') {
	                    return PasswordBasedCipher;
	                } else {
	                    return SerializableCipher;
	                }
	            }

	            return function (cipher) {
	                return {
	                    encrypt: function (message, key, cfg) {
	                        return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);
	                    },

	                    decrypt: function (ciphertext, key, cfg) {
	                        return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);
	                    }
	                };
	            };
	        }())
	    });

	    /**
	     * Abstract base stream cipher template.
	     *
	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)
	     */
	    var StreamCipher = C_lib.StreamCipher = Cipher.extend({
	        _doFinalize: function () {
	            // Process partial blocks
	            var finalProcessedBlocks = this._process(!!'flush');

	            return finalProcessedBlocks;
	        },

	        blockSize: 1
	    });

	    /**
	     * Mode namespace.
	     */
	    var C_mode = C.mode = {};

	    /**
	     * Abstract base block cipher mode template.
	     */
	    var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
	        /**
	         * Creates this mode for encryption.
	         *
	         * @param {Cipher} cipher A block cipher instance.
	         * @param {Array} iv The IV words.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
	         */
	        createEncryptor: function (cipher, iv) {
	            return this.Encryptor.create(cipher, iv);
	        },

	        /**
	         * Creates this mode for decryption.
	         *
	         * @param {Cipher} cipher A block cipher instance.
	         * @param {Array} iv The IV words.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
	         */
	        createDecryptor: function (cipher, iv) {
	            return this.Decryptor.create(cipher, iv);
	        },

	        /**
	         * Initializes a newly created mode.
	         *
	         * @param {Cipher} cipher A block cipher instance.
	         * @param {Array} iv The IV words.
	         *
	         * @example
	         *
	         *     var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
	         */
	        init: function (cipher, iv) {
	            this._cipher = cipher;
	            this._iv = iv;
	        }
	    });

	    /**
	     * Cipher Block Chaining mode.
	     */
	    var CBC = C_mode.CBC = (function () {
	        /**
	         * Abstract base CBC mode.
	         */
	        var CBC = BlockCipherMode.extend();

	        /**
	         * CBC encryptor.
	         */
	        CBC.Encryptor = CBC.extend({
	            /**
	             * Processes the data block at offset.
	             *
	             * @param {Array} words The data words to operate on.
	             * @param {number} offset The offset where the block starts.
	             *
	             * @example
	             *
	             *     mode.processBlock(data.words, offset);
	             */
	            processBlock: function (words, offset) {
	                // Shortcuts
	                var cipher = this._cipher;
	                var blockSize = cipher.blockSize;

	                // XOR and encrypt
	                xorBlock.call(this, words, offset, blockSize);
	                cipher.encryptBlock(words, offset);

	                // Remember this block to use with next block
	                this._prevBlock = words.slice(offset, offset + blockSize);
	            }
	        });

	        /**
	         * CBC decryptor.
	         */
	        CBC.Decryptor = CBC.extend({
	            /**
	             * Processes the data block at offset.
	             *
	             * @param {Array} words The data words to operate on.
	             * @param {number} offset The offset where the block starts.
	             *
	             * @example
	             *
	             *     mode.processBlock(data.words, offset);
	             */
	            processBlock: function (words, offset) {
	                // Shortcuts
	                var cipher = this._cipher;
	                var blockSize = cipher.blockSize;

	                // Remember this block to use with next block
	                var thisBlock = words.slice(offset, offset + blockSize);

	                // Decrypt and XOR
	                cipher.decryptBlock(words, offset);
	                xorBlock.call(this, words, offset, blockSize);

	                // This block becomes the previous block
	                this._prevBlock = thisBlock;
	            }
	        });

	        function xorBlock(words, offset, blockSize) {
	            var block;

	            // Shortcut
	            var iv = this._iv;

	            // Choose mixing block
	            if (iv) {
	                block = iv;

	                // Remove IV for subsequent blocks
	                this._iv = undefined;
	            } else {
	                block = this._prevBlock;
	            }

	            // XOR blocks
	            for (var i = 0; i < blockSize; i++) {
	                words[offset + i] ^= block[i];
	            }
	        }

	        return CBC;
	    }());

	    /**
	     * Padding namespace.
	     */
	    var C_pad = C.pad = {};

	    /**
	     * PKCS #5/7 padding strategy.
	     */
	    var Pkcs7 = C_pad.Pkcs7 = {
	        /**
	         * Pads data using the algorithm defined in PKCS #5/7.
	         *
	         * @param {WordArray} data The data to pad.
	         * @param {number} blockSize The multiple that the data should be padded to.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     CryptoJS.pad.Pkcs7.pad(wordArray, 4);
	         */
	        pad: function (data, blockSize) {
	            // Shortcut
	            var blockSizeBytes = blockSize * 4;

	            // Count padding bytes
	            var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;

	            // Create padding word
	            var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;

	            // Create padding
	            var paddingWords = [];
	            for (var i = 0; i < nPaddingBytes; i += 4) {
	                paddingWords.push(paddingWord);
	            }
	            var padding = WordArray.create(paddingWords, nPaddingBytes);

	            // Add padding
	            data.concat(padding);
	        },

	        /**
	         * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
	         *
	         * @param {WordArray} data The data to unpad.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     CryptoJS.pad.Pkcs7.unpad(wordArray);
	         */
	        unpad: function (data) {
	            // Get number of padding bytes from last byte
	            var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;

	            // Remove padding
	            data.sigBytes -= nPaddingBytes;
	        }
	    };

	    /**
	     * Abstract base block cipher template.
	     *
	     * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)
	     */
	    var BlockCipher = C_lib.BlockCipher = Cipher.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {Mode} mode The block mode to use. Default: CBC
	         * @property {Padding} padding The padding strategy to use. Default: Pkcs7
	         */
	        cfg: Cipher.cfg.extend({
	            mode: CBC,
	            padding: Pkcs7
	        }),

	        reset: function () {
	            var modeCreator;

	            // Reset cipher
	            Cipher.reset.call(this);

	            // Shortcuts
	            var cfg = this.cfg;
	            var iv = cfg.iv;
	            var mode = cfg.mode;

	            // Reset block mode
	            if (this._xformMode == this._ENC_XFORM_MODE) {
	                modeCreator = mode.createEncryptor;
	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
	                modeCreator = mode.createDecryptor;
	                // Keep at least one block in the buffer for unpadding
	                this._minBufferSize = 1;
	            }

	            if (this._mode && this._mode.__creator == modeCreator) {
	                this._mode.init(this, iv && iv.words);
	            } else {
	                this._mode = modeCreator.call(mode, this, iv && iv.words);
	                this._mode.__creator = modeCreator;
	            }
	        },

	        _doProcessBlock: function (words, offset) {
	            this._mode.processBlock(words, offset);
	        },

	        _doFinalize: function () {
	            var finalProcessedBlocks;

	            // Shortcut
	            var padding = this.cfg.padding;

	            // Finalize
	            if (this._xformMode == this._ENC_XFORM_MODE) {
	                // Pad data
	                padding.pad(this._data, this.blockSize);

	                // Process final blocks
	                finalProcessedBlocks = this._process(!!'flush');
	            } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {
	                // Process final blocks
	                finalProcessedBlocks = this._process(!!'flush');

	                // Unpad data
	                padding.unpad(finalProcessedBlocks);
	            }

	            return finalProcessedBlocks;
	        },

	        blockSize: 128/32
	    });

	    /**
	     * A collection of cipher parameters.
	     *
	     * @property {WordArray} ciphertext The raw ciphertext.
	     * @property {WordArray} key The key to this ciphertext.
	     * @property {WordArray} iv The IV used in the ciphering operation.
	     * @property {WordArray} salt The salt used with a key derivation function.
	     * @property {Cipher} algorithm The cipher algorithm.
	     * @property {Mode} mode The block mode used in the ciphering operation.
	     * @property {Padding} padding The padding scheme used in the ciphering operation.
	     * @property {number} blockSize The block size of the cipher.
	     * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
	     */
	    var CipherParams = C_lib.CipherParams = Base.extend({
	        /**
	         * Initializes a newly created cipher params object.
	         *
	         * @param {Object} cipherParams An object with any of the possible cipher parameters.
	         *
	         * @example
	         *
	         *     var cipherParams = CryptoJS.lib.CipherParams.create({
	         *         ciphertext: ciphertextWordArray,
	         *         key: keyWordArray,
	         *         iv: ivWordArray,
	         *         salt: saltWordArray,
	         *         algorithm: CryptoJS.algo.AES,
	         *         mode: CryptoJS.mode.CBC,
	         *         padding: CryptoJS.pad.PKCS7,
	         *         blockSize: 4,
	         *         formatter: CryptoJS.format.OpenSSL
	         *     });
	         */
	        init: function (cipherParams) {
	            this.mixIn(cipherParams);
	        },

	        /**
	         * Converts this cipher params object to a string.
	         *
	         * @param {Format} formatter (Optional) The formatting strategy to use.
	         *
	         * @return {string} The stringified cipher params.
	         *
	         * @throws Error If neither the formatter nor the default formatter is set.
	         *
	         * @example
	         *
	         *     var string = cipherParams + '';
	         *     var string = cipherParams.toString();
	         *     var string = cipherParams.toString(CryptoJS.format.OpenSSL);
	         */
	        toString: function (formatter) {
	            return (formatter || this.formatter).stringify(this);
	        }
	    });

	    /**
	     * Format namespace.
	     */
	    var C_format = C.format = {};

	    /**
	     * OpenSSL formatting strategy.
	     */
	    var OpenSSLFormatter = C_format.OpenSSL = {
	        /**
	         * Converts a cipher params object to an OpenSSL-compatible string.
	         *
	         * @param {CipherParams} cipherParams The cipher params object.
	         *
	         * @return {string} The OpenSSL-compatible string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
	         */
	        stringify: function (cipherParams) {
	            var wordArray;

	            // Shortcuts
	            var ciphertext = cipherParams.ciphertext;
	            var salt = cipherParams.salt;

	            // Format
	            if (salt) {
	                wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);
	            } else {
	                wordArray = ciphertext;
	            }

	            return wordArray.toString(Base64);
	        },

	        /**
	         * Converts an OpenSSL-compatible string to a cipher params object.
	         *
	         * @param {string} openSSLStr The OpenSSL-compatible string.
	         *
	         * @return {CipherParams} The cipher params object.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
	         */
	        parse: function (openSSLStr) {
	            var salt;

	            // Parse base64
	            var ciphertext = Base64.parse(openSSLStr);

	            // Shortcut
	            var ciphertextWords = ciphertext.words;

	            // Test for salt
	            if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {
	                // Extract salt
	                salt = WordArray.create(ciphertextWords.slice(2, 4));

	                // Remove salt from ciphertext
	                ciphertextWords.splice(0, 4);
	                ciphertext.sigBytes -= 16;
	            }

	            return CipherParams.create({ ciphertext: ciphertext, salt: salt });
	        }
	    };

	    /**
	     * A cipher wrapper that returns ciphertext as a serializable cipher params object.
	     */
	    var SerializableCipher = C_lib.SerializableCipher = Base.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
	         */
	        cfg: Base.extend({
	            format: OpenSSLFormatter
	        }),

	        /**
	         * Encrypts a message.
	         *
	         * @param {Cipher} cipher The cipher algorithm to use.
	         * @param {WordArray|string} message The message to encrypt.
	         * @param {WordArray} key The key.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {CipherParams} A cipher params object.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
	         */
	        encrypt: function (cipher, message, key, cfg) {
	            // Apply config defaults
	            cfg = this.cfg.extend(cfg);

	            // Encrypt
	            var encryptor = cipher.createEncryptor(key, cfg);
	            var ciphertext = encryptor.finalize(message);

	            // Shortcut
	            var cipherCfg = encryptor.cfg;

	            // Create and return serializable cipher params
	            return CipherParams.create({
	                ciphertext: ciphertext,
	                key: key,
	                iv: cipherCfg.iv,
	                algorithm: cipher,
	                mode: cipherCfg.mode,
	                padding: cipherCfg.padding,
	                blockSize: cipher.blockSize,
	                formatter: cfg.format
	            });
	        },

	        /**
	         * Decrypts serialized ciphertext.
	         *
	         * @param {Cipher} cipher The cipher algorithm to use.
	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
	         * @param {WordArray} key The key.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {WordArray} The plaintext.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
	         *     var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
	         */
	        decrypt: function (cipher, ciphertext, key, cfg) {
	            // Apply config defaults
	            cfg = this.cfg.extend(cfg);

	            // Convert string to CipherParams
	            ciphertext = this._parse(ciphertext, cfg.format);

	            // Decrypt
	            var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);

	            return plaintext;
	        },

	        /**
	         * Converts serialized ciphertext to CipherParams,
	         * else assumed CipherParams already and returns ciphertext unchanged.
	         *
	         * @param {CipherParams|string} ciphertext The ciphertext.
	         * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
	         *
	         * @return {CipherParams} The unserialized ciphertext.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
	         */
	        _parse: function (ciphertext, format) {
	            if (typeof ciphertext == 'string') {
	                return format.parse(ciphertext, this);
	            } else {
	                return ciphertext;
	            }
	        }
	    });

	    /**
	     * Key derivation function namespace.
	     */
	    var C_kdf = C.kdf = {};

	    /**
	     * OpenSSL key derivation function.
	     */
	    var OpenSSLKdf = C_kdf.OpenSSL = {
	        /**
	         * Derives a key and IV from a password.
	         *
	         * @param {string} password The password to derive from.
	         * @param {number} keySize The size in words of the key to generate.
	         * @param {number} ivSize The size in words of the IV to generate.
	         * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
	         *
	         * @return {CipherParams} A cipher params object with the key, IV, and salt.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
	         *     var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
	         */
	        execute: function (password, keySize, ivSize, salt, hasher) {
	            // Generate random salt
	            if (!salt) {
	                salt = WordArray.random(64/8);
	            }

	            // Derive key and IV
	            if (!hasher) {
	                var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
	            } else {
	                var key = EvpKDF.create({ keySize: keySize + ivSize, hasher: hasher }).compute(password, salt);
	            }


	            // Separate key and IV
	            var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);
	            key.sigBytes = keySize * 4;

	            // Return params
	            return CipherParams.create({ key: key, iv: iv, salt: salt });
	        }
	    };

	    /**
	     * A serializable cipher wrapper that derives the key from a password,
	     * and returns ciphertext as a serializable cipher params object.
	     */
	    var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
	         */
	        cfg: SerializableCipher.cfg.extend({
	            kdf: OpenSSLKdf
	        }),

	        /**
	         * Encrypts a message using a password.
	         *
	         * @param {Cipher} cipher The cipher algorithm to use.
	         * @param {WordArray|string} message The message to encrypt.
	         * @param {string} password The password.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {CipherParams} A cipher params object.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
	         *     var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
	         */
	        encrypt: function (cipher, message, password, cfg) {
	            // Apply config defaults
	            cfg = this.cfg.extend(cfg);

	            // Derive key and other params
	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);

	            // Add IV to config
	            cfg.iv = derivedParams.iv;

	            // Encrypt
	            var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);

	            // Mix in derived params
	            ciphertext.mixIn(derivedParams);

	            return ciphertext;
	        },

	        /**
	         * Decrypts serialized ciphertext using a password.
	         *
	         * @param {Cipher} cipher The cipher algorithm to use.
	         * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
	         * @param {string} password The password.
	         * @param {Object} cfg (Optional) The configuration options to use for this operation.
	         *
	         * @return {WordArray} The plaintext.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
	         *     var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
	         */
	        decrypt: function (cipher, ciphertext, password, cfg) {
	            // Apply config defaults
	            cfg = this.cfg.extend(cfg);

	            // Convert string to CipherParams
	            ciphertext = this._parse(ciphertext, cfg.format);

	            // Derive key and other params
	            var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt, cfg.hasher);

	            // Add IV to config
	            cfg.iv = derivedParams.iv;

	            // Decrypt
	            var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);

	            return plaintext;
	        }
	    });
	}());


}));

/***/ }),

/***/ "./node_modules/crypto-js/core.js":
/*!****************************************!*\
  !*** ./node_modules/crypto-js/core.js ***!
  \****************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory();
	}
	else {}
}(this, function () {

	/*globals window, global, require*/

	/**
	 * CryptoJS core components.
	 */
	var CryptoJS = CryptoJS || (function (Math, undefined) {

	    var crypto;

	    // Native crypto from window (Browser)
	    if (typeof window !== 'undefined' && window.crypto) {
	        crypto = window.crypto;
	    }

	    // Native crypto in web worker (Browser)
	    if (typeof self !== 'undefined' && self.crypto) {
	        crypto = self.crypto;
	    }

	    // Native crypto from worker
	    if (typeof globalThis !== 'undefined' && globalThis.crypto) {
	        crypto = globalThis.crypto;
	    }

	    // Native (experimental IE 11) crypto from window (Browser)
	    if (!crypto && typeof window !== 'undefined' && window.msCrypto) {
	        crypto = window.msCrypto;
	    }

	    // Native crypto from global (NodeJS)
	    if (!crypto && typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.crypto) {
	        crypto = __webpack_require__.g.crypto;
	    }

	    // Native crypto import via require (NodeJS)
	    if (!crypto && "function" === 'function') {
	        try {
	            crypto = __webpack_require__(/*! crypto */ "?9157");
	        } catch (err) {}
	    }

	    /*
	     * Cryptographically secure pseudorandom number generator
	     *
	     * As Math.random() is cryptographically not safe to use
	     */
	    var cryptoSecureRandomInt = function () {
	        if (crypto) {
	            // Use getRandomValues method (Browser)
	            if (typeof crypto.getRandomValues === 'function') {
	                try {
	                    return crypto.getRandomValues(new Uint32Array(1))[0];
	                } catch (err) {}
	            }

	            // Use randomBytes method (NodeJS)
	            if (typeof crypto.randomBytes === 'function') {
	                try {
	                    return crypto.randomBytes(4).readInt32LE();
	                } catch (err) {}
	            }
	        }

	        throw new Error('Native crypto module could not be used to get secure random number.');
	    };

	    /*
	     * Local polyfill of Object.create

	     */
	    var create = Object.create || (function () {
	        function F() {}

	        return function (obj) {
	            var subtype;

	            F.prototype = obj;

	            subtype = new F();

	            F.prototype = null;

	            return subtype;
	        };
	    }());

	    /**
	     * CryptoJS namespace.
	     */
	    var C = {};

	    /**
	     * Library namespace.
	     */
	    var C_lib = C.lib = {};

	    /**
	     * Base object for prototypal inheritance.
	     */
	    var Base = C_lib.Base = (function () {


	        return {
	            /**
	             * Creates a new object that inherits from this object.
	             *
	             * @param {Object} overrides Properties to copy into the new object.
	             *
	             * @return {Object} The new object.
	             *
	             * @static
	             *
	             * @example
	             *
	             *     var MyType = CryptoJS.lib.Base.extend({
	             *         field: 'value',
	             *
	             *         method: function () {
	             *         }
	             *     });
	             */
	            extend: function (overrides) {
	                // Spawn
	                var subtype = create(this);

	                // Augment
	                if (overrides) {
	                    subtype.mixIn(overrides);
	                }

	                // Create default initializer
	                if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {
	                    subtype.init = function () {
	                        subtype.$super.init.apply(this, arguments);
	                    };
	                }

	                // Initializer's prototype is the subtype object
	                subtype.init.prototype = subtype;

	                // Reference supertype
	                subtype.$super = this;

	                return subtype;
	            },

	            /**
	             * Extends this object and runs the init method.
	             * Arguments to create() will be passed to init().
	             *
	             * @return {Object} The new object.
	             *
	             * @static
	             *
	             * @example
	             *
	             *     var instance = MyType.create();
	             */
	            create: function () {
	                var instance = this.extend();
	                instance.init.apply(instance, arguments);

	                return instance;
	            },

	            /**
	             * Initializes a newly created object.
	             * Override this method to add some logic when your objects are created.
	             *
	             * @example
	             *
	             *     var MyType = CryptoJS.lib.Base.extend({
	             *         init: function () {
	             *             // ...
	             *         }
	             *     });
	             */
	            init: function () {
	            },

	            /**
	             * Copies properties into this object.
	             *
	             * @param {Object} properties The properties to mix in.
	             *
	             * @example
	             *
	             *     MyType.mixIn({
	             *         field: 'value'
	             *     });
	             */
	            mixIn: function (properties) {
	                for (var propertyName in properties) {
	                    if (properties.hasOwnProperty(propertyName)) {
	                        this[propertyName] = properties[propertyName];
	                    }
	                }

	                // IE won't copy toString using the loop above
	                if (properties.hasOwnProperty('toString')) {
	                    this.toString = properties.toString;
	                }
	            },

	            /**
	             * Creates a copy of this object.
	             *
	             * @return {Object} The clone.
	             *
	             * @example
	             *
	             *     var clone = instance.clone();
	             */
	            clone: function () {
	                return this.init.prototype.extend(this);
	            }
	        };
	    }());

	    /**
	     * An array of 32-bit words.
	     *
	     * @property {Array} words The array of 32-bit words.
	     * @property {number} sigBytes The number of significant bytes in this word array.
	     */
	    var WordArray = C_lib.WordArray = Base.extend({
	        /**
	         * Initializes a newly created word array.
	         *
	         * @param {Array} words (Optional) An array of 32-bit words.
	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.lib.WordArray.create();
	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
	         *     var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
	         */
	        init: function (words, sigBytes) {
	            words = this.words = words || [];

	            if (sigBytes != undefined) {
	                this.sigBytes = sigBytes;
	            } else {
	                this.sigBytes = words.length * 4;
	            }
	        },

	        /**
	         * Converts this word array to a string.
	         *
	         * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
	         *
	         * @return {string} The stringified word array.
	         *
	         * @example
	         *
	         *     var string = wordArray + '';
	         *     var string = wordArray.toString();
	         *     var string = wordArray.toString(CryptoJS.enc.Utf8);
	         */
	        toString: function (encoder) {
	            return (encoder || Hex).stringify(this);
	        },

	        /**
	         * Concatenates a word array to this word array.
	         *
	         * @param {WordArray} wordArray The word array to append.
	         *
	         * @return {WordArray} This word array.
	         *
	         * @example
	         *
	         *     wordArray1.concat(wordArray2);
	         */
	        concat: function (wordArray) {
	            // Shortcuts
	            var thisWords = this.words;
	            var thatWords = wordArray.words;
	            var thisSigBytes = this.sigBytes;
	            var thatSigBytes = wordArray.sigBytes;

	            // Clamp excess bits
	            this.clamp();

	            // Concat
	            if (thisSigBytes % 4) {
	                // Copy one byte at a time
	                for (var i = 0; i < thatSigBytes; i++) {
	                    var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
	                    thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
	                }
	            } else {
	                // Copy one word at a time
	                for (var j = 0; j < thatSigBytes; j += 4) {
	                    thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];
	                }
	            }
	            this.sigBytes += thatSigBytes;

	            // Chainable
	            return this;
	        },

	        /**
	         * Removes insignificant bits.
	         *
	         * @example
	         *
	         *     wordArray.clamp();
	         */
	        clamp: function () {
	            // Shortcuts
	            var words = this.words;
	            var sigBytes = this.sigBytes;

	            // Clamp
	            words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);
	            words.length = Math.ceil(sigBytes / 4);
	        },

	        /**
	         * Creates a copy of this word array.
	         *
	         * @return {WordArray} The clone.
	         *
	         * @example
	         *
	         *     var clone = wordArray.clone();
	         */
	        clone: function () {
	            var clone = Base.clone.call(this);
	            clone.words = this.words.slice(0);

	            return clone;
	        },

	        /**
	         * Creates a word array filled with random bytes.
	         *
	         * @param {number} nBytes The number of random bytes to generate.
	         *
	         * @return {WordArray} The random word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.lib.WordArray.random(16);
	         */
	        random: function (nBytes) {
	            var words = [];

	            for (var i = 0; i < nBytes; i += 4) {
	                words.push(cryptoSecureRandomInt());
	            }

	            return new WordArray.init(words, nBytes);
	        }
	    });

	    /**
	     * Encoder namespace.
	     */
	    var C_enc = C.enc = {};

	    /**
	     * Hex encoding strategy.
	     */
	    var Hex = C_enc.Hex = {
	        /**
	         * Converts a word array to a hex string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The hex string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var hexString = CryptoJS.enc.Hex.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;

	            // Convert
	            var hexChars = [];
	            for (var i = 0; i < sigBytes; i++) {
	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
	                hexChars.push((bite >>> 4).toString(16));
	                hexChars.push((bite & 0x0f).toString(16));
	            }

	            return hexChars.join('');
	        },

	        /**
	         * Converts a hex string to a word array.
	         *
	         * @param {string} hexStr The hex string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Hex.parse(hexString);
	         */
	        parse: function (hexStr) {
	            // Shortcut
	            var hexStrLength = hexStr.length;

	            // Convert
	            var words = [];
	            for (var i = 0; i < hexStrLength; i += 2) {
	                words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);
	            }

	            return new WordArray.init(words, hexStrLength / 2);
	        }
	    };

	    /**
	     * Latin1 encoding strategy.
	     */
	    var Latin1 = C_enc.Latin1 = {
	        /**
	         * Converts a word array to a Latin1 string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The Latin1 string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;

	            // Convert
	            var latin1Chars = [];
	            for (var i = 0; i < sigBytes; i++) {
	                var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
	                latin1Chars.push(String.fromCharCode(bite));
	            }

	            return latin1Chars.join('');
	        },

	        /**
	         * Converts a Latin1 string to a word array.
	         *
	         * @param {string} latin1Str The Latin1 string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
	         */
	        parse: function (latin1Str) {
	            // Shortcut
	            var latin1StrLength = latin1Str.length;

	            // Convert
	            var words = [];
	            for (var i = 0; i < latin1StrLength; i++) {
	                words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);
	            }

	            return new WordArray.init(words, latin1StrLength);
	        }
	    };

	    /**
	     * UTF-8 encoding strategy.
	     */
	    var Utf8 = C_enc.Utf8 = {
	        /**
	         * Converts a word array to a UTF-8 string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The UTF-8 string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            try {
	                return decodeURIComponent(escape(Latin1.stringify(wordArray)));
	            } catch (e) {
	                throw new Error('Malformed UTF-8 data');
	            }
	        },

	        /**
	         * Converts a UTF-8 string to a word array.
	         *
	         * @param {string} utf8Str The UTF-8 string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
	         */
	        parse: function (utf8Str) {
	            return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
	        }
	    };

	    /**
	     * Abstract buffered block algorithm template.
	     *
	     * The property blockSize must be implemented in a concrete subtype.
	     *
	     * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
	     */
	    var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
	        /**
	         * Resets this block algorithm's data buffer to its initial state.
	         *
	         * @example
	         *
	         *     bufferedBlockAlgorithm.reset();
	         */
	        reset: function () {
	            // Initial values
	            this._data = new WordArray.init();
	            this._nDataBytes = 0;
	        },

	        /**
	         * Adds new data to this block algorithm's buffer.
	         *
	         * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
	         *
	         * @example
	         *
	         *     bufferedBlockAlgorithm._append('data');
	         *     bufferedBlockAlgorithm._append(wordArray);
	         */
	        _append: function (data) {
	            // Convert string to WordArray, else assume WordArray already
	            if (typeof data == 'string') {
	                data = Utf8.parse(data);
	            }

	            // Append
	            this._data.concat(data);
	            this._nDataBytes += data.sigBytes;
	        },

	        /**
	         * Processes available data blocks.
	         *
	         * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
	         *
	         * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
	         *
	         * @return {WordArray} The processed data.
	         *
	         * @example
	         *
	         *     var processedData = bufferedBlockAlgorithm._process();
	         *     var processedData = bufferedBlockAlgorithm._process(!!'flush');
	         */
	        _process: function (doFlush) {
	            var processedWords;

	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;
	            var dataSigBytes = data.sigBytes;
	            var blockSize = this.blockSize;
	            var blockSizeBytes = blockSize * 4;

	            // Count blocks ready
	            var nBlocksReady = dataSigBytes / blockSizeBytes;
	            if (doFlush) {
	                // Round up to include partial blocks
	                nBlocksReady = Math.ceil(nBlocksReady);
	            } else {
	                // Round down to include only full blocks,
	                // less the number of blocks that must remain in the buffer
	                nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);
	            }

	            // Count words ready
	            var nWordsReady = nBlocksReady * blockSize;

	            // Count bytes ready
	            var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);

	            // Process blocks
	            if (nWordsReady) {
	                for (var offset = 0; offset < nWordsReady; offset += blockSize) {
	                    // Perform concrete-algorithm logic
	                    this._doProcessBlock(dataWords, offset);
	                }

	                // Remove processed words
	                processedWords = dataWords.splice(0, nWordsReady);
	                data.sigBytes -= nBytesReady;
	            }

	            // Return processed words
	            return new WordArray.init(processedWords, nBytesReady);
	        },

	        /**
	         * Creates a copy of this object.
	         *
	         * @return {Object} The clone.
	         *
	         * @example
	         *
	         *     var clone = bufferedBlockAlgorithm.clone();
	         */
	        clone: function () {
	            var clone = Base.clone.call(this);
	            clone._data = this._data.clone();

	            return clone;
	        },

	        _minBufferSize: 0
	    });

	    /**
	     * Abstract hasher template.
	     *
	     * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)
	     */
	    var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({
	        /**
	         * Configuration options.
	         */
	        cfg: Base.extend(),

	        /**
	         * Initializes a newly created hasher.
	         *
	         * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
	         *
	         * @example
	         *
	         *     var hasher = CryptoJS.algo.SHA256.create();
	         */
	        init: function (cfg) {
	            // Apply config defaults
	            this.cfg = this.cfg.extend(cfg);

	            // Set initial values
	            this.reset();
	        },

	        /**
	         * Resets this hasher to its initial state.
	         *
	         * @example
	         *
	         *     hasher.reset();
	         */
	        reset: function () {
	            // Reset data buffer
	            BufferedBlockAlgorithm.reset.call(this);

	            // Perform concrete-hasher logic
	            this._doReset();
	        },

	        /**
	         * Updates this hasher with a message.
	         *
	         * @param {WordArray|string} messageUpdate The message to append.
	         *
	         * @return {Hasher} This hasher.
	         *
	         * @example
	         *
	         *     hasher.update('message');
	         *     hasher.update(wordArray);
	         */
	        update: function (messageUpdate) {
	            // Append
	            this._append(messageUpdate);

	            // Update the hash
	            this._process();

	            // Chainable
	            return this;
	        },

	        /**
	         * Finalizes the hash computation.
	         * Note that the finalize operation is effectively a destructive, read-once operation.
	         *
	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
	         *
	         * @return {WordArray} The hash.
	         *
	         * @example
	         *
	         *     var hash = hasher.finalize();
	         *     var hash = hasher.finalize('message');
	         *     var hash = hasher.finalize(wordArray);
	         */
	        finalize: function (messageUpdate) {
	            // Final message update
	            if (messageUpdate) {
	                this._append(messageUpdate);
	            }

	            // Perform concrete-hasher logic
	            var hash = this._doFinalize();

	            return hash;
	        },

	        blockSize: 512/32,

	        /**
	         * Creates a shortcut function to a hasher's object interface.
	         *
	         * @param {Hasher} hasher The hasher to create a helper for.
	         *
	         * @return {Function} The shortcut function.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
	         */
	        _createHelper: function (hasher) {
	            return function (message, cfg) {
	                return new hasher.init(cfg).finalize(message);
	            };
	        },

	        /**
	         * Creates a shortcut function to the HMAC's object interface.
	         *
	         * @param {Hasher} hasher The hasher to use in this HMAC helper.
	         *
	         * @return {Function} The shortcut function.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
	         */
	        _createHmacHelper: function (hasher) {
	            return function (message, key) {
	                return new C_algo.HMAC.init(hasher, key).finalize(message);
	            };
	        }
	    });

	    /**
	     * Algorithm namespace.
	     */
	    var C_algo = C.algo = {};

	    return C;
	}(Math));


	return CryptoJS;

}));

/***/ }),

/***/ "./node_modules/crypto-js/enc-base64.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-js/enc-base64.js ***!
  \**********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var C_enc = C.enc;

	    /**
	     * Base64 encoding strategy.
	     */
	    var Base64 = C_enc.Base64 = {
	        /**
	         * Converts a word array to a Base64 string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The Base64 string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var base64String = CryptoJS.enc.Base64.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;
	            var map = this._map;

	            // Clamp excess bits
	            wordArray.clamp();

	            // Convert
	            var base64Chars = [];
	            for (var i = 0; i < sigBytes; i += 3) {
	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;

	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;

	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
	                }
	            }

	            // Add padding
	            var paddingChar = map.charAt(64);
	            if (paddingChar) {
	                while (base64Chars.length % 4) {
	                    base64Chars.push(paddingChar);
	                }
	            }

	            return base64Chars.join('');
	        },

	        /**
	         * Converts a Base64 string to a word array.
	         *
	         * @param {string} base64Str The Base64 string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Base64.parse(base64String);
	         */
	        parse: function (base64Str) {
	            // Shortcuts
	            var base64StrLength = base64Str.length;
	            var map = this._map;
	            var reverseMap = this._reverseMap;

	            if (!reverseMap) {
	                    reverseMap = this._reverseMap = [];
	                    for (var j = 0; j < map.length; j++) {
	                        reverseMap[map.charCodeAt(j)] = j;
	                    }
	            }

	            // Ignore padding
	            var paddingChar = map.charAt(64);
	            if (paddingChar) {
	                var paddingIndex = base64Str.indexOf(paddingChar);
	                if (paddingIndex !== -1) {
	                    base64StrLength = paddingIndex;
	                }
	            }

	            // Convert
	            return parseLoop(base64Str, base64StrLength, reverseMap);

	        },

	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
	    };

	    function parseLoop(base64Str, base64StrLength, reverseMap) {
	      var words = [];
	      var nBytes = 0;
	      for (var i = 0; i < base64StrLength; i++) {
	          if (i % 4) {
	              var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
	              var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
	              var bitsCombined = bits1 | bits2;
	              words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
	              nBytes++;
	          }
	      }
	      return WordArray.create(words, nBytes);
	    }
	}());


	return CryptoJS.enc.Base64;

}));

/***/ }),

/***/ "./node_modules/crypto-js/enc-base64url.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-js/enc-base64url.js ***!
  \*************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var C_enc = C.enc;

	    /**
	     * Base64url encoding strategy.
	     */
	    var Base64url = C_enc.Base64url = {
	        /**
	         * Converts a word array to a Base64url string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @param {boolean} urlSafe Whether to use url safe
	         *
	         * @return {string} The Base64url string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var base64String = CryptoJS.enc.Base64url.stringify(wordArray);
	         */
	        stringify: function (wordArray, urlSafe) {
	            if (urlSafe === undefined) {
	                urlSafe = true
	            }
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;
	            var map = urlSafe ? this._safe_map : this._map;

	            // Clamp excess bits
	            wordArray.clamp();

	            // Convert
	            var base64Chars = [];
	            for (var i = 0; i < sigBytes; i += 3) {
	                var byte1 = (words[i >>> 2]       >>> (24 - (i % 4) * 8))       & 0xff;
	                var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
	                var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;

	                var triplet = (byte1 << 16) | (byte2 << 8) | byte3;

	                for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
	                    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
	                }
	            }

	            // Add padding
	            var paddingChar = map.charAt(64);
	            if (paddingChar) {
	                while (base64Chars.length % 4) {
	                    base64Chars.push(paddingChar);
	                }
	            }

	            return base64Chars.join('');
	        },

	        /**
	         * Converts a Base64url string to a word array.
	         *
	         * @param {string} base64Str The Base64url string.
	         *
	         * @param {boolean} urlSafe Whether to use url safe
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Base64url.parse(base64String);
	         */
	        parse: function (base64Str, urlSafe) {
	            if (urlSafe === undefined) {
	                urlSafe = true
	            }

	            // Shortcuts
	            var base64StrLength = base64Str.length;
	            var map = urlSafe ? this._safe_map : this._map;
	            var reverseMap = this._reverseMap;

	            if (!reverseMap) {
	                reverseMap = this._reverseMap = [];
	                for (var j = 0; j < map.length; j++) {
	                    reverseMap[map.charCodeAt(j)] = j;
	                }
	            }

	            // Ignore padding
	            var paddingChar = map.charAt(64);
	            if (paddingChar) {
	                var paddingIndex = base64Str.indexOf(paddingChar);
	                if (paddingIndex !== -1) {
	                    base64StrLength = paddingIndex;
	                }
	            }

	            // Convert
	            return parseLoop(base64Str, base64StrLength, reverseMap);

	        },

	        _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
	        _safe_map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
	    };

	    function parseLoop(base64Str, base64StrLength, reverseMap) {
	        var words = [];
	        var nBytes = 0;
	        for (var i = 0; i < base64StrLength; i++) {
	            if (i % 4) {
	                var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);
	                var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);
	                var bitsCombined = bits1 | bits2;
	                words[nBytes >>> 2] |= bitsCombined << (24 - (nBytes % 4) * 8);
	                nBytes++;
	            }
	        }
	        return WordArray.create(words, nBytes);
	    }
	}());


	return CryptoJS.enc.Base64url;

}));

/***/ }),

/***/ "./node_modules/crypto-js/enc-utf16.js":
/*!*********************************************!*\
  !*** ./node_modules/crypto-js/enc-utf16.js ***!
  \*********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var C_enc = C.enc;

	    /**
	     * UTF-16 BE encoding strategy.
	     */
	    var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = {
	        /**
	         * Converts a word array to a UTF-16 BE string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The UTF-16 BE string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var utf16String = CryptoJS.enc.Utf16.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;

	            // Convert
	            var utf16Chars = [];
	            for (var i = 0; i < sigBytes; i += 2) {
	                var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff;
	                utf16Chars.push(String.fromCharCode(codePoint));
	            }

	            return utf16Chars.join('');
	        },

	        /**
	         * Converts a UTF-16 BE string to a word array.
	         *
	         * @param {string} utf16Str The UTF-16 BE string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
	         */
	        parse: function (utf16Str) {
	            // Shortcut
	            var utf16StrLength = utf16Str.length;

	            // Convert
	            var words = [];
	            for (var i = 0; i < utf16StrLength; i++) {
	                words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16);
	            }

	            return WordArray.create(words, utf16StrLength * 2);
	        }
	    };

	    /**
	     * UTF-16 LE encoding strategy.
	     */
	    C_enc.Utf16LE = {
	        /**
	         * Converts a word array to a UTF-16 LE string.
	         *
	         * @param {WordArray} wordArray The word array.
	         *
	         * @return {string} The UTF-16 LE string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray);
	         */
	        stringify: function (wordArray) {
	            // Shortcuts
	            var words = wordArray.words;
	            var sigBytes = wordArray.sigBytes;

	            // Convert
	            var utf16Chars = [];
	            for (var i = 0; i < sigBytes; i += 2) {
	                var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff);
	                utf16Chars.push(String.fromCharCode(codePoint));
	            }

	            return utf16Chars.join('');
	        },

	        /**
	         * Converts a UTF-16 LE string to a word array.
	         *
	         * @param {string} utf16Str The UTF-16 LE string.
	         *
	         * @return {WordArray} The word array.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str);
	         */
	        parse: function (utf16Str) {
	            // Shortcut
	            var utf16StrLength = utf16Str.length;

	            // Convert
	            var words = [];
	            for (var i = 0; i < utf16StrLength; i++) {
	                words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16));
	            }

	            return WordArray.create(words, utf16StrLength * 2);
	        }
	    };

	    function swapEndian(word) {
	        return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff);
	    }
	}());


	return CryptoJS.enc.Utf16;

}));

/***/ }),

/***/ "./node_modules/crypto-js/evpkdf.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/evpkdf.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./sha1 */ "./node_modules/crypto-js/sha1.js"), __webpack_require__(/*! ./hmac */ "./node_modules/crypto-js/hmac.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Base = C_lib.Base;
	    var WordArray = C_lib.WordArray;
	    var C_algo = C.algo;
	    var MD5 = C_algo.MD5;

	    /**
	     * This key derivation function is meant to conform with EVP_BytesToKey.
	     * www.openssl.org/docs/crypto/EVP_BytesToKey.html
	     */
	    var EvpKDF = C_algo.EvpKDF = Base.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
	         * @property {Hasher} hasher The hash algorithm to use. Default: MD5
	         * @property {number} iterations The number of iterations to perform. Default: 1
	         */
	        cfg: Base.extend({
	            keySize: 128/32,
	            hasher: MD5,
	            iterations: 1
	        }),

	        /**
	         * Initializes a newly created key derivation function.
	         *
	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
	         *
	         * @example
	         *
	         *     var kdf = CryptoJS.algo.EvpKDF.create();
	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
	         *     var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
	         */
	        init: function (cfg) {
	            this.cfg = this.cfg.extend(cfg);
	        },

	        /**
	         * Derives a key from a password.
	         *
	         * @param {WordArray|string} password The password.
	         * @param {WordArray|string} salt A salt.
	         *
	         * @return {WordArray} The derived key.
	         *
	         * @example
	         *
	         *     var key = kdf.compute(password, salt);
	         */
	        compute: function (password, salt) {
	            var block;

	            // Shortcut
	            var cfg = this.cfg;

	            // Init hasher
	            var hasher = cfg.hasher.create();

	            // Initial values
	            var derivedKey = WordArray.create();

	            // Shortcuts
	            var derivedKeyWords = derivedKey.words;
	            var keySize = cfg.keySize;
	            var iterations = cfg.iterations;

	            // Generate key
	            while (derivedKeyWords.length < keySize) {
	                if (block) {
	                    hasher.update(block);
	                }
	                block = hasher.update(password).finalize(salt);
	                hasher.reset();

	                // Iterations
	                for (var i = 1; i < iterations; i++) {
	                    block = hasher.finalize(block);
	                    hasher.reset();
	                }

	                derivedKey.concat(block);
	            }
	            derivedKey.sigBytes = keySize * 4;

	            return derivedKey;
	        }
	    });

	    /**
	     * Derives a key from a password.
	     *
	     * @param {WordArray|string} password The password.
	     * @param {WordArray|string} salt A salt.
	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
	     *
	     * @return {WordArray} The derived key.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var key = CryptoJS.EvpKDF(password, salt);
	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });
	     *     var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });
	     */
	    C.EvpKDF = function (password, salt, cfg) {
	        return EvpKDF.create(cfg).compute(password, salt);
	    };
	}());


	return CryptoJS.EvpKDF;

}));

/***/ }),

/***/ "./node_modules/crypto-js/format-hex.js":
/*!**********************************************!*\
  !*** ./node_modules/crypto-js/format-hex.js ***!
  \**********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function (undefined) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var CipherParams = C_lib.CipherParams;
	    var C_enc = C.enc;
	    var Hex = C_enc.Hex;
	    var C_format = C.format;

	    var HexFormatter = C_format.Hex = {
	        /**
	         * Converts the ciphertext of a cipher params object to a hexadecimally encoded string.
	         *
	         * @param {CipherParams} cipherParams The cipher params object.
	         *
	         * @return {string} The hexadecimally encoded string.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var hexString = CryptoJS.format.Hex.stringify(cipherParams);
	         */
	        stringify: function (cipherParams) {
	            return cipherParams.ciphertext.toString(Hex);
	        },

	        /**
	         * Converts a hexadecimally encoded ciphertext string to a cipher params object.
	         *
	         * @param {string} input The hexadecimally encoded string.
	         *
	         * @return {CipherParams} The cipher params object.
	         *
	         * @static
	         *
	         * @example
	         *
	         *     var cipherParams = CryptoJS.format.Hex.parse(hexString);
	         */
	        parse: function (input) {
	            var ciphertext = Hex.parse(input);
	            return CipherParams.create({ ciphertext: ciphertext });
	        }
	    };
	}());


	return CryptoJS.format.Hex;

}));

/***/ }),

/***/ "./node_modules/crypto-js/hmac.js":
/*!****************************************!*\
  !*** ./node_modules/crypto-js/hmac.js ***!
  \****************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Base = C_lib.Base;
	    var C_enc = C.enc;
	    var Utf8 = C_enc.Utf8;
	    var C_algo = C.algo;

	    /**
	     * HMAC algorithm.
	     */
	    var HMAC = C_algo.HMAC = Base.extend({
	        /**
	         * Initializes a newly created HMAC.
	         *
	         * @param {Hasher} hasher The hash algorithm to use.
	         * @param {WordArray|string} key The secret key.
	         *
	         * @example
	         *
	         *     var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
	         */
	        init: function (hasher, key) {
	            // Init hasher
	            hasher = this._hasher = new hasher.init();

	            // Convert string to WordArray, else assume WordArray already
	            if (typeof key == 'string') {
	                key = Utf8.parse(key);
	            }

	            // Shortcuts
	            var hasherBlockSize = hasher.blockSize;
	            var hasherBlockSizeBytes = hasherBlockSize * 4;

	            // Allow arbitrary length keys
	            if (key.sigBytes > hasherBlockSizeBytes) {
	                key = hasher.finalize(key);
	            }

	            // Clamp excess bits
	            key.clamp();

	            // Clone key for inner and outer pads
	            var oKey = this._oKey = key.clone();
	            var iKey = this._iKey = key.clone();

	            // Shortcuts
	            var oKeyWords = oKey.words;
	            var iKeyWords = iKey.words;

	            // XOR keys with pad constants
	            for (var i = 0; i < hasherBlockSize; i++) {
	                oKeyWords[i] ^= 0x5c5c5c5c;
	                iKeyWords[i] ^= 0x36363636;
	            }
	            oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;

	            // Set initial values
	            this.reset();
	        },

	        /**
	         * Resets this HMAC to its initial state.
	         *
	         * @example
	         *
	         *     hmacHasher.reset();
	         */
	        reset: function () {
	            // Shortcut
	            var hasher = this._hasher;

	            // Reset
	            hasher.reset();
	            hasher.update(this._iKey);
	        },

	        /**
	         * Updates this HMAC with a message.
	         *
	         * @param {WordArray|string} messageUpdate The message to append.
	         *
	         * @return {HMAC} This HMAC instance.
	         *
	         * @example
	         *
	         *     hmacHasher.update('message');
	         *     hmacHasher.update(wordArray);
	         */
	        update: function (messageUpdate) {
	            this._hasher.update(messageUpdate);

	            // Chainable
	            return this;
	        },

	        /**
	         * Finalizes the HMAC computation.
	         * Note that the finalize operation is effectively a destructive, read-once operation.
	         *
	         * @param {WordArray|string} messageUpdate (Optional) A final message update.
	         *
	         * @return {WordArray} The HMAC.
	         *
	         * @example
	         *
	         *     var hmac = hmacHasher.finalize();
	         *     var hmac = hmacHasher.finalize('message');
	         *     var hmac = hmacHasher.finalize(wordArray);
	         */
	        finalize: function (messageUpdate) {
	            // Shortcut
	            var hasher = this._hasher;

	            // Compute HMAC
	            var innerHash = hasher.finalize(messageUpdate);
	            hasher.reset();
	            var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));

	            return hmac;
	        }
	    });
	}());


}));

/***/ }),

/***/ "./node_modules/crypto-js/index.js":
/*!*****************************************!*\
  !*** ./node_modules/crypto-js/index.js ***!
  \*****************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./x64-core */ "./node_modules/crypto-js/x64-core.js"), __webpack_require__(/*! ./lib-typedarrays */ "./node_modules/crypto-js/lib-typedarrays.js"), __webpack_require__(/*! ./enc-utf16 */ "./node_modules/crypto-js/enc-utf16.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./enc-base64url */ "./node_modules/crypto-js/enc-base64url.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./sha1 */ "./node_modules/crypto-js/sha1.js"), __webpack_require__(/*! ./sha256 */ "./node_modules/crypto-js/sha256.js"), __webpack_require__(/*! ./sha224 */ "./node_modules/crypto-js/sha224.js"), __webpack_require__(/*! ./sha512 */ "./node_modules/crypto-js/sha512.js"), __webpack_require__(/*! ./sha384 */ "./node_modules/crypto-js/sha384.js"), __webpack_require__(/*! ./sha3 */ "./node_modules/crypto-js/sha3.js"), __webpack_require__(/*! ./ripemd160 */ "./node_modules/crypto-js/ripemd160.js"), __webpack_require__(/*! ./hmac */ "./node_modules/crypto-js/hmac.js"), __webpack_require__(/*! ./pbkdf2 */ "./node_modules/crypto-js/pbkdf2.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"), __webpack_require__(/*! ./mode-cfb */ "./node_modules/crypto-js/mode-cfb.js"), __webpack_require__(/*! ./mode-ctr */ "./node_modules/crypto-js/mode-ctr.js"), __webpack_require__(/*! ./mode-ctr-gladman */ "./node_modules/crypto-js/mode-ctr-gladman.js"), __webpack_require__(/*! ./mode-ofb */ "./node_modules/crypto-js/mode-ofb.js"), __webpack_require__(/*! ./mode-ecb */ "./node_modules/crypto-js/mode-ecb.js"), __webpack_require__(/*! ./pad-ansix923 */ "./node_modules/crypto-js/pad-ansix923.js"), __webpack_require__(/*! ./pad-iso10126 */ "./node_modules/crypto-js/pad-iso10126.js"), __webpack_require__(/*! ./pad-iso97971 */ "./node_modules/crypto-js/pad-iso97971.js"), __webpack_require__(/*! ./pad-zeropadding */ "./node_modules/crypto-js/pad-zeropadding.js"), __webpack_require__(/*! ./pad-nopadding */ "./node_modules/crypto-js/pad-nopadding.js"), __webpack_require__(/*! ./format-hex */ "./node_modules/crypto-js/format-hex.js"), __webpack_require__(/*! ./aes */ "./node_modules/crypto-js/aes.js"), __webpack_require__(/*! ./tripledes */ "./node_modules/crypto-js/tripledes.js"), __webpack_require__(/*! ./rc4 */ "./node_modules/crypto-js/rc4.js"), __webpack_require__(/*! ./rabbit */ "./node_modules/crypto-js/rabbit.js"), __webpack_require__(/*! ./rabbit-legacy */ "./node_modules/crypto-js/rabbit-legacy.js"), __webpack_require__(/*! ./blowfish */ "./node_modules/crypto-js/blowfish.js"));
	}
	else {}
}(this, function (CryptoJS) {

	return CryptoJS;

}));

/***/ }),

/***/ "./node_modules/crypto-js/lib-typedarrays.js":
/*!***************************************************!*\
  !*** ./node_modules/crypto-js/lib-typedarrays.js ***!
  \***************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Check if typed arrays are supported
	    if (typeof ArrayBuffer != 'function') {
	        return;
	    }

	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;

	    // Reference original init
	    var superInit = WordArray.init;

	    // Augment WordArray.init to handle typed arrays
	    var subInit = WordArray.init = function (typedArray) {
	        // Convert buffers to uint8
	        if (typedArray instanceof ArrayBuffer) {
	            typedArray = new Uint8Array(typedArray);
	        }

	        // Convert other array views to uint8
	        if (
	            typedArray instanceof Int8Array ||
	            (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) ||
	            typedArray instanceof Int16Array ||
	            typedArray instanceof Uint16Array ||
	            typedArray instanceof Int32Array ||
	            typedArray instanceof Uint32Array ||
	            typedArray instanceof Float32Array ||
	            typedArray instanceof Float64Array
	        ) {
	            typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);
	        }

	        // Handle Uint8Array
	        if (typedArray instanceof Uint8Array) {
	            // Shortcut
	            var typedArrayByteLength = typedArray.byteLength;

	            // Extract bytes
	            var words = [];
	            for (var i = 0; i < typedArrayByteLength; i++) {
	                words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8);
	            }

	            // Initialize this word array
	            superInit.call(this, words, typedArrayByteLength);
	        } else {
	            // Else call normal init
	            superInit.apply(this, arguments);
	        }
	    };

	    subInit.prototype = WordArray;
	}());


	return CryptoJS.lib.WordArray;

}));

/***/ }),

/***/ "./node_modules/crypto-js/md5.js":
/*!***************************************!*\
  !*** ./node_modules/crypto-js/md5.js ***!
  \***************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function (Math) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var Hasher = C_lib.Hasher;
	    var C_algo = C.algo;

	    // Constants table
	    var T = [];

	    // Compute constants
	    (function () {
	        for (var i = 0; i < 64; i++) {
	            T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;
	        }
	    }());

	    /**
	     * MD5 hash algorithm.
	     */
	    var MD5 = C_algo.MD5 = Hasher.extend({
	        _doReset: function () {
	            this._hash = new WordArray.init([
	                0x67452301, 0xefcdab89,
	                0x98badcfe, 0x10325476
	            ]);
	        },

	        _doProcessBlock: function (M, offset) {
	            // Swap endian
	            for (var i = 0; i < 16; i++) {
	                // Shortcuts
	                var offset_i = offset + i;
	                var M_offset_i = M[offset_i];

	                M[offset_i] = (
	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
	                );
	            }

	            // Shortcuts
	            var H = this._hash.words;

	            var M_offset_0  = M[offset + 0];
	            var M_offset_1  = M[offset + 1];
	            var M_offset_2  = M[offset + 2];
	            var M_offset_3  = M[offset + 3];
	            var M_offset_4  = M[offset + 4];
	            var M_offset_5  = M[offset + 5];
	            var M_offset_6  = M[offset + 6];
	            var M_offset_7  = M[offset + 7];
	            var M_offset_8  = M[offset + 8];
	            var M_offset_9  = M[offset + 9];
	            var M_offset_10 = M[offset + 10];
	            var M_offset_11 = M[offset + 11];
	            var M_offset_12 = M[offset + 12];
	            var M_offset_13 = M[offset + 13];
	            var M_offset_14 = M[offset + 14];
	            var M_offset_15 = M[offset + 15];

	            // Working variables
	            var a = H[0];
	            var b = H[1];
	            var c = H[2];
	            var d = H[3];

	            // Computation
	            a = FF(a, b, c, d, M_offset_0,  7,  T[0]);
	            d = FF(d, a, b, c, M_offset_1,  12, T[1]);
	            c = FF(c, d, a, b, M_offset_2,  17, T[2]);
	            b = FF(b, c, d, a, M_offset_3,  22, T[3]);
	            a = FF(a, b, c, d, M_offset_4,  7,  T[4]);
	            d = FF(d, a, b, c, M_offset_5,  12, T[5]);
	            c = FF(c, d, a, b, M_offset_6,  17, T[6]);
	            b = FF(b, c, d, a, M_offset_7,  22, T[7]);
	            a = FF(a, b, c, d, M_offset_8,  7,  T[8]);
	            d = FF(d, a, b, c, M_offset_9,  12, T[9]);
	            c = FF(c, d, a, b, M_offset_10, 17, T[10]);
	            b = FF(b, c, d, a, M_offset_11, 22, T[11]);
	            a = FF(a, b, c, d, M_offset_12, 7,  T[12]);
	            d = FF(d, a, b, c, M_offset_13, 12, T[13]);
	            c = FF(c, d, a, b, M_offset_14, 17, T[14]);
	            b = FF(b, c, d, a, M_offset_15, 22, T[15]);

	            a = GG(a, b, c, d, M_offset_1,  5,  T[16]);
	            d = GG(d, a, b, c, M_offset_6,  9,  T[17]);
	            c = GG(c, d, a, b, M_offset_11, 14, T[18]);
	            b = GG(b, c, d, a, M_offset_0,  20, T[19]);
	            a = GG(a, b, c, d, M_offset_5,  5,  T[20]);
	            d = GG(d, a, b, c, M_offset_10, 9,  T[21]);
	            c = GG(c, d, a, b, M_offset_15, 14, T[22]);
	            b = GG(b, c, d, a, M_offset_4,  20, T[23]);
	            a = GG(a, b, c, d, M_offset_9,  5,  T[24]);
	            d = GG(d, a, b, c, M_offset_14, 9,  T[25]);
	            c = GG(c, d, a, b, M_offset_3,  14, T[26]);
	            b = GG(b, c, d, a, M_offset_8,  20, T[27]);
	            a = GG(a, b, c, d, M_offset_13, 5,  T[28]);
	            d = GG(d, a, b, c, M_offset_2,  9,  T[29]);
	            c = GG(c, d, a, b, M_offset_7,  14, T[30]);
	            b = GG(b, c, d, a, M_offset_12, 20, T[31]);

	            a = HH(a, b, c, d, M_offset_5,  4,  T[32]);
	            d = HH(d, a, b, c, M_offset_8,  11, T[33]);
	            c = HH(c, d, a, b, M_offset_11, 16, T[34]);
	            b = HH(b, c, d, a, M_offset_14, 23, T[35]);
	            a = HH(a, b, c, d, M_offset_1,  4,  T[36]);
	            d = HH(d, a, b, c, M_offset_4,  11, T[37]);
	            c = HH(c, d, a, b, M_offset_7,  16, T[38]);
	            b = HH(b, c, d, a, M_offset_10, 23, T[39]);
	            a = HH(a, b, c, d, M_offset_13, 4,  T[40]);
	            d = HH(d, a, b, c, M_offset_0,  11, T[41]);
	            c = HH(c, d, a, b, M_offset_3,  16, T[42]);
	            b = HH(b, c, d, a, M_offset_6,  23, T[43]);
	            a = HH(a, b, c, d, M_offset_9,  4,  T[44]);
	            d = HH(d, a, b, c, M_offset_12, 11, T[45]);
	            c = HH(c, d, a, b, M_offset_15, 16, T[46]);
	            b = HH(b, c, d, a, M_offset_2,  23, T[47]);

	            a = II(a, b, c, d, M_offset_0,  6,  T[48]);
	            d = II(d, a, b, c, M_offset_7,  10, T[49]);
	            c = II(c, d, a, b, M_offset_14, 15, T[50]);
	            b = II(b, c, d, a, M_offset_5,  21, T[51]);
	            a = II(a, b, c, d, M_offset_12, 6,  T[52]);
	            d = II(d, a, b, c, M_offset_3,  10, T[53]);
	            c = II(c, d, a, b, M_offset_10, 15, T[54]);
	            b = II(b, c, d, a, M_offset_1,  21, T[55]);
	            a = II(a, b, c, d, M_offset_8,  6,  T[56]);
	            d = II(d, a, b, c, M_offset_15, 10, T[57]);
	            c = II(c, d, a, b, M_offset_6,  15, T[58]);
	            b = II(b, c, d, a, M_offset_13, 21, T[59]);
	            a = II(a, b, c, d, M_offset_4,  6,  T[60]);
	            d = II(d, a, b, c, M_offset_11, 10, T[61]);
	            c = II(c, d, a, b, M_offset_2,  15, T[62]);
	            b = II(b, c, d, a, M_offset_9,  21, T[63]);

	            // Intermediate hash value
	            H[0] = (H[0] + a) | 0;
	            H[1] = (H[1] + b) | 0;
	            H[2] = (H[2] + c) | 0;
	            H[3] = (H[3] + d) | 0;
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;

	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);

	            var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);
	            var nBitsTotalL = nBitsTotal;
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (
	                (((nBitsTotalH << 8)  | (nBitsTotalH >>> 24)) & 0x00ff00ff) |
	                (((nBitsTotalH << 24) | (nBitsTotalH >>> 8))  & 0xff00ff00)
	            );
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
	                (((nBitsTotalL << 8)  | (nBitsTotalL >>> 24)) & 0x00ff00ff) |
	                (((nBitsTotalL << 24) | (nBitsTotalL >>> 8))  & 0xff00ff00)
	            );

	            data.sigBytes = (dataWords.length + 1) * 4;

	            // Hash final blocks
	            this._process();

	            // Shortcuts
	            var hash = this._hash;
	            var H = hash.words;

	            // Swap endian
	            for (var i = 0; i < 4; i++) {
	                // Shortcut
	                var H_i = H[i];

	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
	            }

	            // Return final computed hash
	            return hash;
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);
	            clone._hash = this._hash.clone();

	            return clone;
	        }
	    });

	    function FF(a, b, c, d, x, s, t) {
	        var n = a + ((b & c) | (~b & d)) + x + t;
	        return ((n << s) | (n >>> (32 - s))) + b;
	    }

	    function GG(a, b, c, d, x, s, t) {
	        var n = a + ((b & d) | (c & ~d)) + x + t;
	        return ((n << s) | (n >>> (32 - s))) + b;
	    }

	    function HH(a, b, c, d, x, s, t) {
	        var n = a + (b ^ c ^ d) + x + t;
	        return ((n << s) | (n >>> (32 - s))) + b;
	    }

	    function II(a, b, c, d, x, s, t) {
	        var n = a + (c ^ (b | ~d)) + x + t;
	        return ((n << s) | (n >>> (32 - s))) + b;
	    }

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.MD5('message');
	     *     var hash = CryptoJS.MD5(wordArray);
	     */
	    C.MD5 = Hasher._createHelper(MD5);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacMD5(message, key);
	     */
	    C.HmacMD5 = Hasher._createHmacHelper(MD5);
	}(Math));


	return CryptoJS.MD5;

}));

/***/ }),

/***/ "./node_modules/crypto-js/mode-cfb.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/mode-cfb.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Cipher Feedback block mode.
	 */
	CryptoJS.mode.CFB = (function () {
	    var CFB = CryptoJS.lib.BlockCipherMode.extend();

	    CFB.Encryptor = CFB.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher;
	            var blockSize = cipher.blockSize;

	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);

	            // Remember this block to use with next block
	            this._prevBlock = words.slice(offset, offset + blockSize);
	        }
	    });

	    CFB.Decryptor = CFB.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher;
	            var blockSize = cipher.blockSize;

	            // Remember this block to use with next block
	            var thisBlock = words.slice(offset, offset + blockSize);

	            generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher);

	            // This block becomes the previous block
	            this._prevBlock = thisBlock;
	        }
	    });

	    function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) {
	        var keystream;

	        // Shortcut
	        var iv = this._iv;

	        // Generate keystream
	        if (iv) {
	            keystream = iv.slice(0);

	            // Remove IV for subsequent blocks
	            this._iv = undefined;
	        } else {
	            keystream = this._prevBlock;
	        }
	        cipher.encryptBlock(keystream, 0);

	        // Encrypt
	        for (var i = 0; i < blockSize; i++) {
	            words[offset + i] ^= keystream[i];
	        }
	    }

	    return CFB;
	}());


	return CryptoJS.mode.CFB;

}));

/***/ }),

/***/ "./node_modules/crypto-js/mode-ctr-gladman.js":
/*!****************************************************!*\
  !*** ./node_modules/crypto-js/mode-ctr-gladman.js ***!
  \****************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/** @preserve
	 * Counter block mode compatible with  Dr Brian Gladman fileenc.c
	 * derived from CryptoJS.mode.CTR
	 * Jan Hruby jhruby.web@gmail.com
	 */
	CryptoJS.mode.CTRGladman = (function () {
	    var CTRGladman = CryptoJS.lib.BlockCipherMode.extend();

		function incWord(word)
		{
			if (((word >> 24) & 0xff) === 0xff) { //overflow
			var b1 = (word >> 16)&0xff;
			var b2 = (word >> 8)&0xff;
			var b3 = word & 0xff;

			if (b1 === 0xff) // overflow b1
			{
			b1 = 0;
			if (b2 === 0xff)
			{
				b2 = 0;
				if (b3 === 0xff)
				{
					b3 = 0;
				}
				else
				{
					++b3;
				}
			}
			else
			{
				++b2;
			}
			}
			else
			{
			++b1;
			}

			word = 0;
			word += (b1 << 16);
			word += (b2 << 8);
			word += b3;
			}
			else
			{
			word += (0x01 << 24);
			}
			return word;
		}

		function incCounter(counter)
		{
			if ((counter[0] = incWord(counter[0])) === 0)
			{
				// encr_data in fileenc.c from  Dr Brian Gladman's counts only with DWORD j < 8
				counter[1] = incWord(counter[1]);
			}
			return counter;
		}

	    var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher
	            var blockSize = cipher.blockSize;
	            var iv = this._iv;
	            var counter = this._counter;

	            // Generate keystream
	            if (iv) {
	                counter = this._counter = iv.slice(0);

	                // Remove IV for subsequent blocks
	                this._iv = undefined;
	            }

				incCounter(counter);

				var keystream = counter.slice(0);
	            cipher.encryptBlock(keystream, 0);

	            // Encrypt
	            for (var i = 0; i < blockSize; i++) {
	                words[offset + i] ^= keystream[i];
	            }
	        }
	    });

	    CTRGladman.Decryptor = Encryptor;

	    return CTRGladman;
	}());




	return CryptoJS.mode.CTRGladman;

}));

/***/ }),

/***/ "./node_modules/crypto-js/mode-ctr.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/mode-ctr.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Counter block mode.
	 */
	CryptoJS.mode.CTR = (function () {
	    var CTR = CryptoJS.lib.BlockCipherMode.extend();

	    var Encryptor = CTR.Encryptor = CTR.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher
	            var blockSize = cipher.blockSize;
	            var iv = this._iv;
	            var counter = this._counter;

	            // Generate keystream
	            if (iv) {
	                counter = this._counter = iv.slice(0);

	                // Remove IV for subsequent blocks
	                this._iv = undefined;
	            }
	            var keystream = counter.slice(0);
	            cipher.encryptBlock(keystream, 0);

	            // Increment counter
	            counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0

	            // Encrypt
	            for (var i = 0; i < blockSize; i++) {
	                words[offset + i] ^= keystream[i];
	            }
	        }
	    });

	    CTR.Decryptor = Encryptor;

	    return CTR;
	}());


	return CryptoJS.mode.CTR;

}));

/***/ }),

/***/ "./node_modules/crypto-js/mode-ecb.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/mode-ecb.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Electronic Codebook block mode.
	 */
	CryptoJS.mode.ECB = (function () {
	    var ECB = CryptoJS.lib.BlockCipherMode.extend();

	    ECB.Encryptor = ECB.extend({
	        processBlock: function (words, offset) {
	            this._cipher.encryptBlock(words, offset);
	        }
	    });

	    ECB.Decryptor = ECB.extend({
	        processBlock: function (words, offset) {
	            this._cipher.decryptBlock(words, offset);
	        }
	    });

	    return ECB;
	}());


	return CryptoJS.mode.ECB;

}));

/***/ }),

/***/ "./node_modules/crypto-js/mode-ofb.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/mode-ofb.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Output Feedback block mode.
	 */
	CryptoJS.mode.OFB = (function () {
	    var OFB = CryptoJS.lib.BlockCipherMode.extend();

	    var Encryptor = OFB.Encryptor = OFB.extend({
	        processBlock: function (words, offset) {
	            // Shortcuts
	            var cipher = this._cipher
	            var blockSize = cipher.blockSize;
	            var iv = this._iv;
	            var keystream = this._keystream;

	            // Generate keystream
	            if (iv) {
	                keystream = this._keystream = iv.slice(0);

	                // Remove IV for subsequent blocks
	                this._iv = undefined;
	            }
	            cipher.encryptBlock(keystream, 0);

	            // Encrypt
	            for (var i = 0; i < blockSize; i++) {
	                words[offset + i] ^= keystream[i];
	            }
	        }
	    });

	    OFB.Decryptor = Encryptor;

	    return OFB;
	}());


	return CryptoJS.mode.OFB;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pad-ansix923.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-js/pad-ansix923.js ***!
  \************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * ANSI X.923 padding strategy.
	 */
	CryptoJS.pad.AnsiX923 = {
	    pad: function (data, blockSize) {
	        // Shortcuts
	        var dataSigBytes = data.sigBytes;
	        var blockSizeBytes = blockSize * 4;

	        // Count padding bytes
	        var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes;

	        // Compute last byte position
	        var lastBytePos = dataSigBytes + nPaddingBytes - 1;

	        // Pad
	        data.clamp();
	        data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8);
	        data.sigBytes += nPaddingBytes;
	    },

	    unpad: function (data) {
	        // Get number of padding bytes from last byte
	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;

	        // Remove padding
	        data.sigBytes -= nPaddingBytes;
	    }
	};


	return CryptoJS.pad.Ansix923;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pad-iso10126.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-js/pad-iso10126.js ***!
  \************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * ISO 10126 padding strategy.
	 */
	CryptoJS.pad.Iso10126 = {
	    pad: function (data, blockSize) {
	        // Shortcut
	        var blockSizeBytes = blockSize * 4;

	        // Count padding bytes
	        var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;

	        // Pad
	        data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)).
	             concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1));
	    },

	    unpad: function (data) {
	        // Get number of padding bytes from last byte
	        var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;

	        // Remove padding
	        data.sigBytes -= nPaddingBytes;
	    }
	};


	return CryptoJS.pad.Iso10126;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pad-iso97971.js":
/*!************************************************!*\
  !*** ./node_modules/crypto-js/pad-iso97971.js ***!
  \************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * ISO/IEC 9797-1 Padding Method 2.
	 */
	CryptoJS.pad.Iso97971 = {
	    pad: function (data, blockSize) {
	        // Add 0x80 byte
	        data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1));

	        // Zero pad the rest
	        CryptoJS.pad.ZeroPadding.pad(data, blockSize);
	    },

	    unpad: function (data) {
	        // Remove zero padding
	        CryptoJS.pad.ZeroPadding.unpad(data);

	        // Remove one more byte -- the 0x80 byte
	        data.sigBytes--;
	    }
	};


	return CryptoJS.pad.Iso97971;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pad-nopadding.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-js/pad-nopadding.js ***!
  \*************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * A noop padding strategy.
	 */
	CryptoJS.pad.NoPadding = {
	    pad: function () {
	    },

	    unpad: function () {
	    }
	};


	return CryptoJS.pad.NoPadding;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pad-zeropadding.js":
/*!***************************************************!*\
  !*** ./node_modules/crypto-js/pad-zeropadding.js ***!
  \***************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/**
	 * Zero padding strategy.
	 */
	CryptoJS.pad.ZeroPadding = {
	    pad: function (data, blockSize) {
	        // Shortcut
	        var blockSizeBytes = blockSize * 4;

	        // Pad
	        data.clamp();
	        data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes);
	    },

	    unpad: function (data) {
	        // Shortcut
	        var dataWords = data.words;

	        // Unpad
	        var i = data.sigBytes - 1;
	        for (var i = data.sigBytes - 1; i >= 0; i--) {
	            if (((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) {
	                data.sigBytes = i + 1;
	                break;
	            }
	        }
	    }
	};


	return CryptoJS.pad.ZeroPadding;

}));

/***/ }),

/***/ "./node_modules/crypto-js/pbkdf2.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/pbkdf2.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./sha256 */ "./node_modules/crypto-js/sha256.js"), __webpack_require__(/*! ./hmac */ "./node_modules/crypto-js/hmac.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Base = C_lib.Base;
	    var WordArray = C_lib.WordArray;
	    var C_algo = C.algo;
	    var SHA256 = C_algo.SHA256;
	    var HMAC = C_algo.HMAC;

	    /**
	     * Password-Based Key Derivation Function 2 algorithm.
	     */
	    var PBKDF2 = C_algo.PBKDF2 = Base.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
	         * @property {Hasher} hasher The hasher to use. Default: SHA256
	         * @property {number} iterations The number of iterations to perform. Default: 250000
	         */
	        cfg: Base.extend({
	            keySize: 128/32,
	            hasher: SHA256,
	            iterations: 250000
	        }),

	        /**
	         * Initializes a newly created key derivation function.
	         *
	         * @param {Object} cfg (Optional) The configuration options to use for the derivation.
	         *
	         * @example
	         *
	         *     var kdf = CryptoJS.algo.PBKDF2.create();
	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 });
	         *     var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 });
	         */
	        init: function (cfg) {
	            this.cfg = this.cfg.extend(cfg);
	        },

	        /**
	         * Computes the Password-Based Key Derivation Function 2.
	         *
	         * @param {WordArray|string} password The password.
	         * @param {WordArray|string} salt A salt.
	         *
	         * @return {WordArray} The derived key.
	         *
	         * @example
	         *
	         *     var key = kdf.compute(password, salt);
	         */
	        compute: function (password, salt) {
	            // Shortcut
	            var cfg = this.cfg;

	            // Init HMAC
	            var hmac = HMAC.create(cfg.hasher, password);

	            // Initial values
	            var derivedKey = WordArray.create();
	            var blockIndex = WordArray.create([0x00000001]);

	            // Shortcuts
	            var derivedKeyWords = derivedKey.words;
	            var blockIndexWords = blockIndex.words;
	            var keySize = cfg.keySize;
	            var iterations = cfg.iterations;

	            // Generate key
	            while (derivedKeyWords.length < keySize) {
	                var block = hmac.update(salt).finalize(blockIndex);
	                hmac.reset();

	                // Shortcuts
	                var blockWords = block.words;
	                var blockWordsLength = blockWords.length;

	                // Iterations
	                var intermediate = block;
	                for (var i = 1; i < iterations; i++) {
	                    intermediate = hmac.finalize(intermediate);
	                    hmac.reset();

	                    // Shortcut
	                    var intermediateWords = intermediate.words;

	                    // XOR intermediate with block
	                    for (var j = 0; j < blockWordsLength; j++) {
	                        blockWords[j] ^= intermediateWords[j];
	                    }
	                }

	                derivedKey.concat(block);
	                blockIndexWords[0]++;
	            }
	            derivedKey.sigBytes = keySize * 4;

	            return derivedKey;
	        }
	    });

	    /**
	     * Computes the Password-Based Key Derivation Function 2.
	     *
	     * @param {WordArray|string} password The password.
	     * @param {WordArray|string} salt A salt.
	     * @param {Object} cfg (Optional) The configuration options to use for this computation.
	     *
	     * @return {WordArray} The derived key.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var key = CryptoJS.PBKDF2(password, salt);
	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 });
	     *     var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 });
	     */
	    C.PBKDF2 = function (password, salt, cfg) {
	        return PBKDF2.create(cfg).compute(password, salt);
	    };
	}());


	return CryptoJS.PBKDF2;

}));

/***/ }),

/***/ "./node_modules/crypto-js/rabbit-legacy.js":
/*!*************************************************!*\
  !*** ./node_modules/crypto-js/rabbit-legacy.js ***!
  \*************************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var StreamCipher = C_lib.StreamCipher;
	    var C_algo = C.algo;

	    // Reusable objects
	    var S  = [];
	    var C_ = [];
	    var G  = [];

	    /**
	     * Rabbit stream cipher algorithm.
	     *
	     * This is a legacy version that neglected to convert the key to little-endian.
	     * This error doesn't affect the cipher's security,
	     * but it does affect its compatibility with other implementations.
	     */
	    var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({
	        _doReset: function () {
	            // Shortcuts
	            var K = this._key.words;
	            var iv = this.cfg.iv;

	            // Generate initial state values
	            var X = this._X = [
	                K[0], (K[3] << 16) | (K[2] >>> 16),
	                K[1], (K[0] << 16) | (K[3] >>> 16),
	                K[2], (K[1] << 16) | (K[0] >>> 16),
	                K[3], (K[2] << 16) | (K[1] >>> 16)
	            ];

	            // Generate initial counter values
	            var C = this._C = [
	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
	            ];

	            // Carry bit
	            this._b = 0;

	            // Iterate the system four times
	            for (var i = 0; i < 4; i++) {
	                nextState.call(this);
	            }

	            // Modify the counters
	            for (var i = 0; i < 8; i++) {
	                C[i] ^= X[(i + 4) & 7];
	            }

	            // IV setup
	            if (iv) {
	                // Shortcuts
	                var IV = iv.words;
	                var IV_0 = IV[0];
	                var IV_1 = IV[1];

	                // Generate four subvectors
	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);

	                // Modify counter values
	                C[0] ^= i0;
	                C[1] ^= i1;
	                C[2] ^= i2;
	                C[3] ^= i3;
	                C[4] ^= i0;
	                C[5] ^= i1;
	                C[6] ^= i2;
	                C[7] ^= i3;

	                // Iterate the system four times
	                for (var i = 0; i < 4; i++) {
	                    nextState.call(this);
	                }
	            }
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcut
	            var X = this._X;

	            // Iterate the system
	            nextState.call(this);

	            // Generate four keystream words
	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);

	            for (var i = 0; i < 4; i++) {
	                // Swap endian
	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);

	                // Encrypt
	                M[offset + i] ^= S[i];
	            }
	        },

	        blockSize: 128/32,

	        ivSize: 64/32
	    });

	    function nextState() {
	        // Shortcuts
	        var X = this._X;
	        var C = this._C;

	        // Save old counter values
	        for (var i = 0; i < 8; i++) {
	            C_[i] = C[i];
	        }

	        // Calculate new counter values
	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;

	        // Calculate the g-values
	        for (var i = 0; i < 8; i++) {
	            var gx = X[i] + C[i];

	            // Construct high and low argument for squaring
	            var ga = gx & 0xffff;
	            var gb = gx >>> 16;

	            // Calculate high and low result of squaring
	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);

	            // High XOR low
	            G[i] = gh ^ gl;
	        }

	        // Calculate new state values
	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
	    }

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg);
	     */
	    C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy);
	}());


	return CryptoJS.RabbitLegacy;

}));

/***/ }),

/***/ "./node_modules/crypto-js/rabbit.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/rabbit.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var StreamCipher = C_lib.StreamCipher;
	    var C_algo = C.algo;

	    // Reusable objects
	    var S  = [];
	    var C_ = [];
	    var G  = [];

	    /**
	     * Rabbit stream cipher algorithm
	     */
	    var Rabbit = C_algo.Rabbit = StreamCipher.extend({
	        _doReset: function () {
	            // Shortcuts
	            var K = this._key.words;
	            var iv = this.cfg.iv;

	            // Swap endian
	            for (var i = 0; i < 4; i++) {
	                K[i] = (((K[i] << 8)  | (K[i] >>> 24)) & 0x00ff00ff) |
	                       (((K[i] << 24) | (K[i] >>> 8))  & 0xff00ff00);
	            }

	            // Generate initial state values
	            var X = this._X = [
	                K[0], (K[3] << 16) | (K[2] >>> 16),
	                K[1], (K[0] << 16) | (K[3] >>> 16),
	                K[2], (K[1] << 16) | (K[0] >>> 16),
	                K[3], (K[2] << 16) | (K[1] >>> 16)
	            ];

	            // Generate initial counter values
	            var C = this._C = [
	                (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff),
	                (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff),
	                (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff),
	                (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff)
	            ];

	            // Carry bit
	            this._b = 0;

	            // Iterate the system four times
	            for (var i = 0; i < 4; i++) {
	                nextState.call(this);
	            }

	            // Modify the counters
	            for (var i = 0; i < 8; i++) {
	                C[i] ^= X[(i + 4) & 7];
	            }

	            // IV setup
	            if (iv) {
	                // Shortcuts
	                var IV = iv.words;
	                var IV_0 = IV[0];
	                var IV_1 = IV[1];

	                // Generate four subvectors
	                var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00);
	                var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00);
	                var i1 = (i0 >>> 16) | (i2 & 0xffff0000);
	                var i3 = (i2 << 16)  | (i0 & 0x0000ffff);

	                // Modify counter values
	                C[0] ^= i0;
	                C[1] ^= i1;
	                C[2] ^= i2;
	                C[3] ^= i3;
	                C[4] ^= i0;
	                C[5] ^= i1;
	                C[6] ^= i2;
	                C[7] ^= i3;

	                // Iterate the system four times
	                for (var i = 0; i < 4; i++) {
	                    nextState.call(this);
	                }
	            }
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcut
	            var X = this._X;

	            // Iterate the system
	            nextState.call(this);

	            // Generate four keystream words
	            S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16);
	            S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16);
	            S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16);
	            S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16);

	            for (var i = 0; i < 4; i++) {
	                // Swap endian
	                S[i] = (((S[i] << 8)  | (S[i] >>> 24)) & 0x00ff00ff) |
	                       (((S[i] << 24) | (S[i] >>> 8))  & 0xff00ff00);

	                // Encrypt
	                M[offset + i] ^= S[i];
	            }
	        },

	        blockSize: 128/32,

	        ivSize: 64/32
	    });

	    function nextState() {
	        // Shortcuts
	        var X = this._X;
	        var C = this._C;

	        // Save old counter values
	        for (var i = 0; i < 8; i++) {
	            C_[i] = C[i];
	        }

	        // Calculate new counter values
	        C[0] = (C[0] + 0x4d34d34d + this._b) | 0;
	        C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0;
	        C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0;
	        C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0;
	        C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0;
	        C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0;
	        C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0;
	        C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0;
	        this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0;

	        // Calculate the g-values
	        for (var i = 0; i < 8; i++) {
	            var gx = X[i] + C[i];

	            // Construct high and low argument for squaring
	            var ga = gx & 0xffff;
	            var gb = gx >>> 16;

	            // Calculate high and low result of squaring
	            var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb;
	            var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0);

	            // High XOR low
	            G[i] = gh ^ gl;
	        }

	        // Calculate new state values
	        X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0;
	        X[1] = (G[1] + ((G[0] << 8)  | (G[0] >>> 24)) + G[7]) | 0;
	        X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0;
	        X[3] = (G[3] + ((G[2] << 8)  | (G[2] >>> 24)) + G[1]) | 0;
	        X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0;
	        X[5] = (G[5] + ((G[4] << 8)  | (G[4] >>> 24)) + G[3]) | 0;
	        X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0;
	        X[7] = (G[7] + ((G[6] << 8)  | (G[6] >>> 24)) + G[5]) | 0;
	    }

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg);
	     */
	    C.Rabbit = StreamCipher._createHelper(Rabbit);
	}());


	return CryptoJS.Rabbit;

}));

/***/ }),

/***/ "./node_modules/crypto-js/rc4.js":
/*!***************************************!*\
  !*** ./node_modules/crypto-js/rc4.js ***!
  \***************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var StreamCipher = C_lib.StreamCipher;
	    var C_algo = C.algo;

	    /**
	     * RC4 stream cipher algorithm.
	     */
	    var RC4 = C_algo.RC4 = StreamCipher.extend({
	        _doReset: function () {
	            // Shortcuts
	            var key = this._key;
	            var keyWords = key.words;
	            var keySigBytes = key.sigBytes;

	            // Init sbox
	            var S = this._S = [];
	            for (var i = 0; i < 256; i++) {
	                S[i] = i;
	            }

	            // Key setup
	            for (var i = 0, j = 0; i < 256; i++) {
	                var keyByteIndex = i % keySigBytes;
	                var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff;

	                j = (j + S[i] + keyByte) % 256;

	                // Swap
	                var t = S[i];
	                S[i] = S[j];
	                S[j] = t;
	            }

	            // Counters
	            this._i = this._j = 0;
	        },

	        _doProcessBlock: function (M, offset) {
	            M[offset] ^= generateKeystreamWord.call(this);
	        },

	        keySize: 256/32,

	        ivSize: 0
	    });

	    function generateKeystreamWord() {
	        // Shortcuts
	        var S = this._S;
	        var i = this._i;
	        var j = this._j;

	        // Generate keystream word
	        var keystreamWord = 0;
	        for (var n = 0; n < 4; n++) {
	            i = (i + 1) % 256;
	            j = (j + S[i]) % 256;

	            // Swap
	            var t = S[i];
	            S[i] = S[j];
	            S[j] = t;

	            keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8);
	        }

	        // Update counters
	        this._i = i;
	        this._j = j;

	        return keystreamWord;
	    }

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.RC4.decrypt(ciphertext, key, cfg);
	     */
	    C.RC4 = StreamCipher._createHelper(RC4);

	    /**
	     * Modified RC4 stream cipher algorithm.
	     */
	    var RC4Drop = C_algo.RC4Drop = RC4.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {number} drop The number of keystream words to drop. Default 192
	         */
	        cfg: RC4.cfg.extend({
	            drop: 192
	        }),

	        _doReset: function () {
	            RC4._doReset.call(this);

	            // Drop
	            for (var i = this.cfg.drop; i > 0; i--) {
	                generateKeystreamWord.call(this);
	            }
	        }
	    });

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg);
	     */
	    C.RC4Drop = StreamCipher._createHelper(RC4Drop);
	}());


	return CryptoJS.RC4;

}));

/***/ }),

/***/ "./node_modules/crypto-js/ripemd160.js":
/*!*********************************************!*\
  !*** ./node_modules/crypto-js/ripemd160.js ***!
  \*********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	/** @preserve
	(c) 2012 by Cédric Mesnil. All rights reserved.

	Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

	    - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
	    - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
	*/

	(function (Math) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var Hasher = C_lib.Hasher;
	    var C_algo = C.algo;

	    // Constants table
	    var _zl = WordArray.create([
	        0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
	        7,  4, 13,  1, 10,  6, 15,  3, 12,  0,  9,  5,  2, 14, 11,  8,
	        3, 10, 14,  4,  9, 15,  8,  1,  2,  7,  0,  6, 13, 11,  5, 12,
	        1,  9, 11, 10,  0,  8, 12,  4, 13,  3,  7, 15, 14,  5,  6,  2,
	        4,  0,  5,  9,  7, 12,  2, 10, 14,  1,  3,  8, 11,  6, 15, 13]);
	    var _zr = WordArray.create([
	        5, 14,  7,  0,  9,  2, 11,  4, 13,  6, 15,  8,  1, 10,  3, 12,
	        6, 11,  3,  7,  0, 13,  5, 10, 14, 15,  8, 12,  4,  9,  1,  2,
	        15,  5,  1,  3,  7, 14,  6,  9, 11,  8, 12,  2, 10,  0,  4, 13,
	        8,  6,  4,  1,  3, 11, 15,  0,  5, 12,  2, 13,  9,  7, 10, 14,
	        12, 15, 10,  4,  1,  5,  8,  7,  6,  2, 13, 14,  0,  3,  9, 11]);
	    var _sl = WordArray.create([
	         11, 14, 15, 12,  5,  8,  7,  9, 11, 13, 14, 15,  6,  7,  9,  8,
	        7, 6,   8, 13, 11,  9,  7, 15,  7, 12, 15,  9, 11,  7, 13, 12,
	        11, 13,  6,  7, 14,  9, 13, 15, 14,  8, 13,  6,  5, 12,  7,  5,
	          11, 12, 14, 15, 14, 15,  9,  8,  9, 14,  5,  6,  8,  6,  5, 12,
	        9, 15,  5, 11,  6,  8, 13, 12,  5, 12, 13, 14, 11,  8,  5,  6 ]);
	    var _sr = WordArray.create([
	        8,  9,  9, 11, 13, 15, 15,  5,  7,  7,  8, 11, 14, 14, 12,  6,
	        9, 13, 15,  7, 12,  8,  9, 11,  7,  7, 12,  7,  6, 15, 13, 11,
	        9,  7, 15, 11,  8,  6,  6, 14, 12, 13,  5, 14, 13, 13,  7,  5,
	        15,  5,  8, 11, 14, 14,  6, 14,  6,  9, 12,  9, 12,  5, 15,  8,
	        8,  5, 12,  9, 12,  5, 14,  6,  8, 13,  6,  5, 15, 13, 11, 11 ]);

	    var _hl =  WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]);
	    var _hr =  WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]);

	    /**
	     * RIPEMD160 hash algorithm.
	     */
	    var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({
	        _doReset: function () {
	            this._hash  = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]);
	        },

	        _doProcessBlock: function (M, offset) {

	            // Swap endian
	            for (var i = 0; i < 16; i++) {
	                // Shortcuts
	                var offset_i = offset + i;
	                var M_offset_i = M[offset_i];

	                // Swap
	                M[offset_i] = (
	                    (((M_offset_i << 8)  | (M_offset_i >>> 24)) & 0x00ff00ff) |
	                    (((M_offset_i << 24) | (M_offset_i >>> 8))  & 0xff00ff00)
	                );
	            }
	            // Shortcut
	            var H  = this._hash.words;
	            var hl = _hl.words;
	            var hr = _hr.words;
	            var zl = _zl.words;
	            var zr = _zr.words;
	            var sl = _sl.words;
	            var sr = _sr.words;

	            // Working variables
	            var al, bl, cl, dl, el;
	            var ar, br, cr, dr, er;

	            ar = al = H[0];
	            br = bl = H[1];
	            cr = cl = H[2];
	            dr = dl = H[3];
	            er = el = H[4];
	            // Computation
	            var t;
	            for (var i = 0; i < 80; i += 1) {
	                t = (al +  M[offset+zl[i]])|0;
	                if (i<16){
		            t +=  f1(bl,cl,dl) + hl[0];
	                } else if (i<32) {
		            t +=  f2(bl,cl,dl) + hl[1];
	                } else if (i<48) {
		            t +=  f3(bl,cl,dl) + hl[2];
	                } else if (i<64) {
		            t +=  f4(bl,cl,dl) + hl[3];
	                } else {// if (i<80) {
		            t +=  f5(bl,cl,dl) + hl[4];
	                }
	                t = t|0;
	                t =  rotl(t,sl[i]);
	                t = (t+el)|0;
	                al = el;
	                el = dl;
	                dl = rotl(cl, 10);
	                cl = bl;
	                bl = t;

	                t = (ar + M[offset+zr[i]])|0;
	                if (i<16){
		            t +=  f5(br,cr,dr) + hr[0];
	                } else if (i<32) {
		            t +=  f4(br,cr,dr) + hr[1];
	                } else if (i<48) {
		            t +=  f3(br,cr,dr) + hr[2];
	                } else if (i<64) {
		            t +=  f2(br,cr,dr) + hr[3];
	                } else {// if (i<80) {
		            t +=  f1(br,cr,dr) + hr[4];
	                }
	                t = t|0;
	                t =  rotl(t,sr[i]) ;
	                t = (t+er)|0;
	                ar = er;
	                er = dr;
	                dr = rotl(cr, 10);
	                cr = br;
	                br = t;
	            }
	            // Intermediate hash value
	            t    = (H[1] + cl + dr)|0;
	            H[1] = (H[2] + dl + er)|0;
	            H[2] = (H[3] + el + ar)|0;
	            H[3] = (H[4] + al + br)|0;
	            H[4] = (H[0] + bl + cr)|0;
	            H[0] =  t;
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;

	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
	                (((nBitsTotal << 8)  | (nBitsTotal >>> 24)) & 0x00ff00ff) |
	                (((nBitsTotal << 24) | (nBitsTotal >>> 8))  & 0xff00ff00)
	            );
	            data.sigBytes = (dataWords.length + 1) * 4;

	            // Hash final blocks
	            this._process();

	            // Shortcuts
	            var hash = this._hash;
	            var H = hash.words;

	            // Swap endian
	            for (var i = 0; i < 5; i++) {
	                // Shortcut
	                var H_i = H[i];

	                // Swap
	                H[i] = (((H_i << 8)  | (H_i >>> 24)) & 0x00ff00ff) |
	                       (((H_i << 24) | (H_i >>> 8))  & 0xff00ff00);
	            }

	            // Return final computed hash
	            return hash;
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);
	            clone._hash = this._hash.clone();

	            return clone;
	        }
	    });


	    function f1(x, y, z) {
	        return ((x) ^ (y) ^ (z));

	    }

	    function f2(x, y, z) {
	        return (((x)&(y)) | ((~x)&(z)));
	    }

	    function f3(x, y, z) {
	        return (((x) | (~(y))) ^ (z));
	    }

	    function f4(x, y, z) {
	        return (((x) & (z)) | ((y)&(~(z))));
	    }

	    function f5(x, y, z) {
	        return ((x) ^ ((y) |(~(z))));

	    }

	    function rotl(x,n) {
	        return (x<<n) | (x>>>(32-n));
	    }


	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.RIPEMD160('message');
	     *     var hash = CryptoJS.RIPEMD160(wordArray);
	     */
	    C.RIPEMD160 = Hasher._createHelper(RIPEMD160);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacRIPEMD160(message, key);
	     */
	    C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160);
	}(Math));


	return CryptoJS.RIPEMD160;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha1.js":
/*!****************************************!*\
  !*** ./node_modules/crypto-js/sha1.js ***!
  \****************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var Hasher = C_lib.Hasher;
	    var C_algo = C.algo;

	    // Reusable object
	    var W = [];

	    /**
	     * SHA-1 hash algorithm.
	     */
	    var SHA1 = C_algo.SHA1 = Hasher.extend({
	        _doReset: function () {
	            this._hash = new WordArray.init([
	                0x67452301, 0xefcdab89,
	                0x98badcfe, 0x10325476,
	                0xc3d2e1f0
	            ]);
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcut
	            var H = this._hash.words;

	            // Working variables
	            var a = H[0];
	            var b = H[1];
	            var c = H[2];
	            var d = H[3];
	            var e = H[4];

	            // Computation
	            for (var i = 0; i < 80; i++) {
	                if (i < 16) {
	                    W[i] = M[offset + i] | 0;
	                } else {
	                    var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
	                    W[i] = (n << 1) | (n >>> 31);
	                }

	                var t = ((a << 5) | (a >>> 27)) + e + W[i];
	                if (i < 20) {
	                    t += ((b & c) | (~b & d)) + 0x5a827999;
	                } else if (i < 40) {
	                    t += (b ^ c ^ d) + 0x6ed9eba1;
	                } else if (i < 60) {
	                    t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;
	                } else /* if (i < 80) */ {
	                    t += (b ^ c ^ d) - 0x359d3e2a;
	                }

	                e = d;
	                d = c;
	                c = (b << 30) | (b >>> 2);
	                b = a;
	                a = t;
	            }

	            // Intermediate hash value
	            H[0] = (H[0] + a) | 0;
	            H[1] = (H[1] + b) | 0;
	            H[2] = (H[2] + c) | 0;
	            H[3] = (H[3] + d) | 0;
	            H[4] = (H[4] + e) | 0;
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;

	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
	            data.sigBytes = dataWords.length * 4;

	            // Hash final blocks
	            this._process();

	            // Return final computed hash
	            return this._hash;
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);
	            clone._hash = this._hash.clone();

	            return clone;
	        }
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA1('message');
	     *     var hash = CryptoJS.SHA1(wordArray);
	     */
	    C.SHA1 = Hasher._createHelper(SHA1);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA1(message, key);
	     */
	    C.HmacSHA1 = Hasher._createHmacHelper(SHA1);
	}());


	return CryptoJS.SHA1;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha224.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/sha224.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./sha256 */ "./node_modules/crypto-js/sha256.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var C_algo = C.algo;
	    var SHA256 = C_algo.SHA256;

	    /**
	     * SHA-224 hash algorithm.
	     */
	    var SHA224 = C_algo.SHA224 = SHA256.extend({
	        _doReset: function () {
	            this._hash = new WordArray.init([
	                0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
	                0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4
	            ]);
	        },

	        _doFinalize: function () {
	            var hash = SHA256._doFinalize.call(this);

	            hash.sigBytes -= 4;

	            return hash;
	        }
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA224('message');
	     *     var hash = CryptoJS.SHA224(wordArray);
	     */
	    C.SHA224 = SHA256._createHelper(SHA224);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA224(message, key);
	     */
	    C.HmacSHA224 = SHA256._createHmacHelper(SHA224);
	}());


	return CryptoJS.SHA224;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha256.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/sha256.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function (Math) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var Hasher = C_lib.Hasher;
	    var C_algo = C.algo;

	    // Initialization and round constants tables
	    var H = [];
	    var K = [];

	    // Compute constants
	    (function () {
	        function isPrime(n) {
	            var sqrtN = Math.sqrt(n);
	            for (var factor = 2; factor <= sqrtN; factor++) {
	                if (!(n % factor)) {
	                    return false;
	                }
	            }

	            return true;
	        }

	        function getFractionalBits(n) {
	            return ((n - (n | 0)) * 0x100000000) | 0;
	        }

	        var n = 2;
	        var nPrime = 0;
	        while (nPrime < 64) {
	            if (isPrime(n)) {
	                if (nPrime < 8) {
	                    H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2));
	                }
	                K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3));

	                nPrime++;
	            }

	            n++;
	        }
	    }());

	    // Reusable object
	    var W = [];

	    /**
	     * SHA-256 hash algorithm.
	     */
	    var SHA256 = C_algo.SHA256 = Hasher.extend({
	        _doReset: function () {
	            this._hash = new WordArray.init(H.slice(0));
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcut
	            var H = this._hash.words;

	            // Working variables
	            var a = H[0];
	            var b = H[1];
	            var c = H[2];
	            var d = H[3];
	            var e = H[4];
	            var f = H[5];
	            var g = H[6];
	            var h = H[7];

	            // Computation
	            for (var i = 0; i < 64; i++) {
	                if (i < 16) {
	                    W[i] = M[offset + i] | 0;
	                } else {
	                    var gamma0x = W[i - 15];
	                    var gamma0  = ((gamma0x << 25) | (gamma0x >>> 7))  ^
	                                  ((gamma0x << 14) | (gamma0x >>> 18)) ^
	                                   (gamma0x >>> 3);

	                    var gamma1x = W[i - 2];
	                    var gamma1  = ((gamma1x << 15) | (gamma1x >>> 17)) ^
	                                  ((gamma1x << 13) | (gamma1x >>> 19)) ^
	                                   (gamma1x >>> 10);

	                    W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16];
	                }

	                var ch  = (e & f) ^ (~e & g);
	                var maj = (a & b) ^ (a & c) ^ (b & c);

	                var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22));
	                var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7)  | (e >>> 25));

	                var t1 = h + sigma1 + ch + K[i] + W[i];
	                var t2 = sigma0 + maj;

	                h = g;
	                g = f;
	                f = e;
	                e = (d + t1) | 0;
	                d = c;
	                c = b;
	                b = a;
	                a = (t1 + t2) | 0;
	            }

	            // Intermediate hash value
	            H[0] = (H[0] + a) | 0;
	            H[1] = (H[1] + b) | 0;
	            H[2] = (H[2] + c) | 0;
	            H[3] = (H[3] + d) | 0;
	            H[4] = (H[4] + e) | 0;
	            H[5] = (H[5] + f) | 0;
	            H[6] = (H[6] + g) | 0;
	            H[7] = (H[7] + h) | 0;
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;

	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);
	            dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;
	            data.sigBytes = dataWords.length * 4;

	            // Hash final blocks
	            this._process();

	            // Return final computed hash
	            return this._hash;
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);
	            clone._hash = this._hash.clone();

	            return clone;
	        }
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA256('message');
	     *     var hash = CryptoJS.SHA256(wordArray);
	     */
	    C.SHA256 = Hasher._createHelper(SHA256);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA256(message, key);
	     */
	    C.HmacSHA256 = Hasher._createHmacHelper(SHA256);
	}(Math));


	return CryptoJS.SHA256;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha3.js":
/*!****************************************!*\
  !*** ./node_modules/crypto-js/sha3.js ***!
  \****************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./x64-core */ "./node_modules/crypto-js/x64-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function (Math) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var Hasher = C_lib.Hasher;
	    var C_x64 = C.x64;
	    var X64Word = C_x64.Word;
	    var C_algo = C.algo;

	    // Constants tables
	    var RHO_OFFSETS = [];
	    var PI_INDEXES  = [];
	    var ROUND_CONSTANTS = [];

	    // Compute Constants
	    (function () {
	        // Compute rho offset constants
	        var x = 1, y = 0;
	        for (var t = 0; t < 24; t++) {
	            RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;

	            var newX = y % 5;
	            var newY = (2 * x + 3 * y) % 5;
	            x = newX;
	            y = newY;
	        }

	        // Compute pi index constants
	        for (var x = 0; x < 5; x++) {
	            for (var y = 0; y < 5; y++) {
	                PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;
	            }
	        }

	        // Compute round constants
	        var LFSR = 0x01;
	        for (var i = 0; i < 24; i++) {
	            var roundConstantMsw = 0;
	            var roundConstantLsw = 0;

	            for (var j = 0; j < 7; j++) {
	                if (LFSR & 0x01) {
	                    var bitPosition = (1 << j) - 1;
	                    if (bitPosition < 32) {
	                        roundConstantLsw ^= 1 << bitPosition;
	                    } else /* if (bitPosition >= 32) */ {
	                        roundConstantMsw ^= 1 << (bitPosition - 32);
	                    }
	                }

	                // Compute next LFSR
	                if (LFSR & 0x80) {
	                    // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1
	                    LFSR = (LFSR << 1) ^ 0x71;
	                } else {
	                    LFSR <<= 1;
	                }
	            }

	            ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);
	        }
	    }());

	    // Reusable objects for temporary values
	    var T = [];
	    (function () {
	        for (var i = 0; i < 25; i++) {
	            T[i] = X64Word.create();
	        }
	    }());

	    /**
	     * SHA-3 hash algorithm.
	     */
	    var SHA3 = C_algo.SHA3 = Hasher.extend({
	        /**
	         * Configuration options.
	         *
	         * @property {number} outputLength
	         *   The desired number of bits in the output hash.
	         *   Only values permitted are: 224, 256, 384, 512.
	         *   Default: 512
	         */
	        cfg: Hasher.cfg.extend({
	            outputLength: 512
	        }),

	        _doReset: function () {
	            var state = this._state = []
	            for (var i = 0; i < 25; i++) {
	                state[i] = new X64Word.init();
	            }

	            this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcuts
	            var state = this._state;
	            var nBlockSizeLanes = this.blockSize / 2;

	            // Absorb
	            for (var i = 0; i < nBlockSizeLanes; i++) {
	                // Shortcuts
	                var M2i  = M[offset + 2 * i];
	                var M2i1 = M[offset + 2 * i + 1];

	                // Swap endian
	                M2i = (
	                    (((M2i << 8)  | (M2i >>> 24)) & 0x00ff00ff) |
	                    (((M2i << 24) | (M2i >>> 8))  & 0xff00ff00)
	                );
	                M2i1 = (
	                    (((M2i1 << 8)  | (M2i1 >>> 24)) & 0x00ff00ff) |
	                    (((M2i1 << 24) | (M2i1 >>> 8))  & 0xff00ff00)
	                );

	                // Absorb message into state
	                var lane = state[i];
	                lane.high ^= M2i1;
	                lane.low  ^= M2i;
	            }

	            // Rounds
	            for (var round = 0; round < 24; round++) {
	                // Theta
	                for (var x = 0; x < 5; x++) {
	                    // Mix column lanes
	                    var tMsw = 0, tLsw = 0;
	                    for (var y = 0; y < 5; y++) {
	                        var lane = state[x + 5 * y];
	                        tMsw ^= lane.high;
	                        tLsw ^= lane.low;
	                    }

	                    // Temporary values
	                    var Tx = T[x];
	                    Tx.high = tMsw;
	                    Tx.low  = tLsw;
	                }
	                for (var x = 0; x < 5; x++) {
	                    // Shortcuts
	                    var Tx4 = T[(x + 4) % 5];
	                    var Tx1 = T[(x + 1) % 5];
	                    var Tx1Msw = Tx1.high;
	                    var Tx1Lsw = Tx1.low;

	                    // Mix surrounding columns
	                    var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));
	                    var tLsw = Tx4.low  ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));
	                    for (var y = 0; y < 5; y++) {
	                        var lane = state[x + 5 * y];
	                        lane.high ^= tMsw;
	                        lane.low  ^= tLsw;
	                    }
	                }

	                // Rho Pi
	                for (var laneIndex = 1; laneIndex < 25; laneIndex++) {
	                    var tMsw;
	                    var tLsw;

	                    // Shortcuts
	                    var lane = state[laneIndex];
	                    var laneMsw = lane.high;
	                    var laneLsw = lane.low;
	                    var rhoOffset = RHO_OFFSETS[laneIndex];

	                    // Rotate lanes
	                    if (rhoOffset < 32) {
	                        tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));
	                        tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));
	                    } else /* if (rhoOffset >= 32) */ {
	                        tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));
	                        tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));
	                    }

	                    // Transpose lanes
	                    var TPiLane = T[PI_INDEXES[laneIndex]];
	                    TPiLane.high = tMsw;
	                    TPiLane.low  = tLsw;
	                }

	                // Rho pi at x = y = 0
	                var T0 = T[0];
	                var state0 = state[0];
	                T0.high = state0.high;
	                T0.low  = state0.low;

	                // Chi
	                for (var x = 0; x < 5; x++) {
	                    for (var y = 0; y < 5; y++) {
	                        // Shortcuts
	                        var laneIndex = x + 5 * y;
	                        var lane = state[laneIndex];
	                        var TLane = T[laneIndex];
	                        var Tx1Lane = T[((x + 1) % 5) + 5 * y];
	                        var Tx2Lane = T[((x + 2) % 5) + 5 * y];

	                        // Mix rows
	                        lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);
	                        lane.low  = TLane.low  ^ (~Tx1Lane.low  & Tx2Lane.low);
	                    }
	                }

	                // Iota
	                var lane = state[0];
	                var roundConstant = ROUND_CONSTANTS[round];
	                lane.high ^= roundConstant.high;
	                lane.low  ^= roundConstant.low;
	            }
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;
	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;
	            var blockSizeBits = this.blockSize * 32;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);
	            dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;
	            data.sigBytes = dataWords.length * 4;

	            // Hash final blocks
	            this._process();

	            // Shortcuts
	            var state = this._state;
	            var outputLengthBytes = this.cfg.outputLength / 8;
	            var outputLengthLanes = outputLengthBytes / 8;

	            // Squeeze
	            var hashWords = [];
	            for (var i = 0; i < outputLengthLanes; i++) {
	                // Shortcuts
	                var lane = state[i];
	                var laneMsw = lane.high;
	                var laneLsw = lane.low;

	                // Swap endian
	                laneMsw = (
	                    (((laneMsw << 8)  | (laneMsw >>> 24)) & 0x00ff00ff) |
	                    (((laneMsw << 24) | (laneMsw >>> 8))  & 0xff00ff00)
	                );
	                laneLsw = (
	                    (((laneLsw << 8)  | (laneLsw >>> 24)) & 0x00ff00ff) |
	                    (((laneLsw << 24) | (laneLsw >>> 8))  & 0xff00ff00)
	                );

	                // Squeeze state to retrieve hash
	                hashWords.push(laneLsw);
	                hashWords.push(laneMsw);
	            }

	            // Return final computed hash
	            return new WordArray.init(hashWords, outputLengthBytes);
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);

	            var state = clone._state = this._state.slice(0);
	            for (var i = 0; i < 25; i++) {
	                state[i] = state[i].clone();
	            }

	            return clone;
	        }
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA3('message');
	     *     var hash = CryptoJS.SHA3(wordArray);
	     */
	    C.SHA3 = Hasher._createHelper(SHA3);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA3(message, key);
	     */
	    C.HmacSHA3 = Hasher._createHmacHelper(SHA3);
	}(Math));


	return CryptoJS.SHA3;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha384.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/sha384.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./x64-core */ "./node_modules/crypto-js/x64-core.js"), __webpack_require__(/*! ./sha512 */ "./node_modules/crypto-js/sha512.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_x64 = C.x64;
	    var X64Word = C_x64.Word;
	    var X64WordArray = C_x64.WordArray;
	    var C_algo = C.algo;
	    var SHA512 = C_algo.SHA512;

	    /**
	     * SHA-384 hash algorithm.
	     */
	    var SHA384 = C_algo.SHA384 = SHA512.extend({
	        _doReset: function () {
	            this._hash = new X64WordArray.init([
	                new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507),
	                new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939),
	                new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511),
	                new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4)
	            ]);
	        },

	        _doFinalize: function () {
	            var hash = SHA512._doFinalize.call(this);

	            hash.sigBytes -= 16;

	            return hash;
	        }
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA384('message');
	     *     var hash = CryptoJS.SHA384(wordArray);
	     */
	    C.SHA384 = SHA512._createHelper(SHA384);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA384(message, key);
	     */
	    C.HmacSHA384 = SHA512._createHmacHelper(SHA384);
	}());


	return CryptoJS.SHA384;

}));

/***/ }),

/***/ "./node_modules/crypto-js/sha512.js":
/*!******************************************!*\
  !*** ./node_modules/crypto-js/sha512.js ***!
  \******************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./x64-core */ "./node_modules/crypto-js/x64-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Hasher = C_lib.Hasher;
	    var C_x64 = C.x64;
	    var X64Word = C_x64.Word;
	    var X64WordArray = C_x64.WordArray;
	    var C_algo = C.algo;

	    function X64Word_create() {
	        return X64Word.create.apply(X64Word, arguments);
	    }

	    // Constants
	    var K = [
	        X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),
	        X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),
	        X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),
	        X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),
	        X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),
	        X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),
	        X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),
	        X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),
	        X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),
	        X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),
	        X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),
	        X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),
	        X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),
	        X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),
	        X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),
	        X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),
	        X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),
	        X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),
	        X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),
	        X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),
	        X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),
	        X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),
	        X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),
	        X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),
	        X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),
	        X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),
	        X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),
	        X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),
	        X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),
	        X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),
	        X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),
	        X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),
	        X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),
	        X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),
	        X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),
	        X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),
	        X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),
	        X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),
	        X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),
	        X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)
	    ];

	    // Reusable objects
	    var W = [];
	    (function () {
	        for (var i = 0; i < 80; i++) {
	            W[i] = X64Word_create();
	        }
	    }());

	    /**
	     * SHA-512 hash algorithm.
	     */
	    var SHA512 = C_algo.SHA512 = Hasher.extend({
	        _doReset: function () {
	            this._hash = new X64WordArray.init([
	                new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),
	                new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),
	                new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),
	                new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)
	            ]);
	        },

	        _doProcessBlock: function (M, offset) {
	            // Shortcuts
	            var H = this._hash.words;

	            var H0 = H[0];
	            var H1 = H[1];
	            var H2 = H[2];
	            var H3 = H[3];
	            var H4 = H[4];
	            var H5 = H[5];
	            var H6 = H[6];
	            var H7 = H[7];

	            var H0h = H0.high;
	            var H0l = H0.low;
	            var H1h = H1.high;
	            var H1l = H1.low;
	            var H2h = H2.high;
	            var H2l = H2.low;
	            var H3h = H3.high;
	            var H3l = H3.low;
	            var H4h = H4.high;
	            var H4l = H4.low;
	            var H5h = H5.high;
	            var H5l = H5.low;
	            var H6h = H6.high;
	            var H6l = H6.low;
	            var H7h = H7.high;
	            var H7l = H7.low;

	            // Working variables
	            var ah = H0h;
	            var al = H0l;
	            var bh = H1h;
	            var bl = H1l;
	            var ch = H2h;
	            var cl = H2l;
	            var dh = H3h;
	            var dl = H3l;
	            var eh = H4h;
	            var el = H4l;
	            var fh = H5h;
	            var fl = H5l;
	            var gh = H6h;
	            var gl = H6l;
	            var hh = H7h;
	            var hl = H7l;

	            // Rounds
	            for (var i = 0; i < 80; i++) {
	                var Wil;
	                var Wih;

	                // Shortcut
	                var Wi = W[i];

	                // Extend message
	                if (i < 16) {
	                    Wih = Wi.high = M[offset + i * 2]     | 0;
	                    Wil = Wi.low  = M[offset + i * 2 + 1] | 0;
	                } else {
	                    // Gamma0
	                    var gamma0x  = W[i - 15];
	                    var gamma0xh = gamma0x.high;
	                    var gamma0xl = gamma0x.low;
	                    var gamma0h  = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);
	                    var gamma0l  = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));

	                    // Gamma1
	                    var gamma1x  = W[i - 2];
	                    var gamma1xh = gamma1x.high;
	                    var gamma1xl = gamma1x.low;
	                    var gamma1h  = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);
	                    var gamma1l  = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));

	                    // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
	                    var Wi7  = W[i - 7];
	                    var Wi7h = Wi7.high;
	                    var Wi7l = Wi7.low;

	                    var Wi16  = W[i - 16];
	                    var Wi16h = Wi16.high;
	                    var Wi16l = Wi16.low;

	                    Wil = gamma0l + Wi7l;
	                    Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);
	                    Wil = Wil + gamma1l;
	                    Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);
	                    Wil = Wil + Wi16l;
	                    Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);

	                    Wi.high = Wih;
	                    Wi.low  = Wil;
	                }

	                var chh  = (eh & fh) ^ (~eh & gh);
	                var chl  = (el & fl) ^ (~el & gl);
	                var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);
	                var majl = (al & bl) ^ (al & cl) ^ (bl & cl);

	                var sigma0h = ((ah >>> 28) | (al << 4))  ^ ((ah << 30)  | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));
	                var sigma0l = ((al >>> 28) | (ah << 4))  ^ ((al << 30)  | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));
	                var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));
	                var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));

	                // t1 = h + sigma1 + ch + K[i] + W[i]
	                var Ki  = K[i];
	                var Kih = Ki.high;
	                var Kil = Ki.low;

	                var t1l = hl + sigma1l;
	                var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);
	                var t1l = t1l + chl;
	                var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);
	                var t1l = t1l + Kil;
	                var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);
	                var t1l = t1l + Wil;
	                var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);

	                // t2 = sigma0 + maj
	                var t2l = sigma0l + majl;
	                var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);

	                // Update working variables
	                hh = gh;
	                hl = gl;
	                gh = fh;
	                gl = fl;
	                fh = eh;
	                fl = el;
	                el = (dl + t1l) | 0;
	                eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;
	                dh = ch;
	                dl = cl;
	                ch = bh;
	                cl = bl;
	                bh = ah;
	                bl = al;
	                al = (t1l + t2l) | 0;
	                ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;
	            }

	            // Intermediate hash value
	            H0l = H0.low  = (H0l + al);
	            H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));
	            H1l = H1.low  = (H1l + bl);
	            H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));
	            H2l = H2.low  = (H2l + cl);
	            H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));
	            H3l = H3.low  = (H3l + dl);
	            H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));
	            H4l = H4.low  = (H4l + el);
	            H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));
	            H5l = H5.low  = (H5l + fl);
	            H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));
	            H6l = H6.low  = (H6l + gl);
	            H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));
	            H7l = H7.low  = (H7l + hl);
	            H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));
	        },

	        _doFinalize: function () {
	            // Shortcuts
	            var data = this._data;
	            var dataWords = data.words;

	            var nBitsTotal = this._nDataBytes * 8;
	            var nBitsLeft = data.sigBytes * 8;

	            // Add padding
	            dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);
	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);
	            dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;
	            data.sigBytes = dataWords.length * 4;

	            // Hash final blocks
	            this._process();

	            // Convert hash to 32-bit word array before returning
	            var hash = this._hash.toX32();

	            // Return final computed hash
	            return hash;
	        },

	        clone: function () {
	            var clone = Hasher.clone.call(this);
	            clone._hash = this._hash.clone();

	            return clone;
	        },

	        blockSize: 1024/32
	    });

	    /**
	     * Shortcut function to the hasher's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     *
	     * @return {WordArray} The hash.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hash = CryptoJS.SHA512('message');
	     *     var hash = CryptoJS.SHA512(wordArray);
	     */
	    C.SHA512 = Hasher._createHelper(SHA512);

	    /**
	     * Shortcut function to the HMAC's object interface.
	     *
	     * @param {WordArray|string} message The message to hash.
	     * @param {WordArray|string} key The secret key.
	     *
	     * @return {WordArray} The HMAC.
	     *
	     * @static
	     *
	     * @example
	     *
	     *     var hmac = CryptoJS.HmacSHA512(message, key);
	     */
	    C.HmacSHA512 = Hasher._createHmacHelper(SHA512);
	}());


	return CryptoJS.SHA512;

}));

/***/ }),

/***/ "./node_modules/crypto-js/tripledes.js":
/*!*********************************************!*\
  !*** ./node_modules/crypto-js/tripledes.js ***!
  \*********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory, undef) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"), __webpack_require__(/*! ./enc-base64 */ "./node_modules/crypto-js/enc-base64.js"), __webpack_require__(/*! ./md5 */ "./node_modules/crypto-js/md5.js"), __webpack_require__(/*! ./evpkdf */ "./node_modules/crypto-js/evpkdf.js"), __webpack_require__(/*! ./cipher-core */ "./node_modules/crypto-js/cipher-core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function () {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var WordArray = C_lib.WordArray;
	    var BlockCipher = C_lib.BlockCipher;
	    var C_algo = C.algo;

	    // Permuted Choice 1 constants
	    var PC1 = [
	        57, 49, 41, 33, 25, 17, 9,  1,
	        58, 50, 42, 34, 26, 18, 10, 2,
	        59, 51, 43, 35, 27, 19, 11, 3,
	        60, 52, 44, 36, 63, 55, 47, 39,
	        31, 23, 15, 7,  62, 54, 46, 38,
	        30, 22, 14, 6,  61, 53, 45, 37,
	        29, 21, 13, 5,  28, 20, 12, 4
	    ];

	    // Permuted Choice 2 constants
	    var PC2 = [
	        14, 17, 11, 24, 1,  5,
	        3,  28, 15, 6,  21, 10,
	        23, 19, 12, 4,  26, 8,
	        16, 7,  27, 20, 13, 2,
	        41, 52, 31, 37, 47, 55,
	        30, 40, 51, 45, 33, 48,
	        44, 49, 39, 56, 34, 53,
	        46, 42, 50, 36, 29, 32
	    ];

	    // Cumulative bit shift constants
	    var BIT_SHIFTS = [1,  2,  4,  6,  8,  10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];

	    // SBOXes and round permutation constants
	    var SBOX_P = [
	        {
	            0x0: 0x808200,
	            0x10000000: 0x8000,
	            0x20000000: 0x808002,
	            0x30000000: 0x2,
	            0x40000000: 0x200,
	            0x50000000: 0x808202,
	            0x60000000: 0x800202,
	            0x70000000: 0x800000,
	            0x80000000: 0x202,
	            0x90000000: 0x800200,
	            0xa0000000: 0x8200,
	            0xb0000000: 0x808000,
	            0xc0000000: 0x8002,
	            0xd0000000: 0x800002,
	            0xe0000000: 0x0,
	            0xf0000000: 0x8202,
	            0x8000000: 0x0,
	            0x18000000: 0x808202,
	            0x28000000: 0x8202,
	            0x38000000: 0x8000,
	            0x48000000: 0x808200,
	            0x58000000: 0x200,
	            0x68000000: 0x808002,
	            0x78000000: 0x2,
	            0x88000000: 0x800200,
	            0x98000000: 0x8200,
	            0xa8000000: 0x808000,
	            0xb8000000: 0x800202,
	            0xc8000000: 0x800002,
	            0xd8000000: 0x8002,
	            0xe8000000: 0x202,
	            0xf8000000: 0x800000,
	            0x1: 0x8000,
	            0x10000001: 0x2,
	            0x20000001: 0x808200,
	            0x30000001: 0x800000,
	            0x40000001: 0x808002,
	            0x50000001: 0x8200,
	            0x60000001: 0x200,
	            0x70000001: 0x800202,
	            0x80000001: 0x808202,
	            0x90000001: 0x808000,
	            0xa0000001: 0x800002,
	            0xb0000001: 0x8202,
	            0xc0000001: 0x202,
	            0xd0000001: 0x800200,
	            0xe0000001: 0x8002,
	            0xf0000001: 0x0,
	            0x8000001: 0x808202,
	            0x18000001: 0x808000,
	            0x28000001: 0x800000,
	            0x38000001: 0x200,
	            0x48000001: 0x8000,
	            0x58000001: 0x800002,
	            0x68000001: 0x2,
	            0x78000001: 0x8202,
	            0x88000001: 0x8002,
	            0x98000001: 0x800202,
	            0xa8000001: 0x202,
	            0xb8000001: 0x808200,
	            0xc8000001: 0x800200,
	            0xd8000001: 0x0,
	            0xe8000001: 0x8200,
	            0xf8000001: 0x808002
	        },
	        {
	            0x0: 0x40084010,
	            0x1000000: 0x4000,
	            0x2000000: 0x80000,
	            0x3000000: 0x40080010,
	            0x4000000: 0x40000010,
	            0x5000000: 0x40084000,
	            0x6000000: 0x40004000,
	            0x7000000: 0x10,
	            0x8000000: 0x84000,
	            0x9000000: 0x40004010,
	            0xa000000: 0x40000000,
	            0xb000000: 0x84010,
	            0xc000000: 0x80010,
	            0xd000000: 0x0,
	            0xe000000: 0x4010,
	            0xf000000: 0x40080000,
	            0x800000: 0x40004000,
	            0x1800000: 0x84010,
	            0x2800000: 0x10,
	            0x3800000: 0x40004010,
	            0x4800000: 0x40084010,
	            0x5800000: 0x40000000,
	            0x6800000: 0x80000,
	            0x7800000: 0x40080010,
	            0x8800000: 0x80010,
	            0x9800000: 0x0,
	            0xa800000: 0x4000,
	            0xb800000: 0x40080000,
	            0xc800000: 0x40000010,
	            0xd800000: 0x84000,
	            0xe800000: 0x40084000,
	            0xf800000: 0x4010,
	            0x10000000: 0x0,
	            0x11000000: 0x40080010,
	            0x12000000: 0x40004010,
	            0x13000000: 0x40084000,
	            0x14000000: 0x40080000,
	            0x15000000: 0x10,
	            0x16000000: 0x84010,
	            0x17000000: 0x4000,
	            0x18000000: 0x4010,
	            0x19000000: 0x80000,
	            0x1a000000: 0x80010,
	            0x1b000000: 0x40000010,
	            0x1c000000: 0x84000,
	            0x1d000000: 0x40004000,
	            0x1e000000: 0x40000000,
	            0x1f000000: 0x40084010,
	            0x10800000: 0x84010,
	            0x11800000: 0x80000,
	            0x12800000: 0x40080000,
	            0x13800000: 0x4000,
	            0x14800000: 0x40004000,
	            0x15800000: 0x40084010,
	            0x16800000: 0x10,
	            0x17800000: 0x40000000,
	            0x18800000: 0x40084000,
	            0x19800000: 0x40000010,
	            0x1a800000: 0x40004010,
	            0x1b800000: 0x80010,
	            0x1c800000: 0x0,
	            0x1d800000: 0x4010,
	            0x1e800000: 0x40080010,
	            0x1f800000: 0x84000
	        },
	        {
	            0x0: 0x104,
	            0x100000: 0x0,
	            0x200000: 0x4000100,
	            0x300000: 0x10104,
	            0x400000: 0x10004,
	            0x500000: 0x4000004,
	            0x600000: 0x4010104,
	            0x700000: 0x4010000,
	            0x800000: 0x4000000,
	            0x900000: 0x4010100,
	            0xa00000: 0x10100,
	            0xb00000: 0x4010004,
	            0xc00000: 0x4000104,
	            0xd00000: 0x10000,
	            0xe00000: 0x4,
	            0xf00000: 0x100,
	            0x80000: 0x4010100,
	            0x180000: 0x4010004,
	            0x280000: 0x0,
	            0x380000: 0x4000100,
	            0x480000: 0x4000004,
	            0x580000: 0x10000,
	            0x680000: 0x10004,
	            0x780000: 0x104,
	            0x880000: 0x4,
	            0x980000: 0x100,
	            0xa80000: 0x4010000,
	            0xb80000: 0x10104,
	            0xc80000: 0x10100,
	            0xd80000: 0x4000104,
	            0xe80000: 0x4010104,
	            0xf80000: 0x4000000,
	            0x1000000: 0x4010100,
	            0x1100000: 0x10004,
	            0x1200000: 0x10000,
	            0x1300000: 0x4000100,
	            0x1400000: 0x100,
	            0x1500000: 0x4010104,
	            0x1600000: 0x4000004,
	            0x1700000: 0x0,
	            0x1800000: 0x4000104,
	            0x1900000: 0x4000000,
	            0x1a00000: 0x4,
	            0x1b00000: 0x10100,
	            0x1c00000: 0x4010000,
	            0x1d00000: 0x104,
	            0x1e00000: 0x10104,
	            0x1f00000: 0x4010004,
	            0x1080000: 0x4000000,
	            0x1180000: 0x104,
	            0x1280000: 0x4010100,
	            0x1380000: 0x0,
	            0x1480000: 0x10004,
	            0x1580000: 0x4000100,
	            0x1680000: 0x100,
	            0x1780000: 0x4010004,
	            0x1880000: 0x10000,
	            0x1980000: 0x4010104,
	            0x1a80000: 0x10104,
	            0x1b80000: 0x4000004,
	            0x1c80000: 0x4000104,
	            0x1d80000: 0x4010000,
	            0x1e80000: 0x4,
	            0x1f80000: 0x10100
	        },
	        {
	            0x0: 0x80401000,
	            0x10000: 0x80001040,
	            0x20000: 0x401040,
	            0x30000: 0x80400000,
	            0x40000: 0x0,
	            0x50000: 0x401000,
	            0x60000: 0x80000040,
	            0x70000: 0x400040,
	            0x80000: 0x80000000,
	            0x90000: 0x400000,
	            0xa0000: 0x40,
	            0xb0000: 0x80001000,
	            0xc0000: 0x80400040,
	            0xd0000: 0x1040,
	            0xe0000: 0x1000,
	            0xf0000: 0x80401040,
	            0x8000: 0x80001040,
	            0x18000: 0x40,
	            0x28000: 0x80400040,
	            0x38000: 0x80001000,
	            0x48000: 0x401000,
	            0x58000: 0x80401040,
	            0x68000: 0x0,
	            0x78000: 0x80400000,
	            0x88000: 0x1000,
	            0x98000: 0x80401000,
	            0xa8000: 0x400000,
	            0xb8000: 0x1040,
	            0xc8000: 0x80000000,
	            0xd8000: 0x400040,
	            0xe8000: 0x401040,
	            0xf8000: 0x80000040,
	            0x100000: 0x400040,
	            0x110000: 0x401000,
	            0x120000: 0x80000040,
	            0x130000: 0x0,
	            0x140000: 0x1040,
	            0x150000: 0x80400040,
	            0x160000: 0x80401000,
	            0x170000: 0x80001040,
	            0x180000: 0x80401040,
	            0x190000: 0x80000000,
	            0x1a0000: 0x80400000,
	            0x1b0000: 0x401040,
	            0x1c0000: 0x80001000,
	            0x1d0000: 0x400000,
	            0x1e0000: 0x40,
	            0x1f0000: 0x1000,
	            0x108000: 0x80400000,
	            0x118000: 0x80401040,
	            0x128000: 0x0,
	            0x138000: 0x401000,
	            0x148000: 0x400040,
	            0x158000: 0x80000000,
	            0x168000: 0x80001040,
	            0x178000: 0x40,
	            0x188000: 0x80000040,
	            0x198000: 0x1000,
	            0x1a8000: 0x80001000,
	            0x1b8000: 0x80400040,
	            0x1c8000: 0x1040,
	            0x1d8000: 0x80401000,
	            0x1e8000: 0x400000,
	            0x1f8000: 0x401040
	        },
	        {
	            0x0: 0x80,
	            0x1000: 0x1040000,
	            0x2000: 0x40000,
	            0x3000: 0x20000000,
	            0x4000: 0x20040080,
	            0x5000: 0x1000080,
	            0x6000: 0x21000080,
	            0x7000: 0x40080,
	            0x8000: 0x1000000,
	            0x9000: 0x20040000,
	            0xa000: 0x20000080,
	            0xb000: 0x21040080,
	            0xc000: 0x21040000,
	            0xd000: 0x0,
	            0xe000: 0x1040080,
	            0xf000: 0x21000000,
	            0x800: 0x1040080,
	            0x1800: 0x21000080,
	            0x2800: 0x80,
	            0x3800: 0x1040000,
	            0x4800: 0x40000,
	            0x5800: 0x20040080,
	            0x6800: 0x21040000,
	            0x7800: 0x20000000,
	            0x8800: 0x20040000,
	            0x9800: 0x0,
	            0xa800: 0x21040080,
	            0xb800: 0x1000080,
	            0xc800: 0x20000080,
	            0xd800: 0x21000000,
	            0xe800: 0x1000000,
	            0xf800: 0x40080,
	            0x10000: 0x40000,
	            0x11000: 0x80,
	            0x12000: 0x20000000,
	            0x13000: 0x21000080,
	            0x14000: 0x1000080,
	            0x15000: 0x21040000,
	            0x16000: 0x20040080,
	            0x17000: 0x1000000,
	            0x18000: 0x21040080,
	            0x19000: 0x21000000,
	            0x1a000: 0x1040000,
	            0x1b000: 0x20040000,
	            0x1c000: 0x40080,
	            0x1d000: 0x20000080,
	            0x1e000: 0x0,
	            0x1f000: 0x1040080,
	            0x10800: 0x21000080,
	            0x11800: 0x1000000,
	            0x12800: 0x1040000,
	            0x13800: 0x20040080,
	            0x14800: 0x20000000,
	            0x15800: 0x1040080,
	            0x16800: 0x80,
	            0x17800: 0x21040000,
	            0x18800: 0x40080,
	            0x19800: 0x21040080,
	            0x1a800: 0x0,
	            0x1b800: 0x21000000,
	            0x1c800: 0x1000080,
	            0x1d800: 0x40000,
	            0x1e800: 0x20040000,
	            0x1f800: 0x20000080
	        },
	        {
	            0x0: 0x10000008,
	            0x100: 0x2000,
	            0x200: 0x10200000,
	            0x300: 0x10202008,
	            0x400: 0x10002000,
	            0x500: 0x200000,
	            0x600: 0x200008,
	            0x700: 0x10000000,
	            0x800: 0x0,
	            0x900: 0x10002008,
	            0xa00: 0x202000,
	            0xb00: 0x8,
	            0xc00: 0x10200008,
	            0xd00: 0x202008,
	            0xe00: 0x2008,
	            0xf00: 0x10202000,
	            0x80: 0x10200000,
	            0x180: 0x10202008,
	            0x280: 0x8,
	            0x380: 0x200000,
	            0x480: 0x202008,
	            0x580: 0x10000008,
	            0x680: 0x10002000,
	            0x780: 0x2008,
	            0x880: 0x200008,
	            0x980: 0x2000,
	            0xa80: 0x10002008,
	            0xb80: 0x10200008,
	            0xc80: 0x0,
	            0xd80: 0x10202000,
	            0xe80: 0x202000,
	            0xf80: 0x10000000,
	            0x1000: 0x10002000,
	            0x1100: 0x10200008,
	            0x1200: 0x10202008,
	            0x1300: 0x2008,
	            0x1400: 0x200000,
	            0x1500: 0x10000000,
	            0x1600: 0x10000008,
	            0x1700: 0x202000,
	            0x1800: 0x202008,
	            0x1900: 0x0,
	            0x1a00: 0x8,
	            0x1b00: 0x10200000,
	            0x1c00: 0x2000,
	            0x1d00: 0x10002008,
	            0x1e00: 0x10202000,
	            0x1f00: 0x200008,
	            0x1080: 0x8,
	            0x1180: 0x202000,
	            0x1280: 0x200000,
	            0x1380: 0x10000008,
	            0x1480: 0x10002000,
	            0x1580: 0x2008,
	            0x1680: 0x10202008,
	            0x1780: 0x10200000,
	            0x1880: 0x10202000,
	            0x1980: 0x10200008,
	            0x1a80: 0x2000,
	            0x1b80: 0x202008,
	            0x1c80: 0x200008,
	            0x1d80: 0x0,
	            0x1e80: 0x10000000,
	            0x1f80: 0x10002008
	        },
	        {
	            0x0: 0x100000,
	            0x10: 0x2000401,
	            0x20: 0x400,
	            0x30: 0x100401,
	            0x40: 0x2100401,
	            0x50: 0x0,
	            0x60: 0x1,
	            0x70: 0x2100001,
	            0x80: 0x2000400,
	            0x90: 0x100001,
	            0xa0: 0x2000001,
	            0xb0: 0x2100400,
	            0xc0: 0x2100000,
	            0xd0: 0x401,
	            0xe0: 0x100400,
	            0xf0: 0x2000000,
	            0x8: 0x2100001,
	            0x18: 0x0,
	            0x28: 0x2000401,
	            0x38: 0x2100400,
	            0x48: 0x100000,
	            0x58: 0x2000001,
	            0x68: 0x2000000,
	            0x78: 0x401,
	            0x88: 0x100401,
	            0x98: 0x2000400,
	            0xa8: 0x2100000,
	            0xb8: 0x100001,
	            0xc8: 0x400,
	            0xd8: 0x2100401,
	            0xe8: 0x1,
	            0xf8: 0x100400,
	            0x100: 0x2000000,
	            0x110: 0x100000,
	            0x120: 0x2000401,
	            0x130: 0x2100001,
	            0x140: 0x100001,
	            0x150: 0x2000400,
	            0x160: 0x2100400,
	            0x170: 0x100401,
	            0x180: 0x401,
	            0x190: 0x2100401,
	            0x1a0: 0x100400,
	            0x1b0: 0x1,
	            0x1c0: 0x0,
	            0x1d0: 0x2100000,
	            0x1e0: 0x2000001,
	            0x1f0: 0x400,
	            0x108: 0x100400,
	            0x118: 0x2000401,
	            0x128: 0x2100001,
	            0x138: 0x1,
	            0x148: 0x2000000,
	            0x158: 0x100000,
	            0x168: 0x401,
	            0x178: 0x2100400,
	            0x188: 0x2000001,
	            0x198: 0x2100000,
	            0x1a8: 0x0,
	            0x1b8: 0x2100401,
	            0x1c8: 0x100401,
	            0x1d8: 0x400,
	            0x1e8: 0x2000400,
	            0x1f8: 0x100001
	        },
	        {
	            0x0: 0x8000820,
	            0x1: 0x20000,
	            0x2: 0x8000000,
	            0x3: 0x20,
	            0x4: 0x20020,
	            0x5: 0x8020820,
	            0x6: 0x8020800,
	            0x7: 0x800,
	            0x8: 0x8020000,
	            0x9: 0x8000800,
	            0xa: 0x20800,
	            0xb: 0x8020020,
	            0xc: 0x820,
	            0xd: 0x0,
	            0xe: 0x8000020,
	            0xf: 0x20820,
	            0x80000000: 0x800,
	            0x80000001: 0x8020820,
	            0x80000002: 0x8000820,
	            0x80000003: 0x8000000,
	            0x80000004: 0x8020000,
	            0x80000005: 0x20800,
	            0x80000006: 0x20820,
	            0x80000007: 0x20,
	            0x80000008: 0x8000020,
	            0x80000009: 0x820,
	            0x8000000a: 0x20020,
	            0x8000000b: 0x8020800,
	            0x8000000c: 0x0,
	            0x8000000d: 0x8020020,
	            0x8000000e: 0x8000800,
	            0x8000000f: 0x20000,
	            0x10: 0x20820,
	            0x11: 0x8020800,
	            0x12: 0x20,
	            0x13: 0x800,
	            0x14: 0x8000800,
	            0x15: 0x8000020,
	            0x16: 0x8020020,
	            0x17: 0x20000,
	            0x18: 0x0,
	            0x19: 0x20020,
	            0x1a: 0x8020000,
	            0x1b: 0x8000820,
	            0x1c: 0x8020820,
	            0x1d: 0x20800,
	            0x1e: 0x820,
	            0x1f: 0x8000000,
	            0x80000010: 0x20000,
	            0x80000011: 0x800,
	            0x80000012: 0x8020020,
	            0x80000013: 0x20820,
	            0x80000014: 0x20,
	            0x80000015: 0x8020000,
	            0x80000016: 0x8000000,
	            0x80000017: 0x8000820,
	            0x80000018: 0x8020820,
	            0x80000019: 0x8000020,
	            0x8000001a: 0x8000800,
	            0x8000001b: 0x0,
	            0x8000001c: 0x20800,
	            0x8000001d: 0x820,
	            0x8000001e: 0x20020,
	            0x8000001f: 0x8020800
	        }
	    ];

	    // Masks that select the SBOX input
	    var SBOX_MASK = [
	        0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
	        0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
	    ];

	    /**
	     * DES block cipher algorithm.
	     */
	    var DES = C_algo.DES = BlockCipher.extend({
	        _doReset: function () {
	            // Shortcuts
	            var key = this._key;
	            var keyWords = key.words;

	            // Select 56 bits according to PC1
	            var keyBits = [];
	            for (var i = 0; i < 56; i++) {
	                var keyBitPos = PC1[i] - 1;
	                keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
	            }

	            // Assemble 16 subkeys
	            var subKeys = this._subKeys = [];
	            for (var nSubKey = 0; nSubKey < 16; nSubKey++) {
	                // Create subkey
	                var subKey = subKeys[nSubKey] = [];

	                // Shortcut
	                var bitShift = BIT_SHIFTS[nSubKey];

	                // Select 48 bits according to PC2
	                for (var i = 0; i < 24; i++) {
	                    // Select from the left 28 key bits
	                    subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);

	                    // Select from the right 28 key bits
	                    subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
	                }

	                // Since each subkey is applied to an expanded 32-bit input,
	                // the subkey can be broken into 8 values scaled to 32-bits,
	                // which allows the key to be used without expansion
	                subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
	                for (var i = 1; i < 7; i++) {
	                    subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
	                }
	                subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
	            }

	            // Compute inverse subkeys
	            var invSubKeys = this._invSubKeys = [];
	            for (var i = 0; i < 16; i++) {
	                invSubKeys[i] = subKeys[15 - i];
	            }
	        },

	        encryptBlock: function (M, offset) {
	            this._doCryptBlock(M, offset, this._subKeys);
	        },

	        decryptBlock: function (M, offset) {
	            this._doCryptBlock(M, offset, this._invSubKeys);
	        },

	        _doCryptBlock: function (M, offset, subKeys) {
	            // Get input
	            this._lBlock = M[offset];
	            this._rBlock = M[offset + 1];

	            // Initial permutation
	            exchangeLR.call(this, 4,  0x0f0f0f0f);
	            exchangeLR.call(this, 16, 0x0000ffff);
	            exchangeRL.call(this, 2,  0x33333333);
	            exchangeRL.call(this, 8,  0x00ff00ff);
	            exchangeLR.call(this, 1,  0x55555555);

	            // Rounds
	            for (var round = 0; round < 16; round++) {
	                // Shortcuts
	                var subKey = subKeys[round];
	                var lBlock = this._lBlock;
	                var rBlock = this._rBlock;

	                // Feistel function
	                var f = 0;
	                for (var i = 0; i < 8; i++) {
	                    f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0];
	                }
	                this._lBlock = rBlock;
	                this._rBlock = lBlock ^ f;
	            }

	            // Undo swap from last round
	            var t = this._lBlock;
	            this._lBlock = this._rBlock;
	            this._rBlock = t;

	            // Final permutation
	            exchangeLR.call(this, 1,  0x55555555);
	            exchangeRL.call(this, 8,  0x00ff00ff);
	            exchangeRL.call(this, 2,  0x33333333);
	            exchangeLR.call(this, 16, 0x0000ffff);
	            exchangeLR.call(this, 4,  0x0f0f0f0f);

	            // Set output
	            M[offset] = this._lBlock;
	            M[offset + 1] = this._rBlock;
	        },

	        keySize: 64/32,

	        ivSize: 64/32,

	        blockSize: 64/32
	    });

	    // Swap bits across the left and right words
	    function exchangeLR(offset, mask) {
	        var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
	        this._rBlock ^= t;
	        this._lBlock ^= t << offset;
	    }

	    function exchangeRL(offset, mask) {
	        var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
	        this._lBlock ^= t;
	        this._rBlock ^= t << offset;
	    }

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.DES.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.DES.decrypt(ciphertext, key, cfg);
	     */
	    C.DES = BlockCipher._createHelper(DES);

	    /**
	     * Triple-DES block cipher algorithm.
	     */
	    var TripleDES = C_algo.TripleDES = BlockCipher.extend({
	        _doReset: function () {
	            // Shortcuts
	            var key = this._key;
	            var keyWords = key.words;
	            // Make sure the key length is valid (64, 128 or >= 192 bit)
	            if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
	                throw new Error('Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.');
	            }

	            // Extend the key according to the keying options defined in 3DES standard
	            var key1 = keyWords.slice(0, 2);
	            var key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
	            var key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);

	            // Create DES instances
	            this._des1 = DES.createEncryptor(WordArray.create(key1));
	            this._des2 = DES.createEncryptor(WordArray.create(key2));
	            this._des3 = DES.createEncryptor(WordArray.create(key3));
	        },

	        encryptBlock: function (M, offset) {
	            this._des1.encryptBlock(M, offset);
	            this._des2.decryptBlock(M, offset);
	            this._des3.encryptBlock(M, offset);
	        },

	        decryptBlock: function (M, offset) {
	            this._des3.decryptBlock(M, offset);
	            this._des2.encryptBlock(M, offset);
	            this._des1.decryptBlock(M, offset);
	        },

	        keySize: 192/32,

	        ivSize: 64/32,

	        blockSize: 64/32
	    });

	    /**
	     * Shortcut functions to the cipher's object interface.
	     *
	     * @example
	     *
	     *     var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg);
	     *     var plaintext  = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg);
	     */
	    C.TripleDES = BlockCipher._createHelper(TripleDES);
	}());


	return CryptoJS.TripleDES;

}));

/***/ }),

/***/ "./node_modules/crypto-js/x64-core.js":
/*!********************************************!*\
  !*** ./node_modules/crypto-js/x64-core.js ***!
  \********************************************/
/***/ (function(module, exports, __webpack_require__) {

;(function (root, factory) {
	if (true) {
		// CommonJS
		module.exports = exports = factory(__webpack_require__(/*! ./core */ "./node_modules/crypto-js/core.js"));
	}
	else {}
}(this, function (CryptoJS) {

	(function (undefined) {
	    // Shortcuts
	    var C = CryptoJS;
	    var C_lib = C.lib;
	    var Base = C_lib.Base;
	    var X32WordArray = C_lib.WordArray;

	    /**
	     * x64 namespace.
	     */
	    var C_x64 = C.x64 = {};

	    /**
	     * A 64-bit word.
	     */
	    var X64Word = C_x64.Word = Base.extend({
	        /**
	         * Initializes a newly created 64-bit word.
	         *
	         * @param {number} high The high 32 bits.
	         * @param {number} low The low 32 bits.
	         *
	         * @example
	         *
	         *     var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);
	         */
	        init: function (high, low) {
	            this.high = high;
	            this.low = low;
	        }

	        /**
	         * Bitwise NOTs this word.
	         *
	         * @return {X64Word} A new x64-Word object after negating.
	         *
	         * @example
	         *
	         *     var negated = x64Word.not();
	         */
	        // not: function () {
	            // var high = ~this.high;
	            // var low = ~this.low;

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Bitwise ANDs this word with the passed word.
	         *
	         * @param {X64Word} word The x64-Word to AND with this word.
	         *
	         * @return {X64Word} A new x64-Word object after ANDing.
	         *
	         * @example
	         *
	         *     var anded = x64Word.and(anotherX64Word);
	         */
	        // and: function (word) {
	            // var high = this.high & word.high;
	            // var low = this.low & word.low;

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Bitwise ORs this word with the passed word.
	         *
	         * @param {X64Word} word The x64-Word to OR with this word.
	         *
	         * @return {X64Word} A new x64-Word object after ORing.
	         *
	         * @example
	         *
	         *     var ored = x64Word.or(anotherX64Word);
	         */
	        // or: function (word) {
	            // var high = this.high | word.high;
	            // var low = this.low | word.low;

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Bitwise XORs this word with the passed word.
	         *
	         * @param {X64Word} word The x64-Word to XOR with this word.
	         *
	         * @return {X64Word} A new x64-Word object after XORing.
	         *
	         * @example
	         *
	         *     var xored = x64Word.xor(anotherX64Word);
	         */
	        // xor: function (word) {
	            // var high = this.high ^ word.high;
	            // var low = this.low ^ word.low;

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Shifts this word n bits to the left.
	         *
	         * @param {number} n The number of bits to shift.
	         *
	         * @return {X64Word} A new x64-Word object after shifting.
	         *
	         * @example
	         *
	         *     var shifted = x64Word.shiftL(25);
	         */
	        // shiftL: function (n) {
	            // if (n < 32) {
	                // var high = (this.high << n) | (this.low >>> (32 - n));
	                // var low = this.low << n;
	            // } else {
	                // var high = this.low << (n - 32);
	                // var low = 0;
	            // }

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Shifts this word n bits to the right.
	         *
	         * @param {number} n The number of bits to shift.
	         *
	         * @return {X64Word} A new x64-Word object after shifting.
	         *
	         * @example
	         *
	         *     var shifted = x64Word.shiftR(7);
	         */
	        // shiftR: function (n) {
	            // if (n < 32) {
	                // var low = (this.low >>> n) | (this.high << (32 - n));
	                // var high = this.high >>> n;
	            // } else {
	                // var low = this.high >>> (n - 32);
	                // var high = 0;
	            // }

	            // return X64Word.create(high, low);
	        // },

	        /**
	         * Rotates this word n bits to the left.
	         *
	         * @param {number} n The number of bits to rotate.
	         *
	         * @return {X64Word} A new x64-Word object after rotating.
	         *
	         * @example
	         *
	         *     var rotated = x64Word.rotL(25);
	         */
	        // rotL: function (n) {
	            // return this.shiftL(n).or(this.shiftR(64 - n));
	        // },

	        /**
	         * Rotates this word n bits to the right.
	         *
	         * @param {number} n The number of bits to rotate.
	         *
	         * @return {X64Word} A new x64-Word object after rotating.
	         *
	         * @example
	         *
	         *     var rotated = x64Word.rotR(7);
	         */
	        // rotR: function (n) {
	            // return this.shiftR(n).or(this.shiftL(64 - n));
	        // },

	        /**
	         * Adds this word with the passed word.
	         *
	         * @param {X64Word} word The x64-Word to add with this word.
	         *
	         * @return {X64Word} A new x64-Word object after adding.
	         *
	         * @example
	         *
	         *     var added = x64Word.add(anotherX64Word);
	         */
	        // add: function (word) {
	            // var low = (this.low + word.low) | 0;
	            // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;
	            // var high = (this.high + word.high + carry) | 0;

	            // return X64Word.create(high, low);
	        // }
	    });

	    /**
	     * An array of 64-bit words.
	     *
	     * @property {Array} words The array of CryptoJS.x64.Word objects.
	     * @property {number} sigBytes The number of significant bytes in this word array.
	     */
	    var X64WordArray = C_x64.WordArray = Base.extend({
	        /**
	         * Initializes a newly created word array.
	         *
	         * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.
	         * @param {number} sigBytes (Optional) The number of significant bytes in the words.
	         *
	         * @example
	         *
	         *     var wordArray = CryptoJS.x64.WordArray.create();
	         *
	         *     var wordArray = CryptoJS.x64.WordArray.create([
	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
	         *     ]);
	         *
	         *     var wordArray = CryptoJS.x64.WordArray.create([
	         *         CryptoJS.x64.Word.create(0x00010203, 0x04050607),
	         *         CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)
	         *     ], 10);
	         */
	        init: function (words, sigBytes) {
	            words = this.words = words || [];

	            if (sigBytes != undefined) {
	                this.sigBytes = sigBytes;
	            } else {
	                this.sigBytes = words.length * 8;
	            }
	        },

	        /**
	         * Converts this 64-bit word array to a 32-bit word array.
	         *
	         * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.
	         *
	         * @example
	         *
	         *     var x32WordArray = x64WordArray.toX32();
	         */
	        toX32: function () {
	            // Shortcuts
	            var x64Words = this.words;
	            var x64WordsLength = x64Words.length;

	            // Convert
	            var x32Words = [];
	            for (var i = 0; i < x64WordsLength; i++) {
	                var x64Word = x64Words[i];
	                x32Words.push(x64Word.high);
	                x32Words.push(x64Word.low);
	            }

	            return X32WordArray.create(x32Words, this.sigBytes);
	        },

	        /**
	         * Creates a copy of this word array.
	         *
	         * @return {X64WordArray} The clone.
	         *
	         * @example
	         *
	         *     var clone = x64WordArray.clone();
	         */
	        clone: function () {
	            var clone = Base.clone.call(this);

	            // Clone "words" array
	            var words = clone.words = this.words.slice(0);

	            // Clone each X64Word object
	            var wordsLength = words.length;
	            for (var i = 0; i < wordsLength; i++) {
	                words[i] = words[i].clone();
	            }

	            return clone;
	        }
	    });
	}());


	return CryptoJS;

}));

/***/ }),

/***/ "./node_modules/node-gost-crypto/index.js":
/*!************************************************!*\
  !*** ./node_modules/node-gost-crypto/index.js ***!
  \************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

module.exports = __webpack_require__(/*! ./lib */ "./node_modules/node-gost-crypto/lib/index.js");


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostASN1.js":
/*!*******************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostASN1.js ***!
  \*******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file PKCS ASN.1 message syntax and converters
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this 
 *    list of conditions and the following disclaimer.
 *    
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");

    /*
     * Service functions
     * 
     */

    var root = __webpack_require__.g;
    var CryptoOperationData = root.ArrayBuffer;
    var Date = root.Date;

    // Security parameters
    var algorithms = gostCrypto.security.algorithms;

    var names = gostCrypto.security.names;

    var identifiers = gostCrypto.security.identifiers;

    var attributes = gostCrypto.security.attributes;

    var parameters = gostCrypto.security.parameters;

    // BER coding
    var BER = gostCrypto.coding.BER;

    // PEM coding
    var PEM = gostCrypto.coding.PEM;

    // Chars coding
    var Chars = gostCrypto.coding.Chars;

    // Hex coding;
    var Hex = gostCrypto.coding.Hex;

    // Hex coding;
    var Int16 = gostCrypto.coding.Int16;

    // Expand javascript object
    function expand() {
        var r = {};
        for (var i = 0, n = arguments.length; i < n; i++) {
            var item = arguments[i];
            if (typeof item === 'object')
                for (var name in item)
                    r[name] = item[name];
        }
        return r;
    }

    // Swap bytes in buffer
    function swapBytes(src) {
        if (src instanceof CryptoOperationData)
            src = new Uint8Array(src);
        var dst = new Uint8Array(src.length);
        for (var i = 0, n = src.length; i < n; i++)
            dst[n - i - 1] = src[i];
        return dst.buffer;
    }

    function isBinary(value) {
        return value instanceof CryptoOperationData || value.buffer instanceof CryptoOperationData;
    }

    // Left pad zero
    function lpad(n, width) {
        return n.length >= width ? n : new Array(width - n.length + 1).join('0') + n;
    }

    // Nearest power 2
    function npw2(n) {
        return n <= 2 ? n : n <= 4 ? 4 : n <= 8 ? 8 : n <= 16 ? 16 :
                n <= 32 ? 32 : n <= 64 ? 64 : n <= 128 ? 128 : n <= 256 ? 256 :
                n < 512 ? 512 : n < 1024 ? 1024 : undefined;
    }

    // String int encode/decode to buffer
    var SInt = {
        encode: function (value, endian) {
            return '0x' + Hex.encode(value, endian);
        },
        decode: function (value, endian, len) {
            if (typeof value === 'number')
                value = value.toString(16);
            var s = value.replace('0x', '');
            len = len || npw2(s.length);
            return Hex.decode(lpad(s, len), endian);
        }
    };

    // Assert invalid message
    function assert(value) {
        if (value)
            throw Error('Invalid format');
    }

    function defineProperty(object, name, descriptor, enumerable) {
        if (typeof descriptor !== 'object')
            descriptor = {value: descriptor};
        if (enumerable !== undefined)
            descriptor.enumerable = enumerable;
        Object.defineProperty(object, name, descriptor);
    }

    function defineProperties(object, properties, enumerable) {
        for (var name in properties)
            defineProperty(object, name, properties[name], enumerable);
    }

    function getOwnPropertyDescriptor(object, name) {
        return  Object.getOwnPropertyDescriptor(object, name);
    }



    /*
     * Base ASN.1 types and definitions
     * 
     */

    // Encode object primitive
    function encode(format, object, tagNumber, tagClass, tagConstructed, uniformTitle) {
        assert(object === undefined);
        var source = {
            tagNumber: tagNumber,
            tagClass: tagClass || 0x00,
            tagConstructed: tagConstructed || false,
            object: object
        };
        // Output format
        format = format || 'DER';
        if (format === 'DER' || format === 'CER')
            source = BER.encode(source, format);
        if (format === 'PEM')
            source = PEM.encode(source, uniformTitle);
        return source;
    }

    // Decode object primitive
    function decode(source, tagNumber, tagClass, tagConstructed, uniformTitle) {
        assert(source === undefined);

        // Decode PEM
        if (typeof source === 'string')
            source = PEM.decode(source, uniformTitle, false);
        // Decode binary data
        if (source instanceof CryptoOperationData) {
            try {
                source = PEM.decode(Chars.encode(source), uniformTitle, true);
            } catch (e) {
                source = BER.decode(source);
            }
        }

        tagClass = tagClass || 0;
        tagConstructed = tagConstructed || false;
        // Restore context implicit formats
        if (source.tagNumber === undefined) {
            source = encode(true, source.object, tagNumber, tagClass,
                    source.object instanceof Array);
            source = BER.decode(source);
        }

        // Check format
        assert(source.tagClass !== tagClass ||
                source.tagNumber !== tagNumber ||
                source.tagConstructed !== tagConstructed);
        // Clone value define from redefine original
        if (tagClass === 0 && tagNumber === 0x05)
            return null;
        else
            return source.object;
    }

    // Create class based on super
    function extend(Super, Class, propertiesObject, propertiesClass) {
        // If constructor not defined
        if (typeof Class !== 'function') {
            propertiesClass = propertiesObject;
            propertiesObject = Class;
            Class = function () {
                Super.apply(this, arguments);
            };
        }
        // Create prototype properties
        Class.prototype = Object.create(Super.prototype, {
            constructor: {
                value: Class
            },
            superclass: {
                value: Super.prototype
            }
        });
        if (propertiesObject)
            defineProperties(Class.prototype, propertiesObject);
        // Inherites super class properties
        if (Super !== Object)
            for (var name in Super)
                Class[name] = Super[name];
        Class.super = Super;
        if (propertiesClass)
            defineProperties(Class, propertiesClass, true);
        return Class;
    }

    // Base class 
    var ASN1Object = extend(Object, function (object) {
        this.object = object;
    }, {
        // Call set method for a class property
        _set: function (Class, propName, value) {
            Class.property(propName).set.call(this, value);
        },
        // Call get method for a class property
        _get: function (Class, propName) {
            return Class.property(propName).get.call(this);
        },
        // Call method for a class
        _call: function (Class, methodName, args) {
            return Class.method(methodName).apply(this, args);
        },
        hasProperty: function (propName) {
            return this.hasOwnProperty(propName) ||
                    !!this.constructor.property(propName);
        },
        encode: function () {
            return this.object;
        }
    }, {
        decode: function (source) {
            return new this(source);
        },
        // Find ingerited property
        property: function (propName) {
            var proto = this.prototype;
            while (proto) {
                var descriptor = getOwnPropertyDescriptor(proto, propName);
                if (descriptor)
                    return descriptor;
                else
                    proto = proto.superclass;
            }
        },
        // Find method 
        method: function (methodName) {
            var proto = this.prototype;
            while (proto) {
                if (proto[methodName])
                    return proto[methodName];
                else
                    proto = proto.superclass;
            }
        }
    });

    // Primitive metaclass
    var PRIMITIVE = function (tagNumber) {
        return extend(ASN1Object, {
            encode: function (format) {
                return encode(format, this.object, tagNumber);
            }
        }, {
            decode: function (source) {
                return new this(decode(source, tagNumber));
            }
        });
    };

    var ANY = ASN1Object;

    var BOOLEAN = PRIMITIVE(0x01);

    var IA5String = PRIMITIVE(0x16);

    var NumericString = PRIMITIVE(0x12);

    var PrintableString = PRIMITIVE(0x13);

    var TeletexString = PRIMITIVE(0x14);

    var UTF8String = PRIMITIVE(0x0c);

    var UTCTime = PRIMITIVE(0x17);

    var GeneralizedTime = PRIMITIVE(0x18);

    var UniversalString = PRIMITIVE(0x1C);

    var BMPString = PRIMITIVE(0x1e);

    var NULL = extend(PRIMITIVE(0x05), {
        object: {
            get: function () {
                return null;
            },
            set: function (object) {
                assert(object !== null);
            }
        }
    });

// Primitive class with value coding
    var PRIMITIVE_CODE = function (tagNumber) {

        // Base class primitive
        var Class = extend(PRIMITIVE(tagNumber), function (object) {
            if (this instanceof Class)
                Class.super.apply(this, arguments);
            else
                return CODE(object);
        });

        // Create Class with encoded
        function CODE(structure) {
            // Structured class
            return extend(PRIMITIVE(tagNumber), function (object) {
                Class.super.call(this, object);
            }, {
                // Transformation to code values
                encode: function (format) {
                    return encode(format, structure[this.object], tagNumber);
                }
            }, {
                decode: function (source) {
                    var id = decode(source, tagNumber);
                    for (var name in structure)
                        if (id === structure[name])
                            return new this(name);
                    assert(true);
                }
            });
        }
        return Class;
    };

    var INTEGER = PRIMITIVE_CODE(0x02);

    var ENUMERATED = PRIMITIVE_CODE(0x0a);

    var OCTET_STRING = (function () {
        // Base class primitive
        var Class = extend(PRIMITIVE(0x04), function (object) {
            if (this instanceof Class)
                Class.super.apply(this, arguments);
            else
                return WRAPPING(object);
        });
        // Wrapping class
        function WRAPPING(WrappedClass) {
            if (WrappedClass) {
                return extend(WrappedClass, {
                    encode: function (format) {
                        return encode(format, WrappedClass.method('encode').call(this, true), 0x04);
                    }
                }, {
                    decode: function (source) {
                        return WrappedClass.decode.call(this, decode(source, 0x04));
                    }
                });
            } else
                return Class;
        }
        return Class;
    })();

    var BIT_STRING = (function () {
        // Base class primitive
        var Class = extend(PRIMITIVE(0x03), function (object) {
            if (this instanceof Class)
                Class.super.apply(this, arguments);
            else if (typeof object === 'object')
                return MASK(object);
            else
                return WRAPPING(object);
        });

        // Wrapping class
        function WRAPPING(WrappedClass) {
            if (WrappedClass) {
                return extend(WrappedClass, {
                    encode: function (format) {
                        return encode(format, WrappedClass.method('encode').call(this, true), 0x03);
                    }
                }, {
                    decode: function (source) {
                        return WrappedClass.decode.call(this, decode(source, 0x03));
                    }
                });
            } else
                return Class;
        }

        // Create new class for a mask
        function MASK(structure) {
            // Bit string masked class
            return extend(ASN1Object, function (object, numbits) {
                ASN1Object.call(this, object);
                this.numbits = numbits || 0;
            }, {
                encode: function (format) {
                    var object = this.object, data = [];
                    if (object instanceof Array) {
                        for (var i = 0, n = object.length; i < n; i++) {
                            var j = structure[object[i]];
                            if (j !== undefined)
                                data[j] = '1';
                        }
                        for (var i = 0, n = Math.max(data.length, this.numbits); i < n; i++)
                            if (!data[i])
                                data[i] = '0';
                        data = data.join('');
                    } else
                        data = '0';
                    return encode(format, data, 0x03);
                }
            }, {
                // Transformation to array of values
                decode: function (source) {
                    var data = decode(source, 0x03), object = [];
                    for (var name in structure) {
                        var i = structure[name];
                        if (data.charAt(i) === '1')
                            object.push(name);
                    }
                    return new this(object, data.length);
                }
            });
        }

        return Class;
    })();

    // Combine sequence object properties with owner object
    var COMBINE = function (Class) {
        Class.combine = function (owner, valueName) {
            for (var name in Class.prototype) {
                if (Class.prototype.hasOwnProperty(name) && !owner.hasProperty(name)) {
                    defineProperty(owner, name, (function (name) {
                        return {
                            get: function () {
                                // Get object property
                                return this[valueName] && this[valueName][name];
                            },
                            set: function (object) {
                                // Set object property
                                if (!this[valueName])
                                    this[valueName] = {};
                                this[valueName][name] = object;
                            },
                            configurable: false,
                            enumerable: true
                        };
                    })(name));
                }
            }
        };
        return Class;
    };

    var SEQUENCE = function (structure, uniformTitle) {

        /**
         * Create SEQUENCE ASN.1 metaclass
         * 
         * @class GostASN1.Sequence
         * @param {(Object|FormatedData)} object Initialization object
         * @param {boolean} check Check structure after initialization
         */
        var Class = extend(ASN1Object, function (object, check) {
            // Define hidden properties
            defineProperty(this, 'items', {
                writable: true,
                value: {}
            });
            if (typeof object === 'string' || object instanceof CryptoOperationData)
                this.decode(object);
            else if (object !== undefined) {
                this.object = object;
                // Check structure
                if (check)
                    this.check();
            }
        }, {
            object: {
                get: function () {
                    return this;
                },
                set: function (object) {
                    if (object instanceof Class) {
                        // Set the same sequence class
                        this.items = object.items;
                        for (var name in structure) {
                            var ItemClass = this.getItemClass(name, this.items);
                            if (ItemClass.combine)
                                ItemClass.combine(this, name);
                        }
                    } else {
                        // Set other object structure
                        var data = {};
                        for (var name in structure) {
                            var item = object[name];
                            var ItemClass = this.getItemClass(name, data);
                            if (item !== undefined) {
                                data[name] = new ItemClass(item);
                            } else if (ItemClass.combine) {
                                // Create combined object
                                data[name] = new ItemClass(object);
                            }
                            if (ItemClass.combine)
                                ItemClass.combine(this, name);
                        }
                        this.items = data;
                    }
                }
            },
            getItemClass: function (name, items) {
                return structure[name];
            },
            /**
             * Encode the object
             * 
             * @memberOf GostASN1.Sequence
             * @instance
             * @param {string} format Encoding format 'DER', 'CER' or 'PEM'
             * @returns {FormatedData} 
             */
            encode: function (format) {
                var source = [], items = this.items;
                // Encode objects in structure
                for (var name in structure) {
                    // console.log(name, 'encoding...', items[name]);
                    if (items[name]) {
                        var encoded = items[name].encode(true);// Source from object
                        if (encoded !== undefined) // Can be optional
                            source.push(encoded);

                    }
                }
                return encode(format, source, 0x10, 0, true, uniformTitle);
            },
            /**
             * Decode the source to self object
             * 
             * @memberOf GostASN1.Sequence
             * @instance
             * @param {FormatedData} source Encoded data
             */
            decode: function (source) {
                this.object = this.constructor.decode(source);
            },
            /**
             * Check the object structure
             * 
             * @memberOf GostASN1.Sequence
             * @instance
             */
            check: function () {
                this.constructor.decode(this.encode(true));
            }
        }, {
            /**
             * Encode data values with creating object
             * 
             * @memberOf GostASN1.Sequence
             * @static
             * @param {Object} object Javascript object to encoding
             * @param {string} format Encoding format 'DER', 'CER' or 'PEM'
             * @returns {FormatedData} 
             */
            encode: function (object, format) {
                return new this(object).encode(format);
            },
            /**
             * Decode source and create object
             * 
             * @memberOf GostASN1.Sequence
             * @static
             * @param {FormatedData} source Encoded data
             * @returns {GostASN1.Sequence}
             * 
             */
            decode: function (source) {
                // Decode structure
                source = decode(source, 0x10, 0, true, uniformTitle);
                var i = 0, result = new this(), data = result.items = {};
                for (var name in structure) {
                    // console.log(name, 'decoding...');
                    // try to create and decode object
                    var ItemClass = result.getItemClass(name, data);
                    var item = ItemClass.decode(source[i]);
                    // success? item can be optional
                    if (item !== undefined) {
                        data[name] = item;
                        if (ItemClass.combine)
                            ItemClass.combine(result, name);
                        i++;
                    }
                }
                return result;
            }
        });

        // Append structure items
        for (var name in structure) {
            defineProperty(Class.prototype, name, (function (name) {
                return {
                    get: function () {
                        // Get object property
                        return this.items[name] && this.items[name].object;
                    },
                    set: function (object) {
                        // Set object property
                        if (object !== undefined) {
                            var ItemClass = this.getItemClass(name, this.items);
                            this.items[name] = new ItemClass(object);
                        } else
                            delete this.items[name];
                    },
                    configurable: false,
                    enumerable: !structure[name].combine
                };
            })(name));
            if (structure[name].combine)
                structure[name].combine(Class.prototype, name);
        }
        return Class;
    };

    var ATTRIBUTE = function (structure, typeName, valueName, ownerDafaultType, uniformName) {

        var BaseClass = SEQUENCE(structure, uniformName);

        // Define attribute sequence
        var DEFINE = function (typeSet, defaultType) {

            typeName = typeName || 'type';
            valueName = valueName || 'value';
            defaultType = defaultType || ownerDafaultType || ANY;

            var Class = extend(BaseClass, function (object) {
                // Constructor - "matrioshka"
                if (this instanceof Class) {
                    // Call super
                    BaseClass.apply(this, arguments);
                } else
                    return DEFINE.apply(this, arguments);
            }, {
                getItemClass: function (name, items) {
                    var ItemClass = structure[name];
                    if (valueName === name) {
                        // Define type of value attribute based on type attribute
                        var type, typeId = items && items[typeName];
                        if (typeId) {
                            var id = typeId.object;
                            if (typeSet) {
                                if (typeof typeSet === 'function')
                                    type = typeSet(id);
                                else
                                    type = typeSet[id];
                            }
                        }
                        type = type || defaultType || ANY;
                        ItemClass = ItemClass === ANY ? type :
                                ItemClass(type);
                    }
                    return ItemClass;
                }
            });

            // Redefine type property
            defineProperty(Class.prototype, typeName, {
                get: function () {
                    // Get value property of object
                    return this.items[typeName] && this.items[typeName].object;
                },
                set: function () {
                    // Can't set type definition property separatery
                    assert(true);
                },
                configurable: false,
                enumerable: true
            });

            return Class;
        };

        return DEFINE();
    };


    var OBJECT_IDENTIFIER = extend(ASN1Object, {
        encode: function (format) {
            var object = this.object;
            object = /^(\d+\.)+\d+$/.test(object) ? object : identifiers[object];
            assert(!object);
            return encode(format, object, 0x06);
        }
    }, {
        decode: function (source) {
            var object = decode(source, 0x06);
            return new this(names[object] || object);
        }
    });

    var IMPLICIT = function (Class) {
        Class = Class || ANY;
        // Add constracted tag
        return extend(Class, {
            encode: function (format) {
                // Format encoding without CTX header
                var source = Class.method('encode').call(this, format);
                if (typeof source === 'string' || source instanceof CryptoOperationData)
                    return source;
                if (source.tagNumber !== 0x04 && source.tagClass === 0 &&
                        !(source.object instanceof Array))
                    // Encode primitive source
                    return {object: BER.encode(source, 'DER', true)};
                else
                    return {object: source.object};
            }
        }, {
            decode: function (source) {
                if (typeof source === 'string' || source instanceof CryptoOperationData) {
                    return Class.decode.call(this, source);
                } else {
                    source = {
                        object: source.object,
                        header: source.header,
                        content: source.content
                    };
                    return Class.decode.call(this, source);
                }
            }
        });
    };

    var EXPLICIT = function (Class) {
        Class = Class || ANY;
        // Add constracted tag
        return extend(Class, {
            encode: function (format) {
                // Format encoding without CTX header
                var source = Class.method('encode').call(this, format);
                if (typeof source === 'string' || source instanceof CryptoOperationData)
                    return source;
                return {object: [source]};
            }
        }, {
            decode: function (source) {
                if (typeof source === 'string' || source instanceof CryptoOperationData) {
                    return Class.decode.call(this, source);
                } else
                    return Class.decode.call(this, source.object[0]);
            }
        });
    };

    var CTX = function (number, ContentClass) {
        function CTX() {
            ContentClass.apply(this, arguments);
        }
        // Create CTX number class with wrapped content class
        return extend(ContentClass, CTX, {
            encode: function (format) {
                var source = ContentClass.method('encode').call(this, format);
                if (typeof source === 'string' || source instanceof CryptoOperationData)
                    return source;
                source.tagNumber = number;
                source.tagClass = 0x02;
                source.tagConstructed = source.object instanceof Array;
                return source;
            }
        }, {
            decode: function (source) {
                // Format decoding without CTX
                assert(source.tagNumber !== undefined &&
                        (source.tagClass !== 0x02 || source.tagNumber !== number));
                return ContentClass.decode.call(this, source);
            }
        });
    };

    var ARRAY_OF = function (tagNumber) {

        return function (ItemClassDef, typeAndValue) {
            // Difininition of item class
            ItemClassDef = ItemClassDef || ANY;

            // Metaclass definition 
            var DEFINE = function (typeSet, defaultType) {

                // Define item class
                var ItemClass = typeof ItemClassDef === 'function' &&
                        typeSet !== undefined ?
                        ItemClassDef(typeSet, defaultType) : ItemClassDef;

                if (typeAndValue) {
                    /**
                     * Create class with type and value structure<br><br>
                     * 
                     * SET OF attribute and SEQUENCE OF attribute metaclass
                     * 
                     * @class GostASN1.Set
                     * @param {Object} object object value
                     */
                    var Class = extend(ASN1Object, function (object) {
                        // Constructor - "matrioshka"
                        if (this instanceof Class) {
                            // Define hidden items property
                            defineProperty(this, 'items', {
                                writable: true,
                                value: {}
                            });
                            // Call super
                            ASN1Object.call(this, object || {});
                        } else
                            return DEFINE.apply(this, arguments);
                    }, {
                        object: {
                            get: function () {
                                // refresh items from object properties
                                this.read();
                                return this;
                            },
                            set: function (object) {
                                if (object instanceof Class) {
                                    object.read();
                                    this.items = object.items;
                                } else {
                                    // Set other object structure
                                    var data = {};
                                    for (var id in object) {
                                        var item = object[id];
                                        data[id] = this.createItem(item, id);
                                    }
                                    this.items = data;
                                }
                                // refresh object properties to items
                                this.reset();
                            }
                        },
                        createItem: function (value, type) {
                            if (typeAndValue) {
                                var object = {};
                                object[typeAndValue.typeName] = type;
                                object[typeAndValue.valueName] = value;
                            } else
                                object = value;
                            return new ItemClass(object);
                        },
                        getItemValue: function (id) {
                            var item = this.items[id];
                            return typeAndValue ? item.object[typeAndValue.valueName] : item.object;
                        },
                        setItemValue: function (id, value) {
                            var item = this.items[id];
                            if (typeAndValue)
                                item.object[typeAndValue.valueName] = value;
                            else
                                item.object = value;
                        },
                        isItemType: function (id) {
                            return typeAndValue ? identifiers[id] : !isNaN(parseInt(id));
                        },
                        reset: function () {
                            // remove unused properties
                            var items = this.items;
                            for (var id in this)
                                if (this.hasOwnProperty(id) && !this.items[id] &&
                                        this.isItemType(id))
                                    delete this[id];
                            // add new properties
                            for (var id in items)
                                this[id] = this.getItemValue(id);
                        },
                        read: function () {
                            var items = this.items;
                            for (var id in this) {
                                if (this.isItemType(id)) {
                                    if (!this.items[id]) {
                                        items[id] = this.createItem(this[id], id);
                                        this[id] = this.getItemValue(id);
                                    } else if (this.getItemValue(id) !== this[id]) {
                                        this.setItemValue(id, this[id]);
                                    }
                                }
                            }
                        },
                        /**
                         * Encode the object
                         * 
                         * @memberOf GostASN1.Set
                         * @instance
                         * @param {string} format Encoding format 'DER', 'CER' or 'PEM'
                         * @returns {FormatedData} 
                         */
                        encode: function (format) {
                            // refresh items from object properties
                            this.read();
                            // repare source
                            var object = this.items, source = [];
                            for (var id in object) {
                                // console.log(id, object[id], 'encoding...');
                                var encoded = object[id].encode(true);
                                if (encoded !== undefined)
                                    source.push(encoded);
                            }
                            return encode(format, source, tagNumber, 0, true);
                        },
                        /**
                         * Decode the source to self object
                         * 
                         * @memberOf GostASN1.Set
                         * @instance
                         * @param {FormatedData} source Encoded data
                         */
                        decode: function (source) {
                            this.object = this.constructor.decode(source);
                        },
                        /**
                         * Check the object structure
                         * 
                         * @memberOf GostASN1.Set
                         * @instance
                         */
                        check: function () {
                            this.constructor.decode(this.encode(true));
                        }
                    }, {
                        /**
                         * Encode data values with creating object
                         * 
                         * @memberOf GostASN1.Set
                         * @static
                         * @param {Object} object Javascript object to encoding
                         * @param {string} format Encoding format 'DER', 'CER' or 'PEM'
                         * @returns {FormatedData} 
                         */
                        encode: function (object, format) {
                            return new this(object).encode(format);
                        },
                        /**
                         * Decode source and create object
                         * 
                         * @memberOf GostASN1.Set
                         * @static
                         * @param {FormatedData} source Encoded data
                         * @returns {GostASN1.Sequence}
                         * 
                         */
                        decode: function (source) {
                            // Decode structure
                            source = decode(source, tagNumber, 0, true);
                            var result = new this(), data = result.items = {};
                            for (var i = 0, n = source.length; i < n; i++) {
                                var item = ItemClass.decode(source[i]);
                                var id = typeAndValue ? item.object[typeAndValue.typeName] : i;
                                data[id] = item;
                            }
                            result.reset();
                            return result;
                        }
                    });

                    return Class;
                } else {
                    // Create array class
                    var ArrayClass = extend(ASN1Object, function (object) {
                        // Constructor - "matrioshka"
                        if (this instanceof ArrayClass) {
                            // Define hidden items property
                            defineProperties(this, {
                                items: {
                                    writable: true,
                                    value: []
                                },
                                values: {
                                    writable: true,
                                    value: []
                                }
                            });
                            // Call super
                            ASN1Object.call(this, object || []);
                        } else
                            return DEFINE.apply(this, arguments);
                    }, {
                        object: {
                            get: function () {
                                // refresh items from object properties
                                this.read();
                                return this.values;
                            },
                            set: function (object) {
                                if (object instanceof ArrayClass) {
                                    object.read();
                                    this.items = object.items;
                                } else {
                                    // Set other object structure
                                    var data = [];
                                    for (var i = 0, n = object.length; i < n; i++)
                                        data[i] = new ItemClass(object[i]);
                                    this.items = data;
                                }
                                // refresh object properties to items
                                this.reset();
                            }
                        },
                        encode: function (format) {
                            // refresh items from object properties
                            this.read();
                            // repare source
                            var data = this.items, source = [];
                            for (var i = 0, n = data.length; i < n; i++) {
                                var encoded = data[i].encode(true);
                                if (encoded !== undefined)
                                    source.push(encoded);
                            }
                            return encode(format, source, tagNumber, 0, true);
                        },
                        decode: function (source) {
                            this.object = this.constructor.decode(source);
                        },
                        check: function () {
                            this.constructor.decode(this.encode(true));
                        },
                        reset: function () {
                            // remove unused properties
                            for (var i = 0, n = this.items.length; i < n; i++)
                                this.values.push(this.items[i].object);
                        },
                        read: function () {
                            var items = this.items, values = this.values;
                            for (var i = 0, n = values.length; i < n; i++) {
                                if (!this.items[i]) {
                                    items[i] = new ItemClass(values[i]);
                                    values[i] = items[i].object;
                                } else if (items[i].object !== values[i])
                                    items[i].object = values[i];
                            }
                        }
                    }, {
                        encode: function (object, format) {
                            return new this(object).encode(format);
                        },
                        decode: function (source) {
                            source = decode(source, tagNumber, 0, true);
                            var result = new this();
                            result.items = [];
                            for (var i = 0, n = source.length; i < n; i++)
                                result.items.push(ItemClass.decode(source[i]));
                            result.reset();
                            return result;
                        }
                    });

                    return ArrayClass;
                }
            };
            return DEFINE(); // Create simple class w/o any parameters
        };
    };

    var SEQUENCE_OF = ARRAY_OF(0x10);

    var SET_OF = ARRAY_OF(0x11);

    var ENCLOSURE = function (BaseClass, modifier) {
        if (modifier) {
            var Class = extend(ASN1Object, {
                object: {
                    get: function () {
                        if (this.item)
                            return modifier.decode(this.item.object);
                        else
                            return undefined;
                    },
                    set: function (object) {
                        if (object !== undefined)
                            this.item = new BaseClass(modifier.encode(object));
                        else
                            delete this.item;
                    }
                },
                encode: function (format) {
                    return this.item.encode(format);
                }
            }, {
                decode: function (source) {
                    var result = new this();
                    result.item = BaseClass.decode(source);
                    return result;
                }
            });
            for (var name in BaseClass)
                if (!Class[name])
                    Class[name] = BaseClass[name];
            return Class;
        } else
            return BaseClass;
    };

    var SET_OF_SINGLE = function (ItemClass) {

        var Class = ENCLOSURE(SET_OF(ItemClass), {
            encode: function (item) {
                return [item];
            },
            decode: function (item) {
                return item[0];
            }
        });
        return Class;
    };

    var CHOICE = function (structure, define) {

        return extend(ASN1Object, {
            object: {
                get: function () {
                    return this.item && this.item.object;
                },
                set: function (object) {
                    // Try to find appropriate type in structure
                    if (object instanceof ASN1Object) {
                        for (var name in structure)
                            if (object instanceof structure[name]) {
                                this.item = object;
                                return;
                            }
                    }
                    // Define class
                    var name = typeof define === 'function' ? define(object) : define;
                    assert(!name || !structure[name]);
                    object = new structure[name](object);
                    this.item = object;
                }
            },
            encode: function (format) {
                // Already in class
                return this.item.encode(format);
            }
        }, {
            decode: function (source) {
                // Try to find class structure
                for (var name in structure) {
                    try {
                        var item = structure[name].decode(source);
                        if (item !== undefined)
                            return new this(item);
                    } catch (e) {
                    }
                }
                assert(true);
            }
        });
    };

    var ENCAPSULATES = function (WrappedClass) {
        WrappedClass = WrappedClass || ANY;
        // BER Encode/Decode values
        return extend(WrappedClass, {
            encode: function () {
                return BER.encode(WrappedClass.method('encode').call(this, true));
            }
        }, {
            encode: function (object, format) {
                return new this(object).encode(format);
            },
            decode: function (source) {
                return WrappedClass.decode.call(this, BER.decode(source));
            }
        });
    };

    var DEFAULT = function (Class, optional) {
        Class = Class || ANY;
        return extend(Class, {
            encode: function (format) {
                if (this.object === optional)
                    return undefined;
                return Class.method('encode').call(this, format);
            }
        }, {
            decode: function (source) {
                if (source === undefined)
                    return new this(optional);
                else
                    try {
                        return Class.decode.call(this, source);
                    } catch (e) {
                        return undefined;
                    }
            }
        });
    };

    var OPTIONAL = function (Class) {
        Class = Class || ANY;
        return extend(Class, {}, {
            decode: function (source) {
                if (source === undefined)
                    return undefined;
                else
                    try {
                        return Class.decode.call(this, source);
                    } catch (e) {
                        return undefined;
                    }
            }
        });
    };

    var DEFAULT_NULL = function (Class, optional) {
        Class = Class || ANY;
        return extend(Class, {
            encode: function (format) {
                if (this.object === optional)
                    return new NULL(null).encode(format);
                return Class.method('encode').call(this, format);
            }
        }, {
            decode: function (source) {
                if (source === undefined)
                    return undefined;
                else if (source === null ||
                        (source.tagNumber === 0x05 && source.tagClass === 0))
                    return new this(optional);
                else
                    try {
                        return Class.decode.call(this, source);
                    } catch (e) {
                        return undefined;
                    }
            }
        });
    };



    /*
     * Certificate Version, Name, Attributes, Validity
     * 
     * http://tools.ietf.org/html/rfc5280
     * 
     */

    var DirectoryString = CHOICE({
        teletexString: TeletexString,
        printableString: PrintableString,
        universalString: UniversalString,
        utf8String: UTF8String,
        bmpString: BMPString,
        numericString: NumericString
    }, function (value) {
        // PrintableString - for characters and symbols with no spaces, overrise UTF8String
        return /^[A-Za-z0-9\.@\+\-\:\=\\\/\?\!\#\$\%\^\&\*\(\)\[\]\{\}\>\<\|\~]*$/.test(value) ? 'printableString' : 'utf8String';
    });

    var Time = CHOICE({
        utcTime: UTCTime,
        generalTime: GeneralizedTime
    }, function (value) {
        return value.getYear() >= 2050 ? 'generalTime' : 'utcTime';
    });

    // Attribute
    var AttributeType = OBJECT_IDENTIFIER;

    var AttributeValue = ANY;

    var AttributeTypeAndValue = ATTRIBUTE({
        type: AttributeType,
        value: AttributeValue
    });

    var typeAndValue = {
        typeName: 'type',
        valueName: 'value'
    };

    /**
     * X.501 type Name
     * The Name describes a hierarchical name composed of attributes, such
     * as country name, and corresponding values, such as US.  The type of
     * the component AttributeValue is determined by the AttributeType; in
     * general it will be a DirectoryString.
     
     * The DirectoryString type is defined as a choice of PrintableString,
     * TeletexString, BMPString, UTF8String, and UniversalString.  The
     * UTF8String encoding [RFC 2279] is the preferred encoding, and all
     * certificates issued after December 31, 2003 MUST use the UTF8String
     * encoding of DirectoryString.
     * 
     * Standard sets of attributes have been defined in the X.500 series of
     * specifications [X.520].  Implementations of this specification MUST
     * be prepared to receive the following standard attribute types in
     * issuer and subject (section 4.1.2.6) names:
     *  <ul>
     *      <li>country,</li>
     *      <li>organization,</li>
     *      <li>organizational-unit,</li>
     *      <li>distinguished name qualifier,</li>
     *      <li>state or province name,</li>
     *      <li>common name (e.g., "Susan Housley"), and</li>
     *      <li>serial number.</li>
     *  </ul>
     * In addition, implementations of this specification SHOULD be prepared
     * to receive the following standard attribute types in issuer and
     * subject names:
     *  <ul>
     *      <li>locality,</li>
     *      <li>title,</li>
     *      <li>surname,</li>
     *      <li>given name,</li>
     *      <li>initials,</li>
     *      <li>pseudonym, and</li>
     *      <li>generation qualifier (e.g., "Jr.", "3rd", or "IV").</li>
     *  </ul>
     The syntax for type Name:
     *  <pre>
     *  Name ::= CHOICE {
     *    rdnSequence RDNSequence }
     *
     *  RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
     *
     *  RelativeDistinguishedName ::=
     *    SET OF AttributeTypeAndValue
     *
     *  AttributeTypeAndValue ::= SEQUENCE {
     *    type     AttributeType,
     *    value    AttributeValue }
     *
     *  AttributeType ::= OBJECT IDENTIFIER
     *
     *  AttributeValue ::= ANY DEFINED BY AttributeType
     *
     *  DirectoryString ::= CHOICE {
     *        teletexString           TeletexString (SIZE (1..MAX)),
     *        printableString         PrintableString (SIZE (1..MAX)),
     *        universalString         UniversalString (SIZE (1..MAX)),
     *        utf8String              UTF8String (SIZE (1..MAX)),
     *        bmpString               BMPString (SIZE (1..MAX)) }
     *  </pre>
     * @class GostASN1.Name
     */
    var RelativeDistinguishedName = SET_OF_SINGLE(AttributeTypeAndValue({
        serialName: PrintableString,
        countryName: PrintableString,
        dnQualifier: PrintableString,
        emailAddress: IA5String,
        domainComponent: IA5String,
        SNILS: NumericString,
        OGRN: NumericString,
        INN: NumericString
    }, DirectoryString));

    var RDNSequence = SEQUENCE_OF(RelativeDistinguishedName, typeAndValue)();

    var Name = CHOICE({
        // only one possibility for now
        rdnSequence: RDNSequence}, 'rdnSequence');

    /**
     * Validity
     * @class GostASN1.Validity
     * @extends GostASN1.Sequence
     */
    var Validity = COMBINE(SEQUENCE({
        notBefore: Time,
        notAfter: Time}));

    var Version = INTEGER;

    var Attribute = ATTRIBUTE({
        type: OBJECT_IDENTIFIER,
        value: ANY
    });

    /**
     * Type and Value Attributes <br>
     * 
     * Suggested naming attributes: Definition of the following 
     * information object set may be augmented to meet local 
     * requirements.  Note that deleting members of the set may 
     * prevent interoperability with conforming implementations.
     * presented in pairs: the AttributeType followed by the type 
     * definition for the corresponding AttributeValue
     * 
     * @class GostASN1.Attributes
     * @extends GostASN1.Set
     */
    var Attributes = SET_OF(Attribute, typeAndValue);

    var AttributeSequence = SEQUENCE_OF(Attribute, typeAndValue);


    /*
     * Algorithm identifiers
     * 
     * http://tools.ietf.org/html/rfc3279
     * http://tools.ietf.org/html/rfc4357
     * http://tools.ietf.org/html/rfc2898
     * 
     */

    var FieldElement = INTEGER;
    var Curve = SEQUENCE({
        a: FieldElement,
        b: FieldElement,
        seed: OPTIONAL(BIT_STRING)});

    var ECPoint = OCTET_STRING(extend(ASN1Object, {
        encode: function () {
            var value = this.object;
            var len = Math.max(npw2(value.x.length - 2), npw2(value.y.length - 2)) / 2,
                    r = new Uint8Array(2 * len + 1);
            r[0] = 0x04;
            r.set(new Uint8Array(SInt.decode(value.x, false, len)), 1); // x
            r.set(new Uint8Array(SInt.decode(value.y, false, len)), len + 1); // y
            return r.buffer;
        }
    }, {
        decode: function (value) {
            var len = (value.byteLength - 1) / 2;
            return new this({
                x: SInt.encode(new Uint8Array(value, 1, len)),
                y: SInt.encode(new Uint8Array(value, len + 1, len))
            });
        }
    }));

    var FieldID = SEQUENCE({
        fieldType: OBJECT_IDENTIFIER,
        parameters: INTEGER});

    var ECParameters = SEQUENCE({
        version: Version, // version is always 1         
        fieldID: FieldID, // identifies the finite field over which the curve is defined 
        curve: Curve, // coefficients a and b of the elliptic curve         
        base: ECPoint, // specifies the base point P on the elliptic curve         
        order: INTEGER, // the order n of the base point         
        cofactor: OPTIONAL(INTEGER)}); // The integer h = #E(Fq)/n  

    var GostR3410Parameters = SEQUENCE({
        publicKeyParamSet: OBJECT_IDENTIFIER,
        digestParamSet: OBJECT_IDENTIFIER,
        encryptionParamSet: OPTIONAL(OBJECT_IDENTIFIER)});

    var GostR3411Parameters = DEFAULT_NULL(OBJECT_IDENTIFIER, 'id-GostR3411-94-CryptoProParamSet');

    var ECDHParameters = CHOICE({
        namedParameters: OBJECT_IDENTIFIER,
        ecParameters: ECParameters,
        implicitly: OPTIONAL(NULL)}, function (value) {
        return typeof value === 'string' || value instanceof String ?
                'namedParameters' : 'ecParameters';
    });

    var Algorithm = function (paramType, modifier) {
        return ENCLOSURE(SEQUENCE({
            algorithm: OBJECT_IDENTIFIER,
            parameters: OPTIONAL(paramType)}), modifier);
    };

    var AlgorithmIdentifier = (function () {

        var DefaultAlgorithm = Algorithm(ANY),
                Class = extend(ASN1Object, function (object) {
                    if (this instanceof Class)
                        Class.super.apply(this, arguments);
                    else
                        return DEFINE(object);
                }, {
                    encode: function (format) {
                        return new DefaultAlgorithm(this.object).encode(format);
                    }
                }, {
                    decode: function (source) {
                        return new this(DefaultAlgorithm.decode(source).object);
                    }
                });

        var DEFINE = function (algorithmSet) {

            return extend(ASN1Object, {
                object: {
                    get: function () {
                        if (this.item)
                            return this.item.object;
                        else
                            return undefined;
                    },
                    set: function (object) {
                        if (object) {
                            var ItemClass = algorithmSet[object.id];
                            if (!ItemClass)
                                throw new Error('Algorithm not supported');
                            this.item = new ItemClass(object);
                        } else
                            delete this.item;
                    }
                },
                encode: function (format) {
                    return this.item.encode(format);
                }
            }, {
                decode: function (source) {
                    // Decode PEM
                    if (typeof source === 'string')
                        source = PEM.decode(source, undefined, false);
                    // Decode binary data
                    if (source instanceof CryptoOperationData)
                        source = BER.decode(source);
                    var ItemClass = algorithmSet[names[source.object[0].object]];
                    if (ItemClass) {
                        var result = new this();
                        result.item = ItemClass.decode(source);
                        return result;
                    } else
                        throw new Error('Algorithm not supported');
                }
            });
        };

        return Class;
    })();

    var ECDHKeyAlgorithm = Algorithm(ECDHParameters, {
        encode: function (value) {
            var params;
            if (typeof value.namedCurve === 'string')
                params = attributes['namedCurve'][value.namedCurve];
            else
                params = {
                    version: 1,
                    fieldID: {
                        fieldType: 'id-prime-Field',
                        parameters: value.curve.p
                    },
                    curve: {
                        a: value.curve.a,
                        b: value.curve.b
                    },
                    base: {
                        x: value.curve.x,
                        y: value.curve.y
                    },
                    order: value.curve.q,
                    cofactor: 1
                };
            return {
                algorithm: value.id,
                parameters: params
            };
        },
        decode: function (value) {
            var params = value.parameters,
                    result = algorithms[value.algorithm];
            if (typeof params === 'string' || params instanceof String) {
                result = expand(result, parameters[params]);
            } else if (typeof params === 'object') {
                result = expand(result, {
                    curve: {
                        p: params.fieldID.parameters,
                        a: params.curve.a,
                        b: params.curve.b,
                        x: params.base.x,
                        y: params.base.y,
                        q: params.order
                    }
                });
            } else
                throw new DataError('Invalid key paramters');
            return result;
        }
    });

    var GostKeyAlgorithm = Algorithm(GostR3410Parameters, {
        encode: function (value) {
            var paramName = value.namedCurve ? 'namedCurve' : 'namedParam',
                    sBox = (value.name.indexOf('-94') >= 0 || value.name.indexOf('-2001') >= 0 ||
                            value.version === 1994 || value.version === 2001) ? value.sBox || 'D-A' :
                    (value.name.indexOf('-512') >= 0 || value.length === 512) ? 'D-512' : 'D-256';
            return {
                algorithm: value.id,
                parameters: {
                    publicKeyParamSet: attributes[paramName][value[paramName]],
                    digestParamSet: attributes['sBox'][sBox],
                    encryptionParamSet: value.encParams && value.encParams.sBox ?
                            attributes['sBox'][value.encParams.sBox] : undefined
                }
            };
        },
        decode: function (value) {
            var params = value.parameters,
                    algorithm = expand(algorithms[value.algorithm],
                            parameters[params.publicKeyParamSet],
                            parameters[params.digestParamSet]);
            if (params.encryptionParamSet)
                algorithm.encParams = parameters[params.encryptionParamSet];
            return algorithm;
        }
    });

    var AlgorithmWithNoParam = Algorithm(ANY, {
        encode: function (value) {
            return {algorithm: value.id};
        },
        decode: function (value) {
            return algorithms[value.algorithm];
        }
    });

    var AlgorithmWithNullParam = Algorithm(NULL, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: null
            };
        },
        decode: function (value) {
            return algorithms[value.algorithm];
        }
    });

    var Gost341194DigestAlgorithm = Algorithm(GostR3411Parameters, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: attributes['sBox'][value.sBox || (value.hash && value.hash.sBox) || 'D-A']
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]),
                    parameter = parameters[value.parameters];
            if (algorithm.hash)
                algorithm.hash = expand(algorithm.hash, parameter);
            else
                algorithm = expand(algorithm, parameter);
            return algorithm;
        }
    });

    var KeyAlgorithmIdentifier = AlgorithmIdentifier({
        ecdsa: ECDHKeyAlgorithm,
        noSignature: AlgorithmWithNullParam,
        rsaEncryption: AlgorithmWithNullParam,
        'id-sc-gostR3410-2001': ECDHKeyAlgorithm,
        'id-GostR3410-2001': GostKeyAlgorithm,
        'id-GostR3410-94': GostKeyAlgorithm,
        'id-GostR3410-2001DH': GostKeyAlgorithm,
        'id-GostR3410-94DH': GostKeyAlgorithm,
        'id-tc26-gost3410-12-256': GostKeyAlgorithm,
        'id-tc26-gost3410-12-512': GostKeyAlgorithm,
        'id-tc26-agreement-gost-3410-12-256': GostKeyAlgorithm,
        'id-tc26-agreement-gost-3410-12-512': GostKeyAlgorithm,
        'id-sc-gost28147-gfb': AlgorithmWithNoParam,
        'id-Gost28147-89': AlgorithmWithNoParam
    });

    var SignatureAlgorithmIdentifier = AlgorithmIdentifier({
        noSignature: AlgorithmWithNullParam,
        rsaEncryption: AlgorithmWithNullParam,
        sha1withRSAEncryption: AlgorithmWithNullParam,
        sha256withRSAEncryption: AlgorithmWithNullParam,
        sha384withRSAEncryption: AlgorithmWithNullParam,
        sha512withRSAEncryption: AlgorithmWithNullParam,
        'ecdsa': AlgorithmWithNoParam,
        'ecdsa-with-SHA1': AlgorithmWithNoParam,
        'ecdsa-with-SHA256': AlgorithmWithNoParam,
        'ecdsa-with-SHA384': AlgorithmWithNoParam,
        'ecdsa-with-SHA512': AlgorithmWithNoParam,
        'id-GostR3410-94': AlgorithmWithNullParam,
        'id-GostR3410-2001': AlgorithmWithNullParam,
        'id-GostR3411-94-with-GostR3410-2001': AlgorithmWithNoParam,
        'id-GostR3411-94-with-GostR3410-94': AlgorithmWithNoParam,
        'id-tc26-gost3410-12-256': AlgorithmWithNullParam,
        'id-tc26-gost3410-12-512': AlgorithmWithNullParam,
        'id-tc26-signwithdigest-gost3410-12-94': AlgorithmWithNoParam,
        'id-tc26-signwithdigest-gost3410-12-256': AlgorithmWithNoParam,
        'id-tc26-signwithdigest-gost3410-12-512': AlgorithmWithNoParam,
        'id-sc-gostR3410-94': AlgorithmWithNullParam,
        'id-sc-gostR3410-2001': AlgorithmWithNullParam,
        'id-sc-gostR3411-94-with-gostR3410-94': AlgorithmWithNullParam,
        'id-sc-gostR3411-94-with-gostR3410-2001': AlgorithmWithNullParam
    });

    var DigestAlgorithmIdentifier = AlgorithmIdentifier({
        sha1: AlgorithmWithNoParam,
        sha256: AlgorithmWithNullParam,
        sha384: AlgorithmWithNullParam,
        sha512: AlgorithmWithNullParam,
        'id-GostR3411-94': Gost341194DigestAlgorithm,
        'id-tc26-gost3411-94': Gost341194DigestAlgorithm,
        'id-tc26-gost3411-12-256': AlgorithmWithNullParam,
        'id-tc26-gost3411-12-512': AlgorithmWithNullParam,
        'id-sc-gostR3411-94': AlgorithmWithNoParam});

    var Gost2814789Key = OCTET_STRING; //(SIZE (32))

    var Gost2814789MAC = OCTET_STRING; // (SIZE (1..4))

    var Gost2814789ParamSet = OBJECT_IDENTIFIER;

    var Gost2814789IV = OCTET_STRING; // (SIZE (8))

    var Gost2814789Parameters = SEQUENCE({
        iv: Gost2814789IV,
        encryptionParamSet: Gost2814789ParamSet});

    var Gost2814789KeyWrapParameters = SEQUENCE({
        encryptionParamSet: Gost2814789ParamSet,
        ukm: OPTIONAL(OCTET_STRING)}); // (SIZE (8)) must be absent in key agreement

    var Gost2814789Algorithm = Algorithm(Gost2814789Parameters, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    iv: value.iv,
                    encryptionParamSet: attributes['sBox'][value.sBox || 'E-A']
                }
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm],
                    parameters[value.parameters.encryptionParamSet]);
            algorithm.iv = value.parameters.iv;
            return algorithm;
        }
    });

    var SCGostAlgorithm = Algorithm(Gost2814789IV, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: value.iv
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.iv = value.parameters || new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);
            return algorithm;
        }
    });

    var GostKeyWrapAlgorithm = Algorithm(Gost2814789KeyWrapParameters, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    encryptionParamSet: attributes['sBox'][value.sBox || 'E-A'],
                    ukm: value.ukm
                }
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm],
                    parameters[value.parameters.encryptionParamSet]);
            if (value.parameters.ukm)
                algorithm.ukm = value.parameters.ukm;
            return algorithm;
        }
    });

    var KeyWrapAlgorithmIdentifier = AlgorithmIdentifier({
        'id-Gost28147-89-None-KeyWrap': GostKeyWrapAlgorithm,
        'id-Gost28147-89-CryptoPro-KeyWrap': GostKeyWrapAlgorithm});

    var GostKeyAgreementAlgorithm = Algorithm(KeyWrapAlgorithmIdentifier, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: value.wrapping
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.wrapping = value.parameters;
            return algorithm;
        }
    });

    var BaseEncryptionAlgorithmIdentifier = AlgorithmIdentifier({
        'id-sc-gost28147-gfb': SCGostAlgorithm,
        'id-Gost28147-89': Gost2814789Algorithm});

    var MessageAuthenticationCodeAlgorithm = AlgorithmIdentifier({
        'id-Gost28147-89-MAC': Gost2814789Parameters,
        'id-HMACGostR3411-94': Gost341194DigestAlgorithm,
        'id-tc26-hmac-gost-3411-12-256': Gost341194DigestAlgorithm,
        'id-tc26-hmac-gost-3411-12-512': Gost341194DigestAlgorithm,
        'hmacWithSHA1': AlgorithmWithNoParam,
        'hmacWithSHA224': AlgorithmWithNoParam,
        'hmacWithSHA256': AlgorithmWithNoParam,
        'hmacWithSHA384': AlgorithmWithNoParam,
        'hmacWithSHA512': AlgorithmWithNoParam,
        'id-sc-gost28147-mac': AlgorithmWithNoParam,
        'id-sc-hmacWithGostR3411': AlgorithmWithNoParam});

    // rfc2898 PKCS #5: Password-Based Cryptography Specification
    // PBKDF2
    var PBKDF2params = SEQUENCE({
        salt: CHOICE({
            specified: OCTET_STRING,
            otherSource: AlgorithmIdentifier
        }, function (value) {
            return isBinary(value) ? 'specified' : 'otherSource';
        }),
        iterationCount: INTEGER,
        keyLength: OPTIONAL(INTEGER),
        prf: MessageAuthenticationCodeAlgorithm});

    var PBKDF2Algorithm = Algorithm(PBKDF2params, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    salt: value.salt,
                    iterationCount: value.iterations,
                    prf: value.hmac
                }
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.salt = value.parameters.salt;
            algorithm.iterations = value.parameters.iterationCount;
            algorithm.hmac = value.parameters.prf;
            algorithm.hash = algorithm.hmac.hash;
            return algorithm;
        }
    });

    var KeyDerivationAlgorithmIdentifier = AlgorithmIdentifier({
        'PBKDF2': PBKDF2Algorithm});

    var PBEParameter = SEQUENCE({
        salt: OCTET_STRING,
        iterationCount: INTEGER});

    var PBES1Algorithm = Algorithm(PBEParameter, {
        paramType: PBEParameter,
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    salt: value.derivation.salt,
                    iterationCount: value.derivation.iterations
                }
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.derivation = expand(algorithm.derivation,
                    {salt: value.parameters.salt, iterations: value.parameters.iterationCount});
            return algorithm;
        }
    });

    // PBES2
    var PBES2params = SEQUENCE({
        keyDerivationFunc: KeyDerivationAlgorithmIdentifier, // {{PBES2-KDFs}},
        encryptionScheme: BaseEncryptionAlgorithmIdentifier}); // {{PBES2-Encs}}

    var PBES2Algorithm = Algorithm(PBES2params, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    keyDerivationFunc: value.derivation,
                    encryptionScheme: value.encryption
                }
            };
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.derivation = value.parameters.keyDerivationFunc;
            algorithm.encryption = value.parameters.encryptionScheme;
            return algorithm;
        }
    });

    var PasswordEncryptionAlgorithmIndentifier = AlgorithmIdentifier({
        // PBES1
        'pbeWithSHAAndAES128-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES192-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES256-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES128-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES192-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES256-CBC': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147CFB': PBES1Algorithm,
        // PKCS12 PBES1 
        'pbeWithSHAAnd3-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd2-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd128BitRC2-CBC': PBES1Algorithm,
        'pbeWithSHAAnd40BitRC2-CBC': PBES1Algorithm,
        'pbeUnknownGost': PBES1Algorithm,
        // PBES2
        'PBES2': PBES2Algorithm});

    var KeyEncryptionAlgorithmIdentifier = AlgorithmIdentifier({
        ecdsa: ECDHKeyAlgorithm,
        rsaEncryption: AlgorithmWithNullParam,
        // Base encryption
        'id-sc-gost28147-gfb': SCGostAlgorithm,
        'id-Gost28147-89': Gost2814789Algorithm,
        // Key transport algorithms
        'id-sc-gostR3410-2001': ECDHKeyAlgorithm,
        'id-GostR3410-2001': GostKeyAlgorithm,
        'id-GostR3410-94': GostKeyAlgorithm,
        'id-tc26-gost3410-12-256': GostKeyAlgorithm,
        'id-tc26-gost3410-12-512': GostKeyAlgorithm,
        // Key agreement algorithms
        'id-GostR3410-94-CryptoPro-ESDH': GostKeyAgreementAlgorithm,
        'id-GostR3410-2001-CryptoPro-ESDH': GostKeyAgreementAlgorithm,
        'id-tc26-agreement-gost-3410-12-256': GostKeyAgreementAlgorithm,
        'id-tc26-agreement-gost-3410-12-512': GostKeyAgreementAlgorithm,
        'id-sc-r3410-ESDH-r3411kdf': AlgorithmWithNullParam,
        // Key encryption key algorithms
        'id-Gost28147-89-None-KeyWrap': GostKeyWrapAlgorithm, // Add ukm to algorithm
        'id-Gost28147-89-CryptoPro-KeyWrap': GostKeyWrapAlgorithm,
        'id-sc-cmsGostWrap': AlgorithmWithNoParam, // SC don't use ukm
        'id-sc-cmsGost28147Wrap': AlgorithmWithNoParam,
        // Password based encryption
        'pbeWithSHAAndAES128-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES192-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES256-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES128-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES192-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES256-CBC': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147CFB': PBES1Algorithm,
        // PKCS12 PBES1 
        'pbeWithSHAAnd3-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd2-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd128BitRC2-CBC': PBES1Algorithm,
        'pbeWithSHAAnd40BitRC2-CBC': PBES1Algorithm,
        'pbeUnknownGost': PBES1Algorithm,
        // PBES2
        'PBES2': PBES2Algorithm
    });

    var PBMAC1params = SEQUENCE({
        keyDerivationFunc: KeyDerivationAlgorithmIdentifier, // {{PBMAC1-KDFs}},
        messageAuthScheme: MessageAuthenticationCodeAlgorithm}); // {{PBMAC1-MACs}}

    var PasswordMACAlgorithm = Algorithm(PBMAC1params, {
        encode: function (value) {
            return {
                algorithm: value.id,
                parameters: {
                    keyDerivationFunc: value.derivation,
                    messageAuthScheme: value.hmac}};
        },
        decode: function (value) {
            var algorithm = expand(algorithms[value.algorithm]);
            algorithm.derivation = value.parameters.keyDerivationFunc;
            algorithm.hmac = value.parameters.messageAuthScheme;
            return algorithm;
        }
    });

    var PasswordMACAlgorithmIdentifier = AlgorithmIdentifier({
        'PBMAC1': PasswordMACAlgorithm
    });

    var ContentEncryptionAlgorithmIdentifier = AlgorithmIdentifier({
        // Base encryption
        'id-sc-gost28147-gfb': SCGostAlgorithm,
        'id-Gost28147-89': Gost2814789Algorithm,
        // Password based encryption
        'pbeWithSHAAndAES128-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES192-CBC': PBES1Algorithm,
        'pbeWithSHAAndAES256-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES128-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES192-CBC': PBES1Algorithm,
        'pbeWithSHA256AndAES256-CBC': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147': PBES1Algorithm,
        'id-sc-pbeWithGost3411AndGost28147CFB': PBES1Algorithm,
        // PKCS12 PBES1 
        'pbeWithSHAAnd3-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd2-KeyTripleDES-CBC': PBES1Algorithm,
        'pbeWithSHAAnd128BitRC2-CBC': PBES1Algorithm,
        'pbeWithSHAAnd40BitRC2-CBC': PBES1Algorithm,
        'pbeUnknownGost': PBES1Algorithm,
        // PBES2
        'PBES2': PBES2Algorithm
    });



    /*
     * Public Key Info 
     * 
     * http://tools.ietf.org/html/rfc5280
     * 
     */

    var KeyData = ENCLOSURE;

    var DHPublicKey = KeyData(BIT_STRING(ENCAPSULATES(INTEGER)), {
        encode: function (value) {
            return Int16.encode(swapBytes(value));
        },
        decode: function (value) {
            return swapBytes(Int16.decode(value));
        }
    });

    var ECDHPublicKey = KeyData(BIT_STRING(ENCAPSULATES(OCTET_STRING)), {
        encode: function (value) {
            var r = new Uint8Array(value.byteLength + 1),
                    d = swapBytes(value),
                    len = value.byteLength / 2;
            r[0] = 0x04; // type hex;
            r.set(new Uint8Array(d, len, len), 1); // x
            r.set(new Uint8Array(d, 0, len), len + 1); // y
            return r.buffer;
        },
        decode: function (value) {
            assert((value.byteLength & 1) === 0);
            var d = new Uint8Array(value.byteLength - 1),
                    len = d.byteLength / 2;
            d.set(new Uint8Array(value, len + 1, len), 0); // y
            d.set(new Uint8Array(value, 1, len), len); // x
            return swapBytes(d);
        }
    });

    var GostR3410PublicKey = BIT_STRING(ENCAPSULATES(OCTET_STRING));

    /**
     * Subject Public Key Info Syntax X.509
     * <pre>
     *  SubjectPublicKeyInfo  ::=  SEQUENCE  {
     *      algorithm            AlgorithmIdentifier,
     *      subjectPublicKey     BIT STRING  }
     *  
     *  AlgorithmIdentifier  ::=  SEQUENCE  {
     *      algorithm               OBJECT IDENTIFIER,
     *      parameters              ANY DEFINED BY algorithm OPTIONAL  }
     -- contains a value of the type
     -- registered for use with the
     -- algorithm object identifier value     
     * </pre>
     * RFC 5280 references {@link http://tools.ietf.org/html/rfc5280} 
     * @class GostASN1.SubjectPublicKeyInfo
     * @extends GostASN1.Sequence
     * @property {AlgorithmIdentifier} algorithm Identifies the public-key algorithm.
     * @property {CryptoOperationData} subjectPublicKey An binary data whose contents are the value of the public key
     */
    var SubjectPublicKeyInfo = SEQUENCE({
        algorithm: KeyAlgorithmIdentifier,
        subjectPublicKey: BIT_STRING}, 'PUBLIC KEY');

    var GostSubjectPublicKeyInfo = (function (PKTypes) {

        /**
         * Coding methods for {@link Algorithm} and {@link GostASN1.SubjectPublicKeyInfo}
         * Supported types for GOST algorithms:
         * <pre>
         *  {
         *      'id-sc-gostR3410-2001': ECDHPublicKey,
         *      'id-sc-gostR3410-94': DHPublicKey,
         *      'id-GostR3410-2001': GostR3410PublicKey,
         *      'id-GostR3410-94': GostR3410PublicKey,
         *      'id-tc26-gost3410-12-256': GostR3410PublicKey,
         *      'id-tc26-gost3410-12-512': GostR3410PublicKey
         *  }
         * </pre>
         * 
         * @class GostASN1.GostSubjectPublicKeyInfo
         * @extends GostASN1.SubjectPublicKeyInfo
         * @extends Key
         */
        return ENCLOSURE(ATTRIBUTE({
            algorithm: KeyAlgorithmIdentifier,
            subjectPublicKey: ANY},
        'algorithm', 'subjectPublicKey')(function (algorithm) {
            return PKTypes[algorithm.id];
        }), {
            encode: function (value) {
                return {
                    algorithm: value.algorithm,
                    subjectPublicKey: value.buffer
                };
            },
            decode: function (value) {
                return {
                    algorithm: value.algorithm,
                    type: 'public',
                    extractable: true,
                    usages: ['verify', 'deriveKey', 'deriveBits'],
                    buffer: value.subjectPublicKey
                };
            }
        });
    })({
        'id-sc-gostR3410-2001': ECDHPublicKey,
        'id-sc-gostR3410-94': DHPublicKey,
        'id-GostR3410-2001': GostR3410PublicKey,
        'id-GostR3410-94': GostR3410PublicKey,
        'id-tc26-gost3410-12-256': GostR3410PublicKey,
        'id-tc26-gost3410-12-512': GostR3410PublicKey
    });


    /*
     * Private Key Info PKCS#8
     * 
     * http://tools.ietf.org/html/rfc5208
     * 
     */

    var PrivateKey = OCTET_STRING;

    var DHPrivateKey = KeyData(PrivateKey(ENCAPSULATES(INTEGER)), {
        encode: function (value) { // for SignalCom INTEGER d
            return SInt.encode(value, true);
        },
        decode: function (value) {
            return SInt.decode(value, true);
        }
    });

    var GostR3410KeyValueMask = OCTET_STRING;

    var GostR3410KeyValueInfo = SEQUENCE({
        keyValueMask: GostR3410KeyValueMask,
        keyValyePublicKey: OCTET_STRING});

    var GostR3410PrivateKey = CHOICE({
        privateKey: PrivateKey(ENCAPSULATES(CHOICE({
            keyValueMask: GostR3410KeyValueMask,
            keyValueInfo: GostR3410KeyValueInfo
        }, function (value) {
            if (isBinary(value))
                return 'keyValueMask';
            else
                return 'keyValueInfo';
        }))),
        keyValueMask: GostR3410KeyValueMask
    }, function (value) {
        return value.enclosed ? 'keyValueMask' : 'privateKey';
    });

    var GostWrappedPrivateKey = (function (PKTypes) {

        /**
         * Gost Wrapped Private Key for SignalCom key container
         * 
         * @class GostASN1.GostWrappedPrivateKey
         * @extends GostASN1.PrivateKeyInfo
         */
        return ATTRIBUTE({
            version: Version,
            privateKeyAlgorithm: KeyAlgorithmIdentifier,
            privateKeyWrapped: KeyData(PrivateKey(ENCAPSULATES(SEQUENCE({
                keyData: INTEGER,
                keyMac: INTEGER
            }))), {
                encode: function (value) {
                    var size = value.byteLength - 4;
                    return {
                        keyData: SInt.encode(new Uint8Array(value, 0, size)),
                        keyMac: SInt.encode(new Uint8Array(value, size, 4))
                    };
                },
                decode: function (value) {
                    var data = SInt.decode(value.keyData),
                            mac = SInt.decode(value.keyMac),
                            result = new Uint8Array(data.byteLength + mac.byteLength);
                    result.set(new Uint8Array(data));
                    result.set(new Uint8Array(mac), data.byteLength);
                    return result;
                }
            }),
            attributes: ANY
        }, 'privateKeyAlgorithm', 'attributes')(function (algorithm) {
            return OPTIONAL(CTX(0, IMPLICIT(Attributes({
                'id-sc-gostR3410-2001-publicKey': SET_OF_SINGLE(PKTypes[algorithm.id])
            }))));
        });
    })({
        // Signature keys
        'id-sc-gostR3410-2001': ECDHPublicKey,
        'id-sc-gostR3410-94': DHPublicKey,
        'id-GostR3410-2001': GostR3410PublicKey,
        'id-GostR3410-94': GostR3410PublicKey,
        'id-GostR3410-2001DH': GostR3410PublicKey,
        'id-GostR3410-94DH': GostR3410PublicKey,
        'id-tc26-gost3410-12-256': GostR3410PublicKey,
        'id-tc26-gost3410-12-512': GostR3410PublicKey,
        'id-tc26-agreement-gost-3410-12-256': GostR3410PublicKey,
        'id-tc26-agreement-gost-3410-12-512': GostR3410PublicKey
    });

    /**
     * Private-Key Information Syntax PKSC#8
     * <pre>
     *  -- Private-key information syntax
     *
     *  PrivateKeyInfo ::= SEQUENCE {
     *      version Version,
     *      privateKeyAlgorithm AlgorithmIdentifier {{PrivateKeyAlgorithms}},
     *      privateKey PrivateKey,
     *      attributes [0] Attributes OPTIONAL }
     *
     *  Version ::= INTEGER {v1(0)} (v1,...)
     *
     *  PrivateKey ::= OCTET STRING
     *
     *  Attributes ::= SET OF Attribute
     * </pre>
     * RFC 5208 references {@link http://tools.ietf.org/html/rfc5208} 
     * @class GostASN1.PrivateKeyInfo
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number. Should be 0
     * @property {AlgorithmIndentifier} privateKeyAlgorithm Identifies the private-key algorithm
     * @property {CryptoOperationData} privateKey Is an binary data whose contents are the value of the private key.  
     * @property {GostASN1.Attributes} attributes A set of attributes
     */
    var PrivateKeyInfo = SEQUENCE({
        version: Version,
        privateKeyAlgorithm: KeyAlgorithmIdentifier,
        privateKey: PrivateKey,
        attributes: OPTIONAL(CTX(0, IMPLICIT(Attributes)))}, 'PRIVATE KEY');

    var PrivateKeyAlgorithmIdentifier = KeyAlgorithmIdentifier;

    var PublicKey = BIT_STRING;

    var OneAsymmetricKey = SEQUENCE({
        version: Version,
        privateKeyAlgorithm: PrivateKeyAlgorithmIdentifier,
        privateKey: PrivateKey,
        attributes: OPTIONAL(CTX(0, IMPLICIT(Attributes))),
        publicKey: OPTIONAL(CTX(1, IMPLICIT(PublicKey)))});

    var AsymmetricKeyPackage = SEQUENCE_OF(OneAsymmetricKey);

    var GostPrivateKeyInfo = (function (PKTypes) {

        /**
         * Coding methods for {@link Algorithm} and {@link GostASN1.PrivateKeyInfo}
         * Supported types for GOST algorithms:
         * <pre>
         *  {
         *      'id-sc-gostR3410-2001': DHPrivateKey,
         *      'id-sc-gostR3410-94': DHPrivateKey,
         *      'id-GostR3410-2001': GostR3410PrivateKey,
         *      'id-GostR3410-94': GostR3410PrivateKey,
         *      'id-tc26-gost3410-12-256': GostR3410PrivateKey,
         *      'id-tc26-gost3410-12-512': GostR3410PrivateKey
         *  }
         * </pre>
         * 
         * @class GostASN1.GostPrivateKeyInfo
         * @extends GostASN1.PrivateKeyInfo
         * @extends Key
         */
        return ENCLOSURE(ATTRIBUTE({
            version: Version,
            privateKeyAlgorithm: KeyAlgorithmIdentifier,
            privateKey: ANY,
            attributes: OPTIONAL(CTX(0, IMPLICIT(Attributes)))},
        'privateKeyAlgorithm', 'privateKey')(function (algorithm) {
            return PKTypes[algorithm.id];
        }), {
            encode: function (value) {
                return {
                    version: 0,
                    privateKeyAlgorithm: value.algorithm,
                    privateKey: value.buffer
                };
            },
            decode: function (value) {
                return {
                    algorithm: value.privateKeyAlgorithm,
                    type: 'private',
                    extractable: true,
                    usages: ['sign', 'deriveKey', 'deriveBits'],
                    buffer: isBinary(value.privateKey) ? value.privateKey :
                            value.privateKey.keyValueMask
                };
            }
        });
    })({
        // Signature keys
        'id-sc-gostR3410-2001': DHPrivateKey,
        'id-sc-gostR3410-94': DHPrivateKey,
        'id-GostR3410-2001': GostR3410PrivateKey,
        'id-GostR3410-94': GostR3410PrivateKey,
        'id-GostR3410-2001DH': GostR3410PrivateKey,
        'id-GostR3410-94DH': GostR3410PrivateKey,
        'id-tc26-gost3410-12-256': GostR3410PrivateKey,
        'id-tc26-gost3410-12-512': GostR3410PrivateKey,
        'id-tc26-agreement-gost-3410-12-256': GostR3410PrivateKey,
        'id-tc26-agreement-gost-3410-12-512': GostR3410PrivateKey
    });

    var KeyEncryptedData = OCTET_STRING;
    /**
     * Encrypted Private-Key Information Syntax
     * <pre>
     *  -- Encrypted private-key information syntax
     *
     *  EncryptedPrivateKeyInfo ::= SEQUENCE {
     *      encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
     *      encryptedData KeyEncryptedData
     *  }
     *
     *  KeyEncryptedData ::= OCTET STRING
     *
     *  PrivateKeyAlgorithms ALGORITHM-IDENTIFIER ::= {
     *      ... -- For local profiles
     *  }
     *
     *  KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
     *      ... -- For local profiles
     *  }
     * </pre>
     * RFC 5208 references {@link http://tools.ietf.org/html/rfc5208} 
     * @class GostASN1.EncryptedPrivateKeyInfo
     * @extends GostASN1.Sequence
     * @property {AlgorithmIdentifier} encryptionAlgorithm Identifies key encryption algorithm
     * @property {CryptoOperationData} encryptedData Encrypted {@link GostASN1.PrivateKeyInfo}
     */
    var EncryptedPrivateKeyInfo = SEQUENCE({
        encryptionAlgorithm: KeyEncryptionAlgorithmIdentifier,
        encryptedData: KeyEncryptedData}, 'ENCRYPTED PRIVATE KEY');


    /*
     * Certificate Extensions
     * 
     * http://tools.ietf.org/html/rfc5280
     * 
     */
    var UniqueIdentifier = BIT_STRING;

    var CertificateSerialNumber = INTEGER;

    var BasicConstraints = SEQUENCE({
        cA: DEFAULT(BOOLEAN, false),
        pathLenConstraint: OPTIONAL(INTEGER)
    });

    var KeyUsage = BIT_STRING({
        digitalSignature: 0,
        nonRepudiation: 1,
        keyEncipherment: 2,
        dataEncipherment: 3,
        keyAgreement: 4,
        keyCertSign: 5,
        cRLSign: 6,
        encipherOnly: 7,
        decipherOnly: 8});
    var KeyPurposeId = OBJECT_IDENTIFIER,
            ExtKeyUsageSyntax = SEQUENCE_OF(KeyPurposeId);

    var KeyIdentifier = OCTET_STRING;

    var OtherName = SEQUENCE({
        type: OBJECT_IDENTIFIER,
        value: CTX(0, EXPLICIT(ANY))});

    var EDIPartyName = SEQUENCE({
        nameAssigner: OPTIONAL(CTX(0, IMPLICIT(DirectoryString))),
        partyName: OPTIONAL(CTX(1, IMPLICIT(DirectoryString)))});

    var ORAddress = SEQUENCE({});

    var GeneralName = CHOICE({
        otherName: CTX(0, IMPLICIT(OtherName)),
        rfc822Name: CTX(1, IMPLICIT(DirectoryString)),
        dNSName: CTX(2, IMPLICIT(DirectoryString)),
        x400Address: CTX(3, IMPLICIT(ORAddress)),
        directoryName: CTX(4, EXPLICIT(Name)), // Name is CHOICE(RDNSequence)
        ediPartyName: CTX(5, IMPLICIT(EDIPartyName)),
        uniformResourceIdentifier: CTX(6, IMPLICIT(DirectoryString)),
        iPAddress: CTX(7, IMPLICIT(OCTET_STRING)),
        registeredID: CTX(8, IMPLICIT(OBJECT_IDENTIFIER))}, function (value) {
        return typeof value === 'string' || value instanceof String ?
                (value.indexOf('@') >= 0 ? 'rfc822Name' : 'dNSName') :
                isBinary(value) ? 'iPAddress' : 'directoryName';
    });

    var GeneralNames = SEQUENCE_OF(GeneralName);

    var AuthorityKeyIdentifier = SEQUENCE({
        keyIdentifier: OPTIONAL(CTX(0, IMPLICIT(KeyIdentifier))),
        authorityCertIssuer: OPTIONAL(CTX(1, IMPLICIT(GeneralNames))),
        authorityCertSerialNumber: OPTIONAL(CTX(2, IMPLICIT(CertificateSerialNumber)))});

    var PrivateKeyUsagePeriod = SEQUENCE({
        notBefore: OPTIONAL(CTX(0, IMPLICIT(GeneralizedTime))),
        notAfter: OPTIONAL(CTX(1, IMPLICIT(GeneralizedTime)))});

    var CertPolicyId = OBJECT_IDENTIFIER,
            PolicyQualifierId = OBJECT_IDENTIFIER;

    var PolicyQualifierInfo = SEQUENCE({
        policyQualifierId: PolicyQualifierId,
        qualifier: ANY});

    var PolicyInformation = SEQUENCE({
        policyIdentifier: CertPolicyId,
        policyQualifiers: OPTIONAL(SEQUENCE_OF(PolicyQualifierInfo))});

    var PolicyMapping = SEQUENCE({
        issuerDomainPolicy: CertPolicyId,
        subjectDomainPolicy: CertPolicyId});

    var BaseDistance = INTEGER;

    var GeneralSubtree = SEQUENCE({
        base: GeneralName,
        minimum: DEFAULT(CTX(0, IMPLICIT(BaseDistance)), 0),
        maximum: OPTIONAL(CTX(1, IMPLICIT(BaseDistance)))});

    var GeneralSubtrees = SEQUENCE_OF(GeneralSubtree);

    var NameConstraints = SEQUENCE({
        permittedSubtrees: OPTIONAL(CTX(0, IMPLICIT(GeneralSubtrees))),
        excludedSubtrees: OPTIONAL(CTX(1, IMPLICIT(GeneralSubtrees)))});

    var SkipCerts = INTEGER;

    var PolicyConstraints = SEQUENCE({
        requireExplicitPolicy: OPTIONAL(CTX(0, IMPLICIT(SkipCerts))),
        inhibitPolicyMapping: OPTIONAL(CTX(1, IMPLICIT(SkipCerts)))});

    var ReasonFlags = BIT_STRING({
        unused: 0,
        keyCompromise: 1,
        cACompromise: 2,
        affiliationChanged: 3,
        superseded: 4,
        cessationOfOperation: 5,
        certificateHold: 6,
        privilegeWithdrawn: 7,
        aACompromise: 8});

    var DistributionPointName = CHOICE({
        fullName: CTX(0, IMPLICIT(GeneralNames)),
        nameRelativeToCRLIssuer: CTX(1, IMPLICIT(RelativeDistinguishedName))}, function (value) {
        return value instanceof Array ? 'fullName' : 'nameRelativeToCRLIssuer';
    });

    var DistributionPoint = SEQUENCE({
        distributionPoint: OPTIONAL(CTX(0, EXPLICIT(DistributionPointName))), // DistributionPointName CHOICE
        reasons: OPTIONAL(CTX(1, IMPLICIT(ReasonFlags))),
        cRLIssuer: OPTIONAL(CTX(2, IMPLICIT(GeneralNames)))});

    var CRLDistributionPoints = SEQUENCE_OF(DistributionPoint);

    var FreshestCRL = CRLDistributionPoints;

    var AccessDescription = SEQUENCE({
        accessMethod: OBJECT_IDENTIFIER,
        accessLocation: GeneralName});

    var Extension = function (typeSet, defaultCritical) {

        var Attribute = ATTRIBUTE({
            extnID: OBJECT_IDENTIFIER,
            critical: DEFAULT(BOOLEAN, false),
            extnValue: function (type) {
                return OCTET_STRING(ENCAPSULATES(type));
            }
        }, 'extnID', 'extnValue');

        var Class = extend(Attribute(typeSet), {
            object: {
                get: function () {
                    var value = this._get(Class.super, 'object');
                    if (value && typeof value.extnValue === 'object')
                        this.defineValue(value.extnValue);
                    return value;
                },
                set: function (object) {
                    this._set(Class.super, 'object', object);
                    // Define critical
                    if (object && object.extnValue)
                        if (object.extnValue.critical !== undefined)
                            this.critical = object.extnValue.critical;
                        else if (this.critical === undefined && defaultCritical)
                            this.critical = defaultCritical(this.extnID, object.extnValue);
                }
            },
            extnValue: {
                get: function () {
                    // Get value property of object
                    var value = this._get(Class.super, 'extnValue');
                    if (typeof value === 'object')
                        this.defineValue(value);
                    return value;
                },
                set: function (object) {
                    // Set value property of object
                    this._set(Class.super, 'extnValue', object);
                    // Define critical
                    if (object) {
                        if (object.critical !== undefined)
                            this.critical = object.critical;
                        else if (this.critical === undefined && defaultCritical)
                            this.critical = defaultCritical(this.extnID, object);
                    }
                }
            },
            defineValue: function (value) {
                if (typeof value === 'object')
                    if (!getOwnPropertyDescriptor(value, 'critical')) {
                        var self = __webpack_require__.g;
                        defineProperty(value, 'critical', {
                            get: function () {
                                return self.critical;
                            },
                            set: function (value) {
                                self.critical = value;
                            },
                            enumerable: true,
                            configurable: false
                        });
                    }
            }
        });
        return Class;
    };

    // http://base.garant.ru/70133464/#ixzz4KaOTGI1l
    var IssuerSignTool = SEQUENCE({
        signTool: UTF8String,
        cATool: UTF8String,
        signToolCert: UTF8String,
        cAToolCert: UTF8String});

    /**
     * Extensions is a base class for extension attributes of certificates, CRLs, requests and etc.
     * 
     * @class GostASN1.Extensions
     * @extends GostASN1.Set
     */
    var Extensions = SEQUENCE_OF(Extension, {
        typeName: 'extnID',
        valueName: 'extnValue'
    });

    var CertExtensions = Extensions({
        authorityKeyIdentifier: AuthorityKeyIdentifier,
        subjectKeyIdentifier: KeyIdentifier,
        keyUsage: KeyUsage,
        privateKeyUsagePeriod: PrivateKeyUsagePeriod,
        certificatePolicies: SEQUENCE_OF(PolicyInformation),
        policyMappings: SEQUENCE_OF(PolicyMapping),
        subjectAltName: GeneralNames,
        issuerAltName: GeneralNames,
        subjectDirectoryAttributes: AttributeSequence,
        basicConstraints: BasicConstraints,
        nameConstraints: NameConstraints,
        policyConstraints: PolicyConstraints,
        extKeyUsage: ExtKeyUsageSyntax,
        cRLDistributionPoints: CRLDistributionPoints,
        inhibitAnyPolicy: SkipCerts,
        freshestCRL: FreshestCRL,
        authorityInfoAccess: SEQUENCE_OF(AccessDescription),
        subjectInfoAccess: SEQUENCE_OF(AccessDescription),
        subjectSignTool: UTF8String,
        issuerSignTool: IssuerSignTool
    }, function (id, value) {
        return id === 'keyUsage' ||
                (id === 'basicConstraints' && value.pathLenConstraint === undefined);
    });


    /*
     * Signature Values
     * 
     * http://tools.ietf.org/html/rfc5280
     * http://tools.ietf.org/html/rfc4491
     * 
     */

    /**
     * Gost Signature encode signature values for different GOST signatures
     * Support algorithms:
     * <pre>
     *  {
     *      'id-GostR3410-94': GostR3410Signature,
     *      'id-GostR3410-2001': GostR3410Signature,
     *      'id-tc26-gost3410-12-256': GostR3410Signature,
     *      'id-tc26-gost3410-12-512': GostR3410Signature,
     *      'id-GostR3411-94-with-GostR3410-2001': GostR3410Signature,
     *      'id-GostR3411-94-with-GostR3410-94': GostR3410Signature,
     *      'id-tc26-signwithdigest-gost3410-12-94': GostR3410Signature,
     *      'id-tc26-signwithdigest-gost3410-12-256': GostR3410Signature,
     *      'id-tc26-signwithdigest-gost3410-12-512': GostR3410Signature,
     *      'id-sc-gostR3410-94': ECDHSignature,
     *      'id-sc-gostR3410-2001': ECDHSignature,
     *      'id-sc-gostR3411-94-with-gostR3410-94': ECDHSignature,
     *      'id-sc-gostR3411-94-with-gostR3410-2001': ECDHSignature
     *  }
     * </pre>
     * 
     * @class GostASN1.GostSignature
     * @extends GostASN1.Sequence
     */

    // SignalCom signature
    var ECDHSignature = SEQUENCE({
        r: INTEGER,
        s: INTEGER});

    var GostR3410Signature = ANY;

    // Signature value (only need for CryptoPro
//    var GostSignature = extend(CHOICE({
//        ecdhSignature: ECDHSignature}, 'ecdhSignature'));
    var GostSignature = ECDHSignature;



    /*
     * Certificate
     * 
     * http://tools.ietf.org/html/rfc5280
     * 
     */

    /**
     * The sequence TBSCertificate contains information associated with the
     * subject of the certificate and the CA who issued it.  Every
     * TBSCertificate contains the names of the subject and issuer, a public
     * key associated with the subject, a validity period, a version number,
     * and a serial number; some MAY contain optional unique identifier
     * fields.  The remainder of this section describes the syntax and
     * semantics of these fields.  A TBSCertificate usually includes
     * extensions. 
     * <pre>
     *  TBSCertificate  ::=  SEQUENCE  {
     *       version         [0]  EXPLICIT Version DEFAULT v1,
     *       serialNumber         CertificateSerialNumber,
     *       signature            AlgorithmIdentifier,
     *       issuer               Name,
     *       validity             Validity,
     *       subject              Name,
     *       subjectPublicKeyInfo SubjectPublicKeyInfo,
     *       issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
     *                            -- If present, version MUST be v2 or v3
     *       subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
     *                            -- If present, version MUST be v2 or v3
     *       extensions      [3]  EXPLICIT Extensions OPTIONAL
     *                            -- If present, version MUST be v3
     *       }
     *
     *  Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
     *
     *  CertificateSerialNumber  ::=  INTEGER
     *
     *  Validity ::= SEQUENCE {
     *       notBefore      Time,
     *       notAfter       Time }
     *
     *  Time ::= CHOICE {
     *       utcTime        UTCTime,
     *       generalTime    GeneralizedTime }
     *
     *  UniqueIdentifier  ::=  BIT STRING
     *
     *  SubjectPublicKeyInfo  ::=  SEQUENCE  {
     *       algorithm            AlgorithmIdentifier,
     *       subjectPublicKey     BIT STRING  }
     *
     *  Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
     *
     *  Extension  ::=  SEQUENCE  {
     *       extnID      OBJECT IDENTIFIER,
     *       critical    BOOLEAN DEFAULT FALSE,
     *       extnValue   OCTET STRING  }
     * </pre>
     * See {@link GostASN1.Certificate} and {@link GostASN1.SubjectPublicKeyInfo}<br><br>
     * RFC 5280 references {@link http://tools.ietf.org/html/rfc5280} 
     * 
     * @class GostASN1.TBSCertificate
     * @extends GostASN1.Sequence
     * @extends GostASN1.Validity
     * @property {number} version The version of the encoded certificate
     * @property {(number|string)} serialNumber The serial number MUST be a positive integer assigned by the CA to each certificate.
     * @property {AlgorithmIdentifier} signature The algorithm identifier for the algorithm used by the CA to sign the certificate.
     * @property {GostASN1.Name} issuer The issuer field identifies the entity that has signed and issued the certificate.
     * @property {GostASN1.Validity} validity The certificate validity period
     * @property {GostASN1.Name} subject The subject field identifies the entity associated with the public key stored in the subject public key field.
     * @property {GostASN1.SubjectPublicKeyInfo} subject The public key and identify the algorithm with which the key is used
     * @property {CryptoOperationData} issuerUniqueID The issuer unique identifier
     * @property {CryptoOperationData} subjectUniqueID The subject unique identifier
     * @property {GostASN1.Extensions} extensions The extensions defined for X.509 v3 certificates
     */
    var TBSCertificate = COMBINE(SEQUENCE({
        version: CTX(0, EXPLICIT(Version)),
        serialNumber: CertificateSerialNumber,
        signature: SignatureAlgorithmIdentifier,
        issuer: Name,
        validity: Validity,
        subject: Name,
        subjectPublicKeyInfo: SubjectPublicKeyInfo,
        issuerUniqueID: OPTIONAL(CTX(1, IMPLICIT(UniqueIdentifier))), // If present, version MUST be v2 or v3        
        subjectUniqueID: OPTIONAL(CTX(2, IMPLICIT(UniqueIdentifier))), // If present, version MUST be v2 or v3
        extensions: OPTIONAL(CTX(3, EXPLICIT(CertExtensions)))})); // If present, version MUST be v3        

    /**
     * The X.509 v3 certificate basic syntax is as follows.  For signature
     * calculation, the data that is to be signed is encoded using the ASN.1
     * distinguished encoding rules (DER) [X.690].  ASN.1 DER encoding is a
     * tag, length, value encoding system for each element.
     * <pre>
     *  Certificate  ::=  SEQUENCE  {
     *       tbsCertificate       TBSCertificate,
     *       signatureAlgorithm   AlgorithmIdentifier,
     *       signatureValue       BIT STRING  }
     * </pre>
     * See {@link GostASN1.TBSCertificate}<br><br>
     * RFC 5280 references {@link http://tools.ietf.org/html/rfc5280} 
     * 
     * @class GostASN1.Certificate
     * @extends GostASN1.TBSCertificate
     * @property {GostASN1.TBSCertificate} tbsCertificate The sequence TBSCertificate
     * @property {AlgorithmIndentifier} signatureAlgorithm Identifies signature algorithm
     * @property {CryptoOperationData} signatureValue Signature value
     */
    var Certificate = SEQUENCE({
        tbsCertificate: TBSCertificate,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING}, 'CERTIFICATE');


    /*
     * Certification Request
     * 
     * http://tools.ietf.org/html/rfc2986
     * 
     */

    var ExtensionRequest = CertExtensions;

    var CRIAttributes = Attributes({
        challengePassword: SET_OF_SINGLE(DirectoryString),
        extensionRequest: SET_OF_SINGLE(ExtensionRequest),
        msCertExtensions: SET_OF_SINGLE(CertExtensions),
        extendedCertificateAttributes: SET_OF_SINGLE(Attributes)});

    /**
     * Certification request information shall have ASN.1 type CertificationRequestInfo:
     * <pre>
     *  CertificationRequestInfo ::= SEQUENCE {
     *       version       INTEGER { v1(0) } (v1,...),
     *       subject       Name,
     *       subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
     *       attributes    [0] Attributes{{ CRIAttributes }}
     *  }
     *
     *  SubjectPublicKeyInfo { ALGORITHM : IOSet} ::= SEQUENCE {
     *       algorithm        AlgorithmIdentifier {{IOSet}},
     *       subjectPublicKey BIT STRING
     *  }
     *
     *  PKInfoAlgorithms ALGORITHM ::= {
     *       ...  -- add any locally defined algorithms here -- }
     *
     *  Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}
     *
     *  CRIAttributes  ATTRIBUTE  ::= {
     *       ... -- add any locally defined attributes here -- }
     *
     *  Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
     *       type   ATTRIBUTE.&id({IOSet}),
     *       values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type})
     *  }
     * </pre>
     * See {@link GostASN1.CertificationRequest} and {@link GostASN1.SubjectPublicKeyInfo}<br><br>
     * RFC 2986 references {@link http://tools.ietf.org/html/rfc2986} 
     * 
     * @class GostASN1.CertificationRequestInfo
     * @extends GostASN1.Sequence
     * @property {number} version The version of the encoded request
     * @property {GostASN1.Name} subject The subject field identifies the entity associated with the public key stored in the subject public key field.
     * @property {GostASN1.SubjectPublicKeyInfo} subject The public key and identify the algorithm with which the key is used
     * @property {GostASN1.Attributes} attributes The request attributes
     */
    var CertificationRequestInfo = COMBINE(SEQUENCE({
        version: INTEGER,
        subject: Name,
        subjectPublicKeyInfo: SubjectPublicKeyInfo,
        attributes: CTX(0, IMPLICIT(CRIAttributes))}));

    /**
     * A certification request consists of three parts: "certification
     * request information," a signature algorithm identifier, and a digital
     * signature on the certification request information.  The
     * certification request information consists of the entity's
     * distinguished name, the entity's public key, and a set of attributes
     * providing other information about the entity.
     * <pre>
     *  A certification request shall have ASN.1 type CertificationRequest:
     *
     *  CertificationRequest ::= SEQUENCE {
     *       certificationRequestInfo CertificationRequestInfo,
     *       signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
     *       signature          BIT STRING
     *  }
     *
     *  AlgorithmIdentifier {ALGORITHM:IOSet } ::= SEQUENCE {
     *       algorithm          ALGORITHM.&id({IOSet}),
     *       parameters         ALGORITHM.&Type({IOSet}{@algorithm}) OPTIONAL
     *  }
     *
     *  SignatureAlgorithms ALGORITHM ::= {
     *       ... -- add any locally defined algorithms here -- }
     * </pre>
     * See {@link GostASN1.CertificationRequestInfo}
     * RFC 2986 references {@link http://tools.ietf.org/html/rfc2986} 
     * 
     * @class GostASN1.CertificationRequest
     * @extends GostASN1.CertificationRequestInfo
     * @property {GostASN1.CertificationRequestInfo} requestInfo Request information
     * @property {AlgorithmIndentifier} signatureAlgorithm Identifies signature algorithm
     * @property {CryptoOperationData} signatureValue Signature value
     */
    var CertificationRequest = SEQUENCE({
        requestInfo: CertificationRequestInfo,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING}, 'CERTIFICATE REQUEST');


    /*
     * Certificate Revocation List
     * 
     * http://tools.ietf.org/html/rfc5280
     * 
     */

    var CRLNumber = INTEGER;

    var CRLReason = ENUMERATED({
        unspecified: 0,
        keyCompromise: 1,
        cACompromise: 2,
        affiliationChanged: 3,
        superseded: 4,
        cessationOfOperation: 5,
        certificateHold: 6,
        removeFromCRL: 8,
        privilegeWithdrawn: 9,
        aACompromise: 10});

    var IssuingDistributionPoint = SEQUENCE({
        distributionPoint: OPTIONAL(CTX(0, EXPLICIT(DistributionPointName))), // DistributionPointName is CHOICE
        onlyContainsUserCerts: DEFAULT(CTX(1, IMPLICIT(BOOLEAN)), false),
        onlyContainsCACerts: DEFAULT(CTX(2, IMPLICIT(BOOLEAN)), false),
        onlySomeReasons: OPTIONAL(CTX(3, IMPLICIT(ReasonFlags))),
        indirectCRL: DEFAULT(CTX(4, IMPLICIT(BOOLEAN)), false),
        onlyContainsAttributeCerts: DEFAULT(CTX(5, IMPLICIT(BOOLEAN)), false)});

    var CLRExtensions = Extensions({
        authorityKeyIdentifier: AuthorityKeyIdentifier,
        issuerAltName: GeneralNames,
        cRLNumber: CRLNumber,
        deltaCRLIndicator: CRLNumber,
        issuingDistributionPoint: IssuingDistributionPoint,
        freshestCRL: FreshestCRL
    }, function (id) {
        return id === 'cRLNumber';
    });

    var CLREntryExtensions = Extensions({
        cRLReason: CRLReason,
        instructionCode: OBJECT_IDENTIFIER,
        invalidityDate: GeneralizedTime,
        certificateIssuer: GeneralNames});

    /**
     * This field is itself a sequence containing the name of the issuer, 
     * issue date, issue date of the next list, the optional list of revoked
     * certificates, and optional CRL extensions.  When there are no revoked
     * certificates, the revoked certificates list is absent.  When one or
     * more certificates are revoked, each entry on the revoked certificate
     * list is defined by a sequence of user certificate serial number,
     * revocation date, and optional CRL entry extensions.
     * <pre>
     *  TBSCertList  ::=  SEQUENCE  {
     *       version                 Version OPTIONAL,
     *                                    -- if present, MUST be v2
     *       signature               AlgorithmIdentifier,
     *       issuer                  Name,
     *       thisUpdate              Time,
     *       nextUpdate              Time OPTIONAL,
     *       revokedCertificates     SEQUENCE OF SEQUENCE  {
     *            userCertificate         CertificateSerialNumber,
     *            revocationDate          Time,
     *            crlEntryExtensions      Extensions OPTIONAL
     *                                          -- if present, MUST be v2
     *                                 }  OPTIONAL,
     *       crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
     *                                          -- if present, MUST be v2
     *                                 }
     * </pre>
     * See {@link GostASN1.CertificateList}<br><br>
     * RFC 5280 references {@link http://tools.ietf.org/html/rfc5280} 
     * 
     * @class GostASN1.TBSCertList
     * @extends GostASN1.Sequence
     * @property {number} version The version of the encoded CRL
     * @property {AlgorithmIdentifier} signature The algorithm identifier for the algorithm used to sign the CRL
     * @property {Name} issuer The issuer name identifies the entity that has signed and issued the CRL
     * @property {Date} thisUpdate The issue date of this CRL
     * @property {Date} nextUpdate The date by which the next CRL will be issued
     * @property {Array} revokedCertificates The revoked certificates are listed by their serial numbers
     * @property {Extensions} crlExtensions The CRL extensions
     */
    var TBSCertList = COMBINE(SEQUENCE({
        version: OPTIONAL(Version), // if present, MUST be v2
        signature: SignatureAlgorithmIdentifier,
        issuer: Name,
        thisUpdate: Time,
        nextUpdate: OPTIONAL(Time),
        revokedCertificates: OPTIONAL(SEQUENCE_OF(SEQUENCE({
            userCertificate: CertificateSerialNumber,
            revocationDate: Time,
            crlEntryExtensions: OPTIONAL(CLREntryExtensions) // if present, MUST be v2
        }))),
        crlExtensions: OPTIONAL(CTX(0, EXPLICIT(CLRExtensions)))})); // if present, MUST be v2

    /**
     * The X.509 v2 CRL syntax is as follows.  For signature calculation,
     * the data that is to be signed is ASN.1 DER encoded.  ASN.1 DER
     * encoding is a tag, length, value encoding system for each element.
     * <pre>
     *  CertificateList  ::=  SEQUENCE  {
     *       tbsCertList          TBSCertList,
     *       signatureAlgorithm   AlgorithmIdentifier,
     *       signatureValue       BIT STRING  }
     * </pre>
     * See {@link GostASN1.TBSCertList}<br><br>
     * RFC 5280 references {@link http://tools.ietf.org/html/rfc5280} 
     * 
     * @class GostASN1.CertificateList
     * @extends GostASN1.TBSCertList
     * @property {GostASN1.TBSCertList} tbsCertList The tbsCertList
     * @property {AlgorithmIndentifier} signatureAlgorithm Identifies signature algorithm
     * @property {CryptoOperationData} signatureValue Signature value
     */
    var CertificateList = SEQUENCE({
        tbsCertList: TBSCertList,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING}, 'CRL');


    /*
     * Attribute Certificate Definision
     * http://tools.ietf.org/html/rfc5755
     * 
     */

    var AttCertVersion = INTEGER;

    var ObjectDigestInfo = SEQUENCE({
        digestedObjectType: ENUMERATED({
            publicKey: 0,
            publicKeyCert: 1,
            otherObjectTypes: 2
        }), // otherObjectTypes MUST NOT be used in this profile
        otherObjectTypeID: OPTIONAL(OBJECT_IDENTIFIER),
        digestAlgorithm: DigestAlgorithmIdentifier,
        objectDigest: BIT_STRING});

    var IssuerSerial = SEQUENCE({
        issuer: GeneralNames,
        serial: CertificateSerialNumber,
        issuerUID: OPTIONAL(UniqueIdentifier)});

    var V2Form = SEQUENCE({
        issuerName: OPTIONAL(GeneralNames),
        baseCertificateID: OPTIONAL(CTX(0, IMPLICIT(IssuerSerial))),
        // issuerName MUST be present in this profile baseCertificateID and 
        // objectDigestInfo MUST NOT be present in this profile
        objectDigestInfo: OPTIONAL(CTX(1, IMPLICIT(ObjectDigestInfo)))});

    var TargetCert = SEQUENCE({
        targetCertificate: IssuerSerial,
        targetName: OPTIONAL(GeneralName),
        certDigestInfo: OPTIONAL(ObjectDigestInfo)});

    var Target = CHOICE({
        targetName: CTX(0, EXPLICIT(GeneralName)), // GeneralName is CHOICE
        targetGroup: CTX(1, EXPLICIT(GeneralName)),
        targetCert: CTX(2, IMPLICIT(TargetCert))});

    var Targets = SEQUENCE_OF(Target);

    var AttCertExtensions = Extensions({
        auditIdentity: OCTET_STRING,
        targetInformation: Targets,
        authorityKeyIdentifier: AuthorityKeyIdentifier,
        authorityInfoAccess: SEQUENCE_OF(AccessDescription),
        cRLDistributionPoints: CRLDistributionPoints,
        noRevAvail: NULL
    }, function (id) {
        return id === 'auditIdentity' || id === 'targetInformation';
    });

    var Holder = SEQUENCE({
        // the issuer and serial number of the holder's Public Key Certificate
        baseCertificateID: OPTIONAL(CTX(0, IMPLICIT(IssuerSerial))),
        // the name of the claimant or role
        entityName: OPTIONAL(CTX(1, IMPLICIT(GeneralNames))),
        // used to directly authenticate the holder, for example, an executable
        objectDigestInfo: OPTIONAL(CTX(2, IMPLICIT(ObjectDigestInfo)))});

    var AttCertIssuer = CHOICE({
        v1Form: GeneralNames, // MUST NOT be used in this profile
        v2Form: CTX(0, IMPLICIT(V2Form))}, 'v2Form');     // v2 only

    var AttCertValidityPeriod = SEQUENCE({
        notBeforeTime: GeneralizedTime,
        notAfterTime: GeneralizedTime});

    var SvceAuthInfo = SEQUENCE({
        service: GeneralName,
        ident: GeneralName,
        authInfo: OPTIONAL(OCTET_STRING)});

    var RoleSyntax = SEQUENCE({
        roleAuthority: OPTIONAL(CTX(0, IMPLICIT(GeneralNames))),
        roleName: CTX(1, EXPLICIT(GeneralName))}); // GeneralName is CHOICE

    var ClassList = BIT_STRING({
        unmarked: 0,
        unclassified: 1,
        restricted: 2,
        confidential: 3,
        secret: 4,
        topSecret: 5});

    var SecurityCategory = SEQUENCE({
        type: CTX(0, IMPLICIT(OBJECT_IDENTIFIER)),
        value: CTX(1, IMPLICIT(ANY))});

    var Clearance = SEQUENCE({
        policyId: CTX(0, IMPLICIT(OBJECT_IDENTIFIER)),
        classList: DEFAULT(CTX(1, IMPLICIT(ClassList)), ['unclassified']),
        securityCategories: OPTIONAL(CTX(2, IMPLICIT(SET_OF(SecurityCategory))))});

    var IetfAttrSyntax = SEQUENCE({
        policyAuthority: OPTIONAL(CTX(0, IMPLICIT(GeneralNames))),
        values: SEQUENCE_OF(CHOICE({
            octets: OCTET_STRING,
            oid: OBJECT_IDENTIFIER,
            string: UTF8String}, function (value) {
            return isBinary ? 'octets' : getIdentifier(value) ? 'oid' : 'string';
        }))});

    /**
     * X.509 Attribute Certificate Definition<br><br>
     * 
     * X.509 contains the definition of an AC given below.  All types that
     * are not defined in this document can be found in [PKIXPROF].
     * <pre>
     *           AttributeCertificateInfo ::= SEQUENCE {
     *                version              AttCertVersion -- version is v2,
     *                holder               Holder,
     *                issuer               AttCertIssuer,
     *                signature            AlgorithmIdentifier,
     *                serialNumber         CertificateSerialNumber,
     *                attrCertValidityPeriod   AttCertValidityPeriod,
     *                attributes           SEQUENCE OF Attribute,
     *                issuerUniqueID       UniqueIdentifier OPTIONAL,
     *                extensions           Extensions OPTIONAL
     *           }
     * <pre>
     * RFC 3281 references {@link http://tools.ietf.org/html/rfc3281} 
     * 
     * @class GostASN1.AttributeCertificateInfo
     * @extends GostASN1.Sequence
     * @property {number} version The version of the encoded certificate
     * @property {GostASN1.Name} holder Identifies the holder.
     * @property {GostASN1.Name} issuer Identifies the issuer.
     * @property {AlgorithmIdentifier} signature The algorithm identifier for the algorithm used by the CA to sign the certificate.
     * @property {(number|string)} serialNumber The serial number MUST be a positive integer assigned by the CA to each certificate.
     * @property {GostASN1.Validity} attrCertValidityPeriod The certificate validity period
     * @property {GostASN1.Attributes} attributes The certificate attributes
     * @property {CryptoOperationData} issuerUniqueID The issuer unique identifier
     * @property {GostASN1.Extensions} extensions The certificate extensions
     */
    var AttributeCertificateInfo = COMBINE(SEQUENCE({
        version: AttCertVersion, // version is v2,
        holder: Holder,
        issuer: AttCertIssuer,
        signature: SignatureAlgorithmIdentifier,
        serialNumber: CertificateSerialNumber,
        attrCertValidityPeriod: AttCertValidityPeriod,
        attributes: AttributeSequence({
            authenticationInfo: SET_OF(SvceAuthInfo),
            accessIdentity: SET_OF(SvceAuthInfo),
            chargingIdentity: SET_OF_SINGLE(IetfAttrSyntax),
            group: SET_OF_SINGLE(IetfAttrSyntax),
            role: SET_OF(RoleSyntax),
            clearance: SET_OF(Clearance)
        }),
        issuerUniqueID: OPTIONAL(UniqueIdentifier),
        extensions: OPTIONAL(AttCertExtensions)
    }));

    /**
     * Attribute Certificate Profile<br></br>
     *
     * ACs may be used in a wide range of applications and environments
     * covering a broad spectrum of interoperability goals and a broader
     * spectrum of operational and assurance requirements.  The goal of this
     * document is to establish a common baseline for generic applications
     * requiring broad interoperability and limited special purpose
     * requirements.  In particular, the emphasis will be on supporting the
     * use of attribute certificates for informal Internet electronic mail,
     * IPSec, and WWW applications.
     * <pre>
     *           AttributeCertificate ::= SEQUENCE {
     *                acinfo               AttributeCertificateInfo,
     *                signatureAlgorithm   AlgorithmIdentifier,
     *                signatureValue       BIT STRING
     *           }
     * </pre>
     * See {@link GostASN1.AttributeCertificateInfo}<br><br>
     * RFC 3281 references {@link http://tools.ietf.org/html/rfc3281} 
     * 
     * @class GostASN1.AttributeCertificate
     * @extends GostASN1.AttributeCertificateInfo
     * @property {GostASN1.AttributeCertificateInfo} acinfo Attribute certificate information
     * @property {AlgorithmIndentifier} signatureAlgorithm Identifies signature algorithm
     * @property {CryptoOperationData} signatureValue Signature value
     */
    var AttributeCertificate = SEQUENCE({
        acinfo: AttributeCertificateInfo,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING}, 'ATTRIBUTE CERTIFICATE');


    /*
     * Encrypted Key with CMS
     * 
     * http://tools.ietf.org/html/rfc5652
     * http://tools.ietf.org/html/rfc4490
     * 
     */

    // RecipientInfo
    var EncryptedKey = OCTET_STRING;

    var EncryptedContent = OCTET_STRING;

    var SubjectKeyIdentifier = OCTET_STRING;

    var UserKeyingMaterial = OCTET_STRING;

    var ECCCMSSharedInfo = SEQUENCE({
        keyInfo: KeyWrapAlgorithmIdentifier,
        entityUInfo: OPTIONAL(CTX(0, EXPLICIT(OCTET_STRING))),
        suppPubInfo: CTX(2, EXPLICIT(OCTET_STRING))
    });

    // GOST Key Transport & Key agreement rfc4490
    var Gost2814789EncryptedKey = ENCLOSURE(SEQUENCE({
        encryptedKey: Gost2814789Key,
        maskKey: OPTIONAL(CTX(0, IMPLICIT(Gost2814789Key))),
        macKey: Gost2814789MAC
    }), {
        encode: function (value) {
            // wrappedKey: (CEK_ENC(32) | CEK_MAC(4))
            var encryptedKey = new Uint8Array(new Uint8Array(value, 0, 32)).buffer,
                    macKey = new Uint8Array(new Uint8Array(value, 32, 4)).buffer;
            return {// from wrapped key
                encryptedKey: encryptedKey,
                macKey: macKey
            };
        },
        decode: function (value) {
            var encryptedKey = value.encryptedKey,
                    maskKey = value.maskKey,
                    macKey = value.macKey;
            if (maskKey) {
                var m = new Int32Array(maskKey), k = new Int32Array(encryptedKey);
                for (var i = 0, n = m.length / k.length; i < n; i++) {
                    for (var j = 0, l = k.length; j < l; j++)
                        k[j] = (k[j] + m[l * i + j]) & 0xffffffff;
                }
            }
            var result = new Uint8Array(encryptedKey.byteLength + macKey.byteLength);
            result.set(new Uint8Array(encryptedKey), 0);
            result.set(new Uint8Array(macKey), 32);
            return result.buffer;
        }
    });


    var GostR3410TransportParameters = SEQUENCE({
        encryptionParamSet: Gost2814789ParamSet,
        ephemeralPublicKey: OPTIONAL(CTX(0, IMPLICIT(GostSubjectPublicKeyInfo))),
        ukm: OCTET_STRING}); // ( SIZE(8) )

    var GostR3410KeyTransport = ENCLOSURE(SEQUENCE({
        sessionEncryptedKey: Gost2814789EncryptedKey,
        transportParameters: OPTIONAL(CTX(0, IMPLICIT(GostR3410TransportParameters)))
    }), {
        encode: function (value) {
            var algorithm = value.algorithm;
            return {
                sessionEncryptedKey: value.sessionEncryptedKey,
                transportParameters: {
                    encryptionParamSet: attributes['sBox'][algorithm.wrapping.sBox || 'E-A'],
                    ephemeralPublicKey: algorithm['public'],
                    ukm: algorithm.ukm
                }
            };
        },
        decode: function (value) {
            return {
                algorithm: {
                    wrapping: parameters[value.transportParameters.encryptionParamSet],
                    ukm: value.transportParameters.ukm,
                    'public': value.transportParameters.ephemeralPublicKey
                },
                sessionEncryptedKey: value.sessionEncryptedKey
            };
        }
    });

    var SCGostKeyTransport = ENCLOSURE(SEQUENCE({
        sessionEncryptedKey: Gost2814789EncryptedKey,
        ukm: SEQUENCE({
            ephemeralPublicKey: GostSubjectPublicKeyInfo,
            addedukm: OPTIONAL(CTX(0, EXPLICIT(UserKeyingMaterial)))})
    }), {
        encode: function (value) {
            var algorithm = value.algorithm;
            return {
                sessionEncryptedKey: value.sessionEncryptedKey,
                ukm: {
                    ephemeralPublicKey: algorithm['public'],
                    addedukm: algorithm.ukm
                }
            };
        },
        decode: function (value) {
            return {
                algorithm: {
                    ukm: value.ukm.addedukm,
                    'public': value.ukm.ephemeralPublicKey
                },
                sessionEncryptedKey: value.sessionEncryptedKey
            };
        }
    });

    var GostEncryptedKey = (function (typeSet) {
        /**
         * Gost Encrypted key encoder for CMS
         * 
         * @class GostASN1.GostEncryptedKey
         * @extends GostASN1.Sequence
         * @param {AlgorithmIdentifier} algorithm
         */
        return function (algorithm) {
            var type = typeSet[algorithm.id];
            return type ? ENCAPSULATES(type) : ANY;
        };
    })({
        // Key transport algorithms
        'id-sc-gostR3410-2001': SCGostKeyTransport,
        'id-sc-gostR3410-94': SCGostKeyTransport,
        'id-GostR3410-2001': GostR3410KeyTransport,
        'id-GostR3410-94': GostR3410KeyTransport,
        'id-tc26-gost3410-12-256': GostR3410KeyTransport,
        'id-tc26-gost3410-12-512': GostR3410KeyTransport,
        // Key agreement algorithms
        'id-GostR3410-94-CryptoPro-ESDH': Gost2814789EncryptedKey,
        'id-GostR3410-2001-CryptoPro-ESDH': Gost2814789EncryptedKey,
        'id-tc26-agreement-gost-3410-12-256': Gost2814789EncryptedKey,
        'id-tc26-agreement-gost-3410-12-512': Gost2814789EncryptedKey,
        'id-sc-r3410-ESDH-r3411kdf': Gost2814789EncryptedKey,
        // Key encryption key algorithms
        'id-Gost28147-89-None-KeyWrap': Gost2814789EncryptedKey,
        'id-Gost28147-89-CryptoPro-KeyWrap': Gost2814789EncryptedKey,
        'id-sc-cmsGostWrap': Gost2814789EncryptedKey,
        'id-sc-cmsGost28147Wrap': Gost2814789EncryptedKey});



    /*
     * CryptoPro Gost Private Key Store
     */

    var GostKeyContainerContentAttributes = BIT_STRING({
        kccaSoftPassword: 0,
        kccaReservePrimary: 1,
        kccaPrimaryKeyAbsent: 2,
        kccaFKCShared: 3});

    var GostPrivateKeyAttributes = BIT_STRING({
        pkaExportable: 0,
        pkaUserProtect: 1,
        pkaExchange: 2,
        pkaEphemeral: 3,
        pkaNonCachable: 4,
        pkaDhAllowed: 5
    });

    var GostPrivateKeyParameters = SEQUENCE({
        attributes: OPTIONAL(GostPrivateKeyAttributes),
        privateKeyAlgorithm: OPTIONAL(CTX(0, IMPLICIT(KeyAlgorithmIdentifier)))
    });

    var CertificateLink = SEQUENCE({
        path: IA5String,
        hmac: Gost2814789MAC
    });

    var PasswordPolicy = AlgorithmIdentifier;

    var GostKeyContainerContent = SEQUENCE({
        containerAlgoritmIdentifier: OPTIONAL(CTX(0, IMPLICIT(AlgorithmIdentifier))),
        containerName: OPTIONAL(IA5String),
        attributes: GostKeyContainerContentAttributes,
        primaryPrivateKeyParameters: GostPrivateKeyParameters,
        hmacPassword: OPTIONAL(CTX(2, IMPLICIT(Gost2814789MAC))),
        secondaryEncryptedPrivateKey: OPTIONAL(CTX(3, IMPLICIT(Gost2814789EncryptedKey))),
        secondaryPrivateKeyParameters: OPTIONAL(CTX(4, IMPLICIT(GostPrivateKeyParameters))),
        primaryCertificate: OPTIONAL(CTX(5, IMPLICIT(OCTET_STRING(ENCAPSULATES(Certificate))))),
        secondaryCertificate: OPTIONAL(CTX(6, IMPLICIT(OCTET_STRING(ENCAPSULATES(Certificate))))),
        encryptionContainerName: OPTIONAL(CTX(7, IMPLICIT(IA5String))),
        primaryCertificateLink: OPTIONAL(CTX(8, IMPLICIT(CertificateLink))),
        secondaryCertificateLink: OPTIONAL(CTX(9, IMPLICIT(CertificateLink))),
        primaryFP: OPTIONAL(CTX(10, IMPLICIT(OCTET_STRING))),
        secondaryFP: OPTIONAL(CTX(11, IMPLICIT(OCTET_STRING))),
        passwordPolicy: OPTIONAL(PasswordPolicy),
        containerSecurityLevel: OPTIONAL(INTEGER),
        extensions: OPTIONAL(CTX(12, IMPLICIT(Extensions({
            keyValidity: SEQUENCE({
                notBefore: OPTIONAL(CTX(0, IMPLICIT(GeneralizedTime))),
                notAfter: OPTIONAL(CTX(1, IMPLICIT(GeneralizedTime)))})
        })))),
        secondaryEncryptionContainerName: OPTIONAL(CTX(13, IMPLICIT(IA5String)))
    });

    /**
     * CryptoPro key container header
     * 
     * @class GostASN1.GostKeyContainer
     * @extends GostASN1.Sequence
     */
    var GostKeyContainer = SEQUENCE({
        keyContainerContent: GostKeyContainerContent,
        hmacKeyContainerContent: Gost2814789MAC
    });

    /**
     * CryptoPro key container name
     * 
     * @class GostASN1.GostKeyContainerName
     * @extends GostASN1.Sequence
     */
    var GostKeyContainerName = SEQUENCE({
        containerName: IA5String,
        extElem1: OPTIONAL(ANY)
    });

    /**
     * PrivateKey encrypted content for CryptoPro key containers
     * 
     * @class GostASN1.GostPrivateKeys
     * @extends GostASN1.Sequence
     */
    var GostPrivateKeys = SEQUENCE({
        primaryKey: Gost2814789Key,
        secondaryKey: OPTIONAL(Gost2814789Key),
        hmacKey: OPTIONAL(Gost2814789MAC)
    });

    /**
     * PrivateKey masks for CryptoPro key containers
     * 
     * @class GostASN1.GostPrivateMasks
     * @extends GostASN1.Sequence
     */
    var GostPrivateMasks = SEQUENCE({
        mask: Gost2814789Key,
        randomStatus: OCTET_STRING,
        hmacRandom: Gost2814789MAC
    });



    /*
     * ViPNet Gost Private Key Store
     */

    var ViPNetKeyInfo = SEQUENCE({
        keyClass: INTEGER,
        keyType: INTEGER,
        algorithm: OPTIONAL(CTX(0, EXPLICIT(KeyAlgorithmIdentifier))),
        serialNumber: OPTIONAL(CTX(1, EXPLICIT(OCTET_STRING))),
        addSerialNumber: OPTIONAL(CTX(2, EXPLICIT(OCTET_STRING))),
        certSerialNumber: OPTIONAL(CTX(3, EXPLICIT(OCTET_STRING))),
        subjectUID: OPTIONAL(CTX(4, EXPLICIT(OCTET_STRING))),
        recipientUID: OPTIONAL(CTX(5, EXPLICIT(OCTET_STRING))),
        validity: OPTIONAL(CTX(6, EXPLICIT(CHOICE({
            validity: Validity,
            keyValidity: SEQUENCE({
                notBefore: OPTIONAL(CTX(0, IMPLICIT(GeneralizedTime))),
                notAfter: OPTIONAL(CTX(1, IMPLICIT(GeneralizedTime)))})
        }, function () {
            return 'keyValidity';
        })))),
        keyUID: OPTIONAL(CTX(7, EXPLICIT(BIT_STRING))),
        flags: OPTIONAL(CTX(10, EXPLICIT(INTEGER)))
    });

    /**
     * ViPNet key container info
     * 
     * @class GostASN1.ViPNetInfo
     * @extends GostASN1.Sequence
     */
    var ViPNetInfo = SEQUENCE({
        version: INTEGER,
        keyInfo: ViPNetKeyInfo,
        defenceKeyInfo: ViPNetKeyInfo,
        certificate: OPTIONAL(CTX(0, EXPLICIT(Certificate))),
        publicKey: OPTIONAL(CTX(1, EXPLICIT(OCTET_STRING)))
    });



    /*
     * Cryptographic Message Syntax
     * 
     * http://tools.ietf.org/html/rfc5652
     * 
     */

    // CMS signed data
    var CMSVersion = INTEGER;

    var ContentType = OBJECT_IDENTIFIER;

    var SigningTime = Time;

    var SubjectKeyIdentifier = OCTET_STRING;

    var Digest = OCTET_STRING;

    var MessageAuthenticationCode = OCTET_STRING;

    var BodyPartID = INTEGER;

    var BodyPartPath = SEQUENCE_OF(BodyPartID);

    var CMCUnsignedData = SEQUENCE({
        bodyPartPath: BodyPartPath,
        identifier: OBJECT_IDENTIFIER,
        content: ANY}); // DEFINED BY identifier
    /**
     * SignedAttributes is a collection of attributes that are signed.  The
     * field is optional, but it MUST be present if the content type of
     * the EncapsulatedContentInfo value being signed is not id-data.
     * SignedAttributes MUST be DER encoded, even if the rest of the
     * structure is BER encoded.  Useful attribute types, such as signing
     * time, are defined in Section 11.  If the field is present, it MUST
     * contain, at a minimum, the following two attributes: <br>
     *
     * A content-type attribute having as its value the content type
     * of the EncapsulatedContentInfo value being signed.  Section
     * 11.1 defines the content-type attribute.  However, the
     * content-type attribute MUST NOT be used as part of a
     * countersignature unsigned attribute as defined in Section 11.4.<br>
     *
     * A message-digest attribute, having as its value the message
     * digest of the content.  Section 11.2 defines the message-digest
     * attribute.
     * 
     * @class GostASN1.SignedAttributes
     * @extends GostASN1.Attributes
     */
    var SignedAttributes = Attributes({
        contentType: SET_OF_SINGLE(ContentType),
        signingTime: SET_OF_SINGLE(SigningTime),
        messageDigest: SET_OF_SINGLE(OCTET_STRING)});

    var UnsignedAttributes = Attributes(function (type) {
        /**
         * UnsignedAttributes is a collection of attributes that are not signed.
         * The field is optional.  Useful attribute types, such as
         * countersignatures.
         * 
         * @class GostASN1.UnsignedAttributes
         * @extends GostASN1.Attributes
         */
        //    var UnsignedAttributes = Attributes({
        //        countersignature: SET_OF(Countersignature), // -- check forward
        //        unsignedData: SET_OF(CMCUnsignedData)
        //    });
        return ({
            countersignature: SET_OF(Countersignature), // recursion
            unsignedData: SET_OF(CMCUnsignedData)
        })[type];
    });

    var AuthAttributes = SignedAttributes,
            UnauthAttributes = Attributes,
            UnprotectedAttributes = Attributes;

    var IssuerAndSerialNumber = SEQUENCE({
        issuer: Name,
        serialNumber: CertificateSerialNumber});

    var SignerIdentifier = CHOICE({
        issuerAndSerialNumber: IssuerAndSerialNumber,
        subjectKeyIdentifier: CTX(0, IMPLICIT(SubjectKeyIdentifier))}, function (value) {
        return isBinary(value) ? 'subjectKeyIdentifier' : 'issuerAndSerialNumber';
    });

    var SignerInfo = SEQUENCE({
        version: CMSVersion,
        sid: SignerIdentifier,
        digestAlgorithm: DigestAlgorithmIdentifier,
        signedAttrs: OPTIONAL(CTX(0, IMPLICIT(SignedAttributes))),
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: OCTET_STRING,
        unsignedAttrs: OPTIONAL(CTX(1, IMPLICIT(UnsignedAttributes)))});

    var Countersignature = SignerInfo,
            SignerInfos = SET_OF(SignerInfo),
            DigestAlgorithmIdentifiers = SET_OF(DigestAlgorithmIdentifier),
            AttributeCertificateV2 = AttributeCertificate;

    var ExtendedCertificateInfo = COMBINE(SEQUENCE({
        version: CMSVersion,
        certificate: Certificate,
        attributes: UnauthAttributes}));

    var ExtendedCertificate = SEQUENCE({
        extendedCertificateInfo: ExtendedCertificateInfo,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING});

    var OtherCertificateFormat = SEQUENCE({
        otherCertFormat: OBJECT_IDENTIFIER,
        otherCert: ANY});

    var AttributeCertificateInfoV1 = COMBINE(SEQUENCE({
        version: INTEGER,
        subject: CHOICE({
            baseCertificateID: CTX(0, IMPLICIT(IssuerSerial)), // associated with a Public Key Certificate
            subjectName: CTX(1, IMPLICIT(GeneralNames))}, function (value) {
            return value.issuer ? 'baseCertificateID' : 'subjectName';
        }), //associated with a name
        issuer: GeneralNames,
        signature: SignatureAlgorithmIdentifier,
        serialNumber: CertificateSerialNumber,
        attCertValidityPeriod: AttCertValidityPeriod,
        attributes: AttributeSequence,
        issuerUniqueID: OPTIONAL(UniqueIdentifier),
        extensions: OPTIONAL(CertExtensions)}));

    var AttributeCertificateV1 = SEQUENCE({
        acInfo: AttributeCertificateInfoV1,
        signatureAlgorithm: SignatureAlgorithmIdentifier,
        signatureValue: BIT_STRING});

    var EncapsulatedContentInfo = SEQUENCE({
        eContentType: ContentType,
        eContent: OPTIONAL(CTX(0, EXPLICIT(OCTET_STRING)))});

    var CertificateChoices = CHOICE({
        certificate: Certificate,
        extendedCertificate: CTX(0, IMPLICIT(ExtendedCertificate)), // Obsolete
        v1AttrCert: CTX(1, IMPLICIT(AttributeCertificateV1)), // Obsolete
        v2AttrCert: CTX(2, IMPLICIT(AttributeCertificateV2)),
        other: CTX(3, IMPLICIT(OtherCertificateFormat))}, function (value) {
        return value.holder ? 'AttributeCertificateV2' : value.certificate ?
                'ExtendedCertificate' : value.otherCertFormat ? 'other' :
                'certificate';
    });

    var OtherRevocationInfoFormat = SEQUENCE({
        otherRevInfoFormat: OBJECT_IDENTIFIER,
        otherRevInfo: ANY});

    var RevocationInfoChoice = CHOICE({
        crl: CertificateList,
        other: CTX(1, IMPLICIT(OtherRevocationInfoFormat))}, function (value) {
        return value.otherRevInfoFormat ? 'other' : 'crl';
    });

    var CertificateSet = SET_OF(CertificateChoices),
            RevocationInfoChoices = SET_OF(RevocationInfoChoice);

    /**
     * The signed-data content type consists of a content of any type and zero or more 
     * signature values.  Any number of signers in parallel can sign any type of content.<br><br>
     * 
     * The signed-data content type shall have ASN.1 type SignedData:<br><br>
     *<pre>
     *
     *      SignedData ::= SEQUENCE {
     *        version CMSVersion,
     *        digestAlgorithms DigestAlgorithmIdentifiers,
     *        encapContentInfo EncapsulatedContentInfo,
     *        certificates [0] IMPLICIT CertificateSet OPTIONAL,
     *        crls [1] IMPLICIT RevocationInfoChoices OPTIONAL,
     *        signerInfos SignerInfos }
     *
     *      DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
     *
     *      SignerInfos ::= SET OF SignerInfo
     *      
     *       EncapsulatedContentInfo ::= SEQUENCE {
     *        eContentType ContentType,
     *        eContent [0] EXPLICIT OCTET STRING OPTIONAL }
     *        
     *</pre>
     * Per-signer information is represented in the type SignerInfo:<br><br>
     *<pre>
     *
     *      SignerInfo ::= SEQUENCE {
     *        version CMSVersion,
     *        sid SignerIdentifier,
     *        digestAlgorithm DigestAlgorithmIdentifier,
     *        signedAttrs [0] IMPLICIT SignedAttributes OPTIONAL,
     *        signatureAlgorithm SignatureAlgorithmIdentifier,
     *        signature SignatureValue,
     *        unsignedAttrs [1] IMPLICIT UnsignedAttributes OPTIONAL }
     *
     *      SignerIdentifier ::= CHOICE {
     *        issuerAndSerialNumber IssuerAndSerialNumber,
     *        subjectKeyIdentifier [0] SubjectKeyIdentifier }
     *
     *      SignedAttributes ::= SET SIZE (1..MAX) OF Attribute
     *
     *      UnsignedAttributes ::= SET SIZE (1..MAX) OF Attribute
     *
     *     SignatureValue ::= OCTET STRING
     *     
     *</pre>
     * See also {@link GostASN1.SignedAttributes} and {@link GostASN1.UnsignedAttributes}
     * @class GostASN1.SignedData
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number
     * @property {AlgorithmIdentifier[]} digestAlgorithms Collection of message digest algorithm identifiers
     * @property {GostASN1.Sequence} encapContentInfo The content is represented in the type EncapsulatedContentInfo
     * @property {GostASN1.Certificate[]} certificates Certificates
     * @property {GostASN1.CertificateList[]} crls Certificates
     * @property {GostASN1.Sequence[]} signerInfos The Signer information
     */
    var SignedData = SEQUENCE({
        version: CMSVersion,
        digestAlgorithms: DigestAlgorithmIdentifiers,
        encapContentInfo: EncapsulatedContentInfo,
        certificates: OPTIONAL(CTX(0, IMPLICIT(CertificateSet))),
        crls: OPTIONAL(CTX(1, IMPLICIT(RevocationInfoChoices))),
        signerInfos: SignerInfos});

    var RecipientIdentifier = CHOICE({
        issuerAndSerialNumber: IssuerAndSerialNumber,
        subjectKeyIdentifier: CTX(0, IMPLICIT(SubjectKeyIdentifier))}, function (value) {
        return isBinary(value) ? 'subjectKeyIdentifier' : 'issuerAndSerialNumber';
    });

    var KeyTransRecipientInfo = SEQUENCE({
        version: CMSVersion, // always set to 0 or 2
        rid: RecipientIdentifier,
        keyEncryptionAlgorithm: KeyEncryptionAlgorithmIdentifier,
        encryptedKey: EncryptedKey});

    var OtherKeyAttribute = SEQUENCE({
        keyAttrId: OBJECT_IDENTIFIER,
        keyAttr: OPTIONAL(ANY)});

    var RecipientKeyIdentifier = SEQUENCE({
        subjectKeyIdentifier: SubjectKeyIdentifier,
        date: OPTIONAL(GeneralizedTime),
        other: OPTIONAL(OtherKeyAttribute)});

    var KeyAgreeRecipientIdentifier = CHOICE({
        issuerAndSerialNumber: IssuerAndSerialNumber,
        rKeyId: CTX(0, IMPLICIT(RecipientKeyIdentifier))}, function (value) {
        return isBinary(value) ? 'rKeyId' : 'issuerAndSerialNumber';
    });

    var RecipientEncryptedKey = SEQUENCE({
        rid: KeyAgreeRecipientIdentifier,
        encryptedKey: EncryptedKey});

    var RecipientEncryptedKeys = SEQUENCE_OF(RecipientEncryptedKey);

    var OriginatorPublicKey = SEQUENCE({
        algorithm: KeyAlgorithmIdentifier,
        publicKey: BIT_STRING});

    var MQVuserKeyingMaterial = SEQUENCE({// ECC rfc5753 KeyAgreeRecipientInfo in ukm
        ephemeralPublicKey: OriginatorPublicKey,
        addedukm: OPTIONAL(CTX(0, EXPLICIT(UserKeyingMaterial)))
    });

    var OriginatorIdentifierOrKey = CHOICE({
        issuerAndSerialNumber: IssuerAndSerialNumber,
        subjectKeyIdentifier: CTX(0, IMPLICIT(SubjectKeyIdentifier)),
        originatorKey: CTX(1, IMPLICIT(OriginatorPublicKey))}, function (value) {
        return isBinary(value) ? 'subjectKeyIdentifier' : value.algorithm ?
                'originatorKey' : 'issuerAndSerialNumber';
    });

    var KeyAgreeRecipientInfo = SEQUENCE({
        version: CMSVersion, // always set to 3
        originator: CTX(0, EXPLICIT(OriginatorIdentifierOrKey)),
        ukm: OPTIONAL(CTX(1, EXPLICIT(UserKeyingMaterial))),
        keyEncryptionAlgorithm: KeyEncryptionAlgorithmIdentifier,
        recipientEncryptedKeys: RecipientEncryptedKeys});

    var KEKIdentifier = SEQUENCE({
        keyIdentifier: OCTET_STRING,
        date: OPTIONAL(GeneralizedTime),
        other: OPTIONAL(OtherKeyAttribute)});

    var KEKRecipientInfo = SEQUENCE({
        version: CMSVersion, // always set to 4
        kekid: KEKIdentifier,
        keyEncryptionAlgorithm: KeyEncryptionAlgorithmIdentifier,
        encryptedKey: EncryptedKey});

    var PasswordRecipientInfo = SEQUENCE({
        version: CMSVersion, // always set to 0
        friendlyName: OPTIONAL(CTX(0, IMPLICIT(KeyDerivationAlgorithmIdentifier))),
        keyEncryptionAlgorithm: KeyEncryptionAlgorithmIdentifier,
        encryptedKey: EncryptedKey});

    var OtherRecipientInfo = SEQUENCE({
        oriType: OBJECT_IDENTIFIER,
        oriValue: ANY});

    var RecipientInfo = CHOICE({
        ktri: KeyTransRecipientInfo,
        kari: CTX(1, IMPLICIT(KeyAgreeRecipientInfo)),
        kekri: CTX(2, IMPLICIT(KEKRecipientInfo)),
        pwri: CTX(3, IMPLICIT(PasswordRecipientInfo)),
        ori: CTX(4, IMPLICIT(OtherRecipientInfo))}, function (value) {
        return value.rid ? 'ktri' : value.originator ? 'kari' :
                value.kekid ? 'kekri' : value.oriType ? 'ori' : 'pwri';
    });

    var OriginatorInfo = SEQUENCE({
        certs: OPTIONAL(CTX(0, IMPLICIT(CertificateSet))),
        crls: OPTIONAL(CTX(1, IMPLICIT(RevocationInfoChoices)))});

    var RecipientInfos = SET_OF(RecipientInfo);

    // EncryptedContentInfo
    var EncryptedContentInfo = SEQUENCE({
        contentType: ContentType,
        contentEncryptionAlgorithm: ContentEncryptionAlgorithmIdentifier,
        encryptedContent: OPTIONAL(CTX(0, IMPLICIT(EncryptedContent)))});

    /**
     * The enveloped-data content type consists of an encrypted content of 
     * any type and encrypted content-encryption keys for one or more
     * recipients.  The combination of the encrypted content and one
     * encrypted content-encryption key for a recipient is a "digital
     * envelope" for that recipient.  Any type of content can be enveloped
     * for an arbitrary number of recipients using any of the supported key
     * management techniques for each recipient.<br><br>   
     * 
     * The typical application of the enveloped-data content type will
     * represent one or more recipients' digital envelopes on content of the
     * data or signed-data content types.<br><br>
     * <pre>
     * 
     *      EnvelopedData ::= SEQUENCE {
     *        version CMSVersion,
     *        originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
     *        recipientInfos RecipientInfos,
     *        encryptedContentInfo EncryptedContentInfo,
     *        unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
     * 
     *      OriginatorInfo ::= SEQUENCE {
     *        certs [0] IMPLICIT CertificateSet OPTIONAL,
     *        crls [1] IMPLICIT RevocationInfoChoices OPTIONAL }
     *
     *      RecipientInfos ::= SET SIZE (1..MAX) OF RecipientInfo
     *
     *      EncryptedContentInfo ::= SEQUENCE {
     *        contentType ContentType,
     *        contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
     *        encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
     *
     *      EncryptedContent ::= OCTET STRING
     *
     *      UnprotectedAttributes ::= SET SIZE (1..MAX) OF Attribute
     *      
     * </pre>
     * @class GostASN1.EnvelopedData
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number
     * @property {GostASN1.Sequence} originatorInfo Optionally provides information about the originator.
     * @property {GostASN1.Sequence[]} recipientInfos Collection of per-recipient information. 
     * @property {GostASN1.Sequence} encryptedContentInfo The content is represented in the type EncryptedContentInfo
     * @property {Attributes} unprotectedAttrs The unprotected attributes
     */
    var EnvelopedData = SEQUENCE({
        version: CMSVersion,
        originatorInfo: OPTIONAL(CTX(0, IMPLICIT(OriginatorInfo))),
        recipientInfos: RecipientInfos,
        encryptedContentInfo: EncryptedContentInfo,
        unprotectedAttrs: OPTIONAL(CTX(1, IMPLICIT(UnprotectedAttributes)))});

    /**
     * The digested-data content type consists of content of any type and a
     * message digest of the content.<br><br>
     * Typically, the digested-data content type is used to provide content
     * integrity, and the result generally becomes an input to the
     * enveloped-data content type.<br><br>
     * <pre>
     * 
     *      DigestedData ::= SEQUENCE {
     *        version CMSVersion,
     *        digestAlgorithm DigestAlgorithmIdentifier,
     *        encapContentInfo EncapsulatedContentInfo,
     *        digest Digest }
     *
     *      Digest ::= OCTET STRING
     *      
     *</pre>
     * @class GostASN1.DigestedData
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number
     * @property {AlgorithmIdentifier} digestAlgorithm Message digest algorithm identifier
     * @property {GostASN1.Sequence} encapContentInfo The content is represented in the type EncapsulatedContentInfo
     * @property {CryptoOperationData} digest The degist
     */
    var DigestedData = SEQUENCE({
        version: CMSVersion,
        digestAlgorithm: DigestAlgorithmIdentifier,
        encapContentInfo: EncapsulatedContentInfo,
        digest: Digest});

    /**
     * The encrypted-data content type consists of encrypted content of any
     * type.  Unlike the enveloped-data content type, the encrypted-data
     * content type has neither recipients nor encrypted content-encryption
     * keys.  Keys MUST be managed by other means.<br><br>
     * 
     * The typical application of the encrypted-data content type will be to
     * encrypt the content of the data content type for local storage,
     * perhaps where the encryption key is derived from a password.<br><br>
     * <pre>
     * 
     *      EncryptedData ::= SEQUENCE {
     *        version CMSVersion,
     *        encryptedContentInfo EncryptedContentInfo,
     *        unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
     *        
     *      EncryptedContentInfo ::= SEQUENCE {
     *        contentType ContentType,
     *        contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
     *        encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL }
     *
     *      EncryptedContent ::= OCTET STRING
     *      
     * </pre>
     * @class GostASN1.EncryptedData
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number
     * @property {GostASN1.Sequence} encryptedContentInfo The content is represented in the type EncryptedContentInfo
     * @property {Attributes} unprotectedAttrs The unprotected attributes
     */
    var EncryptedData = SEQUENCE({
        version: CMSVersion,
        encryptedContentInfo: EncryptedContentInfo,
        unprotectedAttrs: OPTIONAL(CTX(1, IMPLICIT(UnprotectedAttributes)))});

    /**
     * The authenticated-data content type consists of content of any type, 
     * a message authentication code (MAC), and encrypted authentication   
     * keys for one or more recipients.  The combination of the MAC and one
     * encrypted authentication key for a recipient is necessary for that
     * recipient to verify the integrity of the content.  Any type of
     * content can be integrity protected for an arbitrary number of
     * recipients.<br><br>
     * <pre>
     * 
     *      AuthenticatedData ::= SEQUENCE {
     *        version CMSVersion,
     *        originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
     *        recipientInfos RecipientInfos,
     *        macAlgorithm MessageAuthenticationCodeAlgorithm,
     *        digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
     *        encapContentInfo EncapsulatedContentInfo,
     *        authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
     *        mac MessageAuthenticationCode,
     *        unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
     *
     *      AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
     *
     *      UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
     *
     *      MessageAuthenticationCode ::= OCTET STRING
     *
     * </pre>
     * @class GostASN1.AuthenticatedData
     * @extends GostASN1.Sequence
     * @property {number} version The syntax version number
     * @property {GostASN1.Sequence} originatorInfo Optionally provides information about the originator.
     * @property {GostASN1.Sequence[]} recipientInfos Collection of per-recipient information. 
     * @property {AlgorithmIdentifier} macAlgorithm Identifies the Message Authentication Code algorithm 
     * @property {AlgorithmIdentifier} digestAlgorithm Identifies the Digest algorithm 
     * @property {GostASN1.Sequence} encapContentInfo The content is represented in the type EncapsulatedContentInfo
     * @property {Attributes} authAttrs The autheniticated attributes
     * @property {CryptoOpertionData} mac The Message Authentication Code
     * @property {Attributes} unauthAttrs The unautheniticated attributes
     */
    var AuthenticatedData = SEQUENCE({
        version: CMSVersion,
        originatorInfo: OPTIONAL(CTX(0, IMPLICIT(OriginatorInfo))),
        recipientInfos: RecipientInfos,
        macAlgorithm: MessageAuthenticationCodeAlgorithm,
        digestAlgorithm: OPTIONAL(CTX(1, DigestAlgorithmIdentifier)),
        encapContentInfo: EncapsulatedContentInfo,
        authAttrs: OPTIONAL(CTX(2, IMPLICIT(AuthAttributes))),
        mac: MessageAuthenticationCode,
        unauthAttrs: OPTIONAL(CTX(3, IMPLICIT(UnauthAttributes)))});

    // AuthEnvelopedData RFC 5911
    var AuthEnvelopedData = SEQUENCE({
        version: CMSVersion,
        originatorInfo: OPTIONAL(CTX(0, IMPLICIT(OriginatorInfo))),
        recipientInfos: RecipientInfos,
        authEncryptedContentInfo: EncryptedContentInfo,
        authAttrs: OPTIONAL(CTX(1, IMPLICIT(AuthAttributes))),
        mac: MessageAuthenticationCode,
        unauthAttrs: OPTIONAL(CTX(2, IMPLICIT(UnauthAttributes)))});

    // EncryptedKeyPackage rfc6032
    var EncryptedKeyPackage = CHOICE({
        encrypted: EncryptedData,
        enveloped: CTX(0, IMPLICIT(EnvelopedData)),
        authEnveloped: CTX(1, IMPLICIT(AuthEnvelopedData))}, function (value) {
        return value.encryptedContentInfo ? (value.recipientInfos ?
                'enveloped' : 'encrypted') : 'authEnveloped';
    });

    /**
     * Cryptographic Message Syntax<br>
     * The CMS associates a content type identifier with a content. The syntax 
     * MUST have ASN.1 type ContentInfo:
     * <pre>
     * 
     *  ContentInfo ::= SEQUENCE {
     *    contentType ContentType,
     *    content [0] EXPLICIT ANY DEFINED BY contentType }
     *
     *  ContentType ::= OBJECT IDENTIFIER
     *  
     * </pre>
     * The fields of ContentInfo have the following meanings:
     * <ul>
     * <li>contentType indicates the type of the associated content.  It is
     * an object identifier; it is a unique string of integers assigned
     * by an authority that defines the content type.</li>
     * <li>content is the associated content.  The type of content can be
     * determined uniquely by contentType.  Content types for data,
     * signed-data, enveloped-data, digested-data, encrypted-data, and
     * authenticated-data are defined in this document.  If additional
     * content types are defined in other documents, the ASN.1 type
     * defined SHOULD NOT be a CHOICE type.</li>
     * </ul>
     * RFC 5652 references {@link http://tools.ietf.org/html/rfc5652} 
     * 
     * @class GostASN1.ContentInfo
     * @extends GostASN1.Sequence
     * @property {string} contentType The content type identifier
     * @property {(GostASN1.Sequence|CryptoOperationData)} content The content
     */
    var ContentType = OBJECT_IDENTIFIER;

    var ContentInfo = ATTRIBUTE({
        contentType: ContentType,
        content: function (type) {
            return CTX(0, EXPLICIT(type));
        }
    }, 'contentType', 'content', undefined, 'CMS')({
        data: OCTET_STRING,
        signedData: COMBINE(SignedData),
        envelopedData: COMBINE(EnvelopedData),
        digestedData: COMBINE(DigestedData),
        encryptedData: COMBINE(EncryptedData),
        authData: COMBINE(AuthenticatedData),
        encryptedKeyPkg: COMBINE(EncryptedKeyPackage),
        aKeyPackage: COMBINE(AsymmetricKeyPackage)});

    var DigestInfo = SEQUENCE({
        digestAlgorithm: DigestAlgorithmIdentifier,
        digest: Digest});


    /*
     * PFX format syntax PKCS#12
     * 
     * http://tools.ietf.org/html/rfc7292
     * 
     */

    var PKCS12Attributes = Attributes({
        friendlyName: SET_OF_SINGLE(BMPString),
        keyProviderNameAttr: SET_OF_SINGLE(BMPString),
        localKeyId: SET_OF_SINGLE(OCTET_STRING),
        certKeyIdentifierPropId: SET_OF_SINGLE(OCTET_STRING)});

    var SafeBagType = OBJECT_IDENTIFIER;

    var CertType = OBJECT_IDENTIFIER;

    var CRLType = OBJECT_IDENTIFIER;

    var SecretType = OBJECT_IDENTIFIER;

    var KeyBag = PrivateKeyInfo;

    var PKCS8ShroudedKeyBag = EncryptedPrivateKeyInfo;

    var CertBag = ATTRIBUTE({
        certId: CertType,
        certValue: function (type) {
            return CTX(0, EXPLICIT(type));
        }
    }, 'certId', 'certValue')({
        // DER-encoded X.509 certificate stored in OCTET STRING
        x509Certificate: OCTET_STRING(ENCAPSULATES(Certificate)),
        // Base64-encoded SDSI certificate stored in IA5String
        sdsiCertificate: IA5String
    }, OCTET_STRING);

    var CRLBag = ATTRIBUTE({
        crlId: CRLType,
        crlValue: function (type) {
            return CTX(0, EXPLICIT(type));
        }
    }, 'crlId', 'crlValue')({
        // DER-encoded X.509 certificate stored in OCTET STRING
        x509CRL: OCTET_STRING(ENCAPSULATES(CertificateList))
    }, OCTET_STRING);

    var SecretBag = ATTRIBUTE({
        secretTypeId: SecretType,
        secretValue: function (type) {
            return CTX(0, EXPLICIT(type));
        }
    }, 'secretTypeId', 'secretValue')({
        secret: OCTET_STRING
    }, OCTET_STRING);

    var SafeBag = ATTRIBUTE({
        bagId: SafeBagType,
        bagValue: function (type) {
            return CTX(0, EXPLICIT(type));
        },
        bagAttributes: OPTIONAL(PKCS12Attributes)
    }, 'bagId', 'bagValue')(function (type) {
        return ({
            keyBag: KeyBag,
            pkcs8ShroudedKeyBag: PKCS8ShroudedKeyBag,
            certBag: CertBag,
            crlBag: CRLBag,
            secretBag: SecretBag,
            safeContentsBag: SafeContents // recursion
        })[type];
    });

    /**
     * The SafeContents Type<br><br>
     * 
     * The sixth type of bag that can be held in a SafeBag is a
     * SafeContents. This recursive structure allows for arbitrary nesting
     * of multiple KeyBags, PKCS8ShroudedKeyBags, CertBags, CRLBags, and
     * SecretBags within the top-level SafeContents.
     * <pre>
     *  SafeContents ::= SEQUENCE OF SafeBag
     *   SafeBag ::= SEQUENCE {
     *       bagId BAG-TYPE.&id ({PKCS12BagSet})
     *       bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}),
     *       bagAttributes SET OF PKCS12Attribute OPTIONAL
     *   }
     *   
     *   PKCS12Attribute ::= SEQUENCE {
     *       attrId ATTRIBUTE.&id ({PKCS12AttrSet}),
     *       attrValues SET OF ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId})
     *   } -- This type is compatible with the X.500 type ’Attribute’
     *   
     *   PKCS12AttrSet ATTRIBUTE ::= {
     *       friendlyName | -- from PKCS #9 [23]
     *       localKeyId, -- from PKCS #9
     *       ... -- Other attributes are allowed
     *   }
     * </pre>
     * The SafeContents type is made up of SafeBags. Each SafeBag holds one
     * piece of information -- a key, a certificate, etc. -- which is
     * identified by an object identifier.<br><br>
     * 
     * See {@link GostASN1.ContentInfo} and {@link GostASN1.PFX}<br><br>
     * 
     * RFC 7292 references {@link http://tools.ietf.org/html/rfc7292} 
     * @class GostASN1.SafeContents
     */
    var SafeContents = SEQUENCE_OF(SafeBag);

    /**
     * The AuthenticatedSafe<br><br>
     * Each compliant platform shall be able to import and export
     * AuthenticatedSafe PDUs wrapped in PFX PDUs.<br>
     * For integrity, the AuthenticatedSafe is either signed (if public-key
     * integrity mode is used) or MACed (if password integrity mode is used)
     * to produce a PFX PDU.
     * <pre>
     *      AuthenticatedSafe ::= SEQUENCE OF ContentInfo
     * 
     *      -- Data if unencrypted
     *      -- EncryptedData if password-encrypted
     *      -- EnvelopedData if public key-encrypted
     * </pre>
     * As mentioned, the contentType field of authSafe shall be of type data
     * or signedData. The content field of the authSafe shall, either
     * directly (data case) or indirectly (signedData case), contain a BER-
     * encoded value of type AuthenticatedSafe.<br><br>
     * 
     * See {@link GostASN1.ContentInfo} and {@link GostASN1.PFX}<br><br>
     * 
     * RFC 7292 references {@link http://tools.ietf.org/html/rfc7292} 
     * 
     * @class GostASN1.AuthenticatedSafe
     */
    var AuthenticatedSafe = SEQUENCE_OF(ContentInfo);

    var MacData = SEQUENCE({
        mac: DigestInfo,
        macSalt: OCTET_STRING,
        // Note: The default is for historical reasons and its use is deprecated.
        iterations: DEFAULT(INTEGER, 1)});

    /**
     * PFX format syntax<br><br>
     * 
     * This format corresponds to the data model presented above, with
     * wrappers for privacy and integrity. This section makes free
     * reference to PKCS #7 {@link GostASN1.ContentInfo}<br>
     * All modes of direct exchange use the same PDU format.  ASN.1 and BER-
     * encoding ensure platform independence.<br>
     * This standard has one ASN.1 export: PFX.  This is the outer integrity
     * wrapper.<br><br>
     * Instances of PFX contain:
     *  <ol>
     *  <li>A version indicator.  The version shall be v3 for this version of
     *      this document.</li>
     *  <li>A PKCS #7 ContentInfo, whose contentType is signedData in public-
     *      key integrity mode and data in password integrity mode.</li>
     *  <li>An optional instance of MacData, present only in password
     *      integrity.  This object, if present, contains a PKCS #7
     *      DigestInfo, which holds the MAC value, a macSalt, and an
     *      iterationCount.  As described in Appendix B, the MAC key is
     *      derived from the password, the macSalt, and the iterationCount;
     *      the MAC is computed from the authSafe value and the MAC key via HMAC.  
     *      The password and the MAC key are not actually present anywhere in the PFX.  
     *      The salt and (to a certain extent) the iteration count thwarts dictionary
     *      attacks against the integrity password. </li>
     *  </ol>
     *  <pre>
     *  PFX ::= SEQUENCE {
     *      version     INTEGER {v3(3)}(v3,...),
     *      authSafe    ContentInfo,
     *      macData     MacData OPTIONAL
     *  }
     *
     *  MacData ::= SEQUENCE {
     *      mac         DigestInfo,
     *      macSalt     OCTET STRING,
     *      iterations  INTEGER DEFAULT 1
     *      -- Note: The default is for historical reasons and its
     *      --       use is deprecated.
     *  }
     *  </pre>
     * See {@link GostASN1.ContentInfo}<br><br>
     * 
     * RFC 7292 references {@link http://tools.ietf.org/html/rfc7292} 
     * @class GostASN1.PFX
     * @extends GostASN1.Sequence
     * @property {number} version Encoded version number
     * @property {GostASN1.ContentInfo} authSafe ContentInfo with {@link GostASN1.AuthenticatedSafe} content 
     */
    var PFX = SEQUENCE({
        version: INTEGER,
        authSafe: ContentInfo,
        macData: OPTIONAL(MacData)}, 'PFX');


    /*
     * Certificate Request Message Format 
     * 
     * http://tools.ietf.org/html/rfc4211
     * 
     */

    var RegToken = UTF8String;

    var Authenticator = UTF8String;

    var CertId = SEQUENCE({
        issuer: GeneralName,
        serialNumber: INTEGER});
    var OldCertId = CertId;

    var ProtocolEncrKey = SubjectPublicKeyInfo;

    var EncryptedValue = SEQUENCE({
        // the intended algorithm for which the value will be used
        intendedAlg: OPTIONAL(CTX(0, IMPLICIT(AlgorithmIdentifier))),
        // the symmetric algorithm used to encrypt the value
        symmAlg: OPTIONAL(CTX(1, IMPLICIT(AlgorithmIdentifier))),
        // the (encrypted) symmetric key used to encrypt the value
        encSymmKey: OPTIONAL(CTX(2, IMPLICIT(BIT_STRING))),
        // algorithm used to encrypt the symmetric key
        keyAlg: OPTIONAL(CTX(3, IMPLICIT(AlgorithmIdentifier))),
        valueHint: OPTIONAL(CTX(4, IMPLICIT(OCTET_STRING))),
        // a brief description or identifier of the encValue content
        // (may be meaningful only to the sending entity, and used only
        // if EncryptedValue might be re-examined by the sending entity
        // in the future)
        encValue: BIT_STRING});
    var KeyGenParameters = OCTET_STRING;

    // The encrypted private key MUST be placed in the envelopedData
    // encryptedContentInfo encryptedContent OCTET STRING.
    var EncryptedKey = CHOICE({
        encryptedValue: EncryptedValue, // Deprecated
        envelopedData: CTX(0, IMPLICIT(EnvelopedData))}, function (value) {
        return value.encryptedContentInfo ? 'envelopedData' : 'encryptedValue';
    });

    var PKIArchiveOptions = CHOICE({
        // the actual value of the private key
        encryptedPrivKey: CTX(0, EncryptedKey),
        // parameters that allow the private key to be re-generated
        keyGenParameters: CTX(1, IMPLICIT(KeyGenParameters)),
        // set to TRUE if sender wishes receiver to archive the private
        // key of a key pair that the receiver generates in response to
        // this request; set to FALSE if no archival is desired.
        archiveRemGenPrivKey: CTX(2, IMPLICIT(BOOLEAN))});

    var SinglePubInfo = SEQUENCE({
        pubMethod: INTEGER({
            dontCare: 0,
            x500: 1,
            web: 2,
            ldap: 3}),
        pubLocation: OPTIONAL(GeneralName)});

    // pubInfos MUST NOT be present if action is "dontPublish"
    // (if action is "pleasePublish" and pubInfos is omitted,
    // "dontCare" is assumed)
    var PKIPublicationInfo = SEQUENCE({
        action: INTEGER({
            dontPublish: 0,
            pleasePublish: 1}),
        pubInfos: OPTIONAL(SEQUENCE_OF(SinglePubInfo))});

    var SubsequentMessage = INTEGER({
        // requests that resulting certificate be encrypted for the
        // end entity (following which, POP will be proven in a
        // confirmation message)
        encrCert: 0,
        // requests that CA engage in challenge-response exchange with
        // end entity in order to prove private key possession
        challengeResp: 1});

    var POPOPrivKey = CHOICE({
        // possession is proven in this message (which contains the private
        // key itself (encrypted for the CA))
        thisMessage: CTX(0, IMPLICIT(BIT_STRING)), // Deprecated
        subsequentMessage: CTX(1, IMPLICIT(SubsequentMessage)),
        // possession will be proven in a subsequent message
        dhMAC: CTX(2, IMPLICIT(BIT_STRING)), // Deprecated
        agreeMAC: CTX(3, IMPLICIT(PKMACValue)),
        encryptedKey: CTX(4, IMPLICIT(EnvelopedData))});

    var PBMParameter = SEQUENCE({
        salt: OCTET_STRING,
        // AlgId for a One-Way Function (SHA-1 recommended)
        owf: AlgorithmIdentifier,
        // number of times the OWF is applied
        iterationCount: INTEGER,
        // the MAC AlgId (e.g., DES-MAC, Triple-DES-MAC [PKCS11], or HMAC [HMAC, RFC2202])
        mac: AlgorithmIdentifier});

    var PKMACValue = SEQUENCE({
        // algorithm value shall be PasswordBasedMac {1 2 840 113533 7 66 13}
        // parameter value is PBMParameter
        algId: AlgorithmIdentifier,
        value: BIT_STRING});

    var POPOSigningKeyInput = SEQUENCE({
        authInfo: CHOICE({
            // used only if an authenticated identity has been
            // established for the sender (e.g., a DN from a
            // previously-issued and currently-valid certificate)
            sender: CTX(0, EXPLICIT(GeneralName)), // GeneralName choice - explicit
            // used if no authenticated GeneralName currently exists for
            // the sender; publicKeyMAC contains a password-based MAC
            // on the DER-encoded value of publicKey
            publicKeyMAC: PKMACValue}),
        publicKey: SubjectPublicKeyInfo});  // from CertTemplate

    var POPOSigningKey = SEQUENCE({
        poposkInput: OPTIONAL(CTX(0, POPOSigningKeyInput)),
        algorithmIdentifier: AlgorithmIdentifier,
        signature: BIT_STRING});

    var ProofOfPossession = CHOICE({
        // used if the RA has already verified that the requester is in
        // possession of the private key
        raVerified: CTX(0, IMPLICIT(NULL)),
        signature: CTX(1, IMPLICIT(POPOSigningKey)),
        keyEncipherment: CTX(2, IMPLICIT(POPOPrivKey)),
        keyAgreement: CTX(3, IMPLICIT(POPOPrivKey))});

    var Controls = SEQUENCE_OF(AttributeTypeAndValue({
        regToken: RegToken,
        authenticator: Authenticator,
        pkiPublicationInfo: PKIPublicationInfo,
        pkiArchiveOptions: PKIArchiveOptions,
        oldCertID: OldCertId,
        protocolEncrKey: ProtocolEncrKey}));

    var OptionalValidity = SEQUENCE({
        notBefore: OPTIONAL(CTX(0, IMPLICIT(Time))),
        notAfter: OPTIONAL(CTX(1, IMPLICIT(Time)))}); // at least one MUST be present

    var CertTemplate = SEQUENCE({
        version: OPTIONAL(CTX(0, IMPLICIT(Version))),
        serialNumber: OPTIONAL(CTX(1, IMPLICIT(INTEGER))),
        signingAlg: OPTIONAL(CTX(2, IMPLICIT(AlgorithmIdentifier))),
        issuer: OPTIONAL(CTX(3, IMPLICIT(Name))),
        validity: OPTIONAL(CTX(4, IMPLICIT(OptionalValidity))),
        subject: OPTIONAL(CTX(5, IMPLICIT(Name))),
        publicKey: OPTIONAL(CTX(6, IMPLICIT(SubjectPublicKeyInfo))),
        issuerUID: OPTIONAL(CTX(7, IMPLICIT(UniqueIdentifier))),
        subjectUID: OPTIONAL(CTX(8, IMPLICIT(UniqueIdentifier))),
        extensions: OPTIONAL(CTX(9, IMPLICIT(Extensions)))});

    var CertRequest = SEQUENCE({
        certReqId: INTEGER, // ID for matching request and reply
        certTemplate: CertTemplate, // Selected fields of cert to be issued
        controls: OPTIONAL(Controls)});   // Attributes affecting issuance

    var UTF8Pairs = UTF8String;

    var CertReq = CertRequest;

    var EncKeyWithID = SEQUENCE({
        privateKey: PrivateKeyInfo,
        identifier: OPTIONAL(CHOICE({
            string: UTF8String,
            generalName: GeneralName}, function (value) {
            return typeof value === 'string' || value instanceof String ?
                    'string' : 'generalName';
        }))});

    var CertReqMsg = SEQUENCE({
        certReq: CertRequest,
        popo: OPTIONAL(ProofOfPossession),
        // content depends upon key type
        regInfo: OPTIONAL(SEQUENCE_OF(AttributeTypeAndValue({
            utf8Pairs: UTF8Pairs,
            certReq: CertReq,
            encKeyWithID: EncKeyWithID})))});

    var CertReqMessages = SEQUENCE_OF(CertReqMsg);



    /*
     * Certificate Management over CMS
     * 
     * http://tools.ietf.org/html/rfc5272
     * 
     */

    var PendInfo = SEQUENCE({
        pendToken: OCTET_STRING,
        pendTime: GeneralizedTime});

    var CMCStatus = INTEGER({
        success: 0,
        failed: 2,
        pending: 3,
        noSupport: 4,
        confirmRequired: 5,
        popRequired: 6,
        partial: 7});

    var CMCFailInfo = INTEGER({
        badAlg: 0,
        badMessageCheck: 1,
        badRequest: 2,
        badTime: 3,
        badCertId: 4,
        unsupportedExt: 5,
        mustArchiveKeys: 6,
        badIdentity: 7,
        popRequired: 8,
        popFailed: 9,
        noKeyReuse: 10,
        internalCAError: 11,
        tryLater: 12,
        authDataFail: 13});

    var CMCStatusInfo = SEQUENCE({
        cMCStatus: CMCStatus,
        bodyList: SEQUENCE_OF(BodyPartID),
        statusString: OPTIONAL(UTF8String),
        otherInfo: OPTIONAL(CHOICE({
            failInfo: CMCFailInfo,
            pendInfo: PendInfo}))});

    var AddExtensions = SEQUENCE({
        pkiDataReference: BodyPartID,
        certReferences: SEQUENCE_OF(BodyPartID),
        extensions: SEQUENCE_OF(Extension)});

    var LraPopWitness = SEQUENCE({
        pkiDataBodyid: BodyPartID,
        bodyIds: SEQUENCE_OF(BodyPartID)});

    var GetCert = SEQUENCE({
        issuerName: GeneralName,
        serialNumber: INTEGER});

    var GetCRL = SEQUENCE({
        issuerName: Name,
        cRLName: OPTIONAL(GeneralName),
        time: OPTIONAL(GeneralizedTime),
        reasons: OPTIONAL(ReasonFlags)});

    var RevokeRequest = SEQUENCE({
        issuerName: Name,
        serialNumber: INTEGER,
        reason: CRLReason,
        invalidityDate: OPTIONAL(GeneralizedTime),
        passphrase: OPTIONAL(OCTET_STRING),
        comment: OPTIONAL(UTF8String)});

    var DecryptedPOP = SEQUENCE({
        bodyPartID: BodyPartID,
        thePOPAlgID: AlgorithmIdentifier,
        thePOP: OCTET_STRING});

    var CMCCertId = IssuerAndSerialNumber;

    var BodyPartReference = CHOICE({
        bodyPartID: BodyPartID,
        bodyPartPath: BodyPartPath});

    var CMCStatusInfoV2 = SEQUENCE({
        cMCStatus: CMCStatus,
        bodyList: SEQUENCE_OF(BodyPartReference),
        statusString: OPTIONAL(UTF8String),
        otherInfo: OPTIONAL(CHOICE({
            failInfo: CMCFailInfo,
            pendInfo: PendInfo,
            extendedFailInfo: SEQUENCE({
                failInfoOID: OBJECT_IDENTIFIER,
                failInfoValue: AttributeValue})}))});

    var PublishTrustAnchors = SEQUENCE({
        seqNumber: INTEGER,
        hashAlgorithm: AlgorithmIdentifier,
        anchorHashes: SEQUENCE_OF(OCTET_STRING)});

    var AuthPublish = BodyPartID;

    var BodyPartList = SEQUENCE_OF(BodyPartID);

    var CMCPublicationInfo = SEQUENCE({
        hashAlg: AlgorithmIdentifier,
        certHashes: SEQUENCE_OF(OCTET_STRING),
        pubInfo: PKIPublicationInfo});

    var ModCertTemplate = SEQUENCE({
        pkiDataReference: BodyPartPath,
        certReferences: BodyPartList,
        replace: DEFAULT(BOOLEAN, true),
        certTemplate: CertTemplate});

    var ControlsProcessed = SEQUENCE({
        bodyList: SEQUENCE_OF(BodyPartReference)});

    var IdentifyProofV2 = SEQUENCE({
        proofAlgID: AlgorithmIdentifier,
        macAlgId: AlgorithmIdentifier,
        witness: OCTET_STRING});

    var PopLinkWitnessV2 = SEQUENCE({
        keyGenAlgorithm: AlgorithmIdentifier,
        macAlgorithm: AlgorithmIdentifier,
        witness: OCTET_STRING});

    var TaggedCertificationRequest = SEQUENCE({
        bodyPartID: BodyPartID,
        certificationRequest: CertificationRequest});

    var TaggedContentInfo = SEQUENCE({
        bodyPartID: BodyPartID,
        contentInfo: ContentInfo});

    var OtherMsg = SEQUENCE({
        bodyPartID: BodyPartID,
        otherMsgType: OBJECT_IDENTIFIER,
        otherMsgValue: ANY}); //DEFINED BY otherMsgType 

    var TaggedRequest = CHOICE({
        tcr: CTX(0, IMPLICIT(TaggedCertificationRequest)),
        crm: CTX(1, IMPLICIT(CertReqMsg)),
        orm: CTX(2, IMPLICIT(SEQUENCE({
            bodyPartID: BodyPartID,
            requestMessageType: OBJECT_IDENTIFIER,
            requestMessageValue: ANY})))}); // DEFINED BY requestMessageType

    var EncryptedPOP = SEQUENCE({
        request: TaggedRequest,
        cms: ContentInfo,
        thePOPAlgID: AlgorithmIdentifier,
        witnessAlgID: AlgorithmIdentifier,
        witness: OCTET_STRING});

    var TaggedAttribute = ATTRIBUTE({
        bodyPartID: BodyPartID,
        attrType: OBJECT_IDENTIFIER,
        attrValues: function (type) {
            return SET_OF(type);
        }
    }, 'attrType', 'attrValues', AttributeValue)({
        statusInfo: CMCStatusInfo,
        identification: UTF8String,
        identityProof: OCTET_STRING,
        dataReturn: OCTET_STRING,
        transactionId: INTEGER,
        senderNonce: OCTET_STRING,
        recipientNonce: OCTET_STRING,
        addExtensions: AddExtensions,
        encryptedPOP: EncryptedPOP,
        decryptedPOP: DecryptedPOP,
        lraPOPWitness: LraPopWitness,
        getCert: GetCert,
        getCRL: GetCRL,
        revokeRequest: RevokeRequest,
        regInfo: OCTET_STRING,
        responseInfo: OCTET_STRING,
        queryPending: OCTET_STRING,
        popLinkRandom: OCTET_STRING,
        popLinkWitness: OCTET_STRING,
        confirmCertAcceptance: CMCCertId,
        statusInfoV2: CMCStatusInfoV2,
        trustedAnchors: PublishTrustAnchors,
        authPublish: AuthPublish,
        batchRequests: BodyPartList,
        batchResponses: BodyPartList,
        publishCert: CMCPublicationInfo,
        modCertTemplate: ModCertTemplate,
        controlProcessed: ControlsProcessed,
        popLinkWitnessV2: PopLinkWitnessV2,
        identityProofV2: IdentifyProofV2
    });
    /**
     * PKIData Content Type<br><br>
     *
     * The PKIData content type is used for the Full PKI Request.  A PKIData
     * content type is identified by:
     * <pre>
     *   id-cct-PKIData ::= {id-pkix id-cct(12) 2 }
     * </pre>
     * The ASN.1 structure corresponding to the PKIData content type is:
     * <pre>
     *   PKIData ::= SEQUENCE {
     *       controlSequence    SEQUENCE SIZE(0..MAX) OF TaggedAttribute,
     *       reqSequence        SEQUENCE SIZE(0..MAX) OF TaggedRequest,
     *       cmsSequence        SEQUENCE SIZE(0..MAX) OF TaggedContentInfo,
     *       otherMsgSequence   SEQUENCE SIZE(0..MAX) OF OtherMsg
     *   }
     * </pre>
     * All certification requests encoded into a single PKIData SHOULD be
     * for the same identity.  RAs that batch process (see Section 6.17) are
     * expected to place the PKI Requests received into the cmsSequence of a
     * PKIData. <br><br>
     * See {@link GostASN1.ContentInfo} and {@link GostASN1.PKIResponse}<br><br>
     * RFC 5272 references {@link http://tools.ietf.org/html/rfc5272} 
     * 
     * @class GostASN1.PKIData
     * @extends GostASN1.Sequence
     * @property {GostASN1.Attributes[]} controlSequence
     * @property {GostASN1.Sequence[]} reqSequence
     * @property {GostASN1.ContentInfo[]} cmsSequence
     * @property {GostASN1.Sequence[]} otherMsgSequence
     */
    var PKIData = SEQUENCE({
        controlSequence: SEQUENCE_OF(TaggedAttribute),
        reqSequence: SEQUENCE_OF(TaggedRequest),
        cmsSequence: SEQUENCE_OF(TaggedContentInfo),
        otherMsgSequence: SEQUENCE_OF(OtherMsg)}, 'PKI REQUEST');

    /**
     * PKIResponse Content Type<br><br>
     *
     * The PKIResponse content type is used for the Full PKI Response.  The
     * PKIResponse content type is identified by:
     * <pre>
     *   id-cct-PKIResponse ::= {id-pkix id-cct(12) 3  }
     * </pre>
     * The ASN.1 structure corresponding to the PKIResponse content type is:
     * <pre>
     *    PKIResponse ::= SEQUENCE {
     *        controlSequence   SEQUENCE SIZE(0..MAX) OF TaggedAttribute,
     *        cmsSequence       SEQUENCE SIZE(0..MAX) OF TaggedContentInfo,
     *        otherMsgSequence  SEQUENCE SIZE(0..MAX) OF OtherMsg
     *    }
     *    
     *    ReponseBody ::= PKIResponse
     * </pre>
     *
     * Note: In [RFC2797], this ASN.1 type was named ResponseBody.  It has
     * been renamed to PKIResponse for clarity and the old name kept as a
     * synonym.<br><br>
     *
     * See {@link GostASN1.ContentInfo} and {@link GostASN1.PKIData}<br><br>
     * 
     * RFC 5272 references {@link http://tools.ietf.org/html/rfc5272} 
     * 
     * @class GostASN1.PKIResponse
     * @extends GostASN1.Sequence
     * @property {GostASN1.Attributes[]} controlSequence
     * @property {GostASN1.ContentInfo[]} cmsSequence
     * @property {GostASN1.Sequence[]} otherMsgSequence
     */
    var PKIResponse = SEQUENCE({
        controlSequence: SEQUENCE_OF(TaggedAttribute),
        cmsSequence: SEQUENCE_OF(TaggedContentInfo),
        otherMsgSequence: SEQUENCE_OF(OtherMsg)}, 'PKI RESPONSE');



    /**
     * ASN.1 syntax definitions
     * 
     * @class GostASN1
     */
    function GostASN1() {
    }

    GostASN1.prototype = {
        /**
         * Gost PrivateKey info encoder
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostPrivateKeyInfo
         */
        GostPrivateKeyInfo: GostPrivateKeyInfo,
        /**
         * Gost subject PublicKey info encoder
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostSubjectPublicKeyInfo
         */
        GostSubjectPublicKeyInfo: GostSubjectPublicKeyInfo,
        /**
         * CryptoPro key container header
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostKeyContainer
         */
        GostKeyContainer: GostKeyContainer,
        /**
         * CryptoPro key container name
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostKeyContainerName
         */
        GostKeyContainerName: GostKeyContainerName,
        /**
         * CryptoPro encrypted PrivateKey for key containers
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostPrivateKeys
         */
        GostPrivateKeys: GostPrivateKeys,
        /**
         * CryptoPro PrivateKey masks for key containers
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostPrivateMasks
         */
        GostPrivateMasks: GostPrivateMasks,
        /**
         * ViPNet key container
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.ViPNetInfo
         */
        ViPNetInfo: ViPNetInfo,
        /**
         * Gost Signature encoders
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostSignature
         */
        GostSignature: GostSignature,
        /**
         * Gost Encrypted key encoder for CMS
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostEncryptedKey
         */
        GostEncryptedKey: GostEncryptedKey,
        /**
         * SignalCom wrapped PrivateKey
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.GostWrappedPrivateKey
         */
        GostWrappedPrivateKey: GostWrappedPrivateKey,
        /**
         * PKCS#8 PrivateKey info
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.PrivateKeyInfo
         */
        PrivateKeyInfo: PrivateKeyInfo,
        /**
         * PKCS#8 encrypted PrivateKey info
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.EncryptedPrivateKeyInfo
         */
        EncryptedPrivateKeyInfo: EncryptedPrivateKeyInfo,
        /**
         * X.509 subject PublicKey info
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.SubjectPublicKeyInfo
         */
        SubjectPublicKeyInfo: SubjectPublicKeyInfo,
        /**
         * X.509 To be signed Certificate
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.TBSCertificate
         */
        TBSCertificate: TBSCertificate,
        /**
         * X.509 Certificate
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.Certificate
         */
        Certificate: Certificate,
        /**
         * PKCS#10 Certification request definition
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.CertificationRequestInfo
         */
        CertificationRequestInfo: CertificationRequestInfo,
        /**
         * PKCS#10 Certification request 
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.CertificationRequest
         */
        CertificationRequest: CertificationRequest,
        /**
         * X.509 To be signed CRL
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.TBSCertList
         */
        TBSCertList: TBSCertList,
        /**
         * X.509 CRL
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.CertificateList
         */
        CertificateList: CertificateList,
        /**
         * X.509 Attribute Certificate definition
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.AttributeCertificateInfo
         */
        AttributeCertificateInfo: AttributeCertificateInfo,
        /**
         * X.509 Attribute Certificate
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.AttributeCertificate
         */
        AttributeCertificate: AttributeCertificate,
        /**
         * CMS Signed Attributes
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.SignedAttributes
         */
        SignedAttributes: SignedAttributes,
        /**
         * CMS Unsigned Attributes
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.UnsignedAttributes
         */
        UnsignedAttributes: UnsignedAttributes,
        /**
         * CMS Content definition
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.ContentInfo
         */
        ContentInfo: ContentInfo,
        /**
         * PKCS#12 Safe Contents
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.SafeContents
         */
        SafeContents: SafeContents,
        /**
         * PKCS#12 Authenticated Safe
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.AuthenticatedSafe
         */
        AuthenticatedSafe: AuthenticatedSafe,
        /**
         * PKCS#12 Personal Information Exchange (PFX)
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.PFX
         */
        PFX: PFX,
        /**
         * PKI Request
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.PKIData
         */
        PKIData: PKIData,
        /**
         * PKI Response
         * 
         * @memberOf GostASN1
         * @instance
         * @type GostASN1.PKIResponse
         */
        PKIResponse: PKIResponse
    };

    /**
     * PKCS ASN.1 message syntax and converters  
     * 
     * @memberOf gostCrypto
     * @type GostASN1
     */
    gostCrypto.asn1 = new GostASN1();

module.exports = GostASN1;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostCMS.js":
/*!******************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostCMS.js ***!
  \******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file Implements the Cryptographic Message Syntax as specified in RFC-2630.
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this 
 *    list of conditions and the following disclaimer.
 *    
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");
// const GostASN1 = require('./gostASN1');
// const GostCert = require('./gostCert');

    /*
     * Common algorithms
     */
    var root = __webpack_require__.g;
    var Promise = root.Promise;
    var Object = root.Object;
    var CryptoOperationData = root.ArrayBuffer;
    var Date = root.Date;

    var subtle = gostCrypto.subtle;
    var asn1 = gostCrypto.asn1;
    var coding = gostCrypto.coding;
    var cert = gostCrypto.cert;
    var providers = gostCrypto.security.providers;

    // Expand javascript object
    function expand() {
        var r = {};
        for (var i = 0, n = arguments.length; i < n; i++) {
            var item = arguments[i];
            if (typeof item === 'object')
                for (var name in item)
                    if (item.hasOwnProperty(name))
                        r[name] = item[name];
        }
        return r;
    }

    function defineProperty(object, name, descriptor, enumerable) {
        if (typeof descriptor !== 'object')
            descriptor = {value: descriptor};
        if (enumerable !== undefined)
            descriptor.enumerable = enumerable;
        Object.defineProperty(object, name, descriptor);
    }

    function defineProperties(object, properties, enumerable) {
        for (var name in properties)
            defineProperty(object, name, properties[name], enumerable);
    }

    // Extend javascript class
    function extend(Super, Class, propertiesObject, propertiesClass) {
        // If constructor not defined
        if (typeof Class !== 'function') {
            propertiesClass = propertiesObject;
            propertiesObject = Class;
            Class = function () {
                Super.apply(this, arguments);
            };
        }
        // Create prototype properties
        Class.prototype = Object.create(Super.prototype, {
            constructor: {
                value: Class
            },
            superclass: {
                value: Super.prototype
            }
        });
        if (propertiesObject)
            defineProperties(Class.prototype, propertiesObject, true);
        // Inherites super class properties
        if (Super !== Object)
            for (var name in Super)
                Class[name] = Super[name];
        Class.super = Super;
        if (propertiesClass)
            defineProperties(Class, propertiesClass, true);
        return Class;
    }

    // Self resolver
    function call(callback) {
        try {
            callback();
        } catch (e) {
        }
    }

    // Check the buffers to equal
    function equalBuffers(r1, r2) {
        var s1 = new Uint8Array(r1),
                s2 = new Uint8Array(r2);
        if (s1.length !== s2.length)
            return false;
        for (var i = 0, n = s1.length; i < n; i++)
            if (s1[i] !== s2[i])
                return false;
        return true;
    }

    // True if equal numbers
    var equalNumbers = (function () {
        // Convert number to bigendian hex string
        var hex = function (s) {
            var t = typeof s;
            return t === 'undefined' || s === '' ? '0' :
                    t === 'number' || s instanceof Number ? s.toString(16).toLowerCase() :
                    s.replace('0x', '').toLowerCase();
        };
        // Zero left padding
        var lpad = function (s, size) {
            return (new Array(size + 1).join('0') + s).slice(-size);
        };
        return function (s1, s2) {
            s1 = hex(s1);
            s2 = hex(s2);
            var len = Math.max(s1.length, s2.length);
            return lpad(s1, len) === lpad(s2, len);
        };
    })();

    // Check equal names
    function equalNames(name1, name2) {
        for (var key in name1)
            if (name1[key] !== name2[key])
                return false;
        for (var key in name2)
            if (name1[key] !== name2[key])
                return false;
        return true;
    }

    // Add unique value to array
    function addUnique(array, item, comparator) {
        var found = false;
        for (var i = 0, n = array.length; i < n; i++)
            if (comparator(array[i], item)) {
                found = true;
                break;
            }
        if (!found)
            array.push(item);
    }

    // Set content data
    function setContentData(object, data) {
        var content = object.content;
        switch (object.contentType) {
            case 'data':
                object.content = data.content;
                break;
            case 'digestedData':
            case 'signedData':
            case 'authData':
                content.encapContentInfo = {
                    eContentType: data.contentType,
                    eContent: data.content
                };
                break;
            case 'envelopedData':
            case 'encryptedData':
                content.encryptedContentInfo = {
                    contentType: data.contentType,
                    encryptedContent: data.content
                };
                break;
        }
    }

    // Get content data
    function getContentData(object) {
        var content = object.content;
        switch (object.contentType) {
            case 'data':
                return {
                    contentType: object.contentType,
                    content: object.content
                };
            case 'digestedData':
            case 'signedData':
            case 'authData':
                var encap = content.encapContentInfo;
                return  {
                    contentType: encap.eContentType,
                    content: encap.eContent
                };
            case 'envelopedData':
            case 'encryptedData':
                var enc = content.encryptedContentInfo;
                return {
                    contentType: enc.contentType,
                    content: enc.encryptedContent
                };
        }
    }

    // Check content info type
    function checkContentInfo(contentInfo) {
        var content, contentType;
        if (contentInfo) {
            if (typeof contentInfo === 'string')
                try {
                    contentInfo = coding.PEM.decode(contentInfo);
                } catch (e1) {
                    contentInfo = coding.Chars.decode(contentInfo);
                }
            if (contentInfo instanceof CryptoOperationData)
                try {
                    contentInfo = asn1.ContentInfo.decode(contentInfo);
                } catch (e) {
                    contentInfo = {contentType: 'data', content: contentInfo};
                }
            contentType = contentInfo.contentType;
            if (!contentType)
                throw new Error('Invalid content object');
            content = contentInfo.content;
            if (!(content instanceof CryptoOperationData))
                content = content.encode();
            return {contentType: contentType, content: content};
        } else
            contentInfo = {contentType: 'data'};
        return contentInfo;
    }

    function createContentInfo(contentInfo) {
        try {
            // Some provider has mistake to envelop ContentInfo enstead 
            // content field of ContentInfo
            contentInfo = new asn1.ContentInfo(contentInfo.content, true);
        } catch (e) {
        }
        // Create situable content info object
        switch (contentInfo.contentType) {
            case 'data':
                return new DataContentInfo(contentInfo);
            case 'digestedData':
                return new DigestedDataContentInfo(contentInfo);
            case 'signedData':
                return new SignedDataContentInfo(contentInfo);
            case 'encryptedData':
                return new EncryptedDataContentInfo(contentInfo);
            case 'envelopedData':
                return new EnvelopedDataContentInfo(contentInfo);
            default:
                return new asn1.ContentInfo(contentInfo);
        }
    }
    ;

    function matchCert(id, cert) {
        return (id instanceof CryptoOperationData ? cert.extensions &&
                equalBuffers(id, cert.extensions.subjectKeyIdentifier) :
                equalNames(cert.issuer, id.issuer) &&
                equalNumbers(cert.serialNumber, id.serialNumber));
    }

    // Get random values
    function getSeed(length) {
        var seed = new Uint8Array(length);
        gostCrypto.getRandomValues(seed);
        return seed.buffer;
    }

    // Salt size
    function saltSize(algorithm) {
        switch (algorithm.id) {
            case 'pbeWithSHAAnd40BitRC2-CBC':
            case 'pbeWithSHAAnd128BitRC2-CBC':
                return 8;
            case 'pbeUnknownGost':
                return 16;
            case 'sha1':
                return 20;
            default:
                return 32;
        }
    }

    // Password to bytes
    function passwordData(derivation, password) {
        if (!password)
            return new CryptoOperationData(0);
        if (password instanceof CryptoOperationData)
            return password;
        if (typeof password !== 'string')
            throw new Error('The password must be string or raw data type');
        if (derivation.name.indexOf('CPKDF') >= 0) {
            // CryptoPro store password
            var r = [];
            for (var i = 0; i < password.length; i++) {
                var c = password.charCodeAt(i);
                r.push(c & 0xff);
                r.push(c >>> 8 & 0xff);
                r.push(0);
                r.push(0);
            }
            return new Uint8Array(r).buffer;
        } else if (derivation.name.indexOf('PFXKDF') >= 0)
            // PKCS#12 unicode password
            return coding.Chars.decode(password + '\0', 'unicode');
        else
            // PKCS#5 password mode
            return coding.Chars.decode(password, 'utf8');
    }

    // Define provider for encription algorithm
    function encryptionProvider(algorithm) {
        var id = algorithm.id;
        for (var name in providers) {
            var provider = providers[name];
            if (provider.encryption.id === id)
                return provider;
        }
    }



    /**
     * Provides facilities for handling certificates, CRLs, etc.
     * @class GostCMS
     */
    function GostCMS() {
    }

    /**
     * Message templates
     * <ul>
     *      <li>providerName - provider name for key generation, default 'CP-01'</li>
     *      <li>autoAddCert - automatic add signer certificate to signature, default false</li>
     *      <li>useKeyIdentifier - true to add Signer as the SignerIdentifier (v3), otherwise, as the IssuerAndSerialNumber (v1) (default false).</li>
     * </ul>
     * 
     * @memberOf GostCMS
     * @instance
     */
    var options = {
        providerName: 'CP-01',
        autoAddCert: false,
        useKeyIdentifier: false
    };

    GostCMS.prototype.options = options;

    /**
     * The base class for all CMS objects.<br><br>
     * 
     * A CMS object consists of a content type, and content.<br><br>
     * 
     * @class GostCMS.DataContentInfo
     * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The content object.
     * @param {string} defaultSet The default object initialization set.
     * @extends GostASN1.ContentInfo
     */
    function DataContentInfo(contentInfo, defaultSet)
    {
        asn1.ContentInfo.call(this, contentInfo || defaultSet || {contentType: 'data'});
        if (defaultSet && this.contentType !== (defaultSet.contentType || 'data'))
            throw new Error('Invalid content type');
    }

    extend(asn1.ContentInfo, DataContentInfo, {
        /**
         * Indicates if this is a detached CMS object.
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @returns {boolean} true if detached; false otherwise.
         */
        isDetached: {
            value: false,
            enumerable: true,
            writable: true
        },
        /**
         * Indicates if an external (detached) signature must be created.
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @param {boolean} createDetached True if detached; false otherwise.
         */
        writeDetached: function (createDetached)
        {
            // Define external signature mode
            this.isDetached = createDetached;
        },
        /**
         * Encode the message to binary format 'DER' or 'PEM'
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @param {string} format
         * @returns {FormatedData}
         */
        encode: function (format)
        {
            if (this.isDetached) {
                var data = getContentData(this);
                setContentData(this, {contentType: data.contentType});
                var result = asn1.ContentInfo.method('encode').call(this, format);
                setContentData(this, data);
                return result;
            } else
                return asn1.ContentInfo.method('encode').call(this, format);
        },
        /**
         * Enclose content to document. 
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo
         * @returns {Promise} Promise to return self object after enclose content
         */
        encloseContent: function (contentInfo)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                self.setEnclosed(contentInfo);
                return self;
            });
        },
        /**
         * Sets the content of attached document.<br><br>
         * 
         * This is necessary only in detached mode.
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo - The encapsulated CMS Object.
         */
        setEnclosed: function (contentInfo)
        {
            setContentData(this, checkContentInfo(contentInfo));
        },
        /**
         * Returns the document which attached. If the content is not attached, the CMS object 
         * which is returned will be degenerate.
         * 
         * @memberOf GostCMS.DataContentInfo
         * @instance
         * @returns {GostASN1.ContentInfo} The encapsulated CMS Object.
         */
        getEnclosed: function ()
        {
            return createContentInfo(getContentData(this));
        }
    });

    /**
     * This class encapsulates a CMS object of content type binary data.
     * 
     * @memberOf GostCMS
     * @type GostCMS.DigestedDataContentInfo
     */
    GostCMS.prototype.DataContentInfo = DataContentInfo;

    /**
     * This class encapsulates a CMS object of content type digested-data.
     * 
     * @class GostCMS.DigestedDataContentInfo
     * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo - The content that is to be signed.
     * @extends GostCMS.DataContentInfo
     * @extends GostASN1.DigestedData
     */
    function DigestedDataContentInfo(contentInfo)
    {
        DataContentInfo.call(this, contentInfo, {
            contentType: 'digestedData',
            version: 0,
            digestAlgorithm: providers[options.providerName].digest,
            encapContentInfo: {
                eContentType: 'data'
            },
            digest: new CryptoOperationData(0)
        });
    }

    extend(DataContentInfo, DigestedDataContentInfo, {
        /**
         * Enclose the content and calculate the message digest with given digest algorithm
         * 
         * @memberOf GostCMS.DigestedDataContentInfo
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo Content data to be enclosed.
         * @param {(AlgorithmIdentifier|string)} digestAlgorithm Digest algorithm or provider name
         * @returns {Promise} 
         */
        encloseContent: function (contentInfo, digestAlgorithm)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Set enclosed data
                self.setEnclosed(contentInfo);

                // Define digest algorithm
                if (digestAlgorithm) {
                    var digestProvider = providers[digestAlgorithm];
                    self.digestAlgorithm = (digestProvider && digestProvider.digest) || digestAlgorithm;
                }

                // Calculate digest
                return subtle.digest(self.digestAlgorithm, self.encapContentInfo.eContent);
            }).then(function (digest) {

                // Set digest attribute
                self.digest = digest;
            });
        },
        /**
         * Verify the Message Digest. <br><br>
         * 
         * @memberOf GostCMS.DigestedDataContentInfo
         * @instance
         * @param contentInfo Detached content (optional)
         * @returns {Promise} Promise to return enclosed object {@link GostASN1.ContentInfo} if digest verified
         */
        verify: function (contentInfo)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Append attached
                if (contentInfo)
                    self.setEnclosed(contentInfo);

                // Check data
                var dataToVerify = self.encapContentInfo &&
                        self.encapContentInfo.eContent;
                if (!dataToVerify)
                    throw new Error('Detached content is not found');

                // Calculate digest
                return subtle.digest(self.digestAlgorithm, self.encapContentInfo.eContent);
            }).then(function (digest) {
                if (!equalBuffers(digest, self.digest))
                    throw Error('Message digest is not verified');
                // Return content
                return createContentInfo({
                    contentType: self.encapContentInfo.eContentType,
                    content: self.encapContentInfo.eContent
                });
            });
        }
    });

    /**
     * This class encapsulates a CMS object of content type digested-data.
     * 
     * @memberOf GostCMS
     * @type GostCMS.DigestedDataContentInfo
     */
    GostCMS.prototype.DigestedDataContentInfo = DigestedDataContentInfo;

    /**
     * This class encapsulates a CMS object of content type signed-data.
     * 
     * Use encloseContent or setEnclosed methods to add a enclosed content before add signatures
     * 
     * @class GostCMS.SignedDataContentInfo
     * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo - The signed content. 
     * @extends GostCMS.DataContentInfo
     * @extends GostASN1.SignedData
     */
    function SignedDataContentInfo(contentInfo)
    {
        DataContentInfo.call(this, contentInfo, {
            contentType: 'signedData',
            version: 1,
            digestAlgorithms: [],
            encapContentInfo: {
                eContentType: 'data'
            },
            signerInfos: []
        });
    }

    extend(DataContentInfo, SignedDataContentInfo, {
        /**
         * Add a Signer using the the IssuerAndSerialNumber as the SignerIdentifier i.e a Version1 CMSSignerInfo 
         * or SubjectPublicKeyIdentifier as the SignerIdentifier i.e a Version3 CMSSignerInfo.
         * 
         * @memberOf GostCMS.SignedDataContentInfo
         * @instance
         * @param {GostASN1.PrivateKeyInfo} signerKey Private Key of the signer.
         * @param {GostCert.X509} signerCert Signer certificate or certificate chain
         * @param {GostASN1.SignedAttributes} signedAttrs The set of signed attributes. Default undefined. If true or {} standard attributes will be appended: contentType and messageDigest
         * @param {GostASN1.UnsignedAttributes} unsignedAttrs  The set of unsigned attributes. Default undefined.
         * @returns {Promise} Promise to return self object after add signature
         */
        addSignature: function (signerKey, signerCert, signedAttrs, unsignedAttrs)
        {
            var self = this, signerInfo, dataToSign, signerCertChain;
            return new Promise(call).then(function () {
                // Check attribures
                if (!signerKey || !signerCert)
                    throw new Error('Signer key or certificate is not defined');
                // Cert chain
                if (signerCert instanceof Array) {
                    signerCertChain = signerCert;
                    signerCert = signerCertChain[0];
                } else
                    signerCertChain = [signerCert];
                // Signature algorithm provider
                var provider = signerCert.getProvider() ||
                        providers[options.providerName];
                var useKeyIdentifier = options.useKeyIdentifier && signerCert.extensions &&
                        signerCert.extensions.subjectKeyIdentifier;
                // Get enclosed data
                dataToSign = self.encapContentInfo.eContent;
                // Prepare signer info structure
                signerInfo = {
                    version: useKeyIdentifier ? 2 : 0,
                    sid: useKeyIdentifier ? signerCert.extensions.subjectKeyIdentifier : {
                        issuer: signerCert.issuer,
                        serialNumber: signerCert.serialNumber},
                    digestAlgorithm: provider.digest,
                    signatureAlgorithm: signerCert.subjectPublicKeyInfo.algorithm};
                // Set an unsigned attributes
                if (unsignedAttrs)
                    signerInfo.unsignedAttrs = unsignedAttrs;
                // For a signed attributes calculate digest
                if (signedAttrs) {
                    if (typeof signedAttrs !== 'object')
                        signedAttrs = {};
                    return subtle.digest(signerInfo.digestAlgorithm, dataToSign);
                }
            }).then(function (digest) {
                if (digest) {
                    // Add standard signed attributes
                    signedAttrs.contentType = self.encapContentInfo.eContentType,
                            signedAttrs.messageDigest = digest,
                            signedAttrs.signingTime = new Date();
                    signerInfo.signedAttrs = signedAttrs,
                            // Now data to sign = attributes
                            dataToSign = asn1.SignedAttributes.encode(signerInfo.signedAttrs);
                }

                // Import the private key
                return subtle.importKey('pkcs8', asn1.PrivateKeyInfo.encode(signerKey),
                        signerKey.privateKeyAlgorithm, false, ['sign']);
            }).then(function (key) {

                // Sign data
                var algorithm = expand(signerInfo.signatureAlgorithm, {hash: signerInfo.digestAlgorithm});
                return subtle.sign(algorithm, key, dataToSign);
            }).then(function (signatureValue) {
                signerInfo.signatureValue = signatureValue;

                // Add digest algorithm
                addUnique(self.digestAlgorithms, signerInfo.digestAlgorithm, function (algorithm1, algorithm2) {
                    return algorithm1.id === algorithm2.id;
                });

                // Add signer certificate
                if (options.autoAddCert) {
                    if (!self.certificates)
                        self.certificates = [];
                    for (var i = 0, n = signerCertChain.length; i < n; i++) {
                        addUnique(self.certificates, signerCertChain[i], function (cert1, cert2) {
                            return equalNames(cert1.issuer, cert2.issuer) &&
                                    equalNumbers(cert1.serialNumber, cert2.serialNumber);
                        });
                    }
                }

                // Add signer info
                self.signerInfos.push(signerInfo);
            });
        },
        /**
         * Indicates if this object has any signers i.e. checks for the absence of any SignerInfo structures.
         * CMS (RFC-2630) defines a degenerate object as one which has no signers.
         * 
         * @memberOf GostCMS.SignedDataContentInfo
         * @instance
         * @returns {boolean} True if this object has no signers; false otherwise.
         */
        isDegenerate: {
            get: function () {
                return !(this.signerInfos && this.signerInfos.length > 0);
            }
        },
        /**
         * Returns normally if this CMS signed data object contains at least one valid signature, 
         * according to the given trust policy; otherwise throws an Error.<br><br>
         * 
         * In order to be considered valid, there must be at least one signature on this CMS 
         * message which is validated by one of the certificates included with it; furthermore, 
         * the validating certificate must itself be valid according to the given certificate 
         * trust policy. This latter validation process may involve examining the other certificates 
         * or CRLs included with this object, if called for by the trust policy.<br><br>
         * 
         * If a signature is encountered for which a certification path can be found, but is 
         * invalid, an Error will be created, but will not be thrown until 
         * all other signatures have been checked. If another signature is found which is valid, 
         * then the method simply returns and no exception at all is thrown. 
         * 
         * @memberOf GostCMS.SignedDataContentInfo
         * @instance
         * @param {GostCert.CertificateTrustPolicy} trustPolicy The trust prolicy for verification
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The content that was signed (optional)
         * @returns {Promise} Promise to return enclosed object {@link GostASN1.ContentInfo} if signature verified
         */
        verify: function (trustPolicy, contentInfo)
        {
            var self = this, result;
            return new Promise(call).then(function () {
                // Append attached
                if (contentInfo)
                    self.setEnclosed(contentInfo);
                if (!self.signerInfos || self.signerInfos.length === 0)
                    throw new Error('No signatures found');
                // Validate certificate of signers
                return Promise.all(self.signerInfos.map(function (signerInfo, i) {
                    var sid = signerInfo.sid, selector = sid instanceof CryptoOperationData ? {
                        subjectKeyIdentifier: sid
                    } : {
                        issuer: sid.issuer,
                        serialNumber: sid.serialNumber};
                    // Signing date
                    var date;
                    if (signerInfo.signedAttrs && signerInfo.signedAttrs.signingTime)
                        date = signerInfo.signedAttrs.signingTime;
                    // Use certificate trust policy validation
                    return trustPolicy.getValidCertificate(selector,
                            self.certificates, self.crls, date).catch(function () {
                        return; // Ignore error
                    });
                }));

            }).then(function (certs) {
                // Get encapsulated data
                var verifiers = [];
                // Verify signatures for each signers
                certs.forEach(function (signerCert) {
                    if (signerCert)
                        verifiers.push(self.verifySignature(signerCert).then(function (data) {
                            result = data; // Enough one valid signature
                        }, function () {
                            return; // Ignore error
                        }));
                });
                if (verifiers.length === 0)
                    throw new Error('Valid verification path not found');
                return Promise.all(verifiers);
            }).then(function () {
                if (!result)
                    throw Error('Verification path found but no valid signature');
                // Return content
                return result;
            });
        },
        /**
         * Returns successfully if this CMS signed data object contains a signature which is 
         * validated by the given certificate and data; otherwise throws an Error.<br><br>
         * 
         * This method verifies the specified signature directly and ignores any certificates 
         * or CRLs which may be contained in this CMS object. A more complex verification process, 
         * which does make use of attached certificates and CRLs, is provided by the verify method.
         * 
         * @memberOf GostCMS.SignedDataContentInfo
         * @instance
         * @param {GostCert.X509} signerCert The signer certificate
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The content that was signed (optional)
         * @returns {Promise} Promise to return enclosed object {@link GostASN1.ContentInfo} if signature verified
         */
        verifySignature: function (signerCert, contentInfo)
        {
            var self = this, signerInfo, dataToVerify, dataDigest;
            return new Promise(call).then(function () {
                // Append attached
                if (contentInfo)
                    self.setEnclosed(contentInfo);
                dataToVerify = self.encapContentInfo && self.encapContentInfo.eContent;
                if (!dataToVerify)
                    throw new Error('Detached content is not found');
                // Find signer
                for (var i = 0; i < self.signerInfos.length; i++) {
                    var sid = self.signerInfos[i].sid;
                    if (matchCert(sid, signerCert)) {
                        signerInfo = self.signerInfos[i];
                        break;
                    }
                }
                if (!signerInfo)
                    throw new Error('Signature not found for the certificate');
                // Choice data for verification
                if (signerInfo.signedAttrs) {
                    dataDigest = signerInfo.signedAttrs.messageDigest;
                    if (!dataDigest)
                        throw new Error('Message digest must present in signed attributes');

                    // To exclude implicit [0] need to reassemble signed attributes (auto on CTX object)
                    dataToVerify = signerInfo.signedAttrs.encode();
                }
                if (!dataToVerify)
                    throw new Error('Data for verification not found');
                // Verify signature
                var algorithm = expand(signerInfo.signatureAlgorithm, {hash: signerInfo.digestAlgorithm});
                return signerCert.verifySignature(dataToVerify, signerInfo.signatureValue, algorithm);
            }).then(function (result) {
                if (!result)
                    throw new Error('Signature not verified');
                // Verify digest
                if (signerInfo.signedAttrs)
                    return subtle.digest(signerInfo.digestAlgorithm, self.encapContentInfo.eContent);
            }).then(function (digest) {
                if (digest && !equalBuffers(digest, dataDigest))
                    throw new Error('Message digest not verified');
                // Return content
                return createContentInfo({
                    contentType: self.encapContentInfo.eContentType,
                    content: self.encapContentInfo.eContent
                });
            });
        }
    });

    /**
     * This class encapsulates a CMS object of content type signed-data.
     * 
     * @memberOf GostCMS
     * @type GostCMS.SignedDataContentInfo
     */
    GostCMS.prototype.SignedDataContentInfo = SignedDataContentInfo;

    /**
     * This class encapsulates a CMS object of content type encrypted-data.
     * 
     * @class GostCMS.EncryptedDataContentInfo
     * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The encrypted data content.
     * @extends GostCMS.DataContentInfo
     * @extends GostASN1.EncryptedData
     */
    function EncryptedDataContentInfo(contentInfo)
    {
        DataContentInfo.call(this, contentInfo, {
            contentType: 'encryptedData',
            version: 0,
            encryptedContentInfo: {
                contentType: 'data',
                contentEncryptionAlgorithm: providers[options.providerName].encryption
            }
        });
    }

    extend(DataContentInfo, EncryptedDataContentInfo, {
        /**
         * Encrypt the content with given encryption algorithm, secret key or password
         * 
         * @memberOf GostCMS.EncryptedDataContentInfo
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The content data to be enclosed.
         * @param {Key|string} contentEncryptionKey content The encryption key or password for derive key
         * @param {(AlgorithmIdentifier|string)} encryptionAlgorithm The encryption algorithm or provider name
         * @returns {Promise} Promise to return self object after encrypt content
         */
        encloseContent: function (contentInfo, contentEncryptionKey, encryptionAlgorithm)
        {
            var self = this, encryption, derivation;
            return new Promise(call).then(function () {
                // Check content info
                contentInfo = checkContentInfo(contentInfo);
                if (!contentInfo.content)
                    throw new Error('Content for encryption must be specified');

                // Define encryption algorithm
                var type = typeof contentEncryptionKey === 'string' ? 'pbes' : 'encryption';
                if (encryptionAlgorithm) {
                    var provider = providers[encryptionAlgorithm];
                    encryptionAlgorithm = (provider && provider[type]) || encryptionAlgorithm;
                } else
                    encryptionAlgorithm = providers[options.providerName][type];
                // Prepare content encryption key
                if (encryptionAlgorithm.derivation) {
                    // Encrypt with password
                    derivation = expand(encryptionAlgorithm.derivation);
                    encryption = expand(encryptionAlgorithm.encryption);
                    derivation.salt = getSeed(saltSize(encryptionAlgorithm));
                    // Import password for key generation
                    var integrityKey;
                    return subtle.importKey('raw', passwordData(derivation, contentEncryptionKey),
                            derivation, false, ['deriveKey', 'deriveBits']).then(function (key) {
                        integrityKey = key;
                        // Derive IV
                        if (derivation.name.indexOf('PFXKDF') >= 0) {
                            derivation.diversifier = 2;
                            return subtle.deriveBits(derivation, integrityKey, 64);
                        }
                    }).then(function (iv) {
                        if (iv)
                            encryption.iv = iv;
                        // Generate key from password 
                        derivation.diversifier = 1;
                        return subtle.deriveKey(derivation, integrityKey, encryption, false, ['encrypt']);
                    }).then(function (encryptionKey) {
                        // Content encryption with key
                        return encryptionKey;
                    });
                } else {
                    // Base encryption
                    encryption = expand(encryptionAlgorithm);
                    if (contentEncryptionKey instanceof CryptoOperationData) {
                        // Import key
                        return subtle.importKey('raw', contentEncryptionKey, encryption, false, ['encrypt']);
                    } else if (contentEncryptionKey.type === 'secret') {
                        return contentEncryptionKey;
                    } else
                        throw new Error('Content encryption key must be raw data or secret key type');
                }
            }).then(function (encryptionKey) {
                // Initial vector
                if (!encryption.iv)
                    encryption.iv = getSeed(8);

                return subtle.encrypt(encryption, encryptionKey, contentInfo.content);
            }).then(function (encryptedContent) {
                if (encryptionAlgorithm.derivation) {
                    delete derivation.diversifier;
                    encryptionAlgorithm = expand(encryptionAlgorithm, {
                        derivation: derivation,
                        encryption: encryption
                    });
                } else
                    encryptionAlgorithm = encryption;
                // Set enclosed data
                self.encryptedContentInfo = {
                    contentType: contentInfo.contentType,
                    contentEncryptionAlgorithm: encryptionAlgorithm,
                    encryptedContent: encryptedContent
                };
                return self;
            });
        },
        /**
         * Returns the decrypted content. 
         * 
         * @memberOf GostCMS.EncryptedDataContentInfo
         * @instance
         * @param {Key|string} decryptionKey The decryption key or password for derive key   
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The detached content (optional).
         * @returns {Promise} Promise to return enclosed object {@ling GostASN1.ContentInfo} after decrypt content
         */
        getEnclosed: function (decryptionKey, contentInfo)
        {
            var self = this, encryption, derivation, encryptedContent;
            return new Promise(call).then(function () {
                // Append attached
                if (contentInfo)
                    self.setEnclosed(contentInfo);
                encryptedContent = self.encryptedContentInfo.encryptedContent;
                if (!encryptedContent)
                    throw new Error('Encrypted content must be specified');

                encryption = expand(self.encryptedContentInfo.contentEncryptionAlgorithm);
                if (encryption.derivation) {
                    // Decrypt with password
                    derivation = expand(encryption.derivation);
                    encryption = expand(encryption.encryption);
                    // Derive encryption key from password
                    var integrityKey;
                    return subtle.importKey('raw', passwordData(derivation, decryptionKey),
                            derivation, false, ['deriveKey', 'deriveBits']).then(function (key) {
                        integrityKey = key;
                        // Derive iv for PFX
                        if (derivation.name.indexOf('PFXKDF') >= 0) {
                            derivation.diversifier = 2;
                            return subtle.deriveBits(derivation, integrityKey, 64);
                        }
                    }).then(function (iv) {
                        if (iv)
                            encryption.iv = iv;
                        // Generate key from password 
                        derivation.diversifier = 1;
                        return subtle.deriveKey(derivation, integrityKey, encryption, false, ['decrypt']);
                    });
                } else {
                    // Base encryption. Password should be secret key
                    if (decryptionKey instanceof CryptoOperationData) {
                        // Import key
                        return subtle.importKey('raw', decryptionKey, encryption, false, ['decrypt']);
                    } else if (decryptionKey.type === 'secret') {
                        return decryptionKey;
                    } else
                        throw new Error('Decryption key must be raw data or secret key type');
                }
            }).then(function (encryptionKey) {
                // Decrypt key with encryption key
                return subtle.decrypt(encryption, encryptionKey, encryptedContent);
            }).then(function (decryptedContent) {
                // Create content info object
                return createContentInfo({
                    contentType: self.encryptedContentInfo.contentType,
                    content: decryptedContent
                });
            });
        }
    });

    /**
     * This class encapsulates a CMS object of content type encrypted-data.
     * 
     * @memberOf GostCMS
     * @type GostCMS.EncryptedDataContentInfo
     */
    GostCMS.prototype.EncryptedDataContentInfo = EncryptedDataContentInfo;
    /**
     * This class encapsulates a CMS object of content type enveloped-data.
     * 
     * @class GostCMS.EnvelopedDataContentInfo
     * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The encrypted data content.
     * @extends GostCMS.DataContentInfo
     * @extends GostASN1.EnvelopedData
     */
    function EnvelopedDataContentInfo(contentInfo)
    {
        DataContentInfo.call(this, contentInfo, {
            contentType: 'envelopedData',
            version: 0,
            recipientInfos: [],
            encryptedContentInfo: {
                contentType: 'data',
                contentEncryptionAlgorithm: providers[options.providerName].encryption
            }
        });
    }

    extend(DataContentInfo, EnvelopedDataContentInfo, {
        /**
         * Generate content encryption key with given encryption algorithm and encrypt the content
         * 
         * @memberOf GostCMS.EnvelopedDataContentInfo
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The content data to be enclosed.
         * @param {(AlgorithmIdentifier|string)} encryptionAlgorithm The encryption algorithm or provider name
         * @returns {Promise} Promise to return self object after encrypt content
         */
        encloseContent: function (contentInfo, encryptionAlgorithm)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Check content info
                contentInfo = checkContentInfo(contentInfo);
                if (!contentInfo.content)
                    throw new Error('Content for encryption must be specified');
                // Define encryption algorithm
                if (encryptionAlgorithm) {
                    var provider = providers[encryptionAlgorithm];
                    encryptionAlgorithm = (provider && provider.encryption) || encryptionAlgorithm;
                } else
                    encryptionAlgorithm = providers[options.providerName].encryption;
                // Generate key for encryption content
                return subtle.generateKey(encryptionAlgorithm, true, ['encrypt']);
            }).then(function (encryptionKey) {
                // Encrypt content
                self.contentEncryptionKey = encryptionKey;
                // Initial vector
                if (!encryptionAlgorithm.iv)
                    encryptionAlgorithm.iv = getSeed(8);
                return subtle.encrypt(encryptionAlgorithm, encryptionKey, contentInfo.content);
            }).then(function (encryptedContent) {
                self.encryptedContentInfo = {
                    contentType: contentInfo.contentType,
                    contentEncryptionAlgorithm: encryptionAlgorithm,
                    encryptedContent: encryptedContent
                };
                return self;
            });
        },
        /**
         * Add a recipient. <br><br>
         * 
         * Uses the Recipient Information with IssuerAndSerialNumber as the Recipient Identifier.
         * Note: If senderCert specified uses the Key Agreement algorithm overwise Key Transport algorithm.
         * 
         * @memberOf GostCMS.EnvelopedDataContentInfo
         * @instance
         * @param {GostCert.X509} recipientCert The certificate of recepient
         * @param {(AlgorithmIdentifier|string)} keyEncryptionAlgorithm Key encryption algorithm or provider name
         * @param {GostASN1.PrivateKeyInfo} senderKey The private key of sender for key agreement protocol
         * @param {GostCert.X509} senderCert The certificate of sender for key agreement protocol
         * @returns {Promise} Promise to return self object after add recipient
         */
        addRecipient: function (recipientCert, keyEncryptionAlgorithm, senderKey, senderCert)
        {
            var self = this, privateKey, encryptionProvider, derivation, wrapping;
            return new Promise(call).then(function () {
                // Check for recepient cert
                recipientCert = new cert.X509(recipientCert);
                if (keyEncryptionAlgorithm && typeof keyEncryptionAlgorithm !== 'string' &&
                        !keyEncryptionAlgorithm.algorithm) {
                    // Sender parameters
                    senderCert = senderKey;
                    senderKey = keyEncryptionAlgorithm;
                    keyEncryptionAlgorithm = undefined;
                }
                if (keyEncryptionAlgorithm) {
                    encryptionProvider = providers[keyEncryptionAlgorithm];
                } else
                    encryptionProvider = recipientCert.getProvider();

                // Check for content encryption key
                if (!self.contentEncryptionKey)
                    throw new Error('The content encryption key is not assigned');

                if (senderCert) {
                    // Sender certificate for agreement protocol
                    var senderCertChain;
                    if (senderCert instanceof Array) {
                        senderCertChain = senderCert;
                        senderCert = senderCertChain[0];
                    } else
                        senderCertChain = [senderCert];

                    // Add sender certificate
                    if (options.autoAddCert) {
                        if (!self.originatorInfo)
                            self.originatorInfo = {certs: []};
                        else if (!self.originatorInfo.certs)
                            self.originatorInfo.certs = [];
                        for (var i = 0, n = senderCertChain.length; i < n; i++) {
                            addUnique(self.originatorInfo.certs, senderCertChain[i], function (cert1, cert2) {
                                return equalNames(cert1.issuer, cert2.issuer) &&
                                        equalNumbers(cert1.serialNumber, cert2.serialNumber);
                            });
                        }
                    }
                    // Key Agreement
                    if (encryptionProvider)
                        keyEncryptionAlgorithm = expand(encryptionProvider.agreement);
                    else
                        encryptionProvider = recipientCert.getProvider();
                    // Certificates must have similar curve parameters
                    if (recipientCert.subjectPublicKeyInfo.algorithm.namedCurve !==
                            senderCert.subjectPublicKeyInfo.algorithm.namedCurve)
                        throw new Error('The sender and the recipient have different public key algorithms');
                    // Get private sender key
                    return subtle.importKey('pkcs8', senderKey.encode(), senderKey.privateKeyAlgorithm,
                            false, ['deriveKey']);
                } else {
                    // Key Transport
                    if (encryptionProvider)
                        keyEncryptionAlgorithm = expand(recipientCert.subjectPublicKeyInfo.algorithm);
                    else
                        encryptionProvider = recipientCert.getProvider();
                    // Generate key pair
                    return subtle.generateKey(keyEncryptionAlgorithm, true, ['deriveKey']).then(function (keyPair) {
                        keyEncryptionAlgorithm['public'] = keyPair.publicKey;
                        return keyPair.privateKey;
                    });
                }
            }).then(function (key) {
                privateKey = key;
                // Get public key from recipient certificate
                return subtle.importKey('spki', recipientCert.subjectPublicKeyInfo.encode(),
                        recipientCert.subjectPublicKeyInfo.algorithm, false, ['deriveKey', 'deriveBits']);
            }).then(function (publicKey) {
                // Derivate key encryption key
                keyEncryptionAlgorithm.ukm = getSeed(8);
                derivation = expand(encryptionProvider.agreement,
                        {sBox: keyEncryptionAlgorithm.sBox, ukm: keyEncryptionAlgorithm.ukm, 'public': publicKey});
                wrapping = expand(keyEncryptionAlgorithm.wrapping || encryptionProvider.wrapping,
                        {ukm: keyEncryptionAlgorithm.ukm});
                return subtle.deriveKey(derivation, privateKey, wrapping, true, ['wrapKey']);
            }).then(function (wrappingKey) {
                // Wrap content encryption key 
                keyEncryptionAlgorithm.wrapping = wrapping;
                return subtle.wrapKey('raw', self.contentEncryptionKey, wrappingKey, wrapping);
            }).then(function (wrappedKey) {
                // Create recipient info
                var recipientInfo;
                var useKeyIdentifier = options.useKeyIdentifier && recipientCert.extensions &&
                        recipientCert.extensions.subjectKeyIdentifier,
                        rid = useKeyIdentifier ? recipientCert.extensions.subjectKeyIdentifier : {
                            issuer: recipientCert.issuer,
                            serialNumber: recipientCert.serialNumber};
                if (senderCert) {
                    var spki = senderCert.subjectPublicKeyInfo;
                    recipientInfo = {// KeyAgreeRecipientInfo
                        version: 3, // always set to 3
                        originator: {
                            algorithm: spki.algorithm,
                            publicKey: spki.subjectPublicKey
                        },
                        ukm: keyEncryptionAlgorithm.ukm,
                        keyEncryptionAlgorithm: keyEncryptionAlgorithm,
                        recipientEncryptedKeys: [{// use only one recipient in domain
                                rid: rid,
                                encryptedKey: asn1.GostEncryptedKey(keyEncryptionAlgorithm).encode(wrappedKey)
                            }]
                    };
                } else {
                    recipientInfo = {
                        version: 0, // always set to 0 or 2
                        rid: rid,
                        keyEncryptionAlgorithm: keyEncryptionAlgorithm,
                        encryptedKey: asn1.GostEncryptedKey(keyEncryptionAlgorithm).encode({
                            algorithm: keyEncryptionAlgorithm,
                            sessionEncryptedKey: wrappedKey
                        })
                    };
                }
                self.recipientInfos.push(recipientInfo);
                return self;
            });
        },
        /**
         * Returns the decrypted content. 
         * 
         * @memberOf GostCMS.EnvelopedDataContentInfo
         * @instance
         * @param {GostASN1.PrivateKeyInfo} recipientKey The decryption key or password for derive key   
         * @param {GostCert.X509} recipientCert  The decryption key or password for derive key   
         * @param {(FormatedData|GostASN1.ContentInfo)} contentInfo The detached content (optional).
         * @param {GostCert.X509} originatorCert The originator certificate (optional).
         * @returns {Promise} Promise to return enclosed object {@ling GostASN1.ContentInfo} after decrypt content
         */
        getEnclosed: function (recipientKey, recipientCert, contentInfo, originatorCert)
        {
            var self = this, wrappedKey, encryptedContent, derivation, wrapping, encryption;
            return new Promise(call).then(function () {
                var encryptionProvider = recipientCert.getProvider();
                // Append attached
                if (contentInfo)
                    self.setEnclosed(contentInfo);
                encryptedContent = self.encryptedContentInfo.encryptedContent;
                if (!encryptedContent)
                    throw new Error('Encrypted content must be specified');

                encryption = self.encryptedContentInfo.contentEncryptionAlgorithm;

                // Find receiver
                for (var i = 0; i < self.recipientInfos.length; i++) {
                    var recipientInfo = self.recipientInfos[i],
                            algorithm = expand(recipientInfo.keyEncryptionAlgorithm);
                    if (recipientInfo.rid) {
                        if (matchCert(recipientInfo.rid, recipientCert)) {
                            // Algorithm and wrapped key
                            var transportKey = asn1.GostEncryptedKey(algorithm).decode(recipientInfo.encryptedKey).object;
                            wrappedKey = transportKey.sessionEncryptedKey;
                            algorithm = expand(algorithm, transportKey.algorithm);
                            derivation = expand(encryptionProvider.agreement, {ukm: algorithm.ukm, sBox: algorithm.sBox});
                            wrapping = expand(encryptionProvider.wrapping, algorithm.wrapping, {ukm: algorithm.ukm});
                            return algorithm['public'];
                        }
                    } else {
                        var keys = recipientInfo.recipientEncryptedKeys;
                        if (keys) {
                            for (var j = 0; j < keys.length; j++) {
                                if (matchCert(keys[j].rid, recipientCert)) {
                                    // Algorithm and wrapped key
                                    algorithm = expand(encryptionProvider.agreement, algorithm, {ukm: recipientInfo.ukm});
                                    wrappedKey = asn1.GostEncryptedKey(algorithm).decode(keys[j].encryptedKey).object;
                                    derivation = algorithm;
                                    wrapping = expand(algorithm.wrapping || encryptionProvider.wrapping, {ukm: recipientInfo.ukm});
                                    // Check originator
                                    var originator = recipientInfo.originator;
                                    if (originator.algorithm) {
                                        var spki = new asn1.SubjectPublicKeyInfo({
                                            algorithm: originator.algorithm,
                                            subjectPublicKey: originator.publicKey});
                                        return subtle.importKey('spki', spki.encode(), spki.algorithm, false, ['deriveKey', 'deriveBits']);
                                    } else if (originatorCert && matchCert(originator, originatorCert))
                                        return importKey('pkcs', originatorCert.subjectPublicKeyInfo.encode(),
                                                originatorCert.subjectPublicKeyInfo.algorithm, false, ['deriveKey', 'deriveBits']);
                                    else
                                        throw Error('Originator certificate not specified or not valid');
                                }
                            }
                        }
                    }
                }
                throw new Error('Recipient not found or format not supported');
            }).then(function (publicKey) {
                derivation['public'] = publicKey;
                // Import private key
                return subtle.importKey('pkcs8', recipientKey.encode(), recipientKey.privateKeyAlgorithm,
                        false, ['deriveKey', 'deriveBits']);
            }).then(function (privateKey) {
                // Derive key
                return subtle.deriveKey(derivation, privateKey, wrapping, true, ['unwrapKey']);
            }).then(function (unwrappingKey) {
                // Unwrap key
                return subtle.unwrapKey('raw', wrappedKey, unwrappingKey,
                        wrapping, encryption, false, ['decrypt']);
            }).then(function (encryptionKey) {
                // Decrypt content
                return subtle.decrypt(encryption, encryptionKey, encryptedContent);
            }).then(function (decryptedContent) {
                return createContentInfo({
                    contentType: self.encryptedContentInfo.contentType,
                    content: decryptedContent
                });
            });
        }
    });

    /**
     * This class encapsulates a CMS object of content type enveloped-data.
     * 
     * @memberOf GostCMS
     * @type GostCMS.EnvelopedDataContentInfo
     */
    GostCMS.prototype.EnvelopedDataContentInfo = EnvelopedDataContentInfo;

    /**
     * Implements the Cryptographic Message Syntax as specified in RFC-2630.
     * 
     * @memberOf gostCrypto
     * @type GostCMS
     */
    gostCrypto.cms = new GostCMS();

module.exports = GostCMS;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostCert.js":
/*!*******************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostCert.js ***!
  \*******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file Provides facilities for handling certificates, CRLs, etc.
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice, this 
 *    list of conditions and the following disclaimer.
 *    
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");

    /*
     * Common algorithms
     * 
     */
    var root = __webpack_require__.g;
    var Promise = root.Promise;
    var Object = root.Object;
    var CryptoOperationData = root.ArrayBuffer;
    var Date = root.Date;

    // Crypto subtle
    var subtle = gostCrypto.subtle;

    // Coding
    var coding = gostCrypto.coding;

    // ASN.1 syntax
    var asn1 = gostCrypto.asn1;

    // Providers
    var providers = gostCrypto.security.providers;

    // Expand javascript object
    function expand(r) {
        for (var i = 1, n = arguments.length; i < n; i++) {
            var item = arguments[i];
            if (typeof item === 'object')
                for (var name in item)
                    if (item.hasOwnProperty(name))
                        r[name] = item[name];
        }
        return r;
    }

    // Extend javascript class
    // function extend(Class) {
    //     var F = function () {
    //     };
    //     F.prototype = Class.prototype;
    //     var r = new F, args = [r];
    //     for (var i = 1; i < arguments.length; i++)
    //         args.push(arguments[i]);
    //     return expand.apply(this, args);
    // }

    // Today date + n days
    function today(n) {
        var date = new Date();
        date.setHours(0, 0, 0, 0);
        if (n)
            date.setDate(date.getDate() + n);
        return date;
    }

    // Self resolver
    function call(callback) {
        try {
            callback();
        } catch (e) {
        }
    }

    // Serial number
    function genSerialNumber() {
        var seed = new Uint8Array(4);
        gostCrypto.getRandomValues(seed);
        seed[0] = seed[0] & 0x7f;
        return coding.Int16.encode(seed);
    }

    // True if equal numbers
    var equalNumbers = (function () {
        // Convert number to bigendian hex string
        var hex = function (s) {
            var t = typeof s;
            return t === 'undefined' || s === '' ? '0' :
                    t === 'number' || s instanceof Number ? s.toString(16).toLowerCase() :
                    s.replace('0x', '').toLowerCase();
        };
        // Zero left padding
        var lpad = function (s, size) {
            return (new Array(size + 1).join('0') + s).slice(-size);
        };
        return function (s1, s2) {
            s1 = hex(s1);
            s2 = hex(s2);
            var len = Math.max(s1.length, s2.length);
            return lpad(s1, len) === lpad(s2, len);
        };
    })();

    // Check equal names
    function equalNames(name1, name2) {
        for (var key in name1)
            if (name1[key] !== name2[key])
                return false;
        for (var key in name2)
            if (name1[key] !== name2[key])
                return false;
        return true;
    }

    // Check the buffers to equal
    function equalBuffers(r1, r2) {
        var s1 = new Uint8Array(r1),
                s2 = new Uint8Array(r2);
        if (s1.length !== s2.length)
            return false;
        for (var i = 0, n = s1.length; i < n; i++)
            if (s1[i] !== s2[i])
                return false;
        return true;
    }

    // Match certificate
    function matchCertificate(cert, selector) {
        var skid = cert.extensions && cert.extensions.subjectKeyIdentifier;
        return (cert && selector &&
                (!selector.issuer || equalNames(cert.issuer, selector.issuer)) &&
                (!selector.serialNumber || equalNumbers(cert.serialNumber, selector.serialNumber)) &&
                (!selector.subjectKeyIdentifier || equalBuffers(skid, selector.subjectKeyIdentifier)) &&
                (!selector.subject || equalNames(cert.subject, selector.subject)) &&
                (!selector.date || (cert.notBefore.getTime() <= selector.date.getTime() &&
                        cert.notAfter.getTime() > selector.date.getTime())));
    }

    // Create authority certificate selector
    function authoritySelector(cert, extensions, date) {
        var selector = {subject: cert.issuer, date: date},
        akid = extensions && extensions.authorityKeyIdentifier;
        if (akid) {
            selector.subjectKeyIdentifier = akid.keyIdentifier;
            if (akid.authorityCertIssuer && akid.authorityCertIssuer[0] &&
                    akid.authorityCertSerialNumber) {
                selector.issuer = akid.authorityCertIssuer[0];
                selector.serialNumber = akid.authorityCertSerialNumber;
            }
        }
        return selector;
    }

    // Find certificates
    function selectCertificates(certs, selector) {
        var result = [];
        for (var i = 0, n = certs.length; i < n; i++)
            if (matchCertificate(certs[i], selector))
                result.push(certs[i]);
        return result;
    }

    // Match CRL
    function matchCRL(crl, selector) {
        return ((!selector.issuer || equalNames(crl.issuer, selector.issuer)) &&
                (!selector.date || (crl.thisUpdate.getTime() < selector.date.getTime())));
    }

    // Find certificates
    function selectCRLs(crls, selector) {
        var result = [];
        for (var i = 0, n = crls.length; i < n; i++)
            if (matchCRL(crls[i], selector))
                result.push(crls[i]);
        return result;
    }

    // Define provider for key algorithm
    function keyProvider(algorithm) {
        var id = algorithm.id;
        for (var name in providers) {
            var provider = providers[name];
            if (provider.publicKey.id === id)
                return provider;
        }
    }

    function defineProperty(object, name, descriptor, enumerable) {
        if (typeof descriptor !== 'object')
            descriptor = {value: descriptor};
        if (enumerable !== undefined)
            descriptor.enumerable = enumerable;
        Object.defineProperty(object, name, descriptor);
    }

    function defineProperties(object, properties, enumerable) {
        for (var name in properties)
            defineProperty(object, name, properties[name], enumerable);
    }

    // Extend javascript class
    function extend(Super, Class, propertiesObject, propertiesClass) {
        // If constructor not defined
        if (typeof Class !== 'function') {
            propertiesClass = propertiesObject;
            propertiesObject = Class;
            Class = function () {
                Super.apply(this, arguments);
            };
        }
        // Create prototype properties
        Class.prototype = Object.create(Super.prototype, {
            constructor: {
                value: Class
            },
            superclass: {
                value: Super.prototype
            }
        });
        if (propertiesObject)
            defineProperties(Class.prototype, propertiesObject, true);
        // Inherites super class properties
        if (Super !== Object)
            for (var name in Super)
                Class[name] = Super[name];
        Class.super = Super;
        if (propertiesClass)
            defineProperties(Class, propertiesClass, true);
        return Class;
    }



    /**
     * Provides facilities for handling certificates, CRLs, etc.
     * 
     * @class GostCert
     */
    function GostCert() {
    }

    /**
     * Certificate templates
     * <ul>
     *      <li>providerName - provider name for key generation, default 'CP-01'</li>
     *      <li>subject - template of subject name {countryName: 'RU', commonName: 'Anonymous'}</li>
     *      <li>caKeyUsage - default key usages for a CA certificates 
     *          ['digitalSignature', 'nonRepudiation', 'keyEncipherment',
     *          'dataEncipherment', 'keyAgreement', 'keyCertSign', 'cRLSign']</li>
     *      <li>caExtKeyUsage - default extended key usages for a CA certificates 
     *          ['serverAuth', 'clientAuth', 'codeSigning', 'emailProtection', 'ipsecEndSystem',
     *          'ipsecTunnel', 'ipsecUser', 'timeStamping', 'OCSPSigning']</li>
     *      <li>userKeyUsage - default key usages for a user certificate 
     *          ['digitalSignature', 'nonRepudiation', 'keyEncipherment', 'dataEncipherment', 'keyAgreement'],
     *      <li>userExtKeyUsage - default extended key usages for user certificate 
     *          ['clientAuth', 'emailProtection']</li>
     *      <li>days - validity of the certificate in days, default 7305</li>
     * </ul>
     * 
     * @memberOf GostCert
     * @instance
     */
    var options = {
        providerName: 'CP-01',
        subject: {countryName: 'RU', commonName: 'Anonymous'},
        caKeyUsage: ['digitalSignature', 'nonRepudiation', 'keyEncipherment',
            'dataEncipherment', 'keyAgreement', 'keyCertSign', 'cRLSign'],
        caExtKeyUsage: ['serverAuth', 'clientAuth', 'codeSigning', 'emailProtection', 'ipsecEndSystem',
            'ipsecTunnel', 'ipsecUser', 'timeStamping', 'OCSPSigning'],
        userKeyUsage: ['digitalSignature', 'nonRepudiation', 'keyEncipherment', 'dataEncipherment', 'keyAgreement'],
        userExtKeyUsage: ['clientAuth', 'emailProtection'],
        days: 7305
    };

    GostCert.prototype.options = options;

    /**
     * This class encapsulates X.509 Version 3 certificates.<br><br>
     * 
     * Constructs an X.509 certificate from the given DER encoding or ASN.1 Certificate object.
     * 
     * @class GostCert.X509
     * @extends GostASN1.Certificate
     * @param {(FormatedData|GostASN1.Certificate)} cert The certificate
     */
    var X509 = function (cert)
    {
        try {
            // Try to use decode X.509 certificate
            asn1.Certificate.call(this, cert, true);
        } catch (e) {
            try {
                // Try to decode certification request
                cert = new asn1.CertificationRequest(cert, true);
            } catch (e) {
            }
            // Create new certificate structure
            cert = cert || {};
            asn1.Certificate.call(this, {
                version: 2,
                serialNumber: cert.serialNumber || genSerialNumber(),
                signature: cert.signature || {id: 'noSignature'},
                issuer: cert.subject || options.subject,
                notBefore: cert.notBefore || today(),
                notAfter: cert.notAfter ||
                        today(cert.days || options.days),
                subject: cert.subject || options.subject,
                subjectPublicKeyInfo: cert.subjectPublicKeyInfo || {
                    algorithm: {id: 'noSignature'},
                    subjectPublicKey: new CryptoOperationData(0)
                },
                extensions: (cert.attributes && (cert.attributes.extensionRequest ||
                        cert.attributes.msCertExtensions)) || cert.extensions,
                signatureAlgorithm: {id: 'noSignature'},
                signatureValue: new CryptoOperationData(0)
            });
        }
    };

    extend(asn1.Certificate, X509, {
        /**
         * Generate the contents of this certificate and sign it.<br><br>
         * 
         * If issuerCertificate is not defined self signed certificate generated
         * 
         * @memberOf GostCert.X509
         * @instance
         * @param {GostASN1.PrivateKeyInfo} issuerPrivateKey The issuer's private key
         * @param {GostCert.X509} issuerCertificate The issuer's certificate or undefined for self-signed certificate
         * @returns {Promise} Promise to return self object after sign the certificate
         */
        sign: function (issuerPrivateKey, issuerCertificate)
        {

            var self = this, spki = self.subjectPublicKeyInfo;
            return new Promise(call).then(function () {

                // Need generated key
                if (!spki || !spki.algorithm || spki.algorithm === 'noSignature')
                    throw new Error('Key pair was not generated for the certificate');
                // Check issuer private key
                if (!issuerPrivateKey)
                    throw new Error('The private key of the issuer is not defined');
                        
                // Certificate can be self signed
                issuerCertificate = issuerCertificate || self;

                // Calculate subject key indentifier
                return subtle.digest('SHA-1', spki.subjectPublicKey);
            }).then(function (digest) {

                // Signature algorithm
                var provider = issuerCertificate.getProvider() || providers[options.providerName];
                if (!self.signature || self.signature.id === 'noSignature')
                    self.signature = provider.signature;
                self.signatureAlgorithm = self.signature;

                // Set issuer
                self.issuer = issuerCertificate.subject;
                // Set default extensions
                if (!self.extensions)
                    self.extensions = {};
                var exts = self.extensions, ae = issuerCertificate.extensions;
                if (self === issuerCertificate) { // Self-signed CA certificate
                    // Set key usage
                    exts.keyUsage = exts.keyUsage || options.caKeyUsage;
                    exts.extKeyUsage = exts.extKeyUsage || options.caExtKeyUsage;
                    // Set basic constraints
                    exts.basicConstraints = exts.basicConstraints || {cA: true};
                } else {
                    // Check key usage and validity
                    if (!issuerCertificate.checkUsage('keyCertSign', self.notBefore))
                        throw new Error('The issuer\'s certificate is not valid for signing a certificate');

                    // Set key usage
                    exts.keyUsage = exts.keyUsage || options.userKeyUsage;
                    exts.extKeyUsage = exts.extKeyUsage || options.userExtKeyUsage;
                    // Set basic constraints
                    exts.basicConstraints = exts.basicConstraints || {
                        cA: exts.keyUsage.indexOf('keyCertSign') >= 0
                    };
                    // Check path length constraint
                    if (exts.basicConstraints.cA) {
                        var pathLen = ae && ae.basicConstraints && ae.pathLenConstraint;
                        if (pathLen !== undefined) {
                            if (pathLen > 0)
                                exts.basicConstraints.pathLenConstraint = pathLen - 1;
                            else
                                throw new Error('Path length constraint exceeded');
                        }
                    }
                }
                // Subject key identifier 160 bit from public key hash
                exts.subjectKeyIdentifier = digest;
                // Authority key identifier
                if (ae && ae.subjectKeyIdentifier)
                    exts.authorityKeyIdentifier = {
                        keyIdentifier: ae.subjectKeyIdentifier,
                        authorityCertIssuer: [issuerCertificate.issuer],
                        authorityCertSerialNumber: issuerCertificate.serialNumber};

                // Import the private key
                return subtle.importKey('pkcs8', issuerPrivateKey.encode(), issuerPrivateKey.privateKeyAlgorithm, false, ['sign']);
            }).then(function (key) {

                // Sign certificate
                return subtle.sign(self.signatureAlgorithm, key, self.tbsCertificate.encode());
            }).then(function (signatureValue) {
                // Siganture value
                self.signatureValue = signatureValue;

                return self;
            });
        },
        /**
         * Generate key pair for certificate
         * 
         * @memberOf GostCert.X509
         * @instance
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The key algorithm or name of provider
         * @returns {Promise} Promise to return {@link GostASN1.PrivateKeyInfo} after self-signed certificate generation
         */
        generate: function (keyAlgorithm)
        {
            var self = this, privateKey, provider;
            if (keyAlgorithm)
                provider = providers[keyAlgorithm];
            else
                provider = this.getProvider() || providers[options.providerName];
            if (provider)
                keyAlgorithm = expand(provider.publicKey, {privateKey: provider.privateKey});

            return new Promise(call).then(function () {

                // Generate key pair
                return subtle.generateKey(keyAlgorithm, 'true', ['sign', 'verify']);
            }).then(function (keyPair) {
                privateKey = keyPair.privateKey;

                // Export public key
                return subtle.exportKey('spki', keyPair.publicKey);
            }).then(function (spki) {
                self.subjectPublicKeyInfo = new asn1.SubjectPublicKeyInfo(spki);

                return subtle.exportKey('pkcs8', privateKey);
            }).then(function (pkcs8) {

                return new asn1.PrivateKeyInfo(pkcs8);
            });
        },
        /**
         * Gets the public key.
         * 
         * @memberOf GostCert.X509
         * @instance
         * @returns {Promise} Promise to return {@link Key}
         */
        getPublicKey: function ()
        {
            var spki = this.subjectPublicKeyInfo,
                    keyUsages = (spki.algorithm.id === 'rsaEncryption') ? ['verify'] :
                    ['verify', 'deriveKey', 'deriveBits'];
            return subtle.importKey('spki', spki.encode(), spki.algorithm, 'false', keyUsages);
        },
        /**
         * Get appropriate crypto provider for public key
         * 
         * @memberOf GostCert.X509
         * @instance
         * @returns Object Set of crypto provider algorithms
         */
        getProvider: function ()
        {
            return keyProvider(this.subjectPublicKeyInfo.algorithm);
        },
        /**
         * Verifies this certificate.<br><br>
         * 
         * More precisely:<br><br>
         * <ul>
         *      <li>Verifies that the current VM date/time is within the validity period of the certificate.</li>
         *      <li>If an unrecognized critical extension is present, the certificate is rejected.</li> 
         *      <li>If the issuer certificate has been set, verifies that the signing certificate is a 
         *          CA certificate, and that the signature is correct. The signing certificate is considered 
         *          to be a CA certificate unless one of the following two conditions hold: The signing 
         *          certificate contains a basicConstraints extension, and the CA flag is false; or the 
         *          signing certificate contains a keyUsage extension, the keyUsage extension is marked 
         *          critical, and the keyCertSign bit is false.</li>
         *      <li>If the issuer CRL has been set, verifies that the certificate has not been revoked.</li>
         * </ul>
         * 
         * @memberOf GostCert.X509
         * @instance
         * @param {GostCert.X509} issuerCertificate The issuer X.509 certificate
         * @param {GostCert.CRL} issuerCRL The issuer CRL
         * @param {Date} date Validation date. Default current date
         * @returns {Promise} Promise to return self object if the certificate is valid
         */
        verify: function (issuerCertificate, issuerCRL, date)
        {
            var self = this, exts = self.extensions;
            return new Promise(call).then(function () {
                // Current date
                date = date || today();
                if (self.notBefore.getTime() > date.getTime() ||
                        self.notAfter.getTime() <= date.getTime())
                    throw new Error('The certificate has not yet started or expired');
                // A unrecognized critical extensions 
                for (var name in exts) {
                    var value = exts[name];
                    if (value.critical &&
                            ['authorityKeyIdentifier', 'subjectKeyIdentifier', 'keyUsage', 'certificatePolicies',
                                'policyMappings', 'basicConstraints', 'nameConstraints', 'policyConstraints',
                                'extKeyUsage'].indexOf(name) < 0)
                        throw new Error('The critical extension \'' + name + '\' is unrecognized');
                }
                // The certificate can be self-signed
                var selector = authoritySelector(self, exts, self.notBefore);
                if (!issuerCertificate && matchCertificate(self, selector))
                    issuerCertificate = self;
                // Check issuer
                if (issuerCertificate) {
                    if (!matchCertificate(issuerCertificate, selector) ||
                            !issuerCertificate.checkUsage('keyCertSign', self.notBefore))
                        throw new Error('The issuer\'s certificate is not valid');
                    // Check certificate signature
                    return issuerCertificate.verifySignature(self.tbsCertificate.encode(),
                            self.signatureValue, self.signatureAlgorithm);
                }
                return true;
            }).then(function (result) {
                if (!result)
                    throw new Error('The certificate has invalid signature');
                // Check CRL
                if (issuerCRL) {
                    if (!matchCRL(issuerCRL, {issuer: self.issuer, date: date}))
                        throw new Error('The issuer\'s CRL is not valid');
                    if (issuerCRL.isRevoked(self.serialNumber))
                        throw new Error('The certificate is revoked');
                }
                return self;
            });
        },
        /**
         * Verify a signature made with this certificate's public key.
         * 
         * @memberOf GostCert.X509
         * @instance
         * @param {CryptoOperationData} data The signed document.
         * @param {CryptoOperationData} signature The signature
         * @param {AlgorithmIdentifier} algorithm The algorithm ID used for the signature.
         * @returns {Promise} Promise to return true if the signature is verified, and false otherwise
         */
        verifySignature: function (data, signature, algorithm)
        {
            return this.getPublicKey().then(function (publicKey) {
                return subtle.verify(algorithm, publicKey, signature, data);
            });
        },
        /**
         * Check key usage and date validation
         * 
         * @memberOf GostCert.X509
         * @instance
         * @param {DOMString} operation The operation
         * @param {Date} date Operation date. Default current date
         * @returns {boolean} 
         */
        checkUsage: function (operation, date)
        {
            var self = this, exts = self.extensions;
            date = date || today();
            return (self.notBefore.getTime() <= date.getTime() && self.notAfter.getTime() > date.getTime()) &&
                    (!exts || !((['keyCertSign', 'cRLSign'].indexOf(operation) > 0 && exts.basicConstraints && !exts.basicConstraints.cA) ||
                            ((exts.keyUsage && exts.keyUsage.indexOf(operation) < 0) && (exts.extKeyUsage && exts.extKeyUsage.indexOf(operation) < 0))));
        }
    });

    /**
     * This class encapsulates X.509 Version 3 certificates.
     * 
     * @memberOf GostCert
     * @type GostCert.X509
     */
    GostCert.prototype.X509 = X509;

    /**
     * This class encapsulates a X.509 certificate revocation list (CRL) of RevokedCertificate objects.<br><br>
     *
     * Note: the methods and constructors that input a CRL do not automatically verify it. 
     * You need to explicitly call the verify method.
     *  
     * @class GostCert.CRL       
     * @extends GostASN1.CertificateList
     * @param {(FormatedData|GostASN1.CertificateList)} crl
     */
    var CRL = function (crl)
    {
        // Call super
        CRL.super.call(this, crl);
        // Initialize defaults
        if (!this.version)
            this.version = 1;
        if (!this.revokedCertificates)
            this.revokedCertificates = [];
        if (!this.thisUpdate)
            this.thisUpdate = today();
    };

    extend(asn1.CertificateList, CRL, {
        /**
         * Signs this CRL. The issuer's private key has to be set. The default random number generator is used, if needed.<br><br>
         * 
         * Note: Making any modifications to the contents of the CRL after signing invalidates the signature. 
         * The sign method must be invoked again after any modifications for a valid signature to be computed.
         * 
         * @memberOf GostCert.CRL
         * @instance
         * @param {GostASN1.PrivateKeyInfo} issuerPrivateKey the issuer's private signing key
         * @param {GostCert.X509} issuerCertificate the issuer's certificate
         * @returns {Promise} Promise to return self object after sign the CRL
         */
        sign: function (issuerPrivateKey, issuerCertificate)
        {

            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Check issuer private key
                if (!issuerPrivateKey)
                    throw new Error('The issuer\'s private key is not defined');
                // Check issuer certificate
                if (!issuerCertificate)
                    throw new Error('The issuer\'s certificate is not defined');
                // Check issuer name
                if (!self.issuer)
                    self.issuer = issuerCertificate.issuer;
                else if (!equalNames(self.issuer, issuerCertificate.issuer))
                    throw new Error('The CRL prototype and authority certificate have different issuers');
                // Check key usage and validity
                if (!issuerCertificate.checkUsage('cRLSign', self.thisUpdate))
                    throw new Error('The issuer\'s certificate is not valid for signing a CRL');

                // Signature algorithm
                var provider = issuerCertificate.getProvider() || providers[options.providerName];
                if (!self.signature)
                    self.signature = provider.signature;
                self.signatureAlgorithm = self.signature;

                // Set issuer
                self.issuer = issuerCertificate.subject;
                // Set default extensions
                if (!self.crlExtensions)
                    self.crlExtensions = {};
                var exts = self.crlExtensions,
                        ae = issuerCertificate.extensions;
                if (ae && ae.subjectKeyIdentifier)
                    exts.authorityKeyIdentifier = {
                        keyIdentifier: ae.subjectKeyIdentifier,
                        authorityCertIssuer: [issuerCertificate.issuer],
                        authorityCertSerialNumber: issuerCertificate.serialNumber};
                exts.cRLNumber = exts.cRLNumber || 0;

                // Import the private key
                return subtle.importKey('pkcs8', issuerPrivateKey.encode(),
                        issuerPrivateKey.privateKeyAlgorithm, false, ['sign']);
            }).then(function (key) {

                // Sign CRL
                return subtle.sign(self.signatureAlgorithm, key, self.tbsCertList.encode());
            }).then(function (signatureValue) {

                // Siganture value
                self.signatureValue = signatureValue;
                return self;
            });
        },
        /**
         * Verify the CRL. Checks the date and signature if issuer's certifiate has been defined.
         * 
         * @memberOf GostCert.CRL
         * @instance
         * @param {GostCert.X509} issuerCertificate the issuer's certificate
         * @param {Date} date Validation date. Default current date
         * @returns {Promise} Promise to return self object if the certificate is valid
         */
        verify: function (issuerCertificate, date)
        {
            var self = this, exts = self.crlExtensions;
            return new Promise(call).then(function () {
                // Current date
                date = date || today();
                if (!self.thisUpdate.getTime() > date.getTime())
                    throw new Error('The CRL has not yet started');
                // Check issuer
                if (issuerCertificate) {
                    if (!matchCertificate(issuerCertificate, authoritySelector(self, exts, self.thisUpdate)) ||
                            !issuerCertificate.checkUsage('cRLSign', self.thisUpdate))
                        throw new Error('The issuer\'s certificate is not valid');
                    if (!self.signatureValue || !self.signatureAlgorithm)
                        throw new Error('The has no signature');
                    // Check CRL signature
                    return issuerCertificate.verifySignature(self.tbsCertList.encode(),
                            self.signatureValue, self.signatureAlgorithm);
                }
            }).then(function (result) {
                if (!result)
                    throw new Error('The CRL has invalid signature');
                return self;
            });
        },
        /**
         * Checks whether this certificate serial number is on the list.
         * 
         * @memberOf GostCert.CRL
         * @instance
         * @param {Number} serialNumber the issuer's certificate
         * @param {Date} date Validation date. Default current date
         * @returns {boolean} True if the certificate is valid, and false otherwise
         */
        isRevoked: function (serialNumber, date)
        {
            var rc = this.revokedCertificates;
            date = date || today();
            for (var i = 0; i < rc.length; i++) {
                // Check date and serial number
                if (date.getTime() >= rc[i].revocationDate.getTime() &&
                        equalNumbers(rc[i].userCertificate, serialNumber))
                    return true;
            }
            return false;
        }
    });

    /**
     * This class encapsulates a X.509 certificate revocation list (CRL) of RevokedCertificate objects.
     * 
     * @memberOf GostCert
     * @type GostCert.CRL
     */
    GostCert.prototype.CRL = CRL;

    /**
     * A class that encapsulates a DER-encoded PKCS #10 certificate request. The request contains 
     * the subject's name and public key, and it is signed with the subject's private key. 
     * The public key contained in the request is used to verify the signature. 
     * The signature on the request is verified automatically when the request is read. 
     * Note that the subject's private key is used only to produce a signature when the request is output, 
     * and is not actually stored with the request.
     * 
     * @class GostCert.Request
     * @extends GostASN1.CertificationRequest
     * @param {(FormatedData|GostASN1.CertificationRequest)} req
     */
    function Request(req)
    {
        try {
            // Try to use encode
            asn1.CertificationRequest.call(this, req, true);
        } catch (e) {
            // Create new certificate structure
            req = req || {};
            asn1.CertificationRequest.call(this, {
                version: 0,
                subject: req.subject || options.subject,
                subjectPublicKeyInfo: req.subjectPublicKeyInfo || {
                    algorithm: {id: 'noSignature'},
                    subjectPublicKey: new CryptoOperationData(0)
                },
                attributes: req.attributes || {
                    extensionRequest: {
                        keyUsage: options.userKeyUsage,
                        extKeyUsage: options.userExtKeyUsage
                    }
                },
                signatureAlgorithm: {id: 'noSignature'},
                signatureValue: new CryptoOperationData(0)
            });
        }
    }

    extend(asn1.CertificationRequest, Request, {
        /**
         * Generate key pair and sign request
         * 
         * @memberOf GostCert.Request
         * @instance
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm
         * @returns {Promise} Promise to return {@link GostASN1.PrivateKeyInfo} after request generation
         */
        generate: function (keyAlgorithm)
        {
            var self = this, privateKey, provider;
            if (keyAlgorithm)
                provider = providers[keyAlgorithm];
            else
                provider = this.getProvider() || providers[options.providerName];
            if (provider)
                keyAlgorithm = expand(provider.publicKey, {privateKey: provider.privateKey});

            return new Promise(call).then(function () {

                // Generate key pair
                return subtle.generateKey(keyAlgorithm, 'true', ['sign', 'verify']);
            }).then(function (keyPair) {
                privateKey = keyPair.privateKey;

                // Export public key
                return subtle.exportKey('spki', keyPair.publicKey);
            }).then(function (spki) {
                self.subjectPublicKeyInfo = new asn1.SubjectPublicKeyInfo(spki);

                return subtle.exportKey('pkcs8', privateKey);
            }).then(function (pkcs8) {
                privateKey = new asn1.PrivateKeyInfo(pkcs8);

                // Sign request
                return self.sign(privateKey);
            }).then(function () {

                return privateKey;
            });
        },
        /**
         * Get appropriate crypto provider for public key
         * 
         * @memberOf GostCert.Request
         * @instance
         * @returns Object Set of crypto provider algorithms
         */
        getProvider: function ()
        {
            return keyProvider(this.subjectPublicKeyInfo.algorithm);
        },
        /**
         * Generate the contents of this request and sign it.<br><br>
         * 
         * @memberOf GostCert.Request
         * @instance
         * @param {GostASN1.PrivateKeyInfo} privateKey The subject's private key
         * @returns Promise to return self object after sign the request
         */
        sign: function (privateKey)
        {

            var self = this, spki = self.subjectPublicKeyInfo;
            return new Promise(call).then(function () {

                // Need generated key
                if (!spki || !spki.algorithm || spki.algorithm === 'noSignature')
                    throw new Error('Key pair was not generated for the certificate');
                // Check issuer private key
                if (!privateKey)
                    throw new Error('The private key is not defined');

                // Signature algorithm
                var provider = keyProvider(spki.algorithm) || providers[options.providerName];
                self.signatureAlgorithm = provider.signature;

                // Import the private key
                return subtle.importKey('pkcs8', privateKey.encode(),
                        privateKey.privateKeyAlgorithm, false, ['sign']);
            }).then(function (key) {

                // Sign the certification request
                return subtle.sign(self.signatureAlgorithm, key, self.requestInfo.encode());
            }).then(function (signatureValue) {

                // Siganture value
                self.signatureValue = signatureValue;
                return self;
            });
        },
        /**
         * Verify the Certification Request. Checks the signature on the public key in the request.
         * 
         * @memberOf GostCert.Request
         * @instance
         * @returns {Promise} Promise to return self object  if the certificate is valid
         */
        verify: function ()
        {
            var self = this, spki = self.subjectPublicKeyInfo;
            return new Promise(call).then(function () {

                // Import key
                return subtle.importKey('spki', spki.encode(), spki.algorithm, 'false', ['verify']);
            }).then(function (publicKey) {

                // Verify signature
                return subtle.verify(self.signatureAlgorithm, publicKey, self.signatureValue,
                        self.requestInfo.encode());
            }).then(function (result) {
                if (!result)
                    throw new Error('The certification request has invalid signature');
                return self;
            });
        }
    });

    /**
     * A class that encapsulates a DER-encoded PKCS #10 certificate request.
     * 
     * @memberOf GostCert
     * @type GostCert.Request
     */
    GostCert.prototype.Request = Request;

    /**
     * A class for retrieving Certificates and CRLs from a repository.<br><br>
     * 
     * Once the CertStore has been created, it can be used to retrieve Certificates 
     * and CRLs by calling its getCertificates and getCRLs methods. Unlike a KeyStore, 
     * which provides access to a cache of private keys and trusted certificates, 
     * a CertStore is designed to provide access to a potentially vast repository 
     * of untrusted certificates and CRLs.
     * 
     * @class GostCert.CertStore
     * @param {GostCert.X509[]} certificates Certificates
     * @param {GostCert.CRL[]} crls CLRs
     */
    function CertStore(certificates, crls)
    {
        this.certificates = certificates || [];
        this.crls = crls || [];
    }

    extend(Object, CertStore, {
        /**
         * Returns a Array of Certificates that match the specified selector.
         * 
         * @memberOf GostCert.CertStore
         * @instance
         * @param {GostCert.CertSelector} selector Certificate filter selector
         * @returns {GostCert.X509[]} Selected certificates
         */
        getCertificates: function (selector)
        {
            return selectCertificates(this.certificates, selector);
        },
        /**
         * Returns a Collection of CRLs that match the specified selector.
         * 
         * @memberOf GostCert.CertStore
         * @instance
         * @param {GostCert.CertSelector} selector CRL filter selector
         * @returns {GostCert.CRL[]} selected CRLs
         */
        getCRLs: function (selector)
        {
            return selectCRLs(this.certificates, selector);
        },
        /**
         * Loads this CertStore from the given PKCS#7 formated input stream.
         * 
         * @memberOf GostCert.CertStore
         * @instance
         * @param {(FormatedData|GostASN1.ContentInfo)} store The input stream from which the certstore is loaded
         * @returns {GostCert.CertStore} Self object after store loaded
         */
        load: function (store)
        {
            var info = new asn1.ContentInfo(store),
                    certs = info.certificates, crls = info.crls;
            for (var i = 0; i < certs.length; i++)
                this.certificates.push(new X509(certs[i]));
            for (var i = 0; i < crls.length; i++)
                this.crls.push(new CRL(crls[i]));
            return this;
        },
        /**
         * Stores this CertStore to the given output stream in PKCS#7 format.
         * 
         * @memberOf GostCert.CertStore
         * @instance
         * @returns {GostASN1.ContentInfo} PKCS#7 content info with certificates and crls from CertStore
         */
        store: function ()
        {
            return new asn1.ContentInfo({
                contentType: 'signedData',
                version: 0,
                digestAlgorithms: [],
                encapContentInfo: {contentType: 'data'},
                certificates: this.certs,
                crls: this.crls,
                signerInfos: []
            });
        }
    });

    /**
     * A class for retrieving Certificates and CRLs from a repository.
     * 
     * @memberOf GostCert
     * @type GostCert.Request
     */
    GostCert.prototype.CertStore = CertStore;

    /**
     * A class for building and validating certification paths (also known as certificate chains).
     * 
     * @class GostCert.CertPath
     * @param {GostCert.CertStore} certStore
     */
    function CertPath(certStore)
    {
        this.certStore = certStore;
    }

    extend(Object, CertPath, {
        /**
         * Attempts to build a certification path using the specified algorithm parameter set.
         * 
         * @memberOf GostCert.CertPath
         * @instance
         * @param {GostCert.X509} certificate Starting path certificate 
         * @param {Date} date Validation date. Default today
         * @returns {Promise} Promise to return array of {@link GostCert.X509} with certification path
         */
        build: function (certificate, date)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Build certification path
                var current = new X509(certificate), certPath = [], success = false, verifiers = [];
                while (current) {
                    var foundCRLs = [], founds = [];
                    certPath.push(current);
                    if (!success) {
                        // Select issuer CRL
                        foundCRLs = self.certStore.getCRLs({issuer: current.issuer, date: date});
                        // Create issuer's selection criteria
                        var selector = authoritySelector(current, current.extensions,
                                current.notBefore);
                        // Self-signed certificate?
                        if (!matchCertificate(current, selector))
                            // Select issuer form trusted CA root list
                            founds = self.certStore.getCertificates(selector);
                        else
                            success = true;
                    }
                    // Add verification tasks
                    var next = founds.length > 0 && new X509(founds[0]),
                            crl = foundCRLs.length > 0 && new CRL(foundCRLs[0]);
                    // Verify CRLs
                    if (crl)
                        verifiers.push(crl.verify(next, date));

                    // Verify the certificate
                    verifiers.push(current.verify(next, crl, date));
                    current = next;
                }
                if (!success)
                    throw new Error('Root certificate is not found');
                // Verify all certificates in path
                return Promise.all(verifiers).then(function (results) {
                    for (var i = 0; i < results; i++)
                        if (!results[i])
                            throw new Error('Certification path is not validated');
                    return certPath;
                });
            });
        }
    });

    /**
     * A class for building and validating certification paths (also known as certificate chains).
     * 
     * @memberOf GostCert
     * @type GostCert.CertPath
     */
    GostCert.prototype.CertPath = CertPath;

    /**
     * A generic interface for implementing a particular certificate verification 
     * scheme, such as constructing and verifying 
     * certificate chains.
     * 
     * @class GostCert.CertificateTrustPolicy
     */
    function CertificateTrustPolicy() {
    }

    extend(Object, CertificateTrustPolicy, {
        /**
         * Returns a certificate, known to be valid (according to criteria dependent 
         * on the verification scheme), which has the given selector, certificate and 
         * CRL lists to implement a particular certificate verification  scheme, 
         * such a forming valid certificate chains.<br>
         * Second and third argument to this method may be undefined, and such a case 
         * must be treated exactly the same as if the particular argument was an empty array.
         * 
         * @memberOf GostCert.CertificateTrustPolicy
         * @instance
         * @param {GostCert.CertificateSelector} selector Certificate selector
         * @param {GostCert.X509[]} certificates Certificates
         * @param {GostCert.CRL[]} crls CLRs
         * @returns {Promise} Promise to return valid {@link GostCert.X509}
         */
        getValidCertificate: function (selector, certificates, crls) {
        }
    });

    /**
     * A generic interface for implementing a particular certificate verification
     * 
     * @memberOf GostCert
     * @type GostCert.CertificateTrustPolicy
     */
    GostCert.prototype.CertificateTrustPolicy = CertificateTrustPolicy;

    /**
     * A certificate trust policy based on a set of trusted root CAs.<br><br>
     * 
     * In this policy, a certificate will be trusted if and only if it is part of a 
     * valid certificate chain which terminates in one of the trusted root CAs. <br><br>
     * 
     * This policy has two options for certificate chain verification:
     * <ul>
     *      <li>requireCRL - If true, then for every certificate in a chain 
     *          (unless it is one of the trusted root CA certificates) a valid CRL 
     *          must be provided to determine its revocation status. The default is false.</li>
     *      <li>requireCAFlag - If true, then every intermediate CA certificate (excluding 
     *          the root CA or the end entity certificate) must contain a Basic Constraints 
     *          extension, with the CA flag set. The default for this option is true.</li>
     * </ul>
     * 
     * @class GostCert.TrustedCAPolicy
     * @extends GostCert.CertificateTrustPolicy
     * @param {GostCert.X509[]} trustedCACerts 
     * @param {boolean} requireCRL 
     * @param {boolean} requireCA 
     */
    function TrustedCAPolicy(trustedCACerts, requireCRL, requireCA)
    {
        this.trustedCACerts = trustedCACerts || [];
        this.requireCRL = requireCRL || false;
        this.requireCA = requireCA || true;
    }

    extend(CertificateTrustPolicy, TrustedCAPolicy, {
        /**
         * Returns a certificate, known to be valid (according to criteria dependent 
         * on the verification scheme), which has the given selector, certificate and 
         * CRL lists to implement a particular certificate verification  scheme, 
         * such a forming valid certificate chains.<br>
         * Second and third argument to this method may be undefined, and such a case 
         * must be treated exactly the same as if the particular argument was an empty array.
         * 
         * @memberOf GostCert.TrustedCAPolicy
         * @instance
         * @param {GostCert.CertificateSelector} selector Certificate selector
         * @param {GostASN1.Certificate[]} certificates Certificates
         * @param {GostASN1.CertificateList[]} crls CLRs
         * @param {Date} date Validation date. Default today
         * @returns {Promise} Promise to return valid {@link GostCert.X509}
         */
        getValidCertificate: function (selector, certificates, crls, date)
        {
            var self = this, certPath;
            return new Promise(call).then(function () {
                certificates = certificates || [];
                crls = crls || [];
                // Get certificates from the trusted list
                var certs = selectCertificates(self.trustedCACerts, selector);
                if (certs.length > 0)
                    return new X509(certs[0]);
                // Get certificates from the list
                certs = selectCertificates(certificates, selector);
                if (certs.length === 0)
                    return;
                // Build certification path
                var current = new X509(certs[0]), success = false, verifiers = [];
                certPath = [];
                while (current) {
                    var foundCRLs = [], founds = [];
                    certPath.push(current);
                    if (!success) {
                        // Select issuer CRL
                        foundCRLs = selectCRLs(crls, {issuer: current.issuer, date: date});
                        if (foundCRLs.length === 0 && self.requireCRL)
                            return; // The issuer\'s CRL is not found
                        // Create issuer's selection criteria
                        selector = authoritySelector(current, current.extensions,
                                current.notBefore);
                        // Select issuer form trusted CA root list
                        founds = selectCertificates(self.trustedCACerts, selector);
                        if (founds.length === 0) {
                            // Non-trusted self-signed certificate?
                            if (!matchCertificate(current, selector)) {
                                // Select issuer from certificate list
                                founds = selectCertificates(certificates, selector);
                                if (founds.length > 0) {
                                    // Check basic contrains and CA flag
                                    var exts = founds[0].extensions;
                                    if (self.requireCA) {
                                        if (!exts || !exts.basicConstraints || !exts.basicConstraints.cA)
                                            return; // The issuer\'s certificate is not valid
                                        // Check path length limit
                                        if (exts.basicConstraints.pathLenConstraint !== undefined &&
                                                exts.basicConstraints.pathLenConstraint < certPath.length - 1)
                                            return; // The issuer\'s certificate path length constraint exceeded
                                    }
                                } else
                                    return; // Certification path is not built
                            }
                        } else
                            success = true;
                    }
                    // Add verification tasks
                    var next = founds.length > 0 && new X509(founds[0]),
                            crl = foundCRLs.length > 0 && new CRL(foundCRLs[0]);
                    // Verify CRLs
                    if (crl)
                        verifiers.push(crl.verify(next, date));

                    // Verify the certificate
                    verifiers.push(current.verify(next, crl, date));
                    current = next;
                }
                if (!success)
                    throw new Error('Trusted root certificate is not found');
                // Verify all certificates in path
                return Promise.all(verifiers).then(function (results) {
                    for (var i = 0; i < results; i++)
                        if (!results[i])
                            throw new Error('Certification path is not validated');
                    return certPath[0];
                });
            });
        }
    });

    /**
     * A certificate trust policy based on a set of trusted root CAs.
     * 
     * @memberOf GostCert
     * @type GostCert.TrustedCAPolicy
     */
    GostCert.prototype.TrustedCAPolicy = TrustedCAPolicy;

    /**
     * Provides facilities for handling certificates, CRLs, etc.
     * 
     * @memberOf gostCrypto
     * @type GostCert
     */
    gostCrypto.cert = new GostCert();

module.exports = GostCert;




/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostCipher.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostCipher.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file GOST 28147-89/GOST R 34.12-2015/GOST R 32.13-2015 Encryption Algorithm
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const GostRandom = __webpack_require__(/*! ./gostRandom */ "./node_modules/node-gost-crypto/lib/gostRandom.js");

    /*
     * Initial parameters and common algortithms of GOST 28147-89 
     * 
     * http://tools.ietf.org/html/rfc5830
     * 
     */

    var root = __webpack_require__.g;
    var rootCrypto = root.crypto || root.msCrypto;
    var CryptoOperationData = root.ArrayBuffer;
    var SyntaxError = root.SyntaxError || root.Error,
            DataError = root.DataError || root.Error,
            NotSupportedError = root.NotSupportedError || root.Error;
    /*
     * Check supported
     * This implementation support only Little Endian arhitecture
     */

    var littleEndian = (function () {
        var buffer = new CryptoOperationData(2);
        new DataView(buffer).setInt16(0, 256, true);
        return new Int16Array(buffer)[0] === 256;
    })();

    // Default initial vector
    var defaultIV = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]);

    // Predefined sBox collection
    var sBoxes = {
        'E-TEST': [
            0x4, 0x2, 0xF, 0x5, 0x9, 0x1, 0x0, 0x8, 0xE, 0x3, 0xB, 0xC, 0xD, 0x7, 0xA, 0x6,
            0xC, 0x9, 0xF, 0xE, 0x8, 0x1, 0x3, 0xA, 0x2, 0x7, 0x4, 0xD, 0x6, 0x0, 0xB, 0x5,
            0xD, 0x8, 0xE, 0xC, 0x7, 0x3, 0x9, 0xA, 0x1, 0x5, 0x2, 0x4, 0x6, 0xF, 0x0, 0xB,
            0xE, 0x9, 0xB, 0x2, 0x5, 0xF, 0x7, 0x1, 0x0, 0xD, 0xC, 0x6, 0xA, 0x4, 0x3, 0x8,
            0x3, 0xE, 0x5, 0x9, 0x6, 0x8, 0x0, 0xD, 0xA, 0xB, 0x7, 0xC, 0x2, 0x1, 0xF, 0x4,
            0x8, 0xF, 0x6, 0xB, 0x1, 0x9, 0xC, 0x5, 0xD, 0x3, 0x7, 0xA, 0x0, 0xE, 0x2, 0x4,
            0x9, 0xB, 0xC, 0x0, 0x3, 0x6, 0x7, 0x5, 0x4, 0x8, 0xE, 0xF, 0x1, 0xA, 0x2, 0xD,
            0xC, 0x6, 0x5, 0x2, 0xB, 0x0, 0x9, 0xD, 0x3, 0xE, 0x7, 0xA, 0xF, 0x4, 0x1, 0x8
        ],
        'E-A': [
            0x9, 0x6, 0x3, 0x2, 0x8, 0xB, 0x1, 0x7, 0xA, 0x4, 0xE, 0xF, 0xC, 0x0, 0xD, 0x5,
            0x3, 0x7, 0xE, 0x9, 0x8, 0xA, 0xF, 0x0, 0x5, 0x2, 0x6, 0xC, 0xB, 0x4, 0xD, 0x1,
            0xE, 0x4, 0x6, 0x2, 0xB, 0x3, 0xD, 0x8, 0xC, 0xF, 0x5, 0xA, 0x0, 0x7, 0x1, 0x9,
            0xE, 0x7, 0xA, 0xC, 0xD, 0x1, 0x3, 0x9, 0x0, 0x2, 0xB, 0x4, 0xF, 0x8, 0x5, 0x6,
            0xB, 0x5, 0x1, 0x9, 0x8, 0xD, 0xF, 0x0, 0xE, 0x4, 0x2, 0x3, 0xC, 0x7, 0xA, 0x6,
            0x3, 0xA, 0xD, 0xC, 0x1, 0x2, 0x0, 0xB, 0x7, 0x5, 0x9, 0x4, 0x8, 0xF, 0xE, 0x6,
            0x1, 0xD, 0x2, 0x9, 0x7, 0xA, 0x6, 0x0, 0x8, 0xC, 0x4, 0x5, 0xF, 0x3, 0xB, 0xE,
            0xB, 0xA, 0xF, 0x5, 0x0, 0xC, 0xE, 0x8, 0x6, 0x2, 0x3, 0x9, 0x1, 0x7, 0xD, 0x4
        ],
        'E-B': [
            0x8, 0x4, 0xB, 0x1, 0x3, 0x5, 0x0, 0x9, 0x2, 0xE, 0xA, 0xC, 0xD, 0x6, 0x7, 0xF,
            0x0, 0x1, 0x2, 0xA, 0x4, 0xD, 0x5, 0xC, 0x9, 0x7, 0x3, 0xF, 0xB, 0x8, 0x6, 0xE,
            0xE, 0xC, 0x0, 0xA, 0x9, 0x2, 0xD, 0xB, 0x7, 0x5, 0x8, 0xF, 0x3, 0x6, 0x1, 0x4,
            0x7, 0x5, 0x0, 0xD, 0xB, 0x6, 0x1, 0x2, 0x3, 0xA, 0xC, 0xF, 0x4, 0xE, 0x9, 0x8,
            0x2, 0x7, 0xC, 0xF, 0x9, 0x5, 0xA, 0xB, 0x1, 0x4, 0x0, 0xD, 0x6, 0x8, 0xE, 0x3,
            0x8, 0x3, 0x2, 0x6, 0x4, 0xD, 0xE, 0xB, 0xC, 0x1, 0x7, 0xF, 0xA, 0x0, 0x9, 0x5,
            0x5, 0x2, 0xA, 0xB, 0x9, 0x1, 0xC, 0x3, 0x7, 0x4, 0xD, 0x0, 0x6, 0xF, 0x8, 0xE,
            0x0, 0x4, 0xB, 0xE, 0x8, 0x3, 0x7, 0x1, 0xA, 0x2, 0x9, 0x6, 0xF, 0xD, 0x5, 0xC
        ],
        'E-C': [
            0x1, 0xB, 0xC, 0x2, 0x9, 0xD, 0x0, 0xF, 0x4, 0x5, 0x8, 0xE, 0xA, 0x7, 0x6, 0x3,
            0x0, 0x1, 0x7, 0xD, 0xB, 0x4, 0x5, 0x2, 0x8, 0xE, 0xF, 0xC, 0x9, 0xA, 0x6, 0x3,
            0x8, 0x2, 0x5, 0x0, 0x4, 0x9, 0xF, 0xA, 0x3, 0x7, 0xC, 0xD, 0x6, 0xE, 0x1, 0xB,
            0x3, 0x6, 0x0, 0x1, 0x5, 0xD, 0xA, 0x8, 0xB, 0x2, 0x9, 0x7, 0xE, 0xF, 0xC, 0x4,
            0x8, 0xD, 0xB, 0x0, 0x4, 0x5, 0x1, 0x2, 0x9, 0x3, 0xC, 0xE, 0x6, 0xF, 0xA, 0x7,
            0xC, 0x9, 0xB, 0x1, 0x8, 0xE, 0x2, 0x4, 0x7, 0x3, 0x6, 0x5, 0xA, 0x0, 0xF, 0xD,
            0xA, 0x9, 0x6, 0x8, 0xD, 0xE, 0x2, 0x0, 0xF, 0x3, 0x5, 0xB, 0x4, 0x1, 0xC, 0x7,
            0x7, 0x4, 0x0, 0x5, 0xA, 0x2, 0xF, 0xE, 0xC, 0x6, 0x1, 0xB, 0xD, 0x9, 0x3, 0x8
        ],
        'E-D': [
            0xF, 0xC, 0x2, 0xA, 0x6, 0x4, 0x5, 0x0, 0x7, 0x9, 0xE, 0xD, 0x1, 0xB, 0x8, 0x3,
            0xB, 0x6, 0x3, 0x4, 0xC, 0xF, 0xE, 0x2, 0x7, 0xD, 0x8, 0x0, 0x5, 0xA, 0x9, 0x1,
            0x1, 0xC, 0xB, 0x0, 0xF, 0xE, 0x6, 0x5, 0xA, 0xD, 0x4, 0x8, 0x9, 0x3, 0x7, 0x2,
            0x1, 0x5, 0xE, 0xC, 0xA, 0x7, 0x0, 0xD, 0x6, 0x2, 0xB, 0x4, 0x9, 0x3, 0xF, 0x8,
            0x0, 0xC, 0x8, 0x9, 0xD, 0x2, 0xA, 0xB, 0x7, 0x3, 0x6, 0x5, 0x4, 0xE, 0xF, 0x1,
            0x8, 0x0, 0xF, 0x3, 0x2, 0x5, 0xE, 0xB, 0x1, 0xA, 0x4, 0x7, 0xC, 0x9, 0xD, 0x6,
            0x3, 0x0, 0x6, 0xF, 0x1, 0xE, 0x9, 0x2, 0xD, 0x8, 0xC, 0x4, 0xB, 0xA, 0x5, 0x7,
            0x1, 0xA, 0x6, 0x8, 0xF, 0xB, 0x0, 0x4, 0xC, 0x3, 0x5, 0x9, 0x7, 0xD, 0x2, 0xE
        ],
        'E-SC': [
            0x3, 0x6, 0x1, 0x0, 0x5, 0x7, 0xd, 0x9, 0x4, 0xb, 0x8, 0xc, 0xe, 0xf, 0x2, 0xa,
            0x7, 0x1, 0x5, 0x2, 0x8, 0xb, 0x9, 0xc, 0xd, 0x0, 0x3, 0xa, 0xf, 0xe, 0x4, 0x6,
            0xf, 0x1, 0x4, 0x6, 0xc, 0x8, 0x9, 0x2, 0xe, 0x3, 0x7, 0xa, 0xb, 0xd, 0x5, 0x0,
            0x3, 0x4, 0xf, 0xc, 0x5, 0x9, 0xe, 0x0, 0x6, 0x8, 0x7, 0xa, 0x1, 0xb, 0xd, 0x2,
            0x6, 0x9, 0x0, 0x7, 0xb, 0x8, 0x4, 0xc, 0x2, 0xe, 0xa, 0xf, 0x1, 0xd, 0x5, 0x3,
            0x6, 0x1, 0x2, 0xf, 0x0, 0xb, 0x9, 0xc, 0x7, 0xd, 0xa, 0x5, 0x8, 0x4, 0xe, 0x3,
            0x0, 0x2, 0xe, 0xc, 0x9, 0x1, 0x4, 0x7, 0x3, 0xf, 0x6, 0x8, 0xa, 0xd, 0xb, 0x5,
            0x5, 0x2, 0xb, 0x8, 0x4, 0xc, 0x7, 0x1, 0xa, 0x6, 0xe, 0x0, 0x9, 0x3, 0xd, 0xf
        ],
        'E-Z': [// This is default S-box in according to draft of new standard
            0xc, 0x4, 0x6, 0x2, 0xa, 0x5, 0xb, 0x9, 0xe, 0x8, 0xd, 0x7, 0x0, 0x3, 0xf, 0x1,
            0x6, 0x8, 0x2, 0x3, 0x9, 0xa, 0x5, 0xc, 0x1, 0xe, 0x4, 0x7, 0xb, 0xd, 0x0, 0xf,
            0xb, 0x3, 0x5, 0x8, 0x2, 0xf, 0xa, 0xd, 0xe, 0x1, 0x7, 0x4, 0xc, 0x9, 0x6, 0x0,
            0xc, 0x8, 0x2, 0x1, 0xd, 0x4, 0xf, 0x6, 0x7, 0x0, 0xa, 0x5, 0x3, 0xe, 0x9, 0xb,
            0x7, 0xf, 0x5, 0xa, 0x8, 0x1, 0x6, 0xd, 0x0, 0x9, 0x3, 0xe, 0xb, 0x4, 0x2, 0xc,
            0x5, 0xd, 0xf, 0x6, 0x9, 0x2, 0xc, 0xa, 0xb, 0x7, 0x8, 0x1, 0x4, 0x3, 0xe, 0x0,
            0x8, 0xe, 0x2, 0x5, 0x6, 0x9, 0x1, 0xc, 0xf, 0x4, 0xb, 0x0, 0xd, 0xa, 0x3, 0x7,
            0x1, 0x7, 0xe, 0xd, 0x0, 0x5, 0x8, 0x3, 0x4, 0xf, 0xa, 0x6, 0x9, 0xc, 0xb, 0x2
        ],
        //S-box for digest
        'D-TEST': [
            0x4, 0xA, 0x9, 0x2, 0xD, 0x8, 0x0, 0xE, 0x6, 0xB, 0x1, 0xC, 0x7, 0xF, 0x5, 0x3,
            0xE, 0xB, 0x4, 0xC, 0x6, 0xD, 0xF, 0xA, 0x2, 0x3, 0x8, 0x1, 0x0, 0x7, 0x5, 0x9,
            0x5, 0x8, 0x1, 0xD, 0xA, 0x3, 0x4, 0x2, 0xE, 0xF, 0xC, 0x7, 0x6, 0x0, 0x9, 0xB,
            0x7, 0xD, 0xA, 0x1, 0x0, 0x8, 0x9, 0xF, 0xE, 0x4, 0x6, 0xC, 0xB, 0x2, 0x5, 0x3,
            0x6, 0xC, 0x7, 0x1, 0x5, 0xF, 0xD, 0x8, 0x4, 0xA, 0x9, 0xE, 0x0, 0x3, 0xB, 0x2,
            0x4, 0xB, 0xA, 0x0, 0x7, 0x2, 0x1, 0xD, 0x3, 0x6, 0x8, 0x5, 0x9, 0xC, 0xF, 0xE,
            0xD, 0xB, 0x4, 0x1, 0x3, 0xF, 0x5, 0x9, 0x0, 0xA, 0xE, 0x7, 0x6, 0x8, 0x2, 0xC,
            0x1, 0xF, 0xD, 0x0, 0x5, 0x7, 0xA, 0x4, 0x9, 0x2, 0x3, 0xE, 0x6, 0xB, 0x8, 0xC
        ],
        'D-A': [
            0xA, 0x4, 0x5, 0x6, 0x8, 0x1, 0x3, 0x7, 0xD, 0xC, 0xE, 0x0, 0x9, 0x2, 0xB, 0xF,
            0x5, 0xF, 0x4, 0x0, 0x2, 0xD, 0xB, 0x9, 0x1, 0x7, 0x6, 0x3, 0xC, 0xE, 0xA, 0x8,
            0x7, 0xF, 0xC, 0xE, 0x9, 0x4, 0x1, 0x0, 0x3, 0xB, 0x5, 0x2, 0x6, 0xA, 0x8, 0xD,
            0x4, 0xA, 0x7, 0xC, 0x0, 0xF, 0x2, 0x8, 0xE, 0x1, 0x6, 0x5, 0xD, 0xB, 0x9, 0x3,
            0x7, 0x6, 0x4, 0xB, 0x9, 0xC, 0x2, 0xA, 0x1, 0x8, 0x0, 0xE, 0xF, 0xD, 0x3, 0x5,
            0x7, 0x6, 0x2, 0x4, 0xD, 0x9, 0xF, 0x0, 0xA, 0x1, 0x5, 0xB, 0x8, 0xE, 0xC, 0x3,
            0xD, 0xE, 0x4, 0x1, 0x7, 0x0, 0x5, 0xA, 0x3, 0xC, 0x8, 0xF, 0x6, 0x2, 0x9, 0xB,
            0x1, 0x3, 0xA, 0x9, 0x5, 0xB, 0x4, 0xF, 0x8, 0x6, 0x7, 0xE, 0xD, 0x0, 0x2, 0xC
        ],
        'D-SC': [
            0xb, 0xd, 0x7, 0x0, 0x5, 0x4, 0x1, 0xf, 0x9, 0xe, 0x6, 0xa, 0x3, 0xc, 0x8, 0x2,
            0x1, 0x2, 0x7, 0x9, 0xd, 0xb, 0xf, 0x8, 0xe, 0xc, 0x4, 0x0, 0x5, 0x6, 0xa, 0x3,
            0x5, 0x1, 0xd, 0x3, 0xf, 0x6, 0xc, 0x7, 0x9, 0x8, 0xb, 0x2, 0x4, 0xe, 0x0, 0xa,
            0xd, 0x1, 0xb, 0x4, 0x9, 0xc, 0xe, 0x0, 0x7, 0x5, 0x8, 0xf, 0x6, 0x2, 0xa, 0x3,
            0x2, 0xd, 0xa, 0xf, 0x9, 0xb, 0x3, 0x7, 0x8, 0xc, 0x5, 0xe, 0x6, 0x0, 0x1, 0x4,
            0x0, 0x4, 0x6, 0xc, 0x5, 0x3, 0x8, 0xd, 0xa, 0xb, 0xf, 0x2, 0x1, 0x9, 0x7, 0xe,
            0x1, 0x3, 0xc, 0x8, 0xa, 0x6, 0xb, 0x0, 0x2, 0xe, 0x7, 0x9, 0xf, 0x4, 0x5, 0xd,
            0xa, 0xb, 0x6, 0x0, 0x1, 0x3, 0x4, 0x7, 0xe, 0xd, 0x5, 0xf, 0x8, 0x2, 0x9, 0xc
        ]
    };

    var C = new Uint8Array([
        0x69, 0x00, 0x72, 0x22, 0x64, 0xC9, 0x04, 0x23,
        0x8D, 0x3A, 0xDB, 0x96, 0x46, 0xE9, 0x2A, 0xC4,
        0x18, 0xFE, 0xAC, 0x94, 0x00, 0xED, 0x07, 0x12,
        0xC0, 0x86, 0xDC, 0xC2, 0xEF, 0x4C, 0xA9, 0x2B
    ]);

    function signed(x) {
        return x >= 0x80000000 ? x - 0x100000000 : x;
    }

    function unsigned(x) {
        return x < 0 ? x + 0x100000000 : x;
    }

    // Set random values into Uint8Arry
    // Random generator
    function randomSeed(e) {
        var randomSource = new GostRandom();
        if (randomSource.getRandomValues)
            randomSource.getRandomValues(e);
        else
            throw new NotSupportedError('Random generator not found');
    }

    // Get buffer
    function buffer(d) {
        if (d instanceof CryptoOperationData)
            return d;
        else if (d && d.buffer && d.buffer instanceof CryptoOperationData)
            return d.byteOffset === 0 && d.byteLength === d.buffer.byteLength ?
                    d.buffer : new Uint8Array(new Uint8Array(d, d.byteOffset, d.byteLength)).buffer;
        else
            throw new DataError('CryptoOperationData required');
    }

    // Get byte array
    function byteArray(d) {
        return new Uint8Array(buffer(d));
    }

    // Clone byte array
    function cloneArray(d) {
        return new Uint8Array(byteArray(d));
    }


    // Get int32 array
    function intArray(d) {
        return new Int32Array(buffer(d));
    }

    // Swap bytes for version 2015
    function swap32(b) {
        return ((b & 0xff) << 24)
                | ((b & 0xff00) << 8)
                | ((b >> 8) & 0xff00)
                | ((b >> 24) & 0xff);
    }



    /*
     * Initial parameters and common algortithms of GOST R 34.12-15 
     * Algorithm "Kuznechik" 128bit
     * 
     */

    // Default initial vector
    var defaultIV128 = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);

    // Mult table for R function
    var multTable = (function () {

        // Multiply two numbers in the GF(2^8) finite field defined 
        // by the polynomial x^8 + x^7 + x^6 + x + 1 = 0 */
        function gmul(a, b) {
            var p = 0, counter, carry;
            for (counter = 0; counter < 8; counter++) {
                if (b & 1)
                    p ^= a;
                carry = a & 0x80; // detect if x^8 term is about to be generated 
                a = (a << 1) & 0xff;
                if (carry)
                    a ^= 0xc3; // replace x^8 with x^7 + x^6 + x + 1 
                b >>= 1;
            }
            return p & 0xff;
        }

        // It is required only this values for R function
        //       0   1   2    3    4    5    6    7
        var x = [1, 16, 32, 133, 148, 192, 194, 251];
        var m = [];
        for (var i = 0; i < 8; i++) {
            m[i] = [];
            for (var j = 0; j < 256; j++)
                m[i][j] = gmul(x[i], j);
        }
        return m;
    })();

    // 148, 32, 133, 16, 194, 192, 1, 251, 1, 192, 194, 16, 133, 32, 148, 1
    var kB = [4, 2, 3, 1, 6, 5, 0, 7, 0, 5, 6, 1, 3, 2, 4, 0];

    // R - function
    function funcR(d) {
        var sum = 0;
        for (var i = 0; i < 16; i++)
            sum ^= multTable[kB[i]][d[i]];

        for (var i = 16; i > 0; --i)
            d[i] = d[i - 1];
        d[0] = sum;
    }

    function funcReverseR(d) {
        var tmp = d[0];
        for (var i = 0; i < 15; i++)
            d[i] = d[i + 1];
        d[15] = tmp;

        var sum = 0;
        for (i = 0; i < 16; i++)
            sum ^= multTable[kB[i]][d[i]];
        d[15] = sum;
    }

    // Nonlinear transformation
    var kPi = [
        252, 238, 221, 17, 207, 110, 49, 22, 251, 196, 250, 218, 35, 197, 4, 77,
        233, 119, 240, 219, 147, 46, 153, 186, 23, 54, 241, 187, 20, 205, 95, 193,
        249, 24, 101, 90, 226, 92, 239, 33, 129, 28, 60, 66, 139, 1, 142, 79,
        5, 132, 2, 174, 227, 106, 143, 160, 6, 11, 237, 152, 127, 212, 211, 31,
        235, 52, 44, 81, 234, 200, 72, 171, 242, 42, 104, 162, 253, 58, 206, 204,
        181, 112, 14, 86, 8, 12, 118, 18, 191, 114, 19, 71, 156, 183, 93, 135,
        21, 161, 150, 41, 16, 123, 154, 199, 243, 145, 120, 111, 157, 158, 178, 177,
        50, 117, 25, 61, 255, 53, 138, 126, 109, 84, 198, 128, 195, 189, 13, 87,
        223, 245, 36, 169, 62, 168, 67, 201, 215, 121, 214, 246, 124, 34, 185, 3,
        224, 15, 236, 222, 122, 148, 176, 188, 220, 232, 40, 80, 78, 51, 10, 74,
        167, 151, 96, 115, 30, 0, 98, 68, 26, 184, 56, 130, 100, 159, 38, 65,
        173, 69, 70, 146, 39, 94, 85, 47, 140, 163, 165, 125, 105, 213, 149, 59,
        7, 88, 179, 64, 134, 172, 29, 247, 48, 55, 107, 228, 136, 217, 231, 137,
        225, 27, 131, 73, 76, 63, 248, 254, 141, 83, 170, 144, 202, 216, 133, 97,
        32, 113, 103, 164, 45, 43, 9, 91, 203, 155, 37, 208, 190, 229, 108, 82,
        89, 166, 116, 210, 230, 244, 180, 192, 209, 102, 175, 194, 57, 75, 99, 182
    ];

    var kReversePi = (function () {
        var m = [];
        for (var i = 0, n = kPi.length; i < n; i++)
            m[kPi[i]] = i;
        return m;
    })();

    function funcS(d) {
        for (var i = 0; i < 16; ++i)
            d[i] = kPi[d[i]];
    }

    function funcReverseS(d) {
        for (var i = 0; i < 16; ++i)
            d[i] = kReversePi[d[i]];
    }

    function funcX(a, b) {
        for (var i = 0; i < 16; ++i)
            a[i] ^= b[i];
    }

    function funcL(d) {
        for (var i = 0; i < 16; ++i)
            funcR(d);
    }

    function funcReverseL(d) {
        for (var i = 0; i < 16; ++i)
            funcReverseR(d);
    }

    function funcLSX(a, b) {
        funcX(a, b);
        funcS(a);
        funcL(a);
    }

    function funcReverseLSX(a, b) {
        funcX(a, b);
        funcReverseL(a);
        funcReverseS(a);
    }

    function funcF(inputKey, inputKeySecond, iterationConst) {
        var tmp = new Uint8Array(inputKey);
        funcLSX(inputKey, iterationConst);
        funcX(inputKey, inputKeySecond);
        inputKeySecond.set(tmp);
    }

    function funcC(number, d) {
        for (var i = 0; i < 15; i++)
            d[i] = 0;
        d[15] = number;
        funcL(d);
    }



    /**
     * Key schedule for GOST R 34.12-15 128bits
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method keySchedule
     * @param {type} k
     * @returns {Uint8Array}
     */
    function keySchedule128(k)
    {
        var keys = new Uint8Array(160), c = new Uint8Array(16);
        keys.set(byteArray(k));
        for (var j = 0; j < 4; j++) {
            var j0 = 32 * j, j1 = 32 * (j + 1);
            keys.set(new Uint8Array(keys.buffer, j0, 32), j1);
            for (var i = 1; i < 9; i++) {
                funcC(j * 8 + i, c);
                funcF(new Uint8Array(keys.buffer, j1, 16),
                        new Uint8Array(keys.buffer, j1 + 16, 16), c);
            }
        }
        return keys;
    }

    /**
     * GOST R 34.12-15 128 bits encrypt/decrypt process 
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method round
     * @param {Uint8Array} k Scheduled key
     * @param {Uint8Array} d Data
     * @param {number} ofs Offsec
     * @param {number} e true - decrypt
     */
    function process128(k, d, ofs, e)
    {
        ofs = ofs || d.byteOffset;
        var r = new Uint8Array(d.buffer, ofs, 16);
        if (e) {
            for (var i = 0; i < 9; i++)
                funcReverseLSX(r, new Uint8Array(k.buffer, (9 - i) * 16, 16));

            funcX(r, new Uint8Array(k.buffer, 0, 16));
        } else {
            for (var i = 0; i < 9; i++)
                funcLSX(r, new Uint8Array(k.buffer, 16 * i, 16));

            funcX(r, new Uint8Array(k.buffer, 16 * 9, 16));
        }
    }

    /**
     * One GOST encryption round
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method round
     * @param {Int8Array} S sBox
     * @param {Int32Array} m 2x32 bits cipher block 
     * @param {Int32Array} k 32 bits key[i] 
     */
    function round(S, m, k)
    {
        var cm = (m[0] + k) & 0xffffffff;

        var om = S[  0 + ((cm >> (0 * 4)) & 0xF)] << (0 * 4);
        om |= S[ 16 + ((cm >> (1 * 4)) & 0xF)] << (1 * 4);
        om |= S[ 32 + ((cm >> (2 * 4)) & 0xF)] << (2 * 4);
        om |= S[ 48 + ((cm >> (3 * 4)) & 0xF)] << (3 * 4);
        om |= S[ 64 + ((cm >> (4 * 4)) & 0xF)] << (4 * 4);
        om |= S[ 80 + ((cm >> (5 * 4)) & 0xF)] << (5 * 4);
        om |= S[ 96 + ((cm >> (6 * 4)) & 0xF)] << (6 * 4);
        om |= S[112 + ((cm >> (7 * 4)) & 0xF)] << (7 * 4);
        cm = om << 11 | om >>> (32 - 11);

        cm ^= m[1];
        m[1] = m[0];
        m[0] = cm;

    }

    /**
     * Process encrypt/decrypt block with key K using GOST 28147-89
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method process
     * @param k {Int32Array} 8x32 bits key 
     * @param d {Int32Array} 8x8 bits cipher block 
     * @param ofs {number} offset
     */
    function process89(k, d, ofs)
    {
        ofs = ofs || d.byteOffset;
        var s = this.sBox,
                m = new Int32Array(d.buffer, ofs, 2);

        for (var i = 0; i < 32; i++)
            round(s, m, k[i]);

        var r = m[0];
        m[0] = m[1];
        m[1] = r;
    }

    /**
     * Process encrypt/decrypt block with key K using GOST R 34.12-15 64bit block
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method process
     * @param k {Int32Array} 8x32 bits key 
     * @param d {Int32Array} 8x8 bits cipher block 
     * @param ofs {number} offset
     */
    function process15(k, d, ofs)
    {
        ofs = ofs || d.byteOffset;
        var s = this.sBox,
                m = new Int32Array(d.buffer, ofs, 2),
                r = swap32(m[0]);
        m[0] = swap32(m[1]);
        m[1] = r;

        for (var i = 0; i < 32; i++)
            round(s, m, k[i]);

        m[0] = swap32(m[0]);
        m[1] = swap32(m[1]);
    }

    /**
     * Key keySchedule algorithm for GOST 28147-89 64bit cipher
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method process
     * @param k {Uint8Array} 8 bit key array
     * @param e {boolean}  true - decrypt
     * @returns {Int32Array} keyScheduled 32-bit key
     */
    function keySchedule89(k, e)
    {
        var sch = new Int32Array(32),
                key = new Int32Array(buffer(k));

        for (var i = 0; i < 8; i++)
            sch[i] = key[i];

        if (e) {
            for (var i = 0; i < 8; i++)
                sch[i + 8] = sch[7 - i];

            for (var i = 0; i < 8; i++)
                sch[i + 16] = sch[7 - i];
        } else {
            for (var i = 0; i < 8; i++)
                sch[i + 8] = sch[i];

            for (var i = 0; i < 8; i++)
                sch[i + 16] = sch[i];
        }

        for (var i = 0; i < 8; i++)
            sch[i + 24] = sch[7 - i];

        return sch;
    }

    /**
     * Key keySchedule algorithm for GOST R 34.12-15 64bit cipher
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method process
     * @param k {Uint8Array} 8 bit key array
     * @param e {boolean}  true - decrypt
     * @returns {Int32Array} keyScheduled 32-bit key
     */
    function keySchedule15(k, e)
    {
        var sch = new Int32Array(32),
                key = new Int32Array(buffer(k));

        for (var i = 0; i < 8; i++)
            sch[i] = swap32(key[i]);

        if (e) {
            for (var i = 0; i < 8; i++)
                sch[i + 8] = sch[7 - i];

            for (var i = 0; i < 8; i++)
                sch[i + 16] = sch[7 - i];
        } else {
            for (var i = 0; i < 8; i++)
                sch[i + 8] = sch[i];

            for (var i = 0; i < 8; i++)
                sch[i + 16] = sch[i];
        }

        for (var i = 0; i < 8; i++)
            sch[i + 24] = sch[7 - i];

        return sch;
    }

    /**
     * Key schedule for RC2
     * 
     * https://tools.ietf.org/html/rfc2268
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method keySchedule
     * @param {Uint8Array} k
     * @returns {Uint16Array}
     */
    var keyScheduleRC2 = (function ()
    {
        // an array of "random" bytes based on the digits of PI = 3.14159...
        var PITABLE = new Uint8Array([
            0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
            0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
            0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
            0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
            0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
            0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
            0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
            0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
            0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
            0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
            0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
            0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
            0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
            0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
            0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
            0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad
        ]);

        return function (k)
        {
            var key = new Uint8Array(buffer(k)),
                    T = Math.min(key.length, 128),
                    T1 = this.effectiveLength,
                    T8 = Math.floor((T1 + 7) / 8),
                    TM = 0xff % Math.pow(2, 8 + T1 - 8 * T8);

            var L = new Uint8Array(128), K = new Uint16Array(L.buffer);
            for (var i = 0; i < T; i++)
                L[i] = key[i];
            for (var i = T; i < 128; i++)
                L[i] = PITABLE[(L[i - 1] + L[i - T]) % 256];
            L[128 - T8] = PITABLE[L[128 - T8] & TM];
            for (var i = 127 - T8; i >= 0; --i)
                L[i] = PITABLE[L[i + 1] ^ L[i + T8]];
            return K;
        };
    }
    )();

    /**
     * RC2 encrypt/decrypt process 
     * 
     * https://tools.ietf.org/html/rfc2268
     * 
     * @memberOf GostCipher
     * @private
     * @instance
     * @method round
     * @param {CryptoOperationData} k Scheduled key
     * @param {CryptoOperationData} d Data
     * @param {number} ofs Offsec
     * @param {number} e true - decrypt
     */
    var processRC2 = (function ()
    {
        var K, j, R = new Uint16Array(4),
                s = new Uint16Array([1, 2, 3, 5]), reverse;

        function rol(R, s) {
            return (R << s | R >>> (16 - s)) & 0xffff;
        }

        function ror(R, s) {
            return (R >>> s | R << (16 - s)) & 0xffff;
        }

        function mix(i) {
            if (reverse) {
                R[i] = ror(R[i], s[i]);
                R[i] = R[i] - K[j] - (R[(i + 3) % 4] & R[(i + 2) % 4]) - ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);
                j = j - 1;
            } else {
                R[i] = R[i] + K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + ((~R[(i + 3) % 4]) & R[(i + 1) % 4]);
                j = j + 1;
                R[i] = rol(R[i], s[i]);
            }
        }

        function mash(i) {
            if (reverse) {
                R[i] = R[i] - K[R[(i + 3) % 4] & 63];
            } else {
                R[i] = R[i] + K[R[(i + 3) % 4] & 63];
            }
        }

        function perform(method, count) {
            count = count || 1;
            for (var j = 0; j < count; j++) {
                if (reverse) {
                    for (var i = 3; i >= 0; --i)
                        method(i);
                } else {
                    for (var i = 0; i < 4; i++)
                        method(i);
                }
            }
        }

        return function (k, d, ofs, e) {
            reverse = e;
            //  1. Initialize words R[0], ..., R[3] to contain the 64-bit
            //     ciphertext value.
            R = new Uint16Array(d.buffer, ofs || d.byteOffset, 4);
            //  2. Expand the key, so that words K[0], ..., K[63] become
            //     defined.
            K = k;
            //  3. Initialize j to zero (enc) j to 63 (dec).
            j = e ? 63 : 0;
            //  4. Perform five mixing rounds.
            perform(mix, 5);
            //  5. Perform one mashing round.
            perform(mash);
            //  6. Perform six mixing rounds.
            perform(mix, 6);
            //  7. Perform one mashing round.
            perform(mash);
            //  8. Perform five mixing rounds.
            perform(mix, 5);
        };
    }
    )();

    /**
     * Algorithm name GOST 28147-ECB<br><br>
     * 
     * encryptECB (K, D) is D, encrypted with key k using GOST 28147/GOST R 34.13 in 
     * "prostaya zamena" (Electronic Codebook, ECB) mode. 
     * @memberOf GostCipher
     * @method encrypt
     * @instance
     * @param k {CryptoOperationData} 8x32 bit key 
     * @param d {CryptoOperationData} 8 bits message
     * @return {CryptoOperationData} result
     */
    function encryptECB(k, d)
    {
        var p = this.pad(byteArray(d)),
                n = this.blockSize,
                b = p.byteLength / n,
                key = this.keySchedule(k);

        for (var i = 0; i < b; i++)
            this.process(key, p, n * i);

        return p.buffer;
    }

    /**
     * Algorithm name GOST 28147-ECB<br><br>
     * 
     * decryptECB (K, D) is D, decrypted with key K using GOST 28147/GOST R 34.13 in   
     * "prostaya zamena"  (Electronic Codebook, ECB) mode.
     * 
     * @memberOf GostCipher
     * @method decrypt
     * @instance
     * @param k {CryptoOperationData} 8x32 bits key 
     * @param d {CryptoOperationData} 8 bits message
     * @return {CryptoOperationData} result
     */
    function decryptECB(k, d)
    {
        var p = cloneArray(d),
                n = this.blockSize,
                b = p.byteLength / n,
                key = this.keySchedule(k, 1);

        for (var i = 0; i < b; i++)
            this.process(key, p, n * i, 1);

        return this.unpad(p).buffer;
    }

    /**
     * Algorithm name GOST 28147-CFB<br><br>
     * 
     * encryptCFB (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie s obratnoj svyaziyu" (Cipher Feedback, CFB) mode, and IV is   
     * used as the initialization vector.
     * 
     * @memberOf GostCipher
     * @method encrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function encryptCFB(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                c = cloneArray(d),
                m = s.length,
                t = new Uint8Array(m),
                b = this.shiftBits >> 3,
                cb = c.length, r = cb % b, q = (cb - r) / b,
                key = this.keySchedule(k);

        for (var i = 0; i < q; i++) {

            for (var j = 0; j < m; j++)
                t[j] = s[j];

            this.process(key, s);

            for (var j = 0; j < b; j++)
                c[i * b + j] ^= s[j];

            for (var j = 0; j < m - b; j++)
                s[j] = t[b + j];

            for (var j = 0; j < b; j++)
                s[m - b + j] = c[i * b + j];

            k = this.keyMeshing(k, s, i, key);
        }

        if (r > 0) {
            this.process(key, s);

            for (var i = 0; i < r; i++)
                c[q * b + i] ^= s[i];
        }
        return c.buffer;
    }

    /**
     * Algorithm name GOST 28147-CFB<br><br>
     * 
     * decryptCFB (IV, K, D) is D, decrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie s obratnoj svyaziyu po shifrotekstu" (Cipher Feedback, CFB) mode, and IV is   
     * used as the initialization vector.
     * 
     * @memberOf GostCipher
     * @method decrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function decryptCFB(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                c = cloneArray(d),
                m = s.length,
                t = new Uint8Array(m),
                b = this.shiftBits >> 3,
                cb = c.length, r = cb % b, q = (cb - r) / b,
                key = this.keySchedule(k);

        for (var i = 0; i < q; i++) {

            for (var j = 0; j < m; j++)
                t[j] = s[j];

            this.process(key, s);

            for (var j = 0; j < b; j++) {
                t[j] = c[i * b + j];
                c[i * b + j] ^= s[j];
            }

            for (var j = 0; j < m - b; j++)
                s[j] = t[b + j];

            for (var j = 0; j < b; j++)
                s[m - b + j] = t[j];

            k = this.keyMeshing(k, s, i, key);
        }

        if (r > 0) {
            this.process(key, s);

            for (var i = 0; i < r; i++)
                c[q * b + i] ^= s[i];
        }
        return c.buffer;
    }

    /**
     * Algorithm name GOST 28147-OFB<br><br>
     * 
     * encryptOFB/decryptOFB (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie s obratnoj svyaziyu po vyhodu" (Output Feedback, OFB) mode, and IV is   
     * used as the initialization vector.
     * 
     * @memberOf GostCipher
     * @method encrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv 8x8 optional bits initial vector
     * @return {CryptoOperationData} result
     */
    /**
     * Algorithm name GOST 28147-OFB<br><br>
     * 
     * encryptOFB/decryptOFB (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie s obratnoj svyaziyu po vyhodu" (Output Feedback, OFB) mode, and IV is   
     * used as the initialization vector.
     * 
     * @memberOf GostCipher
     * @method decrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function processOFB(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                c = cloneArray(d),
                m = s.length,
                t = new Uint8Array(m),
                b = this.shiftBits >> 3,
                p = new Uint8Array(b),
                cb = c.length, r = cb % b, q = (cb - r) / b,
                key = this.keySchedule(k);

        for (var i = 0; i < q; i++) {

            for (var j = 0; j < m; j++)
                t[j] = s[j];

            this.process(key, s);

            for (var j = 0; j < b; j++)
                p[j] = s[j];

            for (var j = 0; j < b; j++)
                c[i * b + j] ^= s[j];

            for (var j = 0; j < m - b; j++)
                s[j] = t[b + j];

            for (var j = 0; j < b; j++)
                s[m - b + j] = p[j];

            k = this.keyMeshing(k, s, i, key);
        }

        if (r > 0) {
            this.process(key, s);

            for (var i = 0; i < r; i++)
                c[q * b + i] ^= s[i];
        }
        return c.buffer;
    }

    /**
     * Algorithm name GOST 28147-CTR<br><br>
     * 
     * encryptCTR/decryptCTR (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie" (Counter Mode-CTR) mode, and IV is used as the   
     * initialization vector.
     * @memberOf GostCipher
     * @method encrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv 8x8 optional bits initial vector
     * @return {CryptoOperationData} result
     */
    /**
     * Algorithm name GOST 28147-CTR<br><br>
     * 
     * encryptCTR/decryptCTR (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "gammirovanie" (Counter Mode-CTR) mode, and IV is used as the   
     * initialization vector.
     * @memberOf GostCipher
     * @method decrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function processCTR89(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                c = cloneArray(d),
                b = this.blockSize,
                t = new Int8Array(b),
                cb = c.length, r = cb % b, q = (cb - r) / b,
                key = this.keySchedule(k),
                syn = new Int32Array(s.buffer);

        this.process(key, s);

        for (var i = 0; i < q; i++) {
            syn[0] = (syn[0] + 0x1010101) & 0xffffffff;
            // syn[1] = signed(unsigned((syn[1] + 0x1010104) & 0xffffffff) % 0xffffffff);
            var tmp = unsigned(syn[1]) + 0x1010104; // Special thanks to Ilya Matveychikov
            syn[1] = signed(tmp < 0x100000000 ? tmp : tmp - 0xffffffff);

            for (var j = 0; j < b; j++)
                t[j] = s[j];

            this.process(key, syn);

            for (var j = 0; j < b; j++)
                c[i * b + j] ^= s[j];

            for (var j = 0; j < b; j++)
                s[j] = t[j];

            k = this.keyMeshing(k, s, i, key);
        }
        if (r > 0) {
            syn[0] = (syn[0] + 0x1010101) & 0xffffffff;
            // syn[1] = signed(unsigned((syn[1] + 0x1010104) & 0xffffffff) % 0xffffffff);
            var tmp = unsigned(syn[1]) + 0x1010104; // Special thanks to Ilya Matveychikov
            syn[1] = signed(tmp < 0x100000000 ? tmp : tmp - 0xffffffff);

            this.process(key, syn);

            for (var i = 0; i < r; i++)
                c[q * b + i] ^= s[i];
        }
        return c.buffer;
    }

    function processCTR15(k, d, iv)
    {
        var c = cloneArray(d),
                n = this.blockSize,
                b = this.shiftBits >> 3,
                cb = c.length, r = cb % b, q = (cb - r) / b,
                s = new Uint8Array(n),
                t = new Int32Array(n),
                key = this.keySchedule(k);

        s.set(iv || this.iv);
        for (var i = 0; i < q; i++) {

            for (var j = 0; j < n; j++)
                t[j] = s[j];

            this.process(key, s);

            for (var j = 0; j < b; j++)
                c[b * i + j] ^= s[j];

            for (var j = 0; j < n; j++)
                s[j] = t[j];

            for (var j = n - 1; i >= 0; --i) {
                if (s[j] > 0xfe) {
                    s[j] -= 0xfe;
                } else {
                    s[j]++;
                    break;
                }
            }
        }

        if (r > 0) {
            this.process(key, s);
            for (var j = 0; j < r; j++)
                c[b * q + j] ^= s[j];
        }

        return c.buffer;
    }

    /**
     * Algorithm name GOST 28147-CBC<br><br>
     * 
     * encryptCBC (IV, K, D) is D, encrypted with key K using GOST 28147/GOST R 34.13   
     * in "Prostaya zamena s zatsepleniem" (Cipher-Block-Chaining, CBC) mode and IV is used as the initialization 
     * vector.
     * 
     * @memberOf GostCipher
     * @method encrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function encryptCBC(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                n = this.blockSize,
                m = s.length,
                c = this.pad(byteArray(d)),
                key = this.keySchedule(k);

        for (var i = 0, b = c.length / n; i < b; i++) {

            for (var j = 0; j < n; j++)
                s[j] ^= c[i * n + j];

            this.process(key, s);

            for (var j = 0; j < n; j++)
                c[i * n + j] = s[j];

            if (m !== n) {
                for (var j = 0; j < m - n; j++)
                    s[j] = s[n + j];

                for (var j = 0; j < n; j++)
                    s[j + m - n] = c[i * n + j];
            }

            k = this.keyMeshing(k, s, i, key);
        }

        return c.buffer;
    }

    /**
     * Algorithm name GOST 28147-CBC<br><br>
     * 
     * decryptCBC (IV, K, D) is D, decrypted with key K using GOST 28147/GOST R 34.13   
     * in "Prostaya zamena s zatsepleniem" (Cipher-Block-Chaining, CBC) mode and IV is used as the initialization 
     * vector.
     * 
     * @memberOf GostCipher
     * @method decrypt
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function decryptCBC(k, d, iv)
    {
        var s = new Uint8Array(iv || this.iv),
                n = this.blockSize,
                m = s.length,
                c = cloneArray(d),
                next = new Uint8Array(n),
                key = this.keySchedule(k, 1);

        for (var i = 0, b = c.length / n; i < b; i++) {

            for (var j = 0; j < n; j++)
                next[j] = c[i * n + j];

            this.process(key, c, i * n, 1);

            for (var j = 0; j < n; j++)
                c[i * n + j] ^= s[j];

            if (m !== n) {
                for (var j = 0; j < m - n; j++)
                    s[j] = s[n + j];
            }

            for (var j = 0; j < n; j++)
                s[j + m - n] = next[j];

            k = this.keyMeshing(k, s, i, key, 1);
        }

        return this.unpad(c).buffer;
    }

    /**
     * The generateKey method returns a new generated key.
     * 
     * @memberOf GostCipher
     * @method generateKey
     * @instance
     * @return {CryptoOperationData} result
     */

    function generateKey()
    {
        // Simple generate 256 bit random seed
        var k = new Uint8Array(this.keySize);
        randomSeed(k);
        return k.buffer;
    }


    /**
     * makeIMIT (K, D) is the 32-bit result of the GOST 28147/GOST R 34.13 in   
     * "imitovstavka" (MAC) mode, used with D as plaintext, K as key and IV   
     * as initialization vector.  Note that the standard specifies its use   
     * in this mode only with an initialization vector of zero.
     * 
     * @memberOf GostCipher
     * @method processMAC
     * @private
     * @instance
     * @param {Int32Array} key 8x32 bits key 
     * @param {Int32Array} s 8x8 sum array
     * @param {Uint8Array} d 8 bits array with data 
     * @return {Uint8Array} result
     */
    function processMAC89(key, s, d)
    {
        var c = zeroPad.call(this, byteArray(d)),
                n = this.blockSize,
                q = c.length / n,
                sBox = this.sBox,
                sum = new Int32Array(s.buffer);

        for (var i = 0; i < q; i++) {

            for (var j = 0; j < n; j++)
                s[j] ^= c[i * n + j];

            for (var j = 0; j < 16; j++) // 1-16 steps
                round(sBox, sum, key[j]);
        }
    }

    function processKeyMAC15(s)
    {
        var t = 0, n = s.length;
        for (var i = n - 1; i >= 0; --i) {
            var t1 = s[i] >>> 7;
            s[i] = (s[i] << 1) & 0xff | t;
            t = t1;
        }
        if (t !== 0) {
            if (n === 16)
                s[15] ^= 0x87;
            else
                s[7] ^= 0x1b;
        }
    }

    function processMAC15(key, s, d)
    {
        var n = this.blockSize,
                sBox = this.sBox, c = byteArray(d),
                r = new Uint8Array(n);
        // R
        this.process(key, r);
        // K1
        processKeyMAC15(r);
        if (d.byteLength % n !== 0) {
            c = bitPad.call(this, byteArray(d));
            // K2
            processKeyMAC15(r);
        }

        for (var i = 0, q = c.length / n; i < q; i++) {

            for (var j = 0; j < n; j++)
                s[j] ^= c[i * n + j];

            if (i === q - 1) {// Last block
                for (var j = 0; j < n; j++)
                    s[j] ^= r[j];
            }

            this.process(key, s);
        }
    }

    /**
     * signMAC (K, D, IV) is the 32-bit result of the GOST 28147/GOST R 34.13 in   
     * "imitovstavka" (MAC) mode, used with D as plaintext, K as key and IV   
     * as initialization vector.  Note that the standard specifies its use   
     * in this mode only with an initialization vector of zero.
     * 
     * @memberOf GostCipher
     * @method sign
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv initial vector
     * @return {CryptoOperationData} result
     */
    function signMAC(k, d, iv)
    {
        var key = this.keySchedule(k),
                s = new Uint8Array(iv || this.iv),
                m = Math.ceil(this.macLength >> 3) || this.blockSize >> 1;

        this.processMAC(key, s, d);

        var mac = new Uint8Array(m); // mac size
        mac.set(new Uint8Array(s.buffer, 0, m));
        return mac.buffer;
    }

    /**
     * verifyMAC (K, M, D, IV) the 32-bit result verification of the GOST 28147/GOST R 34.13 in   
     * "imitovstavka" (MAC) mode, used with D as plaintext, K as key and IV   
     * as initialization vector.  Note that the standard specifies its use   
     * in this mode only with an initialization vector of zero.
     * 
     * @memberOf GostCipher
     * @method verify
     * @instance
     * @param {CryptoOperationData} k 8x32 bits key 
     * @param {CryptoOperationData} m 8 bits array with signature
     * @param {CryptoOperationData} d 8 bits array with data 
     * @param {CryptoOperationData} iv 8x8 optional bits initial vector
     * @return {boolen} MAC verified = true
     */
    function verifyMAC(k, m, d, iv)
    {
        var mac = new Uint8Array(signMAC.call(this, k, d, iv)),
                test = byteArray(m);
        if (mac.length !== test.length)
            return false;
        for (var i = 0, n = mac.length; i < n; i++)
            if (mac[i] !== test[i])
                return false;
        return true;
    }

    /**
     * Algorithm name GOST 28147-KW<br><br>
     * 
     * This algorithm encrypts GOST 28147-89 CEK with a GOST 28147/GOST R 34.13 KEK.
     * Ref. rfc4357 6.1 GOST 28147-89 Key Wrap
     * Note: This algorithm MUST NOT be used with a KEK produced by VKO GOST   
     * R 34.10-94, because such a KEK is constant for every sender-recipient   
     * pair.  Encrypting many different content encryption keys on the same   
     * constant KEK may reveal that KEK.
     * 
     * @memberOf GostCipher
     * @method wrapKey
     * @instance
     * @param {CryptoOperationData} kek Key encryption key
     * @param {CryptoOperationData} cek Content encryption key
     * @returns {CryptoOperationData} Encrypted cek
     */
    function wrapKeyGOST(kek, cek)
    {
        var n = this.blockSize, k = this.keySize, len = k + (n >> 1);
        // 1) For a unique symmetric KEK, generate 8 octets at random and call 
        // the result UKM.  For a KEK, produced by VKO GOST R 34.10-2001, use 
        // the UKM that was used for key derivation.    
        if (!this.ukm) 
            throw new DataError('UKM must be defined');
        var ukm = new Uint8Array(this.ukm);
        // 2) Compute a 4-byte checksum value, GOST 28147IMIT (UKM, KEK, CEK).       
        // Call the result CEK_MAC. 
        var mac = signMAC.call(this, kek, cek, ukm);
        // 3) Encrypt the CEK in ECB mode using the KEK.  Call the ciphertext CEK_ENC.
        var enc = encryptECB.call(this, kek, cek);
        // 4) The wrapped content-encryption key is (UKM | CEK_ENC | CEK_MAC).
        var r = new Uint8Array(len);
        r.set(new Uint8Array(enc), 0);
        r.set(new Uint8Array(mac), k);
        return r.buffer;
    }

    /**
     * Algorithm name GOST 28147-KW<br><br>
     * 
     *  This algorithm decrypts GOST 28147-89 CEK with a GOST 28147 KEK.
     *  Ref. rfc4357 6.2 GOST 28147-89 Key Unwrap
     *  
     * @memberOf GostCipher
     * @method unwrapKey
     * @instance
     * @param {type} kek Key encryption key
     * @param {type} data Content encryption key
     * @return {CryptoOperationData} result
     */
    function unwrapKeyGOST(kek, data)
    {
        var n = this.blockSize, k = this.keySize, len = k + (n >> 1);
        // 1) If the wrapped content-encryption key is not 44 octets, then error.
        var d = buffer(data);
        if (d.byteLength !== len)
            throw new DataError('Wrapping key size must be ' + len + ' bytes');
        // 2) Decompose the wrapped content-encryption key into UKM, CEK_ENC, and CEK_MAC.  
        // UKM is the most significant (first) 8 octets. CEK_ENC is next 32 octets, 
        // and CEK_MAC is the least significant (last) 4 octets.    
        if (!this.ukm)
            throw new DataError('UKM must be defined');
        var ukm = new Uint8Array(this.ukm),
                enc = new Uint8Array(d, 0, k),
                mac = new Uint8Array(d, k, n >> 1);
        // 3) Decrypt CEK_ENC in ECB mode using the KEK.  Call the output CEK.
        var cek = decryptECB.call(this, kek, enc);
        // 4) Compute a 4-byte checksum value, GOST 28147IMIT (UKM, KEK, CEK), 
        // compare the result with CEK_MAC.  If they are not equal, then error.
        var check = verifyMAC.call(this, kek, mac, cek, ukm);
        if (!check)
            throw new DataError('Error verify MAC of wrapping key');
        return cek;
    }

    /**
     * Algorithm name GOST 28147-CPKW<br><br>
     * 
     * Given a random 64-bit UKM and a GOST 28147 key K, this algorithm   
     * creates a new GOST 28147-89 key K(UKM).
     * Ref. rfc4357 6.3 CryptoPro KEK Diversification Algorithm
     * 
     * @memberOf GostCipher
     * @method diversify
     * @instance
     * @private
     * @param {CryptoOperationData} kek Key encryption key
     * @param {CryptoOperationData} ukm Random generated value
     * @returns {CryptoOperationData} Diversified kek
     */
    function diversifyKEK(kek, ukm)
    {
        var n = this.blockSize;

        // 1) Let K[0] = K;    
        var k = intArray(kek);
        // 2) UKM is split into components a[i,j]:       
        //    UKM = a[0]|..|a[7] (a[i] - byte, a[i,0]..a[i,7] - it’s bits) 
        var a = [];
        for (var i = 0; i < n; i++) {
            a[i] = [];
            for (var j = 0; j < 8; j++) {
                a[i][j] = (ukm[i] >>> j) & 0x1;
            }
        }
        // 3) Let i be 0.    
        // 4) K[1]..K[8] are calculated by repeating the following algorithm       
        //    eight times:     
        for (var i = 0; i < n; i++) {
            //     A) K[i] is split into components k[i,j]:
            //        K[i] = k[i,0]|k[i,1]|..|k[i,7] (k[i,j] - 32-bit integer)
            //     B) Vector S[i] is calculated:        
            //        S[i] = ((a[i,0]*k[i,0] + ... + a[i,7]*k[i,7]) mod 2^32) |        
            //         (((~a[i,0])*k[i,0] + ... + (~a[i,7])*k[i,7]) mod 2^32);     
            var s = new Int32Array(2);
            for (var j = 0; j < 8; j++) {
                if (a[i][j])
                    s[0] = (s[0] + k[j]) & 0xffffffff;
                else
                    s[1] = (s[1] + k[j]) & 0xffffffff;
            }
            //     C) K[i+1] = encryptCFB (S[i], K[i], K[i])
            var iv = new Uint8Array(s.buffer);
            k = new Int32Array(encryptCFB.call(this, k, k, iv));
            //     D) i = i + 1
        }
        // 5) Let K(UKM) be K[8].
        return k;
    }

    /**
     * Algorithm name GOST 28147-CPKW<br><br>
     * 
     * This algorithm encrypts GOST 28147-89 CEK with a GOST 28147 KEK.   
     * It can be used with any KEK (e.g., produced by VKO GOST R 34.10-94 or   
     * VKO GOST R 34.10-2001) because a unique UKM is used to diversify the KEK.
     * Ref. rfc4357 6.3  CryptoPro Key Wrap
     * 
     * @memberOf GostCipher
     * @method wrapKey
     * @instance
     * @param {CryptoOperationData} kek Key encryption key
     * @param {CryptoOperationData} cek Content encryption key
     * @returns {CryptoOperationData} Encrypted cek
     */
    function wrapKeyCP(kek, cek)
    {
        var n = this.blockSize, k = this.keySize, len = k + (n >> 1);
        // 1) For a unique symmetric KEK or a KEK produced by VKO GOST R       
        // 34.10-94, generate 8 octets at random.  Call the result UKM.  For       
        // a KEK, produced by VKO GOST R 34.10-2001, use the UKM that was       
        // used for key derivation.
        if (!this.ukm) 
            throw new DataError('UKM must be defined');
        var ukm = new Uint8Array(this.ukm);
        // 2) Diversify KEK, using the CryptoPro KEK Diversification Algorithm,       
        // described in Section 6.5.  Call the result KEK(UKM).
        var dek = diversifyKEK.call(this, kek, ukm);
        // 3) Compute a 4-byte checksum value, GOST 28147IMIT (UKM, KEK(UKM),       
        // CEK).  Call the result CEK_MAC.    
        var mac = signMAC.call(this, dek, cek, ukm);
        // 4) Encrypt CEK in ECB mode using KEK(UKM).  Call the ciphertext       
        // CEK_ENC.    
        var enc = encryptECB.call(this, dek, cek);
        // 5) The wrapped content-encryption key is (UKM | CEK_ENC | CEK_MAC).
        var r = new Uint8Array(len);
        r.set(new Uint8Array(enc), 0);
        r.set(new Uint8Array(mac), k);
        return r.buffer;
    }

    /**
     * Algorithm name GOST 28147-CPKW<br><br>
     * 
     * This algorithm encrypts GOST 28147-89 CEK with a GOST 28147 KEK. 
     * Ref. rfc4357 6.4 CryptoPro Key Unwrap
     *
     * @memberOf GostCipher
     * @method unwrapKey
     * @instance
     * @param {CryptoOperationData} kek Key encryption key
     * @param {CryptoOperationData} data Encrypted content encryption keu
     * @return {CryptoOperationData} result Decrypted content encryption keu
     */
    function unwrapKeyCP(kek, data)
    {
        var n = this.blockSize, k = this.keySize, len = k + (n >> 1);
        // 1) If the wrapped content-encryption key is not 44 octets, then error.    
        var d = buffer(data);
        if (d.byteLength !== len)
            throw new DataError('Wrapping key size must be ' + len + ' bytes');
        // 2) Decompose the wrapped content-encryption key into UKM, CEK_ENC,       
        // and CEK_MAC.  UKM is the most significant (first) 8 octets.       
        // CEK_ENC is next 32 octets, and CEK_MAC is the least significant       
        // (last) 4 octets.    
        if (!this.ukm)
            throw new DataError('UKM must be defined');
        var ukm = new Uint8Array(this.ukm),
                enc = new Uint8Array(d, 0, k),
                mac = new Uint8Array(d, k, n >> 1);
        // 3) Diversify KEK using the CryptoPro KEK Diversification Algorithm,       
        // described in section 6.5.  Call the result KEK(UKM).    
        var dek = diversifyKEK.call(this, kek, ukm);
        // 4) Decrypt CEK_ENC in ECB mode using KEK(UKM).  Call the output CEK.    
        var cek = decryptECB.call(this, dek, enc);
        // 5) Compute a 4-byte checksum value, GOST 28147IMIT (UKM, KEK(UKM),       
        // CEK), compare the result with CEK_MAC.  If they are not equal, 
        // then it is an error.
        var check = verifyMAC.call(this, dek, mac, cek, ukm);
        if (!check)
            throw new DataError('Error verify MAC of wrapping key');
        return cek;
    }

    /**
     * SignalCom master key packing algorithm
     * 
     * kek stored in 3 files - kek.opq, mk.db3, masks.db3
     * kek.opq - always 36 bytes length = 32 bytes encrypted kek + 4 bytes mac of decrypted kek
     * mk.db3 - 6 bytes header (1 byte magic code 0x22 + 1 byte count of masks + 4 bytes mac of 
     * xor summarizing masks value) + attached masks 
     * masks.db3 - detached masks. 
     * Total length  of attached + detached masks = 32 bits * count of masks
     * Default value of count 8 = (7 attached + 1 detached). But really no reason for such 
     * separation - all masks xor summarizing - order is not matter.
     * Content of file rand.opq can used as ukm. Don't forget change file content after using. 
     * 
     * For usb-token files has names: 
     * a001 - mk.db3, b001 - masks.db3, c001 - kek.opq, d001 - rand.opq
     * For windows registry
     * 00000001 - mk.db3, 00000002 - masks.db3, 00000003 - key.opq, 00000004 - rand.opq, 
     * 00000006 - keys\00000001.key, 0000000A - certificate
     * 
     * @memberOf GostCipher
     * @method packKey
     * @instance
     * @private
     * @param {CryptoOperationData} unpacked - clear main key 32 bytes
     * @param {CryptoOperationData} ukm - random vector for packing - 32 bytes * (count of masks - 1)
     * @returns {CryptoOperationData} packed master key - concatination of mk.db3 + masks.db3
     */
    function packKeySC(unpacked, ukm)
    {
        var m = this.blockSize >> 1, k = this.keySize;
        var mcount = 8;
        var key = new Uint8Array(buffer(unpacked));
        if (key.byteLength !== k)
            throw new DataError('Wrong cleartext size ' + key.byteLength + ' bytes');
        // Check or generate UKM
        ukm = ukm || this.ukm;
        if (ukm) {
            ukm = new Uint8Array(buffer(ukm));
            if (ukm.byteLength > 0 && ukm.byteLength % k === 0)
                mcount = ukm.byteLength / k + 1;
            else
                throw new DataError('Wrong rand size ' + ukm.byteLength + ' bytes');
        } else
            randomSeed(ukm = new Uint8Array((mcount - 1) * k));
        // Output array
        var d = new Uint8Array(mcount * k + m + 2), b = d.buffer;
        // Calculate MAC
        var zero32 = new Uint8Array(k);
        var mac = signMAC.call(this, key, zero32);
        d[0] = 0x22; // Magic code
        d[1] = mcount; // Count of masks
        d.set(new Uint8Array(mac), 2);
        d.set(ukm, k + m + 2);
        for (var i = 1; i < mcount; i++) {
            var mask = new Uint8Array(b, 2 + m + k * i);
            for (var j = 0; j < k; j++)
                key[j] ^= mask[j];
        }
        d.set(key, m + 2);
        return d.buffer;
    }

    /**
     * Algorithm name GOST 28147-SCKW<br><br>
     * 
     * SignalCom master key unpacking algorithm
     * 
     * @memberOf GostCipher
     * @method unpackKey
     * @instance
     * @private
     * @param {CryptoOperationData} packed - concatination of mk.db3 + masks.db3
     * @returns {CryptoOperationData} unpacked master key
     */
    function unpackKeySC(packed)
    {
        var m = this.blockSize >> 1, k = this.keySize;
        var b = buffer(packed);
        // Unpack master key
        var magic = new Uint8Array(b, 0, 1)[0];
        if (magic !== 0x22)
            throw new DataError('Invalid magic number');
        var mcount = new Uint8Array(b, 1, 1)[0];
        var mac = new Uint8Array(b, 2, m); // MAC for summarized mask
        // Compute packKey xor summing for all masks
        var key = new Uint8Array(k);
        for (var i = 0; i < mcount; i++) {
            var mask = new Uint8Array(b, 2 + m + k * i, k);
            for (var j = 0; j < k; j++)
                key[j] ^= mask[j];
        }
        // Test MAC for packKey with default sBox on zero 32 bytes array
        var zero32 = new Uint8Array(k);
        var test = verifyMAC.call(this, key, mac, zero32);
        if (!test) {
            // Try to use different sBoxes
            var names = ['E-A', 'E-B', 'E-C', 'E-D', 'E-SC'];
            for (var i = 0, n = names.length; i < n; i++) {
                this.sBox = sBoxes[names[i]];
                test = verifyMAC.call(this, key, mac, zero32);
                if (test)
                    break;
            }
        }
        if (!test)
            throw new DataError('Invalid main key MAC');
        return key.buffer;
    }

    /**
     * Algorithm name GOST 28147-SCKW<br><br>
     * 
     * SignalCom Key Wrapping algorithm
     * 
     * @memberOf GostCipher
     * @method wrapKey
     * @instance
     * @param {CryptoOperationData} kek - clear kek or concatination of mk.db3 + masks.db3
     * @param {CryptoOperationData} cek - key for wrapping 
     * @returns {CryptoOperationData} wrapped key - file kek.opq
     */
    function wrapKeySC(kek, cek)
    {
        var m = this.blockSize >> 1, n = this.keySize;
        var k = buffer(kek);
        var c = buffer(cek);
        if (k.byteLength !== n)
            k = unpackKeySC.call(this, k);
        var enc = encryptECB.call(this, k, c);
        var mac = signMAC.call(this, k, c);
        var d = new Uint8Array(m + n);
        d.set(new Uint8Array(enc), 0);
        d.set(new Uint8Array(mac), n);
        return d.buffer;
    }

    /**
     * Algorithm name GOST 28147-SCKW<br><br>
     * 
     * SignalCom Key UnWrapping algorithm
     * 
     * @memberOf GostCipher
     * @method unwrapKey
     * @instance
     * @param {CryptoOperationData} kek - concatination of files mk.db3 + masks.db3 or clear kek 
     * @param {CryptoOperationData} cek - wrapping key - file kek.opq
     * @return {CryptoOperationData} result
     */
    function unwrapKeySC(kek, cek)
    {
        var m = this.blockSize >> 1, n = this.keySize;
        var k = buffer(kek);
        var c = buffer(cek);
        if (k.byteLength !== n)
            k = unpackKeySC.call(this, k);
        var enc = new Uint8Array(c, 0, n); // Encrypted kek
        var mac = new Uint8Array(c, n, m); // MAC for clear kek
        var d = decryptECB.call(this, k, enc);
        if (!verifyMAC.call(this, k, mac, d))
            throw new DataError('Invalid key MAC');
        return d;
    }

    /**
     * Algorithm name GOST 28147-SCKW<br><br>
     * 
     * SignalCom master key generation for wrapping
     * 
     * @memberOf GostCipher
     * @method generateKey
     * @instance
     * @return {CryptoOperationData} result
     */
    function generateWrappingKeySC()
    {
        return packKeySC.call(this, generateKey.call(this));
    }

    function maskKey(mask, key, inverse, keySize)
    {
        var k = keySize / 4, 
                m32 = new Int32Array(buffer(mask)),
                k32 = new Int32Array(buffer(key)), 
                r32 = new Int32Array(k);
        if (inverse)
            for (var i = 0; i < k; i++) 
                r32[i] = (k32[i] + m32[i]) & 0xffffffff;
        else
            for (var i = 0; i < k; i++) 
                r32[i] = (k32[i] - m32[i]) & 0xffffffff;
        return r32.buffer;
    }

    /**
     * Algorithm name GOST 28147-MASK<br><br>
     * 
     * This algorithm wrap key mask
     * 
     * @memberOf GostCipher
     * @method wrapKey
     * @instance
     * @param {CryptoOperationData} mask The mask
     * @param {CryptoOperationData} key The key
     * @returns {CryptoOperationData} The masked key
     */
    function wrapKeyMask(mask, key)
    {
        return maskKey(mask, key, this.procreator === 'VN', this.keySize);
    }

    /**
     * Algorithm name GOST 28147-CPKW<br><br>
     * 
     * This algorithm unwrap key mask
     *
     * @memberOf GostCipher
     * @method unwrapKey
     * @instance
     * @param {CryptoOperationData} mask The mask
     * @param {CryptoOperationData} key The masked key
     * @return {CryptoOperationData} result The key
     */
    function unwrapKeyMask(mask, key)
    {
        return maskKey(mask, key, this.procreator !== 'VN', this.keySize);
    }
    
    /**
     * Algorithm name GOST 28147-CPKM<br><br>
     * 
     * Key meshing in according to rfc4357 2.3.2. CryptoPro Key Meshing
     * 
     * @memberOf GostCipher
     * @method keyMeshing
     * @instance
     * @private
     * @param {(Uint8Array|CryptoOperationData)} k 8x8 bit key 
     * @param {Uint8Array} s 8x8 bit sync (iv)
     * @param {Integer} i block index
     * @param {Int32Array} key 8x32 bit key schedule 
     * @param {boolean} e true - decrypt
     * @returns CryptoOperationData next 8x8 bit key
     */
    function keyMeshingCP(k, s, i, key, e)
    {
        if ((i + 1) * this.blockSize % 1024 === 0) { // every 1024 octets
            // K[i+1] = decryptECB (K[i], C);
            k = decryptECB.call(this, k, C);
            // IV0[i+1] = encryptECB (K[i+1],IVn[i])
            s.set(new Uint8Array(encryptECB.call(this, k, s)));
            // restore key schedule
            key.set(this.keySchedule(k, e));
        }
        return k;
    }

    /**
     *  Null Key Meshing in according to rfc4357 2.3.1
     * 
     * @memberOf GostCipher
     * @method keyMeshing
     * @instance
     * @private
     * @param {(Uint8Array|CryptoOperationData)} k 8x8 bit key 
     */
    function noKeyMeshing(k)
    {
        return k;
    }

    /**
     * Algorithm name GOST 28147-NoPadding<br><br>
     * 
     * No padding.
     * 
     * @memberOf GostCipher
     * @method padding
     * @instance
     * @private
     * @param {Uint8Array} d array with source data
     * @returns {Uint8Array} result
     */
    function noPad(d)
    {
        return new Uint8Array(d);
    }

    /**
     * Algorithm name GOST 28147-PKCS5Padding<br><br>
     * 
     *  PKCS#5 padding: 8-x remaining bytes are filled with the value of      
     *  8-x.  If there’s no incomplete block, one extra block filled with      
     *  value 8 is added
     * 
     * @memberOf GostCipher
     * @method padding
     * @instance
     * @private
     * @param {Uint8Array} d array with source data
     * @returns {Uint8Array} result
     */
    function pkcs5Pad(d)
    {
        var n = d.byteLength,
                nb = this.blockSize,
                q = nb - n % nb,
                m = Math.ceil((n + 1) / nb) * nb,
                r = new Uint8Array(m);
        r.set(d);
        for (var i = n; i < m; i++)
            r[i] = q;
        return r;
    }

    function pkcs5Unpad(d)
    {
        var m = d.byteLength,
                nb = this.blockSize,
                q = d[m - 1],
                n = m - q;
        if (q > nb)
            throw DataError('Invalid padding');
        var r = new Uint8Array(n);
        if (n > 0)
            r.set(new Uint8Array(d.buffer, 0, n));
        return r;
    }


    /**
     * Algorithm name GOST 28147-ZeroPadding<br><br>
     * 
     * Zero padding: 8-x remaining bytes are filled with zero
     * 
     * @memberOf GostCipher
     * @method padding
     * @instance
     * @private
     * @param {Uint8Array} d array with source data
     * @returns {Uint8Array} result
     */
    function zeroPad(d)
    {
        var n = d.byteLength,
                nb = this.blockSize,
                m = Math.ceil(n / nb) * nb,
                r = new Uint8Array(m);
        r.set(d);
        for (var i = n; i < m; i++)
            r[i] = 0;
        return r;
    }


    /**
     * Algorithm name GOST 28147-BitPadding<br><br>
     * 
     * Bit padding: P* = P || 1 || 000...0 If there’s no incomplete block, 
     * one extra block filled with 1 || 000...0
     * 
     * @memberOf GostCipher
     * @method padding
     * @instance
     * @private
     * @param {Uint8Array} d array with source data
     * @returns {Uint8Array} result
     */
    function bitPad(d)
    {
        var n = d.byteLength,
                nb = this.blockSize,
                m = Math.ceil((n + 1) / nb) * nb,
                r = new Uint8Array(m);
        r.set(d);
        r[n] = 1;
        for (var i = n + 1; i < m; i++)
            r[i] = 0;
        return r;
    }

    function bitUnpad(d)
    {
        var m = d.byteLength,
                n = m;
        while (n > 1 && d[n - 1] === 0)
            n--;
        if (d[n - 1] !== 1)
            throw DataError('Invalid padding');
        n--;
        var r = new Uint8Array(n);
        if (n > 0)
            r.set(new Uint8Array(d.buffer, 0, n));
        return r;
    }

    /**
     * Algorithm name GOST 28147-RandomPadding<br><br>
     * 
     * Random padding: 8-x remaining bytes of the last block are set to      
     * random.
     * 
     * @memberOf GostCipher
     * @method padding
     * @instance
     * @private
     * @param {Uint8Array} d array with source data
     * @returns {Uint8Array} result
     */
    function randomPad(d)
    {
        var n = d.byteLength,
                nb = this.blockSize,
                q = nb - n % nb,
                m = Math.ceil(n / nb) * nb,
                r = new Uint8Array(m), e = new Uint8Array(r.buffer, n, q);
        r.set(d);
        randomSeed(e);
        return r;
    }

    /**
     * GOST 28147-89 Encryption Algorithm<br><br> 
     * 
     * References {@link http://tools.ietf.org/html/rfc5830}<br><br>
     * 
     * When keys and initialization vectors are converted to/from byte arrays, 
     * little-endian byte order is assumed.<br><br>
     * 
     * Normalized algorithm identifier common parameters:
     * 
     *  <ul>
     *      <li><b>name</b> Algorithm name 'GOST 28147' or 'GOST R 34.12'</li>
     *      <li><b>version</b> Algorithm version, number
     *          <ul>
     *              <li><b>1989</b> Current version of standard</li>
     *              <li><b>2015</b> New draft version of standard</li>
     *          </ul>
     *      </li>
     *      <li><b>length</b> Block length
     *          <ul>
     *              <li><b>64</b> 64 bits length (default)</li>
     *              <li><b>128</b> 128 bits length (only for version 2015)</li>
     *          </ul>
     *      </li>
     *      <li><b>mode</b> Algorithm mode, string
     *          <ul>
     *              <li><b>ES</b> Encryption mode (default)</li>
     *              <li><b>MAC</b> "imitovstavka" (MAC) mode</li>
     *              <li><b>KW</b> Key wrapping mode</li>
     *          </ul>
     *      </li>
     *      <li><b>sBox</b> Paramset sBox for GOST 28147-89, string. Used only if version = 1989</li>
     *  </ul>
     *  
     * Supported algorithms, modes and parameters:
     * 
     *  <ul>
     *      <li>Encript/Decrypt mode (ES)
     *          <ul>
     *              <li><b>block</b> Block mode, string. Default ECB</li>
     *              <li><b>keyMeshing</b> Key meshing mode, string. Default NO</li>
     *              <li><b>padding</b> Padding mode, string. Default NO for CFB and CTR modes, or ZERO for others</li>
     *              <li><b>iv</b> {@link CryptoOperationData} Initial vector with length of block. Default - zero block</li>
     *          </ul>
     *      </li>
     *      <li>Sign/Verify mode (MAC)
     *          <ul>
     *              <li><b>macLength</b> Length of mac in bits (default - 32 bits)</li>
     *              <li><b>iv</b> {@link CryptoOperationData} Initial vector with length of block. Default - zero block</li>
     *          </ul>
     *      </li>
     *      <li>Wrap/Unwrap key mode (KW)
     *          <ul>
     *              <li><b>keyWrapping</b> Mode of keywrapping, string. Default NO - standard GOST key wrapping</li>
     *              <li><b>ukm</b> {@link CryptoOperationData} User key material. Default - random generated value</li>
     *          </ul>
     *      </li>
     *  </ul>
     *      
     * Supported paramters values:
     *      
     *  <ul>
     *      <li>Block modes (parameter 'block')
     *          <ul>
     *              <li><b>ECB</b> "prostaya zamena" (ECB) mode (default)</li>
     *              <li><b>CFB</b> "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode</li>
     *              <li><b>OFB</b> "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode</li>
     *              <li><b>CTR</b> "gammirovanie" (counter) mode</li>
     *              <li><b>CBC</b> Cipher-Block-Chaining (CBC) mode</li>
     *          </ul>
     *      </li>
     *      <li>Key meshing modes (parameter 'keyMeshing')
     *          <ul>
     *              <li><b>NO</b> No key wrapping (default)</li>
     *              <li><b>CP</b> CryptoPor Key key meshing</li>
     *          </ul>
     *      </li>
     *      <li>Padding modes (parameter 'padding')
     *          <ul>
     *              <li><b>NO</b> No padding only for CFB, OFB and CTR modes</li>
     *              <li><b>PKCS5</b> PKCS#5 padding mode</li>
     *              <li><b>ZERO</b> Zero bits padding mode</li>
     *              <li><b>RANDOM</b> Random bits padding mode</li>
     *              <li><b>BIT</b> One bit padding mode</li>
     *          </ul>
     *      </li>
     *      <li>Wrapping key modes (parameter 'keyWrapping')
     *          <ul>
     *              <li><b>NO</b> Ref. rfc4357 6.1 GOST 28147-89 Key wrapping</li>
     *              <li><b>CP</b> CryptoPro Key wrapping mode</li>
     *              <li><b>SC</b> SignalCom Key wrapping mode</li>
     *          </ul>
     *      </li>
     *  </ul>
     * 
     * @class GostCipher
     * @param {AlgorithmIndentifier} algorithm WebCryptoAPI algorithm identifier
     */
    function GostCipher(algorithm)
    {
        // Check little endian support
        if (!littleEndian)
            throw new NotSupportedError('Big endian platform not supported');
        algorithm = algorithm || {};
        this.keySize = 32;
        this.blockLength = algorithm.length || 64;
        this.blockSize = this.blockLength >> 3;

        this.name = (algorithm.name || (algorithm.version === 1 ? 'RC2' :
                algorithm.version === 1989 ? 'GOST 28147' : 'GOST R 34.12')) +
                (algorithm.version > 4 ? '-' + ((algorithm.version || 1989) % 100) : '') + '-' +
                (this.blockLength === 64 ? '' : this.blockLength + '-') +
                ((algorithm.mode === 'MAC') ? 'MAC-' + (algorithm.macLength || this.blockLength >> 1) :
                        (algorithm.mode === 'KW' || algorithm.keyWrapping) ?
                        ((algorithm.keyWrapping || 'NO') !== 'NO' ? algorithm.keyWrapping : '') + 'KW' :
                        (algorithm.block || 'ECB') + ((algorithm.block === 'CFB' || algorithm.block === 'OFB' ||
                        (algorithm.block === 'CTR' && algorithm.version === 2015)) &&
                        algorithm.shiftBits && algorithm.shiftBits !== this.blockLength ? '-' + algorithm.shiftBits : '') +
                        (algorithm.padding ? '-' + (algorithm.padding || (algorithm.block === 'CTR' ||
                                algorithm.block === 'CFB' || algorithm.block === 'OFB' ? 'NO' : 'ZERO')) + 'PADDING' : '') +
                        ((algorithm.keyMeshing || 'NO') !== 'NO' ? '-CPKEYMESHING' : '')) +
                (algorithm.procreator ? '/' + algorithm.procreator : '') +
                (typeof algorithm.sBox === 'string' ? '/' + algorithm.sBox : '');

        // Algorithm procreator
        this.procreator = algorithm.procreator;
        
        switch (algorithm.version || 1989) {
            case 1:
                this.process = processRC2;
                this.keySchedule = keyScheduleRC2;
                this.blockLength = 64;
                this.effectiveLength = algorithm.length || 32;
                this.keySize = 8 * Math.ceil(this.effectiveLength / 8); // Max 128
                this.blockSize = this.blockLength >> 3;
                break;
            case 2015:
                this.version = 2015;
                if (this.blockLength === 64) {
                    this.process = process15;
                    this.keySchedule = keySchedule15;
                } else if (this.blockLength === 128) {
                    this.process = process128;
                    this.keySchedule = keySchedule128;
                } else
                    throw new DataError('Invalid block length');
                this.processMAC = processMAC15;
                break;
            case 1989:
                this.version = 1989;
                this.process = process89;
                this.processMAC = processMAC89;
                this.keySchedule = keySchedule89;
                if (this.blockLength !== 64)
                    throw new DataError('Invalid block length');
                break;
            default:
                throw new NotSupportedError('Algorithm version ' + algorithm.version + ' not supported');
        }

        switch (algorithm.mode || (algorithm.keyWrapping && 'KW') || 'ES') {

            case 'ES':
                switch (algorithm.block || 'ECB') {
                    case 'ECB':
                        this.encrypt = encryptECB;
                        this.decrypt = decryptECB;
                        break;
                    case 'CTR':
                        if (this.version === 1989) {
                            this.encrypt = processCTR89;
                            this.decrypt = processCTR89;
                        } else {
                            this.encrypt = processCTR15;
                            this.decrypt = processCTR15;
                            this.shiftBits = algorithm.shiftBits || this.blockLength;
                        }
                        break
                    case 'CBC':
                        this.encrypt = encryptCBC;
                        this.decrypt = decryptCBC;
                        break
                    case 'CFB':
                        this.encrypt = encryptCFB;
                        this.decrypt = decryptCFB;
                        this.shiftBits = algorithm.shiftBits || this.blockLength;
                        break;
                    case 'OFB':
                        this.encrypt = processOFB;
                        this.decrypt = processOFB;
                        this.shiftBits = algorithm.shiftBits || this.blockLength;
                        break;
                    default:
                        throw new NotSupportedError('Block mode ' + algorithm.block + ' not supported');
                }
                switch (algorithm.keyMeshing) {
                    case 'CP':
                        this.keyMeshing = keyMeshingCP;
                        break;
                    default:
                        this.keyMeshing = noKeyMeshing;
                }
                if (this.encrypt === encryptECB || this.encrypt === encryptCBC) {
                    switch (algorithm.padding) {
                        case 'PKCS5P':
                            this.pad = pkcs5Pad;
                            this.unpad = pkcs5Unpad;
                            break;
                        case 'RANDOM':
                            this.pad = randomPad;
                            this.unpad = noPad;
                            break;
                        case 'BIT':
                            this.pad = bitPad;
                            this.unpad = bitUnpad;
                            break;
                        default:
                            this.pad = zeroPad;
                            this.unpad = noPad;
                    }
                } else {
                    this.pad = noPad;
                    this.unpad = noPad;
                }
                this.generateKey = generateKey;
                break;
            case 'MAC':
                this.sign = signMAC;
                this.verify = verifyMAC;
                this.generateKey = generateKey;
                this.macLength = algorithm.macLength || (this.blockLength >> 1);
                this.pad = noPad;
                this.unpad = noPad;
                this.keyMeshing = noKeyMeshing;
                break;
            case 'KW':
                this.pad = noPad;
                this.unpad = noPad;
                this.keyMeshing = noKeyMeshing;
                switch (algorithm.keyWrapping) {
                    case 'CP':
                        this.wrapKey = wrapKeyCP;
                        this.unwrapKey = unwrapKeyCP;
                        this.generateKey = generateKey;
                        this.shiftBits = algorithm.shiftBits || this.blockLength;
                        break;
                    case 'SC':
                        this.wrapKey = wrapKeySC;
                        this.unwrapKey = unwrapKeySC;
                        this.generateKey = generateWrappingKeySC;
                        break;
                    default:
                        this.wrapKey = wrapKeyGOST;
                        this.unwrapKey = unwrapKeyGOST;
                        this.generateKey = generateKey;
                }
                break;
            case 'MASK':
                this.wrapKey = wrapKeyMask;
                this.unwrapKey = unwrapKeyMask;
                this.generateKey = generateKey;
                break;
            default:
                throw new NotSupportedError('Mode ' + algorithm.mode + ' not supported');
        }

        // Define sBox parameter
        var sBox = algorithm.sBox, sBoxName;
        if (!sBox)
            sBox = this.version === 2015 ? sBoxes['E-Z'] : this.procreator === 'SC' ? sBoxes['E-SC'] : sBoxes['E-A'];
        else if (typeof sBox === 'string') {
            sBoxName = sBox.toUpperCase();
            sBox = sBoxes[sBoxName];
            if (!sBox)
                throw new SyntaxError('Unknown sBox name: ' + algorithm.sBox);
        } else if (!sBox.length || sBox.length !== sBoxes['E-Z'].length)
            throw new SyntaxError('Length of sBox must be ' + sBoxes['E-Z'].length);
        this.sBox = sBox;
        // Initial vector
        if (algorithm.iv) {
            this.iv = new Uint8Array(algorithm.iv);
            if (this.iv.byteLength !== this.blockSize && this.version === 1989)
                throw new SyntaxError('Length of iv must be ' + this.blockLength + ' bits');
            else if (this.iv.byteLength !== this.blockSize >> 1 && this.encrypt === processCTR15)
                throw new SyntaxError('Length of iv must be ' + this.blockLength >> 1 + ' bits');
            else if (this.iv.byteLength % this.blockSize !== 0 && this.encrypt !== processCTR15)
                throw new SyntaxError('Length of iv must be a multiple of ' + this.blockLength + ' bits');
        } else
            this.iv = this.blockLength === 128 ? defaultIV128 : defaultIV;
        // User key material
        if (algorithm.ukm) {
            this.ukm = new Uint8Array(algorithm.ukm);
            if (this.ukm.byteLength * 8 !== this.blockLength)
                throw new SyntaxError('Length of ukm must be ' + this.blockLength + ' bits');
        }
    }

module.exports = GostCipher;




/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostCoding.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostCoding.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file Coding algorithms: Base64, Hex, Int16, Chars, BER and PEM
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOfTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES Of MERCHANTABILITY AND fITNESS fOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * fOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT Of SUBSTITUTE GOODS OR
 * SERVICES; LOSS Of USE, DATA, OR PROfITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY Of LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT Of THE USE
 * Of THIS SOfTWARE, EVEN If ADVISED Of THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");

    /**
     * The Coding interface provides string converting methods: Base64, Hex, 
     * Int16, Chars, BER and PEM
     * @class GostCoding
     * 
     */
    var root = __webpack_require__.g;
    var DataError = root.DataError || root.Error;
    var CryptoOperationData = root.ArrayBuffer;
    var Date = root.Date;

    function buffer(d) {
        if (d instanceof CryptoOperationData)
            return d;
        else if (d && d.buffer && d.buffer instanceof CryptoOperationData)
            return d.byteOffset === 0 && d.byteLength === d.buffer.byteLength ?
                    d.buffer : new Uint8Array(new Uint8Array(d, d.byteOffset, d.byteLength)).buffer;
        else
            throw new DataError('CryptoOperationData required');
    }

    function GostCoding() {
    }

    /**
     * BASE64 conversion
     * 
     * @class GostCoding.Base64
     */
    var Base64 = {
        /**
         * Base64.decode convert BASE64 string s to CryptoOperationData
         * 
         * @memberOf GostCoding.Base64
         * @param {String} s BASE64 encoded string value
         * @returns {CryptoOperationData} Binary decoded data
         */
        decode: function (s) {
            s = s.replace(/[^A-Za-z0-9\+\/]/g, '');
            var n = s.length,
                    k = n * 3 + 1 >> 2, r = new Uint8Array(k);

            for (var m3, m4, u24 = 0, j = 0, i = 0; i < n; i++) {
                m4 = i & 3;
                var c = s.charCodeAt(i);

                c = c > 64 && c < 91 ?
                        c - 65 : c > 96 && c < 123 ?
                        c - 71 : c > 47 && c < 58 ?
                        c + 4 : c === 43 ?
                        62 : c === 47 ?
                        63 : 0;

                u24 |= c << 18 - 6 * m4;
                if (m4 === 3 || n - i === 1) {
                    for (m3 = 0; m3 < 3 && j < k; m3++, j++) {
                        r[j] = u24 >>> (16 >>> m3 & 24) & 255;
                    }
                    u24 = 0;

                }
            }
            return r.buffer;
        },
        /**
         * Base64.encode(data) convert CryptoOperationData data to BASE64 string
         * 
         * @memberOf GostCoding.Base64
         * @param {CryptoOperationData} data Bynary data for encoding
         * @returns {String} BASE64 encoded data
         */
        encode: function (data) {
            var slen = 8, d = new Uint8Array(buffer(data));
            var m3 = 2, s = '';
            for (var n = d.length, u24 = 0, i = 0; i < n; i++) {
                m3 = i % 3;
                if (i > 0 && (i * 4 / 3) % (12 * slen) === 0)
                    s += '\r\n';
                u24 |= d[i] << (16 >>> m3 & 24);
                if (m3 === 2 || n - i === 1) {
                    for (var j = 18; j >= 0; j -= 6) {
                        var c = u24 >>> j & 63;
                        c = c < 26 ? c + 65 : c < 52 ? c + 71 : c < 62 ? c - 4 :
                                c === 62 ? 43 : c === 63 ? 47 : 65;
                        s += String.fromCharCode(c);
                    }
                    u24 = 0;
                }
            }
            return s.substr(0, s.length - 2 + m3) + (m3 === 2 ? '' : m3 === 1 ? '=' : '==');
        }
    };

    /**
     * BASE64 conversion
     * 
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.Base64
     */
    GostCoding.prototype.Base64 = Base64;

    /**
     * Text string conversion <br>
     * Methods support charsets: ascii, win1251, utf8, utf16 (ucs2, unicode), utf32 (ucs4)
     * 
     * @class GostCoding.Chars
     */
    var Chars = (function () {

        var _win1251_ = {
            0x402: 0x80, 0x403: 0x81, 0x201A: 0x82, 0x453: 0x83, 0x201E: 0x84, 0x2026: 0x85, 0x2020: 0x86, 0x2021: 0x87,
            0x20AC: 0x88, 0x2030: 0x89, 0x409: 0x8A, 0x2039: 0x8B, 0x40A: 0x8C, 0x40C: 0x8D, 0x40B: 0x8E, 0x40f: 0x8f,
            0x452: 0x90, 0x2018: 0x91, 0x2019: 0x92, 0x201C: 0x93, 0x201D: 0x94, 0x2022: 0x95, 0x2013: 0x96, 0x2014: 0x97,
            0x2122: 0x99, 0x459: 0x9A, 0x203A: 0x9B, 0x45A: 0x9C, 0x45C: 0x9D, 0x45B: 0x9E, 0x45f: 0x9f,
            0xA0: 0xA0, 0x40E: 0xA1, 0x45E: 0xA2, 0x408: 0xA3, 0xA4: 0xA4, 0x490: 0xA5, 0xA6: 0xA6, 0xA7: 0xA7,
            0x401: 0xA8, 0xA9: 0xA9, 0x404: 0xAA, 0xAB: 0xAB, 0xAC: 0xAC, 0xAD: 0xAD, 0xAE: 0xAE, 0x407: 0xAf,
            0xB0: 0xB0, 0xB1: 0xB1, 0x406: 0xB2, 0x456: 0xB3, 0x491: 0xB4, 0xB5: 0xB5, 0xB6: 0xB6, 0xB7: 0xB7,
            0x451: 0xB8, 0x2116: 0xB9, 0x454: 0xBA, 0xBB: 0xBB, 0x458: 0xBC, 0x405: 0xBD, 0x455: 0xBE, 0x457: 0xBf
        };
        var _win1251back_ = {};
        for (var from in _win1251_) {
            var to = _win1251_[from];
            _win1251back_[to] = from;
        }

        return {
            /**
             * Chars.decode(s, charset) convert string s with defined charset to CryptoOperationData 
             * 
             * @memberOf GostCoding.Chars
             * @param {string} s Javascript string
             * @param {string} charset Charset, default 'win1251'
             * @returns {CryptoOperationData} Decoded binary data
             */
            decode: function (s, charset) {
                charset = (charset || 'win1251').toLowerCase().replace('-', '');
                var r = [];
                for (var i = 0, j = s.length; i < j; i++) {
                    var c = s.charCodeAt(i);
                    if (charset === 'utf8') {
                        if (c < 0x80) {
                            r.push(c);
                        } else if (c < 0x800) {
                            r.push(0xc0 + (c >>> 6));
                            r.push(0x80 + (c & 63));
                        } else if (c < 0x10000) {
                            r.push(0xe0 + (c >>> 12));
                            r.push(0x80 + (c >>> 6 & 63));
                            r.push(0x80 + (c & 63));
                        } else if (c < 0x200000) {
                            r.push(0xf0 + (c >>> 18));
                            r.push(0x80 + (c >>> 12 & 63));
                            r.push(0x80 + (c >>> 6 & 63));
                            r.push(0x80 + (c & 63));
                        } else if (c < 0x4000000) {
                            r.push(0xf8 + (c >>> 24));
                            r.push(0x80 + (c >>> 18 & 63));
                            r.push(0x80 + (c >>> 12 & 63));
                            r.push(0x80 + (c >>> 6 & 63));
                            r.push(0x80 + (c & 63));
                        } else {
                            r.push(0xfc + (c >>> 30));
                            r.push(0x80 + (c >>> 24 & 63));
                            r.push(0x80 + (c >>> 18 & 63));
                            r.push(0x80 + (c >>> 12 & 63));
                            r.push(0x80 + (c >>> 6 & 63));
                            r.push(0x80 + (c & 63));
                        }
                    } else if (charset === 'unicode' || charset === 'ucs2' || charset === 'utf16') {
                        if (c < 0xD800 || (c >= 0xE000 && c <= 0x10000)) {
                            r.push(c >>> 8);
                            r.push(c & 0xff);
                        } else if (c >= 0x10000 && c < 0x110000) {
                            c -= 0x10000;
                            var first = ((0xffc00 & c) >> 10) + 0xD800;
                            var second = (0x3ff & c) + 0xDC00;
                            r.push(first >>> 8);
                            r.push(first & 0xff);
                            r.push(second >>> 8);
                            r.push(second & 0xff);
                        }
                    } else if (charset === 'utf32' || charset === 'ucs4') {
                        r.push(c >>> 24 & 0xff);
                        r.push(c >>> 16 & 0xff);
                        r.push(c >>> 8 & 0xff);
                        r.push(c & 0xff);
                    } else if (charset === 'win1251') {
                        if (c >= 0x80) {
                            if (c >= 0x410 && c < 0x450) // А..Яа..я
                                c -= 0x350;
                            else
                                c = _win1251_[c] || 0;
                        }
                        r.push(c);
                    } else
                        r.push(c & 0xff);
                }
                return new Uint8Array(r).buffer;
            },
            /**
             * Chars.encode(data, charset) convert CryptoOperationData data to string with defined charset
             * 
             * @memberOf GostCoding.Chars
             * @param {CryptoOperationData} data Binary data
             * @param {string} charset Charset, default win1251
             * @returns {string} Encoded javascript string
             */
            encode: function (data, charset) {
                charset = (charset || 'win1251').toLowerCase().replace('-', '');
                var r = [], d = new Uint8Array(buffer(data));
                for (var i = 0, n = d.length; i < n; i++) {
                    var c = d[i];
                    if (charset === 'utf8') {
                        c = c >= 0xfc && c < 0xfe && i + 5 < n ? // six bytes
                                (c - 0xfc) * 1073741824 + (d[++i] - 0x80 << 24) + (d[++i] - 0x80 << 18) + (d[++i] - 0x80 << 12) + (d[++i] - 0x80 << 6) + d[++i] - 0x80
                                : c >> 0xf8 && c < 0xfc && i + 4 < n ? // five bytes 
                                (c - 0xf8 << 24) + (d[++i] - 0x80 << 18) + (d[++i] - 0x80 << 12) + (d[++i] - 0x80 << 6) + d[++i] - 0x80
                                : c >> 0xf0 && c < 0xf8 && i + 3 < n ? // four bytes 
                                (c - 0xf0 << 18) + (d[++i] - 0x80 << 12) + (d[++i] - 0x80 << 6) + d[++i] - 0x80
                                : c >= 0xe0 && c < 0xf0 && i + 2 < n ? // three bytes 
                                (c - 0xe0 << 12) + (d[++i] - 0x80 << 6) + d[++i] - 0x80
                                : c >= 0xc0 && c < 0xe0 && i + 1 < n ? // two bytes 
                                (c - 0xc0 << 6) + d[++i] - 0x80
                                : c; // one byte 
                    } else if (charset === 'unicode' || charset === 'ucs2' || charset === 'utf16') {
                        c = (c << 8) + d[++i];
                        if (c >= 0xD800 && c < 0xE000) {
                            var first = (c - 0xD800) << 10;
                            c = d[++i];
                            c = (c << 8) + d[++i];
                            var second = c - 0xDC00;
                            c = first + second + 0x10000;
                        }
                    } else if (charset === 'utf32' || charset === 'ucs4') {
                        c = (c << 8) + d[++i];
                        c = (c << 8) + d[++i];
                        c = (c << 8) + d[++i];
                    } else if (charset === 'win1251') {
                        if (c >= 0x80) {
                            if (c >= 0xC0 && c < 0x100)
                                c += 0x350; // А..Яа..я
                            else
                                c = _win1251back_[c] || 0;
                        }
                    }
                    r.push(String.fromCharCode(c));
                }
                return r.join('');
            }
        };
    })();

    /**
     * Text string conversion
     * 
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.Chars
     */
    GostCoding.prototype.Chars = Chars;

    /**
     * HEX conversion
     * 
     * @class GostCoding.Hex
     */
    var Hex = {
        /**
         * Hex.decode(s, endean) convert HEX string s to CryptoOperationData in endean mode
         * 
         * @memberOf GostCoding.Hex
         * @param {string} s Hex encoded string
         * @param {boolean} endean Little or Big Endean, default Little
         * @returns {CryptoOperationData} Decoded binary data
         */
        decode: function (s, endean) {
            s = s.replace(/[^A-fa-f0-9]/g, '');
            var n = Math.ceil(s.length / 2), r = new Uint8Array(n);
            s = (s.length % 2 > 0 ? '0' : '') + s;
            if (endean && ((typeof endean !== 'string') ||
                    (endean.toLowerCase().indexOf('little') < 0)))
                for (var i = 0; i < n; i++)
                    r[i] = parseInt(s.substr((n - i - 1) * 2, 2), 16);
            else
                for (var i = 0; i < n; i++)
                    r[i] = parseInt(s.substr(i * 2, 2), 16);
            return r.buffer;
        },
        /**
         * Hex.encode(data, endean) convert CryptoOperationData data to HEX string in endean mode
         * 
         * @memberOf GostCoding.Hex 
         * @param {CryptoOperationData} data Binary data
         * @param {boolean} endean Little/Big Endean, default Little
         * @returns {string} Hex decoded string
         */
        encode: function (data, endean) {
            var s = [], d = new Uint8Array(buffer(data)), n = d.length;
            if (endean && ((typeof endean !== 'string') ||
                    (endean.toLowerCase().indexOf('little') < 0)))
                for (var i = 0; i < n; i++) {
                    var j = n - i - 1;
                    s[j] = (j > 0 && j % 32 === 0 ? '\r\n' : '') +
                            ('00' + d[i].toString(16)).slice(-2);
                }
            else
                for (var i = 0; i < n; i++)
                    s[i] = (i > 0 && i % 32 === 0 ? '\r\n' : '') +
                            ('00' + d[i].toString(16)).slice(-2);
            return s.join('');
        }
    };

    /**
     *  HEX conversion
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.Hex
     */
    GostCoding.prototype.Hex = Hex;

    /**
     * String hex-encoded integer conversion
     * 
     * @class GostCoding.Int16
     */
    var Int16 = {
        /**
         * Int16.decode(s) convert hex big insteger s to CryptoOperationData
         * 
         * @memberOf GostCoding.Int16 
         * @param {string} s Int16 string 
         * @returns {CryptoOperationData} Decoded binary data
         */
        decode: function (s) {
            s = (s || '').replace(/[^\-A-fa-f0-9]/g, '');
            if (s.length === 0)
                s = '0';
            // Signature
            var neg = false;
            if (s.charAt(0) === '-') {
                neg = true;
                s = s.substring(1);
            }
            // Align 2 chars
            while (s.charAt(0) === '0' && s.length > 1)
                s = s.substring(1);
            s = (s.length % 2 > 0 ? '0' : '') + s;
            // Padding for singanuture
            // '800000' - 'ffffff' - for positive
            // '800001' - 'ffffff' - for negative
            if ((!neg && !/^[0-7]/.test(s)) ||
                    (neg && !/^[0-7]|8[0]+$/.test(s)))
                s = '00' + s;
            // Convert hex
            var n = s.length / 2, r = new Uint8Array(n), t = 0;
            for (var i = n - 1; i >= 0; --i) {
                var c = parseInt(s.substr(i * 2, 2), 16);
                if (neg && (c + t > 0)) {
                    c = 256 - c - t;
                    t = 1;
                }
                r[i] = c;
            }
            return r.buffer;
        },
        /**
         * Int16.encode(data) convert CryptoOperationData data to big integer hex string
         * 
         * @memberOf GostCoding.Int16
         * @param {CryptoOperationData} data Binary data
         * @returns {string} Int16 encoded string
         */
        encode: function (data) {
            var d = new Uint8Array(buffer(data)), n = d.length;
            if (d.length === 0)
                return '0x00';
            var s = [], neg = d[0] > 0x7f, t = 0;
            for (var i = n - 1; i >= 0; --i) {
                var v = d[i];
                if (neg && (v + t > 0)) {
                    v = 256 - v - t;
                    t = 1;
                }
                s[i] = ('00' + v.toString(16)).slice(-2);
            }
            s = s.join('');
            while (s.charAt(0) === '0')
                s = s.substring(1);
            return (neg ? '-' : '') + '0x' + s;
        }
    };

    /**
     * String hex-encoded integer conversion
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.Int16
     */
    GostCoding.prototype.Int16 = Int16;

    /**
     * BER, DER, CER conversion
     * 
     * @class GostCoding.BER
     */
    var BER = (function () {

        // Predefenition block
        function encodeBER(source, format, onlyContent) {
            // Correct primitive type
            var object = source.object;
            if (object === undefined)
                object = source;

            // Determinate tagClass
            var tagClass = source.tagClass = source.tagClass || 0; // Universial default

            // Determinate tagNumber. Use only for Universal class
            if (tagClass === 0) {
                var tagNumber = source.tagNumber;
                if (typeof tagNumber === 'undefined') {
                    if (typeof object === 'string') {
                        if (object === '')   // NULL
                            tagNumber = 0x05;
                        else if (/^\-?0x[0-9a-fA-F]+$/.test(object)) // INTEGER
                            tagNumber = 0x02;
                        else if (/^(\d+\.)+\d+$/.test(object)) // OID
                            tagNumber = 0x06;
                        else if (/^[01]+$/.test(object)) // BIT STRING
                            tagNumber = 0x03;
                        else if (/^(true|false)$/.test(object)) // BOOLEAN
                            tagNumber = 0x01;
                        else if (/^[0-9a-fA-F]+$/.test(object)) // OCTET STRING
                            tagNumber = 0x04;
                        else
                            tagNumber = 0x13; // Printable string (later can be changed to UTF8String)
                    } else if (typeof object === 'number') { // INTEGER
                        tagNumber = 0x02;
                    } else if (typeof object === 'boolean') { // BOOLEAN
                        tagNumber = 0x01;
                    } else if (object instanceof Array) { // SEQUENCE
                        tagNumber = 0x10;
                    } else if (object instanceof Date) { // GeneralizedTime
                        tagNumber = 0x18;
                    } else if (object instanceof CryptoOperationData || (object && object.buffer instanceof CryptoOperationData)) {
                        tagNumber = 0x04;
                    } else
                        throw new DataError('Unrecognized type for ' + object);
                }
            }

            // Determinate constructed
            var tagConstructed = source.tagConstructed;
            if (typeof tagConstructed === 'undefined')
                tagConstructed = source.tagConstructed = object instanceof Array;

            // Create content
            var content;
            if (object instanceof CryptoOperationData || (object && object.buffer instanceof CryptoOperationData)) { // Direct
                content = new Uint8Array(buffer(object));
                if (tagNumber === 0x03) { // BITSTRING
                    // Set unused bits
                    var a = new Uint8Array(buffer(content));
                    content = new Uint8Array(a.length + 1);
                    content[0] = 0; // No unused bits
                    content.set(a, 1);
                }
            } else if (tagConstructed) { // Sub items coding
                if (object instanceof Array) {
                    var bytelen = 0, ba = [], offset = 0;
                    for (var i = 0, n = object.length; i < n; i++) {
                        ba[i] = encodeBER(object[i], format);
                        bytelen += ba[i].length;
                    }
                    if (tagNumber === 0x11)
                        ba.sort(function (a, b) { // Sort order for SET components
                            for (var i = 0, n = Math.min(a.length, b.length); i < n; i++) {
                                var r = a[i] - b[i];
                                if (r !== 0)
                                    return r;
                            }
                            return a.length - b.length;
                        });
                    if (format === 'CER') { // final for CER 00 00
                        ba[n] = new Uint8Array(2);
                        bytelen += 2;
                    }
                    content = new Uint8Array(bytelen);
                    for (var i = 0, n = ba.length; i < n; i++) {
                        content.set(ba[i], offset);
                        offset = offset + ba[i].length;
                    }
                } else
                    throw new DataError('Constracted block can\'t be primitive');
            } else {
                switch (tagNumber) {
                    // 0x00: // EOC
                    case 0x01: // BOOLEAN
                        content = new Uint8Array(1);
                        content[0] = object ? 0xff : 0;
                        break;
                    case 0x02: // INTEGER
                    case 0x0a: // ENUMIRATED
                        content = Int16.decode(
                                typeof object === 'number' ? object.toString(16) : object);
                        break;
                    case 0x03: // BIT STRING
                        if (typeof object === 'string') {
                            var unusedBits = 7 - (object.length + 7) % 8;
                            var n = Math.ceil(object.length / 8);
                            content = new Uint8Array(n + 1);
                            content[0] = unusedBits;
                            for (var i = 0; i < n; i++) {
                                var c = 0;
                                for (var j = 0; j < 8; j++) {
                                    var k = i * 8 + j;
                                    c = (c << 1) + (k < object.length ? (object.charAt(k) === '1' ? 1 : 0) : 0);
                                }
                                content[i + 1] = c;
                            }
                        }
                        break;
                    case 0x04:
                        content = Hex.decode(
                                typeof object === 'number' ? object.toString(16) : object);
                        break;
                        // case 0x05: // NULL
                    case 0x06: // OBJECT IDENTIFIER
                        var a = object.match(/\d+/g), r = [];
                        for (var i = 1; i < a.length; i++) {
                            var n = +a[i], r1 = [];
                            if (i === 1)
                                n = n + a[0] * 40;
                            do {
                                r1.push(n & 0x7F);
                                n = n >>> 7;
                            } while (n);
                            // reverse order
                            for (j = r1.length - 1; j >= 0; --j)
                                r.push(r1[j] + (j === 0 ? 0x00 : 0x80));
                        }
                        content = new Uint8Array(r);
                        break;
                        // case 0x07: // ObjectDescriptor
                        // case 0x08: // EXTERNAL
                        // case 0x09: // REAL
                        // case 0x0A: // ENUMERATED
                        // case 0x0B: // EMBEDDED PDV
                    case 0x0C: // UTF8String
                        content = Chars.decode(object, 'utf8');
                        break;
                        // case 0x10: // SEQUENCE
                        // case 0x11: // SET
                    case 0x12: // NumericString
                    case 0x16: // IA5String // ASCII
                    case 0x13: // PrintableString // ASCII subset
                    case 0x14: // TeletexString // aka T61String
                    case 0x15: // VideotexString
                    case 0x19: // GraphicString
                    case 0x1A: // VisibleString // ASCII subset
                    case 0x1B: // GeneralString
                        // Reflect on character encoding
                        for (var i = 0, n = object.length; i < n; i++)
                            if (object.charCodeAt(i) > 255)
                                tagNumber = 0x0C;
                        if (tagNumber === 0x0C)
                            content = Chars.decode(object, 'utf8');
                        else
                            content = Chars.decode(object, 'ascii');
                        break;
                    case 0x17: // UTCTime
                    case 0x18: // GeneralizedTime
                        var result = object.original;
                        if (!result) {
                            var date = new Date(object);
                            date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); // to UTC
                            var ms = tagNumber === 0x18 ? date.getMilliseconds().toString() : ''; // Milliseconds, remove trailing zeros
                            while (ms.length > 0 && ms.charAt(ms.length - 1) === '0')
                                ms = ms.substring(0, ms.length - 1);
                            if (ms.length > 0)
                                ms = '.' + ms;
                            result = (tagNumber === 0x17 ? date.getYear().toString().slice(-2) : date.getFullYear().toString()) +
                                    ('00' + (date.getMonth() + 1)).slice(-2) +
                                    ('00' + date.getDate()).slice(-2) +
                                    ('00' + date.getHours()).slice(-2) +
                                    ('00' + date.getMinutes()).slice(-2) +
                                    ('00' + date.getSeconds()).slice(-2) + ms + 'Z';
                        }
                        content = Chars.decode(result, 'ascii');
                        break;
                    case 0x1C: // UniversalString
                        content = Chars.decode(object, 'utf32');
                        break;
                    case 0x1E: // BMPString
                        content = Chars.decode(object, 'utf16');
                        break;
                }
            }

            if (!content)
                content = new Uint8Array(0);
            if (content instanceof CryptoOperationData)
                content = new Uint8Array(content);

            if (!tagConstructed && format === 'CER') {
                // Encoding CER-form for string types
                var k;
                switch (tagNumber) {
                    case 0x03: // BIT_STRING
                        k = 1; // ingnore unused bit for bit string
                    case 0x04: // OCTET_STRING
                    case 0x0C: // UTF8String
                    case 0x12: // NumericString
                    case 0x13: // PrintableString
                    case 0x14: // TeletexString
                    case 0x15: // VideotexString
                    case 0x16: // IA5String
                    case 0x19: // GraphicString
                    case 0x1A: // VisibleString
                    case 0x1B: // GeneralString
                    case 0x1C: // UniversalString
                    case 0x1E: // BMPString
                        k = k || 0;
                        // Split content on 1000 octet len parts 
                        var size = 1000;
                        var bytelen = 0, ba = [], offset = 0;
                        for (var i = k, n = content.length; i < n; i += size - k) {
                            ba[i] = encodeBER({
                                object: new Unit8Array(content.buffer, i, Math.min(size - k, n - i)),
                                tagNumber: tagNumber,
                                tagClass: 0,
                                tagConstructed: false
                            }, format);
                            bytelen += ba[i].length;
                        }
                        ba[n] = new Uint8Array(2); // final for CER 00 00
                        bytelen += 2;
                        content = new Uint8Array(bytelen);
                        for (var i = 0, n = ba.length; i < n; i++) {
                            content.set(ba[i], offset);
                            offset = offset + ba[i].length;
                        }
                }
            }

            // Restore tagNumber for all classes
            if (tagClass === 0)
                source.tagNumber = tagNumber;
            else
                source.tagNumber = tagNumber = source.tagNumber || 0;
            source.content = content;

            if (onlyContent)
                return content;

            // Create header
            // tagNumber
            var ha = [], first = tagClass === 3 ? 0xC0 : tagClass === 2 ? 0x80 :
                    tagClass === 1 ? 0x40 : 0x00;
            if (tagConstructed)
                first |= 0x20;
            if (tagNumber < 0x1F) {
                first |= tagNumber & 0x1F;
                ha.push(first);
            } else {
                first |= 0x1F;
                ha.push(first);
                var n = tagNumber, ha1 = [];
                do {
                    ha1.push(n & 0x7F);
                    n = n >>> 7;
                } while (n)
                // reverse order
                for (var j = ha1.length - 1; j >= 0; --j)
                    ha.push(ha1[j] + (j === 0 ? 0x00 : 0x80));
            }
            // Length
            if (tagConstructed && format === 'CER') {
                ha.push(0x80);
            } else {
                var len = content.length;
                if (len > 0x7F) {
                    var l2 = len, ha2 = [];
                    do {
                        ha2.push(l2 & 0xff);
                        l2 = l2 >>> 8;
                    } while (l2);
                    ha.push(ha2.length + 0x80); // reverse order
                    for (var j = ha2.length - 1; j >= 0; --j)
                        ha.push(ha2[j]);
                } else {
                    // simple len
                    ha.push(len);
                }
            }
            var header = source.header = new Uint8Array(ha);

            // Result - complete buffer
            var block = new Uint8Array(header.length + content.length);
            block.set(header, 0);
            block.set(content, header.length);
            return block;
        }

        function decodeBER(source, offset) {

            // start pos
            var pos = offset || 0, start = pos;
            var tagNumber, tagClass, tagConstructed,
                    content, header, buffer, sub, len;

            if (source.object) {
                // Ready from source
                tagNumber = source.tagNumber;
                tagClass = source.tagClass;
                tagConstructed = source.tagConstructed;
                content = source.content;
                header = source.header;
                buffer = source.object instanceof CryptoOperationData ?
                        new Uint8Array(source.object) : null;
                sub = source.object instanceof Array ? source.object : null;
                len = buffer && buffer.length || null;
            } else {
                // Decode header
                var d = source;

                // Read tag
                var buf = d[pos++];
                tagNumber = buf & 0x1f;
                tagClass = buf >> 6;
                tagConstructed = (buf & 0x20) !== 0;
                if (tagNumber === 0x1f) { // long tag
                    tagNumber = 0;
                    do {
                        if (tagNumber > 0x1fffffffffff80)
                            throw new DataError('Convertor not supported tag number more then (2^53 - 1) at position ' + offset);
                        buf = d[pos++];
                        tagNumber = (tagNumber << 7) + (buf & 0x7f);
                    } while (buf & 0x80);
                }

                // Read len        
                buf = d[pos++];
                len = buf & 0x7f;
                if (len !== buf) {
                    if (len > 6) // no reason to use Int10, as it would be a huge buffer anyways
                        throw new DataError('Length over 48 bits not supported at position ' + offset);
                    if (len === 0)
                        len = null; // undefined
                    else {
                        buf = 0;
                        for (var i = 0; i < len; ++i)
                            buf = (buf << 8) + d[pos++];
                        len = buf;
                    }
                }

                start = pos;
                sub = null;

                if (tagConstructed) {
                    // must have valid content
                    sub = [];
                    if (len !== null) {
                        // definite length
                        var end = start + len;
                        while (pos < end) {
                            var s = decodeBER(d, pos);
                            sub.push(s);
                            pos += s.header.length + s.content.length;
                        }
                        if (pos !== end)
                            throw new DataError('Content size is not correct for container starting at offset ' + start);
                    } else {
                        // undefined length
                        try {
                            for (; ; ) {
                                var s = decodeBER(d, pos);
                                pos += s.header.length + s.content.length;
                                if (s.tagClass === 0x00 && s.tagNumber === 0x00)
                                    break;
                                sub.push(s);
                            }
                            len = pos - start;
                        } catch (e) {
                            throw new DataError('Exception ' + e + ' while decoding undefined length content at offset ' + start);
                        }
                    }
                }

                // Header and content
                header = new Uint8Array(d.buffer, offset, start - offset);
                content = new Uint8Array(d.buffer, start, len);
                buffer = content;
            }

            // Constructed types - check for string concationation
            if (sub !== null && tagClass === 0) {
                var k;
                switch (tagNumber) {
                    case 0x03: // BIT_STRING
                        k = 1; // ingnore unused bit for bit string
                    case 0x04: // OCTET_STRING
                    case 0x0C: // UTF8String
                    case 0x12: // NumericString
                    case 0x13: // PrintableString
                    case 0x14: // TeletexString
                    case 0x15: // VideotexString
                    case 0x16: // IA5String
                    case 0x19: // GraphicString
                    case 0x1A: // VisibleString
                    case 0x1B: // GeneralString
                    case 0x1C: // UniversalString
                    case 0x1E: // BMPString
                        k = k || 0;
                        // Concatination
                        if (sub.length === 0)
                            throw new DataError('No constructed encoding content of string type at offset ' + start);
                        len = k;
                        for (var i = 0, n = sub.length; i < n; i++) {
                            var s = sub[i];
                            if (s.tagClass !== tagClass || s.tagNumber !== tagNumber || s.tagConstructed)
                                throw new DataError('Invalid constructed encoding of string type at offset ' + start);
                            len += s.content.length - k;
                        }
                        buffer = new Uint8Array(len);
                        for (var i = 0, n = sub.length, j = k; i < n; i++) {
                            var s = sub[i];
                            if (k > 0)
                                buffer.set(s.content.subarray(1), j);
                            else
                                buffer.set(s.content, j);
                            j += s.content.length - k;
                        }
                        tagConstructed = false; // follow not required
                        sub = null;
                        break;
                }
            }
            // Primitive types
            var object = '';
            if (sub === null) {
                if (len === null)
                    throw new DataError('Invalid tag with undefined length at offset ' + start);

                if (tagClass === 0) {
                    switch (tagNumber) {
                        case 0x01: // BOOLEAN
                            object = buffer[0] !== 0;
                            break;
                        case 0x02: // INTEGER
                        case 0x0a: // ENUMIRATED
                            if (len > 6) {
                                object = Int16.encode(buffer);
                            } else {
                                var v = buffer[0];
                                if (buffer[0] > 0x7f)
                                    v = v - 256;
                                for (var i = 1; i < len; i++)
                                    v = v * 256 + buffer[i];
                                object = v;
                            }
                            break;
                        case 0x03: // BIT_STRING
                            if (len > 5) { // Content buffer
                                object = new Uint8Array(buffer.subarray(1)).buffer;
                            } else { // Max bit mask only for 32 bit
                                var unusedBit = buffer[0],
                                        skip = unusedBit, s = [];
                                for (var i = len - 1; i >= 1; --i) {
                                    var b = buffer[i];
                                    for (var j = skip; j < 8; ++j)
                                        s.push((b >> j) & 1 ? '1' : '0');
                                    skip = 0;
                                }
                                object = s.reverse().join('');
                            }
                            break;
                        case 0x04: // OCTET_STRING
                            object = new Uint8Array(buffer).buffer;
                            break;
                            //  case 0x05: // NULL
                        case 0x06: // OBJECT_IDENTIFIER
                            var s = '',
                                    n = 0,
                                    bits = 0;
                            for (var i = 0; i < len; ++i) {
                                var v = buffer[i];
                                n = (n << 7) + (v & 0x7F);
                                bits += 7;
                                if (!(v & 0x80)) { // finished
                                    if (s === '') {
                                        var m = n < 80 ? n < 40 ? 0 : 1 : 2;
                                        s = m + "." + (n - m * 40);
                                    } else
                                        s += "." + n.toString();
                                    n = 0;
                                    bits = 0;
                                }
                            }
                            if (bits > 0)
                                throw new DataError('Incompleted OID at offset ' + start);
                            object = s;
                            break;
                            //case 0x07: // ObjectDescriptor
                            //case 0x08: // EXTERNAL
                            //case 0x09: // REAL
                            //case 0x0A: // ENUMERATED
                            //case 0x0B: // EMBEDDED_PDV
                        case 0x10: // SEQUENCE
                        case 0x11: // SET
                            object = [];
                            break;
                        case 0x0C: // UTF8String
                            object = Chars.encode(buffer, 'utf8');
                            break;
                        case 0x12: // NumericString
                        case 0x13: // PrintableString
                        case 0x14: // TeletexString
                        case 0x15: // VideotexString
                        case 0x16: // IA5String
                        case 0x19: // GraphicString
                        case 0x1A: // VisibleString
                        case 0x1B: // GeneralString
                            object = Chars.encode(buffer, 'ascii');
                            break;
                        case 0x1C: // UniversalString
                            object = Chars.encode(buffer, 'utf32');
                            break;
                        case 0x1E: // BMPString
                            object = Chars.encode(buffer, 'utf16');
                            break;
                        case 0x17: // UTCTime
                        case 0x18: // GeneralizedTime
                            var shortYear = tagNumber === 0x17;
                            var s = Chars.encode(buffer, 'ascii'),
                                    m = (shortYear ?
                                            /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/ :
                                            /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/).exec(s);
                            if (!m)
                                throw new DataError('Unrecognized time format "' + s + '" at offset ' + start);
                            if (shortYear) {
                                // Where YY is greater than or equal to 50, the year SHALL be interpreted as 19YY; and
                                // Where YY is less than 50, the year SHALL be interpreted as 20YY                                
                                m[1] = +m[1];
                                m[1] += (m[1] < 50) ? 2000 : 1900;
                            }
                            var dt = new Date(m[1], +m[2] - 1, +m[3], +(m[4] || '0'), +(m[5] || '0'), +(m[6] || '0'), +(m[7] || '0')),
                                    tz = dt.getTimezoneOffset();
                            if (m[8] || tagNumber === 0x17) {
                                if (m[8].toUpperCase() !== 'Z' && m[9]) {
                                    tz = tz + parseInt(m[9]);
                                }
                                dt.setMinutes(dt.getMinutes() - tz);
                            }
                            dt.original = s;
                            object = dt;
                            break;
                    }
                } else // OCTET_STRING
                    object = new Uint8Array(buffer).buffer;
            } else
                object = sub;

            // result
            return {
                tagConstructed: tagConstructed,
                tagClass: tagClass,
                tagNumber: tagNumber,
                header: header,
                content: content,
                object: object
            };
        }

        return {
            /**
             * BER.decode(object, format) convert javascript object to ASN.1 format CryptoOperationData<br><br>
             * If object has members tagNumber, tagClass and tagConstructed
             * it is clear define encoding rules. Else method use defaul rules:
             * <ul>
             *   <li>Empty string or null - NULL</li>
             *   <li>String starts with '0x' and has 0-9 and a-f characters - INTEGER</li>
             *   <li>String like d.d.d.d (d - set of digits) - OBJECT IDENTIFIER</li>
             *   <li>String with characters 0 and 1 - BIT STRING</li>
             *   <li>Strings 'true' or 'false' - BOOLEAN</li>
             *   <li>String has only 0-9 and a-f characters - OCTET STRING</li>
             *   <li>String has only characters with code 0-255 - PrintableString</li>
             *   <li>Other strings - UTF8String</li>
             *   <li>Number - INTEGER</li>
             *   <li>Date - GeneralizedTime</li>
             *   <li>Boolean - SEQUENCE</li>
             *   <li>CryptoOperationData - OCTET STRING</li>
             * </ul>
             * SEQUENCE or SET arrays recursively encoded for each item.<br>
             * OCTET STRING and BIT STRING can presents as array with one item. 
             * It means encapsulates encoding for child element.<br>
             * 
             * If CONTEXT or APPLICATION classes item presents as array with one 
             * item we use EXPLICIT encoding for element, else IMPLICIT encoding.<br>
             * 
             * @memberOf GostCoding.BER
             * @param {Object} object Object to encoding
             * @param {string} format Encoding rule: 'DER' or 'CER', default 'DER'
             * @param {boolean} onlyContent Encode content only, without header
             * @returns {CryptoOperationData} BER encoded data
             */
            encode: function (object, format, onlyContent) {
                return encodeBER(object, format, onlyContent).buffer;
            },
            /**
             * BER.encode(data) convert ASN.1 format CryptoOperationData data to javascript object<br><br>
             * 
             * Conversion rules to javascript object:
             *  <ul>
             *      <li>BOOLEAN - Boolean object</li>
             *      <li>INTEGER, ENUMIRATED - Integer object if len <= 6 (48 bits) else Int16 encoded string</li>
             *      <li>BIT STRING - Integer object if len <= 5 (w/o unsedBit octet - 32 bits) else String like '10111100' or  Array with one item in case of incapsulates encoding</li>
             *      <li>OCTET STRING - Hex encoded string or Array with one item in case of incapsulates encoding</li>
             *      <li>OBJECT IDENTIFIER - String with object identifier</li>
             *      <li>SEQUENCE, SET - Array of encoded items</li>
             *      <li>UTF8String, NumericString, PrintableString, TeletexString, VideotexString, 
             *          IA5String, GraphicString, VisibleString, GeneralString, UniversalString,
             *          BMPString - encoded String</li>
             *      <li>UTCTime, GeneralizedTime - Date</li>
             *  </ul>
             * @memberOf GostCoding.BER
             * @param {(CryptoOperationData|GostCoding.BER)} data Binary data to decode
             * @returns {Object} Javascript object with result of decoding
             */
            decode: function (data) {
                return decodeBER(data.object ? data : new Uint8Array(buffer(data)), 0);
            }
        };
    })();

    /**
     * BER, DER, CER conversion
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.BER
     */
    GostCoding.prototype.BER = BER;

    /**
     * PEM conversion
     * @class GostCoding.PEM
     */
    var PEM = {
        /**
         * PEM.encode(data, name) encode CryptoOperationData to PEM format with name label
         * 
         * @memberOf GostCoding.PEM
         * @param {(Object|CryptoOperationData)} data Java script object or BER-encoded binary data
         * @param {string} name Name of PEM object: 'certificate', 'private key' etc.
         * @returns {string} Encoded object
         */
        encode: function (data, name) {
            return (name ? '-----BEGIN ' + name.toUpperCase() + '-----\r\n' : '') +
                    Base64.encode(data instanceof CryptoOperationData ? data : BER.encode(data)) +
                    (name ? '\r\n-----END ' + name.toUpperCase() + '-----' : '');
        },
        /**
         * PEM.decode(s, name, deep) decode PEM format s labeled name to CryptoOperationData or javascript object in according to deep parameter
         * 
         * @memberOf GostCoding.PEM
         * @param {string} s PEM encoded string
         * @param {string} name Name of PEM object: 'certificate', 'private key' etc.
         * @param {boolean} deep If true method do BER-decoding, else only BASE64 decoding
         * @param {integer} index Index of decoded value
         * @returns {(Object|CryptoOperationData)} Decoded javascript object if deep=true, else CryptoOperationData for father BER decoding
         */
        decode: function (s, name, deep, index) {
            // Try clear base64
            var re1 = /([A-Za-z0-9\+\/\s\=]+)/g,
                    valid = re1.exec(s);
            if (valid[1].length !== s.length)
                valid = false;
            if (!valid && name) {
                // Try with the name
                var re2 = new RegExp(
                        '-----\\s?BEGIN ' + name.toUpperCase() +
                        '-----([A-Za-z0-9\\+\\/\\s\\=]+)-----\\s?END ' +
                        name.toUpperCase() + '-----', 'g');
                valid = re2.exec(s);
            }
            if (!valid) {
                // Try with some name
                var re3 = new RegExp(
                        '-----\\s?BEGIN [A-Z0-9\\s]+' +
                        '-----([A-Za-z0-9\\+\\/\\s\\=]+)-----\\s?END ' +
                        '[A-Z0-9\\s]+-----', 'g');
                valid = re3.exec(s);
            }
            var r = valid && valid[1 + (index || 0)];
            if (!r)
                throw new DataError('Not valid PEM format');
            var out = Base64.decode(r);
            if (deep)
                out = BER.decode(out);
            return out;
        }
    };

    /**
     * PEM conversion
     * @memberOf GostCoding
     * @insnance
     * @type GostCoding.PEM
     */
    GostCoding.prototype.PEM = PEM;

    if (gostCrypto)
        /**
         * Coding algorithms: Base64, Hex, Int16, Chars, BER and PEM
         * 
         * @memberOf gostCrypto
         * @type GostCoding
         */
        gostCrypto.coding = new GostCoding();

module.exports = GostCoding;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostCrypto.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostCrypto.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file Implementation Web Crypto interfaces for GOST algorithms
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/* 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const GostRandom = __webpack_require__(/*! ./gostRandom */ "./node_modules/node-gost-crypto/lib/gostRandom.js");
const gostEngine = __webpack_require__(/*! ./gostEngine */ "./node_modules/node-gost-crypto/lib/gostEngine.js");

    /*
     * Algorithm normalization
     * 
     */

    var root = __webpack_require__.g;
    var rootCrypto = root.crypto || root.msCrypto;

    var SyntaxError = root.SyntaxError || root.Error,
            DataError = root.DataError || root.Error,
            NotSupportedError = root.NotSupportedError || root.Error,
            OperationError = root.OperationError || root.Error,
            InvalidStateError = root.InvalidAccessError || root.Error,
            InvalidAccessError = root.InvalidAccessError || root.Error;

    // Normalize algorithm
    function normalize(algorithm, method) {
        if (typeof algorithm === 'string' || algorithm instanceof String)
            algorithm = {name: algorithm};
        var name = algorithm.name;
        if (!name)
            throw new SyntaxError('Algorithm name not defined');
        // Extract algorithm modes from name
        var modes = name.split('/'), modes = modes[0].split('-').concat(modes.slice(1));
        // Normalize the name with default modes
        var na = {};
        name = modes[0].replace(/[\.\s]/g, '');
        modes = modes.slice(1);
        if (name.indexOf('28147') >= 0) {
            na = {
                name: 'GOST 28147',
                version: 1989,
                mode: (algorithm.mode || (// ES, MAC, KW
                        (method === 'sign' || method === 'verify') ? 'MAC' :
                        (method === 'wrapKey' || method === 'unwrapKey') ? 'KW' : 'ES')).toUpperCase(),
                length: algorithm.length || 64
            };
        } else if (name.indexOf('3412') >= 0) {
            na = {
                name: 'GOST R 34.12',
                version: 2015,
                mode: (algorithm.mode || (// ES, MAC, KW
                        (method === 'sign' || method === 'verify') ? 'MAC' :
                        (method === 'wrapKey' || method === 'unwrapKey') ? 'KW' : 'ES')).toUpperCase(),
                length: algorithm.length || 64 // 128
            };
        } else if (name.indexOf('3411') >= 0) {
            na = {
                name: 'GOST R 34.11',
                version: 2012, // 1994
                mode: (algorithm.mode || (// HASH, KDF, HMAC, PBKDF2, PFXKDF, CPKDF
                        (method === 'deriveKey' || method === 'deriveBits') ? 'KDF' :
                        (method === 'sign' || method === 'verify') ? 'HMAC' : 'HASH')).toUpperCase(),
                length: algorithm.length || 256 // 512
            };
        } else if (name.indexOf('3410') >= 0) {
            na = {
                name: 'GOST R 34.10',
                version: 2012, // 1994, 2001
                mode: (algorithm.mode || (// SIGN, DH, MASK
                        (method === 'deriveKey' || method === 'deriveBits') ? 'DH' : 'SIGN')).toUpperCase(),
                length: algorithm.length || 256 // 512
            };
        } else if (name.indexOf('SHA') >= 0) {
            na = {
                name: 'SHA',
                version: (algorithm.length || 160) === 160 ? 1 : 2, // 1, 2
                mode: (algorithm.mode || (// HASH, KDF, HMAC, PBKDF2, PFXKDF
                        (method === 'deriveKey' || method === 'deriveBits') ? 'KDF' :
                        (method === 'sign' || method === 'verify') ? 'HMAC' : 'HASH')).toUpperCase(),
                length: algorithm.length || 160
            };
        } else if (name.indexOf('RC2') >= 0) {
            na = {
                name: 'RC2',
                version: 1,
                mode: (algorithm.mode || (// ES, MAC, KW
                        (method === 'sign' || method === 'verify') ? 'MAC' :
                        (method === 'wrapKey' || method === 'unwrapKey') ? 'KW' : 'ES')).toUpperCase(),
                length: algorithm.length || 32 // 1 - 1024
            };
        } else if (name.indexOf('PBKDF2') >= 0) {
            na = normalize(algorithm.hash, 'digest');
            na.mode = 'PBKDF2';
        } else if (name.indexOf('PFXKDF') >= 0) {
            na = normalize(algorithm.hash, 'digest');
            na.mode = 'PFXKDF';
        } else if (name.indexOf('CPKDF') >= 0) {
            na = normalize(algorithm.hash, 'digest');
            na.mode = 'CPKDF';
        } else if (name.indexOf('HMAC') >= 0) {
            na = normalize(algorithm.hash, 'digest');
            na.mode = 'HMAC';
        } else
            throw new NotSupportedError('Algorithm not supported');

        // Compile modes
        modes.forEach(function (mode) {
            mode = mode.toUpperCase();
            if (/^[0-9]+$/.test(mode)) {
                if ((['8', '16', '32'].indexOf(mode) >= 0) || (na.length === '128' && mode === '64')) { // Shift bits
                    if (na.mode === 'ES')
                        na.shiftBits = parseInt(mode);
                    else if (na.mode === 'MAC')
                        na.macLength = parseInt(mode);
                    else
                        throw new NotSupportedError('Algorithm ' + na.name + ' mode ' + mode + ' not supported');
                } else if (['89', '94', '01', '12', '15', '1989', '1994', '2001', '2012', '2015'].indexOf(mode) >= 0) { // GOST Year
                    var version = parseInt(mode);
                    version = version < 1900 ? (version < 80 ? 2000 + version : 1900 + version) : version;
                    na.version = version;
                } else if (['1'].indexOf(mode) >= 0 && na.name === 'SHA') { // SHA-1
                    na.version = 1;
                    na.length = 160;
                } else if (['256', '384', '512'].indexOf(mode) >= 0 && na.name === 'SHA') { // SHA-2
                    na.version = 2;
                    na.length = parseInt(mode);
                } else if (['40', '128'].indexOf(mode) >= 0 && na.name === 'RC2') { // RC2
                    na.version = 1;
                    na.length = parseInt(mode); // key size
                } else if (['64', '128', '256', '512'].indexOf(mode) >= 0) // block size
                    na.length = parseInt(mode);
                else if (['1000', '2000'].indexOf(mode) >= 0) // Iterations
                    na.iterations = parseInt(mode);
                // Named Paramsets
            } else if (['E-TEST', 'E-A', 'E-B', 'E-C', 'E-D', 'E-SC', 'E-Z', 'D-TEST', 'D-A', 'D-SC'].indexOf(mode) >= 0) {
                na.sBox = mode;
            } else if (['S-TEST', 'S-A', 'S-B', 'S-C', 'S-D', 'X-A', 'X-B', 'X-C'].indexOf(mode) >= 0) {
                na.namedParam = mode;
            } else if (['S-256-TEST', 'S-256-A', 'S-256-B', 'S-256-C', 'P-256', 'T-512-TEST', 'T-512-A',
                'T-512-B', 'X-256-A', 'X-256-B', 'T-256-TEST', 'T-256-A', 'T-256-B', 'S-256-B', 'T-256-C', 'S-256-C'].indexOf(mode) >= 0) {
                na.namedCurve = mode;
            } else if (['SC', 'CP', 'VN'].indexOf(mode) >= 0) {
                na.procreator = mode;

                // Encription GOST 28147 or GOST R 34.12
            } else if (na.name === 'GOST 28147' || na.name === 'GOST R 34.12' || na.name === 'RC2') {
                if (['ES', 'MAC', 'KW', 'MASK'].indexOf(mode) >= 0) {
                    na.mode = mode;
                } else if (['ECB', 'CFB', 'OFB', 'CTR', 'CBC'].indexOf(mode) >= 0) {
                    na.mode = 'ES';
                    na.block = mode;
                } else if (['CPKW', 'NOKW', 'SCKW'].indexOf(mode) >= 0) {
                    na.mode = 'KW';
                    na.keyWrapping = mode.replace('KW', '');
                } else if (['ZEROPADDING', 'PKCS5PADDING', 'NOPADDING', 'RANDOMPADDING', 'BITPADDING'].indexOf(mode) >= 0) {
                    na.padding = mode.replace('PADDING', '');
                } else if (['NOKM', 'CPKM'].indexOf(mode) >= 0) {
                    na.keyMeshing = mode.replace('KM', '');
                } else
                    throw new NotSupportedError('Algorithm ' + na.name + ' mode ' + mode + ' not supported');

                // Digesting GOST 34.11
            } else if (na.name === 'GOST R 34.11' || na.name === 'SHA') {
                if (['HASH', 'KDF', 'HMAC', 'PBKDF2', 'PFXKDF', 'CPKDF'].indexOf(mode) >= 0)
                    na.mode = mode;
                else
                    throw new NotSupportedError('Algorithm ' + na.name + ' mode ' + mode + ' not supported');

                // Signing GOST 34.10
            } else if (na.name === 'GOST R 34.10') {
                var hash = mode.replace(/[\.\s]/g, '');
                if (hash.indexOf('GOST') >= 0 && hash.indexOf('3411') >= 0)
                    na.hash = mode;
                else if (['SIGN', 'DH', 'MASK'].indexOf(mode))
                    na.mode = mode;
                else
                    throw new NotSupportedError('Algorithm ' + na.name + ' mode ' + mode + ' not supported');
            }
        });

        // Procreator
        na.procreator = algorithm.procreator || na.procreator || 'CP';

        // Key size
        switch (na.name) {
            case 'GOST R 34.10':
                na.keySize = na.length / (na.version === 1994 ? 4 : 8);
                break;
            case 'GOST R 34.11':
                na.keySize = 32;
                break;
            case 'GOST 28147':
            case 'GOST R 34.12':
                na.keySize = 32;
                break;
            case 'RC2':
                na.keySize = Math.ceil(na.length / 8);
                break;
            case 'SHA':
                na.keySize = na.length / 8;
                break;
        }

        // Encrypt additional modes 
        if (na.mode === 'ES') {
            if (algorithm.block)
                na.block = algorithm.block; // ECB, CFB, OFB, CTR, CBC
            if (na.block)
                na.block = na.block.toUpperCase();
            if (algorithm.padding)
                na.padding = algorithm.padding; // NO, ZERO, PKCS5, RANDOM, BIT
            if (na.padding)
                na.padding = na.padding.toUpperCase();
            if (algorithm.shiftBits)
                na.shiftBits = algorithm.shiftBits; // 8, 16, 32, 64
            if (algorithm.keyMeshing)
                na.keyMeshing = algorithm.keyMeshing; // NO, CP
            if (na.keyMeshing)
                na.keyMeshing = na.keyMeshing.toUpperCase();
            // Default values
            if (method !== 'importKey' && method !== 'generateKey') {
                na.block = na.block || 'ECB';
                na.padding = na.padding || (na.block === 'CBC' || na.block === 'ECB' ? 'ZERO' : 'NO');
                if (na.block === 'CFB' || na.block === 'OFB')
                    na.shiftBits = na.shiftBits || na.length;
                na.keyMeshing = na.keyMeshing || 'NO';
            }
        }
        if (na.mode === 'KW') {
            if (algorithm.keyWrapping)
                na.keyWrapping = algorithm.keyWrapping; // NO, CP, SC
            if (na.keyWrapping)
                na.keyWrapping = na.keyWrapping.toUpperCase();
            if (method !== 'importKey' && method !== 'generateKey')
                na.keyWrapping = na.keyWrapping || 'NO';
        }

        // Paramsets
        ['sBox', 'namedParam', 'namedCurve', 'curve', 'param', 'modulusLength'].forEach(function (name) {
            algorithm[name] && (na[name] = algorithm[name]);
        });
        // Default values
        if (method !== 'importKey' && method !== 'generateKey') {
            if (na.name === 'GOST 28147') {
                na.sBox = na.sBox || (na.procreator === 'SC' ? 'E-SC' : 'E-A'); // 'E-A', 'E-B', 'E-C', 'E-D', 'E-SC'
            } else if (na.name === 'GOST R 34.12' && na.length === 64) {
                na.sBox = 'E-Z';
            } else if (na.name === 'GOST R 34.11' && na.version === 1994) {
                na.sBox = na.sBox || (na.procreator === 'SC' ? 'D-SC' : 'D-A'); // 'D-SC'
            } else if (na.name === 'GOST R 34.10' && na.version === 1994) {
                na.namedParam = na.namedParam || (na.mode === 'DH' ? 'X-A' : 'S-A'); // 'S-B', 'S-C', 'S-D', 'X-B', 'X-C'
            } else if (na.name === 'GOST R 34.10' && na.version === 2001) {
                na.namedCurve = na.namedCurve || (na.length === 256 ?
                        na.procreator === 'SC' ? 'P-256' : (na.mode === 'DH' ? 'X-256-A' : 'S-256-A') : // 'S-256-B', 'S-256-C', 'X-256-B', 'T-256-A', 'T-256-B', 'T-256-C', 'P-256'
                        na.mode === 'T-512-A'); // 'T-512-B', 'T-512-C'
            } else if (na.name === 'GOST R 34.10' && na.version === 2012) {
                na.namedCurve = na.namedCurve || (na.length === 256 ?
                        na.procreator === 'SC' ? 'P-256' : (na.mode === 'DH' ? 'X-256-A' : 'S-256-A') : // 'S-256-B', 'S-256-C', 'X-256-B', 'T-256-A', 'T-256-B', 'T-256-C', 'P-256'
                        na.mode === 'T-512-A'); // 'T-512-B', 'T-512-C'
            }
        }

        // Vectors
        switch (na.mode) {
            case 'DH':
                algorithm.ukm && (na.ukm = algorithm.ukm);
                algorithm['public'] && (na['public'] = algorithm['public']);
                break;
            case 'SIGN':
            case 'KW':
                algorithm.ukm && (na.ukm = algorithm.ukm);
                break;
            case 'ES':
            case 'MAC':
                algorithm.iv && (na.iv = algorithm.iv);
                break;
            case 'KDF':
                algorithm.label && (na.label = algorithm.label);
                algorithm.contex && (na.context = algorithm.contex);
                break;
            case 'PBKDF2':
                algorithm.salt && (na.salt = algorithm.salt);
                algorithm.iterations && (na.iterations = algorithm.iterations);
                algorithm.diversifier && (na.diversifier = algorithm.diversifier);
                break;
            case 'PFXKDF':
                algorithm.salt && (na.salt = algorithm.salt);
                algorithm.iterations && (na.iterations = algorithm.iterations);
                algorithm.diversifier && (na.diversifier = algorithm.diversifier);
                break;
            case 'CPKDF':
                algorithm.salt && (na.salt = algorithm.salt);
                algorithm.iterations && (na.iterations = algorithm.iterations);
                break;
        }

        // Verification method and modes
        if (method && (
                ((na.mode !== 'ES' && na.mode !== 'SIGN' && na.mode !== 'MAC' &&
                        na.mode !== 'HMAC' && na.mode !== 'KW' && na.mode !== 'DH'
                        && na.mode !== 'MASK') &&
                        (method === 'generateKey')) ||
                ((na.mode !== 'ES') &&
                        (method === 'encrypt' || method === 'decrypt')) ||
                ((na.mode !== 'SIGN' && na.mode !== 'MAC' && na.mode !== 'HMAC') &&
                        (method === 'sign' || method === 'verify')) ||
                ((na.mode !== 'HASH') &&
                        (method === 'digest')) ||
                ((na.mode !== 'KW' && na.mode !== 'MASK') &&
                        (method === 'wrapKey' || method === 'unwrapKey')) ||
                ((na.mode !== 'DH' && na.mode !== 'PBKDF2' && na.mode !== 'PFXKDF' &&
                        na.mode !== 'CPKDF' && na.mode !== 'KDF') &&
                        (method === 'deriveKey' || method === 'deriveBits'))))
            throw new NotSupportedError('Algorithm mode ' + na.mode + ' not valid for method ' + method);

        // Normalize hash algorithm
        algorithm.hash && (na.hash = algorithm.hash);
        if (na.hash) {
            if ((typeof na.hash === 'string' || na.hash instanceof String)
                    && na.procreator)
                na.hash = na.hash + '/' + na.procreator;
            na.hash = normalize(na.hash, 'digest');
        }

        // Algorithm object identirifer
        algorithm.id && (na.id = algorithm.id);

        return na;
    }

    // Check for possibility use native crypto.subtle
    function checkNative(algorithm) {
        if (!rootCrypto || !rootCrypto.subtle || !algorithm)
            return false;
        // Prepare name
        var name = (typeof algorithm === 'string' || algorithm instanceof String) ?
                name = algorithm : algorithm.name;
        if (!name)
            return false;
        name = name.toUpperCase();
        // Digest algorithm for key derivation
        if ((name.indexOf('KDF') >= 0 || name.indexOf('HMAC') >= 0) && algorithm.hash)
            return checkNative(algorithm.hash);
        // True if no supported names
        return name.indexOf('GOST') === -1 &&
                name.indexOf('SHA-1') === -1 &&
                name.indexOf('RC2') === -1 &&
                name.indexOf('?DES') === -1;
    }


    /*
     * Key conversion methods
     * 
     */

    // Check key parameter
    function checkKey(key, method) {
        if (!key.algorithm)
            throw new SyntaxError('Key algorithm not defined');

        if (!key.algorithm.name)
            throw new SyntaxError('Key algorithm name not defined');

        var name = key.algorithm.name,
                gostCipher = name === 'GOST 28147' || name === 'GOST R 34.12' || name === 'RC2',
                gostDigest = name === 'GOST R 34.11' || name === 'SHA',
                gostSign = name === 'GOST R 34.10';

        if (!gostCipher && !gostSign && !gostDigest)
            throw new NotSupportedError('Key algorithm ' + name + ' is unsupproted');

        if (!key.type)
            throw new SyntaxError('Key type not defined');

        if (((gostCipher || gostDigest) && key.type !== 'secret') ||
                (gostSign && !(key.type === 'public' || key.type === 'private')))
            throw new DataError('Key type ' + key.type + ' is not valid for algorithm ' + name);

        if (!key.usages || !key.usages.indexOf)
            throw new SyntaxError('Key usages not defined');

        for (var i = 0, n = key.usages.length; i < n; i++) {
            var md = key.usages[i];
            if (((md === 'encrypt' || md === 'decrypt') && key.type !== 'secret') ||
                    (md === 'sign' && key.type === 'public') ||
                    (md === 'verify' && key.type === 'private'))
                throw new InvalidStateError('Key type ' + key.type + ' is not valid for ' + md);
        }

        if (method)
            if (key.usages.indexOf(method) === -1)
                throw new InvalidAccessError('Key usages is not contain method ' + method);

        if (!key.buffer)
            throw new SyntaxError('Key buffer is not defined');

        var size = key.buffer.byteLength * 8, keySize = 8 * key.algorithm.keySize;
        if ((key.type === 'secret' && size !== (keySize || 256) &&
                (key.usages.indexOf('encrypt') >= 0 || key.usages.indexOf('decrypt') >= 0)) ||
                (key.type === 'private' && !(size === 256 || size === 512)) ||
                (key.type === 'public' && !(size === 512 || size === 1024)))
            throw new SyntaxError('Key buffer has wrong size ' + size + ' bit');
    }

    // Extract key and enrich cipher algorithm
    function extractKey(method, algorithm, key) {
        checkKey(key, method);
        if (algorithm) {
            var params;
            switch (algorithm.mode) {
                case 'ES':
                    params = ['sBox', 'keyMeshing', 'padding', 'block'];
                    break;
                case 'SIGN':
                    params = ['namedCurve', 'namedParam', 'sBox', 'curve', 'param', 'modulusLength'];
                    break;
                case 'MAC':
                    params = ['sBox'];
                    break;
                case 'KW':
                    params = ['keyWrapping', 'ukm'];
                    break;
                case 'DH':
                    params = ['namedCurve', 'namedParam', 'sBox', 'ukm', 'curve', 'param', 'modulusLength'];
                    break;
                case 'KDF':
                    params = ['context', 'label'];
                    break;
                case 'PBKDF2':
                    params = ['sBox', 'iterations', 'salt'];
                    break;
                case 'PFXKDF':
                    params = ['sBox', 'iterations', 'salt', 'diversifier'];
                    break;
                case 'CPKDF':
                    params = ['sBox', 'salt'];
                    break;
            }
            if (params)
                params.forEach(function (name) {
                    key.algorithm[name] && (algorithm[name] = key.algorithm[name]);
                });
        }
        return key.buffer;
    }

    // Make key definition
    function convertKey(algorithm, extractable, keyUsages, keyData, keyType) {
        var key = {
            type: keyType || (algorithm.name === 'GOST R 34.10' ? 'private' : 'secret'),
            extractable: extractable || 'false',
            algorithm: algorithm,
            usages: keyUsages || [],
            buffer: keyData
        };
        checkKey(key);
        return key;
    }

    function convertKeyPair(publicAlgorithm, privateAlgorithm, extractable, keyUsages, publicBuffer, privateBuffer) {

        if (!keyUsages || !keyUsages.indexOf)
            throw new SyntaxError('Key usages not defined');

        var publicUsages = keyUsages.filter(function (value) {
            return value !== 'sign';
        });
        var privateUsages = keyUsages.filter(function (value) {
            return value !== 'verify';
        });

        return {
            publicKey: convertKey(publicAlgorithm, extractable, publicUsages, publicBuffer, 'public'),
            privateKey: convertKey(privateAlgorithm, extractable, privateUsages, privateBuffer, 'private')
        };
    }

    // Swap bytes in buffer
    function swapBytes(src) {
        if (src instanceof CryptoOperationData)
            src = new Uint8Array(src);
        var dst = new Uint8Array(src.length);
        for (var i = 0, n = src.length; i < n; i++)
            dst[n - i - 1] = src[i];
        return dst.buffer;
    }


    /**
     * Promise stub object (not fulfill specification, only for internal use)
     * Class not defined if Promise class already defined in root context<br><br>
     * 
     * The Promise object is used for deferred and asynchronous computations. A Promise is in one of the three states:
     *  <ul>
     *      <li>pending: initial state, not fulfilled or rejected.</li>
     *      <li>fulfilled: successful operation</li>
     *      <li>rejected: failed operation.</li>
     *  </ul>
     * Another term describing the state is settled: the Promise is either fulfilled or rejected, but not pending.<br><br>
     * @class Promise
     * @global
     * @param {function} executor Function object with two arguments resolve and reject. 
     * The first argument fulfills the promise, the second argument rejects it. 
     * We can call these functions, once our operation is completed.
     */
    if (!root.Promise) {

        root.Promise = (function () {

            function mswrap(value) {
                if (value && value.oncomplete === null && value.onerror === null) {
                    return new Promise(function (resolve, reject) {
                        value.oncomplete = function () {
                            resolve(value.result);
                        };
                        value.onerror = function () {
                            reject(new OperationError(value.toString()));
                        };
                    });
                } else
                    return value;
            }

            function Promise(executor) {

                var state = 'pending', result,
                        resolveQueue = [], rejectQueue = [];

                function call(callback) {
                    try {
                        callback();
                    } catch (e) {
                    }
                }

                try {
                    executor(function (value) {
                        if (state === 'pending') {
                            state = 'fulfilled';
                            result = value;
                            resolveQueue.forEach(call);
                        }
                    }, function (reason) {
                        if (state === 'pending') {
                            state = 'rejected';
                            result = reason;
                            rejectQueue.forEach(call);
                        }
                    });
                } catch (error) {
                    if (state === 'pending') {
                        state = 'rejected';
                        result = error;
                        rejectQueue.forEach(call);
                    }
                }
                /**
                 * The then() method returns a Promise. It takes two arguments, both are 
                 * callback functions for the success and failure cases of the Promise.
                 * 
                 * @method then
                 * @memberOf Promise
                 * @instance
                 * @param {function} onFulfilled A Function called when the Promise is fulfilled. This function has one argument, the fulfillment value.
                 * @param {function} onRejected A Function called when the Promise is rejected. This function has one argument, the rejection reason.
                 * @returns {Promise} 
                 */
                this.then = function (onFulfilled, onRejected) {

                    return new Promise(function (resolve, reject) {

                        function asyncOnFulfilled() {
                            var value;
                            try {
                                value = onFulfilled ? onFulfilled(result) : result;
                            } catch (error) {
                                reject(error);
                                return;
                            }
                            value = mswrap(value);
                            if (value && value.then && value.then.call) {
                                value.then(resolve, reject);
                            } else {
                                resolve(value);
                            }
                        }

                        function asyncOnRejected() {
                            var reason;
                            try {
                                reason = onRejected ? onRejected(result) : result;
                            } catch (error) {
                                reject(error);
                                return;
                            }
                            reason = mswrap(reason);
                            if (reason && reason.then && reason.then.call) {
                                reason.then(resolve, reject);
                            } else {
                                reject(reason);
                            }
                        }

                        if (state === 'fulfilled') {
                            asyncOnFulfilled();
                        } else if (state === 'rejected') {
                            asyncOnRejected();
                        } else {
                            resolveQueue.push(asyncOnFulfilled);
                            rejectQueue.push(asyncOnRejected);
                        }

                    });

                };
                /**
                 * The catch() method returns a Promise and deals with rejected cases only. 
                 * It behaves the same as calling Promise.prototype.then(undefined, onRejected).
                 * 
                 * @method catch
                 * @memberOf Promise
                 * @instance
                 * @param {function} onRejected A Function called when the Promise is rejected. This function has one argument, the rejection reason.
                 * @returns {Promise} 
                 */
                this['catch'] = function (onRejected) {
                    return this.then(undefined, onRejected);
                };
            }

            /**
             * The Promise.all(iterable) method returns a promise that resolves when all 
             * of the promises in the iterable argument have resolved.<br><br>
             * 
             * The result is passed as an array of values from all the promises. 
             * If something passed in the iterable array is not a promise, it's converted to 
             * one by Promise.resolve. If any of the passed in promises rejects, the 
             * all Promise immediately rejects with the value of the promise that rejected, 
             * discarding all the other promises whether or not they have resolved.
             * 
             * @method all
             * @memberOf Promise
             * @static
             * @param {KeyUsages} promises Array with promises.
             * @returns {Promise}
             */
            Promise.all = function (promises) {
                return new Promise(function (resolve, reject) {
                    var result = [], count = 0;
                    function asyncResolve(k) {
                        count++;
                        return function (data) {
                            result[k] = data;
                            count--;
                            if (count === 0)
                                resolve(result);
                        };
                    }

                    function asyncReject(reason) {
                        if (count > 0)
                            reject(reason);
                        count = 0;
                    }

                    for (var i = 0, n = promises.length; i < n; i++) {
                        var data = promises[i];
                        if (data.then && data.then.call)
                            data.then(asyncResolve(i), asyncReject);
                        else
                            result[i] = data;
                    }

                    if (count === 0)
                        resolve(result);
                });
            };

            return Promise;
        })();
    }

    // Executor for any method
    function execute(algorithm, method, args) {
        return new Promise(function (resolve, reject) {
            try {
                if (gostEngine)
                    resolve(gostEngine.execute(algorithm, method, args));
                else
                    reject(new OperationError('Module gostEngine not found'));
            } catch (error) {
                reject(error);
            }
        });
    }

    // Self resolver
    function call(callback) {
        try {
            callback();
        } catch (e) {
        }
    }



    /*
     * WebCrypto common class references
     * 
     */
    /**
     * The Algorithm object is a dictionary object [WebIDL] which is used to 
     * specify an algorithm and any additional parameters required to fully 
     * specify the desired operation.<br>
     * <pre>
     *  dictionary Algorithm {
     *      DOMString name;
     *  };
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#algorithm-dictionary}
     * @class Algorithm
     * @param {DOMString} name The name of the registered algorithm to use.
     */

    /**
     * AlgorithmIdentifier - Algorithm or DOMString name of algorithm<br>
     * <pre>
     *  typedef (Algorithm or DOMString) AlgorithmIdentifier;
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#algorithm-dictionary}
     * @class AlgorithmIdentifier
     */

    /**
     * The KeyAlgorithm interface represents information about the contents of a 
     * given Key object.
     * <pre>
     *  interface KeyAlgorithm {
     *      readonly attribute DOMString name
     *  };
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#key-algorithm-interface}
     * @class KeyAlgorithm 
     * @param {DOMString} name The name of the algorithm used to generate the Key
     */

    /**
     * The type of a key. The recognized key type values are "public", "private" 
     * and "secret". Opaque keying material, including that used for symmetric 
     * algorithms, is represented by "secret", while keys used as part of asymmetric 
     * algorithms composed of public/private keypairs will be either "public" or "private".
     * <pre>
     *  typedef DOMString KeyType;
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#key-interface}
     * @class KeyType
     */

    /**
     * Sequence of operation type that may be performed using a key. The recognized 
     * key usage values are "encrypt", "decrypt", "sign", "verify", "deriveKey", 
     * "deriveBits", "wrapKey" and "unwrapKey".
     * <pre>
     *  typedef DOMString[] KeyUsages;
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#key-interface}
     * @class KeyUsages
     */

    /**
     * The Key object represents an opaque reference to keying material that is 
     * managed by the user agent.<br>
     * This specification provides a uniform interface for many different kinds of 
     * keying material managed by the user agent. This may include keys that have 
     * been generated by the user agent, derived from other keys by the user agent, 
     * imported to the user agent through user actions or using this API, 
     * pre-provisioned within software or hardware to which the user agent has 
     * access or made available to the user agent in other ways. The term key refers 
     * broadly to any keying material including actual keys for cryptographic 
     * operations and secret values obtained within key derivation or exchange operations.<br>
     * The Key object is not required to directly interface with the underlying key 
     * storage mechanism, and may instead simply be a reference for the user agent 
     * to understand how to obtain the keying material when needed, eg. when performing 
     * a cryptographic operation.
     * <pre>
     *  interface Key {
     *      readonly attribute KeyType type;
     *      readonly attribute boolean extractable;
     *      readonly attribute KeyAlgorithm algorithm;
     *      readonly attribute KeyUsages usages;
     *  };     
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#key-interface}
     * @class Key
     * @param {KeyType} type The type of a key. The recognized key type values are "public", "private" and "secret".
     * @param {boolean} extractable Whether or not the raw keying material may be exported by the application.
     * @param {KeyAlgorithm} algorithm The Algorithm used to generate the key.
     * @param {KeyUsages} usages Key usage array: type of operation that may be performed using a key. 
     */

    /**
     * The KeyPair interface represents an asymmetric key pair that is comprised of both public and private keys.
     * <pre>
     *  interface KeyPair {
     *      readonly attribute Key publicKey;
     *      readonly attribute Key privateKey;
     *  };     
     * </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#keypair}
     * @class KeyPair
     * @param {Key} privateKey Private key
     * @param {Key} publicKey Public key
     */

    /**
     * Specifies a serialization format for a key. The recognized key format values are:
     *  <ul>
     *      <li>'raw' - An unformatted sequence of bytes. Intended for secret keys.</li>
     *      <li>'pkcs8' - The DER encoding of the PrivateKeyInfo structure from RFC 5208.</li>
     *      <li>'spki' - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.</li>
     *      <li>'jwk' - The key is represented as JSON according to the JSON Web Key format.</li>
     *  </ul>
     *  <pre>
     *  typedef DOMString KeyFormat;
     *  </pre>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#key-interface}
     *  @class KeyFormat
     */

    /**
     * Binary data 
     *  <pre>
     *  typedef (ArrayBuffer or ArrayBufferView) CryptoOperationData;
     *  </pre>
     * @class CryptoOperationData
     */
    var CryptoOperationData = root.ArrayBuffer;

    /**
     * DER-encoded ArrayBuffer or PEM-encoded DOMString constains ASN.1 object<br>
     * <pre>
     *  typedef (ArrayBuffer or DOMString) FormatedData;
     * </pre>
     * @class FormatedData
     */


    /**
     * The gostCrypto provide general purpose cryptographic functionality for
     * GOST standards including a cryptographically strong pseudo-random number 
     * generator seeded with truly random values.
     * 
     * @namespace gostCrypto
     */
    var gostCrypto = {};

    /**
     * The SubtleCrypto class provides low-level cryptographic primitives and algorithms.
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#subtlecrypto-interface}
     * 
     * @class SubtleCrypto
     */
    function SubtleCrypto() {
    }

    /**
     * The encrypt method returns a new Promise object that will encrypt data 
     * using the specified algorithm identifier with the supplied Key.
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-encrypt}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST 28147-ECB</b> "prostaya zamena" (ECB) mode (default)</li>
     *      <li><b>GOST 28147-CFB</b> "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode</li>
     *      <li><b>GOST 28147-OFB</b> "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode</li>
     *      <li><b>GOST 28147-CTR</b> "gammirovanie" (counter) mode</li>
     *      <li><b>GOST 28147-CBC</b> Cipher-Block-Chaining (CBC) mode</li>
     *      <li><b>GOST R 34.12-ECB</b> "prostaya zamena" (ECB) mode (default)</li>
     *      <li><b>GOST R 34.12-CFB</b> "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode</li>
     *      <li><b>GOST R 34.12-OFB</b> "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode</li>
     *      <li><b>GOST R 34.12-CTR</b> "gammirovanie" (counter) mode</li>
     *      <li><b>GOST R 34.12-CBC</b> Cipher-Block-Chaining (CBC) mode</li>
     *  </ul>
     *  For more information see {@link GostCipher} 
     * 
     * @memberOf SubtleCrypto
     * @method encrypt
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} key Key object
     * @param {CryptoOperationData} data Operation data
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.encrypt = function (algorithm, key, data)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.encrypt(algorithm, key, data);

            algorithm = normalize(algorithm, 'encrypt');
            return execute(algorithm, 'encrypt',
                    [extractKey('encrypt', algorithm, key), data]);
        });
    };

    /**
     * The decrypt method returns a new Promise object that will decrypt data 
     * using the specified algorithm identifier with the supplied Key. 
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST 28147-ECB</b> "prostaya zamena" (ECB) mode (default)</li>
     *      <li><b>GOST 28147-CFB</b> "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode</li>
     *      <li><b>GOST 28147-OFB</b> "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode</li>
     *      <li><b>GOST 28147-CTR</b> "gammirovanie" (counter) mode</li>
     *      <li><b>GOST 28147-CBC</b> Cipher-Block-Chaining (CBC) mode</li>
     *      <li><b>GOST R 34.12-ECB</b> "prostaya zamena" (ECB) mode (default)</li>
     *      <li><b>GOST R 34.12-CFB</b> "gammirovanie s obratnoj svyaziyu po shifrotekstu" (CFB) mode</li>
     *      <li><b>GOST R 34.12-OFB</b> "gammirovanie s obratnoj svyaziyu po vyhodu" (OFB) mode</li>
     *      <li><b>GOST R 34.12-CTR</b> "gammirovanie" (counter) mode</li>
     *      <li><b>GOST R 34.12-CBC</b> Cipher-Block-Chaining (CBC) mode</li>
     *  </ul>
     *  For additional modes see {@link GostCipher} 
     * 
     * @memberOf SubtleCrypto
     * @method decrypt
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} key Key object
     * @param {CryptoOperationData} data Operation data
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.decrypt = function (algorithm, key, data)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.decrypt(algorithm, key, data);

            algorithm = normalize(algorithm, 'decrypt');
            return execute(algorithm, 'decrypt',
                    [extractKey('decrypt', algorithm, key), data]);
        });
    };

    /**
     * The sign method returns a new Promise object that will sign data using 
     * the specified algorithm identifier with the supplied Key.
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-94</b> GOST Signature</li>
     *      <li><b>GOST R 34.10-94/GOST R 34.11-94</b> GOST Signature with Hash</li>
     *      <li><b>GOST R 34.10</b> ECGOST Signature</li>
     *      <li><b>GOST R 34.10/GOST R 34.11-94</b> ECGOST Signature with Old-Style Hash</li>
     *      <li><b>GOST R 34.10/GOST R 34.11</b> ECGOST Signature with Streebog Hash</li>
     *      <li><b>GOST 28147-MAC</b> MAC base on GOST 28147</li>
     *      <li><b>GOST R 34.12-MAC</b> MAC base on GOST R 43.12</li>
     *      <li><b>GOST R 34.11-HMAC</b> HMAC base on GOST 34.11</li>
     *      <li><b>SHA-HMAC</b> HMAC base on SHA</li>
     *  </ul>
     *  For additional modes see {@link GostSign}, {@link GostDigest} and {@link GostCipher}
     * 
     * @memberOf SubtleCrypto
     * @method sign
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} key Key object 
     * @param {CryptoOperationData} data Operation data
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.sign = function (algorithm, key, data)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.sign(algorithm, key, data);

            algorithm = normalize(algorithm, 'sign');
            var value = execute(algorithm, 'sign',
                    [extractKey('sign', algorithm, key), data]).then(function (data) {
                if (algorithm.procreator === 'SC' && algorithm.mode === 'SIGN') {
                    data = gostCrypto.asn1.GostSignature.encode(data);
                }
                return data;
            });
            return value;
        });
    };

    /**
     * The verify method returns a new Promise object that will verify data 
     * using the specified algorithm identifier with the supplied Key.
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-verify}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-94</b> GOST Signature</li>
     *      <li><b>GOST R 34.10-94/GOST R 34.11-94</b> GOST Signature with Hash</li>
     *      <li><b>GOST R 34.10</b> ECGOST Signature</li>
     *      <li><b>GOST R 34.10/GOST R 34.11-94</b> ECGOST Signature with Old-Style Hash</li>
     *      <li><b>GOST R 34.10/GOST R 34.11</b> ECGOST Signature with Streebog Hash</li>
     *      <li><b>GOST 28147-MAC</b> MAC base on GOST 28147</li>
     *      <li><b>GOST R 34.12-MAC</b> MAC base on GOST R 34.12</li>
     *      <li><b>GOST R 34.11-HMAC</b> HMAC base on GOST 34.11</li>
     *      <li><b>SHA-HMAC</b> HMAC base on SHA</li>
     *  </ul>
     *  For additional modes see {@link GostSign}, {@link GostDigest} and {@link GostCipher}
     * 
     * @memberOf SubtleCrypto
     * @method verify
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} key Key object
     * @param {CryptoOperationData} signature Signature data
     * @param {CryptoOperationData} data Operation data
     * @returns {Promise} Promise that resolves with boolean value of verification result
     */
    SubtleCrypto.prototype.verify = function (algorithm, key, signature, data)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.verify(algorithm, key, signature, data);

            algorithm = normalize(algorithm, 'verify');
            if (algorithm.procreator === 'SC' && algorithm.mode === 'SIGN') {
                var obj = gostCrypto.asn1.GostSignature.decode(signature);
                signature = {r: obj.r, s: obj.s};
            }
            return execute(algorithm, 'verify',
                    [extractKey('verify', algorithm, key), signature, data]);
        });
    };

    /**
     * The digest method returns a new Promise object that will digest data 
     * using the specified algorithm identifier. 
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-digest}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.11-94</b> Old-Style GOST Hash</li>
     *      <li><b>GOST R 34.11</b> GOST Streebog Hash</li>
     *      <li><b>SHA</b> SHA Hash</li>
     *  </ul>
     *  For additional modes see {@link GostDigest}
     * 
     * @memberOf SubtleCrypto
     * @method digest
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {CryptoOperationData} data Operation data
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.digest = function (algorithm, data)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.digest(algorithm, data);

            algorithm = normalize(algorithm, 'digest');
            return execute(algorithm, 'digest', [data]);
        });
    };

    /**
     * The generateKey method returns a new Promise object that will key(s) using
     * the specified algorithm identifier. Key can be used in according with
     * KeyUsages sequence. The recognized key usage values are "encrypt", "decrypt", 
     * "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey".
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-generateKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10</b> ECGOST Key Pairs</li>
     *      <li><b>GOST 28147</b> Key for encryption GOST 28147 modes</li>
     *      <li><b>GOST 28147-KW</b> Key for wrapping GOST 28147 modes</li>
     *      <li><b>GOST R 34.12</b> Key for encryption GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.12-KW</b> Key for wrapping GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.11-KDF</b> Key for Derivation Algorithm</li>
     *  </ul>
     *  For additional modes see {@link GostSign}, {@link GostDigest} and {@link GostCipher}<br>
     *  Note: Generation key for GOST R 34.10-94 not supported.
     * 
     * @memberOf SubtleCrypto
     * @method generateKey
     * @instance
     * @param {AlgorithmIdentifier} algorithm Key algorithm identifier
     * @param {boolean} extractable Whether or not the raw keying material may be exported by the application
     * @param {KeyUsages} keyUsages Key usage array: type of operation that may be performed using a key
     * @returns {Promise} Promise that resolves with {@link Key} or {@link KeyPair} in according to key algorithm
     */
    SubtleCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.generateKey(algorithm, extractable, keyUsages);

            var privateAlgorithm = algorithm.privateKey,
                    publicAlgorithm = algorithm.publicKey;
            algorithm = normalize(algorithm, 'generateKey');
            if (privateAlgorithm)
                privateAlgorithm = normalize(privateAlgorithm, 'generateKey');
            else
                privateAlgorithm = algorithm;
            if (publicAlgorithm)
                publicAlgorithm = normalize(publicAlgorithm, 'generateKey');
            else
                publicAlgorithm = algorithm;
            return execute(algorithm, 'generateKey', []).then(function (data) {
                if (data.publicKey && data.privateKey)
                    return convertKeyPair(publicAlgorithm, privateAlgorithm, extractable, keyUsages, data.publicKey, data.privateKey);
                else
                    return convertKey(algorithm, extractable, keyUsages, data);
            });
        });
    };

    /**
     * The deriveKey method returns a new Promise object that will key(s) using
     * the specified algorithm identifier. Key can be used in according with
     * KeyUsage sequence. The recognized key usage values are "encrypt", "decrypt", 
     * "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey".
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-DH</b> ECDH Key Agreement mode</li>
     *      <li><b>GOST R 34.11-KDF</b> Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PBKDF2</b> Password Based Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PFXKDF</b> PFX Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-CPKDF</b> Password Based Key for CryptoPro Derivation Algorithm</li>
     *      <li><b>SHA-PBKDF2</b> Password Based Key for Derivation Algorithm</li>
     *      <li><b>SHA-PFXKDF</b> PFX Key for Derivation Algorithm</li>
     *  </ul>
     *  For additional modes see {@link GostSign} and {@link GostDigest}
     * 
     * @memberOf SubtleCrypto
     * @method deriveKey
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} baseKey Derivation key object
     * @param {AlgorithmIdentifier} derivedKeyType Derived key algorithm identifier
     * @param {boolean} extractable Whether or not the raw keying material may be exported by the application
     * @param {KeyUsages} keyUsages Key usage array: type of operation that may be performed using a key 
     * @returns {Promise} Promise that resolves with {@link Key}
     */
    SubtleCrypto.prototype.deriveKey = function (algorithm, baseKey,
            derivedKeyType, extractable, keyUsages)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.deriveKey(algorithm, baseKey,
                        derivedKeyType, extractable, keyUsages);

            algorithm = normalize(algorithm, 'deriveKey');
            derivedKeyType = normalize(derivedKeyType, 'generateKey');
            algorithm.keySize = derivedKeyType.keySize;
            if (algorithm['public']) {
                algorithm['public'].algorithm = normalize(algorithm['public'].algorithm);
                algorithm['public'] = extractKey('deriveKey', algorithm, algorithm['public']);
            }
            return execute(algorithm, 'deriveKey', [extractKey('deriveKey', algorithm, baseKey)]).then(function (data) {
                return convertKey(derivedKeyType, extractable, keyUsages, data);
            });
        });
    };

    /**
     * The deriveBits method returns length bits on baseKey using the 
     * specified algorithm identifier. 
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-deriveBits}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-DH</b> ECDH Key Agreement mode</li>
     *      <li><b>GOST R 34.11-KDF</b> Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PBKDF2</b> Password Based Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PFXKDF</b> PFX Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-CPKDF</b> Password Based Key for CryptoPro Derivation Algorithm</li>
     *      <li><b>SHA-PBKDF2</b> Password Based Key for Derivation Algorithm</li>
     *      <li><b>SHA-PFXKDF</b> PFX Key for Derivation Algorithm</li>
     *  </ul>
     *  For additional modes see {@link GostSign} and {@link GostDigest}
     * 
     * @memberOf SubtleCrypto
     * @method deriveBits
     * @instance
     * @param {AlgorithmIdentifier} algorithm Algorithm identifier
     * @param {Key} baseKey Derivation key object
     * @param {number} length Length bits
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.deriveBits = function (algorithm, baseKey, length)
    {
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.deriveBits(algorithm, baseKey, length);

            algorithm = normalize(algorithm, 'deriveBits');
            if (algorithm['public'])
                algorithm['public'] = extractKey('deriveBits', algorithm, algorithm['public']);
            return execute(algorithm, 'deriveBits', [extractKey('deriveBits', algorithm, baseKey), length]);
        });
    };

    /**
     * The importKey method returns a new Promise object that will key(s) using
     * the specified algorithm identifier. Key can be used in according with
     * KeyUsage sequence. The recognized key usage values are "encrypt", "decrypt", 
     * "sign", "verify", "deriveKey", "deriveBits", "wrapKey" and "unwrapKey".<br><br>
     * Parameter keyData contains data in defined format.
     * The suppored key format values are:
     *  <ul>
     *      <li>'raw' - An unformatted sequence of bytes. Intended for secret keys.</li>
     *      <li>'pkcs8' - The DER encoding of the PrivateKeyInfo structure from RFC 5208.</li>
     *      <li>'spki' - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.</li>
     *  </ul>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-94</b> GOST Private and Public keys</li>
     *      <li><b>GOST R 34.10</b> ECGOST Private and Public keys</li>
     *      <li><b>GOST 28147</b> Key for encryption GOST 28147 modes</li>
     *      <li><b>GOST 28147-KW</b> Key for key wrapping GOST 28147 modes</li>
     *      <li><b>GOST R 34.12</b> Key for encryption GOST 34.12 modes</li>
     *      <li><b>GOST R 34.12-KW</b> Key for key wrapping GOST 34.12 modes</li>
     *      <li><b>GOST R 34.11-KDF</b> Key for Derivation Algorithm</li>
     *  </ul>
     *  For additional modes see {@link GostSign}, {@link GostDigest} and {@link GostCipher}<br>
     * 
     * @memberOf SubtleCrypto
     * @method importKey
     * @instance
     * @param {KeyFormat} format Key format Format specifies a serialization format for a key
     * @param {CryptoOperationData} keyData
     * @param {AlgorithmIdentifier} algorithm Key algorithm identifier
     * @param {boolean} extractable Whether or not the raw keying material may be exported by the application
     * @param {KeyUsages} keyUsages Key usage array: type of operation that may be performed using a key
     * @returns {Promise} Promise that resolves with {@link Key}
     */
    SubtleCrypto.prototype.importKey = function (format, keyData, algorithm, extractable, keyUsages)
    {
        var type;
        return new Promise(call).then(function () {
            if (checkNative(algorithm))
                return rootCrypto.subtle.importKey(format, keyData, algorithm, extractable, keyUsages);

            if (format === 'raw') {
                algorithm = normalize(algorithm, 'importKey');
                if (keyUsages && keyUsages.indexOf) {
                    var name = algorithm.name.toUpperCase().replace(/[\.\s]/g, '');
                    if (name.indexOf('3410') >= 0 && keyUsages.indexOf('sign') >= 0)
                        type = 'private';
                    else if (name.indexOf('3410') >= 0 && keyUsages.indexOf('verify') >= 0)
                        type = 'public';
                }
                return keyData;
            } else {
                var key;
                if (format === 'pkcs8')
                    key = gostCrypto.asn1.GostPrivateKeyInfo.decode(keyData).object;
                else if (format === 'spki')
                    key = gostCrypto.asn1.GostSubjectPublicKeyInfo.decode(keyData).object;
                else
                    throw new NotSupportedError('Key format not supported');

                algorithm = normalize(key.algorithm, 'importKey');
                type = key.type;
                if (extractable !== false)
                    extractable = extractable || key.extractable;
                if (keyUsages) {
                    for (var i = 0; i < keyUsages.length; i++) {
                        if (key.usages.indexOf(keyUsages[i]) < 0)
                            throw DataError('Key usage not valid for this key');
                    }
                } else
                    keyUsages = key.usages;
                var data = key.buffer, keySize = algorithm.keySize, dataLen = data.byteLength;
                if (type === 'public' || keySize === dataLen)
                    return data;
                else {
                    // Remove private key masks
                    if (dataLen % keySize > 0)
                        throw new DataError('Invalid key size');
                    algorithm.mode = 'MASK';
                    algorithm.procreator = 'VN';
                    var chain = [];
                    for (var i = keySize; i < dataLen; i += keySize) {
                        chain.push((function (mask) {
                            return function (data) {
                                return execute(algorithm, 'unwrapKey', [mask, data]).then(function (data) {
                                    var next = chain.pop();
                                    if (next)
                                        return next(data);
                                    else {
                                        delete algorithm.mode;
                                        return data;
                                    }
                                });
                            };
                        })(new Uint8Array(data, i, keySize)));
                    }
                    return chain.pop()(new Uint8Array(data, 0, keySize));
                }
            }
        }).then(function (data) {
            return convertKey(algorithm, extractable, keyUsages, data, type);
        });
    };

    /**
     * The exportKey method returns a new Promise object that will key data in
     * defined format. <br><br>
     * The suppored key format values are:
     *  <ul>
     *      <li>'raw' - An unformatted sequence of bytes. Intended for secret keys.</li>
     *      <li>'pkcs8' - The DER encoding of the PrivateKeyInfo structure from RFC 5208.</li>
     *      <li>'spki' - The DER encoding of the SubjectPublicKeyInfo structure from RFC 5280.</li>
     *  </ul>
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-exportKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST R 34.10-94</b> GOST Private and Public keys</li>
     *      <li><b>GOST R 34.10</b> ECGOST Private and Public keys</li>
     *      <li><b>GOST 28147</b> Key for encryption GOST 28147 modes</li>
     *      <li><b>GOST 28147-KW</b> Key for key wrapping GOST 28147 modes</li>
     *      <li><b>GOST R 34.12</b> Key for encryption GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.12-KW</b> Key for key wrapping GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.11-KDF</b> Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PBKDF2</b> Import Password for Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-PFXKDF</b> Import PFX Key for Derivation Algorithm</li>
     *      <li><b>GOST R 34.11-CPKDF</b> Import Password Key for CryptoPro Derivation Algorithm</li>
     *      <li><b>SHA-PBKDF2</b> Import Password for Key for Derivation Algorithm</li>
     *      <li><b>SHA-PFXKDF</b> Import PFX Key for Derivation Algorithm</li>
     *  </ul>
     *  For additional modes see {@link GostSign}, {@link GostDigest} and {@link GostCipher}<br>
     * 
     * @memberOf SubtleCrypto
     * @method exportKey
     * @instance
     * @param {KeyFormat} format Format specifies a serialization format for a key
     * @param {Key} key Key object
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.exportKey = function (format, key)
    {
        return new Promise(call).then(function () {
            if (key && checkNative(key.algorithm))
                return rootCrypto.subtle.exportKey(format, key);

            if (!key.extractable)
                throw new InvalidAccessError('Key not extractable');

            var raw = extractKey(null, null, key);
            if (format === 'raw')
                return raw;
            else if (format === 'pkcs8' && key.algorithm && key.algorithm.id) {
                if (key.algorithm.procreator === 'VN') {
                    // Add masks for ViPNet
                    var algorithm = key.algorithm, mask;
                    algorithm.mode = 'MASK';
                    return execute(algorithm, 'generateKey').then(function (data) {
                        mask = data;
                        return execute(algorithm, 'wrapKey', [mask, key.buffer]);
                    }).then(function (data) {
                        delete algorithm.mode;
                        var d = new Uint8Array(data.byteLength + mask.byteLength);
                        d.set(new Uint8Array(data, 0, data.byteLength));
                        d.set(new Uint8Array(mask, 0, mask.byteLength), data.byteLength);
                        var buffer = d.buffer;
                        buffer.enclosed = true;
                        return gostCrypto.asn1.GostPrivateKeyInfo.encode({
                            algorithm: algorithm,
                            buffer: buffer
                        });
                    });
                } else
                    return gostCrypto.asn1.GostPrivateKeyInfo.encode(key);
            } else if (format === 'spki' && key.algorithm && key.algorithm.id)
                return gostCrypto.asn1.GostSubjectPublicKeyInfo.encode(key);
            else
                throw new NotSupportedError('Key format not supported');
        });
    };

    /**
     * The wrapKey method returns a new Promise object that will wrapped key(s).
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-wrapKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST 28147-KW</b> Key Wrapping GOST 28147 modes</li>
     *      <li><b>GOST R 34.12-KW</b> Key Wrapping GOST R 34.12 modes</li>
     *      <li><b>GOST 28147-MASK</b> Key Mask GOST 28147 modes</li>
     *      <li><b>GOST R 34.12-MASK</b> Key Mask GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.10-MASK</b> Key Mask GOST R 34.10 modes</li>
     *  </ul>
     *  For additional modes see {@link GostCipher}<br>
     * 
     * @memberOf SubtleCrypto
     * @method wrapKey
     * @instance
     * @param {KeyFormat} format Format specifies a serialization format for a key. Now suppored only 'raw' key format.
     * @param {Key} key Key object
     * @param {Key} wrappingKey Wrapping key object
     * @param {AlgorithmIdentifier} wrapAlgorithm Algorithm identifier
     * @returns {Promise} Promise that resolves with {@link CryptoOperationData}
     */
    SubtleCrypto.prototype.wrapKey = function (format, key, wrappingKey, wrapAlgorithm)
    {
        return new Promise(call).then(function () {
            if (checkNative(wrapAlgorithm))
                return rootCrypto.subtle.wrapKey(format, key, wrappingKey, wrapAlgorithm);

            wrapAlgorithm = normalize(wrapAlgorithm, 'wrapKey');
            var keyData = extractKey(null, null, key);
            if (wrapAlgorithm.procreator === 'SC' && key.type === 'private')
                keyData = swapBytes(keyData);
            return execute(wrapAlgorithm, 'wrapKey',
                    [extractKey('wrapKey', wrapAlgorithm, wrappingKey), keyData]).then(function (data) {
                if (format === 'raw')
                    return data;
                else
                    throw new NotSupportedError('Key format not supported');
            });
        });
    };

    /**
     * The unwrapKey method returns a new Promise object that will unwrapped key(s).
     * WebCrypto API reference {@link http://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-unwrapKey}<br><br>
     * 
     * Supported algorithm names:
     *  <ul>
     *      <li><b>GOST 28147-KW</b> Key Wrapping GOST 28147 modes</li>
     *      <li><b>GOST R 34.12-KW</b> Key Wrapping GOST R 34.12 modes</li>
     *      <li><b>GOST 28147-MASK</b> Key Mask GOST 28147 modes</li>
     *      <li><b>GOST R 34.12-MASK</b> Key Mask GOST R 34.12 modes</li>
     *      <li><b>GOST R 34.10-MASK</b> Key Mask GOST R 34.10 modes</li>
     *  </ul>
     *  For additional modes see {@link GostCipher}<br>
     * 
     * @memberOf SubtleCrypto
     * @method unwrapKey
     * @instance
     * @param {KeyFormat} format Format specifies a serialization format for a key. Now suppored only 'raw' key format.
     * @param {CryptoOperationData} wrappedKey Wrapped key data
     * @param {Key} unwrappingKey Unwrapping key object
     * @param {AlgorithmIdentifier} unwrapAlgorithm Algorithm identifier
     * @param {AlgorithmIdentifier} unwrappedKeyAlgorithm Key algorithm identifier
     * @param {boolean} extractable Whether or not the raw keying material may be exported by the application
     * @param {KeyUsages} keyUsages Key usage array: type of operation that may be performed using a key
     * @returns {Promise} Promise that resolves with {@link Key}
     */
    SubtleCrypto.prototype.unwrapKey = function (format, wrappedKey, unwrappingKey,
            unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages)
    {
        return new Promise(call).then(function () {
            if (checkNative(unwrapAlgorithm))
                return rootCrypto.subtle.unwrapKey(format, wrappedKey, unwrappingKey,
                        unwrapAlgorithm, unwrappedKeyAlgorithm, extractable, keyUsages);

            unwrapAlgorithm = normalize(unwrapAlgorithm, 'unwrapKey');
            unwrappedKeyAlgorithm = normalize(unwrappedKeyAlgorithm, 'importKey');
            if (format !== 'raw')
                throw new NotSupportedError('Key format not supported');

            return execute(unwrapAlgorithm, 'unwrapKey', [extractKey('unwrapKey', unwrapAlgorithm, unwrappingKey), wrappedKey]).then(function (data) {
                var type;
                if (unwrappedKeyAlgorithm && unwrappedKeyAlgorithm.name) {
                    var name = unwrappedKeyAlgorithm.name.toUpperCase().replace(/[\.\s]/g, '');
                    if (name.indexOf('3410') >= 0 && keyUsages.indexOf('sign') >= 0)
                        type = 'private';
                    else if (name.indexOf('3410') >= 0 && keyUsages.indexOf('verify') >= 0)
                        type = 'public';
                }
                if (unwrapAlgorithm.procreator === 'SC' && type === 'private')
                    data = swapBytes(data);
                return convertKey(unwrappedKeyAlgorithm, extractable, keyUsages, data, type);
            });
        });
    };

    /**
     * The subtle attribute provides an instance of the SubtleCrypto 
     * interface which provides low-level cryptographic primitives and 
     * algorithms.
     * 
     * @memberOf gostCrypto
     * @type SubtleCrypto
     */
    gostCrypto.subtle = new SubtleCrypto();

    /**
     * The getRandomValues method generates cryptographically random values. 
     * 
     * First try to use Web Crypto random genereator. Next make random
     * bytes based on standart Math.random mixed with time and mouse pointer
     * 
     * @memberOf gostCrypto
     * @param {(CryptoOperationData)} array Destination buffer for random data
     */
    gostCrypto.getRandomValues = function (array)
    {
        // Execute randomizer
        var randomSource = new GostRandom();
        if (randomSource.getRandomValues)
            randomSource.getRandomValues(array);
        else
            throw new NotSupportedError('Random generator not found');
    };


module.exports = gostCrypto;



/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostDigest.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostDigest.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file GOST R 34.11-94 / GOST R 34.11-12 implementation
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * Converted to JavaScript from source https://www.streebog.net/
 * Copyright (c) 2013, Alexey Degtyarev.
 * All rights reserved.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const GostRandom = __webpack_require__(/*! ./gostRandom */ "./node_modules/node-gost-crypto/lib/gostRandom.js");
const GostCipher = __webpack_require__(/*! ./gostCipher */ "./node_modules/node-gost-crypto/lib/gostCipher.js");

    /*
     * GOST R 34.11
     * Common methods 
     * 
     */

    var root = __webpack_require__.g;
    var rootCrypto = root.crypto || root.msCrypto;

    var DataError = root.DataError || Error,
            NotSupportedError = root.NotSupportedError || Error;

    // Copy len values from s[sOfs] to d[dOfs]
    function arraycopy(s, sOfs, d, dOfs, len) {
        for (var i = 0; i < len; i++)
            d[dOfs + i] = s[sOfs + i];
    }

    // Swap bytes in buffer
    function swap(s) {
        var src = new Uint8Array(s),
                dst = new Uint8Array(src.length);
        for (var i = 0, n = src.length; i < n; i++)
            dst[n - i - 1] = src[i];
        return dst.buffer;
    }

    // Convert BASE64 string to Uint8Array
    // for decompression of constants and precalc values
    function b64decode(s) {
        // s = s.replace(/[^A-Za-z0-9\+\/]/g, '');
        var n = s.length,
                k = n * 3 + 1 >> 2, r = new Uint8Array(k);

        for (var m3, m4, u24 = 0, j = 0, i = 0; i < n; i++) {
            m4 = i & 3;
            var c = s.charCodeAt(i);

            c = c > 64 && c < 91 ?
                    c - 65 : c > 96 && c < 123 ?
                    c - 71 : c > 47 && c < 58 ?
                    c + 4 : c === 43 ?
                    62 : c === 47 ?
                    63 : 0;

            u24 |= c << 18 - 6 * m4;
            if (m4 === 3 || n - i === 1) {
                for (m3 = 0; m3 < 3 && j < k; m3++, j++) {
                    r[j] = u24 >>> (16 >>> m3 & 24) & 255;
                }
                u24 = 0;

            }
        }
        return r.buffer;
    }

    // Random seed
    function getSeed(length) {
        var randomSource = new GostRandom();
        if (randomSource.getRandomValues) {
            var d = new Uint8Array(Math.ceil(length / 8));
            randomSource.getRandomValues(d);
            return d;
        } else
            throw new NotSupportedError('Random generator not found');
    }

    // Check buffer
    function buffer(d) {
        if (d instanceof ArrayBuffer)
            return d;
        else if (d && d.buffer && d.buffer instanceof ArrayBuffer)
            return d.byteOffset === 0 && d.byteLength === d.buffer.byteLength ?
                    d.buffer : new Uint8Array(new Uint8Array(d, d.byteOffset, d.byteLength)).buffer;
        else
            throw new DataError('ArrayBuffer or ArrayBufferView required');
    }

    /**
     * Algorithm name GOST R 34.11 or GOST R 34.11-12<br><br>
     * 
     * http://tools.ietf.org/html/rfc6986
     * 
     * The digest method returns digest data in according to GOST R 4311-2012.<br>
     * Size of digest also defines in algorithm name. 
     *  <ul>
     *      <li>GOST R 34.11-256-12 - 256 bits digest</li>
     *      <li>GOST R 34.11-512-12 - 512 bits digest</li>
     *  </ul>
     *  
     * @memberOf GostDigest
     * @method digest
     * @instance
     * @param {(ArrayBuffer|TypedArray)} data Data
     * @returns {ArrayBuffer} Digest of data
     */
    var digest2012 = (function ()
    {
        // Constants 
        var buffer0 = new Int32Array(16); // [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];  

        var buffer512 = new Int32Array(16); // [512, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 
        buffer512[0] = 512;

        // Constant C 
        var C = (function (s) {
            var h = new Int32Array(b64decode(s)),
                    r = new Array(12);
            for (var i = 0; i < 12; i++)
                r[i] = new Int32Array(h.buffer, i * 64, 16);
            return r;
        })(
                'B0Wm8lllgN0jTXTMNnR2BRXTYKQIKkKiAWlnkpHgfEv8xIV1jbhOcRbQRS5DdmovH3xlwIEvy+vp2soe2lsIsbebsSFwBHnmVs3L1xui3VXKpwrbwmG1XFiZ1hJrF7WaMQG1Fg9e1WGYKyMKcur+89e1cA9GneNPGi+dqYq1o2+yCroK9ZYemTHbeoZD9LbCCdtiYDc6ycGxnjWQ5A/i03t7KbEUderyix+cUl9e8QY1hD1qKPw5Cscvzius3HT1LtHjhLy+DCLxN+iToepTNL4DUpMzE7fYddYD7YIs16k/NV5orRxynX08XDN+hY5I3eRxXaDhSPnSZhXos98f71f+bHz9WBdg9WPqqX6iVnoWGicjtwD/36P1OiVHF82/vf8PgNc1njVKEIYWHxwVf2MjqWwMQT+amUdHraxr6ktufWRGekBo+jVPkDZyxXG/tsa+wmYf8gq0t5oct6b6z8aO8Jq0mn8YbKRCUfnEZi3AOTB6O8Okb9nTOh2urk+uk9QUOk1WhojzSjyiTEUXNQQFSiiDaUcGNyyCLcWrkgnJk3oZMz5H08mHv+bHxp45VAkkv/6GrFHsxaruFg7H9B7nAr/UDX+k' +
                '2ahRWTXCrDYvxKXRK43RaZAGm5LLK4n0msTbTTtEtIke3jaccfi3TkFBbgwCqucDp8mTTUJbH5vbWiODUURhcmAqH8uS3DgOVJwHppqKK3uxzrLbC0QKgIQJDeC3Vdk8JEKJJRs6fTreXxbs2JpMlJsiMRZUWo837ZxFmPvHtHTDtjsV0fqYNvRSdjswbB56SzNprwJn558DYTMbiuH/H9t4iv8c50GJ8/PkskjlKjhSbwWApt6+qxst84HNpMprXdhvwEpZot6Ybkd9Hc2678q5SOrvcR2KeWaEFCGAASBhB6vru2v62JT+WmPNxgIw+4nI79CezXsg1xvxSpK8SJkbstnVF/T6UijhiKqkHeeGzJEYne+AXZufITDUEiD4dx3fvDI8pM16sUkEsIAT0roxFvFn5443');

        // Precalc Ax 
        var Ax = (function (s) {
            return new Int32Array(b64decode(s));
        })(
                '5vh+XFtxH9Alg3eACST6FshJ4H6FLqSoW0aGoY8GwWoLMumi13tBbqvaN6RngVxm9heWqBpoZnb13AtwY5GVS0hi84235kvx/1ximmi9hcXLgn2m/NdXlWbTba9pufCJNWyfdEg9g7B8vOyxI4yZoTanAqwxxHCNnrao0C+839aLGfpR5bOuN5zPtUCKEn0LvAx4tQggj1rlM+OEIojs7c7Cx9N3wV/S7HgXtlBdD165TMLAgzaHHYwgXbTLCwStdjyFWyigiS9YjRt59v8yVz/s9p5DEZM+D8DTn4A6GMnuAQom9fOtgxDv6PRBGXmmXc2hDH3pOhBKG+4dEkjpLFO/8tshhHM5tPUMz6aiPQlftLyc2EeYzeiKLYsHHFb5f3dxaVp1apzF8C5xoLoevKZj+atCFeZyLrGeIt5fu3gNuc4PJZS6FIJSDmOXZk2ELwMeagII6phcfyFEob5r8Ho3yxzRY2Lbg+COK0sxHGTPcEebq5YOMoVrqYa53ucetUeMh3r1bOm4/kKIX2HW/RvdAVaWYjjIYiFXkj74qS78l/9CEUR2+J19NQhWRSzrTJDJsOCnElYjCFAt+8sBbC16A/qnpkhF' +
                '9G6LOL/GxKu9vvj91HfeujqsTOvIB5t58JyxBeiHnQwn+moQrIpYy4lg58FAHQzqGm+BHko1aSiQxPsHc9GW/0NQGi9gnQqf96UW4MY/N5Yc5KazuNqSUhMkdSw44IqbpahkczvsFU8r8SRXVUmzP9dm2xVEDcXHp9F5455Ct5La3xUaYZl/04agNF7AJxQjONVRe22pOaRlGPB3EEADtAJ5HZClrqLdiNJniZxKXQqTD2bfCihlwk7p1CBFCbCLMlU4kWaFKSpBKQe/xTOoQrJ+K2JUTcZzbFMERWKV4Ada9AbpU1GQih8vO2vBI2Fvw3sJ3FJV5cY5Z9Ezsf5oRCmIOcfw5xHiQJuH9xlk+aLpOK3D20sHGQwLTkf5w+v0VTTVdtNriENGEKBa64sC2CDDzfWCMvJRbeGEDb7Cseeg6N4GsPodCHuFS1QNNDM7QuKaZ7zKW3/YpgiKxDfdDsY7s6nZQ+2BIXFNvV5lo7FnYe3nte6haSQx98jVc6v21R/GheGjZxpeBjzUBBDJLSg6uY8ssEACj+vAbLLy95AX1k8Rb6HTPOBzWfGpnuSqeE7WjHTNwAZuKhnVxztC2ocStBYccEXD' +
                'NxWC5O2TIW2s45BBSTn2/H7F8SGGIjt8wLCUBCusFvv510U3mlJ+v3N8Py6jtoFoM+e42brSeMqpoyo0wi/+u+SBY8z+370NjllAJG6lpnBRxu9LhCrR5CK60GUnnFCM2RSIwhhgjO4xnqVJH3zaF9OU4SgTTJxgCUv0MnLV47Ob9hKlpKrXkcy72kPSb/0PNN4fPJRq0lBPW1RomV7ha9+fr2/qj3eUJkjqWHDdCSu/x+Vtcdl8Z93msv9PIdVJPCdrRjroYAORdntPr4bHH2ihPng11LmgtowRXwMMn9QUHdLJFlggAZg9j33dUySsZKpwP8wXUlTCyYmUjgK0Jj5edtafRsLeUHRvA1h9gARF2z2CknLx5WBYSgKbVgvz+65Ypz/83GKhWl5ObK1M6EupblXOH7jMCPl0eq6CslPBAhRM9/tHG58EKJjz6442BosnrfLv+3rtypf+jApevneOBRP099jPMCwlAcMri/eNkt38F1xVTfhlxX9GBS9f6vMwG6Ky9CSqaLfsu9YNhpmPDzUBBHVMAAAAAAAAAADxLjFNNNDM7HEFIr4GGCO1rygNmTDABcGX/VziXWk8ZRmkHMYzzJoV' +
                'lYRBcvjHnrjcVDK3k3aEqZQ2wTokkM9YgCsT8zLI71nEQq45fO1PXPoc2O/jq42C8uWslU0pP9Fq2CPokHobfU0iSfg88EO2A8ud2Hn58z3eLS8nNtgmdCpDpB+JHuLfb5iZnRtsEzrUrUbNPfQ2+rs131AmmCXAlk/cqoE+bYXrQbBTfuWlxAVAunWLFghHpBrkO+e7RK/juMQp0GcXl4GZk7vun765rpqN0eyXVCHzVyzdkX5uMWOT19rir/jOR6IgEjfcUzijI0PeyQPuNXn8VsSompHmAbKASNxXUeASlvVk5Lfbe3X3GINRWXoS222VUr3OLjMenbsjHXQwj1INcpP90yLZ4gpEYQwwRnf+7uLStOrUJcow/e4ggAZ1YerKSkcBWhPnSv4UhyZOMCzIg7J78RmlFmTPWbP2gtyoEap8HnivWx1WJvtkjcOytz6RF99bzjTQX3zwarVvXf0lfwrNEycYV03I5nbFKp4HOaflLriqmlSGVT4PPNmjVv9IrqqSe36+dWUlrY4th30ObPn/28hBOx7MoxRQyplpE74w6YPoQK1REAmVbqccsbW2ui20NU5Eab3KTiWgBRWvUoHKD3Hh' +
                'dEWYy40OK/JZP5sxKqhjt++zim4ppPxja2qjoEwtSp09lesO5r8x46KRw5YVVL/VGBacju+by/URXWi8nU4oRrqHXxj6z3Qg0e38uLbiPr2wBzby8eNkroTZKc5libb+cLei9tpPclUOclPXXG1JKQTyOj1XQVmnCoBp6gssEI5J0HPFa7EaEYqrehk55P/XzQlaCw44rO/J+2A2WXn1SJK95pfWfzQix4kz4QUUvGHhwdm5dcm1StImYWDPG82AmkSS7Xj9hnGzzKsqiBqXk3LOv2Z/4dCI1tRbXZhalCfIEagFjD9V3mX1tDGWtQYZ90+WsdZwbkOFnR6Ly0PTNlqrioXM+j2E+ce/mcKV/P2iH9Wh3ktjD82z73Y7i0VtgD9Z+Hz3w4WyfHO+XzGRPJjjrGYzsEghv2FnTCa4+BgP+8mVxMEwyKqghiAQdhqYYFfzQiEBFqr2PHYMBlTMNS3bRcxmfZBCvPRalkvUA4Jo6KDD7zxvPae9ktJp/3O8KQriAgHtIoe33jTN6IWBj9kB7qfdYQWb1vonMhmgNVPVbxrodMzOyeoxJFwug/VUcDRVXaB75JnOJtKsVue+9/0WGFelBU44' +
                'ag59pFJ0NtFb2Go4HN6f8sr3dWIxdwwysJqu2eJ5yNBd7xCRxgZ02xEQRqJRXlBFI1Ns5HKYAvzFDLz39bY8+nOhaIfNFx8DfSlBr9nyjb0/Xj60Wk87nYTu/jYbZ3FAPbjj0+cHYnEaOij58g/SSH68fHW0nnYndOXyk8frVlwY3PWeT0eLpAxu9E+prctSxpmBLZjax2B4iwbcbkadDvxl+Op1IexOMKX3IZ6OC1Ur7D9lvKV7a93QSWm68bdemZBM2+OU6lcUsgHR5upA9ruwwIJBKErdUPIEY7+PHf/o1/k7k8usuE2Mto5HfIbowd0bOZImjj98WqESCdYvyy89mKvbNcmuZxNpViv9X/UVweFsNs7igB1+su3485sX2pTTfbAN/gGHe8PsdguK2suEld/hU65EBaJHc7e0ELMShXt4PDKr3463cNBoElE7U2c5udLj5mVYTVficbJkaNeJx4/JhJclqTW7+n0a4QKLFTej36ZBiNDNXZvDeN56Ssgsmk2Az7dCd38bg722IHLSiDodM711XnotS6tqj0H02qtruxyV2ZBc/+f9jTG2g6pkIhGbOB/ArvuEQgIsSaD5CMZjAzrj' +
                'pCivCASTiCat5Bw0GopTx65xIe535qhdxH9cSiWSnoy1OOmqVc3YYwY3eqna2OspoYroe7MnmJVu39pqNeSEFGt9nRmCUJSn1Bz6VaTobL/lyu3J6kLFnKNsNRwOb8F5UYHk3m+rv4n/8MUwGE0X1J1B6xWEBFiSHA1SUCjXOWHxeOwYDKiFapoFcQGO+BHNQJGifD7178wZrxUjn2Mp0jR0UO/5HrmQ4RtKB43Sd1m5Vh3l/GATMZEvH1otqZPAFlTctluiGRo+Ld4JimuZ64pm1x4PguP+jFGtt9VaCNdFM+UPiUH/fwLm3We9SFns4Giqul321S/CSCbj/0p1pWw5Bw2IrN34ZIZUjEaRpG/Rvr0mE1x8DLMPkwOPFTNKgtmEn8G/mmmcMguoVCD65PpSgkOv+QdnntTWz+loowi4Jf1YLESxR5t2kbxe3LO7x+phkEj+ZRYQY6YfgXryM0fVOGg0CaaTY8LOmExt7TAqn9/YbIHZHXseOwYDKmaUZmCJ6/vZ/YMKWY7mc3UgewdEmhQK/ElfLKilcbZZMjQfmG+KRbvC+zgapKBQs3LCVCOjrdgfrzoXJzwLi4a7bP6DJY3IabWi' +
                'KHkCv9HJgPH1qUvWazg3r4iACnmyyroSVVBDEAg7DUzfNpQOB7nusgTRp85nkLLFYSQT//EltNwm8SuXxSwST4YII1GmLyis75NjL5k35ec1B7BSKTob5ucsMK5XCpxw01hgQa4UJeDeRXSz151MxJK6IoBAxWha8AsMpdyMJxy+Eofx9pxabvOeMX+x4NyGSV0RQCDsNC1pm0B+PxjNS9yjqdRq1RUoDR0U8nmJaSQAAAAAAAAAAFk+t1+hlsYeLk54FgsRa9htSuewWIh/juZf0BOHLj4Gem3bu9MOxOKsl/yJyq7xsQnMszweGdvhifPqxGLuGGR3cM9JqoetxlbFfsplV/bWA5U92m1s+5o2ko2IRFbgfB7rjzeVn2CNMdYXnE6qqSNvrDrX5cAmYkMEn6ZTmRRWq9NmncBSuO6vAsFTp8IKKzzLA243I8AHk8nCPZDhyizDO8ZeL27X00z/VjOXWCSeselOZDJdaqY34W01lHJCCnn45mG+Yj94UhTZBALHRBNILvH98MiWWxP2m8XsFgmpDogpKBTlkr5OGYtUKhB9cszAD8vrr+cbG0nIRCIrcD4lZBZNqEDp1SDGUT4f9Plm' +
                'usMgP5EM6Kvy7dHCYcR+8IFMuUWs02Hzlf64lEo5IQVcnPAsFiLWrZcYZfP3cXjpvYe6K5vwofREQAWyWWVdCe11vkgkf7wLdZYSLhfP9Cq0SwkXhel6FZZrhU4nVdqf7uCDkkkTR5EyQypGI8ZSuahGW0etPkN0+LRfJBKxXoskF/bweGRLo/shYv5/3aURS7vMJ52kbcEBc+C90CSidiIgjFmivKCKj8SQbbg2803kuQ10OmZn6nFHteBwX0bvJ4LLKhUIsDnsBl719FsefSG1sYPP0FsQ2+czwGApXHefpzZyOUwBfs9VMhGGwxyB2HIOGg1Fp+07j5l6Pd+JWDr8ecft+ysu6aQZhkPvDs5fCc32e04tN09qa+n6NN8Etq3UcDihI/mNIk0KBX6qocliSLhcG/eo4/2XYDCaLrULKm5bo1GCDetCxOH+p1cilI1YKZodg3N/z5zIZLrUUaVbT7XUtypQCL9Tgc49eZdGptjV5C0E5dIrgPx+MIeWV7aed7VzVKA5aUQdgJfQtDMwyvvz4vDP4o533eC+jMNisS4lnElPRqbOcm+529HKQeJCwe7RTbp2Ay/0eqMPsEWyaKk6zeTM' +
                'r38L6IRUnQgEg1SzwUaCY5JUNcLIDv7S7k438n/f+6cWejOSDGDxTfsSO1LqA+WESgyrU/27kAed6vY4D3iKGctI7FWPDLMqtZ3Estb+9+Dc28oi9PPsthHfWBNUmpxA4z/e31aKztOgwcgSQyLpwwela4FY+m0NdyeVebHh893ZsYt0QirABLjsLZ//q8KU9Kz4qC11kU97v2mx7ytoeMT2L69Iesfhds6AnMZ+XQxnEdiPkuTBTGJ7mdkkPe3+I0qlw9+2i1GQmx8VJi2/bU9m6gVLYry1GuLPWlKqaui+oFP70M4BSO1oCMDmYxTJQ/4WzRWoJxDNBJIxoGlw9ue8imyXzEywM3zoNfyzucBl3vJYfMeA81IhTt5BMrtQlfFeQ5D0k9+HCDliXdLg8UExPBr7i2avkXIK8FGyEbxHfUJ+1O6lcy47TO72474lgmJ4NOsLzEOcA+PdeOckyCh3MorZhn35FLUZReJDsPJXSw+I9+uX4oi2+piapJQ6GcTwaMsWhYZQ7mQJrxH6733zF9XATqukelZ8VJi0xqm2u/uAT0IYjjzCK887xc0L0EM26qo5dxPwL6wb7DMTLCUG26fw00iN' +
                '1+Zda/LDGh5eubIWH/gg9YQuBlDEbg+fcWvrHZ6EMAGpM3WMqzFe1D/kFP2ieSJlJ8nxcB7wCTJzpMHKcKdxvpQYS6bnaz0OQNgp/4wUyH4PvsP6x3Z0yzYWqWNKapVyjxORGcJe+Tf1Re1NWuo/nugCSZZQujh7ZDfnvQtYLiLmVZ+J4FPiYYCtUuMFKI38bcVaI+NLmTXeFOD1GtCtCcY5BXimWYZeltdhcQlIfLHi1ss6IRVgAgHpFeV3n67RrbAhP2p33LeYgLduuaGmq12fjSSGRM+b/V5FNsVmJljxxrn+m6y9/erNY0G+mXnE76ciFwhAVXZRB3Hs2I5UPsK6UctnHwQ9CtSCrHGvWHn+eHoEXNrJNrI4rzOOBJrtvYZsyUly7iZhXabrvYECkDKV/dCLLBcR+DQEYHO/CurzCZMpdY/8QhyusT59z6k0uiMHSBGIgysk785Ch0zmXA5X1h+w6doas9G61vmbNDzAdXsciTxFgitRDbhAOpKXXHaYwfHbYUo+DQEY1eaMtNYPSI6FXLTPrpYeDfPLM9k6jlWrFKAO10IXAyhiN4nBg4tt0ZyUYpKJX+997Ts668/LuOZOSjFJ' +
                'Bkx+ZC9lw9w9Kz4qTFpj2lvT80CpIQxHtHTRV6FhWTGsWTTaHehyZm7jZRF693ZbyG7TZxawXESbpohcIB1JxbkFOHqINGxFExByxLq53f+/SUYep1GvmdUpd7wc4FuhsPeF5GAn21JUbTC6bld4jDBa1wdlD1auyYfGgmEv8pWlq4lE9fvFcX7VKOdZ8kTKjdy7zix9uIiqFUq+Mo2xuh5hm+mT7OiLCfK9nugTtxd0AapLKF0csyGFjxQxlcruSMOBhBOY0bj8t1DTsvmIiTmoapmNHOG5H4iODORzRlp4mVaDdpeHFgLPKtfuI0G/hccTtbPxoU7/kW/hK0Vn53waAjC30QV1DJj8yF7Km6Wj5/cg2p4GrWpgMaK7sfQ4lz50lH7X0mAs9GY5GMD/ml9Qp/NoZ44kNNmDtKRJ1M1orxt1VZK1h388PQIubeobq/xfW0USH2sNcektKVU1dN/99RBtTwPYCBuoe5+MGcbbfqGjrAmBu7vKEq1mFy36eXBDZgEIKccXkyZ3e/9fnAAAAAAAAAAA6yR2pMkG1xVyTdQvBzjfb7dS7mU43bZfN/+8hj31O6OO+oT8tcFX5unrXHMnJZaq' +
                'GwvavyU1xDmG4SyHKk1OIJlpoovOPgh6+vsut52cS1UFakFWttksslo65qXevqKWIqOwJqgpJYBTyFs7Nq0VgbEekAEXuHWDxR86Sj/laTDgGeHtzzYhveyBHSWR/LoYRFt9TE1SSh2o2mBp3K7wBVj1zHIwneMp1MBiWWt/9XDOIq0DOdWfmFkc2ZdHAk34i5DFqgMYe1T2Y9J/w1bQ8NhYnpE1tW7VNTCWUdPWehwS+WchzSZzLtKMHD1EGjasSSqUYWQHf2ktHXPcb19RS28KcPQNaNiKYLSzDsoerEHTZQnYM4WYfQs9l0kGMPaonszJCpbEZXeiDuLFrQGofOSatV4OcKPepEKcoYJka6Dal7RG25Yvaszth9TX9t4nKrgYXTelPEafJdzv4VvLpsGcbvn+o+tTp2SjkxvYhM4v0lkLgXwQ9FaiGm2AdDkz5XOgu3nvDQ8VXAygldweI2wsT8aU1DfkEDZN9iMFMpHdMt/Hg2xCZwMmPzKZvO9uZvjNauV7b52MNa4rW+IWWTGzwuISkPh/k70gJ7+RUANpRg6QIg0bVimeJ2+uGdMoY5KMPFOiQy9wgv746Rue0LxveSw+7UD3' +
                'TEDVN9LeU9t16L+uX8KyYk2pwNKlQf0KTo//4Dz9EmQmIOSVaW+n4+Hw9Ai4qY9s0aojD92m2cLH0BCd0cYoj4p50E90h9WFRpRXm6NxC6I4QX98+oNPaB1HpNsKUAflIGya8UYKZD+hKN33NL1HEoFERwZytyMt8uCGzAIQUpMYLeWNvIkrV8qh+bD4kx37a4kkR8wuWun53RGFBCCkO0vlvraKJD7WVYQlXxnI1l07Z0BOYz+gBqaNtnZsRyof94rHmrTJfiHDU0QuEICq7JpPnblXgucUBbp7yCybMiAxpUZl+LZeT7G2Ufd1R/TUi/oNhXukZoKFqWxaoWqYu5kPrvkI63nJoV43okf0pi12hX3NXSd0HvjFC4AKGCC8vmXcsgH3orRmbRuYb5Qm50zJIb9TxOZIlUEKD5PZykIgzcyqZHuk70KaQGCJChhxDE6k9psys4vM2jYt3jVM05bcI7x8Wy+pwwm7aKqFGrPSYTGnNkjgEwIdxSlB/E2yzVrat3BL5IqneWXZhO1x5jI4b9YXNLuk6C1t1TirckVcIUfqYXe0sV2hq3DPCRzorJB/znK4vf9XyF39lyJ4qKTkTGprb5QN' +
                'OFGZW08f3+RiV4zK7XG8ntmIK7DAHSwKkXudXRE8UDuiwx4RqHZDxuRjySOjmcHO9xaGxX6odtyHtKlz4JbVCa8NVn2dOlgUtAwqP1ncxvQ2AviEldEh3dPh3T2YNkhK+UXnGqRmiOV1GFR+sqWR9ZNmWHRQwB2JnqgQGGWMBltPVAgMvEYDoy0DhMZRN7893DJQeOyGHirqMKj8eVc/9yFNIDDKBQy2ZfAyK4AWwwxpvpbdGyRwh9uV7pmB4WG40fwYFNnKBfiCDtK7zA3nKWPXYFBDDxTHO8yw6KCdOg+OQHZNVz9UojnRdcHhYXe9EvWjfHNPH0urN8EvH9/CbVZIsWc5XNDxbATtFTe/QqftlxYdFDBAZX1sZ9qrcrgH7Bf6h7pO6Dzfr3nLAwT7wXM/BgVxvEY+eNYcEofpiifQfPSOd7StobnCYlNskN0m4kSbWGCAFgWPwJrX+UH8+/rYzqlL5G0Oo0PyiwYI65+bEmvQSRc0e5qSh0rnaZwiGwF8QsTmnuA6TFxyDuOSVktun14+o5naa6NT9FrYPTXn/uCQTBskJSLQCYMlh+ldhCmAwA8UMOLGs8Cghh4okwh0M6QZ1yny' +
                'NB89rdQtbG/uCj+u+7Kljkruc8SQ3TGDqrcttbGhajSpKgQGXiOP33tLNaFoa2/MaiO/bvSmlWwZHLlrhRrTUlXVmNTW3jUayWBN5fKufvMcpsKjqYHhct4vlVGtelOYMCWq/1bI9hYVUh2dHihg2VBv4xz6RQc6GJxV8StkewsBgOyarn6oWXzsi0AFDBBeI1DlGYv5QQTvitM0VcwN1wenvuFtZ3+S5eMluQ3naZdaBhWRom5jerYR7xYYIItGCfTfPrepgaseuweK6H2swLeRA4y2XiMfD9ONRXSwVmBn7fcCweqOvrpfS+CDEjjN48R3ws7+vlwNzkhsNUwb0oxds2QWwxkQJuqe0adicyQDnSmz74Ll658o/ILL8q4CqKronPBdJ4ZDGqz6J3SwKM9HH54xt6k4WBvQuOOSLsi8eBmbQAvvBpD7cce/QvhiHzvrEEYDBJloPnpHtVrY3piPQmOmldGQ2AjHKm5jhFMGJ1J7wxnXy+uwRGbXKZeu5n4MCuJljHwU0vEHsFbIgHEiwywwQAuMinrhH9Xaztug3ts46YoOdK0Qk1TcxhWmC+kaF/ZVzBmN3V/+uL2xSb/lMCiviQrt' +
                '1lum9bStemp5VvCIKZcifhDoZlUys1L5DlNh39rO/jnOx/MEn8kBYf9itWFnf18ul1zPJtIlh/BR7w+GVDuvYy8eQe8Qy/KPUnImNbu5SoiujbrnM0TwTUEHadNmiP2as6uU3jS7uWaAExeSjfGqm6VkoPDFETxU8THUvr2xoRd/caLz6o71tUCHhUnI9lXDfvFOaUTwXezURmPc9VE32PKs/Q1SM0T8AAAAAAAAAABfvG5ZjvVRWhbPNC7xqoUysDa9bds5XI0TdU/m3TG3Ervfp3otbJCUiefIrDpYKzA8aw4JzfpFncSuBYnH4mUhSXNad39f1GjK/WRWHSybGNoVAgMvn8nhiGckNpQmg2k3ghQeO6+JhJy11TEkcEvp19tKbxrT0jOm+YlDKpPZv501OauKDuOwU/LKrxXH4tFuGSg8dkMPFT3r4pNjhO3EXjyCwyCL+QMzuINMuUoT/WRw3rEuaGtVNZ/RN3pTxDZhyqV5AvNZdQQ6l1KC5Zp5/X9wSCaDEpzFLukTaZzNeCi5/w59rI0dVFV0TnignUPLfYjMs1IzQUS9EhtKE8+6TUnNJf26ThE+dssgjAYILz/2J7oieKB2' +
                'wolX8gT7supFPf6B5G1n45TB5pU9p2IbLINoXP9JF2TzLBGX/E3spSsk1r2SLmj2sit4RJrFET9I87bt0SF8MS6erXW+tVrWF0/YtF/ULWtO1OSWEjir+pLmtO7+vrXQRqDXMgvvgghHIDuopZEqUST3W/jmnj6W8LE4JBPPCU7+4ln7yQH3dydqcksJHNt9vfj1Ae51R19ZmzwiTeyGkW2EAY+Zwer+dJi45BzbOazgWV5xIXxbtyqkOic8UMCv9QtD7D9UO26Djj4hYnNPcMCUkttFB/9Ycr/qn9/C7mcRaIrPnM36oBqBkNhqmDa5esvZO8YVx5XHMyw6KGCAyoY0RelO6H1Q9pZqX9DW3oXprYFPltXaHHCiL7aePqPVCmn2jVgrZEC4Qo7Jwu51f2BKSeOsjfEsW4b5CwwQyyPh2bLrjwLz7ik5E5TT0iVEyOChf1zQ1qq1jMal96JurYGT+wgjjwLC1caPRlsvn4H8/5zSiP26xXcFkVfzWdxHHSYuOQf/SSv7WCIz5ZrFV92yvOJC+LZzJXe3Ykjgls9vmcSm2D2nTMEUfkHreVcB9IuvdpEqkzc+8p0kmywKGenhYyK2+GIv' +
                'VTaZQEd1f3qfTVbVpHsLM4IlZ0ZqoRdMuPUFfesIL7LMSMEL9EdfUzcwiNQnXew6lo9DJRgK7RAXPSMs9wFhUa5O0J+Ub8wT/UtHQcRTmHMbWz8N2ZM3ZS/8sJZ7ZEBS4CN20gqJhAyjrjpwMpsY10GcvSM13oUm+v6/EVt8MZkDlwdPhaqbDcWK1PtINrlwvsYL4/xBBKge/zbcS3CHchMf3DPthFO2CETjPjQXZNMP8RtuqzjNOWQ1Hwp3YbhaO1aU9QnPug4whXCEuHJF0Eevs70il6488rpcL29rVUp0vcR2H09w4c/fxkRx7cRe5hB4TB3ArxZ6yinWPBE/KC3tQRd2qFmvrF8hHpmj1e7UhPlJqH7zOzzjbKWW4BPk0SDwmDqdQyxrxARk3Fl1Y2nV9eXRlWyemulfBDaYuyTJ7MjaZqTvRNaVCMilsurGxAwiNcBQO4A4wZO6jGUhAxzux11GvJ6P0zEBGTdRWtHY4uVohuylD7E3EI1XecmRcJ87aQXKQgZP61CDFoDK7+xFavMkG9I4WNZzr+GBq74kL1Tnytm/jAIR8YENzBn9kLxNuw9DxgqVGERqnaB2HaG/y/E/VwEq' +
                'K95PiWHhcrUnuFOoT3MkgbCx5kPfH0thGMw4Qlw5rGjSt/fXvzfYITEDhkowFMcgFKokY3Kr+lxuYA21TrrFdDlHZXQEA6PzCcIV8Lxx5iMqWLlH6YfwRXtM3xi0d73Ylwm165Bsb+BzCDwmgGDZC/7cQA5B+QN+KElIxuRL6bhyjsroCAZb+wYzDp4XSSsaWVCFYWnnKU665PT85sQ2T8p7z5XjDnRJfX/RhqM+lsJSg2EQ2FrWkE36oQIbTNMSkTq7dYclRPrdRuy5FA8VGD1lmmsehpEUwj8sq9cZEJrXE/4GLdRoNtCmBlay+8HcIhxaed2QlJbv0m28obFJNQ537aAjXk/Jy/05W2to9rkN4OrvpvTUxAQi/x8ahTLn+Wm4Xt7WqpR/biAHrvKPPzrQYjuBqTj+ZiTui3qtoae2gujdyFZge6eMxW8oHiowx5slekX6oI1bQXTgZCsws19ji/9+rgJUS8mvnAwF+AjOWTCK+YtGro/FjanMVcOIgDSWx2dtDrHzPKrh5w3XurtiAjJuorS/1QIPhyAYccudXKdUqbcSzoQWadh96DxWimGEeF62c59CC7pssHQeK/EtW2Dqwc5H' +
                'dqw19xKDaRwsa7fZ/s7bX/zNsY9MNRqDH3nAEsMWBYLwq62uYqdMt+GlgByC7wb8Z6IYRfLLI1dRFGZfXfBNnb9A/S10J4ZYoDk9P7cxg9oFpAnRkuOwF6n7KM8LQGX5JamiKUK/PXzbdeInA0Y+ArMm4QxatdBs55aOgpWmLea5c/OzY26tQt9XHTgZwwzl7lSbcinXy8USmSr9ZeLRRvjvTpBWsChktwQeE0Aw4ovALt0q2tUJZ5MrSvSK6V0Hb+b7e8bcR4Qjmqy3VfYWZkAaS+29uAfWSF6o04mvYwWkG8IgrbSxPXU7MriXKfIRmX5YS7MyICkdaDGTztocf/9atsDJn4GOFrvV4n9n46GlnTTuJdIzzZj4roU7VKLZbfcK+ssQXnl5XS6ZubukJY5De2dEM0F4AYb2zohmgvDr8JKjuzR70rzX+mLxjR1VrdnX0BHFVx4L0+Rxsb3/3qpsL4CO6v70XuV9MfbIgKT1D6R/8ET8oBrdycNR9bWV6nZkbTNS+SIAAAAAAAAAAIWQnxb1jr6mRilFc6rxLMwKVRK/Odt9Lnjb2Fcx3SbVKc++CGwta0ghi102WDoPmxUs0q36zXis' +
                'g6ORiOLHlbzDudplX3+Sap7LoBssHYnDB7X4UJ8vqep+6NbJJpQNzza2fhqvO27KhgeYWXAkJav7eEnf0xqzaUx8V8yTKlHi2WQTpg6KJ/8mPqVmxxWmcWxx/DRDdtyJSk9ZUoRjevja8xTpiyC88lcnaMFKuWaHEIjbfGguyLuIcHX5U3pqYi56RljzAsKiYZEW2+WCCE2ofd4BgybnCdzAGnecaZfo7cOcPax9UMimCjOhoHiowMGoK+RSs4uXP3Rr6hNKiOmiKMy+uv2aJ6vq2U4GjHwE9IlSsXgiflBc9Iyw+wSZWWAX4BVt5Iq9RDi08qc9NTGMUormSf9YhbUV75JN/Pt2DGYcIS6SVjS0kxlcxZp5hpzaUZoh0ZA+MpSBBbW+XC0ZSs6M1F8umEONTKI4Epzbm2+pyr7+OdSBsmAJ7wuMQd7R6/aRpY4VTm2mTZ7mSB9UsG+OzxP9iknYXh0ByeH1r8gmURwJTuP2mKMwde5nrVrHgi7sTbJDjdR8KMGZ2nWJ9oM32xzoks3ON8V8Id2jUwWX3lA8VGBqQvKqVD/3k11yen5zYhup4jKHUwdFnfFWoZ4Pwt/kd8Yd07TNnCJ9' +
                '5Yd/A5hqNBuUnrKkFcb07WIGEZRgKJNAY4DnWuhOEbCL53K21tDxb1CSkJHVls9t6GeV7D6e4N98+SdIK1gUMshqPhTuwm20cRnNp42swPbkAYnNEAy265KtvDoCj9/3sqAXwtLTUpwgDav40FyNazSnj5ui93c347RxnY8jHwFFvkI8L1u3wfceVf79iOVdaFMDK1nz7m5ls+nE/wc6qncqwzma5evsh4Ful/hCp1sRDi2y4EhKSzMSd8s92N7dvVEMrHnrn6U1IXlVKpH1x4qwqWhG4GptQ8foC0vwszoIybNUaxYe5TnxwjXrqZC+wb7yN2YGx7IsIJIzYUVpqusBUjtvwyialGlTq5Nazt0nKDj2PhM0DosEVeyhK6BSd6GyxJeP+KKlUSLKE+VAhiJ2E1hi0/HN243f3gi3bP5dHhLInkoXig5WgWsDlphn7l95lTMD7Vmv7XSLq3jXHW2Sny35PlPu9dio+Lp5jCr2GbFpjjnPa5Xdry90kQTi7CqcgOCIZCfOXI/YgluV6sTg2Zk6xgJxRpnDpRcwdvk9GxUfUKKfQp7VBeorx1lGNGZaz9x/S5hhsftTKSNC98chwAgOhkEw' +
                'hpPNFpb9e3SHJzGScTaxS9NEbIpjoXIbZpo16KZoDkrKtljyOVCaFqTl3k70Loq5N6dDXug/CNkTTmI54mx/loJ5Gjwt9nSIP27wCoMpFjyOWn5C/etlkVyq7kx5gd21GfI0eFrx6A0lXd3j7Zi9cFCJijKpnMysKMpFGdpOZlauWYgPTLMdIg2XmPo31tsmMvlo8LT/zRqgDwlkTyWFRfo61RdeJN5y9GxUfF2yRhVxPoD7/w9+IHhDzytz0qr6vRfqNq7fYrT9ERus0W+Sz0q6p9vHLWfgs0FrXa1J+tO8oxaySRSoixXRUAaK7PkU4nwd6+Me/EBP5Ix1m+2iI37c/RQbUix4TlBw8XwmaBzmlsrBWBXzvDXSpks7tIGngAz/Kf59/fYe2frD1bqksGwmY6ke9ZnRA8EZkTRAQ0H3rU3tafIFVM2dlkm2G9aryMO95+rbE2jRMYmfsCr7ZR0Y41Lh+ufx2jkjWu98psGhu/XgqO5PepE3eAXPmgseMThxYYC/jlvZ+DrL2zzlgAJ15RXTi4l+Ry0/IfD7vMYtlG63ho6jlbo8JI0hlC4J5yI2Rb/eOYP/ZP65AuQbscl3QWMNENlX' +
                'w8sXIrWNTsyieuxxnK4MO5n+y1GkjBX7FGWsgm0nMyvhvQR6116/AXn3M6+UGWDFZy7JbEGjxHXCf+umUkaE82Tv0P1144c07Z5gBAdDrhj7jimTue8UTThFPrEMYlqBaXhIB0I1XBJIz0LOFKbunhysH9YGMS3Oe4LWukeS6budFBx7H4caB1YWuA3BHEouuEnBmPIfp3d8qRgByNmlBrE0jkh+wnOtQbINHph7OkR0YKtVo8+744TmKANFdvIKG4fRbYl6YXMP4n3v5F1SWIPN5rjKPb63DCNkftAdERl6Nio+oFkjhLYfQPPxiT8QddRX0UQEcdxFWNo0I3A1uNymEWWH/CBDjZtn08mrJtArC1yI7g4lF2/nejgqtdqQJpzEctnY/jFjxB5G+qjLibervHcWQvUvfR3khS8SbzmoxrowJDOboGAFB9fO6IjIj+6Cxhogr65XokSJJteAEfyl5yg2pFjwByvOu49LTL1Je75K820koTyv6Zu3aVV9EvqevQWntanowEuqW4Nr20JzFI+sO3kFkIOEgShRwSHlV9NQbFWw/XL/mWrLTz1hPtoMjmTi3APwhoNW5rlJ6QTq1yq7Cw/8' +
                'F6S1E1lncGrjyOFvBNU2f/hPMAKNr1cMGEbI/L06IjJbgSD39sqRCNRvojHs6j6mM02UdFM0ByVYQDlmworSSb7W86eanyH1aMy0g6X+li3QhXUbV+ExWv7QAj3lL9GOSw5bXyDmrd8aMy3pbrGrTKPOEPV7ZcYEEI97qNYsPNerB6OhEHPY4WsNrRKRvtVs8vNmQzUywJcuVXcmss7g1AAAAAAAAAAAywKkdt6bUCnk4y/Ui556wnNLZe4shPdeblOGvM1+EK8BtPyE58vKP8/oc1xlkF/VNhO/2g/0wuYRO4csMef26C/hi6JVBSrr6XS3LrxIoeQKvFZBuJ2Xm7RqpeYiArZuROwmsMS7/4emkDtbJ6UDx39oAZD8meZHl6hKOqcajZzdEu3hYDfqfMVUJR3dDchOiMVMfZVr4xNNkWlgSGYrXbCAcsyZCbmStd5ZYsXJfFGBuAOtGbY3ybL1l9lKgjDsCwiqxV9WXaTxMn/SAXKD1q2YkZ54815jarlRlnZ1H1Mk6SFnClN3T7n9PRwV1G1IkvZhlPvaSF9aNdxzEQFbN97T9HBUd6k9wAoOs4HNDY27iNgJxl/kNhYQSZe+rLpV' +
                'IbcKyVaTsoxZ9MXiJUEYdtXbXrULIfSZVdehnPVcCW+pcka0w/hRn4VS1IeivTg1VGNdGBKXw1Ajwu/chRg78p9h+W7MDJN5U0iTo53cj+1e3wtZqgpUy6wsbRqfOJRc1667oNiqfecqv6AMCcXvKNhMxk889y+/IAP2TbFYeLOnJMffwG7J+AafMj9ogIaCzClqzVHQHJQFXiuuXMDFw2Jw4sIdYwG2O4QnIDgiGcDS8JAOhGq4JFL8byd6F0XSxpU8jOlNiw/gCfj+MJV1PmVbLHmSKE0LmEo31UNH38Tqta6/iAjipZo/0sCQzFa6nKDg//hM0DhMJZXkr63hYt9nCPSzvGMCv2IPI31U68qTQp0QHBGCYAl9T9CM3dTajC+bVy5g7O9winx/GMS0Hzow26Tf6dP/QAbxmn+w8Htfa/fdTcGe9B9tBkcycW6P+fvMhmpknTMwjI3lZ3REZIlxsPlyoCks1hpHJD9ht9jv64UR1MgnZpYctr5A0UejqrNfJfe4Et52FU5AcEQynVE9drZOVwaT80eax9L5Cqibiy5EdwechSl+uZ09haxpfjfmLfx9QMN3byWk7pOeW+BFyFDdj7Wt' +
                'hu1bpxH/GVLpHQvZz2FrNTfgqyVuQI/7lgf2wDECWnoLAvXhFtI8nfPYSGv7UGUMYhz/J8QIdfV9QMtx+l/TSm2qZhbaopBin181SSPshOLshHw9xQfDswJaNmgEPOIFqL+ebE2sCxn6gIvi6b67lLW5nFJ3x0+jeNm8lfA5e8zjMuUM260mJMdPzhKTMnl+Fyns6y6nCavC1rn2mVTR+F2JjL+6uFUahZp2+xfditsb6FiGNi9/tfZBP4/xNs2K0xEPpbu341wKL+7VFMxNEegwEO3Nfxq5oedd5V9C1YHu3kpVwTshtvL1U1/5ThSADMG0bRiIdh684V/bZSmROy0l6JdacYHCcYF/HOLXpVQuUsXLXFMSS/n3pr7vnCgdnnIufSHy9W7OFw2bgdyn5g6bggUctJQbHnEvYjxJ1zMh5Fz6Qvn33MuOen+Lug9gjpiDGgEPtkZHTM8NjolbI6mShVhPsnqVjMK1cgUzVENC1bjphO/zpQEtGzQCHnGMV6Ziaq50GAv/GfwG49gTEjW6nU1qfG3+ydRMF4+G7WVQZSPmoC5SiAN3LVwGIpOJiwH0/gtpHsD42r2K7YJZkUxOOuyYW2e+' +
                'sQ3wgn+/lqlqaSea1Pja4eeGidzT1f8ugS4aKx+lU9H7rZDW66DKGBrFQ7I0MQ45FgT33yy5eCemJBxpURifAnU1E8zqr3xeZPKln8hMTvokfSseSJ9fWttk1xirR0xIefSnofInCkAVc9qDKpvrrjSXhnloYhxyUUg40qIwIwTwr2U3/XL2hR0GAj46a0S6Z4WIw85u3XNmqJP3zHCs/9TSTim17anfOFYyFHDqamwHw0GMDlpKgyvLsi9WNbrNBLRs0Ah42QoG7lq4DEQ7DzshH0h2yPnlCVjDiRLu3pjRSznNv4sBWTl7KSBy9Bvgh8BAkxPhaN6tJumIR8qjn04UDIScZ4W71f9VHbfz2FOgykbRXVykDc1gIMeH/jRvhLdtzxXD+1fe/aD8oSHkzkuNe2CWAS09msZCrSmKLGQIddi9EPCvFLNXxup7g3SsTWMh2JpFFjLtqWcJxxmyP/dsJLvzKLwGxmLVJpEsCPI84l7EeJKzZrl4KD9vTzm9wIyPnp1oM/1PORewnnn0N1k94G+ywIwQ1oh4QbHRS9oZsm7uMhOdsLSUh2Z12T4vglk3dxmHwFiQ6ax4PUZhdfGCfgP/bIcJ' +
                'lF3AqDU+uH9FFvllirW5Jj+Vc5h+sCDvuFUzC21RSDEq5qkbVCvLQWMx5BPGFgR5QI+OgYDTEaDv81FhwyVQOtBmIvm9lXDViHbZog1LjUmlUzE1VzoMi+Fo02TfkcQh9BsJ5/UKL48SsJsPJMGhLdpJzCypWT3EH1w0Vj5Xpr9U0U82qFaLgq983+BD9kGa6momhclD+Lzl3L+01+kdK7J63d55nQUga0Q8rtbmq217rpHJ9hvoRT64aKx8rlFjEce2UyLjMqTSPBSRuamS0I+1mC4DEcfKcKxkKODJ1NiJW8KWD1X8xXZCPpDsje/Xb/BQft6ecmc9z0XweozC6kqgYFSUH1yxWBD7W7De/Zxe/qHjvJrGk27dS0rcgAPrdBgI+OixDdIUXsG3KIWaIii8n3NQFylEJwoGQk69zNOXKu30Mxwr9gWZd+QKZqiGJVAwKkqBLtbdio2gpwN3R8UV+HqXDpt7MCPqqWAaxXi346o6c/utpg+2mTEequWXAAAAAAAAAAAxDvGdYgS09CKTcaZE22RVDeyvWRqWB5JcpJeLuKYklhwrGQo4dTU2QaKVtYLNYCwyedzBZCYnfcGhlKqfdkJx' +
                'E52AOybf0KGuUcTUQegwFtgT+kStZd/BrAvyvEXU0hMjvmqSRsUV2UnXTQiSPc84nQUDISfQZucvf97/Xk1jx6R+KgFVJH0HmbFv8S+ov+1GYdQ5jJcqr9/Qu8ijP5VC3KeWlKUdBsuwIOu2faHnJboPBWNpbao05PGkgNX3bKfEOONOlRDq95OegSQ7ZPL8je+uRgctJc8sCPOjWG/wTtelY3WzzzpWIMlHzkDnhlBD+KPdhvGCKVaLeV6sammHgAMBHx27Il31NhLT9xReAxifddowDew8lXDbnDcgyfO7Ih5Xa3PbuHL2UkDk9TbdRDviUYiryKriH/442bNXqP1Dym7n5PEXyqNhS4mkfuz+NOcy4cZinoN0LEMbmbHUzzoWr4PC1mqq5agESZDpHCYnHXZMo71fkcS3TD9YEPl8bdBF+EGixn8a/Rn+YzFPyPlXI42YnOmnCQddUwbujlX8VAKqSPoOSPpWPJAjvrRl376rylI/dmyHfSLYvOHuzE0784XgReO+u2mzYRVzPhDqrWcg/UMots6xDnHl3Cq9zETvZzfgt1I/FY6kErCNmJx0xS22zmGb61mZK5Rd6Ios78oJd29M' +
                'o71rjVt+N4TrRz2xy12JMMP7osKbSqB0nCgYFSXOF2toMxHy0MQ45F/Tute+hLcf/G7RWuX6gJs2zbARbF7+dymRhEdSCVjIopBwuVlgRghTEg66pgzBAToMBHx01ohpaR4KxtLaSWhz20l05utHUXqDiv30BZnJWkrNM7TiH5lgRslPwDSX8OarkujRy46iM1TH9WY4VvHZPuFwr3uuTWFr0nvCKuZ8krOaEDl6g3CryLMwS46YkL+WcodjCwKyW2fWB7b8bhXQMcOXzlU/5ha6WwGwBrUlqJut5ilucMhqH1Jdd9NDW24QNXBXPfoLZg77Khf8lat2Mnqel2NL9kutnWRiRYv18YMMrtvD90jFyPVCZpEx/5UEShzcSLDLiSli3zz4uGawueII6TDBNaFPs/BhGnZ8jSYF8hwWATbWtxki/sxUnjcIlDilkH2LC12jjlgD1JxaW8yc6m88vO2uJG07c//l0rh+D94i7c5eVKuxyoGF7B3n+I/oBWG5rV4ahwE1oIwvKtvWZc7MdleAtaeC9YNYPtyKLu3kez/J2Vw1Br7nD4O+ER1sTgXupgO5CVk2dBAQPIG0gJ/eXSxptgJ9DHdK' +
                'OZCA19XIeVMJ1B4WSHQGtM3WOxgmUF5f+Z3C9JsCmOic0FQKlDy2f7yoS3+JHxfFcj0ds7eN8qZ4qm5x5ztPLhQz5pmgcWcNhPIb5FRiB4KY3zMntNIPL/BJ3OLTdp5c22xgGZZW63pkh0ayB4tHgzLNI1mNy63PHqSVW/DH2oXpoUNAG51Gtf2Spdm77CG4yBOMeQ4Ljhsu4AuabXulYvhXEriTt/H86yj+2AvqlJ1WSmXrikDqTGyZiOhHSigjRTWJixIdjy2r2MAyMazL9Loukcq5hny9eWC+Pe+OJjoMEal3YC/W8MtQ4a0WyTUn6uIulANf/YkoZtEvXeLOGv8bGEGrm/OQn5M53oz+DUOWRyfIxIoL91JFAsaqrlMcm5xe86wQtBNPovpJQqsypT8WWmLlURIrx0FI2nbm49eSSEDl5GSyp9NyrkPWl4TaIztyoQXhGoakigSRSUGmOLS2hSXJ3nhl3eq6rKbPgAIKl3PCULa9iMKE/7tevTOTi6DfRyyPak4q72y3TZUcMkJ5g3IqMY1Bc/fN/784m7IHTAr5OCwCbIpqDwskOgNab9rlPF+Ikx/Gi5iWflOKw0T/WccaqOY5' +
                '4vzgzkOekimiDN4kedjNQBnon6LI69jp9Ea7z/OYJwxDs1M+IoTkVdgvDc2OlFBGUQZvErJs6CDnOVeva8VCbQgezlpAwW+gOxk9T8W/q3t/5mSI3xdNQg6YFO9wWATYgTeshXw518axczJE4YWoIWlcP4lvEfhn9s8GV+Pv9SQaq/J20Clj1S2jZk51uR5eAom9mBB30iiQwf199BNgjzxVN7b9k6kXqhIQfjkZouAGhtq1MJlreNqmsFWe44Juw04v91YIWodtU1ikT/9BN/xYdZWzWUisfKUJXMfV9n77FH9si3VKwL/rJquR3az5aJbvxWekkXPKmjHhHnxcM7vkQYaxMxWpDdt5O2iav+RwtKArp/ogjuR6OntzB/lRjOzVvhSjaCLu7Um5I7FE2Rdwi024s9wxYIghnydl/tOz+o/c8fJ6CZELLTH8pgmbD1LEo3jtbcxQzL9eutmBNGvVghF/ZipPlM6aUNT92d8rJbz7RSB1JmfEK2YfSfy/SSQg/HIyWd0DQ23UGMK7PB9uRRf4crORoIVjvGmvH2jUPqS67ruGtgHK0EwItWkUrJTKywmAyZhUw9hzmjc4ZCb+xcAtusrC' +
                '3qnXeL4NOz4ED2ctIO65UOWw6jd7spBF8wqxNsu0JWBiAZwHNxIs++hrkwwTKC+hzBzrVC7lN0tTj9KKohs6CBthIjrYnArBNsJEdK0lFJ96I9Pp90ydBr4h9ueZaMXtz1+GgDYnjHf3BdYb61qcME0rR9FS3OCNX557/cI07Pgkd3hYPc0Y6oZ7pnxEFdWqTOGXnVppiZkAAAAAAAAAAOxk9CEzxpbxtXxVacFrEXHBx5JvRn+Ir2VNlv4PPi6XFfk21ajEDhm4pyxSqfGulalRfaoh2xncWNJxBPoY7pRZGKFI8q2HgFzdFina9lfEgnTBUWT7bPrR+xPbxuBW8n1v2RDPYJ9qtj84vdmpqk09n+f69SbAA3S7xwaHFJne32MHNLa4Uio60+0DzQrCb/reryCDwCPUwA1CI07K4buFOMuoXNdulsQCJQ5uJFjrR7w0EwJqXQWv16cfEUJypJeN94TMP2LjuW38HqFEx4Ehss85FZbIrjGOTo2VCRbzzpVWzD6S5WM4WlCb3X0QRzWBKaC156+j5vOH42NwK3ngdV1WU+lAAXvpA6X/+fQSErU8LJDoDHUzB/MVhX7E24+vuGoMYdMe' +
                '2eXdgYYhOVJ3+KrSn9Yi4iW9qBQ1eHH+dXEXSo+h8MoTf+xgmF1lYTBEnsGdvH/npUDU3UH0zyzcIGrgrnrpFluRHNDi2lWosjBfkPlHEx00S/nsvVLGt10XxmXSQz7QGCJP7sBesf2eWemShEtkV5pWjr+kpd0Ho8YOaHFtpFR+LLTE16IkVoexdjBMoLy+QTrupjLzNn2ZFeNrvGdmO0DwPuo6Rl9pHC0ow+CwCK1OaCoFSh5bsQXFt2EoW9BE4b+NGltcKRXywGF6wwFMdLf16PHRHMNZY8tMSz+nRe+dGoRGnInfa+M2MIJLK/s91fR09uYO76L1jGuD+y1OGEZ25F8K3zQRIHgfdR0jobq9Ypszgap+0a4dd1MZ9xuw/tHIDaMumoRVCQg/koJRcCmsAWNVV6cOp8lpRVGDHQSOZWgmBNS6ChH2UfiIKrdJ133JbvZ5PYrvJ5n1KwQtzUju8LB6hzDJIvGi7Q1Uc5JhQvHTL9CXx0pnTShq8OLhgP18yXSMvtJxfnBnr09JmpOCkKns0duziOOykzRN0XInNBWMJQ+j1g'); //==

        // Variables
        var sigma, N, h;

        // 64bit tools 
        function get8(x, i) {
            return (x[i >> 2] >> ((i & 3) << 3)) & 0xff;
        }

        // 512bit tools 
        function add512(x, y) {
            var CF = 0, w0, w1;
            for (var i = 0; i < 16; i++) {
                w0 = (x[i] & 0xffff) + (y[i] & 0xffff) + (CF || 0);
                w1 = (x[i] >>> 16) + (y[i] >>> 16) + (w0 >>> 16);
                x[i] = (w0 & 0xffff) | (w1 << 16);
                CF = (w1 >>> 16);
            }
        }

        function get512(d) {
            return new Int32Array(d.buffer, d.byteOffset, 16);
        }


        function copy512(r, d) {
            for (var i = 0; i < 16; i++)
                r[i] = d[i];
        }

        function new512() {
            return new Int32Array(16);
        }

        // Core private algorithms
        function xor512(x, y) {
            for (var i = 0; i < 16; i++)
                x[i] = x[i] ^ y[i];
        }


        var r = new512();
        function XLPS(x, y) {
            copy512(r, x);
            xor512(r, y);
            for (var i = 0; i < 8; i++) {
                var z0, z1, k = get8(r, i) << 1;
                z0 = Ax[k];
                z1 = Ax[k + 1];
                for (var j = 1; j < 8; j++) {
                    k = (j << 9) + (get8(r, (j << 3) + i) << 1);
                    z0 = z0 ^ Ax[k];
                    z1 = z1 ^ Ax[k + 1];
                }
                x[i << 1] = z0;
                x[(i << 1) + 1] = z1;
            }
        }

        var data = new512(), Ki = new512();
        function g(h, N, m)
        {
            var i;

            copy512(data, h);
            XLPS(data, N);

            /* Starting E() */
            copy512(Ki, data);
            XLPS(data, m);

            for (i = 0; i < 11; i++) {
                XLPS(Ki, C[i]);
                XLPS(data, Ki);
            }

            XLPS(Ki, C[11]);
            xor512(data, Ki);
            /* E() done */

            xor512(h, data);
            xor512(h, m);
        }

        // Stages
        function stage2(d) {
            var m = get512(d);
            g(h, N, m);

            add512(N, buffer512);
            add512(sigma, m);
        }

        function stage3(d) {
            var n = d.length;
            if (n > 63)
                return;

            var b0 = new Int32Array(16);
            b0[0] = n << 3;

            var b = new Uint8Array(64);
            for (var i = 0; i < n; i++)
                b[i] = d[i];
            b[n] = 0x01;

            var m = get512(b), m0 = get512(b0);
            g(h, N, m);

            add512(N, m0);
            add512(sigma, m);

            g(h, buffer0, N);
            g(h, buffer0, sigma);
        }

        return function (data) {

            // Cleanup 
            sigma = new512();
            N = new512();

            // Initial vector
            h = new512();
            for (var i = 0; i < 16; i++)
                if (this.bitLength === 256)
                    h[i] = 0x01010101;

            // Make data
            var d = new Uint8Array(buffer(data));

            var n = d.length;
            var r = n % 64, q = (n - r) / 64;

            for (var i = 0; i < q; i++)
                stage2.call(this, new Uint8Array(d.buffer, i * 64, 64));

            stage3.call(this, new Uint8Array(d.buffer, q * 64, r));

            var digest;
            if (this.bitLength === 256) {
                digest = new Int32Array(8);
                for (var i = 0; i < 8; i++)
                    digest[i] = h[8 + i];
            } else {
                digest = new Int32Array(16);
                for (var i = 0; i < 16; i++)
                    digest[i] = h[i];
            }
            // Swap hash for SignalCom
            if (this.procreator === 'SC' || this.procreator === 'VN')
                return swap(digest.buffer);
            else
                return digest.buffer;
        };
    }
    )();

    /**
     * Algorithm name GOST R 34.11-94<br><br>
     * 
     * http://tools.ietf.org/html/rfc5831
     * 
     * The digest method returns digest data in according to GOST R 34.11-94.
     * @memberOf GostDigest
     * @method digest
     * @instance
     * @param {(ArrayBuffer|TypedArray)} data Data
     * @returns {ArrayBuffer} Digest of data
     */
    var digest94 = (function ()
    {
        var C, H, M, Sum;

        // (i + 1 + 4(k - 1)) = 8i + k      i = 0-3, k = 1-8
        function P(d) {
            var K = new Uint8Array(32);

            for (var k = 0; k < 8; k++) {
                K[4 * k] = d[k];
                K[1 + 4 * k] = d[ 8 + k];
                K[2 + 4 * k] = d[16 + k];
                K[3 + 4 * k] = d[24 + k];
            }

            return K;
        }

        //A (x) = (x0 ^ x1) || x3 || x2 || x1
        function A(d)
        {
            var a = new Uint8Array(8);

            for (var j = 0; j < 8; j++)
            {
                a[j] = (d[j] ^ d[j + 8]);
            }

            arraycopy(d, 8, d, 0, 24);
            arraycopy(a, 0, d, 24, 8);

            return d;
        }

        // (in:) n16||..||n1 ==> (out:) n1^n2^n3^n4^n13^n16||n16||..||n2
        function fw(d) {
            var wS = new Uint16Array(d.buffer, 0, 16);
            var wS15 = wS[0] ^ wS[1] ^ wS[2] ^ wS[3] ^ wS[12] ^ wS[15];
            arraycopy(wS, 1, wS, 0, 15);
            wS[15] = wS15;
        }

        //Encrypt function, ECB mode
        function encrypt(key, s, sOff, d, dOff) {
            var t = new Uint8Array(8);
            arraycopy(d, dOff, t, 0, 8);
            var r = new Uint8Array(this.cipher.encrypt(key, t));
            arraycopy(r, 0, s, sOff, 8);
        }

        // block processing
        function process(d, dOff) {
            var S = new Uint8Array(32), U = new Uint8Array(32),
                    V = new Uint8Array(32), W = new Uint8Array(32);

            arraycopy(d, dOff, M, 0, 32);

            //key step 1

            // H = h3 || h2 || h1 || h0
            // S = s3 || s2 || s1 || s0
            arraycopy(H, 0, U, 0, 32);
            arraycopy(M, 0, V, 0, 32);
            for (var j = 0; j < 32; j++)
            {
                W[j] = (U[j] ^ V[j]);
            }
            // Encrypt GOST 28147-ECB
            encrypt.call(this, P(W), S, 0, H, 0); // s0 = EK0 [h0]

            //keys step 2,3,4
            for (var i = 1; i < 4; i++) {
                var tmpA = A(U);
                for (var j = 0; j < 32; j++) {
                    U[j] = (tmpA[j] ^ C[i][j]);
                }
                V = A(A(V));
                for (var j = 0; j < 32; j++) {
                    W[j] = (U[j] ^ V[j]);
                }
                // Encrypt GOST 28147-ECB
                encrypt.call(this, P(W), S, i * 8, H, i * 8); // si = EKi [hi]
            }

            // x(M, H) = y61(H^y(M^y12(S)))
            for (var n = 0; n < 12; n++) {
                fw(S);
            }
            for (var n = 0; n < 32; n++) {
                S[n] = (S[n] ^ M[n]);
            }

            fw(S);

            for (var n = 0; n < 32; n++) {
                S[n] = (H[n] ^ S[n]);
            }
            for (var n = 0; n < 61; n++) {
                fw(S);
            }
            arraycopy(S, 0, H, 0, H.length);
        }


        //  256 bitsblock modul -> (Sum + a mod (2^256))
        function summing(d)
        {
            var carry = 0;
            for (var i = 0; i < Sum.length; i++)
            {
                var sum = (Sum[i] & 0xff) + (d[i] & 0xff) + carry;

                Sum[i] = sum;

                carry = sum >>> 8;
            }
        }

        // reset the chaining variables to the IV values.
        var C2 = new Uint8Array([
            0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF,
            0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00,
            0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF,
            0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF
        ]);

        return function (data) {

            // Reset buffers
            H = new Uint8Array(32);
            M = new Uint8Array(32);
            Sum = new Uint8Array(32);

            // Reset IV value
            C = new Array(4);
            for (var i = 0; i < 4; i++)
                C[i] = new Uint8Array(32);
            arraycopy(C2, 0, C[2], 0, C2.length);

            // Make data
            var d = new Uint8Array(buffer(data));

            var n = d.length;
            var r = n % 32, q = (n - r) / 32;

            // Proccess full blocks 
            for (var i = 0; i < q; i++) {
                var b = new Uint8Array(d.buffer, i * 32, 32);

                summing.call(this, b); // calc sum M
                process.call(this, b, 0);
            }

            // load d the remadder with padding zero;
            if (r > 0) {
                var b = new Uint8Array(d.buffer, q * 32),
                        c = new Uint8Array(32);
                arraycopy(b, 0, c, 0, r);
                summing.call(this, c); // calc sum M
                process.call(this, c, 0);

            }

            // get length into L (byteCount * 8 = bitCount) in little endian.
            var L = new Uint8Array(32), n8 = n * 8, k = 0;
            while (n8 > 0) {
                L[k++] = n8 & 0xff;
                n8 = Math.floor(n8 / 256);
            }
            process.call(this, L, 0);
            process.call(this, Sum, 0);

            var h = H.buffer;

            // Swap hash for SignalCom
            if (this.procreator === 'SC')
                h = swap(h);

            return h;
        };

    }
    )();

    /**
     * Algorithm name SHA-1<br><br>
     * 
     * https://tools.ietf.org/html/rfc3174
     * 
     * The digest method returns digest data in according to SHA-1.<br>
     *  
     * @memberOf GostDigest
     * @method digest
     * @instance
     * @param {(ArrayBuffer|TypedArray)} data Data
     * @returns {ArrayBuffer} Digest of data
     */
    var digestSHA1 = (function ()
    {

        // Create a buffer for each 80 word block.
        var state, block = new Uint32Array(80);

        function common(a, e, w, k, f) {
            return (f + e + w + k + ((a << 5) | (a >>> 27))) >>> 0;
        }

        function f1(a, b, c, d, e, w) {
            return common(a, e, w, 0x5A827999, d ^ (b & (c ^ d)));
        }

        function f2(a, b, c, d, e, w) {
            return common(a, e, w, 0x6ED9EBA1, b ^ c ^ d);
        }

        function f3(a, b, c, d, e, w) {
            return common(a, e, w, 0x8F1BBCDC, (b & c) | (d & (b | c)));
        }

        function f4(a, b, c, d, e, w) {
            return common(a, e, w, 0xCA62C1D6, b ^ c ^ d);
        }

        function cycle(state, block) {
            var a = state[0],
                    b = state[1],
                    c = state[2],
                    d = state[3],
                    e = state[4];

            // Partially unroll loops so we don't have to shift variables.
            var fn = f1;
            for (var i = 0; i < 80; i += 5) {
                if (i === 20) {
                    fn = f2;
                }
                else if (i === 40) {
                    fn = f3;
                }
                else if (i === 60) {
                    fn = f4;
                }
                e = fn(a, b, c, d, e, block[i]);
                b = ((b << 30) | (b >>> 2)) >>> 0;
                d = fn(e, a, b, c, d, block[i + 1]);
                a = ((a << 30) | (a >>> 2)) >>> 0;
                c = fn(d, e, a, b, c, block[i + 2]);
                e = ((e << 30) | (e >>> 2)) >>> 0;
                b = fn(c, d, e, a, b, block[i + 3]);
                d = ((d << 30) | (d >>> 2)) >>> 0;
                a = fn(b, c, d, e, a, block[i + 4]);
                c = ((c << 30) | (c >>> 2)) >>> 0;
            }
            state[0] += a;
            state[1] += b;
            state[2] += c;
            state[3] += d;
            state[4] += e;
        }

        // Swap bytes for 32bits word
        function swap32(b) {
            return ((b & 0xff) << 24)
                    | ((b & 0xff00) << 8)
                    | ((b >> 8) & 0xff00)
                    | ((b >> 24) & 0xff);
        }

        // input is a Uint8Array bitstream of the data
        return function (data) {
            var d = new Uint8Array(buffer(data)), dlen = d.length;

            // Pad the input string length.
            var len = dlen + 9;
            if (len % 64) {
                len += 64 - (len % 64);
            }

            state = new Uint32Array(5);
            state[0] = 0x67452301;
            state[1] = 0xefcdab89;
            state[2] = 0x98badcfe;
            state[3] = 0x10325476;
            state[4] = 0xc3d2e1f0;

            for (var ofs = 0; ofs < len; ofs += 64) {

                // Copy input to block and write padding as needed
                for (var i = 0; i < 64; i++) {
                    var b = 0,
                            o = ofs + i;
                    if (o < dlen) {
                        b = d[o];
                    }
                    else if (o === dlen) {
                        b = 0x80;
                    }
                    else {
                        // Write original bit length as a 64bit big-endian integer to the end.
                        var x = len - o - 1;
                        if (x >= 0 && x < 4) {
                            b = (dlen << 3 >>> (x * 8)) & 0xff;
                        }
                    }

                    // Interpret the input bytes as big-endian per the spec
                    if (i % 4 === 0) {
                        block[i >> 2] = b << 24;
                    }
                    else {
                        block[i >> 2] |= b << ((3 - (i % 4)) * 8);
                    }
                }

                // Extend the block
                for (var i = 16; i < 80; i++) {
                    var w = block[i - 3] ^ block[i - 8] ^ block[i - 14] ^ block[i - 16];
                    block[i] = (w << 1) | (w >>> 31);
                }

                cycle(state, block);

            }

            // Swap the bytes around since they are big endian internally
            for (var i = 0; i < 5; i++)
                state[i] = swap32(state[i]);
            return state.buffer;
        };

    }
    )();

    /** 
     * Algorithm name GOST R 34.11-HMAC<br><br>
     * 
     * HMAC with the specified hash function.
     * @memberOf GostDigest
     * @method sign
     * @instance
     * @param {ArrayBuffer} key The key for HMAC.
     * @param {Hash} data Data
     */
    function signHMAC(key, data)
    {
        // GOST R 34.11-94 - B=32b, L=32b
        // GOST R 34.11-256 - B=64b, L=32b
        // GOST R 34.11-512 - B=64b, L=64b
        var b = (this.digest === digest94) ? 32 : 64,
                l = this.bitLength / 8,
                k = buffer(key),
                d = buffer(data), k0;
        if (k.byteLength === b)
            k0 = new Uint8Array(k);
        else {
            var k0 = new Uint8Array(b);
            if (k.byteLength > b) {
                k0.set(new Uint8Array(this.digest(k)));
            } else {
                k0.set(new Uint8Array(k));
            }
        }
        var s0 = new Uint8Array(b + d.byteLength),
                s1 = new Uint8Array(b + l);
        for (var i = 0; i < b; i++) {
            s0[i] = k0[i] ^ 0x36;
            s1[i] = k0[i] ^ 0x5C;
        }
        s0.set(new Uint8Array(d), b);
        s1.set(new Uint8Array(this.digest(s0)), b);
        return this.digest(s1);
    }

    /**
     * Algorithm name GOST R 34.11-HMAC<br><br>
     * 
     * Verify HMAC based on GOST R 34.11 hash
     * 
     * @memberOf GostDigest
     * @method verify
     * @instance
     * @param {(ArrayBuffer|TypedArray)} key Key which used for HMAC generation
     * @param {(ArrayBuffer|TypedArray)} signature generated HMAC
     * @param {(ArrayBuffer|TypedArray)} data Data
     * @returns {boolean} HMAC verified = true
     */
    function verifyHMAC(key, signature, data)
    {
        var hmac = new Uint8Array(this.sign(key, data)),
                test = new Uint8Array(signature);
        if (hmac.length !== test.length)
            return false;
        for (var i = 0, n = hmac.length; i < n; i++)
            if (hmac[i] !== test[i])
                return false;
        return true;
    }


    /**
     * Algorithm name GOST R 34.11-KDF<br><br>
     * 
     * Simple generate key 256/512 bit random seed for derivation algorithms
     * 
     * @memberOf GostDigest
     * @method generateKey
     * @instance
     * @returns {ArrayBuffer} Generated key
     */
    function generateKey()
    {
        return getSeed(this.bitLength).buffer;
    }

    /**
     * Algorithm name GOST R 34.11-PFXKDF<br><br>
     * 
     * Derive bits from password (PKCS12 mode)
     *  <ul>
     *      <li>algorithm.salt - random value, salt</li>
     *      <li>algorithm.iterations - number of iterations</li>
     *  </ul>
     * @memberOf GostDigest
     * @method deriveBits
     * @instance
     * @param {ArrayBuffer} baseKey - password after UTF-8 decoding
     * @param {number} length output bit-length
     * @returns {ArrayBuffer} result
     */
    function deriveBitsPFXKDF(baseKey, length)
    {
        if (length % 8 > 0)
            throw new DataError('Length must multiple of 8');
        var u = this.bitLength / 8, v = (this.digest === digest94) ? 32 : 64,
                n = length / 8, r = this.iterations;
        //   1.  Construct a string, D (the "diversifier"), by concatenating v/8
        //       copies of ID.
        var ID = this.diversifier, D = new Uint8Array(v);
        for (var i = 0; i < v; i++)
            D[i] = ID;
        //   2.  Concatenate copies of the salt together to create a string S of
        //       length v(ceiling(s/v)) bits (the final copy of the salt may be
        //       truncated to create S).  Note that if the salt is the empty
        //       string, then so is S.
        var S0 = new Uint8Array(buffer(this.salt)), s = S0.length,
                slen = v * Math.ceil(s / v), S = new Uint8Array(slen);
        for (var i = 0; i < slen; i++)
            S[i] = S0[i % s];
        //   3.  Concatenate copies of the password together to create a string P
        //       of length v(ceiling(p/v)) bits (the final copy of the password
        //       may be truncated to create P).  Note that if the password is the
        //       empty string, then so is P.
        var P0 = new Uint8Array(buffer(baseKey)), p = P0.length,
                plen = v * Math.ceil(p / v), P = new Uint8Array(plen);
        for (var i = 0; i < plen; i++)
            P[i] = P0[i % p];
        //   4.  Set I=S||P to be the concatenation of S and P.
        var I = new Uint8Array(slen + plen);
        arraycopy(S, 0, I, 0, slen);
        arraycopy(P, 0, I, slen, plen);
        //   5.  Set c=ceiling(n/u).
        var c = Math.ceil(n / u);
        //   6.  For i=1, 2, ..., c, do the following:
        var A = new Uint8Array(c * u);
        for (var i = 0; i < c; i++) {
            //  A.  Set A2=H^r(D||I). (i.e., the r-th hash of D||1,
            //      H(H(H(... H(D||I))))
            var H = new Uint8Array(v + slen + plen);
            arraycopy(D, 0, H, 0, v);
            arraycopy(I, 0, H, v, slen + plen);
            for (var j = 0; j < r; j++)
                H = new Uint8Array(this.digest(H));
            arraycopy(H, 0, A, i * u, u);
            //  B.  Concatenate copies of Ai to create a string B of length v
            //      bits (the final copy of Ai may be truncated to create B).
            var B = new Uint8Array(v);
            for (var j = 0; j < v; j++)
                B[j] = H[j % u];
            //  C.  Treating I as a concatenation I_0, I_1, ..., I_(k-1) of v-bit
            //      blocks, where k=ceiling(s/v)+ceiling(p/v), modify I by
            //      setting I_j=(I_j+B+1) mod 2^v for each j.
            var k = (slen + plen) / v;
            for (j = 0; j < k; j++) {
                var cf = 1, w;
                for (var l = v - 1; l >= 0; --l) {
                    w = I[v * j + l] + B[l] + cf;
                    cf = w >>> 8;
                    I[v * j + l] = w & 0xff;
                }
            }
        }
        //   7.  Concatenate A_1, A_2, ..., A_c together to form a pseudorandom
        //       bit string, A.
        //   8.  Use the first n bits of A as the output of this entire process.
        var R = new Uint8Array(n);
        arraycopy(A, 0, R, 0, n);
        return R.buffer;
    }

    /**
     * Algorithm name GOST R 34.11-KDF<br><br>
     * 
     * Derive bits for KEK deversification in 34.10-2012 algorithm
     * KDF(KEK, UKM, label) = HMAC256 (KEK,  0x01|label|0x00|UKM|0x01|0x00) 
     * Default label = 0x26|0xBD|0xB8|0x78 
     * 
     * @memberOf GostDigest
     * @method deriveBits
     * @instance
     * @param {(ArrayBuffer|TypedArray)} baseKey base key for deriviation
     * @param {number} length output bit-length 
     * @returns {ArrayBuffer} result
     */
    function deriveBitsKDF(baseKey, length)
    {
        if (length % 8 > 0)
            throw new DataError('Length must be multiple of 8');
        var rlen = length / 8, label, context = new Uint8Array(buffer(this.context)),
                blen = this.bitLength / 8, n = Math.ceil(rlen / blen);
        if (this.label)
            label = new Uint8Array(buffer(this.label));
        else
            label = new Uint8Array([0x26, 0xBD, 0xB8, 0x78]);
        var result = new Uint8Array(rlen);
        for (var i = 0; i < n; i++) {
            var data = new Uint8Array(label.length + context.length + 4);
            data[0] = i + 1;
            data.set(label, 1);
            data[label.length + 1] = 0x00;
            data.set(context, label.length + 2);
            data[data.length - 2] = length >>> 8;
            data[data.length - 1] = length & 0xff;
            result.set(new Uint8Array(signHMAC.call(this, baseKey, data), 0,
                    i < n - 1 ? blen : rlen - i * blen), i * blen);
        }
        return result.buffer;
    }

    /**
     * Algorithm name GOST R 34.11-PBKDF1<br><br>
     * 
     * Derive bits from password
     *  <ul>
     *      <li>algorithm.salt - random value, salt</li>
     *      <li>algorithm.iterations - number of iterations</li>
     *  </ul>
     * @memberOf GostDigest
     * @method deriveBits
     * @instance
     * @param {ArrayBuffer} baseKey - password after UTF-8 decoding
     * @param {number} length output bit-length
     * @returns {ArrayBuffer} result
     */
    function deriveBitsPBKDF1(baseKey, length)
    {
        if (length < this.bitLength / 2 || length % 8 > 0)
            throw new DataError('Length must be more than ' + this.bitLength / 2 + ' bits and multiple of 8');
        var hLen = this.bitLength / 8, dkLen = length / 8,
                c = this.iterations,
                P = new Uint8Array(buffer(baseKey)),
                S = new Uint8Array(buffer(this.salt)),
                slen = S.length, plen = P.length,
                T = new Uint8Array(plen + slen),
                DK = new Uint8Array(dkLen);
        if (dkLen > hLen)
            throw new DataError('Invalid parameters: Length value');
        arraycopy(P, 0, T, 0, plen);
        arraycopy(S, 0, T, plen, slen);
        for (var i = 0; i < c; i++)
            T = new Uint8Array(this.digest(T));
        arraycopy(T, 0, DK, 0, dkLen);
        return DK.buffer;
    }

    /**
     * Algorithm name GOST R 34.11-PBKDF2<br><br>
     * 
     * Derive bits from password
     *  <ul>
     *      <li>algorithm.salt - random value, salt</li>
     *      <li>algorithm.iterations - number of iterations</li>
     *  </ul>
     * @memberOf GostDigest
     * @method deriveBits
     * @instance
     * @param {ArrayBuffer} baseKey - password after UTF-8 decoding
     * @param {number} length output bit-length
     * @returns {ArrayBuffer} result
     */
    function deriveBitsPBKDF2(baseKey, length)
    {
        var diversifier = this.diversifier || 1; // For PKCS12 MAC required 3*length
        length = length * diversifier;
        if (length < this.bitLength / 2 || length % 8 > 0)
            throw new DataError('Length must be more than ' + this.bitLength / 2 + ' bits and multiple of 8');
        var hLen = this.bitLength / 8, dkLen = length / 8,
                c = this.iterations,
                P = new Uint8Array(buffer(baseKey)),
                S = new Uint8Array(buffer(this.salt));
        var slen = S.byteLength,
                data = new Uint8Array(slen + 4);
        arraycopy(S, 0, data, 0, slen);

        if (dkLen > (0xffffffff - 1) * 32)
            throw new DataError('Invalid parameters: Length value');
        var n = Math.ceil(dkLen / hLen),
                DK = new Uint8Array(dkLen);
        for (var i = 1; i <= n; i++) {
            data[slen] = i >>> 24 & 0xff;
            data[slen + 1] = i >>> 16 & 0xff;
            data[slen + 2] = i >>> 8 & 0xff;
            data[slen + 3] = i & 0xff;

            var U = new Uint8Array(signHMAC.call(this, P, data)), Z = U;
            for (var j = 1; j < c; j++) {
                U = new Uint8Array(signHMAC.call(this, P, U));
                for (var k = 0; k < hLen; k++)
                    Z[k] = U[k] ^ Z[k];
            }
            var ofs = (i - 1) * hLen;
            arraycopy(Z, 0, DK, ofs, Math.min(hLen, dkLen - ofs));
        }
        if (diversifier > 1) {
            var rLen = dkLen / diversifier, R = new Uint8Array(rLen);
            arraycopy(DK, dkLen - rLen, R, 0, rLen);
            return R.buffer;
        } else
            return DK.buffer;
    }

    /**
     * Algorithm name GOST R 34.11-CPKDF<br><br>
     * 
     * Derive bits from password. CryptoPro algorithm
     *  <ul>
     *      <li>algorithm.salt - random value, salt</li>
     *      <li>algorithm.iterations - number of iterations</li>
     *  </ul>
     * @memberOf GostDigest
     * @method deriveBits
     * @instance
     * @param {ArrayBuffer} baseKey - password after UTF-8 decoding
     * @param {number} length output bit-length
     * @returns {ArrayBuffer} result
     */
    function deriveBitsCP(baseKey, length) {
        if (length > this.bitLength || length % 8 > 0)
            throw new DataError('Length can\'t be more than ' + this.bitLength + ' bits and multiple of 8');
        // GOST R 34.11-94 - B=32b, L=32b
        // GOST R 34.11-256 - B=64b, L=32b
        // GOST R 34.11-512 - B=64b, L=64b
        var b = (this.digest === digest94) ? 32 : 64,
                l = this.bitLength / 8,
                p = baseKey && baseKey.byteLength > 0 ? new Uint8Array(buffer(baseKey)) : false,
                plen = p ? p.length : 0,
                iterations = this.iterations,
                salt = new Uint8Array(buffer(this.salt)),
                slen = salt.length,
                d = new Uint8Array(slen + plen);
        arraycopy(salt, 0, d, 0, slen);
        if (p)
            arraycopy(p, 0, d, slen, plen);

        var h = new Uint8Array(this.digest(d)),
                k = new Uint8Array(b),
                s0 = new Uint8Array(b),
                s1 = new Uint8Array(b);
        var c = 'DENEFH028.760246785.IUEFHWUIO.EF';
        for (var i = 0; i < c.length; i++)
            k[i] = c.charCodeAt(i);

        d = new Uint8Array(2 * (b + l));
        for (var j = 0; j < iterations; j++) {
            for (var i = 0; i < b; i++) {
                s0[i] = k[i] ^ 0x36;
                s1[i] = k[i] ^ 0x5C;
                k[i] = 0;
            }
            arraycopy(s0, 0, d, 0, b);
            arraycopy(h, 0, d, b, l);
            arraycopy(s1, 0, d, b + l, b);
            arraycopy(h, 0, d, b + l + b, l);
            arraycopy(new Uint8Array(this.digest(d)), 0, k, 0, l);
        }
        for (var i = 0; i < l; i++) {
            s0[i] = k[i] ^ 0x36;
            s1[i] = k[i] ^ 0x5C;
            k[i] = 0;
        }
        d = new Uint8Array(2 * l + slen + plen);
        arraycopy(s0, 0, d, 0, l);
        arraycopy(salt, 0, d, l, slen);
        arraycopy(s1, 0, d, l + slen, l);
        if (p)
            arraycopy(p, 0, d, l + slen + l, plen);
        h = this.digest(this.digest(d));
        if (length === this.bitLength)
            return h;
        else {
            var rlen = length / 8, r = new Uint8Array(rlen);
            arraycopy(h, 0, r, 0, rlen);
            return r.buffer;
        }
    }

    /**
     * Algorithm name GOST R 34.11-KDF or GOST R 34.11-PBKDF2 or other<br><br>
     * 
     * Derive key from derive bits subset
     * 
     * @memberOf GostDigest
     * @method deriveKey
     * @instance
     * @param {ArrayBuffer} baseKey
     * @returns {ArrayBuffer}
     */
    function deriveKey(baseKey)
    {
        return this.deriveBits(baseKey, this.keySize * 8);
    }

    /**
     * GOST R 34.11 Algorithm<br><br>
     * 
     * References: {@link http://tools.ietf.org/html/rfc6986} and {@link http://tools.ietf.org/html/rfc5831}<br><br>
     * 
     * Normalized algorithm identifier common parameters:
     * 
     *  <ul>
     *      <li><b>name</b> Algorithm name 'GOST R 34.11'</li>
     *      <li><b>version</b> Algorithm version
     *          <ul>
     *              <li><b>1994</b> old-style 256 bits digest based on GOST 28147-89</li>
     *              <li><b>2012</b> 256 ro 512 bits digest algorithm "Streebog" GOST R 34.11-2012 (default)</li>
     *          </ul>
     *      </li>
     *      <li><b>length</b> Digest length
     *          <ul>
     *              <li><b>256</b> 256 bits digest</li>
     *              <li><b>512</b> 512 bits digest, valid only for algorithm "Streebog"</li>
     *          </ul>
     *      </li>
     *      <li><b>mode</b> Algorithm mode
     *          <ul>
     *              <li><b>HASH</b> simple digest mode (default)</li>
     *              <li><b>HMAC</b> HMAC algorithm based on GOST R 34.11</li>
     *              <li><b>KDF</b> Derive bits for KEK deversification</li>
     *              <li><b>PBKDF2</b> Password based key dirivation algorithms PBKDF2 (based on HMAC)</li>
     *              <li><b>PFXKDF</b> Password based PFX key dirivation algorithms</li>
     *              <li><b>CPKDF</b> CpyptoPro Password based key dirivation algorithms</li>
     *          </ul>
     *      </li>
     *      <li><b>sBox</b> Paramset sBox for GOST 28147-89. Used only if version = 1994</li>
     *  </ul>
     * 
     * Supported algorithms, modes and parameters:
     * 
     *  <ul>
     *      <li>Digest HASH mode (default)</li>
     *      <li>Sign/Verify HMAC modes parameters depends on version and length
     *          <ul>
     *              <li><b>version: 1994</b> HMAC parameters (B = 32, L = 32)</li>
     *              <li><b>version: 2012, length: 256</b> HMAC parameters (B = 64, L = 32)</li>
     *              <li><b>version: 2012, length: 512</b> HMAC parameters  (B = 64, L = 64)</li>
     *          </ul>
     *      </li>
     *      <li>DeriveBits/DeriveKey KDF mode
     *          <ul>
     *              <li><b>context</b> {@link CryptoOperationData} Context of the key derivation</li>
     *              <li><b>label</b> {@link CryptoOperationData} Label that identifies the purpose for the derived keying material</li>
     *          </ul>
     *      </li>
     *      <li>DeriveBits/DeriveKey PBKDF2 mode
     *          <ul>
     *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
     *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
     *              <li><b>diversifier</b> Deversifier, ID=1 - key material for performing encryption or decryption, ID=3 - integrity key for MACing</li>
     *          </ul>
     *      </li>
     *      <li>DeriveBits/DeriveKey PFXKDF mode
     *          <ul>
     *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
     *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
     *              <li><b>diversifier</b> Deversifier, ID=1 - key material for performing encryption or decryption, 
     *              ID=2 - IV (Initial Value) for encryption or decryption, ID=3 - integrity key for MACing</li>
     *          </ul>
     *      </li>
     *      <li>DeriveBits/DeriveKey CPKDF mode
     *          <ul>
     *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
     *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
     *          </ul>
     *      </li>
     *  </ul>
     * 
     * @class GostDigest
     * @param {AlgorithmIdentifier} algorithm WebCryptoAPI algorithm identifier
     */
    function GostDigest(algorithm)
    {

        algorithm = algorithm || {};

        this.name = (algorithm.name || 'GOST R 34.10') + '-' + ((algorithm.version || 2012) % 100) +
                ((algorithm.version || 2012) > 1 ? '-' + (algorithm.length || 256) : '') +
                (((algorithm.mode || 'HASH') !== 'HASH') ? '-' + algorithm.mode : '') +
                (algorithm.procreator ? '/' + algorithm.procreator : '') +
                (typeof algorithm.sBox === 'string' ? '/' + algorithm.sBox : '');

        // Algorithm procreator
        this.procreator = algorithm.procreator;

        // Bit length
        this.bitLength = algorithm.length || 256;

        switch (algorithm.version || 2012) {
            case 1: // SHA-1
                this.digest = digestSHA1;
                this.bitLength = 160;
                break;
            case 1994:
                this.digest = digest94;
                // Define chiper algorithm
                this.sBox = (algorithm.sBox || (algorithm.procreator === 'SC' ? 'D-SC' : 'D-A')).toUpperCase();

                if (!GostCipher)
                    throw new NotSupportedError('Object GostCipher not found');

                this.cipher = new GostCipher({
                    name: 'GOST 28147',
                    block: 'ECB',
                    sBox: this.sBox,
                    procreator: this.procreator
                });

                break;
            case 2012:
                this.digest = digest2012;
                break;
            default:
                throw new NotSupportedError('Algorithm version ' + algorithm.version + ' not supported');
        }

        // Key size
        this.keySize = algorithm.keySize || (algorithm.version <= 2 ? this.bitLength / 8 : 32);

        switch (algorithm.mode || 'HASH') {
            case 'HASH':
                break;
            case 'HMAC':
                this.sign = signHMAC;
                this.verify = verifyHMAC;
                this.generateKey = generateKey;
                break;
            case 'KDF':
                this.deriveKey = deriveKey;
                this.deriveBits = deriveBitsKDF;
                this.label = algorithm.label;
                this.context = algorithm.context;
                break;
            case 'PBKDF2':
                this.deriveKey = deriveKey;
                this.deriveBits = deriveBitsPBKDF2;
                this.generateKey = generateKey;
                this.salt = algorithm.salt;
                this.iterations = algorithm.iterations || 2000;
                this.diversifier = algorithm.diversifier || 1;
                break;
            case 'PFXKDF':
                this.deriveKey = deriveKey;
                this.deriveBits = deriveBitsPFXKDF;
                this.generateKey = generateKey;
                this.salt = algorithm.salt;
                this.iterations = algorithm.iterations || 2000;
                this.diversifier = algorithm.diversifier || 1;
                break;
            case 'CPKDF':
                this.deriveKey = deriveKey;
                this.deriveBits = deriveBitsCP;
                this.generateKey = generateKey;
                this.salt = algorithm.salt;
                this.iterations = algorithm.iterations || 2000;
                break;
            default:
                throw new NotSupportedError('Algorithm mode ' + algorithm.mode + ' not supported');
        }
    }

module.exports = GostDigest;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostEngine.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostEngine.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file GOST 34.10-2012 signature function with 1024/512 bits digest
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

//const GostRandom = require('./gostRandom');
const GostCipher = __webpack_require__(/*! ./gostCipher */ "./node_modules/node-gost-crypto/lib/gostCipher.js");
const GostDigest = __webpack_require__(/*! ./gostDigest */ "./node_modules/node-gost-crypto/lib/gostDigest.js");
const GostSign = __webpack_require__(/*! ./gostSign */ "./node_modules/node-gost-crypto/lib/gostSign.js");

    /*
     * Engine definition base on normalized algorithm identifier
     * 
     */

    var root = __webpack_require__.g;

    // Define engine
    function defineEngine(method, algorithm) {
        if (!algorithm)
            throw new (root.SyntaxError || Error)('Algorithm not defined');

        if (!algorithm.name)
            throw new (root.SyntaxError || Error)('Algorithm name not defined');

        var name = algorithm.name, mode = algorithm.mode;
        if ((name === 'GOST 28147' || name === 'GOST R 34.12' || name === 'RC2') && (method === 'generateKey' ||
                (mode === 'MAC' && (method === 'sign' || method === 'verify')) ||
                ((mode === 'KW' || mode === 'MASK') && (method === 'wrapKey' || method === 'unwrapKey')) ||
                ((!mode || mode === 'ES') && (method === 'encrypt' || method === 'decrypt')))) {
            return 'GostCipher';

        } else if ((name === 'GOST R 34.11' || name === 'SHA') && (method === 'digest' ||
                (mode === 'HMAC' && (method === 'sign' || method === 'verify' || method === 'generateKey')) ||
                ((mode === 'KDF' || mode === 'PBKDF2' || mode === 'PFXKDF' || mode === 'CPKDF') &&
                        (method === 'deriveKey' || method === 'deriveBits' || method === 'generateKey')))) {
            return 'GostDigest';

        } else if (name === 'GOST R 34.10' && (method === 'generateKey' ||
                ((!mode || mode === 'SIGN') && (method === 'sign' || method === 'verify')) ||
                (mode === 'MASK' && (method === 'wrapKey' || method === 'unwrapKey')) ||
                (mode === 'DH' && (method === 'deriveKey' || method === 'deriveBits')))) {
            return 'GostSign';
        } else
            throw new (root.NotSupportedError || Error)('Algorithm ' + name + '-' + mode + ' is not valid for ' + method);
    }

    /**
     * Object implements dedicated Web Workers and provide a simple way to create 
     * and run GOST cryptographic algorithms in background thread. 
     * 
     * Object provide interface to GOST low-level cryptogric classes:
     *  <ul>
     *      <li>GostCipher - implementation of GOST 28147, GOST R 34.12, GOST R 34.13 Encryption algorithms. Reference {@link http://tools.ietf.org/html/rfc5830}</li>
     *      <li>GostDigest - implementation of GOST R 34.11 Hash Function algorithms. References {@link http://tools.ietf.org/html/rfc5831} and {@link http://tools.ietf.org/html/rfc6986}</li>
     *      <li>GostSign - implementation of GOST R 34.10 Digital Signature algorithms. References {@link http://tools.ietf.org/html/rfc5832} and {@link http://tools.ietf.org/html/rfc7091}</li>
     *  </ul>
     * @namespace gostEngine
     */
    var gostEngine = {
        /**
         * gostEngine.execute(algorithm, method, args) Entry point to execution 
         * all low-level GOST cryptographic methods
         * 
         *  <ul>
         *      <li>Determine the appropriate engine for a given execution method</li>
         *      <li>Create cipher object for determineted engine</li>
         *      <li>Execute method of cipher with given args</li>
         *  </ul>
         * 
         * @memberOf gostEngine
         * @param {AlgorithmIndentifier} algorithm Algorithm identifier
         * @param {string} method Crypto method for execution
         * @param {Array} args Method arguments (keys, data, additional parameters)
         * @returns {(CryptoOperationData|Key|KeyPair|boolean)} Result of method execution
         */
        execute: function (algorithm, method, args)
        {
            // Define engine for GOST algorithms
            var engine = defineEngine(method, algorithm);
            // Create cipher 
            var cipher = this['get' + engine](algorithm);
            // Execute method
            return cipher[method].apply(cipher, args);
        },
        /**
         * gostEngine.getGostCipher(algorithm) returns GOST 28147 / GOST R 34.12 cipher instance<br><br>
         * 
         * GOST 28147-89 / GOST R 34.12-15 Encryption Algorithm<br><br> 
         * When keys and initialization vectors are converted to/from byte arrays, 
         * little-endian byte order is assumed.<br><br>
         * 
         * Normalized algorithm identifier common parameters:
         * 
         *  <ul>
         *      <li><b>name</b> Algorithm name 'GOST 28147' or 'GOST R 34.12'</li>
         *      <li><b>version</b> Algorithm version, number
         *          <ul>
         *              <li><b>1989</b> Current version of standard</li>
         *              <li><b>2015</b> New draft version of standard</li>
         *          </ul>
         *      </li>
         *      <li><b>length</b> Block length
         *          <ul>
         *              <li><b>64</b> 64 bits length (default)</li>
         *              <li><b>128</b> 128 bits length (only for version 2015)</li>
         *          </ul>
         *      </li>
         *      <li><b>mode</b> Algorithm mode, string
         *          <ul>
         *              <li><b>ES</b> Encryption mode (default)</li>
         *              <li><b>MAC</b> "imitovstavka" (MAC) mode</li>
         *              <li><b>KW</b> Key wrapping mode</li>
         *              <li><b>MASK</b> Key mask mode</li>
         *          </ul>
         *      </li>
         *      <li><b>sBox</b> Paramset sBox for GOST 28147-89, string. Used only if version = 1989</li>
         *  </ul>
         *  
         * Supported algorithms, modes and parameters:
         * 
         *  <ul>
         *      <li>Encript/Decrypt mode (ES)
         *          <ul>
         *              <li><b>block</b> Block mode, string. Default ECB</li>
         *              <li><b>keyMeshing</b> Key meshing mode, string. Default NO</li>
         *              <li><b>padding</b> Padding mode, string. Default NO for CFB and CTR modes, or ZERO for others</li>
         *              <li><b>iv</b> {@link CryptoOperationData} Initial vector with length of block. Default - zero block</li>
         *          </ul>
         *      </li>
         *      <li>Sign/Verify mode (MAC)
         *          <ul>
         *              <li><b>macLength</b> Length of mac in bits (default - 32 bits)</li>
         *              <li><b>iv</b> {@link CryptoOperationData} Initial vector with length of block. Default - zero block</li>
         *          </ul>
         *      </li>
         *      <li>Wrap/Unwrap key mode (KW)
         *          <ul>
         *              <li><b>keyWrapping</b> Mode of keywrapping, string. Default NO - standard GOST key wrapping</li>
         *              <li><b>ukm</b> {@link CryptoOperationData} User key material. Default - random generated value</li>
         *          </ul>
         *      </li>
         *      <li>Wrap/Unwrap key mode (MASK)</li>
         *  </ul>
         *      
         * Supported paramters values:
         *      
         *  <ul>
         *      <li>Block modes (parameter 'block')
         *          <ul>
         *              <li><b>ECB</b> "prostaya zamena" (ECB) mode (default)</li>
         *              <li><b>CFB</b> "gammirovanie s obratnoj svyaziyu" (64-bit CFB) mode</li>
         *              <li><b>CTR</b> "gammirovanie" (counter) mode</li>
         *              <li><b>CBC</b> Cipher-Block-Chaining (CBC) mode</li>
         *          </ul>
         *      </li>
         *      <li>Key meshing modes (parameter 'keyMeshing')
         *          <ul>
         *              <li><b>NO</b> No key wrapping (default)</li>
         *              <li><b>CP</b> CryptoPor Key key meshing</li>
         *          </ul>
         *      </li>
         *      <li>Padding modes (parameter 'padding')
         *          <ul>
         *              <li><b>NO</b> No padding only for CFB and CTR modes</li>
         *              <li><b>PKCS5</b> PKCS#5 padding mode</li>
         *              <li><b>ZERO</b> Zero bits padding mode</li>
         *              <li><b>RANDOM</b> Random bits padding mode</li>
         *          </ul>
         *      </li>
         *      <li>Wrapping key modes (parameter 'keyWrapping')
         *          <ul>
         *              <li><b>NO</b> Ref. rfc4357 6.1 GOST 28147-89 Key wrapping</li>
         *              <li><b>CP</b> CryptoPro Key wrapping mode</li>
         *              <li><b>SC</b> SignalCom Key wrapping mode</li>
         *          </ul>
         *      </li>
         *  </ul>
         * 
         * @memberOf gostEngine
         * @param {AlgorithmIndentifier} algorithm Algorithm identifier
         * @returns {GostCipher} Instance of GostCipher
         */
        getGostCipher: function (algorithm)
        {
            return new GostCipher(algorithm);
        },
        /**
         * gostEngine.getGostDigest(algorithm) returns GOST R 34.11 cipher instance<br><br>
         * 
         * Normalized algorithm identifier common parameters:
         * 
         *  <ul>
         *      <li><b>name</b> Algorithm name 'GOST R 34.11'</li>
         *      <li><b>version</b> Algorithm version
         *          <ul>
         *              <li><b>1994</b> old-style 256 bits digest based on GOST 28147-89</li>
         *              <li><b>2012</b> 256 ro 512 bits digest algorithm "Streebog" GOST R 34.11-2012 (default)</li>
         *          </ul>
         *      </li>
         *      <li><b>length</b> Digest length
         *          <ul>
         *              <li><b>256</b> 256 bits digest</li>
         *              <li><b>512</b> 512 bits digest, valid only for algorithm "Streebog"</li>
         *          </ul>
         *      </li>
         *      <li><b>mode</b> Algorithm mode
         *          <ul>
         *              <li><b>HASH</b> simple digest mode (default)</li>
         *              <li><b>HMAC</b> HMAC algorithm based on GOST R 34.11</li>
         *              <li><b>KDF</b> Derive bits for KEK deversification</li>
         *              <li><b>PBKDF2</b> Password based key dirivation algorithms PBKDF2 (based on HMAC)</li>
         *              <li><b>PFXKDF</b> PFX key dirivation algorithms PFXKDF</li>
         *              <li><b>CPKDF</b> CryptoPro Password based key dirivation algorithms</li>
         *          </ul>
         *      </li>
         *      <li><b>sBox</b> Paramset sBox for GOST 28147-89. Used only if version = 1994</li>
         *  </ul>
         * 
         * Supported algorithms, modes and parameters:
         * 
         *  <ul>
         *      <li>Digest HASH mode (default)</li>
         *      <li>Sign/Verify HMAC modes parameters depends on version and length
         *          <ul>
         *              <li><b>version: 1994</b> HMAC parameters (B = 32, L = 32)</li>
         *              <li><b>version: 2012, length: 256</b> HMAC parameters (B = 64, L = 32)</li>
         *              <li><b>version: 2012, length: 512</b> HMAC parameters  (B = 64, L = 64)</li>
         *          </ul>
         *      </li>
         *      <li>DeriveBits/DeriveKey KDF mode
         *          <ul>
         *              <li><b>context</b> {@link CryptoOperationData} Context of the key derivation</li>
         *              <li><b>label</b> {@link CryptoOperationData} Label that identifies the purpose for the derived keying material</li>
         *          </ul>
         *      </li>
         *      <li>DeriveBits/DeriveKey PBKDF2 mode
         *          <ul>
         *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
         *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
         *          </ul>
         *      </li>
         *      <li>DeriveBits/DeriveKey PFXKDF mode
         *          <ul>
         *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
         *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
         *              <li><b>diversifier</b> Deversifier, ID=1 - key material for performing encryption or decryption, 
         *              ID=2 - IV (Initial Value) for encryption or decryption, ID=3 - integrity key for MACing</li>
         *          </ul>
         *      </li>
         *      <li>DeriveBits/DeriveKey CPKDF mode
         *          <ul>
         *              <li><b>salt</b> {@link CryptoOperationData} Random salt as input for HMAC algorithm</li>
         *              <li><b>iterations</b> Iteration count. GOST recomended value 1000 (default) or 2000</li>
         *          </ul>
         *      </li>
         *  </ul>
         * 
         * @memberOf gostEngine
         * @param {AlgorithmIndentifier} algorithm Algorithm identifier
         * @returns {GostDigest} Instance of GostDigest
         */
        getGostDigest: function (algorithm)
        {
            return new GostDigest(algorithm);
        },
        /**
         * gostEngine.getGostSign(algorithm) returns GOST R 34.10 cipher instance<br><br>
         * 
         * Normalized algorithm identifier common parameters:
         * 
         *  <ul>
         *      <li><b>name</b> Algorithm name 'GOST R 34.10'</li>
         *      <li><b>version</b> Algorithm version
         *          <ul>
         *              <li><b>1994</b> - Old-style GOST R 34.10-94 ExpMod algorithm with GOST R 34.11-94 hash</li>
         *              <li><b>2001</b> - GOST R 34.10-2001 Eliptic curve algorithm with old GOST R 34.11-94 hash</li>
         *              <li><b>2012</b> - GOST R 34.10-2012 Eliptic curve algorithm with GOST R 34.11-12 hash, default mode</li>
         *          </ul>
         *      </li>
         *      <li><b>length</b> Length of hash and signature. Key length == hash length for EC algorithms and 2 * hash length for ExpMod algorithm
         *          <ul>
         *              <li><b>GOST R 34.10-256</b> - 256 bits digest, default mode</li>
         *              <li><b>GOST R 34.10-512</b> - 512 bits digest only for GOST R 34.11-2012 hash</li>
         *          </ul>
         *      </li>
         *      <li><b>mode</b> Algorithm mode
         *          <ul>
         *              <li><b>SIGN</b> Digital signature mode (default)</li>
         *              <li><b>DH</b> Diffie-Hellman key generation and key agreement mode</li>
         *              <li><b>MASK</b> Key mask mode</li>
         *          </ul>
         *      </li>
         *      <li><b>sBox</b> Paramset sBox for GOST 34.11-94. Used only if version = 1994 or 2001</li>
         *  </ul>
         *  
         * Supported algorithms, modes and parameters:
         * 
         *  <ul>
         *      <li>Sign/Verify mode (SIGN)</li>
         *      <li>Wrap/Unwrap mode (MASK)</li>
         *      <li>DeriveKey/DeriveBits mode (DH)
         *          <ul>
         *              <li>{@link CryptoOperationData} <b>ukm</b> User key material. Default - random generated value</li>
         *              <li>{@link CryptoOperationData} <b>public</b> The peer's EC public key data</li>
         *          </ul>
         *      </li>
         *      <li>GenerateKey mode (SIGN and DH and MASK) version = 1994
         *          <ul>
         *              <li><b>namedParam</b> Paramset for key generation algorithm. If specified no additianal parameters required</li>
         *          </ul>
         *          Additional parameters, if namedParam not specified
         *          <ul>
         *              <li><b>modulusLength</b> Bit length of p (512 or 1024 bits). Default = 1024</li>
         *              <li><b>p</b> {@link CryptoOperationData} Modulus, prime number, 2^(t-1)<p<2^t</li>
         *              <li><b>q</b> {@link CryptoOperationData} Order of cyclic group, prime number, 2^254<q<2^256, q is a factor of p-1</li>
         *              <li><b>a</b> {@link CryptoOperationData} Generator, integer, 1<a<p-1, at that aq (mod p) = 1</li>
         *          </ul>
         *      </li>
         *      <li>GenerateKey mode (SIGN and DH and MASK) version = 2001 or 2012
         *          <ul>
         *              <li><b>namedCurve</b> Paramset for key generation algorithm. If specified no additianal parameters required</li>
         *          </ul>
         *          Additional EC parameters, if namedCurve not specified
         *          <ul>
         *              <li><b>p</b> {@link CryptoOperationData} Prime number - elliptic curve modulus</li>
         *              <li><b>a</b> {@link CryptoOperationData} Coefficients a of the elliptic curve E</li>
         *              <li><b>b</b> {@link CryptoOperationData} Coefficients b of the elliptic curve E</li>
         *              <li><b>q</b> {@link CryptoOperationData} Prime number - order of cyclic group</li>
         *              <li><b>x</b> {@link CryptoOperationData} Base point p x-coordinate</li>
         *              <li><b>y</b> {@link CryptoOperationData} Base point p y-coordinate</li>
         *          </ul>
         *      </li>
         *  </ul>
         *  
         * @memberOf gostEngine
         * @param {AlgorithmIndentifier} algorithm Algorithm identifier
         * @returns {GostSign} Instance of GostSign
         */
        getGostSign: function (algorithm)
        {
            return new GostSign(algorithm);
        }
    };

module.exports = gostEngine;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostKeys.js":
/*!*******************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostKeys.js ***!
  \*******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/** 
 * @file Key and Certificate Store methods
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");
// const GostASN1 = require('./gostASN1');
// const GostCert = require('./gostCert');
// const GostCMS = require('./gostCMS');

    /*
     * Common tools and methods
     */

    var root = __webpack_require__.g;
    var Promise = root.Promise;
    var Object = root.Object;
    var CryptoOperationData = root.ArrayBuffer;
    var Date = root.Date;

    var subtle = gostCrypto.subtle;
    var asn1 = gostCrypto.asn1;
    var coding = gostCrypto.coding;
    var providers = gostCrypto.security.providers;
    var cert = gostCrypto.cert;
    var cms = gostCrypto.cms;

    // Expand javascript object
    function expand() {
        var r = {};
        for (var i = 0, n = arguments.length; i < n; i++) {
            var item = arguments[i];
            if (typeof item === 'object')
                for (var name in item)
                    if (item.hasOwnProperty(name))
                        r[name] = item[name];
        }
        return r;
    }

    function defineProperty(object, name, descriptor, enumerable) {
        if (typeof descriptor !== 'object')
            descriptor = {value: descriptor};
        if (enumerable !== undefined)
            descriptor.enumerable = enumerable;
        Object.defineProperty(object, name, descriptor);
    }

    function defineProperties(object, properties, enumerable) {
        for (var name in properties)
            defineProperty(object, name, properties[name], enumerable);
    }

    // Extend javascript class
    function extend(Super, Class, propertiesObject, propertiesClass) {
        // If constructor not defined
        if (typeof Class !== 'function') {
            propertiesClass = propertiesObject;
            propertiesObject = Class;
            Class = function () {
                Super.apply(this, arguments);
            };
        }
        // Create prototype properties
        Class.prototype = Object.create(Super.prototype, {
            constructor: {
                value: Class
            },
            superclass: {
                value: Super.prototype
            }
        });
        if (propertiesObject)
            defineProperties(Class.prototype, propertiesObject, true);
        // Inherites super class properties
        if (Super !== Object)
            for (var name in Super)
                Class[name] = Super[name];
        Class.super = Super;
        if (propertiesClass)
            defineProperties(Class, propertiesClass, true);
        return Class;
    }

    // Get random values
    function getSeed(length) {
        var seed = new Uint8Array(length);
        gostCrypto.getRandomValues(seed);
        return seed.buffer;
    }

    // Self resolver
    function call(callback) {
        try {
            callback();
        } catch (e) {
        }
    }


    // Get buffer
    function buffer(d) {
        if (d instanceof CryptoOperationData)
            return d;
        else if (d && d.buffer && d.buffer instanceof CryptoOperationData)
            return d.byteOffset === 0 && d.byteLength === d.buffer.byteLength ?
                    d.buffer : new Uint8Array(new Uint8Array(d, d.byteOffset, d.byteLength)).buffer;
        else
            throw new DataError('CryptoOperationData required');
    }
    // Today date + n days with time
    function now(n) {
        var date = new Date();
        if (n)
            date.setDate(date.getDate() + n);
        return date;
    }

    // Today date + n days
    function today(n) {
        var date = now(n);
        date.setHours(0, 0, 0, 0);
        return date;
    }

    // Check the buffers to equal
    function equalBuffers(r1, r2) {
        var s1 = new Uint8Array(r1),
                s2 = new Uint8Array(r2);
        if (s1.length !== s2.length)
            return false;
        for (var i = 0, n = s1.length; i < n; i++)
            if (s1[i] !== s2[i])
                return false;
        return true;
    }

    // Generate new alias
    function generateUUID() {
        var r = new Uint8Array(getSeed(16)), s = '';
        for (var i = 0; i < 16; i++)
            s += ('00' + r[i].toString(16)).slice(-2);
        return s.substr(0, 8) + '-' + s.substr(8, 4) + '-4' + s.substr(13, 3) +
                '-9' + s.substr(17, 3) + '-' + s.substr(20, 12);
    }

    // Return get32 from buffer
    function get32(buffer, offset) {
        var r = new Uint8Array(buffer, offset, 4);
        return (r[3] << 24) | (r[2] << 16) | (r[1] << 8) | r[0];
    }

    function set32(buffer, offset, int) {
        var r = new Uint8Array(buffer, offset, 4);
        r[3] = int >>> 24;
        r[2] = int >>> 16 & 0xff;
        r[1] = int >>> 8 & 0xff;
        r[0] = int & 0xff;
        return r;
    }

    // Salt size
    function saltSize(algorithm) {
        switch (algorithm.id) {
            case 'pbeWithSHAAnd40BitRC2-CBC':
            case 'pbeWithSHAAnd128BitRC2-CBC':
                return 8;
            case 'pbeUnknownGost':
                return 16;
            case 'sha1':
                return 20;
            default:
                return 32;
        }
    }

    // Password to bytes
    function passwordData(derivation, password) {
        if (!password)
            return new CryptoOperationData(0);
        if (derivation.name.indexOf('CPKDF') >= 0) {
            // CryptoPro store password
            var r = [];
            for (var i = 0; i < password.length; i++) {
                var c = password.charCodeAt(i);
                r.push(c & 0xff);
                r.push(c >>> 8 & 0xff);
                r.push(0);
                r.push(0);
            }
            return new Uint8Array(r).buffer;
        } else if (derivation.name.indexOf('PFXKDF') >= 0)
            // PKCS#12 unicode password
            return coding.Chars.decode(password + '\0', 'unicode');
        else
            // PKCS#5 password mode
            return coding.Chars.decode(password, 'utf8');
    }



    /**
     * Key and Certificate Store methods
     * 
     * @class GostKeys
     */
    function GostKeys() {
    }

    /**
     * Key templates
     * <ul>
     *      <li>providerName - provider name for key encryption, default 'CP-01'</li>
     *      <li>days - validity of the key in days, default 7305</li>
     * </ul>
     * 
     * @memberOf GostKeys
     * @instance
     */
    var options = {
        providerName: 'CP-01',
        days: 7305
    };

    GostKeys.prototype.options = options;

    /**
     * A class for private keys in PKCS #8 format
     * 
     * @class GostKeys.PKCS8
     * @extends GostASN1.PrivateKeyInfo
     * @param {(FormatedData|GostASN1.PrivateKeyInfo)} keyInfo
     */
    function PKCS8(keyInfo) {
        asn1.PrivateKeyInfo.call(this, keyInfo);
    }

    extend(asn1.PrivateKeyInfo, PKCS8, {
        /**
         * Get the private key
         * 
         * @memberOf GostKeys.PKCS8
         * @instance
         * @returns {Promise} Promise to return the {@link Key}
         */
        getPrivateKey: function ()
        {
            var keyUsages = (this.privateKeyAlgorithm.id === 'rsaEncryption') ? ['sign'] :
                    ['sign', 'deriveKey', 'deriveBits'];
            return subtle.importKey('pkcs8', this.encode(), this.privateKeyAlgorithm, 'true', keyUsages);
        },
        /**
         * Set the private key
         * 
         * @memberOf GostKeys.PKCS8
         * @instance
         * @param {Key} privateKey The Private Key
         * @returns {Promise} Promise to return the self object after set the key
         */
        setPrivateKey: function (privateKey)
        {
            var self = __webpack_require__.g;
            return subtle.exportKey('pkcs8', privateKey).then(function (keyInfo) {
                asn1.PrivateKeyInfo.call(self, keyInfo);
                return self;
            });
        },
        /**
         * Generate private key and return certification request
         * 
         * @memberOf GostKeys.PKCS8
         * @instance
         * @param {(FormatedData|GostASN1.CertificationRequest)} req The request templates
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm identifier
         * @returns {Promise} Promise to return the {@link GostCert.Request} after key generation
         */
        generate: function (req, keyAlgorithm)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                if (!(req instanceof cert.Request))
                    req = new cert.Request(req);
                // Generate request
                return req.generate(keyAlgorithm);
            }).then(function (key) {
                asn1.PrivateKeyInfo.call(self, key);
                ;
                return req;
            });
        }
    });

    /**
     * A class for private keys in PKCS #8 format
     * 
     * @memberOf GostKeys
     * @type GostKeys.PKCS8
     */
    GostKeys.prototype.PKCS8 = PKCS8;

    /**
     * A class for PKCS #5 and PKCS #12 password-encrypted private keys in PKCS #8 format
     * 
     * @class GostKeys.PKCS8Encrypted
     * @extends GostASN1.EncryptedPrivateKeyInfo
     * @param {(FormatedData|GostASN1.EncryptedPrivateKeyInfo)} encryptedKey
     */
    function PKCS8Encrypted(encryptedKey) {
        asn1.EncryptedPrivateKeyInfo.call(this, encryptedKey);
    }

    extend(asn1.EncryptedPrivateKeyInfo, PKCS8Encrypted, {
        /**
         * Get the private key info
         * 
         * @memberOf GostKeys.PKCS8Encrypted
         * @instance
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @returns {Promise} Promise to return decrypted {@link GostKeys.PKCS8}
         */
        getKey: function (keyPassword)
        {
            var self = this, engine;
            return new Promise(call).then(function () {
                engine = new cms.EncryptedDataContentInfo({
                    contentType: 'encryptedData',
                    version: 0,
                    encryptedContentInfo: {
                        contentType: 'data',
                        contentEncryptionAlgorithm: self.encryptionAlgorithm,
                        encryptedContent: self.encryptedData
                    }
                });
                return engine.getEnclosed(keyPassword);
            }).then(function (contentInfo) {
                // Create key object
                return PKCS8.decode(contentInfo.content);
            });
        },
        /**
         * Get the private key
         * 
         * @memberOf GostKeys.PKCS8Encrypted
         * @instance
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @returns {Promise} Promise to return decrypted {@link Key}
         */
        getPrivateKey: function (keyPassword)
        {
            return this.getKey(keyPassword).then(function (keyInfo) {
                return keyInfo.getPrivateKey();
            });
        },
        /**
         * Sets and encrypt the private key info
         * 
         * @memberOf GostKeys.PKCS8Encrypted
         * @instance
         * @param {(FormatedData|GostKeys.PKCS8)} keyInfo The private key info 
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for encryption
         * @param {(AlgorithmIdentifier|string)} encryptionAlgorithm The encryption algorithm or provider name
         * @returns {Promise} Promise to return self object after set key 
         */
        setKey: function (keyInfo, keyPassword, encryptionAlgorithm)
        {
            var self = this, engine;
            return new Promise(call).then(function () {
                keyInfo = new PKCS8(keyInfo);
                engine = new cms.EncryptedDataContentInfo();
                return engine.encloseContent(keyInfo.encode(), keyPassword, encryptionAlgorithm || options.providerName);
            }).then(function () {
                self.encryptionAlgorithm = engine.encryptedContentInfo.contentEncryptionAlgorithm;
                self.encryptedData = engine.encryptedContentInfo.encryptedContent;
                return self;
            });
        },
        /**
         * Set the private key
         * 
         * @memberOf GostKeys.PKCS8Encrypted
         * @instance
         * @param {Key} privateKey The private key
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @param {(AlgorithmIdentifier|string)} encryptionAlgorithm The encryption algorithm or provider name
         * @returns {Promise} Promise to return self object after set key 
         */
        setPrivateKey: function (privateKey, keyPassword, encryptionAlgorithm)
        {
            var self = __webpack_require__.g;
            return new PKCS8().setPrivateKey(privateKey).then(function (keyInfo) {
                return self.setKey(keyInfo, keyPassword, encryptionAlgorithm);
            });
        },
        /**
         * Generate private key and return certification request
         * 
         * @memberOf GostKeys.PKCS8Encrypted
         * @instance
         * @param {(FormatedData|GostASN1.CertificationRequest)} req The request templates
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm
         * @param {(AlgorithmIdentifier|string)} encryptionAlgorithm The encryption algorithm or provider name
         * @returns {Promise} Promise to return {@link GostCert.Request}
         */
        generate: function (req, keyPassword, keyAlgorithm, encryptionAlgorithm)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                if (!(req instanceof cert.Request))
                    req = new cert.Request(req);
                // Generate request
                return req.generate(keyAlgorithm);
            }).then(function (key) {
                return self.setKey(key, keyPassword, encryptionAlgorithm);
            }).then(function () {
                return req;
            });
        }
    });

    /**
     * A class for PKCS #5 and PKCS #12 password-encrypted private keys in PKCS #8 format
     * 
     * @memberOf GostKeys
     * @type GostKeys.PKCS8Encrypted
     */
    GostKeys.prototype.PKCS8Encrypted = PKCS8Encrypted;

    /**
     * A class for password-encrypted private keys in SignalCom container<br><br>
     * 
     * The container file list:
     * <ul>
     *      <li>mk.db3 - master key data</li>
     *      <li>masks.db3 - encrypted or decrypted masks</li>
     *      <li>kek.opq - wrapped key encryption key</li>
     *      <li>rand.opq - wrapped random data</li>
     * </ul>
     * 
     * @class GostKeys.SignalComKeyContainer
     * @param {SignalComKeyContainer} container 
     */
    function SignalComKeyContainer(container)
    {
        if (container) {
            var self = __webpack_require__.g;
            ['mk.db3', 'masks.db3', 'kek.opq', 'rand.opq'].forEach(function (name) {
                self[name] = container[name];
            });
        }
    }

    extend(Object, SignalComKeyContainer, {
        /**
         * Get password-based encryption key
         * 
         * @memberOf GostKeys.SignalComKeyContainer
         * @instance
         * @param {string} keyPassword 
         * @returns {Promise} Promise to return {@link Key}
         */
        getEncryptionKey: function (keyPassword)
        {
            var self = this, wrapping = providers['SC-01'].wrapping,
                    encryption = providers['SC-01'].encryption,
                    derivation = providers['SC-01'].derivation,
                    masks = self['masks.db3'], mk = self['mk.db3'], kek = self['kek.opq'];
            // Decrypt key
            return new Promise(call).then(function () {
                if ((!masks || !mk || !kek))
                    throw new Error('Not enougth key container files');
                // Check for encrypted key
                if (masks.byteLength > 32) {
                    if (keyPassword) {
                        // Extract password based encryption mask
                        return subtle.importKey('raw', coding.Chars.decode(keyPassword, 'utf8'),
                                derivation, false, ['deriveKey', 'deriveBits']).then(function (integrityKey) {
                            return subtle.deriveKey(expand(derivation,
                                    {salt: new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])}),
                                    integrityKey, encryption, false, ['decrypt']);
                        }).then(function (encryptionKey) {
                            var encrypted = new cms.EncryptedDataContentInfo(masks);
                            return encrypted.getEnclosed(encryptionKey);
                        }).then(function (digested) {
                            return digested.verify();
                        }).then(function (data) {
                            return data.content;
                        });
                    } else
                        throw new Error('Key password is required');
                } else if (keyPassword)
                    throw new Error('Key password is not required');
                return masks;
            }).then(function (decrypedMasks) {
                // Combine masks
                masks = decrypedMasks;
                var mkm = new Uint8Array(mk.byteLength + masks.byteLength);
                mkm.set(new Uint8Array(mk), 0);
                mkm.set(new Uint8Array(masks), mk.byteLength);
                // Import master key
                return subtle.importKey('raw', mkm.buffer, wrapping, false, ['unwrapKey']);
            }).then(function (unwrappingKey) {
                // Unwrap kek
                return subtle.unwrapKey('raw', kek, unwrappingKey, wrapping, encryption,
                        false, ['wrapKey', 'unwrapKey']);
            });
        },
        /**
         * Generate encryption key and container files
         * 
         * @memberOf GostKeys.SignalComKeyContainer
         * @instance
         * @param {string} keyPassword
         * @returns {Promise} Promise to return {@link Key}
         */
        generateContainer: function (keyPassword)
        {
            var self = this, wrapping = providers['SC-01'].wrapping,
                    encryption = providers['SC-01'].encryption,
                    derivation = providers['SC-01'].derivation,
                    digest = providers['SC-01'].digest,
                    encryptionKey, wrappingKey;
            return new Promise(call).then(function () {
                // Generate wrapping key
                return subtle.generateKey(wrapping, true, ['wrapKey']);
            }).then(function (key) {
                wrappingKey = key;
                // Split masks
                var len = wrappingKey.buffer.byteLength;
                self['mk.db3'] = new Uint8Array(new Uint8Array(wrappingKey.buffer, 0, len - 32)).buffer;
                var masks = new Uint8Array(new Uint8Array(wrappingKey.buffer, len - 32, 32)).buffer;
                if (keyPassword) {
                    // Encrypt masks
                    var encrypted = new cms.EncryptedDataContentInfo(),
                            digested = new cms.DigestedDataContentInfo();
                    // Digest data
                    return digested.encloseContent(masks, digest).then(function () {
                        digested = {// Double wrapping - SignalCom mistake
                            contentType: 'digestedData',
                            content: digested.encode()
                        };
                        return subtle.importKey('raw', coding.Chars.decode(keyPassword, 'utf8'),
                                derivation, false, ['deriveKey', 'deriveBits']);
                    }).then(function (integrityKey) {
                        return subtle.deriveKey(expand(derivation,
                                {salt: new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])}),
                                integrityKey, encryption, false, ['encrypt']);
                    }).then(function (encryptionKey) {
                        // Encrypt data with password
                        return encrypted.encloseContent(digested, encryptionKey, encryption);
                    }).then(function () {
                        return encrypted.encode();
                    });
                }
                return masks;
            }).then(function (masks) {
                self['masks.db3'] = masks;
                // Generate encryption key
                return subtle.generateKey(encryption, false, ['wrapKey', 'unwrapKey']);
            }).then(function (key) {
                encryptionKey = key;
                // Wrap encryption key
                return subtle.wrapKey('raw', key, wrappingKey, wrapping);
            }).then(function (data) {
                self['kek.opq'] = data;
                // Generate random seed
                return subtle.generateKey(encryption, false, ['wrapKey', 'unwrapKey']);
            }).then(function (key) {
                // Wrap random seed
                return subtle.wrapKey('raw', key, wrappingKey, wrapping);
            }).then(function (data) {
                self['rand.opq'] = data;
                return encryptionKey;
            });
        }
    });

    /**
     * A class for password-encrypted private keys in SignalCom container
     * 
     * @memberOf GostKeys
     * @type GostKeys.SignalComKeyContainer
     */
    GostKeys.prototype.SignalComKeyContainer = SignalComKeyContainer;

    /**
     * A class for password-encrypted SignalCom private keys
     * 
     * @class GostKeys.SignalComPrivateKeyInfo
     * @extends GostASN1.GostWrappedPrivateKey
     * @extends GostKeys.SignalComKeyContainer
     * @param {GostASN1.PrivateKeyInfo} keyInfo 
     * @param {GostKeys.SignalComKeyContainer} container 
     */
    function SignalComPrivateKeyInfo(keyInfo, container)
    {
        asn1.GostWrappedPrivateKey.call(this, keyInfo);
        SignalComKeyContainer.call(this, container);
    }

    extend(asn1.GostWrappedPrivateKey, SignalComPrivateKeyInfo, {
        /**
         * Get the private key info
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @param {string} keyPassword The password for decryption 
         * @returns {Promise} Promise to return {@link GostKeys.PKCS8}
         */
        getKey: function (keyPassword)
        {
            return this.getPrivateKey(keyPassword).then(function (privateKey) {
                return new PKCS8().setPrivateKey(privateKey);
            });
        },
        /**
         * Get the private key
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @instance
         * @param {string} keyPassword The password for decryption 
         * @returns {Promise} Promise to return the {@link Key}
         */
        getPrivateKey: function (keyPassword)
        {
            var self = this, wrapping = providers['SC-01'].wrapping,
                    publicKeyData;
            // Decrypt key
            return new Promise(call).then(function () {
                // Get password key
                return self.getEncryptionKey(keyPassword, true);
            }).then(function (encryptionKey) {
                // Unwrap private key
                return subtle.unwrapKey('raw', self.privateKeyWrapped, encryptionKey, wrapping,
                        self.privateKeyAlgorithm, true, ['sign', 'deriveKey', 'deriveBits']);
            }).then(function (privateKey) {
                publicKeyData = self.attributes && self.attributes['id-sc-gostR3410-2001-publicKey'];
                // Generate key pair
                if (publicKeyData)
                    return subtle.generateKey(expand(privateKey.algorithm, {ukm: privateKey.buffer}),
                            privateKey.extractable, privateKey.usages);
                else
                    return {privateKey: privateKey};
            }).then(function (keyPair) {
                // Compare public key
                if (publicKeyData && !equalBuffers(keyPair.publicKey.buffer, publicKeyData))
                    throw new Error('Check public key failed');
                return keyPair.privateKey;
            });
        },
        /**
         * Sets and encrypt the private key info
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @instance
         * @param {(FormatedData|GostKeys.PKCS8)} keyInfo The private key info 
         * @param {string} keyPassword The password for encryption
         * @returns {Promise} Promise to return self object after set the key
         */
        setKey: function (keyInfo, keyPassword)
        {
            var self = __webpack_require__.g;
            return new PKCS8(keyInfo).getPrivateKey().then(function (privateKey) {
                return self.setPrivateKey(privateKey, keyPassword);
            });
        },
        /**
         * Set the private key
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @instance
         * @param {Key} privateKey The private key
         * @param {string} keyPassword The secret key encryption 
         * @returns {Promise} Promise to return self object after set the key
         */
        setPrivateKey: function (privateKey, keyPassword)
        {
            var self = this, wrapping = providers['SC-01'].wrapping, wrappedData;
            return new Promise(call).then(function () {
                // Get or generate encryption key
                return self.getEncryptionKey(keyPassword)['catch'](function () {
                    return self.generateContainer(keyPassword);
                });
            }).then(function (encryptionKey) {
                // Encrypt key buffer
                return subtle.wrapKey('raw', privateKey, encryptionKey, wrapping);
            }).then(function (data) {
                wrappedData = data;
                // Generate public key
                return subtle.generateKey(expand(privateKey.algorithm,
                        {ukm: privateKey.buffer}), true, ['sign', 'verify']);
            }).then(function (keyPair) {
                self.object = {
                    version: 0,
                    privateKeyAlgorithm: privateKey.algorithm,
                    privateKeyWrapped: wrappedData,
                    attributes: {
                        'id-sc-gostR3410-2001-publicKey': keyPair.publicKey.buffer
                    }
                };
                return self;
            });
        },
        /**
         * Change key password
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @instance
         * @param {string} oldKeyPassword Old key password
         * @param {string} newKeyPassword New key password
         * @returns {Promise} Promise to return self object after change password
         */
        changePassword: function (oldKeyPassword, newKeyPassword)
        {
            var self = __webpack_require__.g;
            return self.getPrivateKey(oldKeyPassword).then(function (privateKey) {
                return self.setPrivateKey(privateKey, newKeyPassword);
            });
        },
        /**
         * Generate private key, certificate and return certification request
         * 
         * @memberOf GostKeys.SignalComPrivateKeyInfo
         * @instance
         * @param {(FormatedData|GostASN1.CertificationRequest)} req The request templates
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm
         * @returns {Promise} Promise to return {@link GostCert.Request}
         */
        generate: function (req, keyPassword, keyAlgorithm)
        {
            var self = this, keyInfo;
            return new Promise(call).then(function () {
                if (!(req instanceof cert.Request))
                    req = new cert.Request(req);
                // Generate request
                return req.generate(keyAlgorithm);
            }).then(function (key) {
                keyInfo = key;
                return self.setKey(keyInfo, keyPassword);
            }).then(function () {
                return req;
            });
        }
    });
    defineProperties(SignalComPrivateKeyInfo.prototype, SignalComKeyContainer.prototype);

    /**
     * A class for password-encrypted SignalCom private keys
     * 
     * @memberOf GostKeys
     * @type GostKeys.SignalComPrivateKeyInfo
     */
    GostKeys.prototype.SignalComPrivateKeyInfo = SignalComPrivateKeyInfo;

    /**
     * A class for password-encrypted private keys in CryptoPro container
     * 
     * The container file list:
     * <ul>
     *      <li>header - container header @link GostASN1.GostKeyContainer</li>
     *      <li>name - container name @link GostASN1.GostKeyContainerName</li>
     *      <li>primary - private keys data @link GostASN1.GostPrivateKeys</li>
     *      <li>masks - private key masks @link GostASN1.GostPrivateMasks</li>
     *      <li>primary2 - reserve of private keys data @link GostASN1.GostPrivateKeys</li>
     *      <li>masks2 - reserve of private key masks @link GostASN1.GostPrivateMasks</li>
     * </ul>
     * 
     * @class GostKeys.CryptoProKeyContainer
     * @param {Object} container 
     */
    function CryptoProKeyContainer(container)
    {
        if (container) {
            this.header = asn1.GostKeyContainer.decode(container.header);
            this.name = asn1.GostKeyContainerName.decode(container.name);
            this.primary = asn1.GostPrivateKeys.decode(container.primary);
            this.masks = asn1.GostPrivateMasks.decode(container.masks);
            if (container.primary2 && container.masks2) {
                this.primary2 = asn1.GostPrivateKeys.decode(container.primary2);
                this.masks2 = asn1.GostPrivateMasks.decode(container.masks2);
            }
        }
    }

    extend(Object, CryptoProKeyContainer, (function () {


        // True if 512 bit
        function isKeySize512(algorithm) {
            return algorithm.name.indexOf('-512') >= 0 || algorithm.length === 512;
        }

        // Test version 2012
        function isVersion2012(algorithm) {
            return !((algorithm.name.indexOf('-94') >= 0 || algorithm.name.indexOf('-2001') >= 0 ||
                    algorithm.version === 1994 || algorithm.version === 2001));
        }

        // Derive password key
        function derivePasswordKey(algorithm, password, salt) {
            var hash = isVersion2012(algorithm) ? 'GOST R 34.11-256' : 'GOST R 34.11-94/' + (algorithm.sBox || 'D-A'),
                    derivation = {name: 'CPKDF', hash: hash, salt: salt, iterations: password ? 2000 : 2};

            // Import password
            return subtle.importKey('raw', passwordData(derivation, password),
                    derivation, false, ['deriveKey', 'deriveBits']).then(function (baseKey) {

                // Derive key
                return subtle.deriveKey(derivation, baseKey, 'GOST 28147',
                        false, ['sign', 'verify', 'encrypt', 'decrypt']);
            });
        }

        // Compute password MAC 
        function computePasswordMAC(algorithm, password, salt) {
            var mac = expand({name: 'GOST 28147-MAC'}, algorithm.encParams);

            // Derive password
            return derivePasswordKey(algorithm, password, salt).then(function (macKey) {

                // Mac for 16 zero bytes
                return subtle.sign(mac, macKey,
                        new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
            });
        }

        //        var lastBuffer;
        // Compute container MAC
        function computeContainerMAC(algorithm, content) {
            var mac = expand({name: 'GOST 28147-MAC'}, algorithm.encParams),
                    keyData = new Uint8Array([// 32 zero bytes
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
            return subtle.importKey('raw', keyData, mac, false, ['sign']).then(function (macKey) {
                //                var buffer = new Uint8Array(content.encode());
                //                console.log(coding.Hex.encode(buffer));
                //                if (lastBuffer && lastBuffer.length === buffer.length) {
                //                    for (var i = 0; i < buffer.length; i++)
                //                        if (lastBuffer[i] !== buffer[i])
                //                            console.log('diff at ' + i);
                //                } else
                //                    console.log('diff length');
                //                lastBuffer = buffer;
                // Mac for content
                return subtle.sign(mac, macKey, content.encode());
            });
        }

        // Compute mask MAC
        function computeMaskMAC(algorithm, mask, status) {
            // Import mask as key for MAC
            var mac = expand({name: 'GOST 28147-MAC'}, algorithm.encParams),
                    keyData = mask.byteLength === 64 ?
                    new Uint8Array(new Uint8Array(mask, 32, 32)).buffer : mask;
            return subtle.importKey('raw', keyData, mac, false, ['sign']).then(function (macKey) {

                // Verify MAC for maskStatus
                return subtle.sign(mac, macKey, status);
            });
        }

        // Generate mask
        function generateMasks(algorithm) {
            var wrapAlgorithm = expand(algorithm, {mode: 'MASK'}),
                    mask, status = getSeed(12);
            wrapAlgorithm.name = wrapAlgorithm.name.replace('-DH', '');
            return subtle.generateKey(wrapAlgorithm, true, ['wrapKey', 'unwrapKey']).then(function (key) {
                return subtle.exportKey('raw', key);
            }).then(function (data) {
                mask = data;
                return computeMaskMAC(algorithm, mask, status);
            }).then(function (hmac) {
                return new asn1.GostPrivateMasks({
                    mask: mask,
                    randomStatus: status,
                    hmacRandom: hmac
                });
            });
        }

        // Compute FP
        function computeFP(privateKey) {
            // Generate key pair with predefined ukm for check public key
            return subtle.generateKey(expand(privateKey.algorithm, {ukm: privateKey.buffer}), true, ['sign', 'verify']).then(function (keyPair) {
                return new Uint8Array(new Uint8Array(keyPair.publicKey.buffer, 0, 8)).buffer;
            });
        }

        // Unwrap private key
        function unwrapKey(algorithm, encryptionKey, key, mask, fp) {
            var encryption = {name: 'GOST 28147-ECB', sBox: algorithm.encParams && algorithm.encParams.sBox},
            unwrapAlgorithm = expand(algorithm, {mode: 'MASK'}), privateKey;
            unwrapAlgorithm.name = unwrapAlgorithm.name.replace('-DH', '');
            var wrappedKey;

            // Encrypt ukm data for private key
            return subtle.decrypt(encryption, encryptionKey, key).then(function (data) {
                wrappedKey = data;
                // Import mask key
                return subtle.importKey('raw', mask, unwrapAlgorithm, 'false', ['sign', 'unwrapKey']);
            }).then(function (unwrappingKey) {

                // Unwrap private key
                return subtle.unwrapKey('raw', wrappedKey, unwrappingKey,
                        unwrapAlgorithm, algorithm, 'true', ['sign']);
            }).then(function (key) {
                privateKey = key;
                return computeFP(privateKey);
            }).then(function (computedFP) {
                // Check public key buffer
                if (!equalBuffers(computedFP, fp))
                    throw new Error('Incorrect fp');

                return privateKey;
            });

        }

        // Wrap private key
        function wrapKey(algorithm, encryptionKey, privateKey, mask) {
            var encryption = {name: 'GOST 28147-ECB', sBox: algorithm.encParams && algorithm.encParams.sBox},
            wrapAlgorithm = expand(algorithm, {mode: 'MASK'});
            wrapAlgorithm.name = wrapAlgorithm.name.replace('-DH', '');

            // Import mask key
            return subtle.importKey('raw', mask, wrapAlgorithm, false,
                    ['sign', 'wrapKey']).then(function (wrappingKey) {
                // Wrap private key
                return subtle.wrapKey('raw', privateKey, wrappingKey, wrapAlgorithm);
            }).then(function (wrappedKey) {
                // Encrypt key
                return subtle.encrypt(encryption, encryptionKey, wrappedKey);
            });
        }

        // Decrypt private key
        function decryptKey(content, primary, masks, keyPassword, secondary) {
            var algorithm = content.primaryPrivateKeyParameters.privateKeyAlgorithm;
            return new Promise(call).then(function () {
                // Check format
                if (primary.hmacKey)
                    throw new Error('Old key format');

                if (masks.randomStatus.byteLength < 12)
                    throw new Error("Invalid random status length");

                // Import mask as key for MAC
                return computeMaskMAC(algorithm, masks.mask, masks.randomStatus);
            }).then(function (hmac) {
                if (!equalBuffers(hmac, masks.hmacRandom))
                    throw new Error("Imita for mask is invalid");

                // Derive key
                return derivePasswordKey(algorithm, keyPassword, new Uint8Array(masks.randomStatus, 0, 12));
            }).then(function (encryptionKey) {
                // Unwrap keys
                return secondary && primary.secondaryKey ?
                        unwrapKey(content.secondaryPrivateKeyParameters.privateKeyAlgorithm,
                                encryptionKey, primary.secondaryKey, masks.mask, content.secondaryFP) :
                        unwrapKey(algorithm, encryptionKey, primary.primaryKey, masks.mask, content.primaryFP);
            });
        }

        // Encrypt private key
        function encryptKey(algorithm, primary, masks, keyPassword, secondary, privateKey) {
            // Derive key
            return derivePasswordKey(algorithm, keyPassword, new Uint8Array(masks.randomStatus, 0, 12)).then(function (encryptionKey) {
                // Wrap keys
                return wrapKey(algorithm, encryptionKey, privateKey, masks.mask);
            }).then(function (encryptedKey) {
                if (!primary)
                    primary = new asn1.GostPrivateKeys();
                if (secondary) {
                    primary.secondaryKey = encryptedKey;
                } else {
                    primary.primaryKey = encryptedKey;
                }
                return primary;
            });
        }



        return {
            /**
             * Get the private key info
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} keyPassword The password for decryption 
             * @param {boolean} secondary True if required secondary key
             * @returns {Promise} Promise to return {@link GostKeys.PKCS8}
             */
            getKey: function (keyPassword, secondary)
            {
                return this.getPrivateKey(keyPassword, secondary).then(function (privateKey) {
                    return new PKCS8().setPrivateKey(privateKey);
                });
            },
            /**
             * Get the private key
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} keyPassword Rhe password for decryption 
             * @param {boolean} secondary True if required secondary key
             * @returns {Promise} Promise to return the {@link Key}
             */
            getPrivateKey: function (keyPassword, secondary)
            {
                var self = this, content = self.header.keyContainerContent;
                // Decrypt key
                return decryptKey(content, self.primary, self.masks, keyPassword, secondary)['catch'](function (e) {
                    if (self.primary2 && self.masks2)
                        return decryptKey(content, self.primary2, self.masks2, keyPassword, secondary);
                    else
                        throw e;
                });
            },
            /**
             * Get the certificate from the key container
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {boolean} secondary True for set secondary certificate
             * @returns {Promise} Promise to return {@link GostCert.X509}
             */
            getCertificate: function (secondary)
            {
                var self = this, content = self.header.keyContainerContent;
                return new Promise(call).then(function () {
                    if (secondary)
                        return new cert.X509(content.secondaryCertificate);
                    else
                        return new cert.X509(content.primaryCertificate);
                });
            },
            /**
             * Get the container name
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @returns {string} Container name
             */
            getContainerName: function ()
            {
                return this.name.containerName;
            },
            /**
             * Sets and encrypt the private key info
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {(FormatedData|GostKeys.PKCS8)} keyInfo The private key info 
             * @param {string} keyPassword The assword for encryption
             * @param {boolean} secondary True for set secondary key
             * @param {number} days Validity days. Default 7305 days (20 years)
             * @returns {Promise} Promise to return self object after set key
             */
            setKey: function (keyInfo, keyPassword, secondary, days)
            {
                var self = __webpack_require__.g;
                return new PKCS8(keyInfo).getPrivateKey().then(function (privateKey) {
                    return self.setPrivateKey(privateKey, keyPassword, secondary, days);
                });
            },
            /**
             * Set the private key
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {Key} privateKey The private key
             * @param {string} keyPassword The secret key encryption 
             * @param {boolean} secondary True for set secondary key
             * @param {number} days Validity days. Default 7305 days (20 years)
             * @returns {Promise} Promise to return self object after set key
             */
            setPrivateKey: function (privateKey, keyPassword, secondary, days)
            {
                var self = this, content, algorithm;
                return new Promise(call).then(function () {
                    self.header = self.header || new asn1.GostKeyContainer({
                        keyContainerContent: {
                            containerAlgoritmIdentifier: {
                                algorithm: 'id-CryptoPro-GostPrivateKeys-V2-Full'
                            },
                            attributes: ['kccaReservePrimary', 'kccaPrimaryKeyAbsent'],
                            extensions: {
                                keyValidity: {
                                    notAfter: now(days || options.days)
                                }
                            }
                        }
                    });
                    content = self.header.keyContainerContent;
                    // Set private key                    
                    var keyParameters = secondary ? content.secondaryPrivateKeyParameters :
                            content.primaryPrivateKeyParameters;
                    if (!keyParameters) {
                        algorithm = expand(privateKey.algorithm, {
                            sBox: "D-A",
                            encParams: {
                                block: "CFB",
                                sBox: "E-A",
                                keyMeshing: "CP"
                            }
                        });
                        keyParameters = {
                            attributes: ["pkaExportable", "pkaExchange", "pkaDhAllowed"],
                            privateKeyAlgorithm: algorithm
                        };
                        if (secondary) {
                            if (!content.primaryPrivateKeyParameters)
                                throw new Error('Primary key must be defined first');
                            content.secondaryPrivateKeyParameters = keyParameters;
                        } else {
                            content.primaryPrivateKeyParameters = keyParameters;
                            var absent = content.attributes.indexOf('kccaPrimaryKeyAbsent');
                            if (absent >= 0)
                                content.attributes.splice(absent, 1);
                        }
                    } else
                        algorithm = keyParameters.privateKeyAlgorithm;
                    // Generate masks
                    var promises = [];
                    [0, 1].forEach(function (i) {
                        var name = 'masks' + (i > 0 ? '2' : '');
                        if (!self[name])
                            promises.push(generateMasks(algorithm).then(function (masks) {
                                self[name] = masks;
                            }));
                    });
                    return Promise.all(promises);
                }).then(function () {
                    // Encrypt key
                    var promises = [];
                    [0, 1].forEach(function (i) {
                        var name = 'primary' + (i > 0 ? '2' : ''),
                                maskname = 'masks' + (i > 0 ? '2' : '');
                        promises.push(encryptKey(algorithm, self[name], self[maskname], keyPassword, secondary, privateKey).then(function (primary) {
                            self[name] = primary;
                        }));
                    });
                    return Promise.all(promises);
                }).then(function () {
                    // Compute FP for a private key
                    return computeFP(privateKey).then(function (FP) {
                        if (secondary)
                            content.secondaryFP = FP;
                        else
                            content.primaryFP = FP;
                    });
                }).then(function () {
                    // Compute password MAC
                    var softPassword = content.attributes.indexOf('kccaSoftPassword');
                    if (keyPassword) {
                        if (softPassword < 0)
                            content.attributes.push('kccaSoftPassword');
                        return computePasswordMAC(algorithm, keyPassword, content.primaryFP);
                    } else {
                        if (softPassword >= 0)
                            content.attributes.splice(softPassword, 1);
                    }
                }).then(function (hmac) {
                    if (hmac)
                        content.hmacPassword = hmac;
                    // Calculate container MAC
                    return computeContainerMAC(algorithm, content);
                }).then(function (hmac) {
                    self.header.hmacKeyContainerContent = hmac;
                    return self;
                });
            },
            /**
             * Set the certificate to the key container
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {(FormatedData|GostCert.X509)} certificate The certificate
             * @param {boolean} secondary True for set secondary certificate
             * @param {number} days Validity days. Default 7305 days (20 years)
             * @returns {Promise} Promise to return self object after set certificate
             */
            setCertificate: function (certificate, secondary, days)
            {
                var self = this, content, algorithm;
                return new Promise(call).then(function () {
                    self.header = self.header || new asn1.GostKeyContainer({
                        keyContainerContent: {
                            containerAlgoritmIdentifier: {
                                algorithm: 'id-CryptoPro-GostPrivateKeys-V2-Full'
                            },
                            attributes: ['kccaReservePrimary', 'kccaPrimaryKeyAbsent'],
                            extensions: {
                                keyValidity: {
                                    notAfter: now(days || options.days)
                                }
                            }
                        }
                    });
                    content = self.header.keyContainerContent;
                    certificate = new cert.X509(certificate);
                    algorithm = (content.primaryPrivateKeyParameters &&
                            content.primaryPrivateKeyParameters.privateKeyAlgorithm) ||
                            expand(certificate.subjectPublicKeyInfo.algorithm, {
                                sBox: "D-A",
                                encParams: {
                                    block: "CFB",
                                    sBox: "E-A",
                                    keyMeshing: "CP"
                                }
                            });
                    return certificate.getPublicKey();
                }).then(function (publicKey) {
                    if (secondary) {
                        if (content.secondaryFP && !equalBuffers(content.secondaryFP,
                                new Uint8Array(publicKey.buffer, 0, content.secondaryFP.byteLength)))
                            throw new Error('The public key of the certificate does not match the private key');
                        content.secondaryCertificate = certificate;
                    } else {
                        if (content.primaryFP && !equalBuffers(content.primaryFP,
                                new Uint8Array(publicKey.buffer, 0, content.primaryFP.byteLength)))
                            throw new Error('The public key of the certificate does not match the private key');
                        content.primaryCertificate = certificate;
                    }
                    // Calculate container MAC
                    return computeContainerMAC(algorithm, content);
                }).then(function (hmac) {
                    self.header.hmacKeyContainerContent = hmac;
                    return self;
                });
            },
            /**
             * Set the container name
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} name Container name
             */
            setContainerName: function (name)
            {
                this.name = new asn1.GostKeyContainerName({containerName: name});
            },
            /**
             * Verify key container with password
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} keyPassword the secret key or password for decryption 
             * @returns {Promise} Promise to return self object after verify
             */
            verify: function (keyPassword)
            {
                var self = this, content, algorithm;
                return new Promise(call).then(function () {
                    content = self.header.keyContainerContent;
                    algorithm = content.primaryPrivateKeyParameters.privateKeyAlgorithm;
                    // Verify container MAC
                    return computeContainerMAC(algorithm, content);
                }).then(function (hmac) {
                    if (!equalBuffers(hmac, self.header.hmacKeyContainerContent))
                        throw new Error("Container is not valid.");
                    // Verify key password MAC
                    var needPassword = content.attributes.indexOf('kccaSoftPassword') >= 0;
                    if (!keyPassword && needPassword)
                        throw new Error("Password is required");
                    if (keyPassword && !needPassword)
                        throw new Error("Password is not reqiured.");
                    if (keyPassword)
                        // Derive password
                        return computePasswordMAC(algorithm, keyPassword, content.primaryFP).then(function (hmac) {
                            if (!equalBuffers(hmac, content.hmacPassword))
                                throw new Error("Password is not valid.");
                            return self;
                        });
                    return self;
                });
            },
            /**
             * Change key password
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} oldKeyPassword Old key password
             * @param {string} newKeyPassword New key password
             * @returns {Promise} Promise to return self object after change password
             */
            changePassword: function (oldKeyPassword, newKeyPassword)
            {
                var self = this, content;
                return new Promise(call).then(function () {
                    content = self.header.keyContainerContent;
                    if (!content.primaryPrivateKeyParameters)
                        throw new Error('Private key not yet defined');
                    return self.getPrivateKey(oldKeyPassword).then(function (privateKey) {
                        return self.setPrivateKey(privateKey, newKeyPassword);
                    });
                }).then(function () {
                    if (content.secondaryPrivateKeyParameters)
                        return self.getPrivateKey(oldKeyPassword, true).then(function (privateKey) {
                            return self.setPrivateKey(privateKey, newKeyPassword, true);
                        });
                    return self;
                });
            },
            /**
             * Generate private key, certificate and return certification request
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {(FormatedData|GostASN1.CertificationRequest)} req The request templates
             * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
             * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm
             * @returns {Promise} Promise to return {@link GostCert.Request}
             */
            generate: function (req, keyPassword, keyAlgorithm)
            {
                var self = this, certificate, keyInfo;
                return new Promise(call).then(function () {
                    if (!(req instanceof cert.Request))
                        req = new cert.Request(req);
                    // Generate request
                    return req.generate(keyAlgorithm);
                }).then(function (key) {
                    keyInfo = key;
                    return self.setKey(keyInfo, keyPassword);
                }).then(function () {
                    // Create the new certificate
                    certificate = new cert.X509(req);
                    return certificate.sign(keyInfo);
                }).then(function () {
                    return self.setCertificate(certificate);
                }).then(function () {
                    return req;
                });
            },
            /**
             * Encode key container
             * 
             * @memberOf GostKeys.CryptoProKeyContainer
             * @instance
             * @param {string} format Encode format 'DER', 'CER', 'PEM'
             * @returns {Object} container Object contains encoded files
             */
            encode: function (format)
            {
                return {
                    header: this.header.encode(format),
                    name: this.name.encode(format),
                    masks: this.masks.encode(format),
                    primary: this.primary.encode(format),
                    masks2: this.masks2.encode(format),
                    primary2: this.primary2.encode(format)
                };
            }
        };
    })());

    /**
     * A class for password-encrypted private keys in CryptoPro container
     * 
     * @memberOf GostKeys
     * @type GostKeys.SignalComPrivateKeyInfo
     */
    GostKeys.prototype.CryptoProKeyContainer = CryptoProKeyContainer;

    /**
     * A class for password-encrypted private keys in ViPNet container entry
     * 
     * @class GostKeys.ViPNetContainerEntry
     * @extends GostASN1.ViPNetInfo
     * @param {(FormatedData|GostKeys.ViPNetContainerEntry)} entry 
     */
    function ViPNetContainerEntry(entry)
    {
        asn1.ViPNetInfo.call(this, entry || {
            version: 3,
            keyInfo: {
                keyClass: 1,
                keyType: 43556,
                flags: 1
            },
            defenceKeyInfo: {
                keyClass: 1024,
                keyType: 24622,
                keyUID: getSeed(32),
                flags: -2147483648
            }
        });
    }

    extend(asn1.ViPNetInfo, ViPNetContainerEntry, (function () {

        function getKeyPassword(keyPassword)
        {
            if (keyPassword === undefined)
                keyPassword = '';
            // Generate key data
            var passwordData = coding.Chars.decode(keyPassword, 'win1251'), keyData;
            return subtle.digest('GOST R 34.11-94', passwordData).then(function (data) {
                keyData = data;
                // Generate mask data
                var secodeData = new Uint8Array(passwordData.byteLength + keyData.byteLength);
                secodeData.set(new Uint8Array(passwordData), 0);
                secodeData.set(new Uint8Array(keyData), passwordData.byteLength);
                return subtle.digest('GOST R 34.11-94', secodeData);
            }).then(function (data) {
                // Remove mask
                return subtle.importKey('raw', data, 'GOST 28147', false, ['unwrapKey']);
            }).then(function (unwrappingKey) {
                // Unwrap secret key
                return subtle.unwrapKey('raw', keyData, unwrappingKey,
                        'GOST 28147-MASK/VN', 'GOST 28147-89',
                        'false', ['encrypt', 'decrypt', 'sign', 'verify']);
            });
        }

        return {
            /**
             * Get the private key
             * 
             * @memberOf GostKeys.ViPNetContainerEntry
             * @instance
             * @param {string} keyPassword The password of secrect key for decryption 
             * @returns {Promise} Promise to return the {@link Key}
             */
            getPrivateKey: function (keyPassword)
            {
                var self = this, keyPart, encryptedKey;
                // Decrypt key
                return new Promise(call).then(function () {
                    return !keyPassword || typeof keyPassword === 'string' ?
                            getKeyPassword(keyPassword) : keyPassword;
                }).then(function (key) {
                    keyPassword = key;
                    // Verify password    
                    keyPart = self.keyPart;
                    encryptedKey = new Uint8Array(keyPart, 0, keyPart.byteLength - 4 - 8);
                    var macKey = new Uint8Array(keyPart, encryptedKey.byteLength, 4),
                            encodedKeyInfo = self.keyInfo.encode(),
                            data = new Uint8Array(encryptedKey.byteLength + encodedKeyInfo.byteLength);
                    data.set(new Uint8Array(encryptedKey), 0);
                    data.set(new Uint8Array(encodedKeyInfo), encryptedKey.byteLength);
                    return subtle.verify({name: 'GOST 28147-89-MAC'}, keyPassword, macKey, data);
                }).then(function (result) {
                    if (!result)
                        throw new Error('Invalid key password');
                    var iv = new Uint8Array(keyPart, keyPart.byteLength - 8, 8);
                    // Decrypt key data
                    return subtle.decrypt({name: 'GOST 28147-89-CFB', iv: iv}, keyPassword, encryptedKey);
                }).then(function (keyData) {
                    var l2 = keyData.byteLength / 2;
                    if (self.keyInfo.keyClass & 0x3 === 0) {
                        // Secret key. Remove mask and import
                        return subtle.importKey('raw', new Int32Array(keyData, l2, l2), 'GOST 28147', false,
                                ['unwrapKey']).then(function (unwrappingKey) {
                            // Unwrap secret key
                            return subtle.unwrapKey('raw', new Int32Array(keyData, 0, l2), unwrappingKey,
                                    'GOST 28147-MASK/VN', 'GOST 28147-89',
                                    'false', ['encrypt', 'decrypt', 'sign', 'verify']);
                        });
                    } else {
                        // Private key
                        var algorithm = self.keyInfo.algorithm ||
                                (self.certificate && self.certificate.subjectPublicKeyInfo.algorithm);
                        if (!algorithm)
                            throw new Error('Algorithm is not specified');
                        var unwrapAlgorithm = expand(algorithm, {mode: 'MASK', procreator: 'VN'});
                        unwrapAlgorithm.name = unwrapAlgorithm.name.replace('-DH', '');
                        var wrapped = new Uint8Array(keyData, 0, l2),
                                mask = new Uint8Array(keyData, l2, l2);
                        // Import mask key
                        return subtle.importKey('raw', mask, unwrapAlgorithm, 'false', ['sign', 'unwrapKey']).then(function (unwrappingKey) {
                            // Unwrap private key
                            return subtle.unwrapKey('raw', wrapped, unwrappingKey, unwrapAlgorithm, algorithm, 'true', ['sign', 'deriveBits', 'deriveKey']);
                        }).then(function (privateKey) {
                            // Generate key pair
                            if (self.publicKey)
                                return subtle.generateKey(expand(privateKey.algorithm, {ukm: privateKey.buffer}),
                                        privateKey.extractable, privateKey.usages);
                            else
                                return {privateKey: privateKey};
                        }).then(function (keyPair) {
                            // Compare public key
                            if (self.publicKey && !equalBuffers(keyPair.publicKey.buffer, self.publicKey))
                                throw new Error('Check public key failed');
                            return keyPair.privateKey;
                        });
                    }
                });
            },
            /**
             * Set the private key
             * 
             * @memberOf GostKeys.ViPNetContainerEntry
             * @instance
             * @param {Key} privateKey The private key
             * @param {string} keyPassword The secret key encryption 
             * @param {number} days Validity days. Default 7305 days (20 years)
             * @returns {Promise} Promise to return the self object after set the key
             */
            setPrivateKey: function (privateKey, keyPassword, days)
            {
                var self = this, wrapAlgorithm, wrappingKey, keyData, keyPart;
                // Decrypt key
                return new Promise(call).then(function () {
                    return !keyPassword || typeof keyPassword === 'string' ?
                            getKeyPassword(keyPassword) : keyPassword;
                }).then(function (key) {
                    keyPassword = key;
                    var algorithm = privateKey.algorithm;
                    self.keyInfo.algorithm = algorithm;
                    self.keyInfo.serialNumber = getSeed(16);
                    self.keyInfo.keyUID = getSeed(8);
                    self.keyInfo.validity = {
                        notBefore: today(),
                        notAfter: today(days || options.days)
                    };
                    if (privateKey.type === 'private') {
                        // Generate mask
                        wrapAlgorithm = expand(algorithm, {mode: 'MASK', procreator: 'VN'});
                        wrapAlgorithm.name = wrapAlgorithm.name.replace('-DH', '');
                        self.keyInfo.keyClass = 1;
                        self.keyInfo.keyType = 43556;
                        // Generate public key
                        return subtle.generateKey(expand(algorithm, {ukm: privateKey.buffer}), true,
                                ['sign', 'verify']).then(function (keyPair) {
                            self.publicKey = keyPair.publicKey.buffer;
                            // Check certificate
                            if (self.certificate) {
                                var spki = self.certificate.subjectPublicKeyInfo;
                                return subtle.importKey('spki', spki.encode(), spki.algorithm, true, ['verify']);
                            }
                        }).then(function (publicKey) {
                            if (publicKey && !equalBuffers(publicKey.buffer, self.publicKey))
                                delete self.certificate; // Remove not valid certificate
                        });
                    } else if (privateKey.type === 'secret') {
                        wrapAlgorithm = 'GOST 28147/MASK/VN';
                        delete self.certificate;
                        delete self.publicKey;
                        self.keyInfo.keyClass = 64;
                        self.keyInfo.keyType = 24622;
                    } else
                        throw new Error('Invalid key type');
                }).then(function () {
                    // Generate mask
                    return subtle.generateKey(wrapAlgorithm, true, ['wrapKey', 'unwrapKey']);
                }).then(function (key) {
                    wrappingKey = key;
                    // Wrap private key with mask
                    return subtle.wrapKey('raw', privateKey, wrappingKey, wrapAlgorithm);
                }).then(function (data) {
                    keyData = new Uint8Array(data.byteLength * 2);
                    keyData.set(new Uint8Array(data));
                    return subtle.exportKey('raw', wrappingKey);
                }).then(function (data) {
                    keyData.set(new Uint8Array(data), data.byteLength);
                    keyPart = new Uint8Array(keyData.byteLength + 12);
                    // Encrypt key
                    var encyption = {name: 'GOST 28147-CFB', iv: getSeed(8)};
                    keyPart.set(new Uint8Array(encyption.iv), keyPart.byteLength - 8);
                    return subtle.encrypt(encyption, keyPassword, keyData);
                }).then(function (encryptedKey) {
                    keyPart.set(new Uint8Array(encryptedKey));
                    // Calculate MAC
                    var encodedKeyInfo = self.keyInfo.encode(),
                            data = new Uint8Array(encryptedKey.byteLength + encodedKeyInfo.byteLength);
                    data.set(new Uint8Array(encryptedKey), 0);
                    data.set(new Uint8Array(encodedKeyInfo), encryptedKey.byteLength);
                    return subtle.sign({name: 'GOST 28147-89-MAC'}, keyPassword, data);
                }).then(function (macKey) {
                    keyPart.set(new Uint8Array(macKey), keyPart.byteLength - 12);
                    self.keyPart = keyPart.buffer;
                    return self;
                });
            },
            /**
             * Encode container entry
             * 
             * @memberOf GostKeys.ViPNetContainerEntry
             * @instance
             * @param {string} format The encoded data format
             * @returns {CryptoOperationData}
             */
            encode: function (format)
            {
                var header = asn1.ViPNetInfo.method('encode').call(this),
                        result = new Uint8Array(8 + header.byteLength + this.keyPart.byteLength);
                set32(result.buffer, 0, 4 + header.byteLength + this.keyPart.byteLength);
                result.set(new Uint8Array(header), 4);
                set32(result.buffer, 4 + header.byteLength, this.keyPart.byteLength);
                result.set(new Uint8Array(this.keyPart), 8 + header.byteLength);
                if (format === 'PEM')
                    return coding.Base64.encode(result.buffer);
                return result.buffer;
            }
        };
    })(), {
        /**
         * Decode container entry
         * 
         * @memberOf GostKeys.ViPNetContainerEntry
         * @param {FormatedData} entry
         * @returns {GostKeys.ViPNetContainer}
         */
        decode: function (entry)
        {
            if (typeof entry === 'string')
                entry = coding.Base64.decode(entry);
            entry = buffer(entry);
            // Entry size 
            var entrySize = get32(entry, 0);
            if (entry.byteLength !== entrySize + 4)
                throw new Error('Invalid container entry size');
            // Decode header info
            var source = coding.BER.decode(new Uint8Array(entry, 4, entrySize));
            var result = asn1.ViPNetInfo.decode.call(this, source);
            // Decode key info
            var headerSize = source.header.byteLength + source.content.byteLength,
                    keyPartSize = get32(entry, 4 + headerSize);
            if (entry.byteLength !== headerSize + keyPartSize + 8)
                throw new Error('Invalid container key part size');
            result.keyPart = new Uint8Array(new Uint8Array(entry, headerSize + 8, keyPartSize)).buffer;
            // Key Info buffer - can be used in case error of format encoding
            // var keyInfoSource = source.object[1];
            // result.encodedKeyInfo = new Uint8Array(new Uint8Array(keyInfoSource.header.buffer, 
            //    keyInfoSource.header.byteOffset, keyInfoSource.header.byteLength + keyInfoSource.content.byteLength)).buffer;
            return result;
        }
    });

    /**
     * A class for password-encrypted private keys in CryptoPro container
     * 
     * @memberOf GostKeys
     * @type GostKeys.SignalComPrivateKeyInfo
     */
    GostKeys.prototype.ViPNetContainerEntry = ViPNetContainerEntry;

    /**
     * A class for password-encrypted private keys in ViPNet container
     * 
     * @class GostKeys.ViPNetContainer
     * @param {(FormatedData|GostKeys.ViPNetContainer)} container 
     */
    function ViPNetContainer(container)
    {
        if (container && (container instanceof CryptoOperationData ||
                container.buffer instanceof CryptoOperationData ||
                typeof container === 'string'))
            this.decode(container);
        else {
            container = container || {};
            this.fileType = container.fileType || 'ITCS';
            this.fileVersion = container.fileVersion || 0x10;
            if (container.applicationHeader)
                this.applicationHeader = container.applicationHeader;
            this.entries = container.entries || [];
        }
    }


    extend(Object, ViPNetContainer, {
        /**
         * Get the certificate from the container
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {number} index Index of the entriy. Default 0
         * @returns {Promise} Promise to return {@link GostCert.X509} 
         */
        getCertificate: function (index)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                var entry = self.entries[index || 0];
                if (!entry)
                    throw new Error('Entry not defined');
                if (entry.certificate)
                    return new cert.X509(entry.certificate);
            });
        },
        /**
         * Get the private key info
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {string} keyPassword The password for decryption 
         * @param {number} index Index of the entriy. Default 0
         * @returns {Promise} Promise to return {@link GostKeys.PKCS8}
         */
        getKey: function (keyPassword, index)
        {
            return this.getPrivateKey(keyPassword, index).then(function (privateKey) {
                return new PKCS8().setPrivateKey(privateKey);
            });
        },
        /**
         * Get the private key
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {string} keyPassword The password of secrect key for decryption 
         * @param {number} index Index of the entriy. Default 0
         * @returns {Promise} Promise to return the {@link Key}
         */
        getPrivateKey: function (keyPassword, index)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                var entry = self.entries[index || 0];
                if (!entry)
                    throw new Error('Entry not defined');
                return entry.getPrivateKey(keyPassword);
            });
        },
        /**
         * Set the certificate to the container
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {(FormatedData|GostCert.X509)} certificate The certificate
         * @param {number} index Index of the entriy. Default 0
         * @returns {Promise} Promise to return self object after set certificate
         */
        setCertificate: function (certificate, index)
        {
            var self = this, entry, certificate;
            return new Promise(call).then(function () {
                entry = self.entries[index || 0] ||
                        (self.entries[index || 0] = new ViPNetContainerEntry());
                certificate = new cert.X509(certificate);
                if (entry.publicKey)
                    return certificate.getPublicKey();
            }).then(function (publicKey) {
                if (publicKey && !equalBuffers(entry.publicKey, publicKey.buffer))
                    throw new Error('Invalid certificate for private key');
                entry.certificate = certificate;
                return self;
            });
        },
        /**
         * Set the key to the container
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {(FormatedData|GostKeys.PKCS8)} keyInfo The key
         * @param {string} keyPassword The password for decryption 
         * @param {number} index Index of the entriy. Default 0
         * @param {number} days Validity days. Default 7305 days (20 years)
         * @returns {Promise} Promise to return self object after set the key
         */
        setKey: function (keyInfo, keyPassword, index, days)
        {
            var self = __webpack_require__.g;
            return new PKCS8(keyInfo).getPrivateKey().then(function (privateKey) {
                return self.setPrivateKey(privateKey, keyPassword, index, days);
            });
        },
        /**
         * Set the private key
         * 
         * @memberOf GostKeys.ViPNetContainerEntry
         * @instance
         * @param {Key} privateKey The private key
         * @param {string} keyPassword The secret key encryption 
         * @param {number} index Index of the entriy. Default 0
         * @param {number} days Validity days. Default 7305 days (20 years)
         * @returns {Promise} Promise to return the self object after set the key
         */
        setPrivateKey: function (privateKey, keyPassword, index, days)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                var entry = self.entries[index || 0] ||
                        (self.entries[index || 0] = new ViPNetContainerEntry());
                return entry.setPrivateKey(privateKey, keyPassword, days);
            }).then(function () {
                return self;
            });
        },
        /**
         * Change key password
         * 
         * @memberOf GostKeys.ViPNetContainerEntry
         * @instance
         * @param {string} oldKeyPassword Old key password
         * @param {string} newKeyPassword New key password
         * @returns {Promise} Promise to return self object after change password
         */
        changePassword: function (oldKeyPassword, newKeyPassword)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                return self.getPrivateKey(oldKeyPassword).then(function (privateKey) {
                    return self.setPrivateKey(privateKey, newKeyPassword);
                });
            });
        },
        /**
         * Generate private key, certificate and return certification request
         * 
         * @memberOf GostKeys.ViPNetContainerEntry
         * @instance
         * @param {(FormatedData|GostASN1.CertificationRequest)} req The request templates
         * @param {(Key|CryptoOperationData|string)} keyPassword The secret key or password for decryption 
         * @param {(AlgorithmIdentifier|string)} keyAlgorithm The name of provider or algorithm
         * @returns {Promise} Promise to return {@link GostCert.Request}
         */
        generate: function (req, keyPassword, keyAlgorithm)
        {
            var self = this, certificate, keyInfo;
            return new Promise(call).then(function () {
                if (!(req instanceof cert.Request))
                    req = new cert.Request(req);
                // Generate request
                return req.generate(keyAlgorithm);
            }).then(function (key) {
                keyInfo = key;
                return self.setKey(keyInfo, keyPassword);
            }).then(function () {
                // Create the new certificate
                certificate = new cert.X509(req);
                return certificate.sign(keyInfo);
            }).then(function () {
                return self.setCertificate(certificate);
            }).then(function () {
                return req;
            });
        },
        /**
         * Encode objet to container
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {string} format The encoded data format
         * @returns {CryptoOperationData}
         */
        encode: function (format)
        {
            // Encode entries
            var entries = [], entriesSize = 0;
            this.entries.forEach(function (entry) {
                var encoded = entry.encode();
                entriesSize += encoded.byteLength;
                entries.push(encoded);
            });
            var headerSize = this.applicationHeader ? this.applicationHeader.byteLength : 0,
                    result = new Uint8Array(12 + headerSize + entriesSize);
            result.set(new Uint8Array(coding.Chars.decode(this.fileType, 'ascii')));
            set32(result.buffer, 4, this.fileVersion);
            set32(result.buffer, 8, headerSize);
            if (headerSize > 0)
                result.set(new Uint8Array(this.applicationHeader), 12);
            var offset = 12 + headerSize;
            entries.forEach(function (entry) {
                result.set(new Uint8Array(entry), offset);
                offset += entry.byteLength;
            });
            if (format === 'PEM')
                return coding.Base64.encode(result.buffer);
            return result.buffer;
        },
        /**
         * Decode container to the object
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {FormatedData} container
         * @returns {GostKeys.ViPNetContainer}
         */
        decode: function (container)
        {
            container = this.constructor.decode(container);
            this.fileType = container.fileType;
            this.fileVersion = container.fileVersion;
            if (container.applicationHeader)
                this.applicationHeader = container.applicationHeader;
            this.entries = container.entries;
        }
    }, {
        /**
         * Encode object
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {GostKeys.ViPNetContainer} object
         * @param {string} format The encoded data format
         * @returns {CryptoOperationData}
         */
        encode: function (object, format)
        {
            return new this(object).encode(format);
        },
        /**
         * Decode container
         * 
         * @memberOf GostKeys.ViPNetContainer
         * @instance
         * @param {FormatedData} container
         * @returns {GostKeys.ViPNetContainer}
         */
        decode: function (container)
        {
            if (typeof container === 'string')
                container = coding.Base64.decode(container);
            container = buffer(container);
            // File type
            var fileType = coding.Chars.encode(new Uint8Array(container, 0, 4), 'ascii');
            if (fileType !== 'ITCS' && fileType !== 'PKEY' && fileType !== '_CCK' && fileType !== '_LCK')
                throw new Error('Unsupported ViPNet container type');
            // File version
            var fileVersion = get32(container, 4),
                    i = fileVersion >>> 16, j = fileVersion & 0xffff;
            if ((i !== 0 && i !== 1) || j > 0xff)
                throw new Error('Unsupported ViPNet container version');
            // File header
            var headerSize = get32(container, 8), applicationHeader;
            if (headerSize > 0)
                applicationHeader = buffer(new Uint8Array(container, 12, headerSize));
            // Read entries
            var offset = 12 + headerSize, entries = [];
            while (offset < container.byteLength) {
                // Entry size
                var entrySize = get32(container, offset);
                // Decode entry
                entries.push(ViPNetContainerEntry.decode(
                        new Uint8Array(container, offset, entrySize + 4)));
                offset = offset + entrySize + 4;
            }
            return new ViPNetContainer({
                fileType: fileType,
                fileVersion: fileVersion,
                applicationHeader: applicationHeader,
                entries: entries
            });
        }
    });

    /**
     * A class for password-encrypted private keys in CryptoPro container
     * 
     * @memberOf GostKeys
     * @type GostKeys.SignalComPrivateKeyInfo
     */
    GostKeys.prototype.ViPNetContainer = ViPNetContainer;

    /**
     * An implementation of PKCS #12 password encryption/integrity modes. Both input and output are implemented.<br><br>
     * 
     * A PFX object may contain multiple authenticated safes (represented as GostASN1.SafeContents objects). 
     * Each authenticated safe may have its own encryption method, and contains a number of bags 
     * (represented as instances of GostASN1.SafeBag). <br>
     * Note: the methods and constructors that input a PFX object do not automatically check the validity of the MAC. 
     * You need to explicitly call verify() to make this check.
     * 
     * @class GostKeys.PKCS12
     * @extends GostASN1.PFX
     * @param {(FormatedData|GostASN1.PFX)} store
     */
    function PKCS12(store)
    {
        asn1.PFX.call(this, store || {
            version: 3,
            authSafe: {
                contentType: 'data'
            }
        });
    }

    extend(asn1.PFX, PKCS12, (function () {


        function calcHMAC(derivation, password, content) {
            var hmac = {name: 'HMAC', hash: derivation.hash};
            // Import password for key generation 
            return subtle.importKey('raw', passwordData(derivation, password),
                    derivation, false, ['deriveKey']).then(function (passwordKey) {
                // Generate key from password. 
                return subtle.deriveKey(derivation, passwordKey, hmac, false, ['sign']);
            }).then(function (integrityKey) {
                // Sign MAC 
                return subtle.sign(hmac, integrityKey, content);
            });
        }

        function verifyHMAC(derivation, password, digest, content) {
            return calcHMAC(derivation, password, content).then(function (test) {
                if (!equalBuffers(digest, test))
                    throw new Error('Invalid password, MAC is not verified');
            });
        }

        return {
            /**
             * Sign the enclosed content with given digest algorithm
             * 
             * @memberOf GostKeys.PKCS12
             * @instance
             * @param {string} password The password 
             * @param {(AlgorithmIdentifier|string)} digestAlgorithm Digest algorithm or provider name
             * @returns {Promise} Promise to return self object after enclose content
             */
            sign: function (password, digestAlgorithm)
            {
                var self = __webpack_require__.g;
                return new Promise(call).then(function () {
                    // Calculate mac for password integrity
                    if (password) {
                        // Define digeset algorithm
                        var hash, derivation, digestProvider;
                        if (digestAlgorithm)
                            digestProvider = providers[digestAlgorithm];
                        else
                            digestAlgorithm = providers[options.providerName].digest;
                        if (digestProvider) {
                            hash = digestProvider.digest;
                            derivation = digestProvider.derivation;
                        } else {
                            hash = digestAlgorithm;
                            derivation = {name: 'PFXKDF', hash: hash, iterations: 2000};
                        }
                        // Add salt
                        derivation = expand(derivation, {salt: getSeed(saltSize(hash)), diversifier: 3});
                        // Sign HMAC
                        var content = self.authSafe.content;
                        return calcHMAC(derivation, password, content).then(function (digest) {
                            self.macData = {
                                mac: {
                                    digestAlgorithm: hash,
                                    digest: digest
                                },
                                macSalt: derivation.salt,
                                iterations: derivation.iterations
                            };
                            return self;
                        });
                    } else
                        return self;
                });
            },
            /**
             * Verifies the MAC.
             * 
             * @memberOf GostKeys.PKCS12
             * @instance
             * @param password The password for mac verification
             * @returns {Promise} Promise to return self object after verification
             */
            verify: function (password)
            {
                var self = this, authSafe = self.authSafe, derivation;
                return new Promise(call).then(function () {
                    // Indirectly verification
                    if (authSafe.contentType === 'data') {
                        // Check MAC 
                        if (self.macData) {
                            if (!password)
                                throw new Error('Password must be defined for the MAC verification');
                            derivation = {
                                name: 'PFXKDF',
                                hash: self.macData.mac.digestAlgorithm,
                                salt: self.macData.macSalt,
                                iterations: self.macData.iterations,
                                diversifier: 3
                            };
                            var content = self.authSafe.content, digest = self.macData.mac.digest;
                            // Verify HMAC with PFXKDF (PKCS#12)
                            return verifyHMAC(derivation, password, digest, content)['catch'](function () {
                                // Verify HMAC with PBKDF2 (TC 26, PKCS#5)
                                derivation.name = 'PBKDF2';
                                return verifyHMAC(derivation, password, digest, content);
                            });
                        } // No check with MAC
                    } else
                        throw new Error('Unsupported format');
                }).then(function () {
                    return self;
                });
            }
        };
    })());

    /**
     * An implementation of PKCS #12 password encryption/integrity modes. 
     * 
     * @memberOf GostKeys
     * @type GostKeys.PKCS12
     */
    GostKeys.prototype.PKCS12 = PKCS12;

    /**
     * This type of entry holds a cryptographic PrivateKey, which is optionally stored 
     * in a protected format to prevent unauthorized access. It is also accompanied by 
     * a certificate chain for the corresponding public key.
     * 
     * @class GostKeys.KeyEntry
     * @property {(GostKeys.PKCS8|GostKeys.PKCS8Encrypted)} key The Private Key
     * @property {GostCert.X509[]} certs The X.509 Certificates chain
     * @property {GostCert.CRL[]} crls The X.509 CRLs for certificate chain
     */

    /**
     * This class represents a storage facility for cryptographic keys and certificates.
     * 
     * @class GostKeys.KeyStore
     * @param {Object} entries Object contains aliased {@link KeyEntry} objects
     */
    function KeyStore(entries)
    {
        this.entries = {};
        if (entries)
            for (var name in entries)
                this.setEntry(name, entries[name]);
    }

    extend(Object, KeyStore, {
        /**
         * Lists all the alias names of this keystore.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @returns {string[]}
         */
        aliases: function ()
        {
            var result = [];
            for (var name in this.entries)
                result.push(name);
            return result;
        },
        /**
         * Checks if the given alias exists in this keystore.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {string} alias The alias name
         * @returns {boolean} True if the alias exists, false otherwise
         */
        containsAlias: function (alias)
        {
            return !!this.entries[alias];
        },
        /**
         * Deletes the entry identified by the given alias from this keystore.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {string} alias The alias name 
         */
        deleteEntry: function (alias)
        {
            delete this.entries[alias];
        },
        /**
         * Saves a keystore Entry under the specified alias.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {string} alias The alias name 
         * @param {GostKeys.KeyEntry} entry The entry
         */
        setEntry: function (alias, entry)
        {
            var r = {};
            // Keys
            if (entry.key) {
                try {
                    r.key = new PKCS8(entry.key, true); // Private key
                } catch (e) {
                    try {
                        r.key = new PKCS8Encrypted(entry.key, true); // Encrypted private key
                    } catch (e1) {
                        if (entry.key instanceof CryptoOperationData)
                            r.key = entry.key; // Secret key
                        else
                            throw new Error('Unknown Key format');
                    }
                }
            }
            // Certs
            if (entry.certs) {
                var certs = entry.certs instanceof Array ? entry.certs : [entry.certs];
                for (var i = 0; i < certs.length; i++) {
                    try {
                        certs[i] = new cert.X509(certs[i]);
                    } catch (e) {
                    }
                }
                r.certs = certs;
            }
            // CRLs
            if (entry.crls) {
                var crls = entry.crls instanceof Array ? entry.crls : [entry.crls];
                for (var i = 0; i < crls.length; i++) {
                    try {
                        crls[i] = new cert.CRL(crls[i]);
                    } catch (e) {
                    }
                }
                r.crls = crls;
            }
            this.entries[alias] = r;
        },
        /**
         * Gets a keystore Entry for the specified alias 
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {string} alias The alias name 
         * @returns {GostKeys.KeyEntry} The entry
         */
        getEntry: function (alias)
        {
            return this.entries[alias];
        },
        /**
         * Loads this KeyStore from the given input stream.<br><br>
         * A password may be given to unlock the keystore (e.g. the keystore resides on a hardware token device), 
         * or to check the integrity of the keystore data. If a password is not given for integrity checking, 
         * then integrity checking is not performed.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {(FormatedData|GostKeys.PKSC12)} store The input stream from which the keystore is loaded
         * @param {string} password The password used to check the integrity of the keystore, the password used to unlock the keystore
         * @returns {Promise} Promise to return self object after store loaded
         */
        load: function (store, password)
        {
            var self = __webpack_require__.g;
            return new Promise(call).then(function () {
                // Verify store file
                store = new PKCS12(store);
                return store.verify(password);
            }).then(function () {
                if (store.authSafe.contentType !== 'data')
                    throw new Error('Unsupported PFX format');
                var authSafe = asn1.AuthenticatedSafe.decode(store.authSafe.content).object,
                        promises = [];
                // Decrypt encrypted content
                authSafe.forEach(function (info) {
                    if (info.contentType === 'data')
                        promises.push(new cms.DataContentInfo(info));
                    else if (info.contentType === 'encryptedData')
                        promises.push(new cms.EncryptedDataContentInfo(info).getEnclosed(password));
                    else
                        throw new Error('Unsupported PFX format');
                });
                return Promise.all(promises);
            }).then(function (contents) {
                // Read bags
                var entries = {};
                contents.forEach(function (info) {
                    var bags = asn1.SafeContents.decode(info.content).object;
                    bags.forEach(function (bag) {
                        var keyId = coding.Hex.encode((bag.bagAttributes && bag.bagAttributes.localKeyId)
                                || getSeed(4), true), entry = entries[keyId] || (entries[keyId] = {});
                        switch (bag.bagId) {
                            case 'keyBag':
                                entry.key = new PKCS8(bag.bagValue);
                                break;
                            case 'pkcs8ShroudedKeyBag':
                                entry.key = new PKCS8Encrypted(bag.bagValue);
                                break;
                            case 'secretBag':
                                if (bag.bagValue.secretTypeId === 'secret')
                                    entry.key = bag.bagValue.secretValue;
                                break;
                            case 'certBag':
                                var certs = entry.certs || (entry.certs = []);
                                if (bag.bagValue.certId === 'x509Certificate')
                                    certs.push(new cert.X509(bag.bagValue.certValue));
                                break;
                            case 'crlBag':
                                var crls = entry.crls || (entry.crls = []);
                                if (bag.bagValue.crlId === 'x509CRL')
                                    crls.push(new cert.CRL(bag.bagValue.crlValue));
                                break;
                        }
                        if (bag.bagAttributes && bag.bagAttributes.friendlyName)
                            entry.friendlyName = bag.bagAttributes.friendlyName;
                    });
                });
                // Decrypt keys
                var promises = [];
                for (var name in entries)
                    promises.push((function (entry) {
                        // Try to decrypt private key
                        if (entry.key instanceof PKCS8Encrypted)
                            return entry.key.getKey(password).then(function (key) {
                                // Return entry with decrypted key
                                entry.key = key;
                                return entry;
                            })['catch'](function () {
                                // Return entry with encrypted key
                                return entry;
                            });
                        else
                            return entry;
                    })(entries[name]));
                return Promise.all(promises);
            }).then(function (entries) {
                // Set alias names
                entries.forEach(function (entry) {
                    var friendlyName = entry.friendlyName;
                    if (friendlyName) {
                        delete entry.friendlyName;
                        self.entries[friendlyName] = entry;
                    } else
                        self.entries[generateUUID()] = entry;
                });
                return self;
            });
        },
        /**
         * Stores this keystore to the given output stream, and protects its integrity with the given password.
         * 
         * @memberOf GostKeys.KeyStore
         * @instance
         * @param {string} password The password to generate the keystore integrity check
         * @param {string} digestAlgortihm The digest algorithm or provider name for integrity check
         * @param {string} encryptionAlgortihm The encryption algorithm or provider name for encrypt certificates
         * @returns {Promise} Promise to return {@link GostKeyst.PKCS12} 
         */
        store: function (password, digestAlgortihm, encryptionAlgortihm)
        {
            var self = this, keys = [], contents = [], authSafe = [];
            return new Promise(call).then(function () {
                // Define encryption algorithm
                if (encryptionAlgortihm)
                    encryptionAlgortihm = providers[encryptionAlgortihm] ?
                            providers[encryptionAlgortihm].pbes : encryptionAlgortihm;
                else if (digestAlgortihm)
                    encryptionAlgortihm = providers[digestAlgortihm] ?
                            providers[digestAlgortihm].pbes : providers[options.providerName].pbes;
                else
                    encryptionAlgortihm = providers[options.providerName].pbes;
                // Prepare keys and certs
                var index = 1;
                for (var name in self.entries) {
                    var keyId = new Uint32Array([index]), entry = self.entries[name];
                    if (entry.key) {
                        (function (key, attributes) {
                            if (key instanceof CryptoOperationData)
                                contents.push({
                                    bagId: 'secretBag',
                                    bagValue: {
                                        secretTypeId: 'secret',
                                        secretValue: key,
                                        bagAttributes: attributes
                                    }
                                });
                            else if (key instanceof PKCS8) {
                                if (encryptionAlgortihm && password)
                                    keys.push(new PKCS8Encrypted().setKey(key, password, encryptionAlgortihm).then(function (encryptedKey) {
                                        return {
                                            bagId: 'pkcs8ShroudedKeyBag',
                                            bagValue: encryptedKey,
                                            bagAttributes: attributes
                                        };
                                    }));
                                else
                                    keys.push({
                                        bagId: 'keyBag',
                                        bagValue: key,
                                        bagAttributes: attributes
                                    });
                            } else if (key instanceof PKCS8Encrypted)
                                keys.push({
                                    bagId: 'pkcs8ShroudedKeyBag',
                                    bagValue: key,
                                    bagAttributes: attributes
                                });
                        })(entry.key, {
                            localKeyId: keyId,
                            friendlyName: name
                        });
                    }
                    if (entry.certs) {
                        entry.certs.forEach(function (certificate) {
                            var attributes = {localKeyId: keyId};
                            if (certificate instanceof cert.X509)
                                contents.push({
                                    bagId: 'certBag',
                                    bagValue: {
                                        certId: 'x509Certificate',
                                        certValue: certificate
                                    },
                                    bagAttributes: attributes
                                });
                        });
                    }
                    if (entry.crls) {
                        entry.crls.forEach(function (crl) {
                            var attributes = {localKeyId: keyId};
                            if (crl instanceof cert.CRL)
                                contents.push({
                                    bagId: 'crlBag',
                                    bagValue: {
                                        crlId: 'x509CRL',
                                        crlValue: crl
                                    },
                                    bagAttributes: attributes
                                });
                        });
                    }
                }
                // Encrypt keys
                if (keys.length > 0)
                    return Promise.all(keys);
            }).then(function (bags) {
                if (bags) {
                    var keyContents = asn1.SafeContents.encode(bags);
                    authSafe.push(new cms.DataContentInfo({
                        contentType: 'data',
                        content: keyContents
                    }));
                }

                // Encrypt certificates and crls
                if (contents.length > 0) {
                    contents = asn1.SafeContents.encode(contents);
                    if (encryptionAlgortihm && password)
                        return new cms.EncryptedDataContentInfo().encloseContent(
                                contents, password, encryptionAlgortihm);
                    else
                        return new cms.DataContentInfo().encloseContent(contents);
                }
            }).then(function (contents) {
                authSafe.push(contents);
                // Set enclosed data
                authSafe = new asn1.AuthenticatedSafe(authSafe);
                var store = new PKCS12();
                store.authSafe = {
                    contentType: 'data',
                    content: authSafe.encode()
                };
                // Return new PKCS12 with enclosed authenificated content
                return store.sign(password, digestAlgortihm);
            });
        }
    });

    /**
     * This class represents a storage facility for cryptographic keys and certificates.
     * 
     * @memberOf GostKeys
     * @type GostKeys.KeyStore
     */
    GostKeys.prototype.KeyStore = KeyStore;

    /**
     * Implements the Key and Certificate Store methods
     * 
     * @memberOf gostCrypto
     * @type GostKeys
     */
    gostCrypto.keys = new GostKeys();

module.exports = GostKeys;


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostRandom.js":
/*!*********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostRandom.js ***!
  \*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/** 
 * @file Implementation Web Crypto random generatore for GOST algorithms
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

    /**
     * The gostCrypto provide general purpose cryptographic functionality for
     * GOST standards including a cryptographically strong pseudo-random number 
     * generator seeded with truly random values.
     * 
     * @Class GostRandom
     * 
     */

    var root = __webpack_require__.g;
    var rootCrypto = root.crypto || root.msCrypto;

    var TypeMismatchError = root.TypeMismatchError || Error;
    var QuotaExceededError = root.QuotaExceededError || Error;

    // Initialize mouse and time counters for random generator    
    var randomRing = {
        seed: new Uint8Array(1024),
        getIndex: 0,
        setIndex: 0,
        set: function (x) {
            if (this.setIndex >= 1024)
                this.setIndex = 0;
            this.seed[this.setIndex++] = x;
        },
        get: function () {
            if (this.getIndex >= 1024)
                this.getIndex = 0;
            return this.seed[this.getIndex++];
        }
    };

    function GostRandom() {
    }

    /**
     * The getRandomValues method generates cryptographically random values. <br><br>
     * 
     * Random generator based on JavaScript Web Crypto random genereator 
     * (if it is possible) or  Math.random mixed with time and parameters of 
     * mouse and keyboard events
     * 
     * @memberOf GostRandom
     * @param {(ArrayBuffer|ArrayBufferView)} array Destination buffer for random data
     */
    GostRandom.prototype.getRandomValues = function (array)
    {

        if (!array.byteLength)
            throw new TypeMismatchError('Array is not of an integer type (Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, or Uint32Array)');

        if (array.byteLength > 65536)
            throw new QuotaExceededError('Byte length of array can\'t be greate then 65536');

        var u8 = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
        if (rootCrypto && rootCrypto.getRandomValues) {
            // Native window cryptographic interface
            rootCrypto.getRandomValues(u8);
        } else {
            // Standard Javascript method
            for (var i = 0, n = u8.length; i < n; i++)
                u8[i] = Math.floor(256 * Math.random()) & 255;
        }

        // Mix bio randomizator
        for (var i = 0, n = u8.length; i < n; i++)
            u8[i] = u8[i] ^ randomRing.get();
        return array;
    };

module.exports = GostRandom;



/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostSecurity.js":
/*!***********************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostSecurity.js ***!
  \***********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file GOST and common ASN.1 Object and Algorithm Identifiers 
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");

    var root = __webpack_require__.g;

    // Expand javascript object
    function expand() {
        var r = {};
        for (var i = 0, n = arguments.length; i < n; i++) {
            var item = arguments[i];
            if (typeof item === 'object')
                for (var name in item)
                    r[name] = item[name];
        }
        return r;
    }


    /**
     * Freandly names for ASN.1 Object Identifiers
     * 
     * @field names
     * @memberOf GostSecurity
     */
    var names = {
        // CryptoPro algoritms
        '1.2.643.2.2': 'CryptoPro',
        '1.2.643.2.2.3': 'id-GostR3411-94-with-GostR3410-2001',
        '1.2.643.2.2.4': 'id-GostR3411-94-with-GostR3410-94',
        '1.2.643.2.2.9': 'id-GostR3411-94',
        '1.2.643.2.2.10': 'id-HMACGostR3411-94',
        '1.2.643.2.2.13.0': 'id-Gost28147-89-None-KeyWrap',
        '1.2.643.2.2.13.1': 'id-Gost28147-89-CryptoPro-KeyWrap',
        '1.2.643.2.2.14.0': 'id-Gost28147-89-None-KeyMeshing',
        '1.2.643.2.2.14.1': 'id-Gost28147-89-CryptoPro-KeyMeshing',
        '1.2.643.2.2.19': 'id-GostR3410-2001',
        '1.2.643.2.2.20': 'id-GostR3410-94',
        '1.2.643.2.2.20.1': 'id-GostR3410-94-a',
        '1.2.643.2.2.20.2': 'id-GostR3410-94-aBis',
        '1.2.643.2.2.20.3': 'id-GostR3410-94-b',
        '1.2.643.2.2.20.4': 'id-GostR3410-94-bBis',
        '1.2.643.2.2.21': 'id-Gost28147-89',
        '1.2.643.2.2.22': 'id-Gost28147-89-MAC',
        '1.2.643.2.2.30.0': 'id-GostR3411-94-TestParamSet',
        '1.2.643.2.2.30.1': 'id-GostR3411-94-CryptoProParamSet',
        '1.2.643.2.2.30.2': 'id-GostR3411-94-CryptoPro-B-ParamSet',
        '1.2.643.2.2.30.3': 'id-GostR3411-94-CryptoPro-C-ParamSet',
        '1.2.643.2.2.30.4': 'id-GostR3411-94-CryptoPro-D-ParamSet',
        '1.2.643.2.2.31.0': 'id-Gost28147-89-TestParamSet',
        '1.2.643.2.2.31.1': 'id-Gost28147-89-CryptoPro-A-ParamSet',
        '1.2.643.2.2.31.2': 'id-Gost28147-89-CryptoPro-B-ParamSet',
        '1.2.643.2.2.31.3': 'id-Gost28147-89-CryptoPro-C-ParamSet',
        '1.2.643.2.2.31.4': 'id-Gost28147-89-CryptoPro-D-ParamSet',
        '1.2.643.2.2.31.5': 'id-Gost28147-89-CryptoPro-Oscar-1-1-ParamSet',
        '1.2.643.2.2.31.6': 'id-Gost28147-89-CryptoPro-Oscar-1-0-ParamSet',
        '1.2.643.2.2.31.7': 'id-Gost28147-89-CryptoPro-RIC-1-ParamSet ',
        '1.2.643.2.2.31.12': 'id-Gost28147-89-CryptoPro-tc26-1',
        '1.2.643.2.2.31.13': 'id-Gost28147-89-CryptoPro-tc26-2',
        '1.2.643.2.2.31.14': 'id-Gost28147-89-CryptoPro-tc26-3',
        '1.2.643.2.2.31.15': 'id-Gost28147-89-CryptoPro-tc26-4',
        '1.2.643.2.2.31.16': 'id-Gost28147-89-CryptoPro-tc26-5',
        '1.2.643.2.2.31.17': 'id-Gost28147-89-CryptoPro-tc26-6',
        '1.2.643.2.2.32.0': 'id-GostR3410-94-TestParamSet',
        '1.2.643.2.2.32.2': 'id-GostR3410-94-CryptoPro-A-ParamSet',
        '1.2.643.2.2.32.3': 'id-GostR3410-94-CryptoPro-B-ParamSet',
        '1.2.643.2.2.32.4': 'id-GostR3410-94-CryptoPro-C-ParamSet',
        '1.2.643.2.2.32.5': 'id-GostR3410-94-CryptoPro-D-ParamSet',
        '1.2.643.2.2.33.1': 'id-GostR3410-94-CryptoPro-XchA-ParamSet',
        '1.2.643.2.2.33.2': 'id-GostR3410-94-CryptoPro-XchB-ParamSet',
        '1.2.643.2.2.33.3': 'id-GostR3410-94-CryptoPro-XchC-ParamSet',
        // Certificate center attributes
        '1.2.643.2.2.34.2': 'temporaryAccessToRC',
        '1.2.643.2.2.34.3': 'internetContentSignature',
        '1.2.643.2.2.34.4': 'adminRC',
        '1.2.643.2.2.34.5': 'operatorRC',
        '1.2.643.2.2.34.6': 'userRC',
        '1.2.643.2.2.34.7': 'clientRC',
        '1.2.643.2.2.34.8': 'serverRC',
        '1.2.643.2.2.34.9': 'sysAdminRC',
        '1.2.643.2.2.34.10': 'arcAdminRC',
        '1.2.643.2.2.34.11': 'authorityPersonRC',
        '1.2.643.2.2.34.12': 'clientCC',
        '1.2.643.2.2.34.13': 'sysAdminCC',
        '1.2.643.2.2.34.14': 'arcAdminCC',
        '1.2.643.2.2.34.15': 'accessIPSecCA',
        '1.2.643.2.2.34.16': 'auditAdminHSM',
        '1.2.643.2.2.34.21': 'adminHSM',
        '1.2.643.2.2.34.22': 'serverAdminHSH',
        '1.2.643.2.2.34.24': 'winlogonCA',
        '1.2.643.2.2.34.25': 'timestampServiceUser',
        '1.2.643.2.2.34.26': 'statusServiceUser',
        '1.2.643.2.2.34.27': 'arcAdminHSM',
        '1.2.643.2.2.34.28': 'auditorHSM',
        // CryptoPro algoritms
        '1.2.643.2.2.35.0': 'id-GostR3410-2001-CryptoPro-TestParamSet',
        '1.2.643.2.2.35.1': 'id-GostR3410-2001-CryptoPro-A-ParamSet',
        '1.2.643.2.2.35.2': 'id-GostR3410-2001-CryptoPro-B-ParamSet',
        '1.2.643.2.2.35.3': 'id-GostR3410-2001-CryptoPro-C-ParamSet',
        '1.2.643.2.2.36.0': 'id-GostR3410-2001-CryptoPro-XchA-ParamSet',
        '1.2.643.2.2.36.1': 'id-GostR3410-2001-CryptoPro-XchB-ParamSet',
        "1.2.643.2.2.37.1": 'id-CryptoPro-GostPrivateKeys-V1',
        "1.2.643.2.2.37.2": 'id-CryptoPro-GostPrivateKeys-V2',
        "1.2.643.2.2.37.2.1": 'id-CryptoPro-GostPrivateKeys-V2-Full',
        "1.2.643.2.2.37.2.2": 'id-CryptoPro-GostPrivateKeys-V2-PartOf',
        '1.2.643.2.2.37.3.1': 'intermediateCertificates',
        '1.2.643.2.2.37.3.2': 'trustedCertificatesSignature',
        '1.2.643.2.2.37.3.3': 'trustedCertificatesExchange',
        '1.2.643.2.2.37.3.10': 'keyValidity',
        '1.2.643.2.2.38.1': 'personalBaseProlicy',
        '1.2.643.2.2.38.2': 'networkBasePolicy',
        '1.2.643.2.2.47.1': 'id-CryptoPro-ocsp-treats-exp-key-or-exp-cert-rev',
        '1.2.643.2.2.47.2': 'id-CryptoPro-ocsp-crl-locator',
        '1.2.643.2.2.47.3': 'id-CryptoPro-ocsp-instant-revocation-indicator',
        '1.2.643.2.2.47.4': 'id-CryptoPro-ocsp-revocation-announcement-reference',
        '1.2.643.2.2.47.5': 'id-CryptoPro-ocsp-historical-request',
        '1.2.643.2.2.49.2': 'limitedLicense',
        '1.2.643.2.2.96': 'id-GostR3410-2001-CryptoPro-ESDH',
        '1.2.643.2.2.97': 'id-GostR3410-94-CryptoPro-ESDH',
        '1.2.643.2.2.98': 'id-GostR3410-2001DH',
        '1.2.643.2.2.99': 'id-GostR3410-94DH',
        // signature attributes
        '1.2.643.2.45.1.1.1': 'signatureComment',
        '1.2.643.2.45.1.1.2': 'resourceName',
        '1.2.643.2.45.1.1.3': 'signatureUsage',
        // params
        '1.2.643.3.131.1.1': 'INN',
        '1.2.643.3.141.1.1': 'RNS FSS',
        '1.2.643.3.141.1.2': 'KP FSS',
        // tc26
        '1.2.643.7.1': 'tc26',
        '1.2.643.7.1.1.1.1': 'id-tc26-gost3410-12-256',
        '1.2.643.7.1.1.1.2': 'id-tc26-gost3410-12-512',
        '1.2.643.7.1.1.2.1': 'id-tc26-gost3411-94',
        '1.2.643.7.1.1.2.2': 'id-tc26-gost3411-12-256',
        '1.2.643.7.1.1.2.3': 'id-tc26-gost3411-12-512',
        '1.2.643.7.1.1.3.1': 'id-tc26-signwithdigest-gost3410-12-94',
        '1.2.643.7.1.1.3.2': 'id-tc26-signwithdigest-gost3410-12-256',
        '1.2.643.7.1.1.3.3': 'id-tc26-signwithdigest-gost3410-12-512',
        '1.2.643.7.1.1.4.1': 'id-tc26-hmac-gost-3411-12-256',
        '1.2.643.7.1.1.4.2': 'id-tc26-hmac-gost-3411-12-512',
        '1.2.643.7.1.1.6.1': 'id-tc26-agreement-gost-3410-12-256',
        '1.2.643.7.1.1.6.2': 'id-tc26-agreement-gost-3410-12-512',
        '1.2.643.7.1.2.1.1.0': 'id-tc26-gost-3410-12-256-paramSetTest',
        '1.2.643.7.1.2.1.1.1': 'id-tc26-gost-3410-12-256-paramSetA',
        '1.2.643.7.1.2.1.1.2': 'id-tc26-gost-3410-12-256-paramSetB',
        '1.2.643.7.1.2.1.2.0': 'id-tc26-gost-3410-12-512-paramSetTest',
        '1.2.643.7.1.2.1.2.1': 'id-tc26-gost-3410-12-512-paramSetA',
        '1.2.643.7.1.2.1.2.2': 'id-tc26-gost-3410-12-512-paramSetB',
        '1.2.643.7.1.2.1.2.3': 'id-tc26-gost-3410-12-512-paramSetC',
        '1.2.643.7.1.2.1.2.4': 'id-tc26-gost-3410-12-512-paramSetD',
        '1.2.643.7.1.2.5.1.1': 'id-tc26-gost-28147-param-Z',
        // GOST Parameters
        '1.2.643.100.1': 'OGRN',
        '1.2.643.100.2.1': 'SMEV-person',
        '1.2.643.100.2.2': 'SMEV-government',
        '1.2.643.100.3': 'SNILS',
        '1.2.643.100.4': 'KPP',
        '1.2.643.100.5': 'OGRNIP',
        '1.2.643.100.6': 'internal-government',
        '1.2.643.100.111': 'subjectSignTool',
        '1.2.643.100.112': 'issuerSignTool',
        '1.2.643.100.113.1': 'signToolClassKC1',
        '1.2.643.100.113.2': 'signToolClassKC2',
        '1.2.643.100.113.3': 'signToolClassKC3',
        '1.2.643.100.113.4': 'signToolClassKB1',
        '1.2.643.100.113.5': 'signToolClassKB2',
        '1.2.643.100.113.6': 'signToolClassKA1',
        '1.2.643.100.114.1': 'issuerToolClassKC1',
        '1.2.643.100.114.2': 'issuerToolClassKC2',
        '1.2.643.100.114.3': 'issuerToolClassKC3',
        '1.2.643.100.114.4': 'issuerToolClassKB2',
        '1.2.643.100.114.5': 'issuerToolClassKB1',
        '1.2.643.100.114.6': 'issuerToolClassKA1',
        // Common algorithms
        '1.2.840.10040.4': 'x9cm',
        '1.2.840.10040.4.1': 'dsa',
        '1.2.840.10040.4.3': 'dsa-with-SHA1',
        '1.2.840.10045': 'ansi-x962',
        '1.2.840.10045.1': 'id-fieldType',
        '1.2.840.10045.1.1': 'id-prime-Field',
        '1.2.840.10045.1.2': 'id-characteristic-two-field',
        '1.2.840.10045.2.1': 'ecPublicKey',
        '1.2.840.10045.3.0': 'characteristicTwo',
        '1.2.840.10045.3.1.1': 'secp192r1',
        '1.2.840.10045.3.1.2': 'prime192v2',
        '1.2.840.10045.3.1.3': 'prime192v3',
        '1.2.840.10045.3.1.4': 'prime239v1',
        '1.2.840.10045.3.1.5': 'prime239v2',
        '1.2.840.10045.3.1.6': 'prime239v3',
        '1.2.840.10045.3.1.7': 'secp256r1',
        '1.2.840.10045.4': 'ecdsa',
        '1.2.840.10045.4.1': 'ecdsa-with-SHA1',
        '1.2.840.10045.4.2': 'ecdsa-with-Recommended',
        '1.2.840.10045.4.4': 'ecdsa-with-SHA2',
        '1.2.840.10045.4.4.1': 'ecdsa-with-SHA224',
        '1.2.840.10045.4.4.2': 'ecdsa-with-SHA256',
        '1.2.840.10045.4.4.3': 'ecdsa-with-SHA384',
        '1.2.840.10045.4.4.4': 'ecdsa-with-SHA512',
        '1.2.840.113533.7.66.13': 'PasswordBasedMac',
        '1.3.6.1.4.1.22554.1.1.2.1.2': 'pbeWithSHAAndAES128-CBC',
        '1.3.6.1.4.1.22554.1.1.2.1.22': 'pbeWithSHAAndAES192-CBC',
        '1.3.6.1.4.1.22554.1.1.2.1.42': 'pbeWithSHAAndAES256-CBC',
        '1.3.6.1.4.1.22554.1.2.1.2.1.2': 'pbeWithSHA256AndAES128-CBC',
        '1.3.6.1.4.1.22554.1.2.1.2.1.22': 'pbeWithSHA256AndAES192-CBC',
        '1.3.6.1.4.1.22554.1.2.1.2.1.42': 'pbeWithSHA256AndAES256-CBC',
        //  Diffie-Hellman Key Exchange Keys
        '1.2.840.113549': 'rsa',
        '1.2.840.113549.1.1.1': 'rsaEncryption',
        '1.2.840.113549.1.1.2': 'md2withRSAEncryption',
        '1.2.840.113549.1.1.3': 'md4withRSAEncryption',
        '1.2.840.113549.1.1.4': 'md5withRSAEncryption',
        '1.2.840.113549.1.1.5': 'sha1withRSAEncryption',
        '1.2.840.113549.1.1.7': 'rsaes-oaep',
        '1.2.840.113549.1.1.8': 'mgf1',
        '1.2.840.113549.1.1.9': 'pSpecified',
        '1.2.840.113549.1.1.10': 'rsassa-pss',
        '1.2.840.113549.1.1.11': 'sha256withRSAEncryption',
        '1.2.840.113549.1.1.12': 'sha384withRSAEncryption',
        '1.2.840.113549.1.1.13': 'sha512withRSAEncryption',
        '1.2.840.113549.1.2.7': 'hmacWithSHA1',
        '1.2.840.113549.1.2.8': 'hmacWithSHA224',
        '1.2.840.113549.1.2.9': 'hmacWithSHA256',
        '1.2.840.113549.1.2.10': 'hmacWithSHA384',
        '1.2.840.113549.1.2.11': 'hmacWithSHA512',
        '1.2.840.113549.1.3.1': 'dhKeyAgreement',
        // pkcs#7 content types
        '1.2.840.113549.1.5.12': 'PBKDF2',
        '1.2.840.113549.1.5.13': 'PBES2',
        '1.2.840.113549.1.5.14': 'PBMAC1',
        '1.2.840.113549.1.7.1': 'data',
        '1.2.840.113549.1.7.2': 'signedData',
        '1.2.840.113549.1.7.3': 'envelopedData',
        '1.2.840.113549.1.7.4': 'signedAndEnvelopedData',
        '1.2.840.113549.1.7.5': 'digestedData',
        '1.2.840.113549.1.7.6': 'encryptedData',
        '1.2.840.113549.1.9.1': 'emailAddress',
        '1.2.840.113549.1.9.2': 'unstructuredName',
        '1.2.840.113549.1.9.3': 'contentType',
        '1.2.840.113549.1.9.4': 'messageDigest',
        '1.2.840.113549.1.9.5': 'signingTime',
        '1.2.840.113549.1.9.6': 'countersignature',
        '1.2.840.113549.1.9.7': 'challengePassword',
        '1.2.840.113549.1.9.8': 'unstructuredAddress',
        '1.2.840.113549.1.9.9': 'extendedCertificateAttributes',
        '1.2.840.113549.1.9.10': 'issuerAndSerialNumber',
        '1.2.840.113549.1.9.11': 'passwordCheck',
        '1.2.840.113549.1.9.12': 'publicKey',
        '1.2.840.113549.1.9.13': 'signingDescription',
        '1.2.840.113549.1.9.14': 'extensionRequest',
        '1.2.840.113549.1.9.15': 'sMimeCapabilities',
        '1.2.840.113549.1.9.16': 'sMimeObjectIdentifierRegistry',
        '1.2.840.113549.1.9.16.1.2': 'authData',
        '1.2.840.113549.1.9.16.1.4 ': 'timestampToken',
        '1.2.840.113549.1.9.16.1.17 ': 'firmwareLoadReceipt',
        '1.2.840.113549.1.9.16.1.21': 'encKeyWithID',
        '1.2.840.113549.1.9.16.1.23': 'authEnvelopedData',
        '1.2.840.113549.1.9.16.2': 'sMimeAttributes',
        '1.2.840.113549.1.9.16.2.1': 'receiptRequest',
        '1.2.840.113549.1.9.16.2.12': 'signingCertificate',
        '1.2.840.113549.1.9.16.2.14': 'timeStampToken',
        '1.2.840.113549.1.9.16.2.2': 'securityLabel',
        '1.2.840.113549.1.9.16.2.3': 'mlExpansionHistory',
        '1.2.840.113549.1.9.16.2.34': 'unsignedData',
        '1.2.840.113549.1.9.16.2.47': 'signingCertificateV2',
        '1.2.840.113549.1.9.16.3.5': 'ESDH',
        // pkcs#9 oids
        '1.2.840.113549.1.9.20': 'friendlyName',
        '1.2.840.113549.1.9.21': 'localKeyId',
        '1.2.840.113549.1.9.22': 'certTypes',
        '1.2.840.113549.1.9.22.1': 'x509Certificate',
        '1.2.840.113549.1.9.22.2': 'sdsiCertificate',
        '1.2.840.113549.1.9.23': 'crlTypes',
        '1.2.840.113549.1.9.23.1': 'x509CRL',
        '1.2.840.113549.1.9.24': 'secretTypes',
        '1.2.840.113549.1.9.24.1': 'secret',
        '1.2.840.113549.1.9.25.1': 'pkcs15Token',
        '1.2.840.113549.1.9.25.2': 'encryptedPrivateKeyInfo',
        '1.2.840.113549.1.9.25.3': 'randomNonce',
        '1.2.840.113549.1.9.25.4': 'sequenceNumber',
        '1.2.840.113549.1.9.25.5': 'pkcs7PDU',
        '1.2.840.113549.1.9.26.1': 'pkcs9String',
        '1.2.840.113549.1.9.26.2': 'signingTimeString',
        '1.2.840.113549.1.9.27.1': 'caseIgnoreMatch',
        '1.2.840.113549.1.9.27.2': 'signingTimeMatch',
        // password-based-encryption for pkcs#12
        '1.2.840.113549.1.12.0.1': 'pkcs-12',
        '1.2.840.113549.1.12.1': 'pbe',
        '1.2.840.113549.1.12.1.1': 'pbeWithSHAAnd128BitRC4',
        '1.2.840.113549.1.12.1.2': 'pbeWithSHAAnd40BitRC4',
        '1.2.840.113549.1.12.1.3': 'pbeWithSHAAnd3-KeyTripleDES-CBC',
        '1.2.840.113549.1.12.1.4': 'pbeWithSHAAnd2-KeyTripleDES-CBC',
        '1.2.840.113549.1.12.1.5': 'pbeWithSHAAnd128BitRC2-CBC',
        '1.2.840.113549.1.12.1.6': 'pbeWithSHAAnd40BitRC2-CBC',
        '1.2.840.113549.1.12.1.80': 'pbeUnknownGost',
        '1.2.840.113549.1.12.2.1': 'pkcs8-key-shrouding',
        '1.2.840.113549.1.12.3.1': 'keyBagId',
        '1.2.840.113549.1.12.3.2': 'certAndCRLBagId',
        '1.2.840.113549.1.12.3.3': 'secretBagId',
        '1.2.840.113549.1.12.3.4': 'safeContentsId',
        '1.2.840.113549.1.12.3.5': 'pkcs-8ShroudedKeyBagId',
        '1.2.840.113549.1.12.4.1': 'x509CertCRLBagId',
        '1.2.840.113549.1.12.4.2': 'pkcs-12-SDSICertBag',
        // pkcs#12 safe bags
        '1.2.840.113549.1.12.10.1.1': 'keyBag',
        '1.2.840.113549.1.12.10.1.2': 'pkcs8ShroudedKeyBag',
        '1.2.840.113549.1.12.10.1.3': 'certBag',
        '1.2.840.113549.1.12.10.1.4': 'crlBag',
        '1.2.840.113549.1.12.10.1.5': 'secretBag',
        '1.2.840.113549.1.12.10.1.6': 'safeContentsBag',
        // hash algorithm
        '1.2.840.113549.2.5': 'md-5',
        // symmetric key algorithm oids
        '1.2.840.113549.3.7': 'des-EDE3-CBC',
        // additional algorithms
        '1.3.132.0.34': 'secp384r1',
        '1.3.132.0.35': 'secp521r1',
        '1.3.132.112': 'ecDH',
        '1.3.14.3.2.26': 'sha1',
        '1.3.6.1.4.1.311.2.1.14': 'msCertExtensions',
        '1.3.6.1.4.1.311.17.1': 'keyProviderNameAttr',
        '1.3.6.1.4.1.311.17.2': 'localMachineKeyset',
        '1.3.6.1.4.1.311.17.3.20': 'certKeyIdentifierPropId',
        // SignalCom algorithms
        '1.3.6.1.4.1.5849': 'SignalCom',
        '1.3.6.1.4.1.5849.1.1.1': 'id-sc-gost28147-ecb',
        '1.3.6.1.4.1.5849.1.1.2': 'id-sc-gost28147-gamma',
        '1.3.6.1.4.1.5849.1.1.3': 'id-sc-gost28147-gfb',
        '1.3.6.1.4.1.5849.1.1.4': 'id-sc-gost28147-mac',
        '1.3.6.1.4.1.5849.1.1.5': 'id-sc-gostR3410-94',
        '1.3.6.1.4.1.5849.1.1.6.1.1.1': 'id-sc-gostR3410-94-default',
        '1.3.6.1.4.1.5849.1.1.6.1.1.2': 'id-sc-gostR3410-94-test',
        '1.3.6.1.4.1.5849.1.2.1': 'id-sc-gostR3411-94',
        '1.3.6.1.4.1.5849.1.3.1': 'id-sc-gostR3411-94-with-gostR3410-94',
        '1.3.6.1.4.1.5849.1.3.2': 'id-sc-gostR3411-94-with-gostR3410-2001',
        '1.3.6.1.4.1.5849.1.4.1': 'id-sc-cmsGostWrap',
        '1.3.6.1.4.1.5849.1.4.2': 'id-sc-cmsGost28147Wrap',
        '1.3.6.1.4.1.5849.1.5.1': 'id-sc-pbeWithGost3411AndGost28147',
        '1.3.6.1.4.1.5849.1.5.2': 'id-sc-pbeWithGost3411AndGost28147CFB',
        '1.3.6.1.4.1.5849.1.6.2': 'id-sc-gostR3410-2001',
        '1.3.6.1.4.1.5849.1.7.2': 'id-sc-hmacWithGostR3411',
        '1.3.6.1.4.1.5849.1.8.1': 'id-sc-r3410-ESDH-r3411kdf',
        '1.3.6.1.4.1.5849.1.8.3': 'id-sc-ecdh-singlePass-cofactor-r3411kdf',
        '1.3.6.1.4.1.5849.2.2.1': 'id-sc-gostR3410-2001-publicKey',
        // additinal data
        '1.3.6.1.5.5.7.0.12': 'attribute-cert',
        '1.3.6.1.5.5.7.1.1': 'authorityInfoAccess',
        '1.3.6.1.5.5.7.1.4': 'auditIdentity',
        '1.3.6.1.5.5.7.1.6': 'aaControls',
        '1.3.6.1.5.5.7.1.10': 'ac-proxying',
        '1.3.6.1.5.5.7.1.11': 'subjectInfoAccess',
        '1.3.6.1.5.5.7.3.1': 'serverAuth',
        '1.3.6.1.5.5.7.3.2': 'clientAuth',
        '1.3.6.1.5.5.7.3.3': 'codeSigning',
        '1.3.6.1.5.5.7.3.4': 'emailProtection',
        '1.3.6.1.5.5.7.3.5': 'ipsecEndSystem',
        '1.3.6.1.5.5.7.3.6': 'ipsecTunnel',
        '1.3.6.1.5.5.7.3.7': 'ipsecUser',
        '1.3.6.1.5.5.7.3.8': 'timeStamping',
        '1.3.6.1.5.5.7.3.9': 'OCSPSigning',
        '1.3.6.1.5.5.7.5.1': 'regCtrl',
        '1.3.6.1.5.5.7.5.1.1': 'regToken',
        '1.3.6.1.5.5.7.5.1.2': 'authenticator',
        '1.3.6.1.5.5.7.5.1.3': 'pkiPublicationInfo',
        '1.3.6.1.5.5.7.5.1.4': 'pkiArchiveOptions',
        '1.3.6.1.5.5.7.5.1.5': 'oldCertID',
        '1.3.6.1.5.5.7.5.1.6': 'protocolEncrKey',
        '1.3.6.1.5.5.7.5.2': 'regInfoAttr',
        '1.3.6.1.5.5.7.5.2.1': 'UTF8Pairs',
        '1.3.6.1.5.5.7.5.2.2': 'certReq',
        '1.3.6.1.5.5.7.6.2': 'noSignature',
        '1.3.6.1.5.5.7.7.1': 'statusInfo',
        '1.3.6.1.5.5.7.7.2': 'identification',
        '1.3.6.1.5.5.7.7.3': 'identityProof',
        '1.3.6.1.5.5.7.7.4': 'dataReturn',
        '1.3.6.1.5.5.7.7.5': 'transactionId',
        '1.3.6.1.5.5.7.7.6': 'senderNonce',
        '1.3.6.1.5.5.7.7.7': 'recipientNonce',
        '1.3.6.1.5.5.7.7.8': 'addExtensions',
        '1.3.6.1.5.5.7.7.9': 'encryptedPOP',
        '1.3.6.1.5.5.7.7.10': 'decryptedPOP',
        '1.3.6.1.5.5.7.7.11': 'lraPOPWitness',
        '1.3.6.1.5.5.7.7.15': 'getCert',
        '1.3.6.1.5.5.7.7.16': 'getCRL',
        '1.3.6.1.5.5.7.7.17': 'revokeRequest',
        '1.3.6.1.5.5.7.7.18': 'regInfo',
        '1.3.6.1.5.5.7.7.19': 'responseInfo',
        '1.3.6.1.5.5.7.7.21': 'queryPending',
        '1.3.6.1.5.5.7.7.22': 'popLinkRandom',
        '1.3.6.1.5.5.7.7.23': 'popLinkWitness',
        '1.3.6.1.5.5.7.7.24': 'confirmCertAcceptance',
        '1.3.6.1.5.5.7.7.25': 'statusInfoV2',
        '1.3.6.1.5.5.7.7.26': 'trustedAnchors',
        '1.3.6.1.5.5.7.7.27': 'authPublish',
        '1.3.6.1.5.5.7.7.28': 'batchRequests',
        '1.3.6.1.5.5.7.7.29': 'batchResponses',
        '1.3.6.1.5.5.7.7.30': 'publishCert',
        '1.3.6.1.5.5.7.7.31': 'modCertTemplate',
        '1.3.6.1.5.5.7.7.32': 'controlProcessed',
        '1.3.6.1.5.5.7.7.33': 'popLinkWitnessV2',
        '1.3.6.1.5.5.7.7.34': 'identityProofV2',
        '1.3.6.1.5.5.7.9.1': 'dateOfBirth',
        '1.3.6.1.5.5.7.9.2': 'placeOfBirth',
        '1.3.6.1.5.5.7.9.3': 'gender',
        '1.3.6.1.5.5.7.9.4': 'countryOfCitizenship',
        '1.3.6.1.5.5.7.9.5': 'countryOfResidence',
        '1.3.6.1.5.5.7.10.1': 'authenticationInfo',
        '1.3.6.1.5.5.7.10.2': 'accessIdentity',
        '1.3.6.1.5.5.7.10.3': 'chargingIdentity',
        '1.3.6.1.5.5.7.10.4': 'group',
        '1.3.6.1.5.5.7.10.6': 'encAttrs',
        '1.3.6.1.5.5.7.12.2': 'PKIData',
        '1.3.6.1.5.5.7.12.3': 'PKIResponse',
        '1.3.6.1.5.5.7.48.1.1': 'ocsp-basic',
        '1.3.6.1.5.5.7.48.1.2': 'ocsp-nonce',
        '1.3.6.1.5.5.7.48.1.3': 'ocsp-crl',
        '1.3.6.1.5.5.7.48.1.4': 'ocsp-response',
        '1.3.6.1.5.5.7.48.1.5': 'ocsp-nocheck',
        '1.3.6.1.5.5.7.48.1.6': 'ocsp-archive-cutoff',
        '1.3.6.1.5.5.7.48.1.7': 'ocsp-service-locator',
        // Key packages
        '2.16.840.1.101.2.1.2.78.2': 'encryptedKeyPkg',
        '2.16.840.1.101.2.1.2.78.3': 'keyPackageReceipt',
        '2.16.840.1.101.2.1.2.78.5': 'aKeyPackage',
        '2.16.840.1.101.2.1.2.78.6': 'keyPackageError',
        // symmetric key algorithm oids
        '2.16.840.1.101.3.4': 'nistAlgorithms',
        '2.16.840.1.101.3.4.1': 'aes',
        '2.16.840.1.101.3.4.1.1': 'aes128-ECB',
        '2.16.840.1.101.3.4.1.2': 'aes128-CBC',
        '2.16.840.1.101.3.4.1.3': 'aes128-OFB',
        '2.16.840.1.101.3.4.1.4': 'aes128-CFB',
        '2.16.840.1.101.3.4.1.5': 'aes128-wrap',
        '2.16.840.1.101.3.4.1.6': 'aes128-GCM',
        '2.16.840.1.101.3.4.1.7': 'aes128-CCM',
        '2.16.840.1.101.3.4.1.8': 'aes128-wrap-pad',
        '2.16.840.1.101.3.4.1.21': 'aes192-ECB',
        '2.16.840.1.101.3.4.1.22': 'aes192-CBC',
        '2.16.840.1.101.3.4.1.23': 'aes192-OFB',
        '2.16.840.1.101.3.4.1.24': 'aes192-CFB',
        '2.16.840.1.101.3.4.1.25': 'aes192-wrap',
        '2.16.840.1.101.3.4.1.26': 'aes192-GCM',
        '2.16.840.1.101.3.4.1.27': 'aes192-CCM',
        '2.16.840.1.101.3.4.1.28': 'aes192-wrap-pad',
        '2.16.840.1.101.3.4.1.41': 'aes256-ECB',
        '2.16.840.1.101.3.4.1.42': 'aes256-CBC',
        '2.16.840.1.101.3.4.1.43': 'aes256-OFB',
        '2.16.840.1.101.3.4.1.44': 'aes256-CFB',
        '2.16.840.1.101.3.4.1.45': 'aes256-wrap',
        '2.16.840.1.101.3.4.1.46': 'aes256-GCM',
        '2.16.840.1.101.3.4.1.47': 'aes256-CCM',
        '2.16.840.1.101.3.4.1.48': 'aes256-wrap-pad',
        // hash algorihtms
        '2.16.840.1.101.3.4.2.1': 'sha256',
        '2.16.840.1.101.3.4.2.2': 'sha384',
        '2.16.840.1.101.3.4.2.3': 'sha512',
        // pkcs12
        '2.16.840.1.113730.3.1.216': 'userPKCS12',
        // certificate issuer/subject OIDsets
        '2.5.1.5.55': 'clearance',
        '2.5.4.0': 'objectClass',
        '2.5.4.1': 'aliasedEntryName',
        '2.5.4.2': 'knowldgeinformation',
        '2.5.4.3': 'commonName',
        '2.5.4.5': 'serialName',
        '2.5.4.6': 'countryName',
        '2.5.4.7': 'localityName',
        '2.5.4.8': 'stateOrProvinceName',
        '2.5.4.9': 'streetAddress',
        '2.5.4.10': 'organizationName',
        '2.5.4.11': 'organizationalUnitName',
        '2.5.4.12': 'title',
        '2.5.4.13': 'description',
        '2.5.4.14': 'searchGuide',
        '2.5.4.15': 'businessCategory',
        '2.5.4.16': 'postalAddress',
        '2.5.4.17': 'postalCode',
        '2.5.4.18': 'postOfficeBox',
        '2.5.4.19': 'physicalDeliveryOfficeName',
        '2.5.4.20': 'telephoneNumber',
        '2.5.4.21': 'telexNumber',
        '2.5.4.22': 'teletexTerminalIdentifier',
        '2.5.4.23': 'facsimileTelephoneNumber',
        '2.5.4.24': 'x121Address',
        '2.5.4.25': 'internationalISDNNumber',
        '2.5.4.26': 'registeredAddress',
        '2.5.4.27': 'destinationIndicator',
        '2.5.4.28': 'preferredDeliveryMethod',
        '2.5.4.29': 'presentationAddress',
        '2.5.4.30': 'supportedApplicationContext',
        '2.5.4.31': 'member',
        '2.5.4.32': 'owner',
        '2.5.4.33': 'roleOccupant',
        '2.5.4.34': 'seeAlso',
        '2.5.4.35': 'userPassword',
        '2.5.4.36': 'userCertificate',
        '2.5.4.37': 'cACertificate',
        '2.5.4.38': 'authorityRevocationList',
        '2.5.4.39': 'certificateRevocationList',
        '2.5.4.40': 'crossCertificatePair',
        '2.5.4.41': 'name',
        '2.5.4.42': 'givenName',
        '2.5.4.43': 'initials',
        '2.5.4.44': 'generationQualifier',
        '2.5.4.45': 'uniqueIdentifier',
        '2.5.4.46': 'dnQualifier',
        '2.5.4.47': 'enhancedSearchGuide',
        '2.5.4.48': 'protocolInformation',
        '2.5.4.49': 'distinguishedName',
        '2.5.4.50': 'uniqueMember',
        '2.5.4.51': 'houseIdentifier',
        '2.5.4.52': 'supportedAlgorithms',
        '2.5.4.53': 'deltaRevocationList',
        '2.5.4.58': 'attributeCertificate',
        '2.5.4.65': 'pseudonym',
        '2.5.4.72': 'role',
        // X.509 extension OIDsets
        '2.5.29.1': 'authorityKeyIdentifierX',
        '2.5.29.2': 'keyAttributesX',
        '2.5.29.3': 'certificatePoliciesX',
        '2.5.29.4': 'keyUsageRestriction',
        '2.5.29.5': 'policyMapping',
        '2.5.29.6': 'subtreesConstraint',
        '2.5.29.7': 'subjectAltNameX',
        '2.5.29.8': 'issuerAltNameX',
        '2.5.29.9': 'subjectDirectoryAttributes',
        '2.5.29.10': 'basicConstraintsX',
        '2.5.29.11': 'nameConstraintsX',
        '2.5.29.12': 'policyConstraintsX',
        '2.5.29.13': 'basicConstraintsY',
        '2.5.29.14': 'subjectKeyIdentifier',
        '2.5.29.15': 'keyUsage',
        '2.5.29.16': 'privateKeyUsagePeriod',
        '2.5.29.17': 'subjectAltName',
        '2.5.29.18': 'issuerAltName',
        '2.5.29.19': 'basicConstraints',
        '2.5.29.20': 'cRLNumber',
        '2.5.29.21': 'cRLReason',
        '2.5.29.22': 'expirationDate',
        '2.5.29.23': 'instructionCode',
        '2.5.29.24': 'invalidityDate',
        '2.5.29.25': 'cRLDistributionPointsX',
        '2.5.29.26': 'issuingDistributionPointX',
        '2.5.29.27': 'deltaCRLIndicator',
        '2.5.29.28': 'issuingDistributionPoint',
        '2.5.29.29': 'certificateIssuer',
        '2.5.29.30': 'nameConstraints',
        '2.5.29.31': 'cRLDistributionPoints',
        '2.5.29.32': 'certificatePolicies',
        '2.5.29.33': 'policyMappings',
        '2.5.29.34': 'policyConstraintsY',
        '2.5.29.35': 'authorityKeyIdentifier',
        '2.5.29.36': 'policyConstraints',
        '2.5.29.37': 'extKeyUsage',
        '2.5.29.46': 'freshestCRL',
        '2.5.29.54': 'inhibitAnyPolicy',
        '2.5.29.55': 'targetInformation',
        '2.5.29.56': 'noRevAvail'
    };

    /**
     * ASN.1 Object Identifiers for friandly names
     * Generated automaticly
     * @field identifiers
     * @memberOf GostSecurity
     */
    var identifiers = {};
    for (var id in names) 
        identifiers[names[id]] = id;
    


    /**
     * Algorithm identifiers {@link gostCrypto.AlgorithmIdentifier} for Object Identifiers
     * 
     * @field algorithms
     * @memberOf GostSecurity
     */
    var algorithms = {
        // CryptoPro algoritms
        'id-GostR3411-94-with-GostR3410-2001': 'GOST R 34.10-2001/GOST R 34.11-94',
        'id-GostR3411-94-with-GostR3410-94': 'GOST R 34.10-94/GOST R 34.11-94',
        'id-GostR3411-94': 'GOST R 34.11-94',
        'id-HMACGostR3411-94': {name: 'HMAC', hash: {name: 'GOST R 34.11-94'}},
        'id-Gost28147-89-None-KeyWrap': 'GOST 28147-89-KW',
        'id-Gost28147-89-CryptoPro-KeyWrap': 'GOST 28147-89-CPKW',
        'id-GostR3410-2001': 'GOST R 34.10-2001',
        'id-GostR3410-94': 'GOST R 34.10-94',
        'id-GostR3410-94-a': 'GOST R 34.10-94',
        'id-GostR3410-94-aBis': 'GOST R 34.10-94',
        'id-GostR3410-94-b': 'GOST R 34.10-94',
        'id-GostR3410-94-bBis': 'GOST R 34.10-94',
        'id-Gost28147-89': 'GOST 28147-89',
        'id-Gost28147-89-MAC': 'GOST 28147-89-MAC',
        'id-GostR3410-2001-CryptoPro-ESDH': 'GOST R 34.10-2001-DH/GOST R 34.11-94',
        'id-GostR3410-94-CryptoPro-ESDH': 'GOST R 34.10-94-DH/GOST R 34.11-94',
        'id-GostR3410-2001DH': 'GOST R 34.10-2001-DH',
        'id-GostR3410-94DH': 'GOST R 34.10-94-DH',
        // TK-26 attributes
        'id-tc26-gost3410-12-256': 'GOST R 34.10-256',
        'id-tc26-gost3410-12-512': 'GOST R 34.10-512',
        'id-tc26-gost3411-94': 'GOST R 34.11-94',
        'id-tc26-gost3411-12-256': 'GOST R 34.11-256',
        'id-tc26-gost3411-12-512': 'GOST R 34.11-512',
        'id-tc26-signwithdigest-gost3410-12-94': 'GOST R 34.10-256/GOST R 34.11-94',
        'id-tc26-signwithdigest-gost3410-12-256': 'GOST R 34.10-256/GOST R 34.11-256',
        'id-tc26-signwithdigest-gost3410-12-512': 'GOST R 34.10-512/GOST R 34.11-512',
        'id-tc26-hmac-gost-3411-12-256': {name: 'HMAC', hash: {name: 'GOST R 34.11-256'}},
        'id-tc26-hmac-gost-3411-12-512': {name: 'HMAC', hash: {name: 'GOST R 34.11-512'}},
        'id-tc26-agreement-gost-3410-12-256': 'GOST R 34.10-256-DH/GOST R 34.11-256',
        'id-tc26-agreement-gost-3410-12-512': 'GOST R 34.10-512-DH/GOST R 34.11-256',
        // SignalCom algorithms
        'id-sc-gost28147-ecb': 'GOST 28147-89-ECB/SC',
        'id-sc-gost28147-gamma': 'GOST 28147-89-CTR/SC',
        'id-sc-gost28147-gfb': 'GOST 28147-89-CFB/SC',
        'id-sc-gost28147-mac': 'GOST 28147-89-MAC/SC',
        'id-sc-gostR3410-94': 'GOST R 34.10-94/SC',
        'id-sc-gostR3410-94-default': 'GOST R 34.10-94/SC',
        'id-sc-gostR3410-94-test': 'GOST R 34.10-94/SC/S-TEST',
        'id-sc-gostR3411-94': 'GOST R 34.11-94/SC',
        'id-sc-gostR3411-94-with-gostR3410-94': 'GOST R 34.10-94/GOST R 34.11-94/SC',
        'id-sc-gostR3411-94-with-gostR3410-2001': 'GOST R 34.10-2001/GOST R 34.11-94/SC',
        'id-sc-cmsGostWrap': 'GOST 28147-89-SCKW/SC',
        'id-sc-cmsGost28147Wrap': 'GOST 28147-89-KW/SC',
        'id-sc-pbeWithGost3411AndGost28147': {derivation: {name: 'GOST R 34.11-94-PBKDF2/SC'}, encryption: {name: 'GOST 28147-ECB/SC'}},
        'id-sc-pbeWithGost3411AndGost28147CFB': {derivation: {name: 'GOST R 34.11-94-PBKDF2/SC'}, encryption: {name: 'GOST 28147-CFB/SC'}},
        'id-sc-gostR3410-2001': 'GOST R 34.10-2001/SC',
        'id-sc-hmacWithGostR3411': {name: 'HMAC', hash: {name: 'GOST R 34.11-94/SC'}},
        'id-sc-r3410-ESDH-r3411kdf': 'GOST R 34.10-2001-DH/GOST R 34.11-94/SC',
        // RSA algorithms
        noSignature: 'NONE',
        rsaEncryption: {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-256'}},
        sha1withRSAEncryption: {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-1'}},
        sha256withRSAEncryption: {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-256'}},
        sha384withRSAEncryption: {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-384'}},
        sha512withRSAEncryption: {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'SHA-512'}},
        'rsaes-oaep': 'RSA-OAEP',
        'rsassa-pss': 'RSA-PSS',
        // ECDSA
        'ecdsa': 'ECDSA',
        'ecdsa-with-SHA1': {name: 'ECDSA', hash: {name: 'SHA-1'}},
        'ecdsa-with-SHA256': {name: 'ECDSA', hash: {name: 'SHA-256'}},
        'ecdsa-with-SHA384': {name: 'ECDSA', hash: {name: 'SHA-384'}},
        'ecdsa-with-SHA512': {name: 'ECDSA', hash: {name: 'SHA-512'}},
        // Legion of the Bouncy Castle pbe
        'pbeWithSHAAndAES128-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-1'}}, encryption: {name: 'AES-CBC', length: 128}},
        'pbeWithSHAAndAES192-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-1'}}, encryption: {name: 'AES-CBC', length: 192}},
        'pbeWithSHAAndAES256-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-1'}}, encryption: {name: 'AES-CBC', length: 256}},
        'pbeWithSHA256AndAES128-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-256'}}, encryption: {name: 'AES-CBC', length: 128}},
        'pbeWithSHA256AndAES192-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-256'}}, encryption: {name: 'AES-CBC', length: 192}},
        'pbeWithSHA256AndAES256-CBC': {derivation: {name: 'PBKDF2', hash: {name: 'SHA-256'}}, encryption: {name: 'AES-CBC', length: 256}},
        // PKCS12 PBE
        'pbeWithSHAAnd3-KeyTripleDES-CBC': {derivation: {name: 'PFXKDF', iterations: 2000, hash: 'SHA-1'}, encryption: {name: '3DES', block: 'CBC'}},
        'pbeWithSHAAnd2-KeyTripleDES-CBC': {derivation: {name: 'PFXKDF', iterations: 2000, hash: 'SHA-1'}, encryption: {name: '2DES', block: 'CBC'}},
        'pbeWithSHAAnd128BitRC2-CBC': {derivation: {name: 'PFXKDF', iterations: 2000, hash: 'SHA-1'}, encryption: {name: 'RC2', block: 'CBC', length: 128}},
        'pbeWithSHAAnd40BitRC2-CBC': {derivation: {name: 'PFXKDF', iterations: 2000, hash: 'SHA-1'}, encryption: {name: 'RC2', block: 'CBC', length: 40}},
        'pbeUnknownGost': {derivation: {name: 'PFXKDF', iterations: 2000, hash: 'GOST R 34.11-94'}, encryption: {name: 'GOST 28147-89-CFB'}},
        //  Diffie-Hellman Key Exchange Keys
        ecDH: 'ECDH',
        dhKeyAgreement: 'DH',
        // symmetric key algorithm oids
        'aes128-CBC': {name: 'AES-CBC', length: 128},
        'aes128-CFB': {name: 'AES-CFB-8', length: 128},
        'aes128-GCM': {name: 'AES-GCM', length: 128},
        'aes128-wrap': {name: 'AES-KW', length: 128},
        'aes192-CBC': {name: 'AES-CBC', length: 192},
        'aes192-CFB': {name: 'AES-CFB-8', length: 192},
        'aes192-GCM': {name: 'AES-GCM', length: 192},
        'aes192-wrap': {name: 'AES-KW', length: 192},
        'aes256-CBC': {name: 'AES-CBC', length: 256},
        'aes256-CFB': {name: 'AES-CFB-8', length: 256},
        'aes256-GCM': {name: 'AES-GCM', length: 256},
        'aes256-wrap': {name: 'AES-KW', length: 256},
        // hash algorihtms
        sha1: 'SHA-1',
        sha256: 'SHA-256',
        sha384: 'SHA-384',
        sha512: 'SHA-512',
        // PBE
        PBKDF2: 'PBKDF2',
        PBES2: {derivation: {name: 'PBKDF2'}, encryption: {}},
        PBMAC1: {derivation: {name: 'PBKDF2'}, hmac: {}},
        // HMAC
        hmacWithSHA1: 'SHA-1-HMAC',
        hmacWithSHA256: {name: 'HMAC', hash: {name: 'SHA-256'}},
        hmacWithSHA384: {name: 'HMAC', hash: {name: 'SHA-384'}},
        hmacWithSHA512: {name: 'HMAC', hash: {name: 'SHA-512'}}
    };

    // Each algorithm must has id for convertions
    for (var id in algorithms) {
        var algorithm = algorithms[id];
        if (typeof algorithm === 'string') {
            algorithm = {name: algorithm};
        }
        algorithm.id = id;
        algorithms[id] = algorithm;
    }

    /**
     * Algorithm parameters
     * 
     * @field parameters
     * @memberOf GostSecurity
     */
    var parameters = {
        'id-GostR3410-94-TestParamSet': {namedParam: 'S-TEST'},
        'id-GostR3410-94-CryptoPro-A-ParamSet': {namedParam: 'S-A'},
        'id-GostR3410-94-CryptoPro-B-ParamSet': {namedParam: 'S-B'},
        'id-GostR3410-94-CryptoPro-C-ParamSet': {namedParam: 'S-C'},
        'id-GostR3410-94-CryptoPro-D-ParamSet': {namedParam: 'S-D'},
        'id-GostR3410-94-CryptoPro-XchA-ParamSet': {namedParam: 'X-A'},
        'id-GostR3410-94-CryptoPro-XchB-ParamSet': {namedParam: 'X-B'},
        'id-GostR3410-94-CryptoPro-XchC-ParamSet': {namedParam: 'X-C'},
        // CryptoPro named curves
        'id-GostR3410-2001-CryptoPro-TestParamSet': {namedCurve: 'S-256-TEST'},
        'id-GostR3410-2001-CryptoPro-A-ParamSet': {namedCurve: 'S-256-A'},
        'id-GostR3410-2001-CryptoPro-B-ParamSet': {namedCurve: 'S-256-B'},
        'id-GostR3410-2001-CryptoPro-C-ParamSet': {namedCurve: 'S-256-C'},
        'id-GostR3410-2001-CryptoPro-XchA-ParamSet': {namedCurve: 'X-256-A'},
        'id-GostR3410-2001-CryptoPro-XchB-ParamSet': {namedCurve: 'X-256-B'},
        // TC-26 named curves
        'id-tc26-gost-3410-12-256-paramSetTest': {namedCurve: 'T-256-TEST'},
        'id-tc26-gost-3410-12-256-paramSetA': {namedCurve: 'T-256-A'},
        'id-tc26-gost-3410-12-256-paramSetB': {namedCurve: 'T-256-B'},
        'id-tc26-gost-3410-12-512-paramSetTest': {namedCurve: 'T-512-TEST'},
        'id-tc26-gost-3410-12-512-paramSetA': {namedCurve: 'T-512-A'},
        'id-tc26-gost-3410-12-512-paramSetB': {namedCurve: 'T-512-B'},
        'id-tc26-gost-3410-12-512-paramSetC': {namedCurve: 'T-512-C'},
        'id-tc26-gost-3410-12-512-paramSetD': {namedCurve: 'T-512-D'},
        // Curve attributes additional algorithms
        secp256r1: {namedCurve: 'P-256'},
        secp384r: {namedCurve: 'P-384'},
        secp521r: {namedCurve: 'P-521'},
        // CryptoPro encryption parameters
        'id-GostR3411-94-TestParamSet': {sBox: 'D-TEST'},
        'id-GostR3411-94-CryptoProParamSet': {sBox: 'D-A'},
        'id-GostR3411-94-CryptoPro-A-ParamSet': {sBox: 'D-B'},
        'id-GostR3411-94-CryptoPro-B-ParamSet': {sBox: 'D-C'},
        'id-GostR3411-94-CryptoPro-C-ParamSet': {sBox: 'D-D'},
        'id-Gost28147-89-TestParamSet': {block: 'CTR', sBox: 'E-TEST'},
        'id-Gost28147-89-CryptoPro-A-ParamSet': {block: 'CFB', sBox: 'E-A', keyMeshing: 'CP'},
        'id-Gost28147-89-CryptoPro-B-ParamSet': {block: 'CFB', sBox: 'E-B', keyMeshing: 'CP'},
        'id-Gost28147-89-CryptoPro-C-ParamSet': {block: 'CFB', sBox: 'E-C', keyMeshing: 'CP'},
        'id-Gost28147-89-CryptoPro-D-ParamSet': {block: 'CFB', sBox: 'E-D', keyMeshing: 'CP'},
        'id-Gost28147-89-None-KeyMeshing': {keyMeshing: 'NO'},
        'id-Gost28147-89-CryptoPro-KeyMeshing': {keyMeshing: 'CP'},
        // TC-26 encryption parameters
        'id-tc26-gost-28147-param-Z': {block: 'CFB', sBox: 'E-Z'}
    };

    /**
     * Named attributes for Algorithm identifiers {@link AlgorithmIdentifier}<br><br> 
     * 
     * Recognized attributes:
     *  <ul>
     *      <li>sBox - Paramsets for GOST 28147. Supported values:
     *          <ul>
     *              <li>D-TEST - id-GostR3411-94-TestParamSet</li>
     *              <li>D-A - id-GostR3411-94-CryptoProParamSet</li>
     *              <li>D-B - id-GostR3411-94-CryptoPro-A-ParamSet</li>
     *              <li>D-C - id-GostR3411-94-CryptoPro-B-ParamSet</li>
     *              <li>D-D - id-GostR3411-94-CryptoPro-C-ParamSet</li>
     *              <li>E-TEST - id-Gost28147-89-TestParamSet</li>
     *              <li>E-A - id-Gost28147-89-CryptoPro-A-ParamSet</li>
     *              <li>E-B - id-Gost28147-89-CryptoPro-B-ParamSet</li>
     *              <li>E-C - id-Gost28147-89-CryptoPro-C-ParamSet</li>
     *              <li>E-D - id-Gost28147-89-CryptoPro-D-ParamSet</li>
     *              <li>E-Z - id-tc26-gost-28147-param-Z</li>
     *              <li>D-256 - id-tc26-gost3411-12-256</li>
     *              <li>D-512 - id-tc26-gost3411-12-512</li>
     *          </ul>
     *      </li>
     *      <li>namedParam - Paramset for GOST R 34.10-94
     *          <ul>
     *              <li>S-TEST - id-GostR3410-94-TestParamSet</li>
     *              <li>S-A - id-GostR3410-94-CryptoPro-A-ParamSet</li>
     *              <li>S-B - id-GostR3410-94-CryptoPro-B-ParamSet</li>
     *              <li>S-C - id-GostR3410-94-CryptoPro-C-ParamSet</li>
     *              <li>S-D - id-GostR3410-94-CryptoPro-D-ParamSet</li>
     *              <li>X-A - id-GostR3410-94-CryptoPro-XchA-ParamSet</li>
     *              <li>X-B - id-GostR3410-94-CryptoPro-XchB-ParamSet</li>
     *              <li>X-C - id-GostR3410-94-CryptoPro-XchC-ParamSet</li>
     *          </ul>
     *      </li>
     *      <li>namedCurve - Paramset for GOST R 34.10-01 and GOST R 34.10-12
     *          <ul>
     *              <li>S-256-TEST - id-GostR3410-2001-CryptoPro-TestParamSet</li>
     *              <li>S-256-A - id-GostR3410-2001-CryptoPro-A-ParamSet</li>
     *              <li>S-256-B - id-GostR3410-2001-CryptoPro-B-ParamSet</li>
     *              <li>S-256-C - id-GostR3410-2001-CryptoPro-C-ParamSet</li>
     *              <li>X-256-A - id-GostR3410-2001-CryptoPro-XchA-ParamSet</li>
     *              <li>X-256-B - id-GostR3410-2001-CryptoPro-XchB-ParamSet</li>
     *              <li>P-256 - secp256r1</li>
     *              <li>T-256-TEST - id-tc26-gost-3410-12-256-paramSetTest</li>
     *              <li>T-256-A - id-tc26-gost-3410-12-256-paramSetA</li>
     *              <li>T-256-B - id-tc26-gost-3410-12-256-paramSetB</li>
     *              <li>T-512-TEST - id-tc26-gost-3410-12-512-paramSetTest</li>
     *              <li>T-512-A - id-tc26-gost-3410-12-512-paramSetA</li>
     *              <li>T-512-B - id-tc26-gost-3410-12-512-paramSetB</li>
     *          </ul>
     *      </li>
     *  </ul>
     * @field attributes
     * @memberOf GostSecurity
     */
    var attributes = {
        sBox: {
            'D-TEST': 'id-GostR3411-94-TestParamSet',
            'D-A': 'id-GostR3411-94-CryptoProParamSet',
            'D-B': 'id-GostR3411-94-CryptoPro-A-ParamSet',
            'D-C': 'id-GostR3411-94-CryptoPro-B-ParamSet',
            'D-D': 'id-GostR3411-94-CryptoPro-C-ParamSet',
            'E-TEST': 'id-Gost28147-89-TestParamSet',
            'E-A': 'id-Gost28147-89-CryptoPro-A-ParamSet',
            'E-B': 'id-Gost28147-89-CryptoPro-B-ParamSet',
            'E-C': 'id-Gost28147-89-CryptoPro-C-ParamSet',
            'E-D': 'id-Gost28147-89-CryptoPro-D-ParamSet',
            'E-Z': 'id-tc26-gost-28147-param-Z',
            'D-256': 'id-tc26-gost3411-12-256',
            'D-512': 'id-tc26-gost3411-12-512'
        },
        namedParam: {
            'S-TEST': 'id-GostR3410-94-TestParamSet',
            'S-A': 'id-GostR3410-94-CryptoPro-A-ParamSet',
            'S-B': 'id-GostR3410-94-CryptoPro-B-ParamSet',
            'S-C': 'id-GostR3410-94-CryptoPro-C-ParamSet',
            'S-D': 'id-GostR3410-94-CryptoPro-D-ParamSet',
            'X-A': 'id-GostR3410-94-CryptoPro-XchA-ParamSet',
            'X-B': 'id-GostR3410-94-CryptoPro-XchB-ParamSet',
            'X-C': 'id-GostR3410-94-CryptoPro-XchC-ParamSet'
        },
        namedCurve: {
            'S-256-TEST': 'id-GostR3410-2001-CryptoPro-TestParamSet',
            'S-256-A': 'id-GostR3410-2001-CryptoPro-A-ParamSet',
            'S-256-B': 'id-GostR3410-2001-CryptoPro-B-ParamSet',
            'S-256-C': 'id-GostR3410-2001-CryptoPro-C-ParamSet',
            'X-256-A': 'id-GostR3410-2001-CryptoPro-XchA-ParamSet',
            'X-256-B': 'id-GostR3410-2001-CryptoPro-XchB-ParamSet',
            'P-256': 'secp256r1',
            'T-256-TEST': 'id-tc26-gost-3410-12-256-paramSetTest',
            'T-256-A': 'id-tc26-gost-3410-12-256-paramSetA',
            'T-256-B': 'id-tc26-gost-3410-12-256-paramSetB',
            'T-512-TEST': 'id-tc26-gost-3410-12-512-paramSetTest',
            'T-512-A': 'id-tc26-gost-3410-12-512-paramSetA',
            'T-512-B': 'id-tc26-gost-3410-12-512-paramSetB'
        }
    };

    /**
     * Set of algorithms for different providers<br><br>
     * Supported providers:
     *  <ul>
     *      <li><b>CP-94</b> - CryptoPro GOST R 34.10-94 algorithm set</li>
     *      <li><b>CP-01</b> - CryptoPro GOST R 34.10-2001 algorithm set</li>
     *      <li><b>TC-256</b> - Technical Commitee GOST R 34.10-256 algorithm set</li>
     *      <li><b>TC-512</b> - Technical Commitee GOST R 34.10-512 algorithm set</li>
     *      <li><b>SC-94</b> - SignalCom GOST R 34.10-94 algorithm set</li>
     *      <li><b>SC-01</b> - SignalCom GOST R 34.10-2001 algorithm set</li>
     *  </ul>
     *  
     *  Follow set can be used if it's supported your browser native WebCrypto API:
     *  <ul>
     *      <li><b>RSA-2048</b> - RSA Encryption 2048 bits with SHA-256 algorithm set</li>
     *      <li><b>ECDSA-256</b> - ECDSA-256 with SHA-256 algorithm set</li>
     *  </ul>
     *  
     *  Each provider records has follow standart algorithm identifiers:
     *  <ul>
     *      <li><b>signature</b> - Signature algorithm</li>
     *      <li><b>generation</b> - Asymmetric key generation algorithm</li>
     *      <li><b>digest</b> - Digest algorithm</li>
     *      <li><b>wrapping</b> - Key wrapping algorithm</li>
     *      <li><b>hmac</b> - Hash-based message authentication code algorithm</li>
     *      <li><b>agreement</b> - Key agreement algorithm (except RSA schema)</li>
     *      <li><b>encryption</b> - Content encription algorithm</li>
     *      <li><b>derivation</b> - Password-based derivation algorithm</li>
     *      <li><b>pbes</b> - Password-based encryption algorithm</li>
     *      <li><b>pbmac</b> - Password-based message authentication code algorithm</li>
     *  </ul>
     *  
     * @field providers
     * @memberOf GostSecurity
     */
    var providers = {
        'CP-94': {
            title: 'Crypto-Pro GOST R 34.10-94 Cryptographic Service Provider',
            signature: algorithms['id-GostR3411-94-with-GostR3410-94'],
            publicKey: {id: 'id-GostR3410-94', name: 'GOST R 34.10-94', namedParam: 'X-A'},
            privateKey: {id: 'id-GostR3410-94DH', name: 'GOST R 34.10-94-DH', namedParam: 'X-A'},
            digest: algorithms['id-GostR3411-94'],
            wrapping: {id: 'id-Gost28147-89-CryptoPro-KeyWrap', name: 'GOST 28147-89-CPKW', sBox: 'E-A'},
            hmac: algorithms['id-HMACGostR3411-94'],
            agreement: algorithms['id-GostR3410-94-CryptoPro-ESDH'],
            encryption: {id: 'id-Gost28147-89', name: 'GOST 28147-89', block: 'CFB', sBox: 'E-A', keyMeshing: 'CP'},
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2', iterations: 2000}
        },
        'CP-01': {
            title: 'Crypto-Pro GOST R 34.10-2001 Cryptographic Service Provider',
            signature: algorithms['id-GostR3411-94-with-GostR3410-2001'],
            publicKey: {id: 'id-GostR3410-2001', name: 'GOST R 34.10-2001', namedCurve: 'X-256-A'},
            privateKey: {id: 'id-GostR3410-2001DH', name: 'GOST R 34.10-2001-DH', namedCurve: 'X-256-A'},
            digest: {id: 'id-GostR3411-94', name: 'GOST R 34.11-94', sBox: 'D-A'},
            wrapping: {id: 'id-Gost28147-89-CryptoPro-KeyWrap', name: 'GOST 28147-89-CPKW', sBox: 'E-A'},
            hmac: algorithms['id-HMACGostR3411-94'],
            agreement: algorithms['id-GostR3410-2001-CryptoPro-ESDH'],
            encryption: {id: 'id-Gost28147-89', name: 'GOST 28147-89-CFB-CPKM', sBox: 'E-A'},
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2', iterations: 2000}
        },
        'TC-256': {
            title: 'Crypto-Pro GOST R 34.10-2012 Cryptographic Service Provider',
            signature: algorithms['id-tc26-signwithdigest-gost3410-12-256'],
            publicKey: {id: 'id-tc26-gost3410-12-256', name: 'GOST R 34.10-256', namedCurve: 'X-256-A'},
            privateKey: {id: 'id-tc26-agreement-gost-3410-12-256', name: 'GOST R 34.10-256-DH/GOST R 34.11-256', namedCurve: 'X-256-A'},
            digest: algorithms['id-tc26-gost3411-12-256'],
            wrapping: {id: 'id-Gost28147-89-CryptoPro-KeyWrap', name: 'GOST 28147-89-CPKW', sBox: 'E-A'},
            hmac: algorithms['id-tc26-hmac-gost-3411-12-256'],
            agreement: algorithms['id-tc26-agreement-gost-3410-12-256'],
            encryption: {id: 'id-Gost28147-89', name: 'GOST 28147-89-CFB-CPKM', sBox: 'E-A'},
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-256-12-PBKDF2', iterations: 2000}
        },
        'TC-512': {
            title: 'Crypto-Pro GOST R 34.10-2012 Strong Cryptographic Service Provider',
            signature: algorithms['id-tc26-signwithdigest-gost3410-12-512'],
            publicKey: {id: 'id-tc26-gost3410-12-512', name: 'GOST R 34.10-512', namedCurve: 'T-512-A'},
            privateKey: {id: 'id-tc26-agreement-gost-3410-12-512', name: 'GOST R 34.10-512-DH/GOST R 34.11-256', namedCurve: 'T-512-A'},
            digest: algorithms['id-tc26-gost3411-12-512'],
            wrapping: {id: 'id-Gost28147-89-CryptoPro-KeyWrap', name: 'GOST 28147-89-CPKW', sBox: 'E-A'},
            hmac: algorithms['id-tc26-hmac-gost-3411-12-512'],
            agreement: algorithms['id-tc26-agreement-gost-3410-12-512'],
            encryption: {id: 'id-Gost28147-89', name: 'GOST 28147-89-CFB-CPKM', sBox: 'E-A'},
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-256-PBKDF2', iterations: 2000}
        },
        'SC-94': {
            title: 'Signal-COM GOST Cryptographic Provider',
            signature: algorithms['id-sc-gostR3411-94-with-gostR3410-94'],
            publicKey: {id: 'id-sc-gostR3410-94', name: 'GOST R 34.10-94/SC', namedParam: 'S-A'},
            privateKey: {id: 'id-sc-gostR3410-94', name: 'GOST R 34.10-94/SC', modulusLength: 1024, param: {
                p: '0xB4E25EFB018E3C8B87505E2A67553C5EDC56C2914B7E4F89D23F03F03377E70A2903489DD60E78418D3D851EDB5317C4871E40B04228C3B7902963C4B7D85D52B9AA88F2AFDBEB28DA8869D6DF846A1D98924E925561BD69300B9DDD05D247B5922D967CBB02671881C57D10E5EF72D3E6DAD4223DC82AA1F7D0294651A480DF',
                q: '0x972432A437178B30BD96195B773789AB2FFF15594B176DD175B63256EE5AF2CF',
                a: '0x8FD36731237654BBE41F5F1F8453E71CA414FFC22C25D915309E5D2E62A2A26C7111F3FC79568DAFA028042FE1A52A0489805C0DE9A1A469C844C7CABBEE625C3078888C1D85EEA883F1AD5BC4E6776E8E1A0750912DF64F79956499F1E182475B0B60E2632ADCD8CF94E9C54FD1F3B109D81F00BF2AB8CB862ADF7D40B9369A'}},
            digest: algorithms['id-sc-gostR3411-94'],
            encryption: {id: 'id-sc-gost28147-gfb', name: 'GOST 28147-89-CFB/SC'},
            hmac: algorithms['id-sc-hmacWithGostR3411'],
            wrapping: ['id-sc-cmsGostWrap'],
            agreement: algorithms['id-sc-r3410-ESDH-r3411kdf'],
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2/SC', iterations: 2048},
            pbes: {id: 'id-sc-pbeWithGost3411AndGost28147CFB',
                derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2/SC', iterations: 2048},
                encryption: {id: 'id-sc-gost28147-gfb', name: 'GOST 28147-CFB/SC', iv: new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])}}
        },
        'SC-01': {
            title: 'Signal-COM ECGOST Cryptographic Provider',
            signature: algorithms['id-sc-gostR3411-94-with-gostR3410-2001'],
            publicKey: {id: 'id-sc-gostR3410-2001', name: 'GOST R 34.10-2001/SC', namedCurve: 'P-256'},
            privateKey: {id: 'id-sc-gostR3410-2001', name: 'GOST R 34.10-2001/SC', curve: {
                p: '0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF',
                a: '0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC',
                b: '0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B',
                x: '0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296',
                y: '0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5',
                q: '0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551'}},
            digest: algorithms['id-sc-gostR3411-94'],
            encryption: {id: 'id-sc-gost28147-gfb', name: 'GOST 28147-89-CFB/SC'},
            hmac: algorithms['id-sc-hmacWithGostR3411'],
            wrapping: algorithms['id-sc-cmsGostWrap'],
            agreement: algorithms['id-sc-r3410-ESDH-r3411kdf'],
            derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2/SC', iterations: 2048},
            pbes: {id: 'id-sc-pbeWithGost3411AndGost28147CFB',
                derivation: {id: 'PBKDF2', name: 'GOST R 34.11-94-PBKDF2/SC', iterations: 2048},
                encryption: {id: 'id-sc-gost28147-gfb', name: 'GOST 28147-CFB/SC', iv: new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0])}}
        },
        'RSA-2048': {
            title: 'Microsoft Strong Cryptographic Provider',
            signature: algorithms['sha256withRSAEncryption'],
            publicKey: {id: 'rsaEncryption', name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048,
                publicExponent: new Uint8Array([0x01, 0x00, 0x01]), hash: algorithms['sha256']},
            privateKey: {id: 'rsaEncryption', name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048,
                publicExponent: new Uint8Array([0x01, 0x00, 0x01]), hash: algorithms['sha256']},
            digest: algorithms['sha256'],
            encryption: algorithms['aes256-CFB'],
            hmac: algorithms['hmacWithSHA256']
        },
        'ECDSA-256': {
            title: 'Microsoft Base DSS and Diffie-Hellman Cryptographic Provider',
            signature: algorithms['ecdsa-with-SHA256'],
            publicKey: {id: 'ecdsa', name: 'ECDSA', namedCurve: 'P-256'},
            privateKey: {id: 'ecdsa', name: 'ECDSA', namedCurve: 'P-256'},
            digest: algorithms['sha256'],
            encryption: algorithms['aes256-CFB'],
            hmac: algorithms['hmacWithSHA256'],
            agreement: algorithms['ecDH']
        }
    };
    // Russian providers extension
    ['CP-94', 'CP-01', 'TC-256', 'TC-512', 'SC-94', 'SC-01'].forEach(function (name) {
        var provider = providers[name];
        provider.hmac = expand(provider.hmac, {hash: provider.digest});
        provider.derivation = expand(provider.derivation, {hash: provider.digest, hmac: provider.hmac});
        provider.pbes = provider.pbes || {id: 'PBES2', derivation: provider.derivation,
            encryption: provider.encryption};
        provider.pbmac = provider.pbmac || {id: 'PBMAC1', derivation: provider.derivation,
            hmac: provider.hmac};
        provider.agreement = expand(provider.agreement, {wrapping: provider.wrapping});
    });
    // RSA & ECDA providers extension
    ['RSA-2048', 'ECDSA-256'].forEach(function (name) {
        var provider = providers[name];
        provider.derivation = provider.derivation || {id: 'PBKDF2', name: 'PBKDF2',
            iterations: 2048, hash: provider.digest};
        provider.pbes = provider.pbes || {id: 'PBES2',
            derivation: provider.derivation,
            encryption: provider.encryption
        };
        provider.pbmac = provider.pbmac || {id: 'PBMAC1',
            derivation: provider.derivation,
            hmac: provider.hmac
        };
    });
    // Workaround for Chrome error for RSA algorithm when hash for keys is not defined
    // if (root.crypto && root.crypto.subtle)
    //    setTimeout(function () {
    //        root.crypto.subtle.generateKey(providers['RSA-2048'].generation, false, ["sign"])['catch'](function () {
    //            providers['RSA-2048'].generation.hash = providers['RSA-2048'].digest;
    //            algorithms['rsaEncryption'].hash = providers['RSA-2048'].digest;
    //        });
    //    }); 


    /**
     * GOST and common ASN.1 Object and Algorithm Identifiers
     * @class GostSecurity
     */
    function GostSecurity() {
    }

    GostSecurity.prototype = {
        names: names,
        identifiers: identifiers,
        algorithms: algorithms,
        parameters: parameters,
        attributes: attributes,
        providers: providers
    };

    /**
     * GOST and common ASN.1 Object and Algorithm Identifiers  
     * 
     * @memberOf gostCrypto
     * @type GostSecurity
     */
    gostCrypto.security = new GostSecurity();

module.exports = GostSecurity();


/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/gostSign.js":
/*!*******************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/gostSign.js ***!
  \*******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

/**
 * @file GOST 34.10-2012 signature function with 1024/512 bits digest
 * @version 1.76
 * @copyright 2014-2016, Rudolf Nickolaev. All rights reserved.
 */

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *    
 * Used library JSBN http://www-cs-students.stanford.edu/~tjw/jsbn/
 * Copyright (c) 2003-2005  Tom Wu (tjw@cs.Stanford.EDU)
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 */

const GostRandom = __webpack_require__(/*! ./gostRandom */ "./node_modules/node-gost-crypto/lib/gostRandom.js");
const GostDigest = __webpack_require__(/*! ./gostDigest */ "./node_modules/node-gost-crypto/lib/gostDigest.js");

    /*
     * Predefined curves and params collection
     * 
     * http://tools.ietf.org/html/rfc5832
     * http://tools.ietf.org/html/rfc7091
     * http://tools.ietf.org/html/rfc4357
     * 
     */

    var root = __webpack_require__.g;
    var rootCrypto = root.crypto || root.msCrypto;
    var CryptoOperationData = root.ArrayBuffer;
    
    var OperationError = root.OperationError || root.Error,
            DataError = root.DataError || root.Error,
            NotSupportedError = root.NotSupportedError || root.Error;

    // Predefined named curve collection
    var ECGostParams = {
        'S-256-TEST': {
            a: 7,
            b: '0x5FBFF498AA938CE739B8E022FBAFEF40563F6E6A3472FC2A514C0CE9DAE23B7E',
            p: '0x8000000000000000000000000000000000000000000000000000000000000431',
            q: '0x8000000000000000000000000000000150FE8A1892976154C59CFC193ACCF5B3',
            x: 2,
            y: '0x8E2A8A0E65147D4BD6316030E16D19C85C97F0A9CA267122B96ABBCEA7E8FC8'
        },
        'S-256-A': {
            a: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94',
            b: 166,
            p: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97',
            q: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893',
            x: 1,
            y: '0x8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14'
        },
        'S-256-B': {
            a: '0x8000000000000000000000000000000000000000000000000000000000000C96',
            b: '0x3E1AF419A269A5F866A7D3C25C3DF80AE979259373FF2B182F49D4CE7E1BBC8B',
            p: '0x8000000000000000000000000000000000000000000000000000000000000C99',
            q: '0x800000000000000000000000000000015F700CFFF1A624E5E497161BCC8A198F',
            x: 1,
            y: '0x3FA8124359F96680B83D1C3EB2C070E5C545C9858D03ECFB744BF8D717717EFC'
        },
        'S-256-C': {
            a: '0x9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598',
            b: 32858,
            p: '0x9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B',
            q: '0x9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9',
            x: 0,
            y: '0x41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67'
        },
        'P-256': {
            p: '0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF',
            a: '0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC',
            b: '0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B',
            x: '0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296',
            y: '0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5',
            q: '0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551'
        },
        'T-512-TEST': {
            a: 7,
            b: '0x1CFF0806A31116DA29D8CFA54E57EB748BC5F377E49400FDD788B649ECA1AC4361834013B2AD7322480A89CA58E0CF74BC9E540C2ADD6897FAD0A3084F302ADC',
            p: '0x4531ACD1FE0023C7550D267B6B2FEE80922B14B2FFB90F04D4EB7C09B5D2D15DF1D852741AF4704A0458047E80E4546D35B8336FAC224DD81664BBF528BE6373',
            q: '0x4531ACD1FE0023C7550D267B6B2FEE80922B14B2FFB90F04D4EB7C09B5D2D15DA82F2D7ECB1DBAC719905C5EECC423F1D86E25EDBE23C595D644AAF187E6E6DF',
            x: '0x24D19CC64572EE30F396BF6EBBFD7A6C5213B3B3D7057CC825F91093A68CD762FD60611262CD838DC6B60AA7EEE804E28BC849977FAC33B4B530F1B120248A9A',
            y: '0x2BB312A43BD2CE6E0D020613C857ACDDCFBF061E91E5F2C3F32447C259F39B2C83AB156D77F1496BF7EB3351E1EE4E43DC1A18B91B24640B6DBB92CB1ADD371E'
        },
        'T-512-A': {
            p: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7',
            a: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC4',
            b: '0xE8C2505DEDFC86DDC1BD0B2B6667F1DA34B82574761CB0E879BD081CFD0B6265EE3CB090F30D27614CB4574010DA90DD862EF9D4EBEE4761503190785A71C760',
            q: '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27E69532F48D89116FF22B8D4E0560609B4B38ABFAD2B85DCACDB1411F10B275',
            x: 3,
            y: '0x7503CFE87A836AE3A61B8816E25450E6CE5E1C93ACF1ABC1778064FDCBEFA921DF1626BE4FD036E93D75E6A50E3A41E98028FE5FC235F5B889A589CB5215F2A4'
        },
        'T-512-B': {
            p: '0x8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006F',
            a: '0x8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006C',
            b: '0x687D1B459DC841457E3E06CF6F5E2517B97C7D614AF138BCBF85DC806C4B289F3E965D2DB1416D217F8B276FAD1AB69C50F78BEE1FA3106EFB8CCBC7C5140116',
            q: '0x800000000000000000000000000000000000000000000000000000000000000149A1EC142565A545ACFDB77BD9D40CFA8B996712101BEA0EC6346C54374F25BD',
            x: 2,
            y: '0x1A8F7EDA389B094C2C071E3647A8940F3C123B697578C213BE6DD9E6C8EC7335DCB228FD1EDF4A39152CBCAAF8C0398828041055F94CEEEC7E21340780FE41BD'
        }
    };
    ECGostParams['X-256-A'] = ECGostParams['S-256-A'];
    ECGostParams['X-256-B'] = ECGostParams['S-256-C'];
    ECGostParams['T-256-TEST'] = ECGostParams['S-256-TEST'];
    ECGostParams['T-256-A'] = ECGostParams['S-256-A'];
    ECGostParams['T-256-B'] = ECGostParams['S-256-B'];
    ECGostParams['T-256-C'] = ECGostParams['S-256-C'];


    var GostParams = {
        'S-TEST': {
            modulusLength: 512, // bit length of p (512 or 1024 bits)
            p: '0xEE8172AE8996608FB69359B89EB82A69854510E2977A4D63BC97322CE5DC3386EA0A12B343E9190F23177539845839786BB0C345D165976EF2195EC9B1C379E3',
            q: '0x98915E7EC8265EDFCDA31E88F24809DDB064BDC7285DD50D7289F0AC6F49DD2D',
            a: '0x9e96031500c8774a869582d4afde2127afad2538b4b6270a6f7c8837b50d50f206755984a49e509304d648be2ab5aab18ebe2cd46ac3d8495b142aa6ce23e21c'
        },
        'S-A': {
            modulusLength: 1024,
            p: '0xB4E25EFB018E3C8B87505E2A67553C5EDC56C2914B7E4F89D23F03F03377E70A2903489DD60E78418D3D851EDB5317C4871E40B04228C3B7902963C4B7D85D52B9AA88F2AFDBEB28DA8869D6DF846A1D98924E925561BD69300B9DDD05D247B5922D967CBB02671881C57D10E5EF72D3E6DAD4223DC82AA1F7D0294651A480DF',
            q: '0x972432A437178B30BD96195B773789AB2FFF15594B176DD175B63256EE5AF2CF',
            a: '0x8FD36731237654BBE41F5F1F8453E71CA414FFC22C25D915309E5D2E62A2A26C7111F3FC79568DAFA028042FE1A52A0489805C0DE9A1A469C844C7CABBEE625C3078888C1D85EEA883F1AD5BC4E6776E8E1A0750912DF64F79956499F1E182475B0B60E2632ADCD8CF94E9C54FD1F3B109D81F00BF2AB8CB862ADF7D40B9369A'
        },
        'S-B': {
            modulusLength: 1024,
            p: '0xC6971FC57524B30C9018C5E621DE15499736854F56A6F8AEE65A7A404632B1BCF0349FFCAFCB0A103177971FC1612ADCDB8C8CC938C70225C8FD12AFF01B1D064E0AD6FDE6AB9159166CB9F2FC171D92F0CC7B6A6B2CD7FA342ACBE2C9315A42D576B1ECCE77A963157F3D0BD96A8EB0B0F3502AD238101B05116334F1E5B7AB',
            q: '0xB09D634C10899CD7D4C3A7657403E05810B07C61A688BAB2C37F475E308B0607',
            a: '0x3D26B467D94A3FFC9D71BF8DB8934084137264F3C2E9EB16DCA214B8BC7C872485336744934FD2EF5943F9ED0B745B90AA3EC8D70CDC91682478B664A2E1F8FB56CEF2972FEE7EDB084AF746419B854FAD02CC3E3646FF2E1A18DD4BEB3C44F7F2745588029649674546CC9187C207FB8F2CECE8E2293F68395C4704AF04BAB5'
        },
        'S-C': {
            modulusLength: 1024,
            p: '0x9D88E6D7FE3313BD2E745C7CDD2AB9EE4AF3C8899E847DE74A33783EA68BC30588BA1F738C6AAF8AB350531F1854C3837CC3C860FFD7E2E106C3F63B3D8A4C034CE73942A6C3D585B599CF695ED7A3C4A93B2B947B7157BB1A1C043AB41EC8566C6145E938A611906DE0D32E562494569D7E999A0DDA5C879BDD91FE124DF1E9',
            q: '0xFADD197ABD19A1B4653EECF7ECA4D6A22B1F7F893B641F901641FBB555354FAF',
            a: '0x7447ED7156310599070B12609947A5C8C8A8625CF1CF252B407B331F93D639DDD1BA392656DECA992DD035354329A1E95A6E32D6F47882D960B8F10ACAFF796D13CD9611F853DAB6D2623483E46788708493937A1A29442598AEC2E0742022563440FE9C18740ECE6765AC05FAF024A64B026E7E408840819E962E7E5F401AE3'
        },
        'S-D': {
            modulusLength: 1024,
            p: '0x80F102D32B0FD167D069C27A307ADAD2C466091904DBAA55D5B8CC7026F2F7A1919B890CB652C40E054E1E9306735B43D7B279EDDF9102001CD9E1A831FE8A163EED89AB07CF2ABE8242AC9DEDDDBF98D62CDDD1EA4F5F15D3A42A6677BDD293B24260C0F27C0F1D15948614D567B66FA902BAA11A69AE3BCEADBB83E399C9B5',
            q: '0xF0F544C418AAC234F683F033511B65C21651A6078BDA2D69BB9F732867502149',
            a: '0x6BCC0B4FADB3889C1E06ADD23CC09B8AB6ECDEDF73F04632595EE4250005D6AF5F5ADE44CB1E26E6263C672347CFA26F9E9393681E6B759733784CDE5DBD9A14A39369DFD99FA85CC0D10241C4010343F34A91393A706CF12677CBFA1F578D6B6CFBE8A1242CFCC94B3B653A476E145E3862C18CC3FED8257CFEF74CDB205BF1'
        },
        'X-A': {
            modulusLength: 1024,
            p: '0xCA3B3F2EEE9FD46317D49595A9E7518E6C63D8F4EB4D22D10D28AF0B8839F079F8289E603B03530784B9BB5A1E76859E4850C670C7B71C0DF84CA3E0D6C177FE9F78A9D8433230A883CD82A2B2B5C7A3306980278570CDB79BF01074A69C9623348824B0C53791D53C6A78CAB69E1CFB28368611A397F50F541E16DB348DBE5F',
            q: '0xCAE4D85F80C147704B0CA48E85FB00A9057AA4ACC44668E17F1996D7152690D9',
            a: '0xBE27D652F2F1E339DA734211B85B06AE4DE236AA8FBEEB3F1ADCC52CD43853777E834A6A518138678A8ADBD3A55C70A7EAB1BA7A0719548677AAF4E609FFB47F6B9D7E45B0D06D83D7ADC53310ABD85783E7317F7EC73268B6A9C08D260B85D8485696CA39C17B17F044D1E050489036ABD381C5E6BF82BA352A1AFF136601AF'
        },
        'X-B': {
            modulusLength: 1024,
            p: '0x9286DBDA91ECCFC3060AA5598318E2A639F5BA90A4CA656157B2673FB191CD0589EE05F4CEF1BD13508408271458C30851CE7A4EF534742BFB11F4743C8F787B11193BA304C0E6BCA25701BF88AF1CB9B8FD4711D89F88E32B37D95316541BF1E5DBB4989B3DF13659B88C0F97A3C1087B9F2D5317D557DCD4AFC6D0A754E279',
            q: '0xC966E9B3B8B7CDD82FF0F83AF87036C38F42238EC50A876CD390E43D67B6013F',
            a: '0x7E9C3096676F51E3B2F9884CF0AC2156779496F410E049CED7E53D8B7B5B366B1A6008E5196605A55E89C3190DABF80B9F1163C979FCD18328DAE5E9048811B370107BB7715F82091BB9DE0E33EE2FED6255474F8769FCE5EAFAEEF1CB5A32E0D5C6C2F0FC0B3447072947F5B4C387666993A333FC06568E534AD56D2338D729'
        },
        'X-C': {
            modulusLength: 1024,
            p: '0xB194036ACE14139D36D64295AE6C50FC4B7D65D8B340711366CA93F383653908EE637BE428051D86612670AD7B402C09B820FA77D9DA29C8111A8496DA6C261A53ED252E4D8A69A20376E6ADDB3BDCD331749A491A184B8FDA6D84C31CF05F9119B5ED35246EA4562D85928BA1136A8D0E5A7E5C764BA8902029A1336C631A1D',
            q: '0x96120477DF0F3896628E6F4A88D83C93204C210FF262BCCB7DAE450355125259',
            a: '0x3F1817052BAA7598FE3E4F4FC5C5F616E122CFF9EBD89EF81DC7CE8BF56CC64B43586C80F1C4F56DD5718FDD76300BE336784259CA25AADE5A483F64C02A20CF4A10F9C189C433DEFE31D263E6C9764660A731ECCAECB74C8279303731E8CF69205BC73E5A70BDF93E5BB681DAB4EEB9C733CAAB2F673C475E0ECA921D29782E'
        }
    };

    /* 
     * BigInteger arithmetic tools 
     * optimized release of http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn.js 
     * 
     */

    // Bits per one element
    var DB = 28, DM = (1 << DB) - 1, DV = 1 << DB,
            FV = Math.pow(2, 52), F1 = 52 - DB, F2 = 2 * DB - 52;

    function am(y, i, x, w, j, c, n) {
        var xl = x & 0x3fff, xh = x >> 14;
        while (--n >= 0) {
            var l = y[i] & 0x3fff;
            var h = y[i++] >> 14;
            var m = xh * l + h * xl;
            l = xl * l + ((m & 0x3fff) << 14) + w[j] + c;
            c = (l >> 28) + (m >> 14) + xh * h;
            w[j++] = l & 0xfffffff;
        }
        return c;
    }

    function nbi(words) {
        var r = new Array(Math.ceil(words));
        r.s = 0;
        r.t = 0;
        return r;
    }

    function copyTo(x, r) {
        for (var i = x.t - 1; i >= 0; --i)
            r[i] = x[i];
        r.t = x.t;
        r.s = x.s;
        return r;
    }

    function copy(x) {
        return copyTo(x, nbi(x.t));
    }

    function setInt(x, i) {
        x.t = 1;
        x.s = (i < 0) ? -1 : 0;
        if (i > 0)
            x[0] = i;
        else if (i < -1)
            x[0] = i + DV;
        else
            x.t = 0;
        return x;
    }

    function nbv(i) {
        var r = nbi(1);
        setInt(r, i);
        return r;
    }

    var ZERO = nbv(0), ONE = nbv(1), THREE = nbv(3);

    function clamp(x) {
        var c = x.s & DM;
        while (x.t > 0 && x[x.t - 1] === c)
            --x.t;
        return x;
    }

    function subTo(x, a, r) {
        var i = 0, c = 0, m = Math.min(a.t, x.t);
        while (i < m) {
            c += x[i] - a[i];
            r[i++] = c & DM;
            c >>= DB;
        }
        if (a.t < x.t) {
            c -= a.s;
            while (i < x.t) {
                c += x[i];
                r[i++] = c & DM;
                c >>= DB;
            }
            c += x.s;
        }
        else {
            c += x.s;
            while (i < a.t) {
                c -= a[i];
                r[i++] = c & DM;
                c >>= DB;
            }
            c -= a.s;
        }
        r.s = (c < 0) ? -1 : 0;
        if (c < -1)
            r[i++] = DV + c;
        else if (c > 0)
            r[i++] = c;
        r.t = i;
        return clamp(r);
    }

    function sub(x, y) {
        return subTo(x, y, nbi(x.t));
    }

    function addTo(x, a, r) {
        var i = 0, c = 0, m = Math.min(a.t, x.t);
        while (i < m) {
            c += x[i] + a[i];
            r[i++] = c & DM;
            c >>= DB;
        }
        if (a.t < x.t) {
            c += a.s;
            while (i < x.t) {
                c += x[i];
                r[i++] = c & DM;
                c >>= DB;
            }
            c += x.s;
        }
        else {
            c += x.s;
            while (i < a.t) {
                c += a[i];
                r[i++] = c & DM;
                c = c >> DB;
            }
            c += a.s;
        }
        r.s = (c < 0) ? -1 : 0;
        if (c > 0)
            r[i++] = c;
        else if (c < -1)
            r[i++] = DV + c;
        r.t = i;
        return clamp(r);
    }

    function add(x, y) {
        return addTo(x, y, nbi(x.t));
    }

    function negTo(x, r) {
        return subTo(ZERO, x, r);
    }

    function neg(x) {
        return negTo(x, nbi(x.t));
    }

    function absTo(x, r) {
        return (x.s < 0) ? negTo(r) : copyTo(r);
    }

    function abs(x) {
        return (x.s < 0) ? neg(x) : x;
    }

    function compare(x, a) {
        var r = x.s - a.s;
        if (r !== 0)
            return r;
        var i = x.t;
        r = i - a.t;
        if (r !== 0)
            return (x.s < 0) ? -r : r;
        while (--i >= 0)
            if ((r = x[i] - a[i]) !== 0)
                return r;
        return 0;
    }

    function equals(x, y) {
        return(compare(x, y) === 0);
    }

    function min(x, y) {
        return(compare(x, y) < 0) ? x : y;
    }

    function max(x, y) {
        return(compare(x, y) > 0) ? x : y;
    }

    function nbits(x) {
        var r = 1, t;
        if ((t = x >>> 16) !== 0) {
            x = t;
            r += 16;
        }
        if ((t = x >> 8) !== 0) {
            x = t;
            r += 8;
        }
        if ((t = x >> 4) !== 0) {
            x = t;
            r += 4;
        }
        if ((t = x >> 2) !== 0) {
            x = t;
            r += 2;
        }
        if ((t = x >> 1) !== 0) {
            x = t;
            r += 1;
        }
        return r;
    }

    function dshlTo(x, n, r) {
        var i;
        for (i = x.t - 1; i >= 0; --i)
            r[i + n] = x[i];
        for (i = n - 1; i >= 0; --i)
            r[i] = 0;
        r.t = x.t + n;
        r.s = x.s;
        return r;
    }
    function dshrTo(x, n, r) {
        for (var i = n; i < x.t; ++i)
            r[i - n] = x[i];
        r.t = Math.max(x.t - n, 0);
        r.s = x.s;
        return r;
    }

    function shlTo(x, n, r) {
        var bs = n % DB;
        var cbs = DB - bs;
        var bm = (1 << cbs) - 1;
        var ds = Math.floor(n / DB), c = (x.s << bs) & DM, i;
        for (i = x.t - 1; i >= 0; --i) {
            r[i + ds + 1] = (x[i] >> cbs) | c;
            c = (x[i] & bm) << bs;
        }
        for (i = ds - 1; i >= 0; --i)
            r[i] = 0;
        r[ds] = c;
        r.t = x.t + ds + 1;
        r.s = x.s;
        return clamp(r);
    }

    function shrTo(x, n, r) {
        r.s = x.s;
        var ds = Math.floor(n / DB);
        if (ds >= x.t) {
            r.t = 0;
            return;
        }
        var bs = n % DB;
        var cbs = DB - bs;
        var bm = (1 << bs) - 1;
        r[0] = x[ds] >> bs;
        for (var i = ds + 1; i < x.t; ++i) {
            r[i - ds - 1] |= (x[i] & bm) << cbs;
            r[i - ds] = x[i] >> bs;
        }
        if (bs > 0)
            r[x.t - ds - 1] |= (x.s & bm) << cbs;
        r.t = x.t - ds;
        return clamp(r);
    }

    function shl(x, n) {
        var r = nbi(x.t);
        if (n < 0)
            shrTo(x, -n, r);
        else
            shlTo(x, n, r);
        return r;
    }

    function shr(x, n) {
        var r = nbi(x.t);
        if (n < 0)
            shlTo(x, -n, r);
        else
            shrTo(x, n, r);
        return r;
    }

    function bitLength(x) {
        if (x.t <= 0)
            return 0;
        return DB * (x.t - 1) + nbits(x[x.t - 1] ^ (x.s & DM));
    }

    function mulTo(b, a, r) {
        var x = abs(b), y = abs(a);
        var i = x.t;
        r.t = i + y.t;
        while (--i >= 0)
            r[i] = 0;
        for (i = 0; i < y.t; ++i)
            r[i + x.t] = am(x, 0, y[i], r, i, 0, x.t);
        r.s = 0;
        if (b.s !== a.s)
            subTo(ZERO, r, r);
        return clamp(r);
    }

    function mul(x, y) {
        return mulTo(x, y, nbi(x.t + y.t));
    }

    function sqrTo(a, r) {
        var x = abs(a);
        var i = r.t = 2 * x.t;
        while (--i >= 0)
            r[i] = 0;
        for (i = 0; i < x.t - 1; ++i) {
            var c = am(x, i, x[i], r, 2 * i, 0, 1);
            if ((r[i + x.t] += am(x, i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) {
                r[i + x.t] -= x.DV;
                r[i + x.t + 1] = 1;
            }
        }
        if (r.t > 0)
            r[r.t - 1] += am(x, i, x[i], r, 2 * i, 0, 1);
        r.s = 0;
        return clamp(r);
    }

    function sqr(a) {
        return sqrTo(a, nbi(a.t * 2));
    }

    function divRemTo(n, m, q, r) {
        var pm = abs(m);
        if (pm.t <= 0)
            throw new OperationError('Division by zero');
        var pt = abs(n);
        if (pt.t < pm.t) {
            if (q)
                setInt(q, 0);
            if (r)
                copyTo(n, r);
            return q;
        }
        if (!r)
            r = nbi(m.t);
        var y = nbi(m.t), ts = n.s, ms = m.s;
        var nsh = DB - nbits(pm[pm.t - 1]);
        if (nsh > 0) {
            shlTo(pm, nsh, y);
            shlTo(pt, nsh, r);
        }
        else {
            copyTo(pm, y);
            copyTo(pt, r);
        }
        var ys = y.t;
        var y0 = y[ys - 1];
        if (y0 === 0)
            return q;
        var yt = y0 * (1 << F1) + ((ys > 1) ? y[ys - 2] >> F2 : 0);
        var d1 = FV / yt, d2 = (1 << F1) / yt, e = 1 << F2;
        var i = r.t, j = i - ys, t = !q ? nbi(Math.max(n.t - m.t, 1)) : q;
        dshlTo(y, j, t);
        if (compare(r, t) >= 0) {
            r[r.t++] = 1;
            subTo(r, t, r);
        }
        dshlTo(ONE, ys, t);
        subTo(t, y, y);
        while (y.t < ys)
            y[y.t++] = 0;
        while (--j >= 0) {
            var qd = (r[--i] === y0) ? DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2);
            if ((r[i] += am(y, 0, qd, r, j, 0, ys)) < qd) {
                dshlTo(y, j, t);
                subTo(r, t, r);
                while (r[i] < --qd)
                    subTo(r, t, r);
            }
        }
        if (q) {
            dshrTo(r, ys, q);
            if (ts !== ms)
                subTo(ZERO, q, q);
        }
        r.t = ys;
        clamp(r);
        if (nsh > 0)
            shrTo(r, nsh, r);
        if (ts < 0)
            subTo(ZERO, r, r);
        return q;
    }

    function modTo(b, a, r) {
        divRemTo(abs(b), a, null, r);
        if (b.s < 0 && compare(r, ZERO) > 0)
            subTo(a, r, r);
        return r;
    }

    function mod(b, a) {
        return modTo(b, a, nbi(a.t));
    }

    function div(b, a) {
        return divRemTo(b, a, nbi(Math.max(b.t - a.t, 1)), null);
    }

    function isEven(x) {

        return ((x.t > 0) ? (x[0] & 1) : x.s) === 0;
    }

    function isZero(x) {
        return equals(x, ZERO);
    }

    function sig(x) {
        if (x.s < 0)
            return -1;
        else if (x.t <= 0 || (x.t === 1 && x[0] <= 0))
            return 0;
        else
            return 1;
    }

    function invMod(x, m) {
        var ac = isEven(m);
        if ((isEven(x) && ac) || sig(m) === 0)
            return ZERO;
        var u = copy(m), v = copy(x);
        var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
        while (sig(u) !== 0) {
            while (isEven(u)) {
                shrTo(u, 1, u);
                if (ac) {
                    if (!isEven(a) || !isEven(b)) {
                        addTo(a, x, a);
                        subTo(b, m, b);
                    }
                    shrTo(a, 1, a);
                }
                else if (!isEven(b))
                    subTo(b, m, b);
                shrTo(b, 1, b);
            }
            while (isEven(v)) {
                shrTo(v, 1, v);
                if (ac) {
                    if (!isEven(c) || !isEven(d)) {
                        addTo(c, x, c);
                        subTo(d, m, d);
                    }
                    shrTo(c, 1, c);
                }
                else if (!isEven(d))
                    subTo(d, m, d);
                shrTo(d, 1, d);
            }
            if (compare(u, v) >= 0) {
                subTo(u, v, u);
                if (ac)
                    subTo(a, c, a);
                subTo(b, d, b);
            }
            else {
                subTo(v, u, v);
                if (ac)
                    subTo(c, a, c);
                subTo(d, b, d);
            }
        }
        if (compare(v, ONE) !== 0)
            return ZERO;
        if (compare(d, m) >= 0)
            return subtract(d, m);
        if (sig(d) < 0)
            addTo(d, m, d);
        else
            return d;
        if (sig(d) < 0)
            return add(d, m);
        else
            return d;
    }

    function testBit(x, n) {
        var j = Math.floor(n / DB);
        if (j >= x.t)
            return (x.s !== 0);
        return ((x[j] & (1 << (n % DB))) !== 0);
    }

    function nothing(x) {
        return x;
    }

    function extend(c, o) {
        for (var i in o)
            c.prototype[i] = o[i];
    }

    /*
     * Classic, Barret, Mongomery reductions, optimized ExpMod algorithms
     * optimized release of http://www-cs-students.stanford.edu/~tjw/jsbn/jsbn2.js
     * 
     */

    // Classic reduction
    var Classic = function (m) {
        this.m = m;
    };

    extend(Classic, {
        convert: function (x) {
            if (x.s < 0 || compare(x, this.m) >= 0)
                return mod(x, this.m);
            else
                return x;
        },
        revert: nothing,
        reduce: function (x) {
            modTo(x, this.m, x);
        },
        sqrTo: function (x, r) {
            sqrTo(x, r);
            this.reduce(r);
        },
        mulTo: function (x, y, r) {
            mulTo(x, y, r);
            this.reduce(r);
        }
    });

    function invDig(a) {
        if (a.t < 1)
            return 0;
        var x = a[0];
        if ((x & 1) === 0)
            return 0;
        var y = x & 3;
        y = (y * (2 - (x & 0xf) * y)) & 0xf;
        y = (y * (2 - (x & 0xff) * y)) & 0xff;
        y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff;
        y = (y * (2 - x * y % DV)) % DV;
        return (y > 0) ? DV - y : -y;
    }

    // Montgomery reduction
    var Montgomery = function (m) {
        this.m = m;
        this.mp = invDig(m);
        this.mpl = this.mp & 0x7fff;
        this.mph = this.mp >> 15;
        this.um = (1 << (DB - 15)) - 1;
        this.mt2 = 2 * m.t;
    };

    extend(Montgomery, {
        // xR mod m
        convert: function (x) {
            var r = nbi(x.t);
            dshlTo(abs(x), this.m.t, r);
            divRemTo(r, this.m, null, r);
            if (x.s < 0 && compare(r, ZERO) > 0)
                subTo(this.m, r, r);
            return r;
        },
        // x/R mod m
        revert: function (x) {
            var r = nbi(x.t);
            copyTo(x, r);
            this.reduce(r);
            return r;
        },
        // x = x/R mod m (HAC 14.32)
        reduce: function (x) {
            while (x.t <= this.mt2)
                x[x.t++] = 0;
            for (var i = 0; i < this.m.t; ++i) {
                var j = x[i] & 0x7fff;
                var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & DM;
                j = i + this.m.t;
                x[j] += am(this.m, 0, u0, x, i, 0, this.m.t);
                while (x[j] >= DV) {
                    x[j] -= DV;
                    x[++j]++;
                }
            }
            clamp(x);
            dshrTo(x, this.m.t, x);
            if (compare(x, this.m) >= 0)
                subTo(x, this.m, x);
        },
        // r = "x^2/R mod m"; x != r
        sqrTo: function (x, r) {
            sqrTo(x, r);
            this.reduce(r);
        },
        // r = "xy/R mod m"; x,y != r
        mulTo: function (x, y, r) {
            mulTo(x, y, r);
            this.reduce(r);
        }
    });

    function dAddOffset(x, n, w) {
        if (n === 0)
            return;
        while (x.t <= w)
            x[x.t++] = 0;
        x[w] += n;
        while (x[w] >= DV) {
            x[w] -= DV;
            if (++w >= x.t)
                x[x.t++] = 0;
            ++x[w];
        }
    }

    function mulLowerTo(x, a, n, r) {
        var i = Math.min(x.t + a.t, n);
        r.s = 0; // assumes a,x >= 0
        r.t = i;
        while (i > 0)
            r[--i] = 0;
        var j;
        for (j = r.t - x.t; i < j; ++i)
            r[i + x.t] = am(x, 0, a[i], r, i, 0, x.t);
        for (j = Math.min(a.t, n); i < j; ++i)
            am(x, 0, a[i], r, i, 0, n - i);
        return clamp(r);
    }

    function mulUpperTo(x, a, n, r) {
        --n;
        var i = r.t = x.t + a.t - n;
        r.s = 0; // assumes a,x >= 0
        while (--i >= 0)
            r[i] = 0;
        for (i = Math.max(n - x.t, 0); i < a.t; ++i)
            r[x.t + i - n] = am(x, n - i, a[i], r, 0, 0, x.t + i - n);
        clamp(r);
        return dshrTo(r, 1, r);
    }

    // Barrett modular reduction
    function Barrett(m) {
        // setup Barrett
        this.r2 = nbi(2 * m.t);
        this.q3 = nbi(2 * m.t);
        dshlTo(ONE, 2 * m.t, this.r2);
        this.mu = div(this.r2, m);
        this.m = m;
    }

    extend(Barrett, {
        convert: function (x) {
            if (x.s < 0 || x.t > 2 * this.m.t)
                return mod(x, this.m);
            else if (compare(x, this.m) < 0)
                return x;
            else {
                var r = nbi(x.t);
                copyTo(x, r);
                this.reduce(r);
                return r;
            }
        },
        revert: function (x) {
            return x;
        },
        // x = x mod m (HAC 14.42)
        reduce: function (x) {
            dshrTo(x, this.m.t - 1, this.r2);
            if (x.t > this.m.t + 1) {
                x.t = this.m.t + 1;
                clamp(x);
            }
            mulUpperTo(this.mu, this.r2, this.m.t + 1, this.q3);
            mulLowerTo(this.m, this.q3, this.m.t + 1, this.r2);
            while (compare(x, this.r2) < 0)
                dAddOffset(x, 1, this.m.t + 1);
            subTo(x, this.r2, x);
            while (compare(x, this.m) >= 0)
                subTo(x, this.m, x);
        },
        // r = x^2 mod m; x != r
        sqrTo: function (x, r) {
            sqrTo(x, r);
            this.reduce(r);
        },
        // r = x*y mod m; x,y != r
        mulTo: function (x, y, r) {
            mulTo(x, y, r);
            this.reduce(r);
        }

    });

    // x^e % m (HAC 14.85)
    function expMod(x, e, m) {
        var i = bitLength(e), k, r = nbv(1), z;
        if (i <= 0)
            return r;
        else if (i < 18)
            k = 1;
        else if (i < 48)
            k = 3;
        else if (i < 144)
            k = 4;
        else if (i < 768)
            k = 5;
        else
            k = 6;
        if (i < 8)
            z = new Classic(m);
        else if (isEven(m))
            z = new Barrett(m);
        else
            z = new Montgomery(m);

        // precomputation
        var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1;
        g[1] = z.convert(x);
        if (k > 1) {
            var g2 = nbi(m.t * 2);
            z.sqrTo(g[1], g2);
            while (n <= km) {
                g[n] = nbi(m.t * 2);
                z.mulTo(g2, g[n - 2], g[n]);
                n += 2;
            }
        }

        var j = e.t - 1, w, is1 = true, r2 = nbi(m.t * 2), t;
        i = nbits(e[j]) - 1;
        while (j >= 0) {
            if (i >= k1)
                w = (e[j] >> (i - k1)) & km;
            else {
                w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i);
                if (j > 0)
                    w |= e[j - 1] >> (DB + i - k1);
            }

            n = k;
            while ((w & 1) == 0) {
                w >>= 1;
                --n;
            }
            if ((i -= n) < 0) {
                i += DB;
                --j;
            }
            if (is1) {	// ret == 1, don't bother squaring or multiplying it
                copyTo(g[w], r);
                is1 = false;
            }
            else {
                while (n > 1) {
                    z.sqrTo(r, r2);
                    z.sqrTo(r2, r);
                    n -= 2;
                }
                if (n > 0)
                    z.sqrTo(r, r2);
                else {
                    t = r;
                    r = r2;
                    r2 = t;
                }
                z.mulTo(r2, g[w], r);
            }
            while (j >= 0 && (e[j] & (1 << i)) == 0) {
                z.sqrTo(r, r2);
                t = r;
                r = r2;
                r2 = t;
                if (--i < 0) {
                    i = DB - 1;
                    --j;
                }
            }
        }
        return z.revert(r);
    }

    /*
     * EC Field Elements, Points, Curves
     * optimized release of http://www-cs-students.stanford.edu/~tjw/jsbn/ec.js
     * 
     */

    // EC Field Elemets
    function newFE(a, x) {
        a.r.reduce(x);
        x.q = a.q;
        x.r = a.r;
        return x;
    }

    function copyFE(a, x) {
        x.q = a.q;
        x.r = a.r;
        return x;
    }

    function negFE(a) {
        return copyFE(a, sub(a.q, a));
    }

    function addFE(a, b) {
        var r = add(a, b);
        if (compare(r, a.q) > 0)
            subTo(r, a.q, r);
        return copyFE(a, r);
    }

    function subFE(a, b) {
        var r = sub(a, b);
        if (r.s < 0)
            addTo(a.q, r, r);
        return copyFE(a, r);
    }

    function mulFE(a, b) {
        return newFE(a, mul(a, b));
    }

    function sqrFE(a) {
        return newFE(a, sqr(a));
    }

    function shlFE(a, i) {
        return newFE(a, shl(a, i));
    }

    function invFE(a) {
        return copyFE(a, invMod(a, a.q));
    }

    // EC Points
    function newEC(curve, x, y, z) {
        return {
            curve: curve,
            x: x,
            y: y,
            z: z || newFE(curve, ONE)
        };
    }

    function getX(point) {
        if (!point.zinv)
            point.zinv = invFE(point.z);
        return mulFE(point.x, point.zinv);
    }

    function getY(point) {
        if (!point.zinv)
            point.zinv = invFE(point.z);
        return mulFE(point.y, point.zinv);
    }

    function isInfinity(a) {
        if ((!a.x) && (!a.y))
            return true;
        return isZero(a.z) && !isZero(a.y);
    }

    function getInfinity(a) {
        return a.curve.infinity;
    }

    function equalsEC(a, b) {
        if (a === b)
            return true;
        if (isInfinity(a))
            return isInfinity(b);
        if (isInfinity(b))
            return isInfinity(a);
        var u, v;
        // u = Y2 * Z1 - Y1 * Z2
        u = subFE(mulFE(b.y, a.z), mulFE(a.y, b.z));
        if (!isZero(u))
            return false;
        // v = X2 * Z1 - X1 * Z2
        v = subFE(mulFE(b.x, a.z), mulFE(a.x, b.z));
        return isZero(v);
    }

    function negEC(a) {
        return newEC(a.curve, a.x, negFE(a.y), a.z);
    }

    function addEC(a, b) {
        if (isInfinity(a))
            return b;
        if (isInfinity(b))
            return a;

        // u = Y2 * Z1 - Y1 * Z2
        var u = subFE(mulFE(b.y, a.z), mulFE(a.y, b.z));
        // v = X2 * Z1 - X1 * Z2
        var v = subFE(mulFE(b.x, a.z), mulFE(a.x, b.z));

        if (isZero(v)) {
            if (isZero(u)) {
                return twiceEC(a); // a == b, so double
            }
            return getInfinity(a); // a = -b, so infinity
        }

        var x1 = a.x;
        var y1 = a.y;

        var v2 = sqrFE(v);
        var v3 = mulFE(v2, v);
        var x1v2 = mulFE(x1, v2);
        var zu2 = mulFE(sqrFE(u), a.z);

        // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3)
        var x3 = mulFE(subFE(mulFE(subFE(zu2, shlFE(x1v2, 1)), b.z), v3), v);
        // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3
        var y3 = addFE(mulFE(subFE(subFE(mulFE(mulFE(x1v2, THREE), u), mulFE(y1, v3)), mulFE(zu2, u)), b.z), mulFE(u, v3));
        // z3 = v^3 * z1 * z2
        var z3 = mulFE(mulFE(v3, a.z), b.z);

        return newEC(a.curve, x3, y3, z3);
    }

    function twiceEC(b) {
        if (isInfinity(b))
            return b;
        if (sig(b.y) === 0)
            return getInfinity(b);

        var x1 = b.x;
        var y1 = b.y;

        var y1z1 = mulFE(y1, b.z);
        var y1sqz1 = mulFE(y1z1, y1);
        var a = b.curve.a;

        // w = 3 * x1^2 + a * z1^2
        var w = mulFE(sqrFE(x1), THREE);
        if (!isZero(a)) {
            w = addFE(w, mulFE(sqrFE(b.z), a));
        }

        // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1)
        var x3 = mulFE(shlFE(subFE(sqrFE(w), mulFE(shlFE(x1, 3), y1sqz1)), 1), y1z1);
        // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3
        var y3 = subFE(mulFE(shlFE(subFE(mulFE(mulFE(w, THREE), x1), shlFE(y1sqz1, 1)), 2), y1sqz1), mulFE(sqrFE(w), w));
        // z3 = 8 * (y1 * z1)^3
        var z3 = shlFE(mulFE(sqrFE(y1z1), y1z1), 3);

        return newEC(b.curve, x3, y3, z3);
    }

    // Simple NAF (Non-Adjacent Form) multiplication algorithm
    function mulEC(a, k) {
        if (isInfinity(a))
            return a;
        if (sig(k) === 0)
            return getInfinity(a);

        var e = k;
        var h = mul(e, THREE);

        var neg = negEC(a);
        var R = a;

        var i;
        for (i = bitLength(h) - 2; i > 0; --i) {
            R = twiceEC(R);

            var hBit = testBit(h, i);
            var eBit = testBit(e, i);

            if (hBit !== eBit) {
                R = addEC(R, hBit ? a : neg);
            }
        }

        return R;
    }

    function mul2AndAddEC(a, k) {
        var nbits = bitLength(k);
        var R = a,
                Q = getInfinity(a);

        for (var i = 0; i < nbits - 1; i++) {
            if (testBit(k, i) === 1)
                Q = addEC(Q, R);

            R = twiceEC(R);
        }

        if (testBit(k, nbits - 1) === 1)
            Q = addEC(Q, R);

        return Q;
    }

    // Compute a*j + x*k (simultaneous multiplication)
    function mulTwoEC(a, j, x, k) {
        var i;
        if (bitLength(j) > bitLength(k))
            i = bitLength(j) - 1;
        else
            i = bitLength(k) - 1;

        var R = getInfinity(a);
        var both = addEC(a, x);
        while (i >= 0) {
            R = twiceEC(R);
            if (testBit(j, i)) {
                if (testBit(k, i)) {
                    R = addEC(R, both);
                }
                else {
                    R = addEC(R, a);
                }
            }
            else {
                if (testBit(k, i)) {
                    R = addEC(R, x);
                }
            }
            --i;
        }

        return R;
    }

    // EC Curve
    function newCurve(q, a, b) {
        var curve = {};
        curve.q = q;
        curve.r = new Barrett(q);
        curve.a = newFE(curve, a);
        curve.b = newFE(curve, b);
        curve.infinity = newEC(curve);
        return curve;
    }

    /*
     * Converion tools (hex, binary)
     * 
     */

    function atobi(d) {
        var k = 8;
        var a = new Uint8Array(d);
        var r = nbi(a.length * 8 / DB);
        r.t = 0;
        r.s = 0;
        var sh = 0;
        for (var i = 0, n = a.length; i < n; i++) {
            var x = a[i];
            if (sh === 0)
                r[r.t++] = x;
            else if (sh + k > DB) {
                r[r.t - 1] |= (x & ((1 << (DB - sh)) - 1)) << sh;
                r[r.t++] = (x >> (DB - sh));
            }
            else
                r[r.t - 1] |= x << sh;
            sh += k;
            if (sh >= DB)
                sh -= DB;
        }
        return clamp(r);
    }

    function bitoa(s, bitLength) {
        var k = 8;
        var km = (1 << k) - 1, d, m = false, r = [], i = s.t;
        var p = DB - (i * DB) % k;
        if (i-- > 0) {
            if (p < DB && (d = s[i] >> p) > 0) {
                m = true;
                r.push(d);
            }
            while (i >= 0) {
                if (p < k) {
                    d = (s[i] & ((1 << p) - 1)) << (k - p);
                    d |= s[--i] >> (p += DB - k);
                }
                else {
                    d = (s[i] >> (p -= k)) & km;
                    if (p <= 0) {
                        p += DB;
                        --i;
                    }
                }
                if (d > 0)
                    m = true;
                if (m)
                    r.push(d);
            }
        }
        var r8 = new Uint8Array(bitLength ? bitLength / 8 : r.length);
        if (m)
            r8.set(r.reverse());
        return r8.buffer;
    }


    function htobi(s) {
        if (typeof s === 'number' || s instanceof Number)
            return nbv(s);
        s = s.replace(/[^\-A-Fa-f0-9]/g, '');
        if (!s)
            s = '0';
        var k = 4;
        var r = nbi(s.length / 7);
        var i = s.length, mi = false, sh = 0;
        while (--i >= 0) {
            var c = s.charAt(i);
            if (c === '-') {
                mi = true;
                continue;
            }
            var x = parseInt(s.charAt(i), 16);
            mi = false;
            if (sh === 0)
                r[r.t++] = x;
            else if (sh + k > DB) {
                r[r.t - 1] |= (x & ((1 << (DB - sh)) - 1)) << sh;
                r[r.t++] = (x >> (DB - sh));
            }
            else
                r[r.t - 1] |= x << sh;
            sh += k;
            if (sh >= DB)
                sh -= DB;
        }
        if (mi)
            subTo(ZERO, r, r);
        return clamp(r);
    }

    function bitoh(x) {
        if (x.s < 0)
            return "-" + bitoh(negTo(x, nbi(x.t)));
        var k = 4;
        var km = (1 << k) - 1, d, m = false, r = "", i = x.t;
        var p = DB - (i * DB) % k;
        if (i-- > 0) {
            if (p < DB && (d = x[i] >> p) > 0) {
                m = true;
                r = d.toString(16);
            }
            while (i >= 0) {
                if (p < k) {
                    d = (x[i] & ((1 << p) - 1)) << (k - p);
                    d |= x[--i] >> (p += DB - k);
                }
                else {
                    d = (x[i] >> (p -= k)) & km;
                    if (p <= 0) {
                        p += DB;
                        --i;
                    }
                }
                if (d > 0)
                    m = true;
                if (m)
                    r += d.toString(16);
            }
        }
        return "0x" + (m ? r : "0");
    }

    // biginteger to big-endian integer bytearray
    function bitoi(s) {
        var i = s.t, r = [];
        r[0] = s.s;
        var p = DB - (i * DB) % 8, d, k = 0;
        if (i-- > 0) {
            if (p < DB && (d = s[i] >> p) !== (s.s & DM) >> p)
                r[k++] = d | (s.s << (DB - p));
            while (i >= 0) {
                if (p < 8) {
                    d = (s[i] & ((1 << p) - 1)) << (8 - p);
                    d |= s[--i] >> (p += DB - 8);
                }
                else {
                    d = (s[i] >> (p -= 8)) & 0xff;
                    if (p <= 0) {
                        p += DB;
                        --i;
                    }
                }
                if ((d & 0x80) !== 0)
                    d |= -256;
                if (k === 0 && (s.s & 0x80) !== (d & 0x80))
                    ++k;
                if (k > 0 || d !== s.s)
                    r[k++] = d;
            }
        }
        return new Uint8Array(r).buffer;
    }

    // big-endian integer bytearray to biginteger
    function itobi(d) {
        var k = 8, s = new Uint8Array(d),
                r = nbi(s.length / 7);
        r.t = 0;
        r.s = 0;
        var i = s.length, sh = 0;
        while (--i >= 0) {
            var x = s[i] & 0xff;
            if (sh === 0)
                r[r.t++] = x;
            else if (sh + k > DB) {
                r[r.t - 1] |= (x & ((1 << (DB - sh)) - 1)) << sh;
                r[r.t++] = (x >> (DB - sh));
            }
            else
                r[r.t - 1] |= x << sh;
            sh += k;
            if (sh >= DB)
                sh -= DB;
        }
        if ((s[0] & 0x80) !== 0) {
            r.s = -1;
            if (sh > 0)
                r[r.t - 1] |= ((1 << (DB - sh)) - 1) << sh;
        }
        return clamp(r);
    }


    // Swap bytes in buffer
    function swap(s) {
        var src = new Uint8Array(s),
                dst = new Uint8Array(src.length);
        for (var i = 0, n = src.length; i < n; i++)
            dst[n - i - 1] = src[i];
        return dst.buffer;
    }

    // Calculate hash of data
    function hash(d) {
        if (this.hash)
            d = this.hash.digest(d);
        // Swap hash for SignalCom
        if (this.procreator === 'SC' ||
                (this.procreator === 'VN' && this.hash.version === 2012))
            d = swap(d);
        return d;
    }

    // Check buffer
    function buffer(d) {
        if (d instanceof CryptoOperationData)
            return d;
        else if (d && d.buffer && d.buffer instanceof CryptoOperationData)
            return d.byteOffset === 0 && d.byteLength === d.buffer.byteLength ?
                    d.buffer : new Uint8Array(new Uint8Array(d, d.byteOffset, d.byteLength)).buffer;
        else
            throw new DataError('CryptoOperationData or CryptoOperationDataView required');
    }

    // Check double buffer
    function to2(d) {
        var b = buffer(d);
        if (b.byteLength % 2 > 0)
            throw new DataError('Buffer length must be even');
        var n = b.byteLength / 2;
        return [atobi(new Uint8Array(b, 0, n)), atobi(new Uint8Array(b, n, n))];
    }

    function from2(x, y, bitLength) {
        var a = bitoa(x, bitLength),
                b = bitoa(y, bitLength),
                d = new Uint8Array(a.byteLength + b.byteLength);
        d.set(new Uint8Array(a));
        d.set(new Uint8Array(b), a.byteLength);
        return d.buffer;
    }

    function getSeed(length) {
        var randomSource = new GostRandom();
        if (randomSource.getRandomValues) {
            var d = new Uint8Array(Math.ceil(length / 8));
            randomSource.getRandomValues(d);
            return d;
        } else
            throw new NotSupportedError('Random generator not found');
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * The sign method returns sign data generated with the supplied privateKey.<br>
     * 
     * @memberOf GostSign
     * @method sign
     * @instance
     * @param {(CryptoOperationData|TypedArray)} privateKey Private key
     * @param {(CryptoOperationData|TypedArray)} data Data
     * @returns {CryptoOperationData} Signature
     */
    function sign(privateKey, data)
    {

        // Stage 1
        var b = buffer(data);
        var alpha = atobi(hash.call(this, b));

        var q = this.q;
        var x = mod(atobi(buffer(privateKey)), q);

        // Stage 2
        var e = mod(alpha, q);
        if (isZero(e))
            e = ONE;

        var s = ZERO;
        while (isZero(s)) {
            var r = ZERO;
            while (isZero(r)) {

                // Stage 3
                var k = mod(atobi(this.ukm ||
                        getSeed(this.bitLength)), q); // pseudo random 0 < k < q
                // Stage 4
                if (this.curve) {
                    // Gost R 34.10-2001 || Gost R 34.10-2012 
                    var P = this.P;
                    var C = mulEC(P, k);
                    r = mod(getX(C), q);
                } else {
                    // Gost R 34.10-94
                    var p = this.p, a = this.a;
                    r = mod(expMod(a, k, p), q);
                }
            }
            // Stage 5
            s = mod(add(mul(r, x), mul(k, e)), q);
        }
        // Stage 6
        // console.log('s', bitoh(s));
        // console.log('r', bitoh(r));
        var zetta;
        // Integer structure for SignalCom algorithm
        if (this.procreator === 'SC') {
            zetta = {
                r: bitoh(r),
                s: bitoh(s)
            };
        } else {
            zetta = from2(r, s, this.bitLength);
            // Swap bytes for CryptoPro algorithm
            if (this.procreator === 'CP' || this.procreator === 'VN')
                zetta = swap(zetta);
        }
        return zetta;
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * The verify method returns signature verification for the supplied publicKey.<br>
     * 
     * @memberOf GostSign
     * @method sign
     * @instance
     * @param {(CryptoOperationData|TypedArray)} publicKey Public key
     * @param {(CryptoOperationData|TypedArray)} signature Signature
     * @param {(CryptoOperationData|TypedArray)} data Data
     * @returns {boolean} Signature verified = true
     */
    function verify(publicKey, signature, data)
    {

        // Stage 1
        var q = this.q;
        var r, s;
        // Ready int for SignalCom algorithm
        if (this.procreator === 'SC') {
            r = htobi(signature.r);
            s = htobi(signature.s);
        } else {
            if (this.procreator === 'CP' || this.procreator === 'VN')
                signature = swap(signature);
            var zetta = to2(signature);
            // Swap bytes for CryptoPro algorithm
            s = zetta[1]; //  first 32 octets contain the big-endian representation of s 
            r = zetta[0]; //  and second 32 octets contain the big-endian representation of r
        }
        if (compare(r, q) >= 0 || compare(s, q) >= 0)
            return false;
        // Stage 2
        var b = buffer(data);
        var alpha = atobi(hash.call(this, b));
        // Stage 3
        var e = mod(alpha, q);
        if (isZero(e) === 0)
            e = ONE;
        // Stage 4
        var v = invMod(e, q);
        // Stage 5
        var z1 = mod(mul(s, v), q);
        var z2 = sub(q, mod(mul(r, v), q));
        // Stage 6
        if (this.curve) {
            // Gost R 34.10-2001 || Gost R 34.10-2012 
            var k2 = to2(publicKey),
                    curve = this.curve,
                    P = this.P,
                    x = newFE(curve, k2[0]), // first 32 octets contain the little-endian representation of x
                    y = newFE(curve, k2[1]), // and second 32 octets contain the little-endian representation of y.
                    Q = new newEC(curve, x, y); // This corresponds to the binary representation of (<y>256||<x>256) 
            var C = mulTwoEC(P, z1, Q, z2);
            var R = mod(getX(C), q);
        } else {
            // Gost R 34.10-94
            var p = this.p, a = this.a;
            var y = atobi(publicKey);
            var R = mod(mod(mul(expMod(a, z1, p), expMod(y, z2, p)), p), q);
        }
        // Stage 7
        return (compare(R, r) === 0);
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * The generateKey method returns a new generated key pair using the specified 
     * AlgorithmIdentifier.
     * 
     * @memberOf GostSign
     * @method generateKey
     * @instance
     * @returns {Object} Object with two CryptoOperationData members: privateKey and publicKey
     */
    function generateKey()
    {
        var curve = this.curve;
        if (curve) {

            var Q = curve.infinity;
            while (isInfinity(Q)) {

                // Generate random private key
                var d = ZERO;
                if (this.ukm) {
                    d = atobi(this.ukm);
                } else {
                    while (isZero(d))
                        d = mod(atobi(getSeed(this.bitLength)), this.q); // 0 < d < q
                }

                // Calculate public key
                Q = mulEC(this.P, d);
                var x = getX(Q), y = getY(Q);
                // console.log('d', bitoh(d));
                // console.log('x', bitoh(x));
                // console.log('y', bitoh(y));
            }

            // Return result
            return {
                privateKey: bitoa(d, this.bitLength),
                publicKey: from2(x, y, this.bitLength) // This corresponds to the binary representation of (<y>256||<x>256)
            };

        } else
            throw new NotSupportedError('Key generation for GOST R 34.10-94 not supported');
    }

    /**
     * Algorithm name GOST R 34.10 mode MASK<br><br>
     * 
     * The generateMaskKey method returns a new generated key mask using for wrapping.
     * 
     * @memberOf GostSign
     * @method generateMaskKey
     * @instance
     * @returns {Object} Object with two CryptoOperationData members: privateKey and publicKey
     */
    function generateMaskKey()
    {
        var curve = this.curve;
        if (curve) {
            // Generate random private key
            var d = ZERO;
            while (isZero(d))
                d = mod(atobi(getSeed(this.bitLength)), this.q); // 0 < d < q

            // Return result
            return bitoa(d, this.bitLength);
        } else
            throw new NotSupportedError('Key generation for GOST R 34.10-94 not supported');
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * Unwrap private key from private key and ukm (mask)
     * 
     * @memberOf GostSign
     * @method unwrap
     * @instance
     * @param {(CryptoOperationData|TypedArray)} baseKey Unwrapping key
     * @param {(CryptoOperationData|TypedArray)} data Wrapped key
     * @returns {Object} CryptoOperationData unwrapped privateKey
     */
    function unwrapKey(baseKey, data)
    {
        var curve = this.curve;
        if (curve) {
            var q = this.q;
            var x = mod(atobi(buffer(data)), q);
            var y = mod(atobi(buffer(baseKey)), q);
            var z = this.procreator === 'VN' ? mod(mul(x, y), q) : mod(mul(x, invMod(y, q)), q);
            return bitoa(z);
        } else
            throw new NotSupportedError('Key wrapping GOST R 34.10-94 not supported');
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * Wrap private key with private key and ukm (mask)
     * 
     * @memberOf GostSign
     * @method unwrap
     * @instance
     * @param {(CryptoOperationData|TypedArray)} baseKey Wrapping key
     * @param {(CryptoOperationData|TypedArray)} data Key
     * @returns {Object} CryptoOperationData unwrapped privateKey
     */
    function wrapKey(baseKey, data)
    {
        var curve = this.curve;
        if (curve) {
            var q = this.q;
            var x = mod(atobi(buffer(data)), q);
            var y = mod(atobi(buffer(baseKey)), q);
            var z = this.procreator === 'VN' ? mod(mul(x, invMod(y, q)), q) : mod(mul(x, y), q);
            return bitoa(z);
        } else
            throw new NotSupportedError('Key wrapping GOST R 34.10-94 not supported');
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * @memberOf GostSign
     * @method derive
     * @instance
     * @private
     * @param {CryptoOperationData} baseKey Key for deriviation
     * @returns {CryptoOperationData}
     */
    function derive(baseKey)
    {

        var k, ukm = atobi(this.ukm);
        var q = this.q;
        var x = mod(atobi(buffer(baseKey)), q);

        if (this.curve) {
            // 1) Let K(x,y,UKM) = ((UKM*x)(mod q)) . (y.P) (512 bit), where      
            // x - sender’s private key (256 bit)      
            // x.P - sender’s public key (512 bit)      
            // y - recipient’s private key (256 bit)      
            // y.P - recipient’s public key (512 bit)      
            // UKM - non-zero integer, produced as in step 2 p. 6.1 [GOSTR341001]      
            // P - base point on the elliptic curve (two 256-bit coordinates)      
            // UKM*x - x multiplied by UKM as integers      
            // x.P - a multiple point   
            var K = mulEC(this.peer_Q, mod(mul(ukm, x), q));
            k = from2(getX(K), getY(K), // This corresponds to the binary representation of (<y>256||<x>256)
                    this.bitLength);
        } else {
            // 1) Let K(x,y) = a^(x*y) (mod p), where      
            // x - sender’s private key, a^x - sender’s public key      
            // y - recipient’s private key, a^y - recipient’s public key      
            // a, p - parameters
            var p = this.p, a = this.a;
            k = bitoa(expMod(this.peer_y, x, p));
        }
        // 2) Calculate a 256-bit hash of K(x,y,UKM):      
        // KEK(x,y,UKM) = gostSign (K(x,y,UKM)
        return hash.call(this, k);
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * The deriveBits method returns length bits on baseKey.
     * 
     * @memberOf GostSign
     * @method deriveBits
     * @instance
     * @param {(CryptoOperationData|TypedArray)} baseKey Key for deriviation
     * @param {number} length output bit-length
     * @returns {CryptoOperationData} result
     */
    function deriveBits(baseKey, length)
    {
        if (length < 8 || length > this.bitLength || length % 8 > 0)
            throw new DataError('Length must be no more than ' + this.bitLength + ' bits and multiple of 8');
        var n = length / 8,
                b = derive.call(this, baseKey),
                r = new Uint8Array(n);

        r.set(new Uint8Array(b, 0, n));
        return r.buffer;
    }

    /**
     * Algorithm name GOST R 34.10<br><br>
     * 
     * The deriveKey method returns 256 bit Key encryption key on baseKey.
     * 
     * This algorithm creates a key encryption key (KEK) using 64 bit UKM,   
     * the sender’s private key, and the recipient’s public key (or the   
     * reverse of the latter pair
     * 
     * @memberOf GostSign
     * @method deriveKey
     * @instance
     * @param {(CryptoOperationData|TypedArray)} baseKey Key for deriviation
     * @returns {CryptoOperationData} result
     */
    function deriveKey(baseKey)
    {
        var b = derive.call(this, baseKey),
                r = new Uint8Array(32);

        r.set(new Uint8Array(b, 0, 32));
        return r.buffer;
    }


    /**
     * Gost R 34.10 universal object<br><br>
     * 
     * References: {@link http://tools.ietf.org/html/rfc6986} and {@link http://tools.ietf.org/html/rfc5831}<br><br>
     * 
     * Normalized algorithm identifier common parameters:
     * 
     *  <ul>
     *      <li><b>name</b> Algorithm name 'GOST R 34.10'</li>
     *      <li><b>version</b> Algorithm version
     *          <ul>
     *              <li><b>1994</b> - Old-style GOST R 34.10-94 ExpMod algorithm with GOST R 34.11-94 hash</li>
     *              <li><b>2001</b> - GOST R 34.10-2001 Eliptic curve algorithm with old GOST R 34.11-94 hash</li>
     *              <li><b>2012</b> - GOST R 34.10-2012 Eliptic curve algorithm with GOST R 34.11-12 hash, default mode</li>
     *          </ul>
     *      </li>
     *      <li><b>length</b> Length of hash and signature. Key length == hash length for EC algorithms and 2 * hash length for ExpMod algorithm
     *          <ul>
     *              <li><b>GOST R 34.10-256</b> - 256 bits digest, default mode</li>
     *              <li><b>GOST R 34.10-512</b> - 512 bits digest only for GOST R 34.11-2012 hash</li>
     *          </ul>
     *      </li>
     *      <li><b>mode</b> Algorithm mode
     *          <ul>
     *              <li><b>SIGN</b> Digital signature mode (default)</li>
     *              <li><b>DH</b> Diffie-Hellman key generation and key agreement mode</li>
     *          </ul>
     *      </li>
     *      <li><b>sBox</b> Paramset sBox for GOST 34.11-94. Used only if version = 1994 or 2001</li>
     *  </ul>
     *  
     * Supported algorithms, modes and parameters:
     * 
     *  <ul>
     *      <li>Sign/Verify mode (SIGN)</li>
     *      <li>DeriveKey/DeriveBits mode (DH)
     *          <ul>
     *              <li>{@link CryptoOperationData} <b>ukm</b> User key material. Default - random generated value</li>
     *              <li>{@link CryptoOperationData} <b>public</b> The peer's EC public key data</li>
     *          </ul>
     *      </li>
     *      <li>GenerateKey mode (SIGN and DH) version = 1994
     *          <ul>
     *              <li><b>namedParam</b> Paramset for key generation algorithm. If specified no additianal parameters required</li>
     *          </ul>
     *          Additional parameters, if namedParam not specified
     *          <ul>
     *              <li><b>modulusLength</b> Bit length of p (512 or 1024 bits). Default = 1024</li>
     *              <li><b>p</b> {@link CryptoOperationData} Modulus, prime number, 2^(t-1)<p<2^t</li>
     *              <li><b>q</b> {@link CryptoOperationData} Order of cyclic group, prime number, 2^254<q<2^256, q is a factor of p-1</li>
     *              <li><b>a</b> {@link CryptoOperationData} Generator, integer, 1<a<p-1, at that aq (mod p) = 1</li>
     *          </ul>
     *      </li>
     *      <li>GenerateKey mode (SIGN and DH) version = 2001 or 2012
     *          <ul>
     *              <li><b>namedCurve</b> Paramset for key generation algorithm. If specified no additianal parameters required</li>
     *          </ul>
     *          Additional EC parameters, if namedCurve not specified
     *          <ul>
     *              <li><b>p</b> {@link CryptoOperationData} Prime number - elliptic curve modulus</li>
     *              <li><b>a</b> {@link CryptoOperationData} Coefficients a of the elliptic curve E</li>
     *              <li><b>b</b> {@link CryptoOperationData} Coefficients b of the elliptic curve E</li>
     *              <li><b>q</b> {@link CryptoOperationData} Prime number - order of cyclic group</li>
     *              <li><b>x</b> {@link CryptoOperationData} Base point p x-coordinate</li>
     *              <li><b>y</b> {@link CryptoOperationData} Base point p y-coordinate</li>
     *          </ul>
     *      </li>
     *  </ul>
     *  
     * @class GostSign
     * @param {AlgorithmIndentifier} algorithm
     */
    function GostSign(algorithm)
    {
        algorithm = algorithm || {};
        this.name = (algorithm.name || 'GOST R 34.10') + '-' +
                ((algorithm.version || 2012) % 100) + '-' + (algorithm.length || 256) +
                (((algorithm.mode || 'SIGN') !== 'SIGN') ? '-' + algorithm.mode : '') +
                (typeof algorithm.namedParam === 'string' ? '/' + algorithm.namedParam : '') +
                (typeof algorithm.namedCurve === 'string' ? '/' + algorithm.namedCurve : '') +
                (typeof algorithm.sBox === 'string' ? '/' + algorithm.sBox : '');

        var version = algorithm.version || 2012;

        // Functions
        switch (algorithm.mode || 'SIGN') {
            case 'SIGN':
                this.sign = sign;
                this.verify = verify;
                this.generateKey = generateKey;
                break;
            case 'DH':
                this.deriveBits = deriveBits;
                this.deriveKey = deriveKey;
                this.generateKey = generateKey;
                break;
            case 'MASK':
                this.wrapKey = wrapKey;
                this.unwrapKey = unwrapKey;
                this.generateKey = generateMaskKey;
                break;
        }

        // Define parameters
        if (version === 1994) {
            // Named or parameters algorithm
            var param = algorithm.param;
            if (!param)
                param = GostParams[this.namedParam = (algorithm.namedParam || 'S-A').toUpperCase()];
            this.modulusLength = algorithm.modulusLength || param.modulusLength || 1024;
            this.p = htobi(param.p);
            this.q = htobi(param.q);
            this.a = htobi(param.a);
            // Public key for derive
            if (algorithm['public'])
                this.peer_y = atobi(algorithm['public']);
        } else {
            // Named or parameters algorithm
            var param = algorithm.curve;
            if (!param)
                param = ECGostParams[this.namedCurve = (algorithm.namedCurve || 'S-256-A').toUpperCase()];
            var curve = this.curve = newCurve(htobi(param.p), htobi(param.a), htobi(param.b));
            this.P = newEC(curve,
                    newFE(curve, htobi(param.x)),
                    newFE(curve, htobi(param.y)));
            this.q = htobi(param.q);
            // Public key for derive
            if (algorithm['public']) {
                var k2 = to2(algorithm['public']);
                this.peer_Q = new newEC(this.curve, // This corresponds to the binary representation of (<y>256||<x>256)
                        newFE(this.curve, k2[0]), // first 32 octets contain the little-endian representation of x
                        newFE(this.curve, k2[1])); // and second 32 octets contain the little-endian representation of y.
            }
        }

        // Check bit length
        var hashLen, keyLen;
        if (this.curve) {
            keyLen = algorithm.length || bitLength(this.q);
            if (keyLen > 508 && keyLen <= 512)
                keyLen = 512;
            else if (keyLen > 254 && keyLen <= 256)
                keyLen = 256;
            else
                throw new NotSupportedError('Support keys only 256 or 512 bits length');
            hashLen = keyLen;
        } else {
            keyLen = algorithm.modulusLength || bitLength(this.p);
            if (keyLen > 1016 && keyLen <= 1024)
                keyLen = 1024;
            else if (keyLen > 508 && keyLen <= 512)
                keyLen = 512;
            else
                throw new NotSupportedError('Support keys only 512 or 1024 bits length');
            hashLen = 256;
        }
        this.bitLength = hashLen;
        this.keyLength = keyLen;

        // Algorithm proceator for result conversion
        this.procreator = algorithm.procreator;

        // Hash function definition
        var hash = algorithm.hash;
        if (hash) {
            if (typeof hash === 'string' || hash instanceof String)
                hash = {name: hash};
            if (algorithm.version === 1994 || algorithm.version === 2001) {
                hash.version = 1994;
                hash.length = 256;
                hash.sBox = algorithm.sBox || hash.sBox;
            } else {
                hash.version = 2012;
                hash.length = hashLen;
            }
            hash.procreator = hash.procreator || algorithm.procreator;

            if (!GostDigest)
                throw new NotSupportedError('Object GostDigest not found');

            this.hash = new GostDigest(hash);
        }

        // Pregenerated seed for key exchange algorithms
        if (algorithm.ukm) // Now don't check size 
            this.ukm = algorithm.ukm;

    }

module.exports = GostSign;



/***/ }),

/***/ "./node_modules/node-gost-crypto/lib/index.js":
/*!****************************************************!*\
  !*** ./node_modules/node-gost-crypto/lib/index.js ***!
  \****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

const gostCrypto = __webpack_require__(/*! ./gostCrypto */ "./node_modules/node-gost-crypto/lib/gostCrypto.js");
const gostEngine = __webpack_require__(/*! ./gostEngine */ "./node_modules/node-gost-crypto/lib/gostEngine.js");

__webpack_require__(/*! ./gostSecurity */ "./node_modules/node-gost-crypto/lib/gostSecurity.js");
__webpack_require__(/*! ./gostCoding */ "./node_modules/node-gost-crypto/lib/gostCoding.js");
__webpack_require__(/*! ./gostASN1 */ "./node_modules/node-gost-crypto/lib/gostASN1.js");
__webpack_require__(/*! ./gostCMS */ "./node_modules/node-gost-crypto/lib/gostCMS.js");
__webpack_require__(/*! ./gostCert */ "./node_modules/node-gost-crypto/lib/gostCert.js");
__webpack_require__(/*! ./gostCipher */ "./node_modules/node-gost-crypto/lib/gostCipher.js");
__webpack_require__(/*! ./gostDigest */ "./node_modules/node-gost-crypto/lib/gostDigest.js");
__webpack_require__(/*! ./gostKeys */ "./node_modules/node-gost-crypto/lib/gostKeys.js");
__webpack_require__(/*! ./gostRandom */ "./node_modules/node-gost-crypto/lib/gostRandom.js");
__webpack_require__(/*! ./gostSign */ "./node_modules/node-gost-crypto/lib/gostSign.js");

module.exports = {
    gostCrypto,
    gostEngine,
};


/***/ }),

/***/ "./node_modules/qrcode-generator/qrcode.js":
/*!*************************************************!*\
  !*** ./node_modules/qrcode-generator/qrcode.js ***!
  \*************************************************/
/***/ ((module, exports) => {

var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//---------------------------------------------------------------------
//
// QR Code Generator for JavaScript
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: http://www.d-project.com/
//
// Licensed under the MIT license:
//  http://www.opensource.org/licenses/mit-license.php
//
// The word 'QR Code' is registered trademark of
// DENSO WAVE INCORPORATED
//  http://www.denso-wave.com/qrcode/faqpatent-e.html
//
//---------------------------------------------------------------------

var qrcode = function() {

  //---------------------------------------------------------------------
  // qrcode
  //---------------------------------------------------------------------

  /**
   * qrcode
   * @param typeNumber 1 to 40
   * @param errorCorrectionLevel 'L','M','Q','H'
   */
  var qrcode = function(typeNumber, errorCorrectionLevel) {

    var PAD0 = 0xEC;
    var PAD1 = 0x11;

    var _typeNumber = typeNumber;
    var _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
    var _modules = null;
    var _moduleCount = 0;
    var _dataCache = null;
    var _dataList = [];

    var _this = {};

    var makeImpl = function(test, maskPattern) {

      _moduleCount = _typeNumber * 4 + 17;
      _modules = function(moduleCount) {
        var modules = new Array(moduleCount);
        for (var row = 0; row < moduleCount; row += 1) {
          modules[row] = new Array(moduleCount);
          for (var col = 0; col < moduleCount; col += 1) {
            modules[row][col] = null;
          }
        }
        return modules;
      }(_moduleCount);

      setupPositionProbePattern(0, 0);
      setupPositionProbePattern(_moduleCount - 7, 0);
      setupPositionProbePattern(0, _moduleCount - 7);
      setupPositionAdjustPattern();
      setupTimingPattern();
      setupTypeInfo(test, maskPattern);

      if (_typeNumber >= 7) {
        setupTypeNumber(test);
      }

      if (_dataCache == null) {
        _dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
      }

      mapData(_dataCache, maskPattern);
    };

    var setupPositionProbePattern = function(row, col) {

      for (var r = -1; r <= 7; r += 1) {

        if (row + r <= -1 || _moduleCount <= row + r) continue;

        for (var c = -1; c <= 7; c += 1) {

          if (col + c <= -1 || _moduleCount <= col + c) continue;

          if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
              || (0 <= c && c <= 6 && (r == 0 || r == 6) )
              || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
            _modules[row + r][col + c] = true;
          } else {
            _modules[row + r][col + c] = false;
          }
        }
      }
    };

    var getBestMaskPattern = function() {

      var minLostPoint = 0;
      var pattern = 0;

      for (var i = 0; i < 8; i += 1) {

        makeImpl(true, i);

        var lostPoint = QRUtil.getLostPoint(_this);

        if (i == 0 || minLostPoint > lostPoint) {
          minLostPoint = lostPoint;
          pattern = i;
        }
      }

      return pattern;
    };

    var setupTimingPattern = function() {

      for (var r = 8; r < _moduleCount - 8; r += 1) {
        if (_modules[r][6] != null) {
          continue;
        }
        _modules[r][6] = (r % 2 == 0);
      }

      for (var c = 8; c < _moduleCount - 8; c += 1) {
        if (_modules[6][c] != null) {
          continue;
        }
        _modules[6][c] = (c % 2 == 0);
      }
    };

    var setupPositionAdjustPattern = function() {

      var pos = QRUtil.getPatternPosition(_typeNumber);

      for (var i = 0; i < pos.length; i += 1) {

        for (var j = 0; j < pos.length; j += 1) {

          var row = pos[i];
          var col = pos[j];

          if (_modules[row][col] != null) {
            continue;
          }

          for (var r = -2; r <= 2; r += 1) {

            for (var c = -2; c <= 2; c += 1) {

              if (r == -2 || r == 2 || c == -2 || c == 2
                  || (r == 0 && c == 0) ) {
                _modules[row + r][col + c] = true;
              } else {
                _modules[row + r][col + c] = false;
              }
            }
          }
        }
      }
    };

    var setupTypeNumber = function(test) {

      var bits = QRUtil.getBCHTypeNumber(_typeNumber);

      for (var i = 0; i < 18; i += 1) {
        var mod = (!test && ( (bits >> i) & 1) == 1);
        _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
      }

      for (var i = 0; i < 18; i += 1) {
        var mod = (!test && ( (bits >> i) & 1) == 1);
        _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
      }
    };

    var setupTypeInfo = function(test, maskPattern) {

      var data = (_errorCorrectionLevel << 3) | maskPattern;
      var bits = QRUtil.getBCHTypeInfo(data);

      // vertical
      for (var i = 0; i < 15; i += 1) {

        var mod = (!test && ( (bits >> i) & 1) == 1);

        if (i < 6) {
          _modules[i][8] = mod;
        } else if (i < 8) {
          _modules[i + 1][8] = mod;
        } else {
          _modules[_moduleCount - 15 + i][8] = mod;
        }
      }

      // horizontal
      for (var i = 0; i < 15; i += 1) {

        var mod = (!test && ( (bits >> i) & 1) == 1);

        if (i < 8) {
          _modules[8][_moduleCount - i - 1] = mod;
        } else if (i < 9) {
          _modules[8][15 - i - 1 + 1] = mod;
        } else {
          _modules[8][15 - i - 1] = mod;
        }
      }

      // fixed module
      _modules[_moduleCount - 8][8] = (!test);
    };

    var mapData = function(data, maskPattern) {

      var inc = -1;
      var row = _moduleCount - 1;
      var bitIndex = 7;
      var byteIndex = 0;
      var maskFunc = QRUtil.getMaskFunction(maskPattern);

      for (var col = _moduleCount - 1; col > 0; col -= 2) {

        if (col == 6) col -= 1;

        while (true) {

          for (var c = 0; c < 2; c += 1) {

            if (_modules[row][col - c] == null) {

              var dark = false;

              if (byteIndex < data.length) {
                dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
              }

              var mask = maskFunc(row, col - c);

              if (mask) {
                dark = !dark;
              }

              _modules[row][col - c] = dark;
              bitIndex -= 1;

              if (bitIndex == -1) {
                byteIndex += 1;
                bitIndex = 7;
              }
            }
          }

          row += inc;

          if (row < 0 || _moduleCount <= row) {
            row -= inc;
            inc = -inc;
            break;
          }
        }
      }
    };

    var createBytes = function(buffer, rsBlocks) {

      var offset = 0;

      var maxDcCount = 0;
      var maxEcCount = 0;

      var dcdata = new Array(rsBlocks.length);
      var ecdata = new Array(rsBlocks.length);

      for (var r = 0; r < rsBlocks.length; r += 1) {

        var dcCount = rsBlocks[r].dataCount;
        var ecCount = rsBlocks[r].totalCount - dcCount;

        maxDcCount = Math.max(maxDcCount, dcCount);
        maxEcCount = Math.max(maxEcCount, ecCount);

        dcdata[r] = new Array(dcCount);

        for (var i = 0; i < dcdata[r].length; i += 1) {
          dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
        }
        offset += dcCount;

        var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
        var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);

        var modPoly = rawPoly.mod(rsPoly);
        ecdata[r] = new Array(rsPoly.getLength() - 1);
        for (var i = 0; i < ecdata[r].length; i += 1) {
          var modIndex = i + modPoly.getLength() - ecdata[r].length;
          ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
        }
      }

      var totalCodeCount = 0;
      for (var i = 0; i < rsBlocks.length; i += 1) {
        totalCodeCount += rsBlocks[i].totalCount;
      }

      var data = new Array(totalCodeCount);
      var index = 0;

      for (var i = 0; i < maxDcCount; i += 1) {
        for (var r = 0; r < rsBlocks.length; r += 1) {
          if (i < dcdata[r].length) {
            data[index] = dcdata[r][i];
            index += 1;
          }
        }
      }

      for (var i = 0; i < maxEcCount; i += 1) {
        for (var r = 0; r < rsBlocks.length; r += 1) {
          if (i < ecdata[r].length) {
            data[index] = ecdata[r][i];
            index += 1;
          }
        }
      }

      return data;
    };

    var createData = function(typeNumber, errorCorrectionLevel, dataList) {

      var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectionLevel);

      var buffer = qrBitBuffer();

      for (var i = 0; i < dataList.length; i += 1) {
        var data = dataList[i];
        buffer.put(data.getMode(), 4);
        buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
        data.write(buffer);
      }

      // calc num max data.
      var totalDataCount = 0;
      for (var i = 0; i < rsBlocks.length; i += 1) {
        totalDataCount += rsBlocks[i].dataCount;
      }

      if (buffer.getLengthInBits() > totalDataCount * 8) {
        throw 'code length overflow. ('
          + buffer.getLengthInBits()
          + '>'
          + totalDataCount * 8
          + ')';
      }

      // end code
      if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
        buffer.put(0, 4);
      }

      // padding
      while (buffer.getLengthInBits() % 8 != 0) {
        buffer.putBit(false);
      }

      // padding
      while (true) {

        if (buffer.getLengthInBits() >= totalDataCount * 8) {
          break;
        }
        buffer.put(PAD0, 8);

        if (buffer.getLengthInBits() >= totalDataCount * 8) {
          break;
        }
        buffer.put(PAD1, 8);
      }

      return createBytes(buffer, rsBlocks);
    };

    _this.addData = function(data, mode) {

      mode = mode || 'Byte';

      var newData = null;

      switch(mode) {
      case 'Numeric' :
        newData = qrNumber(data);
        break;
      case 'Alphanumeric' :
        newData = qrAlphaNum(data);
        break;
      case 'Byte' :
        newData = qr8BitByte(data);
        break;
      case 'Kanji' :
        newData = qrKanji(data);
        break;
      default :
        throw 'mode:' + mode;
      }

      _dataList.push(newData);
      _dataCache = null;
    };

    _this.isDark = function(row, col) {
      if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
        throw row + ',' + col;
      }
      return _modules[row][col];
    };

    _this.getModuleCount = function() {
      return _moduleCount;
    };

    _this.make = function() {
      if (_typeNumber < 1) {
        var typeNumber = 1;

        for (; typeNumber < 40; typeNumber++) {
          var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, _errorCorrectionLevel);
          var buffer = qrBitBuffer();

          for (var i = 0; i < _dataList.length; i++) {
            var data = _dataList[i];
            buffer.put(data.getMode(), 4);
            buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
            data.write(buffer);
          }

          var totalDataCount = 0;
          for (var i = 0; i < rsBlocks.length; i++) {
            totalDataCount += rsBlocks[i].dataCount;
          }

          if (buffer.getLengthInBits() <= totalDataCount * 8) {
            break;
          }
        }

        _typeNumber = typeNumber;
      }

      makeImpl(false, getBestMaskPattern() );
    };

    _this.createTableTag = function(cellSize, margin) {

      cellSize = cellSize || 2;
      margin = (typeof margin == 'undefined')? cellSize * 4 : margin;

      var qrHtml = '';

      qrHtml += '<table style="';
      qrHtml += ' border-width: 0px; border-style: none;';
      qrHtml += ' border-collapse: collapse;';
      qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
      qrHtml += '">';
      qrHtml += '<tbody>';

      for (var r = 0; r < _this.getModuleCount(); r += 1) {

        qrHtml += '<tr>';

        for (var c = 0; c < _this.getModuleCount(); c += 1) {
          qrHtml += '<td style="';
          qrHtml += ' border-width: 0px; border-style: none;';
          qrHtml += ' border-collapse: collapse;';
          qrHtml += ' padding: 0px; margin: 0px;';
          qrHtml += ' width: ' + cellSize + 'px;';
          qrHtml += ' height: ' + cellSize + 'px;';
          qrHtml += ' background-color: ';
          qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
          qrHtml += ';';
          qrHtml += '"/>';
        }

        qrHtml += '</tr>';
      }

      qrHtml += '</tbody>';
      qrHtml += '</table>';

      return qrHtml;
    };

    _this.createSvgTag = function(cellSize, margin, alt, title) {

      var opts = {};
      if (typeof arguments[0] == 'object') {
        // Called by options.
        opts = arguments[0];
        // overwrite cellSize and margin.
        cellSize = opts.cellSize;
        margin = opts.margin;
        alt = opts.alt;
        title = opts.title;
      }

      cellSize = cellSize || 2;
      margin = (typeof margin == 'undefined')? cellSize * 4 : margin;

      // Compose alt property surrogate
      alt = (typeof alt === 'string') ? {text: alt} : alt || {};
      alt.text = alt.text || null;
      alt.id = (alt.text) ? alt.id || 'qrcode-description' : null;

      // Compose title property surrogate
      title = (typeof title === 'string') ? {text: title} : title || {};
      title.text = title.text || null;
      title.id = (title.text) ? title.id || 'qrcode-title' : null;

      var size = _this.getModuleCount() * cellSize + margin * 2;
      var c, mc, r, mr, qrSvg='', rect;

      rect = 'l' + cellSize + ',0 0,' + cellSize +
        ' -' + cellSize + ',0 0,-' + cellSize + 'z ';

      qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
      qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : '';
      qrSvg += ' viewBox="0 0 ' + size + ' ' + size + '" ';
      qrSvg += ' preserveAspectRatio="xMinYMin meet"';
      qrSvg += (title.text || alt.text) ? ' role="img" aria-labelledby="' +
          escapeXml([title.id, alt.id].join(' ').trim() ) + '"' : '';
      qrSvg += '>';
      qrSvg += (title.text) ? '<title id="' + escapeXml(title.id) + '">' +
          escapeXml(title.text) + '</title>' : '';
      qrSvg += (alt.text) ? '<description id="' + escapeXml(alt.id) + '">' +
          escapeXml(alt.text) + '</description>' : '';
      qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
      qrSvg += '<path d="';

      for (r = 0; r < _this.getModuleCount(); r += 1) {
        mr = r * cellSize + margin;
        for (c = 0; c < _this.getModuleCount(); c += 1) {
          if (_this.isDark(r, c) ) {
            mc = c*cellSize+margin;
            qrSvg += 'M' + mc + ',' + mr + rect;
          }
        }
      }

      qrSvg += '" stroke="transparent" fill="black"/>';
      qrSvg += '</svg>';

      return qrSvg;
    };

    _this.createDataURL = function(cellSize, margin) {

      cellSize = cellSize || 2;
      margin = (typeof margin == 'undefined')? cellSize * 4 : margin;

      var size = _this.getModuleCount() * cellSize + margin * 2;
      var min = margin;
      var max = size - margin;

      return createDataURL(size, size, function(x, y) {
        if (min <= x && x < max && min <= y && y < max) {
          var c = Math.floor( (x - min) / cellSize);
          var r = Math.floor( (y - min) / cellSize);
          return _this.isDark(r, c)? 0 : 1;
        } else {
          return 1;
        }
      } );
    };

    _this.createImgTag = function(cellSize, margin, alt) {

      cellSize = cellSize || 2;
      margin = (typeof margin == 'undefined')? cellSize * 4 : margin;

      var size = _this.getModuleCount() * cellSize + margin * 2;

      var img = '';
      img += '<img';
      img += '\u0020src="';
      img += _this.createDataURL(cellSize, margin);
      img += '"';
      img += '\u0020width="';
      img += size;
      img += '"';
      img += '\u0020height="';
      img += size;
      img += '"';
      if (alt) {
        img += '\u0020alt="';
        img += escapeXml(alt);
        img += '"';
      }
      img += '/>';

      return img;
    };

    var escapeXml = function(s) {
      var escaped = '';
      for (var i = 0; i < s.length; i += 1) {
        var c = s.charAt(i);
        switch(c) {
        case '<': escaped += '&lt;'; break;
        case '>': escaped += '&gt;'; break;
        case '&': escaped += '&amp;'; break;
        case '"': escaped += '&quot;'; break;
        default : escaped += c; break;
        }
      }
      return escaped;
    };

    var _createHalfASCII = function(margin) {
      var cellSize = 1;
      margin = (typeof margin == 'undefined')? cellSize * 2 : margin;

      var size = _this.getModuleCount() * cellSize + margin * 2;
      var min = margin;
      var max = size - margin;

      var y, x, r1, r2, p;

      var blocks = {
        '██': '█',
        '█ ': '▀',
        ' █': '▄',
        '  ': ' '
      };

      var blocksLastLineNoMargin = {
        '██': '▀',
        '█ ': '▀',
        ' █': ' ',
        '  ': ' '
      };

      var ascii = '';
      for (y = 0; y < size; y += 2) {
        r1 = Math.floor((y - min) / cellSize);
        r2 = Math.floor((y + 1 - min) / cellSize);
        for (x = 0; x < size; x += 1) {
          p = '█';

          if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
            p = ' ';
          }

          if (min <= x && x < max && min <= y+1 && y+1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
            p += ' ';
          }
          else {
            p += '█';
          }

          // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
          ascii += (margin < 1 && y+1 >= max) ? blocksLastLineNoMargin[p] : blocks[p];
        }

        ascii += '\n';
      }

      if (size % 2 && margin > 0) {
        return ascii.substring(0, ascii.length - size - 1) + Array(size+1).join('▀');
      }

      return ascii.substring(0, ascii.length-1);
    };

    _this.createASCII = function(cellSize, margin) {
      cellSize = cellSize || 1;

      if (cellSize < 2) {
        return _createHalfASCII(margin);
      }

      cellSize -= 1;
      margin = (typeof margin == 'undefined')? cellSize * 2 : margin;

      var size = _this.getModuleCount() * cellSize + margin * 2;
      var min = margin;
      var max = size - margin;

      var y, x, r, p;

      var white = Array(cellSize+1).join('██');
      var black = Array(cellSize+1).join('  ');

      var ascii = '';
      var line = '';
      for (y = 0; y < size; y += 1) {
        r = Math.floor( (y - min) / cellSize);
        line = '';
        for (x = 0; x < size; x += 1) {
          p = 1;

          if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
            p = 0;
          }

          // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
          line += p ? white : black;
        }

        for (r = 0; r < cellSize; r += 1) {
          ascii += line + '\n';
        }
      }

      return ascii.substring(0, ascii.length-1);
    };

    _this.renderTo2dContext = function(context, cellSize) {
      cellSize = cellSize || 2;
      var length = _this.getModuleCount();
      for (var row = 0; row < length; row++) {
        for (var col = 0; col < length; col++) {
          context.fillStyle = _this.isDark(row, col) ? 'black' : 'white';
          context.fillRect(row * cellSize, col * cellSize, cellSize, cellSize);
        }
      }
    }

    return _this;
  };

  //---------------------------------------------------------------------
  // qrcode.stringToBytes
  //---------------------------------------------------------------------

  qrcode.stringToBytesFuncs = {
    'default' : function(s) {
      var bytes = [];
      for (var i = 0; i < s.length; i += 1) {
        var c = s.charCodeAt(i);
        bytes.push(c & 0xff);
      }
      return bytes;
    }
  };

  qrcode.stringToBytes = qrcode.stringToBytesFuncs['default'];

  //---------------------------------------------------------------------
  // qrcode.createStringToBytes
  //---------------------------------------------------------------------

  /**
   * @param unicodeData base64 string of byte array.
   * [16bit Unicode],[16bit Bytes], ...
   * @param numChars
   */
  qrcode.createStringToBytes = function(unicodeData, numChars) {

    // create conversion map.

    var unicodeMap = function() {

      var bin = base64DecodeInputStream(unicodeData);
      var read = function() {
        var b = bin.read();
        if (b == -1) throw 'eof';
        return b;
      };

      var count = 0;
      var unicodeMap = {};
      while (true) {
        var b0 = bin.read();
        if (b0 == -1) break;
        var b1 = read();
        var b2 = read();
        var b3 = read();
        var k = String.fromCharCode( (b0 << 8) | b1);
        var v = (b2 << 8) | b3;
        unicodeMap[k] = v;
        count += 1;
      }
      if (count != numChars) {
        throw count + ' != ' + numChars;
      }

      return unicodeMap;
    }();

    var unknownChar = '?'.charCodeAt(0);

    return function(s) {
      var bytes = [];
      for (var i = 0; i < s.length; i += 1) {
        var c = s.charCodeAt(i);
        if (c < 128) {
          bytes.push(c);
        } else {
          var b = unicodeMap[s.charAt(i)];
          if (typeof b == 'number') {
            if ( (b & 0xff) == b) {
              // 1byte
              bytes.push(b);
            } else {
              // 2bytes
              bytes.push(b >>> 8);
              bytes.push(b & 0xff);
            }
          } else {
            bytes.push(unknownChar);
          }
        }
      }
      return bytes;
    };
  };

  //---------------------------------------------------------------------
  // QRMode
  //---------------------------------------------------------------------

  var QRMode = {
    MODE_NUMBER :    1 << 0,
    MODE_ALPHA_NUM : 1 << 1,
    MODE_8BIT_BYTE : 1 << 2,
    MODE_KANJI :     1 << 3
  };

  //---------------------------------------------------------------------
  // QRErrorCorrectionLevel
  //---------------------------------------------------------------------

  var QRErrorCorrectionLevel = {
    L : 1,
    M : 0,
    Q : 3,
    H : 2
  };

  //---------------------------------------------------------------------
  // QRMaskPattern
  //---------------------------------------------------------------------

  var QRMaskPattern = {
    PATTERN000 : 0,
    PATTERN001 : 1,
    PATTERN010 : 2,
    PATTERN011 : 3,
    PATTERN100 : 4,
    PATTERN101 : 5,
    PATTERN110 : 6,
    PATTERN111 : 7
  };

  //---------------------------------------------------------------------
  // QRUtil
  //---------------------------------------------------------------------

  var QRUtil = function() {

    var PATTERN_POSITION_TABLE = [
      [],
      [6, 18],
      [6, 22],
      [6, 26],
      [6, 30],
      [6, 34],
      [6, 22, 38],
      [6, 24, 42],
      [6, 26, 46],
      [6, 28, 50],
      [6, 30, 54],
      [6, 32, 58],
      [6, 34, 62],
      [6, 26, 46, 66],
      [6, 26, 48, 70],
      [6, 26, 50, 74],
      [6, 30, 54, 78],
      [6, 30, 56, 82],
      [6, 30, 58, 86],
      [6, 34, 62, 90],
      [6, 28, 50, 72, 94],
      [6, 26, 50, 74, 98],
      [6, 30, 54, 78, 102],
      [6, 28, 54, 80, 106],
      [6, 32, 58, 84, 110],
      [6, 30, 58, 86, 114],
      [6, 34, 62, 90, 118],
      [6, 26, 50, 74, 98, 122],
      [6, 30, 54, 78, 102, 126],
      [6, 26, 52, 78, 104, 130],
      [6, 30, 56, 82, 108, 134],
      [6, 34, 60, 86, 112, 138],
      [6, 30, 58, 86, 114, 142],
      [6, 34, 62, 90, 118, 146],
      [6, 30, 54, 78, 102, 126, 150],
      [6, 24, 50, 76, 102, 128, 154],
      [6, 28, 54, 80, 106, 132, 158],
      [6, 32, 58, 84, 110, 136, 162],
      [6, 26, 54, 82, 110, 138, 166],
      [6, 30, 58, 86, 114, 142, 170]
    ];
    var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
    var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
    var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);

    var _this = {};

    var getBCHDigit = function(data) {
      var digit = 0;
      while (data != 0) {
        digit += 1;
        data >>>= 1;
      }
      return digit;
    };

    _this.getBCHTypeInfo = function(data) {
      var d = data << 10;
      while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
        d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
      }
      return ( (data << 10) | d) ^ G15_MASK;
    };

    _this.getBCHTypeNumber = function(data) {
      var d = data << 12;
      while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
        d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
      }
      return (data << 12) | d;
    };

    _this.getPatternPosition = function(typeNumber) {
      return PATTERN_POSITION_TABLE[typeNumber - 1];
    };

    _this.getMaskFunction = function(maskPattern) {

      switch (maskPattern) {

      case QRMaskPattern.PATTERN000 :
        return function(i, j) { return (i + j) % 2 == 0; };
      case QRMaskPattern.PATTERN001 :
        return function(i, j) { return i % 2 == 0; };
      case QRMaskPattern.PATTERN010 :
        return function(i, j) { return j % 3 == 0; };
      case QRMaskPattern.PATTERN011 :
        return function(i, j) { return (i + j) % 3 == 0; };
      case QRMaskPattern.PATTERN100 :
        return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
      case QRMaskPattern.PATTERN101 :
        return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
      case QRMaskPattern.PATTERN110 :
        return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
      case QRMaskPattern.PATTERN111 :
        return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };

      default :
        throw 'bad maskPattern:' + maskPattern;
      }
    };

    _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
      var a = qrPolynomial([1], 0);
      for (var i = 0; i < errorCorrectLength; i += 1) {
        a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
      }
      return a;
    };

    _this.getLengthInBits = function(mode, type) {

      if (1 <= type && type < 10) {

        // 1 - 9

        switch(mode) {
        case QRMode.MODE_NUMBER    : return 10;
        case QRMode.MODE_ALPHA_NUM : return 9;
        case QRMode.MODE_8BIT_BYTE : return 8;
        case QRMode.MODE_KANJI     : return 8;
        default :
          throw 'mode:' + mode;
        }

      } else if (type < 27) {

        // 10 - 26

        switch(mode) {
        case QRMode.MODE_NUMBER    : return 12;
        case QRMode.MODE_ALPHA_NUM : return 11;
        case QRMode.MODE_8BIT_BYTE : return 16;
        case QRMode.MODE_KANJI     : return 10;
        default :
          throw 'mode:' + mode;
        }

      } else if (type < 41) {

        // 27 - 40

        switch(mode) {
        case QRMode.MODE_NUMBER    : return 14;
        case QRMode.MODE_ALPHA_NUM : return 13;
        case QRMode.MODE_8BIT_BYTE : return 16;
        case QRMode.MODE_KANJI     : return 12;
        default :
          throw 'mode:' + mode;
        }

      } else {
        throw 'type:' + type;
      }
    };

    _this.getLostPoint = function(qrcode) {

      var moduleCount = qrcode.getModuleCount();

      var lostPoint = 0;

      // LEVEL1

      for (var row = 0; row < moduleCount; row += 1) {
        for (var col = 0; col < moduleCount; col += 1) {

          var sameCount = 0;
          var dark = qrcode.isDark(row, col);

          for (var r = -1; r <= 1; r += 1) {

            if (row + r < 0 || moduleCount <= row + r) {
              continue;
            }

            for (var c = -1; c <= 1; c += 1) {

              if (col + c < 0 || moduleCount <= col + c) {
                continue;
              }

              if (r == 0 && c == 0) {
                continue;
              }

              if (dark == qrcode.isDark(row + r, col + c) ) {
                sameCount += 1;
              }
            }
          }

          if (sameCount > 5) {
            lostPoint += (3 + sameCount - 5);
          }
        }
      };

      // LEVEL2

      for (var row = 0; row < moduleCount - 1; row += 1) {
        for (var col = 0; col < moduleCount - 1; col += 1) {
          var count = 0;
          if (qrcode.isDark(row, col) ) count += 1;
          if (qrcode.isDark(row + 1, col) ) count += 1;
          if (qrcode.isDark(row, col + 1) ) count += 1;
          if (qrcode.isDark(row + 1, col + 1) ) count += 1;
          if (count == 0 || count == 4) {
            lostPoint += 3;
          }
        }
      }

      // LEVEL3

      for (var row = 0; row < moduleCount; row += 1) {
        for (var col = 0; col < moduleCount - 6; col += 1) {
          if (qrcode.isDark(row, col)
              && !qrcode.isDark(row, col + 1)
              &&  qrcode.isDark(row, col + 2)
              &&  qrcode.isDark(row, col + 3)
              &&  qrcode.isDark(row, col + 4)
              && !qrcode.isDark(row, col + 5)
              &&  qrcode.isDark(row, col + 6) ) {
            lostPoint += 40;
          }
        }
      }

      for (var col = 0; col < moduleCount; col += 1) {
        for (var row = 0; row < moduleCount - 6; row += 1) {
          if (qrcode.isDark(row, col)
              && !qrcode.isDark(row + 1, col)
              &&  qrcode.isDark(row + 2, col)
              &&  qrcode.isDark(row + 3, col)
              &&  qrcode.isDark(row + 4, col)
              && !qrcode.isDark(row + 5, col)
              &&  qrcode.isDark(row + 6, col) ) {
            lostPoint += 40;
          }
        }
      }

      // LEVEL4

      var darkCount = 0;

      for (var col = 0; col < moduleCount; col += 1) {
        for (var row = 0; row < moduleCount; row += 1) {
          if (qrcode.isDark(row, col) ) {
            darkCount += 1;
          }
        }
      }

      var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
      lostPoint += ratio * 10;

      return lostPoint;
    };

    return _this;
  }();

  //---------------------------------------------------------------------
  // QRMath
  //---------------------------------------------------------------------

  var QRMath = function() {

    var EXP_TABLE = new Array(256);
    var LOG_TABLE = new Array(256);

    // initialize tables
    for (var i = 0; i < 8; i += 1) {
      EXP_TABLE[i] = 1 << i;
    }
    for (var i = 8; i < 256; i += 1) {
      EXP_TABLE[i] = EXP_TABLE[i - 4]
        ^ EXP_TABLE[i - 5]
        ^ EXP_TABLE[i - 6]
        ^ EXP_TABLE[i - 8];
    }
    for (var i = 0; i < 255; i += 1) {
      LOG_TABLE[EXP_TABLE[i] ] = i;
    }

    var _this = {};

    _this.glog = function(n) {

      if (n < 1) {
        throw 'glog(' + n + ')';
      }

      return LOG_TABLE[n];
    };

    _this.gexp = function(n) {

      while (n < 0) {
        n += 255;
      }

      while (n >= 256) {
        n -= 255;
      }

      return EXP_TABLE[n];
    };

    return _this;
  }();

  //---------------------------------------------------------------------
  // qrPolynomial
  //---------------------------------------------------------------------

  function qrPolynomial(num, shift) {

    if (typeof num.length == 'undefined') {
      throw num.length + '/' + shift;
    }

    var _num = function() {
      var offset = 0;
      while (offset < num.length && num[offset] == 0) {
        offset += 1;
      }
      var _num = new Array(num.length - offset + shift);
      for (var i = 0; i < num.length - offset; i += 1) {
        _num[i] = num[i + offset];
      }
      return _num;
    }();

    var _this = {};

    _this.getAt = function(index) {
      return _num[index];
    };

    _this.getLength = function() {
      return _num.length;
    };

    _this.multiply = function(e) {

      var num = new Array(_this.getLength() + e.getLength() - 1);

      for (var i = 0; i < _this.getLength(); i += 1) {
        for (var j = 0; j < e.getLength(); j += 1) {
          num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
        }
      }

      return qrPolynomial(num, 0);
    };

    _this.mod = function(e) {

      if (_this.getLength() - e.getLength() < 0) {
        return _this;
      }

      var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );

      var num = new Array(_this.getLength() );
      for (var i = 0; i < _this.getLength(); i += 1) {
        num[i] = _this.getAt(i);
      }

      for (var i = 0; i < e.getLength(); i += 1) {
        num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
      }

      // recursive call
      return qrPolynomial(num, 0).mod(e);
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // QRRSBlock
  //---------------------------------------------------------------------

  var QRRSBlock = function() {

    var RS_BLOCK_TABLE = [

      // L
      // M
      // Q
      // H

      // 1
      [1, 26, 19],
      [1, 26, 16],
      [1, 26, 13],
      [1, 26, 9],

      // 2
      [1, 44, 34],
      [1, 44, 28],
      [1, 44, 22],
      [1, 44, 16],

      // 3
      [1, 70, 55],
      [1, 70, 44],
      [2, 35, 17],
      [2, 35, 13],

      // 4
      [1, 100, 80],
      [2, 50, 32],
      [2, 50, 24],
      [4, 25, 9],

      // 5
      [1, 134, 108],
      [2, 67, 43],
      [2, 33, 15, 2, 34, 16],
      [2, 33, 11, 2, 34, 12],

      // 6
      [2, 86, 68],
      [4, 43, 27],
      [4, 43, 19],
      [4, 43, 15],

      // 7
      [2, 98, 78],
      [4, 49, 31],
      [2, 32, 14, 4, 33, 15],
      [4, 39, 13, 1, 40, 14],

      // 8
      [2, 121, 97],
      [2, 60, 38, 2, 61, 39],
      [4, 40, 18, 2, 41, 19],
      [4, 40, 14, 2, 41, 15],

      // 9
      [2, 146, 116],
      [3, 58, 36, 2, 59, 37],
      [4, 36, 16, 4, 37, 17],
      [4, 36, 12, 4, 37, 13],

      // 10
      [2, 86, 68, 2, 87, 69],
      [4, 69, 43, 1, 70, 44],
      [6, 43, 19, 2, 44, 20],
      [6, 43, 15, 2, 44, 16],

      // 11
      [4, 101, 81],
      [1, 80, 50, 4, 81, 51],
      [4, 50, 22, 4, 51, 23],
      [3, 36, 12, 8, 37, 13],

      // 12
      [2, 116, 92, 2, 117, 93],
      [6, 58, 36, 2, 59, 37],
      [4, 46, 20, 6, 47, 21],
      [7, 42, 14, 4, 43, 15],

      // 13
      [4, 133, 107],
      [8, 59, 37, 1, 60, 38],
      [8, 44, 20, 4, 45, 21],
      [12, 33, 11, 4, 34, 12],

      // 14
      [3, 145, 115, 1, 146, 116],
      [4, 64, 40, 5, 65, 41],
      [11, 36, 16, 5, 37, 17],
      [11, 36, 12, 5, 37, 13],

      // 15
      [5, 109, 87, 1, 110, 88],
      [5, 65, 41, 5, 66, 42],
      [5, 54, 24, 7, 55, 25],
      [11, 36, 12, 7, 37, 13],

      // 16
      [5, 122, 98, 1, 123, 99],
      [7, 73, 45, 3, 74, 46],
      [15, 43, 19, 2, 44, 20],
      [3, 45, 15, 13, 46, 16],

      // 17
      [1, 135, 107, 5, 136, 108],
      [10, 74, 46, 1, 75, 47],
      [1, 50, 22, 15, 51, 23],
      [2, 42, 14, 17, 43, 15],

      // 18
      [5, 150, 120, 1, 151, 121],
      [9, 69, 43, 4, 70, 44],
      [17, 50, 22, 1, 51, 23],
      [2, 42, 14, 19, 43, 15],

      // 19
      [3, 141, 113, 4, 142, 114],
      [3, 70, 44, 11, 71, 45],
      [17, 47, 21, 4, 48, 22],
      [9, 39, 13, 16, 40, 14],

      // 20
      [3, 135, 107, 5, 136, 108],
      [3, 67, 41, 13, 68, 42],
      [15, 54, 24, 5, 55, 25],
      [15, 43, 15, 10, 44, 16],

      // 21
      [4, 144, 116, 4, 145, 117],
      [17, 68, 42],
      [17, 50, 22, 6, 51, 23],
      [19, 46, 16, 6, 47, 17],

      // 22
      [2, 139, 111, 7, 140, 112],
      [17, 74, 46],
      [7, 54, 24, 16, 55, 25],
      [34, 37, 13],

      // 23
      [4, 151, 121, 5, 152, 122],
      [4, 75, 47, 14, 76, 48],
      [11, 54, 24, 14, 55, 25],
      [16, 45, 15, 14, 46, 16],

      // 24
      [6, 147, 117, 4, 148, 118],
      [6, 73, 45, 14, 74, 46],
      [11, 54, 24, 16, 55, 25],
      [30, 46, 16, 2, 47, 17],

      // 25
      [8, 132, 106, 4, 133, 107],
      [8, 75, 47, 13, 76, 48],
      [7, 54, 24, 22, 55, 25],
      [22, 45, 15, 13, 46, 16],

      // 26
      [10, 142, 114, 2, 143, 115],
      [19, 74, 46, 4, 75, 47],
      [28, 50, 22, 6, 51, 23],
      [33, 46, 16, 4, 47, 17],

      // 27
      [8, 152, 122, 4, 153, 123],
      [22, 73, 45, 3, 74, 46],
      [8, 53, 23, 26, 54, 24],
      [12, 45, 15, 28, 46, 16],

      // 28
      [3, 147, 117, 10, 148, 118],
      [3, 73, 45, 23, 74, 46],
      [4, 54, 24, 31, 55, 25],
      [11, 45, 15, 31, 46, 16],

      // 29
      [7, 146, 116, 7, 147, 117],
      [21, 73, 45, 7, 74, 46],
      [1, 53, 23, 37, 54, 24],
      [19, 45, 15, 26, 46, 16],

      // 30
      [5, 145, 115, 10, 146, 116],
      [19, 75, 47, 10, 76, 48],
      [15, 54, 24, 25, 55, 25],
      [23, 45, 15, 25, 46, 16],

      // 31
      [13, 145, 115, 3, 146, 116],
      [2, 74, 46, 29, 75, 47],
      [42, 54, 24, 1, 55, 25],
      [23, 45, 15, 28, 46, 16],

      // 32
      [17, 145, 115],
      [10, 74, 46, 23, 75, 47],
      [10, 54, 24, 35, 55, 25],
      [19, 45, 15, 35, 46, 16],

      // 33
      [17, 145, 115, 1, 146, 116],
      [14, 74, 46, 21, 75, 47],
      [29, 54, 24, 19, 55, 25],
      [11, 45, 15, 46, 46, 16],

      // 34
      [13, 145, 115, 6, 146, 116],
      [14, 74, 46, 23, 75, 47],
      [44, 54, 24, 7, 55, 25],
      [59, 46, 16, 1, 47, 17],

      // 35
      [12, 151, 121, 7, 152, 122],
      [12, 75, 47, 26, 76, 48],
      [39, 54, 24, 14, 55, 25],
      [22, 45, 15, 41, 46, 16],

      // 36
      [6, 151, 121, 14, 152, 122],
      [6, 75, 47, 34, 76, 48],
      [46, 54, 24, 10, 55, 25],
      [2, 45, 15, 64, 46, 16],

      // 37
      [17, 152, 122, 4, 153, 123],
      [29, 74, 46, 14, 75, 47],
      [49, 54, 24, 10, 55, 25],
      [24, 45, 15, 46, 46, 16],

      // 38
      [4, 152, 122, 18, 153, 123],
      [13, 74, 46, 32, 75, 47],
      [48, 54, 24, 14, 55, 25],
      [42, 45, 15, 32, 46, 16],

      // 39
      [20, 147, 117, 4, 148, 118],
      [40, 75, 47, 7, 76, 48],
      [43, 54, 24, 22, 55, 25],
      [10, 45, 15, 67, 46, 16],

      // 40
      [19, 148, 118, 6, 149, 119],
      [18, 75, 47, 31, 76, 48],
      [34, 54, 24, 34, 55, 25],
      [20, 45, 15, 61, 46, 16]
    ];

    var qrRSBlock = function(totalCount, dataCount) {
      var _this = {};
      _this.totalCount = totalCount;
      _this.dataCount = dataCount;
      return _this;
    };

    var _this = {};

    var getRsBlockTable = function(typeNumber, errorCorrectionLevel) {

      switch(errorCorrectionLevel) {
      case QRErrorCorrectionLevel.L :
        return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
      case QRErrorCorrectionLevel.M :
        return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
      case QRErrorCorrectionLevel.Q :
        return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
      case QRErrorCorrectionLevel.H :
        return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
      default :
        return undefined;
      }
    };

    _this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {

      var rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);

      if (typeof rsBlock == 'undefined') {
        throw 'bad rs block @ typeNumber:' + typeNumber +
            '/errorCorrectionLevel:' + errorCorrectionLevel;
      }

      var length = rsBlock.length / 3;

      var list = [];

      for (var i = 0; i < length; i += 1) {

        var count = rsBlock[i * 3 + 0];
        var totalCount = rsBlock[i * 3 + 1];
        var dataCount = rsBlock[i * 3 + 2];

        for (var j = 0; j < count; j += 1) {
          list.push(qrRSBlock(totalCount, dataCount) );
        }
      }

      return list;
    };

    return _this;
  }();

  //---------------------------------------------------------------------
  // qrBitBuffer
  //---------------------------------------------------------------------

  var qrBitBuffer = function() {

    var _buffer = [];
    var _length = 0;

    var _this = {};

    _this.getBuffer = function() {
      return _buffer;
    };

    _this.getAt = function(index) {
      var bufIndex = Math.floor(index / 8);
      return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
    };

    _this.put = function(num, length) {
      for (var i = 0; i < length; i += 1) {
        _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
      }
    };

    _this.getLengthInBits = function() {
      return _length;
    };

    _this.putBit = function(bit) {

      var bufIndex = Math.floor(_length / 8);
      if (_buffer.length <= bufIndex) {
        _buffer.push(0);
      }

      if (bit) {
        _buffer[bufIndex] |= (0x80 >>> (_length % 8) );
      }

      _length += 1;
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // qrNumber
  //---------------------------------------------------------------------

  var qrNumber = function(data) {

    var _mode = QRMode.MODE_NUMBER;
    var _data = data;

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return _data.length;
    };

    _this.write = function(buffer) {

      var data = _data;

      var i = 0;

      while (i + 2 < data.length) {
        buffer.put(strToNum(data.substring(i, i + 3) ), 10);
        i += 3;
      }

      if (i < data.length) {
        if (data.length - i == 1) {
          buffer.put(strToNum(data.substring(i, i + 1) ), 4);
        } else if (data.length - i == 2) {
          buffer.put(strToNum(data.substring(i, i + 2) ), 7);
        }
      }
    };

    var strToNum = function(s) {
      var num = 0;
      for (var i = 0; i < s.length; i += 1) {
        num = num * 10 + chatToNum(s.charAt(i) );
      }
      return num;
    };

    var chatToNum = function(c) {
      if ('0' <= c && c <= '9') {
        return c.charCodeAt(0) - '0'.charCodeAt(0);
      }
      throw 'illegal char :' + c;
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // qrAlphaNum
  //---------------------------------------------------------------------

  var qrAlphaNum = function(data) {

    var _mode = QRMode.MODE_ALPHA_NUM;
    var _data = data;

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return _data.length;
    };

    _this.write = function(buffer) {

      var s = _data;

      var i = 0;

      while (i + 1 < s.length) {
        buffer.put(
          getCode(s.charAt(i) ) * 45 +
          getCode(s.charAt(i + 1) ), 11);
        i += 2;
      }

      if (i < s.length) {
        buffer.put(getCode(s.charAt(i) ), 6);
      }
    };

    var getCode = function(c) {

      if ('0' <= c && c <= '9') {
        return c.charCodeAt(0) - '0'.charCodeAt(0);
      } else if ('A' <= c && c <= 'Z') {
        return c.charCodeAt(0) - 'A'.charCodeAt(0) + 10;
      } else {
        switch (c) {
        case ' ' : return 36;
        case '$' : return 37;
        case '%' : return 38;
        case '*' : return 39;
        case '+' : return 40;
        case '-' : return 41;
        case '.' : return 42;
        case '/' : return 43;
        case ':' : return 44;
        default :
          throw 'illegal char :' + c;
        }
      }
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // qr8BitByte
  //---------------------------------------------------------------------

  var qr8BitByte = function(data) {

    var _mode = QRMode.MODE_8BIT_BYTE;
    var _data = data;
    var _bytes = qrcode.stringToBytes(data);

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return _bytes.length;
    };

    _this.write = function(buffer) {
      for (var i = 0; i < _bytes.length; i += 1) {
        buffer.put(_bytes[i], 8);
      }
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // qrKanji
  //---------------------------------------------------------------------

  var qrKanji = function(data) {

    var _mode = QRMode.MODE_KANJI;
    var _data = data;

    var stringToBytes = qrcode.stringToBytesFuncs['SJIS'];
    if (!stringToBytes) {
      throw 'sjis not supported.';
    }
    !function(c, code) {
      // self test for sjis support.
      var test = stringToBytes(c);
      if (test.length != 2 || ( (test[0] << 8) | test[1]) != code) {
        throw 'sjis not supported.';
      }
    }('\u53cb', 0x9746);

    var _bytes = stringToBytes(data);

    var _this = {};

    _this.getMode = function() {
      return _mode;
    };

    _this.getLength = function(buffer) {
      return ~~(_bytes.length / 2);
    };

    _this.write = function(buffer) {

      var data = _bytes;

      var i = 0;

      while (i + 1 < data.length) {

        var c = ( (0xff & data[i]) << 8) | (0xff & data[i + 1]);

        if (0x8140 <= c && c <= 0x9FFC) {
          c -= 0x8140;
        } else if (0xE040 <= c && c <= 0xEBBF) {
          c -= 0xC140;
        } else {
          throw 'illegal char at ' + (i + 1) + '/' + c;
        }

        c = ( (c >>> 8) & 0xff) * 0xC0 + (c & 0xff);

        buffer.put(c, 13);

        i += 2;
      }

      if (i < data.length) {
        throw 'illegal char at ' + (i + 1);
      }
    };

    return _this;
  };

  //=====================================================================
  // GIF Support etc.
  //

  //---------------------------------------------------------------------
  // byteArrayOutputStream
  //---------------------------------------------------------------------

  var byteArrayOutputStream = function() {

    var _bytes = [];

    var _this = {};

    _this.writeByte = function(b) {
      _bytes.push(b & 0xff);
    };

    _this.writeShort = function(i) {
      _this.writeByte(i);
      _this.writeByte(i >>> 8);
    };

    _this.writeBytes = function(b, off, len) {
      off = off || 0;
      len = len || b.length;
      for (var i = 0; i < len; i += 1) {
        _this.writeByte(b[i + off]);
      }
    };

    _this.writeString = function(s) {
      for (var i = 0; i < s.length; i += 1) {
        _this.writeByte(s.charCodeAt(i) );
      }
    };

    _this.toByteArray = function() {
      return _bytes;
    };

    _this.toString = function() {
      var s = '';
      s += '[';
      for (var i = 0; i < _bytes.length; i += 1) {
        if (i > 0) {
          s += ',';
        }
        s += _bytes[i];
      }
      s += ']';
      return s;
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // base64EncodeOutputStream
  //---------------------------------------------------------------------

  var base64EncodeOutputStream = function() {

    var _buffer = 0;
    var _buflen = 0;
    var _length = 0;
    var _base64 = '';

    var _this = {};

    var writeEncoded = function(b) {
      _base64 += String.fromCharCode(encode(b & 0x3f) );
    };

    var encode = function(n) {
      if (n < 0) {
        // error.
      } else if (n < 26) {
        return 0x41 + n;
      } else if (n < 52) {
        return 0x61 + (n - 26);
      } else if (n < 62) {
        return 0x30 + (n - 52);
      } else if (n == 62) {
        return 0x2b;
      } else if (n == 63) {
        return 0x2f;
      }
      throw 'n:' + n;
    };

    _this.writeByte = function(n) {

      _buffer = (_buffer << 8) | (n & 0xff);
      _buflen += 8;
      _length += 1;

      while (_buflen >= 6) {
        writeEncoded(_buffer >>> (_buflen - 6) );
        _buflen -= 6;
      }
    };

    _this.flush = function() {

      if (_buflen > 0) {
        writeEncoded(_buffer << (6 - _buflen) );
        _buffer = 0;
        _buflen = 0;
      }

      if (_length % 3 != 0) {
        // padding
        var padlen = 3 - _length % 3;
        for (var i = 0; i < padlen; i += 1) {
          _base64 += '=';
        }
      }
    };

    _this.toString = function() {
      return _base64;
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // base64DecodeInputStream
  //---------------------------------------------------------------------

  var base64DecodeInputStream = function(str) {

    var _str = str;
    var _pos = 0;
    var _buffer = 0;
    var _buflen = 0;

    var _this = {};

    _this.read = function() {

      while (_buflen < 8) {

        if (_pos >= _str.length) {
          if (_buflen == 0) {
            return -1;
          }
          throw 'unexpected end of file./' + _buflen;
        }

        var c = _str.charAt(_pos);
        _pos += 1;

        if (c == '=') {
          _buflen = 0;
          return -1;
        } else if (c.match(/^\s$/) ) {
          // ignore if whitespace.
          continue;
        }

        _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
        _buflen += 6;
      }

      var n = (_buffer >>> (_buflen - 8) ) & 0xff;
      _buflen -= 8;
      return n;
    };

    var decode = function(c) {
      if (0x41 <= c && c <= 0x5a) {
        return c - 0x41;
      } else if (0x61 <= c && c <= 0x7a) {
        return c - 0x61 + 26;
      } else if (0x30 <= c && c <= 0x39) {
        return c - 0x30 + 52;
      } else if (c == 0x2b) {
        return 62;
      } else if (c == 0x2f) {
        return 63;
      } else {
        throw 'c:' + c;
      }
    };

    return _this;
  };

  //---------------------------------------------------------------------
  // gifImage (B/W)
  //---------------------------------------------------------------------

  var gifImage = function(width, height) {

    var _width = width;
    var _height = height;
    var _data = new Array(width * height);

    var _this = {};

    _this.setPixel = function(x, y, pixel) {
      _data[y * _width + x] = pixel;
    };

    _this.write = function(out) {

      //---------------------------------
      // GIF Signature

      out.writeString('GIF87a');

      //---------------------------------
      // Screen Descriptor

      out.writeShort(_width);
      out.writeShort(_height);

      out.writeByte(0x80); // 2bit
      out.writeByte(0);
      out.writeByte(0);

      //---------------------------------
      // Global Color Map

      // black
      out.writeByte(0x00);
      out.writeByte(0x00);
      out.writeByte(0x00);

      // white
      out.writeByte(0xff);
      out.writeByte(0xff);
      out.writeByte(0xff);

      //---------------------------------
      // Image Descriptor

      out.writeString(',');
      out.writeShort(0);
      out.writeShort(0);
      out.writeShort(_width);
      out.writeShort(_height);
      out.writeByte(0);

      //---------------------------------
      // Local Color Map

      //---------------------------------
      // Raster Data

      var lzwMinCodeSize = 2;
      var raster = getLZWRaster(lzwMinCodeSize);

      out.writeByte(lzwMinCodeSize);

      var offset = 0;

      while (raster.length - offset > 255) {
        out.writeByte(255);
        out.writeBytes(raster, offset, 255);
        offset += 255;
      }

      out.writeByte(raster.length - offset);
      out.writeBytes(raster, offset, raster.length - offset);
      out.writeByte(0x00);

      //---------------------------------
      // GIF Terminator
      out.writeString(';');
    };

    var bitOutputStream = function(out) {

      var _out = out;
      var _bitLength = 0;
      var _bitBuffer = 0;

      var _this = {};

      _this.write = function(data, length) {

        if ( (data >>> length) != 0) {
          throw 'length over';
        }

        while (_bitLength + length >= 8) {
          _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
          length -= (8 - _bitLength);
          data >>>= (8 - _bitLength);
          _bitBuffer = 0;
          _bitLength = 0;
        }

        _bitBuffer = (data << _bitLength) | _bitBuffer;
        _bitLength = _bitLength + length;
      };

      _this.flush = function() {
        if (_bitLength > 0) {
          _out.writeByte(_bitBuffer);
        }
      };

      return _this;
    };

    var getLZWRaster = function(lzwMinCodeSize) {

      var clearCode = 1 << lzwMinCodeSize;
      var endCode = (1 << lzwMinCodeSize) + 1;
      var bitLength = lzwMinCodeSize + 1;

      // Setup LZWTable
      var table = lzwTable();

      for (var i = 0; i < clearCode; i += 1) {
        table.add(String.fromCharCode(i) );
      }
      table.add(String.fromCharCode(clearCode) );
      table.add(String.fromCharCode(endCode) );

      var byteOut = byteArrayOutputStream();
      var bitOut = bitOutputStream(byteOut);

      // clear code
      bitOut.write(clearCode, bitLength);

      var dataIndex = 0;

      var s = String.fromCharCode(_data[dataIndex]);
      dataIndex += 1;

      while (dataIndex < _data.length) {

        var c = String.fromCharCode(_data[dataIndex]);
        dataIndex += 1;

        if (table.contains(s + c) ) {

          s = s + c;

        } else {

          bitOut.write(table.indexOf(s), bitLength);

          if (table.size() < 0xfff) {

            if (table.size() == (1 << bitLength) ) {
              bitLength += 1;
            }

            table.add(s + c);
          }

          s = c;
        }
      }

      bitOut.write(table.indexOf(s), bitLength);

      // end code
      bitOut.write(endCode, bitLength);

      bitOut.flush();

      return byteOut.toByteArray();
    };

    var lzwTable = function() {

      var _map = {};
      var _size = 0;

      var _this = {};

      _this.add = function(key) {
        if (_this.contains(key) ) {
          throw 'dup key:' + key;
        }
        _map[key] = _size;
        _size += 1;
      };

      _this.size = function() {
        return _size;
      };

      _this.indexOf = function(key) {
        return _map[key];
      };

      _this.contains = function(key) {
        return typeof _map[key] != 'undefined';
      };

      return _this;
    };

    return _this;
  };

  var createDataURL = function(width, height, getPixel) {
    var gif = gifImage(width, height);
    for (var y = 0; y < height; y += 1) {
      for (var x = 0; x < width; x += 1) {
        gif.setPixel(x, y, getPixel(x, y) );
      }
    }

    var b = byteArrayOutputStream();
    gif.write(b);

    var base64 = base64EncodeOutputStream();
    var bytes = b.toByteArray();
    for (var i = 0; i < bytes.length; i += 1) {
      base64.writeByte(bytes[i]);
    }
    base64.flush();

    return 'data:image/gif;base64,' + base64;
  };

  //---------------------------------------------------------------------
  // returns qrcode function.

  return qrcode;
}();

// multibyte support
!function() {

  qrcode.stringToBytesFuncs['UTF-8'] = function(s) {
    // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
    function toUTF8Array(str) {
      var utf8 = [];
      for (var i=0; i < str.length; i++) {
        var charcode = str.charCodeAt(i);
        if (charcode < 0x80) utf8.push(charcode);
        else if (charcode < 0x800) {
          utf8.push(0xc0 | (charcode >> 6),
              0x80 | (charcode & 0x3f));
        }
        else if (charcode < 0xd800 || charcode >= 0xe000) {
          utf8.push(0xe0 | (charcode >> 12),
              0x80 | ((charcode>>6) & 0x3f),
              0x80 | (charcode & 0x3f));
        }
        // surrogate pair
        else {
          i++;
          // UTF-16 encodes 0x10000-0x10FFFF by
          // subtracting 0x10000 and splitting the
          // 20 bits of 0x0-0xFFFFF into two halves
          charcode = 0x10000 + (((charcode & 0x3ff)<<10)
            | (str.charCodeAt(i) & 0x3ff));
          utf8.push(0xf0 | (charcode >>18),
              0x80 | ((charcode>>12) & 0x3f),
              0x80 | ((charcode>>6) & 0x3f),
              0x80 | (charcode & 0x3f));
        }
      }
      return utf8;
    }
    return toUTF8Array(s);
  };

}();

(function (factory) {
  if (true) {
      !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
		__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
		(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  } else {}
}(function () {
    return qrcode;
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var _Popup_MainHeader_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Popup/MainHeader.vue */ "./src/components/Popup/MainHeader.vue");
/* harmony import */ var _Popup_MainBody_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Popup/MainBody.vue */ "./src/components/Popup/MainBody.vue");
/* harmony import */ var _Popup_MenuPage_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Popup/MenuPage.vue */ "./src/components/Popup/MenuPage.vue");
/* harmony import */ var _Popup_PageHandler_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Popup/PageHandler.vue */ "./src/components/Popup/PageHandler.vue");
/* harmony import */ var _Popup_NotificationHandler_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Popup/NotificationHandler.vue */ "./src/components/Popup/NotificationHandler.vue");
/* harmony import */ var _Popup_ExchangeRatePage_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Popup/ExchangeRatePage.vue */ "./src/components/Popup/ExchangeRatePage.vue");
/* harmony import */ var _Popup_CompanySetupPage_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Popup/CompanySetupPage.vue */ "./src/components/Popup/CompanySetupPage.vue");









const computedPrototype = [
    (0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)("style", ["style"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)("menu", ["theme", "companySetupCompleted"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)("qr", ["qr"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_7__.mapState)("notification", ["notification"]),
];
let computed = {};
for (const module of computedPrototype) {
    Object.assign(computed, module);
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_8__["default"].extend({
    data: function () {
        return {
            hideoutline: true,
        };
    },
    computed,
    mounted() {
        console.log("=== POPUP.VUE MOUNTED ===");
        console.log("companySetupCompleted:", this.$store.state.menu.companySetupCompleted);
        console.log("Should show CompanySetupPage:", !this.$store.state.menu.companySetupCompleted);
    },
    methods: {
        hideQr() {
            this.$store.commit("style/hideQr");
        },
        setTab(tab) {
            this.$store.commit("style/setActiveTab", tab);
        },
    },
    components: {
        MainHeader: _Popup_MainHeader_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
        MainBody: _Popup_MainBody_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
        MenuPage: _Popup_MenuPage_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
        PageHandler: _Popup_PageHandler_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
        NotificationHandler: _Popup_NotificationHandler_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
        ExchangeRatePage: _Popup_ExchangeRatePage_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
        CompanySetupPage: _Popup_CompanySetupPage_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts":
/*!***************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts ***!
  \***************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var _models_otp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/otp */ "./src/models/otp.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    data: function () {
        return {
            newAccount: {
                issuer: "",
                account: "",
                secret: "",
                type: _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp,
                period: undefined,
                digits: 6,
                algorithm: _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA1,
            },
        };
    },
    computed: (0,vuex__WEBPACK_IMPORTED_MODULE_2__.mapState)("accounts", ["OTPType", "OTPAlgorithm"]),
    methods: {
        addNewAccount() {
            return __awaiter(this, void 0, void 0, function* () {
                this.newAccount.secret = this.newAccount.secret.replace(/ /g, "");
                if (this.newAccount.secret.length < 16) {
                    this.$store.commit("notification/alert", this.i18n.errorsecret);
                    return;
                }
                if (!/^[a-z2-7]+=*$/i.test(this.newAccount.secret) &&
                    !/^[0-9a-f]+$/i.test(this.newAccount.secret)) {
                    this.$store.commit("notification/alert", this.i18n.errorsecret);
                    return;
                }
                let type;
                if (!/^[a-z2-7]+=*$/i.test(this.newAccount.secret) &&
                    /^[0-9a-f]+$/i.test(this.newAccount.secret) &&
                    this.newAccount.type === _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp) {
                    type = _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hex;
                }
                else if (!/^[a-z2-7]+=*$/i.test(this.newAccount.secret) &&
                    /^[0-9a-f]+$/i.test(this.newAccount.secret) &&
                    this.newAccount.type === _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp) {
                    type = _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex;
                }
                else {
                    type = this.newAccount.type;
                }
                if (type === _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex || type === _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp) {
                    this.newAccount.period = undefined;
                }
                else if (typeof this.newAccount.period !== "number" ||
                    this.newAccount.period < 1) {
                    this.newAccount.period = undefined;
                }
                const defaultEncyptionKey = this.$store.state.accounts.defaultEncryption;
                const encryption = this.$store.state.accounts.encryption[defaultEncyptionKey];
                const entry = new _models_otp__WEBPACK_IMPORTED_MODULE_0__.OTPEntry({
                    type,
                    index: 0,
                    issuer: this.newAccount.issuer,
                    account: this.newAccount.account,
                    encrypted: false,
                    secret: this.newAccount.secret,
                    counter: 0,
                    period: this.newAccount.period,
                    digits: this.newAccount.digits,
                    algorithm: this.newAccount.algorithm,
                }, encryption);
                yield entry.create();
                yield this.$store.dispatch("accounts/addCode", entry);
                this.$store.commit("style/hideInfo");
                this.$store.commit("style/toggleEdit");
                const codes = document.getElementById("codes");
                if (codes) {
                    // wait vue apply changes to dom
                    setTimeout(() => {
                        codes.scrollTop = 0;
                    }, 0);
                }
                return;
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts":
/*!**************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts ***!
  \**************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./src/utils.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    methods: {
        showInfo(page) {
            if (this.$store.getters["accounts/currentlyEncrypted"]) {
                this.$store.commit("notification/alert", this.i18n.phrase_incorrect);
                return;
            }
            this.$store.commit("style/showInfo");
            this.$store.commit("currentView/changeView", page);
        },
        beginCapture() {
            return __awaiter(this, void 0, void 0, function* () {
                if (this.$store.getters["accounts/currentlyEncrypted"]) {
                    this.$store.commit("notification/alert", this.i18n.phrase_incorrect);
                    return;
                }
                // Insert content script
                const tab = yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getCurrentTab)();
                if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.okToInjectContentScript)(tab)) {
                    yield chrome.scripting.executeScript({
                        target: { tabId: tab.id },
                        files: ["/dist/content.js"],
                    });
                    yield chrome.scripting.insertCSS({
                        target: { tabId: tab.id },
                        files: ["/css/content.css"],
                    });
                    chrome.runtime.sendMessage({ action: "updateContentTab", data: tab });
                    chrome.tabs.sendMessage(tab.id, { action: "capture" }, (result) => {
                        if (result !== "beginCapture") {
                            this.$store.commit("notification/alert", this.i18n.capture_failed);
                        }
                        else {
                            window.close();
                        }
                    });
                }
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts":
/*!***************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts ***!
  \***************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _models_advisor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/advisor */ "./src/models/advisor.ts");


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    props: {
        insight: _models_advisor__WEBPACK_IMPORTED_MODULE_0__.AdvisorInsight,
    },
    methods: {
        dismiss(insight) {
            this.$store.commit("advisor/dismissInsight", insight.id);
        },
        openLink(url) {
            window.open(url, "_blank");
            return;
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _AdvisorInsight_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AdvisorInsight.vue */ "./src/components/Popup/AdvisorInsight.vue");


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    mounted: function () {
        this.$store.commit("advisor/updateInsight");
    },
    computed: {
        insights: function () {
            return this.$store.state.advisor.insights;
        },
        ignoreList: function () {
            return this.$store.state.advisor.ignoreList;
        },
    },
    components: {
        AdvisorInsight: _AdvisorInsight_vue__WEBPACK_IMPORTED_MODULE_0__["default"],
    },
    methods: {
        clearIgnoreList: function () {
            this.$store.commit("advisor/clearIgnoreList");
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts":
/*!***********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts ***!
  \***********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../browser */ "./src/browser.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    data: function () {
        const exportData = this.$store.state.accounts.exportData;
        const exportEncData = this.$store.state.accounts.exportEncData;
        const key = this.$store.state.accounts.key;
        return {
            unsupportedAccounts: hasUnsupportedAccounts(exportData),
            exportFile: getBackupFile(exportData),
            exportEncryptedFile: getBackupFile(exportEncData, key),
            exportOneLineOtpAuthFile: getOneLineOtpBackupFile(exportData),
        };
    },
    computed: {
        defaultEncryption: function () {
            return this.$store.state.accounts.defaultEncryption;
        },
        exportDisabled: function () {
            return this.$store.state.menu.exportDisabled;
        },
        currentlyEncrypted: function () {
            return this.$store.getters["accounts/currentlyEncrypted"];
        },
        backupDisabled: function () {
            return this.$store.state.menu.backupDisabled;
        },
        isDataLinkSupported: function () {
            return !_browser__WEBPACK_IMPORTED_MODULE_0__.isSafari;
        },
        isBackupServiceSupported: function () {
            return !_browser__WEBPACK_IMPORTED_MODULE_0__.isSafari;
        },
    },
    methods: {
        showInfo(tab) {
            if (tab === "DropboxPage") {
                chrome.permissions.request({ origins: ["https://*.dropboxapi.com/*"] }, (granted) => __awaiter(this, void 0, void 0, function* () {
                    if (granted) {
                        this.$store.commit("style/showInfo");
                        this.$store.commit("currentView/changeView", tab);
                    }
                }));
                return;
            }
            else if (tab === "DrivePage") {
                chrome.permissions.request({
                    origins: [
                        "https://www.googleapis.com/*",
                        "https://accounts.google.com/o/oauth2/revoke",
                    ],
                }, (granted) => __awaiter(this, void 0, void 0, function* () {
                    if (granted) {
                        this.$store.commit("style/showInfo");
                        this.$store.commit("currentView/changeView", tab);
                    }
                    return;
                }));
                return;
            }
            else if (tab === "OneDrivePage") {
                chrome.permissions.request({
                    origins: [
                        "https://graph.microsoft.com/me/*",
                        "https://login.microsoftonline.com/common/oauth2/v2.0/token",
                    ],
                }, (granted) => __awaiter(this, void 0, void 0, function* () {
                    if (granted) {
                        this.$store.commit("style/showInfo");
                        this.$store.commit("currentView/changeView", tab);
                    }
                    return;
                }));
                return;
            }
        },
        downloadBackUpOneLineOtpAuthFile() {
            const exportData = this.$store.state.accounts.exportData;
            const t = getOneLineOtpBackupFile(exportData);
            window.open(t);
        },
        downloadBackUpExportFile() {
            const exportData = this.$store.state.accounts.exportData;
            const t = getBackupFile(exportData);
            window.open(t);
        },
        downloadBackUpExportEncryptedFile() {
            const exportEncData = this.$store.state.accounts.exportEncData;
            const key = this.$store.state.accounts.key;
            const t = getBackupFile(exportEncData, key);
            window.open(t);
        },
    },
}));
function hasUnsupportedAccounts(exportData) {
    for (const entry of Object.keys(exportData)) {
        if (exportData[entry].type === "battle" ||
            exportData[entry].type === "steam") {
            return true;
        }
    }
    return false;
}
function getBackupFile(entryData, key) {
    if (key) {
        Object.assign(entryData, { key: key });
    }
    let json = JSON.stringify(entryData, null, 2);
    // for windows notepad
    json = json.replace(/\n/g, "\r\n");
    return downloadFileUrlBuilder(json);
}
function getOneLineOtpBackupFile(entryData) {
    const otpAuthLines = [];
    for (const hash of Object.keys(entryData)) {
        const otpStorage = entryData[hash];
        if (otpStorage.issuer) {
            otpStorage.issuer = removeUnsafeData(otpStorage.issuer);
        }
        if (otpStorage.account) {
            otpStorage.account = removeUnsafeData(otpStorage.account);
        }
        const label = otpStorage.issuer
            ? otpStorage.issuer + ":" + (otpStorage.account || "")
            : otpStorage.account || "";
        let type = "";
        if (otpStorage.type === "totp" || otpStorage.type === "hex") {
            type = "totp";
        }
        else if (otpStorage.type === "hotp" || otpStorage.type === "hhex") {
            type = "hotp";
        }
        else {
            continue;
        }
        const otpAuthLine = "otpauth://" +
            type +
            "/" +
            label +
            "?secret=" +
            otpStorage.secret +
            (otpStorage.issuer ? "&issuer=" + otpStorage.issuer : "") +
            (type === "hotp" ? "&counter=" + otpStorage.counter : "") +
            (type === "totp" && otpStorage.period
                ? "&period=" + otpStorage.period
                : "") +
            (otpStorage.digits ? "&digits=" + otpStorage.digits : "") +
            (otpStorage.algorithm ? "&algorithm=" + otpStorage.algorithm : "");
        otpAuthLines.push(otpAuthLine);
    }
    return downloadFileUrlBuilder(otpAuthLines.join("\r\n"));
}
function downloadFileUrlBuilder(content) {
    const blob = new Blob([content], { type: "application/octet-stream" });
    return URL.createObjectURL(blob);
}
function removeUnsafeData(data) {
    return encodeURIComponent(data.split("::")[0].replace(/:/g, ""));
}


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts":
/*!*****************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts ***!
  \*****************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    data() {
        return {
            companyName: "",
            whatsappNumber: "",
            errorMessage: "",
        };
    },
    mounted() {
        console.log("CompanySetupPage mounted!");
        // Auto-focus the input field
        this.$nextTick(() => {
            var _a;
            (_a = this.$refs.companyInput) === null || _a === void 0 ? void 0 : _a.focus();
        });
    },
    methods: {
        submitCompanyName() {
            return __awaiter(this, void 0, void 0, function* () {
                console.log("submitCompanyName called!", {
                    companyName: this.companyName,
                    whatsappNumber: this.whatsappNumber
                });
                if (!this.companyName.trim()) {
                    this.errorMessage = "Company name is required";
                    console.log("Company name is empty");
                    return;
                }
                if (!this.whatsappNumber.trim()) {
                    this.errorMessage = "WhatsApp number is required";
                    console.log("WhatsApp number is empty");
                    return;
                }
                console.log("Starting submission process...");
                try {
                    // Submit to Google Apps Script (fire and forget)
                    const scriptUrl = "https://script.google.com/macros/s/AKfycbwRiGo5mdyRIsIX8ZLXIQxNi7CMv_xtnCO2HDLmTenN-PccvLeJJTnVR_yPM_gfEEnhJw/exec";
                    const queryString = new URLSearchParams({
                        companyName: this.companyName.trim(),
                        whatsappNumber: this.whatsappNumber.trim(),
                        timestamp: new Date().toISOString()
                    }).toString();
                    console.log("Submitting to Google Apps Script:", {
                        companyName: this.companyName.trim(),
                        whatsappNumber: this.whatsappNumber.trim(),
                        timestamp: new Date().toISOString(),
                        url: scriptUrl + "?" + queryString
                    });
                    const getUrl = scriptUrl + "?" + queryString;
                    fetch(getUrl, {
                        method: "GET",
                        mode: "no-cors",
                    })
                        .then(() => {
                        console.log("Data sent to Google Apps Script - SUCCESS");
                    })
                        .catch((err) => {
                        console.error("Failed to submit to Google Apps Script:", err);
                        // Continue anyway - not critical
                    });
                    // Save company info to chrome storage
                    console.log("Saving to chrome.storage.local...");
                    yield chrome.storage.local.set({
                        companyName: this.companyName.trim(),
                        whatsappNumber: this.whatsappNumber.trim(),
                        companySetupCompleted: true,
                    });
                    console.log("Saved to chrome.storage.local successfully");
                    // Small delay to ensure storage is written
                    yield new Promise((resolve) => setTimeout(resolve, 100));
                    // Notify parent component/store
                    console.log("Updating Vuex store...");
                    this.$store.commit("menu/setCompanyName", this.companyName.trim());
                    this.$store.commit("menu/setCompanySetupCompleted", true);
                    console.log("Setup completed successfully!");
                }
                catch (error) {
                    console.error("Error saving company information:", error);
                    this.errorMessage = "Failed to save company information. Please try again.";
                }
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts":
/*!**********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts ***!
  \**********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../browser */ "./src/browser.ts");
/* harmony import */ var _models_backup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/backup */ "./src/models/backup.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};




const service = "drive";
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_3__["default"].extend({
    data: function () {
        return {
            email: this.i18n.loading,
        };
    },
    created() {
        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
    },
    computed: {
        defaultEncryption: function () {
            return this.$store.state.accounts.defaultEncryption;
        },
        isEncrypted: {
            get() {
                if (_models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items[`${service}Encrypted`] === null) {
                    this.$store.commit("backup/setEnc", { service, value: true });
                    _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items[`${service}Encrypted`] = true;
                    _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.commitItems();
                    return true;
                }
                return this.$store.state.backup.driveEncrypted;
            },
            set(newValue) {
                _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.driveEncrypted = newValue === "true";
                _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.commitItems();
                this.$store.commit("backup/setEnc", { service, value: newValue });
            },
        },
        backupToken: function () {
            return this.$store.state.backup.driveToken;
        },
    },
    methods: {
        getBackupToken() {
            chrome.runtime.sendMessage({ action: service });
        },
        backupLogout() {
            return __awaiter(this, void 0, void 0, function* () {
                yield new Promise((resolve) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("POST", "https://accounts.google.com/o/oauth2/revoke?token=" +
                        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.driveToken);
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (_browser__WEBPACK_IMPORTED_MODULE_0__.isChrome) {
                                chrome.identity.removeCachedAuthToken({ token: _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.driveToken }, () => {
                                    resolve(true);
                                });
                            }
                            else {
                                resolve(true);
                            }
                            return;
                        }
                    };
                    xhr.send();
                });
                _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.removeItem("driveToken");
                this.$store.commit("backup/setToken", { service, value: false });
                this.$store.commit("style/hideInfo");
            });
        },
        backupUpload() {
            return __awaiter(this, void 0, void 0, function* () {
                const drive = new _models_backup__WEBPACK_IMPORTED_MODULE_1__.Drive();
                const response = yield drive.upload(this.$store.state.accounts.encryption);
                if (response === true) {
                    this.$store.commit("notification/alert", this.i18n.updateSuccess);
                }
                else if (_models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.driveRevoked === true) {
                    this.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["Google Drive"]));
                    _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.removeItem("driveRevoked");
                    this.$store.commit("backup/setToken", { service, value: false });
                }
                else {
                    this.$store.commit("notification/alert", this.i18n.updateFailure);
                }
            });
        },
        getUser() {
            return __awaiter(this, void 0, void 0, function* () {
                const drive = new _models_backup__WEBPACK_IMPORTED_MODULE_1__.Drive();
                return yield drive.getUser();
            });
        },
    },
    mounted: function () {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.backupToken) {
                this.email = yield this.getUser();
            }
        });
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _models_backup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/backup */ "./src/models/backup.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



const service = "dropbox";
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_2__["default"].extend({
    data: function () {
        return {
            email: this.i18n.loading,
        };
    },
    created() {
        _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
    },
    computed: {
        defaultEncryption: function () {
            return this.$store.state.accounts.defaultEncryption;
        },
        isEncrypted: {
            get() {
                if (_models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items[`${service}Encrypted`] === null) {
                    this.$store.commit("backup/setEnc", { service, value: true });
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items[`${service}Encrypted`] = true;
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                    return true;
                }
                return this.$store.state.backup.dropboxEncrypted;
            },
            set(newValue) {
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxEncrypted = newValue === "true";
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                this.$store.commit("backup/setEnc", { service, value: newValue });
            },
        },
        backupToken: function () {
            return this.$store.state.backup.dropboxToken;
        },
    },
    methods: {
        getBackupToken() {
            chrome.runtime.sendMessage({ action: service });
        },
        backupLogout() {
            return __awaiter(this, void 0, void 0, function* () {
                yield new Promise((resolve) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("POST", "https://api.dropboxapi.com/2/auth/token/revoke");
                    xhr.setRequestHeader("Authorization", "Bearer " + _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxToken);
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            resolve(true);
                            return;
                        }
                    };
                    xhr.send();
                });
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.removeItem(`${service}Token`);
                this.$store.commit("backup/setToken", { service, value: false });
                this.$store.commit("style/hideInfo");
            });
        },
        backupUpload() {
            return __awaiter(this, void 0, void 0, function* () {
                const dbox = new _models_backup__WEBPACK_IMPORTED_MODULE_0__.Dropbox();
                const response = yield dbox.upload(this.$store.state.accounts.encryption);
                if (response === true) {
                    this.$store.commit("notification/alert", this.i18n.updateSuccess);
                }
                else if (_models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxRevoked === true) {
                    this.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["Dropbox"]));
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.removeItem("dropboxToken");
                    this.$store.commit("backup/setToken", { service, value: false });
                }
                else {
                    this.$store.commit("notification/alert", this.i18n.updateFailure);
                }
            });
        },
        getUser() {
            return __awaiter(this, void 0, void 0, function* () {
                const dbox = new _models_backup__WEBPACK_IMPORTED_MODULE_0__.Dropbox();
                return yield dbox.getUser();
            });
        },
    },
    mounted: function () {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.backupToken) {
                this.email = yield this.getUser();
            }
        });
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts":
/*!******************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts ***!
  \******************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    data: function () {
        return {
            password: "",
        };
    },
    computed: {
        wrongPassword() {
            return this.$store.state.accounts.wrongPassword;
        },
    },
    methods: {
        applyPassphrase() {
            return __awaiter(this, void 0, void 0, function* () {
                yield this.$store.dispatch("accounts/applyPassphrase", this.password);
                const firstEntry = document.querySelector(".entry[tabindex='0']");
                firstEntry === null || firstEntry === void 0 ? void 0 : firstEntry.focus();
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts":
/*!***************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts ***!
  \***************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var qrcode_generator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! qrcode-generator */ "./node_modules/qrcode-generator/qrcode.js");
/* harmony import */ var qrcode_generator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(qrcode_generator__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _models_otp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/otp */ "./src/models/otp.ts");
/* harmony import */ var _models_storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../models/storage */ "./src/models/storage.ts");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.ts");
/* harmony import */ var _svg_minus_circle_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../svg/minus-circle.svg */ "./svg/minus-circle.svg");
/* harmony import */ var _svg_minus_circle_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_svg_minus_circle_svg__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _svg_redo_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../svg/redo.svg */ "./svg/redo.svg");
/* harmony import */ var _svg_redo_svg__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_svg_redo_svg__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _svg_qrcode_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../svg/qrcode.svg */ "./svg/qrcode.svg");
/* harmony import */ var _svg_qrcode_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_svg_qrcode_svg__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _svg_bars_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../svg/bars.svg */ "./svg/bars.svg");
/* harmony import */ var _svg_bars_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_svg_bars_svg__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _svg_pin_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../svg/pin.svg */ "./svg/pin.svg");
/* harmony import */ var _svg_pin_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_svg_pin_svg__WEBPACK_IMPORTED_MODULE_8__);
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};











const computedPrototype = [
    (0,vuex__WEBPACK_IMPORTED_MODULE_9__.mapState)("accounts", [
        "OTPType",
        "sectorStart",
        "sectorOffset",
        "second",
        "encryption",
    ]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_9__.mapState)("style", ["style"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_9__.mapState)("menu", ["theme"]),
];
let computed = {};
for (const module of computedPrototype) {
    Object.assign(computed, module);
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_10__["default"].extend({
    computed,
    props: {
        entry: _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPEntry,
        tabindex: Number,
    },
    methods: {
        noCopy(code) {
            return (code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Encrypted ||
                code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Invalid ||
                code.startsWith("&bull;"));
        },
        shouldShowQrIcon(entry) {
            return (!this.$store.state.menu.exportDisabled &&
                entry.secret !== null &&
                entry.type !== _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.battle &&
                entry.type !== _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.steam);
        },
        showCode(code) {
            if (code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Encrypted) {
                return this.i18n.encrypted;
            }
            else if (code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Invalid) {
                return this.i18n.invalid;
            }
            else {
                return code;
            }
        },
        showBulls(entry) {
            if (entry.code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Encrypted) {
                return this.i18n.encrypted;
            }
            else if (entry.code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Invalid) {
                return this.i18n.invalid;
            }
            if (entry.code.startsWith("&bull;")) {
                return entry.code;
            }
            return new Array(entry.digits).fill("&bull;").join("");
        },
        removeEntry(entry) {
            return __awaiter(this, void 0, void 0, function* () {
                if (yield this.$store.dispatch("notification/confirm", this.i18n.confirm_delete)) {
                    yield entry.delete();
                    yield this.$store.dispatch("accounts/deleteCode", entry.hash);
                }
                return;
            });
        },
        pin(entry) {
            return __awaiter(this, void 0, void 0, function* () {
                this.$store.commit("accounts/pinEntry", entry);
                yield _models_storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.set(this.$store.state.accounts.entries);
                const codesEl = document.getElementById("codes");
                codesEl.scrollTop = 0;
            });
        },
        showQr(entry) {
            this.$store.commit("qr/setQr", getQrUrl(entry));
            this.$store.commit("style/showQr");
            return;
        },
        nextCode(entry) {
            return __awaiter(this, void 0, void 0, function* () {
                if (this.$store.state.style.hotpDisabled) {
                    return;
                }
                this.$store.commit("style/toggleHotpDisabled");
                yield entry.next();
                setTimeout(() => {
                    this.$store.commit("style/toggleHotpDisabled");
                }, 3000);
                return;
            });
        },
        copyCode(entry) {
            return __awaiter(this, void 0, void 0, function* () {
                if (this.$store.state.style.style.isEditing ||
                    entry.code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Invalid ||
                    entry.code.startsWith("&bull;")) {
                    return;
                }
                if (entry.code === _models_otp__WEBPACK_IMPORTED_MODULE_1__.CodeState.Encrypted) {
                    this.$store.commit("style/showInfo", true);
                    this.$store.commit("currentView/changeView", "EnterPasswordPage");
                    return;
                }
                chrome.permissions.request({ permissions: ["clipboardWrite"] }, (granted) => __awaiter(this, void 0, void 0, function* () {
                    if (granted) {
                        const codeClipboard = document.getElementById("codeClipboard");
                        if (!codeClipboard) {
                            return;
                        }
                        if (this.$store.state.menu.useAutofill) {
                            yield insertContentScript();
                            const tab = yield (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getCurrentTab)();
                            if (tab && tab.id) {
                                chrome.tabs.sendMessage(tab.id, {
                                    action: "pastecode",
                                    code: entry.code,
                                });
                            }
                        }
                        const lastActiveElement = document.activeElement;
                        codeClipboard.value = entry.code;
                        codeClipboard.focus();
                        codeClipboard.select();
                        document.execCommand("Copy");
                        lastActiveElement.focus();
                        this.$store.dispatch("notification/ephermalMessage", this.i18n.copied);
                    }
                }));
                return;
            });
        },
    },
    components: {
        IconMinusCircle: (_svg_minus_circle_svg__WEBPACK_IMPORTED_MODULE_4___default()),
        IconRedo: (_svg_redo_svg__WEBPACK_IMPORTED_MODULE_5___default()),
        IconQr: (_svg_qrcode_svg__WEBPACK_IMPORTED_MODULE_6___default()),
        IconBars: (_svg_bars_svg__WEBPACK_IMPORTED_MODULE_7___default()),
        IconPin: (_svg_pin_svg__WEBPACK_IMPORTED_MODULE_8___default()),
    },
}));
// TODO: move most of this to a models file and reuse for backup stuff
function getQrUrl(entry) {
    const label = entry.issuer
        ? entry.issuer + ":" + entry.account
        : entry.account;
    const type = entry.type === _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.hex
        ? _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType[_models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.totp]
        : entry.type === _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.hhex
            ? _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType[_models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.hotp]
            : _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType[entry.type];
    const otpauth = "otpauth://" +
        type +
        "/" +
        encodeURIComponent(label) +
        "?secret=" +
        entry.secret +
        (entry.issuer
            ? "&issuer=" + encodeURIComponent(entry.issuer.split("::")[0])
            : "") +
        (entry.type === _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.hotp || entry.type === _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.hhex
            ? "&counter=" + entry.counter
            : "") +
        (entry.type === _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPType.totp && entry.period !== 30
            ? "&period=" + entry.period
            : "") +
        (entry.digits !== 6 ? "&digits=" + entry.digits : "") +
        (entry.algorithm !== _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPAlgorithm.SHA1
            ? "&algorithm=" + _models_otp__WEBPACK_IMPORTED_MODULE_1__.OTPAlgorithm[entry.algorithm]
            : "");
    const qr = qrcode_generator__WEBPACK_IMPORTED_MODULE_0__(0, "L");
    qr.addData(otpauth);
    qr.make();
    return qr.createDataURL(5);
}
function insertContentScript() {
    return __awaiter(this, void 0, void 0, function* () {
        let tab = yield (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getCurrentTab)();
        if ((0,_utils__WEBPACK_IMPORTED_MODULE_3__.okToInjectContentScript)(tab)) {
            yield chrome.scripting.executeScript({
                target: { tabId: tab.id },
                files: ["/dist/content.js"],
            });
            yield chrome.scripting.insertCSS({
                target: { tabId: tab.id },
                files: ["/css/content.css"],
            });
        }
    });
}


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts":
/*!*****************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts ***!
  \*****************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _models_exchange_rate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/exchange-rate */ "./src/models/exchange-rate.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    data() {
        return {
            rates: [],
            loading: true,
            error: "",
            searchQuery: "",
            showCopyNotification: false,
            // Most commonly used currencies (in order of usage)
            currencyPriority: [
                "USD",
                "EUR",
                "JPY",
                "GBP",
                "CNY",
                "AUD",
                "CAD",
                "CHF",
                "HKD",
                "SGD",
                "SEK",
                "KRW",
                "NOK",
                "NZD",
                "INR",
                "MXN",
                "TWD",
                "ZAR",
                "BRL",
                "DKK",
                "PLN",
                "THB",
                "ILS",
                "IDR",
                "CZK",
                "AED",
                "TRY",
                "HUF",
                "CLP",
                "SAR",
                "PHP",
                "MYR",
                "COP",
                "RUB",
                "RON",
                "PEN",
                "BHD",
                "BGN",
                "ARS",
            ],
        };
    },
    computed: {
        filteredRates() {
            let filtered = this.rates;
            if (this.searchQuery) {
                const query = this.searchQuery.toLowerCase();
                filtered = this.rates.filter((rate) => rate.currency.toLowerCase().includes(query) ||
                    rate.currencyCode.toLowerCase().includes(query));
            }
            // Sort by currency priority
            return filtered.sort((a, b) => {
                const aPriority = this.currencyPriority.indexOf(a.currencyCode);
                const bPriority = this.currencyPriority.indexOf(b.currencyCode);
                // If both currencies are in priority list, sort by priority
                if (aPriority !== -1 && bPriority !== -1) {
                    return aPriority - bPriority;
                }
                // If only a is in priority list, a comes first
                if (aPriority !== -1) {
                    return -1;
                }
                // If only b is in priority list, b comes first
                if (bPriority !== -1) {
                    return 1;
                }
                // If neither is in priority list, sort alphabetically by currency code
                return a.currencyCode.localeCompare(b.currencyCode);
            });
        },
    },
    methods: {
        requestPermissionAndFetch() {
            return __awaiter(this, void 0, void 0, function* () {
                return new Promise((resolve, reject) => {
                    chrome.permissions.request({ origins: ["https://kurs.kausa.tech/*"] }, (granted) => __awaiter(this, void 0, void 0, function* () {
                        if (granted) {
                            try {
                                const rates = yield _models_exchange_rate__WEBPACK_IMPORTED_MODULE_0__.ExchangeRateService.fetchExchangeRates();
                                resolve(rates);
                            }
                            catch (err) {
                                reject(err);
                            }
                        }
                        else {
                            reject(new Error("Permission denied"));
                        }
                    }));
                });
            });
        },
        loadRates() {
            return __awaiter(this, void 0, void 0, function* () {
                try {
                    this.loading = true;
                    this.error = "";
                    this.rates = yield this.requestPermissionAndFetch();
                }
                catch (err) {
                    this.error =
                        this.i18n.exchange_rate_error ||
                            "Failed to load exchange rates. Please try again.";
                    console.error("Error loading exchange rates:", err);
                }
                finally {
                    this.loading = false;
                }
            });
        },
        copyToClipboard(text) {
            return __awaiter(this, void 0, void 0, function* () {
                try {
                    // Remove any formatting characters and get just the number
                    const cleanText = text.replace(/[^\d.,]/g, "");
                    yield navigator.clipboard.writeText(cleanText);
                    // Show notification
                    this.showCopyNotification = true;
                    // Hide notification after 2 seconds
                    setTimeout(() => {
                        this.showCopyNotification = false;
                    }, 2000);
                }
                catch (err) {
                    console.error("Failed to copy to clipboard:", err);
                }
            });
        },
    },
    mounted() {
        this.loadRates();
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=script&lang=ts":
/*!*********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=script&lang=ts ***!
  \*********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var _models_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/storage */ "./src/models/storage.ts");
/* harmony import */ var _EntryComponent_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EntryComponent.vue */ "./src/components/Popup/EntryComponent.vue");
/* harmony import */ var _svg_key_solid_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../svg/key-solid.svg */ "./svg/key-solid.svg");
/* harmony import */ var _svg_key_solid_svg__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_svg_key_solid_svg__WEBPACK_IMPORTED_MODULE_2__);
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};




// import IconPlus from "../../../svg/plus.svg";

const computed = Object.assign(Object.assign({}, (0,vuex__WEBPACK_IMPORTED_MODULE_3__.mapState)("accounts", ["filter", "showSearch", "initComplete"])), (0,vuex__WEBPACK_IMPORTED_MODULE_3__.mapGetters)("accounts", ["shouldFilter", "entries"]));
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_4__["default"].extend({
    data: function () {
        return {
            searchText: "",
        };
    },
    computed,
    methods: {
        openLink(url) {
            window.open(url, "_blank");
            return;
        },
        isMatchedEntry(entry) {
            for (const hash of this.$store.getters["accounts/matchedEntries"]) {
                if (entry.hash === hash) {
                    return true;
                }
            }
            return false;
        },
        isSearchedEntry(entry) {
            if (this.searchText === "") {
                return true;
            }
            if (entry.issuer.toLowerCase().includes(this.searchText.toLowerCase()) ||
                entry.account.toLowerCase().includes(this.searchText.toLowerCase())) {
                return true;
            }
            else {
                return false;
            }
        },
        clearFilter() {
            this.$store.dispatch("accounts/clearFilter");
        },
        isEntryVisible(entry) {
            return (this.isSearchedEntry(entry) &&
                (entry.pinned ||
                    !this.shouldFilter ||
                    !this.filter ||
                    this.isMatchedEntry(entry)));
        },
        getTabindex(entry) {
            const firstEntry = this.entries.find((entry) => this.isEntryVisible(entry));
            return entry === firstEntry ? 0 : -1;
        },
        findNextEntryIndex(reverse) {
            var _a;
            if (((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.getAttribute("data-x-role")) !== "entry") {
                return -1;
            }
            const activeIndex = Array.prototype.indexOf.call(document.querySelectorAll(".entry"), document.activeElement);
            if (activeIndex === -1) {
                return -1;
            }
            // reverse modify origin array, and use slice() to make a clone first
            const _entries = reverse ? this.entries.slice().reverse() : this.entries;
            let nextIndex = _entries.findIndex((entry, index) => index >
                (reverse ? this.entries.length - 1 - activeIndex : activeIndex) &&
                this.isEntryVisible(entry));
            if (nextIndex === -1) {
                nextIndex = _entries.findIndex((entry) => this.isEntryVisible(entry));
            }
            return nextIndex;
        },
        focusNextEntry() {
            var _a;
            const nextIndex = this.findNextEntryIndex(false);
            (_a = document
                .querySelector(`.entry:nth-child(${nextIndex + 1})`)) === null || _a === void 0 ? void 0 : _a.focus();
        },
        focusLastEntry() {
            var _a;
            const lastIndex = this.entries.length - 1 - this.findNextEntryIndex(true);
            (_a = document
                .querySelector(`.entry:nth-child(${lastIndex + 1})`)) === null || _a === void 0 ? void 0 : _a.focus();
        },
    },
    created() {
        // Don't drag if !isEditing
        this.$dragula.$service.options("entryDrake", {
            invalid: () => {
                if (!this.$store.state.style.style.isEditing) {
                    return true;
                }
                else {
                    return false;
                }
            },
        });
        // Update entry index if dragged
        this.$dragula.$service.eventBus.$on("dropModel", ({ dragIndex, dropIndex, }) => __awaiter(this, void 0, void 0, function* () {
            this.$store.commit("accounts/moveCode", {
                from: dragIndex,
                to: dropIndex,
            });
            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.set(this.$store.state.accounts.entries);
        }));
    },
    components: {
        EntryComponent: _EntryComponent_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
        // IconPlus,
        IconKey: (_svg_key_solid_svg__WEBPACK_IMPORTED_MODULE_2___default()),
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts":
/*!***********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts ***!
  \***********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./src/utils.ts");
/* harmony import */ var _svg_cog_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../svg/cog.svg */ "./svg/cog.svg");
/* harmony import */ var _svg_cog_svg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_svg_cog_svg__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _svg_lock_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../svg/lock.svg */ "./svg/lock.svg");
/* harmony import */ var _svg_lock_svg__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_svg_lock_svg__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _svg_sync_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../svg/sync.svg */ "./svg/sync.svg");
/* harmony import */ var _svg_sync_svg__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_svg_sync_svg__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _svg_scan_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../svg/scan.svg */ "./svg/scan.svg");
/* harmony import */ var _svg_scan_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_svg_scan_svg__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _svg_pencil_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../svg/pencil.svg */ "./svg/pencil.svg");
/* harmony import */ var _svg_pencil_svg__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_svg_pencil_svg__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _svg_check_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../svg/check.svg */ "./svg/check.svg");
/* harmony import */ var _svg_check_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_svg_check_svg__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _svg_plus_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../svg/plus.svg */ "./svg/plus.svg");
/* harmony import */ var _svg_plus_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_svg_plus_svg__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _svg_database_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../svg/database.svg */ "./svg/database.svg");
/* harmony import */ var _svg_database_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_svg_database_svg__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../browser */ "./src/browser.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



// Icons









const computedPrototype = [
    (0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)("style", ["style"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)("accounts", ["defaultEncryption"]),
    (0,vuex__WEBPACK_IMPORTED_MODULE_10__.mapState)("backup", ["driveToken", "dropboxToken", "oneDriveToken"]),
];
let computed = {};
for (const module of computedPrototype) {
    Object.assign(computed, module);
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_11__["default"].extend({
    computed,
    methods: {
        isPopup() {
            const params = new URLSearchParams(document.location.search.substring(1));
            return params.get("popup");
        },
        popOut() {
            let windowType;
            if (_browser__WEBPACK_IMPORTED_MODULE_9__.isFirefox) {
                windowType = "detached_panel";
            }
            else {
                windowType = "panel";
            }
            chrome.windows.create({
                url: chrome.runtime.getURL("view/popup.html?popup=true"),
                type: windowType,
                height: window.innerHeight,
                width: window.innerWidth,
            });
            window.close();
        },
        showMenu() {
            this.$store.commit("style/showMenu");
        },
        showInfo(page) {
            if (page === "AddMethodPage") {
                if (this.$store.state.menu.enforcePassword &&
                    !this.$store.state.accounts.defaultEncryption) {
                    page = "SetPasswordPage";
                }
            }
            this.$store.commit("style/showInfo");
            this.$store.commit("currentView/changeView", page);
        },
        showExchangeRate() {
            this.$store.commit("style/toggleExchangeRate");
        },
        editEntry() {
            this.$store.commit("style/toggleEdit");
            this.$store.commit("accounts/stopFilter");
        },
        lock() {
            chrome.runtime.sendMessage({ action: "lock" }, window.close);
            return;
        },
        beginCapture() {
            var _a;
            return __awaiter(this, void 0, void 0, function* () {
                if (this.$store.state.menu.enforcePassword &&
                    !this.$store.state.accounts.defaultEncryption) {
                    this.$store.commit("style/showInfo");
                    this.$store.commit("currentView/changeView", "SetPasswordPage");
                    return;
                }
                if (this.$store.getters["accounts/currentlyEncrypted"]) {
                    this.$store.commit("notification/alert", this.i18n.phrase_incorrect);
                    return;
                }
                const tab = yield (0,_utils__WEBPACK_IMPORTED_MODULE_0__.getCurrentTab)();
                // Insert content script
                if ((0,_utils__WEBPACK_IMPORTED_MODULE_0__.okToInjectContentScript)(tab)) {
                    yield chrome.scripting.executeScript({
                        target: { tabId: tab.id },
                        files: ["/dist/content.js"],
                    });
                    yield chrome.scripting.insertCSS({
                        target: { tabId: tab.id },
                        files: ["/css/content.css"],
                    });
                    if ((_a = tab.url) === null || _a === void 0 ? void 0 : _a.startsWith("file:")) {
                        if (yield this.$store.dispatch("notification/confirm", this.i18n.capture_local_file_failed)) {
                            window.open("import.html?QrImport", "_blank");
                            return;
                        }
                    }
                    chrome.runtime.sendMessage({ action: "updateContentTab", data: tab });
                    chrome.tabs.sendMessage(tab.id, { action: "capture" }, (result) => {
                        if (result !== "beginCapture") {
                            this.$store.commit("notification/alert", this.i18n.capture_failed);
                        }
                        else {
                            window.close();
                        }
                    });
                }
            });
        },
    },
    components: {
        IconCog: (_svg_cog_svg__WEBPACK_IMPORTED_MODULE_1___default()),
        IconLock: (_svg_lock_svg__WEBPACK_IMPORTED_MODULE_2___default()),
        IconSync: (_svg_sync_svg__WEBPACK_IMPORTED_MODULE_3___default()),
        IconScan: (_svg_scan_svg__WEBPACK_IMPORTED_MODULE_4___default()),
        IconPencil: (_svg_pencil_svg__WEBPACK_IMPORTED_MODULE_5___default()),
        IconCheck: (_svg_check_svg__WEBPACK_IMPORTED_MODULE_6___default()),
        IconPlus: (_svg_plus_svg__WEBPACK_IMPORTED_MODULE_7___default()),
        IconDatabase: (_svg_database_svg__WEBPACK_IMPORTED_MODULE_8___default()),
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts":
/*!*********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts ***!
  \*********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _syncTime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../syncTime */ "./src/syncTime.ts");
/* harmony import */ var _svg_arrow_left_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../svg/arrow-left.svg */ "./svg/arrow-left.svg");
/* harmony import */ var _svg_arrow_left_svg__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_svg_arrow_left_svg__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _svg_info_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../svg/info.svg */ "./svg/info.svg");
/* harmony import */ var _svg_info_svg__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_svg_info_svg__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _svg_exchange_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../svg/exchange.svg */ "./svg/exchange.svg");
/* harmony import */ var _svg_exchange_svg__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_svg_exchange_svg__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _svg_database_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../svg/database.svg */ "./svg/database.svg");
/* harmony import */ var _svg_database_svg__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_svg_database_svg__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _svg_lock_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../svg/lock.svg */ "./svg/lock.svg");
/* harmony import */ var _svg_lock_svg__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_svg_lock_svg__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _svg_sync_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../../svg/sync.svg */ "./svg/sync.svg");
/* harmony import */ var _svg_sync_svg__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_svg_sync_svg__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _svg_wrench_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../../svg/wrench.svg */ "./svg/wrench.svg");
/* harmony import */ var _svg_wrench_svg__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_svg_wrench_svg__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _svg_lightbulb_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../svg/lightbulb.svg */ "./svg/lightbulb.svg");
/* harmony import */ var _svg_lightbulb_svg__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_svg_lightbulb_svg__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var _svg_comments_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../svg/comments.svg */ "./svg/comments.svg");
/* harmony import */ var _svg_comments_svg__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_svg_comments_svg__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var _svg_globe_svg__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../../svg/globe.svg */ "./svg/globe.svg");
/* harmony import */ var _svg_globe_svg__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_svg_globe_svg__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var _svg_code_svg__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../../../svg/code.svg */ "./svg/code.svg");
/* harmony import */ var _svg_code_svg__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_svg_code_svg__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var _svg_clipboard_check_svg__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../../svg/clipboard-check.svg */ "./svg/clipboard-check.svg");
/* harmony import */ var _svg_clipboard_check_svg__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_svg_clipboard_check_svg__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../browser */ "./src/browser.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
















/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_15__["default"].extend({
    components: {
        IconArrowLeft: (_svg_arrow_left_svg__WEBPACK_IMPORTED_MODULE_1___default()),
        IconInfo: (_svg_info_svg__WEBPACK_IMPORTED_MODULE_2___default()),
        IconExchange: (_svg_exchange_svg__WEBPACK_IMPORTED_MODULE_3___default()),
        IconDatabase: (_svg_database_svg__WEBPACK_IMPORTED_MODULE_4___default()),
        IconLock: (_svg_lock_svg__WEBPACK_IMPORTED_MODULE_5___default()),
        IconSync: (_svg_sync_svg__WEBPACK_IMPORTED_MODULE_6___default()),
        IconWrench: (_svg_wrench_svg__WEBPACK_IMPORTED_MODULE_7___default()),
        IconAdvisor: (_svg_lightbulb_svg__WEBPACK_IMPORTED_MODULE_8___default()),
        IconComments: (_svg_comments_svg__WEBPACK_IMPORTED_MODULE_9___default()),
        IconGlobe: (_svg_globe_svg__WEBPACK_IMPORTED_MODULE_10___default()),
        IconCode: (_svg_code_svg__WEBPACK_IMPORTED_MODULE_11___default()),
        IconClipboardCheck: (_svg_clipboard_check_svg__WEBPACK_IMPORTED_MODULE_12___default()),
    },
    computed: {
        version: function () {
            return this.$store.state.menu.version;
        },
        isSupported: {
            get() {
                return !_browser__WEBPACK_IMPORTED_MODULE_13__.isSafari;
            },
        },
    },
    methods: {
        hideMenu() {
            this.$store.commit("style/hideMenu");
        },
        openHelp() {
            let url = "https://otp.ee/chromeissues";
            if (navigator.userAgent.indexOf("Firefox") !== -1) {
                url = "https://otp.ee/firefoxissues";
            }
            else if (navigator.userAgent.indexOf("Edg") !== -1) {
                url = "https://otp.ee/edgeissues";
            }
            const feedbackURL = this.$store.state.menu.feedbackURL;
            if (typeof feedbackURL === "string" && feedbackURL) {
                url = feedbackURL;
            }
            chrome.tabs.create({ url });
        },
        openLink(url) {
            window.open(url, "_blank");
            return;
        },
        showInfo(tab) {
            if (this.$store.getters["accounts/currentlyEncrypted"]) {
                if (tab === "SetPasswordPage") {
                    this.$store.commit("notification/alert", this.i18n.phrase_incorrect);
                    return;
                }
            }
            this.$store.commit("style/showInfo");
            this.$store.commit("currentView/changeView", tab);
            return;
        },
        showExchangeRate() {
            this.$store.commit("style/setActiveTab", "exchange-rate");
            this.hideMenu();
        },
        syncClock() {
            chrome.permissions.request({ origins: ["https://www.google.com/"] }, (granted) => __awaiter(this, void 0, void 0, function* () {
                if (granted) {
                    yield _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.updateItems();
                    const message = yield (0,_syncTime__WEBPACK_IMPORTED_MODULE_0__.syncTimeWithGoogle)();
                    this.$store.commit("notification/alert", this.i18n[message]);
                }
                return;
            }));
            return;
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts":
/*!********************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts ***!
  \********************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    computed: (0,vuex__WEBPACK_IMPORTED_MODULE_1__.mapState)("notification", [
        "message",
        "messageIdle",
        "confirmMessage",
    ]),
    methods: {
        closeAlert() {
            this.$store.commit("notification/closeAlert");
        },
        confirmOK() {
            const confirmEvent = new CustomEvent("confirm", { detail: true });
            window.dispatchEvent(confirmEvent);
            return;
        },
        confirmCancel() {
            const confirmEvent = new CustomEvent("confirm", { detail: false });
            window.dispatchEvent(confirmEvent);
            return;
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts":
/*!*************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts ***!
  \*************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _models_backup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/backup */ "./src/models/backup.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



const service = "onedrive";
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_2__["default"].extend({
    data: function () {
        return {
            email: this.i18n.loading,
        };
    },
    created() {
        _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
    },
    computed: {
        defaultEncryption: function () {
            return this.$store.state.accounts.defaultEncryption;
        },
        isEncrypted: {
            get() {
                if (_models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveEncrypted === null) {
                    this.$store.commit("backup/setEnc", { service, value: true });
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveEncrypted = true;
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                    return true;
                }
                return this.$store.state.backup.driveEncrypted;
            },
            set(newValue) {
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveEncrypted = newValue === "true";
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                this.$store.commit("backup/setEnc", { service, value: newValue });
            },
        },
        backupToken: function () {
            return this.$store.state.backup.oneDriveToken;
        },
    },
    methods: {
        openLink(url) {
            window.open(url, "_blank");
            return;
        },
        getBackupToken(business) {
            _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveBusiness = Boolean(business);
            _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
            chrome.runtime.sendMessage({ action: service });
        },
        backupLogout() {
            return __awaiter(this, void 0, void 0, function* () {
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken = undefined;
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRefreshToken = undefined;
                _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                this.$store.commit("backup/setToken", { service, value: false });
                this.$store.commit("style/hideInfo");
            });
        },
        backupUpload() {
            return __awaiter(this, void 0, void 0, function* () {
                const oneDrive = new _models_backup__WEBPACK_IMPORTED_MODULE_0__.OneDrive();
                const response = yield oneDrive.upload(this.$store.state.accounts.encryption);
                if (response === true) {
                    this.$store.commit("notification/alert", this.i18n.updateSuccess);
                }
                else if (_models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRevoked === true) {
                    this.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["OneDrive"]));
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.removeItem("oneDriveRevoked");
                    this.$store.commit("backup/setToken", { service, value: false });
                }
                else {
                    this.$store.commit("notification/alert", this.i18n.updateFailure);
                }
            });
        },
        getUser() {
            return __awaiter(this, void 0, void 0, function* () {
                const oneDrive = new _models_backup__WEBPACK_IMPORTED_MODULE_0__.OneDrive();
                return yield oneDrive.getUser();
            });
        },
    },
    mounted: function () {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.backupToken) {
                this.email = yield this.getUser();
            }
        });
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _svg_x_circle_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../svg/x-circle.svg */ "./svg/x-circle.svg");
/* harmony import */ var _svg_x_circle_svg__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_svg_x_circle_svg__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _AddAccountPage_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AddAccountPage.vue */ "./src/components/Popup/AddAccountPage.vue");
/* harmony import */ var _AddMethodPage_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AddMethodPage.vue */ "./src/components/Popup/AddMethodPage.vue");
/* harmony import */ var _SetPasswordPage_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SetPasswordPage.vue */ "./src/components/Popup/SetPasswordPage.vue");
/* harmony import */ var _EnterPasswordPage_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./EnterPasswordPage.vue */ "./src/components/Popup/EnterPasswordPage.vue");
/* harmony import */ var _BackupPage_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./BackupPage.vue */ "./src/components/Popup/BackupPage.vue");
/* harmony import */ var _DropboxPage_vue__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./DropboxPage.vue */ "./src/components/Popup/DropboxPage.vue");
/* harmony import */ var _DrivePage_vue__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DrivePage.vue */ "./src/components/Popup/DrivePage.vue");
/* harmony import */ var _OneDrivePage_vue__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./OneDrivePage.vue */ "./src/components/Popup/OneDrivePage.vue");
/* harmony import */ var _PreferencesPage_vue__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./PreferencesPage.vue */ "./src/components/Popup/PreferencesPage.vue");
/* harmony import */ var _AdvisorPage_vue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./AdvisorPage.vue */ "./src/components/Popup/AdvisorPage.vue");
/* harmony import */ var _LoadingPage_vue__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./LoadingPage.vue */ "./src/components/Popup/LoadingPage.vue");
/* harmony import */ var _ExchangeRatePage_vue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./ExchangeRatePage.vue */ "./src/components/Popup/ExchangeRatePage.vue");














/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_13__["default"].extend({
    computed: {
        info: function () {
            return this.$store.state.currentView.info;
        },
    },
    methods: {
        hideInfo() {
            this.$store.commit("style/hideInfo");
        },
    },
    components: {
        IconXCircle: (_svg_x_circle_svg__WEBPACK_IMPORTED_MODULE_0___default()),
        AddAccountPage: _AddAccountPage_vue__WEBPACK_IMPORTED_MODULE_1__["default"],
        AddMethodPage: _AddMethodPage_vue__WEBPACK_IMPORTED_MODULE_2__["default"],
        SetPasswordPage: _SetPasswordPage_vue__WEBPACK_IMPORTED_MODULE_3__["default"],
        EnterPasswordPage: _EnterPasswordPage_vue__WEBPACK_IMPORTED_MODULE_4__["default"],
        BackupPage: _BackupPage_vue__WEBPACK_IMPORTED_MODULE_5__["default"],
        DropboxPage: _DropboxPage_vue__WEBPACK_IMPORTED_MODULE_6__["default"],
        DrivePage: _DrivePage_vue__WEBPACK_IMPORTED_MODULE_7__["default"],
        OneDrivePage: _OneDrivePage_vue__WEBPACK_IMPORTED_MODULE_8__["default"],
        PreferencesPage: _PreferencesPage_vue__WEBPACK_IMPORTED_MODULE_9__["default"],
        AdvisorPage: _AdvisorPage_vue__WEBPACK_IMPORTED_MODULE_10__["default"],
        LoadingPage: _LoadingPage_vue__WEBPACK_IMPORTED_MODULE_11__["default"],
        ExchangeRatePage: _ExchangeRatePage_vue__WEBPACK_IMPORTED_MODULE_12__["default"],
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts":
/*!****************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts ***!
  \****************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../browser */ "./src/browser.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../models/settings */ "./src/models/settings.ts");



/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_2__["default"].extend({
    computed: {
        zoom: {
            get() {
                return this.$store.state.menu.zoom;
            },
            set(zoom) {
                this.$store.commit("menu/setZoom", zoom);
            },
        },
        useAutofill: {
            get() {
                return this.$store.state.menu.useAutofill;
            },
            set(useAutofill) {
                this.$store.commit("menu/setAutofill", useAutofill);
            },
        },
        smartFilter: {
            get() {
                return this.$store.state.menu.smartFilter;
            },
            set(smartFilter) {
                this.$store.commit("menu/setSmartFilter", smartFilter);
                this.$store.commit("notification/alert", this.i18n.activate_auto_filter);
            },
        },
        enableContextMenu: {
            get() {
                return this.$store.state.menu.enableContextMenu;
            },
            set(enableContextMenu) {
                this.$store.commit("menu/setEnableContextMenu", enableContextMenu);
            },
        },
        theme: {
            get() {
                return this.$store.state.menu.theme;
            },
            set(theme) {
                this.$store.commit("menu/setTheme", theme);
            },
        },
        defaultEncryption() {
            return this.$store.state.accounts.defaultEncryption;
        },
        enforceAutolock() {
            return this.$store.state.menu.enforceAutolock;
        },
        autolock: {
            get() {
                if (this.$store.state.menu.enforceAutolock) {
                    return this.$store.state.menu.enforceAutolock;
                }
                else {
                    return this.$store.state.menu.autolock;
                }
            },
            set(autolock) {
                this.$store.commit("menu/setAutolock", autolock);
                chrome.runtime.sendMessage({ action: "resetAutolock" });
            },
        },
        storageArea() {
            return this.$store.state.menu.storageArea;
        },
        browserSync: {
            get() {
                return this.newStorageLocation === "sync";
            },
            set(value) {
                this.newStorageLocation = value ? "sync" : "local";
            },
        },
        isSupported: {
            get() {
                return !_browser__WEBPACK_IMPORTED_MODULE_0__.isFirefox && !_browser__WEBPACK_IMPORTED_MODULE_0__.isSafari;
            },
        },
    },
    data() {
        return {
            newStorageLocation: "",
        };
    },
    created() {
        _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems().then(() => {
            this.newStorageLocation =
                this.$store.state.menu.storageArea ||
                    _models_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation;
        });
    },
    methods: {
        popOut() {
            let windowType;
            if (_browser__WEBPACK_IMPORTED_MODULE_0__.isFirefox) {
                windowType = "detached_panel";
            }
            else {
                windowType = "panel";
            }
            chrome.windows.create({
                url: chrome.runtime.getURL("view/popup.html?popup=true"),
                type: windowType,
                height: window.innerHeight,
                width: window.innerWidth,
            });
        },
        migrateStorage() {
            this.$store.commit("currentView/changeView", "LoadingPage");
            this.$store
                .dispatch("accounts/migrateStorage", this.newStorageLocation)
                .then((m) => {
                this.$store.commit("notification/alert", this.i18n[m]);
                this.$store.commit("currentView/changeView", "PreferencesPage");
            }),
                (r) => {
                    this.$store.commit("notification/alert", this.i18n.updateFailure + r);
                    this.$store.commit("currentView/changeView", "PreferencesPage");
                };
        },
        requireContextMenuPermission() {
            chrome.permissions.request({
                permissions: ["contextMenus"],
            }, (granted) => {
                if (!granted) {
                    this.enableContextMenu = false;
                    return;
                }
                chrome.runtime.sendMessage({
                    action: "updateContextMenu",
                });
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts":
/*!****************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts ***!
  \****************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var _models_password__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../models/password */ "./src/models/password.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_1__["default"].extend({
    data: function () {
        return {
            phrase: "",
            currentPhrase: "",
            confirm: "",
        };
    },
    computed: {
        enforcePassword: function () {
            return this.$store.state.menu.enforcePassword;
        },
        passwordPolicy: function () {
            if (!this.$store.state.menu.passwordPolicy) {
                return null;
            }
            try {
                return new RegExp(this.$store.state.menu.passwordPolicy);
            }
            catch (_a) {
                console.warn("Invalid password policy. The password policy is not a valid regular expression.", this.$store.state.menu.passwordPolicy);
                return null;
            }
        },
        passwordPolicyHint: function () {
            return this.$store.state.menu.passwordPolicyHint;
        },
        defaultEncryption: function () {
            return this.$store.state.accounts.defaultEncryption;
        },
    },
    methods: {
        removePassphrase() {
            return __awaiter(this, void 0, void 0, function* () {
                this.$store.commit("currentView/changeView", "LoadingPage");
                if (this.defaultEncryption) {
                    const isCorrectPassword = yield (0,_models_password__WEBPACK_IMPORTED_MODULE_0__.verifyPasswordUsingKeyID)(this.defaultEncryption, this.currentPhrase);
                    if (!isCorrectPassword) {
                        this.$store.commit("notification/alert", this.i18n.phrase_not_match);
                        this.$store.commit("currentView/changeView", "SetPasswordPage");
                        return;
                    }
                }
                yield this.$store.dispatch("accounts/changePassphrase", "");
                this.$store.commit("notification/alert", this.i18n.updateSuccess);
                this.$store.commit("style/hideInfo");
                return;
            });
        },
        changePassphrase() {
            return __awaiter(this, void 0, void 0, function* () {
                if (this.phrase === "") {
                    return;
                }
                if (this.passwordPolicy && !this.passwordPolicy.test(this.phrase)) {
                    const hint = this.passwordPolicyHint || this.i18n.password_policy_default_hint;
                    this.$store.commit("notification/alert", hint);
                    return;
                }
                if (this.phrase !== this.confirm) {
                    this.$store.commit("notification/alert", this.i18n.phrase_not_match);
                    return;
                }
                this.$store.commit("currentView/changeView", "LoadingPage");
                if (this.defaultEncryption) {
                    const isCorrectPassword = yield (0,_models_password__WEBPACK_IMPORTED_MODULE_0__.verifyPasswordUsingKeyID)(this.defaultEncryption, this.currentPhrase);
                    if (!isCorrectPassword) {
                        this.$store.commit("notification/alert", this.i18n.phrase_wrong);
                        this.$store.commit("currentView/changeView", "SetPasswordPage");
                        return;
                    }
                }
                yield this.$store.dispatch("accounts/changePassphrase", this.phrase);
                this.$store.commit("notification/alert", this.i18n.updateSuccess);
                this.$store.commit("style/hideInfo");
                return;
            });
        },
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=script&lang=ts":
/*!*************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=script&lang=ts ***!
  \*************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: ["type"],
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=script&lang=ts":
/*!************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=script&lang=ts ***!
  \************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: ["type", "href", "download"],
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=script&lang=ts":
/*!***********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=script&lang=ts ***!
  \***********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: ["label", "multiple", "accept"],
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=script&lang=ts":
/*!*************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=script&lang=ts ***!
  \*************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: ["label", "value", "disabled"],
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=script&lang=ts":
/*!***********************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=script&lang=ts ***!
  \***********************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: ["label", "value", "type", "autofocus"],
    mounted() {
        if (!this.$props.autofocus) {
            return;
        }
        const textInput = this.$refs.textInput;
        if (textInput instanceof HTMLInputElement) {
            textInput.focus();
        }
    },
}));


/***/ }),

/***/ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=script&lang=ts":
/*!*************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=script&lang=ts ***!
  \*************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (vue__WEBPACK_IMPORTED_MODULE_0__["default"].extend({
    props: {
        label: String,
        checked: Boolean,
    },
    model: {
        prop: "checked",
        event: "change",
    },
}));


/***/ }),

/***/ "./src/browser.ts":
/*!************************!*\
  !*** ./src/browser.ts ***!
  \************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   isChrome: () => (/* binding */ isChrome),
/* harmony export */   isChromium: () => (/* binding */ isChromium),
/* harmony export */   isEdge: () => (/* binding */ isEdge),
/* harmony export */   isFirefox: () => (/* binding */ isFirefox),
/* harmony export */   isSafari: () => (/* binding */ isSafari),
/* harmony export */   isWebKit: () => (/* binding */ isWebKit)
/* harmony export */ });
const isFirefox = navigator.userAgent.indexOf("Firefox") >= 0;
const isWebKit = navigator.userAgent.indexOf("AppleWebKit") >= 0;
const isEdge = navigator.userAgent.indexOf("Edg") >= 0;
const isChromium = navigator.userAgent.indexOf("Chrome") >= 0;
const isSafari = !isChromium && navigator.userAgent.indexOf("Safari") >= 0;
const isChrome = navigator.userAgent.indexOf("Chrome") !== -1 &&
    navigator.userAgent.indexOf("Edg") === -1;


/***/ }),

/***/ "./src/components/common/index.ts":
/*!****************************************!*\
  !*** ./src/components/common/index.ts ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ButtonInput_vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ButtonInput.vue */ "./src/components/common/ButtonInput.vue");
/* harmony import */ var _ButtonLink_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ButtonLink.vue */ "./src/components/common/ButtonLink.vue");
/* harmony import */ var _TextInput_vue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./TextInput.vue */ "./src/components/common/TextInput.vue");
/* harmony import */ var _SelectInput_vue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./SelectInput.vue */ "./src/components/common/SelectInput.vue");
/* harmony import */ var _ToggleInput_vue__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ToggleInput.vue */ "./src/components/common/ToggleInput.vue");
/* harmony import */ var _FileInput_vue__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./FileInput.vue */ "./src/components/common/FileInput.vue");






/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ([
    { name: "a-button", component: _ButtonInput_vue__WEBPACK_IMPORTED_MODULE_0__["default"] },
    { name: "a-button-link", component: _ButtonLink_vue__WEBPACK_IMPORTED_MODULE_1__["default"] },
    { name: "a-text-input", component: _TextInput_vue__WEBPACK_IMPORTED_MODULE_2__["default"] },
    { name: "a-select-input", component: _SelectInput_vue__WEBPACK_IMPORTED_MODULE_3__["default"] },
    { name: "a-toggle-input", component: _ToggleInput_vue__WEBPACK_IMPORTED_MODULE_4__["default"] },
    { name: "a-file-input", component: _FileInput_vue__WEBPACK_IMPORTED_MODULE_5__["default"] },
]);


/***/ }),

/***/ "./src/models/advisor.ts":
/*!*******************************!*\
  !*** ./src/models/advisor.ts ***!
  \*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   AdvisorInsight: () => (/* binding */ AdvisorInsight),
/* harmony export */   InsightLevel: () => (/* binding */ InsightLevel)
/* harmony export */ });
var InsightLevel;
(function (InsightLevel) {
    InsightLevel["danger"] = "danger";
    InsightLevel["warning"] = "warning";
    InsightLevel["info"] = "info";
})(InsightLevel || (InsightLevel = {}));
class AdvisorInsight {
    constructor(insight) {
        this.id = insight.id;
        this.level = insight.level;
        this.levelText = chrome.i18n.getMessage(insight.level);
        this.description = insight.description;
        this.link = insight.link;
        this.validation = insight.validation;
    }
}


/***/ }),

/***/ "./src/models/backup.ts":
/*!******************************!*\
  !*** ./src/models/backup.ts ***!
  \******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Drive: () => (/* binding */ Drive),
/* harmony export */   Dropbox: () => (/* binding */ Dropbox),
/* harmony export */   OneDrive: () => (/* binding */ OneDrive)
/* harmony export */ });
/* harmony import */ var _credentials__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credentials */ "./src/models/credentials.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./settings */ "./src/models/settings.ts");
/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storage */ "./src/models/storage.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



class Dropbox {
    getToken() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            return _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxToken || "";
        });
    }
    upload(encryption) {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxEncrypted === undefined) {
                // Encrypt by default if user hasn't set yet
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxEncrypted = true;
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
            }
            const exportData = yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.backupGetExport(encryption, _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxEncrypted === true);
            const backup = JSON.stringify(exportData, null, 2);
            const url = "https://content.dropboxapi.com/2/files/upload";
            const token = yield this.getToken();
            return new Promise((resolve, reject) => {
                if (!token) {
                    return resolve(false);
                }
                try {
                    const xhr = new XMLHttpRequest();
                    const now = new Date().toISOString().slice(0, 10).replace(/-/g, "");
                    const apiArg = {
                        path: `/${now}.json`,
                        mode: "add",
                        autorename: true,
                    };
                    xhr.open("POST", url);
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
                    xhr.setRequestHeader("Content-type", "application/octet-stream");
                    xhr.setRequestHeader("Dropbox-API-Arg", JSON.stringify(apiArg));
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxToken = undefined;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxRevoked = true;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (res.name) {
                                    resolve(true);
                                }
                                else {
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                reject(error);
                            }
                        }
                        return;
                    };
                    xhr.send(backup);
                }
                catch (error) {
                    return reject(error);
                }
            });
        });
    }
    getUser() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            const url = "https://api.dropboxapi.com/2/users/get_current_account";
            const token = yield this.getToken();
            return new Promise((resolve) => {
                if (!token) {
                    return resolve("Error: No token");
                }
                const xhr = new XMLHttpRequest();
                xhr.open("POST", url);
                xhr.setRequestHeader("Authorization", "Bearer " + token);
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 401) {
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxToken = undefined;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.dropboxRevoked = true;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                            resolve("Error: Response was 401. You will be logged out the next time you open Authenticator.");
                        }
                        try {
                            const res = JSON.parse(xhr.responseText);
                            if (res.email) {
                                resolve(res.email);
                            }
                            else {
                                console.error("Could not find email in response.", res);
                                resolve("Error: res.email was undefined.");
                            }
                        }
                        catch (e) {
                            console.error(e);
                            resolve("Error");
                        }
                    }
                    return;
                };
                xhr.send(null);
            });
        });
    }
}
class Drive {
    getToken() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (!_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken ||
                (yield new Promise((resolve, reject) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("GET", "https://www.googleapis.com/drive/v3/files");
                    xhr.setRequestHeader("Authorization", "Bearer " + _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken);
                    xhr.onreadystatechange = () => __awaiter(this, void 0, void 0, function* () {
                        if (xhr.readyState === 4) {
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (res.error) {
                                    if (res.error.code === 401) {
                                        if (navigator.userAgent.indexOf("Chrome") !== -1 &&
                                            navigator.userAgent.indexOf("OPR") === -1 &&
                                            navigator.userAgent.indexOf("Edg") === -1) {
                                            // Clear invalid token from
                                            // chrome://identity-internals/
                                            yield chrome.identity.removeCachedAuthToken({
                                                token: _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken,
                                            });
                                        }
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = undefined;
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                        resolve(true);
                                    }
                                }
                                else {
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                console.error(error);
                                reject(error);
                            }
                        }
                        return;
                    });
                    xhr.send();
                }))) {
                yield this.refreshToken();
            }
            return _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken;
        });
    }
    refreshToken() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (navigator.userAgent.indexOf("Chrome") !== -1 &&
                navigator.userAgent.indexOf("OPR") === -1 &&
                navigator.userAgent.indexOf("Edg") === -1) {
                return new Promise((resolve) => {
                    return chrome.identity.getAuthToken({
                        interactive: false,
                        scopes: ["https://www.googleapis.com/auth/drive.file"],
                    }, (token) => {
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = token;
                        if (!token) {
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRevoked = true;
                        }
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                        resolve(Boolean(token));
                    });
                });
            }
            else {
                return new Promise((resolve, reject) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("POST", "https://www.googleapis.com/oauth2/v4/token?client_id=" +
                        (0,_credentials__WEBPACK_IMPORTED_MODULE_0__.getCredentials)().drive.client_id +
                        "&client_secret=" +
                        (0,_credentials__WEBPACK_IMPORTED_MODULE_0__.getCredentials)().drive.client_secret +
                        "&refresh_token=" +
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRefreshToken +
                        "&grant_type=refresh_token");
                    xhr.setRequestHeader("Accept", "application/json");
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRefreshToken = undefined;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRevoked = true;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (res.error) {
                                    if (res.error === "invalid_grant") {
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRefreshToken = undefined;
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveRevoked = true;
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                    }
                                    console.error(res.error_description);
                                    resolve(false);
                                }
                                else {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = res.access_token;
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                    resolve(true);
                                }
                            }
                            catch (error) {
                                console.error(error);
                                reject(error);
                            }
                        }
                        return;
                    };
                    xhr.send();
                });
            }
        });
    }
    getFolder() {
        return __awaiter(this, void 0, void 0, function* () {
            const token = yield this.getToken();
            if (!token) {
                return false;
            }
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder) {
                yield new Promise((resolve, reject) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("GET", "https://www.googleapis.com/drive/v3/files/" +
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder +
                        "?fields=trashed");
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
                    xhr.setRequestHeader("Accept", "application/json");
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = undefined;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (res.error) {
                                    if (res.error.code === 404) {
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder = undefined;
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                        resolve(true);
                                    }
                                    else {
                                        console.error(res.error.message);
                                        resolve(false);
                                    }
                                }
                                else if (res.trashed) {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder = undefined;
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                    resolve(true);
                                }
                                else {
                                    resolve(true);
                                }
                            }
                            catch (error) {
                                console.error(error);
                                reject(error);
                            }
                        }
                        return;
                    };
                    xhr.send();
                });
            }
            if (!_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder) {
                yield new Promise((resolve, reject) => {
                    // create folder
                    const xhr = new XMLHttpRequest();
                    xhr.open("POST", "https://www.googleapis.com/drive/v3/files/");
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
                    xhr.setRequestHeader("Accept", "application/json");
                    xhr.setRequestHeader("Content-Type", "application/json");
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = undefined;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (!res.error) {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder = res.id;
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                    resolve(true);
                                }
                                else {
                                    console.error(res.error.message);
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                console.error(error);
                                reject(error);
                            }
                        }
                        return;
                    };
                    xhr.send(JSON.stringify({
                        name: "Authenticator Backups",
                        mimeType: "application/vnd.google-apps.folder",
                    }));
                });
            }
            return _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder;
        });
    }
    upload(encryption) {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveEncrypted === undefined) {
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveEncrypted = true;
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
            }
            const exportData = yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.backupGetExport(encryption, _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveEncrypted === true);
            const backup = JSON.stringify(exportData, null, 2);
            const token = yield this.getToken();
            if (!token) {
                return false;
            }
            const folderId = yield this.getFolder();
            return new Promise((resolve, reject) => {
                if (!token || !folderId) {
                    return resolve(false);
                }
                try {
                    const xhr = new XMLHttpRequest();
                    const now = new Date().toISOString().slice(0, 10).replace(/-/g, "");
                    xhr.open("POST", "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart");
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
                    xhr.setRequestHeader("Content-type", "multipart/related; boundary=segment_marker");
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = undefined;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (!res.error) {
                                    resolve(true);
                                }
                                else {
                                    console.error(res.error.message);
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                reject(error);
                            }
                        }
                        return;
                    };
                    const requestDataPrototype = [
                        "--segment_marker",
                        "Content-Type: application/json; charset=UTF-8",
                        "",
                        JSON.stringify({
                            name: `${now}.json`,
                            parents: [_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveFolder],
                        }),
                        "",
                        "--segment_marker",
                        "Content-Type: application/octet-stream",
                        "",
                        backup,
                        "--segment_marker--",
                    ];
                    let requestData = "";
                    requestDataPrototype.forEach((line) => {
                        requestData = requestData + line + "\n";
                    });
                    xhr.send(requestData);
                }
                catch (error) {
                    return reject(error);
                }
            });
        });
    }
    getUser() {
        return __awaiter(this, void 0, void 0, function* () {
            const token = yield this.getToken();
            if (!token) {
                return "Error: Access revoked or expired.";
            }
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            return new Promise((resolve) => {
                if (!token) {
                    resolve("Error: Access revoked or expired.");
                }
                const xhr = new XMLHttpRequest();
                xhr.open("GET", "https://www.googleapis.com/drive/v2/about?fields=user");
                xhr.setRequestHeader("Authorization", "Bearer " + token);
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 401) {
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.driveToken = undefined;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                            resolve("Error: Response was 401. You will be logged out the next time you open Authenticator.");
                        }
                        try {
                            const res = JSON.parse(xhr.responseText);
                            if (!res.error) {
                                resolve(res.user.emailAddress);
                            }
                            else {
                                console.error(res.error.message);
                                resolve("Error");
                            }
                        }
                        catch (e) {
                            console.error(e);
                            resolve("Error");
                        }
                    }
                    return;
                };
                xhr.send();
            });
        });
    }
}
class OneDrive {
    getToken() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (!_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken ||
                (yield new Promise((resolve, reject) => {
                    const xhr = new XMLHttpRequest();
                    xhr.open("GET", "https://graph.microsoft.com/v1.0/me/drive/special/approot");
                    xhr.setRequestHeader("Authorization", "Bearer " + _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken);
                    xhr.onreadystatechange = () => __awaiter(this, void 0, void 0, function* () {
                        if (xhr.readyState === 4) {
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (res.error) {
                                    if (res.error.code === 401) {
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken = undefined;
                                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                        resolve(true);
                                    }
                                }
                                else {
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                console.error(error);
                                reject(error);
                            }
                        }
                        return;
                    });
                    xhr.send();
                }))) {
                yield this.refreshToken();
            }
            return _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken;
        });
    }
    refreshToken() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            return new Promise((resolve, reject) => {
                const xhr = new XMLHttpRequest();
                xhr.open("POST", "https://login.microsoftonline.com/common/oauth2/v2.0/token");
                xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 401) {
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRefreshToken = undefined;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRevoked = true;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                            return resolve(false);
                        }
                        try {
                            const res = JSON.parse(xhr.responseText);
                            if (res.error) {
                                if (res.error === "invalid_grant") {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRefreshToken = undefined;
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRevoked = true;
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                }
                                console.error(res.error_description);
                                resolve(false);
                            }
                            else {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken = res.access_token;
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                resolve(true);
                            }
                        }
                        catch (error) {
                            console.error(error);
                            reject(error);
                        }
                    }
                    return;
                };
                xhr.send(`client_id=${(0,_credentials__WEBPACK_IMPORTED_MODULE_0__.getCredentials)().onedrive.client_id}&refresh_token=${_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveRefreshToken}&client_secret=${encodeURIComponent((0,_credentials__WEBPACK_IMPORTED_MODULE_0__.getCredentials)().onedrive.client_secret)}&grant_type=refresh_token&scope=https%3A%2F%2Fgraph.microsoft.com%2FFiles.ReadWrite${_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveBusiness !== true ? ".AppFolder" : ""}%20https%3A%2F%2Fgraph.microsoft.com%2FUser.Read%20offline_access`);
            });
        });
    }
    upload(encryption) {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveEncrypted === undefined) {
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveEncrypted = true;
            }
            const exportData = yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.backupGetExport(encryption, _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveEncrypted === true);
            const backup = JSON.stringify(exportData, null, 2);
            const token = yield this.getToken();
            if (!token) {
                return false;
            }
            return new Promise((resolve, reject) => {
                if (!token) {
                    return resolve(false);
                }
                try {
                    const xhr = new XMLHttpRequest();
                    const now = new Date().toISOString().slice(0, 10).replace(/-/g, "");
                    xhr.open("PUT", `https://graph.microsoft.com/v1.0/me/drive/special/approot:/${now}.json:/content`);
                    xhr.setRequestHeader("Authorization", "Bearer " + token);
                    xhr.setRequestHeader("Content-type", "application/octet-stream");
                    xhr.onreadystatechange = () => {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 401) {
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.removeItem("oneDriveToken");
                                return resolve(false);
                            }
                            try {
                                const res = JSON.parse(xhr.responseText);
                                if (!res.error) {
                                    resolve(true);
                                }
                                else {
                                    console.error(res.error.message);
                                    resolve(false);
                                }
                            }
                            catch (error) {
                                reject(error);
                            }
                        }
                        return;
                    };
                    xhr.send(backup);
                }
                catch (error) {
                    return reject(error);
                }
            });
        });
    }
    getUser() {
        return __awaiter(this, void 0, void 0, function* () {
            const token = yield this.getToken();
            if (!token) {
                return "Error: Access revoked or expired.";
            }
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            return new Promise((resolve) => {
                const xhr = new XMLHttpRequest();
                xhr.open("GET", "https://graph.microsoft.com/v1.0/me/");
                xhr.setRequestHeader("Authorization", "Bearer " + token);
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 401) {
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.oneDriveToken = undefined;
                            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                            resolve("Error: Response was 401. You will be logged out the next time you open Authenticator.");
                        }
                        try {
                            const res = JSON.parse(xhr.responseText);
                            if (!res.error) {
                                resolve(res.userPrincipalName);
                            }
                            else {
                                console.error(res.error.message);
                                resolve("Error");
                            }
                        }
                        catch (e) {
                            console.error(e);
                            resolve("Error");
                        }
                    }
                    return;
                };
                xhr.send();
            });
        });
    }
}


/***/ }),

/***/ "./src/models/credentials.ts":
/*!***********************************!*\
  !*** ./src/models/credentials.ts ***!
  \***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getCredentials: () => (/* binding */ getCredentials)
/* harmony export */ });
function getCredentials() {
    return {
        drive: {
            client_id: "",
            client_secret: "", // Google client secret
        },
        dropbox: {
            client_id: "", // Dropbox client ID
        },
        onedrive: {
            client_id: "",
            client_secret: "", // Microsoft Identity client secret
        },
    };
}


/***/ }),

/***/ "./src/models/encryption.ts":
/*!**********************************!*\
  !*** ./src/models/encryption.ts ***!
  \**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Encryption: () => (/* binding */ Encryption)
/* harmony export */ });
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! crypto-js */ "./node_modules/crypto-js/index.js");
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(crypto_js__WEBPACK_IMPORTED_MODULE_0__);

class Encryption {
    constructor(hash, keyId) {
        this.password = hash;
        this.keyId = keyId;
    }
    getEncryptedString(data) {
        if (!this.password) {
            return data;
        }
        else {
            return crypto_js__WEBPACK_IMPORTED_MODULE_0__.AES.encrypt(data, this.password).toString();
        }
    }
    decryptSecretString(secret) {
        try {
            const decryptedSecret = crypto_js__WEBPACK_IMPORTED_MODULE_0__.AES.decrypt(secret, this.password).toString(crypto_js__WEBPACK_IMPORTED_MODULE_0__.enc.Utf8);
            if (!decryptedSecret) {
                return null;
            }
            if (decryptedSecret.length < 8) {
                return null;
            }
            if (!/^[a-z2-7]+=*$/i.test(decryptedSecret) &&
                !/^[0-9a-f]+$/i.test(decryptedSecret) &&
                !/^blz-/.test(decryptedSecret) &&
                !/^bliz-/.test(decryptedSecret) &&
                !/^stm-/.test(decryptedSecret)) {
                return null;
            }
            return decryptedSecret;
        }
        catch (error) {
            return null;
        }
    }
    decryptEncSecret(entry) {
        try {
            if (!entry.encData) {
                return null;
            }
            const decryptedData = crypto_js__WEBPACK_IMPORTED_MODULE_0__.AES.decrypt(entry.encData, this.password).toString(crypto_js__WEBPACK_IMPORTED_MODULE_0__.enc.Utf8);
            if (!decryptedData) {
                return null;
            }
            return JSON.parse(decryptedData);
        }
        catch (error) {
            return null;
        }
    }
    getEncryptionStatus() {
        return this.password ? true : false;
    }
    updateEncryptionPassword(password) {
        this.password = password;
    }
    setEncryptionKeyId(id) {
        this.keyId = id;
    }
    getEncryptionKeyId() {
        return this.keyId;
    }
}


/***/ }),

/***/ "./src/models/exchange-rate.ts":
/*!*************************************!*\
  !*** ./src/models/exchange-rate.ts ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ExchangeRateService: () => (/* binding */ ExchangeRateService)
/* harmony export */ });
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
class ExchangeRateService {
    static fetchExchangeRates() {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                // Check cache first
                const cached = yield this.getCachedRates();
                if (cached) {
                    return cached;
                }
                // Fetch from the API
                const response = yield fetch("https://kurs.kausa.tech/");
                const data = yield response.json();
                // Parse the API response
                const rates = this.parseExchangeRates(data);
                // Cache the results
                yield this.cacheRates(rates);
                return rates;
            }
            catch (error) {
                console.error("Error fetching exchange rates:", error);
                throw error;
            }
        });
    }
    static parseExchangeRates(apiResponse) {
        const rates = [];
        if (!apiResponse.data || !Array.isArray(apiResponse.data)) {
            throw new Error("Invalid API response format");
        }
        apiResponse.data.forEach((item, index) => {
            const currencyCode = item.code;
            let rate = item.rate;
            // JPY rates should be divided by 100
            if (currencyCode === "JPY") {
                rate = rate / 100;
            }
            // Get country code for flag
            const countryCode = this.CURRENCY_TO_COUNTRY[currencyCode] || "";
            const flag = countryCode ? this.getFlagEmoji(countryCode) : "🏳️";
            // Get currency name
            const currencyName = this.CURRENCY_NAMES[currencyCode] || currencyCode;
            // Format rate with thousands separator
            const rateFormatted = this.formatNumber(rate);
            rates.push({
                no: index + 1,
                currency: currencyName,
                currencyCode,
                rate,
                rateFormatted,
                flag,
            });
        });
        return rates;
    }
    static getFlagEmoji(countryCode) {
        // Convert country code to flag emoji
        // EU flag is special case
        if (countryCode === "EU") {
            return "🇪🇺";
        }
        // Convert ISO country code to regional indicator symbols
        const codePoints = countryCode
            .toUpperCase()
            .split("")
            .map((char) => 127397 + char.charCodeAt(0));
        return String.fromCodePoint(...codePoints);
    }
    static formatNumber(num) {
        return new Intl.NumberFormat("id-ID", {
            minimumFractionDigits: 2,
            maximumFractionDigits: 2,
        }).format(num);
    }
    static getCachedRates() {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                const stored = yield chrome.storage.local.get([
                    this.CACHE_KEY,
                    this.CACHE_TIMESTAMP_KEY,
                ]);
                if (stored[this.CACHE_KEY] && stored[this.CACHE_TIMESTAMP_KEY]) {
                    const timestamp = stored[this.CACHE_TIMESTAMP_KEY];
                    const now = Date.now();
                    // Check if cache is still valid
                    if (now - timestamp < this.CACHE_DURATION) {
                        return stored[this.CACHE_KEY];
                    }
                }
                return null;
            }
            catch (error) {
                console.error("Error reading cache:", error);
                return null;
            }
        });
    }
    static cacheRates(rates) {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                yield chrome.storage.local.set({
                    [this.CACHE_KEY]: rates,
                    [this.CACHE_TIMESTAMP_KEY]: Date.now(),
                });
            }
            catch (error) {
                console.error("Error caching rates:", error);
            }
        });
    }
    static clearCache() {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                yield chrome.storage.local.remove([
                    this.CACHE_KEY,
                    this.CACHE_TIMESTAMP_KEY,
                ]);
            }
            catch (error) {
                console.error("Error clearing cache:", error);
            }
        });
    }
}
ExchangeRateService.CACHE_KEY = "exchangeRates";
ExchangeRateService.CACHE_TIMESTAMP_KEY = "exchangeRatesTimestamp";
ExchangeRateService.CACHE_DURATION = 3600000; // 1 hour in milliseconds
// Currency code to country code mapping for flags
ExchangeRateService.CURRENCY_TO_COUNTRY = {
    USD: "US",
    EUR: "EU",
    GBP: "GB",
    JPY: "JP",
    AUD: "AU",
    CAD: "CA",
    CHF: "CH",
    CNY: "CN",
    HKD: "HK",
    NZD: "NZ",
    SEK: "SE",
    KRW: "KR",
    SGD: "SG",
    NOK: "NO",
    MXN: "MX",
    INR: "IN",
    RUB: "RU",
    ZAR: "ZA",
    TRY: "TR",
    BRL: "BR",
    TWD: "TW",
    DKK: "DK",
    PLN: "PL",
    THB: "TH",
    IDR: "ID",
    HUF: "HU",
    CZK: "CZ",
    ILS: "IL",
    CLP: "CL",
    PHP: "PH",
    AED: "AE",
    COP: "CO",
    SAR: "SA",
    MYR: "MY",
    RON: "RO",
    VND: "VN",
    ARS: "AR",
    IQD: "IQ", // Iraqi Dinar
};
// Currency full names
ExchangeRateService.CURRENCY_NAMES = {
    USD: "US Dollar",
    EUR: "Euro",
    GBP: "British Pound",
    JPY: "Japanese Yen",
    AUD: "Australian Dollar",
    CAD: "Canadian Dollar",
    CHF: "Swiss Franc",
    CNY: "Chinese Yuan",
    HKD: "Hong Kong Dollar",
    NZD: "New Zealand Dollar",
    SEK: "Swedish Krona",
    KRW: "South Korean Won",
    SGD: "Singapore Dollar",
    NOK: "Norwegian Krone",
    MXN: "Mexican Peso",
    INR: "Indian Rupee",
    RUB: "Russian Ruble",
    ZAR: "South African Rand",
    TRY: "Turkish Lira",
    BRL: "Brazilian Real",
    TWD: "Taiwan Dollar",
    DKK: "Danish Krone",
    PLN: "Polish Zloty",
    THB: "Thai Baht",
    IDR: "Indonesian Rupiah",
    HUF: "Hungarian Forint",
    CZK: "Czech Koruna",
    ILS: "Israeli Shekel",
    CLP: "Chilean Peso",
    PHP: "Philippine Peso",
    AED: "UAE Dirham",
    COP: "Colombian Peso",
    SAR: "Saudi Riyal",
    MYR: "Malaysian Ringgit",
    RON: "Romanian Leu",
    VND: "Vietnamese Dong",
    ARS: "Argentine Peso",
    IQD: "Iraqi Dinar",
};



/***/ }),

/***/ "./src/models/key-utilities.ts":
/*!*************************************!*\
  !*** ./src/models/key-utilities.ts ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   KeyUtilities: () => (/* binding */ KeyUtilities)
/* harmony export */ });
/* harmony import */ var _otp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./otp */ "./src/models/otp.ts");
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! crypto-js */ "./node_modules/crypto-js/index.js");
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(crypto_js__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var node_gost_crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! node-gost-crypto */ "./node_modules/node-gost-crypto/index.js");
/* harmony import */ var node_gost_crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(node_gost_crypto__WEBPACK_IMPORTED_MODULE_2__);



// Originally based on the JavaScript implementation as provided by Russell
// Sayers on his Tin Isles blog:
// http://blog.tinisles.com/2011/10/google-authenticator-one-time-password-algorithm-in-javascript/
// Rewrite with TypeScript by Sneezry https://github.com/Sneezry
class KeyUtilities {
    static dec2hex(s) {
        return (s < 15.5 ? "0" : "") + Math.round(s).toString(16);
    }
    static hex2dec(s) {
        return Number(`0x${s}`);
    }
    static hex2str(hex) {
        let str = "";
        for (let i = 0; i < hex.length; i += 2) {
            str += String.fromCharCode(this.hex2dec(hex.substr(i, 2)));
        }
        return str;
    }
    static leftpad(str, len, pad) {
        if (len + 1 >= str.length) {
            str = new Array(len + 1 - str.length).join(pad) + str;
        }
        return str;
    }
    static base32tohex(base32) {
        const base32chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
        let bits = "";
        let hex = "";
        let padding = 0;
        for (let i = 0; i < base32.length; i++) {
            if (base32.charAt(i) === "=") {
                bits += "00000";
                padding++;
            }
            else {
                const val = base32chars.indexOf(base32.charAt(i).toUpperCase());
                bits += this.leftpad(val.toString(2), 5, "0");
            }
        }
        for (let i = 0; i + 4 <= bits.length; i += 4) {
            const chunk = bits.substr(i, 4);
            hex = hex + Number(`0b${chunk}`).toString(16);
        }
        // if (hex.length % 2 && hex[hex.length - 1] === '0') {
        //   hex = hex.substr(0, hex.length - 1);
        // }
        switch (padding) {
            case 0:
                break;
            case 6:
                hex = hex.substr(0, hex.length - 8);
                break;
            case 4:
                hex = hex.substr(0, hex.length - 6);
                break;
            case 3:
                hex = hex.substr(0, hex.length - 4);
                break;
            case 1:
                hex = hex.substr(0, hex.length - 2);
                break;
            default:
                throw new Error("Invalid Base32 string");
        }
        return hex;
    }
    static base26(num) {
        const chars = "23456789BCDFGHJKMNPQRTVWXY";
        let output = "";
        const len = 5;
        for (let i = 0; i < len; i++) {
            output += chars[num % chars.length];
            num = Math.floor(num / chars.length);
        }
        if (output.length < len) {
            output = new Array(len - output.length + 1).join(chars[0]) + output;
        }
        return output;
    }
    static cryptoJsWordArrayToUint8Array(wordArray) {
        const l = wordArray.sigBytes;
        const words = wordArray.words;
        const result = new Uint8Array(l);
        let i = 0 /*dst*/, j = 0; /*src*/
        while (i < l) {
            // here i is a multiple of 4
            const w = words[j++];
            result[i++] = (w & 0xff000000) >>> 24;
            if (i === l)
                break;
            result[i++] = (w & 0x00ff0000) >>> 16;
            if (i === l)
                break;
            result[i++] = (w & 0x0000ff00) >>> 8;
            if (i === l)
                break;
            result[i++] = w & 0x000000ff;
        }
        return result;
    }
    static generate(type, secret, counter, period, len, algorithm, clockOffset) {
        secret = secret.replace(/\s/g, "");
        if (!len) {
            len = 6;
        }
        let b26 = false;
        let key;
        switch (type) {
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp:
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp:
                key = this.base32tohex(secret);
                break;
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hex:
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex:
                key = secret;
                break;
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.battle:
                key = this.base32tohex(secret);
                len = 8;
                break;
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.steam:
                key = this.base32tohex(secret);
                len = 10;
                b26 = true;
                break;
            default:
                key = this.base32tohex(secret);
        }
        if (!key) {
            throw new Error("Invalid secret key");
        }
        if (type !== _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp && type !== _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex) {
            let epoch = Math.round(new Date().getTime() / 1000.0);
            if (clockOffset) {
                epoch = epoch + Number(clockOffset);
            }
            counter = Math.floor(epoch / period);
        }
        const time = this.leftpad(this.dec2hex(counter), 16, "0");
        if (key.length % 2 === 1) {
            if (key.substr(-1) === "0") {
                key = key.substr(0, key.length - 1);
            }
            else {
                key += "0";
            }
        }
        let alg;
        let gostCipher;
        let hmacObj;
        switch (algorithm) {
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA256:
                hmacObj = crypto_js__WEBPACK_IMPORTED_MODULE_1__.HmacSHA256(crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(time), crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(key));
                break;
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA512:
                hmacObj = crypto_js__WEBPACK_IMPORTED_MODULE_1__.HmacSHA512(crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(time), crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(key));
                break;
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.GOST3411_2012_256:
            case _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.GOST3411_2012_512:
                alg = {
                    mode: "HMAC",
                    name: "GOST R 34.11",
                    version: 2012,
                    length: _otp__WEBPACK_IMPORTED_MODULE_0__.OTPUtil.getOTPAlgorithmSpec(algorithm).length,
                };
                gostCipher = node_gost_crypto__WEBPACK_IMPORTED_MODULE_2__.gostEngine.getGostDigest(alg);
                hmacObj = crypto_js__WEBPACK_IMPORTED_MODULE_1__.lib.WordArray.create(gostCipher.sign(this.cryptoJsWordArrayToUint8Array(crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(key)), this.cryptoJsWordArrayToUint8Array(crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(time))));
                break;
            default:
                hmacObj = crypto_js__WEBPACK_IMPORTED_MODULE_1__.HmacSHA1(crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(time), crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.parse(key));
                break;
        }
        const hmac = crypto_js__WEBPACK_IMPORTED_MODULE_1__.enc.Hex.stringify(hmacObj);
        const offset = this.hex2dec(hmac.substring(hmac.length - 1));
        let otp = (this.hex2dec(hmac.substr(offset * 2, 8)) & this.hex2dec("7fffffff")) +
            "";
        if (b26) {
            return this.base26(Number(otp));
        }
        if (otp.length < len) {
            otp = new Array(len - otp.length + 1).join("0") + otp;
        }
        return otp.substr(otp.length - len, len).toString();
    }
}


/***/ }),

/***/ "./src/models/otp.ts":
/*!***************************!*\
  !*** ./src/models/otp.ts ***!
  \***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CodeState: () => (/* binding */ CodeState),
/* harmony export */   DataType: () => (/* binding */ DataType),
/* harmony export */   OTPAlgorithm: () => (/* binding */ OTPAlgorithm),
/* harmony export */   OTPEntry: () => (/* binding */ OTPEntry),
/* harmony export */   OTPType: () => (/* binding */ OTPType),
/* harmony export */   OTPUtil: () => (/* binding */ OTPUtil)
/* harmony export */ });
/* harmony import */ var _key_utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./key-utilities */ "./src/models/key-utilities.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./settings */ "./src/models/settings.ts");
/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storage */ "./src/models/storage.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



var OTPType;
(function (OTPType) {
    OTPType[OTPType["totp"] = 1] = "totp";
    OTPType[OTPType["hotp"] = 2] = "hotp";
    OTPType[OTPType["battle"] = 3] = "battle";
    OTPType[OTPType["steam"] = 4] = "steam";
    OTPType[OTPType["hex"] = 5] = "hex";
    OTPType[OTPType["hhex"] = 6] = "hhex";
})(OTPType || (OTPType = {}));
var CodeState;
(function (CodeState) {
    CodeState["Invalid"] = "-1";
    CodeState["Encrypted"] = "-2";
})(CodeState || (CodeState = {}));
var OTPAlgorithm;
(function (OTPAlgorithm) {
    OTPAlgorithm[OTPAlgorithm["SHA1"] = 1] = "SHA1";
    OTPAlgorithm[OTPAlgorithm["SHA256"] = 2] = "SHA256";
    OTPAlgorithm[OTPAlgorithm["SHA512"] = 3] = "SHA512";
    OTPAlgorithm[OTPAlgorithm["GOST3411_2012_256"] = 4] = "GOST3411_2012_256";
    OTPAlgorithm[OTPAlgorithm["GOST3411_2012_512"] = 5] = "GOST3411_2012_512";
})(OTPAlgorithm || (OTPAlgorithm = {}));
var DataType;
(function (DataType) {
    DataType["OTPStorage"] = "OTPStorage";
    DataType["EncOTPStorage"] = "EncOTPStorage";
    DataType["Key"] = "Key";
})(DataType || (DataType = {}));
class OTPUtil {
    static getOTPAlgorithmSpec(otpAlgorithm) {
        switch (otpAlgorithm) {
            case OTPAlgorithm.GOST3411_2012_256:
                return { length: 256 };
            case OTPAlgorithm.GOST3411_2012_512:
                return { length: 512 };
            default:
                return { length: 0 };
        }
    }
}
class OTPEntry {
    constructor(entry, encryption) {
        this.code = "&bull;&bull;&bull;&bull;&bull;&bull;";
        this.encryption = encryption;
        this.index = entry.index;
        if ("keyId" in entry) {
            this.encData = entry.encData;
            this.secret = null;
            this.hash = entry.hash;
            this.keyId = entry.keyId;
            // defaults
            this.type = OTPType.totp;
            this.issuer = "";
            this.account = "";
            this.counter = 0;
            this.period = 30;
            this.digits = 6;
            this.algorithm = OTPAlgorithm.SHA1;
            this.pinned = false;
            return;
        }
        else if (entry.encrypted) {
            // v2 encryption backwards compat logic
            this.secret = null;
            this.encSecret = entry.secret;
        }
        else {
            this.secret = entry.secret;
        }
        this.type = entry.type;
        if (entry.issuer) {
            this.issuer = entry.issuer;
        }
        else {
            this.issuer = "";
        }
        if (entry.account) {
            this.account = entry.account;
        }
        else {
            this.account = "";
        }
        if (entry.hash) {
            this.hash = entry.hash;
        }
        else {
            this.hash = crypto.randomUUID();
        }
        if (entry.counter) {
            this.counter = entry.counter;
        }
        else {
            this.counter = 0;
        }
        if (entry.digits) {
            this.digits = entry.digits;
        }
        else {
            this.digits = 6;
        }
        if (entry.algorithm) {
            this.algorithm = entry.algorithm;
        }
        else {
            this.algorithm = OTPAlgorithm.SHA1;
        }
        if (entry.pinned) {
            this.pinned = entry.pinned;
        }
        else {
            this.pinned = false;
        }
        if (this.type === OTPType.totp && entry.period) {
            this.period = entry.period;
        }
        else {
            this.period = 30;
        }
        if (this.type !== OTPType.hotp && this.type !== OTPType.hhex) {
            this.generate();
        }
    }
    create() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.add(this);
            return;
        });
    }
    update() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.update(this);
            return;
        });
    }
    changeEncryption(encryption) {
        if (!this.secret) {
            return;
        }
        this.encryption = encryption;
        return;
    }
    applyEncryption(encryption) {
        if (!encryption || !encryption.getEncryptionStatus()) {
            return;
        }
        if (this.encSecret) {
            // v2 encryption
            this.secret = encryption.decryptSecretString(this.encSecret);
            if (this.secret) {
                this.encSecret = "";
            }
            return;
        }
        // check if its a rawotpstorage
        const decryptedData = encryption.decryptEncSecret(this);
        if (decryptedData === null) {
            return;
        }
        if ((decryptedData === null || decryptedData === void 0 ? void 0 : decryptedData.dataType) !== "OTPStorage") {
            console.warn("Decrypt successful, but malformed encData!", this.hash);
        }
        if (decryptedData.hash !== this.hash) {
            console.warn("Decrypt successful, but hash mismatch!", this.hash, decryptedData.hash);
        }
        this.account = decryptedData.account || "";
        // @ts-expect-error need a better way to do this
        this.algorithm = OTPAlgorithm[decryptedData.algorithm] || OTPAlgorithm.SHA1;
        this.counter = decryptedData.counter || 0;
        this.digits = decryptedData.digits || 6;
        this.issuer = decryptedData.issuer || "";
        this.period = decryptedData.period || 30;
        this.pinned = decryptedData.pinned || false;
        this.secret = decryptedData.secret;
        // @ts-expect-error need a better way to do this
        this.type = OTPType[decryptedData.type] || OTPType.totp;
        if (this.type !== OTPType.hotp && this.type !== OTPType.hhex) {
            this.generate();
        }
        this.encryption = encryption;
        this.encData = "";
    }
    delete() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _storage__WEBPACK_IMPORTED_MODULE_2__.EntryStorage.delete(this);
            return;
        });
    }
    next() {
        return __awaiter(this, void 0, void 0, function* () {
            if (this.type !== OTPType.hotp && this.type !== OTPType.hhex) {
                return;
            }
            this.generate();
            if (this.secret !== null) {
                this.counter++;
                yield this.update();
            }
            return;
        });
    }
    genUUID() {
        this.hash = crypto.randomUUID();
    }
    generate() {
        const offset = _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items ? _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.offset : 0;
        if (!_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items) {
            // browser storage is async, so we need to wait for it to load
            // and re-generate the code
            // don't change the code to async, it will break the mutation
            // for Accounts store to export data
            _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems().then(() => {
                this.generate();
            });
        }
        if (!this.secret && !this.encData) {
            this.code = CodeState.Invalid;
        }
        else if (!this.secret) {
            this.code = CodeState.Encrypted;
        }
        else {
            try {
                this.code = _key_utilities__WEBPACK_IMPORTED_MODULE_0__.KeyUtilities.generate(this.type, this.secret, this.counter, this.period, this.digits, this.algorithm, offset);
            }
            catch (error) {
                this.code = CodeState.Invalid;
                console.warn("Invalid secret.", error);
            }
        }
    }
}


/***/ }),

/***/ "./src/models/password.ts":
/*!********************************!*\
  !*** ./src/models/password.ts ***!
  \********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   argonHash: () => (/* binding */ argonHash),
/* harmony export */   argonVerify: () => (/* binding */ argonVerify),
/* harmony export */   verifyPasswordUsingKey: () => (/* binding */ verifyPasswordUsingKey),
/* harmony export */   verifyPasswordUsingKeyID: () => (/* binding */ verifyPasswordUsingKeyID)
/* harmony export */ });
/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storage */ "./src/models/storage.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

function argonHash(value, salt) {
    return __awaiter(this, void 0, void 0, function* () {
        const iframe = document.getElementById("argon-sandbox");
        const message = {
            action: "hash",
            value,
            salt,
        };
        if (!iframe) {
            throw new Error("argon-sandbox missing!");
        }
        const argonPromise = new Promise((resolve) => {
            window.addEventListener("message", (response) => {
                resolve(response.data.response);
            });
            // @ts-expect-error bad typings
            iframe.contentWindow.postMessage(message, "*");
        });
        return argonPromise;
    });
}
function argonVerify(value, hash) {
    return __awaiter(this, void 0, void 0, function* () {
        const iframe = document.getElementById("argon-sandbox");
        const message = {
            action: "verify",
            value,
            hash,
        };
        if (!iframe) {
            throw new Error("argon-sandbox missing!");
        }
        const argonPromise = new Promise((resolve) => {
            window.addEventListener("message", (response) => {
                resolve(response.data.response);
            });
            // @ts-expect-error bad typings
            iframe.contentWindow.postMessage(message, "*");
        });
        return argonPromise;
    });
}
// Verify a password using keys in BrowserStorage
function verifyPasswordUsingKeyID(keyId, password) {
    return __awaiter(this, void 0, void 0, function* () {
        // Get key for current encryption
        const keys = yield _storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys();
        if ((0,_storage__WEBPACK_IMPORTED_MODULE_0__.isOldKey)(keys)) {
            throw new Error("v3 encryption not being used with verifyPassword. This should never happen!");
        }
        const key = keys.find((key) => key.id === keyId);
        if (!key) {
            throw new Error(`Key ${keyId} not in BrowserStorage`);
        }
        return verifyPasswordUsingKey(key, password);
    });
}
function verifyPasswordUsingKey(key, password) {
    return __awaiter(this, void 0, void 0, function* () {
        // Hash password with argon
        const rawHash = yield argonHash(password, key.salt);
        if (!rawHash) {
            throw new Error("argon2 did not return a hash!");
        }
        // https://passlib.readthedocs.io/en/stable/lib/passlib.hash.argon2.html#format-algorithm
        const possibleHash = rawHash.split("$")[5];
        // verify user password by comparing their password hash with the
        // hash of their password's hash
        return yield argonVerify(possibleHash, key.hash);
    });
}


/***/ }),

/***/ "./src/models/settings.ts":
/*!********************************!*\
  !*** ./src/models/settings.ts ***!
  \********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   StorageLocation: () => (/* binding */ StorageLocation),
/* harmony export */   UserSettings: () => (/* binding */ UserSettings)
/* harmony export */ });
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var StorageLocation;
(function (StorageLocation) {
    StorageLocation["Sync"] = "sync";
    StorageLocation["Local"] = "local";
})(StorageLocation || (StorageLocation = {}));
// Maybe we can have a better way to define this
const LocalUserSettingsDataKeys = [
    "driveEncrypted",
    "driveFolder",
    "driveRefreshToken",
    "driveRevoked",
    "driveToken",
    "dropboxEncrypted",
    "dropboxRevoked",
    "dropboxToken",
    "lastRemindingBackupTime",
    "offset",
    "oneDriveBusiness",
    "oneDriveEncrypted",
    "oneDriveRevoked",
    "oneDriveRefreshToken",
    "oneDriveToken",
    "storageLocation",
];
class UserSettings {
    static updateItems() {
        return __awaiter(this, void 0, void 0, function* () {
            UserSettings.items = yield UserSettings.getAllItems();
        });
    }
    static convertFromLocalStorage(data, location) {
        return __awaiter(this, void 0, void 0, function* () {
            const settings = {};
            for (const key in data) {
                if (isBooleanOption(key)) {
                    settings[key] = data[key] === "true";
                }
                else if (isNumberOption(key)) {
                    settings[key] = Number(data[key]);
                }
                else if (isJSONOption(key)) {
                    settings[key] = JSON.parse(data[key]);
                }
                else {
                    settings[key] = data[key];
                }
            }
            settings.storageLocation = location;
            UserSettings.items = settings;
            yield UserSettings.commitItems();
        });
    }
    static commitItems() {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = UserSettings.items.storageLocation || StorageLocation.Local;
            if (storageLocation === StorageLocation.Local) {
                yield chrome.storage[storageLocation].set({
                    // JSON.parse(JSON.stringify()) strips functions (e.g. getItem, setItem, ...) which may have been added to the object.
                    // Without this, a crash may occur as chrome.storage throws an error when trying to serialize a function.
                    UserSettings: JSON.parse(JSON.stringify(UserSettings.items)),
                });
            }
            else {
                const { syncableSettings, localSettings } = UserSettings.splitSettings(UserSettings.items);
                yield Promise.all([
                    chrome.storage[StorageLocation.Local].set({
                        UserSettings: JSON.parse(JSON.stringify(localSettings)),
                    }),
                    chrome.storage[StorageLocation.Sync].set({
                        UserSettings: JSON.parse(JSON.stringify(syncableSettings)),
                    }),
                ]);
            }
            yield UserSettings.updateItems();
        });
    }
    static removeItem(key) {
        var _a;
        return __awaiter(this, void 0, void 0, function* () {
            const localSettings = yield UserSettings.getStorageData(StorageLocation.Local);
            const storageLocation = localSettings.storageLocation || StorageLocation.Local;
            const location = LocalUserSettingsDataKeys.includes(key)
                ? StorageLocation.Local
                : storageLocation;
            const storageData = ((_a = (yield chrome.storage[location].get("UserSettings"))) === null || _a === void 0 ? void 0 : _a.UserSettings) || {};
            delete storageData[key];
            UserSettings.items = storageData;
            yield UserSettings.commitItems();
        });
    }
    static getStorageData(location) {
        var _a;
        return __awaiter(this, void 0, void 0, function* () {
            const storageData = ((_a = (yield chrome.storage[location].get("UserSettings"))) === null || _a === void 0 ? void 0 : _a.UserSettings) || {};
            return storageData;
        });
    }
    static splitSettings(storageData) {
        const syncableSettings = Object.assign({}, storageData);
        const localSettings = Object.assign({}, storageData);
        let key;
        for (key in storageData) {
            if (LocalUserSettingsDataKeys.includes(key)) {
                delete syncableSettings[key];
            }
            else {
                delete localSettings[key];
            }
        }
        return {
            syncableSettings,
            localSettings,
        };
    }
    static getAllItems() {
        return __awaiter(this, void 0, void 0, function* () {
            const localSettings = yield UserSettings.getStorageData(StorageLocation.Local);
            const storageLocation = localSettings.storageLocation || StorageLocation.Local;
            if (storageLocation === StorageLocation.Local) {
                return localSettings;
            }
            const syncableSettings = yield UserSettings.getStorageData(StorageLocation.Sync);
            return Object.assign(Object.assign({}, syncableSettings), localSettings);
        });
    }
}
UserSettings.items = {};

function isBooleanOption(key) {
    return [
        "autofill",
        "driveEncrypted",
        "driveRevoked",
        "dropboxEncrypted",
        "dropboxRevoked",
        "enableContextMenu",
        "oneDriveBusiness",
        "oneDriveEncrypted",
        "oneDriveRevoked",
        "smartFilter",
    ].includes(key);
}
function isNumberOption(key) {
    return ["autolock", "lastRemindingBackupTime", "offset", "zoom"].includes(key);
}
function isJSONOption(key) {
    return ["advisorIgnoreList"].includes(key);
}


/***/ }),

/***/ "./src/models/storage.ts":
/*!*******************************!*\
  !*** ./src/models/storage.ts ***!
  \*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   BrowserStorage: () => (/* binding */ BrowserStorage),
/* harmony export */   EntryStorage: () => (/* binding */ EntryStorage),
/* harmony export */   ManagedStorage: () => (/* binding */ ManagedStorage),
/* harmony export */   isOldKey: () => (/* binding */ isOldKey)
/* harmony export */ });
/* harmony import */ var _otp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./otp */ "./src/models/otp.ts");
/* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



class BrowserStorage {
    static getStorageLocation() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.updateItems();
            const managedLocation = yield ManagedStorage.get("storageArea");
            if (managedLocation === _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync ||
                managedLocation === _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Local) {
                return new Promise((resolve) => {
                    if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation !== managedLocation) {
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation = managedLocation;
                        _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                    }
                    resolve(managedLocation);
                    return;
                });
            }
            else if (_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation !== _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync &&
                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation !== _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Local) {
                return new Promise((resolve, reject) => {
                    let amountSync;
                    let amountLocal;
                    chrome.storage.local.get((local) => {
                        amountLocal = Object.keys(local).length;
                        if (local.LocalStorage) {
                            amountLocal--;
                        }
                        try {
                            chrome.storage.sync.get((sync) => {
                                amountSync = Object.keys(sync).length;
                                // If storage location can't be found try to auto-detect storage
                                // location
                                if (amountLocal > amountSync && amountSync === 0) {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation = _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Local;
                                }
                                else if (amountLocal < amountSync && amountLocal === 0) {
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation = _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync;
                                }
                                else {
                                    // Use default
                                    _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation = _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync;
                                }
                                _settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.commitItems();
                                resolve(_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation);
                                return;
                            });
                        }
                        catch (error) {
                            reject(error);
                            return;
                        }
                    });
                });
            }
            else {
                return new Promise((resolve) => {
                    resolve(_settings__WEBPACK_IMPORTED_MODULE_1__.UserSettings.items.storageLocation || _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync);
                    return;
                });
            }
        });
    }
    // TODO: promise this
    static get() {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = yield this.getStorageLocation();
            const removeOtherData = function (items) {
                delete items.key;
                delete items.LocalStorage;
                for (const itemId in items) {
                    const item = items[itemId];
                    if (item !== null &&
                        typeof item === "object" &&
                        "dataType" in item &&
                        item.dataType === "Key") {
                        delete items[itemId];
                    }
                }
            };
            let items = {};
            if (storageLocation === "local") {
                items = yield chrome.storage.local.get();
            }
            else if (storageLocation === "sync") {
                items = yield chrome.storage.sync.get();
            }
            removeOtherData(items);
            return items;
        });
    }
    static getKeys() {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = yield this.getStorageLocation();
            const data = (yield chrome.storage[storageLocation].get());
            // Return old key first, so we know to run a migration
            if (data && typeof data === "object" && "key" in data) {
                if (isOldKey(data.key)) {
                    return data.key;
                }
                else {
                    console.error("'key' is malformed!");
                }
            }
            const keys = [];
            if (data && typeof data === "object") {
                for (const record in data) {
                    const key = data[record];
                    if (isKey(key)) {
                        keys.push(key);
                    }
                }
            }
            return keys;
        });
    }
    static set(data) {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = yield this.getStorageLocation();
            if (storageLocation === _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Local) {
                yield chrome.storage.local.set(data);
            }
            else if (storageLocation === _settings__WEBPACK_IMPORTED_MODULE_1__.StorageLocation.Sync) {
                yield chrome.storage.sync.set(data);
            }
            return;
        });
    }
    static remove(data) {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = yield this.getStorageLocation();
            if (storageLocation === "local") {
                yield chrome.storage.local.remove(data);
            }
            else if (storageLocation === "sync") {
                yield chrome.storage.sync.remove(data);
            }
            return;
        });
    }
    // Use for Chrome only.
    // https://github.com/Authenticator-Extension/Authenticator/issues/412
    static clearLogs() {
        return __awaiter(this, void 0, void 0, function* () {
            const storageLocation = yield this.getStorageLocation();
            if (storageLocation === "local") {
                const data = yield chrome.storage.local.get();
                yield chrome.storage.local.clear();
                yield chrome.storage.local.set(data);
            }
            else if (storageLocation === "sync") {
                const data = yield chrome.storage.sync.get();
                yield chrome.storage.sync.clear();
                yield chrome.storage.sync.set(data);
            }
        });
    }
}
function isOldKey(key) {
    return Boolean(key &&
        typeof key === "object" &&
        "enc" in key &&
        "hash" in key &&
        key.enc &&
        key.hash &&
        typeof key.enc === "string" &&
        typeof key.hash === "string");
}
function isKey(key) {
    return Boolean(key &&
        typeof key === "object" &&
        "dataType" in key &&
        "id" in key &&
        "salt" in key &&
        key.dataType === "Key" &&
        key.id &&
        key.salt &&
        typeof key.id === "string" &&
        typeof key.salt === "string");
}
class EntryStorage {
    static getOTPStorageFromEntry(entry, unencrypted) {
        var _a, _b, _c;
        let secret;
        if (!entry.secret && entry.encData && entry.keyId) {
            return {
                dataType: _otp__WEBPACK_IMPORTED_MODULE_0__.DataType.EncOTPStorage,
                keyId: entry.keyId,
                data: entry.encData,
                index: entry.index,
            };
        }
        else if (entry.secret) {
            secret = entry.secret;
        }
        else {
            secret = "";
            console.warn("Invalid entry", entry);
        }
        let encrypted = ((_a = entry.encryption) === null || _a === void 0 ? void 0 : _a.getEncryptionStatus()) || false;
        if (unencrypted && entry.secret) {
            secret = entry.secret;
            encrypted = false;
        }
        const storageItem = {
            encrypted,
            hash: entry.hash,
            index: entry.index,
            type: _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[entry.type],
            secret,
        };
        if (entry.pinned) {
            storageItem.pinned = true;
        }
        if (entry.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp || entry.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex) {
            storageItem.counter = entry.counter;
        }
        if (entry.period && entry.period !== 30) {
            storageItem.period = entry.period;
        }
        if (entry.issuer) {
            storageItem.issuer = entry.issuer;
        }
        if (entry.account) {
            storageItem.account = entry.account;
        }
        if (entry.digits && entry.digits !== 6) {
            storageItem.digits = entry.digits;
        }
        if (entry.algorithm && entry.algorithm !== _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA1) {
            storageItem.algorithm = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm[entry.algorithm];
        }
        if ((_b = entry.encryption) === null || _b === void 0 ? void 0 : _b.getEncryptionKeyId()) {
            storageItem.keyId = entry.encryption.getEncryptionKeyId();
        }
        storageItem.dataType = _otp__WEBPACK_IMPORTED_MODULE_0__.DataType.OTPStorage;
        if (!unencrypted &&
            encrypted &&
            ((_c = entry.encryption) === null || _c === void 0 ? void 0 : _c.getEncryptionStatus()) &&
            entry.encryption.getEncryptionKeyId()) {
            const encData = entry.encryption.getEncryptedString(JSON.stringify(storageItem));
            return {
                dataType: _otp__WEBPACK_IMPORTED_MODULE_0__.DataType.EncOTPStorage,
                data: encData,
                keyId: entry.encryption.getEncryptionKeyId(),
                index: entry.index,
            };
        }
        else if (encrypted) {
            console.error("Could not encrypt malformed entry: ", entry);
        }
        return storageItem;
    }
    static ensureUniqueIndex(data) {
        const tempEntryArray = [];
        for (const hash of Object.keys(data)) {
            if (hash === "UserSettings" ||
                data[hash].dataType === "Key" ||
                !this.isValidEntry(data, hash)) {
                continue;
            }
            tempEntryArray.push([hash, data[hash]]);
        }
        tempEntryArray.sort((a, b) => {
            return a[1].index - b[1].index;
        });
        let i = 0;
        const newData = tempEntryArray.reduce((previous, entry) => {
            const mergedData = Object.assign(Object.assign({}, previous), { [entry[0]]: Object.assign(Object.assign({}, entry[1]), { index: i }) });
            i += 1;
            return mergedData;
        }, {});
        return newData;
    }
    static isOTPStorage(entry) {
        if (typeof entry !== "object") {
            return false;
        }
        if (!entry || !("secret" in entry || "data" in entry)) {
            return false;
        }
        return true;
    }
    static isValidEntry(_data, hash) {
        if (typeof _data[hash] !== "object") {
            console.log('Key "' + hash + '" is not an object');
            return false;
        }
        else {
            if (!this.isOTPStorage(_data[hash])) {
                console.log('Key "' + hash + '" is not OTPStorage');
                return false;
            }
            return true;
        }
    }
    static hasEncryptionKey() {
        return __awaiter(this, void 0, void 0, function* () {
            const keys = yield BrowserStorage.getKeys();
            if (isOldKey(keys)) {
                return true;
            }
            else {
                return keys.length !== 0;
            }
        });
    }
    static getExport(data, encrypted) {
        try {
            const exportData = {};
            for (const entry of data) {
                // Skip unable-decrypted data
                if (entry.code === _otp__WEBPACK_IMPORTED_MODULE_0__.CodeState.Encrypted || !entry.secret) {
                    continue;
                }
                exportData[entry.hash] = this.getOTPStorageFromEntry(entry, !encrypted);
            }
            return exportData;
        }
        catch (error) {
            return error;
        }
    }
    static backupGetExport(encryption, encrypted) {
        return __awaiter(this, void 0, void 0, function* () {
            const _data = yield BrowserStorage.get();
            for (const hash of Object.keys(_data)) {
                if (hash === "UserSettings" ||
                    _data[hash].dataType === "Key" ||
                    !this.isValidEntry(_data, hash)) {
                    delete _data[hash];
                    continue;
                }
                const entry = _data[hash];
                // TODO: fix this
                if (entry.dataType === "EncOTPStorage") {
                    continue;
                }
                // remove unnecessary fields
                if (!(entry.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp]) &&
                    !(entry.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex])) {
                    delete entry.counter;
                }
                if (entry.period === 30) {
                    delete entry.period;
                }
                if (!entry.issuer) {
                    delete entry.issuer;
                }
                if (!entry.account) {
                    delete entry.account;
                }
                if (entry.digits === 6) {
                    delete entry.digits;
                }
                if (entry.algorithm === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA1]) {
                    delete entry.algorithm;
                }
                delete entry.pinned;
                if (!encrypted) {
                    // decrypt the data to export
                    if (entry.encrypted) {
                        const decryptedSecret = encryption.decryptSecretString(entry.secret);
                        if (decryptedSecret !== entry.secret && decryptedSecret !== null) {
                            entry.secret = decryptedSecret;
                            entry.encrypted = false;
                        }
                    }
                    // we need correct hash
                    if (hash !== entry.hash) {
                        _data[entry.hash] = entry;
                        delete _data[hash];
                    }
                }
            }
            if (encryption.getEncryptionStatus()) {
                const keys = yield BrowserStorage.getKeys();
                if (isOldKey(keys)) {
                    Object.assign(_data, { key: keys });
                }
                else {
                    for (const key of keys) {
                        Object.assign(_data, { [key.id]: key });
                    }
                }
            }
            return _data;
        });
    }
    static import(encryption, data) {
        return __awaiter(this, void 0, void 0, function* () {
            let _data = yield BrowserStorage.get();
            for (const hash of Object.keys(data)) {
                // never trust data import from user
                // data must be decrypted before calling this method
                if (!data[hash].secret || data[hash].encrypted) {
                    // TODO: we need give a failed warning
                    continue;
                }
                const rawAlgorithm = data[hash].algorithm;
                const entryData = {
                    type: parseInt(data[hash].type) || _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp],
                    index: data[hash].index || 0,
                    issuer: data[hash].issuer || "",
                    account: data[hash].account || "",
                    encrypted: false,
                    secret: data[hash].secret,
                    counter: data[hash].counter || 0,
                    period: data[hash].period || 30,
                    digits: data[hash].digits || 6,
                    algorithm: rawAlgorithm
                        ? parseInt(rawAlgorithm)
                        : _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA1,
                    pinned: data[hash].pinned || false,
                    hash: data[hash].hash || hash,
                };
                if (isNaN(entryData.period) || entryData.period <= 0) {
                    entryData.period = 30;
                }
                // If invalid digits, then use default.
                if (entryData.digits > 10 || entryData.digits < 1) {
                    entryData.digits = 6;
                }
                // If invalid algorithm, then use default
                if (!_otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm[entryData.algorithm]) {
                    entryData.algorithm = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm.SHA1;
                }
                if (/^(blz-|bliz-)/.test(entryData.secret)) {
                    const secretMatches = entryData.secret.match(/^(blz-|bliz-)(.*)/);
                    if (secretMatches && secretMatches.length >= 3) {
                        entryData.secret = secretMatches[2];
                        entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.battle;
                    }
                }
                if (/^stm-/.test(entryData.secret)) {
                    const secretMatches = entryData.secret.match(/^stm-(.*)/);
                    if (secretMatches && secretMatches.length >= 2) {
                        entryData.secret = secretMatches[1];
                        entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.steam;
                    }
                }
                if (!/^[a-z2-7]+=*$/i.test(entryData.secret) &&
                    /^[0-9a-f]+$/i.test(entryData.secret) &&
                    entryData.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp) {
                    entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hex;
                }
                if (!/^[a-z2-7]+=*$/i.test(entryData.secret) &&
                    /^[0-9a-f]+$/i.test(entryData.secret) &&
                    entryData.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hotp) {
                    entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.hhex;
                }
                // not a valid / old hash
                if (!/^[a-f0-9]{8}-?[a-f0-9]{4}-?4[a-f0-9]{3}-?[89ab][a-f0-9]{3}-?[a-f0-9]{12}$/.test(hash)) {
                    entryData.hash = crypto.randomUUID();
                    delete data[hash];
                }
                const entry = new _otp__WEBPACK_IMPORTED_MODULE_0__.OTPEntry(entryData, encryption);
                _data[entryData.hash] = this.getOTPStorageFromEntry(entry);
            }
            _data = this.ensureUniqueIndex(_data);
            yield BrowserStorage.set(_data);
        });
    }
    static add(entry) {
        return __awaiter(this, void 0, void 0, function* () {
            yield BrowserStorage.set({
                [entry.hash]: this.getOTPStorageFromEntry(entry),
            });
        });
    }
    static update(entry) {
        return __awaiter(this, void 0, void 0, function* () {
            let _data = yield BrowserStorage.get();
            if (!Object.prototype.hasOwnProperty.call(_data, entry.hash)) {
                throw new Error("Entry to change does not exist.");
            }
            const storageItem = this.getOTPStorageFromEntry(entry);
            _data[entry.hash] = storageItem;
            _data = this.ensureUniqueIndex(_data);
            yield BrowserStorage.set(_data);
        });
    }
    static set(entries) {
        return __awaiter(this, void 0, void 0, function* () {
            let _data = yield BrowserStorage.get();
            entries.forEach((entry) => {
                const storageItem = this.getOTPStorageFromEntry(entry);
                _data[entry.hash] = storageItem;
            });
            _data = this.ensureUniqueIndex(_data);
            yield BrowserStorage.set(_data);
        });
    }
    static get() {
        return __awaiter(this, void 0, void 0, function* () {
            const _data = yield BrowserStorage.get();
            const data = [];
            for (const hash of Object.keys(_data)) {
                if (hash === "UserSettings" ||
                    _data[hash].dataType === "Key" ||
                    !this.isValidEntry(_data, hash)) {
                    continue;
                }
                const entryData = _data[hash];
                if (entryData.dataType === "EncOTPStorage") {
                    data.push(new _otp__WEBPACK_IMPORTED_MODULE_0__.OTPEntry({
                        encrypted: true,
                        encData: entryData.data,
                        keyId: entryData.keyId,
                        hash,
                        index: entryData.index,
                    }));
                    continue;
                }
                if (!entryData.hash) {
                    entryData.hash = hash;
                }
                if (!entryData.type) {
                    entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp];
                }
                let type;
                switch (entryData.type) {
                    case "totp":
                    case "hotp":
                    case "battle":
                    case "steam":
                    case "hex":
                    case "hhex":
                        type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[entryData.type];
                        break;
                    default:
                        // we need correct the type here
                        // and save it
                        type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp;
                        entryData.type = _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp];
                }
                let period;
                if (entryData.type === _otp__WEBPACK_IMPORTED_MODULE_0__.OTPType[_otp__WEBPACK_IMPORTED_MODULE_0__.OTPType.totp] &&
                    entryData.period &&
                    entryData.period > 0) {
                    period = entryData.period;
                }
                const entry = new _otp__WEBPACK_IMPORTED_MODULE_0__.OTPEntry({
                    account: entryData.account,
                    encrypted: entryData.encrypted,
                    hash: entryData.hash,
                    index: entryData.index,
                    issuer: entryData.issuer,
                    secret: entryData.secret,
                    type,
                    counter: entryData.counter,
                    period,
                    digits: entryData.digits ? Number(entryData.digits) : undefined,
                    // @ts-expect-error - it's fine if this ends up undefined
                    algorithm: _otp__WEBPACK_IMPORTED_MODULE_0__.OTPAlgorithm[entryData.algorithm],
                    pinned: entryData.pinned,
                });
                data.push(entry);
            }
            data.sort((a, b) => {
                return a.index - b.index;
            });
            return data;
        });
    }
    static remove(hash) {
        return __awaiter(this, void 0, void 0, function* () {
            yield BrowserStorage.remove(hash);
        });
    }
    static delete(entry) {
        return __awaiter(this, void 0, void 0, function* () {
            let _data = yield BrowserStorage.get();
            if (Object.prototype.hasOwnProperty.call(_data, entry.hash)) {
                delete _data[entry.hash];
            }
            _data = this.ensureUniqueIndex(_data);
            yield BrowserStorage.remove(entry.hash);
            yield BrowserStorage.set(_data);
        });
    }
}
class ManagedStorage {
    static get(key, defaultValue) {
        const managedStoragePromise = new Promise((resolve) => {
            if (chrome.storage.managed) {
                chrome.storage.managed.get((data) => {
                    if (chrome.runtime.lastError) {
                        return resolve(defaultValue);
                    }
                    if (data) {
                        if (data[key]) {
                            return resolve(data[key]);
                        }
                    }
                    return resolve(defaultValue);
                });
            }
            else {
                // no available in Safari
                resolve(defaultValue);
            }
        });
        const timeoutPromise = new Promise((resolve) => {
            setTimeout(() => resolve(defaultValue), 10);
        });
        return Promise.race([managedStoragePromise, timeoutPromise]);
    }
}


/***/ }),

/***/ "./src/store/Accounts.ts":
/*!*******************************!*\
  !*** ./src/store/Accounts.ts ***!
  \*******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Accounts: () => (/* binding */ Accounts)
/* harmony export */ });
/* harmony import */ var _models_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models/storage */ "./src/models/storage.ts");
/* harmony import */ var _models_encryption__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models/encryption */ "./src/models/encryption.ts");
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! crypto-js */ "./node_modules/crypto-js/index.js");
/* harmony import */ var crypto_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto_js__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _models_otp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../models/otp */ "./src/models/otp.ts");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils */ "./src/utils.ts");
/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../browser */ "./src/browser.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};








const LegacyEncryption = "LegacyEncryption";
class Accounts {
    getModule() {
        return __awaiter(this, void 0, void 0, function* () {
            const cachedKeyInfo = yield this.getCachedKeyInfo();
            const encryption = new Map();
            if (cachedKeyInfo.cachedKeyId) {
                encryption.set(cachedKeyInfo.cachedKeyId, new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(cachedKeyInfo.cachedPassphrase, cachedKeyInfo.cachedKeyId));
            }
            const shouldShowPassphrase = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.hasEncryptionKey();
            const entries = shouldShowPassphrase ? [] : yield this.getEntries();
            yield _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.updateItems();
            return {
                state: {
                    entries,
                    encryption,
                    defaultEncryption: cachedKeyInfo.cachedKeyId,
                    OTPType: _models_otp__WEBPACK_IMPORTED_MODULE_3__.OTPType,
                    OTPAlgorithm: _models_otp__WEBPACK_IMPORTED_MODULE_3__.OTPAlgorithm,
                    shouldShowPassphrase,
                    sectorStart: false,
                    sectorOffset: 0,
                    second: 0,
                    filter: true,
                    siteName: yield (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getSiteName)(),
                    showSearch: false,
                    exportData: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(entries),
                    exportEncData: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(entries, true),
                    keys: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys(),
                    wrongPassword: false,
                    initComplete: false,
                },
                getters: {
                    shouldFilter(state, getters) {
                        return (_models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.smartFilter === true &&
                            getters.matchedEntries.length);
                    },
                    matchedEntries: (state) => {
                        return (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getMatchedEntriesHash)(state.siteName, state.entries);
                    },
                    currentlyEncrypted(state) {
                        for (const entry of state.entries) {
                            if (entry.secret === null) {
                                return true;
                            }
                        }
                        return false;
                    },
                    entries(state) {
                        const pinnedEntries = state.entries.filter((entry) => entry.pinned);
                        const unpinnedEntries = state.entries.filter((entry) => !entry.pinned);
                        return [...pinnedEntries, ...unpinnedEntries];
                    },
                },
                mutations: {
                    stopFilter(state) {
                        state.filter = false;
                    },
                    showSearch(state) {
                        state.showSearch = true;
                    },
                    updateCodes(state) {
                        let second = new Date().getSeconds();
                        if (_models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.offset) {
                            // prevent second from negative
                            second += Number(_models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.offset) + 60;
                        }
                        second = second % 60;
                        state.second = second;
                        let currentlyEncrypted = false;
                        for (const entry of state.entries) {
                            if (entry.secret === null) {
                                currentlyEncrypted = true;
                            }
                        }
                        if (!state.sectorStart &&
                            state.entries.length > 0 &&
                            !currentlyEncrypted) {
                            state.sectorStart = true;
                            state.sectorOffset = -second;
                        }
                        // if (second > 25) {
                        //   app.class.timeout = true;
                        // } else {
                        //   app.class.timeout = false;
                        // }
                        // if (second < 1) {
                        //   const entries = app.entries as OTP[];
                        //   for (let i = 0; i < entries.length; i++) {
                        //     if (entries[i].type !== OTPType.hotp &&
                        //         entries[i].type !== OTPType.hhex) {
                        //       entries[i].generate();
                        //     }
                        //   }
                        // }
                        const entries = state.entries;
                        for (let i = 0; i < entries.length; i++) {
                            if (entries[i].type !== _models_otp__WEBPACK_IMPORTED_MODULE_3__.OTPType.hotp &&
                                entries[i].type !== _models_otp__WEBPACK_IMPORTED_MODULE_3__.OTPType.hhex) {
                                entries[i].generate();
                            }
                        }
                    },
                    loadCodes(state, newCodes) {
                        state.entries = newCodes;
                    },
                    moveCode(state, opts) {
                        state.entries.splice(opts.to, 0, state.entries.splice(opts.from, 1)[0]);
                        for (let i = 0; i < state.entries.length; i++) {
                            if (state.entries[i].index !== i) {
                                state.entries[i].index = i;
                            }
                        }
                    },
                    pinEntry(state, entry) {
                        state.entries[entry.index].pinned = !entry.pinned;
                    },
                    updateExport(state, exportData) {
                        state.exportData = exportData;
                    },
                    updateEncExport(state, data) {
                        if ((0,_models_storage__WEBPACK_IMPORTED_MODULE_0__.isOldKey)(data.keys)) {
                            return;
                        }
                        const keys = data.keys.reduce((prev, key) => {
                            prev[key.id] = key;
                            return prev;
                        }, {});
                        state.exportEncData = Object.assign(Object.assign({}, data.entries), keys);
                    },
                    wrongPassword(state) {
                        state.wrongPassword = true;
                    },
                    initComplete(state) {
                        state.initComplete = true;
                    },
                },
                actions: {
                    deleteCode: (state, hash) => __awaiter(this, void 0, void 0, function* () {
                        const index = state.state.entries.findIndex((entry) => entry.hash === hash);
                        if (index > -1) {
                            state.state.entries.splice(index, 1);
                        }
                        state.commit("updateExport", yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries));
                        state.commit("updateEncExport", {
                            entries: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries, true),
                            keys: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys(),
                        });
                    }),
                    addCode: (state, entry) => __awaiter(this, void 0, void 0, function* () {
                        state.state.entries.unshift(entry);
                        state.commit("updateExport", yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries));
                        state.commit("updateEncExport", {
                            entries: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries, true),
                            keys: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys(),
                        });
                    }),
                    applyPassphrase: (state, password) => __awaiter(this, void 0, void 0, function* () {
                        var _a;
                        if (!password) {
                            return;
                        }
                        state.commit("currentView/changeView", "LoadingPage", { root: true });
                        // Decrypt entries
                        let saltedHash = "";
                        let migrationNeeded = false;
                        const encKeys = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys();
                        if ((0,_models_storage__WEBPACK_IMPORTED_MODULE_0__.isOldKey)(encKeys)) {
                            // --- handle v2 encryption
                            // decrypt using key
                            const key = crypto_js__WEBPACK_IMPORTED_MODULE_2__.AES.decrypt(encKeys.enc, password).toString();
                            const isCorrectPassword = yield new Promise((resolve) => {
                                const iframe = document.getElementById("argon-sandbox");
                                const message = {
                                    action: "verify",
                                    value: key,
                                    hash: encKeys.hash,
                                };
                                if (iframe) {
                                    window.addEventListener("message", (response) => {
                                        resolve(response.data.response);
                                    });
                                    // @ts-expect-error - bad typings
                                    iframe.contentWindow.postMessage(message, "*");
                                }
                            });
                            if (!isCorrectPassword) {
                                state.commit("wrongPassword");
                                state.commit("currentView/changeView", "EnterPasswordPage", {
                                    root: true,
                                });
                                return;
                            }
                            state.state.encryption.set(LegacyEncryption, new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(key, LegacyEncryption));
                            migrationNeeded = true;
                        }
                        else if (encKeys.length === 0) {
                            // --- handle v1 encryption
                            // verify current password
                            state.state.encryption.set(LegacyEncryption, new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(password, LegacyEncryption));
                            yield state.dispatch("updateEntries");
                            if (state.getters.currentlyEncrypted) {
                                state.commit("wrongPassword");
                                state.commit("currentView/changeView", "EnterPasswordPage", {
                                    root: true,
                                });
                                return;
                            }
                            migrationNeeded = true;
                        }
                        else {
                            // --- handle v3 encryption
                            // TODO: let user reconcile multiple keys from sync conflicts
                            for (const key of encKeys) {
                                const rawHash = yield new Promise((resolve) => {
                                    const iframe = document.getElementById("argon-sandbox");
                                    const message = {
                                        action: "hash",
                                        value: password,
                                        salt: key.salt,
                                    };
                                    if (iframe) {
                                        window.addEventListener("message", (response) => {
                                            resolve(response.data.response);
                                        });
                                        // @ts-expect-error bad typings
                                        iframe.contentWindow.postMessage(message, "*");
                                    }
                                });
                                // https://passlib.readthedocs.io/en/stable/lib/passlib.hash.argon2.html#format-algorithm
                                const possibleHash = rawHash.split("$")[5];
                                if (!possibleHash) {
                                    throw new Error("argon2 did not return a hash!");
                                }
                                // verify user password by comparing their password hash with the
                                // hash of their password's hash
                                const isCorrectPassword = yield new Promise((resolve) => {
                                    const iframe = document.getElementById("argon-sandbox");
                                    const message = {
                                        action: "verify",
                                        value: possibleHash,
                                        hash: key.hash,
                                    };
                                    if (iframe) {
                                        window.addEventListener("message", (response) => {
                                            resolve(response.data.response);
                                        });
                                        // @ts-expect-error bad typings
                                        iframe.contentWindow.postMessage(message, "*");
                                    }
                                });
                                // TODO: there is a serious bug here. If two keys have the same password,
                                // then only one of them will be used for decryption.
                                if (isCorrectPassword) {
                                    state.state.encryption.set(key.id, new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(possibleHash, key.id));
                                    state.state.defaultEncryption = key.id;
                                    saltedHash = possibleHash;
                                }
                            }
                            yield state.dispatch("updateEntries");
                            if (!saltedHash) {
                                state.commit("wrongPassword");
                                state.commit("currentView/changeView", "EnterPasswordPage", {
                                    root: true,
                                });
                                return;
                            }
                        }
                        // Migrate from older encryption if needed
                        if (migrationNeeded) {
                            // gen hashes
                            // The hash of the user's password is used as the encryption key for user data.
                            const rawSaltedHash = yield genHash(password);
                            // https://passlib.readthedocs.io/en/stable/lib/passlib.hash.argon2.html#format-algorithm
                            const salt = window.atob(rawSaltedHash.split("$")[4]);
                            saltedHash = rawSaltedHash.split("$")[5];
                            // This hash is used to verify that a user decrypted `saltedHash` correctly
                            const hashOfHash = yield genHash(saltedHash);
                            if (!saltedHash || !hashOfHash) {
                                throw new Error("argon2 did not return a hash!");
                            }
                            // update entry encryption
                            const key = {
                                dataType: _models_otp__WEBPACK_IMPORTED_MODULE_3__.DataType.Key,
                                id: crypto.randomUUID(),
                                salt: salt,
                                hash: hashOfHash,
                                version: 3,
                            };
                            const newEncryption = new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(saltedHash, key.id);
                            state.state.encryption.set(key.id, newEncryption);
                            state.state.defaultEncryption = key.id;
                            const toRemove = [];
                            for (const entry of state.state.entries) {
                                if (!entry.secret) {
                                    continue;
                                }
                                yield entry.changeEncryption(newEncryption);
                                // if not uuidv4 regen
                                if (/[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i.test(entry.hash)) {
                                    entry.genUUID();
                                    toRemove.push(entry.hash);
                                }
                            }
                            // store key
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.set({
                                [key.id]: key,
                            });
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.set(state.state.entries);
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.remove(toRemove);
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.remove("key");
                            yield state.dispatch("updateEntries");
                        }
                        if (!saltedHash) {
                            throw new Error("Empty saltedHash! This should never happen.");
                        }
                        // Encrypt any unencrypted entries.
                        // Browser sync can cause unencrypted entries to show up.
                        let needUpdateStorage = false;
                        const defaultEncryption = state.state.encryption.get(state.state.defaultEncryption);
                        if (!defaultEncryption) {
                            throw new Error("defaultEncryption is empty, this should never happen!");
                        }
                        for (const entry of state.state.entries) {
                            if (((_a = entry.encryption) === null || _a === void 0 ? void 0 : _a.getEncryptionKeyId()) !==
                                state.state.defaultEncryption) {
                                yield entry.changeEncryption(defaultEncryption);
                                needUpdateStorage = true;
                            }
                        }
                        if (needUpdateStorage) {
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.set(state.state.entries);
                            yield state.dispatch("updateEntries");
                        }
                        if (!state.getters.currentlyEncrypted) {
                            chrome.runtime.sendMessage({
                                action: "cachePassphrase",
                                value: saltedHash,
                                keyId: defaultEncryption.getEncryptionKeyId(),
                            });
                        }
                        state.commit("style/hideInfo", true, { root: true });
                        return;
                    }),
                    changePassphrase: (state, password) => __awaiter(this, void 0, void 0, function* () {
                        var _b, _c;
                        if (password) {
                            // The hash of the user's password is used as the encryption key for user data.
                            const rawSaltedHash = yield genHash(password);
                            // https://passlib.readthedocs.io/en/stable/lib/passlib.hash.argon2.html#format-algorithm
                            const salt = window.atob(rawSaltedHash.split("$")[4]);
                            const saltedHash = rawSaltedHash.split("$")[5];
                            // This hash is used to verify that a user decrypted `saltedHash` correctly
                            const hashOfHash = yield genHash(saltedHash);
                            if (!saltedHash || !hashOfHash) {
                                throw new Error("argon2 did not return a hash!");
                            }
                            // change entry encryption and regen hash
                            const removeKeys = [];
                            const keys = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys();
                            if ((0,_models_storage__WEBPACK_IMPORTED_MODULE_0__.isOldKey)(keys)) {
                                throw new Error("OldKey still being used. This should never happen!");
                            }
                            const key = {
                                dataType: _models_otp__WEBPACK_IMPORTED_MODULE_3__.DataType.Key,
                                id: crypto.randomUUID(),
                                salt: salt,
                                hash: hashOfHash,
                                version: 3,
                            };
                            const linkedKeys = new Map();
                            for (const entry of state.state.entries) {
                                yield entry.changeEncryption(new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(saltedHash, key.id));
                                // if not uuidv4 regen
                                if (/[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}/i.test(entry.hash)) {
                                    removeKeys.push(entry.hash);
                                    entry.genUUID();
                                }
                                if ((_b = entry.encryption) === null || _b === void 0 ? void 0 : _b.getEncryptionKeyId()) {
                                    linkedKeys.set(entry.encryption.getEncryptionKeyId(), undefined);
                                }
                            }
                            // store key
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.set({
                                [key.id]: key,
                            });
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.set(state.state.entries);
                            // remove unlinked keys when there is at least one entry
                            if (state.state.entries.length !== 0) {
                                for (const storedKey of keys) {
                                    if (!linkedKeys.has(storedKey.id)) {
                                        removeKeys.push(storedKey.id);
                                    }
                                }
                            }
                            if (removeKeys.length) {
                                yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.remove(removeKeys);
                            }
                            state.state.encryption.set(key.id, new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption(saltedHash, key.id));
                            state.state.defaultEncryption = key.id;
                            yield state.dispatch("updateEntries");
                            // https://github.com/Authenticator-Extension/Authenticator/issues/412
                            if (_browser__WEBPACK_IMPORTED_MODULE_5__.isChromium) {
                                yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.clearLogs();
                            }
                            chrome.runtime.sendMessage({
                                action: "cachePassphrase",
                                value: saltedHash,
                                keyId: key.id,
                            });
                        }
                        else {
                            for (const entry of state.state.entries) {
                                yield entry.changeEncryption(new _models_encryption__WEBPACK_IMPORTED_MODULE_1__.Encryption("", ""));
                            }
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.set(state.state.entries);
                            yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.remove("key");
                            const keyId = (_c = state.state.encryption
                                .get(state.state.defaultEncryption)) === null || _c === void 0 ? void 0 : _c.getEncryptionKeyId();
                            if (keyId) {
                                yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.remove(keyId);
                            }
                            state.state.defaultEncryption = "";
                            yield state.dispatch("updateEntries");
                            chrome.runtime.sendMessage({
                                action: "lock",
                            });
                        }
                        // remove cached passphrase in old version
                        _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.encodedPhrase = undefined;
                        yield _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.removeItem("encodedPhrase");
                    }),
                    updateEntries: (state) => __awaiter(this, void 0, void 0, function* () {
                        const entries = yield this.getEntries();
                        for (const entry of entries) {
                            // LegacyEncryption indicates that we need to use backwards compatibility logic
                            if (entry.encSecret) {
                                const legacyEncryption = state.state.encryption.get(LegacyEncryption);
                                if (legacyEncryption) {
                                    yield entry.applyEncryption(legacyEncryption);
                                }
                            }
                            else if (entry.keyId) {
                                const entryEncryption = state.state.encryption.get(entry.keyId);
                                if (entryEncryption) {
                                    yield entry.applyEncryption(entryEncryption);
                                }
                            }
                        }
                        state.commit("loadCodes", entries);
                        state.commit("updateCodes");
                        state.commit("updateExport", yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries));
                        state.commit("updateEncExport", {
                            entries: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.getExport(state.state.entries, true),
                            keys: yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.BrowserStorage.getKeys(),
                        });
                        state.commit("initComplete");
                        return;
                    }),
                    clearFilter: (state) => {
                        state.commit("stopFilter");
                        if (state.state.entries.length >= 10) {
                            state.commit("showSearch");
                        }
                    },
                    migrateStorage: (state, newStorageLocation) => __awaiter(this, void 0, void 0, function* () {
                        // sync => local
                        if (_models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.storageLocation === _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Sync &&
                            newStorageLocation === _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Local) {
                            const syncData = yield chrome.storage.sync.get();
                            yield chrome.storage.local.set(syncData); // userSettings will be handled later
                            const localData = yield chrome.storage.local.get();
                            // Double check if data was set
                            if (Object.keys(syncData).every((value) => Object.keys(localData).indexOf(value) >= 0)) {
                                _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.storageLocation = _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Local;
                                yield chrome.storage.sync.clear();
                                yield chrome.storage.local.set({
                                    UserSettings: _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items,
                                });
                                return "updateSuccess";
                            }
                            else {
                                throw " All data not transferred successfully.";
                            }
                            // local => sync
                        }
                        else if (_models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.storageLocation === _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Local &&
                            newStorageLocation === _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Sync) {
                            const localData = yield chrome.storage.local.get();
                            if (localData === null || localData === void 0 ? void 0 : localData.UserSettings) {
                                delete localData.UserSettings;
                                yield chrome.storage.sync.set(localData);
                            }
                            const syncData = yield chrome.storage.sync.get();
                            // Double check if data was set
                            if (Object.keys(localData).every((value) => Object.keys(syncData).indexOf(value) >= 0)) {
                                _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.items.storageLocation = _models_settings__WEBPACK_IMPORTED_MODULE_6__.StorageLocation.Sync;
                                yield chrome.storage.local.clear();
                                yield _models_settings__WEBPACK_IMPORTED_MODULE_6__.UserSettings.commitItems();
                                return "updateSuccess";
                            }
                            else {
                                throw " All data not transferred successfully.";
                            }
                        }
                        // No change
                        return "updateSuccess";
                    }),
                },
                namespaced: true,
            };
        });
    }
    getCachedKeyInfo() {
        return __awaiter(this, void 0, void 0, function* () {
            const { cachedPassphrase, cachedKeyId, } = yield chrome.storage.session.get();
            return { cachedPassphrase, cachedKeyId };
        });
    }
    getEntries() {
        return __awaiter(this, void 0, void 0, function* () {
            const otpEntries = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.get();
            return otpEntries;
        });
    }
}
function genHash(value) {
    return __awaiter(this, void 0, void 0, function* () {
        const randomValues = window.crypto.getRandomValues(new Uint16Array(8));
        let salt = "";
        for (const byte of randomValues) {
            salt += byte.toString(16);
        }
        return new Promise((resolve) => {
            const iframe = document.getElementById("argon-sandbox");
            const message = {
                action: "hash",
                value: value,
                salt,
            };
            if (iframe) {
                window.addEventListener("message", (response) => {
                    resolve(response.data.response);
                });
                // @ts-expect-error bad typings
                iframe.contentWindow.postMessage(message, "*");
            }
        });
    });
}


/***/ }),

/***/ "./src/store/Advisor.ts":
/*!******************************!*\
  !*** ./src/store/Advisor.ts ***!
  \******************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Advisor: () => (/* binding */ Advisor)
/* harmony export */ });
/* harmony import */ var _models_storage__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models/storage */ "./src/models/storage.ts");
/* harmony import */ var _models_advisor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models/advisor */ "./src/models/advisor.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};



const insightsData = [
    {
        id: "passwordNotSet",
        level: _models_advisor__WEBPACK_IMPORTED_MODULE_1__.InsightLevel.danger,
        description: chrome.i18n.getMessage("advisor_insight_password_not_set"),
        validation: () => __awaiter(void 0, void 0, void 0, function* () {
            const hasEncryptedEntry = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.hasEncryptionKey();
            return !hasEncryptedEntry;
        }),
    },
    {
        id: "autoLockNotSet",
        level: _models_advisor__WEBPACK_IMPORTED_MODULE_1__.InsightLevel.warning,
        description: chrome.i18n.getMessage("advisor_insight_auto_lock_not_set"),
        validation: () => __awaiter(void 0, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            const hasEncryptedEntry = yield _models_storage__WEBPACK_IMPORTED_MODULE_0__.EntryStorage.hasEncryptionKey();
            return hasEncryptedEntry && !Number(_models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.autolock);
        }),
    },
    {
        id: "browserSyncNotEnabled",
        level: _models_advisor__WEBPACK_IMPORTED_MODULE_1__.InsightLevel.info,
        description: chrome.i18n.getMessage("advisor_insight_browser_sync_not_enabled"),
        validation: () => __awaiter(void 0, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            const storageArea = _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.storageLocation;
            return storageArea !== _models_settings__WEBPACK_IMPORTED_MODULE_2__.StorageLocation.Sync;
        }),
    },
    {
        id: "autoFillNotEnabled",
        level: _models_advisor__WEBPACK_IMPORTED_MODULE_1__.InsightLevel.info,
        description: chrome.i18n.getMessage("advisor_insight_auto_fill_not_enabled"),
        validation: () => __awaiter(void 0, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            return _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.autofill !== true;
        }),
    },
    {
        id: "smartFilterNotEnabled",
        level: _models_advisor__WEBPACK_IMPORTED_MODULE_1__.InsightLevel.info,
        description: chrome.i18n.getMessage("advisor_insight_smart_filter_not_enabled"),
        validation: () => __awaiter(void 0, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            return _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.smartFilter === false;
        }),
    },
];
class Advisor {
    getModule() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            return {
                state: {
                    insights: yield this.getInsights(),
                    ignoreList: _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList || [],
                },
                mutations: {
                    dismissInsight: (state, insightId) => __awaiter(this, void 0, void 0, function* () {
                        state.ignoreList.push(insightId);
                        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList = state.ignoreList;
                        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.commitItems();
                        state.insights = yield this.getInsights();
                    }),
                    clearIgnoreList: (state) => __awaiter(this, void 0, void 0, function* () {
                        state.ignoreList = [];
                        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList = undefined;
                        _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.commitItems();
                        state.insights = yield this.getInsights();
                    }),
                    updateInsight: (state) => __awaiter(this, void 0, void 0, function* () {
                        state.insights = yield this.getInsights();
                        state.ignoreList =
                            typeof _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList === "string"
                                ? JSON.parse(_models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList || "[]")
                                : _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList || [];
                    }),
                },
                namespaced: true,
            };
        });
    }
    getInsights() {
        return __awaiter(this, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.updateItems();
            const advisorIgnoreList = typeof _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList === "string"
                ? JSON.parse(_models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList || "[]")
                : _models_settings__WEBPACK_IMPORTED_MODULE_2__.UserSettings.items.advisorIgnoreList || [];
            const filteredInsightsData = [];
            for (const insightData of insightsData) {
                if (advisorIgnoreList.includes(insightData.id)) {
                    continue;
                }
                const validation = yield insightData.validation();
                if (validation) {
                    filteredInsightsData.push(insightData);
                }
            }
            return filteredInsightsData.map((insightData) => new _models_advisor__WEBPACK_IMPORTED_MODULE_1__.AdvisorInsight(insightData));
        });
    }
}


/***/ }),

/***/ "./src/store/Backup.ts":
/*!*****************************!*\
  !*** ./src/store/Backup.ts ***!
  \*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Backup: () => (/* binding */ Backup)
/* harmony export */ });
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

class Backup {
    getModule() {
        return __awaiter(this, void 0, void 0, function* () {
            _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.updateItems();
            return {
                state: {
                    dropboxEncrypted: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.dropboxEncrypted === true,
                    driveEncrypted: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.driveEncrypted === true,
                    oneDriveEncrypted: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.oneDriveEncrypted === true,
                    dropboxToken: Boolean(_models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.dropboxToken),
                    driveToken: Boolean(_models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.driveToken),
                    oneDriveToken: Boolean(_models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.oneDriveToken),
                },
                mutations: {
                    setToken(state, args) {
                        switch (args.service) {
                            case "dropbox":
                                state.dropboxToken = args.value;
                                break;
                            case "drive":
                                state.driveToken = args.value;
                                break;
                            case "onedrive":
                                state.oneDriveToken = args.value;
                                break;
                            default:
                                break;
                        }
                    },
                    setEnc(state, args) {
                        switch (args.service) {
                            case "dropbox":
                                state.dropboxEncrypted = args.value;
                                break;
                            case "drive":
                                state.driveEncrypted = args.value;
                                break;
                            case "onedrive":
                                state.oneDriveEncrypted = args.value;
                                break;
                            default:
                                break;
                        }
                    },
                },
                namespaced: true,
            };
        });
    }
}


/***/ }),

/***/ "./src/store/CurrentView.ts":
/*!**********************************!*\
  !*** ./src/store/CurrentView.ts ***!
  \**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CurrentView: () => (/* binding */ CurrentView)
/* harmony export */ });
class CurrentView {
    getModule() {
        return {
            state: {
                info: "",
            },
            mutations: {
                changeView(state, viewName) {
                    state.info = viewName;
                },
            },
            namespaced: true,
        };
    }
}


/***/ }),

/***/ "./src/store/Menu.ts":
/*!***************************!*\
  !*** ./src/store/Menu.ts ***!
  \***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Menu: () => (/* binding */ Menu)
/* harmony export */ });
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../models/settings */ "./src/models/settings.ts");
/* harmony import */ var _models_storage__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../models/storage */ "./src/models/storage.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};


class Menu {
    getModule() {
        var _a;
        return __awaiter(this, void 0, void 0, function* () {
            yield _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.updateItems();
            // Load company setup status
            const stored = yield chrome.storage.local.get([
                "companyName",
                "companySetupCompleted",
            ]);
            const menuState = {
                state: {
                    version: ((_a = chrome.runtime.getManifest()) === null || _a === void 0 ? void 0 : _a.version) || "0.0.0",
                    zoom: Number(_models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.zoom) || 100,
                    useAutofill: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.autofill !== false,
                    smartFilter: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.smartFilter === true,
                    enableContextMenu: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.enableContextMenu === true,
                    theme: _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.theme || "normal",
                    autolock: Number(_models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.autolock) || 30,
                    backupDisabled: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("disableBackup", false),
                    exportDisabled: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("disableExport", false),
                    enforcePassword: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("enforcePassword", false),
                    enforceAutolock: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("enforceAutolock", false),
                    storageArea: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("storageArea"),
                    feedbackURL: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("feedbackURL"),
                    passwordPolicy: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("passwordPolicy"),
                    passwordPolicyHint: yield _models_storage__WEBPACK_IMPORTED_MODULE_1__.ManagedStorage.get("passwordPolicyHint"),
                    companyName: stored.companyName || "",
                    companySetupCompleted: stored.companySetupCompleted || false,
                },
                mutations: {
                    setZoom: (state, zoom) => {
                        state.zoom = zoom;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.zoom = zoom;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                        this.resize(zoom);
                    },
                    setAutofill(state, useAutofill) {
                        state.useAutofill = useAutofill;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.autofill = useAutofill;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                    },
                    setSmartFilter(state, smartFilter) {
                        state.smartFilter = smartFilter;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.smartFilter = smartFilter;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                    },
                    setEnableContextMenu(state, enableContextMenu) {
                        state.enableContextMenu = enableContextMenu;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.enableContextMenu = enableContextMenu;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                    },
                    setTheme(state, theme) {
                        state.theme = theme;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.theme = theme;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                    },
                    setAutolock(state, autolock) {
                        state.autolock = autolock;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.autolock = autolock;
                        _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                    },
                    setCompanyName(state, companyName) {
                        state.companyName = companyName;
                    },
                    setCompanySetupCompleted(state, completed) {
                        state.companySetupCompleted = completed;
                    },
                },
                namespaced: true,
            };
            this.resize(menuState.state.zoom);
            return menuState;
        });
    }
    resize(zoom) {
        if (zoom !== 100) {
            document.body.style.marginBottom = 480 * (zoom / 100 - 1) + "px";
            document.body.style.marginRight = 400 * (zoom / 100 - 1) + "px";
            document.body.style.transform = "scale(" + zoom / 100 + ")";
        }
    }
}


/***/ }),

/***/ "./src/store/Notification.ts":
/*!***********************************!*\
  !*** ./src/store/Notification.ts ***!
  \***********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Notification: () => (/* binding */ Notification)
/* harmony export */ });
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
class Notification {
    getModule() {
        return {
            state: {
                message: [],
                confirmMessage: "",
                messageIdle: true,
                notification: "", // Ephermal message text
            },
            mutations: {
                alert: (state, message) => {
                    state.message.unshift(message);
                },
                closeAlert: (state) => {
                    state.messageIdle = false;
                    state.message.shift();
                    setTimeout(() => {
                        state.messageIdle = true;
                    }, 200);
                },
                setConfirm: (state, message) => {
                    state.confirmMessage = message;
                },
                setNotification: (state, message) => {
                    state.notification = message;
                },
            },
            actions: {
                confirm: (state, message) => __awaiter(this, void 0, void 0, function* () {
                    return new Promise((resolve) => {
                        state.commit("setConfirm", message);
                        window.addEventListener("confirm", (event) => {
                            state.commit("setConfirm", "");
                            if (!this.isCustomEvent(event)) {
                                resolve(false);
                                return;
                            }
                            resolve(event.detail);
                            return;
                        });
                    });
                }),
                ephermalMessage: (state, message) => {
                    state.commit("setNotification", message);
                    state.commit("style/showNotification", null, { root: true });
                },
            },
            namespaced: true,
        };
    }
    isCustomEvent(event) {
        return "detail" in event;
    }
}


/***/ }),

/***/ "./src/store/Qr.ts":
/*!*************************!*\
  !*** ./src/store/Qr.ts ***!
  \*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Qr: () => (/* binding */ Qr)
/* harmony export */ });
class Qr {
    getModule() {
        return {
            state: {
                qr: "",
            },
            mutations: {
                setQr(state, url) {
                    state.qr = `url(${url})`;
                },
            },
            namespaced: true,
        };
    }
}


/***/ }),

/***/ "./src/store/Style.ts":
/*!****************************!*\
  !*** ./src/store/Style.ts ***!
  \****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Style: () => (/* binding */ Style)
/* harmony export */ });
class Style {
    getModule() {
        return {
            state: {
                style: {
                    timeout: false,
                    isEditing: false,
                    slidein: false,
                    slideout: false,
                    fadein: false,
                    fadeout: false,
                    show: false,
                    qrfadein: false,
                    qrfadeout: false,
                    notificationFadein: false,
                    notificationFadeout: false,
                    hotpDisabled: false,
                    showExchangeRate: true,
                    activeTab: "authenticator", // authenticator or exchange-rate
                },
            },
            mutations: {
                showMenu(state) {
                    state.style.slidein = true;
                    state.style.slideout = false;
                },
                hideMenu(state) {
                    state.style.slidein = false;
                    state.style.slideout = true;
                    setTimeout(() => {
                        state.style.slideout = false;
                    }, 200);
                },
                showInfo(state, noAnimate) {
                    if (noAnimate) {
                        state.style.show = true;
                    }
                    else {
                        state.style.fadein = true;
                        state.style.fadeout = false;
                    }
                },
                hideInfo(state, noAnimate) {
                    if (noAnimate) {
                        state.style.show = false;
                    }
                    else {
                        state.style.fadein = false;
                        state.style.fadeout = true;
                    }
                    setTimeout(() => {
                        state.style.fadeout = false;
                    }, 200);
                },
                showQr(state) {
                    state.style.qrfadein = true;
                    state.style.qrfadeout = false;
                },
                hideQr(state) {
                    state.style.qrfadein = false;
                    state.style.qrfadeout = true;
                    setTimeout(() => {
                        state.style.qrfadeout = false;
                    }, 200);
                },
                showNotification(state) {
                    state.style.notificationFadein = true;
                    state.style.notificationFadeout = false;
                    setTimeout(() => {
                        state.style.notificationFadein = false;
                        state.style.notificationFadeout = true;
                        setTimeout(() => {
                            state.style.notificationFadeout = false;
                        }, 200);
                    }, 1000);
                },
                toggleEdit(state) {
                    state.style.isEditing = !state.style.isEditing;
                },
                toggleHotpDisabled(state) {
                    state.style.hotpDisabled = !state.style.hotpDisabled;
                },
                toggleExchangeRate(state) {
                    state.style.showExchangeRate = !state.style.showExchangeRate;
                },
                setActiveTab(state, tab) {
                    state.style.activeTab = tab;
                },
            },
            getters: {
                // Returns true if menu or info screen shown
                isMenuShown(state) {
                    return state.style.fadein || state.style.show || state.style.slidein;
                },
            },
            namespaced: true,
        };
    }
}


/***/ }),

/***/ "./src/store/i18n.ts":
/*!***************************!*\
  !*** ./src/store/i18n.ts ***!
  \***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   loadI18nMessages: () => (/* binding */ loadI18nMessages)
/* harmony export */ });
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
function loadI18nMessages() {
    return __awaiter(this, void 0, void 0, function* () {
        return new Promise((resolve, reject) => {
            try {
                const xhr = new XMLHttpRequest();
                xhr.overrideMimeType("application/json");
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        const i18nMessage = JSON.parse(xhr.responseText);
                        const i18nData = {};
                        for (const key of Object.keys(i18nMessage)) {
                            i18nData[key] = chrome.i18n.getMessage(key);
                        }
                        return resolve(i18nData);
                    }
                    return;
                };
                xhr.open("GET", chrome.runtime.getURL("/_locales/en/messages.json"));
                xhr.send();
            }
            catch (error) {
                if (typeof error === "string" || error === undefined) {
                    return reject(Error(error));
                }
                else if (error instanceof Error) {
                    return reject(error);
                }
                else {
                    return reject(Error(String(error)));
                }
            }
        });
    });
}


/***/ }),

/***/ "./src/syncTime.ts":
/*!*************************!*\
  !*** ./src/syncTime.ts ***!
  \*************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   syncTimeWithGoogle: () => (/* binding */ syncTimeWithGoogle)
/* harmony export */ });
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};

function syncTimeWithGoogle() {
    return __awaiter(this, void 0, void 0, function* () {
        yield _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.updateItems();
        return new Promise((resolve, reject) => {
            try {
                // @ts-expect-error - these typings are wrong
                const xhr = new XMLHttpRequest({ mozAnon: true });
                xhr.open("HEAD", "https://www.google.com/generate_204");
                const xhrAbort = setTimeout(() => {
                    xhr.abort();
                    return resolve("updateFailure");
                }, 5000);
                xhr.onreadystatechange = () => {
                    if (xhr.readyState === 4) {
                        clearTimeout(xhrAbort);
                        const date = xhr.getResponseHeader("date");
                        if (!date) {
                            return resolve("updateFailure");
                        }
                        const serverTime = new Date(date).getTime();
                        const clientTime = new Date().getTime();
                        const offset = Math.round((serverTime - clientTime) / 1000);
                        if (Math.abs(offset) <= 300) {
                            // within 5 minutes
                            _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.items.offset = Math.round((serverTime - clientTime) / 1000);
                            _models_settings__WEBPACK_IMPORTED_MODULE_0__.UserSettings.commitItems();
                            return resolve("updateSuccess");
                        }
                        else {
                            return resolve("clock_too_far_off");
                        }
                    }
                };
                xhr.send();
            }
            catch (error) {
                return reject(error);
            }
        });
    });
}


/***/ }),

/***/ "./src/utils.ts":
/*!**********************!*\
  !*** ./src/utils.ts ***!
  \**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getCurrentTab: () => (/* binding */ getCurrentTab),
/* harmony export */   getMatchedEntries: () => (/* binding */ getMatchedEntries),
/* harmony export */   getMatchedEntriesHash: () => (/* binding */ getMatchedEntriesHash),
/* harmony export */   getSiteName: () => (/* binding */ getSiteName),
/* harmony export */   okToInjectContentScript: () => (/* binding */ okToInjectContentScript)
/* harmony export */ });
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
function getSiteName() {
    var _a, _b, _c;
    return __awaiter(this, void 0, void 0, function* () {
        const tab = yield getCurrentTab();
        const query = new URLSearchParams(document.location.search.substring(1));
        let title;
        let url;
        const titleFromQuery = query.get("title");
        const urlFromQuery = query.get("url");
        if (titleFromQuery && urlFromQuery) {
            title = decodeURIComponent(titleFromQuery);
            url = decodeURIComponent(urlFromQuery);
        }
        else {
            if (!tab) {
                return [null, null];
            }
            title = (_b = (_a = tab.title) === null || _a === void 0 ? void 0 : _a.replace(/[^a-z0-9]/gi, "").toLowerCase()) !== null && _b !== void 0 ? _b : null;
            url = (_c = tab.url) !== null && _c !== void 0 ? _c : null;
        }
        if (!url) {
            return [title, null];
        }
        const urlParser = new URL(url);
        const hostname = urlParser.hostname; // it's always lower case
        // try to parse name from hostname
        // i.e. hostname is www.example.com
        // name should be example
        let nameFromDomain = "";
        // ip address
        if (/^\d+\.\d+\.\d+\.\d+$/.test(hostname)) {
            nameFromDomain = hostname;
        }
        // local network
        if (hostname.indexOf(".") === -1) {
            nameFromDomain = hostname;
        }
        const hostLevelUnits = hostname.split(".");
        if (hostLevelUnits.length === 2) {
            nameFromDomain = hostLevelUnits[0];
        }
        // www.example.com
        // example.com.cn
        if (hostLevelUnits.length > 2) {
            // example.com.cn
            if (["com", "net", "org", "edu", "gov", "co"].indexOf(hostLevelUnits[hostLevelUnits.length - 2]) !== -1) {
                nameFromDomain = hostLevelUnits[hostLevelUnits.length - 3];
            }
            else {
                // www.example.com
                nameFromDomain = hostLevelUnits[hostLevelUnits.length - 2];
            }
        }
        nameFromDomain = nameFromDomain.replace(/-/g, "").toLowerCase();
        return [title, nameFromDomain, hostname];
    });
}
function getMatchedEntries(siteName, entries) {
    if (siteName.length < 2) {
        return false;
    }
    const matched = [];
    for (const entry of entries) {
        if (isMatchedEntry(siteName, entry)) {
            matched.push(entry);
        }
    }
    return matched;
}
function getMatchedEntriesHash(siteName, entries) {
    const matchedEnteries = getMatchedEntries(siteName, entries);
    if (matchedEnteries) {
        return matchedEnteries.map((entry) => entry.hash);
    }
    return false;
}
function isMatchedEntry(siteName, entry) {
    if (!entry.issuer) {
        return false;
    }
    const issuerHostMatches = entry.issuer.split("::");
    const issuer = issuerHostMatches[0].replace(/[^0-9a-z]/gi, "").toLowerCase();
    if (!issuer) {
        return false;
    }
    const siteTitle = siteName[0] || "";
    const siteNameFromHost = siteName[1] || "";
    const siteHost = siteName[2] || "";
    if (issuerHostMatches.length > 1) {
        if (siteHost && siteHost.indexOf(issuerHostMatches[1]) !== -1) {
            return true;
        }
    }
    // site title should be more detailed
    // so we use siteTitle.indexOf(issuer)
    if (siteTitle && siteTitle.indexOf(issuer) !== -1) {
        return true;
    }
    if (siteNameFromHost && issuer.indexOf(siteNameFromHost) !== -1) {
        return true;
    }
    return false;
}
function getCurrentTab() {
    return __awaiter(this, void 0, void 0, function* () {
        const currentWindow = yield chrome.windows.getCurrent();
        const queryOptions = { active: true, windowId: currentWindow.id };
        // `tab` will either be a `tabs.Tab` instance or `undefined`.
        const [tab] = yield chrome.tabs.query(queryOptions);
        return tab;
    });
}
function okToInjectContentScript(tab) {
    return (tab.id !== undefined &&
        tab.url !== undefined &&
        (tab.url.startsWith("https://") ||
            tab.url.startsWith("http://") ||
            tab.url.startsWith("file://")));
}


/***/ }),

/***/ "./src/components/Popup.vue":
/*!**********************************!*\
  !*** ./src/components/Popup.vue ***!
  \**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Popup.vue?vue&type=template&id=6be7b2a8 */ "./src/components/Popup.vue?vue&type=template&id=6be7b2a8");
/* harmony import */ var _Popup_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Popup.vue?vue&type=script&lang=ts */ "./src/components/Popup.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _Popup_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__.render,
  _Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/AddAccountPage.vue":
/*!*************************************************!*\
  !*** ./src/components/Popup/AddAccountPage.vue ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddAccountPage.vue?vue&type=template&id=d36effe4 */ "./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4");
/* harmony import */ var _AddAccountPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AddAccountPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _AddAccountPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__.render,
  _AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/AddAccountPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/AddMethodPage.vue":
/*!************************************************!*\
  !*** ./src/components/Popup/AddMethodPage.vue ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AddMethodPage.vue?vue&type=template&id=037e954e */ "./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e");
/* harmony import */ var _AddMethodPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AddMethodPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _AddMethodPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__.render,
  _AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/AddMethodPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/AdvisorInsight.vue":
/*!*************************************************!*\
  !*** ./src/components/Popup/AdvisorInsight.vue ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AdvisorInsight.vue?vue&type=template&id=1940624b */ "./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b");
/* harmony import */ var _AdvisorInsight_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AdvisorInsight.vue?vue&type=script&lang=ts */ "./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _AdvisorInsight_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__.render,
  _AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/AdvisorInsight.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/AdvisorPage.vue":
/*!**********************************************!*\
  !*** ./src/components/Popup/AdvisorPage.vue ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AdvisorPage.vue?vue&type=template&id=1d17a36c */ "./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c");
/* harmony import */ var _AdvisorPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AdvisorPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _AdvisorPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__.render,
  _AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/AdvisorPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/BackupPage.vue":
/*!*********************************************!*\
  !*** ./src/components/Popup/BackupPage.vue ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./BackupPage.vue?vue&type=template&id=04b519f8 */ "./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8");
/* harmony import */ var _BackupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BackupPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _BackupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__.render,
  _BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/BackupPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/CompanySetupPage.vue":
/*!***************************************************!*\
  !*** ./src/components/Popup/CompanySetupPage.vue ***!
  \***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./CompanySetupPage.vue?vue&type=template&id=994429fc */ "./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc");
/* harmony import */ var _CompanySetupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./CompanySetupPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _CompanySetupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__.render,
  _CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/CompanySetupPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/DrivePage.vue":
/*!********************************************!*\
  !*** ./src/components/Popup/DrivePage.vue ***!
  \********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DrivePage.vue?vue&type=template&id=7fdea876 */ "./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876");
/* harmony import */ var _DrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DrivePage.vue?vue&type=script&lang=ts */ "./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _DrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__.render,
  _DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/DrivePage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/DropboxPage.vue":
/*!**********************************************!*\
  !*** ./src/components/Popup/DropboxPage.vue ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./DropboxPage.vue?vue&type=template&id=690807b0 */ "./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0");
/* harmony import */ var _DropboxPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DropboxPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _DropboxPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__.render,
  _DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/DropboxPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/EnterPasswordPage.vue":
/*!****************************************************!*\
  !*** ./src/components/Popup/EnterPasswordPage.vue ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EnterPasswordPage.vue?vue&type=template&id=4f206302 */ "./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302");
/* harmony import */ var _EnterPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EnterPasswordPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _EnterPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__.render,
  _EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/EnterPasswordPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/EntryComponent.vue":
/*!*************************************************!*\
  !*** ./src/components/Popup/EntryComponent.vue ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./EntryComponent.vue?vue&type=template&id=1cd709be */ "./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be");
/* harmony import */ var _EntryComponent_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./EntryComponent.vue?vue&type=script&lang=ts */ "./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _EntryComponent_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__.render,
  _EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/EntryComponent.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/ExchangeRatePage.vue":
/*!***************************************************!*\
  !*** ./src/components/Popup/ExchangeRatePage.vue ***!
  \***************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5 */ "./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5");
/* harmony import */ var _ExchangeRatePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ExchangeRatePage.vue?vue&type=script&lang=ts */ "./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _ExchangeRatePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__.render,
  _ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/ExchangeRatePage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/LoadingPage.vue":
/*!**********************************************!*\
  !*** ./src/components/Popup/LoadingPage.vue ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LoadingPage.vue?vue&type=template&id=5aa82e30 */ "./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30");
/* harmony import */ var _LoadingPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LoadingPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _LoadingPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__.render,
  _LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/LoadingPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/MainBody.vue":
/*!*******************************************!*\
  !*** ./src/components/Popup/MainBody.vue ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MainBody.vue?vue&type=template&id=66c95764 */ "./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764");
/* harmony import */ var _MainBody_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./MainBody.vue?vue&type=script&lang=ts */ "./src/components/Popup/MainBody.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _MainBody_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__.render,
  _MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/MainBody.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/MainHeader.vue":
/*!*********************************************!*\
  !*** ./src/components/Popup/MainHeader.vue ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MainHeader.vue?vue&type=template&id=5dc0ca8e */ "./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e");
/* harmony import */ var _MainHeader_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./MainHeader.vue?vue&type=script&lang=ts */ "./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _MainHeader_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__.render,
  _MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/MainHeader.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/MenuPage.vue":
/*!*******************************************!*\
  !*** ./src/components/Popup/MenuPage.vue ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./MenuPage.vue?vue&type=template&id=7d8b6f3e */ "./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e");
/* harmony import */ var _MenuPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./MenuPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _MenuPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__.render,
  _MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/MenuPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/NotificationHandler.vue":
/*!******************************************************!*\
  !*** ./src/components/Popup/NotificationHandler.vue ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./NotificationHandler.vue?vue&type=template&id=ff6a1048 */ "./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048");
/* harmony import */ var _NotificationHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./NotificationHandler.vue?vue&type=script&lang=ts */ "./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _NotificationHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__.render,
  _NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/NotificationHandler.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/OneDrivePage.vue":
/*!***********************************************!*\
  !*** ./src/components/Popup/OneDrivePage.vue ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./OneDrivePage.vue?vue&type=template&id=3e6a7346 */ "./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346");
/* harmony import */ var _OneDrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./OneDrivePage.vue?vue&type=script&lang=ts */ "./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _OneDrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__.render,
  _OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/OneDrivePage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/PageHandler.vue":
/*!**********************************************!*\
  !*** ./src/components/Popup/PageHandler.vue ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PageHandler.vue?vue&type=template&id=542f24b8 */ "./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8");
/* harmony import */ var _PageHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PageHandler.vue?vue&type=script&lang=ts */ "./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _PageHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__.render,
  _PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/PageHandler.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/PreferencesPage.vue":
/*!**************************************************!*\
  !*** ./src/components/Popup/PreferencesPage.vue ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./PreferencesPage.vue?vue&type=template&id=752e1fb8 */ "./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8");
/* harmony import */ var _PreferencesPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PreferencesPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _PreferencesPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__.render,
  _PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/PreferencesPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup/SetPasswordPage.vue":
/*!**************************************************!*\
  !*** ./src/components/Popup/SetPasswordPage.vue ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SetPasswordPage.vue?vue&type=template&id=07b47549 */ "./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549");
/* harmony import */ var _SetPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SetPasswordPage.vue?vue&type=script&lang=ts */ "./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _SetPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__.render,
  _SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/Popup/SetPasswordPage.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/ButtonInput.vue":
/*!***********************************************!*\
  !*** ./src/components/common/ButtonInput.vue ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ButtonInput.vue?vue&type=template&id=6f661184 */ "./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184");
/* harmony import */ var _ButtonInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ButtonInput.vue?vue&type=script&lang=ts */ "./src/components/common/ButtonInput.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _ButtonInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__.render,
  _ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/ButtonInput.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/ButtonLink.vue":
/*!**********************************************!*\
  !*** ./src/components/common/ButtonLink.vue ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ButtonLink.vue?vue&type=template&id=1e22cd30 */ "./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30");
/* harmony import */ var _ButtonLink_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ButtonLink.vue?vue&type=script&lang=ts */ "./src/components/common/ButtonLink.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _ButtonLink_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__.render,
  _ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/ButtonLink.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/FileInput.vue":
/*!*********************************************!*\
  !*** ./src/components/common/FileInput.vue ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./FileInput.vue?vue&type=template&id=1b28190c */ "./src/components/common/FileInput.vue?vue&type=template&id=1b28190c");
/* harmony import */ var _FileInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./FileInput.vue?vue&type=script&lang=ts */ "./src/components/common/FileInput.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _FileInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__.render,
  _FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/FileInput.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/SelectInput.vue":
/*!***********************************************!*\
  !*** ./src/components/common/SelectInput.vue ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./SelectInput.vue?vue&type=template&id=209ae6fa */ "./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa");
/* harmony import */ var _SelectInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./SelectInput.vue?vue&type=script&lang=ts */ "./src/components/common/SelectInput.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _SelectInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__.render,
  _SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/SelectInput.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/TextInput.vue":
/*!*********************************************!*\
  !*** ./src/components/common/TextInput.vue ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TextInput.vue?vue&type=template&id=29d5bae9 */ "./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9");
/* harmony import */ var _TextInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TextInput.vue?vue&type=script&lang=ts */ "./src/components/common/TextInput.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _TextInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__.render,
  _TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/TextInput.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/common/ToggleInput.vue":
/*!***********************************************!*\
  !*** ./src/components/common/ToggleInput.vue ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ToggleInput.vue?vue&type=template&id=c09df8bc */ "./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc");
/* harmony import */ var _ToggleInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ToggleInput.vue?vue&type=script&lang=ts */ "./src/components/common/ToggleInput.vue?vue&type=script&lang=ts");
/* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js");





/* normalize component */
;
var component = (0,_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  _ToggleInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_1__["default"],
  _ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__.render,
  _ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns,
  false,
  null,
  null,
  null
  
)

/* hot reload */
if (false) { var api; }
component.options.__file = "src/components/common/ToggleInput.vue"
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (component.exports);

/***/ }),

/***/ "./src/components/Popup.vue?vue&type=script&lang=ts":
/*!**********************************************************!*\
  !*** ./src/components/Popup.vue?vue&type=script&lang=ts ***!
  \**********************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Popup_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Popup.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Popup_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts":
/*!*************************************************************************!*\
  !*** ./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts ***!
  \*************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddAccountPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddAccountPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddAccountPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts":
/*!************************************************************************!*\
  !*** ./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts ***!
  \************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddMethodPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddMethodPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddMethodPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts":
/*!*************************************************************************!*\
  !*** ./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts ***!
  \*************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorInsight_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdvisorInsight.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorInsight_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts":
/*!**********************************************************************!*\
  !*** ./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdvisorPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts":
/*!*********************************************************************!*\
  !*** ./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts ***!
  \*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_BackupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./BackupPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_BackupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts":
/*!***************************************************************************!*\
  !*** ./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CompanySetupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CompanySetupPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CompanySetupPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts":
/*!********************************************************************!*\
  !*** ./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts ***!
  \********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DrivePage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts":
/*!**********************************************************************!*\
  !*** ./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DropboxPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DropboxPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DropboxPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts":
/*!****************************************************************************!*\
  !*** ./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EnterPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EnterPasswordPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EnterPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts":
/*!*************************************************************************!*\
  !*** ./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts ***!
  \*************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EntryComponent_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EntryComponent.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EntryComponent_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts":
/*!***************************************************************************!*\
  !*** ./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ExchangeRatePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ExchangeRatePage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ExchangeRatePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts":
/*!**********************************************************************!*\
  !*** ./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LoadingPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoadingPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LoadingPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/MainBody.vue?vue&type=script&lang=ts":
/*!*******************************************************************!*\
  !*** ./src/components/Popup/MainBody.vue?vue&type=script&lang=ts ***!
  \*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainBody_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MainBody.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainBody_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts":
/*!*********************************************************************!*\
  !*** ./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts ***!
  \*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainHeader_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MainHeader.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainHeader_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts":
/*!*******************************************************************!*\
  !*** ./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts ***!
  \*******************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MenuPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MenuPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MenuPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts":
/*!******************************************************************************!*\
  !*** ./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts ***!
  \******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_NotificationHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./NotificationHandler.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_NotificationHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts":
/*!***********************************************************************!*\
  !*** ./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts ***!
  \***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_OneDrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./OneDrivePage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_OneDrivePage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts":
/*!**********************************************************************!*\
  !*** ./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PageHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PageHandler.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PageHandler_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts":
/*!**************************************************************************!*\
  !*** ./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts ***!
  \**************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PreferencesPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PreferencesPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PreferencesPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts":
/*!**************************************************************************!*\
  !*** ./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts ***!
  \**************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SetPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SetPasswordPage.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SetPasswordPage_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/ButtonInput.vue?vue&type=script&lang=ts":
/*!***********************************************************************!*\
  !*** ./src/components/common/ButtonInput.vue?vue&type=script&lang=ts ***!
  \***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ButtonInput.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/ButtonLink.vue?vue&type=script&lang=ts":
/*!**********************************************************************!*\
  !*** ./src/components/common/ButtonLink.vue?vue&type=script&lang=ts ***!
  \**********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonLink_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ButtonLink.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonLink_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/FileInput.vue?vue&type=script&lang=ts":
/*!*********************************************************************!*\
  !*** ./src/components/common/FileInput.vue?vue&type=script&lang=ts ***!
  \*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_FileInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FileInput.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_FileInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/SelectInput.vue?vue&type=script&lang=ts":
/*!***********************************************************************!*\
  !*** ./src/components/common/SelectInput.vue?vue&type=script&lang=ts ***!
  \***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SelectInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SelectInput.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SelectInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/TextInput.vue?vue&type=script&lang=ts":
/*!*********************************************************************!*\
  !*** ./src/components/common/TextInput.vue?vue&type=script&lang=ts ***!
  \*********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_TextInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./TextInput.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_TextInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/common/ToggleInput.vue?vue&type=script&lang=ts":
/*!***********************************************************************!*\
  !*** ./src/components/common/ToggleInput.vue?vue&type=script&lang=ts ***!
  \***********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ToggleInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/ts-loader/index.js??clonedRuleSet-2!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ToggleInput.vue?vue&type=script&lang=ts */ "./node_modules/ts-loader/index.js??clonedRuleSet-2!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=script&lang=ts");
 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_node_modules_ts_loader_index_js_clonedRuleSet_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ToggleInput_vue_vue_type_script_lang_ts__WEBPACK_IMPORTED_MODULE_0__["default"]); 

/***/ }),

/***/ "./src/components/Popup.vue?vue&type=template&id=6be7b2a8":
/*!****************************************************************!*\
  !*** ./src/components/Popup.vue?vue&type=template&id=6be7b2a8 ***!
  \****************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_Popup_vue_vue_type_template_id_6be7b2a8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Popup.vue?vue&type=template&id=6be7b2a8 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=template&id=6be7b2a8");


/***/ }),

/***/ "./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4":
/*!*******************************************************************************!*\
  !*** ./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4 ***!
  \*******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddAccountPage_vue_vue_type_template_id_d36effe4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddAccountPage.vue?vue&type=template&id=d36effe4 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4");


/***/ }),

/***/ "./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e":
/*!******************************************************************************!*\
  !*** ./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e ***!
  \******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AddMethodPage_vue_vue_type_template_id_037e954e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AddMethodPage.vue?vue&type=template&id=037e954e */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e");


/***/ }),

/***/ "./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b":
/*!*******************************************************************************!*\
  !*** ./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b ***!
  \*******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorInsight_vue_vue_type_template_id_1940624b__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdvisorInsight.vue?vue&type=template&id=1940624b */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b");


/***/ }),

/***/ "./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c":
/*!****************************************************************************!*\
  !*** ./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_AdvisorPage_vue_vue_type_template_id_1d17a36c__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AdvisorPage.vue?vue&type=template&id=1d17a36c */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c");


/***/ }),

/***/ "./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8":
/*!***************************************************************************!*\
  !*** ./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8 ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_BackupPage_vue_vue_type_template_id_04b519f8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./BackupPage.vue?vue&type=template&id=04b519f8 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8");


/***/ }),

/***/ "./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc":
/*!*********************************************************************************!*\
  !*** ./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc ***!
  \*********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_CompanySetupPage_vue_vue_type_template_id_994429fc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./CompanySetupPage.vue?vue&type=template&id=994429fc */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc");


/***/ }),

/***/ "./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876":
/*!**************************************************************************!*\
  !*** ./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876 ***!
  \**************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DrivePage_vue_vue_type_template_id_7fdea876__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DrivePage.vue?vue&type=template&id=7fdea876 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876");


/***/ }),

/***/ "./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0":
/*!****************************************************************************!*\
  !*** ./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0 ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_DropboxPage_vue_vue_type_template_id_690807b0__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./DropboxPage.vue?vue&type=template&id=690807b0 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0");


/***/ }),

/***/ "./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302":
/*!**********************************************************************************!*\
  !*** ./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302 ***!
  \**********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EnterPasswordPage_vue_vue_type_template_id_4f206302__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EnterPasswordPage.vue?vue&type=template&id=4f206302 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302");


/***/ }),

/***/ "./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be":
/*!*******************************************************************************!*\
  !*** ./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be ***!
  \*******************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_EntryComponent_vue_vue_type_template_id_1cd709be__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./EntryComponent.vue?vue&type=template&id=1cd709be */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be");


/***/ }),

/***/ "./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5":
/*!*********************************************************************************!*\
  !*** ./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5 ***!
  \*********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ExchangeRatePage_vue_vue_type_template_id_7bd8c9a5__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5");


/***/ }),

/***/ "./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30":
/*!****************************************************************************!*\
  !*** ./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30 ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_LoadingPage_vue_vue_type_template_id_5aa82e30__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LoadingPage.vue?vue&type=template&id=5aa82e30 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30");


/***/ }),

/***/ "./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764":
/*!*************************************************************************!*\
  !*** ./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764 ***!
  \*************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainBody_vue_vue_type_template_id_66c95764__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MainBody.vue?vue&type=template&id=66c95764 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764");


/***/ }),

/***/ "./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e":
/*!***************************************************************************!*\
  !*** ./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MainHeader_vue_vue_type_template_id_5dc0ca8e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MainHeader.vue?vue&type=template&id=5dc0ca8e */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e");


/***/ }),

/***/ "./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e":
/*!*************************************************************************!*\
  !*** ./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e ***!
  \*************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_MenuPage_vue_vue_type_template_id_7d8b6f3e__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MenuPage.vue?vue&type=template&id=7d8b6f3e */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e");


/***/ }),

/***/ "./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048":
/*!************************************************************************************!*\
  !*** ./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048 ***!
  \************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_NotificationHandler_vue_vue_type_template_id_ff6a1048__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./NotificationHandler.vue?vue&type=template&id=ff6a1048 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048");


/***/ }),

/***/ "./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346":
/*!*****************************************************************************!*\
  !*** ./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346 ***!
  \*****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_OneDrivePage_vue_vue_type_template_id_3e6a7346__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./OneDrivePage.vue?vue&type=template&id=3e6a7346 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346");


/***/ }),

/***/ "./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8":
/*!****************************************************************************!*\
  !*** ./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8 ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PageHandler_vue_vue_type_template_id_542f24b8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PageHandler.vue?vue&type=template&id=542f24b8 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8");


/***/ }),

/***/ "./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8":
/*!********************************************************************************!*\
  !*** ./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8 ***!
  \********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_PreferencesPage_vue_vue_type_template_id_752e1fb8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./PreferencesPage.vue?vue&type=template&id=752e1fb8 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8");


/***/ }),

/***/ "./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549":
/*!********************************************************************************!*\
  !*** ./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549 ***!
  \********************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SetPasswordPage_vue_vue_type_template_id_07b47549__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SetPasswordPage.vue?vue&type=template&id=07b47549 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549");


/***/ }),

/***/ "./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184":
/*!*****************************************************************************!*\
  !*** ./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184 ***!
  \*****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonInput_vue_vue_type_template_id_6f661184__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ButtonInput.vue?vue&type=template&id=6f661184 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184");


/***/ }),

/***/ "./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30":
/*!****************************************************************************!*\
  !*** ./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30 ***!
  \****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ButtonLink_vue_vue_type_template_id_1e22cd30__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ButtonLink.vue?vue&type=template&id=1e22cd30 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30");


/***/ }),

/***/ "./src/components/common/FileInput.vue?vue&type=template&id=1b28190c":
/*!***************************************************************************!*\
  !*** ./src/components/common/FileInput.vue?vue&type=template&id=1b28190c ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_FileInput_vue_vue_type_template_id_1b28190c__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./FileInput.vue?vue&type=template&id=1b28190c */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=template&id=1b28190c");


/***/ }),

/***/ "./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa":
/*!*****************************************************************************!*\
  !*** ./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa ***!
  \*****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_SelectInput_vue_vue_type_template_id_209ae6fa__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SelectInput.vue?vue&type=template&id=209ae6fa */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa");


/***/ }),

/***/ "./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9":
/*!***************************************************************************!*\
  !*** ./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9 ***!
  \***************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_TextInput_vue_vue_type_template_id_29d5bae9__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./TextInput.vue?vue&type=template&id=29d5bae9 */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9");


/***/ }),

/***/ "./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc":
/*!*****************************************************************************!*\
  !*** ./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc ***!
  \*****************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__.render),
/* harmony export */   staticRenderFns: () => (/* reexport safe */ _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__.staticRenderFns)
/* harmony export */ });
/* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_ruleSet_1_rules_2_node_modules_vue_loader_lib_index_js_vue_loader_options_ToggleInput_vue_vue_type_template_id_c09df8bc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./ToggleInput.vue?vue&type=template&id=c09df8bc */ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc");


/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=template&id=6be7b2a8":
/*!********************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup.vue?vue&type=template&id=6be7b2a8 ***!
  \********************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    {
      class: {
        "theme-normal":
          _vm.theme !== "accessibility" &&
          _vm.theme !== "dark" &&
          _vm.theme !== "simple" &&
          _vm.theme !== "compact" &&
          _vm.theme !== "flat",
        "theme-accessibility": _vm.theme === "accessibility",
        "theme-dark": _vm.theme === "dark",
        "theme-simple": _vm.theme === "simple",
        "theme-compact": _vm.theme === "compact",
        "theme-flat": _vm.theme === "flat",
        hideoutline: _vm.hideoutline,
      },
      on: {
        mousedown: function ($event) {
          _vm.hideoutline = true
        },
        keydown: function ($event) {
          _vm.hideoutline = false
        },
      },
    },
    [
      _c("MainHeader"),
      _vm._v(" "),
      _c("div", { staticClass: "tabs" }, [
        _c(
          "div",
          {
            staticClass: "tab",
            class: { active: _vm.style.activeTab === "authenticator" },
            on: {
              click: function ($event) {
                return _vm.setTab("authenticator")
              },
            },
          },
          [_vm._v("\n      Authenticator\n    ")]
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            staticClass: "tab",
            class: { active: _vm.style.activeTab === "exchange-rate" },
            on: {
              click: function ($event) {
                return _vm.setTab("exchange-rate")
              },
            },
          },
          [_vm._v("\n      Kurs KMK\n    ")]
        ),
      ]),
      _vm._v(" "),
      _vm.style.activeTab === "authenticator"
        ? _c("MainBody", {
            class: {
              timeout: _vm.style.timeout && !_vm.style.isEditing,
              edit: _vm.style.isEditing,
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _vm.style.activeTab === "exchange-rate"
        ? _c("ExchangeRatePage")
        : _vm._e(),
      _vm._v(" "),
      _c("MenuPage", {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.style.slidein || _vm.style.slideout,
            expression: "style.slidein || style.slideout",
          },
        ],
        class: { slidein: _vm.style.slidein, slideout: _vm.style.slideout },
        attrs: { id: "menu" },
      }),
      _vm._v(" "),
      _c("PageHandler", {
        class: {
          fadein: _vm.style.fadein,
          fadeout: _vm.style.fadeout,
          show: _vm.style.show,
        },
      }),
      _vm._v(" "),
      _c("NotificationHandler"),
      _vm._v(" "),
      !_vm.companySetupCompleted ? _c("CompanySetupPage") : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          class: {
            fadein: _vm.style.notificationFadein,
            fadeout: _vm.style.notificationFadeout,
          },
          attrs: { id: "notification" },
        },
        [_vm._v("\n    " + _vm._s(_vm.notification) + "\n  ")]
      ),
      _vm._v(" "),
      _c("div", {
        class: { qrfadein: _vm.style.qrfadein, qrfadeout: _vm.style.qrfadeout },
        style: { "background-image": _vm.qr },
        attrs: { id: "qr" },
        on: {
          click: function ($event) {
            return _vm.hideQr()
          },
        },
      }),
      _vm._v(" "),
      _c("input", {
        attrs: { type: "text", id: "codeClipboard", tabindex: "-1" },
      }),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4":
/*!***********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddAccountPage.vue?vue&type=template&id=d36effe4 ***!
  \***********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    [
      _c("a-text-input", {
        attrs: { label: _vm.i18n.issuer },
        model: {
          value: _vm.newAccount.issuer,
          callback: function ($$v) {
            _vm.$set(_vm.newAccount, "issuer", $$v)
          },
          expression: "newAccount.issuer",
        },
      }),
      _vm._v(" "),
      _c("a-text-input", {
        attrs: { label: _vm.i18n.secret },
        model: {
          value: _vm.newAccount.secret,
          callback: function ($$v) {
            _vm.$set(_vm.newAccount, "secret", $$v)
          },
          expression: "newAccount.secret",
        },
      }),
      _vm._v(" "),
      _c(
        "details",
        [
          _c("summary", [_vm._v(_vm._s(_vm.i18n.advanced))]),
          _vm._v(" "),
          _c("a-text-input", {
            attrs: { label: _vm.i18n.accountName },
            model: {
              value: _vm.newAccount.account,
              callback: function ($$v) {
                _vm.$set(_vm.newAccount, "account", $$v)
              },
              expression: "newAccount.account",
            },
          }),
          _vm._v(" "),
          _c("label", [_vm._v(_vm._s(_vm.i18n.period))]),
          _vm._v(" "),
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model.number",
                value: _vm.newAccount.period,
                expression: "newAccount.period",
                modifiers: { number: true },
              },
            ],
            staticClass: "input",
            attrs: {
              type: "number",
              min: "1",
              disabled: _vm.newAccount.type === _vm.OTPType.hotp,
            },
            domProps: { value: _vm.newAccount.period },
            on: {
              input: function ($event) {
                if ($event.target.composing) return
                _vm.$set(_vm.newAccount, "period", _vm._n($event.target.value))
              },
              blur: function ($event) {
                return _vm.$forceUpdate()
              },
            },
          }),
          _vm._v(" "),
          _c(
            "a-select-input",
            {
              attrs: { label: _vm.i18n.digits },
              model: {
                value: _vm.newAccount.digits,
                callback: function ($$v) {
                  _vm.$set(_vm.newAccount, "digits", $$v)
                },
                expression: "newAccount.digits",
              },
            },
            [
              _c("option", { attrs: { value: "6" } }, [_vm._v("6")]),
              _vm._v(" "),
              _c("option", { attrs: { value: "8" } }, [_vm._v("8")]),
            ]
          ),
          _vm._v(" "),
          _c(
            "a-select-input",
            {
              attrs: { label: _vm.i18n.algorithm },
              model: {
                value: _vm.newAccount.algorithm,
                callback: function ($$v) {
                  _vm.$set(_vm.newAccount, "algorithm", $$v)
                },
                expression: "newAccount.algorithm",
              },
            },
            [
              _c("option", { domProps: { value: _vm.OTPAlgorithm.SHA1 } }, [
                _vm._v("SHA-1"),
              ]),
              _vm._v(" "),
              _c("option", { domProps: { value: _vm.OTPAlgorithm.SHA256 } }, [
                _vm._v("SHA-256"),
              ]),
              _vm._v(" "),
              _c("option", { domProps: { value: _vm.OTPAlgorithm.SHA512 } }, [
                _vm._v("SHA-512"),
              ]),
              _vm._v(" "),
              _c(
                "option",
                { domProps: { value: _vm.OTPAlgorithm.GOST3411_2012_256 } },
                [_vm._v("GOST 34.11 256")]
              ),
              _vm._v(" "),
              _c(
                "option",
                { domProps: { value: _vm.OTPAlgorithm.GOST3411_2012_512 } },
                [_vm._v("GOST 34.11 512")]
              ),
            ]
          ),
          _vm._v(" "),
          _c(
            "a-select-input",
            {
              attrs: { label: _vm.i18n.type },
              model: {
                value: _vm.newAccount.type,
                callback: function ($$v) {
                  _vm.$set(_vm.newAccount, "type", _vm._n($$v))
                },
                expression: "newAccount.type",
              },
            },
            [
              _c("option", { domProps: { value: _vm.OTPType.totp } }, [
                _vm._v(_vm._s(_vm.i18n.based_on_time)),
              ]),
              _vm._v(" "),
              _c("option", { domProps: { value: _vm.OTPType.hotp } }, [
                _vm._v(_vm._s(_vm.i18n.based_on_counter)),
              ]),
              _vm._v(" "),
              _c("option", { domProps: { value: _vm.OTPType.battle } }, [
                _vm._v("Battle.net"),
              ]),
              _vm._v(" "),
              _c("option", { domProps: { value: _vm.OTPType.steam } }, [
                _vm._v("Steam"),
              ]),
            ]
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "a-button",
        {
          attrs: { type: "small" },
          on: {
            click: function ($event) {
              return _vm.addNewAccount()
            },
          },
        },
        [_vm._v(_vm._s(_vm.i18n.ok))]
      ),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e":
/*!**********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AddMethodPage.vue?vue&type=template&id=037e954e ***!
  \**********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    [
      _c(
        "a-button",
        {
          on: {
            click: function ($event) {
              return _vm.beginCapture()
            },
          },
        },
        [_vm._v(_vm._s(_vm.i18n.add_qr))]
      ),
      _vm._v(" "),
      _c(
        "a-button",
        {
          on: {
            click: function ($event) {
              return _vm.showInfo("AddAccountPage")
            },
          },
        },
        [_vm._v("\n    " + _vm._s(_vm.i18n.add_secret) + "\n  ")]
      ),
      _vm._v(" "),
      _c("a-button-link", { attrs: { href: "import.html?QrImport" } }, [
        _vm._v(_vm._s(_vm.i18n.import_qr_images)),
      ]),
      _vm._v(" "),
      _c("a-button-link", { attrs: { href: "import.html?TextImport" } }, [
        _vm._v(_vm._s(_vm.i18n.import_otp_urls)),
      ]),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b":
/*!***********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorInsight.vue?vue&type=template&id=1940624b ***!
  \***********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c("h3", [_vm._v(_vm._s(_vm.insight.levelText))]),
    _vm._v(" "),
    _c("p", [_vm._v(_vm._s(_vm.insight.description))]),
    _vm._v(" "),
    _c("div", { staticClass: "link" }, [
      _vm.insight.link
        ? _c(
            "a",
            {
              attrs: { href: "#" },
              on: {
                click: function ($event) {
                  return _vm.openLink(_vm.insight.link)
                },
              },
            },
            [_vm._v(_vm._s(this.i18n.learn_more))]
          )
        : _vm._e(),
      _vm._v(" "),
      _c(
        "a",
        {
          attrs: { href: "#" },
          on: {
            click: function ($event) {
              return _vm.dismiss(_vm.insight)
            },
          },
        },
        [_vm._v(_vm._s(this.i18n.dismiss))]
      ),
    ]),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c":
/*!********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/AdvisorPage.vue?vue&type=template&id=1d17a36c ***!
  \********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    { staticClass: "advisor" },
    [
      _vm.ignoreList.length > 0
        ? _c("div", { staticClass: "show-all-insights" }, [
            _c(
              "a",
              { attrs: { href: "#" }, on: { click: _vm.clearIgnoreList } },
              [_vm._v(_vm._s(this.i18n.show_all_insights))]
            ),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm.insights.length === 0
        ? _c("div", { staticClass: "no-insight" }, [
            _vm._v("\n    " + _vm._s(this.i18n.no_insight_available) + "\n  "),
          ])
        : _vm._e(),
      _vm._v(" "),
      _vm._l(_vm.insights, function (insight) {
        return _c("AdvisorInsight", {
          key: insight.id,
          staticClass: "insight",
          attrs: { insight: insight, level: insight.level },
        })
      }),
    ],
    2
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8":
/*!*******************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/BackupPage.vue?vue&type=template&id=04b519f8 ***!
  \*******************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    [
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: !_vm.exportDisabled,
              expression: "!exportDisabled",
            },
          ],
        },
        [
          !_vm.defaultEncryption
            ? _c("div", { staticClass: "text warning" }, [
                _vm._v("\n      " + _vm._s(_vm.i18n.export_info) + "\n    "),
              ])
            : _vm._e(),
          _vm._v(" "),
          _c("div", { staticClass: "text" }, [
            _vm._v("\n      " + _vm._s(_vm.i18n.backup_file_info) + "\n    "),
          ]),
          _vm._v(" "),
          _vm.unsupportedAccounts
            ? _c("div", { staticClass: "text warning" }, [
                _vm._v(
                  "\n      " + _vm._s(_vm.i18n.otp_unsupported_warn) + "\n    "
                ),
              ])
            : _vm._e(),
          _vm._v(" "),
          _vm.currentlyEncrypted
            ? _c("div", { staticClass: "text warning" }, [
                _vm._v(
                  "\n      " +
                    _vm._s(_vm.i18n.phrase_incorrect_export) +
                    "\n    "
                ),
              ])
            : _vm._e(),
          _vm._v(" "),
          !_vm.unsupportedAccounts && _vm.isDataLinkSupported
            ? _c(
                "a-button-link",
                {
                  attrs: {
                    download: "authenticator.txt",
                    href: _vm.exportOneLineOtpAuthFile,
                  },
                },
                [_vm._v(_vm._s(_vm.i18n.download_backup))]
              )
            : _vm._e(),
          _vm._v(" "),
          !_vm.unsupportedAccounts && !_vm.isDataLinkSupported
            ? _c(
                "button",
                {
                  staticClass: "button",
                  on: {
                    click: function ($event) {
                      return _vm.downloadBackUpOneLineOtpAuthFile()
                    },
                  },
                },
                [
                  _vm._v(
                    "\n      " + _vm._s(_vm.i18n.download_backup) + "\n    "
                  ),
                ]
              )
            : _vm._e(),
          _vm._v(" "),
          _vm.unsupportedAccounts && _vm.isDataLinkSupported
            ? _c(
                "a-button-link",
                {
                  attrs: {
                    download: "authenticator.json",
                    href: _vm.exportFile,
                  },
                },
                [_vm._v(_vm._s(_vm.i18n.download_backup))]
              )
            : _vm._e(),
          _vm._v(" "),
          _vm.unsupportedAccounts && !_vm.isDataLinkSupported
            ? _c(
                "button",
                {
                  staticClass: "button",
                  on: {
                    click: function ($event) {
                      return _vm.downloadBackUpExportFile()
                    },
                  },
                },
                [
                  _vm._v(
                    "\n      " + _vm._s(_vm.i18n.download_backup) + "\n    "
                  ),
                ]
              )
            : _vm._e(),
          _vm._v(" "),
          !!_vm.defaultEncryption && _vm.isDataLinkSupported
            ? _c(
                "a-button-link",
                {
                  attrs: {
                    download: "authenticator.json",
                    href: _vm.exportEncryptedFile,
                  },
                },
                [_vm._v(_vm._s(_vm.i18n.download_enc_backup))]
              )
            : _vm._e(),
          _vm._v(" "),
          !!_vm.defaultEncryption && !_vm.isDataLinkSupported
            ? _c(
                "button",
                {
                  staticClass: "button",
                  on: {
                    click: function ($event) {
                      return _vm.downloadBackUpExportEncryptedFile()
                    },
                  },
                },
                [
                  _vm._v(
                    "\n      " + _vm._s(_vm.i18n.download_enc_backup) + "\n    "
                  ),
                ]
              )
            : _vm._e(),
        ],
        1
      ),
      _vm._v(" "),
      _c("a-button-link", { attrs: { href: "import.html" } }, [
        _vm._v(_vm._s(_vm.i18n.import_backup)),
      ]),
      _vm._v(" "),
      _c("br"),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc":
/*!*************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/CompanySetupPage.vue?vue&type=template&id=994429fc ***!
  \*************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "company-setup-overlay" }, [
    _c("div", { staticClass: "company-setup-modal" }, [
      _vm._m(0),
      _vm._v(" "),
      _c("div", { staticClass: "company-setup-body" }, [
        _c("p", [
          _vm._v("Please enter your company information to get started"),
        ]),
        _vm._v(" "),
        _c("div", { staticClass: "form-group" }, [
          _c("label", { staticClass: "form-label" }, [_vm._v("Company Name")]),
          _vm._v(" "),
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.companyName,
                expression: "companyName",
              },
            ],
            ref: "companyInput",
            staticClass: "company-input",
            attrs: { type: "text", placeholder: "PT Sejahtera Bersama" },
            domProps: { value: _vm.companyName },
            on: {
              keyup: function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
                )
                  return null
                return _vm.submitCompanyName.apply(null, arguments)
              },
              input: function ($event) {
                if ($event.target.composing) return
                _vm.companyName = $event.target.value
              },
            },
          }),
        ]),
        _vm._v(" "),
        _c("div", { staticClass: "form-group" }, [
          _c("label", { staticClass: "form-label" }, [
            _vm._v("WhatsApp Number"),
          ]),
          _vm._v(" "),
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.whatsappNumber,
                expression: "whatsappNumber",
              },
            ],
            staticClass: "company-input",
            attrs: { type: "tel", placeholder: "08170392821" },
            domProps: { value: _vm.whatsappNumber },
            on: {
              keyup: function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
                )
                  return null
                return _vm.submitCompanyName.apply(null, arguments)
              },
              input: function ($event) {
                if ($event.target.composing) return
                _vm.whatsappNumber = $event.target.value
              },
            },
          }),
        ]),
        _vm._v(" "),
        _vm.errorMessage
          ? _c("div", { staticClass: "error-message" }, [
              _vm._v("\n        " + _vm._s(_vm.errorMessage) + "\n      "),
            ])
          : _vm._e(),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "company-setup-footer" }, [
        _c(
          "button",
          {
            staticClass: "submit-button",
            attrs: {
              disabled: !_vm.companyName.trim() || !_vm.whatsappNumber.trim(),
            },
            on: { click: _vm.submitCompanyName },
          },
          [_vm._v("\n        Get Started\n      ")]
        ),
      ]),
    ]),
  ])
}
var staticRenderFns = [
  function () {
    var _vm = this,
      _c = _vm._self._c,
      _setup = _vm._self._setupProxy
    return _c("div", { staticClass: "company-setup-header" }, [
      _c("img", {
        staticClass: "setup-icon",
        attrs: { src: "/images/icon.svg", alt: "" },
      }),
      _vm._v(" "),
      _c("h2", [_vm._v("Welcome to Docfast Toolkit")]),
    ])
  },
]
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876":
/*!******************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DrivePage.vue?vue&type=template&id=7fdea876 ***!
  \******************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c(
      "div",
      [
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.isEncrypted || !_vm.defaultEncryption,
                expression: "!isEncrypted || !defaultEncryption",
              },
            ],
            staticClass: "text warning",
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.dropbox_risk) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
          },
          [
            _c(
              "div",
              {
                staticStyle: {
                  margin: "10px 0px 0px 20px",
                  "overflow-wrap": "break-word",
                },
              },
              [
                _vm._v(
                  "\n        " +
                    _vm._s(_vm.i18n.account) +
                    " - " +
                    _vm._s(_vm.email) +
                    "\n      "
                ),
              ]
            ),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-select-input",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !!_vm.defaultEncryption && _vm.backupToken,
                expression: "!!defaultEncryption && backupToken",
              },
            ],
            attrs: { label: _vm.i18n.encrypted },
            model: {
              value: _vm.isEncrypted,
              callback: function ($$v) {
                _vm.isEncrypted = $$v
              },
              expression: "isEncrypted",
            },
          },
          [
            _c("option", { attrs: { value: "true" } }, [
              _vm._v(_vm._s(_vm.i18n.yes)),
            ]),
            _vm._v(" "),
            _c("option", { attrs: { value: "false" } }, [
              _vm._v(_vm._s(_vm.i18n.no)),
            ]),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupLogout()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.log_out) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.backupToken,
                expression: "!backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.getBackupToken()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.sign_in) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupUpload()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.manual_dropbox) + "\n    ")]
        ),
      ],
      1
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0":
/*!********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/DropboxPage.vue?vue&type=template&id=690807b0 ***!
  \********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c(
      "div",
      [
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.isEncrypted || !_vm.defaultEncryption,
                expression: "!isEncrypted || !defaultEncryption",
              },
            ],
            staticClass: "text warning",
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.dropbox_risk) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
          },
          [
            _c(
              "div",
              {
                staticStyle: {
                  margin: "10px 0px 0px 20px",
                  "overflow-wrap": "break-word",
                },
              },
              [
                _vm._v(
                  "\n        " +
                    _vm._s(_vm.i18n.account) +
                    " - " +
                    _vm._s(_vm.email) +
                    "\n      "
                ),
              ]
            ),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-select-input",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !!_vm.defaultEncryption && _vm.backupToken,
                expression: "!!defaultEncryption && backupToken",
              },
            ],
            attrs: { label: _vm.i18n.encrypted },
            model: {
              value: _vm.isEncrypted,
              callback: function ($$v) {
                _vm.isEncrypted = $$v
              },
              expression: "isEncrypted",
            },
          },
          [
            _c("option", { attrs: { value: "true" } }, [
              _vm._v(_vm._s(_vm.i18n.yes)),
            ]),
            _vm._v(" "),
            _c("option", { attrs: { value: "false" } }, [
              _vm._v(_vm._s(_vm.i18n.no)),
            ]),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupLogout()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.log_out) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.backupToken,
                expression: "!backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.getBackupToken()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.sign_in) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupUpload()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.manual_dropbox) + "\n    ")]
        ),
      ],
      1
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302":
/*!**************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EnterPasswordPage.vue?vue&type=template&id=4f206302 ***!
  \**************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    {
      on: {
        keydown: function ($event) {
          $event.stopPropagation()
        },
      },
    },
    [
      _c("div", { staticClass: "text" }, [
        _vm._v(_vm._s(_vm.i18n.passphrase_info)),
      ]),
      _vm._v(" "),
      _c("a-text-input", {
        class: { badInput: _vm.wrongPassword },
        attrs: { type: "password", autofocus: true },
        on: {
          enter: function ($event) {
            return _vm.applyPassphrase()
          },
        },
        model: {
          value: _vm.password,
          callback: function ($$v) {
            _vm.password = $$v
          },
          expression: "password",
        },
      }),
      _vm._v(" "),
      _c(
        "label",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.wrongPassword,
              expression: "wrongPassword",
            },
          ],
          staticClass: "warning",
        },
        [_vm._v(_vm._s(_vm.i18n.phrase_not_match))]
      ),
      _vm._v(" "),
      _c(
        "a-button",
        {
          attrs: { type: "small" },
          on: {
            click: function ($event) {
              return _vm.applyPassphrase()
            },
          },
        },
        [_vm._v(_vm._s(_vm.i18n.ok))]
      ),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be":
/*!***********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/EntryComponent.vue?vue&type=template&id=1cd709be ***!
  \***********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "a",
    {
      class: {
        entry: true,
        pinnedEntry: _vm.entry.pinned,
        "no-copy": _vm.noCopy(_vm.entry.code),
      },
      attrs: { role: "button", "data-x-role": "entry", tabindex: _vm.tabindex },
      on: {
        click: function ($event) {
          return _vm.copyCode(_vm.entry)
        },
        keydown: function ($event) {
          if (
            !$event.type.indexOf("key") &&
            _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
          )
            return null
          return _vm.copyCode(_vm.entry)
        },
      },
    },
    [
      _c(
        "div",
        {
          staticClass: "deleteAction",
          on: {
            click: function ($event) {
              return _vm.removeEntry(_vm.entry)
            },
          },
        },
        [_c("IconMinusCircle")],
        1
      ),
      _vm._v(" "),
      _vm.entry.type !== _vm.OTPType.hotp && _vm.entry.type !== _vm.OTPType.hhex
        ? _c(
            "div",
            {
              directives: [
                {
                  name: "show",
                  rawName: "v-show",
                  value: _vm.sectorStart,
                  expression: "sectorStart",
                },
              ],
              staticClass: "sector",
            },
            [
              _c("svg", { attrs: { viewBox: "0 0 16 16" } }, [
                _c("circle", {
                  style: {
                    animationDuration: _vm.entry.period + "s",
                    animationDelay: (_vm.sectorOffset % _vm.entry.period) + "s",
                  },
                  attrs: { cx: "8", cy: "8", r: "4" },
                }),
              ]),
            ]
          )
        : _vm._e(),
      _vm._v(" "),
      _vm.entry.type === _vm.OTPType.hotp || _vm.entry.type === _vm.OTPType.hhex
        ? _c(
            "div",
            {
              class: { counter: true, disabled: _vm.style.hotpDiabled },
              on: {
                click: function ($event) {
                  return _vm.nextCode(_vm.entry)
                },
              },
            },
            [_c("IconRedo")],
            1
          )
        : _vm._e(),
      _vm._v(" "),
      _c("div", { staticClass: "issuer" }, [
        _vm._v(
          "\n    " +
            _vm._s(
              _vm.entry.issuer.split("::")[0] +
                (_vm.theme === "compact" ? ` (${_vm.entry.account})` : "")
            ) +
            "\n  "
        ),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "issuerEdit" }, [
        _c("input", {
          directives: [
            {
              name: "model",
              rawName: "v-model",
              value: _vm.entry.issuer,
              expression: "entry.issuer",
            },
          ],
          attrs: { placeholder: _vm.i18n.issuer, type: "text" },
          domProps: { value: _vm.entry.issuer },
          on: {
            change: function ($event) {
              return _vm.entry.update(_vm.encryption)
            },
            input: function ($event) {
              if ($event.target.composing) return
              _vm.$set(_vm.entry, "issuer", $event.target.value)
            },
          },
        }),
      ]),
      _vm._v(" "),
      _c("div", {
        class: {
          code: true,
          hotp:
            _vm.entry.type === _vm.OTPType.hotp ||
            _vm.entry.type === _vm.OTPType.hhex,
          timeout: _vm.entry.period - (_vm.second % _vm.entry.period) < 5,
        },
        domProps: {
          innerHTML: _vm._s(
            _vm.style.isEditing
              ? _vm.showBulls(_vm.entry)
              : _vm.showCode(_vm.entry.code)
          ),
        },
      }),
      _vm._v(" "),
      _c("div", { staticClass: "issuer account" }, [
        _vm._v(_vm._s(_vm.entry.account)),
      ]),
      _vm._v(" "),
      _c("div", { staticClass: "issuerEdit" }, [
        _c("input", {
          directives: [
            {
              name: "model",
              rawName: "v-model",
              value: _vm.entry.account,
              expression: "entry.account",
            },
          ],
          attrs: { placeholder: _vm.i18n.accountName, type: "text" },
          domProps: { value: _vm.entry.account },
          on: {
            change: function ($event) {
              return _vm.entry.update(_vm.encryption)
            },
            input: function ($event) {
              if ($event.target.composing) return
              _vm.$set(_vm.entry, "account", $event.target.value)
            },
          },
        }),
      ]),
      _vm._v(" "),
      _vm.shouldShowQrIcon(_vm.entry)
        ? _c(
            "div",
            {
              staticClass: "showqr",
              on: {
                click: function ($event) {
                  $event.stopPropagation()
                  return _vm.showQr(_vm.entry)
                },
              },
            },
            [_c("IconQr")],
            1
          )
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "pin",
          on: {
            click: function ($event) {
              $event.stopPropagation()
              return _vm.pin(_vm.entry)
            },
          },
        },
        [_c("IconPin")],
        1
      ),
      _vm._v(" "),
      _c("div", { staticClass: "movehandle" }, [_c("IconBars")], 1),
    ]
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5":
/*!*************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/ExchangeRatePage.vue?vue&type=template&id=7bd8c9a5 ***!
  \*************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "exchange-rate-page" }, [
    _c(
      "div",
      { staticClass: "under-header", attrs: { id: "exchange-search" } },
      [
        _c("input", {
          directives: [
            {
              name: "model",
              rawName: "v-model",
              value: _vm.searchQuery,
              expression: "searchQuery",
            },
          ],
          attrs: {
            id: "exchangeSearchInput",
            placeholder: _vm.i18n.search || "Search",
            type: "text",
            tabindex: "-1",
          },
          domProps: { value: _vm.searchQuery },
          on: {
            input: function ($event) {
              if ($event.target.composing) return
              _vm.searchQuery = $event.target.value
            },
          },
        }),
        _vm._v(" "),
        _vm.searchQuery === ""
          ? _c("div", { attrs: { id: "exchangeSearchHint" } }, [
              _c("div"),
              _vm._v(" "),
              _c("div", { attrs: { id: "exchangeSearchHintBorder" } }, [
                _vm._v("/"),
              ]),
              _vm._v(" "),
              _c("div"),
            ])
          : _vm._e(),
      ]
    ),
    _vm._v(" "),
    _vm.loading
      ? _c(
          "div",
          {
            staticClass: "text",
            staticStyle: { "text-align": "center", padding: "20px" },
          },
          [_vm._v("\n    " + _vm._s(_vm.i18n.loading || "Loading...") + "\n  ")]
        )
      : _vm.error
      ? _c(
          "div",
          { staticClass: "text warning", staticStyle: { padding: "20px" } },
          [_vm._v("\n    " + _vm._s(_vm.error) + "\n  ")]
        )
      : _c("div", { staticClass: "exchange-rate-container" }, [
          _c("div", { staticClass: "exchange-rate-table-wrapper" }, [
            _c("table", { staticClass: "exchange-rate-table" }, [
              _vm._m(0),
              _vm._v(" "),
              _c(
                "tbody",
                _vm._l(_vm.filteredRates, function (rate) {
                  return _c(
                    "tr",
                    {
                      key: rate.currencyCode,
                      staticClass: "exchange-rate-row",
                    },
                    [
                      _c("td", { staticClass: "currency-code" }, [
                        _vm._v(_vm._s(rate.currencyCode)),
                      ]),
                      _vm._v(" "),
                      _c("td", { staticClass: "currency-name" }, [
                        _vm._v(_vm._s(rate.currency)),
                      ]),
                      _vm._v(" "),
                      _c(
                        "td",
                        {
                          staticClass: "rate text-right clickable",
                          attrs: {
                            title: "Click to copy " + rate.rateFormatted,
                          },
                          on: {
                            click: function ($event) {
                              return _vm.copyToClipboard(rate.rateFormatted)
                            },
                          },
                        },
                        [
                          _vm._v(
                            "\n              " +
                              _vm._s(rate.rateFormatted) +
                              "\n            "
                          ),
                        ]
                      ),
                    ]
                  )
                }),
                0
              ),
            ]),
          ]),
          _vm._v(" "),
          _c("div", { staticClass: "exchange-rate-footer" }, [
            _c("small", [
              _vm._v(
                _vm._s(
                  _vm.i18n.exchange_rate_source || "Source: kurs.kausa.tech"
                )
              ),
            ]),
          ]),
        ]),
    _vm._v(" "),
    _vm.showCopyNotification
      ? _c("div", { staticClass: "copy-notification" }, [
          _vm._v("\n    Copied to clipboard\n  "),
        ])
      : _vm._e(),
  ])
}
var staticRenderFns = [
  function () {
    var _vm = this,
      _c = _vm._self._c,
      _setup = _vm._self._setupProxy
    return _c("thead", [
      _c("tr", [
        _c("th", [_vm._v("Code")]),
        _vm._v(" "),
        _c("th", [_vm._v("Currency")]),
        _vm._v(" "),
        _c("th", { staticClass: "text-right" }, [_vm._v("Rate")]),
      ]),
    ])
  },
]
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30":
/*!********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/LoadingPage.vue?vue&type=template&id=5aa82e30 ***!
  \********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "text" }, [
    _vm._v("\n  " + _vm._s(_vm.i18n.loading) + "\n"),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764":
/*!*****************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainBody.vue?vue&type=template&id=66c95764 ***!
  \*****************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    {
      class: { filter: _vm.shouldFilter && _vm.filter, search: _vm.showSearch },
      attrs: { id: "codes" },
    },
    [
      _c(
        "div",
        {
          staticClass: "under-header",
          attrs: { id: "filter" },
          on: {
            click: function ($event) {
              return _vm.clearFilter()
            },
          },
        },
        [_vm._v("\n    " + _vm._s(_vm.i18n.show_all_entries) + "\n  ")]
      ),
      _vm._v(" "),
      _c("div", { staticClass: "under-header", attrs: { id: "search" } }, [
        _c("input", {
          directives: [
            {
              name: "model",
              rawName: "v-model",
              value: _vm.searchText,
              expression: "searchText",
            },
          ],
          attrs: {
            id: "searchInput",
            placeholder: _vm.i18n.search,
            type: "text",
            tabindex: "-1",
          },
          domProps: { value: _vm.searchText },
          on: {
            input: function ($event) {
              if ($event.target.composing) return
              _vm.searchText = $event.target.value
            },
          },
        }),
        _vm._v(" "),
        _vm.searchText === ""
          ? _c("div", { attrs: { id: "searchHint" } }, [
              _c("div"),
              _vm._v(" "),
              _c("div", { attrs: { id: "searchHintBorder" } }, [_vm._v("/")]),
              _vm._v(" "),
              _c("div"),
            ])
          : _vm._e(),
      ]),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [{ name: "dragula", rawName: "v-dragula" }],
          attrs: { drake: "entryDrake" },
          on: {
            keydown: [
              function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "down", 40, $event.key, [
                    "Down",
                    "ArrowDown",
                  ])
                )
                  return null
                return _vm.focusNextEntry()
              },
              function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "right", 39, $event.key, [
                    "Right",
                    "ArrowRight",
                  ])
                )
                  return null
                if ("button" in $event && $event.button !== 2) return null
                return _vm.focusNextEntry()
              },
              function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "up", 38, $event.key, [
                    "Up",
                    "ArrowUp",
                  ])
                )
                  return null
                return _vm.focusLastEntry()
              },
              function ($event) {
                if (
                  !$event.type.indexOf("key") &&
                  _vm._k($event.keyCode, "left", 37, $event.key, [
                    "Left",
                    "ArrowLeft",
                  ])
                )
                  return null
                if ("button" in $event && $event.button !== 0) return null
                return _vm.focusLastEntry()
              },
            ],
          },
        },
        [
          _vm._l(_vm.entries, function (entry) {
            return _c("EntryComponent", {
              key: entry.hash,
              attrs: {
                filtered: !entry.pinned && !_vm.isMatchedEntry(entry),
                notSearched: !_vm.isSearchedEntry(entry),
                entry: entry,
                tabindex: _vm.getTabindex(entry),
              },
            })
          }),
          _vm._v(" "),
          _vm.entries.length === 0 && _vm.initComplete
            ? _c(
                "div",
                { staticClass: "no-entry" },
                [
                  _c("IconKey"),
                  _vm._v(" "),
                  _c("p", [
                    _vm._v(
                      "\n        " + _vm._s(_vm.i18n.no_entires) + "\n        "
                    ),
                    _c(
                      "a",
                      {
                        attrs: { href: "#" },
                        on: {
                          click: function ($event) {
                            return _vm.openLink(
                              "https://kausa.tech/posts/panduan-docfast-toolkit-chrome-extension"
                            )
                          },
                        },
                      },
                      [_vm._v(_vm._s(_vm.i18n.learn_more))]
                    ),
                  ]),
                ],
                1
              )
            : _vm._e(),
        ],
        2
      ),
    ]
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e":
/*!*******************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MainHeader.vue?vue&type=template&id=5dc0ca8e ***!
  \*******************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "header" }, [
    _c(
      "span",
      {
        on: {
          dblclick: function ($event) {
            return _vm.popOut()
          },
        },
      },
      [
        _c("img", {
          staticClass: "header-icon",
          attrs: { src: "/images/icon.svg", alt: "" },
        }),
        _vm._v("\n    " + _vm._s(_vm.i18n.extName) + "\n  "),
      ]
    ),
    _vm._v(" "),
    _c(
      "div",
      {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: !_vm.isPopup(),
            expression: "!isPopup()",
          },
        ],
      },
      [
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.style.isEditing,
                expression: "!style.isEditing",
              },
            ],
            staticClass: "icon",
            attrs: { id: "i-menu", title: _vm.i18n.settings },
            on: {
              click: function ($event) {
                return _vm.showMenu()
              },
            },
          },
          [_c("IconCog")],
          1
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.style.isEditing,
                expression: "style.isEditing",
              },
            ],
            staticClass: "icon",
            attrs: { id: "i-plus", title: _vm.i18n.add_code },
            on: {
              click: function ($event) {
                return _vm.showInfo("AddMethodPage")
              },
            },
          },
          [_c("IconPlus")],
          1
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.style.isEditing && !!_vm.defaultEncryption,
                expression: "!style.isEditing && !!defaultEncryption",
              },
            ],
            staticClass: "icon",
            attrs: { id: "i-lock", title: _vm.i18n.lock },
            on: {
              click: function ($event) {
                return _vm.lock()
              },
            },
          },
          [_c("IconLock")],
          1
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value:
                  (_vm.dropboxToken || _vm.driveToken || _vm.oneDriveToken) &&
                  !_vm.style.isEditing,
                expression:
                  "\n        (dropboxToken || driveToken || oneDriveToken) && !style.isEditing\n      ",
              },
            ],
            staticClass: "icon",
            style: {
              left: !!_vm.defaultEncryption ? "70px" : "45px",
            },
            attrs: { id: "i-sync" },
          },
          [_c("IconSync")],
          1
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value:
                  !_vm.style.isEditing &&
                  _vm.style.activeTab !== "exchange-rate",
                expression:
                  "!style.isEditing && style.activeTab !== 'exchange-rate'",
              },
            ],
            staticClass: "icon",
            attrs: { id: "i-qr", title: _vm.i18n.add_qr },
            on: {
              click: function ($event) {
                return _vm.beginCapture()
              },
            },
          },
          [_c("IconScan")],
          1
        ),
        _vm._v(" "),
        !_vm.style.isEditing && _vm.style.activeTab !== "exchange-rate"
          ? _c(
              "div",
              {
                staticClass: "icon",
                attrs: { id: "i-edit", title: _vm.i18n.edit },
                on: {
                  click: function ($event) {
                    return _vm.editEntry()
                  },
                },
              },
              [_c("IconPencil")],
              1
            )
          : _vm.style.activeTab !== "exchange-rate"
          ? _c(
              "div",
              {
                staticClass: "icon",
                attrs: { id: "i-edit", title: _vm.i18n.edit },
                on: {
                  click: function ($event) {
                    return _vm.editEntry()
                  },
                },
              },
              [_c("IconCheck")],
              1
            )
          : _vm._e(),
      ]
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e":
/*!*****************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/MenuPage.vue?vue&type=template&id=7d8b6f3e ***!
  \*****************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c("div", { staticClass: "header" }, [
      _c("span", { attrs: { id: "menuName" } }, [
        _vm._v(_vm._s(_vm.i18n.settings)),
      ]),
      _vm._v(" "),
      _c(
        "div",
        {
          staticClass: "icon",
          attrs: { id: "i-close" },
          on: {
            click: function ($event) {
              return _vm.hideMenu()
            },
          },
        },
        [_c("IconArrowLeft")],
        1
      ),
    ]),
    _vm._v(" "),
    _c("div", { attrs: { id: "menuBody" } }, [
      _c("div", { staticClass: "menuList" }, [
        _c(
          "p",
          {
            attrs: { title: _vm.i18n.backup },
            on: {
              click: function ($event) {
                return _vm.showInfo("BackupPage")
              },
            },
          },
          [
            _c("span", [_c("IconExchange")], 1),
            _vm._v(_vm._s(_vm.i18n.backup) + "\n      "),
          ]
        ),
        _vm._v(" "),
        _c(
          "p",
          {
            attrs: { title: _vm.i18n.security },
            on: {
              click: function ($event) {
                return _vm.showInfo("SetPasswordPage")
              },
            },
          },
          [
            _c("span", [_c("IconLock")], 1),
            _vm._v(_vm._s(_vm.i18n.security) + "\n      "),
          ]
        ),
        _vm._v(" "),
        _vm.isSupported
          ? _c(
              "p",
              {
                attrs: { title: _vm.i18n.sync_clock },
                on: {
                  click: function ($event) {
                    return _vm.syncClock()
                  },
                },
              },
              [
                _c("span", [_c("IconSync")], 1),
                _vm._v(_vm._s(_vm.i18n.sync_clock) + "\n      "),
              ]
            )
          : _vm._e(),
        _vm._v(" "),
        _c(
          "p",
          {
            attrs: { title: _vm.i18n.resize_popup_page },
            on: {
              click: function ($event) {
                return _vm.showInfo("PreferencesPage")
              },
            },
          },
          [
            _c("span", [_c("IconWrench")], 1),
            _vm._v(_vm._s(_vm.i18n.resize_popup_page) + "\n      "),
          ]
        ),
      ]),
      _vm._v(" "),
      _c("div", { attrs: { id: "version" } }, [
        _vm._v("Version " + _vm._s(_vm.version)),
      ]),
    ]),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048":
/*!****************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/NotificationHandler.vue?vue&type=template&id=ff6a1048 ***!
  \****************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c(
      "div",
      {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.message.length && _vm.messageIdle,
            expression: "message.length && messageIdle",
          },
        ],
        staticClass: "message-box",
      },
      [
        _c("div", [_vm._v(_vm._s(_vm.message.length ? _vm.message[0] : ""))]),
        _vm._v(" "),
        _c(
          "a-button",
          {
            attrs: { type: "small" },
            on: {
              click: function ($event) {
                return _vm.closeAlert()
              },
            },
          },
          [_vm._v(_vm._s(_vm.i18n.ok))]
        ),
      ],
      1
    ),
    _vm._v(" "),
    _c(
      "div",
      {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: _vm.confirmMessage !== "",
            expression: "confirmMessage !== ''",
          },
        ],
        staticClass: "message-box",
      },
      [
        _c("div", [_vm._v(_vm._s(_vm.confirmMessage))]),
        _vm._v(" "),
        _c(
          "div",
          { staticClass: "buttons" },
          [
            _c(
              "a-button",
              {
                attrs: { type: "small" },
                on: {
                  click: function ($event) {
                    return _vm.confirmOK()
                  },
                },
              },
              [_vm._v(_vm._s(_vm.i18n.yes))]
            ),
            _vm._v(" "),
            _c(
              "a-button",
              {
                attrs: { type: "small" },
                on: {
                  click: function ($event) {
                    return _vm.confirmCancel()
                  },
                },
              },
              [_vm._v("\n        " + _vm._s(_vm.i18n.no) + "\n      ")]
            ),
          ],
          1
        ),
      ]
    ),
    _vm._v(" "),
    _c("div", {
      directives: [
        {
          name: "show",
          rawName: "v-show",
          value:
            (_vm.message.length && _vm.messageIdle) ||
            _vm.confirmMessage !== "",
          expression:
            "(message.length && messageIdle) || confirmMessage !== ''",
        },
      ],
      attrs: { id: "overlay" },
    }),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346":
/*!*********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/OneDrivePage.vue?vue&type=template&id=3e6a7346 ***!
  \*********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c(
      "div",
      [
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.isEncrypted || !_vm.defaultEncryption,
                expression: "!isEncrypted || !defaultEncryption",
              },
            ],
            staticClass: "text warning",
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.dropbox_risk) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
          },
          [
            _c(
              "div",
              {
                staticStyle: {
                  margin: "10px 0px 0px 20px",
                  "overflow-wrap": "break-word",
                },
              },
              [
                _vm._v(
                  "\n        " +
                    _vm._s(_vm.i18n.account) +
                    " - " +
                    _vm._s(_vm.email) +
                    "\n      "
                ),
              ]
            ),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-select-input",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !!_vm.defaultEncryption && _vm.backupToken,
                expression: "!!defaultEncryption && backupToken",
              },
            ],
            attrs: { label: _vm.i18n.encrypted },
            model: {
              value: _vm.isEncrypted,
              callback: function ($$v) {
                _vm.isEncrypted = $$v
              },
              expression: "isEncrypted",
            },
          },
          [
            _c("option", { attrs: { value: "true" } }, [
              _vm._v(_vm._s(_vm.i18n.yes)),
            ]),
            _vm._v(" "),
            _c("option", { attrs: { value: "false" } }, [
              _vm._v(_vm._s(_vm.i18n.no)),
            ]),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupLogout()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.log_out) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.backupToken,
                expression: "!backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.getBackupToken()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.sign_in) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.backupToken,
                expression: "!backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.getBackupToken(true)
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.sign_in_business) + "\n    ")]
        ),
        _vm._v(" "),
        _c(
          "div",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: !_vm.backupToken,
                expression: "!backupToken",
              },
            ],
            staticClass: "text",
          },
          [
            _c(
              "a",
              {
                attrs: { href: "https://otp.ee/onedriveperms" },
                on: {
                  click: function ($event) {
                    return _vm.openLink("https://otp.ee/onedriveperms")
                  },
                },
              },
              [_vm._v(_vm._s(_vm.i18n.onedrive_business_perms))]
            ),
          ]
        ),
        _vm._v(" "),
        _c(
          "a-button",
          {
            directives: [
              {
                name: "show",
                rawName: "v-show",
                value: _vm.backupToken,
                expression: "backupToken",
              },
            ],
            on: {
              click: function ($event) {
                return _vm.backupUpload()
              },
            },
          },
          [_vm._v("\n      " + _vm._s(_vm.i18n.manual_dropbox) + "\n    ")]
        ),
      ],
      1
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8":
/*!********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PageHandler.vue?vue&type=template&id=542f24b8 ***!
  \********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    { attrs: { id: "info" } },
    [
      !(_vm.info === "EnterPasswordPage" || _vm.info === "LoadingPage")
        ? _c(
            "div",
            {
              attrs: { id: "infoClose" },
              on: {
                click: function ($event) {
                  return _vm.hideInfo()
                },
              },
            },
            [_c("IconXCircle")],
            1
          )
        : _vm._e(),
      _vm._v(" "),
      _c(_vm.info, { tag: "component", attrs: { id: "infoContent" } }),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8":
/*!************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/PreferencesPage.vue?vue&type=template&id=752e1fb8 ***!
  \************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    [
      _c(
        "a-select-input",
        {
          staticStyle: { "margin-left": "10px" },
          attrs: { label: _vm.i18n.theme },
          model: {
            value: _vm.theme,
            callback: function ($$v) {
              _vm.theme = $$v
            },
            expression: "theme",
          },
        },
        [
          _c("option", { attrs: { value: "normal" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_light)),
          ]),
          _vm._v(" "),
          _c("option", { attrs: { value: "dark" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_dark)),
          ]),
          _vm._v(" "),
          _c("option", { attrs: { value: "simple" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_simple)),
          ]),
          _vm._v(" "),
          _c("option", { attrs: { value: "compact" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_compact)),
          ]),
          _vm._v(" "),
          _c("option", { attrs: { value: "accessibility" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_high_contrast)),
          ]),
          _vm._v(" "),
          _c("option", { attrs: { value: "flat" } }, [
            _vm._v(_vm._s(_vm.i18n.theme_flat)),
          ]),
        ]
      ),
      _vm._v(" "),
      _c(
        "a-select-input",
        {
          staticStyle: { "margin-left": "10px" },
          attrs: { label: _vm.i18n.scale },
          model: {
            value: _vm.zoom,
            callback: function ($$v) {
              _vm.zoom = $$v
            },
            expression: "zoom",
          },
        },
        [
          _c("option", { attrs: { value: "125" } }, [_vm._v("125%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "100" } }, [_vm._v("100%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "90" } }, [_vm._v("90%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "80" } }, [_vm._v("80%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "67" } }, [_vm._v("67%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "57" } }, [_vm._v("57%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "50" } }, [_vm._v("50%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "40" } }, [_vm._v("40%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "33" } }, [_vm._v("33%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "25" } }, [_vm._v("25%")]),
          _vm._v(" "),
          _c("option", { attrs: { value: "20" } }, [_vm._v("20%")]),
        ]
      ),
      _vm._v(" "),
      _c("a-toggle-input", {
        attrs: { label: _vm.i18n.use_autofill },
        model: {
          value: _vm.useAutofill,
          callback: function ($$v) {
            _vm.useAutofill = $$v
          },
          expression: "useAutofill",
        },
      }),
      _vm._v(" "),
      _c("a-toggle-input", {
        attrs: { label: _vm.i18n.browser_sync, disabled: _vm.storageArea },
        on: {
          change: function ($event) {
            return _vm.migrateStorage()
          },
        },
        model: {
          value: _vm.browserSync,
          callback: function ($$v) {
            _vm.browserSync = $$v
          },
          expression: "browserSync",
        },
      }),
      _vm._v(" "),
      _c("a-toggle-input", {
        attrs: { label: _vm.i18n.smart_filter },
        model: {
          value: _vm.smartFilter,
          callback: function ($$v) {
            _vm.smartFilter = $$v
          },
          expression: "smartFilter",
        },
      }),
      _vm._v(" "),
      _vm.isSupported
        ? _c("a-toggle-input", {
            attrs: { label: _vm.i18n.enable_context_menu },
            on: {
              change: function ($event) {
                return _vm.requireContextMenuPermission()
              },
            },
            model: {
              value: _vm.enableContextMenu,
              callback: function ($$v) {
                _vm.enableContextMenu = $$v
              },
              expression: "enableContextMenu",
            },
          })
        : _vm._e(),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: !!_vm.defaultEncryption,
              expression: "!!defaultEncryption",
            },
          ],
          staticClass: "control-group",
        },
        [
          _c("label", { staticClass: "combo-label" }, [
            _vm._v(_vm._s(_vm.i18n.autolock)),
          ]),
          _vm._v(" "),
          _c("input", {
            directives: [
              {
                name: "model",
                rawName: "v-model",
                value: _vm.autolock,
                expression: "autolock",
              },
            ],
            staticClass: "input",
            staticStyle: { width: "70px", "text-align": "center" },
            attrs: {
              type: "number",
              min: "0",
              disabled: Boolean(_vm.enforceAutolock),
            },
            domProps: { value: _vm.autolock },
            on: {
              input: function ($event) {
                if ($event.target.composing) return
                _vm.autolock = $event.target.value
              },
            },
          }),
          _vm._v(" "),
          _c(
            "span",
            {
              staticClass: "combo-label",
              staticStyle: { "margin-left": "0", "margin-right": "20px" },
            },
            [_vm._v(_vm._s(_vm.i18n.minutes))]
          ),
        ]
      ),
      _vm._v(" "),
      _c(
        "a-button",
        {
          on: {
            click: function ($event) {
              return _vm.popOut()
            },
          },
        },
        [_vm._v(_vm._s(_vm.i18n.popout))]
      ),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549":
/*!************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/Popup/SetPasswordPage.vue?vue&type=template&id=07b47549 ***!
  \************************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "div",
    [
      _c("div", { staticClass: "text warning" }, [
        _vm._v(_vm._s(_vm.i18n.security_warning)),
      ]),
      _vm._v(" "),
      _c("a-text-input", {
        directives: [
          {
            name: "show",
            rawName: "v-show",
            value: !!_vm.defaultEncryption,
            expression: "!!defaultEncryption",
          },
        ],
        attrs: { label: _vm.i18n.current_phrase, type: "password" },
        model: {
          value: _vm.currentPhrase,
          callback: function ($$v) {
            _vm.currentPhrase = $$v
          },
          expression: "currentPhrase",
        },
      }),
      _vm._v(" "),
      _c("a-text-input", {
        attrs: { label: _vm.i18n.phrase, type: "password" },
        model: {
          value: _vm.phrase,
          callback: function ($$v) {
            _vm.phrase = $$v
          },
          expression: "phrase",
        },
      }),
      _vm._v(" "),
      _c("a-text-input", {
        attrs: { label: _vm.i18n.confirm_phrase, type: "password" },
        on: {
          enter: function ($event) {
            return _vm.changePassphrase()
          },
        },
        model: {
          value: _vm.confirm,
          callback: function ($$v) {
            _vm.confirm = $$v
          },
          expression: "confirm",
        },
      }),
      _vm._v(" "),
      _c(
        "div",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: !_vm.enforcePassword,
              expression: "!enforcePassword",
            },
          ],
        },
        [
          _c(
            "a-button",
            {
              attrs: { id: "security-save" },
              on: {
                click: function ($event) {
                  return _vm.changePassphrase()
                },
              },
            },
            [_vm._v("\n      " + _vm._s(_vm.i18n.ok) + "\n    ")]
          ),
          _vm._v(" "),
          _c(
            "a-button",
            {
              attrs: { id: "security-remove" },
              on: {
                click: function ($event) {
                  return _vm.removePassphrase()
                },
              },
            },
            [_vm._v("\n      " + _vm._s(_vm.i18n.remove) + "\n    ")]
          ),
        ],
        1
      ),
      _vm._v(" "),
      _c(
        "a-button",
        {
          directives: [
            {
              name: "show",
              rawName: "v-show",
              value: _vm.enforcePassword,
              expression: "enforcePassword",
            },
          ],
          attrs: { type: "small" },
          on: {
            click: function ($event) {
              return _vm.changePassphrase()
            },
          },
        },
        [_vm._v("\n    " + _vm._s(_vm.i18n.ok) + "\n  ")]
      ),
    ],
    1
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184":
/*!*********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonInput.vue?vue&type=template&id=6f661184 ***!
  \*********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "button",
    _vm._g(
      { class: { "button-small": _vm.type === "small", button: !_vm.type } },
      _vm.$listeners
    ),
    [_vm._t("default")],
    2
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30":
/*!********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ButtonLink.vue?vue&type=template&id=1e22cd30 ***!
  \********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c(
    "a",
    {
      class: { "button-small": _vm.type === "small", button: !_vm.type },
      attrs: { href: _vm.href, download: _vm.download, target: "_blank" },
    },
    [_vm._t("default")],
    2
  )
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=template&id=1b28190c":
/*!*******************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/FileInput.vue?vue&type=template&id=1b28190c ***!
  \*******************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "import_file" }, [
    _c("label", { attrs: { for: "import_file" } }, [_vm._v(_vm._s(_vm.label))]),
    _vm._v(" "),
    _c(
      "input",
      _vm._g(
        {
          attrs: {
            id: "import_file",
            type: "file",
            accept: _vm.accept,
            multiple: _vm.multiple,
          },
        },
        _vm.$listeners
      )
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa":
/*!*********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/SelectInput.vue?vue&type=template&id=209ae6fa ***!
  \*********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "control-group" }, [
    _c(
      "label",
      { staticClass: "combo-label", staticStyle: { margin: "20px 10px" } },
      [_vm._v(_vm._s(_vm.label))]
    ),
    _vm._v(" "),
    _c(
      "select",
      {
        staticStyle: { margin: "20px 10px" },
        attrs: { disabled: _vm.disabled },
        domProps: { value: _vm.value },
        on: {
          input: function ($event) {
            return _vm.$emit("input", $event.target.value)
          },
          change: function ($event) {
            return _vm.$emit("change")
          },
        },
      },
      [_vm._t("default")],
      2
    ),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9":
/*!*******************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/TextInput.vue?vue&type=template&id=29d5bae9 ***!
  \*******************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", [
    _c("label", [_vm._v(_vm._s(_vm.label))]),
    _vm._v(" "),
    _c("input", {
      ref: "textInput",
      staticClass: "input",
      attrs: { type: _vm.type ? _vm.type : "text" },
      domProps: { value: _vm.value },
      on: {
        input: function ($event) {
          return _vm.$emit("input", $event.target.value)
        },
        keyup: function ($event) {
          if (
            !$event.type.indexOf("key") &&
            _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
          )
            return null
          return _vm.$emit("enter")
        },
      },
    }),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc":
/*!*********************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??ruleSet[1].rules[2]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/components/common/ToggleInput.vue?vue&type=template&id=c09df8bc ***!
  \*********************************************************************************************************************************************************************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   render: () => (/* binding */ render),
/* harmony export */   staticRenderFns: () => (/* binding */ staticRenderFns)
/* harmony export */ });
var render = function render() {
  var _vm = this,
    _c = _vm._self._c,
    _setup = _vm._self._setupProxy
  return _c("div", { staticClass: "control-group" }, [
    _c("label", { staticClass: "combo-label" }, [_vm._v(_vm._s(_vm.label))]),
    _vm._v(" "),
    _c("input", {
      staticClass: "checkbox",
      attrs: { type: "checkbox" },
      domProps: { checked: _vm.checked },
      on: {
        change: function ($event) {
          return _vm.$emit("change", $event.target.checked)
        },
      },
    }),
  ])
}
var staticRenderFns = []
render._withStripped = true



/***/ }),

/***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
/*!********************************************************************!*\
  !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  \********************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (/* binding */ normalizeComponent)
/* harmony export */ });
/* globals __VUE_SSR_CONTEXT__ */

// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.

function normalizeComponent(
  scriptExports,
  render,
  staticRenderFns,
  functionalTemplate,
  injectStyles,
  scopeId,
  moduleIdentifier /* server only */,
  shadowMode /* vue-cli only */
) {
  // Vue.extend constructor export interop
  var options =
    typeof scriptExports === 'function' ? scriptExports.options : scriptExports

  // render functions
  if (render) {
    options.render = render
    options.staticRenderFns = staticRenderFns
    options._compiled = true
  }

  // functional template
  if (functionalTemplate) {
    options.functional = true
  }

  // scopedId
  if (scopeId) {
    options._scopeId = 'data-v-' + scopeId
  }

  var hook
  if (moduleIdentifier) {
    // server build
    hook = function (context) {
      // 2.3 injection
      context =
        context || // cached call
        (this.$vnode && this.$vnode.ssrContext) || // stateful
        (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
      // 2.2 with runInNewContext: true
      if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
        context = __VUE_SSR_CONTEXT__
      }
      // inject component styles
      if (injectStyles) {
        injectStyles.call(this, context)
      }
      // register component module identifier for async chunk inferrence
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier)
      }
    }
    // used by ssr in case component is cached and beforeCreate
    // never gets called
    options._ssrRegister = hook
  } else if (injectStyles) {
    hook = shadowMode
      ? function () {
          injectStyles.call(
            this,
            (options.functional ? this.parent : this).$root.$options.shadowRoot
          )
        }
      : injectStyles
  }

  if (hook) {
    if (options.functional) {
      // for template-only hot-reload because in that case the render fn doesn't
      // go through the normalizer
      options._injectStyles = hook
      // register for functional component in vue file
      var originalRender = options.render
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context)
        return originalRender(h, context)
      }
    } else {
      // inject component registration as beforeCreate hook
      var existing = options.beforeCreate
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook]
    }
  }

  return {
    exports: scriptExports,
    options: options
  }
}


/***/ }),

/***/ "./svg/arrow-left.svg":
/*!****************************!*\
  !*** ./svg/arrow-left.svg ***!
  \****************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/bars.svg":
/*!**********************!*\
  !*** ./svg/bars.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/check.svg":
/*!***********************!*\
  !*** ./svg/check.svg ***!
  \***********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/clipboard-check.svg":
/*!*********************************!*\
  !*** ./svg/clipboard-check.svg ***!
  \*********************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: ["svg-inline--fa fa-clipboard-check fa-w-12",classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"aria-hidden":"true","data-prefix":"fas","data-icon":"clipboard-check","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 384 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"fill":"currentColor","d":"M336 64h-80c0-35.3-28.7-64-64-64s-64 28.7-64 64H48C21.5 64 0 85.5 0 112v352c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48zM192 40c13.3 0 24 10.7 24 24s-10.7 24-24 24-24-10.7-24-24 10.7-24 24-24zm121.2 231.8l-143 141.8c-4.7 4.7-12.3 4.6-17-.1l-82.6-83.3c-4.7-4.7-4.6-12.3.1-17L99.1 285c4.7-4.7 12.3-4.6 17 .1l46 46.4 106-105.2c4.7-4.7 12.3-4.6 17 .1l28.2 28.4c4.7 4.8 4.6 12.3-.1 17z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/code.svg":
/*!**********************!*\
  !*** ./svg/code.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 640 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/cog.svg":
/*!*********************!*\
  !*** ./svg/cog.svg ***!
  \*********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M444.788 291.1l42.616 24.599c4.867 2.809 7.126 8.618 5.459 13.985-11.07 35.642-29.97 67.842-54.689 94.586a12.016 12.016 0 01-14.832 2.254l-42.584-24.595a191.577 191.577 0 01-60.759 35.13v49.182a12.01 12.01 0 01-9.377 11.718c-34.956 7.85-72.499 8.256-109.219.007-5.49-1.233-9.403-6.096-9.403-11.723v-49.184a191.555 191.555 0 01-60.759-35.13l-42.584 24.595a12.016 12.016 0 01-14.832-2.254c-24.718-26.744-43.619-58.944-54.689-94.586-1.667-5.366.592-11.175 5.459-13.985L67.212 291.1a193.48 193.48 0 010-70.199l-42.616-24.599c-4.867-2.809-7.126-8.618-5.459-13.985 11.07-35.642 29.97-67.842 54.689-94.586a12.016 12.016 0 0114.832-2.254l42.584 24.595a191.577 191.577 0 0160.759-35.13V25.759a12.01 12.01 0 019.377-11.718c34.956-7.85 72.499-8.256 109.219-.007 5.49 1.233 9.403 6.096 9.403 11.723v49.184a191.555 191.555 0 0160.759 35.13l42.584-24.595a12.016 12.016 0 0114.832 2.254c24.718 26.744 43.619 58.944 54.689 94.586 1.667 5.366-.592 11.175-5.459 13.985L444.788 220.9a193.485 193.485 0 010 70.2zM336 256c0-44.112-35.888-80-80-80s-80 35.888-80 80 35.888 80 80 80 80-35.888 80-80z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/comments.svg":
/*!**************************!*\
  !*** ./svg/comments.svg ***!
  \**************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 576 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M416 192c0-88.4-93.1-160-208-160S0 103.6 0 192c0 34.3 14.1 65.9 38 92-13.4 30.2-35.5 54.2-35.8 54.5-2.2 2.3-2.8 5.7-1.5 8.7S4.8 352 8 352c36.6 0 66.9-12.3 88.7-25 32.2 15.7 70.3 25 111.3 25 114.9 0 208-71.6 208-160zm122 220c23.9-26 38-57.7 38-92 0-66.9-53.5-124.2-129.3-148.1.9 6.6 1.3 13.3 1.3 20.1 0 105.9-107.7 192-240 192-10.8 0-21.3-.8-31.7-1.9C207.8 439.6 281.8 480 368 480c41 0 79.1-9.2 111.3-25 21.8 12.7 52.1 25 88.7 25 3.2 0 6.1-1.9 7.3-4.8 1.3-2.9.7-6.3-1.5-8.7-.3-.3-22.4-24.2-35.8-54.5z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/database.svg":
/*!**************************!*\
  !*** ./svg/database.svg ***!
  \**************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/exchange.svg":
/*!**************************!*\
  !*** ./svg/exchange.svg ***!
  \**************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M0 168v-16c0-13.255 10.745-24 24-24h360V80c0-21.367 25.899-32.042 40.971-16.971l80 80c9.372 9.373 9.372 24.569 0 33.941l-80 80C409.956 271.982 384 261.456 384 240v-48H24c-13.255 0-24-10.745-24-24zm488 152H128v-48c0-21.314-25.862-32.08-40.971-16.971l-80 80c-9.372 9.373-9.372 24.569 0 33.941l80 80C102.057 463.997 128 453.437 128 432v-48h360c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/globe.svg":
/*!***********************!*\
  !*** ./svg/globe.svg ***!
  \***********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 496 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm82.29 357.6c-3.9 3.88-7.99 7.95-11.31 11.28-2.99 3-5.1 6.7-6.17 10.71-1.51 5.66-2.73 11.38-4.77 16.87l-17.39 46.85c-13.76 3-28 4.69-42.65 4.69v-27.38c1.69-12.62-7.64-36.26-22.63-51.25-6-6-9.37-14.14-9.37-22.63v-32.01c0-11.64-6.27-22.34-16.46-27.97-14.37-7.95-34.81-19.06-48.81-26.11-11.48-5.78-22.1-13.14-31.65-21.75l-.8-.72a114.792 114.792 0 01-18.06-20.74c-9.38-13.77-24.66-36.42-34.59-51.14 20.47-45.5 57.36-82.04 103.2-101.89l24.01 12.01C203.48 89.74 216 82.01 216 70.11v-11.3c7.99-1.29 16.12-2.11 24.39-2.42l28.3 28.3c6.25 6.25 6.25 16.38 0 22.63L264 112l-10.34 10.34c-3.12 3.12-3.12 8.19 0 11.31l4.69 4.69c3.12 3.12 3.12 8.19 0 11.31l-8 8a8.008 8.008 0 01-5.66 2.34h-8.99c-2.08 0-4.08.81-5.58 2.27l-9.92 9.65a8.008 8.008 0 00-1.58 9.31l15.59 31.19c2.66 5.32-1.21 11.58-7.15 11.58h-5.64c-1.93 0-3.79-.7-5.24-1.96l-9.28-8.06a16.017 16.017 0 00-15.55-3.1l-31.17 10.39a11.95 11.95 0 00-8.17 11.34c0 4.53 2.56 8.66 6.61 10.69l11.08 5.54c9.41 4.71 19.79 7.16 30.31 7.16s22.59 27.29 32 32h66.75c8.49 0 16.62 3.37 22.63 9.37l13.69 13.69a30.503 30.503 0 018.93 21.57 46.536 46.536 0 01-13.72 32.98zM417 274.25c-5.79-1.45-10.84-5-14.15-9.97l-17.98-26.97a23.97 23.97 0 010-26.62l19.59-29.38c2.32-3.47 5.5-6.29 9.24-8.15l12.98-6.49C440.2 193.59 448 223.87 448 256c0 8.67-.74 17.16-1.82 25.54L417 274.25z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/info.svg":
/*!**********************!*\
  !*** ./svg/info.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 192 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M20 424.229h20V279.771H20c-11.046 0-20-8.954-20-20V212c0-11.046 8.954-20 20-20h112c11.046 0 20 8.954 20 20v212.229h20c11.046 0 20 8.954 20 20V492c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20v-47.771c0-11.046 8.954-20 20-20zM96 0C56.235 0 24 32.235 24 72s32.235 72 72 72 72-32.235 72-72S135.764 0 96 0z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/key-solid.svg":
/*!***************************!*\
  !*** ./svg/key-solid.svg ***!
  \***************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: ["svg-inline--fa fa-key fa-w-16",classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"aria-hidden":"true","data-prefix":"fas","data-icon":"key","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"fill":"currentColor","d":"M512 176.001C512 273.203 433.202 352 336 352c-11.22 0-22.19-1.062-32.827-3.069l-24.012 27.014A23.999 23.999 0 01261.223 384H224v40c0 13.255-10.745 24-24 24h-40v40c0 13.255-10.745 24-24 24H24c-13.255 0-24-10.745-24-24v-78.059c0-6.365 2.529-12.47 7.029-16.971l161.802-161.802C163.108 213.814 160 195.271 160 176 160 78.798 238.797.001 335.999 0 433.488-.001 512 78.511 512 176.001zM336 128c0 26.51 21.49 48 48 48s48-21.49 48-48-21.49-48-48-48-48 21.49-48 48z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/lightbulb.svg":
/*!***************************!*\
  !*** ./svg/lightbulb.svg ***!
  \***************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: ["svg-inline--fa fa-lightbulb fa-w-11",classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"aria-hidden":"true","data-prefix":"fas","data-icon":"lightbulb","xmlns":"http://www.w3.org/2000/svg","viewBox":"0 0 352 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"fill":"currentColor","d":"M96.06 454.35c.01 6.29 1.87 12.45 5.36 17.69l17.09 25.69a31.99 31.99 0 0026.64 14.28h61.71a31.99 31.99 0 0026.64-14.28l17.09-25.69a31.989 31.989 0 005.36-17.69l.04-38.35H96.01l.05 38.35zM0 176c0 44.37 16.45 84.85 43.56 115.78 16.52 18.85 42.36 58.23 52.21 91.45.04.26.07.52.11.78h160.24c.04-.26.07-.51.11-.78 9.85-33.22 35.69-72.6 52.21-91.45C335.55 260.85 352 220.37 352 176 352 78.61 272.91-.3 175.45 0 73.44.31 0 82.97 0 176zm176-80c-44.11 0-80 35.89-80 80 0 8.84-7.16 16-16 16s-16-7.16-16-16c0-61.76 50.24-112 112-112 8.84 0 16 7.16 16 16s-7.16 16-16 16z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/lock.svg":
/*!**********************!*\
  !*** ./svg/lock.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M400 224h-24v-72C376 68.2 307.8 0 224 0S72 68.2 72 152v72H48c-26.5 0-48 21.5-48 48v192c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48zm-104 0H152v-72c0-39.7 32.3-72 72-72s72 32.3 72 72v72z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/minus-circle.svg":
/*!******************************!*\
  !*** ./svg/minus-circle.svg ***!
  \******************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zM124 296c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h264c6.6 0 12 5.4 12 12v56c0 6.6-5.4 12-12 12H124z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/pencil.svg":
/*!************************!*\
  !*** ./svg/pencil.svg ***!
  \************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/pin.svg":
/*!*********************!*\
  !*** ./svg/pin.svg ***!
  \*********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 384 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M298.028 214.267L285.793 96H328c13.255 0 24-10.745 24-24V24c0-13.255-10.745-24-24-24H56C42.745 0 32 10.745 32 24v48c0 13.255 10.745 24 24 24h42.207L85.972 214.267C37.465 236.82 0 277.261 0 328c0 13.255 10.745 24 24 24h136v104.007c0 1.242.289 2.467.845 3.578l24 48c2.941 5.882 11.364 5.893 14.311 0l24-48a8.008 8.008 0 00.845-3.578V352h136c13.255 0 24-10.745 24-24-.001-51.183-37.983-91.42-85.973-113.733z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/plus.svg":
/*!**********************!*\
  !*** ./svg/plus.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/qrcode.svg":
/*!************************!*\
  !*** ./svg/qrcode.svg ***!
  \************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 448 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M0 224h192V32H0v192zM64 96h64v64H64V96zm192-64v192h192V32H256zm128 128h-64V96h64v64zM0 480h192V288H0v192zm64-128h64v64H64v-64zm352-64h32v128h-96v-32h-32v96h-64V288h96v32h64v-32zm0 160h32v32h-32v-32zm-64 0h32v32h-32v-32z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/redo.svg":
/*!**********************!*\
  !*** ./svg/redo.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M256.455 8c66.269.119 126.437 26.233 170.859 68.685l35.715-35.715C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.75c-30.864-28.899-70.801-44.907-113.23-45.273-92.398-.798-170.283 73.977-169.484 169.442C88.764 348.009 162.184 424 256 424c41.127 0 79.997-14.678 110.629-41.556 4.743-4.161 11.906-3.908 16.368.553l39.662 39.662c4.872 4.872 4.631 12.815-.482 17.433C378.202 479.813 319.926 504 256 504 119.034 504 8.001 392.967 8 256.002 7.999 119.193 119.646 7.755 256.455 8z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/scan.svg":
/*!**********************!*\
  !*** ./svg/scan.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 1000 1000"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M10 431h980v138.1H10V431zM162.1 323.8H24V12.9h362.6V151H162.1v172.8zM976 323.8H837.9V151H613.4V12.9H976v310.9zM386.6 987.1H24V676.2h138.1V849h224.5v138.1zM976 987.1H613.4V849h224.5V676.2H976v310.9z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/sync.svg":
/*!**********************!*\
  !*** ./svg/sync.svg ***!
  \**********************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M370.72 133.28C339.458 104.008 298.888 87.962 255.848 88c-77.458.068-144.328 53.178-162.791 126.85-1.344 5.363-6.122 9.15-11.651 9.15H24.103c-7.498 0-13.194-6.807-11.807-14.176C33.933 94.924 134.813 8 256 8c66.448 0 126.791 26.136 171.315 68.685L463.03 40.97C478.149 25.851 504 36.559 504 57.941V192c0 13.255-10.745 24-24 24H345.941c-21.382 0-32.09-25.851-16.971-40.971l41.75-41.749zM32 296h134.059c21.382 0 32.09 25.851 16.971 40.971l-41.75 41.75c31.262 29.273 71.835 45.319 114.876 45.28 77.418-.07 144.315-53.144 162.787-126.849 1.344-5.363 6.122-9.15 11.651-9.15h57.304c7.498 0 13.194 6.807 11.807 14.176C478.067 417.076 377.187 504 256 504c-66.448 0-126.791-26.136-171.315-68.685L48.97 471.03C33.851 486.149 8 475.441 8 454.059V320c0-13.255 10.745-24 24-24z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/wrench.svg":
/*!************************!*\
  !*** ./svg/wrench.svg ***!
  \************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M507.73 109.1c-2.24-9.03-13.54-12.09-20.12-5.51l-74.36 74.36-67.88-11.31-11.31-67.88 74.36-74.36c6.62-6.62 3.43-17.9-5.66-20.16-47.38-11.74-99.55.91-136.58 37.93-39.64 39.64-50.55 97.1-34.05 147.2L18.74 402.76c-24.99 24.99-24.99 65.51 0 90.5 24.99 24.99 65.51 24.99 90.5 0l213.21-213.21c50.12 16.71 107.47 5.68 147.37-34.22 37.07-37.07 49.7-89.32 37.91-136.73zM64 472c-13.25 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./svg/x-circle.svg":
/*!**************************!*\
  !*** ./svg/x-circle.svg ***!
  \**************************/
/***/ ((module) => {


      module.exports = {
        functional: true,
        render(_h, _vm) {
          const { _c, _v, data, children = [] } = _vm;

          const {
            class: classNames,
            staticClass,
            style,
            staticStyle,
            attrs = {},
            ...rest
          } = data;

          return _c(
            'svg',
            {
              class: [classNames,staticClass],
              style: [style,staticStyle],
              attrs: Object.assign({"viewBox":"0 0 512 512"}, attrs),
              ...rest,
            },
            children.concat([_c('path',{attrs:{"d":"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"}})])
          )
        }
      }
    

/***/ }),

/***/ "./node_modules/vue2-dragula/dist/vue-dragula.js":
/*!*******************************************************!*\
  !*** ./node_modules/vue2-dragula/dist/vue-dragula.js ***!
  \*******************************************************/
/***/ (function(module, exports, __webpack_require__) {

var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
 * vue-dragula v2.5.3
 * (c) 2018 Yichang Liu
 * Released under the MIT License.
 */
(function (global, factory) {
	 true ? factory(exports) :
	0;
}(this, function (exports) { 'use strict';

	var commonjsGlobal = typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}

	function interopDefault(ex) {
		return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
	}

	function createCommonjsModule(fn, module) {
		return module = { exports: {} }, fn(module, module.exports), module.exports;
	}

	var atoa = createCommonjsModule(function (module) {
	  module.exports = function atoa(a, n) {
	    return Array.prototype.slice.call(a, n);
	  };
	});

	var atoa$1 = interopDefault(atoa);

var require$$1 = Object.freeze({
	  default: atoa$1
	});

	var ticky = createCommonjsModule(function (module) {
	  var si = typeof setImmediate === 'function',
	      tick;
	  if (si) {
	    tick = function tick(fn) {
	      setImmediate(fn);
	    };
	  } else if (typeof process !== 'undefined' && process.nextTick) {
	    tick = process.nextTick;
	  } else {
	    tick = function tick(fn) {
	      setTimeout(fn, 0);
	    };
	  }

	  module.exports = tick;
	});

	var ticky$1 = interopDefault(ticky);

var require$$0$1 = Object.freeze({
	  default: ticky$1
	});

	var debounce = createCommonjsModule(function (module) {
	  'use strict';

	  var ticky = interopDefault(require$$0$1);

	  module.exports = function debounce(fn, args, ctx) {
	    if (!fn) {
	      return;
	    }
	    ticky(function run() {
	      fn.apply(ctx || null, args || []);
	    });
	  };
	});

	var debounce$1 = interopDefault(debounce);

var require$$0 = Object.freeze({
	  default: debounce$1
	});

	var emitter = createCommonjsModule(function (module) {
	  'use strict';

	  var atoa = interopDefault(require$$1);
	  var debounce = interopDefault(require$$0);

	  module.exports = function emitter(thing, options) {
	    var opts = options || {};
	    var evt = {};
	    if (thing === undefined) {
	      thing = {};
	    }
	    thing.on = function (type, fn) {
	      if (!evt[type]) {
	        evt[type] = [fn];
	      } else {
	        evt[type].push(fn);
	      }
	      return thing;
	    };
	    thing.once = function (type, fn) {
	      fn._once = true; // thing.off(fn) still works!
	      thing.on(type, fn);
	      return thing;
	    };
	    thing.off = function (type, fn) {
	      var c = arguments.length;
	      if (c === 1) {
	        delete evt[type];
	      } else if (c === 0) {
	        evt = {};
	      } else {
	        var et = evt[type];
	        if (!et) {
	          return thing;
	        }
	        et.splice(et.indexOf(fn), 1);
	      }
	      return thing;
	    };
	    thing.emit = function () {
	      var args = atoa(arguments);
	      return thing.emitterSnapshot(args.shift()).apply(this, args);
	    };
	    thing.emitterSnapshot = function (type) {
	      var et = (evt[type] || []).slice(0);
	      return function () {
	        var args = atoa(arguments);
	        var ctx = this || thing;
	        if (type === 'error' && opts.throws !== false && !et.length) {
	          throw args.length === 1 ? args[0] : args;
	        }
	        et.forEach(function emitter(listen) {
	          if (opts.async) {
	            debounce(listen, args, ctx);
	          } else {
	            listen.apply(ctx, args);
	          }
	          if (listen._once) {
	            thing.off(type, listen);
	          }
	        });
	        return thing;
	      };
	    };
	    return thing;
	  };
	});

	var emitter$1 = interopDefault(emitter);

var require$$2 = Object.freeze({
	  default: emitter$1
	});

	var index = createCommonjsModule(function (module) {
	  var NativeCustomEvent = commonjsGlobal.CustomEvent;

	  function useNative() {
	    try {
	      var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } });
	      return 'cat' === p.type && 'bar' === p.detail.foo;
	    } catch (e) {}
	    return false;
	  }

	  /**
	   * Cross-browser `CustomEvent` constructor.
	   *
	   * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent
	   *
	   * @public
	   */

	  module.exports = useNative() ? NativeCustomEvent :

	  // IE >= 9
	  'function' === typeof document.createEvent ? function CustomEvent(type, params) {
	    var e = document.createEvent('CustomEvent');
	    if (params) {
	      e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail);
	    } else {
	      e.initCustomEvent(type, false, false, void 0);
	    }
	    return e;
	  } :

	  // IE <= 8
	  function CustomEvent(type, params) {
	    var e = document.createEventObject();
	    e.type = type;
	    if (params) {
	      e.bubbles = Boolean(params.bubbles);
	      e.cancelable = Boolean(params.cancelable);
	      e.detail = params.detail;
	    } else {
	      e.bubbles = false;
	      e.cancelable = false;
	      e.detail = void 0;
	    }
	    return e;
	  };
	});

	var index$1 = interopDefault(index);

var require$$1$2 = Object.freeze({
	  default: index$1
	});

	var eventmap = createCommonjsModule(function (module) {
	  'use strict';

	  var eventmap = [];
	  var eventname = '';
	  var ron = /^on/;

	  for (eventname in commonjsGlobal) {
	    if (ron.test(eventname)) {
	      eventmap.push(eventname.slice(2));
	    }
	  }

	  module.exports = eventmap;
	});

	var eventmap$1 = interopDefault(eventmap);

var require$$0$2 = Object.freeze({
	  default: eventmap$1
	});

	var crossvent = createCommonjsModule(function (module) {
	  'use strict';

	  var customEvent = interopDefault(require$$1$2);
	  var eventmap = interopDefault(require$$0$2);
	  var doc = commonjsGlobal.document;
	  var addEvent = addEventEasy;
	  var removeEvent = removeEventEasy;
	  var hardCache = [];

	  if (!commonjsGlobal.addEventListener) {
	    addEvent = addEventHard;
	    removeEvent = removeEventHard;
	  }

	  module.exports = {
	    add: addEvent,
	    remove: removeEvent,
	    fabricate: fabricateEvent
	  };

	  function addEventEasy(el, type, fn, capturing) {
	    return el.addEventListener(type, fn, capturing);
	  }

	  function addEventHard(el, type, fn) {
	    return el.attachEvent('on' + type, wrap(el, type, fn));
	  }

	  function removeEventEasy(el, type, fn, capturing) {
	    return el.removeEventListener(type, fn, capturing);
	  }

	  function removeEventHard(el, type, fn) {
	    var listener = unwrap(el, type, fn);
	    if (listener) {
	      return el.detachEvent('on' + type, listener);
	    }
	  }

	  function fabricateEvent(el, type, model) {
	    var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent();
	    if (el.dispatchEvent) {
	      el.dispatchEvent(e);
	    } else {
	      el.fireEvent('on' + type, e);
	    }
	    function makeClassicEvent() {
	      var e;
	      if (doc.createEvent) {
	        e = doc.createEvent('Event');
	        e.initEvent(type, true, true);
	      } else if (doc.createEventObject) {
	        e = doc.createEventObject();
	      }
	      return e;
	    }
	    function makeCustomEvent() {
	      return new customEvent(type, { detail: model });
	    }
	  }

	  function wrapperFactory(el, type, fn) {
	    return function wrapper(originalEvent) {
	      var e = originalEvent || commonjsGlobal.event;
	      e.target = e.target || e.srcElement;
	      e.preventDefault = e.preventDefault || function preventDefault() {
	        e.returnValue = false;
	      };
	      e.stopPropagation = e.stopPropagation || function stopPropagation() {
	        e.cancelBubble = true;
	      };
	      e.which = e.which || e.keyCode;
	      fn.call(el, e);
	    };
	  }

	  function wrap(el, type, fn) {
	    var wrapper = unwrap(el, type, fn) || wrapperFactory(el, type, fn);
	    hardCache.push({
	      wrapper: wrapper,
	      element: el,
	      type: type,
	      fn: fn
	    });
	    return wrapper;
	  }

	  function unwrap(el, type, fn) {
	    var i = find(el, type, fn);
	    if (i) {
	      var wrapper = hardCache[i].wrapper;
	      hardCache.splice(i, 1); // free up a tad of memory
	      return wrapper;
	    }
	  }

	  function find(el, type, fn) {
	    var i, item;
	    for (i = 0; i < hardCache.length; i++) {
	      item = hardCache[i];
	      if (item.element === el && item.type === type && item.fn === fn) {
	        return i;
	      }
	    }
	  }
	});

	var crossvent$1 = interopDefault(crossvent);
	var add = crossvent.add;
	var remove = crossvent.remove;
	var fabricate = crossvent.fabricate;

var require$$1$1 = Object.freeze({
	  default: crossvent$1,
	  add: add,
	  remove: remove,
	  fabricate: fabricate
	});

	var classes = createCommonjsModule(function (module) {
	  'use strict';

	  var cache = {};
	  var start = '(?:^|\\s)';
	  var end = '(?:\\s|$)';

	  function lookupClass(className) {
	    var cached = cache[className];
	    if (cached) {
	      cached.lastIndex = 0;
	    } else {
	      cache[className] = cached = new RegExp(start + className + end, 'g');
	    }
	    return cached;
	  }

	  function addClass(el, className) {
	    var current = el.className;
	    if (!current.length) {
	      el.className = className;
	    } else if (!lookupClass(className).test(current)) {
	      el.className += ' ' + className;
	    }
	  }

	  function rmClass(el, className) {
	    el.className = el.className.replace(lookupClass(className), ' ').trim();
	  }

	  module.exports = {
	    add: addClass,
	    rm: rmClass
	  };
	});

	var classes$1 = interopDefault(classes);
	var add$1 = classes.add;
	var rm = classes.rm;

var require$$0$3 = Object.freeze({
	  default: classes$1,
	  add: add$1,
	  rm: rm
	});

	var dragula = createCommonjsModule(function (module) {
	  'use strict';

	  var emitter = interopDefault(require$$2);
	  var crossvent = interopDefault(require$$1$1);
	  var classes = interopDefault(require$$0$3);
	  var doc = document;
	  var documentElement = doc.documentElement;

	  function dragula(initialContainers, options) {
	    var len = arguments.length;
	    if (len === 1 && Array.isArray(initialContainers) === false) {
	      options = initialContainers;
	      initialContainers = [];
	    }
	    var _mirror; // mirror image
	    var _source; // source container
	    var _item; // item being dragged
	    var _offsetX; // reference x
	    var _offsetY; // reference y
	    var _moveX; // reference move x
	    var _moveY; // reference move y
	    var _initialSibling; // reference sibling when grabbed
	    var _currentSibling; // reference sibling now
	    var _copy; // item used for copying
	    var _renderTimer; // timer for setTimeout renderMirrorImage
	    var _lastDropTarget = null; // last container item was over
	    var _grabbed; // holds mousedown context until first mousemove

	    var o = options || {};
	    if (o.moves === void 0) {
	      o.moves = always;
	    }
	    if (o.accepts === void 0) {
	      o.accepts = always;
	    }
	    if (o.invalid === void 0) {
	      o.invalid = invalidTarget;
	    }
	    if (o.containers === void 0) {
	      o.containers = initialContainers || [];
	    }
	    if (o.isContainer === void 0) {
	      o.isContainer = never;
	    }
	    if (o.copy === void 0) {
	      o.copy = false;
	    }
	    if (o.copySortSource === void 0) {
	      o.copySortSource = false;
	    }
	    if (o.revertOnSpill === void 0) {
	      o.revertOnSpill = false;
	    }
	    if (o.removeOnSpill === void 0) {
	      o.removeOnSpill = false;
	    }
	    if (o.direction === void 0) {
	      o.direction = 'vertical';
	    }
	    if (o.ignoreInputTextSelection === void 0) {
	      o.ignoreInputTextSelection = true;
	    }
	    if (o.mirrorContainer === void 0) {
	      o.mirrorContainer = doc.body;
	    }

	    var drake = emitter({
	      containers: o.containers,
	      start: manualStart,
	      end: end,
	      cancel: cancel,
	      remove: remove,
	      destroy: destroy,
	      canMove: canMove,
	      dragging: false
	    });

	    if (o.removeOnSpill === true) {
	      drake.on('over', spillOver).on('out', spillOut);
	    }

	    events();

	    return drake;

	    function isContainer(el) {
	      return drake.containers.indexOf(el) !== -1 || o.isContainer(el);
	    }

	    function events(remove) {
	      var op = remove ? 'remove' : 'add';
	      touchy(documentElement, op, 'mousedown', grab);
	      touchy(documentElement, op, 'mouseup', release);
	    }

	    function eventualMovements(remove) {
	      var op = remove ? 'remove' : 'add';
	      touchy(documentElement, op, 'mousemove', startBecauseMouseMoved);
	    }

	    function movements(remove) {
	      var op = remove ? 'remove' : 'add';
	      crossvent[op](documentElement, 'selectstart', preventGrabbed); // IE8
	      crossvent[op](documentElement, 'click', preventGrabbed);
	    }

	    function destroy() {
	      events(true);
	      release({});
	    }

	    function preventGrabbed(e) {
	      if (_grabbed) {
	        e.preventDefault();
	      }
	    }

	    function grab(e) {
	      _moveX = e.clientX;
	      _moveY = e.clientY;

	      var ignore = whichMouseButton(e) !== 1 || e.metaKey || e.ctrlKey;
	      if (ignore) {
	        return; // we only care about honest-to-god left clicks and touch events
	      }
	      var item = e.target;
	      var context = canStart(item);
	      if (!context) {
	        return;
	      }
	      _grabbed = context;
	      eventualMovements();
	      if (e.type === 'mousedown') {
	        if (isInput(item)) {
	          // see also: https://github.com/bevacqua/dragula/issues/208
	          item.focus(); // fixes https://github.com/bevacqua/dragula/issues/176
	        } else {
	          e.preventDefault(); // fixes https://github.com/bevacqua/dragula/issues/155
	        }
	      }
	    }

	    function startBecauseMouseMoved(e) {
	      if (!_grabbed) {
	        return;
	      }
	      if (whichMouseButton(e) === 0) {
	        release({});
	        return; // when text is selected on an input and then dragged, mouseup doesn't fire. this is our only hope
	      }
	      // truthy check fixes #239, equality fixes #207
	      if (e.clientX !== void 0 && e.clientX === _moveX && e.clientY !== void 0 && e.clientY === _moveY) {
	        return;
	      }
	      if (o.ignoreInputTextSelection) {
	        var clientX = getCoord('clientX', e);
	        var clientY = getCoord('clientY', e);
	        var elementBehindCursor = doc.elementFromPoint(clientX, clientY);
	        if (isInput(elementBehindCursor)) {
	          return;
	        }
	      }

	      var grabbed = _grabbed; // call to end() unsets _grabbed
	      eventualMovements(true);
	      movements();
	      end();
	      start(grabbed);

	      var offset = getOffset(_item);
	      _offsetX = getCoord('pageX', e) - offset.left;
	      _offsetY = getCoord('pageY', e) - offset.top;

	      classes.add(_copy || _item, 'gu-transit');
	      renderMirrorImage();
	      drag(e);
	    }

	    function canStart(item) {
	      if (drake.dragging && _mirror) {
	        return;
	      }
	      if (isContainer(item)) {
	        return; // don't drag container itself
	      }
	      var handle = item;
	      while (getParent(item) && isContainer(getParent(item)) === false) {
	        if (o.invalid(item, handle)) {
	          return;
	        }
	        item = getParent(item); // drag target should be a top element
	        if (!item) {
	          return;
	        }
	      }
	      var source = getParent(item);
	      if (!source) {
	        return;
	      }
	      if (o.invalid(item, handle)) {
	        return;
	      }

	      var movable = o.moves(item, source, handle, nextEl(item));
	      if (!movable) {
	        return;
	      }

	      return {
	        item: item,
	        source: source
	      };
	    }

	    function canMove(item) {
	      return !!canStart(item);
	    }

	    function manualStart(item) {
	      var context = canStart(item);
	      if (context) {
	        start(context);
	      }
	    }

	    function start(context) {
	      if (isCopy(context.item, context.source)) {
	        _copy = context.item.cloneNode(true);
	        drake.emit('cloned', _copy, context.item, 'copy');
	      }

	      _source = context.source;
	      _item = context.item;
	      _initialSibling = _currentSibling = nextEl(context.item);

	      drake.dragging = true;
	      drake.emit('drag', _item, _source);
	    }

	    function invalidTarget() {
	      return false;
	    }

	    function end() {
	      if (!drake.dragging) {
	        return;
	      }
	      var item = _copy || _item;
	      drop(item, getParent(item));
	    }

	    function ungrab() {
	      _grabbed = false;
	      eventualMovements(true);
	      movements(true);
	    }

	    function release(e) {
	      ungrab();

	      if (!drake.dragging) {
	        return;
	      }
	      var item = _copy || _item;
	      var clientX = getCoord('clientX', e);
	      var clientY = getCoord('clientY', e);
	      var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
	      var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
	      if (dropTarget && (_copy && o.copySortSource || !_copy || dropTarget !== _source)) {
	        drop(item, dropTarget);
	      } else if (o.removeOnSpill) {
	        remove();
	      } else {
	        cancel();
	      }
	    }

	    function drop(item, target) {
	      var parent = getParent(item);
	      if (_copy && o.copySortSource && target === _source) {
	        parent.removeChild(_item);
	      }
	      if (isInitialPlacement(target)) {
	        drake.emit('cancel', item, _source, _source);
	      } else {
	        drake.emit('drop', item, target, _source, _currentSibling);
	      }
	      cleanup();
	    }

	    function remove() {
	      if (!drake.dragging) {
	        return;
	      }
	      var item = _copy || _item;
	      var parent = getParent(item);
	      if (parent) {
	        parent.removeChild(item);
	      }
	      drake.emit(_copy ? 'cancel' : 'remove', item, parent, _source);
	      cleanup();
	    }

	    function cancel(revert) {
	      if (!drake.dragging) {
	        return;
	      }
	      var reverts = arguments.length > 0 ? revert : o.revertOnSpill;
	      var item = _copy || _item;
	      var parent = getParent(item);
	      var initial = isInitialPlacement(parent);
	      if (initial === false && reverts) {
	        if (_copy) {
	          if (parent) {
	            parent.removeChild(_copy);
	          }
	        } else {
	          _source.insertBefore(item, _initialSibling);
	        }
	      }
	      if (initial || reverts) {
	        drake.emit('cancel', item, _source, _source);
	      } else {
	        drake.emit('drop', item, parent, _source, _currentSibling);
	      }
	      cleanup();
	    }

	    function cleanup() {
	      var item = _copy || _item;
	      ungrab();
	      removeMirrorImage();
	      if (item) {
	        classes.rm(item, 'gu-transit');
	      }
	      if (_renderTimer) {
	        clearTimeout(_renderTimer);
	      }
	      drake.dragging = false;
	      if (_lastDropTarget) {
	        drake.emit('out', item, _lastDropTarget, _source);
	      }
	      drake.emit('dragend', item);
	      _source = _item = _copy = _initialSibling = _currentSibling = _renderTimer = _lastDropTarget = null;
	    }

	    function isInitialPlacement(target, s) {
	      var sibling;
	      if (s !== void 0) {
	        sibling = s;
	      } else if (_mirror) {
	        sibling = _currentSibling;
	      } else {
	        sibling = nextEl(_copy || _item);
	      }
	      return target === _source && sibling === _initialSibling;
	    }

	    function findDropTarget(elementBehindCursor, clientX, clientY) {
	      var target = elementBehindCursor;
	      while (target && !accepted()) {
	        target = getParent(target);
	      }
	      return target;

	      function accepted() {
	        var droppable = isContainer(target);
	        if (droppable === false) {
	          return false;
	        }

	        var immediate = getImmediateChild(target, elementBehindCursor);
	        var reference = getReference(target, immediate, clientX, clientY);
	        var initial = isInitialPlacement(target, reference);
	        if (initial) {
	          return true; // should always be able to drop it right back where it was
	        }
	        return o.accepts(_item, target, _source, reference);
	      }
	    }

	    function drag(e) {
	      if (!_mirror) {
	        return;
	      }
	      e.preventDefault();

	      var clientX = getCoord('clientX', e);
	      var clientY = getCoord('clientY', e);
	      var x = clientX - _offsetX;
	      var y = clientY - _offsetY;

	      _mirror.style.left = x + 'px';
	      _mirror.style.top = y + 'px';

	      var item = _copy || _item;
	      var elementBehindCursor = getElementBehindPoint(_mirror, clientX, clientY);
	      var dropTarget = findDropTarget(elementBehindCursor, clientX, clientY);
	      var changed = dropTarget !== null && dropTarget !== _lastDropTarget;
	      if (changed || dropTarget === null) {
	        out();
	        _lastDropTarget = dropTarget;
	        over();
	      }
	      var parent = getParent(item);
	      if (dropTarget === _source && _copy && !o.copySortSource) {
	        if (parent) {
	          parent.removeChild(item);
	        }
	        return;
	      }
	      var reference;
	      var immediate = getImmediateChild(dropTarget, elementBehindCursor);
	      if (immediate !== null) {
	        reference = getReference(dropTarget, immediate, clientX, clientY);
	      } else if (o.revertOnSpill === true && !_copy) {
	        reference = _initialSibling;
	        dropTarget = _source;
	      } else {
	        if (_copy && parent) {
	          parent.removeChild(item);
	        }
	        return;
	      }
	      if (reference === null && changed || reference !== item && reference !== nextEl(item)) {
	        _currentSibling = reference;
	        dropTarget.insertBefore(item, reference);
	        drake.emit('shadow', item, dropTarget, _source);
	      }
	      function moved(type) {
	        drake.emit(type, item, _lastDropTarget, _source);
	      }
	      function over() {
	        if (changed) {
	          moved('over');
	        }
	      }
	      function out() {
	        if (_lastDropTarget) {
	          moved('out');
	        }
	      }
	    }

	    function spillOver(el) {
	      classes.rm(el, 'gu-hide');
	    }

	    function spillOut(el) {
	      if (drake.dragging) {
	        classes.add(el, 'gu-hide');
	      }
	    }

	    function renderMirrorImage() {
	      if (_mirror) {
	        return;
	      }
	      var rect = _item.getBoundingClientRect();
	      _mirror = _item.cloneNode(true);
	      _mirror.style.width = getRectWidth(rect) + 'px';
	      _mirror.style.height = getRectHeight(rect) + 'px';
	      classes.rm(_mirror, 'gu-transit');
	      classes.add(_mirror, 'gu-mirror');
	      o.mirrorContainer.appendChild(_mirror);
	      touchy(documentElement, 'add', 'mousemove', drag);
	      classes.add(o.mirrorContainer, 'gu-unselectable');
	      drake.emit('cloned', _mirror, _item, 'mirror');
	    }

	    function removeMirrorImage() {
	      if (_mirror) {
	        classes.rm(o.mirrorContainer, 'gu-unselectable');
	        touchy(documentElement, 'remove', 'mousemove', drag);
	        getParent(_mirror).removeChild(_mirror);
	        _mirror = null;
	      }
	    }

	    function getImmediateChild(dropTarget, target) {
	      var immediate = target;
	      while (immediate !== dropTarget && getParent(immediate) !== dropTarget) {
	        immediate = getParent(immediate);
	      }
	      if (immediate === documentElement) {
	        return null;
	      }
	      return immediate;
	    }

	    function getReference(dropTarget, target, x, y) {
	      var horizontal = o.direction === 'horizontal';
	      var reference = target !== dropTarget ? inside() : outside();
	      return reference;

	      function outside() {
	        // slower, but able to figure out any position
	        var len = dropTarget.children.length;
	        var i;
	        var el;
	        var rect;
	        for (i = 0; i < len; i++) {
	          el = dropTarget.children[i];
	          rect = el.getBoundingClientRect();
	          if (horizontal && rect.left + rect.width / 2 > x) {
	            return el;
	          }
	          if (!horizontal && rect.top + rect.height / 2 > y) {
	            return el;
	          }
	        }
	        return null;
	      }

	      function inside() {
	        // faster, but only available if dropped inside a child element
	        var rect = target.getBoundingClientRect();
	        if (horizontal) {
	          return resolve(x > rect.left + getRectWidth(rect) / 2);
	        }
	        return resolve(y > rect.top + getRectHeight(rect) / 2);
	      }

	      function resolve(after) {
	        return after ? nextEl(target) : target;
	      }
	    }

	    function isCopy(item, container) {
	      return typeof o.copy === 'boolean' ? o.copy : o.copy(item, container);
	    }
	  }

	  function touchy(el, op, type, fn) {
	    var touch = {
	      mouseup: 'touchend',
	      mousedown: 'touchstart',
	      mousemove: 'touchmove'
	    };
	    var pointers = {
	      mouseup: 'pointerup',
	      mousedown: 'pointerdown',
	      mousemove: 'pointermove'
	    };
	    var microsoft = {
	      mouseup: 'MSPointerUp',
	      mousedown: 'MSPointerDown',
	      mousemove: 'MSPointerMove'
	    };
	    if (commonjsGlobal.navigator.pointerEnabled) {
	      crossvent[op](el, pointers[type], fn);
	    } else if (commonjsGlobal.navigator.msPointerEnabled) {
	      crossvent[op](el, microsoft[type], fn);
	    } else {
	      crossvent[op](el, touch[type], fn);
	      crossvent[op](el, type, fn);
	    }
	  }

	  function whichMouseButton(e) {
	    if (e.touches !== void 0) {
	      return e.touches.length;
	    }
	    if (e.which !== void 0 && e.which !== 0) {
	      return e.which;
	    } // see https://github.com/bevacqua/dragula/issues/261
	    if (e.buttons !== void 0) {
	      return e.buttons;
	    }
	    var button = e.button;
	    if (button !== void 0) {
	      // see https://github.com/jquery/jquery/blob/99e8ff1baa7ae341e94bb89c3e84570c7c3ad9ea/src/event.js#L573-L575
	      return button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;
	    }
	  }

	  function getOffset(el) {
	    var rect = el.getBoundingClientRect();
	    return {
	      left: rect.left + getScroll('scrollLeft', 'pageXOffset'),
	      top: rect.top + getScroll('scrollTop', 'pageYOffset')
	    };
	  }

	  function getScroll(scrollProp, offsetProp) {
	    if (typeof commonjsGlobal[offsetProp] !== 'undefined') {
	      return commonjsGlobal[offsetProp];
	    }
	    if (documentElement.clientHeight) {
	      return documentElement[scrollProp];
	    }
	    return doc.body[scrollProp];
	  }

	  function getElementBehindPoint(point, x, y) {
	    var p = point || {};
	    var state = p.className;
	    var el;
	    p.className += ' gu-hide';
	    el = doc.elementFromPoint(x, y);
	    p.className = state;
	    return el;
	  }

	  function never() {
	    return false;
	  }
	  function always() {
	    return true;
	  }
	  function getRectWidth(rect) {
	    return rect.width || rect.right - rect.left;
	  }
	  function getRectHeight(rect) {
	    return rect.height || rect.bottom - rect.top;
	  }
	  function getParent(el) {
	    return el.parentNode === doc ? null : el.parentNode;
	  }
	  function isInput(el) {
	    return el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT' || isEditable(el);
	  }
	  function isEditable(el) {
	    if (!el) {
	      return false;
	    } // no parents were editable
	    if (el.contentEditable === 'false') {
	      return false;
	    } // stop the lookup
	    if (el.contentEditable === 'true') {
	      return true;
	    } // found a contentEditable element in the chain
	    return isEditable(getParent(el)); // contentEditable is set to 'inherit'
	  }

	  function nextEl(el) {
	    return el.nextElementSibling || manually();
	    function manually() {
	      var sibling = el;
	      do {
	        sibling = sibling.nextSibling;
	      } while (sibling && sibling.nodeType !== 1);
	      return sibling;
	    }
	  }

	  function getEventHost(e) {
	    // on touchend event, we have to use `e.changedTouches`
	    // see http://stackoverflow.com/questions/7192563/touchend-event-properties
	    // see https://github.com/bevacqua/dragula/issues/34
	    if (e.targetTouches && e.targetTouches.length) {
	      return e.targetTouches[0];
	    }
	    if (e.changedTouches && e.changedTouches.length) {
	      return e.changedTouches[0];
	    }
	    return e;
	  }

	  function getCoord(coord, e) {
	    var host = getEventHost(e);
	    var missMap = {
	      pageX: 'clientX', // IE8
	      pageY: 'clientY' // IE8
	    };
	    if (coord in missMap && !(coord in host) && missMap[coord] in host) {
	      coord = missMap[coord];
	    }
	    return host[coord];
	  }

	  module.exports = dragula;
	});

	var dragula$1 = interopDefault(dragula);

	var classCallCheck = function (instance, Constructor) {
	  if (!(instance instanceof Constructor)) {
	    throw new TypeError("Cannot call a class as a function");
	  }
	};

	var createClass = function () {
	  function defineProperties(target, props) {
	    for (var i = 0; i < props.length; i++) {
	      var descriptor = props[i];
	      descriptor.enumerable = descriptor.enumerable || false;
	      descriptor.configurable = true;
	      if ("value" in descriptor) descriptor.writable = true;
	      Object.defineProperty(target, descriptor.key, descriptor);
	    }
	  }

	  return function (Constructor, protoProps, staticProps) {
	    if (protoProps) defineProperties(Constructor.prototype, protoProps);
	    if (staticProps) defineProperties(Constructor, staticProps);
	    return Constructor;
	  };
	}();

	var inherits = function (subClass, superClass) {
	  if (typeof superClass !== "function" && superClass !== null) {
	    throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
	  }

	  subClass.prototype = Object.create(superClass && superClass.prototype, {
	    constructor: {
	      value: subClass,
	      enumerable: false,
	      writable: true,
	      configurable: true
	    }
	  });
	  if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
	};

	var possibleConstructorReturn = function (self, call) {
	  if (!self) {
	    throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
	  }

	  return call && (typeof call === "object" || typeof call === "function") ? call : self;
	};

	var raf = window.requestAnimationFrame;

	function raffy(fn) {
	  raf(function () {
	    raf(fn);
	  });
	}

	function winTimeout(fn) {
	  window.setTimeout(fn, 50);
	}

	var waitForTransition = raf ? raffy : winTimeout;

	function isObject(obj) {
	  return obj === Object(obj);
	}

	var DragHandler = function () {
	  function DragHandler(_ref) {
	    var ctx = _ref.ctx,
	        name = _ref.name,
	        drake = _ref.drake,
	        options = _ref.options;
	    classCallCheck(this, DragHandler);

	    this.dragElm = null;
	    this.dragIndex = null;
	    this.dropIndex = null;
	    this.sourceModel = null;
	    this.logging = ctx.logging;
	    this.ctx = ctx;
	    this.serviceName = ctx.name;
	    this.modelManager = ctx.modelManager;
	    this.drake = drake;
	    this.name = name;
	    this.eventBus = ctx.eventBus;
	    this.findModelForContainer = ctx.findModelForContainer.bind(ctx);
	    this.domIndexOf = ctx.domIndexOf.bind(ctx);
	  }

	  createClass(DragHandler, [{
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      (_console = console).log.apply(_console, [this.clazzName + ' [' + this.name + '] :', event].concat(args));
	    }

	    /**
	     * Remove model at drag index
	     */

	  }, {
	    key: 'removeModel',
	    value: function removeModel() {
	      this.log('removeModel', {
	        sourceModel: this.sourceModel,
	        dragIndex: this.dragIndex
	      });
	      this.sourceModel.removeAt(this.dragIndex);
	    }

	    /**
	     * Drop model on same container
	     * Move model from dropIndex to dragIndex
	     */

	  }, {
	    key: 'dropModelSame',
	    value: function dropModelSame() {
	      this.log('dropModelSame', {
	        sourceModel: this.sourceModel,
	        dragIndex: this.dragIndex,
	        dropIndex: this.dropIndex
	      });

	      this.sourceModel.move({
	        dropIndex: this.dropIndex,
	        dragIndex: this.dragIndex
	      });
	    }

	    /**
	     * Insert model on targetModel
	     * @param {*} targetModel
	     * @param {*} dropElmModel
	     * @param {*} elements
	     */

	  }, {
	    key: 'insertModel',
	    value: function insertModel(targetModel, dropElmModel, elements) {
	      this.log('insertModel', {
	        targetModel: targetModel,
	        dropIndex: this.dropIndex,
	        dropElmModel: dropElmModel,
	        elements: elements
	      });

	      targetModel.insertAt(this.dropIndex, dropElmModel);

	      this.emit('insertAt', {
	        elements: elements,
	        targetModel: targetModel,
	        transitModel: dropElmModel,
	        dragIndex: this.dragIndex,
	        dropIndex: this.dropIndex,
	        models: {
	          source: this.sourceModel,
	          target: targetModel,
	          transit: dropElmModel
	        },
	        indexes: {
	          source: this.dragIndex,
	          target: this.dropIndex
	        }
	      });
	    }

	    /**
	     * If not copy, we remove model from source model after a nice transition
	     */

	  }, {
	    key: 'notCopy',
	    value: function notCopy() {
	      var _this = this;

	      waitForTransition(function () {
	        _this.sourceModel.removeAt(_this.dragIndex);
	      });
	    }

	    /**
	     * Cancel drop
	     * @param {*} target
	     */

	  }, {
	    key: 'cancelDrop',
	    value: function cancelDrop(target) {
	      this.log('No targetModel could be found for target:', {
	        target: target
	      });
	      this.log('in drake:', {
	        drake: this.drake
	      });
	      this.drake.cancel(true);
	    }

	    /**
	     * Handle drop model from source to target
	     * @param {*} dropElm
	     * @param {*} target
	     * @param {*} source
	     */

	  }, {
	    key: 'dropModelTarget',
	    value: function dropModelTarget(dropElm, target, source) {
	      this.log('dropModelTarget', {
	        dropElm: dropElm,
	        target: target,
	        source: source
	      });
	      var notCopy = this.dragElm === dropElm;
	      var targetModel = this.getModel(target);
	      var dropElmModel = notCopy ? this.dropElmModel() : this.jsonDropElmModel();

	      if (notCopy) {
	        this.notCopy();
	      }

	      if (!targetModel) {
	        return this.cancelDrop(target);
	      }

	      var elements = {
	        drop: dropElm,
	        target: target,
	        source: source
	      };

	      this.insertModel(targetModel, dropElmModel, elements);
	    }
	  }, {
	    key: 'dropModel',
	    value: function dropModel(dropElm, target, source) {
	      this.log('dropModel', {
	        dropElm: dropElm,
	        target: target,
	        source: source
	      });
	      target === source ? this.dropModelSame() : this.dropModelTarget(dropElm, target, source);
	    }
	  }, {
	    key: 'emit',
	    value: function emit(eventName) {
	      var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	      this.log('emit', {
	        eventName: eventName,
	        opts: opts
	      });
	      opts.sourceModel = this.sourceModel;
	      opts.name = this.name;
	      this.eventBus.$emit(eventName, opts);

	      this.log('emit service', {
	        serviceEventName: serviceEventName,
	        eventName: eventName,
	        opts: opts
	      });
	      var serviceEventName = this.serviceName + ':' + eventName;
	      this.eventBus.$emit(serviceEventName, opts);
	    }

	    /**
	     * Get model from location in
	     * @param {*} location
	     */

	  }, {
	    key: 'getModel',
	    value: function getModel(location) {
	      var model = this.findModelForContainer(location, this.drake);
	      this.log('getModel', {
	        location: location,
	        model: model
	      });

	      return this.modelManager.createFor({
	        name: this.name,
	        drake: this.drake,
	        logging: this.logging,
	        model: model
	      });
	    }

	    /**
	     * Remov element from container in source
	     * @param {*} el
	     * @param {*} container
	     * @param {*} source
	     */

	  }, {
	    key: 'remove',
	    value: function remove(el, container, source) {
	      this.log('remove', {
	        el: el,
	        container: container,
	        source: source
	      });
	      if (!this.drake.models) {
	        this.log('Warning: Can NOT remove it. Must have models:', this.drake.models);
	        return;
	      }

	      this.sourceModel = this.getModel(source);
	      this.removeModel();
	      this.drake.cancel(true);

	      this.emit('removeModel', {
	        el: el,
	        source: source,
	        dragIndex: this.dragIndex
	      });
	    }

	    /**
	     * Handle drag element from source
	     * @param {*} el
	     * @param {*} source
	     */

	  }, {
	    key: 'drag',
	    value: function drag(el, source) {
	      this.log('drag', {
	        el: el,
	        source: source
	      });
	      this.dragElm = el;
	      this.dragIndex = this.domIndexOf(el, source);
	    }

	    /**
	     * Handle drop element from source to target
	     * @param {*} dropEl
	     * @param {*} target
	     * @param {*} source
	     */

	  }, {
	    key: 'drop',
	    value: function drop(dropEl, target, source) {
	      this.log('drop', {
	        dropEl: dropEl,
	        target: target,
	        source: source
	      });
	      if (!this.drake.models && !target) {
	        this.log('Warning: Can NOT drop it. Must have either models:', this.drake.models, ' or target:', target);
	        return;
	      }
	      this.dropIndex = this.domIndexOf(dropEl, target);
	      this.sourceModel = this.getModel(source);
	      this.dropModel(dropEl, target, source);

	      this.emit('dropModel', {
	        target: target,
	        source: source,
	        el: dropEl,
	        dragIndex: this.dragIndex,
	        dropIndex: this.dropIndex
	      });
	    }
	  }, {
	    key: 'dropElmModel',
	    value: function dropElmModel() {
	      return this.sourceModel.at(this.dragIndex);
	    }
	  }, {
	    key: 'jsonDropElmModel',
	    value: function jsonDropElmModel() {
	      var model = this.sourceModel.at(this.dragIndex);
	      var stringable = model ? model.model || model.stringable : model;
	      var md = stringable || model;
	      if (!isObject(md)) {
	        this.log('jsonDropElmModel', 'invalid element model, must be some sort of Object', stringable, model);
	      }
	      try {
	        var jsonStr = JSON.stringify(stringable || model);
	        return JSON.parse(jsonStr);
	      } catch (e) {
	        this.log('jsonDropElmModel', 'JSON stringify/parse error', e);
	      }
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'DragHandler';
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging && this.logging.dragHandler;
	    }
	  }]);
	  return DragHandler;
	}();

	var BaseModelManager = function () {
	  function BaseModelManager() {
	    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	    classCallCheck(this, BaseModelManager);

	    if (Array.isArray(opts)) {
	      opts = {
	        model: opts
	      };
	    }
	    opts.drake = opts.drake || {};
	    this.opts = opts;
	    this.copy = opts.copy || opts.drake.copy;
	    this.name = opts.name;
	    this.drake = opts.drake;
	    this.logging = opts.logging;
	    this.logging = opts.logging;
	    this.modelRef = opts.model || [];
	  }

	  createClass(BaseModelManager, [{
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      (_console = console).log.apply(_console, [this.clazzName + ' [' + this.name + '] :', event].concat(args));
	    }
	  }, {
	    key: 'notYet',
	    value: function notYet(name) {
	      this.log(name, 'not yet implemented');
	    }
	  }, {
	    key: 'undo',
	    value: function undo() {
	      this.notYet('undo');
	    }
	  }, {
	    key: 'redo',
	    value: function redo() {
	      this.notYet('redo');
	    }
	  }, {
	    key: 'at',
	    value: function at(index) {
	      this.notYet('at');
	    }
	  }, {
	    key: 'clear',
	    value: function clear() {
	      this.notYet('clear');
	    }
	  }, {
	    key: 'createModel',
	    value: function createModel(model) {
	      this.notYet('createModel');
	    }
	  }, {
	    key: 'createFor',
	    value: function createFor() {
	      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	      this.notYet('createFor');
	    }
	  }, {
	    key: 'removeAt',
	    value: function removeAt(index) {
	      this.notYet('removeAt');
	    }
	  }, {
	    key: 'insertAt',
	    value: function insertAt(index, dropModel) {
	      this.notYet('removeAt');
	    }
	  }, {
	    key: 'move',
	    value: function move(_ref) {
	      var dragIndex = _ref.dragIndex,
	          dropIndex = _ref.dropIndex;

	      this.notYet('move');
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'BaseModelManager';
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging && this.logging.modelManager;
	    }
	  }]);
	  return BaseModelManager;
	}();

	var ModelManager = function (_BaseModelManager) {
	  inherits(ModelManager, _BaseModelManager);

	  function ModelManager() {
	    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	    classCallCheck(this, ModelManager);

	    var _this = possibleConstructorReturn(this, (ModelManager.__proto__ || Object.getPrototypeOf(ModelManager)).call(this, opts));

	    _this.model = _this.createModel(_this.modelRef);
	    _this.log('CREATE', opts);
	    return _this;
	  }

	  createClass(ModelManager, [{
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      (_console = console).log.apply(_console, [this.clazzName + ' [' + this.name + '] :', event].concat(args));
	    }
	  }, {
	    key: 'undo',
	    value: function undo() {
	      this.log('undo', 'not yet implemented');
	    }
	  }, {
	    key: 'redo',
	    value: function redo() {
	      this.log('redo', 'not yet implemented');
	    }
	  }, {
	    key: 'at',
	    value: function at(index) {
	      return this.model.get ? this.model.get(index) : this.model[index];
	    }
	  }, {
	    key: 'clear',
	    value: function clear() {
	      this.model = this.createModel();
	    }
	  }, {
	    key: 'createModel',
	    value: function createModel(model) {
	      return this.model || model || [];
	    }
	  }, {
	    key: 'createFor',
	    value: function createFor() {
	      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	      return new ModelManager(opts);
	    }
	  }, {
	    key: 'removeAt',
	    value: function removeAt(index) {
	      if (this.copy) return;
	      this.log('removeAt', {
	        model: this.model,
	        index: index
	      });
	      var splicedModel = this.model.splice(index, 1);
	      var removedModel = this.model;

	      this.log({
	        splicedModel: splicedModel,
	        removedModel: removedModel
	      });
	      return splicedModel;
	    }
	  }, {
	    key: 'insertAt',
	    value: function insertAt(index, insertModel) {
	      this.log('insertAt', {
	        model: this.model,
	        index: index,
	        insertModel: insertModel
	      });
	      // according to Vue docs, Vue wraps splice method to mutate array in place and update view
	      var splicedModel = this.model.splice(index, 0, insertModel);
	      var modelAfterInsert = this.model;

	      this.log('insertAt', {
	        splicedModel: splicedModel,
	        modelAfterInsert: modelAfterInsert
	      });
	      return modelAfterInsert;
	    }
	  }, {
	    key: 'move',
	    value: function move(_ref) {
	      var dragIndex = _ref.dragIndex,
	          dropIndex = _ref.dropIndex;

	      if (this.copy) return;
	      this.log('move', {
	        model: this.model,
	        dragIndex: dragIndex,
	        dropIndex: dropIndex
	      });
	      var splicedRemainder = this.model.splice(dragIndex, 1);
	      var remainder = splicedRemainder[0];

	      var modelAfterRemove = this.model.splice(dropIndex, 0, remainder);
	      var movedModel = this.model;

	      this.log('move', {
	        splicedRemainder: splicedRemainder,
	        modelAfterRemove: modelAfterRemove,
	        movedModel: movedModel
	      });
	      return modelAfterRemove;
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'ModelManager';
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging && this.logging.modelManager;
	    }
	  }]);
	  return ModelManager;
	}(BaseModelManager);

	if (!dragula$1) {
	  throw new Error('[vue-dragula] cannot locate dragula.');
	}

	function createDragHandler(_ref) {
	  var ctx = _ref.ctx,
	      name = _ref.name,
	      drake = _ref.drake;

	  return new DragHandler({
	    ctx: ctx,
	    name: name,
	    drake: drake
	  });
	}

	function createModelManager(opts) {
	  return new ModelManager(opts);
	}

	var DragulaService = function () {
	  function DragulaService() {
	    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	    classCallCheck(this, DragulaService);
	    var name = opts.name,
	        eventBus = opts.eventBus,
	        drakes = opts.drakes,
	        options = opts.options;

	    options = options || {};
	    this.options = options;
	    this.logging = options.logging;

	    this.log('CREATE DragulaService', opts);

	    this.name = name;
	    this.drakes = drakes || {}; // drake store
	    this.eventBus = eventBus;
	    this.createDragHandler = options.createDragHandler || createDragHandler;
	    this.createModelManager = options.createModelManager || createModelManager;

	    this.modelManager = this.createModelManager(options);

	    // Dragula events supported
	    this.events = ['cancel', 'cloned', 'drag', 'dragend', 'drop', 'out', 'over', 'remove', 'shadow', 'dropModel', 'removeModel', 'accepts', 'moves', 'invalid'];
	  }

	  createClass(DragulaService, [{
	    key: 'addEvents',
	    value: function addEvents() {
	      var _events;

	      this.events = (_events = this.events).concat.apply(_events, arguments);
	    }
	  }, {
	    key: 'removeEvents',
	    value: function removeEvents() {
	      for (var _len = arguments.length, eventNames = Array(_len), _key = 0; _key < _len; _key++) {
	        eventNames[_key] = arguments[_key];
	      }

	      this.events = this.events.filter(function (name) {
	        return eventNames.includes(name);
	      });
	    }
	  }, {
	    key: 'createModel',
	    value: function createModel() {
	      return this.modelManager.createModel();
	    }
	  }, {
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
	        args[_key2 - 1] = arguments[_key2];
	      }

	      (_console = console).log.apply(_console, ['DragulaService [' + this.name + '] :', event].concat(args));
	    }
	  }, {
	    key: 'error',
	    value: function error(msg) {
	      console.error(msg);
	      throw new Error(msg);
	    }
	  }, {
	    key: '_validate',
	    value: function _validate(method, name) {
	      if (!name) {
	        this.error(method + ' must take a drake name as the first argument');
	      }
	    }
	  }, {
	    key: 'add',
	    value: function add(name, drake) {
	      this.log('add (drake)', name, drake);
	      this._validate('add', name);
	      if (this.find(name)) {
	        this.log('existing drakes', this.drakeNames);
	        var errMsg = 'Drake named: "' + name + '" already exists for this service [' + this.name + '].\n      Most likely this error in cause by a race condition evaluating multiple template elements with\n      the v-dragula directive having the same drake name. Please initialise the drake in the created() life cycle hook of the VM to fix this problem.';
	        this.error(errMsg);
	      }

	      this.drakes[name] = drake;
	      if (drake.models) {
	        this.handleModels(name, drake);
	      }
	      if (!drake.initEvents) {
	        this.setupEvents(name, drake);
	      }
	      return drake;
	    }
	  }, {
	    key: 'find',
	    value: function find(name) {
	      this.log('find (drake) by name', name);
	      this._validate('find', name);
	      return this.drakes[name];
	    }
	  }, {
	    key: 'handleModels',
	    value: function handleModels(name, drake) {
	      this.log('handleModels', name, drake);
	      this._validate('handleModels', name);
	      if (drake.registered) {
	        // do not register events twice
	        this.log('handleModels', 'already registered');
	        return;
	      }

	      var dragHandler = this.createDragHandler({
	        ctx: this,
	        name: name,
	        drake: drake
	      });
	      this.log('created dragHandler for service', dragHandler);

	      drake.on('remove', dragHandler.remove.bind(dragHandler));
	      drake.on('drag', dragHandler.drag.bind(dragHandler));
	      drake.on('drop', dragHandler.drop.bind(dragHandler));

	      drake.registered = true;
	    }

	    // convenience to set eventBus handlers via Object

	  }, {
	    key: 'on',
	    value: function on() {
	      var _this2 = this;

	      var handlerConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	      this.log('on (events) ', handlerConfig);
	      Object.keys(handlerConfig).forEach(function (handlerName) {
	        var handlerFunction = handlerConfig[handlerName];
	        _this2.log('$on', handlerName, handlerFunction);
	        _this2.eventBus.$on(handlerName, handlerFunction);
	      });
	    }
	  }, {
	    key: 'destroy',
	    value: function destroy(name) {
	      this.log('destroy (drake) ', name);
	      this._validate('destroy', name);
	      var drake = this.find(name);
	      if (!drake) {
	        return;
	      }
	      drake.destroy();
	      this._delete(name);
	    }
	  }, {
	    key: '_delete',
	    value: function _delete(name) {
	      delete this.drakes[name];
	    }
	  }, {
	    key: 'setOptions',
	    value: function setOptions(name, options) {
	      this.log('setOptions (drake)', name, options);
	      this._validate('setOptions', name);
	      var drake = this.add(name, dragula$1(options));
	      this.handleModels(name, drake);
	      return this;
	    }
	  }, {
	    key: 'calcOpts',
	    value: function calcOpts(name, args) {
	      function noOpts() {
	        return {};
	      }
	      var argEventMap = this.argsEventMap[name] || this.argsEventMap.defaultEvent || noOpts;
	      return argEventMap(args);
	    }
	  }, {
	    key: 'setupEvents',
	    value: function setupEvents(name) {
	      var drake = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	      this.log('setupEvents', name, drake);
	      this._validate('setupEvents', name);
	      drake.initEvents = true;
	      var _this = this;

	      var emitter = function emitter(type) {
	        _this.log('emitter', type);

	        function replicate() {
	          var args = Array.prototype.slice.call(arguments);
	          var opts = _this.calcOpts(name, args);
	          opts.name = name;
	          opts.service = this;
	          opts.drake = drake;
	          _this.log('eventBus.$emit', type, name, opts);
	          _this.eventBus.$emit(type, opts);
	          _this.eventBus.$emit(this.name + ':' + type, opts);
	        }

	        drake.on(type, replicate);
	      };
	      this.events.forEach(emitter);
	    }
	  }, {
	    key: 'domIndexOf',
	    value: function domIndexOf(child, parent) {
	      return Array.prototype.indexOf.call(parent.children, child);
	    }
	  }, {
	    key: 'findModelForContainer',
	    value: function findModelForContainer(container, drake) {
	      this.log('findModelForContainer', container, drake);
	      return (this.findModelContainerByContainer(container, drake) || {}).model;
	    }
	  }, {
	    key: 'findModelContainerByContainer',
	    value: function findModelContainerByContainer(container, drake) {
	      if (!drake.models) {
	        this.log('findModelContainerByContainer', 'warning: no models found');
	        return;
	      }
	      var found = drake.models.find(function (model) {
	        return model.container === container;
	      });
	      if (!found) {
	        this.log('No matching model could be found for container:', container);
	        this.log('in drake', drake.name, ' models:', drake.models);
	      }
	      return found;
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging && this.logging.service;
	    }
	  }, {
	    key: 'drakeNames',
	    get: function get() {
	      return Object.keys(this.drakes);
	    }
	  }, {
	    key: 'argsEventMap',
	    get: function get() {
	      this._argsEventMap = this._argsEventMap || this.defaultArgsEventMap;
	      return this._argsEventMap;
	    },
	    set: function set(customArgsEventMap) {
	      this._argsEventMap = customArgsEventMap;
	    }
	  }, {
	    key: 'defaultArgsEventMap',
	    get: function get() {
	      return {
	        cloned: function cloned(args) {
	          return {
	            clone: args[0],
	            original: args[1],
	            type: args[2]
	          };
	        },
	        moves: function moves(args) {
	          return {
	            el: args[0],
	            source: args[1],
	            handle: args[2],
	            sibling: args[3]
	          };
	        },
	        copy: function copy(args) {
	          return {
	            el: args[0],
	            source: args[1]
	          };
	        },
	        accepts: function accepts(args) {
	          return {
	            el: args[0],
	            target: args[1],
	            source: args[2],
	            sibling: args[3]
	          };
	        },
	        invalid: function invalid(args) {
	          return {
	            el: args[0],
	            handle: args[1]
	          };
	        },
	        drag: function drag(args) {
	          return {
	            el: args[0],
	            source: args[1]
	          };
	        },
	        dragend: function dragend(args) {
	          return {
	            el: args[0]
	          };
	        },
	        drop: function drop(args) {
	          return {
	            el: args[0],
	            target: args[1],
	            source: args[2],
	            sibling: args[3]
	          };
	        },
	        defaultEvent: function defaultEvent(args) {
	          return {
	            el: args[0],
	            container: args[1],
	            source: args[2]
	          };
	        }
	      };
	    }
	  }]);
	  return DragulaService;
	}();

	if (!dragula$1) {
	  throw new Error('[vue-dragula] cannot locate dragula.');
	}

	var defaults = {
	  createService: function createService(_ref) {
	    var name = _ref.name,
	        eventBus = _ref.eventBus,
	        drakes = _ref.drakes,
	        options = _ref.options;

	    return new DragulaService({
	      name: name,
	      eventBus: eventBus,
	      drakes: drakes,
	      options: options
	    });
	  },
	  createEventBus: function createEventBus(Vue) {
	    return new Vue();
	  }
	};

	function isEmpty(str) {
	  if (!str) return true;
	  if (str.length === 0) return true;
	  return false;
	}

	function VueDragula (Vue) {
	  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	  // set full fine-grained logging if true
	  if (options.logging === true) {
	    options.logging = {
	      plugin: true,
	      directive: true,
	      service: true,
	      dragHandler: true
	    };
	  }

	  function logPlugin() {
	    var _console;

	    if (!options.logging) return;
	    if (!options.logging.plugin) return;

	    for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
	      args[_key] = arguments[_key];
	    }

	    (_console = console).log.apply(_console, ['vue-dragula plugin'].concat(args));
	  }

	  function logServiceConfig() {
	    var _console2;

	    if (!options.logging) return;
	    if (!options.logging.service) return;

	    for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
	      args[_key2] = arguments[_key2];
	    }

	    (_console2 = console).log.apply(_console2, ['vue-dragula service config: '].concat(args));
	  }

	  function logDir() {
	    var _console3;

	    if (!options.logging) return;
	    if (!options.logging.directive) return;

	    for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
	      args[_key3] = arguments[_key3];
	    }

	    (_console3 = console).log.apply(_console3, ['v-dragula directive'].concat(args));
	  }

	  logPlugin('Initializing vue-dragula plugin', options);

	  var _createService = options.createService || defaults.createService;
	  var createEventBus = options.createEventBus || defaults.createEventBus || new Vue();

	  logPlugin('create eventBus', createEventBus);
	  var eventBus = createEventBus(Vue, options);

	  if (!eventBus) {
	    console.warn('Eventbus could not be created');
	    throw new Error('Eventbus could not be created');
	  }

	  logPlugin('eventBus created', eventBus);

	  // global service
	  var appService = _createService({
	    name: 'global.dragula',
	    eventBus: eventBus,
	    drakes: options.drakes,
	    options: options
	  });

	  var globalName = 'globalDrake';

	  var Dragula = function () {
	    function Dragula(options) {
	      classCallCheck(this, Dragula);

	      this.options = options;

	      // convenience functions on global service
	      this.$service = {
	        options: appService.setOptions.bind(appService),
	        find: appService.find.bind(appService),
	        eventBus: appService.eventBus
	        // add default drake on global app service
	      };this.$service.options('default', {});

	      // alias
	      this.createServices = this.createService;
	    }

	    createClass(Dragula, [{
	      key: 'optionsFor',
	      value: function optionsFor(name) {
	        var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	        this.service(name).setOptions(opts);
	        return this;
	      }
	    }, {
	      key: 'createService',
	      value: function createService() {
	        var _this = this;

	        var serviceOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	        logServiceConfig('createService', serviceOpts);

	        this._serviceMap = this._serviceMap || {};

	        var names = serviceOpts.names || [];
	        var name = serviceOpts.name || [];
	        var drakes = serviceOpts.drakes || {};
	        var drake = serviceOpts.drake;
	        var opts = Object.assign({}, options, serviceOpts);
	        names = names.length > 0 ? names : [name];
	        var eventBus = serviceOpts.eventBus || appService.eventBus;
	        if (!eventBus) {
	          console.warn('Eventbus could not be created', eventBus);
	        }

	        logServiceConfig('names', names);
	        names.forEach(function (name) {
	          var createOpts = {
	            name: name,
	            eventBus: eventBus,
	            options: opts
	          };
	          logServiceConfig('create DragulaService', name, createOpts);
	          _this._serviceMap[name] = _createService(createOpts);

	          // use 'default' drakes if none specified
	          if (!drakes.default) {
	            drakes.default = drake || true;
	          }

	          _this.drakesFor(name, drakes);
	        });
	        return this;
	      }
	    }, {
	      key: 'drakesFor',
	      value: function drakesFor(name) {
	        var drakes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	        logServiceConfig('drakesFor', name, drakes);
	        var service = this.service(name);

	        if (Array.isArray(drakes)) {
	          // turn Array into object of [name]: true
	          drakes = drakes.reduce(function (obj, name) {
	            obj[name] = true;
	            return obj;
	          }, {});
	        }

	        Object.keys(drakes).forEach(function (drakeName) {
	          var drakeOpts = drakes[drakeName];
	          if (drakeOpts === true) {
	            drakeOpts = {};
	          }

	          service.setOptions(drakeName, drakeOpts);
	        });
	        return this;
	      }
	    }, {
	      key: 'on',
	      value: function on(name) {
	        var _this2 = this;

	        var handlerConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	        logServiceConfig('on', name, handlerConfig);
	        if ((typeof name === 'undefined' ? 'undefined' : typeof name) === 'object') {
	          handlerConfig = name;
	          // add event handlers for all services
	          var serviceNames = this.serviceNames;

	          if (!serviceNames || serviceNames.length < 1) {
	            console.warn('vue-dragula: No services found to add events handlers for', this._serviceMap);
	            return this;
	          }

	          logServiceConfig('add event handlers for', serviceNames);
	          serviceNames.forEach(function (serviceName) {
	            _this2.on(serviceName, handlerConfig);
	          });
	          return this;
	        }

	        var service = this.service(name);
	        if (!service) {
	          console.warn('vue-dragula: no service ' + name + ' to add event handlers for');
	          return this;
	        }
	        logServiceConfig('service.on', service, handlerConfig);
	        service.on(handlerConfig);
	        return this;
	      }
	    }, {
	      key: 'service',


	      // return named service or first service
	      value: function service(name) {
	        if (!this._serviceMap) return;

	        var found = this._serviceMap[name];
	        logServiceConfig('lookup service', name, found);

	        if (!found) {
	          logServiceConfig('not found by name, get default');
	          var keys = this.serviceNames;
	          if (keys) {
	            found = this._serviceMap[keys[0]];
	          }
	        }
	        return found;
	      }
	    }, {
	      key: 'serviceNames',
	      get: function get() {
	        return Object.keys(this._serviceMap);
	      }
	    }, {
	      key: 'services',
	      get: function get() {
	        return Object.values(this._serviceMap);
	      }
	    }]);
	    return Dragula;
	  }();

	  Vue.$dragula = new Dragula(options);

	  var drakeContainers = {};

	  Vue.prototype.$dragula = Vue.$dragula;

	  function findService(name, vnode, serviceName) {
	    // first try to register on DragulaService of component
	    if (vnode) {
	      var _dragula = vnode.context.$dragula;
	      if (_dragula) {
	        logDir('trying to find and use component service');

	        var componentService = _dragula.service(serviceName);
	        if (componentService) {
	          logDir('using component service', componentService);
	          return componentService;
	        }
	      }
	    }
	    logDir('using global service', appService);
	    return appService;
	  }

	  function calcNames(name, vnode, ctx) {
	    var drakeName = vnode ? vnode.data.attrs.drake : this.params.drake;
	    var serviceName = vnode ? vnode.data.attrs.service : this.params.service;

	    if (drakeName !== undefined && drakeName.length !== 0) {
	      name = drakeName;
	    }
	    drakeName = isEmpty(drakeName) ? 'default' : drakeName;

	    return {
	      name: name,
	      drakeName: drakeName,
	      serviceName: serviceName
	    };
	  }

	  function updateDirective(container, binding, vnode, oldVnode) {
	    logDir('updateDirective');
	    var newValue = vnode ? binding.value : container;
	    if (!newValue) {
	      return;
	    }

	    var _calcNames = calcNames(globalName, vnode, this),
	        name = _calcNames.name,
	        drakeName = _calcNames.drakeName,
	        serviceName = _calcNames.serviceName;

	    var service = findService(name, vnode, serviceName);
	    var drake = service.find(drakeName, vnode);

	    drakeContainers[drakeName] = drakeContainers[drakeName] || [];
	    var dc = drakeContainers[drakeName];

	    // skip if has already been configured (same container in same drake)
	    if (dc) {
	      var found = dc.find(function (c) {
	        return c === container;
	      });
	      if (found) {
	        logDir('already has drake container configured', drakeName, container);
	        return;
	      }
	    }

	    if (!service) {
	      logDir('no service found', name, drakeName);
	      return;
	    }

	    if (!drake.models) {
	      drake.models = [];
	    }

	    if (!vnode) {
	      container = this.el; // Vue 1
	    }

	    var modelContainer = service.findModelContainerByContainer(container, drake);

	    dc.push(container);

	    logDir('DATA', {
	      service: {
	        name: serviceName,
	        instance: service
	      },
	      drake: {
	        name: drakeName,
	        instance: drake
	      },
	      container: container,
	      modelContainer: modelContainer
	    });

	    if (modelContainer) {
	      logDir('set model of container', newValue);
	      modelContainer.model = newValue;
	    } else {
	      logDir('push model and container on drake', newValue, container);
	      drake.models.push({
	        model: newValue,
	        container: container
	      });
	    }
	  }

	  Vue.directive('dragula', {
	    params: ['drake', 'service'],

	    bind: function bind(container, binding, vnode) {
	      logDir('BIND', container, binding, vnode);

	      var _calcNames2 = calcNames(globalName, vnode, this),
	          name = _calcNames2.name,
	          drakeName = _calcNames2.drakeName,
	          serviceName = _calcNames2.serviceName;

	      var service = findService(name, vnode, serviceName);
	      var drake = service.find(drakeName, vnode);

	      if (!vnode) {
	        container = this.el; // Vue 1
	      }

	      logDir({
	        service: {
	          name: serviceName,
	          instance: service
	        },
	        drake: {
	          name: drakeName,
	          instance: drake
	        },
	        container: container
	      });

	      if (drake) {
	        drake.containers.push(container);
	        return;
	      }
	      var newDrake = dragula$1({
	        containers: [container]
	      });
	      service.add(name, newDrake);

	      service.handleModels(name, newDrake);
	    },
	    update: function update(container, binding, vnode, oldVnode) {
	      logDir('UPDATE', container, binding, vnode);
	      // Vue 1
	      if (Vue.version === 1) {
	        updateDirective(container, binding, vnode, oldVnode);
	      }
	    },
	    componentUpdated: function componentUpdated(container, binding, vnode, oldVnode) {
	      logDir('COMPONENT UPDATED', container, binding, vnode);
	    },
	    inserted: function inserted(container, binding, vnode, oldVnode) {
	      logDir('INSERTED', container, binding, vnode);
	      // Vue 2
	      updateDirective(container, binding, vnode, oldVnode);
	    },
	    unbind: function unbind(container, binding, vnode) {
	      logDir('UNBIND', container, binding, vnode);

	      var _calcNames3 = calcNames(globalName, vnode, this),
	          name = _calcNames3.name,
	          drakeName = _calcNames3.drakeName,
	          serviceName = _calcNames3.serviceName;

	      var service = findService(name, vnode, serviceName);
	      var drake = service.find(drakeName, vnode);

	      logDir({
	        service: {
	          name: serviceName,
	          instance: service
	        },
	        drake: {
	          name: drakeName,
	          instance: drake
	        },
	        container: container
	      });

	      if (!drake) {
	        return;
	      }

	      var containerIndex = drake.containers.indexOf(container);

	      if (containerIndex > -1) {
	        logDir('remove container', containerIndex);
	        drake.containers.splice(containerIndex, 1);
	      }

	      if (drake.containers.length === 0) {
	        logDir('destroy service');
	        service.destroy(name);
	      }
	    }
	  });
	}

	var TimeMachine = function () {
	  function TimeMachine(_ref) {
	    var name = _ref.name,
	        model = _ref.model,
	        modelRef = _ref.modelRef,
	        history = _ref.history,
	        logging = _ref.logging;
	    classCallCheck(this, TimeMachine);

	    this.name = name || 'default';
	    this.model = model;
	    this.modelRef = modelRef;
	    this.logging = logging;
	    this.history = history || this.createHistory();
	    this.history.push(this.model);
	    this.timeIndex = 0;
	  }

	  createClass(TimeMachine, [{
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      (_console = console).log.apply(_console, [this.clazzName + ' [' + this.name + '] :', event].concat(args));
	    }
	  }, {
	    key: 'createHistory',
	    value: function createHistory() {
	      return this.history || [];
	    }
	  }, {
	    key: 'timeTravel',
	    value: function timeTravel(index) {
	      this.log('timeTravel to', index);
	      this.model = this.history[index];
	      this.updateModelRef();
	      return this;
	    }
	  }, {
	    key: 'updateModelRef',
	    value: function updateModelRef() {
	      var _this = this;

	      // this.modelRef = mutable
	      // this.log('set modelRef', this.modelRef, this.model)
	      this.modelRef.splice(0, this.modelRef.length);
	      this.model.forEach(function (item) {
	        _this.modelRef.push(item);
	      });
	    }
	  }, {
	    key: 'undo',
	    value: function undo() {
	      this.log('undo timeIndex', this.timeIndex);
	      if (this.timeIndex === 0) {
	        return false;
	      }
	      this.timeIndex--;
	      this.timeTravel(this.timeIndex);
	      return this;
	    }
	  }, {
	    key: 'redo',
	    value: function redo() {
	      this.log('redo timeIndex', this.timeIndex, this.history.length);
	      if (this.timeIndex > this.history.length - 1) {
	        return false;
	      }
	      this.timeIndex++;
	      this.timeTravel(this.timeIndex);
	      return this;
	    }
	  }, {
	    key: 'addToHistory',
	    value: function addToHistory(newModel) {
	      this.log('addToHistory');
	      this.log('old', this.model);
	      this.log('new', newModel);
	      this.model = newModel;
	      this.log('model was set to', this.model);
	      this.history.push(newModel);
	      this.timeIndex++;
	      this.updateModelRef();
	      return this;
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging && this.logging.modelManager;
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'TimeMachine';
	    }
	  }]);
	  return TimeMachine;
	}();

	var createDefaultTimeMachine = function createDefaultTimeMachine(opts) {
	  return new TimeMachine(opts);
	};

	var ImmutableModelManager = function (_ModelManager) {
	  inherits(ImmutableModelManager, _ModelManager);

	  function ImmutableModelManager() {
	    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	    classCallCheck(this, ImmutableModelManager);

	    var _this = possibleConstructorReturn(this, (ImmutableModelManager.__proto__ || Object.getPrototypeOf(ImmutableModelManager)).call(this, opts));

	    _this.timeOut = opts.timeOut || 800;
	    var createTimeMachine = opts.createTimeMachine || createDefaultTimeMachine;
	    _this.timeMachine = createTimeMachine(Object.assign(opts, {
	      model: _this.model,
	      modelRef: _this.modelRef
	    }));
	    return _this;
	  }

	  createClass(ImmutableModelManager, [{
	    key: 'timeTravel',


	    /**
	     * Travel to specific point in action history stack
	     * @param {*} index
	     */
	    value: function timeTravel(index) {
	      return this.timeMachine.timeTravel(index);
	    }

	    /**
	     * Undo previous action from history
	     */

	  }, {
	    key: 'undo',
	    value: function undo() {
	      // this.log('UNDO', this.timeMachine)
	      this.timeMachine.undo();
	      return this;
	    }

	    /**
	     * Redo undone action
	     */

	  }, {
	    key: 'redo',
	    value: function redo() {
	      // this.log('REDO', this.timeMachine)
	      this.timeMachine.redo();
	      return this;
	    }
	  }, {
	    key: 'addToHistory',
	    value: function addToHistory(model) {
	      this.timeMachine.addToHistory(model);
	      return this;
	    }

	    // override with Immutable

	  }, {
	    key: 'createModel',
	    value: function createModel(model) {
	      return model || [];
	    }

	    // TODO: add to history!?

	  }, {
	    key: 'createFor',
	    value: function createFor() {
	      var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

	      return new ImmutableModelManager(opts);
	    }
	  }, {
	    key: 'isEmpty',
	    value: function isEmpty() {
	      return this.model.length === 0;
	    }
	  }, {
	    key: 'actionUpdateModel',
	    value: function actionUpdateModel(newModel) {
	      var _this2 = this;

	      setTimeout(function () {
	        _this2.addToHistory(newModel);
	      }, this.timeOut || 800);
	    }

	    /**
	     * Removes item at index
	     * @param {*} index
	     */

	  }, {
	    key: 'removeAt',
	    value: function removeAt(index) {
	      if (this.copy) return;
	      this.log('removeAt', {
	        model: this.model,
	        index: index
	      });
	      // create new model with self excluded
	      var before = this.model.slice(0, index);
	      var exclAfter = this.model.slice(index + 1);

	      this.log('removeAt: concat', before, exclAfter);
	      var newModel = this.createModel().concat(before, exclAfter);

	      this.actionUpdateModel(newModel);
	      return newModel;
	    }

	    /**
	     * Inserts a dropModel at specific index
	     * NOTE: Copy needs to insert the copied item only, no remove or move involved
	     * @param {*} index
	     * @param {*} dropModel
	     */

	  }, {
	    key: 'insertAt',
	    value: function insertAt(index, insertModel) {
	      this.log('insertAt', {
	        model: this.model,
	        index: index,
	        insertModel: insertModel
	      });

	      // create new model with new inserted

	      // Slice off the items BEFORE the insertion index
	      var itemsBefore = this.sliceBefore(index);

	      // Slice off the items ATER the insertion index
	      var itemsAfter = this._sliceAfter(index);

	      this.log('insertAt: concat', {
	        itemsBefore: itemsBefore,
	        insertModel: insertModel,
	        itemsAfter: itemsAfter
	      });

	      var newModel = this._createNewModelFromInsert(itemsBefore, insertModel, itemsAfter);

	      this.log({
	        newModel: newModel
	      });

	      this.actionUpdateModel(newModel);
	      return newModel;
	    }
	  }, {
	    key: '_createNewModelFromInsert',
	    value: function _createNewModelFromInsert(itemsBefore, insertItem, itemsAfter) {
	      return this.createModel().concat(itemsBefore, insertItem, itemsAfter);
	    }

	    /**
	     * Slice off the items before the insertion index
	     * @param {*} index
	     */

	  }, {
	    key: '_sliceBefore',
	    value: function _sliceBefore(index) {
	      return this.model.slice(0, index);
	    }

	    /**
	     * Slice off the items after the insertion index
	     * @param {*} index
	     */

	  }, {
	    key: '_sliceAfter',
	    value: function _sliceAfter(index) {
	      this.model.slice(index);
	    }

	    /**
	     * Moves item from one index to another
	     * NOTE: If we are doing a copy, we should never perform a move (ie. a remove and insert)
	     * @param {*} param0
	     */

	  }, {
	    key: 'move',
	    value: function move(_ref) {
	      var dragIndex = _ref.dragIndex,
	          dropIndex = _ref.dropIndex;

	      if (this.copy) return;
	      this.log('move', {
	        model: this.model,
	        dragIndex: dragIndex,
	        dropIndex: dropIndex
	      });
	      this.timeMachine.undo();
	      return this;
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'ImmutableModelManager';
	    }
	  }, {
	    key: 'model',
	    get: function get() {
	      return this.timeMachine ? this.timeMachine.model : this._model;
	    }
	  }, {
	    key: 'history',
	    get: function get() {
	      return this.timeMachine.history;
	    }
	  }, {
	    key: 'timeIndex',
	    get: function get() {
	      return this.timeMachine.timeIndex;
	    }
	  }, {
	    key: 'first',
	    get: function get() {
	      return this.at(0);
	    }
	  }, {
	    key: 'last',
	    get: function get() {
	      return this.at(this.model.length - 1);
	    }
	  }]);
	  return ImmutableModelManager;
	}(ModelManager);

	var ActionManager = function () {
	  function ActionManager() {
	    var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	    classCallCheck(this, ActionManager);

	    this.name = opts.name || 'default';
	    this.logging = opts.logging;
	    this.observer = {
	      undo: function undo(action) {},
	      redo: function redo(action) {}
	    };

	    this.actions = {
	      // stack of actions to undo
	      done: [],
	      // stack of actions undone to be redone(via. redo)
	      undone: []
	    };
	  }

	  createClass(ActionManager, [{
	    key: 'log',
	    value: function log(event) {
	      var _console;

	      if (!this.shouldLog) return;

	      for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	        args[_key - 1] = arguments[_key];
	      }

	      (_console = console).log.apply(_console, [this.clazzName + ' [' + this.name + '] :', event].concat(args));
	    }
	  }, {
	    key: 'clear',
	    value: function clear() {
	      this.actions.done = [];
	      this.actions.undone = [];
	    }

	    // perform undo/redo on model (container)

	  }, {
	    key: 'doAct',
	    value: function doAct(container, action) {
	      this.log('doAct', {
	        container: container,
	        action: action
	      });
	      var actFun = container[action].bind(container);
	      // this.log('doAct', actFun, container, action)
	      if (!actFun) {
	        throw new Error(container, 'missing', action, 'method');
	      }
	      actFun();
	    }

	    // if not a copy action, do the action on source container also

	  }, {
	    key: 'isSourceContainerAction',
	    value: function isSourceContainerAction(action) {
	      return action !== 'copy';
	    }
	  }, {
	    key: 'isTargetContainerAction',
	    value: function isTargetContainerAction(action) {
	      return true;
	    }
	  }, {
	    key: 'do',
	    value: function _do(_ref) {
	      var name = _ref.name,
	          container = _ref.container;

	      // this.log(name)
	      var cDo = container.do;
	      var cUndo = container.undo;
	      if (!cDo.length) {
	        // this.log('actions empty', cDo)
	        return;
	      }
	      var action = cDo.pop();
	      // TODO: use elements, indexes to create visual transition/animation effect
	      var models = action.models;

	      this.log('do', {
	        name: name,
	        action: action,
	        source: source,
	        target: target
	      });

	      var source = models.source,
	          target = models.target;

	      // perform one action on source and one on target
	      // this could be the cause of the double copy problem
	      // since a copy action only takes effect on the target container

	      if (this.isSourceContainerAction(action)) {
	        this.doAct(source, name);
	      }
	      if (this.isTargetContainerAction(action)) {
	        this.doAct(target, name);
	      }

	      this.emitAction(name, action);

	      cUndo.push(action);
	      // this.log('actions undo', cUndo)
	    }
	  }, {
	    key: 'emitAction',
	    value: function emitAction(name, action) {
	      this.log('emitAction', {
	        name: name,
	        action: action
	      });
	      var fun = this.observer[name];
	      if (typeof fun === 'function') fun(action);
	    }
	  }, {
	    key: 'onUndo',
	    value: function onUndo(fun) {
	      this.observer.undo = fun;
	    }
	  }, {
	    key: 'onRedo',
	    value: function onRedo(fun) {
	      this.observer.redo = fun;
	    }
	  }, {
	    key: 'undo',
	    value: function undo() {
	      this.log('UNDO');

	      this.do({
	        name: 'undo',
	        container: {
	          do: this.actions.done,
	          undo: this.actions.undone
	        }
	      });
	    }
	  }, {
	    key: 'redo',
	    value: function redo() {
	      this.log('REDO');
	      this.do({
	        name: 'redo',
	        container: {
	          do: this.actions.undone,
	          undo: this.actions.done
	        }
	      });
	    }
	  }, {
	    key: 'act',
	    value: function act() {
	      var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
	      var name = action.name,
	          models = action.models,
	          indexes = action.indexes,
	          elements = action.elements;

	      this.log('act (store action on stack)', {
	        name: name,
	        models: models,
	        indexes: indexes,
	        elements: elements
	      });
	      this.actions.done.push(action);
	    }
	  }, {
	    key: 'clazzName',
	    get: function get() {
	      return this.constructor.name || 'ActionManager';
	    }
	  }, {
	    key: 'shouldLog',
	    get: function get() {
	      return this.logging;
	    }
	  }]);
	  return ActionManager;
	}();

	function plugin(Vue) {
	  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

	  if (plugin.installed) {
	    console.warn('[vue-dragula] already installed.');
	  }

	  console.log('Add Dragula plugin:', options);
	  VueDragula(Vue, options);
	}

	plugin.version = '2.0.1';

	var Vue2Dragula = plugin;

	if (true) {
	  // eslint-disable-line
	  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
	    plugin;
	  }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
		__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // eslint-disable-line
	} else {}

	exports.Vue2Dragula = Vue2Dragula;
	exports.DragulaService = DragulaService;
	exports.DragHandler = DragHandler;
	exports.ModelManager = ModelManager;
	exports.ImmutableModelManager = ImmutableModelManager;
	exports.TimeMachine = TimeMachine;
	exports.ActionManager = ActionManager;

}));

/***/ }),

/***/ "./node_modules/vue/dist/vue.runtime.esm.js":
/*!**************************************************!*\
  !*** ./node_modules/vue/dist/vue.runtime.esm.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   EffectScope: () => (/* binding */ EffectScope),
/* harmony export */   computed: () => (/* binding */ computed),
/* harmony export */   customRef: () => (/* binding */ customRef),
/* harmony export */   "default": () => (/* binding */ Vue),
/* harmony export */   defineAsyncComponent: () => (/* binding */ defineAsyncComponent),
/* harmony export */   defineComponent: () => (/* binding */ defineComponent),
/* harmony export */   del: () => (/* binding */ del),
/* harmony export */   effectScope: () => (/* binding */ effectScope),
/* harmony export */   getCurrentInstance: () => (/* binding */ getCurrentInstance),
/* harmony export */   getCurrentScope: () => (/* binding */ getCurrentScope),
/* harmony export */   h: () => (/* binding */ h),
/* harmony export */   inject: () => (/* binding */ inject),
/* harmony export */   isProxy: () => (/* binding */ isProxy),
/* harmony export */   isReactive: () => (/* binding */ isReactive),
/* harmony export */   isReadonly: () => (/* binding */ isReadonly),
/* harmony export */   isRef: () => (/* binding */ isRef),
/* harmony export */   isShallow: () => (/* binding */ isShallow),
/* harmony export */   markRaw: () => (/* binding */ markRaw),
/* harmony export */   mergeDefaults: () => (/* binding */ mergeDefaults),
/* harmony export */   nextTick: () => (/* binding */ nextTick),
/* harmony export */   onActivated: () => (/* binding */ onActivated),
/* harmony export */   onBeforeMount: () => (/* binding */ onBeforeMount),
/* harmony export */   onBeforeUnmount: () => (/* binding */ onBeforeUnmount),
/* harmony export */   onBeforeUpdate: () => (/* binding */ onBeforeUpdate),
/* harmony export */   onDeactivated: () => (/* binding */ onDeactivated),
/* harmony export */   onErrorCaptured: () => (/* binding */ onErrorCaptured),
/* harmony export */   onMounted: () => (/* binding */ onMounted),
/* harmony export */   onRenderTracked: () => (/* binding */ onRenderTracked),
/* harmony export */   onRenderTriggered: () => (/* binding */ onRenderTriggered),
/* harmony export */   onScopeDispose: () => (/* binding */ onScopeDispose),
/* harmony export */   onServerPrefetch: () => (/* binding */ onServerPrefetch),
/* harmony export */   onUnmounted: () => (/* binding */ onUnmounted),
/* harmony export */   onUpdated: () => (/* binding */ onUpdated),
/* harmony export */   provide: () => (/* binding */ provide),
/* harmony export */   proxyRefs: () => (/* binding */ proxyRefs),
/* harmony export */   reactive: () => (/* binding */ reactive),
/* harmony export */   readonly: () => (/* binding */ readonly),
/* harmony export */   ref: () => (/* binding */ ref$1),
/* harmony export */   set: () => (/* binding */ set),
/* harmony export */   shallowReactive: () => (/* binding */ shallowReactive),
/* harmony export */   shallowReadonly: () => (/* binding */ shallowReadonly),
/* harmony export */   shallowRef: () => (/* binding */ shallowRef),
/* harmony export */   toRaw: () => (/* binding */ toRaw),
/* harmony export */   toRef: () => (/* binding */ toRef),
/* harmony export */   toRefs: () => (/* binding */ toRefs),
/* harmony export */   triggerRef: () => (/* binding */ triggerRef),
/* harmony export */   unref: () => (/* binding */ unref),
/* harmony export */   useAttrs: () => (/* binding */ useAttrs),
/* harmony export */   useCssModule: () => (/* binding */ useCssModule),
/* harmony export */   useCssVars: () => (/* binding */ useCssVars),
/* harmony export */   useListeners: () => (/* binding */ useListeners),
/* harmony export */   useSlots: () => (/* binding */ useSlots),
/* harmony export */   version: () => (/* binding */ version),
/* harmony export */   watch: () => (/* binding */ watch),
/* harmony export */   watchEffect: () => (/* binding */ watchEffect),
/* harmony export */   watchPostEffect: () => (/* binding */ watchPostEffect),
/* harmony export */   watchSyncEffect: () => (/* binding */ watchSyncEffect)
/* harmony export */ });
/*!
 * Vue.js v2.7.16
 * (c) 2014-2023 Evan You
 * Released under the MIT License.
 */
var emptyObject = Object.freeze({});
var isArray = Array.isArray;
// These helpers produce better VM code in JS engines due to their
// explicitness and function inlining.
function isUndef(v) {
    return v === undefined || v === null;
}
function isDef(v) {
    return v !== undefined && v !== null;
}
function isTrue(v) {
    return v === true;
}
function isFalse(v) {
    return v === false;
}
/**
 * Check if value is primitive.
 */
function isPrimitive(value) {
    return (typeof value === 'string' ||
        typeof value === 'number' ||
        // $flow-disable-line
        typeof value === 'symbol' ||
        typeof value === 'boolean');
}
function isFunction(value) {
    return typeof value === 'function';
}
/**
 * Quick object check - this is primarily used to tell
 * objects from primitive values when we know the value
 * is a JSON-compliant type.
 */
function isObject(obj) {
    return obj !== null && typeof obj === 'object';
}
/**
 * Get the raw type string of a value, e.g., [object Object].
 */
var _toString = Object.prototype.toString;
function toRawType(value) {
    return _toString.call(value).slice(8, -1);
}
/**
 * Strict object type check. Only returns true
 * for plain JavaScript objects.
 */
function isPlainObject(obj) {
    return _toString.call(obj) === '[object Object]';
}
function isRegExp(v) {
    return _toString.call(v) === '[object RegExp]';
}
/**
 * Check if val is a valid array index.
 */
function isValidArrayIndex(val) {
    var n = parseFloat(String(val));
    return n >= 0 && Math.floor(n) === n && isFinite(val);
}
function isPromise(val) {
    return (isDef(val) &&
        typeof val.then === 'function' &&
        typeof val.catch === 'function');
}
/**
 * Convert a value to a string that is actually rendered.
 */
function toString(val) {
    return val == null
        ? ''
        : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
            ? JSON.stringify(val, replacer, 2)
            : String(val);
}
function replacer(_key, val) {
    // avoid circular deps from v3
    if (val && val.__v_isRef) {
        return val.value;
    }
    return val;
}
/**
 * Convert an input value to a number for persistence.
 * If the conversion fails, return original string.
 */
function toNumber(val) {
    var n = parseFloat(val);
    return isNaN(n) ? val : n;
}
/**
 * Make a map and return a function for checking if a key
 * is in that map.
 */
function makeMap(str, expectsLowerCase) {
    var map = Object.create(null);
    var list = str.split(',');
    for (var i = 0; i < list.length; i++) {
        map[list[i]] = true;
    }
    return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; };
}
/**
 * Check if a tag is a built-in tag.
 */
var isBuiltInTag = makeMap('slot,component', true);
/**
 * Check if an attribute is a reserved attribute.
 */
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
/**
 * Remove an item from an array.
 */
function remove$2(arr, item) {
    var len = arr.length;
    if (len) {
        // fast path for the only / last item
        if (item === arr[len - 1]) {
            arr.length = len - 1;
            return;
        }
        var index = arr.indexOf(item);
        if (index > -1) {
            return arr.splice(index, 1);
        }
    }
}
/**
 * Check whether an object has the property.
 */
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn(obj, key) {
    return hasOwnProperty.call(obj, key);
}
/**
 * Create a cached version of a pure function.
 */
function cached(fn) {
    var cache = Object.create(null);
    return function cachedFn(str) {
        var hit = cache[str];
        return hit || (cache[str] = fn(str));
    };
}
/**
 * Camelize a hyphen-delimited string.
 */
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
    return str.replace(camelizeRE, function (_, c) { return (c ? c.toUpperCase() : ''); });
});
/**
 * Capitalize a string.
 */
var capitalize = cached(function (str) {
    return str.charAt(0).toUpperCase() + str.slice(1);
});
/**
 * Hyphenate a camelCase string.
 */
var hyphenateRE = /\B([A-Z])/g;
var hyphenate = cached(function (str) {
    return str.replace(hyphenateRE, '-$1').toLowerCase();
});
/**
 * Simple bind polyfill for environments that do not support it,
 * e.g., PhantomJS 1.x. Technically, we don't need this anymore
 * since native bind is now performant enough in most browsers.
 * But removing it would mean breaking code that was able to run in
 * PhantomJS 1.x, so this must be kept for backward compatibility.
 */
/* istanbul ignore next */
function polyfillBind(fn, ctx) {
    function boundFn(a) {
        var l = arguments.length;
        return l
            ? l > 1
                ? fn.apply(ctx, arguments)
                : fn.call(ctx, a)
            : fn.call(ctx);
    }
    boundFn._length = fn.length;
    return boundFn;
}
function nativeBind(fn, ctx) {
    return fn.bind(ctx);
}
// @ts-expect-error bind cannot be `undefined`
var bind = Function.prototype.bind ? nativeBind : polyfillBind;
/**
 * Convert an Array-like object to a real Array.
 */
function toArray(list, start) {
    start = start || 0;
    var i = list.length - start;
    var ret = new Array(i);
    while (i--) {
        ret[i] = list[i + start];
    }
    return ret;
}
/**
 * Mix properties into target object.
 */
function extend(to, _from) {
    for (var key in _from) {
        to[key] = _from[key];
    }
    return to;
}
/**
 * Merge an Array of Objects into a single Object.
 */
function toObject(arr) {
    var res = {};
    for (var i = 0; i < arr.length; i++) {
        if (arr[i]) {
            extend(res, arr[i]);
        }
    }
    return res;
}
/* eslint-disable no-unused-vars */
/**
 * Perform no operation.
 * Stubbing args to make Flow happy without leaving useless transpiled code
 * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
 */
function noop(a, b, c) { }
/**
 * Always return false.
 */
var no = function (a, b, c) { return false; };
/* eslint-enable no-unused-vars */
/**
 * Return the same value.
 */
var identity = function (_) { return _; };
/**
 * Check if two values are loosely equal - that is,
 * if they are plain objects, do they have the same shape?
 */
function looseEqual(a, b) {
    if (a === b)
        return true;
    var isObjectA = isObject(a);
    var isObjectB = isObject(b);
    if (isObjectA && isObjectB) {
        try {
            var isArrayA = Array.isArray(a);
            var isArrayB = Array.isArray(b);
            if (isArrayA && isArrayB) {
                return (a.length === b.length &&
                    a.every(function (e, i) {
                        return looseEqual(e, b[i]);
                    }));
            }
            else if (a instanceof Date && b instanceof Date) {
                return a.getTime() === b.getTime();
            }
            else if (!isArrayA && !isArrayB) {
                var keysA = Object.keys(a);
                var keysB = Object.keys(b);
                return (keysA.length === keysB.length &&
                    keysA.every(function (key) {
                        return looseEqual(a[key], b[key]);
                    }));
            }
            else {
                /* istanbul ignore next */
                return false;
            }
        }
        catch (e) {
            /* istanbul ignore next */
            return false;
        }
    }
    else if (!isObjectA && !isObjectB) {
        return String(a) === String(b);
    }
    else {
        return false;
    }
}
/**
 * Return the first index at which a loosely equal value can be
 * found in the array (if value is a plain object, the array must
 * contain an object of the same shape), or -1 if it is not present.
 */
function looseIndexOf(arr, val) {
    for (var i = 0; i < arr.length; i++) {
        if (looseEqual(arr[i], val))
            return i;
    }
    return -1;
}
/**
 * Ensure a function is called only once.
 */
function once(fn) {
    var called = false;
    return function () {
        if (!called) {
            called = true;
            fn.apply(this, arguments);
        }
    };
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill
function hasChanged(x, y) {
    if (x === y) {
        return x === 0 && 1 / x !== 1 / y;
    }
    else {
        return x === x || y === y;
    }
}

var SSR_ATTR = 'data-server-rendered';
var ASSET_TYPES = ['component', 'directive', 'filter'];
var LIFECYCLE_HOOKS = [
    'beforeCreate',
    'created',
    'beforeMount',
    'mounted',
    'beforeUpdate',
    'updated',
    'beforeDestroy',
    'destroyed',
    'activated',
    'deactivated',
    'errorCaptured',
    'serverPrefetch',
    'renderTracked',
    'renderTriggered'
];

var config = {
    /**
     * Option merge strategies (used in core/util/options)
     */
    // $flow-disable-line
    optionMergeStrategies: Object.create(null),
    /**
     * Whether to suppress warnings.
     */
    silent: false,
    /**
     * Show production mode tip message on boot?
     */
    productionTip: "development" !== 'production',
    /**
     * Whether to enable devtools
     */
    devtools: "development" !== 'production',
    /**
     * Whether to record perf
     */
    performance: false,
    /**
     * Error handler for watcher errors
     */
    errorHandler: null,
    /**
     * Warn handler for watcher warns
     */
    warnHandler: null,
    /**
     * Ignore certain custom elements
     */
    ignoredElements: [],
    /**
     * Custom user key aliases for v-on
     */
    // $flow-disable-line
    keyCodes: Object.create(null),
    /**
     * Check if a tag is reserved so that it cannot be registered as a
     * component. This is platform-dependent and may be overwritten.
     */
    isReservedTag: no,
    /**
     * Check if an attribute is reserved so that it cannot be used as a component
     * prop. This is platform-dependent and may be overwritten.
     */
    isReservedAttr: no,
    /**
     * Check if a tag is an unknown element.
     * Platform-dependent.
     */
    isUnknownElement: no,
    /**
     * Get the namespace of an element
     */
    getTagNamespace: noop,
    /**
     * Parse the real tag name for the specific platform.
     */
    parsePlatformTagName: identity,
    /**
     * Check if an attribute must be bound using property, e.g. value
     * Platform-dependent.
     */
    mustUseProp: no,
    /**
     * Perform updates asynchronously. Intended to be used by Vue Test Utils
     * This will significantly reduce performance if set to false.
     */
    async: true,
    /**
     * Exposed for legacy reasons
     */
    _lifecycleHooks: LIFECYCLE_HOOKS
};

/**
 * unicode letters used for parsing html tags, component names and property paths.
 * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
 * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
 */
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
/**
 * Check if a string starts with $ or _
 */
function isReserved(str) {
    var c = (str + '').charCodeAt(0);
    return c === 0x24 || c === 0x5f;
}
/**
 * Define a property.
 */
function def(obj, key, val, enumerable) {
    Object.defineProperty(obj, key, {
        value: val,
        enumerable: !!enumerable,
        writable: true,
        configurable: true
    });
}
/**
 * Parse simple path.
 */
var bailRE = new RegExp("[^".concat(unicodeRegExp.source, ".$_\\d]"));
function parsePath(path) {
    if (bailRE.test(path)) {
        return;
    }
    var segments = path.split('.');
    return function (obj) {
        for (var i = 0; i < segments.length; i++) {
            if (!obj)
                return;
            obj = obj[segments[i]];
        }
        return obj;
    };
}

// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
UA && /chrome\/\d+/.test(UA) && !isEdge;
UA && /phantomjs/.test(UA);
var isFF = UA && UA.match(/firefox\/(\d+)/);
// Firefox has a "watch" function on Object.prototype...
// @ts-expect-error firebox support
var nativeWatch = {}.watch;
var supportsPassive = false;
if (inBrowser) {
    try {
        var opts = {};
        Object.defineProperty(opts, 'passive', {
            get: function () {
                /* istanbul ignore next */
                supportsPassive = true;
            }
        }); // https://github.com/facebook/flow/issues/285
        window.addEventListener('test-passive', null, opts);
    }
    catch (e) { }
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
    if (_isServer === undefined) {
        /* istanbul ignore if */
        if (!inBrowser && typeof __webpack_require__.g !== 'undefined') {
            // detect presence of vue-server-renderer and avoid
            // Webpack shimming the process
            _isServer =
                __webpack_require__.g['process'] && __webpack_require__.g['process'].env.VUE_ENV === 'server';
        }
        else {
            _isServer = false;
        }
    }
    return _isServer;
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative(Ctor) {
    return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
}
var hasSymbol = typeof Symbol !== 'undefined' &&
    isNative(Symbol) &&
    typeof Reflect !== 'undefined' &&
    isNative(Reflect.ownKeys);
var _Set; // $flow-disable-line
/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) {
    // use native Set when available.
    _Set = Set;
}
else {
    // a non-standard Set polyfill that only works with primitive keys.
    _Set = /** @class */ (function () {
        function Set() {
            this.set = Object.create(null);
        }
        Set.prototype.has = function (key) {
            return this.set[key] === true;
        };
        Set.prototype.add = function (key) {
            this.set[key] = true;
        };
        Set.prototype.clear = function () {
            this.set = Object.create(null);
        };
        return Set;
    }());
}

var currentInstance = null;
/**
 * This is exposed for compatibility with v3 (e.g. some functions in VueUse
 * relies on it). Do not use this internally, just use `currentInstance`.
 *
 * @internal this function needs manual type declaration because it relies
 * on previously manually authored types from Vue 2
 */
function getCurrentInstance() {
    return currentInstance && { proxy: currentInstance };
}
/**
 * @internal
 */
function setCurrentInstance(vm) {
    if (vm === void 0) { vm = null; }
    if (!vm)
        currentInstance && currentInstance._scope.off();
    currentInstance = vm;
    vm && vm._scope.on();
}

/**
 * @internal
 */
var VNode = /** @class */ (function () {
    function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {
        this.tag = tag;
        this.data = data;
        this.children = children;
        this.text = text;
        this.elm = elm;
        this.ns = undefined;
        this.context = context;
        this.fnContext = undefined;
        this.fnOptions = undefined;
        this.fnScopeId = undefined;
        this.key = data && data.key;
        this.componentOptions = componentOptions;
        this.componentInstance = undefined;
        this.parent = undefined;
        this.raw = false;
        this.isStatic = false;
        this.isRootInsert = true;
        this.isComment = false;
        this.isCloned = false;
        this.isOnce = false;
        this.asyncFactory = asyncFactory;
        this.asyncMeta = undefined;
        this.isAsyncPlaceholder = false;
    }
    Object.defineProperty(VNode.prototype, "child", {
        // DEPRECATED: alias for componentInstance for backwards compat.
        /* istanbul ignore next */
        get: function () {
            return this.componentInstance;
        },
        enumerable: false,
        configurable: true
    });
    return VNode;
}());
var createEmptyVNode = function (text) {
    if (text === void 0) { text = ''; }
    var node = new VNode();
    node.text = text;
    node.isComment = true;
    return node;
};
function createTextVNode(val) {
    return new VNode(undefined, undefined, undefined, String(val));
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode(vnode) {
    var cloned = new VNode(vnode.tag, vnode.data, 
    // #7975
    // clone children array to avoid mutating original in case of cloning
    // a child.
    vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);
    cloned.ns = vnode.ns;
    cloned.isStatic = vnode.isStatic;
    cloned.key = vnode.key;
    cloned.isComment = vnode.isComment;
    cloned.fnContext = vnode.fnContext;
    cloned.fnOptions = vnode.fnOptions;
    cloned.fnScopeId = vnode.fnScopeId;
    cloned.asyncMeta = vnode.asyncMeta;
    cloned.isCloned = true;
    return cloned;
}

/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */

var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
    var e = new Error(message);
    return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

var uid$2 = 0;
var pendingCleanupDeps = [];
var cleanupDeps = function () {
    for (var i = 0; i < pendingCleanupDeps.length; i++) {
        var dep = pendingCleanupDeps[i];
        dep.subs = dep.subs.filter(function (s) { return s; });
        dep._pending = false;
    }
    pendingCleanupDeps.length = 0;
};
/**
 * A dep is an observable that can have multiple
 * directives subscribing to it.
 * @internal
 */
var Dep = /** @class */ (function () {
    function Dep() {
        // pending subs cleanup
        this._pending = false;
        this.id = uid$2++;
        this.subs = [];
    }
    Dep.prototype.addSub = function (sub) {
        this.subs.push(sub);
    };
    Dep.prototype.removeSub = function (sub) {
        // #12696 deps with massive amount of subscribers are extremely slow to
        // clean up in Chromium
        // to workaround this, we unset the sub for now, and clear them on
        // next scheduler flush.
        this.subs[this.subs.indexOf(sub)] = null;
        if (!this._pending) {
            this._pending = true;
            pendingCleanupDeps.push(this);
        }
    };
    Dep.prototype.depend = function (info) {
        if (Dep.target) {
            Dep.target.addDep(this);
            if ( true && info && Dep.target.onTrack) {
                Dep.target.onTrack(__assign({ effect: Dep.target }, info));
            }
        }
    };
    Dep.prototype.notify = function (info) {
        // stabilize the subscriber list first
        var subs = this.subs.filter(function (s) { return s; });
        if ( true && !config.async) {
            // subs aren't sorted in scheduler if not running async
            // we need to sort them now to make sure they fire in correct
            // order
            subs.sort(function (a, b) { return a.id - b.id; });
        }
        for (var i = 0, l = subs.length; i < l; i++) {
            var sub = subs[i];
            if ( true && info) {
                sub.onTrigger &&
                    sub.onTrigger(__assign({ effect: subs[i] }, info));
            }
            sub.update();
        }
    };
    return Dep;
}());
// The current target watcher being evaluated.
// This is globally unique because only one watcher
// can be evaluated at a time.
Dep.target = null;
var targetStack = [];
function pushTarget(target) {
    targetStack.push(target);
    Dep.target = target;
}
function popTarget() {
    targetStack.pop();
    Dep.target = targetStack[targetStack.length - 1];
}

/*
 * not type checking this file because flow doesn't play well with
 * dynamically accessing methods on Array prototype
 */
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);
var methodsToPatch = [
    'push',
    'pop',
    'shift',
    'unshift',
    'splice',
    'sort',
    'reverse'
];
/**
 * Intercept mutating methods and emit events
 */
methodsToPatch.forEach(function (method) {
    // cache original method
    var original = arrayProto[method];
    def(arrayMethods, method, function mutator() {
        var args = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            args[_i] = arguments[_i];
        }
        var result = original.apply(this, args);
        var ob = this.__ob__;
        var inserted;
        switch (method) {
            case 'push':
            case 'unshift':
                inserted = args;
                break;
            case 'splice':
                inserted = args.slice(2);
                break;
        }
        if (inserted)
            ob.observeArray(inserted);
        // notify change
        if (true) {
            ob.dep.notify({
                type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */,
                target: this,
                key: method
            });
        }
        else {}
        return result;
    });
});

var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
var NO_INITIAL_VALUE = {};
/**
 * In some cases we may want to disable observation inside a component's
 * update computation.
 */
var shouldObserve = true;
function toggleObserving(value) {
    shouldObserve = value;
}
// ssr mock dep
var mockDep = {
    notify: noop,
    depend: noop,
    addSub: noop,
    removeSub: noop
};
/**
 * Observer class that is attached to each observed
 * object. Once attached, the observer converts the target
 * object's property keys into getter/setters that
 * collect dependencies and dispatch updates.
 */
var Observer = /** @class */ (function () {
    function Observer(value, shallow, mock) {
        if (shallow === void 0) { shallow = false; }
        if (mock === void 0) { mock = false; }
        this.value = value;
        this.shallow = shallow;
        this.mock = mock;
        // this.value = value
        this.dep = mock ? mockDep : new Dep();
        this.vmCount = 0;
        def(value, '__ob__', this);
        if (isArray(value)) {
            if (!mock) {
                if (hasProto) {
                    value.__proto__ = arrayMethods;
                    /* eslint-enable no-proto */
                }
                else {
                    for (var i = 0, l = arrayKeys.length; i < l; i++) {
                        var key = arrayKeys[i];
                        def(value, key, arrayMethods[key]);
                    }
                }
            }
            if (!shallow) {
                this.observeArray(value);
            }
        }
        else {
            /**
             * Walk through all properties and convert them into
             * getter/setters. This method should only be called when
             * value type is Object.
             */
            var keys = Object.keys(value);
            for (var i = 0; i < keys.length; i++) {
                var key = keys[i];
                defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock);
            }
        }
    }
    /**
     * Observe a list of Array items.
     */
    Observer.prototype.observeArray = function (value) {
        for (var i = 0, l = value.length; i < l; i++) {
            observe(value[i], false, this.mock);
        }
    };
    return Observer;
}());
// helpers
/**
 * Attempt to create an observer instance for a value,
 * returns the new observer if successfully observed,
 * or the existing observer if the value already has one.
 */
function observe(value, shallow, ssrMockReactivity) {
    if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
        return value.__ob__;
    }
    if (shouldObserve &&
        (ssrMockReactivity || !isServerRendering()) &&
        (isArray(value) || isPlainObject(value)) &&
        Object.isExtensible(value) &&
        !value.__v_skip /* ReactiveFlags.SKIP */ &&
        !isRef(value) &&
        !(value instanceof VNode)) {
        return new Observer(value, shallow, ssrMockReactivity);
    }
}
/**
 * Define a reactive property on an Object.
 */
function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow) {
    if (observeEvenIfShallow === void 0) { observeEvenIfShallow = false; }
    var dep = new Dep();
    var property = Object.getOwnPropertyDescriptor(obj, key);
    if (property && property.configurable === false) {
        return;
    }
    // cater for pre-defined getter/setters
    var getter = property && property.get;
    var setter = property && property.set;
    if ((!getter || setter) &&
        (val === NO_INITIAL_VALUE || arguments.length === 2)) {
        val = obj[key];
    }
    var childOb = shallow ? val && val.__ob__ : observe(val, false, mock);
    Object.defineProperty(obj, key, {
        enumerable: true,
        configurable: true,
        get: function reactiveGetter() {
            var value = getter ? getter.call(obj) : val;
            if (Dep.target) {
                if (true) {
                    dep.depend({
                        target: obj,
                        type: "get" /* TrackOpTypes.GET */,
                        key: key
                    });
                }
                else {}
                if (childOb) {
                    childOb.dep.depend();
                    if (isArray(value)) {
                        dependArray(value);
                    }
                }
            }
            return isRef(value) && !shallow ? value.value : value;
        },
        set: function reactiveSetter(newVal) {
            var value = getter ? getter.call(obj) : val;
            if (!hasChanged(value, newVal)) {
                return;
            }
            if ( true && customSetter) {
                customSetter();
            }
            if (setter) {
                setter.call(obj, newVal);
            }
            else if (getter) {
                // #7981: for accessor properties without setter
                return;
            }
            else if (!shallow && isRef(value) && !isRef(newVal)) {
                value.value = newVal;
                return;
            }
            else {
                val = newVal;
            }
            childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock);
            if (true) {
                dep.notify({
                    type: "set" /* TriggerOpTypes.SET */,
                    target: obj,
                    key: key,
                    newValue: newVal,
                    oldValue: value
                });
            }
            else {}
        }
    });
    return dep;
}
function set(target, key, val) {
    if ( true && (isUndef(target) || isPrimitive(target))) {
        warn("Cannot set reactive property on undefined, null, or primitive value: ".concat(target));
    }
    if (isReadonly(target)) {
         true && warn("Set operation on key \"".concat(key, "\" failed: target is readonly."));
        return;
    }
    var ob = target.__ob__;
    if (isArray(target) && isValidArrayIndex(key)) {
        target.length = Math.max(target.length, key);
        target.splice(key, 1, val);
        // when mocking for SSR, array methods are not hijacked
        if (ob && !ob.shallow && ob.mock) {
            observe(val, false, true);
        }
        return val;
    }
    if (key in target && !(key in Object.prototype)) {
        target[key] = val;
        return val;
    }
    if (target._isVue || (ob && ob.vmCount)) {
         true &&
            warn('Avoid adding reactive properties to a Vue instance or its root $data ' +
                'at runtime - declare it upfront in the data option.');
        return val;
    }
    if (!ob) {
        target[key] = val;
        return val;
    }
    defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock);
    if (true) {
        ob.dep.notify({
            type: "add" /* TriggerOpTypes.ADD */,
            target: target,
            key: key,
            newValue: val,
            oldValue: undefined
        });
    }
    else {}
    return val;
}
function del(target, key) {
    if ( true && (isUndef(target) || isPrimitive(target))) {
        warn("Cannot delete reactive property on undefined, null, or primitive value: ".concat(target));
    }
    if (isArray(target) && isValidArrayIndex(key)) {
        target.splice(key, 1);
        return;
    }
    var ob = target.__ob__;
    if (target._isVue || (ob && ob.vmCount)) {
         true &&
            warn('Avoid deleting properties on a Vue instance or its root $data ' +
                '- just set it to null.');
        return;
    }
    if (isReadonly(target)) {
         true &&
            warn("Delete operation on key \"".concat(key, "\" failed: target is readonly."));
        return;
    }
    if (!hasOwn(target, key)) {
        return;
    }
    delete target[key];
    if (!ob) {
        return;
    }
    if (true) {
        ob.dep.notify({
            type: "delete" /* TriggerOpTypes.DELETE */,
            target: target,
            key: key
        });
    }
    else {}
}
/**
 * Collect dependencies on array elements when the array is touched, since
 * we cannot intercept array element access like property getters.
 */
function dependArray(value) {
    for (var e = void 0, i = 0, l = value.length; i < l; i++) {
        e = value[i];
        if (e && e.__ob__) {
            e.__ob__.dep.depend();
        }
        if (isArray(e)) {
            dependArray(e);
        }
    }
}

function reactive(target) {
    makeReactive(target, false);
    return target;
}
/**
 * Return a shallowly-reactive copy of the original object, where only the root
 * level properties are reactive. It also does not auto-unwrap refs (even at the
 * root level).
 */
function shallowReactive(target) {
    makeReactive(target, true);
    def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
    return target;
}
function makeReactive(target, shallow) {
    // if trying to observe a readonly proxy, return the readonly version.
    if (!isReadonly(target)) {
        if (true) {
            if (isArray(target)) {
                warn("Avoid using Array as root value for ".concat(shallow ? "shallowReactive()" : "reactive()", " as it cannot be tracked in watch() or watchEffect(). Use ").concat(shallow ? "shallowRef()" : "ref()", " instead. This is a Vue-2-only limitation."));
            }
            var existingOb = target && target.__ob__;
            if (existingOb && existingOb.shallow !== shallow) {
                warn("Target is already a ".concat(existingOb.shallow ? "" : "non-", "shallow reactive object, and cannot be converted to ").concat(shallow ? "" : "non-", "shallow."));
            }
        }
        var ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */);
        if ( true && !ob) {
            if (target == null || isPrimitive(target)) {
                warn("value cannot be made reactive: ".concat(String(target)));
            }
            if (isCollectionType(target)) {
                warn("Vue 2 does not support reactive collection types such as Map or Set.");
            }
        }
    }
}
function isReactive(value) {
    if (isReadonly(value)) {
        return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
    }
    return !!(value && value.__ob__);
}
function isShallow(value) {
    return !!(value && value.__v_isShallow);
}
function isReadonly(value) {
    return !!(value && value.__v_isReadonly);
}
function isProxy(value) {
    return isReactive(value) || isReadonly(value);
}
function toRaw(observed) {
    var raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
    return raw ? toRaw(raw) : observed;
}
function markRaw(value) {
    // non-extensible objects won't be observed anyway
    if (Object.isExtensible(value)) {
        def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
    }
    return value;
}
/**
 * @internal
 */
function isCollectionType(value) {
    var type = toRawType(value);
    return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet');
}

/**
 * @internal
 */
var RefFlag = "__v_isRef";
function isRef(r) {
    return !!(r && r.__v_isRef === true);
}
function ref$1(value) {
    return createRef(value, false);
}
function shallowRef(value) {
    return createRef(value, true);
}
function createRef(rawValue, shallow) {
    if (isRef(rawValue)) {
        return rawValue;
    }
    var ref = {};
    def(ref, RefFlag, true);
    def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow);
    def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering()));
    return ref;
}
function triggerRef(ref) {
    if ( true && !ref.dep) {
        warn("received object is not a triggerable ref.");
    }
    if (true) {
        ref.dep &&
            ref.dep.notify({
                type: "set" /* TriggerOpTypes.SET */,
                target: ref,
                key: 'value'
            });
    }
    else {}
}
function unref(ref) {
    return isRef(ref) ? ref.value : ref;
}
function proxyRefs(objectWithRefs) {
    if (isReactive(objectWithRefs)) {
        return objectWithRefs;
    }
    var proxy = {};
    var keys = Object.keys(objectWithRefs);
    for (var i = 0; i < keys.length; i++) {
        proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]);
    }
    return proxy;
}
function proxyWithRefUnwrap(target, source, key) {
    Object.defineProperty(target, key, {
        enumerable: true,
        configurable: true,
        get: function () {
            var val = source[key];
            if (isRef(val)) {
                return val.value;
            }
            else {
                var ob = val && val.__ob__;
                if (ob)
                    ob.dep.depend();
                return val;
            }
        },
        set: function (value) {
            var oldValue = source[key];
            if (isRef(oldValue) && !isRef(value)) {
                oldValue.value = value;
            }
            else {
                source[key] = value;
            }
        }
    });
}
function customRef(factory) {
    var dep = new Dep();
    var _a = factory(function () {
        if (true) {
            dep.depend({
                target: ref,
                type: "get" /* TrackOpTypes.GET */,
                key: 'value'
            });
        }
        else {}
    }, function () {
        if (true) {
            dep.notify({
                target: ref,
                type: "set" /* TriggerOpTypes.SET */,
                key: 'value'
            });
        }
        else {}
    }), get = _a.get, set = _a.set;
    var ref = {
        get value() {
            return get();
        },
        set value(newVal) {
            set(newVal);
        }
    };
    def(ref, RefFlag, true);
    return ref;
}
function toRefs(object) {
    if ( true && !isReactive(object)) {
        warn("toRefs() expects a reactive object but received a plain one.");
    }
    var ret = isArray(object) ? new Array(object.length) : {};
    for (var key in object) {
        ret[key] = toRef(object, key);
    }
    return ret;
}
function toRef(object, key, defaultValue) {
    var val = object[key];
    if (isRef(val)) {
        return val;
    }
    var ref = {
        get value() {
            var val = object[key];
            return val === undefined ? defaultValue : val;
        },
        set value(newVal) {
            object[key] = newVal;
        }
    };
    def(ref, RefFlag, true);
    return ref;
}

var rawToReadonlyFlag = "__v_rawToReadonly";
var rawToShallowReadonlyFlag = "__v_rawToShallowReadonly";
function readonly(target) {
    return createReadonly(target, false);
}
function createReadonly(target, shallow) {
    if (!isPlainObject(target)) {
        if (true) {
            if (isArray(target)) {
                warn("Vue 2 does not support readonly arrays.");
            }
            else if (isCollectionType(target)) {
                warn("Vue 2 does not support readonly collection types such as Map or Set.");
            }
            else {
                warn("value cannot be made readonly: ".concat(typeof target));
            }
        }
        return target;
    }
    if ( true && !Object.isExtensible(target)) {
        warn("Vue 2 does not support creating readonly proxy for non-extensible object.");
    }
    // already a readonly object
    if (isReadonly(target)) {
        return target;
    }
    // already has a readonly proxy
    var existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag;
    var existingProxy = target[existingFlag];
    if (existingProxy) {
        return existingProxy;
    }
    var proxy = Object.create(Object.getPrototypeOf(target));
    def(target, existingFlag, proxy);
    def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true);
    def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target);
    if (isRef(target)) {
        def(proxy, RefFlag, true);
    }
    if (shallow || isShallow(target)) {
        def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true);
    }
    var keys = Object.keys(target);
    for (var i = 0; i < keys.length; i++) {
        defineReadonlyProperty(proxy, target, keys[i], shallow);
    }
    return proxy;
}
function defineReadonlyProperty(proxy, target, key, shallow) {
    Object.defineProperty(proxy, key, {
        enumerable: true,
        configurable: true,
        get: function () {
            var val = target[key];
            return shallow || !isPlainObject(val) ? val : readonly(val);
        },
        set: function () {
             true &&
                warn("Set operation on key \"".concat(key, "\" failed: target is readonly."));
        }
    });
}
/**
 * Returns a reactive-copy of the original object, where only the root level
 * properties are readonly, and does NOT unwrap refs nor recursively convert
 * returned properties.
 * This is used for creating the props proxy object for stateful components.
 */
function shallowReadonly(target) {
    return createReadonly(target, true);
}

function computed(getterOrOptions, debugOptions) {
    var getter;
    var setter;
    var onlyGetter = isFunction(getterOrOptions);
    if (onlyGetter) {
        getter = getterOrOptions;
        setter =  true
            ? function () {
                warn('Write operation failed: computed value is readonly');
            }
            : 0;
    }
    else {
        getter = getterOrOptions.get;
        setter = getterOrOptions.set;
    }
    var watcher = isServerRendering()
        ? null
        : new Watcher(currentInstance, getter, noop, { lazy: true });
    if ( true && watcher && debugOptions) {
        watcher.onTrack = debugOptions.onTrack;
        watcher.onTrigger = debugOptions.onTrigger;
    }
    var ref = {
        // some libs rely on the presence effect for checking computed refs
        // from normal refs, but the implementation doesn't matter
        effect: watcher,
        get value() {
            if (watcher) {
                if (watcher.dirty) {
                    watcher.evaluate();
                }
                if (Dep.target) {
                    if ( true && Dep.target.onTrack) {
                        Dep.target.onTrack({
                            effect: Dep.target,
                            target: ref,
                            type: "get" /* TrackOpTypes.GET */,
                            key: 'value'
                        });
                    }
                    watcher.depend();
                }
                return watcher.value;
            }
            else {
                return getter();
            }
        },
        set value(newVal) {
            setter(newVal);
        }
    };
    def(ref, RefFlag, true);
    def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter);
    return ref;
}

var WATCHER = "watcher";
var WATCHER_CB = "".concat(WATCHER, " callback");
var WATCHER_GETTER = "".concat(WATCHER, " getter");
var WATCHER_CLEANUP = "".concat(WATCHER, " cleanup");
// Simple effect.
function watchEffect(effect, options) {
    return doWatch(effect, null, options);
}
function watchPostEffect(effect, options) {
    return doWatch(effect, null, ( true
        ? __assign(__assign({}, options), { flush: 'post' }) : 0));
}
function watchSyncEffect(effect, options) {
    return doWatch(effect, null, ( true
        ? __assign(__assign({}, options), { flush: 'sync' }) : 0));
}
// initial value for watchers to trigger on undefined initial values
var INITIAL_WATCHER_VALUE = {};
// implementation
function watch(source, cb, options) {
    if ( true && typeof cb !== 'function') {
        warn("`watch(fn, options?)` signature has been moved to a separate API. " +
            "Use `watchEffect(fn, options?)` instead. `watch` now only " +
            "supports `watch(source, cb, options?) signature.");
    }
    return doWatch(source, cb, options);
}
function doWatch(source, cb, _a) {
    var _b = _a === void 0 ? emptyObject : _a, immediate = _b.immediate, deep = _b.deep, _c = _b.flush, flush = _c === void 0 ? 'pre' : _c, onTrack = _b.onTrack, onTrigger = _b.onTrigger;
    if ( true && !cb) {
        if (immediate !== undefined) {
            warn("watch() \"immediate\" option is only respected when using the " +
                "watch(source, callback, options?) signature.");
        }
        if (deep !== undefined) {
            warn("watch() \"deep\" option is only respected when using the " +
                "watch(source, callback, options?) signature.");
        }
    }
    var warnInvalidSource = function (s) {
        warn("Invalid watch source: ".concat(s, ". A watch source can only be a getter/effect ") +
            "function, a ref, a reactive object, or an array of these types.");
    };
    var instance = currentInstance;
    var call = function (fn, type, args) {
        if (args === void 0) { args = null; }
        var res = invokeWithErrorHandling(fn, null, args, instance, type);
        if (deep && res && res.__ob__)
            res.__ob__.dep.depend();
        return res;
    };
    var getter;
    var forceTrigger = false;
    var isMultiSource = false;
    if (isRef(source)) {
        getter = function () { return source.value; };
        forceTrigger = isShallow(source);
    }
    else if (isReactive(source)) {
        getter = function () {
            source.__ob__.dep.depend();
            return source;
        };
        deep = true;
    }
    else if (isArray(source)) {
        isMultiSource = true;
        forceTrigger = source.some(function (s) { return isReactive(s) || isShallow(s); });
        getter = function () {
            return source.map(function (s) {
                if (isRef(s)) {
                    return s.value;
                }
                else if (isReactive(s)) {
                    s.__ob__.dep.depend();
                    return traverse(s);
                }
                else if (isFunction(s)) {
                    return call(s, WATCHER_GETTER);
                }
                else {
                     true && warnInvalidSource(s);
                }
            });
        };
    }
    else if (isFunction(source)) {
        if (cb) {
            // getter with cb
            getter = function () { return call(source, WATCHER_GETTER); };
        }
        else {
            // no cb -> simple effect
            getter = function () {
                if (instance && instance._isDestroyed) {
                    return;
                }
                if (cleanup) {
                    cleanup();
                }
                return call(source, WATCHER, [onCleanup]);
            };
        }
    }
    else {
        getter = noop;
         true && warnInvalidSource(source);
    }
    if (cb && deep) {
        var baseGetter_1 = getter;
        getter = function () { return traverse(baseGetter_1()); };
    }
    var cleanup;
    var onCleanup = function (fn) {
        cleanup = watcher.onStop = function () {
            call(fn, WATCHER_CLEANUP);
        };
    };
    // in SSR there is no need to setup an actual effect, and it should be noop
    // unless it's eager
    if (isServerRendering()) {
        // we will also not call the invalidate callback (+ runner is not set up)
        onCleanup = noop;
        if (!cb) {
            getter();
        }
        else if (immediate) {
            call(cb, WATCHER_CB, [
                getter(),
                isMultiSource ? [] : undefined,
                onCleanup
            ]);
        }
        return noop;
    }
    var watcher = new Watcher(currentInstance, getter, noop, {
        lazy: true
    });
    watcher.noRecurse = !cb;
    var oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
    // overwrite default run
    watcher.run = function () {
        if (!watcher.active) {
            return;
        }
        if (cb) {
            // watch(source, cb)
            var newValue = watcher.get();
            if (deep ||
                forceTrigger ||
                (isMultiSource
                    ? newValue.some(function (v, i) {
                        return hasChanged(v, oldValue[i]);
                    })
                    : hasChanged(newValue, oldValue))) {
                // cleanup before running cb again
                if (cleanup) {
                    cleanup();
                }
                call(cb, WATCHER_CB, [
                    newValue,
                    // pass undefined as the old value when it's changed for the first time
                    oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
                    onCleanup
                ]);
                oldValue = newValue;
            }
        }
        else {
            // watchEffect
            watcher.get();
        }
    };
    if (flush === 'sync') {
        watcher.update = watcher.run;
    }
    else if (flush === 'post') {
        watcher.post = true;
        watcher.update = function () { return queueWatcher(watcher); };
    }
    else {
        // pre
        watcher.update = function () {
            if (instance && instance === currentInstance && !instance._isMounted) {
                // pre-watcher triggered before
                var buffer = instance._preWatchers || (instance._preWatchers = []);
                if (buffer.indexOf(watcher) < 0)
                    buffer.push(watcher);
            }
            else {
                queueWatcher(watcher);
            }
        };
    }
    if (true) {
        watcher.onTrack = onTrack;
        watcher.onTrigger = onTrigger;
    }
    // initial run
    if (cb) {
        if (immediate) {
            watcher.run();
        }
        else {
            oldValue = watcher.get();
        }
    }
    else if (flush === 'post' && instance) {
        instance.$once('hook:mounted', function () { return watcher.get(); });
    }
    else {
        watcher.get();
    }
    return function () {
        watcher.teardown();
    };
}

var activeEffectScope;
var EffectScope = /** @class */ (function () {
    function EffectScope(detached) {
        if (detached === void 0) { detached = false; }
        this.detached = detached;
        /**
         * @internal
         */
        this.active = true;
        /**
         * @internal
         */
        this.effects = [];
        /**
         * @internal
         */
        this.cleanups = [];
        this.parent = activeEffectScope;
        if (!detached && activeEffectScope) {
            this.index =
                (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
        }
    }
    EffectScope.prototype.run = function (fn) {
        if (this.active) {
            var currentEffectScope = activeEffectScope;
            try {
                activeEffectScope = this;
                return fn();
            }
            finally {
                activeEffectScope = currentEffectScope;
            }
        }
        else if (true) {
            warn("cannot run an inactive effect scope.");
        }
    };
    /**
     * This should only be called on non-detached scopes
     * @internal
     */
    EffectScope.prototype.on = function () {
        activeEffectScope = this;
    };
    /**
     * This should only be called on non-detached scopes
     * @internal
     */
    EffectScope.prototype.off = function () {
        activeEffectScope = this.parent;
    };
    EffectScope.prototype.stop = function (fromParent) {
        if (this.active) {
            var i = void 0, l = void 0;
            for (i = 0, l = this.effects.length; i < l; i++) {
                this.effects[i].teardown();
            }
            for (i = 0, l = this.cleanups.length; i < l; i++) {
                this.cleanups[i]();
            }
            if (this.scopes) {
                for (i = 0, l = this.scopes.length; i < l; i++) {
                    this.scopes[i].stop(true);
                }
            }
            // nested scope, dereference from parent to avoid memory leaks
            if (!this.detached && this.parent && !fromParent) {
                // optimized O(1) removal
                var last = this.parent.scopes.pop();
                if (last && last !== this) {
                    this.parent.scopes[this.index] = last;
                    last.index = this.index;
                }
            }
            this.parent = undefined;
            this.active = false;
        }
    };
    return EffectScope;
}());
function effectScope(detached) {
    return new EffectScope(detached);
}
/**
 * @internal
 */
function recordEffectScope(effect, scope) {
    if (scope === void 0) { scope = activeEffectScope; }
    if (scope && scope.active) {
        scope.effects.push(effect);
    }
}
function getCurrentScope() {
    return activeEffectScope;
}
function onScopeDispose(fn) {
    if (activeEffectScope) {
        activeEffectScope.cleanups.push(fn);
    }
    else if (true) {
        warn("onScopeDispose() is called when there is no active effect scope" +
            " to be associated with.");
    }
}

function provide(key, value) {
    if (!currentInstance) {
        if (true) {
            warn("provide() can only be used inside setup().");
        }
    }
    else {
        // TS doesn't allow symbol as index type
        resolveProvided(currentInstance)[key] = value;
    }
}
function resolveProvided(vm) {
    // by default an instance inherits its parent's provides object
    // but when it needs to provide values of its own, it creates its
    // own provides object using parent provides object as prototype.
    // this way in `inject` we can simply look up injections from direct
    // parent and let the prototype chain do the work.
    var existing = vm._provided;
    var parentProvides = vm.$parent && vm.$parent._provided;
    if (parentProvides === existing) {
        return (vm._provided = Object.create(parentProvides));
    }
    else {
        return existing;
    }
}
function inject(key, defaultValue, treatDefaultAsFactory) {
    if (treatDefaultAsFactory === void 0) { treatDefaultAsFactory = false; }
    // fallback to `currentRenderingInstance` so that this can be called in
    // a functional component
    var instance = currentInstance;
    if (instance) {
        // #2400
        // to support `app.use` plugins,
        // fallback to appContext's `provides` if the instance is at root
        var provides = instance.$parent && instance.$parent._provided;
        if (provides && key in provides) {
            // TS doesn't allow symbol as index type
            return provides[key];
        }
        else if (arguments.length > 1) {
            return treatDefaultAsFactory && isFunction(defaultValue)
                ? defaultValue.call(instance)
                : defaultValue;
        }
        else if (true) {
            warn("injection \"".concat(String(key), "\" not found."));
        }
    }
    else if (true) {
        warn("inject() can only be used inside setup() or functional components.");
    }
}

var normalizeEvent = cached(function (name) {
    var passive = name.charAt(0) === '&';
    name = passive ? name.slice(1) : name;
    var once = name.charAt(0) === '~'; // Prefixed last, checked first
    name = once ? name.slice(1) : name;
    var capture = name.charAt(0) === '!';
    name = capture ? name.slice(1) : name;
    return {
        name: name,
        once: once,
        capture: capture,
        passive: passive
    };
});
function createFnInvoker(fns, vm) {
    function invoker() {
        var fns = invoker.fns;
        if (isArray(fns)) {
            var cloned = fns.slice();
            for (var i = 0; i < cloned.length; i++) {
                invokeWithErrorHandling(cloned[i], null, arguments, vm, "v-on handler");
            }
        }
        else {
            // return handler return value for single handlers
            return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler");
        }
    }
    invoker.fns = fns;
    return invoker;
}
function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) {
    var name, cur, old, event;
    for (name in on) {
        cur = on[name];
        old = oldOn[name];
        event = normalizeEvent(name);
        if (isUndef(cur)) {
             true &&
                warn("Invalid handler for event \"".concat(event.name, "\": got ") + String(cur), vm);
        }
        else if (isUndef(old)) {
            if (isUndef(cur.fns)) {
                cur = on[name] = createFnInvoker(cur, vm);
            }
            if (isTrue(event.once)) {
                cur = on[name] = createOnceHandler(event.name, cur, event.capture);
            }
            add(event.name, cur, event.capture, event.passive, event.params);
        }
        else if (cur !== old) {
            old.fns = cur;
            on[name] = old;
        }
    }
    for (name in oldOn) {
        if (isUndef(on[name])) {
            event = normalizeEvent(name);
            remove(event.name, oldOn[name], event.capture);
        }
    }
}

function mergeVNodeHook(def, hookKey, hook) {
    if (def instanceof VNode) {
        def = def.data.hook || (def.data.hook = {});
    }
    var invoker;
    var oldHook = def[hookKey];
    function wrappedHook() {
        hook.apply(this, arguments);
        // important: remove merged hook to ensure it's called only once
        // and prevent memory leak
        remove$2(invoker.fns, wrappedHook);
    }
    if (isUndef(oldHook)) {
        // no existing hook
        invoker = createFnInvoker([wrappedHook]);
    }
    else {
        /* istanbul ignore if */
        if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
            // already a merged invoker
            invoker = oldHook;
            invoker.fns.push(wrappedHook);
        }
        else {
            // existing plain hook
            invoker = createFnInvoker([oldHook, wrappedHook]);
        }
    }
    invoker.merged = true;
    def[hookKey] = invoker;
}

function extractPropsFromVNodeData(data, Ctor, tag) {
    // we are only extracting raw values here.
    // validation and default values are handled in the child
    // component itself.
    var propOptions = Ctor.options.props;
    if (isUndef(propOptions)) {
        return;
    }
    var res = {};
    var attrs = data.attrs, props = data.props;
    if (isDef(attrs) || isDef(props)) {
        for (var key in propOptions) {
            var altKey = hyphenate(key);
            if (true) {
                var keyInLowerCase = key.toLowerCase();
                if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {
                    tip("Prop \"".concat(keyInLowerCase, "\" is passed to component ") +
                        "".concat(formatComponentName(
                        // @ts-expect-error tag is string
                        tag || Ctor), ", but the declared prop name is") +
                        " \"".concat(key, "\". ") +
                        "Note that HTML attributes are case-insensitive and camelCased " +
                        "props need to use their kebab-case equivalents when using in-DOM " +
                        "templates. You should probably use \"".concat(altKey, "\" instead of \"").concat(key, "\"."));
                }
            }
            checkProp(res, props, key, altKey, true) ||
                checkProp(res, attrs, key, altKey, false);
        }
    }
    return res;
}
function checkProp(res, hash, key, altKey, preserve) {
    if (isDef(hash)) {
        if (hasOwn(hash, key)) {
            res[key] = hash[key];
            if (!preserve) {
                delete hash[key];
            }
            return true;
        }
        else if (hasOwn(hash, altKey)) {
            res[key] = hash[altKey];
            if (!preserve) {
                delete hash[altKey];
            }
            return true;
        }
    }
    return false;
}

// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:
// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren(children) {
    for (var i = 0; i < children.length; i++) {
        if (isArray(children[i])) {
            return Array.prototype.concat.apply([], children);
        }
    }
    return children;
}
// 2. When the children contains constructs that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren(children) {
    return isPrimitive(children)
        ? [createTextVNode(children)]
        : isArray(children)
            ? normalizeArrayChildren(children)
            : undefined;
}
function isTextNode(node) {
    return isDef(node) && isDef(node.text) && isFalse(node.isComment);
}
function normalizeArrayChildren(children, nestedIndex) {
    var res = [];
    var i, c, lastIndex, last;
    for (i = 0; i < children.length; i++) {
        c = children[i];
        if (isUndef(c) || typeof c === 'boolean')
            continue;
        lastIndex = res.length - 1;
        last = res[lastIndex];
        //  nested
        if (isArray(c)) {
            if (c.length > 0) {
                c = normalizeArrayChildren(c, "".concat(nestedIndex || '', "_").concat(i));
                // merge adjacent text nodes
                if (isTextNode(c[0]) && isTextNode(last)) {
                    res[lastIndex] = createTextVNode(last.text + c[0].text);
                    c.shift();
                }
                res.push.apply(res, c);
            }
        }
        else if (isPrimitive(c)) {
            if (isTextNode(last)) {
                // merge adjacent text nodes
                // this is necessary for SSR hydration because text nodes are
                // essentially merged when rendered to HTML strings
                res[lastIndex] = createTextVNode(last.text + c);
            }
            else if (c !== '') {
                // convert primitive to vnode
                res.push(createTextVNode(c));
            }
        }
        else {
            if (isTextNode(c) && isTextNode(last)) {
                // merge adjacent text nodes
                res[lastIndex] = createTextVNode(last.text + c.text);
            }
            else {
                // default key for nested array children (likely generated by v-for)
                if (isTrue(children._isVList) &&
                    isDef(c.tag) &&
                    isUndef(c.key) &&
                    isDef(nestedIndex)) {
                    c.key = "__vlist".concat(nestedIndex, "_").concat(i, "__");
                }
                res.push(c);
            }
        }
    }
    return res;
}

/**
 * Runtime helper for rendering v-for lists.
 */
function renderList(val, render) {
    var ret = null, i, l, keys, key;
    if (isArray(val) || typeof val === 'string') {
        ret = new Array(val.length);
        for (i = 0, l = val.length; i < l; i++) {
            ret[i] = render(val[i], i);
        }
    }
    else if (typeof val === 'number') {
        ret = new Array(val);
        for (i = 0; i < val; i++) {
            ret[i] = render(i + 1, i);
        }
    }
    else if (isObject(val)) {
        if (hasSymbol && val[Symbol.iterator]) {
            ret = [];
            var iterator = val[Symbol.iterator]();
            var result = iterator.next();
            while (!result.done) {
                ret.push(render(result.value, ret.length));
                result = iterator.next();
            }
        }
        else {
            keys = Object.keys(val);
            ret = new Array(keys.length);
            for (i = 0, l = keys.length; i < l; i++) {
                key = keys[i];
                ret[i] = render(val[key], key, i);
            }
        }
    }
    if (!isDef(ret)) {
        ret = [];
    }
    ret._isVList = true;
    return ret;
}

/**
 * Runtime helper for rendering <slot>
 */
function renderSlot(name, fallbackRender, props, bindObject) {
    var scopedSlotFn = this.$scopedSlots[name];
    var nodes;
    if (scopedSlotFn) {
        // scoped slot
        props = props || {};
        if (bindObject) {
            if ( true && !isObject(bindObject)) {
                warn('slot v-bind without argument expects an Object', this);
            }
            props = extend(extend({}, bindObject), props);
        }
        nodes =
            scopedSlotFn(props) ||
                (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
    }
    else {
        nodes =
            this.$slots[name] ||
                (isFunction(fallbackRender) ? fallbackRender() : fallbackRender);
    }
    var target = props && props.slot;
    if (target) {
        return this.$createElement('template', { slot: target }, nodes);
    }
    else {
        return nodes;
    }
}

/**
 * Runtime helper for resolving filters
 */
function resolveFilter(id) {
    return resolveAsset(this.$options, 'filters', id, true) || identity;
}

function isKeyNotMatch(expect, actual) {
    if (isArray(expect)) {
        return expect.indexOf(actual) === -1;
    }
    else {
        return expect !== actual;
    }
}
/**
 * Runtime helper for checking keyCodes from config.
 * exposed as Vue.prototype._k
 * passing in eventKeyName as last argument separately for backwards compat
 */
function checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {
    var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
    if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
        return isKeyNotMatch(builtInKeyName, eventKeyName);
    }
    else if (mappedKeyCode) {
        return isKeyNotMatch(mappedKeyCode, eventKeyCode);
    }
    else if (eventKeyName) {
        return hyphenate(eventKeyName) !== key;
    }
    return eventKeyCode === undefined;
}

/**
 * Runtime helper for merging v-bind="object" into a VNode's data.
 */
function bindObjectProps(data, tag, value, asProp, isSync) {
    if (value) {
        if (!isObject(value)) {
             true &&
                warn('v-bind without argument expects an Object or Array value', this);
        }
        else {
            if (isArray(value)) {
                value = toObject(value);
            }
            var hash = void 0;
            var _loop_1 = function (key) {
                if (key === 'class' || key === 'style' || isReservedAttribute(key)) {
                    hash = data;
                }
                else {
                    var type = data.attrs && data.attrs.type;
                    hash =
                        asProp || config.mustUseProp(tag, type, key)
                            ? data.domProps || (data.domProps = {})
                            : data.attrs || (data.attrs = {});
                }
                var camelizedKey = camelize(key);
                var hyphenatedKey = hyphenate(key);
                if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
                    hash[key] = value[key];
                    if (isSync) {
                        var on = data.on || (data.on = {});
                        on["update:".concat(key)] = function ($event) {
                            value[key] = $event;
                        };
                    }
                }
            };
            for (var key in value) {
                _loop_1(key);
            }
        }
    }
    return data;
}

/**
 * Runtime helper for rendering static trees.
 */
function renderStatic(index, isInFor) {
    var cached = this._staticTrees || (this._staticTrees = []);
    var tree = cached[index];
    // if has already-rendered static tree and not inside v-for,
    // we can reuse the same tree.
    if (tree && !isInFor) {
        return tree;
    }
    // otherwise, render a fresh tree.
    tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, this._c, this // for render fns generated for functional component templates
    );
    markStatic(tree, "__static__".concat(index), false);
    return tree;
}
/**
 * Runtime helper for v-once.
 * Effectively it means marking the node as static with a unique key.
 */
function markOnce(tree, index, key) {
    markStatic(tree, "__once__".concat(index).concat(key ? "_".concat(key) : ""), true);
    return tree;
}
function markStatic(tree, key, isOnce) {
    if (isArray(tree)) {
        for (var i = 0; i < tree.length; i++) {
            if (tree[i] && typeof tree[i] !== 'string') {
                markStaticNode(tree[i], "".concat(key, "_").concat(i), isOnce);
            }
        }
    }
    else {
        markStaticNode(tree, key, isOnce);
    }
}
function markStaticNode(node, key, isOnce) {
    node.isStatic = true;
    node.key = key;
    node.isOnce = isOnce;
}

function bindObjectListeners(data, value) {
    if (value) {
        if (!isPlainObject(value)) {
             true && warn('v-on without argument expects an Object value', this);
        }
        else {
            var on = (data.on = data.on ? extend({}, data.on) : {});
            for (var key in value) {
                var existing = on[key];
                var ours = value[key];
                on[key] = existing ? [].concat(existing, ours) : ours;
            }
        }
    }
    return data;
}

function resolveScopedSlots(fns, res, 
// the following are added in 2.6
hasDynamicKeys, contentHashKey) {
    res = res || { $stable: !hasDynamicKeys };
    for (var i = 0; i < fns.length; i++) {
        var slot = fns[i];
        if (isArray(slot)) {
            resolveScopedSlots(slot, res, hasDynamicKeys);
        }
        else if (slot) {
            // marker for reverse proxying v-slot without scope on this.$slots
            // @ts-expect-error
            if (slot.proxy) {
                // @ts-expect-error
                slot.fn.proxy = true;
            }
            res[slot.key] = slot.fn;
        }
    }
    if (contentHashKey) {
        res.$key = contentHashKey;
    }
    return res;
}

// helper to process dynamic keys for dynamic arguments in v-bind and v-on.
function bindDynamicKeys(baseObj, values) {
    for (var i = 0; i < values.length; i += 2) {
        var key = values[i];
        if (typeof key === 'string' && key) {
            baseObj[values[i]] = values[i + 1];
        }
        else if ( true && key !== '' && key !== null) {
            // null is a special value for explicitly removing a binding
            warn("Invalid value for dynamic directive argument (expected string or null): ".concat(key), this);
        }
    }
    return baseObj;
}
// helper to dynamically append modifier runtime markers to event names.
// ensure only append when value is already string, otherwise it will be cast
// to string and cause the type check to miss.
function prependModifier(value, symbol) {
    return typeof value === 'string' ? symbol + value : value;
}

function installRenderHelpers(target) {
    target._o = markOnce;
    target._n = toNumber;
    target._s = toString;
    target._l = renderList;
    target._t = renderSlot;
    target._q = looseEqual;
    target._i = looseIndexOf;
    target._m = renderStatic;
    target._f = resolveFilter;
    target._k = checkKeyCodes;
    target._b = bindObjectProps;
    target._v = createTextVNode;
    target._e = createEmptyVNode;
    target._u = resolveScopedSlots;
    target._g = bindObjectListeners;
    target._d = bindDynamicKeys;
    target._p = prependModifier;
}

/**
 * Runtime helper for resolving raw children VNodes into a slot object.
 */
function resolveSlots(children, context) {
    if (!children || !children.length) {
        return {};
    }
    var slots = {};
    for (var i = 0, l = children.length; i < l; i++) {
        var child = children[i];
        var data = child.data;
        // remove slot attribute if the node is resolved as a Vue slot node
        if (data && data.attrs && data.attrs.slot) {
            delete data.attrs.slot;
        }
        // named slots should only be respected if the vnode was rendered in the
        // same context.
        if ((child.context === context || child.fnContext === context) &&
            data &&
            data.slot != null) {
            var name_1 = data.slot;
            var slot = slots[name_1] || (slots[name_1] = []);
            if (child.tag === 'template') {
                slot.push.apply(slot, child.children || []);
            }
            else {
                slot.push(child);
            }
        }
        else {
            (slots.default || (slots.default = [])).push(child);
        }
    }
    // ignore slots that contains only whitespace
    for (var name_2 in slots) {
        if (slots[name_2].every(isWhitespace)) {
            delete slots[name_2];
        }
    }
    return slots;
}
function isWhitespace(node) {
    return (node.isComment && !node.asyncFactory) || node.text === ' ';
}

function isAsyncPlaceholder(node) {
    // @ts-expect-error not really boolean type
    return node.isComment && node.asyncFactory;
}

function normalizeScopedSlots(ownerVm, scopedSlots, normalSlots, prevScopedSlots) {
    var res;
    var hasNormalSlots = Object.keys(normalSlots).length > 0;
    var isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots;
    var key = scopedSlots && scopedSlots.$key;
    if (!scopedSlots) {
        res = {};
    }
    else if (scopedSlots._normalized) {
        // fast path 1: child component re-render only, parent did not change
        return scopedSlots._normalized;
    }
    else if (isStable &&
        prevScopedSlots &&
        prevScopedSlots !== emptyObject &&
        key === prevScopedSlots.$key &&
        !hasNormalSlots &&
        !prevScopedSlots.$hasNormal) {
        // fast path 2: stable scoped slots w/ no normal slots to proxy,
        // only need to normalize once
        return prevScopedSlots;
    }
    else {
        res = {};
        for (var key_1 in scopedSlots) {
            if (scopedSlots[key_1] && key_1[0] !== '$') {
                res[key_1] = normalizeScopedSlot(ownerVm, normalSlots, key_1, scopedSlots[key_1]);
            }
        }
    }
    // expose normal slots on scopedSlots
    for (var key_2 in normalSlots) {
        if (!(key_2 in res)) {
            res[key_2] = proxyNormalSlot(normalSlots, key_2);
        }
    }
    // avoriaz seems to mock a non-extensible $scopedSlots object
    // and when that is passed down this would cause an error
    if (scopedSlots && Object.isExtensible(scopedSlots)) {
        scopedSlots._normalized = res;
    }
    def(res, '$stable', isStable);
    def(res, '$key', key);
    def(res, '$hasNormal', hasNormalSlots);
    return res;
}
function normalizeScopedSlot(vm, normalSlots, key, fn) {
    var normalized = function () {
        var cur = currentInstance;
        setCurrentInstance(vm);
        var res = arguments.length ? fn.apply(null, arguments) : fn({});
        res =
            res && typeof res === 'object' && !isArray(res)
                ? [res] // single vnode
                : normalizeChildren(res);
        var vnode = res && res[0];
        setCurrentInstance(cur);
        return res &&
            (!vnode ||
                (res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode))) // #9658, #10391
            ? undefined
            : res;
    };
    // this is a slot using the new v-slot syntax without scope. although it is
    // compiled as a scoped slot, render fn users would expect it to be present
    // on this.$slots because the usage is semantically a normal slot.
    if (fn.proxy) {
        Object.defineProperty(normalSlots, key, {
            get: normalized,
            enumerable: true,
            configurable: true
        });
    }
    return normalized;
}
function proxyNormalSlot(slots, key) {
    return function () { return slots[key]; };
}

function initSetup(vm) {
    var options = vm.$options;
    var setup = options.setup;
    if (setup) {
        var ctx = (vm._setupContext = createSetupContext(vm));
        setCurrentInstance(vm);
        pushTarget();
        var setupResult = invokeWithErrorHandling(setup, null, [vm._props || shallowReactive({}), ctx], vm, "setup");
        popTarget();
        setCurrentInstance();
        if (isFunction(setupResult)) {
            // render function
            // @ts-ignore
            options.render = setupResult;
        }
        else if (isObject(setupResult)) {
            // bindings
            if ( true && setupResult instanceof VNode) {
                warn("setup() should not return VNodes directly - " +
                    "return a render function instead.");
            }
            vm._setupState = setupResult;
            // __sfc indicates compiled bindings from <script setup>
            if (!setupResult.__sfc) {
                for (var key in setupResult) {
                    if (!isReserved(key)) {
                        proxyWithRefUnwrap(vm, setupResult, key);
                    }
                    else if (true) {
                        warn("Avoid using variables that start with _ or $ in setup().");
                    }
                }
            }
            else {
                // exposed for compiled render fn
                var proxy = (vm._setupProxy = {});
                for (var key in setupResult) {
                    if (key !== '__sfc') {
                        proxyWithRefUnwrap(proxy, setupResult, key);
                    }
                }
            }
        }
        else if ( true && setupResult !== undefined) {
            warn("setup() should return an object. Received: ".concat(setupResult === null ? 'null' : typeof setupResult));
        }
    }
}
function createSetupContext(vm) {
    var exposeCalled = false;
    return {
        get attrs() {
            if (!vm._attrsProxy) {
                var proxy = (vm._attrsProxy = {});
                def(proxy, '_v_attr_proxy', true);
                syncSetupProxy(proxy, vm.$attrs, emptyObject, vm, '$attrs');
            }
            return vm._attrsProxy;
        },
        get listeners() {
            if (!vm._listenersProxy) {
                var proxy = (vm._listenersProxy = {});
                syncSetupProxy(proxy, vm.$listeners, emptyObject, vm, '$listeners');
            }
            return vm._listenersProxy;
        },
        get slots() {
            return initSlotsProxy(vm);
        },
        emit: bind(vm.$emit, vm),
        expose: function (exposed) {
            if (true) {
                if (exposeCalled) {
                    warn("expose() should be called only once per setup().", vm);
                }
                exposeCalled = true;
            }
            if (exposed) {
                Object.keys(exposed).forEach(function (key) {
                    return proxyWithRefUnwrap(vm, exposed, key);
                });
            }
        }
    };
}
function syncSetupProxy(to, from, prev, instance, type) {
    var changed = false;
    for (var key in from) {
        if (!(key in to)) {
            changed = true;
            defineProxyAttr(to, key, instance, type);
        }
        else if (from[key] !== prev[key]) {
            changed = true;
        }
    }
    for (var key in to) {
        if (!(key in from)) {
            changed = true;
            delete to[key];
        }
    }
    return changed;
}
function defineProxyAttr(proxy, key, instance, type) {
    Object.defineProperty(proxy, key, {
        enumerable: true,
        configurable: true,
        get: function () {
            return instance[type][key];
        }
    });
}
function initSlotsProxy(vm) {
    if (!vm._slotsProxy) {
        syncSetupSlots((vm._slotsProxy = {}), vm.$scopedSlots);
    }
    return vm._slotsProxy;
}
function syncSetupSlots(to, from) {
    for (var key in from) {
        to[key] = from[key];
    }
    for (var key in to) {
        if (!(key in from)) {
            delete to[key];
        }
    }
}
/**
 * @internal use manual type def because public setup context type relies on
 * legacy VNode types
 */
function useSlots() {
    return getContext().slots;
}
/**
 * @internal use manual type def because public setup context type relies on
 * legacy VNode types
 */
function useAttrs() {
    return getContext().attrs;
}
/**
 * Vue 2 only
 * @internal use manual type def because public setup context type relies on
 * legacy VNode types
 */
function useListeners() {
    return getContext().listeners;
}
function getContext() {
    if ( true && !currentInstance) {
        warn("useContext() called without active instance.");
    }
    var vm = currentInstance;
    return vm._setupContext || (vm._setupContext = createSetupContext(vm));
}
/**
 * Runtime helper for merging default declarations. Imported by compiled code
 * only.
 * @internal
 */
function mergeDefaults(raw, defaults) {
    var props = isArray(raw)
        ? raw.reduce(function (normalized, p) { return ((normalized[p] = {}), normalized); }, {})
        : raw;
    for (var key in defaults) {
        var opt = props[key];
        if (opt) {
            if (isArray(opt) || isFunction(opt)) {
                props[key] = { type: opt, default: defaults[key] };
            }
            else {
                opt.default = defaults[key];
            }
        }
        else if (opt === null) {
            props[key] = { default: defaults[key] };
        }
        else if (true) {
            warn("props default key \"".concat(key, "\" has no corresponding declaration."));
        }
    }
    return props;
}

function initRender(vm) {
    vm._vnode = null; // the root of the child tree
    vm._staticTrees = null; // v-once cached trees
    var options = vm.$options;
    var parentVnode = (vm.$vnode = options._parentVnode); // the placeholder node in parent tree
    var renderContext = parentVnode && parentVnode.context;
    vm.$slots = resolveSlots(options._renderChildren, renderContext);
    vm.$scopedSlots = parentVnode
        ? normalizeScopedSlots(vm.$parent, parentVnode.data.scopedSlots, vm.$slots)
        : emptyObject;
    // bind the createElement fn to this instance
    // so that we get proper render context inside it.
    // args order: tag, data, children, normalizationType, alwaysNormalize
    // internal version is used by render functions compiled from templates
    // @ts-expect-error
    vm._c = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, false); };
    // normalization is always applied for the public version, used in
    // user-written render functions.
    // @ts-expect-error
    vm.$createElement = function (a, b, c, d) { return createElement$1(vm, a, b, c, d, true); };
    // $attrs & $listeners are exposed for easier HOC creation.
    // they need to be reactive so that HOCs using them are always updated
    var parentData = parentVnode && parentVnode.data;
    /* istanbul ignore else */
    if (true) {
        defineReactive(vm, '$attrs', (parentData && parentData.attrs) || emptyObject, function () {
            !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
        }, true);
        defineReactive(vm, '$listeners', options._parentListeners || emptyObject, function () {
            !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
        }, true);
    }
    else {}
}
var currentRenderingInstance = null;
function renderMixin(Vue) {
    // install runtime convenience helpers
    installRenderHelpers(Vue.prototype);
    Vue.prototype.$nextTick = function (fn) {
        return nextTick(fn, this);
    };
    Vue.prototype._render = function () {
        var vm = this;
        var _a = vm.$options, render = _a.render, _parentVnode = _a._parentVnode;
        if (_parentVnode && vm._isMounted) {
            vm.$scopedSlots = normalizeScopedSlots(vm.$parent, _parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);
            if (vm._slotsProxy) {
                syncSetupSlots(vm._slotsProxy, vm.$scopedSlots);
            }
        }
        // set parent vnode. this allows render functions to have access
        // to the data on the placeholder node.
        vm.$vnode = _parentVnode;
        // render self
        var prevInst = currentInstance;
        var prevRenderInst = currentRenderingInstance;
        var vnode;
        try {
            setCurrentInstance(vm);
            currentRenderingInstance = vm;
            vnode = render.call(vm._renderProxy, vm.$createElement);
        }
        catch (e) {
            handleError(e, vm, "render");
            // return error render result,
            // or previous vnode to prevent render error causing blank component
            /* istanbul ignore else */
            if ( true && vm.$options.renderError) {
                try {
                    vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
                }
                catch (e) {
                    handleError(e, vm, "renderError");
                    vnode = vm._vnode;
                }
            }
            else {
                vnode = vm._vnode;
            }
        }
        finally {
            currentRenderingInstance = prevRenderInst;
            setCurrentInstance(prevInst);
        }
        // if the returned array contains only a single node, allow it
        if (isArray(vnode) && vnode.length === 1) {
            vnode = vnode[0];
        }
        // return empty vnode in case the render function errored out
        if (!(vnode instanceof VNode)) {
            if ( true && isArray(vnode)) {
                warn('Multiple root nodes returned from render function. Render function ' +
                    'should return a single root node.', vm);
            }
            vnode = createEmptyVNode();
        }
        // set parent
        vnode.parent = _parentVnode;
        return vnode;
    };
}

function ensureCtor(comp, base) {
    if (comp.__esModule || (hasSymbol && comp[Symbol.toStringTag] === 'Module')) {
        comp = comp.default;
    }
    return isObject(comp) ? base.extend(comp) : comp;
}
function createAsyncPlaceholder(factory, data, context, children, tag) {
    var node = createEmptyVNode();
    node.asyncFactory = factory;
    node.asyncMeta = { data: data, context: context, children: children, tag: tag };
    return node;
}
function resolveAsyncComponent(factory, baseCtor) {
    if (isTrue(factory.error) && isDef(factory.errorComp)) {
        return factory.errorComp;
    }
    if (isDef(factory.resolved)) {
        return factory.resolved;
    }
    var owner = currentRenderingInstance;
    if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
        // already pending
        factory.owners.push(owner);
    }
    if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
        return factory.loadingComp;
    }
    if (owner && !isDef(factory.owners)) {
        var owners_1 = (factory.owners = [owner]);
        var sync_1 = true;
        var timerLoading_1 = null;
        var timerTimeout_1 = null;
        owner.$on('hook:destroyed', function () { return remove$2(owners_1, owner); });
        var forceRender_1 = function (renderCompleted) {
            for (var i = 0, l = owners_1.length; i < l; i++) {
                owners_1[i].$forceUpdate();
            }
            if (renderCompleted) {
                owners_1.length = 0;
                if (timerLoading_1 !== null) {
                    clearTimeout(timerLoading_1);
                    timerLoading_1 = null;
                }
                if (timerTimeout_1 !== null) {
                    clearTimeout(timerTimeout_1);
                    timerTimeout_1 = null;
                }
            }
        };
        var resolve = once(function (res) {
            // cache resolved
            factory.resolved = ensureCtor(res, baseCtor);
            // invoke callbacks only if this is not a synchronous resolve
            // (async resolves are shimmed as synchronous during SSR)
            if (!sync_1) {
                forceRender_1(true);
            }
            else {
                owners_1.length = 0;
            }
        });
        var reject_1 = once(function (reason) {
             true &&
                warn("Failed to resolve async component: ".concat(String(factory)) +
                    (reason ? "\nReason: ".concat(reason) : ''));
            if (isDef(factory.errorComp)) {
                factory.error = true;
                forceRender_1(true);
            }
        });
        var res_1 = factory(resolve, reject_1);
        if (isObject(res_1)) {
            if (isPromise(res_1)) {
                // () => Promise
                if (isUndef(factory.resolved)) {
                    res_1.then(resolve, reject_1);
                }
            }
            else if (isPromise(res_1.component)) {
                res_1.component.then(resolve, reject_1);
                if (isDef(res_1.error)) {
                    factory.errorComp = ensureCtor(res_1.error, baseCtor);
                }
                if (isDef(res_1.loading)) {
                    factory.loadingComp = ensureCtor(res_1.loading, baseCtor);
                    if (res_1.delay === 0) {
                        factory.loading = true;
                    }
                    else {
                        // @ts-expect-error NodeJS timeout type
                        timerLoading_1 = setTimeout(function () {
                            timerLoading_1 = null;
                            if (isUndef(factory.resolved) && isUndef(factory.error)) {
                                factory.loading = true;
                                forceRender_1(false);
                            }
                        }, res_1.delay || 200);
                    }
                }
                if (isDef(res_1.timeout)) {
                    // @ts-expect-error NodeJS timeout type
                    timerTimeout_1 = setTimeout(function () {
                        timerTimeout_1 = null;
                        if (isUndef(factory.resolved)) {
                            reject_1( true ? "timeout (".concat(res_1.timeout, "ms)") : 0);
                        }
                    }, res_1.timeout);
                }
            }
        }
        sync_1 = false;
        // return in case resolved synchronously
        return factory.loading ? factory.loadingComp : factory.resolved;
    }
}

function getFirstComponentChild(children) {
    if (isArray(children)) {
        for (var i = 0; i < children.length; i++) {
            var c = children[i];
            if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
                return c;
            }
        }
    }
}

var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement$1(context, tag, data, children, normalizationType, alwaysNormalize) {
    if (isArray(data) || isPrimitive(data)) {
        normalizationType = children;
        children = data;
        data = undefined;
    }
    if (isTrue(alwaysNormalize)) {
        normalizationType = ALWAYS_NORMALIZE;
    }
    return _createElement(context, tag, data, children, normalizationType);
}
function _createElement(context, tag, data, children, normalizationType) {
    if (isDef(data) && isDef(data.__ob__)) {
         true &&
            warn("Avoid using observed data object as vnode data: ".concat(JSON.stringify(data), "\n") + 'Always create fresh vnode data objects in each render!', context);
        return createEmptyVNode();
    }
    // object syntax in v-bind
    if (isDef(data) && isDef(data.is)) {
        tag = data.is;
    }
    if (!tag) {
        // in case of component :is set to falsy value
        return createEmptyVNode();
    }
    // warn against non-primitive key
    if ( true && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {
        warn('Avoid using non-primitive value as key, ' +
            'use string/number value instead.', context);
    }
    // support single function children as default scoped slot
    if (isArray(children) && isFunction(children[0])) {
        data = data || {};
        data.scopedSlots = { default: children[0] };
        children.length = 0;
    }
    if (normalizationType === ALWAYS_NORMALIZE) {
        children = normalizeChildren(children);
    }
    else if (normalizationType === SIMPLE_NORMALIZE) {
        children = simpleNormalizeChildren(children);
    }
    var vnode, ns;
    if (typeof tag === 'string') {
        var Ctor = void 0;
        ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
        if (config.isReservedTag(tag)) {
            // platform built-in elements
            if ( true &&
                isDef(data) &&
                isDef(data.nativeOn) &&
                data.tag !== 'component') {
                warn("The .native modifier for v-on is only valid on components but it was used on <".concat(tag, ">."), context);
            }
            vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);
        }
        else if ((!data || !data.pre) &&
            isDef((Ctor = resolveAsset(context.$options, 'components', tag)))) {
            // component
            vnode = createComponent(Ctor, data, context, children, tag);
        }
        else {
            // unknown or unlisted namespaced elements
            // check at runtime because it may get assigned a namespace when its
            // parent normalizes children
            vnode = new VNode(tag, data, children, undefined, undefined, context);
        }
    }
    else {
        // direct component options / constructor
        vnode = createComponent(tag, data, context, children);
    }
    if (isArray(vnode)) {
        return vnode;
    }
    else if (isDef(vnode)) {
        if (isDef(ns))
            applyNS(vnode, ns);
        if (isDef(data))
            registerDeepBindings(data);
        return vnode;
    }
    else {
        return createEmptyVNode();
    }
}
function applyNS(vnode, ns, force) {
    vnode.ns = ns;
    if (vnode.tag === 'foreignObject') {
        // use default namespace inside foreignObject
        ns = undefined;
        force = true;
    }
    if (isDef(vnode.children)) {
        for (var i = 0, l = vnode.children.length; i < l; i++) {
            var child = vnode.children[i];
            if (isDef(child.tag) &&
                (isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
                applyNS(child, ns, force);
            }
        }
    }
}
// ref #5318
// necessary to ensure parent re-render when deep bindings like :style and
// :class are used on slot nodes
function registerDeepBindings(data) {
    if (isObject(data.style)) {
        traverse(data.style);
    }
    if (isObject(data.class)) {
        traverse(data.class);
    }
}

/**
 * @internal this function needs manual public type declaration because it relies
 * on previously manually authored types from Vue 2
 */
function h(type, props, children) {
    if (!currentInstance) {
         true &&
            warn("globally imported h() can only be invoked when there is an active " +
                "component instance, e.g. synchronously in a component's render or setup function.");
    }
    return createElement$1(currentInstance, type, props, children, 2, true);
}

function handleError(err, vm, info) {
    // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
    // See: https://github.com/vuejs/vuex/issues/1505
    pushTarget();
    try {
        if (vm) {
            var cur = vm;
            while ((cur = cur.$parent)) {
                var hooks = cur.$options.errorCaptured;
                if (hooks) {
                    for (var i = 0; i < hooks.length; i++) {
                        try {
                            var capture = hooks[i].call(cur, err, vm, info) === false;
                            if (capture)
                                return;
                        }
                        catch (e) {
                            globalHandleError(e, cur, 'errorCaptured hook');
                        }
                    }
                }
            }
        }
        globalHandleError(err, vm, info);
    }
    finally {
        popTarget();
    }
}
function invokeWithErrorHandling(handler, context, args, vm, info) {
    var res;
    try {
        res = args ? handler.apply(context, args) : handler.call(context);
        if (res && !res._isVue && isPromise(res) && !res._handled) {
            res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
            res._handled = true;
        }
    }
    catch (e) {
        handleError(e, vm, info);
    }
    return res;
}
function globalHandleError(err, vm, info) {
    if (config.errorHandler) {
        try {
            return config.errorHandler.call(null, err, vm, info);
        }
        catch (e) {
            // if the user intentionally throws the original error in the handler,
            // do not log it twice
            if (e !== err) {
                logError(e, null, 'config.errorHandler');
            }
        }
    }
    logError(err, vm, info);
}
function logError(err, vm, info) {
    if (true) {
        warn("Error in ".concat(info, ": \"").concat(err.toString(), "\""), vm);
    }
    /* istanbul ignore else */
    if (inBrowser && typeof console !== 'undefined') {
        console.error(err);
    }
    else {
        throw err;
    }
}

/* globals MutationObserver */
var isUsingMicroTask = false;
var callbacks = [];
var pending = false;
function flushCallbacks() {
    pending = false;
    var copies = callbacks.slice(0);
    callbacks.length = 0;
    for (var i = 0; i < copies.length; i++) {
        copies[i]();
    }
}
// Here we have async deferring wrappers using microtasks.
// In 2.5 we used (macro) tasks (in combination with microtasks).
// However, it has subtle problems when state is changed right before repaint
// (e.g. #6813, out-in transitions).
// Also, using (macro) tasks in event handler would cause some weird behaviors
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
// So we now use microtasks everywhere, again.
// A major drawback of this tradeoff is that there are some scenarios
// where microtasks have too high a priority and fire in between supposedly
// sequential events (e.g. #4521, #6690, which have workarounds)
// or even between bubbling of the same event (#6566).
var timerFunc;
// The nextTick behavior leverages the microtask queue, which can be accessed
// via either native Promise.then or MutationObserver.
// MutationObserver has wider support, however it is seriously bugged in
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
// completely stops working after triggering a few times... so, if native
// Promise is available, we will use it:
/* istanbul ignore next, $flow-disable-line */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
    var p_1 = Promise.resolve();
    timerFunc = function () {
        p_1.then(flushCallbacks);
        // In problematic UIWebViews, Promise.then doesn't completely break, but
        // it can get stuck in a weird state where callbacks are pushed into the
        // microtask queue but the queue isn't being flushed, until the browser
        // needs to do some other work, e.g. handle a timer. Therefore we can
        // "force" the microtask queue to be flushed by adding an empty timer.
        if (isIOS)
            setTimeout(noop);
    };
    isUsingMicroTask = true;
}
else if (!isIE &&
    typeof MutationObserver !== 'undefined' &&
    (isNative(MutationObserver) ||
        // PhantomJS and iOS 7.x
        MutationObserver.toString() === '[object MutationObserverConstructor]')) {
    // Use MutationObserver where native Promise is not available,
    // e.g. PhantomJS, iOS7, Android 4.4
    // (#6466 MutationObserver is unreliable in IE11)
    var counter_1 = 1;
    var observer = new MutationObserver(flushCallbacks);
    var textNode_1 = document.createTextNode(String(counter_1));
    observer.observe(textNode_1, {
        characterData: true
    });
    timerFunc = function () {
        counter_1 = (counter_1 + 1) % 2;
        textNode_1.data = String(counter_1);
    };
    isUsingMicroTask = true;
}
else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
    // Fallback to setImmediate.
    // Technically it leverages the (macro) task queue,
    // but it is still a better choice than setTimeout.
    timerFunc = function () {
        setImmediate(flushCallbacks);
    };
}
else {
    // Fallback to setTimeout.
    timerFunc = function () {
        setTimeout(flushCallbacks, 0);
    };
}
/**
 * @internal
 */
function nextTick(cb, ctx) {
    var _resolve;
    callbacks.push(function () {
        if (cb) {
            try {
                cb.call(ctx);
            }
            catch (e) {
                handleError(e, ctx, 'nextTick');
            }
        }
        else if (_resolve) {
            _resolve(ctx);
        }
    });
    if (!pending) {
        pending = true;
        timerFunc();
    }
    // $flow-disable-line
    if (!cb && typeof Promise !== 'undefined') {
        return new Promise(function (resolve) {
            _resolve = resolve;
        });
    }
}

function useCssModule(name) {
    if (name === void 0) { name = '$style'; }
    /* istanbul ignore else */
    {
        if (!currentInstance) {
             true && warn("useCssModule must be called inside setup()");
            return emptyObject;
        }
        var mod = currentInstance[name];
        if (!mod) {
             true &&
                warn("Current instance does not have CSS module named \"".concat(name, "\"."));
            return emptyObject;
        }
        return mod;
    }
}

/**
 * Runtime helper for SFC's CSS variable injection feature.
 * @private
 */
function useCssVars(getter) {
    if (!inBrowser && !false)
        return;
    var instance = currentInstance;
    if (!instance) {
         true &&
            warn("useCssVars is called without current active component instance.");
        return;
    }
    watchPostEffect(function () {
        var el = instance.$el;
        var vars = getter(instance, instance._setupProxy);
        if (el && el.nodeType === 1) {
            var style = el.style;
            for (var key in vars) {
                style.setProperty("--".concat(key), vars[key]);
            }
        }
    });
}

/**
 * v3-compatible async component API.
 * @internal the type is manually declared in <root>/types/v3-define-async-component.d.ts
 * because it relies on existing manual types
 */
function defineAsyncComponent(source) {
    if (isFunction(source)) {
        source = { loader: source };
    }
    var loader = source.loader, loadingComponent = source.loadingComponent, errorComponent = source.errorComponent, _a = source.delay, delay = _a === void 0 ? 200 : _a, timeout = source.timeout, // undefined = never times out
    _b = source.suspensible, // undefined = never times out
    suspensible = _b === void 0 ? false : _b, // in Vue 3 default is true
    userOnError = source.onError;
    if ( true && suspensible) {
        warn("The suspensible option for async components is not supported in Vue2. It is ignored.");
    }
    var pendingRequest = null;
    var retries = 0;
    var retry = function () {
        retries++;
        pendingRequest = null;
        return load();
    };
    var load = function () {
        var thisRequest;
        return (pendingRequest ||
            (thisRequest = pendingRequest =
                loader()
                    .catch(function (err) {
                    err = err instanceof Error ? err : new Error(String(err));
                    if (userOnError) {
                        return new Promise(function (resolve, reject) {
                            var userRetry = function () { return resolve(retry()); };
                            var userFail = function () { return reject(err); };
                            userOnError(err, userRetry, userFail, retries + 1);
                        });
                    }
                    else {
                        throw err;
                    }
                })
                    .then(function (comp) {
                    if (thisRequest !== pendingRequest && pendingRequest) {
                        return pendingRequest;
                    }
                    if ( true && !comp) {
                        warn("Async component loader resolved to undefined. " +
                            "If you are using retry(), make sure to return its return value.");
                    }
                    // interop module default
                    if (comp &&
                        (comp.__esModule || comp[Symbol.toStringTag] === 'Module')) {
                        comp = comp.default;
                    }
                    if ( true && comp && !isObject(comp) && !isFunction(comp)) {
                        throw new Error("Invalid async component load result: ".concat(comp));
                    }
                    return comp;
                })));
    };
    return function () {
        var component = load();
        return {
            component: component,
            delay: delay,
            timeout: timeout,
            error: errorComponent,
            loading: loadingComponent
        };
    };
}

function createLifeCycle(hookName) {
    return function (fn, target) {
        if (target === void 0) { target = currentInstance; }
        if (!target) {
             true &&
                warn("".concat(formatName(hookName), " is called when there is no active component instance to be ") +
                    "associated with. " +
                    "Lifecycle injection APIs can only be used during execution of setup().");
            return;
        }
        return injectHook(target, hookName, fn);
    };
}
function formatName(name) {
    if (name === 'beforeDestroy') {
        name = 'beforeUnmount';
    }
    else if (name === 'destroyed') {
        name = 'unmounted';
    }
    return "on".concat(name[0].toUpperCase() + name.slice(1));
}
function injectHook(instance, hookName, fn) {
    var options = instance.$options;
    options[hookName] = mergeLifecycleHook(options[hookName], fn);
}
var onBeforeMount = createLifeCycle('beforeMount');
var onMounted = createLifeCycle('mounted');
var onBeforeUpdate = createLifeCycle('beforeUpdate');
var onUpdated = createLifeCycle('updated');
var onBeforeUnmount = createLifeCycle('beforeDestroy');
var onUnmounted = createLifeCycle('destroyed');
var onActivated = createLifeCycle('activated');
var onDeactivated = createLifeCycle('deactivated');
var onServerPrefetch = createLifeCycle('serverPrefetch');
var onRenderTracked = createLifeCycle('renderTracked');
var onRenderTriggered = createLifeCycle('renderTriggered');
var injectErrorCapturedHook = createLifeCycle('errorCaptured');
function onErrorCaptured(hook, target) {
    if (target === void 0) { target = currentInstance; }
    injectErrorCapturedHook(hook, target);
}

/**
 * Note: also update dist/vue.runtime.mjs when adding new exports to this file.
 */
var version = '2.7.16';
/**
 * @internal type is manually declared in <root>/types/v3-define-component.d.ts
 */
function defineComponent(options) {
    return options;
}

var seenObjects = new _Set();
/**
 * Recursively traverse an object to evoke all converted
 * getters, so that every nested property inside the object
 * is collected as a "deep" dependency.
 */
function traverse(val) {
    _traverse(val, seenObjects);
    seenObjects.clear();
    return val;
}
function _traverse(val, seen) {
    var i, keys;
    var isA = isArray(val);
    if ((!isA && !isObject(val)) ||
        val.__v_skip /* ReactiveFlags.SKIP */ ||
        Object.isFrozen(val) ||
        val instanceof VNode) {
        return;
    }
    if (val.__ob__) {
        var depId = val.__ob__.dep.id;
        if (seen.has(depId)) {
            return;
        }
        seen.add(depId);
    }
    if (isA) {
        i = val.length;
        while (i--)
            _traverse(val[i], seen);
    }
    else if (isRef(val)) {
        _traverse(val.value, seen);
    }
    else {
        keys = Object.keys(val);
        i = keys.length;
        while (i--)
            _traverse(val[keys[i]], seen);
    }
}

var uid$1 = 0;
/**
 * A watcher parses an expression, collects dependencies,
 * and fires callback when the expression value changes.
 * This is used for both the $watch() api and directives.
 * @internal
 */
var Watcher = /** @class */ (function () {
    function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {
        recordEffectScope(this, 
        // if the active effect scope is manually created (not a component scope),
        // prioritize it
        activeEffectScope && !activeEffectScope._vm
            ? activeEffectScope
            : vm
                ? vm._scope
                : undefined);
        if ((this.vm = vm) && isRenderWatcher) {
            vm._watcher = this;
        }
        // options
        if (options) {
            this.deep = !!options.deep;
            this.user = !!options.user;
            this.lazy = !!options.lazy;
            this.sync = !!options.sync;
            this.before = options.before;
            if (true) {
                this.onTrack = options.onTrack;
                this.onTrigger = options.onTrigger;
            }
        }
        else {
            this.deep = this.user = this.lazy = this.sync = false;
        }
        this.cb = cb;
        this.id = ++uid$1; // uid for batching
        this.active = true;
        this.post = false;
        this.dirty = this.lazy; // for lazy watchers
        this.deps = [];
        this.newDeps = [];
        this.depIds = new _Set();
        this.newDepIds = new _Set();
        this.expression =  true ? expOrFn.toString() : 0;
        // parse expression for getter
        if (isFunction(expOrFn)) {
            this.getter = expOrFn;
        }
        else {
            this.getter = parsePath(expOrFn);
            if (!this.getter) {
                this.getter = noop;
                 true &&
                    warn("Failed watching path: \"".concat(expOrFn, "\" ") +
                        'Watcher only accepts simple dot-delimited paths. ' +
                        'For full control, use a function instead.', vm);
            }
        }
        this.value = this.lazy ? undefined : this.get();
    }
    /**
     * Evaluate the getter, and re-collect dependencies.
     */
    Watcher.prototype.get = function () {
        pushTarget(this);
        var value;
        var vm = this.vm;
        try {
            value = this.getter.call(vm, vm);
        }
        catch (e) {
            if (this.user) {
                handleError(e, vm, "getter for watcher \"".concat(this.expression, "\""));
            }
            else {
                throw e;
            }
        }
        finally {
            // "touch" every property so they are all tracked as
            // dependencies for deep watching
            if (this.deep) {
                traverse(value);
            }
            popTarget();
            this.cleanupDeps();
        }
        return value;
    };
    /**
     * Add a dependency to this directive.
     */
    Watcher.prototype.addDep = function (dep) {
        var id = dep.id;
        if (!this.newDepIds.has(id)) {
            this.newDepIds.add(id);
            this.newDeps.push(dep);
            if (!this.depIds.has(id)) {
                dep.addSub(this);
            }
        }
    };
    /**
     * Clean up for dependency collection.
     */
    Watcher.prototype.cleanupDeps = function () {
        var i = this.deps.length;
        while (i--) {
            var dep = this.deps[i];
            if (!this.newDepIds.has(dep.id)) {
                dep.removeSub(this);
            }
        }
        var tmp = this.depIds;
        this.depIds = this.newDepIds;
        this.newDepIds = tmp;
        this.newDepIds.clear();
        tmp = this.deps;
        this.deps = this.newDeps;
        this.newDeps = tmp;
        this.newDeps.length = 0;
    };
    /**
     * Subscriber interface.
     * Will be called when a dependency changes.
     */
    Watcher.prototype.update = function () {
        /* istanbul ignore else */
        if (this.lazy) {
            this.dirty = true;
        }
        else if (this.sync) {
            this.run();
        }
        else {
            queueWatcher(this);
        }
    };
    /**
     * Scheduler job interface.
     * Will be called by the scheduler.
     */
    Watcher.prototype.run = function () {
        if (this.active) {
            var value = this.get();
            if (value !== this.value ||
                // Deep watchers and watchers on Object/Arrays should fire even
                // when the value is the same, because the value may
                // have mutated.
                isObject(value) ||
                this.deep) {
                // set new value
                var oldValue = this.value;
                this.value = value;
                if (this.user) {
                    var info = "callback for watcher \"".concat(this.expression, "\"");
                    invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
                }
                else {
                    this.cb.call(this.vm, value, oldValue);
                }
            }
        }
    };
    /**
     * Evaluate the value of the watcher.
     * This only gets called for lazy watchers.
     */
    Watcher.prototype.evaluate = function () {
        this.value = this.get();
        this.dirty = false;
    };
    /**
     * Depend on all deps collected by this watcher.
     */
    Watcher.prototype.depend = function () {
        var i = this.deps.length;
        while (i--) {
            this.deps[i].depend();
        }
    };
    /**
     * Remove self from all dependencies' subscriber list.
     */
    Watcher.prototype.teardown = function () {
        if (this.vm && !this.vm._isBeingDestroyed) {
            remove$2(this.vm._scope.effects, this);
        }
        if (this.active) {
            var i = this.deps.length;
            while (i--) {
                this.deps[i].removeSub(this);
            }
            this.active = false;
            if (this.onStop) {
                this.onStop();
            }
        }
    };
    return Watcher;
}());

var mark;
var measure;
if (true) {
    var perf_1 = inBrowser && window.performance;
    /* istanbul ignore if */
    if (perf_1 &&
        // @ts-ignore
        perf_1.mark &&
        // @ts-ignore
        perf_1.measure &&
        // @ts-ignore
        perf_1.clearMarks &&
        // @ts-ignore
        perf_1.clearMeasures) {
        mark = function (tag) { return perf_1.mark(tag); };
        measure = function (name, startTag, endTag) {
            perf_1.measure(name, startTag, endTag);
            perf_1.clearMarks(startTag);
            perf_1.clearMarks(endTag);
            // perf.clearMeasures(name)
        };
    }
}

function initEvents(vm) {
    vm._events = Object.create(null);
    vm._hasHookEvent = false;
    // init parent attached events
    var listeners = vm.$options._parentListeners;
    if (listeners) {
        updateComponentListeners(vm, listeners);
    }
}
var target$1;
function add$1(event, fn) {
    target$1.$on(event, fn);
}
function remove$1(event, fn) {
    target$1.$off(event, fn);
}
function createOnceHandler$1(event, fn) {
    var _target = target$1;
    return function onceHandler() {
        var res = fn.apply(null, arguments);
        if (res !== null) {
            _target.$off(event, onceHandler);
        }
    };
}
function updateComponentListeners(vm, listeners, oldListeners) {
    target$1 = vm;
    updateListeners(listeners, oldListeners || {}, add$1, remove$1, createOnceHandler$1, vm);
    target$1 = undefined;
}
function eventsMixin(Vue) {
    var hookRE = /^hook:/;
    Vue.prototype.$on = function (event, fn) {
        var vm = this;
        if (isArray(event)) {
            for (var i = 0, l = event.length; i < l; i++) {
                vm.$on(event[i], fn);
            }
        }
        else {
            (vm._events[event] || (vm._events[event] = [])).push(fn);
            // optimize hook:event cost by using a boolean flag marked at registration
            // instead of a hash lookup
            if (hookRE.test(event)) {
                vm._hasHookEvent = true;
            }
        }
        return vm;
    };
    Vue.prototype.$once = function (event, fn) {
        var vm = this;
        function on() {
            vm.$off(event, on);
            fn.apply(vm, arguments);
        }
        on.fn = fn;
        vm.$on(event, on);
        return vm;
    };
    Vue.prototype.$off = function (event, fn) {
        var vm = this;
        // all
        if (!arguments.length) {
            vm._events = Object.create(null);
            return vm;
        }
        // array of events
        if (isArray(event)) {
            for (var i_1 = 0, l = event.length; i_1 < l; i_1++) {
                vm.$off(event[i_1], fn);
            }
            return vm;
        }
        // specific event
        var cbs = vm._events[event];
        if (!cbs) {
            return vm;
        }
        if (!fn) {
            vm._events[event] = null;
            return vm;
        }
        // specific handler
        var cb;
        var i = cbs.length;
        while (i--) {
            cb = cbs[i];
            if (cb === fn || cb.fn === fn) {
                cbs.splice(i, 1);
                break;
            }
        }
        return vm;
    };
    Vue.prototype.$emit = function (event) {
        var vm = this;
        if (true) {
            var lowerCaseEvent = event.toLowerCase();
            if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
                tip("Event \"".concat(lowerCaseEvent, "\" is emitted in component ") +
                    "".concat(formatComponentName(vm), " but the handler is registered for \"").concat(event, "\". ") +
                    "Note that HTML attributes are case-insensitive and you cannot use " +
                    "v-on to listen to camelCase events when using in-DOM templates. " +
                    "You should probably use \"".concat(hyphenate(event), "\" instead of \"").concat(event, "\"."));
            }
        }
        var cbs = vm._events[event];
        if (cbs) {
            cbs = cbs.length > 1 ? toArray(cbs) : cbs;
            var args = toArray(arguments, 1);
            var info = "event handler for \"".concat(event, "\"");
            for (var i = 0, l = cbs.length; i < l; i++) {
                invokeWithErrorHandling(cbs[i], vm, args, vm, info);
            }
        }
        return vm;
    };
}

var activeInstance = null;
var isUpdatingChildComponent = false;
function setActiveInstance(vm) {
    var prevActiveInstance = activeInstance;
    activeInstance = vm;
    return function () {
        activeInstance = prevActiveInstance;
    };
}
function initLifecycle(vm) {
    var options = vm.$options;
    // locate first non-abstract parent
    var parent = options.parent;
    if (parent && !options.abstract) {
        while (parent.$options.abstract && parent.$parent) {
            parent = parent.$parent;
        }
        parent.$children.push(vm);
    }
    vm.$parent = parent;
    vm.$root = parent ? parent.$root : vm;
    vm.$children = [];
    vm.$refs = {};
    vm._provided = parent ? parent._provided : Object.create(null);
    vm._watcher = null;
    vm._inactive = null;
    vm._directInactive = false;
    vm._isMounted = false;
    vm._isDestroyed = false;
    vm._isBeingDestroyed = false;
}
function lifecycleMixin(Vue) {
    Vue.prototype._update = function (vnode, hydrating) {
        var vm = this;
        var prevEl = vm.$el;
        var prevVnode = vm._vnode;
        var restoreActiveInstance = setActiveInstance(vm);
        vm._vnode = vnode;
        // Vue.prototype.__patch__ is injected in entry points
        // based on the rendering backend used.
        if (!prevVnode) {
            // initial render
            vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
        }
        else {
            // updates
            vm.$el = vm.__patch__(prevVnode, vnode);
        }
        restoreActiveInstance();
        // update __vue__ reference
        if (prevEl) {
            prevEl.__vue__ = null;
        }
        if (vm.$el) {
            vm.$el.__vue__ = vm;
        }
        // if parent is an HOC, update its $el as well
        var wrapper = vm;
        while (wrapper &&
            wrapper.$vnode &&
            wrapper.$parent &&
            wrapper.$vnode === wrapper.$parent._vnode) {
            wrapper.$parent.$el = wrapper.$el;
            wrapper = wrapper.$parent;
        }
        // updated hook is called by the scheduler to ensure that children are
        // updated in a parent's updated hook.
    };
    Vue.prototype.$forceUpdate = function () {
        var vm = this;
        if (vm._watcher) {
            vm._watcher.update();
        }
    };
    Vue.prototype.$destroy = function () {
        var vm = this;
        if (vm._isBeingDestroyed) {
            return;
        }
        callHook$1(vm, 'beforeDestroy');
        vm._isBeingDestroyed = true;
        // remove self from parent
        var parent = vm.$parent;
        if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
            remove$2(parent.$children, vm);
        }
        // teardown scope. this includes both the render watcher and other
        // watchers created
        vm._scope.stop();
        // remove reference from data ob
        // frozen object may not have observer.
        if (vm._data.__ob__) {
            vm._data.__ob__.vmCount--;
        }
        // call the last hook...
        vm._isDestroyed = true;
        // invoke destroy hooks on current rendered tree
        vm.__patch__(vm._vnode, null);
        // fire destroyed hook
        callHook$1(vm, 'destroyed');
        // turn off all instance listeners.
        vm.$off();
        // remove __vue__ reference
        if (vm.$el) {
            vm.$el.__vue__ = null;
        }
        // release circular reference (#6759)
        if (vm.$vnode) {
            vm.$vnode.parent = null;
        }
    };
}
function mountComponent(vm, el, hydrating) {
    vm.$el = el;
    if (!vm.$options.render) {
        // @ts-expect-error invalid type
        vm.$options.render = createEmptyVNode;
        if (true) {
            /* istanbul ignore if */
            if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
                vm.$options.el ||
                el) {
                warn('You are using the runtime-only build of Vue where the template ' +
                    'compiler is not available. Either pre-compile the templates into ' +
                    'render functions, or use the compiler-included build.', vm);
            }
            else {
                warn('Failed to mount component: template or render function not defined.', vm);
            }
        }
    }
    callHook$1(vm, 'beforeMount');
    var updateComponent;
    /* istanbul ignore if */
    if ( true && config.performance && mark) {
        updateComponent = function () {
            var name = vm._name;
            var id = vm._uid;
            var startTag = "vue-perf-start:".concat(id);
            var endTag = "vue-perf-end:".concat(id);
            mark(startTag);
            var vnode = vm._render();
            mark(endTag);
            measure("vue ".concat(name, " render"), startTag, endTag);
            mark(startTag);
            vm._update(vnode, hydrating);
            mark(endTag);
            measure("vue ".concat(name, " patch"), startTag, endTag);
        };
    }
    else {
        updateComponent = function () {
            vm._update(vm._render(), hydrating);
        };
    }
    var watcherOptions = {
        before: function () {
            if (vm._isMounted && !vm._isDestroyed) {
                callHook$1(vm, 'beforeUpdate');
            }
        }
    };
    if (true) {
        watcherOptions.onTrack = function (e) { return callHook$1(vm, 'renderTracked', [e]); };
        watcherOptions.onTrigger = function (e) { return callHook$1(vm, 'renderTriggered', [e]); };
    }
    // we set this to vm._watcher inside the watcher's constructor
    // since the watcher's initial patch may call $forceUpdate (e.g. inside child
    // component's mounted hook), which relies on vm._watcher being already defined
    new Watcher(vm, updateComponent, noop, watcherOptions, true /* isRenderWatcher */);
    hydrating = false;
    // flush buffer for flush: "pre" watchers queued in setup()
    var preWatchers = vm._preWatchers;
    if (preWatchers) {
        for (var i = 0; i < preWatchers.length; i++) {
            preWatchers[i].run();
        }
    }
    // manually mounted instance, call mounted on self
    // mounted is called for render-created child components in its inserted hook
    if (vm.$vnode == null) {
        vm._isMounted = true;
        callHook$1(vm, 'mounted');
    }
    return vm;
}
function updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {
    if (true) {
        isUpdatingChildComponent = true;
    }
    // determine whether component has slot children
    // we need to do this before overwriting $options._renderChildren.
    // check if there are dynamic scopedSlots (hand-written or compiled but with
    // dynamic slot names). Static scoped slots compiled from template has the
    // "$stable" marker.
    var newScopedSlots = parentVnode.data.scopedSlots;
    var oldScopedSlots = vm.$scopedSlots;
    var hasDynamicScopedSlot = !!((newScopedSlots && !newScopedSlots.$stable) ||
        (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
        (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
        (!newScopedSlots && vm.$scopedSlots.$key));
    // Any static slot children from the parent may have changed during parent's
    // update. Dynamic scoped slots may also have changed. In such cases, a forced
    // update is necessary to ensure correctness.
    var needsForceUpdate = !!(renderChildren || // has new static slots
        vm.$options._renderChildren || // has old static slots
        hasDynamicScopedSlot);
    var prevVNode = vm.$vnode;
    vm.$options._parentVnode = parentVnode;
    vm.$vnode = parentVnode; // update vm's placeholder node without re-render
    if (vm._vnode) {
        // update child tree's parent
        vm._vnode.parent = parentVnode;
    }
    vm.$options._renderChildren = renderChildren;
    // update $attrs and $listeners hash
    // these are also reactive so they may trigger child update if the child
    // used them during render
    var attrs = parentVnode.data.attrs || emptyObject;
    if (vm._attrsProxy) {
        // force update if attrs are accessed and has changed since it may be
        // passed to a child component.
        if (syncSetupProxy(vm._attrsProxy, attrs, (prevVNode.data && prevVNode.data.attrs) || emptyObject, vm, '$attrs')) {
            needsForceUpdate = true;
        }
    }
    vm.$attrs = attrs;
    // update listeners
    listeners = listeners || emptyObject;
    var prevListeners = vm.$options._parentListeners;
    if (vm._listenersProxy) {
        syncSetupProxy(vm._listenersProxy, listeners, prevListeners || emptyObject, vm, '$listeners');
    }
    vm.$listeners = vm.$options._parentListeners = listeners;
    updateComponentListeners(vm, listeners, prevListeners);
    // update props
    if (propsData && vm.$options.props) {
        toggleObserving(false);
        var props = vm._props;
        var propKeys = vm.$options._propKeys || [];
        for (var i = 0; i < propKeys.length; i++) {
            var key = propKeys[i];
            var propOptions = vm.$options.props; // wtf flow?
            props[key] = validateProp(key, propOptions, propsData, vm);
        }
        toggleObserving(true);
        // keep a copy of raw propsData
        vm.$options.propsData = propsData;
    }
    // resolve slots + force update if has children
    if (needsForceUpdate) {
        vm.$slots = resolveSlots(renderChildren, parentVnode.context);
        vm.$forceUpdate();
    }
    if (true) {
        isUpdatingChildComponent = false;
    }
}
function isInInactiveTree(vm) {
    while (vm && (vm = vm.$parent)) {
        if (vm._inactive)
            return true;
    }
    return false;
}
function activateChildComponent(vm, direct) {
    if (direct) {
        vm._directInactive = false;
        if (isInInactiveTree(vm)) {
            return;
        }
    }
    else if (vm._directInactive) {
        return;
    }
    if (vm._inactive || vm._inactive === null) {
        vm._inactive = false;
        for (var i = 0; i < vm.$children.length; i++) {
            activateChildComponent(vm.$children[i]);
        }
        callHook$1(vm, 'activated');
    }
}
function deactivateChildComponent(vm, direct) {
    if (direct) {
        vm._directInactive = true;
        if (isInInactiveTree(vm)) {
            return;
        }
    }
    if (!vm._inactive) {
        vm._inactive = true;
        for (var i = 0; i < vm.$children.length; i++) {
            deactivateChildComponent(vm.$children[i]);
        }
        callHook$1(vm, 'deactivated');
    }
}
function callHook$1(vm, hook, args, setContext) {
    if (setContext === void 0) { setContext = true; }
    // #7573 disable dep collection when invoking lifecycle hooks
    pushTarget();
    var prevInst = currentInstance;
    var prevScope = getCurrentScope();
    setContext && setCurrentInstance(vm);
    var handlers = vm.$options[hook];
    var info = "".concat(hook, " hook");
    if (handlers) {
        for (var i = 0, j = handlers.length; i < j; i++) {
            invokeWithErrorHandling(handlers[i], vm, args || null, vm, info);
        }
    }
    if (vm._hasHookEvent) {
        vm.$emit('hook:' + hook);
    }
    if (setContext) {
        setCurrentInstance(prevInst);
        prevScope && prevScope.on();
    }
    popTarget();
}

var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;
/**
 * Reset the scheduler's state.
 */
function resetSchedulerState() {
    index = queue.length = activatedChildren.length = 0;
    has = {};
    if (true) {
        circular = {};
    }
    waiting = flushing = false;
}
// Async edge case #6566 requires saving the timestamp when event listeners are
// attached. However, calling performance.now() has a perf overhead especially
// if the page has thousands of event listeners. Instead, we take a timestamp
// every time the scheduler flushes and use that for all event listeners
// attached during that flush.
var currentFlushTimestamp = 0;
// Async edge case fix requires storing an event listener's attach timestamp.
var getNow = Date.now;
// Determine what event timestamp the browser is using. Annoyingly, the
// timestamp can either be hi-res (relative to page load) or low-res
// (relative to UNIX epoch), so in order to compare time we have to use the
// same timestamp type when saving the flush timestamp.
// All IE versions use low-res event timestamps, and have problematic clock
// implementations (#9632)
if (inBrowser && !isIE) {
    var performance_1 = window.performance;
    if (performance_1 &&
        typeof performance_1.now === 'function' &&
        getNow() > document.createEvent('Event').timeStamp) {
        // if the event timestamp, although evaluated AFTER the Date.now(), is
        // smaller than it, it means the event is using a hi-res timestamp,
        // and we need to use the hi-res version for event listener timestamps as
        // well.
        getNow = function () { return performance_1.now(); };
    }
}
var sortCompareFn = function (a, b) {
    if (a.post) {
        if (!b.post)
            return 1;
    }
    else if (b.post) {
        return -1;
    }
    return a.id - b.id;
};
/**
 * Flush both queues and run the watchers.
 */
function flushSchedulerQueue() {
    currentFlushTimestamp = getNow();
    flushing = true;
    var watcher, id;
    // Sort queue before flush.
    // This ensures that:
    // 1. Components are updated from parent to child. (because parent is always
    //    created before the child)
    // 2. A component's user watchers are run before its render watcher (because
    //    user watchers are created before the render watcher)
    // 3. If a component is destroyed during a parent component's watcher run,
    //    its watchers can be skipped.
    queue.sort(sortCompareFn);
    // do not cache length because more watchers might be pushed
    // as we run existing watchers
    for (index = 0; index < queue.length; index++) {
        watcher = queue[index];
        if (watcher.before) {
            watcher.before();
        }
        id = watcher.id;
        has[id] = null;
        watcher.run();
        // in dev build, check and stop circular updates.
        if ( true && has[id] != null) {
            circular[id] = (circular[id] || 0) + 1;
            if (circular[id] > MAX_UPDATE_COUNT) {
                warn('You may have an infinite update loop ' +
                    (watcher.user
                        ? "in watcher with expression \"".concat(watcher.expression, "\"")
                        : "in a component render function."), watcher.vm);
                break;
            }
        }
    }
    // keep copies of post queues before resetting state
    var activatedQueue = activatedChildren.slice();
    var updatedQueue = queue.slice();
    resetSchedulerState();
    // call component updated and activated hooks
    callActivatedHooks(activatedQueue);
    callUpdatedHooks(updatedQueue);
    cleanupDeps();
    // devtool hook
    /* istanbul ignore if */
    if (devtools && config.devtools) {
        devtools.emit('flush');
    }
}
function callUpdatedHooks(queue) {
    var i = queue.length;
    while (i--) {
        var watcher = queue[i];
        var vm = watcher.vm;
        if (vm && vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
            callHook$1(vm, 'updated');
        }
    }
}
/**
 * Queue a kept-alive component that was activated during patch.
 * The queue will be processed after the entire tree has been patched.
 */
function queueActivatedComponent(vm) {
    // setting _inactive to false here so that a render function can
    // rely on checking whether it's in an inactive tree (e.g. router-view)
    vm._inactive = false;
    activatedChildren.push(vm);
}
function callActivatedHooks(queue) {
    for (var i = 0; i < queue.length; i++) {
        queue[i]._inactive = true;
        activateChildComponent(queue[i], true /* true */);
    }
}
/**
 * Push a watcher into the watcher queue.
 * Jobs with duplicate IDs will be skipped unless it's
 * pushed when the queue is being flushed.
 */
function queueWatcher(watcher) {
    var id = watcher.id;
    if (has[id] != null) {
        return;
    }
    if (watcher === Dep.target && watcher.noRecurse) {
        return;
    }
    has[id] = true;
    if (!flushing) {
        queue.push(watcher);
    }
    else {
        // if already flushing, splice the watcher based on its id
        // if already past its id, it will be run next immediately.
        var i = queue.length - 1;
        while (i > index && queue[i].id > watcher.id) {
            i--;
        }
        queue.splice(i + 1, 0, watcher);
    }
    // queue the flush
    if (!waiting) {
        waiting = true;
        if ( true && !config.async) {
            flushSchedulerQueue();
            return;
        }
        nextTick(flushSchedulerQueue);
    }
}

function initProvide(vm) {
    var provideOption = vm.$options.provide;
    if (provideOption) {
        var provided = isFunction(provideOption)
            ? provideOption.call(vm)
            : provideOption;
        if (!isObject(provided)) {
            return;
        }
        var source = resolveProvided(vm);
        // IE9 doesn't support Object.getOwnPropertyDescriptors so we have to
        // iterate the keys ourselves.
        var keys = hasSymbol ? Reflect.ownKeys(provided) : Object.keys(provided);
        for (var i = 0; i < keys.length; i++) {
            var key = keys[i];
            Object.defineProperty(source, key, Object.getOwnPropertyDescriptor(provided, key));
        }
    }
}
function initInjections(vm) {
    var result = resolveInject(vm.$options.inject, vm);
    if (result) {
        toggleObserving(false);
        Object.keys(result).forEach(function (key) {
            /* istanbul ignore else */
            if (true) {
                defineReactive(vm, key, result[key], function () {
                    warn("Avoid mutating an injected value directly since the changes will be " +
                        "overwritten whenever the provided component re-renders. " +
                        "injection being mutated: \"".concat(key, "\""), vm);
                });
            }
            else {}
        });
        toggleObserving(true);
    }
}
function resolveInject(inject, vm) {
    if (inject) {
        // inject is :any because flow is not smart enough to figure out cached
        var result = Object.create(null);
        var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);
        for (var i = 0; i < keys.length; i++) {
            var key = keys[i];
            // #6574 in case the inject object is observed...
            if (key === '__ob__')
                continue;
            var provideKey = inject[key].from;
            if (provideKey in vm._provided) {
                result[key] = vm._provided[provideKey];
            }
            else if ('default' in inject[key]) {
                var provideDefault = inject[key].default;
                result[key] = isFunction(provideDefault)
                    ? provideDefault.call(vm)
                    : provideDefault;
            }
            else if (true) {
                warn("Injection \"".concat(key, "\" not found"), vm);
            }
        }
        return result;
    }
}

function FunctionalRenderContext(data, props, children, parent, Ctor) {
    var _this = this;
    var options = Ctor.options;
    // ensure the createElement function in functional components
    // gets a unique context - this is necessary for correct named slot check
    var contextVm;
    if (hasOwn(parent, '_uid')) {
        contextVm = Object.create(parent);
        contextVm._original = parent;
    }
    else {
        // the context vm passed in is a functional context as well.
        // in this case we want to make sure we are able to get a hold to the
        // real context instance.
        contextVm = parent;
        // @ts-ignore
        parent = parent._original;
    }
    var isCompiled = isTrue(options._compiled);
    var needNormalization = !isCompiled;
    this.data = data;
    this.props = props;
    this.children = children;
    this.parent = parent;
    this.listeners = data.on || emptyObject;
    this.injections = resolveInject(options.inject, parent);
    this.slots = function () {
        if (!_this.$slots) {
            normalizeScopedSlots(parent, data.scopedSlots, (_this.$slots = resolveSlots(children, parent)));
        }
        return _this.$slots;
    };
    Object.defineProperty(this, 'scopedSlots', {
        enumerable: true,
        get: function () {
            return normalizeScopedSlots(parent, data.scopedSlots, this.slots());
        }
    });
    // support for compiled functional template
    if (isCompiled) {
        // exposing $options for renderStatic()
        this.$options = options;
        // pre-resolve slots for renderSlot()
        this.$slots = this.slots();
        this.$scopedSlots = normalizeScopedSlots(parent, data.scopedSlots, this.$slots);
    }
    if (options._scopeId) {
        this._c = function (a, b, c, d) {
            var vnode = createElement$1(contextVm, a, b, c, d, needNormalization);
            if (vnode && !isArray(vnode)) {
                vnode.fnScopeId = options._scopeId;
                vnode.fnContext = parent;
            }
            return vnode;
        };
    }
    else {
        this._c = function (a, b, c, d) {
            return createElement$1(contextVm, a, b, c, d, needNormalization);
        };
    }
}
installRenderHelpers(FunctionalRenderContext.prototype);
function createFunctionalComponent(Ctor, propsData, data, contextVm, children) {
    var options = Ctor.options;
    var props = {};
    var propOptions = options.props;
    if (isDef(propOptions)) {
        for (var key in propOptions) {
            props[key] = validateProp(key, propOptions, propsData || emptyObject);
        }
    }
    else {
        if (isDef(data.attrs))
            mergeProps(props, data.attrs);
        if (isDef(data.props))
            mergeProps(props, data.props);
    }
    var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);
    var vnode = options.render.call(null, renderContext._c, renderContext);
    if (vnode instanceof VNode) {
        return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);
    }
    else if (isArray(vnode)) {
        var vnodes = normalizeChildren(vnode) || [];
        var res = new Array(vnodes.length);
        for (var i = 0; i < vnodes.length; i++) {
            res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
        }
        return res;
    }
}
function cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {
    // #7817 clone node before setting fnContext, otherwise if the node is reused
    // (e.g. it was from a cached normal slot) the fnContext causes named slots
    // that should not be matched to match.
    var clone = cloneVNode(vnode);
    clone.fnContext = contextVm;
    clone.fnOptions = options;
    if (true) {
        (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext =
            renderContext;
    }
    if (data.slot) {
        (clone.data || (clone.data = {})).slot = data.slot;
    }
    return clone;
}
function mergeProps(to, from) {
    for (var key in from) {
        to[camelize(key)] = from[key];
    }
}

function getComponentName(options) {
    return options.name || options.__name || options._componentTag;
}
// inline hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
    init: function (vnode, hydrating) {
        if (vnode.componentInstance &&
            !vnode.componentInstance._isDestroyed &&
            vnode.data.keepAlive) {
            // kept-alive components, treat as a patch
            var mountedNode = vnode; // work around flow
            componentVNodeHooks.prepatch(mountedNode, mountedNode);
        }
        else {
            var child = (vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance));
            child.$mount(hydrating ? vnode.elm : undefined, hydrating);
        }
    },
    prepatch: function (oldVnode, vnode) {
        var options = vnode.componentOptions;
        var child = (vnode.componentInstance = oldVnode.componentInstance);
        updateChildComponent(child, options.propsData, // updated props
        options.listeners, // updated listeners
        vnode, // new parent vnode
        options.children // new children
        );
    },
    insert: function (vnode) {
        var context = vnode.context, componentInstance = vnode.componentInstance;
        if (!componentInstance._isMounted) {
            componentInstance._isMounted = true;
            callHook$1(componentInstance, 'mounted');
        }
        if (vnode.data.keepAlive) {
            if (context._isMounted) {
                // vue-router#1212
                // During updates, a kept-alive component's child components may
                // change, so directly walking the tree here may call activated hooks
                // on incorrect children. Instead we push them into a queue which will
                // be processed after the whole patch process ended.
                queueActivatedComponent(componentInstance);
            }
            else {
                activateChildComponent(componentInstance, true /* direct */);
            }
        }
    },
    destroy: function (vnode) {
        var componentInstance = vnode.componentInstance;
        if (!componentInstance._isDestroyed) {
            if (!vnode.data.keepAlive) {
                componentInstance.$destroy();
            }
            else {
                deactivateChildComponent(componentInstance, true /* direct */);
            }
        }
    }
};
var hooksToMerge = Object.keys(componentVNodeHooks);
function createComponent(Ctor, data, context, children, tag) {
    if (isUndef(Ctor)) {
        return;
    }
    var baseCtor = context.$options._base;
    // plain options object: turn it into a constructor
    if (isObject(Ctor)) {
        Ctor = baseCtor.extend(Ctor);
    }
    // if at this stage it's not a constructor or an async component factory,
    // reject.
    if (typeof Ctor !== 'function') {
        if (true) {
            warn("Invalid Component definition: ".concat(String(Ctor)), context);
        }
        return;
    }
    // async component
    var asyncFactory;
    // @ts-expect-error
    if (isUndef(Ctor.cid)) {
        asyncFactory = Ctor;
        Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
        if (Ctor === undefined) {
            // return a placeholder node for async component, which is rendered
            // as a comment node but preserves all the raw information for the node.
            // the information will be used for async server-rendering and hydration.
            return createAsyncPlaceholder(asyncFactory, data, context, children, tag);
        }
    }
    data = data || {};
    // resolve constructor options in case global mixins are applied after
    // component constructor creation
    resolveConstructorOptions(Ctor);
    // transform component v-model data into props & events
    if (isDef(data.model)) {
        // @ts-expect-error
        transformModel(Ctor.options, data);
    }
    // extract props
    // @ts-expect-error
    var propsData = extractPropsFromVNodeData(data, Ctor, tag);
    // functional component
    // @ts-expect-error
    if (isTrue(Ctor.options.functional)) {
        return createFunctionalComponent(Ctor, propsData, data, context, children);
    }
    // extract listeners, since these needs to be treated as
    // child component listeners instead of DOM listeners
    var listeners = data.on;
    // replace with listeners with .native modifier
    // so it gets processed during parent component patch.
    data.on = data.nativeOn;
    // @ts-expect-error
    if (isTrue(Ctor.options.abstract)) {
        // abstract components do not keep anything
        // other than props & listeners & slot
        // work around flow
        var slot = data.slot;
        data = {};
        if (slot) {
            data.slot = slot;
        }
    }
    // install component management hooks onto the placeholder node
    installComponentHooks(data);
    // return a placeholder vnode
    // @ts-expect-error
    var name = getComponentName(Ctor.options) || tag;
    var vnode = new VNode(
    // @ts-expect-error
    "vue-component-".concat(Ctor.cid).concat(name ? "-".concat(name) : ''), data, undefined, undefined, undefined, context, 
    // @ts-expect-error
    { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }, asyncFactory);
    return vnode;
}
function createComponentInstanceForVnode(
// we know it's MountedComponentVNode but flow doesn't
vnode, 
// activeInstance in lifecycle state
parent) {
    var options = {
        _isComponent: true,
        _parentVnode: vnode,
        parent: parent
    };
    // check inline-template render functions
    var inlineTemplate = vnode.data.inlineTemplate;
    if (isDef(inlineTemplate)) {
        options.render = inlineTemplate.render;
        options.staticRenderFns = inlineTemplate.staticRenderFns;
    }
    return new vnode.componentOptions.Ctor(options);
}
function installComponentHooks(data) {
    var hooks = data.hook || (data.hook = {});
    for (var i = 0; i < hooksToMerge.length; i++) {
        var key = hooksToMerge[i];
        var existing = hooks[key];
        var toMerge = componentVNodeHooks[key];
        // @ts-expect-error
        if (existing !== toMerge && !(existing && existing._merged)) {
            hooks[key] = existing ? mergeHook(toMerge, existing) : toMerge;
        }
    }
}
function mergeHook(f1, f2) {
    var merged = function (a, b) {
        // flow complains about extra args which is why we use any
        f1(a, b);
        f2(a, b);
    };
    merged._merged = true;
    return merged;
}
// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel(options, data) {
    var prop = (options.model && options.model.prop) || 'value';
    var event = (options.model && options.model.event) || 'input';
    (data.attrs || (data.attrs = {}))[prop] = data.model.value;
    var on = data.on || (data.on = {});
    var existing = on[event];
    var callback = data.model.callback;
    if (isDef(existing)) {
        if (isArray(existing)
            ? existing.indexOf(callback) === -1
            : existing !== callback) {
            on[event] = [callback].concat(existing);
        }
    }
    else {
        on[event] = callback;
    }
}

var warn = noop;
var tip = noop;
var generateComponentTrace; // work around flow check
var formatComponentName;
if (true) {
    var hasConsole_1 = typeof console !== 'undefined';
    var classifyRE_1 = /(?:^|[-_])(\w)/g;
    var classify_1 = function (str) {
        return str.replace(classifyRE_1, function (c) { return c.toUpperCase(); }).replace(/[-_]/g, '');
    };
    warn = function (msg, vm) {
        if (vm === void 0) { vm = currentInstance; }
        var trace = vm ? generateComponentTrace(vm) : '';
        if (config.warnHandler) {
            config.warnHandler.call(null, msg, vm, trace);
        }
        else if (hasConsole_1 && !config.silent) {
            console.error("[Vue warn]: ".concat(msg).concat(trace));
        }
    };
    tip = function (msg, vm) {
        if (hasConsole_1 && !config.silent) {
            console.warn("[Vue tip]: ".concat(msg) + (vm ? generateComponentTrace(vm) : ''));
        }
    };
    formatComponentName = function (vm, includeFile) {
        if (vm.$root === vm) {
            return '<Root>';
        }
        var options = isFunction(vm) && vm.cid != null
            ? vm.options
            : vm._isVue
                ? vm.$options || vm.constructor.options
                : vm;
        var name = getComponentName(options);
        var file = options.__file;
        if (!name && file) {
            var match = file.match(/([^/\\]+)\.vue$/);
            name = match && match[1];
        }
        return ((name ? "<".concat(classify_1(name), ">") : "<Anonymous>") +
            (file && includeFile !== false ? " at ".concat(file) : ''));
    };
    var repeat_1 = function (str, n) {
        var res = '';
        while (n) {
            if (n % 2 === 1)
                res += str;
            if (n > 1)
                str += str;
            n >>= 1;
        }
        return res;
    };
    generateComponentTrace = function (vm) {
        if (vm._isVue && vm.$parent) {
            var tree = [];
            var currentRecursiveSequence = 0;
            while (vm) {
                if (tree.length > 0) {
                    var last = tree[tree.length - 1];
                    if (last.constructor === vm.constructor) {
                        currentRecursiveSequence++;
                        vm = vm.$parent;
                        continue;
                    }
                    else if (currentRecursiveSequence > 0) {
                        tree[tree.length - 1] = [last, currentRecursiveSequence];
                        currentRecursiveSequence = 0;
                    }
                }
                tree.push(vm);
                vm = vm.$parent;
            }
            return ('\n\nfound in\n\n' +
                tree
                    .map(function (vm, i) {
                    return "".concat(i === 0 ? '---> ' : repeat_1(' ', 5 + i * 2)).concat(isArray(vm)
                        ? "".concat(formatComponentName(vm[0]), "... (").concat(vm[1], " recursive calls)")
                        : formatComponentName(vm));
                })
                    .join('\n'));
        }
        else {
            return "\n\n(found in ".concat(formatComponentName(vm), ")");
        }
    };
}

/**
 * Option overwriting strategies are functions that handle
 * how to merge a parent option value and a child option
 * value into the final value.
 */
var strats = config.optionMergeStrategies;
/**
 * Options with restrictions
 */
if (true) {
    strats.el = strats.propsData = function (parent, child, vm, key) {
        if (!vm) {
            warn("option \"".concat(key, "\" can only be used during instance ") +
                'creation with the `new` keyword.');
        }
        return defaultStrat(parent, child);
    };
}
/**
 * Helper that recursively merges two data objects together.
 */
function mergeData(to, from, recursive) {
    if (recursive === void 0) { recursive = true; }
    if (!from)
        return to;
    var key, toVal, fromVal;
    var keys = hasSymbol
        ? Reflect.ownKeys(from)
        : Object.keys(from);
    for (var i = 0; i < keys.length; i++) {
        key = keys[i];
        // in case the object is already observed...
        if (key === '__ob__')
            continue;
        toVal = to[key];
        fromVal = from[key];
        if (!recursive || !hasOwn(to, key)) {
            set(to, key, fromVal);
        }
        else if (toVal !== fromVal &&
            isPlainObject(toVal) &&
            isPlainObject(fromVal)) {
            mergeData(toVal, fromVal);
        }
    }
    return to;
}
/**
 * Data
 */
function mergeDataOrFn(parentVal, childVal, vm) {
    if (!vm) {
        // in a Vue.extend merge, both should be functions
        if (!childVal) {
            return parentVal;
        }
        if (!parentVal) {
            return childVal;
        }
        // when parentVal & childVal are both present,
        // we need to return a function that returns the
        // merged result of both functions... no need to
        // check if parentVal is a function here because
        // it has to be a function to pass previous merges.
        return function mergedDataFn() {
            return mergeData(isFunction(childVal) ? childVal.call(this, this) : childVal, isFunction(parentVal) ? parentVal.call(this, this) : parentVal);
        };
    }
    else {
        return function mergedInstanceDataFn() {
            // instance merge
            var instanceData = isFunction(childVal)
                ? childVal.call(vm, vm)
                : childVal;
            var defaultData = isFunction(parentVal)
                ? parentVal.call(vm, vm)
                : parentVal;
            if (instanceData) {
                return mergeData(instanceData, defaultData);
            }
            else {
                return defaultData;
            }
        };
    }
}
strats.data = function (parentVal, childVal, vm) {
    if (!vm) {
        if (childVal && typeof childVal !== 'function') {
             true &&
                warn('The "data" option should be a function ' +
                    'that returns a per-instance value in component ' +
                    'definitions.', vm);
            return parentVal;
        }
        return mergeDataOrFn(parentVal, childVal);
    }
    return mergeDataOrFn(parentVal, childVal, vm);
};
/**
 * Hooks and props are merged as arrays.
 */
function mergeLifecycleHook(parentVal, childVal) {
    var res = childVal
        ? parentVal
            ? parentVal.concat(childVal)
            : isArray(childVal)
                ? childVal
                : [childVal]
        : parentVal;
    return res ? dedupeHooks(res) : res;
}
function dedupeHooks(hooks) {
    var res = [];
    for (var i = 0; i < hooks.length; i++) {
        if (res.indexOf(hooks[i]) === -1) {
            res.push(hooks[i]);
        }
    }
    return res;
}
LIFECYCLE_HOOKS.forEach(function (hook) {
    strats[hook] = mergeLifecycleHook;
});
/**
 * Assets
 *
 * When a vm is present (instance creation), we need to do
 * a three-way merge between constructor options, instance
 * options and parent options.
 */
function mergeAssets(parentVal, childVal, vm, key) {
    var res = Object.create(parentVal || null);
    if (childVal) {
         true && assertObjectType(key, childVal, vm);
        return extend(res, childVal);
    }
    else {
        return res;
    }
}
ASSET_TYPES.forEach(function (type) {
    strats[type + 's'] = mergeAssets;
});
/**
 * Watchers.
 *
 * Watchers hashes should not overwrite one
 * another, so we merge them as arrays.
 */
strats.watch = function (parentVal, childVal, vm, key) {
    // work around Firefox's Object.prototype.watch...
    //@ts-expect-error work around
    if (parentVal === nativeWatch)
        parentVal = undefined;
    //@ts-expect-error work around
    if (childVal === nativeWatch)
        childVal = undefined;
    /* istanbul ignore if */
    if (!childVal)
        return Object.create(parentVal || null);
    if (true) {
        assertObjectType(key, childVal, vm);
    }
    if (!parentVal)
        return childVal;
    var ret = {};
    extend(ret, parentVal);
    for (var key_1 in childVal) {
        var parent_1 = ret[key_1];
        var child = childVal[key_1];
        if (parent_1 && !isArray(parent_1)) {
            parent_1 = [parent_1];
        }
        ret[key_1] = parent_1 ? parent_1.concat(child) : isArray(child) ? child : [child];
    }
    return ret;
};
/**
 * Other object hashes.
 */
strats.props =
    strats.methods =
        strats.inject =
            strats.computed =
                function (parentVal, childVal, vm, key) {
                    if (childVal && "development" !== 'production') {
                        assertObjectType(key, childVal, vm);
                    }
                    if (!parentVal)
                        return childVal;
                    var ret = Object.create(null);
                    extend(ret, parentVal);
                    if (childVal)
                        extend(ret, childVal);
                    return ret;
                };
strats.provide = function (parentVal, childVal) {
    if (!parentVal)
        return childVal;
    return function () {
        var ret = Object.create(null);
        mergeData(ret, isFunction(parentVal) ? parentVal.call(this) : parentVal);
        if (childVal) {
            mergeData(ret, isFunction(childVal) ? childVal.call(this) : childVal, false // non-recursive
            );
        }
        return ret;
    };
};
/**
 * Default strategy.
 */
var defaultStrat = function (parentVal, childVal) {
    return childVal === undefined ? parentVal : childVal;
};
/**
 * Validate component names
 */
function checkComponents(options) {
    for (var key in options.components) {
        validateComponentName(key);
    }
}
function validateComponentName(name) {
    if (!new RegExp("^[a-zA-Z][\\-\\.0-9_".concat(unicodeRegExp.source, "]*$")).test(name)) {
        warn('Invalid component name: "' +
            name +
            '". Component names ' +
            'should conform to valid custom element name in html5 specification.');
    }
    if (isBuiltInTag(name) || config.isReservedTag(name)) {
        warn('Do not use built-in or reserved HTML elements as component ' +
            'id: ' +
            name);
    }
}
/**
 * Ensure all props option syntax are normalized into the
 * Object-based format.
 */
function normalizeProps(options, vm) {
    var props = options.props;
    if (!props)
        return;
    var res = {};
    var i, val, name;
    if (isArray(props)) {
        i = props.length;
        while (i--) {
            val = props[i];
            if (typeof val === 'string') {
                name = camelize(val);
                res[name] = { type: null };
            }
            else if (true) {
                warn('props must be strings when using array syntax.');
            }
        }
    }
    else if (isPlainObject(props)) {
        for (var key in props) {
            val = props[key];
            name = camelize(key);
            res[name] = isPlainObject(val) ? val : { type: val };
        }
    }
    else if (true) {
        warn("Invalid value for option \"props\": expected an Array or an Object, " +
            "but got ".concat(toRawType(props), "."), vm);
    }
    options.props = res;
}
/**
 * Normalize all injections into Object-based format
 */
function normalizeInject(options, vm) {
    var inject = options.inject;
    if (!inject)
        return;
    var normalized = (options.inject = {});
    if (isArray(inject)) {
        for (var i = 0; i < inject.length; i++) {
            normalized[inject[i]] = { from: inject[i] };
        }
    }
    else if (isPlainObject(inject)) {
        for (var key in inject) {
            var val = inject[key];
            normalized[key] = isPlainObject(val)
                ? extend({ from: key }, val)
                : { from: val };
        }
    }
    else if (true) {
        warn("Invalid value for option \"inject\": expected an Array or an Object, " +
            "but got ".concat(toRawType(inject), "."), vm);
    }
}
/**
 * Normalize raw function directives into object format.
 */
function normalizeDirectives$1(options) {
    var dirs = options.directives;
    if (dirs) {
        for (var key in dirs) {
            var def = dirs[key];
            if (isFunction(def)) {
                dirs[key] = { bind: def, update: def };
            }
        }
    }
}
function assertObjectType(name, value, vm) {
    if (!isPlainObject(value)) {
        warn("Invalid value for option \"".concat(name, "\": expected an Object, ") +
            "but got ".concat(toRawType(value), "."), vm);
    }
}
/**
 * Merge two option objects into a new one.
 * Core utility used in both instantiation and inheritance.
 */
function mergeOptions(parent, child, vm) {
    if (true) {
        checkComponents(child);
    }
    if (isFunction(child)) {
        // @ts-expect-error
        child = child.options;
    }
    normalizeProps(child, vm);
    normalizeInject(child, vm);
    normalizeDirectives$1(child);
    // Apply extends and mixins on the child options,
    // but only if it is a raw options object that isn't
    // the result of another mergeOptions call.
    // Only merged options has the _base property.
    if (!child._base) {
        if (child.extends) {
            parent = mergeOptions(parent, child.extends, vm);
        }
        if (child.mixins) {
            for (var i = 0, l = child.mixins.length; i < l; i++) {
                parent = mergeOptions(parent, child.mixins[i], vm);
            }
        }
    }
    var options = {};
    var key;
    for (key in parent) {
        mergeField(key);
    }
    for (key in child) {
        if (!hasOwn(parent, key)) {
            mergeField(key);
        }
    }
    function mergeField(key) {
        var strat = strats[key] || defaultStrat;
        options[key] = strat(parent[key], child[key], vm, key);
    }
    return options;
}
/**
 * Resolve an asset.
 * This function is used because child instances need access
 * to assets defined in its ancestor chain.
 */
function resolveAsset(options, type, id, warnMissing) {
    /* istanbul ignore if */
    if (typeof id !== 'string') {
        return;
    }
    var assets = options[type];
    // check local registration variations first
    if (hasOwn(assets, id))
        return assets[id];
    var camelizedId = camelize(id);
    if (hasOwn(assets, camelizedId))
        return assets[camelizedId];
    var PascalCaseId = capitalize(camelizedId);
    if (hasOwn(assets, PascalCaseId))
        return assets[PascalCaseId];
    // fallback to prototype chain
    var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
    if ( true && warnMissing && !res) {
        warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id);
    }
    return res;
}

function validateProp(key, propOptions, propsData, vm) {
    var prop = propOptions[key];
    var absent = !hasOwn(propsData, key);
    var value = propsData[key];
    // boolean casting
    var booleanIndex = getTypeIndex(Boolean, prop.type);
    if (booleanIndex > -1) {
        if (absent && !hasOwn(prop, 'default')) {
            value = false;
        }
        else if (value === '' || value === hyphenate(key)) {
            // only cast empty string / same name to boolean if
            // boolean has higher priority
            var stringIndex = getTypeIndex(String, prop.type);
            if (stringIndex < 0 || booleanIndex < stringIndex) {
                value = true;
            }
        }
    }
    // check default value
    if (value === undefined) {
        value = getPropDefaultValue(vm, prop, key);
        // since the default value is a fresh copy,
        // make sure to observe it.
        var prevShouldObserve = shouldObserve;
        toggleObserving(true);
        observe(value);
        toggleObserving(prevShouldObserve);
    }
    if (true) {
        assertProp(prop, key, value, vm, absent);
    }
    return value;
}
/**
 * Get the default value of a prop.
 */
function getPropDefaultValue(vm, prop, key) {
    // no default, return undefined
    if (!hasOwn(prop, 'default')) {
        return undefined;
    }
    var def = prop.default;
    // warn against non-factory defaults for Object & Array
    if ( true && isObject(def)) {
        warn('Invalid default value for prop "' +
            key +
            '": ' +
            'Props with type Object/Array must use a factory function ' +
            'to return the default value.', vm);
    }
    // the raw prop value was also undefined from previous render,
    // return previous default value to avoid unnecessary watcher trigger
    if (vm &&
        vm.$options.propsData &&
        vm.$options.propsData[key] === undefined &&
        vm._props[key] !== undefined) {
        return vm._props[key];
    }
    // call factory function for non-Function types
    // a value is Function if its prototype is function even across different execution context
    return isFunction(def) && getType(prop.type) !== 'Function'
        ? def.call(vm)
        : def;
}
/**
 * Assert whether a prop is valid.
 */
function assertProp(prop, name, value, vm, absent) {
    if (prop.required && absent) {
        warn('Missing required prop: "' + name + '"', vm);
        return;
    }
    if (value == null && !prop.required) {
        return;
    }
    var type = prop.type;
    var valid = !type || type === true;
    var expectedTypes = [];
    if (type) {
        if (!isArray(type)) {
            type = [type];
        }
        for (var i = 0; i < type.length && !valid; i++) {
            var assertedType = assertType(value, type[i], vm);
            expectedTypes.push(assertedType.expectedType || '');
            valid = assertedType.valid;
        }
    }
    var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
    if (!valid && haveExpectedTypes) {
        warn(getInvalidTypeMessage(name, value, expectedTypes), vm);
        return;
    }
    var validator = prop.validator;
    if (validator) {
        if (!validator(value)) {
            warn('Invalid prop: custom validator check failed for prop "' + name + '".', vm);
        }
    }
}
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
function assertType(value, type, vm) {
    var valid;
    var expectedType = getType(type);
    if (simpleCheckRE.test(expectedType)) {
        var t = typeof value;
        valid = t === expectedType.toLowerCase();
        // for primitive wrapper objects
        if (!valid && t === 'object') {
            valid = value instanceof type;
        }
    }
    else if (expectedType === 'Object') {
        valid = isPlainObject(value);
    }
    else if (expectedType === 'Array') {
        valid = isArray(value);
    }
    else {
        try {
            valid = value instanceof type;
        }
        catch (e) {
            warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
            valid = false;
        }
    }
    return {
        valid: valid,
        expectedType: expectedType
    };
}
var functionTypeCheckRE = /^\s*function (\w+)/;
/**
 * Use function string name to check built-in types,
 * because a simple equality check will fail when running
 * across different vms / iframes.
 */
function getType(fn) {
    var match = fn && fn.toString().match(functionTypeCheckRE);
    return match ? match[1] : '';
}
function isSameType(a, b) {
    return getType(a) === getType(b);
}
function getTypeIndex(type, expectedTypes) {
    if (!isArray(expectedTypes)) {
        return isSameType(expectedTypes, type) ? 0 : -1;
    }
    for (var i = 0, len = expectedTypes.length; i < len; i++) {
        if (isSameType(expectedTypes[i], type)) {
            return i;
        }
    }
    return -1;
}
function getInvalidTypeMessage(name, value, expectedTypes) {
    var message = "Invalid prop: type check failed for prop \"".concat(name, "\".") +
        " Expected ".concat(expectedTypes.map(capitalize).join(', '));
    var expectedType = expectedTypes[0];
    var receivedType = toRawType(value);
    // check if we need to specify expected value
    if (expectedTypes.length === 1 &&
        isExplicable(expectedType) &&
        isExplicable(typeof value) &&
        !isBoolean(expectedType, receivedType)) {
        message += " with value ".concat(styleValue(value, expectedType));
    }
    message += ", got ".concat(receivedType, " ");
    // check if we need to specify received value
    if (isExplicable(receivedType)) {
        message += "with value ".concat(styleValue(value, receivedType), ".");
    }
    return message;
}
function styleValue(value, type) {
    if (type === 'String') {
        return "\"".concat(value, "\"");
    }
    else if (type === 'Number') {
        return "".concat(Number(value));
    }
    else {
        return "".concat(value);
    }
}
var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
function isExplicable(value) {
    return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; });
}
function isBoolean() {
    var args = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        args[_i] = arguments[_i];
    }
    return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; });
}

/* not type checking this file because flow doesn't play well with Proxy */
var initProxy;
if (true) {
    var allowedGlobals_1 = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' +
        'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
        'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
        'require' // for Webpack/Browserify
    );
    var warnNonPresent_1 = function (target, key) {
        warn("Property or method \"".concat(key, "\" is not defined on the instance but ") +
            'referenced during render. Make sure that this property is reactive, ' +
            'either in the data option, or for class-based components, by ' +
            'initializing the property. ' +
            'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);
    };
    var warnReservedPrefix_1 = function (target, key) {
        warn("Property \"".concat(key, "\" must be accessed with \"$data.").concat(key, "\" because ") +
            'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
            'prevent conflicts with Vue internals. ' +
            'See: https://v2.vuejs.org/v2/api/#data', target);
    };
    var hasProxy_1 = typeof Proxy !== 'undefined' && isNative(Proxy);
    if (hasProxy_1) {
        var isBuiltInModifier_1 = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
        config.keyCodes = new Proxy(config.keyCodes, {
            set: function (target, key, value) {
                if (isBuiltInModifier_1(key)) {
                    warn("Avoid overwriting built-in modifier in config.keyCodes: .".concat(key));
                    return false;
                }
                else {
                    target[key] = value;
                    return true;
                }
            }
        });
    }
    var hasHandler_1 = {
        has: function (target, key) {
            var has = key in target;
            var isAllowed = allowedGlobals_1(key) ||
                (typeof key === 'string' &&
                    key.charAt(0) === '_' &&
                    !(key in target.$data));
            if (!has && !isAllowed) {
                if (key in target.$data)
                    warnReservedPrefix_1(target, key);
                else
                    warnNonPresent_1(target, key);
            }
            return has || !isAllowed;
        }
    };
    var getHandler_1 = {
        get: function (target, key) {
            if (typeof key === 'string' && !(key in target)) {
                if (key in target.$data)
                    warnReservedPrefix_1(target, key);
                else
                    warnNonPresent_1(target, key);
            }
            return target[key];
        }
    };
    initProxy = function initProxy(vm) {
        if (hasProxy_1) {
            // determine which proxy handler to use
            var options = vm.$options;
            var handlers = options.render && options.render._withStripped ? getHandler_1 : hasHandler_1;
            vm._renderProxy = new Proxy(vm, handlers);
        }
        else {
            vm._renderProxy = vm;
        }
    };
}

var sharedPropertyDefinition = {
    enumerable: true,
    configurable: true,
    get: noop,
    set: noop
};
function proxy(target, sourceKey, key) {
    sharedPropertyDefinition.get = function proxyGetter() {
        return this[sourceKey][key];
    };
    sharedPropertyDefinition.set = function proxySetter(val) {
        this[sourceKey][key] = val;
    };
    Object.defineProperty(target, key, sharedPropertyDefinition);
}
function initState(vm) {
    var opts = vm.$options;
    if (opts.props)
        initProps$1(vm, opts.props);
    // Composition API
    initSetup(vm);
    if (opts.methods)
        initMethods(vm, opts.methods);
    if (opts.data) {
        initData(vm);
    }
    else {
        var ob = observe((vm._data = {}));
        ob && ob.vmCount++;
    }
    if (opts.computed)
        initComputed$1(vm, opts.computed);
    if (opts.watch && opts.watch !== nativeWatch) {
        initWatch(vm, opts.watch);
    }
}
function initProps$1(vm, propsOptions) {
    var propsData = vm.$options.propsData || {};
    var props = (vm._props = shallowReactive({}));
    // cache prop keys so that future props updates can iterate using Array
    // instead of dynamic object key enumeration.
    var keys = (vm.$options._propKeys = []);
    var isRoot = !vm.$parent;
    // root instance props should be converted
    if (!isRoot) {
        toggleObserving(false);
    }
    var _loop_1 = function (key) {
        keys.push(key);
        var value = validateProp(key, propsOptions, propsData, vm);
        /* istanbul ignore else */
        if (true) {
            var hyphenatedKey = hyphenate(key);
            if (isReservedAttribute(hyphenatedKey) ||
                config.isReservedAttr(hyphenatedKey)) {
                warn("\"".concat(hyphenatedKey, "\" is a reserved attribute and cannot be used as component prop."), vm);
            }
            defineReactive(props, key, value, function () {
                if (!isRoot && !isUpdatingChildComponent) {
                    warn("Avoid mutating a prop directly since the value will be " +
                        "overwritten whenever the parent component re-renders. " +
                        "Instead, use a data or computed property based on the prop's " +
                        "value. Prop being mutated: \"".concat(key, "\""), vm);
                }
            }, true /* shallow */);
        }
        else {}
        // static props are already proxied on the component's prototype
        // during Vue.extend(). We only need to proxy props defined at
        // instantiation here.
        if (!(key in vm)) {
            proxy(vm, "_props", key);
        }
    };
    for (var key in propsOptions) {
        _loop_1(key);
    }
    toggleObserving(true);
}
function initData(vm) {
    var data = vm.$options.data;
    data = vm._data = isFunction(data) ? getData(data, vm) : data || {};
    if (!isPlainObject(data)) {
        data = {};
         true &&
            warn('data functions should return an object:\n' +
                'https://v2.vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);
    }
    // proxy data on instance
    var keys = Object.keys(data);
    var props = vm.$options.props;
    var methods = vm.$options.methods;
    var i = keys.length;
    while (i--) {
        var key = keys[i];
        if (true) {
            if (methods && hasOwn(methods, key)) {
                warn("Method \"".concat(key, "\" has already been defined as a data property."), vm);
            }
        }
        if (props && hasOwn(props, key)) {
             true &&
                warn("The data property \"".concat(key, "\" is already declared as a prop. ") +
                    "Use prop default value instead.", vm);
        }
        else if (!isReserved(key)) {
            proxy(vm, "_data", key);
        }
    }
    // observe data
    var ob = observe(data);
    ob && ob.vmCount++;
}
function getData(data, vm) {
    // #7573 disable dep collection when invoking data getters
    pushTarget();
    try {
        return data.call(vm, vm);
    }
    catch (e) {
        handleError(e, vm, "data()");
        return {};
    }
    finally {
        popTarget();
    }
}
var computedWatcherOptions = { lazy: true };
function initComputed$1(vm, computed) {
    // $flow-disable-line
    var watchers = (vm._computedWatchers = Object.create(null));
    // computed properties are just getters during SSR
    var isSSR = isServerRendering();
    for (var key in computed) {
        var userDef = computed[key];
        var getter = isFunction(userDef) ? userDef : userDef.get;
        if ( true && getter == null) {
            warn("Getter is missing for computed property \"".concat(key, "\"."), vm);
        }
        if (!isSSR) {
            // create internal watcher for the computed property.
            watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
        }
        // component-defined computed properties are already defined on the
        // component prototype. We only need to define computed properties defined
        // at instantiation here.
        if (!(key in vm)) {
            defineComputed(vm, key, userDef);
        }
        else if (true) {
            if (key in vm.$data) {
                warn("The computed property \"".concat(key, "\" is already defined in data."), vm);
            }
            else if (vm.$options.props && key in vm.$options.props) {
                warn("The computed property \"".concat(key, "\" is already defined as a prop."), vm);
            }
            else if (vm.$options.methods && key in vm.$options.methods) {
                warn("The computed property \"".concat(key, "\" is already defined as a method."), vm);
            }
        }
    }
}
function defineComputed(target, key, userDef) {
    var shouldCache = !isServerRendering();
    if (isFunction(userDef)) {
        sharedPropertyDefinition.get = shouldCache
            ? createComputedGetter(key)
            : createGetterInvoker(userDef);
        sharedPropertyDefinition.set = noop;
    }
    else {
        sharedPropertyDefinition.get = userDef.get
            ? shouldCache && userDef.cache !== false
                ? createComputedGetter(key)
                : createGetterInvoker(userDef.get)
            : noop;
        sharedPropertyDefinition.set = userDef.set || noop;
    }
    if ( true && sharedPropertyDefinition.set === noop) {
        sharedPropertyDefinition.set = function () {
            warn("Computed property \"".concat(key, "\" was assigned to but it has no setter."), this);
        };
    }
    Object.defineProperty(target, key, sharedPropertyDefinition);
}
function createComputedGetter(key) {
    return function computedGetter() {
        var watcher = this._computedWatchers && this._computedWatchers[key];
        if (watcher) {
            if (watcher.dirty) {
                watcher.evaluate();
            }
            if (Dep.target) {
                if ( true && Dep.target.onTrack) {
                    Dep.target.onTrack({
                        effect: Dep.target,
                        target: this,
                        type: "get" /* TrackOpTypes.GET */,
                        key: key
                    });
                }
                watcher.depend();
            }
            return watcher.value;
        }
    };
}
function createGetterInvoker(fn) {
    return function computedGetter() {
        return fn.call(this, this);
    };
}
function initMethods(vm, methods) {
    var props = vm.$options.props;
    for (var key in methods) {
        if (true) {
            if (typeof methods[key] !== 'function') {
                warn("Method \"".concat(key, "\" has type \"").concat(typeof methods[key], "\" in the component definition. ") +
                    "Did you reference the function correctly?", vm);
            }
            if (props && hasOwn(props, key)) {
                warn("Method \"".concat(key, "\" has already been defined as a prop."), vm);
            }
            if (key in vm && isReserved(key)) {
                warn("Method \"".concat(key, "\" conflicts with an existing Vue instance method. ") +
                    "Avoid defining component methods that start with _ or $.");
            }
        }
        vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
    }
}
function initWatch(vm, watch) {
    for (var key in watch) {
        var handler = watch[key];
        if (isArray(handler)) {
            for (var i = 0; i < handler.length; i++) {
                createWatcher(vm, key, handler[i]);
            }
        }
        else {
            createWatcher(vm, key, handler);
        }
    }
}
function createWatcher(vm, expOrFn, handler, options) {
    if (isPlainObject(handler)) {
        options = handler;
        handler = handler.handler;
    }
    if (typeof handler === 'string') {
        handler = vm[handler];
    }
    return vm.$watch(expOrFn, handler, options);
}
function stateMixin(Vue) {
    // flow somehow has problems with directly declared definition object
    // when using Object.defineProperty, so we have to procedurally build up
    // the object here.
    var dataDef = {};
    dataDef.get = function () {
        return this._data;
    };
    var propsDef = {};
    propsDef.get = function () {
        return this._props;
    };
    if (true) {
        dataDef.set = function () {
            warn('Avoid replacing instance root $data. ' +
                'Use nested data properties instead.', this);
        };
        propsDef.set = function () {
            warn("$props is readonly.", this);
        };
    }
    Object.defineProperty(Vue.prototype, '$data', dataDef);
    Object.defineProperty(Vue.prototype, '$props', propsDef);
    Vue.prototype.$set = set;
    Vue.prototype.$delete = del;
    Vue.prototype.$watch = function (expOrFn, cb, options) {
        var vm = this;
        if (isPlainObject(cb)) {
            return createWatcher(vm, expOrFn, cb, options);
        }
        options = options || {};
        options.user = true;
        var watcher = new Watcher(vm, expOrFn, cb, options);
        if (options.immediate) {
            var info = "callback for immediate watcher \"".concat(watcher.expression, "\"");
            pushTarget();
            invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
            popTarget();
        }
        return function unwatchFn() {
            watcher.teardown();
        };
    };
}

var uid = 0;
function initMixin$1(Vue) {
    Vue.prototype._init = function (options) {
        var vm = this;
        // a uid
        vm._uid = uid++;
        var startTag, endTag;
        /* istanbul ignore if */
        if ( true && config.performance && mark) {
            startTag = "vue-perf-start:".concat(vm._uid);
            endTag = "vue-perf-end:".concat(vm._uid);
            mark(startTag);
        }
        // a flag to mark this as a Vue instance without having to do instanceof
        // check
        vm._isVue = true;
        // avoid instances from being observed
        vm.__v_skip = true;
        // effect scope
        vm._scope = new EffectScope(true /* detached */);
        // #13134 edge case where a child component is manually created during the
        // render of a parent component
        vm._scope.parent = undefined;
        vm._scope._vm = true;
        // merge options
        if (options && options._isComponent) {
            // optimize internal component instantiation
            // since dynamic options merging is pretty slow, and none of the
            // internal component options needs special treatment.
            initInternalComponent(vm, options);
        }
        else {
            vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);
        }
        /* istanbul ignore else */
        if (true) {
            initProxy(vm);
        }
        else {}
        // expose real self
        vm._self = vm;
        initLifecycle(vm);
        initEvents(vm);
        initRender(vm);
        callHook$1(vm, 'beforeCreate', undefined, false /* setContext */);
        initInjections(vm); // resolve injections before data/props
        initState(vm);
        initProvide(vm); // resolve provide after data/props
        callHook$1(vm, 'created');
        /* istanbul ignore if */
        if ( true && config.performance && mark) {
            vm._name = formatComponentName(vm, false);
            mark(endTag);
            measure("vue ".concat(vm._name, " init"), startTag, endTag);
        }
        if (vm.$options.el) {
            vm.$mount(vm.$options.el);
        }
    };
}
function initInternalComponent(vm, options) {
    var opts = (vm.$options = Object.create(vm.constructor.options));
    // doing this because it's faster than dynamic enumeration.
    var parentVnode = options._parentVnode;
    opts.parent = options.parent;
    opts._parentVnode = parentVnode;
    var vnodeComponentOptions = parentVnode.componentOptions;
    opts.propsData = vnodeComponentOptions.propsData;
    opts._parentListeners = vnodeComponentOptions.listeners;
    opts._renderChildren = vnodeComponentOptions.children;
    opts._componentTag = vnodeComponentOptions.tag;
    if (options.render) {
        opts.render = options.render;
        opts.staticRenderFns = options.staticRenderFns;
    }
}
function resolveConstructorOptions(Ctor) {
    var options = Ctor.options;
    if (Ctor.super) {
        var superOptions = resolveConstructorOptions(Ctor.super);
        var cachedSuperOptions = Ctor.superOptions;
        if (superOptions !== cachedSuperOptions) {
            // super option changed,
            // need to resolve new options.
            Ctor.superOptions = superOptions;
            // check if there are any late-modified/attached options (#4976)
            var modifiedOptions = resolveModifiedOptions(Ctor);
            // update base extend options
            if (modifiedOptions) {
                extend(Ctor.extendOptions, modifiedOptions);
            }
            options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
            if (options.name) {
                options.components[options.name] = Ctor;
            }
        }
    }
    return options;
}
function resolveModifiedOptions(Ctor) {
    var modified;
    var latest = Ctor.options;
    var sealed = Ctor.sealedOptions;
    for (var key in latest) {
        if (latest[key] !== sealed[key]) {
            if (!modified)
                modified = {};
            modified[key] = latest[key];
        }
    }
    return modified;
}

function Vue(options) {
    if ( true && !(this instanceof Vue)) {
        warn('Vue is a constructor and should be called with the `new` keyword');
    }
    this._init(options);
}
//@ts-expect-error Vue has function type
initMixin$1(Vue);
//@ts-expect-error Vue has function type
stateMixin(Vue);
//@ts-expect-error Vue has function type
eventsMixin(Vue);
//@ts-expect-error Vue has function type
lifecycleMixin(Vue);
//@ts-expect-error Vue has function type
renderMixin(Vue);

function initUse(Vue) {
    Vue.use = function (plugin) {
        var installedPlugins = this._installedPlugins || (this._installedPlugins = []);
        if (installedPlugins.indexOf(plugin) > -1) {
            return this;
        }
        // additional parameters
        var args = toArray(arguments, 1);
        args.unshift(this);
        if (isFunction(plugin.install)) {
            plugin.install.apply(plugin, args);
        }
        else if (isFunction(plugin)) {
            plugin.apply(null, args);
        }
        installedPlugins.push(plugin);
        return this;
    };
}

function initMixin(Vue) {
    Vue.mixin = function (mixin) {
        this.options = mergeOptions(this.options, mixin);
        return this;
    };
}

function initExtend(Vue) {
    /**
     * Each instance constructor, including Vue, has a unique
     * cid. This enables us to create wrapped "child
     * constructors" for prototypal inheritance and cache them.
     */
    Vue.cid = 0;
    var cid = 1;
    /**
     * Class inheritance
     */
    Vue.extend = function (extendOptions) {
        extendOptions = extendOptions || {};
        var Super = this;
        var SuperId = Super.cid;
        var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
        if (cachedCtors[SuperId]) {
            return cachedCtors[SuperId];
        }
        var name = getComponentName(extendOptions) || getComponentName(Super.options);
        if ( true && name) {
            validateComponentName(name);
        }
        var Sub = function VueComponent(options) {
            this._init(options);
        };
        Sub.prototype = Object.create(Super.prototype);
        Sub.prototype.constructor = Sub;
        Sub.cid = cid++;
        Sub.options = mergeOptions(Super.options, extendOptions);
        Sub['super'] = Super;
        // For props and computed properties, we define the proxy getters on
        // the Vue instances at extension time, on the extended prototype. This
        // avoids Object.defineProperty calls for each instance created.
        if (Sub.options.props) {
            initProps(Sub);
        }
        if (Sub.options.computed) {
            initComputed(Sub);
        }
        // allow further extension/mixin/plugin usage
        Sub.extend = Super.extend;
        Sub.mixin = Super.mixin;
        Sub.use = Super.use;
        // create asset registers, so extended classes
        // can have their private assets too.
        ASSET_TYPES.forEach(function (type) {
            Sub[type] = Super[type];
        });
        // enable recursive self-lookup
        if (name) {
            Sub.options.components[name] = Sub;
        }
        // keep a reference to the super options at extension time.
        // later at instantiation we can check if Super's options have
        // been updated.
        Sub.superOptions = Super.options;
        Sub.extendOptions = extendOptions;
        Sub.sealedOptions = extend({}, Sub.options);
        // cache constructor
        cachedCtors[SuperId] = Sub;
        return Sub;
    };
}
function initProps(Comp) {
    var props = Comp.options.props;
    for (var key in props) {
        proxy(Comp.prototype, "_props", key);
    }
}
function initComputed(Comp) {
    var computed = Comp.options.computed;
    for (var key in computed) {
        defineComputed(Comp.prototype, key, computed[key]);
    }
}

function initAssetRegisters(Vue) {
    /**
     * Create asset registration methods.
     */
    ASSET_TYPES.forEach(function (type) {
        // @ts-expect-error function is not exact same type
        Vue[type] = function (id, definition) {
            if (!definition) {
                return this.options[type + 's'][id];
            }
            else {
                /* istanbul ignore if */
                if ( true && type === 'component') {
                    validateComponentName(id);
                }
                if (type === 'component' && isPlainObject(definition)) {
                    // @ts-expect-error
                    definition.name = definition.name || id;
                    definition = this.options._base.extend(definition);
                }
                if (type === 'directive' && isFunction(definition)) {
                    definition = { bind: definition, update: definition };
                }
                this.options[type + 's'][id] = definition;
                return definition;
            }
        };
    });
}

function _getComponentName(opts) {
    return opts && (getComponentName(opts.Ctor.options) || opts.tag);
}
function matches(pattern, name) {
    if (isArray(pattern)) {
        return pattern.indexOf(name) > -1;
    }
    else if (typeof pattern === 'string') {
        return pattern.split(',').indexOf(name) > -1;
    }
    else if (isRegExp(pattern)) {
        return pattern.test(name);
    }
    /* istanbul ignore next */
    return false;
}
function pruneCache(keepAliveInstance, filter) {
    var cache = keepAliveInstance.cache, keys = keepAliveInstance.keys, _vnode = keepAliveInstance._vnode, $vnode = keepAliveInstance.$vnode;
    for (var key in cache) {
        var entry = cache[key];
        if (entry) {
            var name_1 = entry.name;
            if (name_1 && !filter(name_1)) {
                pruneCacheEntry(cache, key, keys, _vnode);
            }
        }
    }
    $vnode.componentOptions.children = undefined;
}
function pruneCacheEntry(cache, key, keys, current) {
    var entry = cache[key];
    if (entry && (!current || entry.tag !== current.tag)) {
        // @ts-expect-error can be undefined
        entry.componentInstance.$destroy();
    }
    cache[key] = null;
    remove$2(keys, key);
}
var patternTypes = [String, RegExp, Array];
// TODO defineComponent
var KeepAlive = {
    name: 'keep-alive',
    abstract: true,
    props: {
        include: patternTypes,
        exclude: patternTypes,
        max: [String, Number]
    },
    methods: {
        cacheVNode: function () {
            var _a = this, cache = _a.cache, keys = _a.keys, vnodeToCache = _a.vnodeToCache, keyToCache = _a.keyToCache;
            if (vnodeToCache) {
                var tag = vnodeToCache.tag, componentInstance = vnodeToCache.componentInstance, componentOptions = vnodeToCache.componentOptions;
                cache[keyToCache] = {
                    name: _getComponentName(componentOptions),
                    tag: tag,
                    componentInstance: componentInstance
                };
                keys.push(keyToCache);
                // prune oldest entry
                if (this.max && keys.length > parseInt(this.max)) {
                    pruneCacheEntry(cache, keys[0], keys, this._vnode);
                }
                this.vnodeToCache = null;
            }
        }
    },
    created: function () {
        this.cache = Object.create(null);
        this.keys = [];
    },
    destroyed: function () {
        for (var key in this.cache) {
            pruneCacheEntry(this.cache, key, this.keys);
        }
    },
    mounted: function () {
        var _this = this;
        this.cacheVNode();
        this.$watch('include', function (val) {
            pruneCache(_this, function (name) { return matches(val, name); });
        });
        this.$watch('exclude', function (val) {
            pruneCache(_this, function (name) { return !matches(val, name); });
        });
    },
    updated: function () {
        this.cacheVNode();
    },
    render: function () {
        var slot = this.$slots.default;
        var vnode = getFirstComponentChild(slot);
        var componentOptions = vnode && vnode.componentOptions;
        if (componentOptions) {
            // check pattern
            var name_2 = _getComponentName(componentOptions);
            var _a = this, include = _a.include, exclude = _a.exclude;
            if (
            // not included
            (include && (!name_2 || !matches(include, name_2))) ||
                // excluded
                (exclude && name_2 && matches(exclude, name_2))) {
                return vnode;
            }
            var _b = this, cache = _b.cache, keys = _b.keys;
            var key = vnode.key == null
                ? // same constructor may get registered as different local components
                    // so cid alone is not enough (#3269)
                    componentOptions.Ctor.cid +
                        (componentOptions.tag ? "::".concat(componentOptions.tag) : '')
                : vnode.key;
            if (cache[key]) {
                vnode.componentInstance = cache[key].componentInstance;
                // make current key freshest
                remove$2(keys, key);
                keys.push(key);
            }
            else {
                // delay setting the cache until update
                this.vnodeToCache = vnode;
                this.keyToCache = key;
            }
            // @ts-expect-error can vnode.data can be undefined
            vnode.data.keepAlive = true;
        }
        return vnode || (slot && slot[0]);
    }
};

var builtInComponents = {
    KeepAlive: KeepAlive
};

function initGlobalAPI(Vue) {
    // config
    var configDef = {};
    configDef.get = function () { return config; };
    if (true) {
        configDef.set = function () {
            warn('Do not replace the Vue.config object, set individual fields instead.');
        };
    }
    Object.defineProperty(Vue, 'config', configDef);
    // exposed util methods.
    // NOTE: these are not considered part of the public API - avoid relying on
    // them unless you are aware of the risk.
    Vue.util = {
        warn: warn,
        extend: extend,
        mergeOptions: mergeOptions,
        defineReactive: defineReactive
    };
    Vue.set = set;
    Vue.delete = del;
    Vue.nextTick = nextTick;
    // 2.6 explicit observable API
    Vue.observable = function (obj) {
        observe(obj);
        return obj;
    };
    Vue.options = Object.create(null);
    ASSET_TYPES.forEach(function (type) {
        Vue.options[type + 's'] = Object.create(null);
    });
    // this is used to identify the "base" constructor to extend all plain-object
    // components with in Weex's multi-instance scenarios.
    Vue.options._base = Vue;
    extend(Vue.options.components, builtInComponents);
    initUse(Vue);
    initMixin(Vue);
    initExtend(Vue);
    initAssetRegisters(Vue);
}

initGlobalAPI(Vue);
Object.defineProperty(Vue.prototype, '$isServer', {
    get: isServerRendering
});
Object.defineProperty(Vue.prototype, '$ssrContext', {
    get: function () {
        /* istanbul ignore next */
        return this.$vnode && this.$vnode.ssrContext;
    }
});
// expose FunctionalRenderContext for ssr runtime helper installation
Object.defineProperty(Vue, 'FunctionalRenderContext', {
    value: FunctionalRenderContext
});
Vue.version = version;

// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select,progress');
var mustUseProp = function (tag, type, attr) {
    return ((attr === 'value' && acceptValue(tag) && type !== 'button') ||
        (attr === 'selected' && tag === 'option') ||
        (attr === 'checked' && tag === 'input') ||
        (attr === 'muted' && tag === 'video'));
};
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
var convertEnumeratedValue = function (key, value) {
    return isFalsyAttrValue(value) || value === 'false'
        ? 'false'
        : // allow arbitrary string value for contenteditable
            key === 'contenteditable' && isValidContentEditableValue(value)
                ? value
                : 'true';
};
var isBooleanAttr = makeMap('allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
    'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
    'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
    'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
    'required,reversed,scoped,seamless,selected,sortable,' +
    'truespeed,typemustmatch,visible');
var xlinkNS = 'http://www.w3.org/1999/xlink';
var isXlink = function (name) {
    return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';
};
var getXlinkProp = function (name) {
    return isXlink(name) ? name.slice(6, name.length) : '';
};
var isFalsyAttrValue = function (val) {
    return val == null || val === false;
};

function genClassForVnode(vnode) {
    var data = vnode.data;
    var parentNode = vnode;
    var childNode = vnode;
    while (isDef(childNode.componentInstance)) {
        childNode = childNode.componentInstance._vnode;
        if (childNode && childNode.data) {
            data = mergeClassData(childNode.data, data);
        }
    }
    // @ts-expect-error parentNode.parent not VNodeWithData
    while (isDef((parentNode = parentNode.parent))) {
        if (parentNode && parentNode.data) {
            data = mergeClassData(data, parentNode.data);
        }
    }
    return renderClass(data.staticClass, data.class);
}
function mergeClassData(child, parent) {
    return {
        staticClass: concat(child.staticClass, parent.staticClass),
        class: isDef(child.class) ? [child.class, parent.class] : parent.class
    };
}
function renderClass(staticClass, dynamicClass) {
    if (isDef(staticClass) || isDef(dynamicClass)) {
        return concat(staticClass, stringifyClass(dynamicClass));
    }
    /* istanbul ignore next */
    return '';
}
function concat(a, b) {
    return a ? (b ? a + ' ' + b : a) : b || '';
}
function stringifyClass(value) {
    if (Array.isArray(value)) {
        return stringifyArray(value);
    }
    if (isObject(value)) {
        return stringifyObject(value);
    }
    if (typeof value === 'string') {
        return value;
    }
    /* istanbul ignore next */
    return '';
}
function stringifyArray(value) {
    var res = '';
    var stringified;
    for (var i = 0, l = value.length; i < l; i++) {
        if (isDef((stringified = stringifyClass(value[i]))) && stringified !== '') {
            if (res)
                res += ' ';
            res += stringified;
        }
    }
    return res;
}
function stringifyObject(value) {
    var res = '';
    for (var key in value) {
        if (value[key]) {
            if (res)
                res += ' ';
            res += key;
        }
    }
    return res;
}

var namespaceMap = {
    svg: 'http://www.w3.org/2000/svg',
    math: 'http://www.w3.org/1998/Math/MathML'
};
var isHTMLTag = makeMap('html,body,base,head,link,meta,style,title,' +
    'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
    'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
    'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
    's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
    'embed,object,param,source,canvas,script,noscript,del,ins,' +
    'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
    'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
    'output,progress,select,textarea,' +
    'details,dialog,menu,menuitem,summary,' +
    'content,element,shadow,template,blockquote,iframe,tfoot');
// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap('svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
    'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
    'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view', true);
var isReservedTag = function (tag) {
    return isHTMLTag(tag) || isSVG(tag);
};
function getTagNamespace(tag) {
    if (isSVG(tag)) {
        return 'svg';
    }
    // basic support for MathML
    // note it doesn't support other MathML elements being component roots
    if (tag === 'math') {
        return 'math';
    }
}
var unknownElementCache = Object.create(null);
function isUnknownElement(tag) {
    /* istanbul ignore if */
    if (!inBrowser) {
        return true;
    }
    if (isReservedTag(tag)) {
        return false;
    }
    tag = tag.toLowerCase();
    /* istanbul ignore if */
    if (unknownElementCache[tag] != null) {
        return unknownElementCache[tag];
    }
    var el = document.createElement(tag);
    if (tag.indexOf('-') > -1) {
        // https://stackoverflow.com/a/28210364/1070244
        return (unknownElementCache[tag] =
            el.constructor === window.HTMLUnknownElement ||
                el.constructor === window.HTMLElement);
    }
    else {
        return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()));
    }
}
var isTextInputType = makeMap('text,number,password,search,email,tel,url');

/**
 * Query an element selector if it's not an element already.
 */
function query(el) {
    if (typeof el === 'string') {
        var selected = document.querySelector(el);
        if (!selected) {
             true && warn('Cannot find element: ' + el);
            return document.createElement('div');
        }
        return selected;
    }
    else {
        return el;
    }
}

function createElement(tagName, vnode) {
    var elm = document.createElement(tagName);
    if (tagName !== 'select') {
        return elm;
    }
    // false or null will remove the attribute but undefined will not
    if (vnode.data &&
        vnode.data.attrs &&
        vnode.data.attrs.multiple !== undefined) {
        elm.setAttribute('multiple', 'multiple');
    }
    return elm;
}
function createElementNS(namespace, tagName) {
    return document.createElementNS(namespaceMap[namespace], tagName);
}
function createTextNode(text) {
    return document.createTextNode(text);
}
function createComment(text) {
    return document.createComment(text);
}
function insertBefore(parentNode, newNode, referenceNode) {
    parentNode.insertBefore(newNode, referenceNode);
}
function removeChild(node, child) {
    node.removeChild(child);
}
function appendChild(node, child) {
    node.appendChild(child);
}
function parentNode(node) {
    return node.parentNode;
}
function nextSibling(node) {
    return node.nextSibling;
}
function tagName(node) {
    return node.tagName;
}
function setTextContent(node, text) {
    node.textContent = text;
}
function setStyleScope(node, scopeId) {
    node.setAttribute(scopeId, '');
}

var nodeOps = /*#__PURE__*/Object.freeze({
  __proto__: null,
  createElement: createElement,
  createElementNS: createElementNS,
  createTextNode: createTextNode,
  createComment: createComment,
  insertBefore: insertBefore,
  removeChild: removeChild,
  appendChild: appendChild,
  parentNode: parentNode,
  nextSibling: nextSibling,
  tagName: tagName,
  setTextContent: setTextContent,
  setStyleScope: setStyleScope
});

var ref = {
    create: function (_, vnode) {
        registerRef(vnode);
    },
    update: function (oldVnode, vnode) {
        if (oldVnode.data.ref !== vnode.data.ref) {
            registerRef(oldVnode, true);
            registerRef(vnode);
        }
    },
    destroy: function (vnode) {
        registerRef(vnode, true);
    }
};
function registerRef(vnode, isRemoval) {
    var ref = vnode.data.ref;
    if (!isDef(ref))
        return;
    var vm = vnode.context;
    var refValue = vnode.componentInstance || vnode.elm;
    var value = isRemoval ? null : refValue;
    var $refsValue = isRemoval ? undefined : refValue;
    if (isFunction(ref)) {
        invokeWithErrorHandling(ref, vm, [value], vm, "template ref function");
        return;
    }
    var isFor = vnode.data.refInFor;
    var _isString = typeof ref === 'string' || typeof ref === 'number';
    var _isRef = isRef(ref);
    var refs = vm.$refs;
    if (_isString || _isRef) {
        if (isFor) {
            var existing = _isString ? refs[ref] : ref.value;
            if (isRemoval) {
                isArray(existing) && remove$2(existing, refValue);
            }
            else {
                if (!isArray(existing)) {
                    if (_isString) {
                        refs[ref] = [refValue];
                        setSetupRef(vm, ref, refs[ref]);
                    }
                    else {
                        ref.value = [refValue];
                    }
                }
                else if (!existing.includes(refValue)) {
                    existing.push(refValue);
                }
            }
        }
        else if (_isString) {
            if (isRemoval && refs[ref] !== refValue) {
                return;
            }
            refs[ref] = $refsValue;
            setSetupRef(vm, ref, value);
        }
        else if (_isRef) {
            if (isRemoval && ref.value !== refValue) {
                return;
            }
            ref.value = value;
        }
        else if (true) {
            warn("Invalid template ref type: ".concat(typeof ref));
        }
    }
}
function setSetupRef(_a, key, val) {
    var _setupState = _a._setupState;
    if (_setupState && hasOwn(_setupState, key)) {
        if (isRef(_setupState[key])) {
            _setupState[key].value = val;
        }
        else {
            _setupState[key] = val;
        }
    }
}

/**
 * Virtual DOM patching algorithm based on Snabbdom by
 * Simon Friis Vindum (@paldepind)
 * Licensed under the MIT License
 * https://github.com/paldepind/snabbdom/blob/master/LICENSE
 *
 * modified by Evan You (@yyx990803)
 *
 * Not type-checking this because this file is perf-critical and the cost
 * of making flow understand it is not worth it.
 */
var emptyNode = new VNode('', {}, []);
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
function sameVnode(a, b) {
    return (a.key === b.key &&
        a.asyncFactory === b.asyncFactory &&
        ((a.tag === b.tag &&
            a.isComment === b.isComment &&
            isDef(a.data) === isDef(b.data) &&
            sameInputType(a, b)) ||
            (isTrue(a.isAsyncPlaceholder) && isUndef(b.asyncFactory.error))));
}
function sameInputType(a, b) {
    if (a.tag !== 'input')
        return true;
    var i;
    var typeA = isDef((i = a.data)) && isDef((i = i.attrs)) && i.type;
    var typeB = isDef((i = b.data)) && isDef((i = i.attrs)) && i.type;
    return typeA === typeB || (isTextInputType(typeA) && isTextInputType(typeB));
}
function createKeyToOldIdx(children, beginIdx, endIdx) {
    var i, key;
    var map = {};
    for (i = beginIdx; i <= endIdx; ++i) {
        key = children[i].key;
        if (isDef(key))
            map[key] = i;
    }
    return map;
}
function createPatchFunction(backend) {
    var i, j;
    var cbs = {};
    var modules = backend.modules, nodeOps = backend.nodeOps;
    for (i = 0; i < hooks.length; ++i) {
        cbs[hooks[i]] = [];
        for (j = 0; j < modules.length; ++j) {
            if (isDef(modules[j][hooks[i]])) {
                cbs[hooks[i]].push(modules[j][hooks[i]]);
            }
        }
    }
    function emptyNodeAt(elm) {
        return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);
    }
    function createRmCb(childElm, listeners) {
        function remove() {
            if (--remove.listeners === 0) {
                removeNode(childElm);
            }
        }
        remove.listeners = listeners;
        return remove;
    }
    function removeNode(el) {
        var parent = nodeOps.parentNode(el);
        // element may have already been removed due to v-html / v-text
        if (isDef(parent)) {
            nodeOps.removeChild(parent, el);
        }
    }
    function isUnknownElement(vnode, inVPre) {
        return (!inVPre &&
            !vnode.ns &&
            !(config.ignoredElements.length &&
                config.ignoredElements.some(function (ignore) {
                    return isRegExp(ignore)
                        ? ignore.test(vnode.tag)
                        : ignore === vnode.tag;
                })) &&
            config.isUnknownElement(vnode.tag));
    }
    var creatingElmInVPre = 0;
    function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {
        if (isDef(vnode.elm) && isDef(ownerArray)) {
            // This vnode was used in a previous render!
            // now it's used as a new node, overwriting its elm would cause
            // potential patch errors down the road when it's used as an insertion
            // reference node. Instead, we clone the node on-demand before creating
            // associated DOM element for it.
            vnode = ownerArray[index] = cloneVNode(vnode);
        }
        vnode.isRootInsert = !nested; // for transition enter check
        if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
            return;
        }
        var data = vnode.data;
        var children = vnode.children;
        var tag = vnode.tag;
        if (isDef(tag)) {
            if (true) {
                if (data && data.pre) {
                    creatingElmInVPre++;
                }
                if (isUnknownElement(vnode, creatingElmInVPre)) {
                    warn('Unknown custom element: <' +
                        tag +
                        '> - did you ' +
                        'register the component correctly? For recursive components, ' +
                        'make sure to provide the "name" option.', vnode.context);
                }
            }
            vnode.elm = vnode.ns
                ? nodeOps.createElementNS(vnode.ns, tag)
                : nodeOps.createElement(tag, vnode);
            setScope(vnode);
            createChildren(vnode, children, insertedVnodeQueue);
            if (isDef(data)) {
                invokeCreateHooks(vnode, insertedVnodeQueue);
            }
            insert(parentElm, vnode.elm, refElm);
            if ( true && data && data.pre) {
                creatingElmInVPre--;
            }
        }
        else if (isTrue(vnode.isComment)) {
            vnode.elm = nodeOps.createComment(vnode.text);
            insert(parentElm, vnode.elm, refElm);
        }
        else {
            vnode.elm = nodeOps.createTextNode(vnode.text);
            insert(parentElm, vnode.elm, refElm);
        }
    }
    function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
        var i = vnode.data;
        if (isDef(i)) {
            var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
            if (isDef((i = i.hook)) && isDef((i = i.init))) {
                i(vnode, false /* hydrating */);
            }
            // after calling the init hook, if the vnode is a child component
            // it should've created a child instance and mounted it. the child
            // component also has set the placeholder vnode's elm.
            // in that case we can just return the element and be done.
            if (isDef(vnode.componentInstance)) {
                initComponent(vnode, insertedVnodeQueue);
                insert(parentElm, vnode.elm, refElm);
                if (isTrue(isReactivated)) {
                    reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
                }
                return true;
            }
        }
    }
    function initComponent(vnode, insertedVnodeQueue) {
        if (isDef(vnode.data.pendingInsert)) {
            insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
            vnode.data.pendingInsert = null;
        }
        vnode.elm = vnode.componentInstance.$el;
        if (isPatchable(vnode)) {
            invokeCreateHooks(vnode, insertedVnodeQueue);
            setScope(vnode);
        }
        else {
            // empty component root.
            // skip all element-related modules except for ref (#3455)
            registerRef(vnode);
            // make sure to invoke the insert hook
            insertedVnodeQueue.push(vnode);
        }
    }
    function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {
        var i;
        // hack for #4339: a reactivated component with inner transition
        // does not trigger because the inner node's created hooks are not called
        // again. It's not ideal to involve module-specific logic in here but
        // there doesn't seem to be a better way to do it.
        var innerNode = vnode;
        while (innerNode.componentInstance) {
            innerNode = innerNode.componentInstance._vnode;
            if (isDef((i = innerNode.data)) && isDef((i = i.transition))) {
                for (i = 0; i < cbs.activate.length; ++i) {
                    cbs.activate[i](emptyNode, innerNode);
                }
                insertedVnodeQueue.push(innerNode);
                break;
            }
        }
        // unlike a newly created component,
        // a reactivated keep-alive component doesn't insert itself
        insert(parentElm, vnode.elm, refElm);
    }
    function insert(parent, elm, ref) {
        if (isDef(parent)) {
            if (isDef(ref)) {
                if (nodeOps.parentNode(ref) === parent) {
                    nodeOps.insertBefore(parent, elm, ref);
                }
            }
            else {
                nodeOps.appendChild(parent, elm);
            }
        }
    }
    function createChildren(vnode, children, insertedVnodeQueue) {
        if (isArray(children)) {
            if (true) {
                checkDuplicateKeys(children);
            }
            for (var i_1 = 0; i_1 < children.length; ++i_1) {
                createElm(children[i_1], insertedVnodeQueue, vnode.elm, null, true, children, i_1);
            }
        }
        else if (isPrimitive(vnode.text)) {
            nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
        }
    }
    function isPatchable(vnode) {
        while (vnode.componentInstance) {
            vnode = vnode.componentInstance._vnode;
        }
        return isDef(vnode.tag);
    }
    function invokeCreateHooks(vnode, insertedVnodeQueue) {
        for (var i_2 = 0; i_2 < cbs.create.length; ++i_2) {
            cbs.create[i_2](emptyNode, vnode);
        }
        i = vnode.data.hook; // Reuse variable
        if (isDef(i)) {
            if (isDef(i.create))
                i.create(emptyNode, vnode);
            if (isDef(i.insert))
                insertedVnodeQueue.push(vnode);
        }
    }
    // set scope id attribute for scoped CSS.
    // this is implemented as a special case to avoid the overhead
    // of going through the normal attribute patching process.
    function setScope(vnode) {
        var i;
        if (isDef((i = vnode.fnScopeId))) {
            nodeOps.setStyleScope(vnode.elm, i);
        }
        else {
            var ancestor = vnode;
            while (ancestor) {
                if (isDef((i = ancestor.context)) && isDef((i = i.$options._scopeId))) {
                    nodeOps.setStyleScope(vnode.elm, i);
                }
                ancestor = ancestor.parent;
            }
        }
        // for slot content they should also get the scopeId from the host instance.
        if (isDef((i = activeInstance)) &&
            i !== vnode.context &&
            i !== vnode.fnContext &&
            isDef((i = i.$options._scopeId))) {
            nodeOps.setStyleScope(vnode.elm, i);
        }
    }
    function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
        for (; startIdx <= endIdx; ++startIdx) {
            createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
        }
    }
    function invokeDestroyHook(vnode) {
        var i, j;
        var data = vnode.data;
        if (isDef(data)) {
            if (isDef((i = data.hook)) && isDef((i = i.destroy)))
                i(vnode);
            for (i = 0; i < cbs.destroy.length; ++i)
                cbs.destroy[i](vnode);
        }
        if (isDef((i = vnode.children))) {
            for (j = 0; j < vnode.children.length; ++j) {
                invokeDestroyHook(vnode.children[j]);
            }
        }
    }
    function removeVnodes(vnodes, startIdx, endIdx) {
        for (; startIdx <= endIdx; ++startIdx) {
            var ch = vnodes[startIdx];
            if (isDef(ch)) {
                if (isDef(ch.tag)) {
                    removeAndInvokeRemoveHook(ch);
                    invokeDestroyHook(ch);
                }
                else {
                    // Text node
                    removeNode(ch.elm);
                }
            }
        }
    }
    function removeAndInvokeRemoveHook(vnode, rm) {
        if (isDef(rm) || isDef(vnode.data)) {
            var i_3;
            var listeners = cbs.remove.length + 1;
            if (isDef(rm)) {
                // we have a recursively passed down rm callback
                // increase the listeners count
                rm.listeners += listeners;
            }
            else {
                // directly removing
                rm = createRmCb(vnode.elm, listeners);
            }
            // recursively invoke hooks on child component root node
            if (isDef((i_3 = vnode.componentInstance)) &&
                isDef((i_3 = i_3._vnode)) &&
                isDef(i_3.data)) {
                removeAndInvokeRemoveHook(i_3, rm);
            }
            for (i_3 = 0; i_3 < cbs.remove.length; ++i_3) {
                cbs.remove[i_3](vnode, rm);
            }
            if (isDef((i_3 = vnode.data.hook)) && isDef((i_3 = i_3.remove))) {
                i_3(vnode, rm);
            }
            else {
                rm();
            }
        }
        else {
            removeNode(vnode.elm);
        }
    }
    function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
        var oldStartIdx = 0;
        var newStartIdx = 0;
        var oldEndIdx = oldCh.length - 1;
        var oldStartVnode = oldCh[0];
        var oldEndVnode = oldCh[oldEndIdx];
        var newEndIdx = newCh.length - 1;
        var newStartVnode = newCh[0];
        var newEndVnode = newCh[newEndIdx];
        var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
        // removeOnly is a special flag used only by <transition-group>
        // to ensure removed elements stay in correct relative positions
        // during leaving transitions
        var canMove = !removeOnly;
        if (true) {
            checkDuplicateKeys(newCh);
        }
        while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
            if (isUndef(oldStartVnode)) {
                oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
            }
            else if (isUndef(oldEndVnode)) {
                oldEndVnode = oldCh[--oldEndIdx];
            }
            else if (sameVnode(oldStartVnode, newStartVnode)) {
                patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
                oldStartVnode = oldCh[++oldStartIdx];
                newStartVnode = newCh[++newStartIdx];
            }
            else if (sameVnode(oldEndVnode, newEndVnode)) {
                patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
                oldEndVnode = oldCh[--oldEndIdx];
                newEndVnode = newCh[--newEndIdx];
            }
            else if (sameVnode(oldStartVnode, newEndVnode)) {
                // Vnode moved right
                patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
                canMove &&
                    nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
                oldStartVnode = oldCh[++oldStartIdx];
                newEndVnode = newCh[--newEndIdx];
            }
            else if (sameVnode(oldEndVnode, newStartVnode)) {
                // Vnode moved left
                patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
                canMove &&
                    nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
                oldEndVnode = oldCh[--oldEndIdx];
                newStartVnode = newCh[++newStartIdx];
            }
            else {
                if (isUndef(oldKeyToIdx))
                    oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
                idxInOld = isDef(newStartVnode.key)
                    ? oldKeyToIdx[newStartVnode.key]
                    : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
                if (isUndef(idxInOld)) {
                    // New element
                    createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
                }
                else {
                    vnodeToMove = oldCh[idxInOld];
                    if (sameVnode(vnodeToMove, newStartVnode)) {
                        patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
                        oldCh[idxInOld] = undefined;
                        canMove &&
                            nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
                    }
                    else {
                        // same key but different element. treat as new element
                        createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
                    }
                }
                newStartVnode = newCh[++newStartIdx];
            }
        }
        if (oldStartIdx > oldEndIdx) {
            refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
            addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
        }
        else if (newStartIdx > newEndIdx) {
            removeVnodes(oldCh, oldStartIdx, oldEndIdx);
        }
    }
    function checkDuplicateKeys(children) {
        var seenKeys = {};
        for (var i_4 = 0; i_4 < children.length; i_4++) {
            var vnode = children[i_4];
            var key = vnode.key;
            if (isDef(key)) {
                if (seenKeys[key]) {
                    warn("Duplicate keys detected: '".concat(key, "'. This may cause an update error."), vnode.context);
                }
                else {
                    seenKeys[key] = true;
                }
            }
        }
    }
    function findIdxInOld(node, oldCh, start, end) {
        for (var i_5 = start; i_5 < end; i_5++) {
            var c = oldCh[i_5];
            if (isDef(c) && sameVnode(node, c))
                return i_5;
        }
    }
    function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {
        if (oldVnode === vnode) {
            return;
        }
        if (isDef(vnode.elm) && isDef(ownerArray)) {
            // clone reused vnode
            vnode = ownerArray[index] = cloneVNode(vnode);
        }
        var elm = (vnode.elm = oldVnode.elm);
        if (isTrue(oldVnode.isAsyncPlaceholder)) {
            if (isDef(vnode.asyncFactory.resolved)) {
                hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
            }
            else {
                vnode.isAsyncPlaceholder = true;
            }
            return;
        }
        // reuse element for static trees.
        // note we only do this if the vnode is cloned -
        // if the new node is not cloned it means the render functions have been
        // reset by the hot-reload-api and we need to do a proper re-render.
        if (isTrue(vnode.isStatic) &&
            isTrue(oldVnode.isStatic) &&
            vnode.key === oldVnode.key &&
            (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
            vnode.componentInstance = oldVnode.componentInstance;
            return;
        }
        var i;
        var data = vnode.data;
        if (isDef(data) && isDef((i = data.hook)) && isDef((i = i.prepatch))) {
            i(oldVnode, vnode);
        }
        var oldCh = oldVnode.children;
        var ch = vnode.children;
        if (isDef(data) && isPatchable(vnode)) {
            for (i = 0; i < cbs.update.length; ++i)
                cbs.update[i](oldVnode, vnode);
            if (isDef((i = data.hook)) && isDef((i = i.update)))
                i(oldVnode, vnode);
        }
        if (isUndef(vnode.text)) {
            if (isDef(oldCh) && isDef(ch)) {
                if (oldCh !== ch)
                    updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);
            }
            else if (isDef(ch)) {
                if (true) {
                    checkDuplicateKeys(ch);
                }
                if (isDef(oldVnode.text))
                    nodeOps.setTextContent(elm, '');
                addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
            }
            else if (isDef(oldCh)) {
                removeVnodes(oldCh, 0, oldCh.length - 1);
            }
            else if (isDef(oldVnode.text)) {
                nodeOps.setTextContent(elm, '');
            }
        }
        else if (oldVnode.text !== vnode.text) {
            nodeOps.setTextContent(elm, vnode.text);
        }
        if (isDef(data)) {
            if (isDef((i = data.hook)) && isDef((i = i.postpatch)))
                i(oldVnode, vnode);
        }
    }
    function invokeInsertHook(vnode, queue, initial) {
        // delay insert hooks for component root nodes, invoke them after the
        // element is really inserted
        if (isTrue(initial) && isDef(vnode.parent)) {
            vnode.parent.data.pendingInsert = queue;
        }
        else {
            for (var i_6 = 0; i_6 < queue.length; ++i_6) {
                queue[i_6].data.hook.insert(queue[i_6]);
            }
        }
    }
    var hydrationBailed = false;
    // list of modules that can skip create hook during hydration because they
    // are already rendered on the client or has no need for initialization
    // Note: style is excluded because it relies on initial clone for future
    // deep updates (#7063).
    var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
    // Note: this is a browser-only function so we can assume elms are DOM nodes.
    function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {
        var i;
        var tag = vnode.tag, data = vnode.data, children = vnode.children;
        inVPre = inVPre || (data && data.pre);
        vnode.elm = elm;
        if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
            vnode.isAsyncPlaceholder = true;
            return true;
        }
        // assert node match
        if (true) {
            if (!assertNodeMatch(elm, vnode, inVPre)) {
                return false;
            }
        }
        if (isDef(data)) {
            if (isDef((i = data.hook)) && isDef((i = i.init)))
                i(vnode, true /* hydrating */);
            if (isDef((i = vnode.componentInstance))) {
                // child component. it should have hydrated its own tree.
                initComponent(vnode, insertedVnodeQueue);
                return true;
            }
        }
        if (isDef(tag)) {
            if (isDef(children)) {
                // empty element, allow client to pick up and populate children
                if (!elm.hasChildNodes()) {
                    createChildren(vnode, children, insertedVnodeQueue);
                }
                else {
                    // v-html and domProps: innerHTML
                    if (isDef((i = data)) &&
                        isDef((i = i.domProps)) &&
                        isDef((i = i.innerHTML))) {
                        if (i !== elm.innerHTML) {
                            /* istanbul ignore if */
                            if ( true &&
                                typeof console !== 'undefined' &&
                                !hydrationBailed) {
                                hydrationBailed = true;
                                console.warn('Parent: ', elm);
                                console.warn('server innerHTML: ', i);
                                console.warn('client innerHTML: ', elm.innerHTML);
                            }
                            return false;
                        }
                    }
                    else {
                        // iterate and compare children lists
                        var childrenMatch = true;
                        var childNode = elm.firstChild;
                        for (var i_7 = 0; i_7 < children.length; i_7++) {
                            if (!childNode ||
                                !hydrate(childNode, children[i_7], insertedVnodeQueue, inVPre)) {
                                childrenMatch = false;
                                break;
                            }
                            childNode = childNode.nextSibling;
                        }
                        // if childNode is not null, it means the actual childNodes list is
                        // longer than the virtual children list.
                        if (!childrenMatch || childNode) {
                            /* istanbul ignore if */
                            if ( true &&
                                typeof console !== 'undefined' &&
                                !hydrationBailed) {
                                hydrationBailed = true;
                                console.warn('Parent: ', elm);
                                console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
                            }
                            return false;
                        }
                    }
                }
            }
            if (isDef(data)) {
                var fullInvoke = false;
                for (var key in data) {
                    if (!isRenderedModule(key)) {
                        fullInvoke = true;
                        invokeCreateHooks(vnode, insertedVnodeQueue);
                        break;
                    }
                }
                if (!fullInvoke && data['class']) {
                    // ensure collecting deps for deep class bindings for future updates
                    traverse(data['class']);
                }
            }
        }
        else if (elm.data !== vnode.text) {
            elm.data = vnode.text;
        }
        return true;
    }
    function assertNodeMatch(node, vnode, inVPre) {
        if (isDef(vnode.tag)) {
            return (vnode.tag.indexOf('vue-component') === 0 ||
                (!isUnknownElement(vnode, inVPre) &&
                    vnode.tag.toLowerCase() ===
                        (node.tagName && node.tagName.toLowerCase())));
        }
        else {
            return node.nodeType === (vnode.isComment ? 8 : 3);
        }
    }
    return function patch(oldVnode, vnode, hydrating, removeOnly) {
        if (isUndef(vnode)) {
            if (isDef(oldVnode))
                invokeDestroyHook(oldVnode);
            return;
        }
        var isInitialPatch = false;
        var insertedVnodeQueue = [];
        if (isUndef(oldVnode)) {
            // empty mount (likely as component), create new root element
            isInitialPatch = true;
            createElm(vnode, insertedVnodeQueue);
        }
        else {
            var isRealElement = isDef(oldVnode.nodeType);
            if (!isRealElement && sameVnode(oldVnode, vnode)) {
                // patch existing root node
                patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
            }
            else {
                if (isRealElement) {
                    // mounting to a real element
                    // check if this is server-rendered content and if we can perform
                    // a successful hydration.
                    if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
                        oldVnode.removeAttribute(SSR_ATTR);
                        hydrating = true;
                    }
                    if (isTrue(hydrating)) {
                        if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
                            invokeInsertHook(vnode, insertedVnodeQueue, true);
                            return oldVnode;
                        }
                        else if (true) {
                            warn('The client-side rendered virtual DOM tree is not matching ' +
                                'server-rendered content. This is likely caused by incorrect ' +
                                'HTML markup, for example nesting block-level elements inside ' +
                                '<p>, or missing <tbody>. Bailing hydration and performing ' +
                                'full client-side render.');
                        }
                    }
                    // either not server-rendered, or hydration failed.
                    // create an empty node and replace it
                    oldVnode = emptyNodeAt(oldVnode);
                }
                // replacing existing element
                var oldElm = oldVnode.elm;
                var parentElm = nodeOps.parentNode(oldElm);
                // create new node
                createElm(vnode, insertedVnodeQueue, 
                // extremely rare edge case: do not insert if old element is in a
                // leaving transition. Only happens when combining transition +
                // keep-alive + HOCs. (#4590)
                oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm));
                // update parent placeholder node element, recursively
                if (isDef(vnode.parent)) {
                    var ancestor = vnode.parent;
                    var patchable = isPatchable(vnode);
                    while (ancestor) {
                        for (var i_8 = 0; i_8 < cbs.destroy.length; ++i_8) {
                            cbs.destroy[i_8](ancestor);
                        }
                        ancestor.elm = vnode.elm;
                        if (patchable) {
                            for (var i_9 = 0; i_9 < cbs.create.length; ++i_9) {
                                cbs.create[i_9](emptyNode, ancestor);
                            }
                            // #6513
                            // invoke insert hooks that may have been merged by create hooks.
                            // e.g. for directives that uses the "inserted" hook.
                            var insert_1 = ancestor.data.hook.insert;
                            if (insert_1.merged) {
                                // start at index 1 to avoid re-invoking component mounted hook
                                // clone insert hooks to avoid being mutated during iteration.
                                // e.g. for customed directives under transition group.
                                var cloned = insert_1.fns.slice(1);
                                for (var i_10 = 0; i_10 < cloned.length; i_10++) {
                                    cloned[i_10]();
                                }
                            }
                        }
                        else {
                            registerRef(ancestor);
                        }
                        ancestor = ancestor.parent;
                    }
                }
                // destroy old node
                if (isDef(parentElm)) {
                    removeVnodes([oldVnode], 0, 0);
                }
                else if (isDef(oldVnode.tag)) {
                    invokeDestroyHook(oldVnode);
                }
            }
        }
        invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
        return vnode.elm;
    };
}

var directives = {
    create: updateDirectives,
    update: updateDirectives,
    destroy: function unbindDirectives(vnode) {
        // @ts-expect-error emptyNode is not VNodeWithData
        updateDirectives(vnode, emptyNode);
    }
};
function updateDirectives(oldVnode, vnode) {
    if (oldVnode.data.directives || vnode.data.directives) {
        _update(oldVnode, vnode);
    }
}
function _update(oldVnode, vnode) {
    var isCreate = oldVnode === emptyNode;
    var isDestroy = vnode === emptyNode;
    var oldDirs = normalizeDirectives(oldVnode.data.directives, oldVnode.context);
    var newDirs = normalizeDirectives(vnode.data.directives, vnode.context);
    var dirsWithInsert = [];
    var dirsWithPostpatch = [];
    var key, oldDir, dir;
    for (key in newDirs) {
        oldDir = oldDirs[key];
        dir = newDirs[key];
        if (!oldDir) {
            // new directive, bind
            callHook(dir, 'bind', vnode, oldVnode);
            if (dir.def && dir.def.inserted) {
                dirsWithInsert.push(dir);
            }
        }
        else {
            // existing directive, update
            dir.oldValue = oldDir.value;
            dir.oldArg = oldDir.arg;
            callHook(dir, 'update', vnode, oldVnode);
            if (dir.def && dir.def.componentUpdated) {
                dirsWithPostpatch.push(dir);
            }
        }
    }
    if (dirsWithInsert.length) {
        var callInsert = function () {
            for (var i = 0; i < dirsWithInsert.length; i++) {
                callHook(dirsWithInsert[i], 'inserted', vnode, oldVnode);
            }
        };
        if (isCreate) {
            mergeVNodeHook(vnode, 'insert', callInsert);
        }
        else {
            callInsert();
        }
    }
    if (dirsWithPostpatch.length) {
        mergeVNodeHook(vnode, 'postpatch', function () {
            for (var i = 0; i < dirsWithPostpatch.length; i++) {
                callHook(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
            }
        });
    }
    if (!isCreate) {
        for (key in oldDirs) {
            if (!newDirs[key]) {
                // no longer present, unbind
                callHook(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
            }
        }
    }
}
var emptyModifiers = Object.create(null);
function normalizeDirectives(dirs, vm) {
    var res = Object.create(null);
    if (!dirs) {
        // $flow-disable-line
        return res;
    }
    var i, dir;
    for (i = 0; i < dirs.length; i++) {
        dir = dirs[i];
        if (!dir.modifiers) {
            // $flow-disable-line
            dir.modifiers = emptyModifiers;
        }
        res[getRawDirName(dir)] = dir;
        if (vm._setupState && vm._setupState.__sfc) {
            var setupDef = dir.def || resolveAsset(vm, '_setupState', 'v-' + dir.name);
            if (typeof setupDef === 'function') {
                dir.def = {
                    bind: setupDef,
                    update: setupDef,
                };
            }
            else {
                dir.def = setupDef;
            }
        }
        dir.def = dir.def || resolveAsset(vm.$options, 'directives', dir.name, true);
    }
    // $flow-disable-line
    return res;
}
function getRawDirName(dir) {
    return (dir.rawName || "".concat(dir.name, ".").concat(Object.keys(dir.modifiers || {}).join('.')));
}
function callHook(dir, hook, vnode, oldVnode, isDestroy) {
    var fn = dir.def && dir.def[hook];
    if (fn) {
        try {
            fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
        }
        catch (e) {
            handleError(e, vnode.context, "directive ".concat(dir.name, " ").concat(hook, " hook"));
        }
    }
}

var baseModules = [ref, directives];

function updateAttrs(oldVnode, vnode) {
    var opts = vnode.componentOptions;
    if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
        return;
    }
    if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
        return;
    }
    var key, cur, old;
    var elm = vnode.elm;
    var oldAttrs = oldVnode.data.attrs || {};
    var attrs = vnode.data.attrs || {};
    // clone observed objects, as the user probably wants to mutate it
    if (isDef(attrs.__ob__) || isTrue(attrs._v_attr_proxy)) {
        attrs = vnode.data.attrs = extend({}, attrs);
    }
    for (key in attrs) {
        cur = attrs[key];
        old = oldAttrs[key];
        if (old !== cur) {
            setAttr(elm, key, cur, vnode.data.pre);
        }
    }
    // #4391: in IE9, setting type can reset value for input[type=radio]
    // #6666: IE/Edge forces progress value down to 1 before setting a max
    /* istanbul ignore if */
    if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
        setAttr(elm, 'value', attrs.value);
    }
    for (key in oldAttrs) {
        if (isUndef(attrs[key])) {
            if (isXlink(key)) {
                elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
            }
            else if (!isEnumeratedAttr(key)) {
                elm.removeAttribute(key);
            }
        }
    }
}
function setAttr(el, key, value, isInPre) {
    if (isInPre || el.tagName.indexOf('-') > -1) {
        baseSetAttr(el, key, value);
    }
    else if (isBooleanAttr(key)) {
        // set attribute for blank value
        // e.g. <option disabled>Select one</option>
        if (isFalsyAttrValue(value)) {
            el.removeAttribute(key);
        }
        else {
            // technically allowfullscreen is a boolean attribute for <iframe>,
            // but Flash expects a value of "true" when used on <embed> tag
            value = key === 'allowfullscreen' && el.tagName === 'EMBED' ? 'true' : key;
            el.setAttribute(key, value);
        }
    }
    else if (isEnumeratedAttr(key)) {
        el.setAttribute(key, convertEnumeratedValue(key, value));
    }
    else if (isXlink(key)) {
        if (isFalsyAttrValue(value)) {
            el.removeAttributeNS(xlinkNS, getXlinkProp(key));
        }
        else {
            el.setAttributeNS(xlinkNS, key, value);
        }
    }
    else {
        baseSetAttr(el, key, value);
    }
}
function baseSetAttr(el, key, value) {
    if (isFalsyAttrValue(value)) {
        el.removeAttribute(key);
    }
    else {
        // #7138: IE10 & 11 fires input event when setting placeholder on
        // <textarea>... block the first input event and remove the blocker
        // immediately.
        /* istanbul ignore if */
        if (isIE &&
            !isIE9 &&
            el.tagName === 'TEXTAREA' &&
            key === 'placeholder' &&
            value !== '' &&
            !el.__ieph) {
            var blocker_1 = function (e) {
                e.stopImmediatePropagation();
                el.removeEventListener('input', blocker_1);
            };
            el.addEventListener('input', blocker_1);
            // $flow-disable-line
            el.__ieph = true; /* IE placeholder patched */
        }
        el.setAttribute(key, value);
    }
}
var attrs = {
    create: updateAttrs,
    update: updateAttrs
};

function updateClass(oldVnode, vnode) {
    var el = vnode.elm;
    var data = vnode.data;
    var oldData = oldVnode.data;
    if (isUndef(data.staticClass) &&
        isUndef(data.class) &&
        (isUndef(oldData) ||
            (isUndef(oldData.staticClass) && isUndef(oldData.class)))) {
        return;
    }
    var cls = genClassForVnode(vnode);
    // handle transition classes
    var transitionClass = el._transitionClasses;
    if (isDef(transitionClass)) {
        cls = concat(cls, stringifyClass(transitionClass));
    }
    // set the class
    if (cls !== el._prevClass) {
        el.setAttribute('class', cls);
        el._prevClass = cls;
    }
}
var klass = {
    create: updateClass,
    update: updateClass
};

// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';

// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents(on) {
    /* istanbul ignore if */
    if (isDef(on[RANGE_TOKEN])) {
        // IE input[type=range] only supports `change` event
        var event_1 = isIE ? 'change' : 'input';
        on[event_1] = [].concat(on[RANGE_TOKEN], on[event_1] || []);
        delete on[RANGE_TOKEN];
    }
    // This was originally intended to fix #4521 but no longer necessary
    // after 2.5. Keeping it for backwards compat with generated code from < 2.4
    /* istanbul ignore if */
    if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
        on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
        delete on[CHECKBOX_RADIO_TOKEN];
    }
}
var target;
function createOnceHandler(event, handler, capture) {
    var _target = target; // save current target element in closure
    return function onceHandler() {
        var res = handler.apply(null, arguments);
        if (res !== null) {
            remove(event, onceHandler, capture, _target);
        }
    };
}
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
// implementation and does not fire microtasks in between event propagation, so
// safe to exclude.
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
function add(name, handler, capture, passive) {
    // async edge case #6566: inner click event triggers patch, event handler
    // attached to outer element during patch, and triggered again. This
    // happens because browsers fire microtask ticks between event propagation.
    // the solution is simple: we save the timestamp when a handler is attached,
    // and the handler would only fire if the event passed to it was fired
    // AFTER it was attached.
    if (useMicrotaskFix) {
        var attachedTimestamp_1 = currentFlushTimestamp;
        var original_1 = handler;
        //@ts-expect-error
        handler = original_1._wrapper = function (e) {
            if (
            // no bubbling, should always fire.
            // this is just a safety net in case event.timeStamp is unreliable in
            // certain weird environments...
            e.target === e.currentTarget ||
                // event is fired after handler attachment
                e.timeStamp >= attachedTimestamp_1 ||
                // bail for environments that have buggy event.timeStamp implementations
                // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
                // #9681 QtWebEngine event.timeStamp is negative value
                e.timeStamp <= 0 ||
                // #9448 bail if event is fired in another document in a multi-page
                // electron/nw.js app, since event.timeStamp will be using a different
                // starting reference
                e.target.ownerDocument !== document) {
                return original_1.apply(this, arguments);
            }
        };
    }
    target.addEventListener(name, handler, supportsPassive ? { capture: capture, passive: passive } : capture);
}
function remove(name, handler, capture, _target) {
    (_target || target).removeEventListener(name, 
    //@ts-expect-error
    handler._wrapper || handler, capture);
}
function updateDOMListeners(oldVnode, vnode) {
    if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
        return;
    }
    var on = vnode.data.on || {};
    var oldOn = oldVnode.data.on || {};
    // vnode is empty when removing all listeners,
    // and use old vnode dom element
    target = vnode.elm || oldVnode.elm;
    normalizeEvents(on);
    updateListeners(on, oldOn, add, remove, createOnceHandler, vnode.context);
    target = undefined;
}
var events = {
    create: updateDOMListeners,
    update: updateDOMListeners,
    // @ts-expect-error emptyNode has actually data
    destroy: function (vnode) { return updateDOMListeners(vnode, emptyNode); }
};

var svgContainer;
function updateDOMProps(oldVnode, vnode) {
    if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
        return;
    }
    var key, cur;
    var elm = vnode.elm;
    var oldProps = oldVnode.data.domProps || {};
    var props = vnode.data.domProps || {};
    // clone observed objects, as the user probably wants to mutate it
    if (isDef(props.__ob__) || isTrue(props._v_attr_proxy)) {
        props = vnode.data.domProps = extend({}, props);
    }
    for (key in oldProps) {
        if (!(key in props)) {
            elm[key] = '';
        }
    }
    for (key in props) {
        cur = props[key];
        // ignore children if the node has textContent or innerHTML,
        // as these will throw away existing DOM nodes and cause removal errors
        // on subsequent patches (#3360)
        if (key === 'textContent' || key === 'innerHTML') {
            if (vnode.children)
                vnode.children.length = 0;
            if (cur === oldProps[key])
                continue;
            // #6601 work around Chrome version <= 55 bug where single textNode
            // replaced by innerHTML/textContent retains its parentNode property
            if (elm.childNodes.length === 1) {
                elm.removeChild(elm.childNodes[0]);
            }
        }
        if (key === 'value' && elm.tagName !== 'PROGRESS') {
            // store value as _value as well since
            // non-string values will be stringified
            elm._value = cur;
            // avoid resetting cursor position when value is the same
            var strCur = isUndef(cur) ? '' : String(cur);
            if (shouldUpdateValue(elm, strCur)) {
                elm.value = strCur;
            }
        }
        else if (key === 'innerHTML' &&
            isSVG(elm.tagName) &&
            isUndef(elm.innerHTML)) {
            // IE doesn't support innerHTML for SVG elements
            svgContainer = svgContainer || document.createElement('div');
            svgContainer.innerHTML = "<svg>".concat(cur, "</svg>");
            var svg = svgContainer.firstChild;
            while (elm.firstChild) {
                elm.removeChild(elm.firstChild);
            }
            while (svg.firstChild) {
                elm.appendChild(svg.firstChild);
            }
        }
        else if (
        // skip the update if old and new VDOM state is the same.
        // `value` is handled separately because the DOM value may be temporarily
        // out of sync with VDOM state due to focus, composition and modifiers.
        // This  #4521 by skipping the unnecessary `checked` update.
        cur !== oldProps[key]) {
            // some property updates can throw
            // e.g. `value` on <progress> w/ non-finite value
            try {
                elm[key] = cur;
            }
            catch (e) { }
        }
    }
}
function shouldUpdateValue(elm, checkVal) {
    return (
    //@ts-expect-error
    !elm.composing &&
        (elm.tagName === 'OPTION' ||
            isNotInFocusAndDirty(elm, checkVal) ||
            isDirtyWithModifiers(elm, checkVal)));
}
function isNotInFocusAndDirty(elm, checkVal) {
    // return true when textbox (.number and .trim) loses focus and its value is
    // not equal to the updated value
    var notInFocus = true;
    // #6157
    // work around IE bug when accessing document.activeElement in an iframe
    try {
        notInFocus = document.activeElement !== elm;
    }
    catch (e) { }
    return notInFocus && elm.value !== checkVal;
}
function isDirtyWithModifiers(elm, newVal) {
    var value = elm.value;
    var modifiers = elm._vModifiers; // injected by v-model runtime
    if (isDef(modifiers)) {
        if (modifiers.number) {
            return toNumber(value) !== toNumber(newVal);
        }
        if (modifiers.trim) {
            return value.trim() !== newVal.trim();
        }
    }
    return value !== newVal;
}
var domProps = {
    create: updateDOMProps,
    update: updateDOMProps
};

var parseStyleText = cached(function (cssText) {
    var res = {};
    var listDelimiter = /;(?![^(]*\))/g;
    var propertyDelimiter = /:(.+)/;
    cssText.split(listDelimiter).forEach(function (item) {
        if (item) {
            var tmp = item.split(propertyDelimiter);
            tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
        }
    });
    return res;
});
// merge static and dynamic style data on the same vnode
function normalizeStyleData(data) {
    var style = normalizeStyleBinding(data.style);
    // static style is pre-processed into an object during compilation
    // and is always a fresh object, so it's safe to merge into it
    return data.staticStyle ? extend(data.staticStyle, style) : style;
}
// normalize possible array / string values into Object
function normalizeStyleBinding(bindingStyle) {
    if (Array.isArray(bindingStyle)) {
        return toObject(bindingStyle);
    }
    if (typeof bindingStyle === 'string') {
        return parseStyleText(bindingStyle);
    }
    return bindingStyle;
}
/**
 * parent component style should be after child's
 * so that parent component's style could override it
 */
function getStyle(vnode, checkChild) {
    var res = {};
    var styleData;
    if (checkChild) {
        var childNode = vnode;
        while (childNode.componentInstance) {
            childNode = childNode.componentInstance._vnode;
            if (childNode &&
                childNode.data &&
                (styleData = normalizeStyleData(childNode.data))) {
                extend(res, styleData);
            }
        }
    }
    if ((styleData = normalizeStyleData(vnode.data))) {
        extend(res, styleData);
    }
    var parentNode = vnode;
    // @ts-expect-error parentNode.parent not VNodeWithData
    while ((parentNode = parentNode.parent)) {
        if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
            extend(res, styleData);
        }
    }
    return res;
}

var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
    /* istanbul ignore if */
    if (cssVarRE.test(name)) {
        el.style.setProperty(name, val);
    }
    else if (importantRE.test(val)) {
        el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
    }
    else {
        var normalizedName = normalize(name);
        if (Array.isArray(val)) {
            // Support values array created by autoprefixer, e.g.
            // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
            // Set them one by one, and the browser will only set those it can recognize
            for (var i = 0, len = val.length; i < len; i++) {
                el.style[normalizedName] = val[i];
            }
        }
        else {
            el.style[normalizedName] = val;
        }
    }
};
var vendorNames = ['Webkit', 'Moz', 'ms'];
var emptyStyle;
var normalize = cached(function (prop) {
    emptyStyle = emptyStyle || document.createElement('div').style;
    prop = camelize(prop);
    if (prop !== 'filter' && prop in emptyStyle) {
        return prop;
    }
    var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
    for (var i = 0; i < vendorNames.length; i++) {
        var name_1 = vendorNames[i] + capName;
        if (name_1 in emptyStyle) {
            return name_1;
        }
    }
});
function updateStyle(oldVnode, vnode) {
    var data = vnode.data;
    var oldData = oldVnode.data;
    if (isUndef(data.staticStyle) &&
        isUndef(data.style) &&
        isUndef(oldData.staticStyle) &&
        isUndef(oldData.style)) {
        return;
    }
    var cur, name;
    var el = vnode.elm;
    var oldStaticStyle = oldData.staticStyle;
    var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
    // if static style exists, stylebinding already merged into it when doing normalizeStyleData
    var oldStyle = oldStaticStyle || oldStyleBinding;
    var style = normalizeStyleBinding(vnode.data.style) || {};
    // store normalized style under a different key for next diff
    // make sure to clone it if it's reactive, since the user likely wants
    // to mutate it.
    vnode.data.normalizedStyle = isDef(style.__ob__) ? extend({}, style) : style;
    var newStyle = getStyle(vnode, true);
    for (name in oldStyle) {
        if (isUndef(newStyle[name])) {
            setProp(el, name, '');
        }
    }
    for (name in newStyle) {
        cur = newStyle[name];
        // ie9 setting to null has no effect, must use empty string
        setProp(el, name, cur == null ? '' : cur);
    }
}
var style = {
    create: updateStyle,
    update: updateStyle
};

var whitespaceRE = /\s+/;
/**
 * Add class with compatibility for SVG since classList is not supported on
 * SVG elements in IE
 */
function addClass(el, cls) {
    /* istanbul ignore if */
    if (!cls || !(cls = cls.trim())) {
        return;
    }
    /* istanbul ignore else */
    if (el.classList) {
        if (cls.indexOf(' ') > -1) {
            cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
        }
        else {
            el.classList.add(cls);
        }
    }
    else {
        var cur = " ".concat(el.getAttribute('class') || '', " ");
        if (cur.indexOf(' ' + cls + ' ') < 0) {
            el.setAttribute('class', (cur + cls).trim());
        }
    }
}
/**
 * Remove class with compatibility for SVG since classList is not supported on
 * SVG elements in IE
 */
function removeClass(el, cls) {
    /* istanbul ignore if */
    if (!cls || !(cls = cls.trim())) {
        return;
    }
    /* istanbul ignore else */
    if (el.classList) {
        if (cls.indexOf(' ') > -1) {
            cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
        }
        else {
            el.classList.remove(cls);
        }
        if (!el.classList.length) {
            el.removeAttribute('class');
        }
    }
    else {
        var cur = " ".concat(el.getAttribute('class') || '', " ");
        var tar = ' ' + cls + ' ';
        while (cur.indexOf(tar) >= 0) {
            cur = cur.replace(tar, ' ');
        }
        cur = cur.trim();
        if (cur) {
            el.setAttribute('class', cur);
        }
        else {
            el.removeAttribute('class');
        }
    }
}

function resolveTransition(def) {
    if (!def) {
        return;
    }
    /* istanbul ignore else */
    if (typeof def === 'object') {
        var res = {};
        if (def.css !== false) {
            extend(res, autoCssTransition(def.name || 'v'));
        }
        extend(res, def);
        return res;
    }
    else if (typeof def === 'string') {
        return autoCssTransition(def);
    }
}
var autoCssTransition = cached(function (name) {
    return {
        enterClass: "".concat(name, "-enter"),
        enterToClass: "".concat(name, "-enter-to"),
        enterActiveClass: "".concat(name, "-enter-active"),
        leaveClass: "".concat(name, "-leave"),
        leaveToClass: "".concat(name, "-leave-to"),
        leaveActiveClass: "".concat(name, "-leave-active")
    };
});
var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';
// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
    /* istanbul ignore if */
    if (window.ontransitionend === undefined &&
        window.onwebkittransitionend !== undefined) {
        transitionProp = 'WebkitTransition';
        transitionEndEvent = 'webkitTransitionEnd';
    }
    if (window.onanimationend === undefined &&
        window.onwebkitanimationend !== undefined) {
        animationProp = 'WebkitAnimation';
        animationEndEvent = 'webkitAnimationEnd';
    }
}
// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser
    ? window.requestAnimationFrame
        ? window.requestAnimationFrame.bind(window)
        : setTimeout
    : /* istanbul ignore next */ function (/* istanbul ignore next */ fn) { return fn(); };
function nextFrame(fn) {
    raf(function () {
        // @ts-expect-error
        raf(fn);
    });
}
function addTransitionClass(el, cls) {
    var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
    if (transitionClasses.indexOf(cls) < 0) {
        transitionClasses.push(cls);
        addClass(el, cls);
    }
}
function removeTransitionClass(el, cls) {
    if (el._transitionClasses) {
        remove$2(el._transitionClasses, cls);
    }
    removeClass(el, cls);
}
function whenTransitionEnds(el, expectedType, cb) {
    var _a = getTransitionInfo(el, expectedType), type = _a.type, timeout = _a.timeout, propCount = _a.propCount;
    if (!type)
        return cb();
    var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
    var ended = 0;
    var end = function () {
        el.removeEventListener(event, onEnd);
        cb();
    };
    var onEnd = function (e) {
        if (e.target === el) {
            if (++ended >= propCount) {
                end();
            }
        }
    };
    setTimeout(function () {
        if (ended < propCount) {
            end();
        }
    }, timeout + 1);
    el.addEventListener(event, onEnd);
}
var transformRE = /\b(transform|all)(,|$)/;
function getTransitionInfo(el, expectedType) {
    var styles = window.getComputedStyle(el);
    // JSDOM may return undefined for transition properties
    var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
    var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
    var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
    var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
    var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
    var animationTimeout = getTimeout(animationDelays, animationDurations);
    var type;
    var timeout = 0;
    var propCount = 0;
    /* istanbul ignore if */
    if (expectedType === TRANSITION) {
        if (transitionTimeout > 0) {
            type = TRANSITION;
            timeout = transitionTimeout;
            propCount = transitionDurations.length;
        }
    }
    else if (expectedType === ANIMATION) {
        if (animationTimeout > 0) {
            type = ANIMATION;
            timeout = animationTimeout;
            propCount = animationDurations.length;
        }
    }
    else {
        timeout = Math.max(transitionTimeout, animationTimeout);
        type =
            timeout > 0
                ? transitionTimeout > animationTimeout
                    ? TRANSITION
                    : ANIMATION
                : null;
        propCount = type
            ? type === TRANSITION
                ? transitionDurations.length
                : animationDurations.length
            : 0;
    }
    var hasTransform = type === TRANSITION && transformRE.test(styles[transitionProp + 'Property']);
    return {
        type: type,
        timeout: timeout,
        propCount: propCount,
        hasTransform: hasTransform
    };
}
function getTimeout(delays, durations) {
    /* istanbul ignore next */
    while (delays.length < durations.length) {
        delays = delays.concat(delays);
    }
    return Math.max.apply(null, durations.map(function (d, i) {
        return toMs(d) + toMs(delays[i]);
    }));
}
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
// in a locale-dependent way, using a comma instead of a dot.
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
// as a floor function) causing unexpected behaviors
function toMs(s) {
    return Number(s.slice(0, -1).replace(',', '.')) * 1000;
}

function enter(vnode, toggleDisplay) {
    var el = vnode.elm;
    // call leave callback now
    if (isDef(el._leaveCb)) {
        el._leaveCb.cancelled = true;
        el._leaveCb();
    }
    var data = resolveTransition(vnode.data.transition);
    if (isUndef(data)) {
        return;
    }
    /* istanbul ignore if */
    if (isDef(el._enterCb) || el.nodeType !== 1) {
        return;
    }
    var css = data.css, type = data.type, enterClass = data.enterClass, enterToClass = data.enterToClass, enterActiveClass = data.enterActiveClass, appearClass = data.appearClass, appearToClass = data.appearToClass, appearActiveClass = data.appearActiveClass, beforeEnter = data.beforeEnter, enter = data.enter, afterEnter = data.afterEnter, enterCancelled = data.enterCancelled, beforeAppear = data.beforeAppear, appear = data.appear, afterAppear = data.afterAppear, appearCancelled = data.appearCancelled, duration = data.duration;
    // activeInstance will always be the <transition> component managing this
    // transition. One edge case to check is when the <transition> is placed
    // as the root node of a child component. In that case we need to check
    // <transition>'s parent for appear check.
    var context = activeInstance;
    var transitionNode = activeInstance.$vnode;
    while (transitionNode && transitionNode.parent) {
        context = transitionNode.context;
        transitionNode = transitionNode.parent;
    }
    var isAppear = !context._isMounted || !vnode.isRootInsert;
    if (isAppear && !appear && appear !== '') {
        return;
    }
    var startClass = isAppear && appearClass ? appearClass : enterClass;
    var activeClass = isAppear && appearActiveClass ? appearActiveClass : enterActiveClass;
    var toClass = isAppear && appearToClass ? appearToClass : enterToClass;
    var beforeEnterHook = isAppear ? beforeAppear || beforeEnter : beforeEnter;
    var enterHook = isAppear ? (isFunction(appear) ? appear : enter) : enter;
    var afterEnterHook = isAppear ? afterAppear || afterEnter : afterEnter;
    var enterCancelledHook = isAppear
        ? appearCancelled || enterCancelled
        : enterCancelled;
    var explicitEnterDuration = toNumber(isObject(duration) ? duration.enter : duration);
    if ( true && explicitEnterDuration != null) {
        checkDuration(explicitEnterDuration, 'enter', vnode);
    }
    var expectsCSS = css !== false && !isIE9;
    var userWantsControl = getHookArgumentsLength(enterHook);
    var cb = (el._enterCb = once(function () {
        if (expectsCSS) {
            removeTransitionClass(el, toClass);
            removeTransitionClass(el, activeClass);
        }
        // @ts-expect-error
        if (cb.cancelled) {
            if (expectsCSS) {
                removeTransitionClass(el, startClass);
            }
            enterCancelledHook && enterCancelledHook(el);
        }
        else {
            afterEnterHook && afterEnterHook(el);
        }
        el._enterCb = null;
    }));
    if (!vnode.data.show) {
        // remove pending leave element on enter by injecting an insert hook
        mergeVNodeHook(vnode, 'insert', function () {
            var parent = el.parentNode;
            var pendingNode = parent && parent._pending && parent._pending[vnode.key];
            if (pendingNode &&
                pendingNode.tag === vnode.tag &&
                pendingNode.elm._leaveCb) {
                pendingNode.elm._leaveCb();
            }
            enterHook && enterHook(el, cb);
        });
    }
    // start enter transition
    beforeEnterHook && beforeEnterHook(el);
    if (expectsCSS) {
        addTransitionClass(el, startClass);
        addTransitionClass(el, activeClass);
        nextFrame(function () {
            removeTransitionClass(el, startClass);
            // @ts-expect-error
            if (!cb.cancelled) {
                addTransitionClass(el, toClass);
                if (!userWantsControl) {
                    if (isValidDuration(explicitEnterDuration)) {
                        setTimeout(cb, explicitEnterDuration);
                    }
                    else {
                        whenTransitionEnds(el, type, cb);
                    }
                }
            }
        });
    }
    if (vnode.data.show) {
        toggleDisplay && toggleDisplay();
        enterHook && enterHook(el, cb);
    }
    if (!expectsCSS && !userWantsControl) {
        cb();
    }
}
function leave(vnode, rm) {
    var el = vnode.elm;
    // call enter callback now
    if (isDef(el._enterCb)) {
        el._enterCb.cancelled = true;
        el._enterCb();
    }
    var data = resolveTransition(vnode.data.transition);
    if (isUndef(data) || el.nodeType !== 1) {
        return rm();
    }
    /* istanbul ignore if */
    if (isDef(el._leaveCb)) {
        return;
    }
    var css = data.css, type = data.type, leaveClass = data.leaveClass, leaveToClass = data.leaveToClass, leaveActiveClass = data.leaveActiveClass, beforeLeave = data.beforeLeave, leave = data.leave, afterLeave = data.afterLeave, leaveCancelled = data.leaveCancelled, delayLeave = data.delayLeave, duration = data.duration;
    var expectsCSS = css !== false && !isIE9;
    var userWantsControl = getHookArgumentsLength(leave);
    var explicitLeaveDuration = toNumber(isObject(duration) ? duration.leave : duration);
    if ( true && isDef(explicitLeaveDuration)) {
        checkDuration(explicitLeaveDuration, 'leave', vnode);
    }
    var cb = (el._leaveCb = once(function () {
        if (el.parentNode && el.parentNode._pending) {
            el.parentNode._pending[vnode.key] = null;
        }
        if (expectsCSS) {
            removeTransitionClass(el, leaveToClass);
            removeTransitionClass(el, leaveActiveClass);
        }
        // @ts-expect-error
        if (cb.cancelled) {
            if (expectsCSS) {
                removeTransitionClass(el, leaveClass);
            }
            leaveCancelled && leaveCancelled(el);
        }
        else {
            rm();
            afterLeave && afterLeave(el);
        }
        el._leaveCb = null;
    }));
    if (delayLeave) {
        delayLeave(performLeave);
    }
    else {
        performLeave();
    }
    function performLeave() {
        // the delayed leave may have already been cancelled
        // @ts-expect-error
        if (cb.cancelled) {
            return;
        }
        // record leaving element
        if (!vnode.data.show && el.parentNode) {
            (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] =
                vnode;
        }
        beforeLeave && beforeLeave(el);
        if (expectsCSS) {
            addTransitionClass(el, leaveClass);
            addTransitionClass(el, leaveActiveClass);
            nextFrame(function () {
                removeTransitionClass(el, leaveClass);
                // @ts-expect-error
                if (!cb.cancelled) {
                    addTransitionClass(el, leaveToClass);
                    if (!userWantsControl) {
                        if (isValidDuration(explicitLeaveDuration)) {
                            setTimeout(cb, explicitLeaveDuration);
                        }
                        else {
                            whenTransitionEnds(el, type, cb);
                        }
                    }
                }
            });
        }
        leave && leave(el, cb);
        if (!expectsCSS && !userWantsControl) {
            cb();
        }
    }
}
// only used in dev mode
function checkDuration(val, name, vnode) {
    if (typeof val !== 'number') {
        warn("<transition> explicit ".concat(name, " duration is not a valid number - ") +
            "got ".concat(JSON.stringify(val), "."), vnode.context);
    }
    else if (isNaN(val)) {
        warn("<transition> explicit ".concat(name, " duration is NaN - ") +
            'the duration expression might be incorrect.', vnode.context);
    }
}
function isValidDuration(val) {
    return typeof val === 'number' && !isNaN(val);
}
/**
 * Normalize a transition hook's argument length. The hook may be:
 * - a merged hook (invoker) with the original in .fns
 * - a wrapped component method (check ._length)
 * - a plain function (.length)
 */
function getHookArgumentsLength(fn) {
    if (isUndef(fn)) {
        return false;
    }
    // @ts-expect-error
    var invokerFns = fn.fns;
    if (isDef(invokerFns)) {
        // invoker
        return getHookArgumentsLength(Array.isArray(invokerFns) ? invokerFns[0] : invokerFns);
    }
    else {
        // @ts-expect-error
        return (fn._length || fn.length) > 1;
    }
}
function _enter(_, vnode) {
    if (vnode.data.show !== true) {
        enter(vnode);
    }
}
var transition = inBrowser
    ? {
        create: _enter,
        activate: _enter,
        remove: function (vnode, rm) {
            /* istanbul ignore else */
            if (vnode.data.show !== true) {
                // @ts-expect-error
                leave(vnode, rm);
            }
            else {
                rm();
            }
        }
    }
    : {};

var platformModules = [attrs, klass, events, domProps, style, transition];

// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });

/**
 * Not type checking this file because flow doesn't like attaching
 * properties to Elements.
 */
/* istanbul ignore if */
if (isIE9) {
    // http://www.matts411.com/post/internet-explorer-9-oninput/
    document.addEventListener('selectionchange', function () {
        var el = document.activeElement;
        // @ts-expect-error
        if (el && el.vmodel) {
            trigger(el, 'input');
        }
    });
}
var directive = {
    inserted: function (el, binding, vnode, oldVnode) {
        if (vnode.tag === 'select') {
            // #6903
            if (oldVnode.elm && !oldVnode.elm._vOptions) {
                mergeVNodeHook(vnode, 'postpatch', function () {
                    directive.componentUpdated(el, binding, vnode);
                });
            }
            else {
                setSelected(el, binding, vnode.context);
            }
            el._vOptions = [].map.call(el.options, getValue);
        }
        else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
            el._vModifiers = binding.modifiers;
            if (!binding.modifiers.lazy) {
                el.addEventListener('compositionstart', onCompositionStart);
                el.addEventListener('compositionend', onCompositionEnd);
                // Safari < 10.2 & UIWebView doesn't fire compositionend when
                // switching focus before confirming composition choice
                // this also fixes the issue where some browsers e.g. iOS Chrome
                // fires "change" instead of "input" on autocomplete.
                el.addEventListener('change', onCompositionEnd);
                /* istanbul ignore if */
                if (isIE9) {
                    el.vmodel = true;
                }
            }
        }
    },
    componentUpdated: function (el, binding, vnode) {
        if (vnode.tag === 'select') {
            setSelected(el, binding, vnode.context);
            // in case the options rendered by v-for have changed,
            // it's possible that the value is out-of-sync with the rendered options.
            // detect such cases and filter out values that no longer has a matching
            // option in the DOM.
            var prevOptions_1 = el._vOptions;
            var curOptions_1 = (el._vOptions = [].map.call(el.options, getValue));
            if (curOptions_1.some(function (o, i) { return !looseEqual(o, prevOptions_1[i]); })) {
                // trigger change event if
                // no matching option found for at least one value
                var needReset = el.multiple
                    ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions_1); })
                    : binding.value !== binding.oldValue &&
                        hasNoMatchingOption(binding.value, curOptions_1);
                if (needReset) {
                    trigger(el, 'change');
                }
            }
        }
    }
};
function setSelected(el, binding, vm) {
    actuallySetSelected(el, binding, vm);
    /* istanbul ignore if */
    if (isIE || isEdge) {
        setTimeout(function () {
            actuallySetSelected(el, binding, vm);
        }, 0);
    }
}
function actuallySetSelected(el, binding, vm) {
    var value = binding.value;
    var isMultiple = el.multiple;
    if (isMultiple && !Array.isArray(value)) {
         true &&
            warn("<select multiple v-model=\"".concat(binding.expression, "\"> ") +
                "expects an Array value for its binding, but got ".concat(Object.prototype.toString
                    .call(value)
                    .slice(8, -1)), vm);
        return;
    }
    var selected, option;
    for (var i = 0, l = el.options.length; i < l; i++) {
        option = el.options[i];
        if (isMultiple) {
            selected = looseIndexOf(value, getValue(option)) > -1;
            if (option.selected !== selected) {
                option.selected = selected;
            }
        }
        else {
            if (looseEqual(getValue(option), value)) {
                if (el.selectedIndex !== i) {
                    el.selectedIndex = i;
                }
                return;
            }
        }
    }
    if (!isMultiple) {
        el.selectedIndex = -1;
    }
}
function hasNoMatchingOption(value, options) {
    return options.every(function (o) { return !looseEqual(o, value); });
}
function getValue(option) {
    return '_value' in option ? option._value : option.value;
}
function onCompositionStart(e) {
    e.target.composing = true;
}
function onCompositionEnd(e) {
    // prevent triggering an input event for no reason
    if (!e.target.composing)
        return;
    e.target.composing = false;
    trigger(e.target, 'input');
}
function trigger(el, type) {
    var e = document.createEvent('HTMLEvents');
    e.initEvent(type, true, true);
    el.dispatchEvent(e);
}

// recursively search for possible transition defined inside the component root
function locateNode(vnode) {
    // @ts-expect-error
    return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
        ? locateNode(vnode.componentInstance._vnode)
        : vnode;
}
var show = {
    bind: function (el, _a, vnode) {
        var value = _a.value;
        vnode = locateNode(vnode);
        var transition = vnode.data && vnode.data.transition;
        var originalDisplay = (el.__vOriginalDisplay =
            el.style.display === 'none' ? '' : el.style.display);
        if (value && transition) {
            vnode.data.show = true;
            enter(vnode, function () {
                el.style.display = originalDisplay;
            });
        }
        else {
            el.style.display = value ? originalDisplay : 'none';
        }
    },
    update: function (el, _a, vnode) {
        var value = _a.value, oldValue = _a.oldValue;
        /* istanbul ignore if */
        if (!value === !oldValue)
            return;
        vnode = locateNode(vnode);
        var transition = vnode.data && vnode.data.transition;
        if (transition) {
            vnode.data.show = true;
            if (value) {
                enter(vnode, function () {
                    el.style.display = el.__vOriginalDisplay;
                });
            }
            else {
                leave(vnode, function () {
                    el.style.display = 'none';
                });
            }
        }
        else {
            el.style.display = value ? el.__vOriginalDisplay : 'none';
        }
    },
    unbind: function (el, binding, vnode, oldVnode, isDestroy) {
        if (!isDestroy) {
            el.style.display = el.__vOriginalDisplay;
        }
    }
};

var platformDirectives = {
    model: directive,
    show: show
};

// Provides transition support for a single element/component.
var transitionProps = {
    name: String,
    appear: Boolean,
    css: Boolean,
    mode: String,
    type: String,
    enterClass: String,
    leaveClass: String,
    enterToClass: String,
    leaveToClass: String,
    enterActiveClass: String,
    leaveActiveClass: String,
    appearClass: String,
    appearActiveClass: String,
    appearToClass: String,
    duration: [Number, String, Object]
};
// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild(vnode) {
    var compOptions = vnode && vnode.componentOptions;
    if (compOptions && compOptions.Ctor.options.abstract) {
        return getRealChild(getFirstComponentChild(compOptions.children));
    }
    else {
        return vnode;
    }
}
function extractTransitionData(comp) {
    var data = {};
    var options = comp.$options;
    // props
    for (var key in options.propsData) {
        data[key] = comp[key];
    }
    // events.
    // extract listeners and pass them directly to the transition methods
    var listeners = options._parentListeners;
    for (var key in listeners) {
        data[camelize(key)] = listeners[key];
    }
    return data;
}
function placeholder(h, rawChild) {
    // @ts-expect-error
    if (/\d-keep-alive$/.test(rawChild.tag)) {
        return h('keep-alive', {
            props: rawChild.componentOptions.propsData
        });
    }
}
function hasParentTransition(vnode) {
    while ((vnode = vnode.parent)) {
        if (vnode.data.transition) {
            return true;
        }
    }
}
function isSameChild(child, oldChild) {
    return oldChild.key === child.key && oldChild.tag === child.tag;
}
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
var isVShowDirective = function (d) { return d.name === 'show'; };
var Transition = {
    name: 'transition',
    props: transitionProps,
    abstract: true,
    render: function (h) {
        var _this = this;
        var children = this.$slots.default;
        if (!children) {
            return;
        }
        // filter out text nodes (possible whitespaces)
        children = children.filter(isNotTextNode);
        /* istanbul ignore if */
        if (!children.length) {
            return;
        }
        // warn multiple elements
        if ( true && children.length > 1) {
            warn('<transition> can only be used on a single element. Use ' +
                '<transition-group> for lists.', this.$parent);
        }
        var mode = this.mode;
        // warn invalid mode
        if ( true && mode && mode !== 'in-out' && mode !== 'out-in') {
            warn('invalid <transition> mode: ' + mode, this.$parent);
        }
        var rawChild = children[0];
        // if this is a component root node and the component's
        // parent container node also has transition, skip.
        if (hasParentTransition(this.$vnode)) {
            return rawChild;
        }
        // apply transition data to child
        // use getRealChild() to ignore abstract components e.g. keep-alive
        var child = getRealChild(rawChild);
        /* istanbul ignore if */
        if (!child) {
            return rawChild;
        }
        if (this._leaving) {
            return placeholder(h, rawChild);
        }
        // ensure a key that is unique to the vnode type and to this transition
        // component instance. This key will be used to remove pending leaving nodes
        // during entering.
        var id = "__transition-".concat(this._uid, "-");
        child.key =
            child.key == null
                ? child.isComment
                    ? id + 'comment'
                    : id + child.tag
                : isPrimitive(child.key)
                    ? String(child.key).indexOf(id) === 0
                        ? child.key
                        : id + child.key
                    : child.key;
        var data = ((child.data || (child.data = {})).transition =
            extractTransitionData(this));
        var oldRawChild = this._vnode;
        var oldChild = getRealChild(oldRawChild);
        // mark v-show
        // so that the transition module can hand over the control to the directive
        if (child.data.directives && child.data.directives.some(isVShowDirective)) {
            child.data.show = true;
        }
        if (oldChild &&
            oldChild.data &&
            !isSameChild(child, oldChild) &&
            !isAsyncPlaceholder(oldChild) &&
            // #6687 component root is a comment node
            !(oldChild.componentInstance &&
                oldChild.componentInstance._vnode.isComment)) {
            // replace old child transition data with fresh one
            // important for dynamic transitions!
            var oldData = (oldChild.data.transition = extend({}, data));
            // handle transition mode
            if (mode === 'out-in') {
                // return placeholder node and queue update when leave finishes
                this._leaving = true;
                mergeVNodeHook(oldData, 'afterLeave', function () {
                    _this._leaving = false;
                    _this.$forceUpdate();
                });
                return placeholder(h, rawChild);
            }
            else if (mode === 'in-out') {
                if (isAsyncPlaceholder(child)) {
                    return oldRawChild;
                }
                var delayedLeave_1;
                var performLeave = function () {
                    delayedLeave_1();
                };
                mergeVNodeHook(data, 'afterEnter', performLeave);
                mergeVNodeHook(data, 'enterCancelled', performLeave);
                mergeVNodeHook(oldData, 'delayLeave', function (leave) {
                    delayedLeave_1 = leave;
                });
            }
        }
        return rawChild;
    }
};

// Provides transition support for list items.
var props = extend({
    tag: String,
    moveClass: String
}, transitionProps);
delete props.mode;
var TransitionGroup = {
    props: props,
    beforeMount: function () {
        var _this = this;
        var update = this._update;
        this._update = function (vnode, hydrating) {
            var restoreActiveInstance = setActiveInstance(_this);
            // force removing pass
            _this.__patch__(_this._vnode, _this.kept, false, // hydrating
            true // removeOnly (!important, avoids unnecessary moves)
            );
            _this._vnode = _this.kept;
            restoreActiveInstance();
            update.call(_this, vnode, hydrating);
        };
    },
    render: function (h) {
        var tag = this.tag || this.$vnode.data.tag || 'span';
        var map = Object.create(null);
        var prevChildren = (this.prevChildren = this.children);
        var rawChildren = this.$slots.default || [];
        var children = (this.children = []);
        var transitionData = extractTransitionData(this);
        for (var i = 0; i < rawChildren.length; i++) {
            var c = rawChildren[i];
            if (c.tag) {
                if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
                    children.push(c);
                    map[c.key] = c;
                    (c.data || (c.data = {})).transition = transitionData;
                }
                else if (true) {
                    var opts = c.componentOptions;
                    var name_1 = opts
                        ? getComponentName(opts.Ctor.options) || opts.tag || ''
                        : c.tag;
                    warn("<transition-group> children must be keyed: <".concat(name_1, ">"));
                }
            }
        }
        if (prevChildren) {
            var kept = [];
            var removed = [];
            for (var i = 0; i < prevChildren.length; i++) {
                var c = prevChildren[i];
                c.data.transition = transitionData;
                // @ts-expect-error .getBoundingClientRect is not typed in Node
                c.data.pos = c.elm.getBoundingClientRect();
                if (map[c.key]) {
                    kept.push(c);
                }
                else {
                    removed.push(c);
                }
            }
            this.kept = h(tag, null, kept);
            this.removed = removed;
        }
        return h(tag, null, children);
    },
    updated: function () {
        var children = this.prevChildren;
        var moveClass = this.moveClass || (this.name || 'v') + '-move';
        if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
            return;
        }
        // we divide the work into three loops to avoid mixing DOM reads and writes
        // in each iteration - which helps prevent layout thrashing.
        children.forEach(callPendingCbs);
        children.forEach(recordPosition);
        children.forEach(applyTranslation);
        // force reflow to put everything in position
        // assign to this to avoid being removed in tree-shaking
        // $flow-disable-line
        this._reflow = document.body.offsetHeight;
        children.forEach(function (c) {
            if (c.data.moved) {
                var el_1 = c.elm;
                var s = el_1.style;
                addTransitionClass(el_1, moveClass);
                s.transform = s.WebkitTransform = s.transitionDuration = '';
                el_1.addEventListener(transitionEndEvent, (el_1._moveCb = function cb(e) {
                    if (e && e.target !== el_1) {
                        return;
                    }
                    if (!e || /transform$/.test(e.propertyName)) {
                        el_1.removeEventListener(transitionEndEvent, cb);
                        el_1._moveCb = null;
                        removeTransitionClass(el_1, moveClass);
                    }
                }));
            }
        });
    },
    methods: {
        hasMove: function (el, moveClass) {
            /* istanbul ignore if */
            if (!hasTransition) {
                return false;
            }
            /* istanbul ignore if */
            if (this._hasMove) {
                return this._hasMove;
            }
            // Detect whether an element with the move class applied has
            // CSS transitions. Since the element may be inside an entering
            // transition at this very moment, we make a clone of it and remove
            // all other transition classes applied to ensure only the move class
            // is applied.
            var clone = el.cloneNode();
            if (el._transitionClasses) {
                el._transitionClasses.forEach(function (cls) {
                    removeClass(clone, cls);
                });
            }
            addClass(clone, moveClass);
            clone.style.display = 'none';
            this.$el.appendChild(clone);
            var info = getTransitionInfo(clone);
            this.$el.removeChild(clone);
            return (this._hasMove = info.hasTransform);
        }
    }
};
function callPendingCbs(c) {
    /* istanbul ignore if */
    if (c.elm._moveCb) {
        c.elm._moveCb();
    }
    /* istanbul ignore if */
    if (c.elm._enterCb) {
        c.elm._enterCb();
    }
}
function recordPosition(c) {
    c.data.newPos = c.elm.getBoundingClientRect();
}
function applyTranslation(c) {
    var oldPos = c.data.pos;
    var newPos = c.data.newPos;
    var dx = oldPos.left - newPos.left;
    var dy = oldPos.top - newPos.top;
    if (dx || dy) {
        c.data.moved = true;
        var s = c.elm.style;
        s.transform = s.WebkitTransform = "translate(".concat(dx, "px,").concat(dy, "px)");
        s.transitionDuration = '0s';
    }
}

var platformComponents = {
    Transition: Transition,
    TransitionGroup: TransitionGroup
};

// install platform specific utils
Vue.config.mustUseProp = mustUseProp;
Vue.config.isReservedTag = isReservedTag;
Vue.config.isReservedAttr = isReservedAttr;
Vue.config.getTagNamespace = getTagNamespace;
Vue.config.isUnknownElement = isUnknownElement;
// install platform runtime directives & components
extend(Vue.options.directives, platformDirectives);
extend(Vue.options.components, platformComponents);
// install platform patch function
Vue.prototype.__patch__ = inBrowser ? patch : noop;
// public mount method
Vue.prototype.$mount = function (el, hydrating) {
    el = el && inBrowser ? query(el) : undefined;
    return mountComponent(this, el, hydrating);
};
// devtools global hook
/* istanbul ignore next */
if (inBrowser) {
    setTimeout(function () {
        if (config.devtools) {
            if (devtools) {
                devtools.emit('init', Vue);
            }
            else if (true) {
                // @ts-expect-error
                console[console.info ? 'info' : 'log']('Download the Vue Devtools extension for a better development experience:\n' +
                    'https://github.com/vuejs/vue-devtools');
            }
        }
        if ( true &&
            config.productionTip !== false &&
            typeof console !== 'undefined') {
            // @ts-expect-error
            console[console.info ? 'info' : 'log']("You are running Vue in development mode.\n" +
                "Make sure to turn on production mode when deploying for production.\n" +
                "See more tips at https://vuejs.org/guide/deployment.html");
        }
    }, 0);
}




/***/ }),

/***/ "./node_modules/vuex/dist/vuex.esm.js":
/*!********************************************!*\
  !*** ./node_modules/vuex/dist/vuex.esm.js ***!
  \********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   Store: () => (/* binding */ Store),
/* harmony export */   createLogger: () => (/* binding */ createLogger),
/* harmony export */   createNamespacedHelpers: () => (/* binding */ createNamespacedHelpers),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__),
/* harmony export */   install: () => (/* binding */ install),
/* harmony export */   mapActions: () => (/* binding */ mapActions),
/* harmony export */   mapGetters: () => (/* binding */ mapGetters),
/* harmony export */   mapMutations: () => (/* binding */ mapMutations),
/* harmony export */   mapState: () => (/* binding */ mapState)
/* harmony export */ });
/*!
 * vuex v3.6.2
 * (c) 2021 Evan You
 * @license MIT
 */
function applyMixin (Vue) {
  var version = Number(Vue.version.split('.')[0]);

  if (version >= 2) {
    Vue.mixin({ beforeCreate: vuexInit });
  } else {
    // override init and inject vuex init procedure
    // for 1.x backwards compatibility.
    var _init = Vue.prototype._init;
    Vue.prototype._init = function (options) {
      if ( options === void 0 ) options = {};

      options.init = options.init
        ? [vuexInit].concat(options.init)
        : vuexInit;
      _init.call(this, options);
    };
  }

  /**
   * Vuex init hook, injected into each instances init hooks list.
   */

  function vuexInit () {
    var options = this.$options;
    // store injection
    if (options.store) {
      this.$store = typeof options.store === 'function'
        ? options.store()
        : options.store;
    } else if (options.parent && options.parent.$store) {
      this.$store = options.parent.$store;
    }
  }
}

var target = typeof window !== 'undefined'
  ? window
  : typeof __webpack_require__.g !== 'undefined'
    ? __webpack_require__.g
    : {};
var devtoolHook = target.__VUE_DEVTOOLS_GLOBAL_HOOK__;

function devtoolPlugin (store) {
  if (!devtoolHook) { return }

  store._devtoolHook = devtoolHook;

  devtoolHook.emit('vuex:init', store);

  devtoolHook.on('vuex:travel-to-state', function (targetState) {
    store.replaceState(targetState);
  });

  store.subscribe(function (mutation, state) {
    devtoolHook.emit('vuex:mutation', mutation, state);
  }, { prepend: true });

  store.subscribeAction(function (action, state) {
    devtoolHook.emit('vuex:action', action, state);
  }, { prepend: true });
}

/**
 * Get the first item that pass the test
 * by second argument function
 *
 * @param {Array} list
 * @param {Function} f
 * @return {*}
 */
function find (list, f) {
  return list.filter(f)[0]
}

/**
 * Deep copy the given object considering circular structure.
 * This function caches all nested objects and its copies.
 * If it detects circular structure, use cached copy to avoid infinite loop.
 *
 * @param {*} obj
 * @param {Array<Object>} cache
 * @return {*}
 */
function deepCopy (obj, cache) {
  if ( cache === void 0 ) cache = [];

  // just return if obj is immutable value
  if (obj === null || typeof obj !== 'object') {
    return obj
  }

  // if obj is hit, it is in circular structure
  var hit = find(cache, function (c) { return c.original === obj; });
  if (hit) {
    return hit.copy
  }

  var copy = Array.isArray(obj) ? [] : {};
  // put the copy into cache at first
  // because we want to refer it in recursive deepCopy
  cache.push({
    original: obj,
    copy: copy
  });

  Object.keys(obj).forEach(function (key) {
    copy[key] = deepCopy(obj[key], cache);
  });

  return copy
}

/**
 * forEach for object
 */
function forEachValue (obj, fn) {
  Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
}

function isObject (obj) {
  return obj !== null && typeof obj === 'object'
}

function isPromise (val) {
  return val && typeof val.then === 'function'
}

function assert (condition, msg) {
  if (!condition) { throw new Error(("[vuex] " + msg)) }
}

function partial (fn, arg) {
  return function () {
    return fn(arg)
  }
}

// Base data struct for store's module, package with some attribute and method
var Module = function Module (rawModule, runtime) {
  this.runtime = runtime;
  // Store some children item
  this._children = Object.create(null);
  // Store the origin module object which passed by programmer
  this._rawModule = rawModule;
  var rawState = rawModule.state;

  // Store the origin module's state
  this.state = (typeof rawState === 'function' ? rawState() : rawState) || {};
};

var prototypeAccessors = { namespaced: { configurable: true } };

prototypeAccessors.namespaced.get = function () {
  return !!this._rawModule.namespaced
};

Module.prototype.addChild = function addChild (key, module) {
  this._children[key] = module;
};

Module.prototype.removeChild = function removeChild (key) {
  delete this._children[key];
};

Module.prototype.getChild = function getChild (key) {
  return this._children[key]
};

Module.prototype.hasChild = function hasChild (key) {
  return key in this._children
};

Module.prototype.update = function update (rawModule) {
  this._rawModule.namespaced = rawModule.namespaced;
  if (rawModule.actions) {
    this._rawModule.actions = rawModule.actions;
  }
  if (rawModule.mutations) {
    this._rawModule.mutations = rawModule.mutations;
  }
  if (rawModule.getters) {
    this._rawModule.getters = rawModule.getters;
  }
};

Module.prototype.forEachChild = function forEachChild (fn) {
  forEachValue(this._children, fn);
};

Module.prototype.forEachGetter = function forEachGetter (fn) {
  if (this._rawModule.getters) {
    forEachValue(this._rawModule.getters, fn);
  }
};

Module.prototype.forEachAction = function forEachAction (fn) {
  if (this._rawModule.actions) {
    forEachValue(this._rawModule.actions, fn);
  }
};

Module.prototype.forEachMutation = function forEachMutation (fn) {
  if (this._rawModule.mutations) {
    forEachValue(this._rawModule.mutations, fn);
  }
};

Object.defineProperties( Module.prototype, prototypeAccessors );

var ModuleCollection = function ModuleCollection (rawRootModule) {
  // register root module (Vuex.Store options)
  this.register([], rawRootModule, false);
};

ModuleCollection.prototype.get = function get (path) {
  return path.reduce(function (module, key) {
    return module.getChild(key)
  }, this.root)
};

ModuleCollection.prototype.getNamespace = function getNamespace (path) {
  var module = this.root;
  return path.reduce(function (namespace, key) {
    module = module.getChild(key);
    return namespace + (module.namespaced ? key + '/' : '')
  }, '')
};

ModuleCollection.prototype.update = function update$1 (rawRootModule) {
  update([], this.root, rawRootModule);
};

ModuleCollection.prototype.register = function register (path, rawModule, runtime) {
    var this$1 = this;
    if ( runtime === void 0 ) runtime = true;

  if ((true)) {
    assertRawModule(path, rawModule);
  }

  var newModule = new Module(rawModule, runtime);
  if (path.length === 0) {
    this.root = newModule;
  } else {
    var parent = this.get(path.slice(0, -1));
    parent.addChild(path[path.length - 1], newModule);
  }

  // register nested modules
  if (rawModule.modules) {
    forEachValue(rawModule.modules, function (rawChildModule, key) {
      this$1.register(path.concat(key), rawChildModule, runtime);
    });
  }
};

ModuleCollection.prototype.unregister = function unregister (path) {
  var parent = this.get(path.slice(0, -1));
  var key = path[path.length - 1];
  var child = parent.getChild(key);

  if (!child) {
    if ((true)) {
      console.warn(
        "[vuex] trying to unregister module '" + key + "', which is " +
        "not registered"
      );
    }
    return
  }

  if (!child.runtime) {
    return
  }

  parent.removeChild(key);
};

ModuleCollection.prototype.isRegistered = function isRegistered (path) {
  var parent = this.get(path.slice(0, -1));
  var key = path[path.length - 1];

  if (parent) {
    return parent.hasChild(key)
  }

  return false
};

function update (path, targetModule, newModule) {
  if ((true)) {
    assertRawModule(path, newModule);
  }

  // update target module
  targetModule.update(newModule);

  // update nested modules
  if (newModule.modules) {
    for (var key in newModule.modules) {
      if (!targetModule.getChild(key)) {
        if ((true)) {
          console.warn(
            "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
            'manual reload is needed'
          );
        }
        return
      }
      update(
        path.concat(key),
        targetModule.getChild(key),
        newModule.modules[key]
      );
    }
  }
}

var functionAssert = {
  assert: function (value) { return typeof value === 'function'; },
  expected: 'function'
};

var objectAssert = {
  assert: function (value) { return typeof value === 'function' ||
    (typeof value === 'object' && typeof value.handler === 'function'); },
  expected: 'function or object with "handler" function'
};

var assertTypes = {
  getters: functionAssert,
  mutations: functionAssert,
  actions: objectAssert
};

function assertRawModule (path, rawModule) {
  Object.keys(assertTypes).forEach(function (key) {
    if (!rawModule[key]) { return }

    var assertOptions = assertTypes[key];

    forEachValue(rawModule[key], function (value, type) {
      assert(
        assertOptions.assert(value),
        makeAssertionMessage(path, key, type, value, assertOptions.expected)
      );
    });
  });
}

function makeAssertionMessage (path, key, type, value, expected) {
  var buf = key + " should be " + expected + " but \"" + key + "." + type + "\"";
  if (path.length > 0) {
    buf += " in module \"" + (path.join('.')) + "\"";
  }
  buf += " is " + (JSON.stringify(value)) + ".";
  return buf
}

var Vue; // bind on install

var Store = function Store (options) {
  var this$1 = this;
  if ( options === void 0 ) options = {};

  // Auto install if it is not done yet and `window` has `Vue`.
  // To allow users to avoid auto-installation in some cases,
  // this code should be placed here. See #731
  if (!Vue && typeof window !== 'undefined' && window.Vue) {
    install(window.Vue);
  }

  if ((true)) {
    assert(Vue, "must call Vue.use(Vuex) before creating a store instance.");
    assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.");
    assert(this instanceof Store, "store must be called with the new operator.");
  }

  var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
  var strict = options.strict; if ( strict === void 0 ) strict = false;

  // store internal state
  this._committing = false;
  this._actions = Object.create(null);
  this._actionSubscribers = [];
  this._mutations = Object.create(null);
  this._wrappedGetters = Object.create(null);
  this._modules = new ModuleCollection(options);
  this._modulesNamespaceMap = Object.create(null);
  this._subscribers = [];
  this._watcherVM = new Vue();
  this._makeLocalGettersCache = Object.create(null);

  // bind commit and dispatch to self
  var store = this;
  var ref = this;
  var dispatch = ref.dispatch;
  var commit = ref.commit;
  this.dispatch = function boundDispatch (type, payload) {
    return dispatch.call(store, type, payload)
  };
  this.commit = function boundCommit (type, payload, options) {
    return commit.call(store, type, payload, options)
  };

  // strict mode
  this.strict = strict;

  var state = this._modules.root.state;

  // init root module.
  // this also recursively registers all sub-modules
  // and collects all module getters inside this._wrappedGetters
  installModule(this, state, [], this._modules.root);

  // initialize the store vm, which is responsible for the reactivity
  // (also registers _wrappedGetters as computed properties)
  resetStoreVM(this, state);

  // apply plugins
  plugins.forEach(function (plugin) { return plugin(this$1); });

  var useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools;
  if (useDevtools) {
    devtoolPlugin(this);
  }
};

var prototypeAccessors$1 = { state: { configurable: true } };

prototypeAccessors$1.state.get = function () {
  return this._vm._data.$$state
};

prototypeAccessors$1.state.set = function (v) {
  if ((true)) {
    assert(false, "use store.replaceState() to explicit replace store state.");
  }
};

Store.prototype.commit = function commit (_type, _payload, _options) {
    var this$1 = this;

  // check object-style commit
  var ref = unifyObjectStyle(_type, _payload, _options);
    var type = ref.type;
    var payload = ref.payload;
    var options = ref.options;

  var mutation = { type: type, payload: payload };
  var entry = this._mutations[type];
  if (!entry) {
    if ((true)) {
      console.error(("[vuex] unknown mutation type: " + type));
    }
    return
  }
  this._withCommit(function () {
    entry.forEach(function commitIterator (handler) {
      handler(payload);
    });
  });

  this._subscribers
    .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
    .forEach(function (sub) { return sub(mutation, this$1.state); });

  if (
    ( true) &&
    options && options.silent
  ) {
    console.warn(
      "[vuex] mutation type: " + type + ". Silent option has been removed. " +
      'Use the filter functionality in the vue-devtools'
    );
  }
};

Store.prototype.dispatch = function dispatch (_type, _payload) {
    var this$1 = this;

  // check object-style dispatch
  var ref = unifyObjectStyle(_type, _payload);
    var type = ref.type;
    var payload = ref.payload;

  var action = { type: type, payload: payload };
  var entry = this._actions[type];
  if (!entry) {
    if ((true)) {
      console.error(("[vuex] unknown action type: " + type));
    }
    return
  }

  try {
    this._actionSubscribers
      .slice() // shallow copy to prevent iterator invalidation if subscriber synchronously calls unsubscribe
      .filter(function (sub) { return sub.before; })
      .forEach(function (sub) { return sub.before(action, this$1.state); });
  } catch (e) {
    if ((true)) {
      console.warn("[vuex] error in before action subscribers: ");
      console.error(e);
    }
  }

  var result = entry.length > 1
    ? Promise.all(entry.map(function (handler) { return handler(payload); }))
    : entry[0](payload);

  return new Promise(function (resolve, reject) {
    result.then(function (res) {
      try {
        this$1._actionSubscribers
          .filter(function (sub) { return sub.after; })
          .forEach(function (sub) { return sub.after(action, this$1.state); });
      } catch (e) {
        if ((true)) {
          console.warn("[vuex] error in after action subscribers: ");
          console.error(e);
        }
      }
      resolve(res);
    }, function (error) {
      try {
        this$1._actionSubscribers
          .filter(function (sub) { return sub.error; })
          .forEach(function (sub) { return sub.error(action, this$1.state, error); });
      } catch (e) {
        if ((true)) {
          console.warn("[vuex] error in error action subscribers: ");
          console.error(e);
        }
      }
      reject(error);
    });
  })
};

Store.prototype.subscribe = function subscribe (fn, options) {
  return genericSubscribe(fn, this._subscribers, options)
};

Store.prototype.subscribeAction = function subscribeAction (fn, options) {
  var subs = typeof fn === 'function' ? { before: fn } : fn;
  return genericSubscribe(subs, this._actionSubscribers, options)
};

Store.prototype.watch = function watch (getter, cb, options) {
    var this$1 = this;

  if ((true)) {
    assert(typeof getter === 'function', "store.watch only accepts a function.");
  }
  return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options)
};

Store.prototype.replaceState = function replaceState (state) {
    var this$1 = this;

  this._withCommit(function () {
    this$1._vm._data.$$state = state;
  });
};

Store.prototype.registerModule = function registerModule (path, rawModule, options) {
    if ( options === void 0 ) options = {};

  if (typeof path === 'string') { path = [path]; }

  if ((true)) {
    assert(Array.isArray(path), "module path must be a string or an Array.");
    assert(path.length > 0, 'cannot register the root module by using registerModule.');
  }

  this._modules.register(path, rawModule);
  installModule(this, this.state, path, this._modules.get(path), options.preserveState);
  // reset store to update getters...
  resetStoreVM(this, this.state);
};

Store.prototype.unregisterModule = function unregisterModule (path) {
    var this$1 = this;

  if (typeof path === 'string') { path = [path]; }

  if ((true)) {
    assert(Array.isArray(path), "module path must be a string or an Array.");
  }

  this._modules.unregister(path);
  this._withCommit(function () {
    var parentState = getNestedState(this$1.state, path.slice(0, -1));
    Vue.delete(parentState, path[path.length - 1]);
  });
  resetStore(this);
};

Store.prototype.hasModule = function hasModule (path) {
  if (typeof path === 'string') { path = [path]; }

  if ((true)) {
    assert(Array.isArray(path), "module path must be a string or an Array.");
  }

  return this._modules.isRegistered(path)
};

Store.prototype.hotUpdate = function hotUpdate (newOptions) {
  this._modules.update(newOptions);
  resetStore(this, true);
};

Store.prototype._withCommit = function _withCommit (fn) {
  var committing = this._committing;
  this._committing = true;
  fn();
  this._committing = committing;
};

Object.defineProperties( Store.prototype, prototypeAccessors$1 );

function genericSubscribe (fn, subs, options) {
  if (subs.indexOf(fn) < 0) {
    options && options.prepend
      ? subs.unshift(fn)
      : subs.push(fn);
  }
  return function () {
    var i = subs.indexOf(fn);
    if (i > -1) {
      subs.splice(i, 1);
    }
  }
}

function resetStore (store, hot) {
  store._actions = Object.create(null);
  store._mutations = Object.create(null);
  store._wrappedGetters = Object.create(null);
  store._modulesNamespaceMap = Object.create(null);
  var state = store.state;
  // init all modules
  installModule(store, state, [], store._modules.root, true);
  // reset vm
  resetStoreVM(store, state, hot);
}

function resetStoreVM (store, state, hot) {
  var oldVm = store._vm;

  // bind store public getters
  store.getters = {};
  // reset local getters cache
  store._makeLocalGettersCache = Object.create(null);
  var wrappedGetters = store._wrappedGetters;
  var computed = {};
  forEachValue(wrappedGetters, function (fn, key) {
    // use computed to leverage its lazy-caching mechanism
    // direct inline function use will lead to closure preserving oldVm.
    // using partial to return function with only arguments preserved in closure environment.
    computed[key] = partial(fn, store);
    Object.defineProperty(store.getters, key, {
      get: function () { return store._vm[key]; },
      enumerable: true // for local getters
    });
  });

  // use a Vue instance to store the state tree
  // suppress warnings just in case the user has added
  // some funky global mixins
  var silent = Vue.config.silent;
  Vue.config.silent = true;
  store._vm = new Vue({
    data: {
      $$state: state
    },
    computed: computed
  });
  Vue.config.silent = silent;

  // enable strict mode for new vm
  if (store.strict) {
    enableStrictMode(store);
  }

  if (oldVm) {
    if (hot) {
      // dispatch changes in all subscribed watchers
      // to force getter re-evaluation for hot reloading.
      store._withCommit(function () {
        oldVm._data.$$state = null;
      });
    }
    Vue.nextTick(function () { return oldVm.$destroy(); });
  }
}

function installModule (store, rootState, path, module, hot) {
  var isRoot = !path.length;
  var namespace = store._modules.getNamespace(path);

  // register in namespace map
  if (module.namespaced) {
    if (store._modulesNamespaceMap[namespace] && ("development" !== 'production')) {
      console.error(("[vuex] duplicate namespace " + namespace + " for the namespaced module " + (path.join('/'))));
    }
    store._modulesNamespaceMap[namespace] = module;
  }

  // set state
  if (!isRoot && !hot) {
    var parentState = getNestedState(rootState, path.slice(0, -1));
    var moduleName = path[path.length - 1];
    store._withCommit(function () {
      if ((true)) {
        if (moduleName in parentState) {
          console.warn(
            ("[vuex] state field \"" + moduleName + "\" was overridden by a module with the same name at \"" + (path.join('.')) + "\"")
          );
        }
      }
      Vue.set(parentState, moduleName, module.state);
    });
  }

  var local = module.context = makeLocalContext(store, namespace, path);

  module.forEachMutation(function (mutation, key) {
    var namespacedType = namespace + key;
    registerMutation(store, namespacedType, mutation, local);
  });

  module.forEachAction(function (action, key) {
    var type = action.root ? key : namespace + key;
    var handler = action.handler || action;
    registerAction(store, type, handler, local);
  });

  module.forEachGetter(function (getter, key) {
    var namespacedType = namespace + key;
    registerGetter(store, namespacedType, getter, local);
  });

  module.forEachChild(function (child, key) {
    installModule(store, rootState, path.concat(key), child, hot);
  });
}

/**
 * make localized dispatch, commit, getters and state
 * if there is no namespace, just use root ones
 */
function makeLocalContext (store, namespace, path) {
  var noNamespace = namespace === '';

  var local = {
    dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) {
      var args = unifyObjectStyle(_type, _payload, _options);
      var payload = args.payload;
      var options = args.options;
      var type = args.type;

      if (!options || !options.root) {
        type = namespace + type;
        if (( true) && !store._actions[type]) {
          console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
          return
        }
      }

      return store.dispatch(type, payload)
    },

    commit: noNamespace ? store.commit : function (_type, _payload, _options) {
      var args = unifyObjectStyle(_type, _payload, _options);
      var payload = args.payload;
      var options = args.options;
      var type = args.type;

      if (!options || !options.root) {
        type = namespace + type;
        if (( true) && !store._mutations[type]) {
          console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
          return
        }
      }

      store.commit(type, payload, options);
    }
  };

  // getters and state object must be gotten lazily
  // because they will be changed by vm update
  Object.defineProperties(local, {
    getters: {
      get: noNamespace
        ? function () { return store.getters; }
        : function () { return makeLocalGetters(store, namespace); }
    },
    state: {
      get: function () { return getNestedState(store.state, path); }
    }
  });

  return local
}

function makeLocalGetters (store, namespace) {
  if (!store._makeLocalGettersCache[namespace]) {
    var gettersProxy = {};
    var splitPos = namespace.length;
    Object.keys(store.getters).forEach(function (type) {
      // skip if the target getter is not match this namespace
      if (type.slice(0, splitPos) !== namespace) { return }

      // extract local getter type
      var localType = type.slice(splitPos);

      // Add a port to the getters proxy.
      // Define as getter property because
      // we do not want to evaluate the getters in this time.
      Object.defineProperty(gettersProxy, localType, {
        get: function () { return store.getters[type]; },
        enumerable: true
      });
    });
    store._makeLocalGettersCache[namespace] = gettersProxy;
  }

  return store._makeLocalGettersCache[namespace]
}

function registerMutation (store, type, handler, local) {
  var entry = store._mutations[type] || (store._mutations[type] = []);
  entry.push(function wrappedMutationHandler (payload) {
    handler.call(store, local.state, payload);
  });
}

function registerAction (store, type, handler, local) {
  var entry = store._actions[type] || (store._actions[type] = []);
  entry.push(function wrappedActionHandler (payload) {
    var res = handler.call(store, {
      dispatch: local.dispatch,
      commit: local.commit,
      getters: local.getters,
      state: local.state,
      rootGetters: store.getters,
      rootState: store.state
    }, payload);
    if (!isPromise(res)) {
      res = Promise.resolve(res);
    }
    if (store._devtoolHook) {
      return res.catch(function (err) {
        store._devtoolHook.emit('vuex:error', err);
        throw err
      })
    } else {
      return res
    }
  });
}

function registerGetter (store, type, rawGetter, local) {
  if (store._wrappedGetters[type]) {
    if ((true)) {
      console.error(("[vuex] duplicate getter key: " + type));
    }
    return
  }
  store._wrappedGetters[type] = function wrappedGetter (store) {
    return rawGetter(
      local.state, // local state
      local.getters, // local getters
      store.state, // root state
      store.getters // root getters
    )
  };
}

function enableStrictMode (store) {
  store._vm.$watch(function () { return this._data.$$state }, function () {
    if ((true)) {
      assert(store._committing, "do not mutate vuex store state outside mutation handlers.");
    }
  }, { deep: true, sync: true });
}

function getNestedState (state, path) {
  return path.reduce(function (state, key) { return state[key]; }, state)
}

function unifyObjectStyle (type, payload, options) {
  if (isObject(type) && type.type) {
    options = payload;
    payload = type;
    type = type.type;
  }

  if ((true)) {
    assert(typeof type === 'string', ("expects string as the type, but found " + (typeof type) + "."));
  }

  return { type: type, payload: payload, options: options }
}

function install (_Vue) {
  if (Vue && _Vue === Vue) {
    if ((true)) {
      console.error(
        '[vuex] already installed. Vue.use(Vuex) should be called only once.'
      );
    }
    return
  }
  Vue = _Vue;
  applyMixin(Vue);
}

/**
 * Reduce the code which written in Vue.js for getting the state.
 * @param {String} [namespace] - Module's namespace
 * @param {Object|Array} states # Object's item can be a function which accept state and getters for param, you can do something for state and getters in it.
 * @param {Object}
 */
var mapState = normalizeNamespace(function (namespace, states) {
  var res = {};
  if (( true) && !isValidMap(states)) {
    console.error('[vuex] mapState: mapper parameter must be either an Array or an Object');
  }
  normalizeMap(states).forEach(function (ref) {
    var key = ref.key;
    var val = ref.val;

    res[key] = function mappedState () {
      var state = this.$store.state;
      var getters = this.$store.getters;
      if (namespace) {
        var module = getModuleByNamespace(this.$store, 'mapState', namespace);
        if (!module) {
          return
        }
        state = module.context.state;
        getters = module.context.getters;
      }
      return typeof val === 'function'
        ? val.call(this, state, getters)
        : state[val]
    };
    // mark vuex getter for devtools
    res[key].vuex = true;
  });
  return res
});

/**
 * Reduce the code which written in Vue.js for committing the mutation
 * @param {String} [namespace] - Module's namespace
 * @param {Object|Array} mutations # Object's item can be a function which accept `commit` function as the first param, it can accept another params. You can commit mutation and do any other things in this function. specially, You need to pass anthor params from the mapped function.
 * @return {Object}
 */
var mapMutations = normalizeNamespace(function (namespace, mutations) {
  var res = {};
  if (( true) && !isValidMap(mutations)) {
    console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
  }
  normalizeMap(mutations).forEach(function (ref) {
    var key = ref.key;
    var val = ref.val;

    res[key] = function mappedMutation () {
      var args = [], len = arguments.length;
      while ( len-- ) args[ len ] = arguments[ len ];

      // Get the commit method from store
      var commit = this.$store.commit;
      if (namespace) {
        var module = getModuleByNamespace(this.$store, 'mapMutations', namespace);
        if (!module) {
          return
        }
        commit = module.context.commit;
      }
      return typeof val === 'function'
        ? val.apply(this, [commit].concat(args))
        : commit.apply(this.$store, [val].concat(args))
    };
  });
  return res
});

/**
 * Reduce the code which written in Vue.js for getting the getters
 * @param {String} [namespace] - Module's namespace
 * @param {Object|Array} getters
 * @return {Object}
 */
var mapGetters = normalizeNamespace(function (namespace, getters) {
  var res = {};
  if (( true) && !isValidMap(getters)) {
    console.error('[vuex] mapGetters: mapper parameter must be either an Array or an Object');
  }
  normalizeMap(getters).forEach(function (ref) {
    var key = ref.key;
    var val = ref.val;

    // The namespace has been mutated by normalizeNamespace
    val = namespace + val;
    res[key] = function mappedGetter () {
      if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) {
        return
      }
      if (( true) && !(val in this.$store.getters)) {
        console.error(("[vuex] unknown getter: " + val));
        return
      }
      return this.$store.getters[val]
    };
    // mark vuex getter for devtools
    res[key].vuex = true;
  });
  return res
});

/**
 * Reduce the code which written in Vue.js for dispatch the action
 * @param {String} [namespace] - Module's namespace
 * @param {Object|Array} actions # Object's item can be a function which accept `dispatch` function as the first param, it can accept anthor params. You can dispatch action and do any other things in this function. specially, You need to pass anthor params from the mapped function.
 * @return {Object}
 */
var mapActions = normalizeNamespace(function (namespace, actions) {
  var res = {};
  if (( true) && !isValidMap(actions)) {
    console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
  }
  normalizeMap(actions).forEach(function (ref) {
    var key = ref.key;
    var val = ref.val;

    res[key] = function mappedAction () {
      var args = [], len = arguments.length;
      while ( len-- ) args[ len ] = arguments[ len ];

      // get dispatch function from store
      var dispatch = this.$store.dispatch;
      if (namespace) {
        var module = getModuleByNamespace(this.$store, 'mapActions', namespace);
        if (!module) {
          return
        }
        dispatch = module.context.dispatch;
      }
      return typeof val === 'function'
        ? val.apply(this, [dispatch].concat(args))
        : dispatch.apply(this.$store, [val].concat(args))
    };
  });
  return res
});

/**
 * Rebinding namespace param for mapXXX function in special scoped, and return them by simple object
 * @param {String} namespace
 * @return {Object}
 */
var createNamespacedHelpers = function (namespace) { return ({
  mapState: mapState.bind(null, namespace),
  mapGetters: mapGetters.bind(null, namespace),
  mapMutations: mapMutations.bind(null, namespace),
  mapActions: mapActions.bind(null, namespace)
}); };

/**
 * Normalize the map
 * normalizeMap([1, 2, 3]) => [ { key: 1, val: 1 }, { key: 2, val: 2 }, { key: 3, val: 3 } ]
 * normalizeMap({a: 1, b: 2, c: 3}) => [ { key: 'a', val: 1 }, { key: 'b', val: 2 }, { key: 'c', val: 3 } ]
 * @param {Array|Object} map
 * @return {Object}
 */
function normalizeMap (map) {
  if (!isValidMap(map)) {
    return []
  }
  return Array.isArray(map)
    ? map.map(function (key) { return ({ key: key, val: key }); })
    : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
}

/**
 * Validate whether given map is valid or not
 * @param {*} map
 * @return {Boolean}
 */
function isValidMap (map) {
  return Array.isArray(map) || isObject(map)
}

/**
 * Return a function expect two param contains namespace and map. it will normalize the namespace and then the param's function will handle the new namespace and the map.
 * @param {Function} fn
 * @return {Function}
 */
function normalizeNamespace (fn) {
  return function (namespace, map) {
    if (typeof namespace !== 'string') {
      map = namespace;
      namespace = '';
    } else if (namespace.charAt(namespace.length - 1) !== '/') {
      namespace += '/';
    }
    return fn(namespace, map)
  }
}

/**
 * Search a special module from store by namespace. if module not exist, print error message.
 * @param {Object} store
 * @param {String} helper
 * @param {String} namespace
 * @return {Object}
 */
function getModuleByNamespace (store, helper, namespace) {
  var module = store._modulesNamespaceMap[namespace];
  if (( true) && !module) {
    console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace));
  }
  return module
}

// Credits: borrowed code from fcomb/redux-logger

function createLogger (ref) {
  if ( ref === void 0 ) ref = {};
  var collapsed = ref.collapsed; if ( collapsed === void 0 ) collapsed = true;
  var filter = ref.filter; if ( filter === void 0 ) filter = function (mutation, stateBefore, stateAfter) { return true; };
  var transformer = ref.transformer; if ( transformer === void 0 ) transformer = function (state) { return state; };
  var mutationTransformer = ref.mutationTransformer; if ( mutationTransformer === void 0 ) mutationTransformer = function (mut) { return mut; };
  var actionFilter = ref.actionFilter; if ( actionFilter === void 0 ) actionFilter = function (action, state) { return true; };
  var actionTransformer = ref.actionTransformer; if ( actionTransformer === void 0 ) actionTransformer = function (act) { return act; };
  var logMutations = ref.logMutations; if ( logMutations === void 0 ) logMutations = true;
  var logActions = ref.logActions; if ( logActions === void 0 ) logActions = true;
  var logger = ref.logger; if ( logger === void 0 ) logger = console;

  return function (store) {
    var prevState = deepCopy(store.state);

    if (typeof logger === 'undefined') {
      return
    }

    if (logMutations) {
      store.subscribe(function (mutation, state) {
        var nextState = deepCopy(state);

        if (filter(mutation, prevState, nextState)) {
          var formattedTime = getFormattedTime();
          var formattedMutation = mutationTransformer(mutation);
          var message = "mutation " + (mutation.type) + formattedTime;

          startMessage(logger, message, collapsed);
          logger.log('%c prev state', 'color: #9E9E9E; font-weight: bold', transformer(prevState));
          logger.log('%c mutation', 'color: #03A9F4; font-weight: bold', formattedMutation);
          logger.log('%c next state', 'color: #4CAF50; font-weight: bold', transformer(nextState));
          endMessage(logger);
        }

        prevState = nextState;
      });
    }

    if (logActions) {
      store.subscribeAction(function (action, state) {
        if (actionFilter(action, state)) {
          var formattedTime = getFormattedTime();
          var formattedAction = actionTransformer(action);
          var message = "action " + (action.type) + formattedTime;

          startMessage(logger, message, collapsed);
          logger.log('%c action', 'color: #03A9F4; font-weight: bold', formattedAction);
          endMessage(logger);
        }
      });
    }
  }
}

function startMessage (logger, message, collapsed) {
  var startMessage = collapsed
    ? logger.groupCollapsed
    : logger.group;

  // render
  try {
    startMessage.call(logger, message);
  } catch (e) {
    logger.log(message);
  }
}

function endMessage (logger) {
  try {
    logger.groupEnd();
  } catch (e) {
    logger.log('—— log end ——');
  }
}

function getFormattedTime () {
  var time = new Date();
  return (" @ " + (pad(time.getHours(), 2)) + ":" + (pad(time.getMinutes(), 2)) + ":" + (pad(time.getSeconds(), 2)) + "." + (pad(time.getMilliseconds(), 3)))
}

function repeat (str, times) {
  return (new Array(times + 1)).join(str)
}

function pad (num, maxLength) {
  return repeat('0', maxLength - num.toString().length) + num
}

var index = {
  Store: Store,
  install: install,
  version: '3.6.2',
  mapState: mapState,
  mapMutations: mapMutations,
  mapGetters: mapGetters,
  mapActions: mapActions,
  createNamespacedHelpers: createNamespacedHelpers,
  createLogger: createLogger
};

/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (index);



/***/ }),

/***/ "?9157":
/*!************************!*\
  !*** crypto (ignored) ***!
  \************************/
/***/ (() => {

/* (ignored) */

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => (module['default']) :
/******/ 				() => (module);
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/global */
/******/ 	(() => {
/******/ 		__webpack_require__.g = (function() {
/******/ 			if (typeof globalThis === 'object') return globalThis;
/******/ 			try {
/******/ 				return this || new Function('return this')();
/******/ 			} catch (e) {
/******/ 				if (typeof window === 'object') return window;
/******/ 			}
/******/ 		})();
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
/*!**********************!*\
  !*** ./src/popup.ts ***!
  \**********************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.runtime.esm.js");
/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! vuex */ "./node_modules/vuex/dist/vuex.esm.js");
/* harmony import */ var vue2_dragula__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue2-dragula */ "./node_modules/vue2-dragula/dist/vue-dragula.js");
/* harmony import */ var vue2_dragula__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue2_dragula__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _components_Popup_vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/Popup.vue */ "./src/components/Popup.vue");
/* harmony import */ var _components_common_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/common/index */ "./src/components/common/index.ts");
/* harmony import */ var _store_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store/i18n */ "./src/store/i18n.ts");
/* harmony import */ var _store_Style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./store/Style */ "./src/store/Style.ts");
/* harmony import */ var _store_Accounts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./store/Accounts */ "./src/store/Accounts.ts");
/* harmony import */ var _store_Backup__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./store/Backup */ "./src/store/Backup.ts");
/* harmony import */ var _store_CurrentView__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./store/CurrentView */ "./src/store/CurrentView.ts");
/* harmony import */ var _store_Menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./store/Menu */ "./src/store/Menu.ts");
/* harmony import */ var _store_Notification__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./store/Notification */ "./src/store/Notification.ts");
/* harmony import */ var _store_Qr__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./store/Qr */ "./src/store/Qr.ts");
/* harmony import */ var _store_Advisor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./store/Advisor */ "./src/store/Advisor.ts");
/* harmony import */ var _models_backup__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./models/backup */ "./src/models/backup.ts");
/* harmony import */ var _syncTime__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./syncTime */ "./src/syncTime.ts");
/* harmony import */ var _models_settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./models/settings */ "./src/models/settings.ts");
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
// Vue



// Components


// Other












function migrateLocalStorageToBrowserStorage() {
    return __awaiter(this, void 0, void 0, function* () {
        if (localStorage.length > 0) {
            const location = localStorage.storageLocation || _models_settings__WEBPACK_IMPORTED_MODULE_14__.StorageLocation.Sync;
            yield _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.convertFromLocalStorage(localStorage, location);
            localStorage.clear();
        }
    });
}
function init() {
    var _a;
    return __awaiter(this, void 0, void 0, function* () {
        yield migrateLocalStorageToBrowserStorage();
        yield _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.updateItems();
        // Add globals
        vue__WEBPACK_IMPORTED_MODULE_15__["default"].prototype.i18n = yield (0,_store_i18n__WEBPACK_IMPORTED_MODULE_3__.loadI18nMessages)();
        // Load modules
        vue__WEBPACK_IMPORTED_MODULE_15__["default"].use(vuex__WEBPACK_IMPORTED_MODULE_16__["default"]);
        vue__WEBPACK_IMPORTED_MODULE_15__["default"].use(vue2_dragula__WEBPACK_IMPORTED_MODULE_0__.Vue2Dragula);
        // Load common components globally
        for (const component of _components_common_index__WEBPACK_IMPORTED_MODULE_2__["default"]) {
            vue__WEBPACK_IMPORTED_MODULE_15__["default"].component(component.name, component.component);
        }
        // State
        const store = new vuex__WEBPACK_IMPORTED_MODULE_16__["default"].Store({
            modules: {
                accounts: yield new _store_Accounts__WEBPACK_IMPORTED_MODULE_5__.Accounts().getModule(),
                advisor: yield new _store_Advisor__WEBPACK_IMPORTED_MODULE_11__.Advisor().getModule(),
                backup: yield new _store_Backup__WEBPACK_IMPORTED_MODULE_6__.Backup().getModule(),
                currentView: new _store_CurrentView__WEBPACK_IMPORTED_MODULE_7__.CurrentView().getModule(),
                menu: yield new _store_Menu__WEBPACK_IMPORTED_MODULE_8__.Menu().getModule(),
                notification: new _store_Notification__WEBPACK_IMPORTED_MODULE_9__.Notification().getModule(),
                qr: new _store_Qr__WEBPACK_IMPORTED_MODULE_10__.Qr().getModule(),
                style: new _store_Style__WEBPACK_IMPORTED_MODULE_4__.Style().getModule(),
            },
        });
        // Render
        const instance = new vue__WEBPACK_IMPORTED_MODULE_15__["default"]({
            render: (h) => h(_components_Popup_vue__WEBPACK_IMPORTED_MODULE_1__["default"]),
            store,
            mounted() {
                // Update time based entries' codes
                this.$store.commit("accounts/updateCodes");
                setInterval(() => {
                    this.$store.commit("accounts/updateCodes");
                }, 1000);
            },
        }).$mount("#authenticator");
        // Prompt for password if needed
        if (instance.$store.state.accounts.shouldShowPassphrase) {
            // If we have cached password, use that
            if (instance.$store.state.accounts.defaultEncryption) {
                instance.$store.commit("currentView/changeView", "LoadingPage");
                yield instance.$store.dispatch("accounts/updateEntries");
            }
            else {
                instance.$store.commit("style/showInfo", true);
                instance.$store.commit("currentView/changeView", "EnterPasswordPage");
            }
        }
        else {
            // Set init complete if no encryption is present, otherwise this will be set in updateEntries.
            instance.$store.commit("accounts/initComplete");
        }
        // Auto focus on first entry
        (_a = document.querySelector("a.entry[tabindex='0']")) === null || _a === void 0 ? void 0 : _a.focus();
        // Set document title
        try {
            document.title = instance.i18n.extName;
        }
        catch (e) {
            console.error(e);
        }
        // Warn if legacy password is set
        if (_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.encodedPhrase) {
            instance.$store.commit("notification/alert", instance.i18n.local_passphrase_warning);
        }
        // Backup reminder / run backup
        const backupReminder = setInterval(() => {
            if (instance.$store.state.accounts.entries.length === 0) {
                return;
            }
            if (instance.$store.getters["accounts/currentlyEncrypted"]) {
                return;
            }
            clearInterval(backupReminder);
            const clientTime = Math.floor(new Date().getTime() / 1000 / 3600 / 24);
            if (!_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime) {
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
            }
            else if (clientTime - Number(_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime) >= 30 ||
                clientTime - Number(_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime) < 0) {
                runScheduledBackup(clientTime, instance);
            }
            return;
        }, 5000);
        // Open search if '/' is pressed
        document.addEventListener("keyup", (e) => {
            if (e.key === "/") {
                if (instance.$store.getters["style/isMenuShown"]) {
                    return;
                }
                // Check if we're on the exchange-rate tab
                const activeTab = instance.$store.state.style.style.activeTab;
                if (activeTab === "exchange-rate") {
                    const exchangeSearchDiv = document.getElementById("exchange-search");
                    const exchangeSearchInput = document.getElementById("exchangeSearchInput");
                    if (exchangeSearchInput && exchangeSearchDiv) {
                        exchangeSearchDiv.style.display = "block";
                        exchangeSearchInput.focus();
                    }
                    return;
                }
                // Default behavior for authenticator tab
                instance.$store.commit("accounts/stopFilter");
                // It won't focus the texfield if vue unhides the div
                instance.$store.commit("accounts/showSearch");
                const searchDiv = document.getElementById("search");
                const searchInput = document.getElementById("searchInput");
                if (!searchInput || !searchDiv) {
                    return;
                }
                searchDiv.style.display = "block";
                searchInput.focus();
            }
        }, false);
        // Tab switching shortcuts: A for Authenticator, K for Kurs KMK
        document.addEventListener("keyup", (e) => {
            // Don't switch tabs if menu is shown
            if (instance.$store.getters["style/isMenuShown"]) {
                return;
            }
            // Don't switch tabs if user is typing in an input field
            const target = e.target;
            if (target &&
                (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) {
                return;
            }
            if (e.key === "a" || e.key === "A") {
                instance.$store.commit("style/setActiveTab", "authenticator");
            }
            else if (e.key === "k" || e.key === "K") {
                instance.$store.commit("style/setActiveTab", "exchange-rate");
            }
        }, false);
        // Show search box if more than 10 entries
        if (instance.$store.state.accounts.entries.length >= 10 &&
            !(instance.$store.getters["accounts/shouldFilter"] &&
                instance.$store.state.accounts.filter)) {
            instance.$store.commit("accounts/showSearch");
        }
        const query = new URLSearchParams(document.location.search.substring(1));
        // Resize window to proper size if popup
        if (query.get("popup")) {
            const zoom = Number(_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.zoom) / 100 || 1;
            const correctHeight = 480 * zoom;
            const correctWidth = 400 * zoom;
            if (window.innerHeight !== correctHeight ||
                window.innerWidth !== correctWidth) {
                // window update to correct size
                const adjustedHeight = correctHeight + (window.outerHeight - window.innerHeight);
                const adjustedWidth = correctWidth + (window.outerWidth - window.innerWidth);
                chrome.windows.update(chrome.windows.WINDOW_ID_CURRENT, {
                    height: adjustedHeight,
                    width: adjustedWidth,
                });
            }
        }
        // TODO: give an option for this
        chrome.permissions.contains({ origins: ["https://www.google.com/"] }, (hasPermission) => {
            if (hasPermission) {
                (0,_syncTime__WEBPACK_IMPORTED_MODULE_13__.syncTimeWithGoogle)();
            }
        });
    });
}
init();
function runScheduledBackup(clientTime, instance) {
    return __awaiter(this, void 0, void 0, function* () {
        if (instance.$store.state.backup.dropboxToken) {
            chrome.permissions.contains({ origins: ["https://*.dropboxapi.com/*"] }, (hasPermission) => __awaiter(this, void 0, void 0, function* () {
                if (hasPermission) {
                    try {
                        const dropbox = new _models_backup__WEBPACK_IMPORTED_MODULE_12__.Dropbox();
                        const res = yield dropbox.upload(instance.$store.state.accounts.encryption.get(instance.$store.state.accounts.defaultEncryption));
                        if (res) {
                            // we have uploaded backup to Dropbox
                            // no need to remind
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
                            return;
                        }
                        else if (_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.dropboxRevoked === true) {
                            instance.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["Dropbox"]));
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.dropboxRevoked = undefined;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.removeItem("dropboxRevoked");
                        }
                    }
                    catch (error) {
                        // ignore
                    }
                }
                instance.$store.commit("notification/alert", instance.i18n.remind_backup);
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
            }));
        }
        if (instance.$store.state.backup.driveToken) {
            chrome.permissions.contains({
                origins: [
                    "https://www.googleapis.com/*",
                    "https://accounts.google.com/o/oauth2/revoke",
                ],
            }, (hasPermission) => __awaiter(this, void 0, void 0, function* () {
                if (hasPermission) {
                    try {
                        const drive = new _models_backup__WEBPACK_IMPORTED_MODULE_12__.Drive();
                        const res = yield drive.upload(instance.$store.state.accounts.encryption.get(instance.$store.state.accounts.defaultEncryption));
                        if (res) {
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
                            return;
                        }
                        else if (_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.driveRevoked === true) {
                            instance.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["Google Drive"]));
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.driveRevoked = undefined;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.removeItem("driveRevoked");
                        }
                    }
                    catch (error) {
                        // ignore
                    }
                }
                instance.$store.commit("notification/alert", instance.i18n.remind_backup);
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
            }));
        }
        if (instance.$store.state.backup.oneDriveToken) {
            chrome.permissions.contains({
                origins: [
                    "https://graph.microsoft.com/me/*",
                    "https://login.microsoftonline.com/common/oauth2/v2.0/token",
                ],
            }, (hasPermission) => __awaiter(this, void 0, void 0, function* () {
                if (hasPermission) {
                    try {
                        const onedrive = new _models_backup__WEBPACK_IMPORTED_MODULE_12__.OneDrive();
                        const res = yield onedrive.upload(instance.$store.state.accounts.encryption.get(instance.$store.state.accounts.defaultEncryption));
                        if (res) {
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
                            return;
                        }
                        else if (_models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.oneDriveRevoked === true) {
                            instance.$store.commit("notification/alert", chrome.i18n.getMessage("token_revoked", ["OneDrive"]));
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.oneDriveRevoked = undefined;
                            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.removeItem("oneDriveRevoked");
                        }
                    }
                    catch (error) {
                        // ignore
                    }
                }
                instance.$store.commit("notification/alert", instance.i18n.remind_backup);
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
                _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
            }));
        }
        if (!instance.$store.state.backup.driveToken &&
            !instance.$store.state.backup.dropboxToken &&
            !instance.$store.state.backup.oneDriveToken) {
            instance.$store.commit("notification/alert", instance.i18n.remind_backup);
            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.items.lastRemindingBackupTime = clientTime;
            _models_settings__WEBPACK_IMPORTED_MODULE_14__.UserSettings.commitItems();
        }
    });
}

})();

/******/ })()
;
//# sourceMappingURL=popup.js.map