.', list[i]);\n }\n }\n\n addAttr(el, name, JSON.stringify(value), list[i]); // #6887 firefox doesn't update muted state if set via attribute\n // even immediately after element creation\n\n if (!el.component && name === 'muted' && platformMustUseProp(el.tag, el.attrsMap.type, name)) {\n addProp(el, name, 'true', list[i]);\n }\n }\n }\n}\n\nfunction checkInFor(el) {\n var parent = el;\n\n while (parent) {\n if (parent.for !== undefined) {\n return true;\n }\n\n parent = parent.parent;\n }\n\n return false;\n}\n\nfunction parseModifiers(name) {\n var match = name.match(modifierRE);\n\n if (match) {\n var ret = {};\n match.forEach(function (m) {\n ret[m.slice(1)] = true;\n });\n return ret;\n }\n}\n\nfunction makeAttrsMap(attrs) {\n var map = {};\n\n for (var i = 0, l = attrs.length; i < l; i++) {\n if (process.env.NODE_ENV !== 'production' && map[attrs[i].name] && !isIE && !isEdge) {\n warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);\n }\n\n map[attrs[i].name] = attrs[i].value;\n }\n\n return map;\n} // for script (e.g. type=\"x/template\") or style, do not decode content\n\n\nfunction isTextTag(el) {\n return el.tag === 'script' || el.tag === 'style';\n}\n\nfunction isForbiddenTag(el) {\n return el.tag === 'style' || el.tag === 'script' && (!el.attrsMap.type || el.attrsMap.type === 'text/javascript');\n}\n\nvar ieNSBug = /^xmlns:NS\\d+/;\nvar ieNSPrefix = /^NS\\d+:/;\n/* istanbul ignore next */\n\nfunction guardIESVGBug(attrs) {\n var res = [];\n\n for (var i = 0; i < attrs.length; i++) {\n var attr = attrs[i];\n\n if (!ieNSBug.test(attr.name)) {\n attr.name = attr.name.replace(ieNSPrefix, '');\n res.push(attr);\n }\n }\n\n return res;\n}\n\nfunction checkForAliasModel(el, value) {\n var _el = el;\n\n while (_el) {\n if (_el.for && _el.alias === value) {\n warn$2(\"<\" + el.tag + \" v-model=\\\"\" + value + \"\\\">: \" + \"You are binding v-model directly to a v-for iteration alias. \" + \"This will not be able to modify the v-for source array because \" + \"writing to the alias is like modifying a function local variable. \" + \"Consider using an array of objects and use v-model on an object property instead.\", el.rawAttrsMap['v-model']);\n }\n\n _el = _el.parent;\n }\n}\n/* */\n\n\nfunction preTransformNode(el, options) {\n if (el.tag === 'input') {\n var map = el.attrsMap;\n\n if (!map['v-model']) {\n return;\n }\n\n var typeBinding;\n\n if (map[':type'] || map['v-bind:type']) {\n typeBinding = getBindingAttr(el, 'type');\n }\n\n if (!map.type && !typeBinding && map['v-bind']) {\n typeBinding = \"(\" + map['v-bind'] + \").type\";\n }\n\n if (typeBinding) {\n var ifCondition = getAndRemoveAttr(el, 'v-if', true);\n var ifConditionExtra = ifCondition ? \"&&(\" + ifCondition + \")\" : \"\";\n var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;\n var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true); // 1. checkbox\n\n var branch0 = cloneASTElement(el); // process for on the main node\n\n processFor(branch0);\n addRawAttr(branch0, 'type', 'checkbox');\n processElement(branch0, options);\n branch0.processed = true; // prevent it from double-processed\n\n branch0.if = \"(\" + typeBinding + \")==='checkbox'\" + ifConditionExtra;\n addIfCondition(branch0, {\n exp: branch0.if,\n block: branch0\n }); // 2. add radio else-if condition\n\n var branch1 = cloneASTElement(el);\n getAndRemoveAttr(branch1, 'v-for', true);\n addRawAttr(branch1, 'type', 'radio');\n processElement(branch1, options);\n addIfCondition(branch0, {\n exp: \"(\" + typeBinding + \")==='radio'\" + ifConditionExtra,\n block: branch1\n }); // 3. other\n\n var branch2 = cloneASTElement(el);\n getAndRemoveAttr(branch2, 'v-for', true);\n addRawAttr(branch2, ':type', typeBinding);\n processElement(branch2, options);\n addIfCondition(branch0, {\n exp: ifCondition,\n block: branch2\n });\n\n if (hasElse) {\n branch0.else = true;\n } else if (elseIfCondition) {\n branch0.elseif = elseIfCondition;\n }\n\n return branch0;\n }\n }\n}\n\nfunction cloneASTElement(el) {\n return createASTElement(el.tag, el.attrsList.slice(), el.parent);\n}\n\nvar model$1 = {\n preTransformNode: preTransformNode\n};\nvar modules$1 = [klass$1, style$1, model$1];\n/* */\n\nfunction text(el, dir) {\n if (dir.value) {\n addProp(el, 'textContent', \"_s(\" + dir.value + \")\", dir);\n }\n}\n/* */\n\n\nfunction html(el, dir) {\n if (dir.value) {\n addProp(el, 'innerHTML', \"_s(\" + dir.value + \")\", dir);\n }\n}\n\nvar directives$1 = {\n model: model,\n text: text,\n html: html\n};\n/* */\n\nvar baseOptions = {\n expectHTML: true,\n modules: modules$1,\n directives: directives$1,\n isPreTag: isPreTag,\n isUnaryTag: isUnaryTag,\n mustUseProp: mustUseProp,\n canBeLeftOpenTag: canBeLeftOpenTag,\n isReservedTag: isReservedTag,\n getTagNamespace: getTagNamespace,\n staticKeys: genStaticKeys(modules$1)\n};\n/* */\n\nvar isStaticKey;\nvar isPlatformReservedTag;\nvar genStaticKeysCached = cached(genStaticKeys$1);\n/**\n * Goal of the optimizer: walk the generated template AST tree\n * and detect sub-trees that are purely static, i.e. parts of\n * the DOM that never needs to change.\n *\n * Once we detect these sub-trees, we can:\n *\n * 1. Hoist them into constants, so that we no longer need to\n * create fresh nodes for them on each re-render;\n * 2. Completely skip them in the patching process.\n */\n\nfunction optimize(root, options) {\n if (!root) {\n return;\n }\n\n isStaticKey = genStaticKeysCached(options.staticKeys || '');\n isPlatformReservedTag = options.isReservedTag || no; // first pass: mark all non-static nodes.\n\n markStatic$1(root); // second pass: mark static roots.\n\n markStaticRoots(root, false);\n}\n\nfunction genStaticKeys$1(keys) {\n return makeMap('type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' + (keys ? ',' + keys : ''));\n}\n\nfunction markStatic$1(node) {\n node.static = isStatic(node);\n\n if (node.type === 1) {\n // do not make component slot content static. this avoids\n // 1. components not able to mutate slot nodes\n // 2. static slot content fails for hot-reloading\n if (!isPlatformReservedTag(node.tag) && node.tag !== 'slot' && node.attrsMap['inline-template'] == null) {\n return;\n }\n\n for (var i = 0, l = node.children.length; i < l; i++) {\n var child = node.children[i];\n markStatic$1(child);\n\n if (!child.static) {\n node.static = false;\n }\n }\n\n if (node.ifConditions) {\n for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {\n var block = node.ifConditions[i$1].block;\n markStatic$1(block);\n\n if (!block.static) {\n node.static = false;\n }\n }\n }\n }\n}\n\nfunction markStaticRoots(node, isInFor) {\n if (node.type === 1) {\n if (node.static || node.once) {\n node.staticInFor = isInFor;\n } // For a node to qualify as a static root, it should have children that\n // are not just static text. Otherwise the cost of hoisting out will\n // outweigh the benefits and it's better off to just always render it fresh.\n\n\n if (node.static && node.children.length && !(node.children.length === 1 && node.children[0].type === 3)) {\n node.staticRoot = true;\n return;\n } else {\n node.staticRoot = false;\n }\n\n if (node.children) {\n for (var i = 0, l = node.children.length; i < l; i++) {\n markStaticRoots(node.children[i], isInFor || !!node.for);\n }\n }\n\n if (node.ifConditions) {\n for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {\n markStaticRoots(node.ifConditions[i$1].block, isInFor);\n }\n }\n }\n}\n\nfunction isStatic(node) {\n if (node.type === 2) {\n // expression\n return false;\n }\n\n if (node.type === 3) {\n // text\n return true;\n }\n\n return !!(node.pre || !node.hasBindings && // no dynamic bindings\n !node.if && !node.for && // not v-if or v-for or v-else\n !isBuiltInTag(node.tag) && // not a built-in\n isPlatformReservedTag(node.tag) && // not a component\n !isDirectChildOfTemplateFor(node) && Object.keys(node).every(isStaticKey));\n}\n\nfunction isDirectChildOfTemplateFor(node) {\n while (node.parent) {\n node = node.parent;\n\n if (node.tag !== 'template') {\n return false;\n }\n\n if (node.for) {\n return true;\n }\n }\n\n return false;\n}\n/* */\n\n\nvar fnExpRE = /^([\\w$_]+|\\([^)]*?\\))\\s*=>|^function(?:\\s+[\\w$]+)?\\s*\\(/;\nvar fnInvokeRE = /\\([^)]*?\\);*$/;\nvar simplePathRE = /^[A-Za-z_$][\\w$]*(?:\\.[A-Za-z_$][\\w$]*|\\['[^']*?']|\\[\"[^\"]*?\"]|\\[\\d+]|\\[[A-Za-z_$][\\w$]*])*$/; // KeyboardEvent.keyCode aliases\n\nvar keyCodes = {\n esc: 27,\n tab: 9,\n enter: 13,\n space: 32,\n up: 38,\n left: 37,\n right: 39,\n down: 40,\n 'delete': [8, 46]\n}; // KeyboardEvent.key aliases\n\nvar keyNames = {\n // #7880: IE11 and Edge use `Esc` for Escape key name.\n esc: ['Esc', 'Escape'],\n tab: 'Tab',\n enter: 'Enter',\n // #9112: IE11 uses `Spacebar` for Space key name.\n space: [' ', 'Spacebar'],\n // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.\n up: ['Up', 'ArrowUp'],\n left: ['Left', 'ArrowLeft'],\n right: ['Right', 'ArrowRight'],\n down: ['Down', 'ArrowDown'],\n // #9112: IE11 uses `Del` for Delete key name.\n 'delete': ['Backspace', 'Delete', 'Del']\n}; // #4868: modifiers that prevent the execution of the listener\n// need to explicitly return null so that we can determine whether to remove\n// the listener for .once\n\nvar genGuard = function genGuard(condition) {\n return \"if(\" + condition + \")return null;\";\n};\n\nvar modifierCode = {\n stop: '$event.stopPropagation();',\n prevent: '$event.preventDefault();',\n self: genGuard(\"$event.target !== $event.currentTarget\"),\n ctrl: genGuard(\"!$event.ctrlKey\"),\n shift: genGuard(\"!$event.shiftKey\"),\n alt: genGuard(\"!$event.altKey\"),\n meta: genGuard(\"!$event.metaKey\"),\n left: genGuard(\"'button' in $event && $event.button !== 0\"),\n middle: genGuard(\"'button' in $event && $event.button !== 1\"),\n right: genGuard(\"'button' in $event && $event.button !== 2\")\n};\n\nfunction genHandlers(events, isNative) {\n var prefix = isNative ? 'nativeOn:' : 'on:';\n var staticHandlers = \"\";\n var dynamicHandlers = \"\";\n\n for (var name in events) {\n var handlerCode = genHandler(events[name]);\n\n if (events[name] && events[name].dynamic) {\n dynamicHandlers += name + \",\" + handlerCode + \",\";\n } else {\n staticHandlers += \"\\\"\" + name + \"\\\":\" + handlerCode + \",\";\n }\n }\n\n staticHandlers = \"{\" + staticHandlers.slice(0, -1) + \"}\";\n\n if (dynamicHandlers) {\n return prefix + \"_d(\" + staticHandlers + \",[\" + dynamicHandlers.slice(0, -1) + \"])\";\n } else {\n return prefix + staticHandlers;\n }\n}\n\nfunction genHandler(handler) {\n if (!handler) {\n return 'function(){}';\n }\n\n if (Array.isArray(handler)) {\n return \"[\" + handler.map(function (handler) {\n return genHandler(handler);\n }).join(',') + \"]\";\n }\n\n var isMethodPath = simplePathRE.test(handler.value);\n var isFunctionExpression = fnExpRE.test(handler.value);\n var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));\n\n if (!handler.modifiers) {\n if (isMethodPath || isFunctionExpression) {\n return handler.value;\n }\n\n return \"function($event){\" + (isFunctionInvocation ? \"return \" + handler.value : handler.value) + \"}\"; // inline statement\n } else {\n var code = '';\n var genModifierCode = '';\n var keys = [];\n\n for (var key in handler.modifiers) {\n if (modifierCode[key]) {\n genModifierCode += modifierCode[key]; // left/right\n\n if (keyCodes[key]) {\n keys.push(key);\n }\n } else if (key === 'exact') {\n var modifiers = handler.modifiers;\n genModifierCode += genGuard(['ctrl', 'shift', 'alt', 'meta'].filter(function (keyModifier) {\n return !modifiers[keyModifier];\n }).map(function (keyModifier) {\n return \"$event.\" + keyModifier + \"Key\";\n }).join('||'));\n } else {\n keys.push(key);\n }\n }\n\n if (keys.length) {\n code += genKeyFilter(keys);\n } // Make sure modifiers like prevent and stop get executed after key filtering\n\n\n if (genModifierCode) {\n code += genModifierCode;\n }\n\n var handlerCode = isMethodPath ? \"return \" + handler.value + \".apply(null, arguments)\" : isFunctionExpression ? \"return (\" + handler.value + \").apply(null, arguments)\" : isFunctionInvocation ? \"return \" + handler.value : handler.value;\n return \"function($event){\" + code + handlerCode + \"}\";\n }\n}\n\nfunction genKeyFilter(keys) {\n return (// make sure the key filters only apply to KeyboardEvents\n // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake\n // key events that do not have keyCode property...\n \"if(!$event.type.indexOf('key')&&\" + keys.map(genFilterCode).join('&&') + \")return null;\"\n );\n}\n\nfunction genFilterCode(key) {\n var keyVal = parseInt(key, 10);\n\n if (keyVal) {\n return \"$event.keyCode!==\" + keyVal;\n }\n\n var keyCode = keyCodes[key];\n var keyName = keyNames[key];\n return \"_k($event.keyCode,\" + JSON.stringify(key) + \",\" + JSON.stringify(keyCode) + \",\" + \"$event.key,\" + \"\" + JSON.stringify(keyName) + \")\";\n}\n/* */\n\n\nfunction on(el, dir) {\n if (process.env.NODE_ENV !== 'production' && dir.modifiers) {\n warn(\"v-on without argument does not support modifiers.\");\n }\n\n el.wrapListeners = function (code) {\n return \"_g(\" + code + \",\" + dir.value + \")\";\n };\n}\n/* */\n\n\nfunction bind$1(el, dir) {\n el.wrapData = function (code) {\n return \"_b(\" + code + \",'\" + el.tag + \"',\" + dir.value + \",\" + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + \")\";\n };\n}\n/* */\n\n\nvar baseDirectives = {\n on: on,\n bind: bind$1,\n cloak: noop\n};\n/* */\n\nvar CodegenState = function CodegenState(options) {\n this.options = options;\n this.warn = options.warn || baseWarn;\n this.transforms = pluckModuleFunction(options.modules, 'transformCode');\n this.dataGenFns = pluckModuleFunction(options.modules, 'genData');\n this.directives = extend(extend({}, baseDirectives), options.directives);\n var isReservedTag = options.isReservedTag || no;\n\n this.maybeComponent = function (el) {\n return !!el.component || !isReservedTag(el.tag);\n };\n\n this.onceId = 0;\n this.staticRenderFns = [];\n this.pre = false;\n};\n\nfunction generate(ast, options) {\n var state = new CodegenState(options); // fix #11483, Root level \n\n","import { render, staticRenderFns } from \"./tips.vue?vue&type=template&id=218095e5&scoped=true&\"\nimport script from \"./tips.vue?vue&type=script&lang=js&\"\nexport * from \"./tips.vue?vue&type=script&lang=js&\"\nimport style0 from \"./tips.vue?vue&type=style&index=0&id=218095e5&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../shared/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"218095e5\",\n null\n \n)\n\nexport default component.exports","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var check = function (it) {\n return it && it.Math == Math && it;\n};\n\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nmodule.exports =\n // eslint-disable-next-line es/no-global-this -- safe\n check(typeof globalThis == 'object' && globalThis) ||\n check(typeof window == 'object' && window) ||\n // eslint-disable-next-line no-restricted-globals -- safe\n check(typeof self == 'object' && self) ||\n check(typeof global == 'object' && global) ||\n // eslint-disable-next-line no-new-func -- fallback\n (function () { return this; })() || Function('return this')();\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory, undef) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"), require(\"./sha1\"), require(\"./hmac\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\", \"./sha1\", \"./hmac\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var Base = C_lib.Base;\n var WordArray = C_lib.WordArray;\n var C_algo = C.algo;\n var MD5 = C_algo.MD5;\n /**\n * This key derivation function is meant to conform with EVP_BytesToKey.\n * www.openssl.org/docs/crypto/EVP_BytesToKey.html\n */\n\n var EvpKDF = C_algo.EvpKDF = Base.extend({\n /**\n * Configuration options.\n *\n * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n * @property {Hasher} hasher The hash algorithm to use. Default: MD5\n * @property {number} iterations The number of iterations to perform. Default: 1\n */\n cfg: Base.extend({\n keySize: 128 / 32,\n hasher: MD5,\n iterations: 1\n }),\n\n /**\n * Initializes a newly created key derivation function.\n *\n * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n *\n * @example\n *\n * var kdf = CryptoJS.algo.EvpKDF.create();\n * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });\n * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });\n */\n init: function init(cfg) {\n this.cfg = this.cfg.extend(cfg);\n },\n\n /**\n * Derives a key from a password.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n *\n * @return {WordArray} The derived key.\n *\n * @example\n *\n * var key = kdf.compute(password, salt);\n */\n compute: function compute(password, salt) {\n var block; // Shortcut\n\n var cfg = this.cfg; // Init hasher\n\n var hasher = cfg.hasher.create(); // Initial values\n\n var derivedKey = WordArray.create(); // Shortcuts\n\n var derivedKeyWords = derivedKey.words;\n var keySize = cfg.keySize;\n var iterations = cfg.iterations; // Generate key\n\n while (derivedKeyWords.length < keySize) {\n if (block) {\n hasher.update(block);\n }\n\n block = hasher.update(password).finalize(salt);\n hasher.reset(); // Iterations\n\n for (var i = 1; i < iterations; i++) {\n block = hasher.finalize(block);\n hasher.reset();\n }\n\n derivedKey.concat(block);\n }\n\n derivedKey.sigBytes = keySize * 4;\n return derivedKey;\n }\n });\n /**\n * Derives a key from a password.\n *\n * @param {WordArray|string} password The password.\n * @param {WordArray|string} salt A salt.\n * @param {Object} cfg (Optional) The configuration options to use for this computation.\n *\n * @return {WordArray} The derived key.\n *\n * @static\n *\n * @example\n *\n * var key = CryptoJS.EvpKDF(password, salt);\n * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });\n * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });\n */\n\n C.EvpKDF = function (password, salt, cfg) {\n return EvpKDF.create(cfg).compute(password, salt);\n };\n })();\n\n return CryptoJS.EvpKDF;\n});","'use strict';\n\nif (typeof process === 'undefined' || !process.version || process.version.indexOf('v0.') === 0 || process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = {\n nextTick: nextTick\n };\n} else {\n module.exports = process;\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n\n var len = arguments.length;\n var args, i;\n\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n\n default:\n args = new Array(len - 1);\n i = 0;\n\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}","var scope = typeof global !== \"undefined\" && global || typeof self !== \"undefined\" && self || window;\nvar apply = Function.prototype.apply; // DOM APIs, for completeness\n\nexports.setTimeout = function () {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\n\nexports.setInterval = function () {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\n\nexports.clearTimeout = exports.clearInterval = function (timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\n\nTimeout.prototype.unref = Timeout.prototype.ref = function () {};\n\nTimeout.prototype.close = function () {\n this._clearFn.call(scope, this._id);\n}; // Does not start the time, just sets up the members needed.\n\n\nexports.enroll = function (item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function (item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function (item) {\n clearTimeout(item._idleTimeoutId);\n var msecs = item._idleTimeout;\n\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout) item._onTimeout();\n }, msecs);\n }\n}; // setimmediate attaches itself to the global object\n\n\nrequire(\"setimmediate\"); // On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\n\n\nexports.setImmediate = typeof self !== \"undefined\" && self.setImmediate || typeof global !== \"undefined\" && global.setImmediate || this && this.setImmediate;\nexports.clearImmediate = typeof self !== \"undefined\" && self.clearImmediate || typeof global !== \"undefined\" && global.clearImmediate || this && this.clearImmediate;","// based on the aes implimentation in triple sec\n// https://github.com/keybase/triplesec\n// which is in turn based on the one from crypto-js\n// https://code.google.com/p/crypto-js/\nvar Buffer = require('safe-buffer').Buffer;\n\nfunction asUInt32Array(buf) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);\n var len = buf.length / 4 | 0;\n var out = new Array(len);\n\n for (var i = 0; i < len; i++) {\n out[i] = buf.readUInt32BE(i * 4);\n }\n\n return out;\n}\n\nfunction scrubVec(v) {\n for (var i = 0; i < v.length; v++) {\n v[i] = 0;\n }\n}\n\nfunction cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {\n var SUB_MIX0 = SUB_MIX[0];\n var SUB_MIX1 = SUB_MIX[1];\n var SUB_MIX2 = SUB_MIX[2];\n var SUB_MIX3 = SUB_MIX[3];\n var s0 = M[0] ^ keySchedule[0];\n var s1 = M[1] ^ keySchedule[1];\n var s2 = M[2] ^ keySchedule[2];\n var s3 = M[3] ^ keySchedule[3];\n var t0, t1, t2, t3;\n var ksRow = 4;\n\n for (var round = 1; round < nRounds; round++) {\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 0xff] ^ SUB_MIX2[s2 >>> 8 & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++];\n t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 0xff] ^ SUB_MIX2[s3 >>> 8 & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++];\n t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 0xff] ^ SUB_MIX2[s0 >>> 8 & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++];\n t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 0xff] ^ SUB_MIX2[s1 >>> 8 & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++];\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n }\n\n t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n t0 = t0 >>> 0;\n t1 = t1 >>> 0;\n t2 = t2 >>> 0;\n t3 = t3 >>> 0;\n return [t0, t1, t2, t3];\n} // AES constants\n\n\nvar RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\nvar G = function () {\n // Compute double table\n var d = new Array(256);\n\n for (var j = 0; j < 256; j++) {\n if (j < 128) {\n d[j] = j << 1;\n } else {\n d[j] = j << 1 ^ 0x11b;\n }\n }\n\n var SBOX = [];\n var INV_SBOX = [];\n var SUB_MIX = [[], [], [], []];\n var INV_SUB_MIX = [[], [], [], []]; // Walk GF(2^8)\n\n var x = 0;\n var xi = 0;\n\n for (var i = 0; i < 256; ++i) {\n // Compute sbox\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 0xff ^ 0x63;\n SBOX[x] = sx;\n INV_SBOX[sx] = x; // Compute multiplication\n\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4]; // Compute sub bytes, mix columns tables\n\n var t = d[sx] * 0x101 ^ sx * 0x1010100;\n SUB_MIX[0][x] = t << 24 | t >>> 8;\n SUB_MIX[1][x] = t << 16 | t >>> 16;\n SUB_MIX[2][x] = t << 8 | t >>> 24;\n SUB_MIX[3][x] = t; // Compute inv sub bytes, inv mix columns tables\n\n t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n INV_SUB_MIX[0][sx] = t << 24 | t >>> 8;\n INV_SUB_MIX[1][sx] = t << 16 | t >>> 16;\n INV_SUB_MIX[2][sx] = t << 8 | t >>> 24;\n INV_SUB_MIX[3][sx] = t;\n\n if (x === 0) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n\n return {\n SBOX: SBOX,\n INV_SBOX: INV_SBOX,\n SUB_MIX: SUB_MIX,\n INV_SUB_MIX: INV_SUB_MIX\n };\n}();\n\nfunction AES(key) {\n this._key = asUInt32Array(key);\n\n this._reset();\n}\n\nAES.blockSize = 4 * 4;\nAES.keySize = 256 / 8;\nAES.prototype.blockSize = AES.blockSize;\nAES.prototype.keySize = AES.keySize;\n\nAES.prototype._reset = function () {\n var keyWords = this._key;\n var keySize = keyWords.length;\n var nRounds = keySize + 6;\n var ksRows = (nRounds + 1) * 4;\n var keySchedule = [];\n\n for (var k = 0; k < keySize; k++) {\n keySchedule[k] = keyWords[k];\n }\n\n for (k = keySize; k < ksRows; k++) {\n var t = keySchedule[k - 1];\n\n if (k % keySize === 0) {\n t = t << 8 | t >>> 24;\n t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];\n t ^= RCON[k / keySize | 0] << 24;\n } else if (keySize > 6 && k % keySize === 4) {\n t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 0xff] << 16 | G.SBOX[t >>> 8 & 0xff] << 8 | G.SBOX[t & 0xff];\n }\n\n keySchedule[k] = keySchedule[k - keySize] ^ t;\n }\n\n var invKeySchedule = [];\n\n for (var ik = 0; ik < ksRows; ik++) {\n var ksR = ksRows - ik;\n var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)];\n\n if (ik < 4 || ksR <= 4) {\n invKeySchedule[ik] = tt;\n } else {\n invKeySchedule[ik] = G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]];\n }\n }\n\n this._nRounds = nRounds;\n this._keySchedule = keySchedule;\n this._invKeySchedule = invKeySchedule;\n};\n\nAES.prototype.encryptBlockRaw = function (M) {\n M = asUInt32Array(M);\n return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);\n};\n\nAES.prototype.encryptBlock = function (M) {\n var out = this.encryptBlockRaw(M);\n var buf = Buffer.allocUnsafe(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[1], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[3], 12);\n return buf;\n};\n\nAES.prototype.decryptBlock = function (M) {\n M = asUInt32Array(M); // swap\n\n var m1 = M[1];\n M[1] = M[3];\n M[3] = m1;\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds);\n var buf = Buffer.allocUnsafe(16);\n buf.writeUInt32BE(out[0], 0);\n buf.writeUInt32BE(out[3], 4);\n buf.writeUInt32BE(out[2], 8);\n buf.writeUInt32BE(out[1], 12);\n return buf;\n};\n\nAES.prototype.scrub = function () {\n scrubVec(this._keySchedule);\n scrubVec(this._invKeySchedule);\n scrubVec(this._key);\n};\n\nmodule.exports.AES = AES;","var Buffer = require('safe-buffer').Buffer;\n\nvar MD5 = require('md5.js');\n/* eslint-disable camelcase */\n\n\nfunction EVP_BytesToKey(password, salt, keyBits, ivLen) {\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary');\n\n if (salt) {\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary');\n if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length');\n }\n\n var keyLen = keyBits / 8;\n var key = Buffer.alloc(keyLen);\n var iv = Buffer.alloc(ivLen || 0);\n var tmp = Buffer.alloc(0);\n\n while (keyLen > 0 || ivLen > 0) {\n var hash = new MD5();\n hash.update(tmp);\n hash.update(password);\n if (salt) hash.update(salt);\n tmp = hash.digest();\n var used = 0;\n\n if (keyLen > 0) {\n var keyStart = key.length - keyLen;\n used = Math.min(keyLen, tmp.length);\n tmp.copy(key, keyStart, 0, used);\n keyLen -= used;\n }\n\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen;\n var length = Math.min(ivLen, tmp.length - used);\n tmp.copy(iv, ivStart, used, used + length);\n ivLen -= length;\n }\n }\n\n tmp.fill(0);\n return {\n key: key,\n iv: iv\n };\n}\n\nmodule.exports = EVP_BytesToKey;","'use strict';\n\nvar BN = require('bn.js');\n\nvar utils = require('../utils');\n\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16); // Use Montgomery, when there is no fast reduction for the prime\n\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); // Useful for many curves\n\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red); // Curve configuration, optional\n\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); // Temporary arrays\n\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n this._bitLength = this.n ? this.n.bitLength() : 0; // Generalized Greg Maxwell's trick\n\n var adjustCount = this.n && this.p.div(this.n);\n\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\n\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3; // Translate into more windowed form\n\n var repr = [];\n var j;\n var nafW;\n\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n\n for (var l = j + doubles.step - 1; l >= j; l--) {\n nafW = (nafW << 1) + naf[l];\n }\n\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i) b = b.mixedAdd(doubles.points[j]);else if (nafW === -i) b = b.mixedAdd(doubles.points[j].neg());\n }\n\n a = a.add(b);\n }\n\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4; // Precompute window\n\n var nafPoints = p._getNAFPoints(w);\n\n w = nafPoints.wnd;\n var wnd = nafPoints.points; // Get NAF form\n\n var naf = getNAF(k, w, this._bitLength); // Add `this`*(N+1) for every w-NAF index\n\n var acc = this.jpoint(null, null, null);\n\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--) {\n l++;\n }\n\n if (i >= 0) l++;\n acc = acc.dblp(l);\n if (i < 0) break;\n var z = naf[i];\n assert(z !== 0);\n\n if (p.type === 'affine') {\n // J +- P\n if (z > 0) acc = acc.mixedAdd(wnd[z - 1 >> 1]);else acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg());\n } else {\n // J +- J\n if (z > 0) acc = acc.add(wnd[z - 1 >> 1]);else acc = acc.add(wnd[-z - 1 >> 1].neg());\n }\n }\n\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3; // Fill all arrays\n\n var max = 0;\n var i;\n var j;\n var p;\n\n for (i = 0; i < len; i++) {\n p = points[i];\n\n var nafPoints = p._getNAFPoints(defW);\n\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n } // Comb small window NAFs\n\n\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [points[a],\n /* 1 */\n null,\n /* 3 */\n null,\n /* 5 */\n points[b]\n /* 7 */\n ]; // Try to avoid Projective points, if possible\n\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [-3,\n /* -1 -1 */\n -1,\n /* -1 0 */\n -5,\n /* -1 1 */\n -7,\n /* 0 -1 */\n 0,\n /* 0 0 */\n 7,\n /* 0 1 */\n 5,\n /* 1 -1 */\n 1,\n /* 1 0 */\n 3\n /* 1 1 */\n ];\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0) zero = false;\n }\n\n if (!zero) break;\n k++;\n i--;\n }\n\n if (i >= 0) k++;\n acc = acc.dblp(k);\n if (i < 0) break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0) continue;else if (z > 0) p = wnd[j][z - 1 >> 1];else if (z < 0) p = wnd[j][-z - 1 >> 1].neg();\n if (p.type === 'affine') acc = acc.mixedAdd(p);else acc = acc.add(p);\n }\n } // Zeroify references\n\n\n for (i = 0; i < len; i++) {\n wnd[i] = null;\n }\n\n if (jacobianResult) return acc;else return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\n\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq() {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n var len = this.p.byteLength(); // uncompressed, hybrid-odd, hybrid-even\n\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06) assert(bytes[bytes.length - 1] % 2 === 0);else if (bytes[0] === 0x07) assert(bytes[bytes.length - 1] % 2 === 1);\n var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n if (compact) return [this.getY().isEven() ? 0x02 : 0x03].concat(x);\n return [0x04].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed) return this;\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed) return false;\n var doubles = this.precomputed.doubles;\n if (!doubles) return false;\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles;\n var doubles = [this];\n var acc = this;\n\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++) {\n acc = acc.dbl();\n }\n\n doubles.push(acc);\n }\n\n return {\n step: step,\n points: doubles\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;\n var res = [this];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n\n for (var i = 1; i < max; i++) {\n res[i] = res[i - 1].add(dbl);\n }\n\n return {\n wnd: wnd,\n points: res\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n\n for (var i = 0; i < k; i++) {\n r = r.dbl();\n }\n\n return r;\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar asn1 = require('./asn1');\n\nvar aesid = require('./aesid.json');\n\nvar fixProc = require('./fixProc');\n\nvar ciphers = require('browserify-aes');\n\nvar compat = require('pbkdf2');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = parseKeys;\n\nfunction parseKeys(buffer) {\n var password;\n\n if (_typeof(buffer) === 'object' && !Buffer.isBuffer(buffer)) {\n password = buffer.passphrase;\n buffer = buffer.key;\n }\n\n if (typeof buffer === 'string') {\n buffer = Buffer.from(buffer);\n }\n\n var stripped = fixProc(buffer, password);\n var type = stripped.tag;\n var data = stripped.data;\n var subtype, ndata;\n\n switch (type) {\n case 'CERTIFICATE':\n ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo;\n // falls through\n\n case 'PUBLIC KEY':\n if (!ndata) {\n ndata = asn1.PublicKey.decode(data, 'der');\n }\n\n subtype = ndata.algorithm.algorithm.join('.');\n\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der');\n\n case '1.2.840.10045.2.1':\n ndata.subjectPrivateKey = ndata.subjectPublicKey;\n return {\n type: 'ec',\n data: ndata\n };\n\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der');\n return {\n type: 'dsa',\n data: ndata.algorithm.params\n };\n\n default:\n throw new Error('unknown key id ' + subtype);\n }\n\n // throw new Error('unknown key type ' + type)\n\n case 'ENCRYPTED PRIVATE KEY':\n data = asn1.EncryptedPrivateKey.decode(data, 'der');\n data = decrypt(data, password);\n // falls through\n\n case 'PRIVATE KEY':\n ndata = asn1.PrivateKey.decode(data, 'der');\n subtype = ndata.algorithm.algorithm.join('.');\n\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der');\n\n case '1.2.840.10045.2.1':\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n };\n\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der');\n return {\n type: 'dsa',\n params: ndata.algorithm.params\n };\n\n default:\n throw new Error('unknown key id ' + subtype);\n }\n\n // throw new Error('unknown key type ' + type)\n\n case 'RSA PUBLIC KEY':\n return asn1.RSAPublicKey.decode(data, 'der');\n\n case 'RSA PRIVATE KEY':\n return asn1.RSAPrivateKey.decode(data, 'der');\n\n case 'DSA PRIVATE KEY':\n return {\n type: 'dsa',\n params: asn1.DSAPrivateKey.decode(data, 'der')\n };\n\n case 'EC PRIVATE KEY':\n data = asn1.ECPrivateKey.decode(data, 'der');\n return {\n curve: data.parameters.value,\n privateKey: data.privateKey\n };\n\n default:\n throw new Error('unknown key type ' + type);\n }\n}\n\nparseKeys.signature = asn1.signature;\n\nfunction decrypt(data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt;\n var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10);\n var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')];\n var iv = data.algorithm.decrypt.cipher.iv;\n var cipherText = data.subjectPrivateKey;\n var keylen = parseInt(algo.split('-')[1], 10) / 8;\n var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1');\n var cipher = ciphers.createDecipheriv(algo, key, iv);\n var out = [];\n out.push(cipher.update(cipherText));\n out.push(cipher.final());\n return Buffer.concat(out);\n}","var global = require('../internals/global');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar redefine = require('../internals/redefine');\nvar setGlobal = require('../internals/set-global');\nvar copyConstructorProperties = require('../internals/copy-constructor-properties');\nvar isForced = require('../internals/is-forced');\n\n/*\n options.target - name of the target object\n options.global - target is the global object\n options.stat - export as static methods of target\n options.proto - export as prototype methods of target\n options.real - real prototype method for the `pure` version\n options.forced - export even if the native feature is available\n options.bind - bind methods to the target, required for the `pure` version\n options.wrap - wrap constructors to preventing global pollution, required for the `pure` version\n options.unsafe - use the simple assignment of property instead of delete + defineProperty\n options.sham - add a flag to not completely full polyfills\n options.enumerable - export as enumerable property\n options.noTargetGet - prevent calling a getter on target\n options.name - the .name of the function if it does not match the key\n*/\nmodule.exports = function (options, source) {\n var TARGET = options.target;\n var GLOBAL = options.global;\n var STATIC = options.stat;\n var FORCED, target, key, targetProperty, sourceProperty, descriptor;\n if (GLOBAL) {\n target = global;\n } else if (STATIC) {\n target = global[TARGET] || setGlobal(TARGET, {});\n } else {\n target = (global[TARGET] || {}).prototype;\n }\n if (target) for (key in source) {\n sourceProperty = source[key];\n if (options.noTargetGet) {\n descriptor = getOwnPropertyDescriptor(target, key);\n targetProperty = descriptor && descriptor.value;\n } else targetProperty = target[key];\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contained in target\n if (!FORCED && targetProperty !== undefined) {\n if (typeof sourceProperty === typeof targetProperty) continue;\n copyConstructorProperties(sourceProperty, targetProperty);\n }\n // add a flag to not completely full polyfills\n if (options.sham || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(sourceProperty, 'sham', true);\n }\n // extend global\n redefine(target, key, sourceProperty, options);\n }\n};\n","\n
\n \n
\n
{{errorMessage}}
\n
\n
\n
\n \n Verifying data\n
\n
\n
\n
\n\n\n\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Check if typed arrays are supported\n if (typeof ArrayBuffer != 'function') {\n return;\n } // Shortcuts\n\n\n var C = CryptoJS;\n var C_lib = C.lib;\n var WordArray = C_lib.WordArray; // Reference original init\n\n var superInit = WordArray.init; // Augment WordArray.init to handle typed arrays\n\n var subInit = WordArray.init = function (typedArray) {\n // Convert buffers to uint8\n if (typedArray instanceof ArrayBuffer) {\n typedArray = new Uint8Array(typedArray);\n } // Convert other array views to uint8\n\n\n 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) {\n typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength);\n } // Handle Uint8Array\n\n\n if (typedArray instanceof Uint8Array) {\n // Shortcut\n var typedArrayByteLength = typedArray.byteLength; // Extract bytes\n\n var words = [];\n\n for (var i = 0; i < typedArrayByteLength; i++) {\n words[i >>> 2] |= typedArray[i] << 24 - i % 4 * 8;\n } // Initialize this word array\n\n\n superInit.call(this, words, typedArrayByteLength);\n } else {\n // Else call normal init\n superInit.apply(this, arguments);\n }\n };\n\n subInit.prototype = WordArray;\n })();\n\n return CryptoJS.lib.WordArray;\n});","import inspect from \"../jsutils/inspect.mjs\";\nimport { isNode } from \"./ast.mjs\";\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport var QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'],\n InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields']\n};\nexport var BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to four permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n *\n * 2) Named visitors that trigger upon entering and leaving a node of\n * a specific kind.\n *\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n *\n * 4) Parallel visitors for entering and leaving nodes of a specific kind.\n *\n * visit(ast, {\n * enter: {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * },\n * leave: {\n * Kind(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n */\n\nexport function visit(root, visitor) {\n var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys;\n /* eslint-disable no-undef-init */\n\n var stack = undefined;\n var inArray = Array.isArray(root);\n var keys = [root];\n var index = -1;\n var edits = [];\n var node = undefined;\n var key = undefined;\n var parent = undefined;\n var path = [];\n var ancestors = [];\n var newRoot = root;\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n var isLeaving = index === keys.length;\n var isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n } else {\n var clone = {};\n\n for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) {\n var k = _Object$keys2[_i2];\n clone[k] = node[k];\n }\n\n node = clone;\n }\n\n var editOffset = 0;\n\n for (var ii = 0; ii < edits.length; ii++) {\n var editKey = edits[ii][0];\n var editValue = edits[ii][1];\n\n if (inArray) {\n editKey -= editOffset;\n }\n\n if (inArray && editValue === null) {\n node.splice(editKey, 1);\n editOffset++;\n } else {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else {\n key = parent ? inArray ? index : keys[index] : undefined;\n node = parent ? parent[key] : newRoot;\n\n if (node === null || node === undefined) {\n continue;\n }\n\n if (parent) {\n path.push(key);\n }\n }\n\n var result = void 0;\n\n if (!Array.isArray(node)) {\n if (!isNode(node)) {\n throw new Error(\"Invalid AST Node: \".concat(inspect(node), \".\"));\n }\n\n var visitFn = getVisitFn(visitor, node.kind, isLeaving);\n\n if (visitFn) {\n result = visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _visitorKeys$node$kin;\n\n stack = {\n inArray: inArray,\n index: index,\n keys: keys,\n edits: edits,\n prev: stack\n };\n inArray = Array.isArray(node);\n keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n newRoot = edits[edits.length - 1][1];\n }\n\n return newRoot;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n var skipping = new Array(visitors.length);\n return {\n enter: function enter(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n false);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n }\n },\n leave: function leave(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n true);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n }\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n var kindVisitor = visitor[kind];\n\n if (kindVisitor) {\n if (!isLeaving && typeof kindVisitor === 'function') {\n // { Kind() {} }\n return kindVisitor;\n }\n\n var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter;\n\n if (typeof kindSpecificVisitor === 'function') {\n // { Kind: { enter() {}, leave() {} } }\n return kindSpecificVisitor;\n }\n } else {\n var specificVisitor = isLeaving ? visitor.leave : visitor.enter;\n\n if (specificVisitor) {\n if (typeof specificVisitor === 'function') {\n // { enter() {}, leave() {} }\n return specificVisitor;\n }\n\n var specificKindVisitor = specificVisitor[kind];\n\n if (typeof specificKindVisitor === 'function') {\n // { enter: { Kind() {} }, leave: { Kind() {} } }\n return specificKindVisitor;\n }\n }\n }\n}","// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = function (argument) {\n return typeof argument === 'function';\n};\n","import _regeneratorRuntime from \"@babel/runtime/regenerator\";\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\n * pinia v2.0.30\n * (c) 2023 Eduardo San Martin Morote\n * @license MIT\n */\nimport { getCurrentInstance, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, reactive, toRef, del, nextTick, computed, toRefs } from 'vue-demi';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n/**\r\n * setActivePinia must be called to handle SSR at the top of functions like\r\n * `fetch`, `setup`, `serverPrefetch` and others\r\n */\n\nvar activePinia;\n/**\r\n * Sets or unsets the active pinia. Used in SSR and internally when calling\r\n * actions and getters\r\n *\r\n * @param pinia - Pinia instance\r\n */\n\nvar setActivePinia = function setActivePinia(pinia) {\n return activePinia = pinia;\n};\n/**\r\n * Get the currently active pinia if there is any.\r\n */\n\n\nvar getActivePinia = function getActivePinia() {\n return getCurrentInstance() && inject(piniaSymbol) || activePinia;\n};\n\nvar piniaSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia') :\n/* istanbul ignore next */\nSymbol();\n\nfunction isPlainObject( // eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return o && _typeof(o) === 'object' && Object.prototype.toString.call(o) === '[object Object]' && typeof o.toJSON !== 'function';\n} // type DeepReadonly
= { readonly [P in keyof T]: DeepReadonly }\n// TODO: can we change these to numbers?\n\n/**\r\n * Possible types for SubscriptionCallback\r\n */\n\n\nvar MutationType;\n\n(function (MutationType) {\n /**\r\n * Direct mutation of the state:\r\n *\r\n * - `store.name = 'new name'`\r\n * - `store.$state.name = 'new name'`\r\n * - `store.list.push('new item')`\r\n */\n MutationType[\"direct\"] = \"direct\";\n /**\r\n * Mutated the state with `$patch` and an object\r\n *\r\n * - `store.$patch({ name: 'newName' })`\r\n */\n\n MutationType[\"patchObject\"] = \"patch object\";\n /**\r\n * Mutated the state with `$patch` and a function\r\n *\r\n * - `store.$patch(state => state.name = 'newName')`\r\n */\n\n MutationType[\"patchFunction\"] = \"patch function\"; // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\nvar IS_CLIENT = typeof window !== 'undefined';\n/**\r\n * Should we add the devtools plugins.\r\n * - only if dev mode or forced through the prod devtools flag\r\n * - not in test\r\n * - only if window exists (could change in the future)\r\n */\n\nvar USE_DEVTOOLS = (process.env.NODE_ENV !== 'production' || typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__) && !(process.env.NODE_ENV === 'test') && IS_CLIENT;\n/*\r\n * FileSaver.js A saveAs() FileSaver implementation.\r\n *\r\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\r\n * Morote.\r\n *\r\n * License : MIT\r\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\n\nvar _global = /*#__PURE__*/function () {\n return (typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === 'object' && window.window === window ? window : (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === 'object' && self.self === self ? self : (typeof global === \"undefined\" ? \"undefined\" : _typeof(global)) === 'object' && global.global === global ? global : (typeof globalThis === \"undefined\" ? \"undefined\" : _typeof(globalThis)) === 'object' ? globalThis : {\n HTMLElement: null\n };\n}();\n\nfunction bom(blob) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$autoBom = _ref.autoBom,\n autoBom = _ref$autoBom === void 0 ? false : _ref$autoBom;\n\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], {\n type: blob.type\n });\n }\n\n return blob;\n}\n\nfunction download(url, name, opts) {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n\n xhr.onerror = function () {\n console.error('could not download file');\n };\n\n xhr.send();\n}\n\nfunction corsEnabled(url) {\n var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker\n\n xhr.open('HEAD', url, false);\n\n try {\n xhr.send();\n } catch (e) {}\n\n return xhr.status >= 200 && xhr.status <= 299;\n} // `a.click()` doesn't work for all browsers (#465)\n\n\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n } catch (e) {\n var evt = document.createEvent('MouseEvents');\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n node.dispatchEvent(evt);\n }\n}\n\nvar _navigator = (typeof navigator === \"undefined\" ? \"undefined\" : _typeof(navigator)) === 'object' ? navigator : {\n userAgent: ''\n}; // Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\n\n\nvar isMacOSWebView = /*#__PURE__*/function () {\n return /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent);\n}();\n\nvar saveAs = !IS_CLIENT ? function () {} // noop\n: // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\ntypeof HTMLAnchorElement !== 'undefined' && 'download' in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : // Use msSaveOrOpenBlob as a second approach\n'msSaveOrOpenBlob' in _navigator ? msSaveAs : // Fallback to using FileReader and a popup\nfileSaverSaveAs;\n\nfunction downloadSaveAs(blob) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'download';\n var opts = arguments.length > 2 ? arguments[2] : undefined;\n var a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n } else {\n a.target = '_blank';\n click(a);\n }\n } else {\n click(a);\n }\n } else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\n\nfunction msSaveAs(blob) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'download';\n var opts = arguments.length > 2 ? arguments[2] : undefined;\n\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n } else {\n var a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n } else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\n\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n\n if (typeof blob === 'string') return download(blob, name, opts);\n var force = blob.type === 'application/octet-stream';\n\n var isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n\n var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n\n if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n var reader = new FileReader();\n\n reader.onloadend = function () {\n var url = reader.result;\n\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n\n url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n\n if (popup) {\n popup.location.href = url;\n } else {\n location.assign(url);\n }\n\n popup = null; // reverse-tabnabbing #460\n };\n\n reader.readAsDataURL(blob);\n } else {\n var url = URL.createObjectURL(blob);\n if (popup) popup.location.assign(url);else location.href = url;\n popup = null; // reverse-tabnabbing #460\n\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n/**\r\n * Shows a toast or console.log\r\n *\r\n * @param message - message to log\r\n * @param type - different color of the tooltip\r\n */\n\n\nfunction toastMessage(message, type) {\n var piniaMessage = '🍍 ' + message;\n\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n } else if (type === 'error') {\n console.error(piniaMessage);\n } else if (type === 'warn') {\n console.warn(piniaMessage);\n } else {\n console.log(piniaMessage);\n }\n}\n\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(\"Your browser doesn't support the Clipboard API\", 'error');\n return true;\n }\n}\n\nfunction checkNotFocusedError(error) {\n if (error instanceof Error && error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n\n return false;\n}\n\nfunction actionGlobalCopyState(_x) {\n return _actionGlobalCopyState.apply(this, arguments);\n}\n\nfunction _actionGlobalCopyState() {\n _actionGlobalCopyState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(pinia) {\n return _regeneratorRuntime.wrap(function _callee4$(_context4) {\n while (1) {\n switch (_context4.prev = _context4.next) {\n case 0:\n if (!checkClipboardAccess()) {\n _context4.next = 2;\n break;\n }\n\n return _context4.abrupt(\"return\");\n\n case 2:\n _context4.prev = 2;\n _context4.next = 5;\n return navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n\n case 5:\n toastMessage('Global state copied to clipboard.');\n _context4.next = 14;\n break;\n\n case 8:\n _context4.prev = 8;\n _context4.t0 = _context4[\"catch\"](2);\n\n if (!checkNotFocusedError(_context4.t0)) {\n _context4.next = 12;\n break;\n }\n\n return _context4.abrupt(\"return\");\n\n case 12:\n toastMessage(\"Failed to serialize the state. Check the console for more details.\", 'error');\n console.error(_context4.t0);\n\n case 14:\n case \"end\":\n return _context4.stop();\n }\n }\n }, _callee4, null, [[2, 8]]);\n }));\n return _actionGlobalCopyState.apply(this, arguments);\n}\n\nfunction actionGlobalPasteState(_x2) {\n return _actionGlobalPasteState.apply(this, arguments);\n}\n\nfunction _actionGlobalPasteState() {\n _actionGlobalPasteState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(pinia) {\n return _regeneratorRuntime.wrap(function _callee5$(_context5) {\n while (1) {\n switch (_context5.prev = _context5.next) {\n case 0:\n if (!checkClipboardAccess()) {\n _context5.next = 2;\n break;\n }\n\n return _context5.abrupt(\"return\");\n\n case 2:\n _context5.prev = 2;\n _context5.t0 = JSON;\n _context5.next = 6;\n return navigator.clipboard.readText();\n\n case 6:\n _context5.t1 = _context5.sent;\n pinia.state.value = _context5.t0.parse.call(_context5.t0, _context5.t1);\n toastMessage('Global state pasted from clipboard.');\n _context5.next = 17;\n break;\n\n case 11:\n _context5.prev = 11;\n _context5.t2 = _context5[\"catch\"](2);\n\n if (!checkNotFocusedError(_context5.t2)) {\n _context5.next = 15;\n break;\n }\n\n return _context5.abrupt(\"return\");\n\n case 15:\n toastMessage(\"Failed to deserialize the state from clipboard. Check the console for more details.\", 'error');\n console.error(_context5.t2);\n\n case 17:\n case \"end\":\n return _context5.stop();\n }\n }\n }, _callee5, null, [[2, 11]]);\n }));\n return _actionGlobalPasteState.apply(this, arguments);\n}\n\nfunction actionGlobalSaveState(_x3) {\n return _actionGlobalSaveState.apply(this, arguments);\n}\n\nfunction _actionGlobalSaveState() {\n _actionGlobalSaveState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(pinia) {\n return _regeneratorRuntime.wrap(function _callee6$(_context6) {\n while (1) {\n switch (_context6.prev = _context6.next) {\n case 0:\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8'\n }), 'pinia-state.json');\n } catch (error) {\n toastMessage(\"Failed to export the state as JSON. Check the console for more details.\", 'error');\n console.error(error);\n }\n\n case 1:\n case \"end\":\n return _context6.stop();\n }\n }\n }, _callee6);\n }));\n return _actionGlobalSaveState.apply(this, arguments);\n}\n\nvar fileInput;\n\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n\n function openFile() {\n return new Promise(function (resolve, reject) {\n fileInput.onchange = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {\n var files, file;\n return _regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n files = fileInput.files;\n\n if (files) {\n _context.next = 3;\n break;\n }\n\n return _context.abrupt(\"return\", resolve(null));\n\n case 3:\n file = files.item(0);\n\n if (file) {\n _context.next = 6;\n break;\n }\n\n return _context.abrupt(\"return\", resolve(null));\n\n case 6:\n _context.t0 = resolve;\n _context.next = 9;\n return file.text();\n\n case 9:\n _context.t1 = _context.sent;\n _context.t2 = file;\n _context.t3 = {\n text: _context.t1,\n file: _context.t2\n };\n return _context.abrupt(\"return\", (0, _context.t0)(_context.t3));\n\n case 13:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n })); // @ts-ignore: TODO: changed from 4.3 to 4.4\n\n fileInput.oncancel = function () {\n return resolve(null);\n };\n\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n\n return openFile;\n}\n\nfunction actionGlobalOpenStateFile(_x4) {\n return _actionGlobalOpenStateFile.apply(this, arguments);\n}\n\nfunction _actionGlobalOpenStateFile() {\n _actionGlobalOpenStateFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(pinia) {\n var _open, result, text, file;\n\n return _regeneratorRuntime.wrap(function _callee7$(_context7) {\n while (1) {\n switch (_context7.prev = _context7.next) {\n case 0:\n _context7.prev = 0;\n _context7.next = 3;\n return getFileOpener();\n\n case 3:\n _open = _context7.sent;\n _context7.next = 6;\n return _open();\n\n case 6:\n result = _context7.sent;\n\n if (result) {\n _context7.next = 9;\n break;\n }\n\n return _context7.abrupt(\"return\");\n\n case 9:\n text = result.text, file = result.file;\n pinia.state.value = JSON.parse(text);\n toastMessage(\"Global state imported from \\\"\".concat(file.name, \"\\\".\"));\n _context7.next = 18;\n break;\n\n case 14:\n _context7.prev = 14;\n _context7.t0 = _context7[\"catch\"](0);\n toastMessage(\"Failed to export the state as JSON. Check the console for more details.\", 'error');\n console.error(_context7.t0);\n\n case 18:\n case \"end\":\n return _context7.stop();\n }\n }\n }, _callee7, null, [[0, 14]]);\n }));\n return _actionGlobalOpenStateFile.apply(this, arguments);\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display: display\n }\n };\n}\n\nvar PINIA_ROOT_LABEL = '🍍 Pinia (root)';\nvar PINIA_ROOT_ID = '_root';\n\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store) ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL\n } : {\n id: store.$id,\n label: store.$id\n };\n}\n\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n var storeNames = Array.from(store._s.keys());\n var storeMap = store._s;\n var _state = {\n state: storeNames.map(function (storeId) {\n return {\n editable: true,\n key: storeId,\n value: store.state.value[storeId]\n };\n }),\n getters: storeNames.filter(function (id) {\n return storeMap.get(id)._getters;\n }).map(function (id) {\n var store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce(function (getters, key) {\n getters[key] = store[key];\n return getters;\n }, {})\n };\n })\n };\n return _state;\n }\n\n var state = {\n state: Object.keys(store.$state).map(function (key) {\n return {\n editable: true,\n key: key,\n value: store.$state[key]\n };\n })\n }; // avoid adding empty getters\n\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map(function (getterName) {\n return {\n editable: false,\n key: getterName,\n value: store[getterName]\n };\n });\n }\n\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map(function (key) {\n return {\n editable: true,\n key: key,\n value: store[key]\n };\n });\n }\n\n return state;\n}\n\nfunction formatEventData(events) {\n if (!events) return {};\n\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce(function (data, event) {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {}\n });\n } else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue\n };\n }\n}\n\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n\n case MutationType.patchFunction:\n return '$patch';\n\n case MutationType.patchObject:\n return '$patch';\n\n default:\n return 'unknown';\n }\n} // timeline can be paused when directly changing the state\n\n\nvar isTimelineActive = true;\nvar componentStateTypes = [];\nvar MUTATIONS_LAYER_ID = 'pinia:mutations';\nvar INSPECTOR_ID = 'pinia';\nvar assign$1 = Object.assign;\n/**\r\n * Gets the displayed name of a store in devtools\r\n *\r\n * @param id - id of the store\r\n * @returns a formatted string\r\n */\n\nvar getStoreType = function getStoreType(id) {\n return '🍍 ' + id;\n};\n/**\r\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\r\n * as soon as it is added to the application.\r\n *\r\n * @param app - Vue application\r\n * @param pinia - pinia instance\r\n */\n\n\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes: componentStateTypes,\n app: app\n }, function (api) {\n if (typeof api.now !== 'function') {\n toastMessage('You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');\n }\n\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: \"Pinia \\uD83C\\uDF4D\",\n color: 0xe5df88\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia 🍍',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [{\n icon: 'content_copy',\n action: function action() {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state'\n }, {\n icon: 'content_paste',\n action: function () {\n var _action = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {\n return _regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return actionGlobalPasteState(pinia);\n\n case 2:\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n\n case 4:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n\n function action() {\n return _action.apply(this, arguments);\n }\n\n return action;\n }(),\n tooltip: 'Replace the state with the content of your clipboard'\n }, {\n icon: 'save',\n action: function action() {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file'\n }, {\n icon: 'folder_open',\n action: function () {\n var _action2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {\n return _regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return actionGlobalOpenStateFile(pinia);\n\n case 2:\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n\n case 4:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n function action() {\n return _action2.apply(this, arguments);\n }\n\n return action;\n }(),\n tooltip: 'Import the state from a JSON file'\n }],\n nodeActions: [{\n icon: 'restore',\n tooltip: 'Reset the state (option store only)',\n action: function action(nodeId) {\n var store = pinia._s.get(nodeId);\n\n if (!store) {\n toastMessage(\"Cannot reset \\\"\".concat(nodeId, \"\\\" store because it wasn't found.\"), 'warn');\n } else if (!store._isOptionsAPI) {\n toastMessage(\"Cannot reset \\\"\".concat(nodeId, \"\\\" store because it's a setup store.\"), 'warn');\n } else {\n store.$reset();\n toastMessage(\"Store \\\"\".concat(nodeId, \"\\\" reset.\"));\n }\n }\n }]\n });\n api.on.inspectComponent(function (payload, ctx) {\n var proxy = payload.componentInstance && payload.componentInstance.proxy;\n\n if (proxy && proxy._pStores) {\n var piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach(function (store) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [{\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: function action() {\n return store.$reset();\n }\n }]\n }\n } : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce(function (state, key) {\n state[key] = store.$state[key];\n return state;\n }, {})\n });\n\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce(function (getters, key) {\n try {\n getters[key] = store[key];\n } catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n\n return getters;\n }, {})\n });\n }\n });\n }\n });\n api.on.getInspectorTree(function (payload) {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n var stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter ? stores.filter(function (store) {\n return '$id' in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase());\n }) : stores).map(formatStoreForInspectorTree);\n }\n });\n api.on.getInspectorState(function (payload) {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n var inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);\n\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n\n if (inspectedStore) {\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState(function (payload, ctx) {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n var inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);\n\n if (!inspectedStore) {\n return toastMessage(\"store \\\"\".concat(payload.nodeId, \"\\\" not found\"), 'error');\n }\n\n var path = payload.path;\n\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n } else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState(function (payload) {\n if (payload.type.startsWith('🍍')) {\n var storeId = payload.type.replace(/^🍍\\s*/, '');\n\n var store = pinia._s.get(storeId);\n\n if (!store) {\n return toastMessage(\"store \\\"\".concat(storeId, \"\\\" not found\"), 'error');\n }\n\n var path = payload.path;\n\n if (path[0] !== 'state') {\n return toastMessage(\"Invalid path for store \\\"\".concat(storeId, \"\\\":\\n\").concat(path, \"\\nOnly state can be modified.\"));\n } // rewrite the first entry to be able to directly set the state as\n // well as any other path\n\n\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\n\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia 🍍',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes: componentStateTypes,\n app: app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true\n } // useEmojis: {\n // label: 'Use emojis in messages ⚡️',\n // type: 'boolean',\n // defaultValue: true,\n // },\n\n }\n }, function (api) {\n // gracefully handle errors\n var now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(function (_ref3) {\n var after = _ref3.after,\n onError = _ref3.onError,\n name = _ref3.name,\n args = _ref3.args;\n var groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛫 ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args: args\n },\n groupId: groupId\n }\n });\n after(function (result) {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🛬 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args: args,\n result: result\n },\n groupId: groupId\n }\n });\n });\n onError(function (error) {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '💥 ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args: args,\n error: error\n },\n groupId: groupId\n }\n });\n });\n }, true);\n\n store._customProperties.forEach(function (name) {\n watch(function () {\n return unref(store[name]);\n }, function (newValue, oldValue) {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue: newValue,\n oldValue: oldValue\n },\n groupId: activeAction\n }\n });\n }\n }, {\n deep: true\n });\n });\n\n store.$subscribe(function (_ref4, state) {\n var events = _ref4.events,\n type = _ref4.type;\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive) return; // rootStore.state[store.id] = state\n\n var eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({\n store: formatDisplay(store.$id)\n }, formatEventData(events)),\n groupId: activeAction\n }; // reset for the next mutation\n\n activeAction = undefined;\n\n if (type === MutationType.patchFunction) {\n eventData.subtitle = '⤵️';\n } else if (type === MutationType.patchObject) {\n eventData.subtitle = '🧩';\n } else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events\n }\n };\n }\n\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData\n });\n }, {\n detached: true,\n flush: 'sync'\n });\n var hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw(function (newStore) {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '🔥 ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(\"HMR update\")\n }\n }\n }); // update the devtools too\n\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n var $dispose = store.$dispose;\n\n store.$dispose = function () {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges && toastMessage(\"Disposed \\\"\".concat(store.$id, \"\\\" store \\uD83D\\uDDD1\"));\n }; // trigger an update so it can display new registered stores\n\n\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges && toastMessage(\"\\\"\".concat(store.$id, \"\\\" store installed \\uD83C\\uDD95\"));\n });\n}\n\nvar runningActionId = 0;\nvar activeAction;\n/**\r\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\r\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\r\n * mutation to the action.\r\n *\r\n * @param store - store to patch\r\n * @param actionNames - list of actionst to patch\r\n */\n\nfunction patchActionForGrouping(store, actionNames) {\n // original actions of the store as they are given by pinia. We are going to override them\n var actions = actionNames.reduce(function (storeActions, actionName) {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n\n var _loop = function _loop(actionName) {\n store[actionName] = function () {\n // setActivePinia(store._p)\n // the running action id is incremented in a before action hook\n var _actionId = runningActionId;\n var trackedStore = new Proxy(store, {\n get: function get() {\n activeAction = _actionId;\n return Reflect.get.apply(Reflect, arguments);\n },\n set: function set() {\n activeAction = _actionId;\n return Reflect.set.apply(Reflect, arguments);\n }\n });\n return actions[actionName].apply(trackedStore, arguments);\n };\n };\n\n for (var actionName in actions) {\n _loop(actionName);\n }\n}\n/**\r\n * pinia.use(devtoolsPlugin)\r\n */\n\n\nfunction devtoolsPlugin(_ref5) {\n var app = _ref5.app,\n store = _ref5.store,\n options = _ref5.options;\n\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n } // detect option api vs setup api\n\n\n if (options.state) {\n store._isOptionsAPI = true;\n } // only wrap actions in option-defined stores as this technique relies on\n // wrapping the context of the action with a proxy\n\n\n if (typeof options.state === 'function') {\n patchActionForGrouping( // @ts-expect-error: can cast the store...\n store, Object.keys(options.actions));\n var originalHotUpdate = store._hotUpdate; // Upgrade the HMR to also update the new actions\n\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions));\n };\n }\n\n addStoreToDevtools(app, // FIXME: is there a way to allow the assignment from Store to StoreGeneric?\n store);\n}\n/**\r\n * Creates a Pinia instance to be used by the application\r\n */\n\n\nfunction createPinia() {\n var scope = effectScope(true); // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n\n var state = scope.run(function () {\n return ref({});\n });\n var _p = []; // plugins added before calling app.use(pinia)\n\n var toBeInstalled = [];\n var pinia = markRaw({\n install: function install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n\n if (!isVue2) {\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n\n if (USE_DEVTOOLS) {\n registerPiniaDevtools(app, pinia);\n }\n\n toBeInstalled.forEach(function (plugin) {\n return _p.push(plugin);\n });\n toBeInstalled = [];\n }\n },\n use: function use(plugin) {\n if (!this._a && !isVue2) {\n toBeInstalled.push(plugin);\n } else {\n _p.push(plugin);\n }\n\n return this;\n },\n _p: _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state: state\n }); // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n\n if (USE_DEVTOOLS && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n\n return pinia;\n}\n/**\r\n * Checks if a function is a `StoreDefinition`.\r\n *\r\n * @param fn - object to test\r\n * @returns true if `fn` is a StoreDefinition\r\n */\n\n\nvar isUseStore = function isUseStore(fn) {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\r\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\r\n * remove any key not existing in `newState` and recursively merge plain\r\n * objects.\r\n *\r\n * @param newState - new state object to be patched\r\n * @param oldState - old state that should be used to patch newState\r\n * @returns - newState\r\n */\n\n\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (var key in oldState) {\n var subPatch = oldState[key]; // skip the whole sub tree\n\n if (!(key in newState)) {\n continue;\n }\n\n var targetValue = newState[key];\n\n if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n } else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n if (isVue2) {\n set(newState, key, subPatch);\n } else {\n newState[key] = subPatch;\n }\n }\n }\n\n return newState;\n}\n/**\r\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\r\n *\r\n * @example\r\n * ```js\r\n * const useUser = defineStore(...)\r\n * if (import.meta.hot) {\r\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\r\n * }\r\n * ```\r\n *\r\n * @param initialUseStore - return of the defineStore to hot update\r\n * @param hot - `import.meta.hot`\r\n */\n\n\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return function () {};\n }\n\n return function (newModule) {\n var pinia = hot.data.pinia || initialUseStore._pinia;\n\n if (!pinia) {\n // this store is still not used\n return;\n } // preserve the pinia instance across loads\n\n\n hot.data.pinia = pinia; // console.log('got data', newStore)\n\n for (var exportName in newModule) {\n var useStore = newModule[exportName]; // console.log('checking for', exportName)\n\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n var id = useStore.$id;\n\n if (id !== initialUseStore.$id) {\n console.warn(\"The id of the store changed from \\\"\".concat(initialUseStore.$id, \"\\\" to \\\"\").concat(id, \"\\\". Reloading.\")); // return import.meta.hot.invalidate()\n\n return hot.invalidate();\n }\n\n var existingStore = pinia._s.get(id);\n\n if (!existingStore) {\n console.log(\"[Pinia]: skipping hmr because store doesn't exist yet\");\n return;\n }\n\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nvar noop = function noop() {};\n\nfunction addSubscription(subscriptions, callback, detached) {\n var onCleanup = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : noop;\n subscriptions.push(callback);\n\n var removeSubscription = function removeSubscription() {\n var idx = subscriptions.indexOf(callback);\n\n if (idx > -1) {\n subscriptions.splice(idx, 1);\n onCleanup();\n }\n };\n\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n\n return removeSubscription;\n}\n\nfunction triggerSubscriptions(subscriptions) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n\n subscriptions.slice().forEach(function (callback) {\n callback.apply(void 0, args);\n });\n}\n\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach(function (value, key) {\n return target.set(key, value);\n });\n } // Handle Set instances\n\n\n if (target instanceof Set && patchToApply instanceof Set) {\n patchToApply.forEach(target.add, target);\n } // no need to go through symbols because they cannot be serialized anyway\n\n\n for (var key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key)) continue;\n var subPatch = patchToApply[key];\n var targetValue = target[key];\n\n if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n } else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n\n return target;\n}\n\nvar skipHydrateSymbol = process.env.NODE_ENV !== 'production' ? Symbol('pinia:skipHydration') :\n/* istanbul ignore next */\nSymbol();\nvar skipHydrateMap = /*#__PURE__*/new WeakMap();\n/**\r\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\r\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\r\n *\r\n * @param obj - target object\r\n * @returns obj\r\n */\n\nfunction skipHydrate(obj) {\n return isVue2 ? // in @vue/composition-api, the refs are sealed so defineProperty doesn't work...\n\n /* istanbul ignore next */\n skipHydrateMap.set(obj, 1) && obj : Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\r\n * Returns whether a value should be hydrated\r\n *\r\n * @param obj - target variable\r\n * @returns true if `obj` should be hydrated\r\n */\n\n\nfunction shouldHydrate(obj) {\n return isVue2 ?\n /* istanbul ignore next */\n !skipHydrateMap.has(obj) : !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);\n}\n\nvar assign = Object.assign;\n\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\n\nfunction createOptionsStore(id, options, pinia, hot) {\n var state = options.state,\n actions = options.actions,\n getters = options.getters;\n var initialState = pinia.state.value[id];\n var store;\n\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, id, state ? state() : {});\n } else {\n pinia.state.value[id] = state ? state() : {};\n }\n } // avoid creating a state in pinia.state.value\n\n\n var localState = process.env.NODE_ENV !== 'production' && hot ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce(function (computedGetters, name) {\n if (process.env.NODE_ENV !== 'production' && name in localState) {\n console.warn(\"[\\uD83C\\uDF4D]: A getter cannot have the same name as another state property. Rename one of them. Found with \\\"\".concat(name, \"\\\" in store \\\"\").concat(id, \"\\\".\"));\n }\n\n computedGetters[name] = markRaw(computed(function () {\n setActivePinia(pinia); // it was created just before\n\n var store = pinia._s.get(id); // allow cross using stores\n\n /* istanbul ignore next */\n\n\n if (isVue2 && !store._r) return; // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n\n store = createSetupStore(id, setup, options, pinia, hot, true);\n\n store.$reset = function $reset() {\n var newState = state ? state() : {}; // we use a patch to group all changes into one single subscription\n\n this.$patch(function ($state) {\n assign($state, newState);\n });\n };\n\n return store;\n}\n\nfunction createSetupStore($id, setup) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var pinia = arguments.length > 3 ? arguments[3] : undefined;\n var hot = arguments.length > 4 ? arguments[4] : undefined;\n var isOptionsStore = arguments.length > 5 ? arguments[5] : undefined;\n var scope;\n var optionsForPlugin = assign({\n actions: {}\n }, options);\n /* istanbul ignore if */\n // @ts-expect-error: active is an internal property\n\n if (process.env.NODE_ENV !== 'production' && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n } // watcher options for $subscribe\n\n\n var $subscribeOptions = {\n deep: true // flush: 'post',\n\n };\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production' && !isVue2) {\n $subscribeOptions.onTrigger = function (event) {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event; // avoid triggering this while the store is being built and the state is being set in pinia\n } else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n } else {\n console.error('🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n } // internal state\n\n\n var isListening; // set to true at the end\n\n var isSyncListening; // set to true at the end\n\n var subscriptions = markRaw([]);\n var actionSubscriptions = markRaw([]);\n var debuggerEvents;\n var initialState = pinia.state.value[$id]; // avoid setting the state for option stores if it is set\n // by the setup\n\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, $id, {});\n } else {\n pinia.state.value[$id] = {};\n }\n }\n\n var hotState = ref({}); // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n\n var activeListener;\n\n function $patch(partialStateOrMutator) {\n var subscriptionMutation;\n isListening = isSyncListening = false; // reset the debugger events since patches are sync\n\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production') {\n debuggerEvents = [];\n }\n\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents\n };\n } else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents\n };\n }\n\n var myListenerId = activeListener = Symbol();\n nextTick().then(function () {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true; // because we paused the watcher, we need to manually call the subscriptions\n\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n /* istanbul ignore next */\n\n\n var $reset = process.env.NODE_ENV !== 'production' ? function () {\n throw new Error(\"\\uD83C\\uDF4D: Store \\\"\".concat($id, \"\\\" is built using the setup syntax and does not implement $reset().\"));\n } : noop;\n\n function $dispose() {\n scope.stop();\n subscriptions = [];\n actionSubscriptions = [];\n\n pinia._s.delete($id);\n }\n /**\r\n * Wraps an action to handle subscriptions.\r\n *\r\n * @param name - name of the action\r\n * @param action - action to wrap\r\n * @returns a wrapped action to handle subscriptions\r\n */\n\n\n function wrapAction(name, action) {\n return function () {\n setActivePinia(pinia);\n var args = Array.from(arguments);\n var afterCallbackList = [];\n var onErrorCallbackList = [];\n\n function after(callback) {\n afterCallbackList.push(callback);\n }\n\n function onError(callback) {\n onErrorCallbackList.push(callback);\n } // @ts-expect-error\n\n\n triggerSubscriptions(actionSubscriptions, {\n args: args,\n name: name,\n store: store,\n after: after,\n onError: onError\n });\n var ret;\n\n try {\n ret = action.apply(this && this.$id === $id ? this : store, args); // handle sync errors\n } catch (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n throw error;\n }\n\n if (ret instanceof Promise) {\n return ret.then(function (value) {\n triggerSubscriptions(afterCallbackList, value);\n return value;\n }).catch(function (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n return Promise.reject(error);\n });\n } // allow the afterCallback to override the return value\n\n\n triggerSubscriptions(afterCallbackList, ret);\n return ret;\n };\n }\n\n var _hmrPayload = /*#__PURE__*/markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState: hotState\n });\n\n var partialStore = {\n _p: pinia,\n // _s: scope,\n $id: $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch: $patch,\n $reset: $reset,\n $subscribe: function $subscribe(callback) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var removeSubscription = addSubscription(subscriptions, callback, options.detached, function () {\n return stopWatcher();\n });\n var stopWatcher = scope.run(function () {\n return watch(function () {\n return pinia.state.value[$id];\n }, function (state) {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents\n }, state);\n }\n }, assign({}, $subscribeOptions, options));\n });\n return removeSubscription;\n },\n $dispose: $dispose\n };\n /* istanbul ignore if */\n\n if (isVue2) {\n // start as non ready\n partialStore._r = false;\n }\n\n var store = reactive(process.env.NODE_ENV !== 'production' || USE_DEVTOOLS ? assign({\n _hmrPayload: _hmrPayload,\n _customProperties: markRaw(new Set()) // devtools custom properties\n\n }, partialStore // must be added later\n // setupStore\n ) : partialStore); // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n\n pinia._s.set($id, store); // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n\n\n var setupStore = pinia._e.run(function () {\n scope = effectScope();\n return scope.run(function () {\n return setup();\n });\n }); // overwrite existing actions to support $onAction\n\n\n for (var key in setupStore) {\n var prop = setupStore[key];\n\n if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if (process.env.NODE_ENV !== 'production' && hot) {\n set(hotState.value, key, toRef(setupStore, key)); // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n } else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n } else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n } // transfer the ref to the pinia state to keep everything in sync\n\n /* istanbul ignore if */\n\n\n if (isVue2) {\n set(pinia.state.value[$id], key, prop);\n } else {\n pinia.state.value[$id][key] = prop;\n }\n }\n /* istanbul ignore else */\n\n\n if (process.env.NODE_ENV !== 'production') {\n _hmrPayload.state.push(key);\n } // action\n\n } else if (typeof prop === 'function') {\n // @ts-expect-error: we are overriding the function we avoid wrapping if\n var actionValue = process.env.NODE_ENV !== 'production' && hot ? prop : wrapAction(key, prop); // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n\n /* istanbul ignore if */\n\n if (isVue2) {\n set(setupStore, key, actionValue);\n } else {\n // @ts-expect-error\n setupStore[key] = actionValue;\n }\n /* istanbul ignore else */\n\n\n if (process.env.NODE_ENV !== 'production') {\n _hmrPayload.actions[key] = prop;\n } // list actions so they can be used in plugins\n // @ts-expect-error\n\n\n optionsForPlugin.actions[key] = prop;\n } else if (process.env.NODE_ENV !== 'production') {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore ? // @ts-expect-error\n options.getters[key] : prop;\n\n if (IS_CLIENT) {\n var getters = setupStore._getters || ( // @ts-expect-error: same\n setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n } // add the state, getters, and action properties\n\n /* istanbul ignore if */\n\n\n if (isVue2) {\n Object.keys(setupStore).forEach(function (key) {\n set(store, key, setupStore[key]);\n });\n } else {\n assign(store, setupStore); // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n\n assign(toRaw(store), setupStore);\n } // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n\n\n Object.defineProperty(store, '$state', {\n get: function get() {\n return process.env.NODE_ENV !== 'production' && hot ? hotState.value : pinia.state.value[$id];\n },\n set: function set(state) {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && hot) {\n throw new Error('cannot set hotState');\n }\n\n $patch(function ($state) {\n assign($state, state);\n });\n }\n }); // add the hotUpdate before plugins to allow them to override it\n\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production') {\n store._hotUpdate = markRaw(function (newStore) {\n store._hotUpdating = true;\n\n newStore._hmrPayload.state.forEach(function (stateKey) {\n if (stateKey in store.$state) {\n var newStateTarget = newStore.$state[stateKey];\n var oldStateSource = store.$state[stateKey];\n\n if (_typeof(newStateTarget) === 'object' && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n } else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n } // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n\n\n set(store, stateKey, toRef(newStore.$state, stateKey));\n }); // remove deleted state properties\n\n\n Object.keys(store.$state).forEach(function (stateKey) {\n if (!(stateKey in newStore.$state)) {\n del(store, stateKey);\n }\n }); // avoid devtools logging this as a mutation\n\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(function () {\n isListening = true;\n });\n\n for (var actionName in newStore._hmrPayload.actions) {\n var action = newStore[actionName];\n set(store, actionName, wrapAction(actionName, action));\n } // TODO: does this work in both setup and option store?\n\n\n var _loop2 = function _loop2(getterName) {\n var getter = newStore._hmrPayload.getters[getterName];\n var getterValue = isOptionsStore ? // special handling of options api\n computed(function () {\n setActivePinia(pinia);\n return getter.call(store, store);\n }) : getter;\n set(store, getterName, getterValue);\n };\n\n for (var getterName in newStore._hmrPayload.getters) {\n _loop2(getterName);\n } // remove deleted getters\n\n\n Object.keys(store._hmrPayload.getters).forEach(function (key) {\n if (!(key in newStore._hmrPayload.getters)) {\n del(store, key);\n }\n }); // remove old actions\n\n Object.keys(store._hmrPayload.actions).forEach(function (key) {\n if (!(key in newStore._hmrPayload.actions)) {\n del(store, key);\n }\n }); // update the values used in devtools and to allow deleting new properties later on\n\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n\n if (USE_DEVTOOLS) {\n var nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach(function (p) {\n Object.defineProperty(store, p, assign({\n value: store[p]\n }, nonEnumerable));\n });\n }\n /* istanbul ignore if */\n\n\n if (isVue2) {\n // mark the store as ready before plugins\n store._r = true;\n } // apply all plugins\n\n\n pinia._p.forEach(function (extender) {\n /* istanbul ignore else */\n if (USE_DEVTOOLS) {\n var extensions = scope.run(function () {\n return extender({\n store: store,\n app: pinia._a,\n pinia: pinia,\n options: optionsForPlugin\n });\n });\n Object.keys(extensions || {}).forEach(function (key) {\n return store._customProperties.add(key);\n });\n assign(store, extensions);\n } else {\n assign(store, scope.run(function () {\n return extender({\n store: store,\n app: pinia._a,\n pinia: pinia,\n options: optionsForPlugin\n });\n }));\n }\n });\n\n if (process.env.NODE_ENV !== 'production' && store.$state && _typeof(store.$state) === 'object' && typeof store.$state.constructor === 'function' && !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(\"[\\uD83C\\uDF4D]: The \\\"state\\\" must be a plain object. It cannot be\\n\" + \"\\tstate: () => new MyClass()\\n\" + \"Found in store \\\"\".concat(store.$id, \"\\\".\"));\n } // only apply hydrate to option stores with an initial state in pinia\n\n\n if (initialState && isOptionsStore && options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n\n isListening = true;\n isSyncListening = true;\n return store;\n}\n\nfunction defineStore( // TODO: add proper types from above\nidOrOptions, setup, setupOptions) {\n var id;\n var options;\n var isSetupStore = typeof setup === 'function';\n\n if (typeof idOrOptions === 'string') {\n id = idOrOptions; // the option store setup will contain the actual options in this case\n\n options = isSetupStore ? setupOptions : setup;\n } else {\n options = idOrOptions;\n id = idOrOptions.id;\n }\n\n function useStore(pinia, hot) {\n var currentInstance = getCurrentInstance();\n pinia = // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n (process.env.NODE_ENV === 'test' && activePinia && activePinia._testing ? null : pinia) || currentInstance && inject(piniaSymbol, null);\n if (pinia) setActivePinia(pinia);\n\n if (process.env.NODE_ENV !== 'production' && !activePinia) {\n throw new Error(\"[\\uD83C\\uDF4D]: getActivePinia was called with no active Pinia. Did you forget to install pinia?\\n\" + \"\\tconst pinia = createPinia()\\n\" + \"\\tapp.use(pinia)\\n\" + \"This will fail in production.\");\n }\n\n pinia = activePinia;\n\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n } else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n\n\n if (process.env.NODE_ENV !== 'production') {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n\n var store = pinia._s.get(id);\n\n if (process.env.NODE_ENV !== 'production' && hot) {\n var hotId = '__hot:' + id;\n var newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);\n\n hot._hotUpdate(newStore); // cleanup the state properties and the store from the cache\n\n\n delete pinia.state.value[hotId];\n\n pinia._s.delete(hotId);\n } // save stores in instances to access them devtools\n\n\n if (process.env.NODE_ENV !== 'production' && IS_CLIENT && currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement\n !hot) {\n var vm = currentInstance.proxy;\n var cache = '_pStores' in vm ? vm._pStores : vm._pStores = {};\n cache[id] = store;\n } // StoreGeneric cannot be casted towards Store\n\n\n return store;\n }\n\n useStore.$id = id;\n return useStore;\n}\n\nvar mapStoreSuffix = 'Store';\n/**\r\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\r\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\r\n * interface if you are using TypeScript.\r\n *\r\n * @param suffix - new suffix\r\n */\n\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\r\n * Allows using stores without the composition API (`setup()`) by generating an\r\n * object to be spread in the `computed` field of a component. It accepts a list\r\n * of store definitions.\r\n *\r\n * @example\r\n * ```js\r\n * export default {\r\n * computed: {\r\n * // other computed properties\r\n * ...mapStores(useUserStore, useCartStore)\r\n * },\r\n *\r\n * created() {\r\n * this.userStore // store with id \"user\"\r\n * this.cartStore // store with id \"cart\"\r\n * }\r\n * }\r\n * ```\r\n *\r\n * @param stores - list of stores to map to an object\r\n */\n\n\nfunction mapStores() {\n for (var _len2 = arguments.length, stores = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n stores[_key2] = arguments[_key2];\n }\n\n if (process.env.NODE_ENV !== 'production' && Array.isArray(stores[0])) {\n console.warn(\"[\\uD83C\\uDF4D]: Directly pass all stores to \\\"mapStores()\\\" without putting them in an array:\\n\" + \"Replace\\n\" + \"\\tmapStores([useAuthStore, useCartStore])\\n\" + \"with\\n\" + \"\\tmapStores(useAuthStore, useCartStore)\\n\" + \"This will fail in production if not fixed.\");\n stores = stores[0];\n }\n\n return stores.reduce(function (reduced, useStore) {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n\n return reduced;\n }, {});\n}\n/**\r\n * Allows using state and getters from one store without using the composition\r\n * API (`setup()`) by generating an object to be spread in the `computed` field\r\n * of a component.\r\n *\r\n * @param useStore - store to map from\r\n * @param keysOrMapper - array or object\r\n */\n\n\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper) ? keysOrMapper.reduce(function (reduced, key) {\n reduced[key] = function () {\n return useStore(this.$pinia)[key];\n };\n\n return reduced;\n }, {}) : Object.keys(keysOrMapper).reduce(function (reduced, key) {\n // @ts-expect-error\n reduced[key] = function () {\n var store = useStore(this.$pinia);\n var storeKey = keysOrMapper[key]; // for some reason TS is unable to infer the type of storeKey to be a\n // function\n\n return typeof storeKey === 'function' ? storeKey.call(this, store) : store[storeKey];\n };\n\n return reduced;\n }, {});\n}\n/**\r\n * Alias for `mapState()`. You should use `mapState()` instead.\r\n * @deprecated use `mapState()` instead.\r\n */\n\n\nvar mapGetters = mapState;\n/**\r\n * Allows directly using actions from your store without using the composition\r\n * API (`setup()`) by generating an object to be spread in the `methods` field\r\n * of a component.\r\n *\r\n * @param useStore - store to map from\r\n * @param keysOrMapper - array or object\r\n */\n\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper) ? keysOrMapper.reduce(function (reduced, key) {\n // @ts-expect-error\n reduced[key] = function () {\n var _useStore;\n\n return (_useStore = useStore(this.$pinia))[key].apply(_useStore, arguments);\n };\n\n return reduced;\n }, {}) : Object.keys(keysOrMapper).reduce(function (reduced, key) {\n // @ts-expect-error\n reduced[key] = function () {\n var _useStore2;\n\n return (_useStore2 = useStore(this.$pinia))[keysOrMapper[key]].apply(_useStore2, arguments);\n };\n\n return reduced;\n }, {});\n}\n/**\r\n * Allows using state and getters from one store without using the composition\r\n * API (`setup()`) by generating an object to be spread in the `computed` field\r\n * of a component.\r\n *\r\n * @param useStore - store to map from\r\n * @param keysOrMapper - array or object\r\n */\n\n\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper) ? keysOrMapper.reduce(function (reduced, key) {\n // @ts-ignore\n reduced[key] = {\n get: function get() {\n return useStore(this.$pinia)[key];\n },\n set: function set(value) {\n // it's easier to type it here as any\n return useStore(this.$pinia)[key] = value;\n }\n };\n return reduced;\n }, {}) : Object.keys(keysOrMapper).reduce(function (reduced, key) {\n // @ts-ignore\n reduced[key] = {\n get: function get() {\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set: function set(value) {\n // it's easier to type it here as any\n return useStore(this.$pinia)[keysOrMapper[key]] = value;\n }\n };\n return reduced;\n }, {});\n}\n/**\r\n * Creates an object of references with all the state, getters, and plugin-added\r\n * state properties of the store. Similar to `toRefs()` but specifically\r\n * designed for Pinia stores so methods and non reactive properties are\r\n * completely ignored.\r\n *\r\n * @param store - store to extract the refs from\r\n */\n\n\nfunction storeToRefs(store) {\n // See https://github.com/vuejs/pinia/issues/852\n // It's easier to just use toRefs() even if it includes more stuff\n if (isVue2) {\n // @ts-expect-error: toRefs include methods and others\n return toRefs(store);\n } else {\n store = toRaw(store);\n var refs = {};\n\n for (var key in store) {\n var value = store[key];\n\n if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] = // ---\n toRef(store, key);\n }\n }\n\n return refs;\n }\n}\n/**\r\n * Vue 2 Plugin that must be installed for pinia to work. Note **you don't need\r\n * this plugin if you are using Nuxt.js**. Use the `buildModule` instead:\r\n * https://pinia.vuejs.org/ssr/nuxt.html.\r\n *\r\n * @example\r\n * ```js\r\n * import Vue from 'vue'\r\n * import { PiniaVuePlugin, createPinia } from 'pinia'\r\n *\r\n * Vue.use(PiniaVuePlugin)\r\n * const pinia = createPinia()\r\n *\r\n * new Vue({\r\n * el: '#app',\r\n * // ...\r\n * pinia,\r\n * })\r\n * ```\r\n *\r\n * @param _Vue - `Vue` imported from 'vue'.\r\n */\n\n\nvar PiniaVuePlugin = function PiniaVuePlugin(_Vue) {\n // Equivalent of\n // app.config.globalProperties.$pinia = pinia\n _Vue.mixin({\n beforeCreate: function beforeCreate() {\n var options = this.$options;\n\n if (options.pinia) {\n var pinia = options.pinia; // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/main/src/apis/inject.ts#L31\n\n /* istanbul ignore else */\n\n if (!this._provided) {\n var provideCache = {};\n Object.defineProperty(this, '_provided', {\n get: function get() {\n return provideCache;\n },\n set: function set(v) {\n return Object.assign(provideCache, v);\n }\n });\n }\n\n this._provided[piniaSymbol] = pinia; // propagate the pinia instance in an SSR friendly way\n // avoid adding it to nuxt twice\n\n /* istanbul ignore else */\n\n if (!this.$pinia) {\n this.$pinia = pinia;\n }\n\n pinia._a = this;\n\n if (IS_CLIENT) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n }\n\n if (USE_DEVTOOLS) {\n registerPiniaDevtools(pinia._a, pinia);\n }\n } else if (!this.$pinia && options.parent && options.parent.$pinia) {\n this.$pinia = options.parent.$pinia;\n }\n },\n destroyed: function destroyed() {\n delete this._pStores;\n }\n });\n};\n\nexport { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, skipHydrate, storeToRefs };","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nvar Barcode = function Barcode(data, options) {\n _classCallCheck(this, Barcode);\n\n this.data = data;\n this.text = options.text || data;\n this.options = options;\n};\n\nexports.default = Barcode;","var global = require('../internals/global');\nvar shared = require('../internals/shared');\nvar hasOwn = require('../internals/has-own-property');\nvar uid = require('../internals/uid');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar WellKnownSymbolsStore = shared('wks');\nvar Symbol = global.Symbol;\nvar createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;\n\nmodule.exports = function (name) {\n if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {\n if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {\n WellKnownSymbolsStore[name] = Symbol[name];\n } else {\n WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);\n }\n } return WellKnownSymbolsStore[name];\n};\n","'use strict';\n\nvar inherits = require('inherits');\n\nvar HashBase = require('hash-base');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar ARRAY16 = new Array(16);\n\nfunction MD5() {\n HashBase.call(this, 64); // state\n\n this._a = 0x67452301;\n this._b = 0xefcdab89;\n this._c = 0x98badcfe;\n this._d = 0x10325476;\n}\n\ninherits(MD5, HashBase);\n\nMD5.prototype._update = function () {\n var M = ARRAY16;\n\n for (var i = 0; i < 16; ++i) {\n M[i] = this._block.readInt32LE(i * 4);\n }\n\n var a = this._a;\n var b = this._b;\n var c = this._c;\n var d = this._d;\n a = fnF(a, b, c, d, M[0], 0xd76aa478, 7);\n d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12);\n c = fnF(c, d, a, b, M[2], 0x242070db, 17);\n b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22);\n a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7);\n d = fnF(d, a, b, c, M[5], 0x4787c62a, 12);\n c = fnF(c, d, a, b, M[6], 0xa8304613, 17);\n b = fnF(b, c, d, a, M[7], 0xfd469501, 22);\n a = fnF(a, b, c, d, M[8], 0x698098d8, 7);\n d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12);\n c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17);\n b = fnF(b, c, d, a, M[11], 0x895cd7be, 22);\n a = fnF(a, b, c, d, M[12], 0x6b901122, 7);\n d = fnF(d, a, b, c, M[13], 0xfd987193, 12);\n c = fnF(c, d, a, b, M[14], 0xa679438e, 17);\n b = fnF(b, c, d, a, M[15], 0x49b40821, 22);\n a = fnG(a, b, c, d, M[1], 0xf61e2562, 5);\n d = fnG(d, a, b, c, M[6], 0xc040b340, 9);\n c = fnG(c, d, a, b, M[11], 0x265e5a51, 14);\n b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20);\n a = fnG(a, b, c, d, M[5], 0xd62f105d, 5);\n d = fnG(d, a, b, c, M[10], 0x02441453, 9);\n c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14);\n b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20);\n a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5);\n d = fnG(d, a, b, c, M[14], 0xc33707d6, 9);\n c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14);\n b = fnG(b, c, d, a, M[8], 0x455a14ed, 20);\n a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5);\n d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9);\n c = fnG(c, d, a, b, M[7], 0x676f02d9, 14);\n b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20);\n a = fnH(a, b, c, d, M[5], 0xfffa3942, 4);\n d = fnH(d, a, b, c, M[8], 0x8771f681, 11);\n c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16);\n b = fnH(b, c, d, a, M[14], 0xfde5380c, 23);\n a = fnH(a, b, c, d, M[1], 0xa4beea44, 4);\n d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11);\n c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16);\n b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23);\n a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4);\n d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11);\n c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16);\n b = fnH(b, c, d, a, M[6], 0x04881d05, 23);\n a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4);\n d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11);\n c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16);\n b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23);\n a = fnI(a, b, c, d, M[0], 0xf4292244, 6);\n d = fnI(d, a, b, c, M[7], 0x432aff97, 10);\n c = fnI(c, d, a, b, M[14], 0xab9423a7, 15);\n b = fnI(b, c, d, a, M[5], 0xfc93a039, 21);\n a = fnI(a, b, c, d, M[12], 0x655b59c3, 6);\n d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10);\n c = fnI(c, d, a, b, M[10], 0xffeff47d, 15);\n b = fnI(b, c, d, a, M[1], 0x85845dd1, 21);\n a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6);\n d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10);\n c = fnI(c, d, a, b, M[6], 0xa3014314, 15);\n b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21);\n a = fnI(a, b, c, d, M[4], 0xf7537e82, 6);\n d = fnI(d, a, b, c, M[11], 0xbd3af235, 10);\n c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15);\n b = fnI(b, c, d, a, M[9], 0xeb86d391, 21);\n this._a = this._a + a | 0;\n this._b = this._b + b | 0;\n this._c = this._c + c | 0;\n this._d = this._d + d | 0;\n};\n\nMD5.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80;\n\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64);\n\n this._update();\n\n this._blockOffset = 0;\n }\n\n this._block.fill(0, this._blockOffset, 56);\n\n this._block.writeUInt32LE(this._length[0], 56);\n\n this._block.writeUInt32LE(this._length[1], 60);\n\n this._update(); // produce result\n\n\n var buffer = Buffer.allocUnsafe(16);\n buffer.writeInt32LE(this._a, 0);\n buffer.writeInt32LE(this._b, 4);\n buffer.writeInt32LE(this._c, 8);\n buffer.writeInt32LE(this._d, 12);\n return buffer;\n};\n\nfunction rotl(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction fnF(a, b, c, d, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;\n}\n\nfunction fnG(a, b, c, d, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;\n}\n\nfunction fnH(a, b, c, d, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;\n}\n\nfunction fnI(a, b, c, d, m, k, s) {\n return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;\n}\n\nmodule.exports = MD5;","/**\n * Module exports.\n */\nmodule.exports = deprecate;\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate(fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n\n warned = true;\n }\n\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\n\nfunction config(name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","'use strict';\n\nvar Buffer = require('buffer').Buffer;\n\nvar inherits = require('inherits');\n\nvar HashBase = require('hash-base');\n\nvar ARRAY16 = new Array(16);\nvar zl = [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];\nvar zr = [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];\nvar sl = [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];\nvar sr = [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];\nvar hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e];\nvar hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000];\n\nfunction RIPEMD160() {\n HashBase.call(this, 64); // state\n\n this._a = 0x67452301;\n this._b = 0xefcdab89;\n this._c = 0x98badcfe;\n this._d = 0x10325476;\n this._e = 0xc3d2e1f0;\n}\n\ninherits(RIPEMD160, HashBase);\n\nRIPEMD160.prototype._update = function () {\n var words = ARRAY16;\n\n for (var j = 0; j < 16; ++j) {\n words[j] = this._block.readInt32LE(j * 4);\n }\n\n var al = this._a | 0;\n var bl = this._b | 0;\n var cl = this._c | 0;\n var dl = this._d | 0;\n var el = this._e | 0;\n var ar = this._a | 0;\n var br = this._b | 0;\n var cr = this._c | 0;\n var dr = this._d | 0;\n var er = this._e | 0; // computation\n\n for (var i = 0; i < 80; i += 1) {\n var tl;\n var tr;\n\n if (i < 16) {\n tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]);\n tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]);\n } else if (i < 32) {\n tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]);\n tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]);\n } else if (i < 48) {\n tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]);\n tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]);\n } else if (i < 64) {\n tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]);\n tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]);\n } else {\n // if (i<80) {\n tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]);\n tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]);\n }\n\n al = el;\n el = dl;\n dl = rotl(cl, 10);\n cl = bl;\n bl = tl;\n ar = er;\n er = dr;\n dr = rotl(cr, 10);\n cr = br;\n br = tr;\n } // update state\n\n\n var t = this._b + cl + dr | 0;\n this._b = this._c + dl + er | 0;\n this._c = this._d + el + ar | 0;\n this._d = this._e + al + br | 0;\n this._e = this._a + bl + cr | 0;\n this._a = t;\n};\n\nRIPEMD160.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80;\n\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64);\n\n this._update();\n\n this._blockOffset = 0;\n }\n\n this._block.fill(0, this._blockOffset, 56);\n\n this._block.writeUInt32LE(this._length[0], 56);\n\n this._block.writeUInt32LE(this._length[1], 60);\n\n this._update(); // produce result\n\n\n var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20);\n buffer.writeInt32LE(this._a, 0);\n buffer.writeInt32LE(this._b, 4);\n buffer.writeInt32LE(this._c, 8);\n buffer.writeInt32LE(this._d, 12);\n buffer.writeInt32LE(this._e, 16);\n return buffer;\n};\n\nfunction rotl(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction fn1(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;\n}\n\nfunction fn2(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;\n}\n\nfunction fn3(a, b, c, d, e, m, k, s) {\n return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;\n}\n\nfunction fn4(a, b, c, d, e, m, k, s) {\n return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;\n}\n\nfunction fn5(a, b, c, d, e, m, k, s) {\n return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;\n}\n\nmodule.exports = RIPEMD160;","var exports = module.exports = function SHA(algorithm) {\n algorithm = algorithm.toLowerCase();\n var Algorithm = exports[algorithm];\n if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)');\n return new Algorithm();\n};\n\nexports.sha = require('./sha');\nexports.sha1 = require('./sha1');\nexports.sha224 = require('./sha224');\nexports.sha256 = require('./sha256');\nexports.sha384 = require('./sha384');\nexports.sha512 = require('./sha512');","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer');\n\nvar Buffer = buffer.Buffer; // alternative to using Object.keys for old browsers\n\nfunction copyProps(src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n}\n\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer;\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n}\n\nfunction SafeBuffer(arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length);\n} // Copy static methods from Buffer\n\n\ncopyProps(Buffer, SafeBuffer);\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number');\n }\n\n return Buffer(arg, encodingOrOffset, length);\n};\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n var buf = Buffer(size);\n\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n\n return buf;\n};\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return Buffer(size);\n};\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number');\n }\n\n return buffer.SlowBuffer(size);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/**/\n\n/**/\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n var isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; // cast to ints.\n\n this.highWaterMark = Math.floor(this.highWaterMark); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb\n\n stream.emit('error', er);\n pna.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n stream.emit('error', err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nfunction Cipher(options) {\n this.options = options;\n this.type = this.options.type;\n this.blockSize = 8;\n\n this._init();\n\n this.buffer = new Array(this.blockSize);\n this.bufferOff = 0;\n}\n\nmodule.exports = Cipher;\n\nCipher.prototype._init = function _init() {// Might be overrided\n};\n\nCipher.prototype.update = function update(data) {\n if (data.length === 0) return [];\n if (this.type === 'decrypt') return this._updateDecrypt(data);else return this._updateEncrypt(data);\n};\n\nCipher.prototype._buffer = function _buffer(data, off) {\n // Append data to buffer\n var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);\n\n for (var i = 0; i < min; i++) {\n this.buffer[this.bufferOff + i] = data[off + i];\n }\n\n this.bufferOff += min; // Shift next\n\n return min;\n};\n\nCipher.prototype._flushBuffer = function _flushBuffer(out, off) {\n this._update(this.buffer, 0, out, off);\n\n this.bufferOff = 0;\n return this.blockSize;\n};\n\nCipher.prototype._updateEncrypt = function _updateEncrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n var count = (this.bufferOff + data.length) / this.blockSize | 0;\n var out = new Array(count * this.blockSize);\n\n if (this.bufferOff !== 0) {\n inputOff += this._buffer(data, inputOff);\n if (this.bufferOff === this.buffer.length) outputOff += this._flushBuffer(out, outputOff);\n } // Write blocks\n\n\n var max = data.length - (data.length - inputOff) % this.blockSize;\n\n for (; inputOff < max; inputOff += this.blockSize) {\n this._update(data, inputOff, out, outputOff);\n\n outputOff += this.blockSize;\n } // Queue rest\n\n\n for (; inputOff < data.length; inputOff++, this.bufferOff++) {\n this.buffer[this.bufferOff] = data[inputOff];\n }\n\n return out;\n};\n\nCipher.prototype._updateDecrypt = function _updateDecrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;\n var out = new Array(count * this.blockSize); // TODO(indutny): optimize it, this is far from optimal\n\n for (; count > 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n } // Buffer rest of the input\n\n\n inputOff += this._buffer(data, inputOff);\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer) first = this.update(buffer);\n var last;\n if (this.type === 'encrypt') last = this._finalEncrypt();else last = this._finalDecrypt();\n if (first) return first.concat(last);else return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0) return false;\n\n while (off < buffer.length) {\n buffer[off++] = 0;\n }\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff)) return [];\n var out = new Array(this.blockSize);\n\n this._update(this.buffer, 0, out, 0);\n\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};","var ciphers = require('./encrypter');\n\nvar deciphers = require('./decrypter');\n\nvar modes = require('./modes/list.json');\n\nfunction getCiphers() {\n return Object.keys(modes);\n}\n\nexports.createCipher = exports.Cipher = ciphers.createCipher;\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv;\nexports.createDecipher = exports.Decipher = deciphers.createDecipher;\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv;\nexports.listCiphers = exports.getCiphers = getCiphers;","var modeModules = {\n ECB: require('./ecb'),\n CBC: require('./cbc'),\n CFB: require('./cfb'),\n CFB8: require('./cfb8'),\n CFB1: require('./cfb1'),\n OFB: require('./ofb'),\n CTR: require('./ctr'),\n GCM: require('./ctr')\n};\n\nvar modes = require('./list.json');\n\nfor (var key in modes) {\n modes[key].module = modeModules[modes[key].mode];\n}\n\nmodule.exports = modes;","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar r;\n\nmodule.exports = function rand(len) {\n if (!r) r = new Rand(null);\n return r.generate(len);\n};\n\nfunction Rand(rand) {\n this.rand = rand;\n}\n\nmodule.exports.Rand = Rand;\n\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n}; // Emulate crypto API using randy\n\n\nRand.prototype._rand = function _rand(n) {\n if (this.rand.getBytes) return this.rand.getBytes(n);\n var res = new Uint8Array(n);\n\n for (var i = 0; i < res.length; i++) {\n res[i] = this.rand.getByte();\n }\n\n return res;\n};\n\nif ((typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === 'object') {\n if (self.crypto && self.crypto.getRandomValues) {\n // Modern browsers\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.crypto.getRandomValues(arr);\n return arr;\n };\n } else if (self.msCrypto && self.msCrypto.getRandomValues) {\n // IE\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.msCrypto.getRandomValues(arr);\n return arr;\n }; // Safari's WebWorkers do not have `crypto`\n\n } else if ((typeof window === \"undefined\" ? \"undefined\" : _typeof(window)) === 'object') {\n // Old junk\n Rand.prototype._rand = function () {\n throw new Error('Not implemented yet');\n };\n }\n} else {\n // Node.js or Web worker with no crypto support\n try {\n var crypto = require('crypto');\n\n if (typeof crypto.randomBytes !== 'function') throw new Error('Not supported');\n\n Rand.prototype._rand = function _rand(n) {\n return crypto.randomBytes(n);\n };\n } catch (e) {}\n}","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","var BN = require('bn.js');\n\nvar randomBytes = require('randombytes');\n\nfunction blind(priv) {\n var r = getr(priv);\n var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed();\n return {\n blinder: blinder,\n unblinder: r.invm(priv.modulus)\n };\n}\n\nfunction getr(priv) {\n var len = priv.modulus.byteLength();\n var r;\n\n do {\n r = new BN(randomBytes(len));\n } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2));\n\n return r;\n}\n\nfunction crt(msg, priv) {\n var blinds = blind(priv);\n var len = priv.modulus.byteLength();\n var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus);\n var c1 = blinded.toRed(BN.mont(priv.prime1));\n var c2 = blinded.toRed(BN.mont(priv.prime2));\n var qinv = priv.coefficient;\n var p = priv.prime1;\n var q = priv.prime2;\n var m1 = c1.redPow(priv.exponent1).fromRed();\n var m2 = c2.redPow(priv.exponent2).fromRed();\n var h = m1.isub(m2).imul(qinv).umod(p).imul(q);\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len);\n}\n\ncrt.getr = getr;\nmodule.exports = crt;","'use strict';\n\nvar elliptic = exports;\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves'); // Protocols\n\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\n\nvar curve = require('./curve');\n\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short') this.curve = new curve.short(options);else if (options.type === 'edwards') this.curve = new curve.edwards(options);else this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\n\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function get() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve\n });\n return curve;\n }\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: ['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811']\n});\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: ['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34']\n});\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: ['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5']\n});\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: ['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f']\n});\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: ['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650']\n});\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: ['9']\n});\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: ['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658']\n});\nvar pre;\n\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [{\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3'\n }, {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15'\n }],\n gRed: false,\n g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre]\n});","var hash = exports;\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac'); // Proxy hash functions to the main object\n\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;","/* eslint-disable node/no-deprecated-api */\n'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar buffer = require('buffer');\n\nvar Buffer = buffer.Buffer;\nvar safer = {};\nvar key;\n\nfor (key in buffer) {\n if (!buffer.hasOwnProperty(key)) continue;\n if (key === 'SlowBuffer' || key === 'Buffer') continue;\n safer[key] = buffer[key];\n}\n\nvar Safer = safer.Buffer = {};\n\nfor (key in Buffer) {\n if (!Buffer.hasOwnProperty(key)) continue;\n if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue;\n Safer[key] = Buffer[key];\n}\n\nsafer.Buffer.prototype = Buffer.prototype;\n\nif (!Safer.from || Safer.from === Uint8Array.from) {\n Safer.from = function (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('The \"value\" argument must not be of type number. Received type ' + _typeof(value));\n }\n\n if (value && typeof value.length === 'undefined') {\n throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + _typeof(value));\n }\n\n return Buffer(value, encodingOrOffset, length);\n };\n}\n\nif (!Safer.alloc) {\n Safer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('The \"size\" argument must be of type number. Received type ' + _typeof(size));\n }\n\n if (size < 0 || size >= 2 * (1 << 30)) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"');\n }\n\n var buf = Buffer(size);\n\n if (!fill || fill.length === 0) {\n buf.fill(0);\n } else if (typeof encoding === 'string') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n\n return buf;\n };\n}\n\nif (!safer.kStringMaxLength) {\n try {\n safer.kStringMaxLength = process.binding('buffer').kStringMaxLength;\n } catch (e) {// we can't determine kStringMaxLength in environments where process.binding\n // is unsupported, so let's not set it\n }\n}\n\nif (!safer.constants) {\n safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n };\n\n if (safer.kStringMaxLength) {\n safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength;\n }\n}\n\nmodule.exports = safer;","'use strict';\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar Reporter = require('../base/reporter').Reporter;\n\nvar EncoderBuffer = require('../base/buffer').EncoderBuffer;\n\nvar DecoderBuffer = require('../base/buffer').DecoderBuffer;\n\nvar assert = require('minimalistic-assert'); // Supported tags\n\n\nvar tags = ['seq', 'seqof', 'set', 'setof', 'objid', 'bool', 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr']; // Public methods list\n\nvar methods = ['key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', 'any', 'contains'].concat(tags); // Overrided methods list\n\nvar overrided = ['_peekTag', '_decodeTag', '_use', '_decodeStr', '_decodeObjid', '_decodeTime', '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', '_encodeNull', '_encodeInt', '_encodeBool'];\n\nfunction Node(enc, parent, name) {\n var state = {};\n this._baseState = state;\n state.name = name;\n state.enc = enc;\n state.parent = parent || null;\n state.children = null; // State\n\n state.tag = null;\n state.args = null;\n state.reverseArgs = null;\n state.choice = null;\n state.optional = false;\n state.any = false;\n state.obj = false;\n state.use = null;\n state.useDecoder = null;\n state.key = null;\n state['default'] = null;\n state.explicit = null;\n state.implicit = null;\n state.contains = null; // Should create new instance on each method\n\n if (!state.parent) {\n state.children = [];\n\n this._wrap();\n }\n}\n\nmodule.exports = Node;\nvar stateProps = ['enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', 'implicit', 'contains'];\n\nNode.prototype.clone = function clone() {\n var state = this._baseState;\n var cstate = {};\n stateProps.forEach(function (prop) {\n cstate[prop] = state[prop];\n });\n var res = new this.constructor(cstate.parent);\n res._baseState = cstate;\n return res;\n};\n\nNode.prototype._wrap = function wrap() {\n var state = this._baseState;\n methods.forEach(function (method) {\n this[method] = function _wrappedMethod() {\n var clone = new this.constructor(this);\n state.children.push(clone);\n return clone[method].apply(clone, arguments);\n };\n }, this);\n};\n\nNode.prototype._init = function init(body) {\n var state = this._baseState;\n assert(state.parent === null);\n body.call(this); // Filter children\n\n state.children = state.children.filter(function (child) {\n return child._baseState.parent === this;\n }, this);\n assert.equal(state.children.length, 1, 'Root node can have only one child');\n};\n\nNode.prototype._useArgs = function useArgs(args) {\n var state = this._baseState; // Filter children and args\n\n var children = args.filter(function (arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function (arg) {\n return !(arg instanceof this.constructor);\n }, this);\n\n if (children.length !== 0) {\n assert(state.children === null);\n state.children = children; // Replace parent to maintain backward link\n\n children.forEach(function (child) {\n child._baseState.parent = this;\n }, this);\n }\n\n if (args.length !== 0) {\n assert(state.args === null);\n state.args = args;\n state.reverseArgs = args.map(function (arg) {\n if (_typeof(arg) !== 'object' || arg.constructor !== Object) return arg;\n var res = {};\n Object.keys(arg).forEach(function (key) {\n if (key == (key | 0)) key |= 0;\n var value = arg[key];\n res[value] = key;\n });\n return res;\n });\n }\n}; //\n// Overrided methods\n//\n\n\noverrided.forEach(function (method) {\n Node.prototype[method] = function _overrided() {\n var state = this._baseState;\n throw new Error(method + ' not implemented for encoding: ' + state.enc);\n };\n}); //\n// Public methods\n//\n\ntags.forEach(function (tag) {\n Node.prototype[tag] = function _tagMethod() {\n var state = this._baseState;\n var args = Array.prototype.slice.call(arguments);\n assert(state.tag === null);\n state.tag = tag;\n\n this._useArgs(args);\n\n return this;\n };\n});\n\nNode.prototype.use = function use(item) {\n assert(item);\n var state = this._baseState;\n assert(state.use === null);\n state.use = item;\n return this;\n};\n\nNode.prototype.optional = function optional() {\n var state = this._baseState;\n state.optional = true;\n return this;\n};\n\nNode.prototype.def = function def(val) {\n var state = this._baseState;\n assert(state['default'] === null);\n state['default'] = val;\n state.optional = true;\n return this;\n};\n\nNode.prototype.explicit = function explicit(num) {\n var state = this._baseState;\n assert(state.explicit === null && state.implicit === null);\n state.explicit = num;\n return this;\n};\n\nNode.prototype.implicit = function implicit(num) {\n var state = this._baseState;\n assert(state.explicit === null && state.implicit === null);\n state.implicit = num;\n return this;\n};\n\nNode.prototype.obj = function obj() {\n var state = this._baseState;\n var args = Array.prototype.slice.call(arguments);\n state.obj = true;\n if (args.length !== 0) this._useArgs(args);\n return this;\n};\n\nNode.prototype.key = function key(newKey) {\n var state = this._baseState;\n assert(state.key === null);\n state.key = newKey;\n return this;\n};\n\nNode.prototype.any = function any() {\n var state = this._baseState;\n state.any = true;\n return this;\n};\n\nNode.prototype.choice = function choice(obj) {\n var state = this._baseState;\n assert(state.choice === null);\n state.choice = obj;\n\n this._useArgs(Object.keys(obj).map(function (key) {\n return obj[key];\n }));\n\n return this;\n};\n\nNode.prototype.contains = function contains(item) {\n var state = this._baseState;\n assert(state.use === null);\n state.contains = item;\n return this;\n}; //\n// Decoding\n//\n\n\nNode.prototype._decode = function decode(input, options) {\n var state = this._baseState; // Decode root node\n\n if (state.parent === null) return input.wrapResult(state.children[0]._decode(input, options));\n var result = state['default'];\n var present = true;\n var prevKey = null;\n if (state.key !== null) prevKey = input.enterKey(state.key); // Check if tag is there\n\n if (state.optional) {\n var tag = null;\n if (state.explicit !== null) tag = state.explicit;else if (state.implicit !== null) tag = state.implicit;else if (state.tag !== null) tag = state.tag;\n\n if (tag === null && !state.any) {\n // Trial and Error\n var save = input.save();\n\n try {\n if (state.choice === null) this._decodeGeneric(state.tag, input, options);else this._decodeChoice(input, options);\n present = true;\n } catch (e) {\n present = false;\n }\n\n input.restore(save);\n } else {\n present = this._peekTag(input, tag, state.any);\n if (input.isError(present)) return present;\n }\n } // Push object on stack\n\n\n var prevObj;\n if (state.obj && present) prevObj = input.enterObject();\n\n if (present) {\n // Unwrap explicit values\n if (state.explicit !== null) {\n var explicit = this._decodeTag(input, state.explicit);\n\n if (input.isError(explicit)) return explicit;\n input = explicit;\n }\n\n var start = input.offset; // Unwrap implicit and normal values\n\n if (state.use === null && state.choice === null) {\n var _save;\n\n if (state.any) _save = input.save();\n\n var body = this._decodeTag(input, state.implicit !== null ? state.implicit : state.tag, state.any);\n\n if (input.isError(body)) return body;\n if (state.any) result = input.raw(_save);else input = body;\n }\n\n if (options && options.track && state.tag !== null) options.track(input.path(), start, input.length, 'tagged');\n if (options && options.track && state.tag !== null) options.track(input.path(), input.offset, input.length, 'content'); // Select proper method for tag\n\n if (state.any) {// no-op\n } else if (state.choice === null) {\n result = this._decodeGeneric(state.tag, input, options);\n } else {\n result = this._decodeChoice(input, options);\n }\n\n if (input.isError(result)) return result; // Decode children\n\n if (!state.any && state.choice === null && state.children !== null) {\n state.children.forEach(function decodeChildren(child) {\n // NOTE: We are ignoring errors here, to let parser continue with other\n // parts of encoded data\n child._decode(input, options);\n });\n } // Decode contained/encoded by schema, only in bit or octet strings\n\n\n if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {\n var data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);\n }\n } // Pop object\n\n\n if (state.obj && present) result = input.leaveObject(prevObj); // Set key\n\n if (state.key !== null && (result !== null || present === true)) input.leaveKey(prevKey, state.key, result);else if (prevKey !== null) input.exitKey(prevKey);\n return result;\n};\n\nNode.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {\n var state = this._baseState;\n if (tag === 'seq' || tag === 'set') return null;\n if (tag === 'seqof' || tag === 'setof') return this._decodeList(input, tag, state.args[0], options);else if (/str$/.test(tag)) return this._decodeStr(input, tag, options);else if (tag === 'objid' && state.args) return this._decodeObjid(input, state.args[0], state.args[1], options);else if (tag === 'objid') return this._decodeObjid(input, null, null, options);else if (tag === 'gentime' || tag === 'utctime') return this._decodeTime(input, tag, options);else if (tag === 'null_') return this._decodeNull(input, options);else if (tag === 'bool') return this._decodeBool(input, options);else if (tag === 'objDesc') return this._decodeStr(input, tag, options);else if (tag === 'int' || tag === 'enum') return this._decodeInt(input, state.args && state.args[0], options);\n\n if (state.use !== null) {\n return this._getUse(state.use, input._reporterState.obj)._decode(input, options);\n } else {\n return input.error('unknown tag: ' + tag);\n }\n};\n\nNode.prototype._getUse = function _getUse(entity, obj) {\n var state = this._baseState; // Create altered use decoder if implicit is set\n\n state.useDecoder = this._use(entity, obj);\n assert(state.useDecoder._baseState.parent === null);\n state.useDecoder = state.useDecoder._baseState.children[0];\n\n if (state.implicit !== state.useDecoder._baseState.implicit) {\n state.useDecoder = state.useDecoder.clone();\n state.useDecoder._baseState.implicit = state.implicit;\n }\n\n return state.useDecoder;\n};\n\nNode.prototype._decodeChoice = function decodeChoice(input, options) {\n var state = this._baseState;\n var result = null;\n var match = false;\n Object.keys(state.choice).some(function (key) {\n var save = input.save();\n var node = state.choice[key];\n\n try {\n var value = node._decode(input, options);\n\n if (input.isError(value)) return false;\n result = {\n type: key,\n value: value\n };\n match = true;\n } catch (e) {\n input.restore(save);\n return false;\n }\n\n return true;\n }, this);\n if (!match) return input.error('Choice not matched');\n return result;\n}; //\n// Encoding\n//\n\n\nNode.prototype._createEncoderBuffer = function createEncoderBuffer(data) {\n return new EncoderBuffer(data, this.reporter);\n};\n\nNode.prototype._encode = function encode(data, reporter, parent) {\n var state = this._baseState;\n if (state['default'] !== null && state['default'] === data) return;\n\n var result = this._encodeValue(data, reporter, parent);\n\n if (result === undefined) return;\n if (this._skipDefault(result, reporter, parent)) return;\n return result;\n};\n\nNode.prototype._encodeValue = function encode(data, reporter, parent) {\n var state = this._baseState; // Decode root node\n\n if (state.parent === null) return state.children[0]._encode(data, reporter || new Reporter());\n var result = null; // Set reporter to share it with a child class\n\n this.reporter = reporter; // Check if data is there\n\n if (state.optional && data === undefined) {\n if (state['default'] !== null) data = state['default'];else return;\n } // Encode children first\n\n\n var content = null;\n var primitive = false;\n\n if (state.any) {\n // Anything that was given is translated to buffer\n result = this._createEncoderBuffer(data);\n } else if (state.choice) {\n result = this._encodeChoice(data, reporter);\n } else if (state.contains) {\n content = this._getUse(state.contains, parent)._encode(data, reporter);\n primitive = true;\n } else if (state.children) {\n content = state.children.map(function (child) {\n if (child._baseState.tag === 'null_') return child._encode(null, reporter, data);\n if (child._baseState.key === null) return reporter.error('Child should have a key');\n var prevKey = reporter.enterKey(child._baseState.key);\n if (_typeof(data) !== 'object') return reporter.error('Child expected, but input is not object');\n\n var res = child._encode(data[child._baseState.key], reporter, data);\n\n reporter.leaveKey(prevKey);\n return res;\n }, this).filter(function (child) {\n return child;\n });\n content = this._createEncoderBuffer(content);\n } else {\n if (state.tag === 'seqof' || state.tag === 'setof') {\n // TODO(indutny): this should be thrown on DSL level\n if (!(state.args && state.args.length === 1)) return reporter.error('Too many args for : ' + state.tag);\n if (!Array.isArray(data)) return reporter.error('seqof/setof, but data is not Array');\n var child = this.clone();\n child._baseState.implicit = null;\n content = this._createEncoderBuffer(data.map(function (item) {\n var state = this._baseState;\n return this._getUse(state.args[0], data)._encode(item, reporter);\n }, child));\n } else if (state.use !== null) {\n result = this._getUse(state.use, parent)._encode(data, reporter);\n } else {\n content = this._encodePrimitive(state.tag, data);\n primitive = true;\n }\n } // Encode data itself\n\n\n if (!state.any && state.choice === null) {\n var tag = state.implicit !== null ? state.implicit : state.tag;\n var cls = state.implicit === null ? 'universal' : 'context';\n\n if (tag === null) {\n if (state.use === null) reporter.error('Tag could be omitted only for .use()');\n } else {\n if (state.use === null) result = this._encodeComposite(tag, primitive, cls, content);\n }\n } // Wrap in explicit\n\n\n if (state.explicit !== null) result = this._encodeComposite(state.explicit, false, 'context', result);\n return result;\n};\n\nNode.prototype._encodeChoice = function encodeChoice(data, reporter) {\n var state = this._baseState;\n var node = state.choice[data.type];\n\n if (!node) {\n assert(false, data.type + ' not found in ' + JSON.stringify(Object.keys(state.choice)));\n }\n\n return node._encode(data.value, reporter);\n};\n\nNode.prototype._encodePrimitive = function encodePrimitive(tag, data) {\n var state = this._baseState;\n if (/str$/.test(tag)) return this._encodeStr(data, tag);else if (tag === 'objid' && state.args) return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);else if (tag === 'objid') return this._encodeObjid(data, null, null);else if (tag === 'gentime' || tag === 'utctime') return this._encodeTime(data, tag);else if (tag === 'null_') return this._encodeNull();else if (tag === 'int' || tag === 'enum') return this._encodeInt(data, state.args && state.reverseArgs[0]);else if (tag === 'bool') return this._encodeBool(data);else if (tag === 'objDesc') return this._encodeStr(data, tag);else throw new Error('Unsupported tag: ' + tag);\n};\n\nNode.prototype._isNumstr = function isNumstr(str) {\n return /^[0-9 ]*$/.test(str);\n};\n\nNode.prototype._isPrintstr = function isPrintstr(str) {\n return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);\n};","'use strict';\n\nvar inherits = require('inherits');\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\n\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n var state = this._reporterState;\n return {\n obj: state.obj,\n pathLen: state.path.length\n };\n};\n\nReporter.prototype.restore = function restore(data) {\n var state = this._reporterState;\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n var state = this._reporterState;\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n var state = this._reporterState;\n this.exitKey(index);\n if (state.obj !== null) state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n var state = this._reporterState;\n var prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n var state = this._reporterState;\n var now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n var err;\n var state = this._reporterState;\n var inherited = msg instanceof ReporterError;\n\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function (elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial) throw err;\n if (!inherited) state.errors.push(err);\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n var state = this._reporterState;\n if (!state.options.partial) return result;\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n}\n\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace) Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n\n return this;\n};","'use strict'; // Helper\n\nfunction reverse(map) {\n var res = {};\n Object.keys(map).forEach(function (key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key) key = key | 0;\n var value = map[key];\n res[value] = key;\n });\n return res;\n}\n\nexports.tagClass = {\n 0: 'universal',\n 1: 'application',\n 2: 'context',\n 3: 'private'\n};\nexports.tagClassByName = reverse(exports.tagClass);\nexports.tag = {\n 0x00: 'end',\n 0x01: 'bool',\n 0x02: 'int',\n 0x03: 'bitstr',\n 0x04: 'octstr',\n 0x05: 'null_',\n 0x06: 'objid',\n 0x07: 'objDesc',\n 0x08: 'external',\n 0x09: 'real',\n 0x0a: 'enum',\n 0x0b: 'embed',\n 0x0c: 'utf8str',\n 0x0d: 'relativeOid',\n 0x10: 'seq',\n 0x11: 'set',\n 0x12: 'numstr',\n 0x13: 'printstr',\n 0x14: 't61str',\n 0x15: 'videostr',\n 0x16: 'ia5str',\n 0x17: 'utctime',\n 0x18: 'gentime',\n 0x19: 'graphstr',\n 0x1a: 'iso646str',\n 0x1b: 'genstr',\n 0x1c: 'unistr',\n 0x1d: 'charstr',\n 0x1e: 'bmpstr'\n};\nexports.tagByName = reverse(exports.tag);","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\n * vue-resource v1.5.3\n * https://github.com/pagekit/vue-resource\n * Released under the MIT License.\n */\n\n/**\n * Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)\n */\nvar RESOLVED = 0;\nvar REJECTED = 1;\nvar PENDING = 2;\n\nfunction Promise$1(executor) {\n this.state = PENDING;\n this.value = undefined;\n this.deferred = [];\n var promise = this;\n\n try {\n executor(function (x) {\n promise.resolve(x);\n }, function (r) {\n promise.reject(r);\n });\n } catch (e) {\n promise.reject(e);\n }\n}\n\nPromise$1.reject = function (r) {\n return new Promise$1(function (resolve, reject) {\n reject(r);\n });\n};\n\nPromise$1.resolve = function (x) {\n return new Promise$1(function (resolve, reject) {\n resolve(x);\n });\n};\n\nPromise$1.all = function all(iterable) {\n return new Promise$1(function (resolve, reject) {\n var count = 0,\n result = [];\n\n if (iterable.length === 0) {\n resolve(result);\n }\n\n function resolver(i) {\n return function (x) {\n result[i] = x;\n count += 1;\n\n if (count === iterable.length) {\n resolve(result);\n }\n };\n }\n\n for (var i = 0; i < iterable.length; i += 1) {\n Promise$1.resolve(iterable[i]).then(resolver(i), reject);\n }\n });\n};\n\nPromise$1.race = function race(iterable) {\n return new Promise$1(function (resolve, reject) {\n for (var i = 0; i < iterable.length; i += 1) {\n Promise$1.resolve(iterable[i]).then(resolve, reject);\n }\n });\n};\n\nvar p = Promise$1.prototype;\n\np.resolve = function resolve(x) {\n var promise = this;\n\n if (promise.state === PENDING) {\n if (x === promise) {\n throw new TypeError('Promise settled with itself.');\n }\n\n var called = false;\n\n try {\n var then = x && x['then'];\n\n if (x !== null && _typeof(x) === 'object' && typeof then === 'function') {\n then.call(x, function (x) {\n if (!called) {\n promise.resolve(x);\n }\n\n called = true;\n }, function (r) {\n if (!called) {\n promise.reject(r);\n }\n\n called = true;\n });\n return;\n }\n } catch (e) {\n if (!called) {\n promise.reject(e);\n }\n\n return;\n }\n\n promise.state = RESOLVED;\n promise.value = x;\n promise.notify();\n }\n};\n\np.reject = function reject(reason) {\n var promise = this;\n\n if (promise.state === PENDING) {\n if (reason === promise) {\n throw new TypeError('Promise settled with itself.');\n }\n\n promise.state = REJECTED;\n promise.value = reason;\n promise.notify();\n }\n};\n\np.notify = function notify() {\n var promise = this;\n nextTick(function () {\n if (promise.state !== PENDING) {\n while (promise.deferred.length) {\n var deferred = promise.deferred.shift(),\n onResolved = deferred[0],\n onRejected = deferred[1],\n resolve = deferred[2],\n reject = deferred[3];\n\n try {\n if (promise.state === RESOLVED) {\n if (typeof onResolved === 'function') {\n resolve(onResolved.call(undefined, promise.value));\n } else {\n resolve(promise.value);\n }\n } else if (promise.state === REJECTED) {\n if (typeof onRejected === 'function') {\n resolve(onRejected.call(undefined, promise.value));\n } else {\n reject(promise.value);\n }\n }\n } catch (e) {\n reject(e);\n }\n }\n }\n });\n};\n\np.then = function then(onResolved, onRejected) {\n var promise = this;\n return new Promise$1(function (resolve, reject) {\n promise.deferred.push([onResolved, onRejected, resolve, reject]);\n promise.notify();\n });\n};\n\np[\"catch\"] = function (onRejected) {\n return this.then(undefined, onRejected);\n};\n/**\n * Promise adapter.\n */\n\n\nif (typeof Promise === 'undefined') {\n window.Promise = Promise$1;\n}\n\nfunction PromiseObj(executor, context) {\n if (executor instanceof Promise) {\n this.promise = executor;\n } else {\n this.promise = new Promise(executor.bind(context));\n }\n\n this.context = context;\n}\n\nPromiseObj.all = function (iterable, context) {\n return new PromiseObj(Promise.all(iterable), context);\n};\n\nPromiseObj.resolve = function (value, context) {\n return new PromiseObj(Promise.resolve(value), context);\n};\n\nPromiseObj.reject = function (reason, context) {\n return new PromiseObj(Promise.reject(reason), context);\n};\n\nPromiseObj.race = function (iterable, context) {\n return new PromiseObj(Promise.race(iterable), context);\n};\n\nvar p$1 = PromiseObj.prototype;\n\np$1.bind = function (context) {\n this.context = context;\n return this;\n};\n\np$1.then = function (fulfilled, rejected) {\n if (fulfilled && fulfilled.bind && this.context) {\n fulfilled = fulfilled.bind(this.context);\n }\n\n if (rejected && rejected.bind && this.context) {\n rejected = rejected.bind(this.context);\n }\n\n return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);\n};\n\np$1[\"catch\"] = function (rejected) {\n if (rejected && rejected.bind && this.context) {\n rejected = rejected.bind(this.context);\n }\n\n return new PromiseObj(this.promise[\"catch\"](rejected), this.context);\n};\n\np$1[\"finally\"] = function (callback) {\n return this.then(function (value) {\n callback.call(this);\n return value;\n }, function (reason) {\n callback.call(this);\n return Promise.reject(reason);\n });\n};\n/**\n * Utility functions.\n */\n\n\nvar _ref = {},\n hasOwnProperty = _ref.hasOwnProperty,\n slice = [].slice,\n debug = false,\n ntick;\nvar inBrowser = typeof window !== 'undefined';\n\nfunction Util(_ref2) {\n var config = _ref2.config,\n nextTick = _ref2.nextTick;\n ntick = nextTick;\n debug = config.debug || !config.silent;\n}\n\nfunction warn(msg) {\n if (typeof console !== 'undefined' && debug) {\n console.warn('[VueResource warn]: ' + msg);\n }\n}\n\nfunction error(msg) {\n if (typeof console !== 'undefined') {\n console.error(msg);\n }\n}\n\nfunction nextTick(cb, ctx) {\n return ntick(cb, ctx);\n}\n\nfunction trim(str) {\n return str ? str.replace(/^\\s*|\\s*$/g, '') : '';\n}\n\nfunction trimEnd(str, chars) {\n if (str && chars === undefined) {\n return str.replace(/\\s+$/, '');\n }\n\n if (!str || !chars) {\n return str;\n }\n\n return str.replace(new RegExp(\"[\" + chars + \"]+$\"), '');\n}\n\nfunction toLower(str) {\n return str ? str.toLowerCase() : '';\n}\n\nfunction toUpper(str) {\n return str ? str.toUpperCase() : '';\n}\n\nvar isArray = Array.isArray;\n\nfunction isString(val) {\n return typeof val === 'string';\n}\n\nfunction isFunction(val) {\n return typeof val === 'function';\n}\n\nfunction isObject(obj) {\n return obj !== null && _typeof(obj) === 'object';\n}\n\nfunction isPlainObject(obj) {\n return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;\n}\n\nfunction isBlob(obj) {\n return typeof Blob !== 'undefined' && obj instanceof Blob;\n}\n\nfunction isFormData(obj) {\n return typeof FormData !== 'undefined' && obj instanceof FormData;\n}\n\nfunction when(value, fulfilled, rejected) {\n var promise = PromiseObj.resolve(value);\n\n if (arguments.length < 2) {\n return promise;\n }\n\n return promise.then(fulfilled, rejected);\n}\n\nfunction options(fn, obj, opts) {\n opts = opts || {};\n\n if (isFunction(opts)) {\n opts = opts.call(obj);\n }\n\n return merge(fn.bind({\n $vm: obj,\n $options: opts\n }), fn, {\n $options: opts\n });\n}\n\nfunction each(obj, iterator) {\n var i, key;\n\n if (isArray(obj)) {\n for (i = 0; i < obj.length; i++) {\n iterator.call(obj[i], obj[i], i);\n }\n } else if (isObject(obj)) {\n for (key in obj) {\n if (hasOwnProperty.call(obj, key)) {\n iterator.call(obj[key], obj[key], key);\n }\n }\n }\n\n return obj;\n}\n\nvar assign = Object.assign || _assign;\n\nfunction merge(target) {\n var args = slice.call(arguments, 1);\n args.forEach(function (source) {\n _merge(target, source, true);\n });\n return target;\n}\n\nfunction defaults(target) {\n var args = slice.call(arguments, 1);\n args.forEach(function (source) {\n for (var key in source) {\n if (target[key] === undefined) {\n target[key] = source[key];\n }\n }\n });\n return target;\n}\n\nfunction _assign(target) {\n var args = slice.call(arguments, 1);\n args.forEach(function (source) {\n _merge(target, source);\n });\n return target;\n}\n\nfunction _merge(target, source, deep) {\n for (var key in source) {\n if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {\n if (isPlainObject(source[key]) && !isPlainObject(target[key])) {\n target[key] = {};\n }\n\n if (isArray(source[key]) && !isArray(target[key])) {\n target[key] = [];\n }\n\n _merge(target[key], source[key], deep);\n } else if (source[key] !== undefined) {\n target[key] = source[key];\n }\n }\n}\n/**\n * Root Prefix Transform.\n */\n\n\nfunction root(options$$1, next) {\n var url = next(options$$1);\n\n if (isString(options$$1.root) && !/^(https?:)?\\//.test(url)) {\n url = trimEnd(options$$1.root, '/') + '/' + url;\n }\n\n return url;\n}\n/**\n * Query Parameter Transform.\n */\n\n\nfunction query(options$$1, next) {\n var urlParams = Object.keys(Url.options.params),\n query = {},\n url = next(options$$1);\n each(options$$1.params, function (value, key) {\n if (urlParams.indexOf(key) === -1) {\n query[key] = value;\n }\n });\n query = Url.params(query);\n\n if (query) {\n url += (url.indexOf('?') == -1 ? '?' : '&') + query;\n }\n\n return url;\n}\n/**\n * URL Template v2.0.6 (https://github.com/bramstein/url-template)\n */\n\n\nfunction expand(url, params, variables) {\n var tmpl = parse(url),\n expanded = tmpl.expand(params);\n\n if (variables) {\n variables.push.apply(variables, tmpl.vars);\n }\n\n return expanded;\n}\n\nfunction parse(template) {\n var operators = ['+', '#', '.', '/', ';', '?', '&'],\n variables = [];\n return {\n vars: variables,\n expand: function expand(context) {\n return template.replace(/\\{([^{}]+)\\}|([^{}]+)/g, function (_, expression, literal) {\n if (expression) {\n var operator = null,\n values = [];\n\n if (operators.indexOf(expression.charAt(0)) !== -1) {\n operator = expression.charAt(0);\n expression = expression.substr(1);\n }\n\n expression.split(/,/g).forEach(function (variable) {\n var tmp = /([^:*]*)(?::(\\d+)|(\\*))?/.exec(variable);\n values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));\n variables.push(tmp[1]);\n });\n\n if (operator && operator !== '+') {\n var separator = ',';\n\n if (operator === '?') {\n separator = '&';\n } else if (operator !== '#') {\n separator = operator;\n }\n\n return (values.length !== 0 ? operator : '') + values.join(separator);\n } else {\n return values.join(',');\n }\n } else {\n return encodeReserved(literal);\n }\n });\n }\n };\n}\n\nfunction getValues(context, operator, key, modifier) {\n var value = context[key],\n result = [];\n\n if (isDefined(value) && value !== '') {\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n value = value.toString();\n\n if (modifier && modifier !== '*') {\n value = value.substring(0, parseInt(modifier, 10));\n }\n\n result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));\n } else {\n if (modifier === '*') {\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function (value) {\n result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));\n });\n } else {\n Object.keys(value).forEach(function (k) {\n if (isDefined(value[k])) {\n result.push(encodeValue(operator, value[k], k));\n }\n });\n }\n } else {\n var tmp = [];\n\n if (Array.isArray(value)) {\n value.filter(isDefined).forEach(function (value) {\n tmp.push(encodeValue(operator, value));\n });\n } else {\n Object.keys(value).forEach(function (k) {\n if (isDefined(value[k])) {\n tmp.push(encodeURIComponent(k));\n tmp.push(encodeValue(operator, value[k].toString()));\n }\n });\n }\n\n if (isKeyOperator(operator)) {\n result.push(encodeURIComponent(key) + '=' + tmp.join(','));\n } else if (tmp.length !== 0) {\n result.push(tmp.join(','));\n }\n }\n }\n } else {\n if (operator === ';') {\n result.push(encodeURIComponent(key));\n } else if (value === '' && (operator === '&' || operator === '?')) {\n result.push(encodeURIComponent(key) + '=');\n } else if (value === '') {\n result.push('');\n }\n }\n\n return result;\n}\n\nfunction isDefined(value) {\n return value !== undefined && value !== null;\n}\n\nfunction isKeyOperator(operator) {\n return operator === ';' || operator === '&' || operator === '?';\n}\n\nfunction encodeValue(operator, value, key) {\n value = operator === '+' || operator === '#' ? encodeReserved(value) : encodeURIComponent(value);\n\n if (key) {\n return encodeURIComponent(key) + '=' + value;\n } else {\n return value;\n }\n}\n\nfunction encodeReserved(str) {\n return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {\n if (!/%[0-9A-Fa-f]/.test(part)) {\n part = encodeURI(part);\n }\n\n return part;\n }).join('');\n}\n/**\n * URL Template (RFC 6570) Transform.\n */\n\n\nfunction template(options) {\n var variables = [],\n url = expand(options.url, options.params, variables);\n variables.forEach(function (key) {\n delete options.params[key];\n });\n return url;\n}\n/**\n * Service for URL templating.\n */\n\n\nfunction Url(url, params) {\n var self = this || {},\n options$$1 = url,\n transform;\n\n if (isString(url)) {\n options$$1 = {\n url: url,\n params: params\n };\n }\n\n options$$1 = merge({}, Url.options, self.$options, options$$1);\n Url.transforms.forEach(function (handler) {\n if (isString(handler)) {\n handler = Url.transform[handler];\n }\n\n if (isFunction(handler)) {\n transform = factory(handler, transform, self.$vm);\n }\n });\n return transform(options$$1);\n}\n/**\n * Url options.\n */\n\n\nUrl.options = {\n url: '',\n root: null,\n params: {}\n};\n/**\n * Url transforms.\n */\n\nUrl.transform = {\n template: template,\n query: query,\n root: root\n};\nUrl.transforms = ['template', 'query', 'root'];\n/**\n * Encodes a Url parameter string.\n *\n * @param {Object} obj\n */\n\nUrl.params = function (obj) {\n var params = [],\n escape = encodeURIComponent;\n\n params.add = function (key, value) {\n if (isFunction(value)) {\n value = value();\n }\n\n if (value === null) {\n value = '';\n }\n\n this.push(escape(key) + '=' + escape(value));\n };\n\n serialize(params, obj);\n return params.join('&').replace(/%20/g, '+');\n};\n/**\n * Parse a URL and return its components.\n *\n * @param {String} url\n */\n\n\nUrl.parse = function (url) {\n var el = document.createElement('a');\n\n if (document.documentMode) {\n el.href = url;\n url = el.href;\n }\n\n el.href = url;\n return {\n href: el.href,\n protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',\n port: el.port,\n host: el.host,\n hostname: el.hostname,\n pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,\n search: el.search ? el.search.replace(/^\\?/, '') : '',\n hash: el.hash ? el.hash.replace(/^#/, '') : ''\n };\n};\n\nfunction factory(handler, next, vm) {\n return function (options$$1) {\n return handler.call(vm, options$$1, next);\n };\n}\n\nfunction serialize(params, obj, scope) {\n var array = isArray(obj),\n plain = isPlainObject(obj),\n hash;\n each(obj, function (value, key) {\n hash = isObject(value) || isArray(value);\n\n if (scope) {\n key = scope + '[' + (plain || hash ? key : '') + ']';\n }\n\n if (!scope && array) {\n params.add(value.name, value.value);\n } else if (hash) {\n serialize(params, value, key);\n } else {\n params.add(key, value);\n }\n });\n}\n/**\n * XDomain client (Internet Explorer).\n */\n\n\nfunction xdrClient(request) {\n return new PromiseObj(function (resolve) {\n var xdr = new XDomainRequest(),\n handler = function handler(_ref) {\n var type = _ref.type;\n var status = 0;\n\n if (type === 'load') {\n status = 200;\n } else if (type === 'error') {\n status = 500;\n }\n\n resolve(request.respondWith(xdr.responseText, {\n status: status\n }));\n };\n\n request.abort = function () {\n return xdr.abort();\n };\n\n xdr.open(request.method, request.getUrl());\n\n if (request.timeout) {\n xdr.timeout = request.timeout;\n }\n\n xdr.onload = handler;\n xdr.onabort = handler;\n xdr.onerror = handler;\n xdr.ontimeout = handler;\n\n xdr.onprogress = function () {};\n\n xdr.send(request.getBody());\n });\n}\n/**\n * CORS Interceptor.\n */\n\n\nvar SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();\n\nfunction cors(request) {\n if (inBrowser) {\n var orgUrl = Url.parse(location.href);\n var reqUrl = Url.parse(request.getUrl());\n\n if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {\n request.crossOrigin = true;\n request.emulateHTTP = false;\n\n if (!SUPPORTS_CORS) {\n request.client = xdrClient;\n }\n }\n }\n}\n/**\n * Form data Interceptor.\n */\n\n\nfunction form(request) {\n if (isFormData(request.body)) {\n request.headers[\"delete\"]('Content-Type');\n } else if (isObject(request.body) && request.emulateJSON) {\n request.body = Url.params(request.body);\n request.headers.set('Content-Type', 'application/x-www-form-urlencoded');\n }\n}\n/**\n * JSON Interceptor.\n */\n\n\nfunction json(request) {\n var type = request.headers.get('Content-Type') || '';\n\n if (isObject(request.body) && type.indexOf('application/json') === 0) {\n request.body = JSON.stringify(request.body);\n }\n\n return function (response) {\n return response.bodyText ? when(response.text(), function (text) {\n var type = response.headers.get('Content-Type') || '';\n\n if (type.indexOf('application/json') === 0 || isJson(text)) {\n try {\n response.body = JSON.parse(text);\n } catch (e) {\n response.body = null;\n }\n } else {\n response.body = text;\n }\n\n return response;\n }) : response;\n };\n}\n\nfunction isJson(str) {\n var start = str.match(/^\\s*(\\[|\\{)/);\n var end = {\n '[': /]\\s*$/,\n '{': /}\\s*$/\n };\n return start && end[start[1]].test(str);\n}\n/**\n * JSONP client (Browser).\n */\n\n\nfunction jsonpClient(request) {\n return new PromiseObj(function (resolve) {\n var name = request.jsonp || 'callback',\n callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2),\n body = null,\n handler,\n script;\n\n handler = function handler(_ref) {\n var type = _ref.type;\n var status = 0;\n\n if (type === 'load' && body !== null) {\n status = 200;\n } else if (type === 'error') {\n status = 500;\n }\n\n if (status && window[callback]) {\n delete window[callback];\n document.body.removeChild(script);\n }\n\n resolve(request.respondWith(body, {\n status: status\n }));\n };\n\n window[callback] = function (result) {\n body = JSON.stringify(result);\n };\n\n request.abort = function () {\n handler({\n type: 'abort'\n });\n };\n\n request.params[name] = callback;\n\n if (request.timeout) {\n setTimeout(request.abort, request.timeout);\n }\n\n script = document.createElement('script');\n script.src = request.getUrl();\n script.type = 'text/javascript';\n script.async = true;\n script.onload = handler;\n script.onerror = handler;\n document.body.appendChild(script);\n });\n}\n/**\n * JSONP Interceptor.\n */\n\n\nfunction jsonp(request) {\n if (request.method == 'JSONP') {\n request.client = jsonpClient;\n }\n}\n/**\n * Before Interceptor.\n */\n\n\nfunction before(request) {\n if (isFunction(request.before)) {\n request.before.call(this, request);\n }\n}\n/**\n * HTTP method override Interceptor.\n */\n\n\nfunction method(request) {\n if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {\n request.headers.set('X-HTTP-Method-Override', request.method);\n request.method = 'POST';\n }\n}\n/**\n * Header Interceptor.\n */\n\n\nfunction header(request) {\n var headers = assign({}, Http.headers.common, !request.crossOrigin ? Http.headers.custom : {}, Http.headers[toLower(request.method)]);\n each(headers, function (value, name) {\n if (!request.headers.has(name)) {\n request.headers.set(name, value);\n }\n });\n}\n/**\n * XMLHttp client (Browser).\n */\n\n\nfunction xhrClient(request) {\n return new PromiseObj(function (resolve) {\n var xhr = new XMLHttpRequest(),\n handler = function handler(event) {\n var response = request.respondWith('response' in xhr ? xhr.response : xhr.responseText, {\n status: xhr.status === 1223 ? 204 : xhr.status,\n // IE9 status bug\n statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)\n });\n each(trim(xhr.getAllResponseHeaders()).split('\\n'), function (row) {\n response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));\n });\n resolve(response);\n };\n\n request.abort = function () {\n return xhr.abort();\n };\n\n xhr.open(request.method, request.getUrl(), true);\n\n if (request.timeout) {\n xhr.timeout = request.timeout;\n }\n\n if (request.responseType && 'responseType' in xhr) {\n xhr.responseType = request.responseType;\n }\n\n if (request.withCredentials || request.credentials) {\n xhr.withCredentials = true;\n }\n\n if (!request.crossOrigin) {\n request.headers.set('X-Requested-With', 'XMLHttpRequest');\n } // deprecated use downloadProgress\n\n\n if (isFunction(request.progress) && request.method === 'GET') {\n xhr.addEventListener('progress', request.progress);\n }\n\n if (isFunction(request.downloadProgress)) {\n xhr.addEventListener('progress', request.downloadProgress);\n } // deprecated use uploadProgress\n\n\n if (isFunction(request.progress) && /^(POST|PUT)$/i.test(request.method)) {\n xhr.upload.addEventListener('progress', request.progress);\n }\n\n if (isFunction(request.uploadProgress) && xhr.upload) {\n xhr.upload.addEventListener('progress', request.uploadProgress);\n }\n\n request.headers.forEach(function (value, name) {\n xhr.setRequestHeader(name, value);\n });\n xhr.onload = handler;\n xhr.onabort = handler;\n xhr.onerror = handler;\n xhr.ontimeout = handler;\n xhr.send(request.getBody());\n });\n}\n/**\n * Http client (Node).\n */\n\n\nfunction nodeClient(request) {\n var client = require('got');\n\n return new PromiseObj(function (resolve) {\n var url = request.getUrl();\n var body = request.getBody();\n var method = request.method;\n var headers = {},\n handler;\n request.headers.forEach(function (value, name) {\n headers[name] = value;\n });\n client(url, {\n body: body,\n method: method,\n headers: headers\n }).then(handler = function handler(resp) {\n var response = request.respondWith(resp.body, {\n status: resp.statusCode,\n statusText: trim(resp.statusMessage)\n });\n each(resp.headers, function (value, name) {\n response.headers.set(name, value);\n });\n resolve(response);\n }, function (error$$1) {\n return handler(error$$1.response);\n });\n });\n}\n/**\n * Base client.\n */\n\n\nfunction Client(context) {\n var reqHandlers = [sendRequest],\n resHandlers = [];\n\n if (!isObject(context)) {\n context = null;\n }\n\n function Client(request) {\n while (reqHandlers.length) {\n var handler = reqHandlers.pop();\n\n if (isFunction(handler)) {\n var _ret = function () {\n var response = void 0,\n next = void 0;\n response = handler.call(context, request, function (val) {\n return next = val;\n }) || next;\n\n if (isObject(response)) {\n return {\n v: new PromiseObj(function (resolve, reject) {\n resHandlers.forEach(function (handler) {\n response = when(response, function (response) {\n return handler.call(context, response) || response;\n }, reject);\n });\n when(response, resolve, reject);\n }, context)\n };\n }\n\n if (isFunction(response)) {\n resHandlers.unshift(response);\n }\n }();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n } else {\n warn(\"Invalid interceptor of type \" + _typeof(handler) + \", must be a function\");\n }\n }\n }\n\n Client.use = function (handler) {\n reqHandlers.push(handler);\n };\n\n return Client;\n}\n\nfunction sendRequest(request) {\n var client = request.client || (inBrowser ? xhrClient : nodeClient);\n return client(request);\n}\n/**\n * HTTP Headers.\n */\n\n\nvar Headers = /*#__PURE__*/function () {\n function Headers(headers) {\n var _this = this;\n\n this.map = {};\n each(headers, function (value, name) {\n return _this.append(name, value);\n });\n }\n\n var _proto = Headers.prototype;\n\n _proto.has = function has(name) {\n return getName(this.map, name) !== null;\n };\n\n _proto.get = function get(name) {\n var list = this.map[getName(this.map, name)];\n return list ? list.join() : null;\n };\n\n _proto.getAll = function getAll(name) {\n return this.map[getName(this.map, name)] || [];\n };\n\n _proto.set = function set(name, value) {\n this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];\n };\n\n _proto.append = function append(name, value) {\n var list = this.map[getName(this.map, name)];\n\n if (list) {\n list.push(trim(value));\n } else {\n this.set(name, value);\n }\n };\n\n _proto[\"delete\"] = function _delete(name) {\n delete this.map[getName(this.map, name)];\n };\n\n _proto.deleteAll = function deleteAll() {\n this.map = {};\n };\n\n _proto.forEach = function forEach(callback, thisArg) {\n var _this2 = this;\n\n each(this.map, function (list, name) {\n each(list, function (value) {\n return callback.call(thisArg, value, name, _this2);\n });\n });\n };\n\n return Headers;\n}();\n\nfunction getName(map, name) {\n return Object.keys(map).reduce(function (prev, curr) {\n return toLower(name) === toLower(curr) ? curr : prev;\n }, null);\n}\n\nfunction normalizeName(name) {\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name');\n }\n\n return trim(name);\n}\n/**\n * HTTP Response.\n */\n\n\nvar Response = /*#__PURE__*/function () {\n function Response(body, _ref) {\n var url = _ref.url,\n headers = _ref.headers,\n status = _ref.status,\n statusText = _ref.statusText;\n this.url = url;\n this.ok = status >= 200 && status < 300;\n this.status = status || 0;\n this.statusText = statusText || '';\n this.headers = new Headers(headers);\n this.body = body;\n\n if (isString(body)) {\n this.bodyText = body;\n } else if (isBlob(body)) {\n this.bodyBlob = body;\n\n if (isBlobText(body)) {\n this.bodyText = blobText(body);\n }\n }\n }\n\n var _proto = Response.prototype;\n\n _proto.blob = function blob() {\n return when(this.bodyBlob);\n };\n\n _proto.text = function text() {\n return when(this.bodyText);\n };\n\n _proto.json = function json() {\n return when(this.text(), function (text) {\n return JSON.parse(text);\n });\n };\n\n return Response;\n}();\n\nObject.defineProperty(Response.prototype, 'data', {\n get: function get() {\n return this.body;\n },\n set: function set(body) {\n this.body = body;\n }\n});\n\nfunction blobText(body) {\n return new PromiseObj(function (resolve) {\n var reader = new FileReader();\n reader.readAsText(body);\n\n reader.onload = function () {\n resolve(reader.result);\n };\n });\n}\n\nfunction isBlobText(body) {\n return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;\n}\n/**\n * HTTP Request.\n */\n\n\nvar Request = /*#__PURE__*/function () {\n function Request(options$$1) {\n this.body = null;\n this.params = {};\n assign(this, options$$1, {\n method: toUpper(options$$1.method || 'GET')\n });\n\n if (!(this.headers instanceof Headers)) {\n this.headers = new Headers(this.headers);\n }\n }\n\n var _proto = Request.prototype;\n\n _proto.getUrl = function getUrl() {\n return Url(this);\n };\n\n _proto.getBody = function getBody() {\n return this.body;\n };\n\n _proto.respondWith = function respondWith(body, options$$1) {\n return new Response(body, assign(options$$1 || {}, {\n url: this.getUrl()\n }));\n };\n\n return Request;\n}();\n/**\n * Service for sending network requests.\n */\n\n\nvar COMMON_HEADERS = {\n 'Accept': 'application/json, text/plain, */*'\n};\nvar JSON_CONTENT_TYPE = {\n 'Content-Type': 'application/json;charset=utf-8'\n};\n\nfunction Http(options$$1) {\n var self = this || {},\n client = Client(self.$vm);\n defaults(options$$1 || {}, self.$options, Http.options);\n Http.interceptors.forEach(function (handler) {\n if (isString(handler)) {\n handler = Http.interceptor[handler];\n }\n\n if (isFunction(handler)) {\n client.use(handler);\n }\n });\n return client(new Request(options$$1)).then(function (response) {\n return response.ok ? response : PromiseObj.reject(response);\n }, function (response) {\n if (response instanceof Error) {\n error(response);\n }\n\n return PromiseObj.reject(response);\n });\n}\n\nHttp.options = {};\nHttp.headers = {\n put: JSON_CONTENT_TYPE,\n post: JSON_CONTENT_TYPE,\n patch: JSON_CONTENT_TYPE,\n \"delete\": JSON_CONTENT_TYPE,\n common: COMMON_HEADERS,\n custom: {}\n};\nHttp.interceptor = {\n before: before,\n method: method,\n jsonp: jsonp,\n json: json,\n form: form,\n header: header,\n cors: cors\n};\nHttp.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];\n['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {\n Http[method$$1] = function (url, options$$1) {\n return this(assign(options$$1 || {}, {\n url: url,\n method: method$$1\n }));\n };\n});\n['post', 'put', 'patch'].forEach(function (method$$1) {\n Http[method$$1] = function (url, body, options$$1) {\n return this(assign(options$$1 || {}, {\n url: url,\n method: method$$1,\n body: body\n }));\n };\n});\n/**\n * Service for interacting with RESTful services.\n */\n\nfunction Resource(url, params, actions, options$$1) {\n var self = this || {},\n resource = {};\n actions = assign({}, Resource.actions, actions);\n each(actions, function (action, name) {\n action = merge({\n url: url,\n params: assign({}, params)\n }, options$$1, action);\n\n resource[name] = function () {\n return (self.$http || Http)(opts(action, arguments));\n };\n });\n return resource;\n}\n\nfunction opts(action, args) {\n var options$$1 = assign({}, action),\n params = {},\n body;\n\n switch (args.length) {\n case 2:\n params = args[0];\n body = args[1];\n break;\n\n case 1:\n if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {\n body = args[0];\n } else {\n params = args[0];\n }\n\n break;\n\n case 0:\n break;\n\n default:\n throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';\n }\n\n options$$1.body = body;\n options$$1.params = assign({}, options$$1.params, params);\n return options$$1;\n}\n\nResource.actions = {\n get: {\n method: 'GET'\n },\n save: {\n method: 'POST'\n },\n query: {\n method: 'GET'\n },\n update: {\n method: 'PUT'\n },\n remove: {\n method: 'DELETE'\n },\n \"delete\": {\n method: 'DELETE'\n }\n};\n/**\n * Install plugin.\n */\n\nfunction plugin(Vue) {\n if (plugin.installed) {\n return;\n }\n\n Util(Vue);\n Vue.url = Url;\n Vue.http = Http;\n Vue.resource = Resource;\n Vue.Promise = PromiseObj;\n Object.defineProperties(Vue.prototype, {\n $url: {\n get: function get() {\n return options(Vue.url, this, this.$options.url);\n }\n },\n $http: {\n get: function get() {\n return options(Vue.http, this, this.$options.http);\n }\n },\n $resource: {\n get: function get() {\n return Vue.resource.bind(this);\n }\n },\n $promise: {\n get: function get() {\n var _this = this;\n\n return function (executor) {\n return new Vue.Promise(executor, _this);\n };\n }\n }\n });\n}\n\nif (typeof window !== 'undefined' && window.Vue && !window.Vue.resource) {\n window.Vue.use(plugin);\n}\n\nexport default plugin;\nexport { Url, Http, Resource };","function _typeof2(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\n(function webpackUniversalModuleDefinition(root, factory) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof2(exports)) === 'object' && (typeof module === \"undefined\" ? \"undefined\" : _typeof2(module)) === 'object') module.exports = factory();else if (typeof define === 'function' && define.amd) define([], factory);else {\n var a = factory();\n\n for (var i in a) {\n ((typeof exports === \"undefined\" ? \"undefined\" : _typeof2(exports)) === 'object' ? exports : root)[i] = a[i];\n }\n }\n})(typeof self !== 'undefined' ? self : this, function () {\n return (\n /******/\n function (modules) {\n // webpackBootstrap\n\n /******/\n // The module cache\n\n /******/\n var installedModules = {};\n /******/\n\n /******/\n // The require function\n\n /******/\n\n function __webpack_require__(moduleId) {\n /******/\n\n /******/\n // Check if module is in cache\n\n /******/\n if (installedModules[moduleId]) {\n /******/\n return installedModules[moduleId].exports;\n /******/\n }\n /******/\n // Create a new module (and put it into the cache)\n\n /******/\n\n\n var module = installedModules[moduleId] = {\n /******/\n i: moduleId,\n\n /******/\n l: false,\n\n /******/\n exports: {}\n /******/\n\n };\n /******/\n\n /******/\n // Execute the module function\n\n /******/\n\n modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n /******/\n\n /******/\n // Flag the module as loaded\n\n /******/\n\n module.l = true;\n /******/\n\n /******/\n // Return the exports of the module\n\n /******/\n\n return module.exports;\n /******/\n }\n /******/\n\n /******/\n\n /******/\n // expose the modules object (__webpack_modules__)\n\n /******/\n\n\n __webpack_require__.m = modules;\n /******/\n\n /******/\n // expose the module cache\n\n /******/\n\n __webpack_require__.c = installedModules;\n /******/\n\n /******/\n // define getter function for harmony exports\n\n /******/\n\n __webpack_require__.d = function (exports, name, getter) {\n /******/\n if (!__webpack_require__.o(exports, name)) {\n /******/\n Object.defineProperty(exports, name, {\n enumerable: true,\n get: getter\n });\n /******/\n }\n /******/\n\n };\n /******/\n\n /******/\n // define __esModule on exports\n\n /******/\n\n\n __webpack_require__.r = function (exports) {\n /******/\n if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n /******/\n Object.defineProperty(exports, Symbol.toStringTag, {\n value: 'Module'\n });\n /******/\n }\n /******/\n\n\n Object.defineProperty(exports, '__esModule', {\n value: true\n });\n /******/\n };\n /******/\n\n /******/\n // create a fake namespace object\n\n /******/\n // mode & 1: value is a module id, require it\n\n /******/\n // mode & 2: merge all properties of value into the ns\n\n /******/\n // mode & 4: return value when already ns object\n\n /******/\n // mode & 8|1: behave like require\n\n /******/\n\n\n __webpack_require__.t = function (value, mode) {\n /******/\n if (mode & 1) value = __webpack_require__(value);\n /******/\n\n if (mode & 8) return value;\n /******/\n\n if (mode & 4 && _typeof2(value) === 'object' && value && value.__esModule) return value;\n /******/\n\n var ns = Object.create(null);\n /******/\n\n __webpack_require__.r(ns);\n /******/\n\n\n Object.defineProperty(ns, 'default', {\n enumerable: true,\n value: value\n });\n /******/\n\n if (mode & 2 && typeof value != 'string') for (var key in value) {\n __webpack_require__.d(ns, key, function (key) {\n return value[key];\n }.bind(null, key));\n }\n /******/\n\n return ns;\n /******/\n };\n /******/\n\n /******/\n // getDefaultExport function for compatibility with non-harmony modules\n\n /******/\n\n\n __webpack_require__.n = function (module) {\n /******/\n var getter = module && module.__esModule ?\n /******/\n function getDefault() {\n return module['default'];\n } :\n /******/\n function getModuleExports() {\n return module;\n };\n /******/\n\n __webpack_require__.d(getter, 'a', getter);\n /******/\n\n\n return getter;\n /******/\n };\n /******/\n\n /******/\n // Object.prototype.hasOwnProperty.call\n\n /******/\n\n\n __webpack_require__.o = function (object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n };\n /******/\n\n /******/\n // __webpack_public_path__\n\n /******/\n\n\n __webpack_require__.p = \"\";\n /******/\n\n /******/\n\n /******/\n // Load entry module and return exports\n\n /******/\n\n return __webpack_require__(__webpack_require__.s = 0);\n /******/\n }\n /************************************************************************/\n\n /******/\n ([\n /* 0 */\n\n /***/\n function (module, __webpack_exports__, __webpack_require__) {\n \"use strict\";\n\n __webpack_require__.r(__webpack_exports__);\n\n var string_namespaceObject = {};\n\n __webpack_require__.r(string_namespaceObject);\n\n __webpack_require__.d(string_namespaceObject, \"capitalize\", function () {\n return string_capitalize;\n });\n\n __webpack_require__.d(string_namespaceObject, \"uppercase\", function () {\n return string_uppercase;\n });\n\n __webpack_require__.d(string_namespaceObject, \"lowercase\", function () {\n return string_lowercase;\n });\n\n __webpack_require__.d(string_namespaceObject, \"placeholder\", function () {\n return string_placeholder;\n });\n\n __webpack_require__.d(string_namespaceObject, \"truncate\", function () {\n return string_truncate;\n });\n\n var other_namespaceObject = {};\n\n __webpack_require__.r(other_namespaceObject);\n\n __webpack_require__.d(other_namespaceObject, \"currency\", function () {\n return other_currency;\n });\n\n __webpack_require__.d(other_namespaceObject, \"bytes\", function () {\n return other_bytes;\n });\n\n __webpack_require__.d(other_namespaceObject, \"pluralize\", function () {\n return other_pluralize;\n });\n\n __webpack_require__.d(other_namespaceObject, \"ordinal\", function () {\n return other_ordinal;\n });\n\n __webpack_require__.d(other_namespaceObject, \"number\", function () {\n return other_number;\n }); // CONCATENATED MODULE: ./src/util/index.js\n\n\n function _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();\n }\n\n function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance\");\n }\n\n function _iterableToArray(iter) {\n if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter);\n }\n\n function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n }\n }\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n }\n\n var ArrayProto = Array.prototype,\n ObjProto = Object.prototype;\n var slice = ArrayProto.slice,\n util_toString = ObjProto.toString;\n var util = {};\n\n util.isArray = function (obj) {\n return Array.isArray(obj);\n };\n\n var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;\n\n util.isArrayLike = function (obj) {\n if (_typeof(obj) !== 'object' || !obj) {\n return false;\n }\n\n var length = obj.length;\n return typeof length === 'number' && length % 1 === 0 && length >= 0 && length <= MAX_ARRAY_INDEX;\n };\n\n util.isObject = function (obj) {\n var type = _typeof(obj);\n\n return type === 'function' || type === 'object' && !!obj;\n };\n\n util.each = function (obj, callback) {\n var i, len;\n\n if (util.isArray(obj)) {\n for (i = 0, len = obj.length; i < len; i++) {\n if (callback(obj[i], i, obj) === false) {\n break;\n }\n }\n } else {\n for (i in obj) {\n if (callback(obj[i], i, obj) === false) {\n break;\n }\n }\n }\n\n return obj;\n };\n\n util.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function (name) {\n util['is' + name] = function (obj) {\n return util_toString.call(obj) === '[object ' + name + ']';\n };\n });\n\n util.toArray = function (list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n\n while (i--) {\n ret[i] = list[i + start];\n }\n\n return ret;\n };\n\n util.toNumber = function (value) {\n if (typeof value !== 'string') {\n return value;\n } else {\n var parsed = Number(value);\n return isNaN(parsed) ? value : parsed;\n }\n };\n\n util.convertRangeToArray = function (range) {\n return _toConsumableArray(Array(range + 1).keys()).slice(1);\n };\n\n util.convertArray = function (value) {\n if (util.isArray(value)) {\n return value;\n } else if (util.isPlainObject(value)) {\n // convert plain object to array.\n var keys = Object.keys(value);\n var i = keys.length;\n var res = new Array(i);\n var key;\n\n while (i--) {\n key = keys[i];\n res[i] = {\n $key: key,\n $value: value[key]\n };\n }\n\n return res;\n } else {\n return value || [];\n }\n };\n\n function multiIndex(obj, is) {\n // obj,['1','2','3'] -> ((obj['1'])['2'])['3']\n return is.length ? multiIndex(obj[is[0]], is.slice(1)) : obj;\n }\n\n util.getPath = function (obj, is) {\n // obj,'1.2.3' -> multiIndex(obj,['1','2','3'])\n return multiIndex(obj, is.split('.'));\n };\n /**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n *\n * @param {*} obj\n * @return {Boolean}\n */\n\n\n var util_toString = Object.prototype.toString;\n var OBJECT_STRING = '[object Object]';\n\n util.isPlainObject = function (obj) {\n return util_toString.call(obj) === OBJECT_STRING;\n };\n\n util.exist = function (value) {\n return value !== null && typeof value !== 'undefined';\n };\n /* harmony default export */\n\n\n var src_util = util; // CONCATENATED MODULE: ./src/string/capitalize.js\n\n /**\n * Converts a string into Capitalize\n * \n * 'abc' => 'Abc'\n * \n * @param {Object} options\n */\n\n function capitalize(value, options) {\n var globalOptions = this && this.capitalize ? this.capitalize : {};\n options = options || globalOptions;\n var onlyFirstLetter = options.onlyFirstLetter != null ? options.onlyFirstLetter : false;\n if (!value && value !== 0) return '';\n\n if (onlyFirstLetter === true) {\n return value.toString().charAt(0).toUpperCase() + value.toString().slice(1);\n } else {\n value = value.toString().toLowerCase().split(' ');\n return value.map(function (item) {\n return item.charAt(0).toUpperCase() + item.slice(1);\n }).join(' ');\n }\n }\n /* harmony default export */\n\n\n var string_capitalize = capitalize; // CONCATENATED MODULE: ./src/string/uppercase.js\n\n /**\n * Converts a string to UPPERCASE\n * \n * 'abc' => 'ABC'\n */\n\n function uppercase(value) {\n return value || value === 0 ? value.toString().toUpperCase() : '';\n }\n /* harmony default export */\n\n\n var string_uppercase = uppercase; // CONCATENATED MODULE: ./src/string/lowercase.js\n\n /**\n * Converts a string to lowercase\n * \n * 'AbC' => 'abc'\n */\n\n function lowercase(value) {\n return value || value === 0 ? value.toString().toLowerCase() : '';\n }\n /* harmony default export */\n\n\n var string_lowercase = lowercase; // CONCATENATED MODULE: ./src/string/placeholder.js\n\n /**\n * If the value is missing outputs the placeholder text\n * \n * '' => {placeholder}\n * 'foo' => 'foo'\n */\n\n function placeholder(input, property) {\n return input === undefined || input === '' || input === null ? property : input;\n }\n /* harmony default export */\n\n\n var string_placeholder = placeholder; // CONCATENATED MODULE: ./src/string/truncate.js\n\n /**\n * Truncate at the given || default length\n *\n * 'lorem ipsum dolor' => 'lorem ipsum dol...'\n */\n\n function truncate(value, length) {\n length = length || 15;\n if (!value || typeof value !== 'string') return '';\n if (value.length <= length) return value;\n return value.substring(0, length) + '...';\n }\n /* harmony default export */\n\n\n var string_truncate = truncate; // CONCATENATED MODULE: ./src/string/index.js\n // CONCATENATED MODULE: ./src/array/limitBy.js\n\n /**\n * Limit filter for arrays\n *\n * @param {Number|Array} arr (If Number, decimal expected)\n * @param {Number} n\n * @param {Number} offset (Decimal expected)\n */\n\n function limitBy(arr, n, offset) {\n arr = src_util.isArray(arr) ? arr : src_util.convertRangeToArray(arr);\n offset = offset ? parseInt(offset, 10) : 0;\n n = src_util.toNumber(n);\n return typeof n === 'number' ? arr.slice(offset, offset + n) : arr;\n }\n /* harmony default export */\n\n\n var array_limitBy = limitBy; // CONCATENATED MODULE: ./src/array/filterBy.js\n\n /**\n * Filter filter for arrays\n *\n * @param {Array} arr\n * @param {String} prop\n * @param {String|Number} search\n */\n\n function filterBy(arr, search) {\n var arr = src_util.convertArray(arr);\n\n if (search == null) {\n return arr;\n }\n\n if (typeof search === 'function') {\n return arr.filter(search);\n } // cast to lowercase string\n\n\n search = ('' + search).toLowerCase();\n var n = 2; // extract and flatten keys\n\n var keys = Array.prototype.concat.apply([], src_util.toArray(arguments, n));\n var res = [];\n var item, key, val, j;\n\n for (var i = 0, l = arr.length; i < l; i++) {\n item = arr[i];\n val = item && item.$value || item;\n j = keys.length;\n\n if (j) {\n while (j--) {\n key = keys[j];\n\n if (key === '$key' && contains(item.$key, search) || contains(src_util.getPath(val, key), search)) {\n res.push(item);\n break;\n }\n }\n } else if (contains(item, search)) {\n res.push(item);\n }\n }\n\n return res;\n }\n\n function contains(val, search) {\n var i;\n\n if (src_util.isPlainObject(val)) {\n var keys = Object.keys(val);\n i = keys.length;\n\n while (i--) {\n if (contains(val[keys[i]], search)) {\n return true;\n }\n }\n } else if (src_util.isArray(val)) {\n i = val.length;\n\n while (i--) {\n if (contains(val[i], search)) {\n return true;\n }\n }\n } else if (val != null) {\n return val.toString().toLowerCase().indexOf(search) > -1;\n }\n }\n /* harmony default export */\n\n\n var array_filterBy = filterBy; // CONCATENATED MODULE: ./src/array/orderBy.js\n\n /**\n * Filter filter for arrays\n *\n * @param {String|Array|Function} ...sortKeys\n * @param {Number} [order]\n */\n\n function orderBy(arr) {\n var _comparator = null;\n var sortKeys;\n arr = src_util.convertArray(arr); // determine order (last argument)\n\n var args = src_util.toArray(arguments, 1);\n var order = args[args.length - 1];\n\n if (typeof order === 'number') {\n order = order < 0 ? -1 : 1;\n args = args.length > 1 ? args.slice(0, -1) : args;\n } else {\n order = 1;\n } // determine sortKeys & comparator\n\n\n var firstArg = args[0];\n\n if (!firstArg) {\n return arr;\n } else if (typeof firstArg === 'function') {\n // custom comparator\n _comparator = function comparator(a, b) {\n return firstArg(a, b) * order;\n };\n } else {\n // string keys. flatten first\n sortKeys = Array.prototype.concat.apply([], args);\n\n _comparator = function comparator(a, b, i) {\n i = i || 0;\n return i >= sortKeys.length - 1 ? baseCompare(a, b, i) : baseCompare(a, b, i) || _comparator(a, b, i + 1);\n };\n }\n\n function baseCompare(a, b, sortKeyIndex) {\n var sortKey = sortKeys[sortKeyIndex];\n\n if (sortKey) {\n if (sortKey !== '$key') {\n if (src_util.isObject(a) && '$value' in a) a = a.$value;\n if (src_util.isObject(b) && '$value' in b) b = b.$value;\n }\n\n a = src_util.isObject(a) ? src_util.getPath(a, sortKey) : a;\n b = src_util.isObject(b) ? src_util.getPath(b, sortKey) : b;\n a = typeof a === 'string' ? a.toLowerCase() : a;\n b = typeof b === 'string' ? b.toLowerCase() : b;\n }\n\n return a === b ? 0 : a > b ? order : -order;\n } // sort on a copy to avoid mutating original array\n\n\n return arr.slice().sort(_comparator);\n }\n /* harmony default export */\n\n\n var array_orderBy = orderBy; // CONCATENATED MODULE: ./src/array/find.js\n\n /**\n * Get first matching element from a filtered array\n *\n * @param {Array} arr\n * @param {String|Number} search\n * @returns {mixed}\n */\n\n function find(arr, search) {\n var array = array_filterBy.apply(this, arguments);\n array.splice(1);\n return array;\n }\n /* harmony default export */\n\n\n var array_find = find; // CONCATENATED MODULE: ./src/array/index.js\n // CONCATENATED MODULE: ./src/other/currency.js\n\n /**\n * \n * 12345 => $12,345.00\n *\n * @param {String} symbol\n * @param {Number} decimals Decimal places\n * @param {Object} options\n */\n\n function currency(value, symbol, decimals, options) {\n var globalOptions = this && this.currency ? this.currency : {};\n symbol = src_util.exist(symbol) ? symbol : globalOptions.symbol;\n decimals = src_util.exist(decimals) ? decimals : globalOptions.decimalDigits;\n options = options || globalOptions;\n var thousandsSeparator, symbolOnLeft, spaceBetweenAmountAndSymbol, showPlusSign;\n var digitsRE = /(\\d{3})(?=\\d)/g;\n value = parseFloat(value);\n if (!isFinite(value) || !value && value !== 0) return '';\n symbol = typeof symbol !== 'undefined' ? symbol : '$';\n decimals = typeof decimals !== 'undefined' ? decimals : 2;\n thousandsSeparator = options.thousandsSeparator != null ? options.thousandsSeparator : ',';\n symbolOnLeft = options.symbolOnLeft != null ? options.symbolOnLeft : true;\n spaceBetweenAmountAndSymbol = options.spaceBetweenAmountAndSymbol != null ? options.spaceBetweenAmountAndSymbol : false;\n showPlusSign = options.showPlusSign != null ? options.showPlusSign : false;\n var number = Math.abs(value);\n var stringified = toFixed(number, decimals);\n stringified = options.decimalSeparator ? stringified.replace('.', options.decimalSeparator) : stringified;\n\n var _int = decimals ? stringified.slice(0, -1 - decimals) : stringified;\n\n var i = _int.length % 3;\n var head = i > 0 ? _int.slice(0, i) + (_int.length > 3 ? thousandsSeparator : '') : '';\n\n var _float = decimals ? stringified.slice(-1 - decimals) : '';\n\n symbol = spaceBetweenAmountAndSymbol ? symbolOnLeft ? symbol + ' ' : ' ' + symbol : symbol;\n symbol = symbolOnLeft ? symbol + head + _int.slice(i).replace(digitsRE, '$1' + thousandsSeparator) + _float : head + _int.slice(i).replace(digitsRE, '$1' + thousandsSeparator) + _float + symbol;\n var sign = value < 0 ? '-' : '';\n var plusSign = value > 0 && showPlusSign ? '+' : '';\n return plusSign + sign + symbol;\n }\n\n function toFixed(num, precision) {\n return (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision)).toFixed(precision);\n }\n /* harmony default export */\n\n\n var other_currency = currency; // CONCATENATED MODULE: ./src/other/bytes.js\n\n /**\n * 8 => '8 byte'\n * 1024 => '1.00 kb'\n * 2000000 => '1.90 MB'\n * 2000000000 => '1.86 GB'\n * 2000000000000 => '1.82 TB'\n *\n * @param {Number} value\n * @param {Number} decimals Decimal places (default: 2)\n */\n\n function bytes(value, decimals) {\n var globalOptions = this && this.bytes ? this.bytes : {};\n decimals = src_util.exist(decimals) ? decimals : globalOptions.decimalDigits;\n decimals = typeof decimals !== 'undefined' ? decimals : 2;\n value = value === null || isNaN(value) ? 0 : value;\n\n if (value >= Math.pow(1024, 4)) {\n // TB\n return \"\".concat((value / Math.pow(1024, 4)).toFixed(decimals), \" TB\");\n } else if (value >= Math.pow(1024, 3)) {\n // GB\n return \"\".concat((value / Math.pow(1024, 3)).toFixed(decimals), \" GB\");\n } else if (value >= Math.pow(1024, 2)) {\n // MB\n return \"\".concat((value / Math.pow(1024, 2)).toFixed(decimals), \" MB\");\n } else if (value >= 1024) {\n // kb\n return \"\".concat((value / 1024).toFixed(decimals), \" kb\");\n } // byte\n\n\n return \"\".concat(value, \" byte\");\n }\n /* harmony default export */\n\n\n var other_bytes = bytes; // CONCATENATED MODULE: ./src/other/pluralize.js\n\n /**\n * 'item' => 'items'\n *\n * @param {String|Array} word\n * @param {Object} options\n *\n */\n\n function pluralize(value, word, options) {\n var globalOptions = this && this.pluralize ? this.pluralize : {};\n options = options || globalOptions;\n var output = '';\n var includeNumber = options.includeNumber != null ? options.includeNumber : false;\n if (includeNumber === true) output += value + ' ';\n if (!value && value !== 0 || !word) return output;\n\n if (Array.isArray(word)) {\n output += word[value - 1] || word[word.length - 1];\n } else {\n output += word + (value === 1 ? '' : 's');\n }\n\n return output;\n }\n /* harmony default export */\n\n\n var other_pluralize = pluralize; // CONCATENATED MODULE: ./src/other/ordinal.js\n\n /**\n * 42 => 'nd'\n *\n * @params {Object} options\n * \n */\n\n function ordinal(value, options) {\n var globalOptions = this && this.ordinal ? this.ordinal : {};\n options = options || globalOptions;\n var output = '';\n var includeNumber = options.includeNumber != null ? options.includeNumber : false;\n if (includeNumber === true) output += value;\n var j = value % 10,\n k = value % 100;\n if (j == 1 && k != 11) output += 'st';else if (j == 2 && k != 12) output += 'nd';else if (j == 3 && k != 13) output += 'rd';else output += 'th';\n return output;\n }\n /* harmony default export */\n\n\n var other_ordinal = ordinal; // CONCATENATED MODULE: ./src/other/number.js\n\n /**\n * 123456 => '123,456'\n *\n * @params {Object} options\n * \n */\n\n function number_number(value, format, options) {\n var globalOptions = this && this.number ? this.number : {};\n format = src_util.exist(format) ? format : globalOptions.format;\n options = options || globalOptions;\n var config = parseFormat(format);\n var number = parseNumber(value);\n var thousandsSeparator = options.thousandsSeparator != null ? options.thousandsSeparator : ',';\n var decimalSeparator = options.decimalSeparator != null ? options.decimalSeparator : '.';\n config.sign = config.sign || number.sign;\n\n if (config.unit) {\n var numberWithUnit = addUnit(number.float, config);\n return config.sign + numberWithUnit;\n }\n\n var int = config.decimals === 0 ? number_toFixed(number.float, 0) : number.int;\n\n switch (config.base) {\n case '':\n int = '';\n break;\n\n case '0,0':\n int = addSeparator(int, thousandsSeparator);\n break;\n }\n\n var fraction = getFraction(number.float, config.decimals, decimalSeparator);\n return config.sign + int + fraction;\n }\n\n Math.sign = function (x) {\n x = +x;\n\n if (x === 0 || isNaN(x)) {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n\n function parseNumber(num) {\n return {\n float: Math.abs(parseFloat(num)),\n int: Math.abs(parseInt(num)),\n sign: Math.sign(num) < 0 ? '-' : ''\n };\n }\n\n function parseFormat() {\n var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '0';\n var regex = /([\\+\\-])?([0-9\\,]+)?([\\.0-9]+)?([a\\s]+)?/;\n var matches = string ? string.match(regex) : ['', '', '', '', ''];\n var float = matches[3];\n var decimals = float ? float.match(/0/g).length : 0;\n return {\n sign: matches[1] || '',\n base: matches[2] || '',\n decimals: decimals,\n unit: matches[4] || ''\n };\n }\n\n function addUnit(num, config) {\n var rx = /\\.0+$|(\\.[0-9]*[1-9])0+$/;\n var si = [{\n value: 1,\n symbol: \"\"\n }, {\n value: 1E3,\n symbol: \"K\"\n }, {\n value: 1E6,\n symbol: \"M\"\n }];\n var i;\n\n for (i = si.length - 1; i > 0; i--) {\n if (num >= si[i].value) {\n break;\n }\n }\n\n num = (num / si[i].value).toFixed(config.decimals).replace(rx, \"$1\");\n return num + config.unit.replace('a', si[i].symbol);\n }\n\n function addSeparator(num, separator) {\n var regex = /(\\d+)(\\d{3})/;\n var string = num.toString();\n var x = string.split('.');\n var x1 = x[0];\n var x2 = x.length > 1 ? '.' + x[1] : '';\n\n while (regex.test(x1)) {\n x1 = x1.replace(regex, '$1' + separator + '$2');\n }\n\n return x1 + x2;\n }\n\n function getFraction(num, decimals, separator) {\n var fraction = number_toFixed(num, decimals).toString().split('.')[1];\n return fraction ? separator + fraction : '';\n }\n\n function number_toFixed(num, precision) {\n return (+(Math.round(+(num + 'e' + precision)) + 'e' + -precision)).toFixed(precision);\n }\n /* harmony default export */\n\n\n var other_number = number_number; // CONCATENATED MODULE: ./src/other/index.js\n // CONCATENATED MODULE: ./src/index.js\n\n var Vue2Filters = {\n install: function install(Vue, options) {\n src_util.each(string_namespaceObject, function (value, key) {\n Vue.filter(key, value.bind(options));\n });\n src_util.each(other_namespaceObject, function (value, key) {\n Vue.filter(key, value.bind(options));\n });\n },\n mixin: {\n methods: {\n limitBy: array_limitBy,\n filterBy: array_filterBy,\n orderBy: array_orderBy,\n find: array_find\n }\n }\n };\n /* harmony default export */\n\n var src = __webpack_exports__[\"default\"] = Vue2Filters;\n\n if (typeof window !== 'undefined' && window.Vue) {\n window.Vue.use(Vue2Filters);\n window.Vue2Filters = Vue2Filters;\n }\n /***/\n\n }\n /******/\n ])\n );\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\n * vue-i18n v8.27.2 \n * (c) 2022 kazuya kawaguchi\n * Released under the MIT License.\n */\n\n/* */\n\n/**\n * constants\n */\nvar numberFormatKeys = ['compactDisplay', 'currency', 'currencyDisplay', 'currencySign', 'localeMatcher', 'notation', 'numberingSystem', 'signDisplay', 'style', 'unit', 'unitDisplay', 'useGrouping', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits'];\n/**\n * utilities\n */\n\nfunction warn(msg, err) {\n if (typeof console !== 'undefined') {\n console.warn('[vue-i18n] ' + msg);\n /* istanbul ignore if */\n\n if (err) {\n console.warn(err.stack);\n }\n }\n}\n\nfunction error(msg, err) {\n if (typeof console !== 'undefined') {\n console.error('[vue-i18n] ' + msg);\n /* istanbul ignore if */\n\n if (err) {\n console.error(err.stack);\n }\n }\n}\n\nvar isArray = Array.isArray;\n\nfunction isObject(obj) {\n return obj !== null && _typeof(obj) === 'object';\n}\n\nfunction isBoolean(val) {\n return typeof val === 'boolean';\n}\n\nfunction isString(val) {\n return typeof val === 'string';\n}\n\nvar toString = Object.prototype.toString;\nvar OBJECT_STRING = '[object Object]';\n\nfunction isPlainObject(obj) {\n return toString.call(obj) === OBJECT_STRING;\n}\n\nfunction isNull(val) {\n return val === null || val === undefined;\n}\n\nfunction isFunction(val) {\n return typeof val === 'function';\n}\n\nfunction parseArgs() {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n var locale = null;\n var params = null;\n\n if (args.length === 1) {\n if (isObject(args[0]) || isArray(args[0])) {\n params = args[0];\n } else if (typeof args[0] === 'string') {\n locale = args[0];\n }\n } else if (args.length === 2) {\n if (typeof args[0] === 'string') {\n locale = args[0];\n }\n /* istanbul ignore if */\n\n\n if (isObject(args[1]) || isArray(args[1])) {\n params = args[1];\n }\n }\n\n return {\n locale: locale,\n params: params\n };\n}\n\nfunction looseClone(obj) {\n return JSON.parse(JSON.stringify(obj));\n}\n\nfunction remove(arr, item) {\n if (arr.delete(item)) {\n return arr;\n }\n}\n\nfunction arrayFrom(arr) {\n var ret = [];\n arr.forEach(function (a) {\n return ret.push(a);\n });\n return ret;\n}\n\nfunction includes(arr, item) {\n return !!~arr.indexOf(item);\n}\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n\nfunction merge(target) {\n var arguments$1 = arguments;\n var output = Object(target);\n\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments$1[i];\n\n if (source !== undefined && source !== null) {\n var key = void 0;\n\n for (key in source) {\n if (hasOwn(source, key)) {\n if (isObject(source[key])) {\n output[key] = merge(output[key], source[key]);\n } else {\n output[key] = source[key];\n }\n }\n }\n }\n }\n\n return output;\n}\n\nfunction looseEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n var isObjectA = isObject(a);\n var isObjectB = isObject(b);\n\n if (isObjectA && isObjectB) {\n try {\n var isArrayA = isArray(a);\n var isArrayB = isArray(b);\n\n if (isArrayA && isArrayB) {\n return a.length === b.length && a.every(function (e, i) {\n return looseEqual(e, b[i]);\n });\n } else if (!isArrayA && !isArrayB) {\n var keysA = Object.keys(a);\n var keysB = Object.keys(b);\n return keysA.length === keysB.length && keysA.every(function (key) {\n return looseEqual(a[key], b[key]);\n });\n } else {\n /* istanbul ignore next */\n return false;\n }\n } catch (e) {\n /* istanbul ignore next */\n return false;\n }\n } else if (!isObjectA && !isObjectB) {\n return String(a) === String(b);\n } else {\n return false;\n }\n}\n/**\n * Sanitizes html special characters from input strings. For mitigating risk of XSS attacks.\n * @param rawText The raw input from the user that should be escaped.\n */\n\n\nfunction escapeHtml(rawText) {\n return rawText.replace(//g, '>').replace(/\"/g, '"').replace(/'/g, ''');\n}\n/**\n * Escapes html tags and special symbols from all provided params which were returned from parseArgs().params.\n * This method performs an in-place operation on the params object.\n *\n * @param {any} params Parameters as provided from `parseArgs().params`.\n * May be either an array of strings or a string->any map.\n *\n * @returns The manipulated `params` object.\n */\n\n\nfunction escapeParams(params) {\n if (params != null) {\n Object.keys(params).forEach(function (key) {\n if (typeof params[key] == 'string') {\n params[key] = escapeHtml(params[key]);\n }\n });\n }\n\n return params;\n}\n/* */\n\n\nfunction extend(Vue) {\n if (!Vue.prototype.hasOwnProperty('$i18n')) {\n // $FlowFixMe\n Object.defineProperty(Vue.prototype, '$i18n', {\n get: function get() {\n return this._i18n;\n }\n });\n }\n\n Vue.prototype.$t = function (key) {\n var values = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n values[len] = arguments[len + 1];\n }\n\n var i18n = this.$i18n;\n return i18n._t.apply(i18n, [key, i18n.locale, i18n._getMessages(), this].concat(values));\n };\n\n Vue.prototype.$tc = function (key, choice) {\n var values = [],\n len = arguments.length - 2;\n\n while (len-- > 0) {\n values[len] = arguments[len + 2];\n }\n\n var i18n = this.$i18n;\n return i18n._tc.apply(i18n, [key, i18n.locale, i18n._getMessages(), this, choice].concat(values));\n };\n\n Vue.prototype.$te = function (key, locale) {\n var i18n = this.$i18n;\n return i18n._te(key, i18n.locale, i18n._getMessages(), locale);\n };\n\n Vue.prototype.$d = function (value) {\n var ref;\n var args = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n args[len] = arguments[len + 1];\n }\n\n return (ref = this.$i18n).d.apply(ref, [value].concat(args));\n };\n\n Vue.prototype.$n = function (value) {\n var ref;\n var args = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n args[len] = arguments[len + 1];\n }\n\n return (ref = this.$i18n).n.apply(ref, [value].concat(args));\n };\n}\n/* */\n\n/**\n * Mixin\n * \n * If `bridge` mode, empty mixin is returned,\n * else regulary mixin implementation is returned.\n */\n\n\nfunction defineMixin(bridge) {\n if (bridge === void 0) bridge = false;\n\n function mounted() {\n if (this !== this.$root && this.$options.__INTLIFY_META__ && this.$el) {\n this.$el.setAttribute('data-intlify', this.$options.__INTLIFY_META__);\n }\n }\n\n return bridge ? {\n mounted: mounted\n } // delegate `vue-i18n-bridge` mixin implementation\n : {\n // regulary \n beforeCreate: function beforeCreate() {\n var options = this.$options;\n options.i18n = options.i18n || (options.__i18nBridge || options.__i18n ? {} : null);\n\n if (options.i18n) {\n if (options.i18n instanceof VueI18n) {\n // init locale messages via custom blocks\n if (options.__i18nBridge || options.__i18n) {\n try {\n var localeMessages = options.i18n && options.i18n.messages ? options.i18n.messages : {};\n\n var _i18n = options.__i18nBridge || options.__i18n;\n\n _i18n.forEach(function (resource) {\n localeMessages = merge(localeMessages, JSON.parse(resource));\n });\n\n Object.keys(localeMessages).forEach(function (locale) {\n options.i18n.mergeLocaleMessage(locale, localeMessages[locale]);\n });\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n error(\"Cannot parse locale messages via custom blocks.\", e);\n }\n }\n }\n\n this._i18n = options.i18n;\n this._i18nWatcher = this._i18n.watchI18nData();\n } else if (isPlainObject(options.i18n)) {\n var rootI18n = this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n ? this.$root.$i18n : null; // component local i18n\n\n if (rootI18n) {\n options.i18n.root = this.$root;\n options.i18n.formatter = rootI18n.formatter;\n options.i18n.fallbackLocale = rootI18n.fallbackLocale;\n options.i18n.formatFallbackMessages = rootI18n.formatFallbackMessages;\n options.i18n.silentTranslationWarn = rootI18n.silentTranslationWarn;\n options.i18n.silentFallbackWarn = rootI18n.silentFallbackWarn;\n options.i18n.pluralizationRules = rootI18n.pluralizationRules;\n options.i18n.preserveDirectiveContent = rootI18n.preserveDirectiveContent;\n } // init locale messages via custom blocks\n\n\n if (options.__i18nBridge || options.__i18n) {\n try {\n var localeMessages$1 = options.i18n && options.i18n.messages ? options.i18n.messages : {};\n\n var _i18n$1 = options.__i18nBridge || options.__i18n;\n\n _i18n$1.forEach(function (resource) {\n localeMessages$1 = merge(localeMessages$1, JSON.parse(resource));\n });\n\n options.i18n.messages = localeMessages$1;\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Cannot parse locale messages via custom blocks.\", e);\n }\n }\n }\n\n var ref = options.i18n;\n var sharedMessages = ref.sharedMessages;\n\n if (sharedMessages && isPlainObject(sharedMessages)) {\n options.i18n.messages = merge(options.i18n.messages, sharedMessages);\n }\n\n this._i18n = new VueI18n(options.i18n);\n this._i18nWatcher = this._i18n.watchI18nData();\n\n if (options.i18n.sync === undefined || !!options.i18n.sync) {\n this._localeWatcher = this.$i18n.watchLocale();\n }\n\n if (rootI18n) {\n rootI18n.onComponentInstanceCreated(this._i18n);\n }\n } else {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Cannot be interpreted 'i18n' option.\");\n }\n }\n } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {\n // root i18n\n this._i18n = this.$root.$i18n;\n } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {\n // parent i18n\n this._i18n = options.parent.$i18n;\n }\n },\n beforeMount: function beforeMount() {\n var options = this.$options;\n options.i18n = options.i18n || (options.__i18nBridge || options.__i18n ? {} : null);\n\n if (options.i18n) {\n if (options.i18n instanceof VueI18n) {\n // init locale messages via custom blocks\n this._i18n.subscribeDataChanging(this);\n\n this._subscribing = true;\n } else if (isPlainObject(options.i18n)) {\n this._i18n.subscribeDataChanging(this);\n\n this._subscribing = true;\n } else {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Cannot be interpreted 'i18n' option.\");\n }\n }\n } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {\n this._i18n.subscribeDataChanging(this);\n\n this._subscribing = true;\n } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {\n this._i18n.subscribeDataChanging(this);\n\n this._subscribing = true;\n }\n },\n mounted: mounted,\n beforeDestroy: function beforeDestroy() {\n if (!this._i18n) {\n return;\n }\n\n var self = this;\n this.$nextTick(function () {\n if (self._subscribing) {\n self._i18n.unsubscribeDataChanging(self);\n\n delete self._subscribing;\n }\n\n if (self._i18nWatcher) {\n self._i18nWatcher();\n\n self._i18n.destroyVM();\n\n delete self._i18nWatcher;\n }\n\n if (self._localeWatcher) {\n self._localeWatcher();\n\n delete self._localeWatcher;\n }\n });\n }\n };\n}\n/* */\n\n\nvar interpolationComponent = {\n name: 'i18n',\n functional: true,\n props: {\n tag: {\n type: [String, Boolean, Object],\n default: 'span'\n },\n path: {\n type: String,\n required: true\n },\n locale: {\n type: String\n },\n places: {\n type: [Array, Object]\n }\n },\n render: function render(h, ref) {\n var data = ref.data;\n var parent = ref.parent;\n var props = ref.props;\n var slots = ref.slots;\n var $i18n = parent.$i18n;\n\n if (!$i18n) {\n if (process.env.NODE_ENV !== 'production') {\n warn('Cannot find VueI18n instance!');\n }\n\n return;\n }\n\n var path = props.path;\n var locale = props.locale;\n var places = props.places;\n var params = slots();\n var children = $i18n.i(path, locale, onlyHasDefaultPlace(params) || places ? useLegacyPlaces(params.default, places) : params);\n var tag = !!props.tag && props.tag !== true || props.tag === false ? props.tag : 'span';\n return tag ? h(tag, data, children) : children;\n }\n};\n\nfunction onlyHasDefaultPlace(params) {\n var prop;\n\n for (prop in params) {\n if (prop !== 'default') {\n return false;\n }\n }\n\n return Boolean(prop);\n}\n\nfunction useLegacyPlaces(children, places) {\n var params = places ? createParamsFromPlaces(places) : {};\n\n if (!children) {\n return params;\n } // Filter empty text nodes\n\n\n children = children.filter(function (child) {\n return child.tag || child.text.trim() !== '';\n });\n var everyPlace = children.every(vnodeHasPlaceAttribute);\n\n if (process.env.NODE_ENV !== 'production' && everyPlace) {\n warn('`place` attribute is deprecated in next major version. Please switch to Vue slots.');\n }\n\n return children.reduce(everyPlace ? assignChildPlace : assignChildIndex, params);\n}\n\nfunction createParamsFromPlaces(places) {\n if (process.env.NODE_ENV !== 'production') {\n warn('`places` prop is deprecated in next major version. Please switch to Vue slots.');\n }\n\n return Array.isArray(places) ? places.reduce(assignChildIndex, {}) : Object.assign({}, places);\n}\n\nfunction assignChildPlace(params, child) {\n if (child.data && child.data.attrs && child.data.attrs.place) {\n params[child.data.attrs.place] = child;\n }\n\n return params;\n}\n\nfunction assignChildIndex(params, child, index) {\n params[index] = child;\n return params;\n}\n\nfunction vnodeHasPlaceAttribute(vnode) {\n return Boolean(vnode.data && vnode.data.attrs && vnode.data.attrs.place);\n}\n/* */\n\n\nvar numberComponent = {\n name: 'i18n-n',\n functional: true,\n props: {\n tag: {\n type: [String, Boolean, Object],\n default: 'span'\n },\n value: {\n type: Number,\n required: true\n },\n format: {\n type: [String, Object]\n },\n locale: {\n type: String\n }\n },\n render: function render(h, ref) {\n var props = ref.props;\n var parent = ref.parent;\n var data = ref.data;\n var i18n = parent.$i18n;\n\n if (!i18n) {\n if (process.env.NODE_ENV !== 'production') {\n warn('Cannot find VueI18n instance!');\n }\n\n return null;\n }\n\n var key = null;\n var options = null;\n\n if (isString(props.format)) {\n key = props.format;\n } else if (isObject(props.format)) {\n if (props.format.key) {\n key = props.format.key;\n } // Filter out number format options only\n\n\n options = Object.keys(props.format).reduce(function (acc, prop) {\n var obj;\n\n if (includes(numberFormatKeys, prop)) {\n return Object.assign({}, acc, (obj = {}, obj[prop] = props.format[prop], obj));\n }\n\n return acc;\n }, null);\n }\n\n var locale = props.locale || i18n.locale;\n\n var parts = i18n._ntp(props.value, locale, key, options);\n\n var values = parts.map(function (part, index) {\n var obj;\n var slot = data.scopedSlots && data.scopedSlots[part.type];\n return slot ? slot((obj = {}, obj[part.type] = part.value, obj.index = index, obj.parts = parts, obj)) : part.value;\n });\n var tag = !!props.tag && props.tag !== true || props.tag === false ? props.tag : 'span';\n return tag ? h(tag, {\n attrs: data.attrs,\n 'class': data['class'],\n staticClass: data.staticClass\n }, values) : values;\n }\n};\n/* */\n\nfunction bind(el, binding, vnode) {\n if (!assert(el, vnode)) {\n return;\n }\n\n t(el, binding, vnode);\n}\n\nfunction update(el, binding, vnode, oldVNode) {\n if (!assert(el, vnode)) {\n return;\n }\n\n var i18n = vnode.context.$i18n;\n\n if (localeEqual(el, vnode) && looseEqual(binding.value, binding.oldValue) && looseEqual(el._localeMessage, i18n.getLocaleMessage(i18n.locale))) {\n return;\n }\n\n t(el, binding, vnode);\n}\n\nfunction unbind(el, binding, vnode, oldVNode) {\n var vm = vnode.context;\n\n if (!vm) {\n warn('Vue instance does not exists in VNode context');\n return;\n }\n\n var i18n = vnode.context.$i18n || {};\n\n if (!binding.modifiers.preserve && !i18n.preserveDirectiveContent) {\n el.textContent = '';\n }\n\n el._vt = undefined;\n delete el['_vt'];\n el._locale = undefined;\n delete el['_locale'];\n el._localeMessage = undefined;\n delete el['_localeMessage'];\n}\n\nfunction assert(el, vnode) {\n var vm = vnode.context;\n\n if (!vm) {\n warn('Vue instance does not exists in VNode context');\n return false;\n }\n\n if (!vm.$i18n) {\n warn('VueI18n instance does not exists in Vue instance');\n return false;\n }\n\n return true;\n}\n\nfunction localeEqual(el, vnode) {\n var vm = vnode.context;\n return el._locale === vm.$i18n.locale;\n}\n\nfunction t(el, binding, vnode) {\n var ref$1, ref$2;\n var value = binding.value;\n var ref = parseValue(value);\n var path = ref.path;\n var locale = ref.locale;\n var args = ref.args;\n var choice = ref.choice;\n\n if (!path && !locale && !args) {\n warn('value type not supported');\n return;\n }\n\n if (!path) {\n warn('`path` is required in v-t directive');\n return;\n }\n\n var vm = vnode.context;\n\n if (choice != null) {\n el._vt = el.textContent = (ref$1 = vm.$i18n).tc.apply(ref$1, [path, choice].concat(makeParams(locale, args)));\n } else {\n el._vt = el.textContent = (ref$2 = vm.$i18n).t.apply(ref$2, [path].concat(makeParams(locale, args)));\n }\n\n el._locale = vm.$i18n.locale;\n el._localeMessage = vm.$i18n.getLocaleMessage(vm.$i18n.locale);\n}\n\nfunction parseValue(value) {\n var path;\n var locale;\n var args;\n var choice;\n\n if (isString(value)) {\n path = value;\n } else if (isPlainObject(value)) {\n path = value.path;\n locale = value.locale;\n args = value.args;\n choice = value.choice;\n }\n\n return {\n path: path,\n locale: locale,\n args: args,\n choice: choice\n };\n}\n\nfunction makeParams(locale, args) {\n var params = [];\n locale && params.push(locale);\n\n if (args && (Array.isArray(args) || isPlainObject(args))) {\n params.push(args);\n }\n\n return params;\n}\n\nvar Vue;\n\nfunction install(_Vue, options) {\n if (options === void 0) options = {\n bridge: false\n };\n /* istanbul ignore if */\n\n if (process.env.NODE_ENV !== 'production' && install.installed && _Vue === Vue) {\n warn('already installed.');\n return;\n }\n\n install.installed = true;\n Vue = _Vue;\n var version = Vue.version && Number(Vue.version.split('.')[0]) || -1;\n /* istanbul ignore if */\n\n if (process.env.NODE_ENV !== 'production' && version < 2) {\n warn(\"vue-i18n (\" + install.version + \") need to use Vue 2.0 or later (Vue: \" + Vue.version + \").\");\n return;\n }\n\n extend(Vue);\n Vue.mixin(defineMixin(options.bridge));\n Vue.directive('t', {\n bind: bind,\n update: update,\n unbind: unbind\n });\n Vue.component(interpolationComponent.name, interpolationComponent);\n Vue.component(numberComponent.name, numberComponent); // use simple mergeStrategies to prevent i18n instance lose '__proto__'\n\n var strats = Vue.config.optionMergeStrategies;\n\n strats.i18n = function (parentVal, childVal) {\n return childVal === undefined ? parentVal : childVal;\n };\n}\n/* */\n\n\nvar BaseFormatter = function BaseFormatter() {\n this._caches = Object.create(null);\n};\n\nBaseFormatter.prototype.interpolate = function interpolate(message, values) {\n if (!values) {\n return [message];\n }\n\n var tokens = this._caches[message];\n\n if (!tokens) {\n tokens = parse(message);\n this._caches[message] = tokens;\n }\n\n return compile(tokens, values);\n};\n\nvar RE_TOKEN_LIST_VALUE = /^(?:\\d)+/;\nvar RE_TOKEN_NAMED_VALUE = /^(?:\\w)+/;\n\nfunction parse(format) {\n var tokens = [];\n var position = 0;\n var text = '';\n\n while (position < format.length) {\n var char = format[position++];\n\n if (char === '{') {\n if (text) {\n tokens.push({\n type: 'text',\n value: text\n });\n }\n\n text = '';\n var sub = '';\n char = format[position++];\n\n while (char !== undefined && char !== '}') {\n sub += char;\n char = format[position++];\n }\n\n var isClosed = char === '}';\n var type = RE_TOKEN_LIST_VALUE.test(sub) ? 'list' : isClosed && RE_TOKEN_NAMED_VALUE.test(sub) ? 'named' : 'unknown';\n tokens.push({\n value: sub,\n type: type\n });\n } else if (char === '%') {\n // when found rails i18n syntax, skip text capture\n if (format[position] !== '{') {\n text += char;\n }\n } else {\n text += char;\n }\n }\n\n text && tokens.push({\n type: 'text',\n value: text\n });\n return tokens;\n}\n\nfunction compile(tokens, values) {\n var compiled = [];\n var index = 0;\n var mode = Array.isArray(values) ? 'list' : isObject(values) ? 'named' : 'unknown';\n\n if (mode === 'unknown') {\n return compiled;\n }\n\n while (index < tokens.length) {\n var token = tokens[index];\n\n switch (token.type) {\n case 'text':\n compiled.push(token.value);\n break;\n\n case 'list':\n compiled.push(values[parseInt(token.value, 10)]);\n break;\n\n case 'named':\n if (mode === 'named') {\n compiled.push(values[token.value]);\n } else {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Type of token '\" + token.type + \"' and format of value '\" + mode + \"' don't match!\");\n }\n }\n\n break;\n\n case 'unknown':\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Detect 'unknown' type of token!\");\n }\n\n break;\n }\n\n index++;\n }\n\n return compiled;\n}\n/* */\n\n/**\n * Path parser\n * - Inspired:\n * Vue.js Path parser\n */\n// actions\n\n\nvar APPEND = 0;\nvar PUSH = 1;\nvar INC_SUB_PATH_DEPTH = 2;\nvar PUSH_SUB_PATH = 3; // states\n\nvar BEFORE_PATH = 0;\nvar IN_PATH = 1;\nvar BEFORE_IDENT = 2;\nvar IN_IDENT = 3;\nvar IN_SUB_PATH = 4;\nvar IN_SINGLE_QUOTE = 5;\nvar IN_DOUBLE_QUOTE = 6;\nvar AFTER_PATH = 7;\nvar ERROR = 8;\nvar pathStateMachine = [];\npathStateMachine[BEFORE_PATH] = {\n 'ws': [BEFORE_PATH],\n 'ident': [IN_IDENT, APPEND],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\npathStateMachine[IN_PATH] = {\n 'ws': [IN_PATH],\n '.': [BEFORE_IDENT],\n '[': [IN_SUB_PATH],\n 'eof': [AFTER_PATH]\n};\npathStateMachine[BEFORE_IDENT] = {\n 'ws': [BEFORE_IDENT],\n 'ident': [IN_IDENT, APPEND],\n '0': [IN_IDENT, APPEND],\n 'number': [IN_IDENT, APPEND]\n};\npathStateMachine[IN_IDENT] = {\n 'ident': [IN_IDENT, APPEND],\n '0': [IN_IDENT, APPEND],\n 'number': [IN_IDENT, APPEND],\n 'ws': [IN_PATH, PUSH],\n '.': [BEFORE_IDENT, PUSH],\n '[': [IN_SUB_PATH, PUSH],\n 'eof': [AFTER_PATH, PUSH]\n};\npathStateMachine[IN_SUB_PATH] = {\n \"'\": [IN_SINGLE_QUOTE, APPEND],\n '\"': [IN_DOUBLE_QUOTE, APPEND],\n '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],\n ']': [IN_PATH, PUSH_SUB_PATH],\n 'eof': ERROR,\n 'else': [IN_SUB_PATH, APPEND]\n};\npathStateMachine[IN_SINGLE_QUOTE] = {\n \"'\": [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_SINGLE_QUOTE, APPEND]\n};\npathStateMachine[IN_DOUBLE_QUOTE] = {\n '\"': [IN_SUB_PATH, APPEND],\n 'eof': ERROR,\n 'else': [IN_DOUBLE_QUOTE, APPEND]\n};\n/**\n * Check if an expression is a literal value.\n */\n\nvar literalValueRE = /^\\s?(?:true|false|-?[\\d.]+|'[^']*'|\"[^\"]*\")\\s?$/;\n\nfunction isLiteral(exp) {\n return literalValueRE.test(exp);\n}\n/**\n * Strip quotes from a string\n */\n\n\nfunction stripQuotes(str) {\n var a = str.charCodeAt(0);\n var b = str.charCodeAt(str.length - 1);\n return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;\n}\n/**\n * Determine the type of a character in a keypath.\n */\n\n\nfunction getPathCharType(ch) {\n if (ch === undefined || ch === null) {\n return 'eof';\n }\n\n var code = ch.charCodeAt(0);\n\n switch (code) {\n case 0x5B: // [\n\n case 0x5D: // ]\n\n case 0x2E: // .\n\n case 0x22: // \"\n\n case 0x27:\n // '\n return ch;\n\n case 0x5F: // _\n\n case 0x24: // $\n\n case 0x2D:\n // -\n return 'ident';\n\n case 0x09: // Tab\n\n case 0x0A: // Newline\n\n case 0x0D: // Return\n\n case 0xA0: // No-break space\n\n case 0xFEFF: // Byte Order Mark\n\n case 0x2028: // Line Separator\n\n case 0x2029:\n // Paragraph Separator\n return 'ws';\n }\n\n return 'ident';\n}\n/**\n * Format a subPath, return its plain form if it is\n * a literal string or number. Otherwise prepend the\n * dynamic indicator (*).\n */\n\n\nfunction formatSubPath(path) {\n var trimmed = path.trim(); // invalid leading 0\n\n if (path.charAt(0) === '0' && isNaN(path)) {\n return false;\n }\n\n return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed;\n}\n/**\n * Parse a string path into an array of segments\n */\n\n\nfunction parse$1(path) {\n var keys = [];\n var index = -1;\n var mode = BEFORE_PATH;\n var subPathDepth = 0;\n var c;\n var key;\n var newChar;\n var type;\n var transition;\n var action;\n var typeMap;\n var actions = [];\n\n actions[PUSH] = function () {\n if (key !== undefined) {\n keys.push(key);\n key = undefined;\n }\n };\n\n actions[APPEND] = function () {\n if (key === undefined) {\n key = newChar;\n } else {\n key += newChar;\n }\n };\n\n actions[INC_SUB_PATH_DEPTH] = function () {\n actions[APPEND]();\n subPathDepth++;\n };\n\n actions[PUSH_SUB_PATH] = function () {\n if (subPathDepth > 0) {\n subPathDepth--;\n mode = IN_SUB_PATH;\n actions[APPEND]();\n } else {\n subPathDepth = 0;\n\n if (key === undefined) {\n return false;\n }\n\n key = formatSubPath(key);\n\n if (key === false) {\n return false;\n } else {\n actions[PUSH]();\n }\n }\n };\n\n function maybeUnescapeQuote() {\n var nextChar = path[index + 1];\n\n if (mode === IN_SINGLE_QUOTE && nextChar === \"'\" || mode === IN_DOUBLE_QUOTE && nextChar === '\"') {\n index++;\n newChar = '\\\\' + nextChar;\n actions[APPEND]();\n return true;\n }\n }\n\n while (mode !== null) {\n index++;\n c = path[index];\n\n if (c === '\\\\' && maybeUnescapeQuote()) {\n continue;\n }\n\n type = getPathCharType(c);\n typeMap = pathStateMachine[mode];\n transition = typeMap[type] || typeMap['else'] || ERROR;\n\n if (transition === ERROR) {\n return; // parse error\n }\n\n mode = transition[0];\n action = actions[transition[1]];\n\n if (action) {\n newChar = transition[2];\n newChar = newChar === undefined ? c : newChar;\n\n if (action() === false) {\n return;\n }\n }\n\n if (mode === AFTER_PATH) {\n return keys;\n }\n }\n}\n\nvar I18nPath = function I18nPath() {\n this._cache = Object.create(null);\n};\n/**\n * External parse that check for a cache hit first\n */\n\n\nI18nPath.prototype.parsePath = function parsePath(path) {\n var hit = this._cache[path];\n\n if (!hit) {\n hit = parse$1(path);\n\n if (hit) {\n this._cache[path] = hit;\n }\n }\n\n return hit || [];\n};\n/**\n * Get path value from path string\n */\n\n\nI18nPath.prototype.getPathValue = function getPathValue(obj, path) {\n if (!isObject(obj)) {\n return null;\n }\n\n var paths = this.parsePath(path);\n\n if (paths.length === 0) {\n return null;\n } else {\n var length = paths.length;\n var last = obj;\n var i = 0;\n\n while (i < length) {\n var value = last[paths[i]];\n\n if (value === undefined || value === null) {\n return null;\n }\n\n last = value;\n i++;\n }\n\n return last;\n }\n};\n/* */\n\n\nvar htmlTagMatcher = /<\\/?[\\w\\s=\"/.':;#-\\/]+>/;\nvar linkKeyMatcher = /(?:@(?:\\.[a-zA-Z]+)?:(?:[\\w\\-_|./]+|\\([\\w\\-_:|./]+\\)))/g;\nvar linkKeyPrefixMatcher = /^@(?:\\.([a-zA-Z]+))?:/;\nvar bracketsMatcher = /[()]/g;\nvar defaultModifiers = {\n 'upper': function upper(str) {\n return str.toLocaleUpperCase();\n },\n 'lower': function lower(str) {\n return str.toLocaleLowerCase();\n },\n 'capitalize': function capitalize(str) {\n return \"\" + str.charAt(0).toLocaleUpperCase() + str.substr(1);\n }\n};\nvar defaultFormatter = new BaseFormatter();\n\nvar VueI18n = function VueI18n(options) {\n var this$1 = this;\n if (options === void 0) options = {}; // Auto install if it is not done yet and `window` has `Vue`.\n // To allow users to avoid auto-installation in some cases,\n // this code should be placed here. See #290\n\n /* istanbul ignore if */\n\n if (!Vue && typeof window !== 'undefined' && window.Vue) {\n install(window.Vue);\n }\n\n var locale = options.locale || 'en-US';\n var fallbackLocale = options.fallbackLocale === false ? false : options.fallbackLocale || 'en-US';\n var messages = options.messages || {};\n var dateTimeFormats = options.dateTimeFormats || options.datetimeFormats || {};\n var numberFormats = options.numberFormats || {};\n this._vm = null;\n this._formatter = options.formatter || defaultFormatter;\n this._modifiers = options.modifiers || {};\n this._missing = options.missing || null;\n this._root = options.root || null;\n this._sync = options.sync === undefined ? true : !!options.sync;\n this._fallbackRoot = options.fallbackRoot === undefined ? true : !!options.fallbackRoot;\n this._fallbackRootWithEmptyString = options.fallbackRootWithEmptyString === undefined ? true : !!options.fallbackRootWithEmptyString;\n this._formatFallbackMessages = options.formatFallbackMessages === undefined ? false : !!options.formatFallbackMessages;\n this._silentTranslationWarn = options.silentTranslationWarn === undefined ? false : options.silentTranslationWarn;\n this._silentFallbackWarn = options.silentFallbackWarn === undefined ? false : !!options.silentFallbackWarn;\n this._dateTimeFormatters = {};\n this._numberFormatters = {};\n this._path = new I18nPath();\n this._dataListeners = new Set();\n this._componentInstanceCreatedListener = options.componentInstanceCreatedListener || null;\n this._preserveDirectiveContent = options.preserveDirectiveContent === undefined ? false : !!options.preserveDirectiveContent;\n this.pluralizationRules = options.pluralizationRules || {};\n this._warnHtmlInMessage = options.warnHtmlInMessage || 'off';\n this._postTranslation = options.postTranslation || null;\n this._escapeParameterHtml = options.escapeParameterHtml || false;\n\n if ('__VUE_I18N_BRIDGE__' in options) {\n this.__VUE_I18N_BRIDGE__ = options.__VUE_I18N_BRIDGE__;\n }\n /**\n * @param choice {number} a choice index given by the input to $tc: `$tc('path.to.rule', choiceIndex)`\n * @param choicesLength {number} an overall amount of available choices\n * @returns a final choice index\n */\n\n\n this.getChoiceIndex = function (choice, choicesLength) {\n var thisPrototype = Object.getPrototypeOf(this$1);\n\n if (thisPrototype && thisPrototype.getChoiceIndex) {\n var prototypeGetChoiceIndex = thisPrototype.getChoiceIndex;\n return prototypeGetChoiceIndex.call(this$1, choice, choicesLength);\n } // Default (old) getChoiceIndex implementation - english-compatible\n\n\n var defaultImpl = function defaultImpl(_choice, _choicesLength) {\n _choice = Math.abs(_choice);\n\n if (_choicesLength === 2) {\n return _choice ? _choice > 1 ? 1 : 0 : 1;\n }\n\n return _choice ? Math.min(_choice, 2) : 0;\n };\n\n if (this$1.locale in this$1.pluralizationRules) {\n return this$1.pluralizationRules[this$1.locale].apply(this$1, [choice, choicesLength]);\n } else {\n return defaultImpl(choice, choicesLength);\n }\n };\n\n this._exist = function (message, key) {\n if (!message || !key) {\n return false;\n }\n\n if (!isNull(this$1._path.getPathValue(message, key))) {\n return true;\n } // fallback for flat key\n\n\n if (message[key]) {\n return true;\n }\n\n return false;\n };\n\n if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {\n Object.keys(messages).forEach(function (locale) {\n this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]);\n });\n }\n\n this._initVM({\n locale: locale,\n fallbackLocale: fallbackLocale,\n messages: messages,\n dateTimeFormats: dateTimeFormats,\n numberFormats: numberFormats\n });\n};\n\nvar prototypeAccessors = {\n vm: {\n configurable: true\n },\n messages: {\n configurable: true\n },\n dateTimeFormats: {\n configurable: true\n },\n numberFormats: {\n configurable: true\n },\n availableLocales: {\n configurable: true\n },\n locale: {\n configurable: true\n },\n fallbackLocale: {\n configurable: true\n },\n formatFallbackMessages: {\n configurable: true\n },\n missing: {\n configurable: true\n },\n formatter: {\n configurable: true\n },\n silentTranslationWarn: {\n configurable: true\n },\n silentFallbackWarn: {\n configurable: true\n },\n preserveDirectiveContent: {\n configurable: true\n },\n warnHtmlInMessage: {\n configurable: true\n },\n postTranslation: {\n configurable: true\n },\n sync: {\n configurable: true\n }\n};\n\nVueI18n.prototype._checkLocaleMessage = function _checkLocaleMessage(locale, level, message) {\n var paths = [];\n\n var fn = function fn(level, locale, message, paths) {\n if (isPlainObject(message)) {\n Object.keys(message).forEach(function (key) {\n var val = message[key];\n\n if (isPlainObject(val)) {\n paths.push(key);\n paths.push('.');\n fn(level, locale, val, paths);\n paths.pop();\n paths.pop();\n } else {\n paths.push(key);\n fn(level, locale, val, paths);\n paths.pop();\n }\n });\n } else if (isArray(message)) {\n message.forEach(function (item, index) {\n if (isPlainObject(item)) {\n paths.push(\"[\" + index + \"]\");\n paths.push('.');\n fn(level, locale, item, paths);\n paths.pop();\n paths.pop();\n } else {\n paths.push(\"[\" + index + \"]\");\n fn(level, locale, item, paths);\n paths.pop();\n }\n });\n } else if (isString(message)) {\n var ret = htmlTagMatcher.test(message);\n\n if (ret) {\n var msg = \"Detected HTML in message '\" + message + \"' of keypath '\" + paths.join('') + \"' at '\" + locale + \"'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp\";\n\n if (level === 'warn') {\n warn(msg);\n } else if (level === 'error') {\n error(msg);\n }\n }\n }\n };\n\n fn(level, locale, message, paths);\n};\n\nVueI18n.prototype._initVM = function _initVM(data) {\n var silent = Vue.config.silent;\n Vue.config.silent = true;\n this._vm = new Vue({\n data: data,\n __VUE18N__INSTANCE__: true\n });\n Vue.config.silent = silent;\n};\n\nVueI18n.prototype.destroyVM = function destroyVM() {\n this._vm.$destroy();\n};\n\nVueI18n.prototype.subscribeDataChanging = function subscribeDataChanging(vm) {\n this._dataListeners.add(vm);\n};\n\nVueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging(vm) {\n remove(this._dataListeners, vm);\n};\n\nVueI18n.prototype.watchI18nData = function watchI18nData() {\n var this$1 = this;\n return this._vm.$watch('$data', function () {\n var listeners = arrayFrom(this$1._dataListeners);\n var i = listeners.length;\n\n while (i--) {\n Vue.nextTick(function () {\n listeners[i] && listeners[i].$forceUpdate();\n });\n }\n }, {\n deep: true\n });\n};\n\nVueI18n.prototype.watchLocale = function watchLocale(composer) {\n if (!composer) {\n /* istanbul ignore if */\n if (!this._sync || !this._root) {\n return null;\n }\n\n var target = this._vm;\n return this._root.$i18n.vm.$watch('locale', function (val) {\n target.$set(target, 'locale', val);\n target.$forceUpdate();\n }, {\n immediate: true\n });\n } else {\n // deal with vue-i18n-bridge\n if (!this.__VUE_I18N_BRIDGE__) {\n return null;\n }\n\n var self = this;\n var target$1 = this._vm;\n return this.vm.$watch('locale', function (val) {\n target$1.$set(target$1, 'locale', val);\n\n if (self.__VUE_I18N_BRIDGE__ && composer) {\n composer.locale.value = val;\n }\n\n target$1.$forceUpdate();\n }, {\n immediate: true\n });\n }\n};\n\nVueI18n.prototype.onComponentInstanceCreated = function onComponentInstanceCreated(newI18n) {\n if (this._componentInstanceCreatedListener) {\n this._componentInstanceCreatedListener(newI18n, this);\n }\n};\n\nprototypeAccessors.vm.get = function () {\n return this._vm;\n};\n\nprototypeAccessors.messages.get = function () {\n return looseClone(this._getMessages());\n};\n\nprototypeAccessors.dateTimeFormats.get = function () {\n return looseClone(this._getDateTimeFormats());\n};\n\nprototypeAccessors.numberFormats.get = function () {\n return looseClone(this._getNumberFormats());\n};\n\nprototypeAccessors.availableLocales.get = function () {\n return Object.keys(this.messages).sort();\n};\n\nprototypeAccessors.locale.get = function () {\n return this._vm.locale;\n};\n\nprototypeAccessors.locale.set = function (locale) {\n this._vm.$set(this._vm, 'locale', locale);\n};\n\nprototypeAccessors.fallbackLocale.get = function () {\n return this._vm.fallbackLocale;\n};\n\nprototypeAccessors.fallbackLocale.set = function (locale) {\n this._localeChainCache = {};\n\n this._vm.$set(this._vm, 'fallbackLocale', locale);\n};\n\nprototypeAccessors.formatFallbackMessages.get = function () {\n return this._formatFallbackMessages;\n};\n\nprototypeAccessors.formatFallbackMessages.set = function (fallback) {\n this._formatFallbackMessages = fallback;\n};\n\nprototypeAccessors.missing.get = function () {\n return this._missing;\n};\n\nprototypeAccessors.missing.set = function (handler) {\n this._missing = handler;\n};\n\nprototypeAccessors.formatter.get = function () {\n return this._formatter;\n};\n\nprototypeAccessors.formatter.set = function (formatter) {\n this._formatter = formatter;\n};\n\nprototypeAccessors.silentTranslationWarn.get = function () {\n return this._silentTranslationWarn;\n};\n\nprototypeAccessors.silentTranslationWarn.set = function (silent) {\n this._silentTranslationWarn = silent;\n};\n\nprototypeAccessors.silentFallbackWarn.get = function () {\n return this._silentFallbackWarn;\n};\n\nprototypeAccessors.silentFallbackWarn.set = function (silent) {\n this._silentFallbackWarn = silent;\n};\n\nprototypeAccessors.preserveDirectiveContent.get = function () {\n return this._preserveDirectiveContent;\n};\n\nprototypeAccessors.preserveDirectiveContent.set = function (preserve) {\n this._preserveDirectiveContent = preserve;\n};\n\nprototypeAccessors.warnHtmlInMessage.get = function () {\n return this._warnHtmlInMessage;\n};\n\nprototypeAccessors.warnHtmlInMessage.set = function (level) {\n var this$1 = this;\n var orgLevel = this._warnHtmlInMessage;\n this._warnHtmlInMessage = level;\n\n if (orgLevel !== level && (level === 'warn' || level === 'error')) {\n var messages = this._getMessages();\n\n Object.keys(messages).forEach(function (locale) {\n this$1._checkLocaleMessage(locale, this$1._warnHtmlInMessage, messages[locale]);\n });\n }\n};\n\nprototypeAccessors.postTranslation.get = function () {\n return this._postTranslation;\n};\n\nprototypeAccessors.postTranslation.set = function (handler) {\n this._postTranslation = handler;\n};\n\nprototypeAccessors.sync.get = function () {\n return this._sync;\n};\n\nprototypeAccessors.sync.set = function (val) {\n this._sync = val;\n};\n\nVueI18n.prototype._getMessages = function _getMessages() {\n return this._vm.messages;\n};\n\nVueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats() {\n return this._vm.dateTimeFormats;\n};\n\nVueI18n.prototype._getNumberFormats = function _getNumberFormats() {\n return this._vm.numberFormats;\n};\n\nVueI18n.prototype._warnDefault = function _warnDefault(locale, key, result, vm, values, interpolateMode) {\n if (!isNull(result)) {\n return result;\n }\n\n if (this._missing) {\n var missingRet = this._missing.apply(null, [locale, key, vm, values]);\n\n if (isString(missingRet)) {\n return missingRet;\n }\n } else {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {\n warn(\"Cannot translate the value of keypath '\" + key + \"'. \" + 'Use the value of keypath as default.');\n }\n }\n\n if (this._formatFallbackMessages) {\n var parsedArgs = parseArgs.apply(void 0, values);\n return this._render(key, interpolateMode, parsedArgs.params, key);\n } else {\n return key;\n }\n};\n\nVueI18n.prototype._isFallbackRoot = function _isFallbackRoot(val) {\n return (this._fallbackRootWithEmptyString ? !val : isNull(val)) && !isNull(this._root) && this._fallbackRoot;\n};\n\nVueI18n.prototype._isSilentFallbackWarn = function _isSilentFallbackWarn(key) {\n return this._silentFallbackWarn instanceof RegExp ? this._silentFallbackWarn.test(key) : this._silentFallbackWarn;\n};\n\nVueI18n.prototype._isSilentFallback = function _isSilentFallback(locale, key) {\n return this._isSilentFallbackWarn(key) && (this._isFallbackRoot() || locale !== this.fallbackLocale);\n};\n\nVueI18n.prototype._isSilentTranslationWarn = function _isSilentTranslationWarn(key) {\n return this._silentTranslationWarn instanceof RegExp ? this._silentTranslationWarn.test(key) : this._silentTranslationWarn;\n};\n\nVueI18n.prototype._interpolate = function _interpolate(locale, message, key, host, interpolateMode, values, visitedLinkStack) {\n if (!message) {\n return null;\n }\n\n var pathRet = this._path.getPathValue(message, key);\n\n if (isArray(pathRet) || isPlainObject(pathRet)) {\n return pathRet;\n }\n\n var ret;\n\n if (isNull(pathRet)) {\n /* istanbul ignore else */\n if (isPlainObject(message)) {\n ret = message[key];\n\n if (!(isString(ret) || isFunction(ret))) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {\n warn(\"Value of key '\" + key + \"' is not a string or function !\");\n }\n\n return null;\n }\n } else {\n return null;\n }\n } else {\n /* istanbul ignore else */\n if (isString(pathRet) || isFunction(pathRet)) {\n ret = pathRet;\n } else {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallback(locale, key)) {\n warn(\"Value of key '\" + key + \"' is not a string or function!\");\n }\n\n return null;\n }\n } // Check for the existence of links within the translated string\n\n\n if (isString(ret) && (ret.indexOf('@:') >= 0 || ret.indexOf('@.') >= 0)) {\n ret = this._link(locale, message, ret, host, 'raw', values, visitedLinkStack);\n }\n\n return this._render(ret, interpolateMode, values, key);\n};\n\nVueI18n.prototype._link = function _link(locale, message, str, host, interpolateMode, values, visitedLinkStack) {\n var ret = str; // Match all the links within the local\n // We are going to replace each of\n // them with its translation\n\n var matches = ret.match(linkKeyMatcher); // eslint-disable-next-line no-autofix/prefer-const\n\n for (var idx in matches) {\n // ie compatible: filter custom array\n // prototype method\n if (!matches.hasOwnProperty(idx)) {\n continue;\n }\n\n var link = matches[idx];\n var linkKeyPrefixMatches = link.match(linkKeyPrefixMatcher);\n var linkPrefix = linkKeyPrefixMatches[0];\n var formatterName = linkKeyPrefixMatches[1]; // Remove the leading @:, @.case: and the brackets\n\n var linkPlaceholder = link.replace(linkPrefix, '').replace(bracketsMatcher, '');\n\n if (includes(visitedLinkStack, linkPlaceholder)) {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Circular reference found. \\\"\" + link + \"\\\" is already visited in the chain of \" + visitedLinkStack.reverse().join(' <- '));\n }\n\n return ret;\n }\n\n visitedLinkStack.push(linkPlaceholder); // Translate the link\n\n var translated = this._interpolate(locale, message, linkPlaceholder, host, interpolateMode === 'raw' ? 'string' : interpolateMode, interpolateMode === 'raw' ? undefined : values, visitedLinkStack);\n\n if (this._isFallbackRoot(translated)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(linkPlaceholder)) {\n warn(\"Fall back to translate the link placeholder '\" + linkPlaceholder + \"' with root locale.\");\n }\n /* istanbul ignore if */\n\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n var root = this._root.$i18n;\n translated = root._translate(root._getMessages(), root.locale, root.fallbackLocale, linkPlaceholder, host, interpolateMode, values);\n }\n\n translated = this._warnDefault(locale, linkPlaceholder, translated, host, isArray(values) ? values : [values], interpolateMode);\n\n if (this._modifiers.hasOwnProperty(formatterName)) {\n translated = this._modifiers[formatterName](translated);\n } else if (defaultModifiers.hasOwnProperty(formatterName)) {\n translated = defaultModifiers[formatterName](translated);\n }\n\n visitedLinkStack.pop(); // Replace the link with the translated\n\n ret = !translated ? ret : ret.replace(link, translated);\n }\n\n return ret;\n};\n\nVueI18n.prototype._createMessageContext = function _createMessageContext(values, formatter, path, interpolateMode) {\n var this$1 = this;\n\n var _list = isArray(values) ? values : [];\n\n var _named = isObject(values) ? values : {};\n\n var list = function list(index) {\n return _list[index];\n };\n\n var named = function named(key) {\n return _named[key];\n };\n\n var messages = this._getMessages();\n\n var locale = this.locale;\n return {\n list: list,\n named: named,\n values: values,\n formatter: formatter,\n path: path,\n messages: messages,\n locale: locale,\n linked: function linked(linkedKey) {\n return this$1._interpolate(locale, messages[locale] || {}, linkedKey, null, interpolateMode, undefined, [linkedKey]);\n }\n };\n};\n\nVueI18n.prototype._render = function _render(message, interpolateMode, values, path) {\n if (isFunction(message)) {\n return message(this._createMessageContext(values, this._formatter || defaultFormatter, path, interpolateMode));\n }\n\n var ret = this._formatter.interpolate(message, values, path); // If the custom formatter refuses to work - apply the default one\n\n\n if (!ret) {\n ret = defaultFormatter.interpolate(message, values, path);\n } // if interpolateMode is **not** 'string' ('row'),\n // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter\n\n\n return interpolateMode === 'string' && !isString(ret) ? ret.join('') : ret;\n};\n\nVueI18n.prototype._appendItemToChain = function _appendItemToChain(chain, item, blocks) {\n var follow = false;\n\n if (!includes(chain, item)) {\n follow = true;\n\n if (item) {\n follow = item[item.length - 1] !== '!';\n item = item.replace(/!/g, '');\n chain.push(item);\n\n if (blocks && blocks[item]) {\n follow = blocks[item];\n }\n }\n }\n\n return follow;\n};\n\nVueI18n.prototype._appendLocaleToChain = function _appendLocaleToChain(chain, locale, blocks) {\n var follow;\n var tokens = locale.split('-');\n\n do {\n var item = tokens.join('-');\n follow = this._appendItemToChain(chain, item, blocks);\n tokens.splice(-1, 1);\n } while (tokens.length && follow === true);\n\n return follow;\n};\n\nVueI18n.prototype._appendBlockToChain = function _appendBlockToChain(chain, block, blocks) {\n var follow = true;\n\n for (var i = 0; i < block.length && isBoolean(follow); i++) {\n var locale = block[i];\n\n if (isString(locale)) {\n follow = this._appendLocaleToChain(chain, locale, blocks);\n }\n }\n\n return follow;\n};\n\nVueI18n.prototype._getLocaleChain = function _getLocaleChain(start, fallbackLocale) {\n if (start === '') {\n return [];\n }\n\n if (!this._localeChainCache) {\n this._localeChainCache = {};\n }\n\n var chain = this._localeChainCache[start];\n\n if (!chain) {\n if (!fallbackLocale) {\n fallbackLocale = this.fallbackLocale;\n }\n\n chain = []; // first block defined by start\n\n var block = [start]; // while any intervening block found\n\n while (isArray(block)) {\n block = this._appendBlockToChain(chain, block, fallbackLocale);\n } // last block defined by default\n\n\n var defaults;\n\n if (isArray(fallbackLocale)) {\n defaults = fallbackLocale;\n } else if (isObject(fallbackLocale)) {\n /* $FlowFixMe */\n if (fallbackLocale['default']) {\n defaults = fallbackLocale['default'];\n } else {\n defaults = null;\n }\n } else {\n defaults = fallbackLocale;\n } // convert defaults to array\n\n\n if (isString(defaults)) {\n block = [defaults];\n } else {\n block = defaults;\n }\n\n if (block) {\n this._appendBlockToChain(chain, block, null);\n }\n\n this._localeChainCache[start] = chain;\n }\n\n return chain;\n};\n\nVueI18n.prototype._translate = function _translate(messages, locale, fallback, key, host, interpolateMode, args) {\n var chain = this._getLocaleChain(locale, fallback);\n\n var res;\n\n for (var i = 0; i < chain.length; i++) {\n var step = chain[i];\n res = this._interpolate(step, messages[step], key, host, interpolateMode, args, [key]);\n\n if (!isNull(res)) {\n if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to translate the keypath '\" + key + \"' with '\" + step + \"' locale.\");\n }\n\n return res;\n }\n }\n\n return null;\n};\n\nVueI18n.prototype._t = function _t(key, _locale, messages, host) {\n var ref;\n var values = [],\n len = arguments.length - 4;\n\n while (len-- > 0) {\n values[len] = arguments[len + 4];\n }\n\n if (!key) {\n return '';\n }\n\n var parsedArgs = parseArgs.apply(void 0, values);\n\n if (this._escapeParameterHtml) {\n parsedArgs.params = escapeParams(parsedArgs.params);\n }\n\n var locale = parsedArgs.locale || _locale;\n\n var ret = this._translate(messages, locale, this.fallbackLocale, key, host, 'string', parsedArgs.params);\n\n if (this._isFallbackRoot(ret)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to translate the keypath '\" + key + \"' with root locale.\");\n }\n /* istanbul ignore if */\n\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n return (ref = this._root).$t.apply(ref, [key].concat(values));\n } else {\n ret = this._warnDefault(locale, key, ret, host, values, 'string');\n\n if (this._postTranslation && ret !== null && ret !== undefined) {\n ret = this._postTranslation(ret, key);\n }\n\n return ret;\n }\n};\n\nVueI18n.prototype.t = function t(key) {\n var ref;\n var values = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n values[len] = arguments[len + 1];\n }\n\n return (ref = this)._t.apply(ref, [key, this.locale, this._getMessages(), null].concat(values));\n};\n\nVueI18n.prototype._i = function _i(key, locale, messages, host, values) {\n var ret = this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);\n\n if (this._isFallbackRoot(ret)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {\n warn(\"Fall back to interpolate the keypath '\" + key + \"' with root locale.\");\n }\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n return this._root.$i18n.i(key, locale, values);\n } else {\n return this._warnDefault(locale, key, ret, host, [values], 'raw');\n }\n};\n\nVueI18n.prototype.i = function i(key, locale, values) {\n /* istanbul ignore if */\n if (!key) {\n return '';\n }\n\n if (!isString(locale)) {\n locale = this.locale;\n }\n\n return this._i(key, locale, this._getMessages(), null, values);\n};\n\nVueI18n.prototype._tc = function _tc(key, _locale, messages, host, choice) {\n var ref;\n var values = [],\n len = arguments.length - 5;\n\n while (len-- > 0) {\n values[len] = arguments[len + 5];\n }\n\n if (!key) {\n return '';\n }\n\n if (choice === undefined) {\n choice = 1;\n }\n\n var predefined = {\n 'count': choice,\n 'n': choice\n };\n var parsedArgs = parseArgs.apply(void 0, values);\n parsedArgs.params = Object.assign(predefined, parsedArgs.params);\n values = parsedArgs.locale === null ? [parsedArgs.params] : [parsedArgs.locale, parsedArgs.params];\n return this.fetchChoice((ref = this)._t.apply(ref, [key, _locale, messages, host].concat(values)), choice);\n};\n\nVueI18n.prototype.fetchChoice = function fetchChoice(message, choice) {\n /* istanbul ignore if */\n if (!message || !isString(message)) {\n return null;\n }\n\n var choices = message.split('|');\n choice = this.getChoiceIndex(choice, choices.length);\n\n if (!choices[choice]) {\n return message;\n }\n\n return choices[choice].trim();\n};\n\nVueI18n.prototype.tc = function tc(key, choice) {\n var ref;\n var values = [],\n len = arguments.length - 2;\n\n while (len-- > 0) {\n values[len] = arguments[len + 2];\n }\n\n return (ref = this)._tc.apply(ref, [key, this.locale, this._getMessages(), null, choice].concat(values));\n};\n\nVueI18n.prototype._te = function _te(key, locale, messages) {\n var args = [],\n len = arguments.length - 3;\n\n while (len-- > 0) {\n args[len] = arguments[len + 3];\n }\n\n var _locale = parseArgs.apply(void 0, args).locale || locale;\n\n return this._exist(messages[_locale], key);\n};\n\nVueI18n.prototype.te = function te(key, locale) {\n return this._te(key, this.locale, this._getMessages(), locale);\n};\n\nVueI18n.prototype.getLocaleMessage = function getLocaleMessage(locale) {\n return looseClone(this._vm.messages[locale] || {});\n};\n\nVueI18n.prototype.setLocaleMessage = function setLocaleMessage(locale, message) {\n if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {\n this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);\n }\n\n this._vm.$set(this._vm.messages, locale, message);\n};\n\nVueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage(locale, message) {\n if (this._warnHtmlInMessage === 'warn' || this._warnHtmlInMessage === 'error') {\n this._checkLocaleMessage(locale, this._warnHtmlInMessage, message);\n }\n\n this._vm.$set(this._vm.messages, locale, merge(typeof this._vm.messages[locale] !== 'undefined' && Object.keys(this._vm.messages[locale]).length ? Object.assign({}, this._vm.messages[locale]) : {}, message));\n};\n\nVueI18n.prototype.getDateTimeFormat = function getDateTimeFormat(locale) {\n return looseClone(this._vm.dateTimeFormats[locale] || {});\n};\n\nVueI18n.prototype.setDateTimeFormat = function setDateTimeFormat(locale, format) {\n this._vm.$set(this._vm.dateTimeFormats, locale, format);\n\n this._clearDateTimeFormat(locale, format);\n};\n\nVueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat(locale, format) {\n this._vm.$set(this._vm.dateTimeFormats, locale, merge(this._vm.dateTimeFormats[locale] || {}, format));\n\n this._clearDateTimeFormat(locale, format);\n};\n\nVueI18n.prototype._clearDateTimeFormat = function _clearDateTimeFormat(locale, format) {\n // eslint-disable-next-line no-autofix/prefer-const\n for (var key in format) {\n var id = locale + \"__\" + key;\n\n if (!this._dateTimeFormatters.hasOwnProperty(id)) {\n continue;\n }\n\n delete this._dateTimeFormatters[id];\n }\n};\n\nVueI18n.prototype._localizeDateTime = function _localizeDateTime(value, locale, fallback, dateTimeFormats, key) {\n var _locale = locale;\n var formats = dateTimeFormats[_locale];\n\n var chain = this._getLocaleChain(locale, fallback);\n\n for (var i = 0; i < chain.length; i++) {\n var current = _locale;\n var step = chain[i];\n formats = dateTimeFormats[step];\n _locale = step; // fallback locale\n\n if (isNull(formats) || isNull(formats[key])) {\n if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to '\" + step + \"' datetime formats from '\" + current + \"' datetime formats.\");\n }\n } else {\n break;\n }\n }\n\n if (isNull(formats) || isNull(formats[key])) {\n return null;\n } else {\n var format = formats[key];\n var id = _locale + \"__\" + key;\n var formatter = this._dateTimeFormatters[id];\n\n if (!formatter) {\n formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format);\n }\n\n return formatter.format(value);\n }\n};\n\nVueI18n.prototype._d = function _d(value, locale, key) {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && !VueI18n.availabilities.dateTimeFormat) {\n warn('Cannot format a Date value due to not supported Intl.DateTimeFormat.');\n return '';\n }\n\n if (!key) {\n return new Intl.DateTimeFormat(locale).format(value);\n }\n\n var ret = this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key);\n\n if (this._isFallbackRoot(ret)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to datetime localization of root: key '\" + key + \"'.\");\n }\n /* istanbul ignore if */\n\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n return this._root.$i18n.d(value, key, locale);\n } else {\n return ret || '';\n }\n};\n\nVueI18n.prototype.d = function d(value) {\n var args = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n args[len] = arguments[len + 1];\n }\n\n var locale = this.locale;\n var key = null;\n\n if (args.length === 1) {\n if (isString(args[0])) {\n key = args[0];\n } else if (isObject(args[0])) {\n if (args[0].locale) {\n locale = args[0].locale;\n }\n\n if (args[0].key) {\n key = args[0].key;\n }\n }\n } else if (args.length === 2) {\n if (isString(args[0])) {\n key = args[0];\n }\n\n if (isString(args[1])) {\n locale = args[1];\n }\n }\n\n return this._d(value, locale, key);\n};\n\nVueI18n.prototype.getNumberFormat = function getNumberFormat(locale) {\n return looseClone(this._vm.numberFormats[locale] || {});\n};\n\nVueI18n.prototype.setNumberFormat = function setNumberFormat(locale, format) {\n this._vm.$set(this._vm.numberFormats, locale, format);\n\n this._clearNumberFormat(locale, format);\n};\n\nVueI18n.prototype.mergeNumberFormat = function mergeNumberFormat(locale, format) {\n this._vm.$set(this._vm.numberFormats, locale, merge(this._vm.numberFormats[locale] || {}, format));\n\n this._clearNumberFormat(locale, format);\n};\n\nVueI18n.prototype._clearNumberFormat = function _clearNumberFormat(locale, format) {\n // eslint-disable-next-line no-autofix/prefer-const\n for (var key in format) {\n var id = locale + \"__\" + key;\n\n if (!this._numberFormatters.hasOwnProperty(id)) {\n continue;\n }\n\n delete this._numberFormatters[id];\n }\n};\n\nVueI18n.prototype._getNumberFormatter = function _getNumberFormatter(value, locale, fallback, numberFormats, key, options) {\n var _locale = locale;\n var formats = numberFormats[_locale];\n\n var chain = this._getLocaleChain(locale, fallback);\n\n for (var i = 0; i < chain.length; i++) {\n var current = _locale;\n var step = chain[i];\n formats = numberFormats[step];\n _locale = step; // fallback locale\n\n if (isNull(formats) || isNull(formats[key])) {\n if (step !== locale && process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to '\" + step + \"' number formats from '\" + current + \"' number formats.\");\n }\n } else {\n break;\n }\n }\n\n if (isNull(formats) || isNull(formats[key])) {\n return null;\n } else {\n var format = formats[key];\n var formatter;\n\n if (options) {\n // If options specified - create one time number formatter\n formatter = new Intl.NumberFormat(_locale, Object.assign({}, format, options));\n } else {\n var id = _locale + \"__\" + key;\n formatter = this._numberFormatters[id];\n\n if (!formatter) {\n formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format);\n }\n }\n\n return formatter;\n }\n};\n\nVueI18n.prototype._n = function _n(value, locale, key, options) {\n /* istanbul ignore if */\n if (!VueI18n.availabilities.numberFormat) {\n if (process.env.NODE_ENV !== 'production') {\n warn('Cannot format a Number value due to not supported Intl.NumberFormat.');\n }\n\n return '';\n }\n\n if (!key) {\n var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);\n return nf.format(value);\n }\n\n var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);\n\n var ret = formatter && formatter.format(value);\n\n if (this._isFallbackRoot(ret)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key) && !this._isSilentFallbackWarn(key)) {\n warn(\"Fall back to number localization of root: key '\" + key + \"'.\");\n }\n /* istanbul ignore if */\n\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n return this._root.$i18n.n(value, Object.assign({}, {\n key: key,\n locale: locale\n }, options));\n } else {\n return ret || '';\n }\n};\n\nVueI18n.prototype.n = function n(value) {\n var args = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n args[len] = arguments[len + 1];\n }\n\n var locale = this.locale;\n var key = null;\n var options = null;\n\n if (args.length === 1) {\n if (isString(args[0])) {\n key = args[0];\n } else if (isObject(args[0])) {\n if (args[0].locale) {\n locale = args[0].locale;\n }\n\n if (args[0].key) {\n key = args[0].key;\n } // Filter out number format options only\n\n\n options = Object.keys(args[0]).reduce(function (acc, key) {\n var obj;\n\n if (includes(numberFormatKeys, key)) {\n return Object.assign({}, acc, (obj = {}, obj[key] = args[0][key], obj));\n }\n\n return acc;\n }, null);\n }\n } else if (args.length === 2) {\n if (isString(args[0])) {\n key = args[0];\n }\n\n if (isString(args[1])) {\n locale = args[1];\n }\n }\n\n return this._n(value, locale, key, options);\n};\n\nVueI18n.prototype._ntp = function _ntp(value, locale, key, options) {\n /* istanbul ignore if */\n if (!VueI18n.availabilities.numberFormat) {\n if (process.env.NODE_ENV !== 'production') {\n warn('Cannot format to parts a Number value due to not supported Intl.NumberFormat.');\n }\n\n return [];\n }\n\n if (!key) {\n var nf = !options ? new Intl.NumberFormat(locale) : new Intl.NumberFormat(locale, options);\n return nf.formatToParts(value);\n }\n\n var formatter = this._getNumberFormatter(value, locale, this.fallbackLocale, this._getNumberFormats(), key, options);\n\n var ret = formatter && formatter.formatToParts(value);\n\n if (this._isFallbackRoot(ret)) {\n if (process.env.NODE_ENV !== 'production' && !this._isSilentTranslationWarn(key)) {\n warn(\"Fall back to format number to parts of root: key '\" + key + \"' .\");\n }\n /* istanbul ignore if */\n\n\n if (!this._root) {\n throw Error('unexpected error');\n }\n\n return this._root.$i18n._ntp(value, locale, key, options);\n } else {\n return ret || [];\n }\n};\n\nObject.defineProperties(VueI18n.prototype, prototypeAccessors);\nvar availabilities; // $FlowFixMe\n\nObject.defineProperty(VueI18n, 'availabilities', {\n get: function get() {\n if (!availabilities) {\n var intlDefined = typeof Intl !== 'undefined';\n availabilities = {\n dateTimeFormat: intlDefined && typeof Intl.DateTimeFormat !== 'undefined',\n numberFormat: intlDefined && typeof Intl.NumberFormat !== 'undefined'\n };\n }\n\n return availabilities;\n }\n});\nVueI18n.install = install;\nVueI18n.version = '8.27.2';\nexport default VueI18n;","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n}();\n\nvar _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n};\n\nexports.default = function (options) {\n var mappedProps = options.mappedProps,\n name = options.name,\n ctr = options.ctr,\n ctrArgs = options.ctrArgs,\n events = options.events,\n beforeCreate = options.beforeCreate,\n afterCreate = options.afterCreate,\n props = options.props,\n rest = _objectWithoutProperties(options, ['mappedProps', 'name', 'ctr', 'ctrArgs', 'events', 'beforeCreate', 'afterCreate', 'props']);\n\n var promiseName = '$' + name + 'Promise';\n var instanceName = '$' + name + 'Object';\n assert(!(rest.props instanceof Array), '`props` should be an object, not Array');\n return _extends({}, typeof GENERATE_DOC !== 'undefined' ? {\n $vgmOptions: options\n } : {}, {\n mixins: [_mapElementMixin2.default],\n props: _extends({}, props, mappedPropsToVueProps(mappedProps)),\n render: function render() {\n return '';\n },\n provide: function provide() {\n var _this = this;\n\n var promise = this.$mapPromise.then(function (map) {\n // Infowindow needs this to be immediately available\n _this.$map = map; // Initialize the maps with the given options\n\n var options = _extends({}, _this.options, {\n map: map\n }, (0, _bindProps.getPropsValues)(_this, mappedProps));\n\n delete options.options; // delete the extra options\n\n if (beforeCreate) {\n var result = beforeCreate.bind(_this)(options);\n\n if (result instanceof Promise) {\n return result.then(function () {\n return {\n options: options\n };\n });\n }\n }\n\n return {\n options: options\n };\n }).then(function (_ref) {\n var _Function$prototype$b;\n\n var options = _ref.options;\n var ConstructorObject = ctr(); // https://stackoverflow.com/questions/1606797/use-of-apply-with-new-operator-is-this-possible\n\n _this[instanceName] = ctrArgs ? new ((_Function$prototype$b = Function.prototype.bind).call.apply(_Function$prototype$b, [ConstructorObject, null].concat(_toConsumableArray(ctrArgs(options, (0, _bindProps.getPropsValues)(_this, props || {}))))))() : new ConstructorObject(options);\n (0, _bindProps.bindProps)(_this, _this[instanceName], mappedProps);\n (0, _bindEvents2.default)(_this, _this[instanceName], events);\n\n if (afterCreate) {\n afterCreate.bind(_this)(_this[instanceName]);\n }\n\n return _this[instanceName];\n });\n this[promiseName] = promise;\n return _defineProperty({}, promiseName, promise);\n },\n destroyed: function destroyed() {\n // Note: not all Google Maps components support maps\n if (this[instanceName] && this[instanceName].setMap) {\n this[instanceName].setMap(null);\n }\n }\n }, rest);\n};\n\nexports.mappedPropsToVueProps = mappedPropsToVueProps;\n\nvar _bindEvents = require('../utils/bindEvents.js');\n\nvar _bindEvents2 = _interopRequireDefault(_bindEvents);\n\nvar _bindProps = require('../utils/bindProps.js');\n\nvar _mapElementMixin = require('./mapElementMixin');\n\nvar _mapElementMixin2 = _interopRequireDefault(_mapElementMixin);\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _toConsumableArray(arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n } else {\n return Array.from(arr);\n }\n}\n\nfunction _objectWithoutProperties(obj, keys) {\n var target = {};\n\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n\n return target;\n}\n/**\r\n *\r\n * @param {Object} options\r\n * @param {Object} options.mappedProps - Definitions of props\r\n * @param {Object} options.mappedProps.PROP.type - Value type\r\n * @param {Boolean} options.mappedProps.PROP.twoWay\r\n * - Whether the prop has a corresponding PROP_changed\r\n * event\r\n * @param {Boolean} options.mappedProps.PROP.noBind\r\n * - If true, do not apply the default bindProps / bindEvents.\r\n * However it will still be added to the list of component props\r\n * @param {Object} options.props - Regular Vue-style props.\r\n * Note: must be in the Object form because it will be\r\n * merged with the `mappedProps`\r\n *\r\n * @param {Object} options.events - Google Maps API events\r\n * that are not bound to a corresponding prop\r\n * @param {String} options.name - e.g. `polyline`\r\n * @param {=> String} options.ctr - constructor, e.g.\r\n * `google.maps.Polyline`. However, since this is not\r\n * generally available during library load, this becomes\r\n * a function instead, e.g. () => google.maps.Polyline\r\n * which will be called only after the API has been loaded\r\n * @param {(MappedProps, OtherVueProps) => Array} options.ctrArgs -\r\n * If the constructor in `ctr` needs to be called with\r\n * arguments other than a single `options` object, e.g. for\r\n * GroundOverlay, we call `new GroundOverlay(url, bounds, options)`\r\n * then pass in a function that returns the argument list as an array\r\n *\r\n * Otherwise, the constructor will be called with an `options` object,\r\n * with property and values merged from:\r\n *\r\n * 1. the `options` property, if any\r\n * 2. a `map` property with the Google Maps\r\n * 3. all the properties passed to the component in `mappedProps`\r\n * @param {Object => Any} options.beforeCreate -\r\n * Hook to modify the options passed to the initializer\r\n * @param {(options.ctr, Object) => Any} options.afterCreate -\r\n * Hook called when\r\n *\r\n */\n\n\nfunction assert(v, message) {\n if (!v) throw new Error(message);\n}\n/**\r\n * Strips out the extraneous properties we have in our\r\n * props definitions\r\n * @param {Object} props\r\n */\n\n\nfunction mappedPropsToVueProps(mappedProps) {\n return Object.entries(mappedProps).map(function (_ref3) {\n var _ref4 = _slicedToArray(_ref3, 2),\n key = _ref4[0],\n prop = _ref4[1];\n\n var value = {};\n if ('type' in prop) value.type = prop.type;\n if ('default' in prop) value.default = prop.default;\n if ('required' in prop) value.required = prop.required;\n return [key, value];\n }).reduce(function (acc, _ref5) {\n var _ref6 = _slicedToArray(_ref5, 2),\n key = _ref6[0],\n val = _ref6[1];\n\n acc[key] = val;\n return acc;\n }, {});\n}","var fails = require('../internals/fails');\n\n// Detect IE8's incomplete defineProperty implementation\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n return typeof it === 'object' ? it !== null : isCallable(it);\n};\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory, undef) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"), require(\"./enc-base64\"), require(\"./md5\"), require(\"./evpkdf\"), require(\"./cipher-core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\", \"./enc-base64\", \"./md5\", \"./evpkdf\", \"./cipher-core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var BlockCipher = C_lib.BlockCipher;\n var C_algo = C.algo; // Lookup tables\n\n var SBOX = [];\n var INV_SBOX = [];\n var SUB_MIX_0 = [];\n var SUB_MIX_1 = [];\n var SUB_MIX_2 = [];\n var SUB_MIX_3 = [];\n var INV_SUB_MIX_0 = [];\n var INV_SUB_MIX_1 = [];\n var INV_SUB_MIX_2 = [];\n var INV_SUB_MIX_3 = []; // Compute lookup tables\n\n (function () {\n // Compute double table\n var d = [];\n\n for (var i = 0; i < 256; i++) {\n if (i < 128) {\n d[i] = i << 1;\n } else {\n d[i] = i << 1 ^ 0x11b;\n }\n } // Walk GF(2^8)\n\n\n var x = 0;\n var xi = 0;\n\n for (var i = 0; i < 256; i++) {\n // Compute sbox\n var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;\n sx = sx >>> 8 ^ sx & 0xff ^ 0x63;\n SBOX[x] = sx;\n INV_SBOX[sx] = x; // Compute multiplication\n\n var x2 = d[x];\n var x4 = d[x2];\n var x8 = d[x4]; // Compute sub bytes, mix columns tables\n\n var t = d[sx] * 0x101 ^ sx * 0x1010100;\n SUB_MIX_0[x] = t << 24 | t >>> 8;\n SUB_MIX_1[x] = t << 16 | t >>> 16;\n SUB_MIX_2[x] = t << 8 | t >>> 24;\n SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables\n\n var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n INV_SUB_MIX_0[sx] = t << 24 | t >>> 8;\n INV_SUB_MIX_1[sx] = t << 16 | t >>> 16;\n INV_SUB_MIX_2[sx] = t << 8 | t >>> 24;\n INV_SUB_MIX_3[sx] = t; // Compute next counter\n\n if (!x) {\n x = xi = 1;\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]];\n xi ^= d[d[xi]];\n }\n }\n })(); // Precomputed Rcon lookup\n\n\n var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n /**\n * AES block cipher algorithm.\n */\n\n var AES = C_algo.AES = BlockCipher.extend({\n _doReset: function _doReset() {\n var t; // Skip reset of nRounds has been set before and key did not change\n\n if (this._nRounds && this._keyPriorReset === this._key) {\n return;\n } // Shortcuts\n\n\n var key = this._keyPriorReset = this._key;\n var keyWords = key.words;\n var keySize = key.sigBytes / 4; // Compute number of rounds\n\n var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows\n\n var ksRows = (nRounds + 1) * 4; // Compute key schedule\n\n var keySchedule = this._keySchedule = [];\n\n for (var ksRow = 0; ksRow < ksRows; ksRow++) {\n if (ksRow < keySize) {\n keySchedule[ksRow] = keyWords[ksRow];\n } else {\n t = keySchedule[ksRow - 1];\n\n if (!(ksRow % keySize)) {\n // Rot word\n t = t << 8 | t >>> 24; // Sub word\n\n t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon\n\n t ^= RCON[ksRow / keySize | 0] << 24;\n } else if (keySize > 6 && ksRow % keySize == 4) {\n // Sub word\n t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff];\n }\n\n keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;\n }\n } // Compute inv key schedule\n\n\n var invKeySchedule = this._invKeySchedule = [];\n\n for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n var ksRow = ksRows - invKsRow;\n\n if (invKsRow % 4) {\n var t = keySchedule[ksRow];\n } else {\n var t = keySchedule[ksRow - 4];\n }\n\n if (invKsRow < 4 || ksRow <= 4) {\n invKeySchedule[invKsRow] = t;\n } else {\n 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]];\n }\n }\n },\n encryptBlock: function encryptBlock(M, offset) {\n this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);\n },\n decryptBlock: function decryptBlock(M, offset) {\n // Swap 2nd and 4th rows\n var t = M[offset + 1];\n M[offset + 1] = M[offset + 3];\n M[offset + 3] = t;\n\n 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\n\n\n var t = M[offset + 1];\n M[offset + 1] = M[offset + 3];\n M[offset + 3] = t;\n },\n _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {\n // Shortcut\n var nRounds = this._nRounds; // Get input, add round key\n\n var s0 = M[offset] ^ keySchedule[0];\n var s1 = M[offset + 1] ^ keySchedule[1];\n var s2 = M[offset + 2] ^ keySchedule[2];\n var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter\n\n var ksRow = 4; // Rounds\n\n for (var round = 1; round < nRounds; round++) {\n // Shift rows, sub bytes, mix columns, add round key\n 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++];\n 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++];\n 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++];\n 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\n\n s0 = t0;\n s1 = t1;\n s2 = t2;\n s3 = t3;\n } // Shift rows, sub bytes, add round key\n\n\n var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output\n\n M[offset] = t0;\n M[offset + 1] = t1;\n M[offset + 2] = t2;\n M[offset + 3] = t3;\n },\n keySize: 256 / 32\n });\n /**\n * Shortcut functions to the cipher's object interface.\n *\n * @example\n *\n * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);\n * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);\n */\n\n C.AES = BlockCipher._createHelper(AES);\n })();\n\n return CryptoJS.AES;\n});","'use strict';\n\nexports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes');\nexports.createHash = exports.Hash = require('create-hash');\nexports.createHmac = exports.Hmac = require('create-hmac');\n\nvar algos = require('browserify-sign/algos');\n\nvar algoKeys = Object.keys(algos);\nvar hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(algoKeys);\n\nexports.getHashes = function () {\n return hashes;\n};\n\nvar p = require('pbkdf2');\n\nexports.pbkdf2 = p.pbkdf2;\nexports.pbkdf2Sync = p.pbkdf2Sync;\n\nvar aes = require('browserify-cipher');\n\nexports.Cipher = aes.Cipher;\nexports.createCipher = aes.createCipher;\nexports.Cipheriv = aes.Cipheriv;\nexports.createCipheriv = aes.createCipheriv;\nexports.Decipher = aes.Decipher;\nexports.createDecipher = aes.createDecipher;\nexports.Decipheriv = aes.Decipheriv;\nexports.createDecipheriv = aes.createDecipheriv;\nexports.getCiphers = aes.getCiphers;\nexports.listCiphers = aes.listCiphers;\n\nvar dh = require('diffie-hellman');\n\nexports.DiffieHellmanGroup = dh.DiffieHellmanGroup;\nexports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup;\nexports.getDiffieHellman = dh.getDiffieHellman;\nexports.createDiffieHellman = dh.createDiffieHellman;\nexports.DiffieHellman = dh.DiffieHellman;\n\nvar sign = require('browserify-sign');\n\nexports.createSign = sign.createSign;\nexports.Sign = sign.Sign;\nexports.createVerify = sign.createVerify;\nexports.Verify = sign.Verify;\nexports.createECDH = require('create-ecdh');\n\nvar publicEncrypt = require('public-encrypt');\n\nexports.publicEncrypt = publicEncrypt.publicEncrypt;\nexports.privateEncrypt = publicEncrypt.privateEncrypt;\nexports.publicDecrypt = publicEncrypt.publicDecrypt;\nexports.privateDecrypt = publicEncrypt.privateDecrypt; // the least I can do is make error messages for the rest of the node.js/crypto api.\n// ;[\n// 'createCredentials'\n// ].forEach(function (name) {\n// exports[name] = function () {\n// throw new Error([\n// 'sorry, ' + name + ' is not implemented yet',\n// 'we accept pull requests',\n// 'https://github.com/crypto-browserify/crypto-browserify'\n// ].join('\\n'))\n// }\n// })\n\nvar rf = require('randomfill');\n\nexports.randomFill = rf.randomFill;\nexports.randomFillSync = rf.randomFillSync;\n\nexports.createCredentials = function () {\n throw new Error(['sorry, createCredentials is not implemented yet', 'we accept pull requests', 'https://github.com/crypto-browserify/crypto-browserify'].join('\\n'));\n};\n\nexports.constants = {\n 'DH_CHECK_P_NOT_SAFE_PRIME': 2,\n 'DH_CHECK_P_NOT_PRIME': 1,\n 'DH_UNABLE_TO_CHECK_GENERATOR': 4,\n 'DH_NOT_SUITABLE_GENERATOR': 8,\n 'NPN_ENABLED': 1,\n 'ALPN_ENABLED': 1,\n 'RSA_PKCS1_PADDING': 1,\n 'RSA_SSLV23_PADDING': 2,\n 'RSA_NO_PADDING': 3,\n 'RSA_PKCS1_OAEP_PADDING': 4,\n 'RSA_X931_PADDING': 5,\n 'RSA_PKCS1_PSS_PADDING': 6,\n 'POINT_CONVERSION_COMPRESSED': 2,\n 'POINT_CONVERSION_UNCOMPRESSED': 4,\n 'POINT_CONVERSION_HYBRID': 6\n};","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"col s12 m4\"},[_c('label',{attrs:{\"for\":\"cardNumber\"}},[_vm._v(\"Card Number\")]),_vm._v(\" \"),_c('div',{ref:\"cardNumber\",staticClass:\"stripe-input\",attrs:{\"id\":\"cardNumber\"}})]),_vm._v(\" \"),_c('div',{staticClass:\"col s4 m2\"},[_c('label',{attrs:{\"for\":\"cardExpiry\"}},[_vm._v(\"Exp Date\")]),_vm._v(\" \"),_c('div',{ref:\"cardExpiry\",staticClass:\"stripe-input\",attrs:{\"id\":\"cardExpiry\"}})]),_vm._v(\" \"),_c('div',{staticClass:\"col s4 m2\"},[_c('label',{attrs:{\"for\":\"cardCvc\"}},[_vm._v(\"CVC\")]),_vm._v(\" \"),_c('div',{ref:\"cardCvc\",staticClass:\"stripe-input\",attrs:{\"id\":\"cardCvc\"}})]),_vm._v(\" \"),_c('div',{staticClass:\"col s4 m2\"},[_c('label',{attrs:{\"for\":\"addressZip\"}},[_vm._v(_vm._s(_vm.zipLabel))]),_vm._v(\" \"),_c('input',{directives:[{name:\"mask\",rawName:\"v-mask\",value:(_vm.zipMask),expression:\"zipMask\"},{name:\"model\",rawName:\"v-model\",value:(_vm.addressZip),expression:\"addressZip\"},{name:\"validate\",rawName:\"v-validate\",value:('required|length:' + _vm.zipLength),expression:\"'required|length:' + zipLength\"}],ref:\"addressZip\",staticClass:\"zip-input\",style:({ color: _vm.foregroundColor }),attrs:{\"id\":\"addressZip\",\"type\":\"text\",\"placeholder\":\"90210\",\"data-vv-name\":\"postalCode\"},domProps:{\"value\":(_vm.addressZip)},on:{\"keyup\":_vm.onZipChange,\"input\":function($event){if($event.target.composing){ return; }_vm.addressZip=$event.target.value}}})])]),_vm._v(\" \"),_c('div',{staticClass:\"red-text text-darken-3\",attrs:{\"id\":\"card-errors\"}},[_vm._v(_vm._s(_vm.cardError))]),_vm._v(\" \"),_c('span',{staticClass:\"red-text\"},[_vm._v(_vm._s(_vm.errorMessage))]),_c('br'),_vm._v(\" \"),_c('span',{staticClass:\"red-text\"},[_vm._v(_vm._s(_vm.processingErrorMessage))]),_c('br')])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./stripe_card_element.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./stripe_card_element.vue?vue&type=script&lang=js&\"","\n \n
\n
\n\n
\n\n
\n\n
\n \n \n
\n
\n\n
{{ cardError }}
\n
{{ errorMessage }}\n
{{ processingErrorMessage }}\n
\n\n\n\n","import { render, staticRenderFns } from \"./stripe_card_element.vue?vue&type=template&id=cd17e364&scoped=true&\"\nimport script from \"./stripe_card_element.vue?vue&type=script&lang=js&\"\nexport * from \"./stripe_card_element.vue?vue&type=script&lang=js&\"\nimport style0 from \"./stripe_card_element.vue?vue&type=style&index=0&id=cd17e364&scoped=true&lang=css&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../../shared/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"cd17e364\",\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('br'),_vm._v(\" \"),_c('div',{staticClass:\"input-field col s12 m4\"},[_c('i',{staticClass:\"prefix grey-text\",class:_vm.cardBrand}),_vm._v(\" \"),_c('input',{directives:[{name:\"mask\",rawName:\"v-mask\",value:(_vm.cardNumberMask),expression:\"cardNumberMask\"},{name:\"model\",rawName:\"v-model\",value:(_vm.number),expression:\"number\"},{name:\"validate\",rawName:\"v-validate\",value:('required|min:15'),expression:\"'required|min:15'\"}],attrs:{\"id\":\"number\",\"type\":\"text\",\"inputmode\":\"numeric\",\"name\":\"number\"},domProps:{\"value\":(_vm.number)},on:{\"input\":[function($event){if($event.target.composing){ return; }_vm.number=$event.target.value},function($event){return _vm.jumpOn(_vm.cardNumberLength, _vm.number, _vm.$refs.monthInput)}]}}),_vm._v(\" \"),_c('div',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.invalidNumber),expression:\"invalidNumber\"}],staticClass:\"red-text text-darken-3\"},[_vm._v(\"Card number is invalid\")]),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"number\"}},[_vm._v(\"Card number\")])]),_vm._v(\" \"),_c('div',{staticClass:\"input-field col s3 m2\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.expMonth),expression:\"expMonth\"},{name:\"validate\",rawName:\"v-validate\",value:('required|min:1|max:2|max_value:12'),expression:\"'required|min:1|max:2|max_value:12'\"}],ref:\"monthInput\",attrs:{\"id\":\"month\",\"name\":\"month\",\"type\":\"number\"},domProps:{\"value\":(_vm.expMonth)},on:{\"input\":[function($event){if($event.target.composing){ return; }_vm.expMonth=$event.target.value},function($event){return _vm.jumpOn(2, _vm.expMonth, _vm.$refs.yearInput)}]}}),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"month\"}},[_vm._v(\"Exp MM\")])]),_vm._v(\" \"),_c('div',{staticClass:\"input-field col s3 m2\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.expYear),expression:\"expYear\"},{name:\"validate\",rawName:\"v-validate\",value:('required|min:2|max:4'),expression:\"'required|min:2|max:4'\"}],ref:\"yearInput\",attrs:{\"id\":\"year\",\"name\":\"year\",\"type\":\"number\"},domProps:{\"value\":(_vm.expYear)},on:{\"input\":[function($event){if($event.target.composing){ return; }_vm.expYear=$event.target.value},function($event){return _vm.jumpOn(2, _vm.expYear, _vm.$refs.cvvInput)}]}}),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"year\"}},[_vm._v(\"Exp YY\")])]),_vm._v(\" \"),_c('div',{staticClass:\"input-field col s3 m2\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.verificationNumber),expression:\"verificationNumber\"},{name:\"validate\",rawName:\"v-validate\",value:('required|min:3'),expression:\"'required|min:3'\"}],ref:\"cvvInput\",attrs:{\"id\":\"cvv\",\"name\":\"cvv\",\"type\":\"number\"},domProps:{\"value\":(_vm.verificationNumber)},on:{\"input\":[function($event){if($event.target.composing){ return; }_vm.verificationNumber=$event.target.value},function($event){return _vm.jumpOn(_vm.cvvCalculatedLength, _vm.verificationNumber, _vm.$refs.zipInput)}]}}),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"cvv\"}},[_vm._v(\"CVV\")])]),_vm._v(\" \"),_c('div',{staticClass:\"input-field col s3 m2\"},[_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.addressZip),expression:\"addressZip\"},{name:\"mask\",rawName:\"v-mask\",value:(_vm.zipMask),expression:\"zipMask\"},{name:\"validate\",rawName:\"v-validate\",value:('required|length:' + _vm.zipLength),expression:\"'required|length:' + zipLength\"}],ref:\"zipInput\",attrs:{\"id\":\"addressZip\",\"name\":\"zip\",\"type\":\"text\"},domProps:{\"value\":(_vm.addressZip)},on:{\"keyup\":_vm.apiSubmit,\"input\":function($event){if($event.target.composing){ return; }_vm.addressZip=$event.target.value}}}),_vm._v(\" \"),_c('label',{attrs:{\"for\":\"addressZip\"}},[_vm._v(_vm._s(_vm.zipLabel))])])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./card_input.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./card_input.vue?vue&type=script&lang=js&\"","\n \n\n\n\n","import { render, staticRenderFns } from \"./card_input.vue?vue&type=template&id=f2568a86&\"\nimport script from \"./card_input.vue?vue&type=script&lang=js&\"\nexport * from \"./card_input.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../shared/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var EventListener =\n/** @class */\nfunction () {\n function EventListener(eventTarget, eventName) {\n this.eventTarget = eventTarget;\n this.eventName = eventName;\n this.unorderedBindings = new Set();\n }\n\n EventListener.prototype.connect = function () {\n this.eventTarget.addEventListener(this.eventName, this, false);\n };\n\n EventListener.prototype.disconnect = function () {\n this.eventTarget.removeEventListener(this.eventName, this, false);\n }; // Binding observer delegate\n\n /** @hidden */\n\n\n EventListener.prototype.bindingConnected = function (binding) {\n this.unorderedBindings.add(binding);\n };\n /** @hidden */\n\n\n EventListener.prototype.bindingDisconnected = function (binding) {\n this.unorderedBindings.delete(binding);\n };\n\n EventListener.prototype.handleEvent = function (event) {\n var extendedEvent = extendEvent(event);\n\n for (var _i = 0, _a = this.bindings; _i < _a.length; _i++) {\n var binding = _a[_i];\n\n if (extendedEvent.immediatePropagationStopped) {\n break;\n } else {\n binding.handleEvent(extendedEvent);\n }\n }\n };\n\n Object.defineProperty(EventListener.prototype, \"bindings\", {\n get: function get() {\n return Array.from(this.unorderedBindings).sort(function (left, right) {\n var leftIndex = left.index,\n rightIndex = right.index;\n return leftIndex < rightIndex ? -1 : leftIndex > rightIndex ? 1 : 0;\n });\n },\n enumerable: true,\n configurable: true\n });\n return EventListener;\n}();\n\nexport { EventListener };\n\nfunction extendEvent(event) {\n if (\"immediatePropagationStopped\" in event) {\n return event;\n } else {\n var stopImmediatePropagation_1 = event.stopImmediatePropagation;\n return Object.assign(event, {\n immediatePropagationStopped: false,\n stopImmediatePropagation: function stopImmediatePropagation() {\n this.immediatePropagationStopped = true;\n stopImmediatePropagation_1.call(this);\n }\n });\n }\n}","import { EventListener } from \"./event_listener\";\n\nvar Dispatcher =\n/** @class */\nfunction () {\n function Dispatcher(application) {\n this.application = application;\n this.eventListenerMaps = new Map();\n this.started = false;\n }\n\n Dispatcher.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.connect();\n });\n }\n };\n\n Dispatcher.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this.eventListeners.forEach(function (eventListener) {\n return eventListener.disconnect();\n });\n }\n };\n\n Object.defineProperty(Dispatcher.prototype, \"eventListeners\", {\n get: function get() {\n return Array.from(this.eventListenerMaps.values()).reduce(function (listeners, map) {\n return listeners.concat(Array.from(map.values()));\n }, []);\n },\n enumerable: true,\n configurable: true\n }); // Binding observer delegate\n\n /** @hidden */\n\n Dispatcher.prototype.bindingConnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingConnected(binding);\n };\n /** @hidden */\n\n\n Dispatcher.prototype.bindingDisconnected = function (binding) {\n this.fetchEventListenerForBinding(binding).bindingDisconnected(binding);\n }; // Error handling\n\n\n Dispatcher.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n Dispatcher.prototype.fetchEventListenerForBinding = function (binding) {\n var eventTarget = binding.eventTarget,\n eventName = binding.eventName;\n return this.fetchEventListener(eventTarget, eventName);\n };\n\n Dispatcher.prototype.fetchEventListener = function (eventTarget, eventName) {\n var eventListenerMap = this.fetchEventListenerMapForEventTarget(eventTarget);\n var eventListener = eventListenerMap.get(eventName);\n\n if (!eventListener) {\n eventListener = this.createEventListener(eventTarget, eventName);\n eventListenerMap.set(eventName, eventListener);\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.createEventListener = function (eventTarget, eventName) {\n var eventListener = new EventListener(eventTarget, eventName);\n\n if (this.started) {\n eventListener.connect();\n }\n\n return eventListener;\n };\n\n Dispatcher.prototype.fetchEventListenerMapForEventTarget = function (eventTarget) {\n var eventListenerMap = this.eventListenerMaps.get(eventTarget);\n\n if (!eventListenerMap) {\n eventListenerMap = new Map();\n this.eventListenerMaps.set(eventTarget, eventListenerMap);\n }\n\n return eventListenerMap;\n };\n\n return Dispatcher;\n}();\n\nexport { Dispatcher };","// capture nos.: 12 23 4 43 1 5 56 7 76\nvar descriptorPattern = /^((.+?)(@(window|document))?->)?(.+?)(#(.+))?$/;\nexport function parseDescriptorString(descriptorString) {\n var source = descriptorString.trim();\n var matches = source.match(descriptorPattern) || [];\n return {\n eventTarget: parseEventTarget(matches[4]),\n eventName: matches[2],\n identifier: matches[5],\n methodName: matches[7]\n };\n}\n\nfunction parseEventTarget(eventTargetName) {\n if (eventTargetName == \"window\") {\n return window;\n } else if (eventTargetName == \"document\") {\n return document;\n }\n}\n\nexport function stringifyEventTarget(eventTarget) {\n if (eventTarget == window) {\n return \"window\";\n } else if (eventTarget == document) {\n return \"document\";\n }\n}","import { parseDescriptorString, stringifyEventTarget } from \"./action_descriptor\";\n\nvar Action =\n/** @class */\nfunction () {\n function Action(element, index, descriptor) {\n this.element = element;\n this.index = index;\n this.eventTarget = descriptor.eventTarget || element;\n this.eventName = descriptor.eventName || getDefaultEventNameForElement(element) || error(\"missing event name\");\n this.identifier = descriptor.identifier || error(\"missing identifier\");\n this.methodName = descriptor.methodName || error(\"missing method name\");\n }\n\n Action.forToken = function (token) {\n return new this(token.element, token.index, parseDescriptorString(token.content));\n };\n\n Action.prototype.toString = function () {\n var eventNameSuffix = this.eventTargetName ? \"@\" + this.eventTargetName : \"\";\n return \"\" + this.eventName + eventNameSuffix + \"->\" + this.identifier + \"#\" + this.methodName;\n };\n\n Object.defineProperty(Action.prototype, \"eventTargetName\", {\n get: function get() {\n return stringifyEventTarget(this.eventTarget);\n },\n enumerable: true,\n configurable: true\n });\n return Action;\n}();\n\nexport { Action };\nvar defaultEventNames = {\n \"a\": function a(e) {\n return \"click\";\n },\n \"button\": function button(e) {\n return \"click\";\n },\n \"form\": function form(e) {\n return \"submit\";\n },\n \"input\": function input(e) {\n return e.getAttribute(\"type\") == \"submit\" ? \"click\" : \"change\";\n },\n \"select\": function select(e) {\n return \"change\";\n },\n \"textarea\": function textarea(e) {\n return \"change\";\n }\n};\nexport function getDefaultEventNameForElement(element) {\n var tagName = element.tagName.toLowerCase();\n\n if (tagName in defaultEventNames) {\n return defaultEventNames[tagName](element);\n }\n}\n\nfunction error(message) {\n throw new Error(message);\n}","var Binding =\n/** @class */\nfunction () {\n function Binding(context, action) {\n this.context = context;\n this.action = action;\n }\n\n Object.defineProperty(Binding.prototype, \"index\", {\n get: function get() {\n return this.action.index;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"eventTarget\", {\n get: function get() {\n return this.action.eventTarget;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"identifier\", {\n get: function get() {\n return this.context.identifier;\n },\n enumerable: true,\n configurable: true\n });\n\n Binding.prototype.handleEvent = function (event) {\n if (this.willBeInvokedByEvent(event)) {\n this.invokeWithEvent(event);\n }\n };\n\n Object.defineProperty(Binding.prototype, \"eventName\", {\n get: function get() {\n return this.action.eventName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"method\", {\n get: function get() {\n var method = this.controller[this.methodName];\n\n if (typeof method == \"function\") {\n return method;\n }\n\n throw new Error(\"Action \\\"\" + this.action + \"\\\" references undefined method \\\"\" + this.methodName + \"\\\"\");\n },\n enumerable: true,\n configurable: true\n });\n\n Binding.prototype.invokeWithEvent = function (event) {\n try {\n this.method.call(this.controller, event);\n } catch (error) {\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element,\n index = _a.index;\n\n var detail = {\n identifier: identifier,\n controller: controller,\n element: element,\n index: index,\n event: event\n };\n this.context.handleError(error, \"invoking action \\\"\" + this.action + \"\\\"\", detail);\n }\n };\n\n Binding.prototype.willBeInvokedByEvent = function (event) {\n var eventTarget = event.target;\n\n if (this.element === eventTarget) {\n return true;\n } else if (eventTarget instanceof Element && this.element.contains(eventTarget)) {\n return this.scope.containsElement(eventTarget);\n } else {\n return true;\n }\n };\n\n Object.defineProperty(Binding.prototype, \"controller\", {\n get: function get() {\n return this.context.controller;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"methodName\", {\n get: function get() {\n return this.action.methodName;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"element\", {\n get: function get() {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Binding.prototype, \"scope\", {\n get: function get() {\n return this.context.scope;\n },\n enumerable: true,\n configurable: true\n });\n return Binding;\n}();\n\nexport { Binding };","var ElementObserver =\n/** @class */\nfunction () {\n function ElementObserver(element, delegate) {\n var _this = this;\n\n this.element = element;\n this.started = false;\n this.delegate = delegate;\n this.elements = new Set();\n this.mutationObserver = new MutationObserver(function (mutations) {\n return _this.processMutations(mutations);\n });\n }\n\n ElementObserver.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this.mutationObserver.observe(this.element, {\n attributes: true,\n childList: true,\n subtree: true\n });\n this.refresh();\n }\n };\n\n ElementObserver.prototype.stop = function () {\n if (this.started) {\n this.mutationObserver.takeRecords();\n this.mutationObserver.disconnect();\n this.started = false;\n }\n };\n\n ElementObserver.prototype.refresh = function () {\n if (this.started) {\n var matches = new Set(this.matchElementsInTree());\n\n for (var _i = 0, _a = Array.from(this.elements); _i < _a.length; _i++) {\n var element = _a[_i];\n\n if (!matches.has(element)) {\n this.removeElement(element);\n }\n }\n\n for (var _b = 0, _c = Array.from(matches); _b < _c.length; _b++) {\n var element = _c[_b];\n this.addElement(element);\n }\n }\n }; // Mutation record processing\n\n\n ElementObserver.prototype.processMutations = function (mutations) {\n if (this.started) {\n for (var _i = 0, mutations_1 = mutations; _i < mutations_1.length; _i++) {\n var mutation = mutations_1[_i];\n this.processMutation(mutation);\n }\n }\n };\n\n ElementObserver.prototype.processMutation = function (mutation) {\n if (mutation.type == \"attributes\") {\n this.processAttributeChange(mutation.target, mutation.attributeName);\n } else if (mutation.type == \"childList\") {\n this.processRemovedNodes(mutation.removedNodes);\n this.processAddedNodes(mutation.addedNodes);\n }\n };\n\n ElementObserver.prototype.processAttributeChange = function (node, attributeName) {\n var element = node;\n\n if (this.elements.has(element)) {\n if (this.delegate.elementAttributeChanged && this.matchElement(element)) {\n this.delegate.elementAttributeChanged(element, attributeName);\n } else {\n this.removeElement(element);\n }\n } else if (this.matchElement(element)) {\n this.addElement(element);\n }\n };\n\n ElementObserver.prototype.processRemovedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element) {\n this.processTree(element, this.removeElement);\n }\n }\n };\n\n ElementObserver.prototype.processAddedNodes = function (nodes) {\n for (var _i = 0, _a = Array.from(nodes); _i < _a.length; _i++) {\n var node = _a[_i];\n var element = this.elementFromNode(node);\n\n if (element && this.elementIsActive(element)) {\n this.processTree(element, this.addElement);\n }\n }\n }; // Element matching\n\n\n ElementObserver.prototype.matchElement = function (element) {\n return this.delegate.matchElement(element);\n };\n\n ElementObserver.prototype.matchElementsInTree = function (tree) {\n if (tree === void 0) {\n tree = this.element;\n }\n\n return this.delegate.matchElementsInTree(tree);\n };\n\n ElementObserver.prototype.processTree = function (tree, processor) {\n for (var _i = 0, _a = this.matchElementsInTree(tree); _i < _a.length; _i++) {\n var element = _a[_i];\n processor.call(this, element);\n }\n };\n\n ElementObserver.prototype.elementFromNode = function (node) {\n if (node.nodeType == Node.ELEMENT_NODE) {\n return node;\n }\n };\n\n ElementObserver.prototype.elementIsActive = function (element) {\n if (element.isConnected != this.element.isConnected) {\n return false;\n } else {\n return this.element.contains(element);\n }\n }; // Element tracking\n\n\n ElementObserver.prototype.addElement = function (element) {\n if (!this.elements.has(element)) {\n if (this.elementIsActive(element)) {\n this.elements.add(element);\n\n if (this.delegate.elementMatched) {\n this.delegate.elementMatched(element);\n }\n }\n }\n };\n\n ElementObserver.prototype.removeElement = function (element) {\n if (this.elements.has(element)) {\n this.elements.delete(element);\n\n if (this.delegate.elementUnmatched) {\n this.delegate.elementUnmatched(element);\n }\n }\n };\n\n return ElementObserver;\n}();\n\nexport { ElementObserver };","import { ElementObserver } from \"./element_observer\";\n\nvar AttributeObserver =\n/** @class */\nfunction () {\n function AttributeObserver(element, attributeName, delegate) {\n this.attributeName = attributeName;\n this.delegate = delegate;\n this.elementObserver = new ElementObserver(element, this);\n }\n\n Object.defineProperty(AttributeObserver.prototype, \"element\", {\n get: function get() {\n return this.elementObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(AttributeObserver.prototype, \"selector\", {\n get: function get() {\n return \"[\" + this.attributeName + \"]\";\n },\n enumerable: true,\n configurable: true\n });\n\n AttributeObserver.prototype.start = function () {\n this.elementObserver.start();\n };\n\n AttributeObserver.prototype.stop = function () {\n this.elementObserver.stop();\n };\n\n AttributeObserver.prototype.refresh = function () {\n this.elementObserver.refresh();\n };\n\n Object.defineProperty(AttributeObserver.prototype, \"started\", {\n get: function get() {\n return this.elementObserver.started;\n },\n enumerable: true,\n configurable: true\n }); // Element observer delegate\n\n AttributeObserver.prototype.matchElement = function (element) {\n return element.hasAttribute(this.attributeName);\n };\n\n AttributeObserver.prototype.matchElementsInTree = function (tree) {\n var match = this.matchElement(tree) ? [tree] : [];\n var matches = Array.from(tree.querySelectorAll(this.selector));\n return match.concat(matches);\n };\n\n AttributeObserver.prototype.elementMatched = function (element) {\n if (this.delegate.elementMatchedAttribute) {\n this.delegate.elementMatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementUnmatched = function (element) {\n if (this.delegate.elementUnmatchedAttribute) {\n this.delegate.elementUnmatchedAttribute(element, this.attributeName);\n }\n };\n\n AttributeObserver.prototype.elementAttributeChanged = function (element, attributeName) {\n if (this.delegate.elementAttributeValueChanged && this.attributeName == attributeName) {\n this.delegate.elementAttributeValueChanged(element, attributeName);\n }\n };\n\n return AttributeObserver;\n}();\n\nexport { AttributeObserver };","export function add(map, key, value) {\n fetch(map, key).add(value);\n}\nexport function del(map, key, value) {\n fetch(map, key).delete(value);\n prune(map, key);\n}\nexport function fetch(map, key) {\n var values = map.get(key);\n\n if (!values) {\n values = new Set();\n map.set(key, values);\n }\n\n return values;\n}\nexport function prune(map, key) {\n var values = map.get(key);\n\n if (values != null && values.size == 0) {\n map.delete(key);\n }\n}","import { add, del } from \"./set_operations\";\n\nvar Multimap =\n/** @class */\nfunction () {\n function Multimap() {\n this.valuesByKey = new Map();\n }\n\n Object.defineProperty(Multimap.prototype, \"values\", {\n get: function get() {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (values, set) {\n return values.concat(Array.from(set));\n }, []);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Multimap.prototype, \"size\", {\n get: function get() {\n var sets = Array.from(this.valuesByKey.values());\n return sets.reduce(function (size, set) {\n return size + set.size;\n }, 0);\n },\n enumerable: true,\n configurable: true\n });\n\n Multimap.prototype.add = function (key, value) {\n add(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.delete = function (key, value) {\n del(this.valuesByKey, key, value);\n };\n\n Multimap.prototype.has = function (key, value) {\n var values = this.valuesByKey.get(key);\n return values != null && values.has(value);\n };\n\n Multimap.prototype.hasKey = function (key) {\n return this.valuesByKey.has(key);\n };\n\n Multimap.prototype.hasValue = function (value) {\n var sets = Array.from(this.valuesByKey.values());\n return sets.some(function (set) {\n return set.has(value);\n });\n };\n\n Multimap.prototype.getValuesForKey = function (key) {\n var values = this.valuesByKey.get(key);\n return values ? Array.from(values) : [];\n };\n\n Multimap.prototype.getKeysForValue = function (value) {\n return Array.from(this.valuesByKey).filter(function (_a) {\n var key = _a[0],\n values = _a[1];\n return values.has(value);\n }).map(function (_a) {\n var key = _a[0],\n values = _a[1];\n return key;\n });\n };\n\n return Multimap;\n}();\n\nexport { Multimap };","var __extends = this && this.__extends || function () {\n var extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n\nimport { Multimap } from \"./multimap\";\nimport { add, del } from \"./set_operations\";\n\nvar IndexedMultimap =\n/** @class */\nfunction (_super) {\n __extends(IndexedMultimap, _super);\n\n function IndexedMultimap() {\n var _this = _super.call(this) || this;\n\n _this.keysByValue = new Map();\n return _this;\n }\n\n Object.defineProperty(IndexedMultimap.prototype, \"values\", {\n get: function get() {\n return Array.from(this.keysByValue.keys());\n },\n enumerable: true,\n configurable: true\n });\n\n IndexedMultimap.prototype.add = function (key, value) {\n _super.prototype.add.call(this, key, value);\n\n add(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.delete = function (key, value) {\n _super.prototype.delete.call(this, key, value);\n\n del(this.keysByValue, value, key);\n };\n\n IndexedMultimap.prototype.hasValue = function (value) {\n return this.keysByValue.has(value);\n };\n\n IndexedMultimap.prototype.getKeysForValue = function (value) {\n var set = this.keysByValue.get(value);\n return set ? Array.from(set) : [];\n };\n\n return IndexedMultimap;\n}(Multimap);\n\nexport { IndexedMultimap };","import { AttributeObserver } from \"./attribute_observer\";\nimport { Multimap } from \"@stimulus/multimap\";\n\nvar TokenListObserver =\n/** @class */\nfunction () {\n function TokenListObserver(element, attributeName, delegate) {\n this.attributeObserver = new AttributeObserver(element, attributeName, this);\n this.delegate = delegate;\n this.tokensByElement = new Multimap();\n }\n\n Object.defineProperty(TokenListObserver.prototype, \"started\", {\n get: function get() {\n return this.attributeObserver.started;\n },\n enumerable: true,\n configurable: true\n });\n\n TokenListObserver.prototype.start = function () {\n this.attributeObserver.start();\n };\n\n TokenListObserver.prototype.stop = function () {\n this.attributeObserver.stop();\n };\n\n TokenListObserver.prototype.refresh = function () {\n this.attributeObserver.refresh();\n };\n\n Object.defineProperty(TokenListObserver.prototype, \"element\", {\n get: function get() {\n return this.attributeObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TokenListObserver.prototype, \"attributeName\", {\n get: function get() {\n return this.attributeObserver.attributeName;\n },\n enumerable: true,\n configurable: true\n }); // Attribute observer delegate\n\n TokenListObserver.prototype.elementMatchedAttribute = function (element) {\n this.tokensMatched(this.readTokensForElement(element));\n };\n\n TokenListObserver.prototype.elementAttributeValueChanged = function (element) {\n var _a = this.refreshTokensForElement(element),\n unmatchedTokens = _a[0],\n matchedTokens = _a[1];\n\n this.tokensUnmatched(unmatchedTokens);\n this.tokensMatched(matchedTokens);\n };\n\n TokenListObserver.prototype.elementUnmatchedAttribute = function (element) {\n this.tokensUnmatched(this.tokensByElement.getValuesForKey(element));\n };\n\n TokenListObserver.prototype.tokensMatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenMatched(token);\n });\n };\n\n TokenListObserver.prototype.tokensUnmatched = function (tokens) {\n var _this = this;\n\n tokens.forEach(function (token) {\n return _this.tokenUnmatched(token);\n });\n };\n\n TokenListObserver.prototype.tokenMatched = function (token) {\n this.delegate.tokenMatched(token);\n this.tokensByElement.add(token.element, token);\n };\n\n TokenListObserver.prototype.tokenUnmatched = function (token) {\n this.delegate.tokenUnmatched(token);\n this.tokensByElement.delete(token.element, token);\n };\n\n TokenListObserver.prototype.refreshTokensForElement = function (element) {\n var previousTokens = this.tokensByElement.getValuesForKey(element);\n var currentTokens = this.readTokensForElement(element);\n var firstDifferingIndex = zip(previousTokens, currentTokens).findIndex(function (_a) {\n var previousToken = _a[0],\n currentToken = _a[1];\n return !tokensAreEqual(previousToken, currentToken);\n });\n\n if (firstDifferingIndex == -1) {\n return [[], []];\n } else {\n return [previousTokens.slice(firstDifferingIndex), currentTokens.slice(firstDifferingIndex)];\n }\n };\n\n TokenListObserver.prototype.readTokensForElement = function (element) {\n var attributeName = this.attributeName;\n var tokenString = element.getAttribute(attributeName) || \"\";\n return parseTokenString(tokenString, element, attributeName);\n };\n\n return TokenListObserver;\n}();\n\nexport { TokenListObserver };\n\nfunction parseTokenString(tokenString, element, attributeName) {\n return tokenString.trim().split(/\\s+/).filter(function (content) {\n return content.length;\n }).map(function (content, index) {\n return {\n element: element,\n attributeName: attributeName,\n content: content,\n index: index\n };\n });\n}\n\nfunction zip(left, right) {\n var length = Math.max(left.length, right.length);\n return Array.from({\n length: length\n }, function (_, index) {\n return [left[index], right[index]];\n });\n}\n\nfunction tokensAreEqual(left, right) {\n return left && right && left.index == right.index && left.content == right.content;\n}","import { TokenListObserver } from \"./token_list_observer\";\n\nvar ValueListObserver =\n/** @class */\nfunction () {\n function ValueListObserver(element, attributeName, delegate) {\n this.tokenListObserver = new TokenListObserver(element, attributeName, this);\n this.delegate = delegate;\n this.parseResultsByToken = new WeakMap();\n this.valuesByTokenByElement = new WeakMap();\n }\n\n Object.defineProperty(ValueListObserver.prototype, \"started\", {\n get: function get() {\n return this.tokenListObserver.started;\n },\n enumerable: true,\n configurable: true\n });\n\n ValueListObserver.prototype.start = function () {\n this.tokenListObserver.start();\n };\n\n ValueListObserver.prototype.stop = function () {\n this.tokenListObserver.stop();\n };\n\n ValueListObserver.prototype.refresh = function () {\n this.tokenListObserver.refresh();\n };\n\n Object.defineProperty(ValueListObserver.prototype, \"element\", {\n get: function get() {\n return this.tokenListObserver.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ValueListObserver.prototype, \"attributeName\", {\n get: function get() {\n return this.tokenListObserver.attributeName;\n },\n enumerable: true,\n configurable: true\n });\n\n ValueListObserver.prototype.tokenMatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).set(token, value);\n this.delegate.elementMatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.tokenUnmatched = function (token) {\n var element = token.element;\n var value = this.fetchParseResultForToken(token).value;\n\n if (value) {\n this.fetchValuesByTokenForElement(element).delete(token);\n this.delegate.elementUnmatchedValue(element, value);\n }\n };\n\n ValueListObserver.prototype.fetchParseResultForToken = function (token) {\n var parseResult = this.parseResultsByToken.get(token);\n\n if (!parseResult) {\n parseResult = this.parseToken(token);\n this.parseResultsByToken.set(token, parseResult);\n }\n\n return parseResult;\n };\n\n ValueListObserver.prototype.fetchValuesByTokenForElement = function (element) {\n var valuesByToken = this.valuesByTokenByElement.get(element);\n\n if (!valuesByToken) {\n valuesByToken = new Map();\n this.valuesByTokenByElement.set(element, valuesByToken);\n }\n\n return valuesByToken;\n };\n\n ValueListObserver.prototype.parseToken = function (token) {\n try {\n var value = this.delegate.parseValueForToken(token);\n return {\n value: value\n };\n } catch (error) {\n return {\n error: error\n };\n }\n };\n\n return ValueListObserver;\n}();\n\nexport { ValueListObserver };","import { Action } from \"./action\";\nimport { Binding } from \"./binding\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar BindingObserver =\n/** @class */\nfunction () {\n function BindingObserver(context, delegate) {\n this.context = context;\n this.delegate = delegate;\n this.bindingsByAction = new Map();\n }\n\n BindingObserver.prototype.start = function () {\n if (!this.valueListObserver) {\n this.valueListObserver = new ValueListObserver(this.element, this.actionAttribute, this);\n this.valueListObserver.start();\n }\n };\n\n BindingObserver.prototype.stop = function () {\n if (this.valueListObserver) {\n this.valueListObserver.stop();\n delete this.valueListObserver;\n this.disconnectAllActions();\n }\n };\n\n Object.defineProperty(BindingObserver.prototype, \"element\", {\n get: function get() {\n return this.context.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"identifier\", {\n get: function get() {\n return this.context.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"actionAttribute\", {\n get: function get() {\n return this.schema.actionAttribute;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"schema\", {\n get: function get() {\n return this.context.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BindingObserver.prototype, \"bindings\", {\n get: function get() {\n return Array.from(this.bindingsByAction.values());\n },\n enumerable: true,\n configurable: true\n });\n\n BindingObserver.prototype.connectAction = function (action) {\n var binding = new Binding(this.context, action);\n this.bindingsByAction.set(action, binding);\n this.delegate.bindingConnected(binding);\n };\n\n BindingObserver.prototype.disconnectAction = function (action) {\n var binding = this.bindingsByAction.get(action);\n\n if (binding) {\n this.bindingsByAction.delete(action);\n this.delegate.bindingDisconnected(binding);\n }\n };\n\n BindingObserver.prototype.disconnectAllActions = function () {\n var _this = this;\n\n this.bindings.forEach(function (binding) {\n return _this.delegate.bindingDisconnected(binding);\n });\n this.bindingsByAction.clear();\n }; // Value observer delegate\n\n\n BindingObserver.prototype.parseValueForToken = function (token) {\n var action = Action.forToken(token);\n\n if (action.identifier == this.identifier) {\n return action;\n }\n };\n\n BindingObserver.prototype.elementMatchedValue = function (element, action) {\n this.connectAction(action);\n };\n\n BindingObserver.prototype.elementUnmatchedValue = function (element, action) {\n this.disconnectAction(action);\n };\n\n return BindingObserver;\n}();\n\nexport { BindingObserver };","import { BindingObserver } from \"./binding_observer\";\n\nvar Context =\n/** @class */\nfunction () {\n function Context(module, scope) {\n this.module = module;\n this.scope = scope;\n this.controller = new module.controllerConstructor(this);\n this.bindingObserver = new BindingObserver(this, this.dispatcher);\n\n try {\n this.controller.initialize();\n } catch (error) {\n this.handleError(error, \"initializing controller\");\n }\n }\n\n Context.prototype.connect = function () {\n this.bindingObserver.start();\n\n try {\n this.controller.connect();\n } catch (error) {\n this.handleError(error, \"connecting controller\");\n }\n };\n\n Context.prototype.disconnect = function () {\n try {\n this.controller.disconnect();\n } catch (error) {\n this.handleError(error, \"disconnecting controller\");\n }\n\n this.bindingObserver.stop();\n };\n\n Object.defineProperty(Context.prototype, \"application\", {\n get: function get() {\n return this.module.application;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"identifier\", {\n get: function get() {\n return this.module.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"schema\", {\n get: function get() {\n return this.application.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"dispatcher\", {\n get: function get() {\n return this.application.dispatcher;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"element\", {\n get: function get() {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Context.prototype, \"parentElement\", {\n get: function get() {\n return this.element.parentElement;\n },\n enumerable: true,\n configurable: true\n }); // Error handling\n\n Context.prototype.handleError = function (error, message, detail) {\n if (detail === void 0) {\n detail = {};\n }\n\n var _a = this,\n identifier = _a.identifier,\n controller = _a.controller,\n element = _a.element;\n\n detail = Object.assign({\n identifier: identifier,\n controller: controller,\n element: element\n }, detail);\n this.application.handleError(error, \"Error \" + message, detail);\n };\n\n return Context;\n}();\n\nexport { Context };","var __extends = this && this.__extends || function () {\n var extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) {\n if (b.hasOwnProperty(p)) d[p] = b[p];\n }\n };\n\n return function (d, b) {\n extendStatics(d, b);\n\n function __() {\n this.constructor = d;\n }\n\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n}();\n/** @hidden */\n\n\nexport function blessDefinition(definition) {\n return {\n identifier: definition.identifier,\n controllerConstructor: blessControllerConstructor(definition.controllerConstructor)\n };\n}\n\nfunction blessControllerConstructor(controllerConstructor) {\n var constructor = extend(controllerConstructor);\n constructor.bless();\n return constructor;\n}\n\nvar extend = function () {\n function extendWithReflect(constructor) {\n function Controller() {\n var _newTarget = this && this instanceof Controller ? this.constructor : void 0;\n\n return Reflect.construct(constructor, arguments, _newTarget);\n }\n\n Controller.prototype = Object.create(constructor.prototype, {\n constructor: {\n value: Controller\n }\n });\n Reflect.setPrototypeOf(Controller, constructor);\n return Controller;\n }\n\n function testReflectExtension() {\n var a = function a() {\n this.a.call(this);\n };\n\n var b = extendWithReflect(a);\n\n b.prototype.a = function () {};\n\n return new b();\n }\n\n try {\n testReflectExtension();\n return extendWithReflect;\n } catch (error) {\n return function (constructor) {\n return (\n /** @class */\n function (_super) {\n __extends(Controller, _super);\n\n function Controller() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n\n return Controller;\n }(constructor)\n );\n };\n }\n}();","import { Context } from \"./context\";\nimport { blessDefinition } from \"./definition\";\n\nvar Module =\n/** @class */\nfunction () {\n function Module(application, definition) {\n this.application = application;\n this.definition = blessDefinition(definition);\n this.contextsByScope = new WeakMap();\n this.connectedContexts = new Set();\n }\n\n Object.defineProperty(Module.prototype, \"identifier\", {\n get: function get() {\n return this.definition.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"controllerConstructor\", {\n get: function get() {\n return this.definition.controllerConstructor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Module.prototype, \"contexts\", {\n get: function get() {\n return Array.from(this.connectedContexts);\n },\n enumerable: true,\n configurable: true\n });\n\n Module.prototype.connectContextForScope = function (scope) {\n var context = this.fetchContextForScope(scope);\n this.connectedContexts.add(context);\n context.connect();\n };\n\n Module.prototype.disconnectContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (context) {\n this.connectedContexts.delete(context);\n context.disconnect();\n }\n };\n\n Module.prototype.fetchContextForScope = function (scope) {\n var context = this.contextsByScope.get(scope);\n\n if (!context) {\n context = new Context(this, scope);\n this.contextsByScope.set(scope, context);\n }\n\n return context;\n };\n\n return Module;\n}();\n\nexport { Module };","var DataMap =\n/** @class */\nfunction () {\n function DataMap(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(DataMap.prototype, \"element\", {\n get: function get() {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DataMap.prototype, \"identifier\", {\n get: function get() {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n\n DataMap.prototype.get = function (key) {\n key = this.getFormattedKey(key);\n return this.element.getAttribute(key);\n };\n\n DataMap.prototype.set = function (key, value) {\n key = this.getFormattedKey(key);\n this.element.setAttribute(key, value);\n return this.get(key);\n };\n\n DataMap.prototype.has = function (key) {\n key = this.getFormattedKey(key);\n return this.element.hasAttribute(key);\n };\n\n DataMap.prototype.delete = function (key) {\n if (this.has(key)) {\n key = this.getFormattedKey(key);\n this.element.removeAttribute(key);\n return true;\n } else {\n return false;\n }\n };\n\n DataMap.prototype.getFormattedKey = function (key) {\n return \"data-\" + this.identifier + \"-\" + dasherize(key);\n };\n\n return DataMap;\n}();\n\nexport { DataMap };\n\nfunction dasherize(value) {\n return value.replace(/([A-Z])/g, function (_, char) {\n return \"-\" + char.toLowerCase();\n });\n}","/** @hidden */\nexport function attributeValueContainsToken(attributeName, token) {\n return \"[\" + attributeName + \"~=\\\"\" + token + \"\\\"]\";\n}","import { attributeValueContainsToken } from \"./selectors\";\n\nvar TargetSet =\n/** @class */\nfunction () {\n function TargetSet(scope) {\n this.scope = scope;\n }\n\n Object.defineProperty(TargetSet.prototype, \"element\", {\n get: function get() {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"identifier\", {\n get: function get() {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TargetSet.prototype, \"schema\", {\n get: function get() {\n return this.scope.schema;\n },\n enumerable: true,\n configurable: true\n });\n\n TargetSet.prototype.has = function (targetName) {\n return this.find(targetName) != null;\n };\n\n TargetSet.prototype.find = function () {\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n var selector = this.getSelectorForTargetNames(targetNames);\n return this.scope.findElement(selector);\n };\n\n TargetSet.prototype.findAll = function () {\n var targetNames = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n targetNames[_i] = arguments[_i];\n }\n\n var selector = this.getSelectorForTargetNames(targetNames);\n return this.scope.findAllElements(selector);\n };\n\n TargetSet.prototype.getSelectorForTargetNames = function (targetNames) {\n var _this = this;\n\n return targetNames.map(function (targetName) {\n return _this.getSelectorForTargetName(targetName);\n }).join(\", \");\n };\n\n TargetSet.prototype.getSelectorForTargetName = function (targetName) {\n var targetDescriptor = this.identifier + \".\" + targetName;\n return attributeValueContainsToken(this.schema.targetAttribute, targetDescriptor);\n };\n\n return TargetSet;\n}();\n\nexport { TargetSet };","import { DataMap } from \"./data_map\";\nimport { TargetSet } from \"./target_set\";\nimport { attributeValueContainsToken } from \"./selectors\";\n\nvar Scope =\n/** @class */\nfunction () {\n function Scope(schema, identifier, element) {\n this.schema = schema;\n this.identifier = identifier;\n this.element = element;\n this.targets = new TargetSet(this);\n this.data = new DataMap(this);\n }\n\n Scope.prototype.findElement = function (selector) {\n return this.findAllElements(selector)[0];\n };\n\n Scope.prototype.findAllElements = function (selector) {\n var head = this.element.matches(selector) ? [this.element] : [];\n var tail = this.filterElements(Array.from(this.element.querySelectorAll(selector)));\n return head.concat(tail);\n };\n\n Scope.prototype.filterElements = function (elements) {\n var _this = this;\n\n return elements.filter(function (element) {\n return _this.containsElement(element);\n });\n };\n\n Scope.prototype.containsElement = function (element) {\n return element.closest(this.controllerSelector) === this.element;\n };\n\n Object.defineProperty(Scope.prototype, \"controllerSelector\", {\n get: function get() {\n return attributeValueContainsToken(this.schema.controllerAttribute, this.identifier);\n },\n enumerable: true,\n configurable: true\n });\n return Scope;\n}();\n\nexport { Scope };","import { Scope } from \"./scope\";\nimport { ValueListObserver } from \"@stimulus/mutation-observers\";\n\nvar ScopeObserver =\n/** @class */\nfunction () {\n function ScopeObserver(element, schema, delegate) {\n this.element = element;\n this.schema = schema;\n this.delegate = delegate;\n this.valueListObserver = new ValueListObserver(this.element, this.controllerAttribute, this);\n this.scopesByIdentifierByElement = new WeakMap();\n this.scopeReferenceCounts = new WeakMap();\n }\n\n ScopeObserver.prototype.start = function () {\n this.valueListObserver.start();\n };\n\n ScopeObserver.prototype.stop = function () {\n this.valueListObserver.stop();\n };\n\n Object.defineProperty(ScopeObserver.prototype, \"controllerAttribute\", {\n get: function get() {\n return this.schema.controllerAttribute;\n },\n enumerable: true,\n configurable: true\n }); // Value observer delegate\n\n /** @hidden */\n\n ScopeObserver.prototype.parseValueForToken = function (token) {\n var element = token.element,\n identifier = token.content;\n var scopesByIdentifier = this.fetchScopesByIdentifierForElement(element);\n var scope = scopesByIdentifier.get(identifier);\n\n if (!scope) {\n scope = new Scope(this.schema, identifier, element);\n scopesByIdentifier.set(identifier, scope);\n }\n\n return scope;\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementMatchedValue = function (element, value) {\n var referenceCount = (this.scopeReferenceCounts.get(value) || 0) + 1;\n this.scopeReferenceCounts.set(value, referenceCount);\n\n if (referenceCount == 1) {\n this.delegate.scopeConnected(value);\n }\n };\n /** @hidden */\n\n\n ScopeObserver.prototype.elementUnmatchedValue = function (element, value) {\n var referenceCount = this.scopeReferenceCounts.get(value);\n\n if (referenceCount) {\n this.scopeReferenceCounts.set(value, referenceCount - 1);\n\n if (referenceCount == 1) {\n this.delegate.scopeDisconnected(value);\n }\n }\n };\n\n ScopeObserver.prototype.fetchScopesByIdentifierForElement = function (element) {\n var scopesByIdentifier = this.scopesByIdentifierByElement.get(element);\n\n if (!scopesByIdentifier) {\n scopesByIdentifier = new Map();\n this.scopesByIdentifierByElement.set(element, scopesByIdentifier);\n }\n\n return scopesByIdentifier;\n };\n\n return ScopeObserver;\n}();\n\nexport { ScopeObserver };","import { Module } from \"./module\";\nimport { Multimap } from \"@stimulus/multimap\";\nimport { ScopeObserver } from \"./scope_observer\";\n\nvar Router =\n/** @class */\nfunction () {\n function Router(application) {\n this.application = application;\n this.scopeObserver = new ScopeObserver(this.element, this.schema, this);\n this.scopesByIdentifier = new Multimap();\n this.modulesByIdentifier = new Map();\n }\n\n Object.defineProperty(Router.prototype, \"element\", {\n get: function get() {\n return this.application.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"schema\", {\n get: function get() {\n return this.application.schema;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"controllerAttribute\", {\n get: function get() {\n return this.schema.controllerAttribute;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"modules\", {\n get: function get() {\n return Array.from(this.modulesByIdentifier.values());\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Router.prototype, \"contexts\", {\n get: function get() {\n return this.modules.reduce(function (contexts, module) {\n return contexts.concat(module.contexts);\n }, []);\n },\n enumerable: true,\n configurable: true\n });\n\n Router.prototype.start = function () {\n this.scopeObserver.start();\n };\n\n Router.prototype.stop = function () {\n this.scopeObserver.stop();\n };\n\n Router.prototype.loadDefinition = function (definition) {\n this.unloadIdentifier(definition.identifier);\n var module = new Module(this.application, definition);\n this.connectModule(module);\n };\n\n Router.prototype.unloadIdentifier = function (identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n this.disconnectModule(module);\n }\n };\n\n Router.prototype.getContextForElementAndIdentifier = function (element, identifier) {\n var module = this.modulesByIdentifier.get(identifier);\n\n if (module) {\n return module.contexts.find(function (context) {\n return context.element == element;\n });\n }\n }; // Error handler delegate\n\n /** @hidden */\n\n\n Router.prototype.handleError = function (error, message, detail) {\n this.application.handleError(error, message, detail);\n }; // Scope observer delegate\n\n /** @hidden */\n\n\n Router.prototype.scopeConnected = function (scope) {\n this.scopesByIdentifier.add(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.connectContextForScope(scope);\n }\n };\n /** @hidden */\n\n\n Router.prototype.scopeDisconnected = function (scope) {\n this.scopesByIdentifier.delete(scope.identifier, scope);\n var module = this.modulesByIdentifier.get(scope.identifier);\n\n if (module) {\n module.disconnectContextForScope(scope);\n }\n }; // Modules\n\n\n Router.prototype.connectModule = function (module) {\n this.modulesByIdentifier.set(module.identifier, module);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.connectContextForScope(scope);\n });\n };\n\n Router.prototype.disconnectModule = function (module) {\n this.modulesByIdentifier.delete(module.identifier);\n var scopes = this.scopesByIdentifier.getValuesForKey(module.identifier);\n scopes.forEach(function (scope) {\n return module.disconnectContextForScope(scope);\n });\n };\n\n return Router;\n}();\n\nexport { Router };","export var defaultSchema = {\n controllerAttribute: \"data-controller\",\n actionAttribute: \"data-action\",\n targetAttribute: \"data-target\"\n};","var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n\n function step(result) {\n result.done ? resolve(result.value) : new P(function (resolve) {\n resolve(result.value);\n }).then(fulfilled, rejected);\n }\n\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\n\nvar __generator = this && this.__generator || function (thisArg, body) {\n var _ = {\n label: 0,\n sent: function sent() {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g;\n return g = {\n next: verb(0),\n \"throw\": verb(1),\n \"return\": verb(2)\n }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n\n while (_) {\n try {\n if (f = 1, y && (t = y[op[0] & 2 ? \"return\" : op[0] ? \"throw\" : \"next\"]) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [0, t.value];\n\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n\n case 7:\n op = _.ops.pop();\n\n _.trys.pop();\n\n continue;\n\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n\n if (t && _.label < t[2]) {\n _.label = t[2];\n\n _.ops.push(op);\n\n break;\n }\n\n if (t[2]) _.ops.pop();\n\n _.trys.pop();\n\n continue;\n }\n\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n }\n\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n};\n\nimport { Dispatcher } from \"./dispatcher\";\nimport { Router } from \"./router\";\nimport { defaultSchema } from \"./schema\";\n\nvar Application =\n/** @class */\nfunction () {\n function Application(element, schema) {\n if (element === void 0) {\n element = document.documentElement;\n }\n\n if (schema === void 0) {\n schema = defaultSchema;\n }\n\n this.element = element;\n this.schema = schema;\n this.dispatcher = new Dispatcher(this);\n this.router = new Router(this);\n }\n\n Application.start = function (element, schema) {\n var application = new Application(element, schema);\n application.start();\n return application;\n };\n\n Application.prototype.start = function () {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n return [4\n /*yield*/\n , domReady()];\n\n case 1:\n _a.sent();\n\n this.router.start();\n this.dispatcher.start();\n return [2\n /*return*/\n ];\n }\n });\n });\n };\n\n Application.prototype.stop = function () {\n this.router.stop();\n this.dispatcher.stop();\n };\n\n Application.prototype.register = function (identifier, controllerConstructor) {\n this.load({\n identifier: identifier,\n controllerConstructor: controllerConstructor\n });\n };\n\n Application.prototype.load = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var definitions = Array.isArray(head) ? head : [head].concat(rest);\n definitions.forEach(function (definition) {\n return _this.router.loadDefinition(definition);\n });\n };\n\n Application.prototype.unload = function (head) {\n var _this = this;\n\n var rest = [];\n\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments[_i];\n }\n\n var identifiers = Array.isArray(head) ? head : [head].concat(rest);\n identifiers.forEach(function (identifier) {\n return _this.router.unloadIdentifier(identifier);\n });\n };\n\n Object.defineProperty(Application.prototype, \"controllers\", {\n // Controllers\n get: function get() {\n return this.router.contexts.map(function (context) {\n return context.controller;\n });\n },\n enumerable: true,\n configurable: true\n });\n\n Application.prototype.getControllerForElementAndIdentifier = function (element, identifier) {\n var context = this.router.getContextForElementAndIdentifier(element, identifier);\n return context ? context.controller : null;\n }; // Error handling\n\n\n Application.prototype.handleError = function (error, message, detail) {\n console.error(\"%s\\n\\n%o\\n\\n%o\", message, error, detail);\n };\n\n return Application;\n}();\n\nexport { Application };\n\nfunction domReady() {\n return new Promise(function (resolve) {\n if (document.readyState == \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", resolve);\n } else {\n resolve();\n }\n });\n}","/** @hidden */\nexport function defineTargetProperties(constructor) {\n var prototype = constructor.prototype;\n var targetNames = getTargetNamesForConstructor(constructor);\n targetNames.forEach(function (name) {\n var _a;\n\n return defineLinkedProperties(prototype, (_a = {}, _a[name + \"Target\"] = {\n get: function get() {\n var target = this.targets.find(name);\n\n if (target) {\n return target;\n } else {\n throw new Error(\"Missing target element \\\"\" + this.identifier + \".\" + name + \"\\\"\");\n }\n }\n }, _a[name + \"Targets\"] = {\n get: function get() {\n return this.targets.findAll(name);\n }\n }, _a[\"has\" + capitalize(name) + \"Target\"] = {\n get: function get() {\n return this.targets.has(name);\n }\n }, _a));\n });\n}\n\nfunction getTargetNamesForConstructor(constructor) {\n var ancestors = getAncestorsForConstructor(constructor);\n return Array.from(ancestors.reduce(function (targetNames, constructor) {\n getOwnTargetNamesForConstructor(constructor).forEach(function (name) {\n return targetNames.add(name);\n });\n return targetNames;\n }, new Set()));\n}\n\nfunction getAncestorsForConstructor(constructor) {\n var ancestors = [];\n\n while (constructor) {\n ancestors.push(constructor);\n constructor = Object.getPrototypeOf(constructor);\n }\n\n return ancestors;\n}\n\nfunction getOwnTargetNamesForConstructor(constructor) {\n var definition = constructor[\"targets\"];\n return Array.isArray(definition) ? definition : [];\n}\n\nfunction defineLinkedProperties(object, properties) {\n Object.keys(properties).forEach(function (name) {\n if (!(name in object)) {\n var descriptor = properties[name];\n Object.defineProperty(object, name, descriptor);\n }\n });\n}\n\nfunction capitalize(name) {\n return name.charAt(0).toUpperCase() + name.slice(1);\n}","import { defineTargetProperties } from \"./target_properties\";\n\nvar Controller =\n/** @class */\nfunction () {\n function Controller(context) {\n this.context = context;\n }\n\n Controller.bless = function () {\n defineTargetProperties(this);\n };\n\n Object.defineProperty(Controller.prototype, \"application\", {\n get: function get() {\n return this.context.application;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"scope\", {\n get: function get() {\n return this.context.scope;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"element\", {\n get: function get() {\n return this.scope.element;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"identifier\", {\n get: function get() {\n return this.scope.identifier;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"targets\", {\n get: function get() {\n return this.scope.targets;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Controller.prototype, \"data\", {\n get: function get() {\n return this.scope.data;\n },\n enumerable: true,\n configurable: true\n });\n\n Controller.prototype.initialize = function () {// Override in your subclass to set up initial controller state\n };\n\n Controller.prototype.connect = function () {// Override in your subclass to respond when the controller is connected to the DOM\n };\n\n Controller.prototype.disconnect = function () {// Override in your subclass to respond when the controller is disconnected from the DOM\n };\n\n Controller.targets = [];\n return Controller;\n}();\n\nexport { Controller };","var toObject = require('../internals/to-object');\n\nvar hasOwnProperty = {}.hasOwnProperty;\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty.call(toObject(it), key);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\n// eslint-disable-next-line es/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return $defineProperty(O, P, Attributes);\n } catch (error) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","var supported;\nvar perf;\nexport function isPerformanceSupported() {\n var _a;\n\n if (supported !== undefined) {\n return supported;\n }\n\n if (typeof window !== 'undefined' && window.performance) {\n supported = true;\n perf = window.performance;\n } else if (typeof global !== 'undefined' && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {\n supported = true;\n perf = global.perf_hooks.performance;\n } else {\n supported = false;\n }\n\n return supported;\n}\nexport function now() {\n return isPerformanceSupported() ? perf.now() : Date.now();\n}","export function getDevtoolsGlobalHook() {\n return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;\n}\nexport function getTarget() {\n // @ts-ignore\n return typeof navigator !== 'undefined' && typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : {};\n}\nexport var isProxyAvailable = typeof Proxy === 'function';","var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function (Math) {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var WordArray = C_lib.WordArray;\n var Hasher = C_lib.Hasher;\n var C_algo = C.algo; // Constants table\n\n var T = []; // Compute constants\n\n (function () {\n for (var i = 0; i < 64; i++) {\n T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0;\n }\n })();\n /**\n * MD5 hash algorithm.\n */\n\n\n var MD5 = C_algo.MD5 = Hasher.extend({\n _doReset: function _doReset() {\n this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]);\n },\n _doProcessBlock: function _doProcessBlock(M, offset) {\n // Swap endian\n for (var i = 0; i < 16; i++) {\n // Shortcuts\n var offset_i = offset + i;\n var M_offset_i = M[offset_i];\n M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00;\n } // Shortcuts\n\n\n var H = this._hash.words;\n var M_offset_0 = M[offset + 0];\n var M_offset_1 = M[offset + 1];\n var M_offset_2 = M[offset + 2];\n var M_offset_3 = M[offset + 3];\n var M_offset_4 = M[offset + 4];\n var M_offset_5 = M[offset + 5];\n var M_offset_6 = M[offset + 6];\n var M_offset_7 = M[offset + 7];\n var M_offset_8 = M[offset + 8];\n var M_offset_9 = M[offset + 9];\n var M_offset_10 = M[offset + 10];\n var M_offset_11 = M[offset + 11];\n var M_offset_12 = M[offset + 12];\n var M_offset_13 = M[offset + 13];\n var M_offset_14 = M[offset + 14];\n var M_offset_15 = M[offset + 15]; // Working varialbes\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3]; // Computation\n\n a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n a = II(a, b, c, d, M_offset_0, 6, T[48]);\n d = II(d, a, b, c, M_offset_7, 10, T[49]);\n c = II(c, d, a, b, M_offset_14, 15, T[50]);\n b = II(b, c, d, a, M_offset_5, 21, T[51]);\n a = II(a, b, c, d, M_offset_12, 6, T[52]);\n d = II(d, a, b, c, M_offset_3, 10, T[53]);\n c = II(c, d, a, b, M_offset_10, 15, T[54]);\n b = II(b, c, d, a, M_offset_1, 21, T[55]);\n a = II(a, b, c, d, M_offset_8, 6, T[56]);\n d = II(d, a, b, c, M_offset_15, 10, T[57]);\n c = II(c, d, a, b, M_offset_6, 15, T[58]);\n b = II(b, c, d, a, M_offset_13, 21, T[59]);\n a = II(a, b, c, d, M_offset_4, 6, T[60]);\n d = II(d, a, b, c, M_offset_11, 10, T[61]);\n c = II(c, d, a, b, M_offset_2, 15, T[62]);\n b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value\n\n H[0] = H[0] + a | 0;\n H[1] = H[1] + b | 0;\n H[2] = H[2] + c | 0;\n H[3] = H[3] + d | 0;\n },\n _doFinalize: function _doFinalize() {\n // Shortcuts\n var data = this._data;\n var dataWords = data.words;\n var nBitsTotal = this._nDataBytes * 8;\n var nBitsLeft = data.sigBytes * 8; // Add padding\n\n dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;\n var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n var nBitsTotalL = nBitsTotal;\n dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00;\n dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00;\n data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks\n\n this._process(); // Shortcuts\n\n\n var hash = this._hash;\n var H = hash.words; // Swap endian\n\n for (var i = 0; i < 4; i++) {\n // Shortcut\n var H_i = H[i];\n H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00;\n } // Return final computed hash\n\n\n return hash;\n },\n clone: function clone() {\n var clone = Hasher.clone.call(this);\n clone._hash = this._hash.clone();\n return clone;\n }\n });\n\n function FF(a, b, c, d, x, s, t) {\n var n = a + (b & c | ~b & d) + x + t;\n return (n << s | n >>> 32 - s) + b;\n }\n\n function GG(a, b, c, d, x, s, t) {\n var n = a + (b & d | c & ~d) + x + t;\n return (n << s | n >>> 32 - s) + b;\n }\n\n function HH(a, b, c, d, x, s, t) {\n var n = a + (b ^ c ^ d) + x + t;\n return (n << s | n >>> 32 - s) + b;\n }\n\n function II(a, b, c, d, x, s, t) {\n var n = a + (c ^ (b | ~d)) + x + t;\n return (n << s | n >>> 32 - s) + b;\n }\n /**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n * var hash = CryptoJS.MD5('message');\n * var hash = CryptoJS.MD5(wordArray);\n */\n\n\n C.MD5 = Hasher._createHelper(MD5);\n /**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n * var hmac = CryptoJS.HmacMD5(message, key);\n */\n\n C.HmacMD5 = Hasher._createHmacHelper(MD5);\n })(Math);\n\n return CryptoJS.MD5;\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var WordArray = C_lib.WordArray;\n var Hasher = C_lib.Hasher;\n var C_algo = C.algo; // Reusable object\n\n var W = [];\n /**\n * SHA-1 hash algorithm.\n */\n\n var SHA1 = C_algo.SHA1 = Hasher.extend({\n _doReset: function _doReset() {\n this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]);\n },\n _doProcessBlock: function _doProcessBlock(M, offset) {\n // Shortcut\n var H = this._hash.words; // Working variables\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4]; // Computation\n\n for (var i = 0; i < 80; i++) {\n if (i < 16) {\n W[i] = M[offset + i] | 0;\n } else {\n var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n W[i] = n << 1 | n >>> 31;\n }\n\n var t = (a << 5 | a >>> 27) + e + W[i];\n\n if (i < 20) {\n t += (b & c | ~b & d) + 0x5a827999;\n } else if (i < 40) {\n t += (b ^ c ^ d) + 0x6ed9eba1;\n } else if (i < 60) {\n t += (b & c | b & d | c & d) - 0x70e44324;\n } else\n /* if (i < 80) */\n {\n t += (b ^ c ^ d) - 0x359d3e2a;\n }\n\n e = d;\n d = c;\n c = b << 30 | b >>> 2;\n b = a;\n a = t;\n } // Intermediate hash value\n\n\n H[0] = H[0] + a | 0;\n H[1] = H[1] + b | 0;\n H[2] = H[2] + c | 0;\n H[3] = H[3] + d | 0;\n H[4] = H[4] + e | 0;\n },\n _doFinalize: function _doFinalize() {\n // Shortcuts\n var data = this._data;\n var dataWords = data.words;\n var nBitsTotal = this._nDataBytes * 8;\n var nBitsLeft = data.sigBytes * 8; // Add padding\n\n dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32;\n dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal;\n data.sigBytes = dataWords.length * 4; // Hash final blocks\n\n this._process(); // Return final computed hash\n\n\n return this._hash;\n },\n clone: function clone() {\n var clone = Hasher.clone.call(this);\n clone._hash = this._hash.clone();\n return clone;\n }\n });\n /**\n * Shortcut function to the hasher's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n *\n * @return {WordArray} The hash.\n *\n * @static\n *\n * @example\n *\n * var hash = CryptoJS.SHA1('message');\n * var hash = CryptoJS.SHA1(wordArray);\n */\n\n C.SHA1 = Hasher._createHelper(SHA1);\n /**\n * Shortcut function to the HMAC's object interface.\n *\n * @param {WordArray|string} message The message to hash.\n * @param {WordArray|string} key The secret key.\n *\n * @return {WordArray} The HMAC.\n *\n * @static\n *\n * @example\n *\n * var hmac = CryptoJS.HmacSHA1(message, key);\n */\n\n C.HmacSHA1 = Hasher._createHmacHelper(SHA1);\n })();\n\n return CryptoJS.SHA1;\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n (function () {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var Base = C_lib.Base;\n var C_enc = C.enc;\n var Utf8 = C_enc.Utf8;\n var C_algo = C.algo;\n /**\n * HMAC algorithm.\n */\n\n var HMAC = C_algo.HMAC = Base.extend({\n /**\n * Initializes a newly created HMAC.\n *\n * @param {Hasher} hasher The hash algorithm to use.\n * @param {WordArray|string} key The secret key.\n *\n * @example\n *\n * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n */\n init: function init(hasher, key) {\n // Init hasher\n hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already\n\n if (typeof key == 'string') {\n key = Utf8.parse(key);\n } // Shortcuts\n\n\n var hasherBlockSize = hasher.blockSize;\n var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys\n\n if (key.sigBytes > hasherBlockSizeBytes) {\n key = hasher.finalize(key);\n } // Clamp excess bits\n\n\n key.clamp(); // Clone key for inner and outer pads\n\n var oKey = this._oKey = key.clone();\n var iKey = this._iKey = key.clone(); // Shortcuts\n\n var oKeyWords = oKey.words;\n var iKeyWords = iKey.words; // XOR keys with pad constants\n\n for (var i = 0; i < hasherBlockSize; i++) {\n oKeyWords[i] ^= 0x5c5c5c5c;\n iKeyWords[i] ^= 0x36363636;\n }\n\n oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values\n\n this.reset();\n },\n\n /**\n * Resets this HMAC to its initial state.\n *\n * @example\n *\n * hmacHasher.reset();\n */\n reset: function reset() {\n // Shortcut\n var hasher = this._hasher; // Reset\n\n hasher.reset();\n hasher.update(this._iKey);\n },\n\n /**\n * Updates this HMAC with a message.\n *\n * @param {WordArray|string} messageUpdate The message to append.\n *\n * @return {HMAC} This HMAC instance.\n *\n * @example\n *\n * hmacHasher.update('message');\n * hmacHasher.update(wordArray);\n */\n update: function update(messageUpdate) {\n this._hasher.update(messageUpdate); // Chainable\n\n\n return this;\n },\n\n /**\n * Finalizes the HMAC computation.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} messageUpdate (Optional) A final message update.\n *\n * @return {WordArray} The HMAC.\n *\n * @example\n *\n * var hmac = hmacHasher.finalize();\n * var hmac = hmacHasher.finalize('message');\n * var hmac = hmacHasher.finalize(wordArray);\n */\n finalize: function finalize(messageUpdate) {\n // Shortcut\n var hasher = this._hasher; // Compute HMAC\n\n var innerHash = hasher.finalize(messageUpdate);\n hasher.reset();\n var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n return hmac;\n }\n });\n })();\n});","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n;\n\n(function (root, factory, undef) {\n if ((typeof exports === \"undefined\" ? \"undefined\" : _typeof(exports)) === \"object\") {\n // CommonJS\n module.exports = exports = factory(require(\"./core\"), require(\"./evpkdf\"));\n } else if (typeof define === \"function\" && define.amd) {\n // AMD\n define([\"./core\", \"./evpkdf\"], factory);\n } else {\n // Global (browser)\n factory(root.CryptoJS);\n }\n})(this, function (CryptoJS) {\n /**\n * Cipher core components.\n */\n CryptoJS.lib.Cipher || function (undefined) {\n // Shortcuts\n var C = CryptoJS;\n var C_lib = C.lib;\n var Base = C_lib.Base;\n var WordArray = C_lib.WordArray;\n var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;\n var C_enc = C.enc;\n var Utf8 = C_enc.Utf8;\n var Base64 = C_enc.Base64;\n var C_algo = C.algo;\n var EvpKDF = C_algo.EvpKDF;\n /**\n * Abstract base cipher template.\n *\n * @property {number} keySize This cipher's key size. Default: 4 (128 bits)\n * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)\n * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.\n * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.\n */\n\n var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({\n /**\n * Configuration options.\n *\n * @property {WordArray} iv The IV to use for this operation.\n */\n cfg: Base.extend(),\n\n /**\n * Creates this cipher in encryption mode.\n *\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {Cipher} A cipher instance.\n *\n * @static\n *\n * @example\n *\n * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });\n */\n createEncryptor: function createEncryptor(key, cfg) {\n return this.create(this._ENC_XFORM_MODE, key, cfg);\n },\n\n /**\n * Creates this cipher in decryption mode.\n *\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {Cipher} A cipher instance.\n *\n * @static\n *\n * @example\n *\n * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });\n */\n createDecryptor: function createDecryptor(key, cfg) {\n return this.create(this._DEC_XFORM_MODE, key, cfg);\n },\n\n /**\n * Initializes a newly created cipher.\n *\n * @param {number} xformMode Either the encryption or decryption transormation mode constant.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @example\n *\n * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });\n */\n init: function init(xformMode, key, cfg) {\n // Apply config defaults\n this.cfg = this.cfg.extend(cfg); // Store transform mode and key\n\n this._xformMode = xformMode;\n this._key = key; // Set initial values\n\n this.reset();\n },\n\n /**\n * Resets this cipher to its initial state.\n *\n * @example\n *\n * cipher.reset();\n */\n reset: function reset() {\n // Reset data buffer\n BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic\n\n this._doReset();\n },\n\n /**\n * Adds data to be encrypted or decrypted.\n *\n * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.\n *\n * @return {WordArray} The data after processing.\n *\n * @example\n *\n * var encrypted = cipher.process('data');\n * var encrypted = cipher.process(wordArray);\n */\n process: function process(dataUpdate) {\n // Append\n this._append(dataUpdate); // Process available blocks\n\n\n return this._process();\n },\n\n /**\n * Finalizes the encryption or decryption process.\n * Note that the finalize operation is effectively a destructive, read-once operation.\n *\n * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.\n *\n * @return {WordArray} The data after final processing.\n *\n * @example\n *\n * var encrypted = cipher.finalize();\n * var encrypted = cipher.finalize('data');\n * var encrypted = cipher.finalize(wordArray);\n */\n finalize: function finalize(dataUpdate) {\n // Final data update\n if (dataUpdate) {\n this._append(dataUpdate);\n } // Perform concrete-cipher logic\n\n\n var finalProcessedData = this._doFinalize();\n\n return finalProcessedData;\n },\n keySize: 128 / 32,\n ivSize: 128 / 32,\n _ENC_XFORM_MODE: 1,\n _DEC_XFORM_MODE: 2,\n\n /**\n * Creates shortcut functions to a cipher's object interface.\n *\n * @param {Cipher} cipher The cipher to create a helper for.\n *\n * @return {Object} An object with encrypt and decrypt shortcut functions.\n *\n * @static\n *\n * @example\n *\n * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);\n */\n _createHelper: function () {\n function selectCipherStrategy(key) {\n if (typeof key == 'string') {\n return PasswordBasedCipher;\n } else {\n return SerializableCipher;\n }\n }\n\n return function (cipher) {\n return {\n encrypt: function encrypt(message, key, cfg) {\n return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);\n },\n decrypt: function decrypt(ciphertext, key, cfg) {\n return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);\n }\n };\n };\n }()\n });\n /**\n * Abstract base stream cipher template.\n *\n * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)\n */\n\n var StreamCipher = C_lib.StreamCipher = Cipher.extend({\n _doFinalize: function _doFinalize() {\n // Process partial blocks\n var finalProcessedBlocks = this._process(!!'flush');\n\n return finalProcessedBlocks;\n },\n blockSize: 1\n });\n /**\n * Mode namespace.\n */\n\n var C_mode = C.mode = {};\n /**\n * Abstract base block cipher mode template.\n */\n\n var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({\n /**\n * Creates this mode for encryption.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @static\n *\n * @example\n *\n * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);\n */\n createEncryptor: function createEncryptor(cipher, iv) {\n return this.Encryptor.create(cipher, iv);\n },\n\n /**\n * Creates this mode for decryption.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @static\n *\n * @example\n *\n * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);\n */\n createDecryptor: function createDecryptor(cipher, iv) {\n return this.Decryptor.create(cipher, iv);\n },\n\n /**\n * Initializes a newly created mode.\n *\n * @param {Cipher} cipher A block cipher instance.\n * @param {Array} iv The IV words.\n *\n * @example\n *\n * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);\n */\n init: function init(cipher, iv) {\n this._cipher = cipher;\n this._iv = iv;\n }\n });\n /**\n * Cipher Block Chaining mode.\n */\n\n var CBC = C_mode.CBC = function () {\n /**\n * Abstract base CBC mode.\n */\n var CBC = BlockCipherMode.extend();\n /**\n * CBC encryptor.\n */\n\n CBC.Encryptor = CBC.extend({\n /**\n * Processes the data block at offset.\n *\n * @param {Array} words The data words to operate on.\n * @param {number} offset The offset where the block starts.\n *\n * @example\n *\n * mode.processBlock(data.words, offset);\n */\n processBlock: function processBlock(words, offset) {\n // Shortcuts\n var cipher = this._cipher;\n var blockSize = cipher.blockSize; // XOR and encrypt\n\n xorBlock.call(this, words, offset, blockSize);\n cipher.encryptBlock(words, offset); // Remember this block to use with next block\n\n this._prevBlock = words.slice(offset, offset + blockSize);\n }\n });\n /**\n * CBC decryptor.\n */\n\n CBC.Decryptor = CBC.extend({\n /**\n * Processes the data block at offset.\n *\n * @param {Array} words The data words to operate on.\n * @param {number} offset The offset where the block starts.\n *\n * @example\n *\n * mode.processBlock(data.words, offset);\n */\n processBlock: function processBlock(words, offset) {\n // Shortcuts\n var cipher = this._cipher;\n var blockSize = cipher.blockSize; // Remember this block to use with next block\n\n var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR\n\n cipher.decryptBlock(words, offset);\n xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block\n\n this._prevBlock = thisBlock;\n }\n });\n\n function xorBlock(words, offset, blockSize) {\n var block; // Shortcut\n\n var iv = this._iv; // Choose mixing block\n\n if (iv) {\n block = iv; // Remove IV for subsequent blocks\n\n this._iv = undefined;\n } else {\n block = this._prevBlock;\n } // XOR blocks\n\n\n for (var i = 0; i < blockSize; i++) {\n words[offset + i] ^= block[i];\n }\n }\n\n return CBC;\n }();\n /**\n * Padding namespace.\n */\n\n\n var C_pad = C.pad = {};\n /**\n * PKCS #5/7 padding strategy.\n */\n\n var Pkcs7 = C_pad.Pkcs7 = {\n /**\n * Pads data using the algorithm defined in PKCS #5/7.\n *\n * @param {WordArray} data The data to pad.\n * @param {number} blockSize The multiple that the data should be padded to.\n *\n * @static\n *\n * @example\n *\n * CryptoJS.pad.Pkcs7.pad(wordArray, 4);\n */\n pad: function pad(data, blockSize) {\n // Shortcut\n var blockSizeBytes = blockSize * 4; // Count padding bytes\n\n var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word\n\n var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding\n\n var paddingWords = [];\n\n for (var i = 0; i < nPaddingBytes; i += 4) {\n paddingWords.push(paddingWord);\n }\n\n var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding\n\n data.concat(padding);\n },\n\n /**\n * Unpads data that had been padded using the algorithm defined in PKCS #5/7.\n *\n * @param {WordArray} data The data to unpad.\n *\n * @static\n *\n * @example\n *\n * CryptoJS.pad.Pkcs7.unpad(wordArray);\n */\n unpad: function unpad(data) {\n // Get number of padding bytes from last byte\n var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding\n\n data.sigBytes -= nPaddingBytes;\n }\n };\n /**\n * Abstract base block cipher template.\n *\n * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)\n */\n\n var BlockCipher = C_lib.BlockCipher = Cipher.extend({\n /**\n * Configuration options.\n *\n * @property {Mode} mode The block mode to use. Default: CBC\n * @property {Padding} padding The padding strategy to use. Default: Pkcs7\n */\n cfg: Cipher.cfg.extend({\n mode: CBC,\n padding: Pkcs7\n }),\n reset: function reset() {\n var modeCreator; // Reset cipher\n\n Cipher.reset.call(this); // Shortcuts\n\n var cfg = this.cfg;\n var iv = cfg.iv;\n var mode = cfg.mode; // Reset block mode\n\n if (this._xformMode == this._ENC_XFORM_MODE) {\n modeCreator = mode.createEncryptor;\n } else\n /* if (this._xformMode == this._DEC_XFORM_MODE) */\n {\n modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding\n\n this._minBufferSize = 1;\n }\n\n if (this._mode && this._mode.__creator == modeCreator) {\n this._mode.init(this, iv && iv.words);\n } else {\n this._mode = modeCreator.call(mode, this, iv && iv.words);\n this._mode.__creator = modeCreator;\n }\n },\n _doProcessBlock: function _doProcessBlock(words, offset) {\n this._mode.processBlock(words, offset);\n },\n _doFinalize: function _doFinalize() {\n var finalProcessedBlocks; // Shortcut\n\n var padding = this.cfg.padding; // Finalize\n\n if (this._xformMode == this._ENC_XFORM_MODE) {\n // Pad data\n padding.pad(this._data, this.blockSize); // Process final blocks\n\n finalProcessedBlocks = this._process(!!'flush');\n } else\n /* if (this._xformMode == this._DEC_XFORM_MODE) */\n {\n // Process final blocks\n finalProcessedBlocks = this._process(!!'flush'); // Unpad data\n\n padding.unpad(finalProcessedBlocks);\n }\n\n return finalProcessedBlocks;\n },\n blockSize: 128 / 32\n });\n /**\n * A collection of cipher parameters.\n *\n * @property {WordArray} ciphertext The raw ciphertext.\n * @property {WordArray} key The key to this ciphertext.\n * @property {WordArray} iv The IV used in the ciphering operation.\n * @property {WordArray} salt The salt used with a key derivation function.\n * @property {Cipher} algorithm The cipher algorithm.\n * @property {Mode} mode The block mode used in the ciphering operation.\n * @property {Padding} padding The padding scheme used in the ciphering operation.\n * @property {number} blockSize The block size of the cipher.\n * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.\n */\n\n var CipherParams = C_lib.CipherParams = Base.extend({\n /**\n * Initializes a newly created cipher params object.\n *\n * @param {Object} cipherParams An object with any of the possible cipher parameters.\n *\n * @example\n *\n * var cipherParams = CryptoJS.lib.CipherParams.create({\n * ciphertext: ciphertextWordArray,\n * key: keyWordArray,\n * iv: ivWordArray,\n * salt: saltWordArray,\n * algorithm: CryptoJS.algo.AES,\n * mode: CryptoJS.mode.CBC,\n * padding: CryptoJS.pad.PKCS7,\n * blockSize: 4,\n * formatter: CryptoJS.format.OpenSSL\n * });\n */\n init: function init(cipherParams) {\n this.mixIn(cipherParams);\n },\n\n /**\n * Converts this cipher params object to a string.\n *\n * @param {Format} formatter (Optional) The formatting strategy to use.\n *\n * @return {string} The stringified cipher params.\n *\n * @throws Error If neither the formatter nor the default formatter is set.\n *\n * @example\n *\n * var string = cipherParams + '';\n * var string = cipherParams.toString();\n * var string = cipherParams.toString(CryptoJS.format.OpenSSL);\n */\n toString: function toString(formatter) {\n return (formatter || this.formatter).stringify(this);\n }\n });\n /**\n * Format namespace.\n */\n\n var C_format = C.format = {};\n /**\n * OpenSSL formatting strategy.\n */\n\n var OpenSSLFormatter = C_format.OpenSSL = {\n /**\n * Converts a cipher params object to an OpenSSL-compatible string.\n *\n * @param {CipherParams} cipherParams The cipher params object.\n *\n * @return {string} The OpenSSL-compatible string.\n *\n * @static\n *\n * @example\n *\n * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);\n */\n stringify: function stringify(cipherParams) {\n var wordArray; // Shortcuts\n\n var ciphertext = cipherParams.ciphertext;\n var salt = cipherParams.salt; // Format\n\n if (salt) {\n wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);\n } else {\n wordArray = ciphertext;\n }\n\n return wordArray.toString(Base64);\n },\n\n /**\n * Converts an OpenSSL-compatible string to a cipher params object.\n *\n * @param {string} openSSLStr The OpenSSL-compatible string.\n *\n * @return {CipherParams} The cipher params object.\n *\n * @static\n *\n * @example\n *\n * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);\n */\n parse: function parse(openSSLStr) {\n var salt; // Parse base64\n\n var ciphertext = Base64.parse(openSSLStr); // Shortcut\n\n var ciphertextWords = ciphertext.words; // Test for salt\n\n if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {\n // Extract salt\n salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext\n\n ciphertextWords.splice(0, 4);\n ciphertext.sigBytes -= 16;\n }\n\n return CipherParams.create({\n ciphertext: ciphertext,\n salt: salt\n });\n }\n };\n /**\n * A cipher wrapper that returns ciphertext as a serializable cipher params object.\n */\n\n var SerializableCipher = C_lib.SerializableCipher = Base.extend({\n /**\n * Configuration options.\n *\n * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL\n */\n cfg: Base.extend({\n format: OpenSSLFormatter\n }),\n\n /**\n * Encrypts a message.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {WordArray|string} message The message to encrypt.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {CipherParams} A cipher params object.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);\n * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });\n * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n */\n encrypt: function encrypt(cipher, message, key, cfg) {\n // Apply config defaults\n cfg = this.cfg.extend(cfg); // Encrypt\n\n var encryptor = cipher.createEncryptor(key, cfg);\n var ciphertext = encryptor.finalize(message); // Shortcut\n\n var cipherCfg = encryptor.cfg; // Create and return serializable cipher params\n\n return CipherParams.create({\n ciphertext: ciphertext,\n key: key,\n iv: cipherCfg.iv,\n algorithm: cipher,\n mode: cipherCfg.mode,\n padding: cipherCfg.padding,\n blockSize: cipher.blockSize,\n formatter: cfg.format\n });\n },\n\n /**\n * Decrypts serialized ciphertext.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n * @param {WordArray} key The key.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {WordArray} The plaintext.\n *\n * @static\n *\n * @example\n *\n * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n */\n decrypt: function decrypt(cipher, ciphertext, key, cfg) {\n // Apply config defaults\n cfg = this.cfg.extend(cfg); // Convert string to CipherParams\n\n ciphertext = this._parse(ciphertext, cfg.format); // Decrypt\n\n var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);\n return plaintext;\n },\n\n /**\n * Converts serialized ciphertext to CipherParams,\n * else assumed CipherParams already and returns ciphertext unchanged.\n *\n * @param {CipherParams|string} ciphertext The ciphertext.\n * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.\n *\n * @return {CipherParams} The unserialized ciphertext.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);\n */\n _parse: function _parse(ciphertext, format) {\n if (typeof ciphertext == 'string') {\n return format.parse(ciphertext, this);\n } else {\n return ciphertext;\n }\n }\n });\n /**\n * Key derivation function namespace.\n */\n\n var C_kdf = C.kdf = {};\n /**\n * OpenSSL key derivation function.\n */\n\n var OpenSSLKdf = C_kdf.OpenSSL = {\n /**\n * Derives a key and IV from a password.\n *\n * @param {string} password The password to derive from.\n * @param {number} keySize The size in words of the key to generate.\n * @param {number} ivSize The size in words of the IV to generate.\n * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.\n *\n * @return {CipherParams} A cipher params object with the key, IV, and salt.\n *\n * @static\n *\n * @example\n *\n * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);\n * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');\n */\n execute: function execute(password, keySize, ivSize, salt) {\n // Generate random salt\n if (!salt) {\n salt = WordArray.random(64 / 8);\n } // Derive key and IV\n\n\n var key = EvpKDF.create({\n keySize: keySize + ivSize\n }).compute(password, salt); // Separate key and IV\n\n var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);\n key.sigBytes = keySize * 4; // Return params\n\n return CipherParams.create({\n key: key,\n iv: iv,\n salt: salt\n });\n }\n };\n /**\n * A serializable cipher wrapper that derives the key from a password,\n * and returns ciphertext as a serializable cipher params object.\n */\n\n var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({\n /**\n * Configuration options.\n *\n * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL\n */\n cfg: SerializableCipher.cfg.extend({\n kdf: OpenSSLKdf\n }),\n\n /**\n * Encrypts a message using a password.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {WordArray|string} message The message to encrypt.\n * @param {string} password The password.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {CipherParams} A cipher params object.\n *\n * @static\n *\n * @example\n *\n * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');\n * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });\n */\n encrypt: function encrypt(cipher, message, password, cfg) {\n // Apply config defaults\n cfg = this.cfg.extend(cfg); // Derive key and other params\n\n var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config\n\n cfg.iv = derivedParams.iv; // Encrypt\n\n var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params\n\n ciphertext.mixIn(derivedParams);\n return ciphertext;\n },\n\n /**\n * Decrypts serialized ciphertext using a password.\n *\n * @param {Cipher} cipher The cipher algorithm to use.\n * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n * @param {string} password The password.\n * @param {Object} cfg (Optional) The configuration options to use for this operation.\n *\n * @return {WordArray} The plaintext.\n *\n * @static\n *\n * @example\n *\n * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });\n * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });\n */\n decrypt: function decrypt(cipher, ciphertext, password, cfg) {\n // Apply config defaults\n cfg = this.cfg.extend(cfg); // Convert string to CipherParams\n\n ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params\n\n var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config\n\n cfg.iv = derivedParams.iv; // Decrypt\n\n var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);\n return plaintext;\n }\n });\n }();\n});","'use strict';\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar Transform = require('readable-stream').Transform;\n\nvar inherits = require('inherits');\n\nfunction throwIfNotStringOrBuffer(val, prefix) {\n if (!Buffer.isBuffer(val) && typeof val !== 'string') {\n throw new TypeError(prefix + ' must be a string or a buffer');\n }\n}\n\nfunction HashBase(blockSize) {\n Transform.call(this);\n this._block = Buffer.allocUnsafe(blockSize);\n this._blockSize = blockSize;\n this._blockOffset = 0;\n this._length = [0, 0, 0, 0];\n this._finalized = false;\n}\n\ninherits(HashBase, Transform);\n\nHashBase.prototype._transform = function (chunk, encoding, callback) {\n var error = null;\n\n try {\n this.update(chunk, encoding);\n } catch (err) {\n error = err;\n }\n\n callback(error);\n};\n\nHashBase.prototype._flush = function (callback) {\n var error = null;\n\n try {\n this.push(this.digest());\n } catch (err) {\n error = err;\n }\n\n callback(error);\n};\n\nHashBase.prototype.update = function (data, encoding) {\n throwIfNotStringOrBuffer(data, 'Data');\n if (this._finalized) throw new Error('Digest already called');\n if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding); // consume data\n\n var block = this._block;\n var offset = 0;\n\n while (this._blockOffset + data.length - offset >= this._blockSize) {\n for (var i = this._blockOffset; i < this._blockSize;) {\n block[i++] = data[offset++];\n }\n\n this._update();\n\n this._blockOffset = 0;\n }\n\n while (offset < data.length) {\n block[this._blockOffset++] = data[offset++];\n } // update length\n\n\n for (var j = 0, carry = data.length * 8; carry > 0; ++j) {\n this._length[j] += carry;\n carry = this._length[j] / 0x0100000000 | 0;\n if (carry > 0) this._length[j] -= 0x0100000000 * carry;\n }\n\n return this;\n};\n\nHashBase.prototype._update = function () {\n throw new Error('_update is not implemented');\n};\n\nHashBase.prototype.digest = function (encoding) {\n if (this._finalized) throw new Error('Digest already called');\n this._finalized = true;\n\n var digest = this._digest();\n\n if (encoding !== undefined) digest = digest.toString(encoding); // reset state\n\n this._block.fill(0);\n\n this._blockOffset = 0;\n\n for (var i = 0; i < 4; ++i) {\n this._length[i] = 0;\n }\n\n return digest;\n};\n\nHashBase.prototype._digest = function () {\n throw new Error('_digest is not implemented');\n};\n\nmodule.exports = HashBase;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","module.exports = require('events').EventEmitter;","'use strict'; // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\nvar inherits = require('inherits');\n\nvar Hash = require('./hash');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar K = [0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2];\nvar W = new Array(64);\n\nfunction Sha256() {\n this.init();\n this._w = W; // new Array(64)\n\n Hash.call(this, 64, 56);\n}\n\ninherits(Sha256, Hash);\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667;\n this._b = 0xbb67ae85;\n this._c = 0x3c6ef372;\n this._d = 0xa54ff53a;\n this._e = 0x510e527f;\n this._f = 0x9b05688c;\n this._g = 0x1f83d9ab;\n this._h = 0x5be0cd19;\n return this;\n};\n\nfunction ch(x, y, z) {\n return z ^ x & (y ^ z);\n}\n\nfunction maj(x, y, z) {\n return x & y | z & (x | y);\n}\n\nfunction sigma0(x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);\n}\n\nfunction sigma1(x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);\n}\n\nfunction gamma0(x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;\n}\n\nfunction gamma1(x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10;\n}\n\nSha256.prototype._update = function (M) {\n var W = this._w;\n var a = this._a | 0;\n var b = this._b | 0;\n var c = this._c | 0;\n var d = this._d | 0;\n var e = this._e | 0;\n var f = this._f | 0;\n var g = this._g | 0;\n var h = this._h | 0;\n\n for (var i = 0; i < 16; ++i) {\n W[i] = M.readInt32BE(i * 4);\n }\n\n for (; i < 64; ++i) {\n W[i] = gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16] | 0;\n }\n\n for (var j = 0; j < 64; ++j) {\n var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W[j] | 0;\n var T2 = sigma0(a) + maj(a, b, c) | 0;\n h = g;\n g = f;\n f = e;\n e = d + T1 | 0;\n d = c;\n c = b;\n b = a;\n a = T1 + T2 | 0;\n }\n\n this._a = a + this._a | 0;\n this._b = b + this._b | 0;\n this._c = c + this._c | 0;\n this._d = d + this._d | 0;\n this._e = e + this._e | 0;\n this._f = f + this._f | 0;\n this._g = g + this._g | 0;\n this._h = h + this._h | 0;\n};\n\nSha256.prototype._hash = function () {\n var H = Buffer.allocUnsafe(32);\n H.writeInt32BE(this._a, 0);\n H.writeInt32BE(this._b, 4);\n H.writeInt32BE(this._c, 8);\n H.writeInt32BE(this._d, 12);\n H.writeInt32BE(this._e, 16);\n H.writeInt32BE(this._f, 20);\n H.writeInt32BE(this._g, 24);\n H.writeInt32BE(this._h, 28);\n return H;\n};\n\nmodule.exports = Sha256;","var inherits = require('inherits');\n\nvar Hash = require('./hash');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar K = [0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817];\nvar W = new Array(160);\n\nfunction Sha512() {\n this.init();\n this._w = W;\n Hash.call(this, 128, 112);\n}\n\ninherits(Sha512, Hash);\n\nSha512.prototype.init = function () {\n this._ah = 0x6a09e667;\n this._bh = 0xbb67ae85;\n this._ch = 0x3c6ef372;\n this._dh = 0xa54ff53a;\n this._eh = 0x510e527f;\n this._fh = 0x9b05688c;\n this._gh = 0x1f83d9ab;\n this._hh = 0x5be0cd19;\n this._al = 0xf3bcc908;\n this._bl = 0x84caa73b;\n this._cl = 0xfe94f82b;\n this._dl = 0x5f1d36f1;\n this._el = 0xade682d1;\n this._fl = 0x2b3e6c1f;\n this._gl = 0xfb41bd6b;\n this._hl = 0x137e2179;\n return this;\n};\n\nfunction Ch(x, y, z) {\n return z ^ x & (y ^ z);\n}\n\nfunction maj(x, y, z) {\n return x & y | z & (x | y);\n}\n\nfunction sigma0(x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);\n}\n\nfunction sigma1(x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);\n}\n\nfunction Gamma0(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;\n}\n\nfunction Gamma0l(x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);\n}\n\nfunction Gamma1(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;\n}\n\nfunction Gamma1l(x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);\n}\n\nfunction getCarry(a, b) {\n return a >>> 0 < b >>> 0 ? 1 : 0;\n}\n\nSha512.prototype._update = function (M) {\n var W = this._w;\n var ah = this._ah | 0;\n var bh = this._bh | 0;\n var ch = this._ch | 0;\n var dh = this._dh | 0;\n var eh = this._eh | 0;\n var fh = this._fh | 0;\n var gh = this._gh | 0;\n var hh = this._hh | 0;\n var al = this._al | 0;\n var bl = this._bl | 0;\n var cl = this._cl | 0;\n var dl = this._dl | 0;\n var el = this._el | 0;\n var fl = this._fl | 0;\n var gl = this._gl | 0;\n var hl = this._hl | 0;\n\n for (var i = 0; i < 32; i += 2) {\n W[i] = M.readInt32BE(i * 4);\n W[i + 1] = M.readInt32BE(i * 4 + 4);\n }\n\n for (; i < 160; i += 2) {\n var xh = W[i - 15 * 2];\n var xl = W[i - 15 * 2 + 1];\n var gamma0 = Gamma0(xh, xl);\n var gamma0l = Gamma0l(xl, xh);\n xh = W[i - 2 * 2];\n xl = W[i - 2 * 2 + 1];\n var gamma1 = Gamma1(xh, xl);\n var gamma1l = Gamma1l(xl, xh); // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n\n var Wi7h = W[i - 7 * 2];\n var Wi7l = W[i - 7 * 2 + 1];\n var Wi16h = W[i - 16 * 2];\n var Wi16l = W[i - 16 * 2 + 1];\n var Wil = gamma0l + Wi7l | 0;\n var Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;\n Wil = Wil + gamma1l | 0;\n Wih = Wih + gamma1 + getCarry(Wil, gamma1l) | 0;\n Wil = Wil + Wi16l | 0;\n Wih = Wih + Wi16h + getCarry(Wil, Wi16l) | 0;\n W[i] = Wih;\n W[i + 1] = Wil;\n }\n\n for (var j = 0; j < 160; j += 2) {\n Wih = W[j];\n Wil = W[j + 1];\n var majh = maj(ah, bh, ch);\n var majl = maj(al, bl, cl);\n var sigma0h = sigma0(ah, al);\n var sigma0l = sigma0(al, ah);\n var sigma1h = sigma1(eh, el);\n var sigma1l = sigma1(el, eh); // t1 = h + sigma1 + ch + K[j] + W[j]\n\n var Kih = K[j];\n var Kil = K[j + 1];\n var chh = Ch(eh, fh, gh);\n var chl = Ch(el, fl, gl);\n var t1l = hl + sigma1l | 0;\n var t1h = hh + sigma1h + getCarry(t1l, hl) | 0;\n t1l = t1l + chl | 0;\n t1h = t1h + chh + getCarry(t1l, chl) | 0;\n t1l = t1l + Kil | 0;\n t1h = t1h + Kih + getCarry(t1l, Kil) | 0;\n t1l = t1l + Wil | 0;\n t1h = t1h + Wih + getCarry(t1l, Wil) | 0; // t2 = sigma0 + maj\n\n var t2l = sigma0l + majl | 0;\n var t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;\n hh = gh;\n hl = gl;\n gh = fh;\n gl = fl;\n fh = eh;\n fl = el;\n el = dl + t1l | 0;\n eh = dh + t1h + getCarry(el, dl) | 0;\n dh = ch;\n dl = cl;\n ch = bh;\n cl = bl;\n bh = ah;\n bl = al;\n al = t1l + t2l | 0;\n ah = t1h + t2h + getCarry(al, t1l) | 0;\n }\n\n this._al = this._al + al | 0;\n this._bl = this._bl + bl | 0;\n this._cl = this._cl + cl | 0;\n this._dl = this._dl + dl | 0;\n this._el = this._el + el | 0;\n this._fl = this._fl + fl | 0;\n this._gl = this._gl + gl | 0;\n this._hl = this._hl + hl | 0;\n this._ah = this._ah + ah + getCarry(this._al, al) | 0;\n this._bh = this._bh + bh + getCarry(this._bl, bl) | 0;\n this._ch = this._ch + ch + getCarry(this._cl, cl) | 0;\n this._dh = this._dh + dh + getCarry(this._dl, dl) | 0;\n this._eh = this._eh + eh + getCarry(this._el, el) | 0;\n this._fh = this._fh + fh + getCarry(this._fl, fl) | 0;\n this._gh = this._gh + gh + getCarry(this._gl, gl) | 0;\n this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;\n};\n\nSha512.prototype._hash = function () {\n var H = Buffer.allocUnsafe(64);\n\n function writeInt64BE(h, l, offset) {\n H.writeInt32BE(h, offset);\n H.writeInt32BE(l, offset + 4);\n }\n\n writeInt64BE(this._ah, this._al, 0);\n writeInt64BE(this._bh, this._bl, 8);\n writeInt64BE(this._ch, this._cl, 16);\n writeInt64BE(this._dh, this._dl, 24);\n writeInt64BE(this._eh, this._el, 32);\n writeInt64BE(this._fh, this._fl, 40);\n writeInt64BE(this._gh, this._gl, 48);\n writeInt64BE(this._hh, this._hl, 56);\n return H;\n};\n\nmodule.exports = Sha512;","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n\nmodule.exports = Readable;\n/**/\n\nvar isArray = require('isarray');\n/**/\n\n/**/\n\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n/**/\n\n\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\n\nvar debugUtil = require('util');\n\nvar debug = void 0;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/BufferList');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar StringDecoder;\nutil.inherits(Readable, Stream);\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n var isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; // cast to ints.\n\n this.highWaterMark = Math.floor(this.highWaterMark); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options);\n this._readableState = new ReadableState(options, this); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n\n return er;\n} // if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\n\n\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n}; // Don't raise the hwm > 8MB\n\n\nvar MAX_HWM = 0x800000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true; // emit 'readable' now to make sure it gets picked up.\n\n emitReadable(stream);\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n } // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n\n\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {}\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList; // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n return ret;\n} // Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n\n return ret;\n} // Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n} // Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n\n break;\n }\n\n ++c;\n }\n\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState; // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","module.exports = require('events').EventEmitter;","'use strict';\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n// undocumented cb() API, needed for core, not for public API\n\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n/**/\n\n\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n return stream.push(null);\n}","'use strict';\n\nvar inherits = require('inherits');\n\nvar Legacy = require('./legacy');\n\nvar Base = require('cipher-base');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar md5 = require('create-hash/md5');\n\nvar RIPEMD160 = require('ripemd160');\n\nvar sha = require('sha.js');\n\nvar ZEROS = Buffer.alloc(128);\n\nfunction Hmac(alg, key) {\n Base.call(this, 'digest');\n\n if (typeof key === 'string') {\n key = Buffer.from(key);\n }\n\n var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64;\n this._alg = alg;\n this._key = key;\n\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);\n key = hash.update(key).digest();\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize);\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize);\n var opad = this._opad = Buffer.allocUnsafe(blocksize);\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36;\n opad[i] = key[i] ^ 0x5C;\n }\n\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg);\n\n this._hash.update(ipad);\n}\n\ninherits(Hmac, Base);\n\nHmac.prototype._update = function (data) {\n this._hash.update(data);\n};\n\nHmac.prototype._final = function () {\n var h = this._hash.digest();\n\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg);\n return hash.update(this._opad).update(h).digest();\n};\n\nmodule.exports = function createHmac(alg, key) {\n alg = alg.toLowerCase();\n\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key);\n }\n\n if (alg === 'md5') {\n return new Legacy(md5, key);\n }\n\n return new Hmac(alg, key);\n};","var MD5 = require('md5.js');\n\nmodule.exports = function (buffer) {\n return new MD5().update(buffer).digest();\n};","exports.pbkdf2 = require('./lib/async');\nexports.pbkdf2Sync = require('./lib/sync');","var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs\n\nmodule.exports = function (iterations, keylen) {\n if (typeof iterations !== 'number') {\n throw new TypeError('Iterations not a number');\n }\n\n if (iterations < 0) {\n throw new TypeError('Bad iterations');\n }\n\n if (typeof keylen !== 'number') {\n throw new TypeError('Key length not a number');\n }\n\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) {\n /* eslint no-self-compare: 0 */\n throw new TypeError('Bad key length');\n }\n};","var defaultEncoding;\n/* istanbul ignore next */\n\nif (global.process && global.process.browser) {\n defaultEncoding = 'utf-8';\n} else if (global.process && global.process.version) {\n var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10);\n defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary';\n} else {\n defaultEncoding = 'utf-8';\n}\n\nmodule.exports = defaultEncoding;","var md5 = require('create-hash/md5');\n\nvar RIPEMD160 = require('ripemd160');\n\nvar sha = require('sha.js');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar checkParameters = require('./precondition');\n\nvar defaultEncoding = require('./default-encoding');\n\nvar toBuffer = require('./to-buffer');\n\nvar ZEROS = Buffer.alloc(128);\nvar sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n};\n\nfunction Hmac(alg, key, saltLen) {\n var hash = getDigest(alg);\n var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64;\n\n if (key.length > blocksize) {\n key = hash(key);\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize);\n }\n\n var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]);\n var opad = Buffer.allocUnsafe(blocksize + sizes[alg]);\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36;\n opad[i] = key[i] ^ 0x5C;\n }\n\n var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4);\n ipad.copy(ipad1, 0, 0, blocksize);\n this.ipad1 = ipad1;\n this.ipad2 = ipad;\n this.opad = opad;\n this.alg = alg;\n this.blocksize = blocksize;\n this.hash = hash;\n this.size = sizes[alg];\n}\n\nHmac.prototype.run = function (data, ipad) {\n data.copy(ipad, this.blocksize);\n var h = this.hash(ipad);\n h.copy(this.opad, this.blocksize);\n return this.hash(this.opad);\n};\n\nfunction getDigest(alg) {\n function shaFunc(data) {\n return sha(alg).update(data).digest();\n }\n\n function rmd160Func(data) {\n return new RIPEMD160().update(data).digest();\n }\n\n if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func;\n if (alg === 'md5') return md5;\n return shaFunc;\n}\n\nfunction pbkdf2(password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen);\n password = toBuffer(password, defaultEncoding, 'Password');\n salt = toBuffer(salt, defaultEncoding, 'Salt');\n digest = digest || 'sha1';\n var hmac = new Hmac(digest, password, salt.length);\n var DK = Buffer.allocUnsafe(keylen);\n var block1 = Buffer.allocUnsafe(salt.length + 4);\n salt.copy(block1, 0, 0, salt.length);\n var destPos = 0;\n var hLen = sizes[digest];\n var l = Math.ceil(keylen / hLen);\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length);\n var T = hmac.run(block1, hmac.ipad1);\n var U = T;\n\n for (var j = 1; j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2);\n\n for (var k = 0; k < hLen; k++) {\n T[k] ^= U[k];\n }\n }\n\n T.copy(DK, destPos);\n destPos += hLen;\n }\n\n return DK;\n}\n\nmodule.exports = pbkdf2;","var Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = function (thing, encoding, name) {\n if (Buffer.isBuffer(thing)) {\n return thing;\n } else if (typeof thing === 'string') {\n return Buffer.from(thing, encoding);\n } else if (ArrayBuffer.isView(thing)) {\n return Buffer.from(thing.buffer);\n } else {\n throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView');\n }\n};","'use strict';\n\nexports.readUInt32BE = function readUInt32BE(bytes, off) {\n var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off];\n return res >>> 0;\n};\n\nexports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {\n bytes[0 + off] = value >>> 24;\n bytes[1 + off] = value >>> 16 & 0xff;\n bytes[2 + off] = value >>> 8 & 0xff;\n bytes[3 + off] = value & 0xff;\n};\n\nexports.ip = function ip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= inR >>> j + i & 1;\n }\n\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= inL >>> j + i & 1;\n }\n }\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= inR >>> j + i & 1;\n }\n\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= inL >>> j + i & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.rip = function rip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 0; i < 4; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outL <<= 1;\n outL |= inR >>> j + i & 1;\n outL <<= 1;\n outL |= inL >>> j + i & 1;\n }\n }\n\n for (var i = 4; i < 8; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outR <<= 1;\n outR |= inR >>> j + i & 1;\n outR <<= 1;\n outR |= inL >>> j + i & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.pc1 = function pc1(inL, inR, out, off) {\n var outL = 0;\n var outR = 0; // 7, 15, 23, 31, 39, 47, 55, 63\n // 6, 14, 22, 30, 39, 47, 55, 63\n // 5, 13, 21, 29, 39, 47, 55, 63\n // 4, 12, 20, 28\n\n for (var i = 7; i >= 5; i--) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= inR >> j + i & 1;\n }\n\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= inL >> j + i & 1;\n }\n }\n\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= inR >> j + i & 1;\n } // 1, 9, 17, 25, 33, 41, 49, 57\n // 2, 10, 18, 26, 34, 42, 50, 58\n // 3, 11, 19, 27, 35, 43, 51, 59\n // 36, 44, 52, 60\n\n\n for (var i = 1; i <= 3; i++) {\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= inR >> j + i & 1;\n }\n\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= inL >> j + i & 1;\n }\n }\n\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= inL >> j + i & 1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.r28shl = function r28shl(num, shift) {\n return num << shift & 0xfffffff | num >>> 28 - shift;\n};\n\nvar pc2table = [// inL => outL\n14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, // inR => outR\n15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24];\n\nexports.pc2 = function pc2(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n var len = pc2table.length >>> 1;\n\n for (var i = 0; i < len; i++) {\n outL <<= 1;\n outL |= inL >>> pc2table[i] & 0x1;\n }\n\n for (var i = len; i < pc2table.length; i++) {\n outR <<= 1;\n outR |= inR >>> pc2table[i] & 0x1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.expand = function expand(r, out, off) {\n var outL = 0;\n var outR = 0;\n outL = (r & 1) << 5 | r >>> 27;\n\n for (var i = 23; i >= 15; i -= 4) {\n outL <<= 6;\n outL |= r >>> i & 0x3f;\n }\n\n for (var i = 11; i >= 3; i -= 4) {\n outR |= r >>> i & 0x3f;\n outR <<= 6;\n }\n\n outR |= (r & 0x1f) << 1 | r >>> 31;\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nvar sTable = [14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11];\n\nexports.substitute = function substitute(inL, inR) {\n var out = 0;\n\n for (var i = 0; i < 4; i++) {\n var b = inL >>> 18 - i * 6 & 0x3f;\n var sb = sTable[i * 0x40 + b];\n out <<= 4;\n out |= sb;\n }\n\n for (var i = 0; i < 4; i++) {\n var b = inR >>> 18 - i * 6 & 0x3f;\n var sb = sTable[4 * 0x40 + i * 0x40 + b];\n out <<= 4;\n out |= sb;\n }\n\n return out >>> 0;\n};\n\nvar permuteTable = [16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7];\n\nexports.permute = function permute(num) {\n var out = 0;\n\n for (var i = 0; i < permuteTable.length; i++) {\n out <<= 1;\n out |= num >>> permuteTable[i] & 0x1;\n }\n\n return out >>> 0;\n};\n\nexports.padSplit = function padSplit(num, size, group) {\n var str = num.toString(2);\n\n while (str.length < size) {\n str = '0' + str;\n }\n\n var out = [];\n\n for (var i = 0; i < size; i += group) {\n out.push(str.slice(i, i + group));\n }\n\n return out.join(' ');\n};","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nvar inherits = require('inherits');\n\nvar utils = require('./utils');\n\nvar Cipher = require('./cipher');\n\nfunction DESState() {\n this.tmp = new Array(2);\n this.keys = null;\n}\n\nfunction DES(options) {\n Cipher.call(this, options);\n var state = new DESState();\n this._desState = state;\n this.deriveKeys(state, options.key);\n}\n\ninherits(DES, Cipher);\nmodule.exports = DES;\n\nDES.create = function create(options) {\n return new DES(options);\n};\n\nvar shiftTable = [1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1];\n\nDES.prototype.deriveKeys = function deriveKeys(state, key) {\n state.keys = new Array(16 * 2);\n assert.equal(key.length, this.blockSize, 'Invalid key length');\n var kL = utils.readUInt32BE(key, 0);\n var kR = utils.readUInt32BE(key, 4);\n utils.pc1(kL, kR, state.tmp, 0);\n kL = state.tmp[0];\n kR = state.tmp[1];\n\n for (var i = 0; i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift);\n kR = utils.r28shl(kR, shift);\n utils.pc2(kL, kR, state.keys, i);\n }\n};\n\nDES.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._desState;\n var l = utils.readUInt32BE(inp, inOff);\n var r = utils.readUInt32BE(inp, inOff + 4); // Initial Permutation\n\n utils.ip(l, r, state.tmp, 0);\n l = state.tmp[0];\n r = state.tmp[1];\n if (this.type === 'encrypt') this._encrypt(state, l, r, state.tmp, 0);else this._decrypt(state, l, r, state.tmp, 0);\n l = state.tmp[0];\n r = state.tmp[1];\n utils.writeUInt32BE(out, l, outOff);\n utils.writeUInt32BE(out, r, outOff + 4);\n};\n\nDES.prototype._pad = function _pad(buffer, off) {\n var value = buffer.length - off;\n\n for (var i = off; i < buffer.length; i++) {\n buffer[i] = value;\n }\n\n return true;\n};\n\nDES.prototype._unpad = function _unpad(buffer) {\n var pad = buffer[buffer.length - 1];\n\n for (var i = buffer.length - pad; i < buffer.length; i++) {\n assert.equal(buffer[i], pad);\n }\n\n return buffer.slice(0, buffer.length - pad);\n};\n\nDES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {\n var l = lStart;\n var r = rStart; // Apply f() x16 times\n\n for (var i = 0; i < state.keys.length; i += 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1]; // f(r, k)\n\n utils.expand(r, state.tmp, 0);\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n var t = r;\n r = (l ^ f) >>> 0;\n l = t;\n } // Reverse Initial Permutation\n\n\n utils.rip(r, l, out, off);\n};\n\nDES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {\n var l = rStart;\n var r = lStart; // Apply f() x16 times\n\n for (var i = state.keys.length - 2; i >= 0; i -= 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1]; // f(r, k)\n\n utils.expand(l, state.tmp, 0);\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n var t = l;\n l = (r ^ f) >>> 0;\n r = t;\n } // Reverse Initial Permutation\n\n\n utils.rip(l, r, out, off);\n};","var xor = require('buffer-xor');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar incr32 = require('../incr32');\n\nfunction getBlock(self) {\n var out = self._cipher.encryptBlockRaw(self._prev);\n\n incr32(self._prev);\n return out;\n}\n\nvar blockSize = 16;\n\nexports.encrypt = function (self, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize);\n var start = self._cache.length;\n self._cache = Buffer.concat([self._cache, Buffer.allocUnsafe(chunkNum * blockSize)]);\n\n for (var i = 0; i < chunkNum; i++) {\n var out = getBlock(self);\n var offset = start + i * blockSize;\n\n self._cache.writeUInt32BE(out[0], offset + 0);\n\n self._cache.writeUInt32BE(out[1], offset + 4);\n\n self._cache.writeUInt32BE(out[2], offset + 8);\n\n self._cache.writeUInt32BE(out[3], offset + 12);\n }\n\n var pad = self._cache.slice(0, chunk.length);\n\n self._cache = self._cache.slice(chunk.length);\n return xor(chunk, pad);\n};","function incr32(iv) {\n var len = iv.length;\n var item;\n\n while (len--) {\n item = iv.readUInt8(len);\n\n if (item === 255) {\n iv.writeUInt8(0, len);\n } else {\n item++;\n iv.writeUInt8(item, len);\n break;\n }\n }\n}\n\nmodule.exports = incr32;","var aes = require('./aes');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar Transform = require('cipher-base');\n\nvar inherits = require('inherits');\n\nvar GHASH = require('./ghash');\n\nvar xor = require('buffer-xor');\n\nvar incr32 = require('./incr32');\n\nfunction xorTest(a, b) {\n var out = 0;\n if (a.length !== b.length) out++;\n var len = Math.min(a.length, b.length);\n\n for (var i = 0; i < len; ++i) {\n out += a[i] ^ b[i];\n }\n\n return out;\n}\n\nfunction calcIv(self, iv, ck) {\n if (iv.length === 12) {\n self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]);\n return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]);\n }\n\n var ghash = new GHASH(ck);\n var len = iv.length;\n var toPad = len % 16;\n ghash.update(iv);\n\n if (toPad) {\n toPad = 16 - toPad;\n ghash.update(Buffer.alloc(toPad, 0));\n }\n\n ghash.update(Buffer.alloc(8, 0));\n var ivBits = len * 8;\n var tail = Buffer.alloc(8);\n tail.writeUIntBE(ivBits, 0, 8);\n ghash.update(tail);\n self._finID = ghash.state;\n var out = Buffer.from(self._finID);\n incr32(out);\n return out;\n}\n\nfunction StreamCipher(mode, key, iv, decrypt) {\n Transform.call(this);\n var h = Buffer.alloc(4, 0);\n this._cipher = new aes.AES(key);\n\n var ck = this._cipher.encryptBlock(h);\n\n this._ghash = new GHASH(ck);\n iv = calcIv(this, iv, ck);\n this._prev = Buffer.from(iv);\n this._cache = Buffer.allocUnsafe(0);\n this._secCache = Buffer.allocUnsafe(0);\n this._decrypt = decrypt;\n this._alen = 0;\n this._len = 0;\n this._mode = mode;\n this._authTag = null;\n this._called = false;\n}\n\ninherits(StreamCipher, Transform);\n\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - this._alen % 16;\n\n if (rump < 16) {\n rump = Buffer.alloc(rump, 0);\n\n this._ghash.update(rump);\n }\n }\n\n this._called = true;\n\n var out = this._mode.encrypt(this, chunk);\n\n if (this._decrypt) {\n this._ghash.update(chunk);\n } else {\n this._ghash.update(out);\n }\n\n this._len += chunk.length;\n return out;\n};\n\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data');\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID));\n if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data');\n this._authTag = tag;\n\n this._cipher.scrub();\n};\n\nStreamCipher.prototype.getAuthTag = function getAuthTag() {\n if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state');\n return this._authTag;\n};\n\nStreamCipher.prototype.setAuthTag = function setAuthTag(tag) {\n if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state');\n this._authTag = tag;\n};\n\nStreamCipher.prototype.setAAD = function setAAD(buf) {\n if (this._called) throw new Error('Attempting to set AAD in unsupported state');\n\n this._ghash.update(buf);\n\n this._alen += buf.length;\n};\n\nmodule.exports = StreamCipher;","var aes = require('./aes');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nvar Transform = require('cipher-base');\n\nvar inherits = require('inherits');\n\nfunction StreamCipher(mode, key, iv, decrypt) {\n Transform.call(this);\n this._cipher = new aes.AES(key);\n this._prev = Buffer.from(iv);\n this._cache = Buffer.allocUnsafe(0);\n this._secCache = Buffer.allocUnsafe(0);\n this._decrypt = decrypt;\n this._mode = mode;\n}\n\ninherits(StreamCipher, Transform);\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt);\n};\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub();\n};\n\nmodule.exports = StreamCipher;","var randomBytes = require('randombytes');\n\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\n\nvar BN = require('bn.js');\n\nvar TWENTYFOUR = new BN(24);\n\nvar MillerRabin = require('miller-rabin');\n\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null) return primes;\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n\n for (var j = 0; j < i && res[j] <= sqrt; j++) {\n if (k % res[j] === 0) break;\n }\n\n if (i !== j && res[j] <= sqrt) continue;\n res[i++] = k;\n }\n\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++) {\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n\n gen = new BN(gen);\n var num, n2;\n\n while (true) {\n num = new BN(randomBytes(Math.ceil(bits / 8)));\n\n while (num.bitLength() > bits) {\n num.ishrn(1);\n }\n\n if (num.isEven()) {\n num.iadd(ONE);\n }\n\n if (!num.testn(1)) {\n num.iadd(TWO);\n }\n\n if (!gen.cmp(TWO)) {\n while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {\n num.iadd(FOUR);\n }\n } else if (!gen.cmp(FIVE)) {\n while (num.mod(TEN).cmp(THREE)) {\n num.iadd(FOUR);\n }\n }\n\n n2 = num.shrn(1);\n\n if (simpleSieve(n2) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n }\n}","var bn = require('bn.js');\n\nvar brorand = require('brorand');\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\n\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._randbelow = function _randbelow(n) {\n var len = n.bitLength();\n var min_bytes = Math.ceil(len / 8); // Generage random bytes until a number less than n is found.\n // This ensures that 0..n-1 have an equal probability of being selected.\n\n do {\n var a = new bn(this.rand.generate(min_bytes));\n } while (a.cmp(n) >= 0);\n\n return a;\n};\n\nMillerRabin.prototype._randrange = function _randrange(start, stop) {\n // Generate a random number greater than or equal to start and less than stop.\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n};\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n if (!k) k = Math.max(1, len / 48 | 0); // Find d and s, (n - 1) = (2 ^ s) * d;\n\n var n1 = n.subn(1);\n\n for (var s = 0; !n1.testn(s); s++) {}\n\n var d = n.shrn(s);\n var rn1 = n1.toRed(red);\n var prime = true;\n\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n\n if (cb) cb(a);\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n if (x.cmp(rone) === 0) return false;\n if (x.cmp(rn1) === 0) break;\n }\n\n if (i === s) return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n if (!k) k = Math.max(1, len / 48 | 0); // Find d and s, (n - 1) = (2 ^ s) * d;\n\n var n1 = n.subn(1);\n\n for (var s = 0; !n1.testn(s); s++) {}\n\n var d = n.shrn(s);\n var rn1 = n1.toRed(red);\n\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0) return g;\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n if (x.cmp(rone) === 0) return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0) break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return false;\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","module.exports = require('events').EventEmitter;","'use strict'; // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","'use strict';\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg)) return msg.slice();\n if (!msg) return [];\n var res = [];\n\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++) {\n res[i] = msg[i] | 0;\n }\n\n return res;\n }\n\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0) msg = '0' + msg;\n\n for (var i = 0; i < msg.length; i += 2) {\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi) res.push(hi, lo);else res.push(lo);\n }\n }\n\n return res;\n}\n\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1) return '0' + word;else return word;\n}\n\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n\n for (var i = 0; i < msg.length; i++) {\n res += zero2(msg[i].toString(16));\n }\n\n return res;\n}\n\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex') return toHex(arr);else return arr;\n};","'use strict';\n\nvar curve = exports;\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');","'use strict';\n\nvar utils = require('../utils');\n\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0) return ch32(x, y, z);\n if (s === 1 || s === 3) return p32(x, y, z);\n if (s === 2) return maj32(x, y, z);\n}\n\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return x & y ^ ~x & z;\n}\n\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return x & y ^ x & z ^ y & z;\n}\n\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\n\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\n\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\n\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;\n}\n\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;\n}\n\nexports.g1_256 = g1_256;","'use strict';\n\nvar utils = require('../utils');\n\nvar common = require('../common');\n\nvar shaCommon = require('./common');\n\nvar assert = require('minimalistic-assert');\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\nvar BlockHash = common.BlockHash;\nvar sha256_K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];\n\nfunction SHA256() {\n if (!(this instanceof SHA256)) return new SHA256();\n BlockHash.call(this);\n this.h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19];\n this.k = sha256_K;\n this.W = new Array(64);\n}\n\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++) {\n W[i] = msg[start + i];\n }\n\n for (; i < W.length; i++) {\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n }\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n assert(this.k.length === W.length);\n\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');\n};","'use strict';\n\nvar utils = require('../utils');\n\nvar common = require('../common');\n\nvar assert = require('minimalistic-assert');\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\nvar BlockHash = common.BlockHash;\nvar sha512_K = [0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817];\n\nfunction SHA512() {\n if (!(this instanceof SHA512)) return new SHA512();\n BlockHash.call(this);\n this.h = [0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179];\n this.k = sha512_K;\n this.W = new Array(160);\n}\n\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W; // 32 x 32bit words\n\n for (var i = 0; i < 32; i++) {\n W[i] = msg[start + i];\n }\n\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n\n var c3_lo = W[i - 31];\n W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n assert(this.k.length === W.length);\n\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n var T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n hh = gh;\n hl = gl;\n gh = fh;\n gl = fl;\n fh = eh;\n fl = el;\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n dh = ch;\n dl = cl;\n ch = bh;\n cl = bl;\n bh = ah;\n bl = al;\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ ~xh & zh;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ ~xl & zl;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = xh & yh ^ xh & zh ^ yh & zh;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = xl & yl ^ xl & zl ^ yl & zl;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n\n var c2_hi = shr64_hi(xh, xl, 6);\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0) r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n\n var c2_lo = shr64_lo(xh, xl, 6);\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0) r += 0x100000000;\n return r;\n}","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n(function (module, exports) {\n 'use strict'; // Utils\n\n function assert(val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n } // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n\n\n function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n\n var TempCtor = function TempCtor() {};\n\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n } // BN\n\n\n function BN(number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0; // Reduction context\n\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n\n if (_typeof(module) === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n var Buffer;\n\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {}\n\n BN.isBN = function isBN(num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && _typeof(num) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max(left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min(left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init(number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (_typeof(number) === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n\n assert(base === (base | 0) && base >= 2 && base <= 36);\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber(number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n\n this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1];\n this.length = 3;\n }\n\n if (endian !== 'le') return; // Reverse the bytes\n\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray(number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | number[i - 1] << 8 | number[i - 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | number[i + 1] << 8 | number[i + 2] << 16;\n this.words[j] |= w << off & 0x3ffffff;\n this.words[j + 1] = w >>> 26 - off & 0x3ffffff;\n off += 24;\n\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n\n return this._strip();\n };\n\n function parseHex4Bits(string, index) {\n var c = string.charCodeAt(index); // '0' - '9'\n\n if (c >= 48 && c <= 57) {\n return c - 48; // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55; // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte(string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex(number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n } // 24-bits chunks\n\n\n var off = 0;\n var j = 0;\n var w;\n\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase(str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n r *= mul; // 'a'\n\n if (c >= 49) {\n b = c - 49 + 0xa; // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa; // '0' - '9'\n } else {\n b = c;\n }\n\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase(number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1; // Find length of limb in base\n\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n\n limbLen--;\n limbPow = limbPow / base | 0;\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n var word = 0;\n\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n this.imuln(limbPow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy(dest) {\n dest.words = new Array(this.length);\n\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move(dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move(dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone() {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand(size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n\n return this;\n }; // Remove leading `0` from `this`\n\n\n BN.prototype._strip = function strip() {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign() {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n\n return this;\n }; // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n\n\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect() {\n return (this.red ? '';\n }\n /*\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n */\n\n\n var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000'];\n var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5];\n var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176];\n\n BN.prototype.toString = function toString(base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n var out;\n\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = ((w << off | carry) & 0xffffff).toString(16);\n carry = w >>> 24 - off & 0xffffff;\n\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n\n off += 2;\n\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize);\n\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n\n if (this.isZero()) {\n out = '0' + out;\n }\n\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n\n if (this.negative !== 0) {\n out = '-' + out;\n }\n\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber() {\n var ret = this.words[0];\n\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + this.words[1] * 0x4000000;\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n\n return this.negative !== 0 ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON() {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer(endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray(endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate(ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = this.words[i] << shift | carry;\n res[position++] = word & 0xff;\n\n if (position < res.length) {\n res[position++] = word >> 8 & 0xff;\n }\n\n if (position < res.length) {\n res[position++] = word >> 16 & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = word >> 24 & 0xff;\n }\n\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = this.words[i] << shift | carry;\n res[position--] = word & 0xff;\n\n if (position >= 0) {\n res[position--] = word >> 8 & 0xff;\n }\n\n if (position >= 0) {\n res[position--] = word >> 16 & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = word >> 24 & 0xff;\n }\n\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits(w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits(w) {\n var t = w;\n var r = 0;\n\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits(w) {\n // Short-cut\n if (w === 0) return 26;\n var t = w;\n var r = 0;\n\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n\n if ((t & 0x1) === 0) {\n r++;\n }\n\n return r;\n }; // Return number of used bits in a BN\n\n\n BN.prototype.bitLength = function bitLength() {\n var w = this.words[this.length - 1];\n\n var hi = this._countBits(w);\n\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray(num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n w[bit] = num.words[off] >>> wbit & 0x01;\n }\n\n return w;\n } // Number of trailing zero bits\n\n\n BN.prototype.zeroBits = function zeroBits() {\n if (this.isZero()) return 0;\n var r = 0;\n\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n\n r += b;\n if (b !== 26) break;\n }\n\n return r;\n };\n\n BN.prototype.byteLength = function byteLength() {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos(width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos(width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg() {\n return this.negative !== 0;\n }; // Return negative clone of `this`\n\n\n BN.prototype.neg = function neg() {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg() {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n }; // Or `num` with `this` in-place\n\n\n BN.prototype.iuor = function iuor(num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n }; // Or `num` with `this`\n\n\n BN.prototype.or = function or(num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor(num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n }; // And `num` with `this` in-place\n\n\n BN.prototype.iuand = function iuand(num) {\n // b = min-length(num, this)\n var b;\n\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n return this._strip();\n };\n\n BN.prototype.iand = function iand(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n }; // And `num` with `this`\n\n\n BN.prototype.and = function and(num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand(num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n }; // Xor `num` with `this` in-place\n\n\n BN.prototype.iuxor = function iuxor(num) {\n // a.length > b.length\n var a;\n var b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor(num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n }; // Xor `num` with `this`\n\n\n BN.prototype.xor = function xor(num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor(num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n }; // Not ``this`` with ``width`` bitwidth\n\n\n BN.prototype.inotn = function inotn(width) {\n assert(typeof width === 'number' && width >= 0);\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26; // Extend the buffer with leading zeroes\n\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n } // Handle complete words\n\n\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n } // Handle the residue\n\n\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft;\n } // And remove leading zeroes\n\n\n return this._strip();\n };\n\n BN.prototype.notn = function notn(width) {\n return this.clone().inotn(width);\n }; // Set `bit` of `this`\n\n\n BN.prototype.setn = function setn(bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n var off = bit / 26 | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | 1 << wbit;\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n }; // Add `num` to `this` in-place\n\n\n BN.prototype.iadd = function iadd(num) {\n var r; // negative + positive\n\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign(); // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n } // a.length > b.length\n\n\n var a, b;\n\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++; // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n }; // Add `num` to `this`\n\n\n BN.prototype.add = function add(num) {\n var res;\n\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n return num.clone().iadd(this);\n }; // Subtract `num` from `this` in-place\n\n\n BN.prototype.isub = function isub(num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign(); // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n } // At this point both numbers are positive\n\n\n var cmp = this.cmp(num); // Optimization - zeroify\n\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n } // a > b\n\n\n var a, b;\n\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n } // Copy rest of the words\n\n\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n }; // Subtract `num` from `this`\n\n\n BN.prototype.sub = function sub(num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = self.length + num.length | 0;\n out.length = len;\n len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity)\n\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n var carry = r / 0x4000000 | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += r / 0x4000000 | 0;\n rword = r & 0x3ffffff;\n }\n\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n } // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n\n\n var comb10MulTo = function comb10MulTo(self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = mid + Math.imul(ah0, bl0) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = mid + Math.imul(ah1, bl0) | 0;\n hi = Math.imul(ah1, bh0);\n lo = lo + Math.imul(al0, bl1) | 0;\n mid = mid + Math.imul(al0, bh1) | 0;\n mid = mid + Math.imul(ah0, bl1) | 0;\n hi = hi + Math.imul(ah0, bh1) | 0;\n var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = mid + Math.imul(ah2, bl0) | 0;\n hi = Math.imul(ah2, bh0);\n lo = lo + Math.imul(al1, bl1) | 0;\n mid = mid + Math.imul(al1, bh1) | 0;\n mid = mid + Math.imul(ah1, bl1) | 0;\n hi = hi + Math.imul(ah1, bh1) | 0;\n lo = lo + Math.imul(al0, bl2) | 0;\n mid = mid + Math.imul(al0, bh2) | 0;\n mid = mid + Math.imul(ah0, bl2) | 0;\n hi = hi + Math.imul(ah0, bh2) | 0;\n var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = mid + Math.imul(ah3, bl0) | 0;\n hi = Math.imul(ah3, bh0);\n lo = lo + Math.imul(al2, bl1) | 0;\n mid = mid + Math.imul(al2, bh1) | 0;\n mid = mid + Math.imul(ah2, bl1) | 0;\n hi = hi + Math.imul(ah2, bh1) | 0;\n lo = lo + Math.imul(al1, bl2) | 0;\n mid = mid + Math.imul(al1, bh2) | 0;\n mid = mid + Math.imul(ah1, bl2) | 0;\n hi = hi + Math.imul(ah1, bh2) | 0;\n lo = lo + Math.imul(al0, bl3) | 0;\n mid = mid + Math.imul(al0, bh3) | 0;\n mid = mid + Math.imul(ah0, bl3) | 0;\n hi = hi + Math.imul(ah0, bh3) | 0;\n var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = mid + Math.imul(ah4, bl0) | 0;\n hi = Math.imul(ah4, bh0);\n lo = lo + Math.imul(al3, bl1) | 0;\n mid = mid + Math.imul(al3, bh1) | 0;\n mid = mid + Math.imul(ah3, bl1) | 0;\n hi = hi + Math.imul(ah3, bh1) | 0;\n lo = lo + Math.imul(al2, bl2) | 0;\n mid = mid + Math.imul(al2, bh2) | 0;\n mid = mid + Math.imul(ah2, bl2) | 0;\n hi = hi + Math.imul(ah2, bh2) | 0;\n lo = lo + Math.imul(al1, bl3) | 0;\n mid = mid + Math.imul(al1, bh3) | 0;\n mid = mid + Math.imul(ah1, bl3) | 0;\n hi = hi + Math.imul(ah1, bh3) | 0;\n lo = lo + Math.imul(al0, bl4) | 0;\n mid = mid + Math.imul(al0, bh4) | 0;\n mid = mid + Math.imul(ah0, bl4) | 0;\n hi = hi + Math.imul(ah0, bh4) | 0;\n var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = mid + Math.imul(ah5, bl0) | 0;\n hi = Math.imul(ah5, bh0);\n lo = lo + Math.imul(al4, bl1) | 0;\n mid = mid + Math.imul(al4, bh1) | 0;\n mid = mid + Math.imul(ah4, bl1) | 0;\n hi = hi + Math.imul(ah4, bh1) | 0;\n lo = lo + Math.imul(al3, bl2) | 0;\n mid = mid + Math.imul(al3, bh2) | 0;\n mid = mid + Math.imul(ah3, bl2) | 0;\n hi = hi + Math.imul(ah3, bh2) | 0;\n lo = lo + Math.imul(al2, bl3) | 0;\n mid = mid + Math.imul(al2, bh3) | 0;\n mid = mid + Math.imul(ah2, bl3) | 0;\n hi = hi + Math.imul(ah2, bh3) | 0;\n lo = lo + Math.imul(al1, bl4) | 0;\n mid = mid + Math.imul(al1, bh4) | 0;\n mid = mid + Math.imul(ah1, bl4) | 0;\n hi = hi + Math.imul(ah1, bh4) | 0;\n lo = lo + Math.imul(al0, bl5) | 0;\n mid = mid + Math.imul(al0, bh5) | 0;\n mid = mid + Math.imul(ah0, bl5) | 0;\n hi = hi + Math.imul(ah0, bh5) | 0;\n var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = mid + Math.imul(ah6, bl0) | 0;\n hi = Math.imul(ah6, bh0);\n lo = lo + Math.imul(al5, bl1) | 0;\n mid = mid + Math.imul(al5, bh1) | 0;\n mid = mid + Math.imul(ah5, bl1) | 0;\n hi = hi + Math.imul(ah5, bh1) | 0;\n lo = lo + Math.imul(al4, bl2) | 0;\n mid = mid + Math.imul(al4, bh2) | 0;\n mid = mid + Math.imul(ah4, bl2) | 0;\n hi = hi + Math.imul(ah4, bh2) | 0;\n lo = lo + Math.imul(al3, bl3) | 0;\n mid = mid + Math.imul(al3, bh3) | 0;\n mid = mid + Math.imul(ah3, bl3) | 0;\n hi = hi + Math.imul(ah3, bh3) | 0;\n lo = lo + Math.imul(al2, bl4) | 0;\n mid = mid + Math.imul(al2, bh4) | 0;\n mid = mid + Math.imul(ah2, bl4) | 0;\n hi = hi + Math.imul(ah2, bh4) | 0;\n lo = lo + Math.imul(al1, bl5) | 0;\n mid = mid + Math.imul(al1, bh5) | 0;\n mid = mid + Math.imul(ah1, bl5) | 0;\n hi = hi + Math.imul(ah1, bh5) | 0;\n lo = lo + Math.imul(al0, bl6) | 0;\n mid = mid + Math.imul(al0, bh6) | 0;\n mid = mid + Math.imul(ah0, bl6) | 0;\n hi = hi + Math.imul(ah0, bh6) | 0;\n var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = mid + Math.imul(ah7, bl0) | 0;\n hi = Math.imul(ah7, bh0);\n lo = lo + Math.imul(al6, bl1) | 0;\n mid = mid + Math.imul(al6, bh1) | 0;\n mid = mid + Math.imul(ah6, bl1) | 0;\n hi = hi + Math.imul(ah6, bh1) | 0;\n lo = lo + Math.imul(al5, bl2) | 0;\n mid = mid + Math.imul(al5, bh2) | 0;\n mid = mid + Math.imul(ah5, bl2) | 0;\n hi = hi + Math.imul(ah5, bh2) | 0;\n lo = lo + Math.imul(al4, bl3) | 0;\n mid = mid + Math.imul(al4, bh3) | 0;\n mid = mid + Math.imul(ah4, bl3) | 0;\n hi = hi + Math.imul(ah4, bh3) | 0;\n lo = lo + Math.imul(al3, bl4) | 0;\n mid = mid + Math.imul(al3, bh4) | 0;\n mid = mid + Math.imul(ah3, bl4) | 0;\n hi = hi + Math.imul(ah3, bh4) | 0;\n lo = lo + Math.imul(al2, bl5) | 0;\n mid = mid + Math.imul(al2, bh5) | 0;\n mid = mid + Math.imul(ah2, bl5) | 0;\n hi = hi + Math.imul(ah2, bh5) | 0;\n lo = lo + Math.imul(al1, bl6) | 0;\n mid = mid + Math.imul(al1, bh6) | 0;\n mid = mid + Math.imul(ah1, bl6) | 0;\n hi = hi + Math.imul(ah1, bh6) | 0;\n lo = lo + Math.imul(al0, bl7) | 0;\n mid = mid + Math.imul(al0, bh7) | 0;\n mid = mid + Math.imul(ah0, bl7) | 0;\n hi = hi + Math.imul(ah0, bh7) | 0;\n var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = mid + Math.imul(ah8, bl0) | 0;\n hi = Math.imul(ah8, bh0);\n lo = lo + Math.imul(al7, bl1) | 0;\n mid = mid + Math.imul(al7, bh1) | 0;\n mid = mid + Math.imul(ah7, bl1) | 0;\n hi = hi + Math.imul(ah7, bh1) | 0;\n lo = lo + Math.imul(al6, bl2) | 0;\n mid = mid + Math.imul(al6, bh2) | 0;\n mid = mid + Math.imul(ah6, bl2) | 0;\n hi = hi + Math.imul(ah6, bh2) | 0;\n lo = lo + Math.imul(al5, bl3) | 0;\n mid = mid + Math.imul(al5, bh3) | 0;\n mid = mid + Math.imul(ah5, bl3) | 0;\n hi = hi + Math.imul(ah5, bh3) | 0;\n lo = lo + Math.imul(al4, bl4) | 0;\n mid = mid + Math.imul(al4, bh4) | 0;\n mid = mid + Math.imul(ah4, bl4) | 0;\n hi = hi + Math.imul(ah4, bh4) | 0;\n lo = lo + Math.imul(al3, bl5) | 0;\n mid = mid + Math.imul(al3, bh5) | 0;\n mid = mid + Math.imul(ah3, bl5) | 0;\n hi = hi + Math.imul(ah3, bh5) | 0;\n lo = lo + Math.imul(al2, bl6) | 0;\n mid = mid + Math.imul(al2, bh6) | 0;\n mid = mid + Math.imul(ah2, bl6) | 0;\n hi = hi + Math.imul(ah2, bh6) | 0;\n lo = lo + Math.imul(al1, bl7) | 0;\n mid = mid + Math.imul(al1, bh7) | 0;\n mid = mid + Math.imul(ah1, bl7) | 0;\n hi = hi + Math.imul(ah1, bh7) | 0;\n lo = lo + Math.imul(al0, bl8) | 0;\n mid = mid + Math.imul(al0, bh8) | 0;\n mid = mid + Math.imul(ah0, bl8) | 0;\n hi = hi + Math.imul(ah0, bh8) | 0;\n var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = mid + Math.imul(ah9, bl0) | 0;\n hi = Math.imul(ah9, bh0);\n lo = lo + Math.imul(al8, bl1) | 0;\n mid = mid + Math.imul(al8, bh1) | 0;\n mid = mid + Math.imul(ah8, bl1) | 0;\n hi = hi + Math.imul(ah8, bh1) | 0;\n lo = lo + Math.imul(al7, bl2) | 0;\n mid = mid + Math.imul(al7, bh2) | 0;\n mid = mid + Math.imul(ah7, bl2) | 0;\n hi = hi + Math.imul(ah7, bh2) | 0;\n lo = lo + Math.imul(al6, bl3) | 0;\n mid = mid + Math.imul(al6, bh3) | 0;\n mid = mid + Math.imul(ah6, bl3) | 0;\n hi = hi + Math.imul(ah6, bh3) | 0;\n lo = lo + Math.imul(al5, bl4) | 0;\n mid = mid + Math.imul(al5, bh4) | 0;\n mid = mid + Math.imul(ah5, bl4) | 0;\n hi = hi + Math.imul(ah5, bh4) | 0;\n lo = lo + Math.imul(al4, bl5) | 0;\n mid = mid + Math.imul(al4, bh5) | 0;\n mid = mid + Math.imul(ah4, bl5) | 0;\n hi = hi + Math.imul(ah4, bh5) | 0;\n lo = lo + Math.imul(al3, bl6) | 0;\n mid = mid + Math.imul(al3, bh6) | 0;\n mid = mid + Math.imul(ah3, bl6) | 0;\n hi = hi + Math.imul(ah3, bh6) | 0;\n lo = lo + Math.imul(al2, bl7) | 0;\n mid = mid + Math.imul(al2, bh7) | 0;\n mid = mid + Math.imul(ah2, bl7) | 0;\n hi = hi + Math.imul(ah2, bh7) | 0;\n lo = lo + Math.imul(al1, bl8) | 0;\n mid = mid + Math.imul(al1, bh8) | 0;\n mid = mid + Math.imul(ah1, bl8) | 0;\n hi = hi + Math.imul(ah1, bh8) | 0;\n lo = lo + Math.imul(al0, bl9) | 0;\n mid = mid + Math.imul(al0, bh9) | 0;\n mid = mid + Math.imul(ah0, bl9) | 0;\n hi = hi + Math.imul(ah0, bh9) | 0;\n var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = mid + Math.imul(ah9, bl1) | 0;\n hi = Math.imul(ah9, bh1);\n lo = lo + Math.imul(al8, bl2) | 0;\n mid = mid + Math.imul(al8, bh2) | 0;\n mid = mid + Math.imul(ah8, bl2) | 0;\n hi = hi + Math.imul(ah8, bh2) | 0;\n lo = lo + Math.imul(al7, bl3) | 0;\n mid = mid + Math.imul(al7, bh3) | 0;\n mid = mid + Math.imul(ah7, bl3) | 0;\n hi = hi + Math.imul(ah7, bh3) | 0;\n lo = lo + Math.imul(al6, bl4) | 0;\n mid = mid + Math.imul(al6, bh4) | 0;\n mid = mid + Math.imul(ah6, bl4) | 0;\n hi = hi + Math.imul(ah6, bh4) | 0;\n lo = lo + Math.imul(al5, bl5) | 0;\n mid = mid + Math.imul(al5, bh5) | 0;\n mid = mid + Math.imul(ah5, bl5) | 0;\n hi = hi + Math.imul(ah5, bh5) | 0;\n lo = lo + Math.imul(al4, bl6) | 0;\n mid = mid + Math.imul(al4, bh6) | 0;\n mid = mid + Math.imul(ah4, bl6) | 0;\n hi = hi + Math.imul(ah4, bh6) | 0;\n lo = lo + Math.imul(al3, bl7) | 0;\n mid = mid + Math.imul(al3, bh7) | 0;\n mid = mid + Math.imul(ah3, bl7) | 0;\n hi = hi + Math.imul(ah3, bh7) | 0;\n lo = lo + Math.imul(al2, bl8) | 0;\n mid = mid + Math.imul(al2, bh8) | 0;\n mid = mid + Math.imul(ah2, bl8) | 0;\n hi = hi + Math.imul(ah2, bh8) | 0;\n lo = lo + Math.imul(al1, bl9) | 0;\n mid = mid + Math.imul(al1, bh9) | 0;\n mid = mid + Math.imul(ah1, bl9) | 0;\n hi = hi + Math.imul(ah1, bh9) | 0;\n var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = mid + Math.imul(ah9, bl2) | 0;\n hi = Math.imul(ah9, bh2);\n lo = lo + Math.imul(al8, bl3) | 0;\n mid = mid + Math.imul(al8, bh3) | 0;\n mid = mid + Math.imul(ah8, bl3) | 0;\n hi = hi + Math.imul(ah8, bh3) | 0;\n lo = lo + Math.imul(al7, bl4) | 0;\n mid = mid + Math.imul(al7, bh4) | 0;\n mid = mid + Math.imul(ah7, bl4) | 0;\n hi = hi + Math.imul(ah7, bh4) | 0;\n lo = lo + Math.imul(al6, bl5) | 0;\n mid = mid + Math.imul(al6, bh5) | 0;\n mid = mid + Math.imul(ah6, bl5) | 0;\n hi = hi + Math.imul(ah6, bh5) | 0;\n lo = lo + Math.imul(al5, bl6) | 0;\n mid = mid + Math.imul(al5, bh6) | 0;\n mid = mid + Math.imul(ah5, bl6) | 0;\n hi = hi + Math.imul(ah5, bh6) | 0;\n lo = lo + Math.imul(al4, bl7) | 0;\n mid = mid + Math.imul(al4, bh7) | 0;\n mid = mid + Math.imul(ah4, bl7) | 0;\n hi = hi + Math.imul(ah4, bh7) | 0;\n lo = lo + Math.imul(al3, bl8) | 0;\n mid = mid + Math.imul(al3, bh8) | 0;\n mid = mid + Math.imul(ah3, bl8) | 0;\n hi = hi + Math.imul(ah3, bh8) | 0;\n lo = lo + Math.imul(al2, bl9) | 0;\n mid = mid + Math.imul(al2, bh9) | 0;\n mid = mid + Math.imul(ah2, bl9) | 0;\n hi = hi + Math.imul(ah2, bh9) | 0;\n var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = mid + Math.imul(ah9, bl3) | 0;\n hi = Math.imul(ah9, bh3);\n lo = lo + Math.imul(al8, bl4) | 0;\n mid = mid + Math.imul(al8, bh4) | 0;\n mid = mid + Math.imul(ah8, bl4) | 0;\n hi = hi + Math.imul(ah8, bh4) | 0;\n lo = lo + Math.imul(al7, bl5) | 0;\n mid = mid + Math.imul(al7, bh5) | 0;\n mid = mid + Math.imul(ah7, bl5) | 0;\n hi = hi + Math.imul(ah7, bh5) | 0;\n lo = lo + Math.imul(al6, bl6) | 0;\n mid = mid + Math.imul(al6, bh6) | 0;\n mid = mid + Math.imul(ah6, bl6) | 0;\n hi = hi + Math.imul(ah6, bh6) | 0;\n lo = lo + Math.imul(al5, bl7) | 0;\n mid = mid + Math.imul(al5, bh7) | 0;\n mid = mid + Math.imul(ah5, bl7) | 0;\n hi = hi + Math.imul(ah5, bh7) | 0;\n lo = lo + Math.imul(al4, bl8) | 0;\n mid = mid + Math.imul(al4, bh8) | 0;\n mid = mid + Math.imul(ah4, bl8) | 0;\n hi = hi + Math.imul(ah4, bh8) | 0;\n lo = lo + Math.imul(al3, bl9) | 0;\n mid = mid + Math.imul(al3, bh9) | 0;\n mid = mid + Math.imul(ah3, bl9) | 0;\n hi = hi + Math.imul(ah3, bh9) | 0;\n var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = mid + Math.imul(ah9, bl4) | 0;\n hi = Math.imul(ah9, bh4);\n lo = lo + Math.imul(al8, bl5) | 0;\n mid = mid + Math.imul(al8, bh5) | 0;\n mid = mid + Math.imul(ah8, bl5) | 0;\n hi = hi + Math.imul(ah8, bh5) | 0;\n lo = lo + Math.imul(al7, bl6) | 0;\n mid = mid + Math.imul(al7, bh6) | 0;\n mid = mid + Math.imul(ah7, bl6) | 0;\n hi = hi + Math.imul(ah7, bh6) | 0;\n lo = lo + Math.imul(al6, bl7) | 0;\n mid = mid + Math.imul(al6, bh7) | 0;\n mid = mid + Math.imul(ah6, bl7) | 0;\n hi = hi + Math.imul(ah6, bh7) | 0;\n lo = lo + Math.imul(al5, bl8) | 0;\n mid = mid + Math.imul(al5, bh8) | 0;\n mid = mid + Math.imul(ah5, bl8) | 0;\n hi = hi + Math.imul(ah5, bh8) | 0;\n lo = lo + Math.imul(al4, bl9) | 0;\n mid = mid + Math.imul(al4, bh9) | 0;\n mid = mid + Math.imul(ah4, bl9) | 0;\n hi = hi + Math.imul(ah4, bh9) | 0;\n var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = mid + Math.imul(ah9, bl5) | 0;\n hi = Math.imul(ah9, bh5);\n lo = lo + Math.imul(al8, bl6) | 0;\n mid = mid + Math.imul(al8, bh6) | 0;\n mid = mid + Math.imul(ah8, bl6) | 0;\n hi = hi + Math.imul(ah8, bh6) | 0;\n lo = lo + Math.imul(al7, bl7) | 0;\n mid = mid + Math.imul(al7, bh7) | 0;\n mid = mid + Math.imul(ah7, bl7) | 0;\n hi = hi + Math.imul(ah7, bh7) | 0;\n lo = lo + Math.imul(al6, bl8) | 0;\n mid = mid + Math.imul(al6, bh8) | 0;\n mid = mid + Math.imul(ah6, bl8) | 0;\n hi = hi + Math.imul(ah6, bh8) | 0;\n lo = lo + Math.imul(al5, bl9) | 0;\n mid = mid + Math.imul(al5, bh9) | 0;\n mid = mid + Math.imul(ah5, bl9) | 0;\n hi = hi + Math.imul(ah5, bh9) | 0;\n var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = mid + Math.imul(ah9, bl6) | 0;\n hi = Math.imul(ah9, bh6);\n lo = lo + Math.imul(al8, bl7) | 0;\n mid = mid + Math.imul(al8, bh7) | 0;\n mid = mid + Math.imul(ah8, bl7) | 0;\n hi = hi + Math.imul(ah8, bh7) | 0;\n lo = lo + Math.imul(al7, bl8) | 0;\n mid = mid + Math.imul(al7, bh8) | 0;\n mid = mid + Math.imul(ah7, bl8) | 0;\n hi = hi + Math.imul(ah7, bh8) | 0;\n lo = lo + Math.imul(al6, bl9) | 0;\n mid = mid + Math.imul(al6, bh9) | 0;\n mid = mid + Math.imul(ah6, bl9) | 0;\n hi = hi + Math.imul(ah6, bh9) | 0;\n var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = mid + Math.imul(ah9, bl7) | 0;\n hi = Math.imul(ah9, bh7);\n lo = lo + Math.imul(al8, bl8) | 0;\n mid = mid + Math.imul(al8, bh8) | 0;\n mid = mid + Math.imul(ah8, bl8) | 0;\n hi = hi + Math.imul(ah8, bh8) | 0;\n lo = lo + Math.imul(al7, bl9) | 0;\n mid = mid + Math.imul(al7, bh9) | 0;\n mid = mid + Math.imul(ah7, bl9) | 0;\n hi = hi + Math.imul(ah7, bh9) | 0;\n var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = mid + Math.imul(ah9, bl8) | 0;\n hi = Math.imul(ah9, bh8);\n lo = lo + Math.imul(al8, bl9) | 0;\n mid = mid + Math.imul(al8, bh9) | 0;\n mid = mid + Math.imul(ah8, bl9) | 0;\n hi = hi + Math.imul(ah8, bh9) | 0;\n var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = mid + Math.imul(ah9, bl9) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0;\n c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n\n return out;\n }; // Polyfill comb\n\n\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo(self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n var carry = 0;\n var hncarry = 0;\n\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n var lo = r & 0x3ffffff;\n ncarry = ncarry + (r / 0x4000000 | 0) | 0;\n lo = lo + rword | 0;\n rword = lo & 0x3ffffff;\n ncarry = ncarry + (lo >>> 26) | 0;\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo(self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo(num, out) {\n var res;\n var len = this.length + num.length;\n\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n }; // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n\n function FFTM(x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT(N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n }; // Returns binary-reversed representation of `x`\n\n\n FFTM.prototype.revBin = function revBin(x, l, N) {\n if (x === 0 || x === N - 1) return x;\n var rb = 0;\n\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << l - i - 1;\n x >>= 1;\n }\n\n return rb;\n }; // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n\n\n FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n var rx = rtwdf_ * ro - itwdf_ * io;\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n /* jshint maxdepth : false */\n\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b(n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate(rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n t = iws[i];\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b(ws, N) {\n var carry = 0;\n\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry;\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) {\n var carry = 0;\n\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n rws[2 * i] = carry & 0x1fff;\n carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff;\n carry = carry >>> 13;\n } // Pad with zeroes\n\n\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub(N) {\n var ph = new Array(N);\n\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp(x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n var rmws = out.words;\n rmws.length = N;\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n }; // Multiply `this` by `num`\n\n\n BN.prototype.mul = function mul(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n }; // Multiply employing FFT\n\n\n BN.prototype.mulf = function mulf(num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n }; // In-place Multiplication\n\n\n BN.prototype.imul = function imul(num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(typeof num === 'number');\n assert(num < 0x4000000); // Carry\n\n var carry = 0;\n\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum\n\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln(num) {\n return this.clone().imuln(num);\n }; // `this` * `this`\n\n\n BN.prototype.sqr = function sqr() {\n return this.mul(this);\n }; // `this` * `this` in-place\n\n\n BN.prototype.isqr = function isqr() {\n return this.imul(this.clone());\n }; // Math.pow(`this`, `num`)\n\n\n BN.prototype.pow = function pow(num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1); // Skip leading zeroes\n\n var res = this;\n\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n res = res.mul(q);\n }\n }\n\n return res;\n }; // Shift-left in-place\n\n\n BN.prototype.iushln = function iushln(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = 0x3ffffff >>> 26 - r << 26 - r;\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = (this.words[i] | 0) - newCarry << r;\n this.words[i] = c | carry;\n carry = newCarry >>> 26 - r;\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln(bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n }; // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n\n\n BN.prototype.iushrn = function iushrn(bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n\n if (hint) {\n h = (hint - hint % 26) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n var maskedWords = extended;\n h -= s;\n h = Math.max(0, h); // Extended mode, copy masked part\n\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n\n maskedWords.length = s;\n }\n\n if (s === 0) {// No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = carry << 26 - r | word >>> r;\n carry = word & mask;\n } // Push carried bits as a mask\n\n\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn(bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n }; // Shift-left\n\n\n BN.prototype.shln = function shln(bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln(bits) {\n return this.clone().iushln(bits);\n }; // Shift-right\n\n\n BN.prototype.shrn = function shrn(bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn(bits) {\n return this.clone().iushrn(bits);\n }; // Test if n bit is set\n\n\n BN.prototype.testn = function testn(bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) return false; // Check bit and return\n\n var w = this.words[s];\n return !!(w & q);\n }; // Return only lowers bits of number (in-place)\n\n\n BN.prototype.imaskn = function imaskn(bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ 0x3ffffff >>> r << r;\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n }; // Return only lowers bits of number\n\n\n BN.prototype.maskn = function maskn(bits) {\n return this.clone().imaskn(bits);\n }; // Add plain number `num` to `this`\n\n\n BN.prototype.iaddn = function iaddn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num); // Possible sign change\n\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n } // Add without checks\n\n\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn(num) {\n this.words[0] += num; // Carry\n\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n\n this.length = Math.max(this.length, i + 1);\n return this;\n }; // Subtract plain number `num` from `this`\n\n\n BN.prototype.isubn = function isubn(num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn(num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn(num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs() {\n this.negative = 0;\n return this;\n };\n\n BN.prototype.abs = function abs() {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - (right / 0x4000000 | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip(); // Subtraction overflow\n\n assert(carry === -1);\n carry = 0;\n\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n\n this.negative = 1;\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv(num, mode) {\n var shift = this.length - num.length;\n var a = this.clone();\n var b = num; // Normalize\n\n var bhi = b.words[b.length - 1] | 0;\n\n var bhiBits = this._countBits(bhi);\n\n shift = 26 - bhiBits;\n\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n } // Initialize quotient\n\n\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n\n if (diff.negative === 0) {\n a = diff;\n\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n\n qj = Math.min(qj / bhi | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n\n a._ishlnsubmul(b, 1, j);\n\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n\n if (q) {\n q.words[j] = qj;\n }\n }\n\n if (q) {\n q._strip();\n }\n\n a._strip(); // Denormalize\n\n\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n }; // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n\n\n BN.prototype.divmod = function divmod(num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n } // Both numbers are positive at this point\n // Strip both numbers to approximate shift value\n\n\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n } // Very short reduction\n\n\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n }; // Find `this` / `num`\n\n\n BN.prototype.div = function div(num) {\n return this.divmod(num, 'div', false).div;\n }; // Find `this` % `num`\n\n\n BN.prototype.mod = function mod(num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod(num) {\n return this.divmod(num, 'mod', true).mod;\n }; // Find Round(`this` / `num`)\n\n\n BN.prototype.divRound = function divRound(num) {\n var dm = this.divmod(num); // Fast case - exact division\n\n if (dm.mod.isZero()) return dm.div;\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half); // Round down\n\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up\n\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n var acc = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n }; // WARNING: DEPRECATED\n\n\n BN.prototype.modn = function modn(num) {\n return this.modrn(num);\n }; // In-place division by number\n\n\n BN.prototype.idivn = function idivn(num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n assert(num <= 0x3ffffff);\n var carry = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = w / num | 0;\n carry = w % num;\n }\n\n this._strip();\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn(num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n } // A * x + B * y = x\n\n\n var A = new BN(1);\n var B = new BN(0); // C * x + D * y = y\n\n var C = new BN(0);\n var D = new BN(1);\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n x.iushrn(i);\n\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n y.iushrn(j);\n\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n }; // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n\n\n BN.prototype._invmp = function _invmp(p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {\n ;\n }\n\n if (i > 0) {\n a.iushrn(i);\n\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {\n ;\n }\n\n if (j > 0) {\n b.iushrn(j);\n\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd(num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0; // Remove common factor of two\n\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n }; // Invert number in the field F(num)\n\n\n BN.prototype.invm = function invm(num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven() {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd() {\n return (this.words[0] & 1) === 1;\n }; // And first word and num\n\n\n BN.prototype.andln = function andln(num) {\n return this.words[0] & num;\n }; // Increment at the bit position in-line\n\n\n BN.prototype.bincn = function bincn(bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r; // Fast case: bit is much higher than all existing words\n\n if (this.length <= s) {\n this._expand(s + 1);\n\n this.words[s] |= q;\n return this;\n } // Add bit and propagate, if needed\n\n\n var carry = q;\n\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.isZero = function isZero() {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn(num) {\n var negative = num < 0;\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n\n\n BN.prototype.cmp = function cmp(num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n }; // Unsigned comparison\n\n\n BN.prototype.ucmp = function ucmp(num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n var res = 0;\n\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n if (a === b) continue;\n\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n\n break;\n }\n\n return res;\n };\n\n BN.prototype.gtn = function gtn(num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt(num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten(num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte(num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn(num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt(num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten(num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte(num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn(num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq(num) {\n return this.cmp(num) === 0;\n }; //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n\n\n BN.red = function red(num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed() {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed(ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed(ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd(num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd(num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub(num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub(num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl(num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul(num) {\n assert(this.red, 'redMul works only with red numbers');\n\n this.red._verify2(this, num);\n\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr() {\n assert(this.red, 'redSqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr() {\n assert(this.red, 'redISqr works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.isqr(this);\n }; // Square root over p\n\n\n BN.prototype.redSqrt = function redSqrt() {\n assert(this.red, 'redSqrt works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm() {\n assert(this.red, 'redInvm works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.invm(this);\n }; // Return negative clone of `this` % `red modulo`\n\n\n BN.prototype.redNeg = function redNeg() {\n assert(this.red, 'redNeg works only with red numbers');\n\n this.red._verify1(this);\n\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow(num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n\n this.red._verify1(this);\n\n return this.red.pow(this, num);\n }; // Prime numbers with efficient reduction\n\n\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n }; // Pseudo-Mersenne prime\n\n function MPrime(name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp() {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce(num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split(input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK(num) {\n return num.imul(this.k);\n };\n\n function K256() {\n MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n\n inherits(K256, MPrime);\n\n K256.prototype.split = function split(input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n var outLen = Math.min(input.length, 9);\n\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n } // Shift by 9 limbs\n\n\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = (next & mask) << 4 | prev >>> 22;\n prev = next;\n }\n\n prev >>>= 22;\n input.words[i - 10] = prev;\n\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK(num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n\n var lo = 0;\n\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + (lo / 0x4000000 | 0);\n } // Fast length reduction\n\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n\n return num;\n };\n\n function P224() {\n MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n\n inherits(P224, MPrime);\n\n function P192() {\n MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n\n inherits(P192, MPrime);\n\n function P25519() {\n // 2 ^ 255 - 19\n MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK(num) {\n // K = 0x13\n var carry = 0;\n\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n num.words[i] = lo;\n carry = hi;\n }\n\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n\n return num;\n }; // Exported mostly for testing purposes, use plain name instead\n\n\n BN._prime = function prime(name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n var prime;\n\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n\n primes[name] = prime;\n return prime;\n }; //\n // Base reduction engine\n //\n\n\n function Red(m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1(a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2(a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red, 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod(a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg(a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add(a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd(a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n\n return res;\n };\n\n Red.prototype.sub = function sub(a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub(a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n\n return res;\n };\n\n Red.prototype.shl = function shl(a, num) {\n this._verify1(a);\n\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul(a, b) {\n this._verify2(a, b);\n\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr(a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr(a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt(a) {\n if (a.isZero()) return a.clone();\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1); // Fast case\n\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n } // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n\n\n var q = this.m.subn(1);\n var s = 0;\n\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n\n assert(!q.isZero());\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg(); // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n\n while (t.cmp(one) !== 0) {\n var tmp = t;\n\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm(a) {\n var inv = a._invmp(this.m);\n\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow(a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n\n for (var j = start - 1; j >= 0; j--) {\n var bit = word >> j & 1;\n\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo(num) {\n var r = num.umod(this.m);\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom(num) {\n var res = num.clone();\n res.red = null;\n return res;\n }; //\n // Montgomery method engine\n //\n\n\n BN.mont = function mont(num) {\n return new Mont(num);\n };\n\n function Mont(m) {\n Red.call(this, m);\n this.shift = this.m.bitLength();\n\n if (this.shift % 26 !== 0) {\n this.shift += 26 - this.shift % 26;\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo(num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom(num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul(a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul(a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm(a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);","'use strict';\n\nvar asn1 = exports;\nasn1.bignum = require('bn.js');\nasn1.define = require('./asn1/api').define;\nasn1.base = require('./asn1/base');\nasn1.constants = require('./asn1/constants');\nasn1.decoders = require('./asn1/decoders');\nasn1.encoders = require('./asn1/encoders');","'use strict';\n\nvar encoders = exports;\nencoders.der = require('./der');\nencoders.pem = require('./pem');","'use strict';\n\nvar inherits = require('inherits');\n\nvar Buffer = require('safer-buffer').Buffer;\n\nvar Node = require('../base/node'); // Import DER constants\n\n\nvar der = require('../constants/der');\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity; // Construct base tree\n\n this.tree = new DERNode();\n\n this.tree._init(entity.body);\n}\n\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n}; // Tree methods\n\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\n\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag, primitive, cls, content) {\n var encodedTag = encodeTag(tag, primitive, cls, this.reporter); // Short form\n\n if (content.length < 0x80) {\n var _header = Buffer.alloc(2);\n\n _header[0] = encodedTag;\n _header[1] = content.length;\n return this._createEncoderBuffer([_header, content]);\n } // Long form\n // Count octets required to store length\n\n\n var lenOctets = 1;\n\n for (var i = content.length; i >= 0x100; i >>= 8) {\n lenOctets++;\n }\n\n var header = Buffer.alloc(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (var _i = 1 + lenOctets, j = content.length; j > 0; _i--, j >>= 8) {\n header[_i] = j & 0xff;\n }\n\n return this._createEncoderBuffer([header, content]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([str.unused | 0, str.data]);\n } else if (tag === 'bmpstr') {\n var buf = Buffer.alloc(str.length * 2);\n\n for (var i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' + 'only digits and space');\n }\n\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' + 'only latin upper and lower case letters, ' + 'digits, space, apostrophe, left and rigth ' + 'parenthesis, plus sign, comma, hyphen, ' + 'dot, slash, colon, equal sign, ' + 'question mark');\n }\n\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values) return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id)) return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n\n for (var i = 0; i < id.length; i++) {\n id[i] |= 0;\n }\n } else if (Array.isArray(id)) {\n id = id.slice();\n\n for (var _i2 = 0; _i2 < id.length; _i2++) {\n id[_i2] |= 0;\n }\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' + 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40) return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n } // Count number of octets\n\n\n var size = 0;\n\n for (var _i3 = 0; _i3 < id.length; _i3++) {\n var ident = id[_i3];\n\n for (size++; ident >= 0x80; ident >>= 7) {\n size++;\n }\n }\n\n var objid = Buffer.alloc(size);\n var offset = objid.length - 1;\n\n for (var _i4 = id.length - 1; _i4 >= 0; _i4--) {\n var _ident = id[_i4];\n objid[offset--] = _ident & 0x7f;\n\n while ((_ident >>= 7) > 0) {\n objid[offset--] = 0x80 | _ident & 0x7f;\n }\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10) return '0' + num;else return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n var str;\n var date = new Date(time);\n\n if (tag === 'gentime') {\n str = [two(date.getUTCFullYear()), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');\n } else if (tag === 'utctime') {\n str = [two(date.getUTCFullYear() % 100), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), 'Z'].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values) return this.reporter.error('String int or enum given, but no values map');\n\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' + JSON.stringify(num));\n }\n\n num = values[num];\n } // Bignum, assume big endian\n\n\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n var numArray = num.toArray();\n\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n\n num = Buffer.from(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n var _size = num.length;\n if (num.length === 0) _size++;\n\n var _out = Buffer.alloc(_size);\n\n num.copy(_out);\n if (num.length === 0) _out[0] = 0;\n return this._createEncoderBuffer(_out);\n }\n\n if (num < 0x80) return this._createEncoderBuffer(num);\n if (num < 0x100) return this._createEncoderBuffer([0, num]);\n var size = 1;\n\n for (var i = num; i >= 0x100; i >>= 8) {\n size++;\n }\n\n var out = new Array(size);\n\n for (var _i5 = out.length - 1; _i5 >= 0; _i5--) {\n out[_i5] = num & 0xff;\n num >>= 8;\n }\n\n if (out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(Buffer.from(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function') entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n var state = this._baseState;\n var i;\n if (state['default'] === null) return false;\n var data = dataBuffer.join();\n if (state.defaultBuffer === undefined) state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n if (data.length !== state.defaultBuffer.length) return false;\n\n for (i = 0; i < data.length; i++) {\n if (data[i] !== state.defaultBuffer[i]) return false;\n }\n\n return true;\n}; // Utility methods\n\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n var res;\n if (tag === 'seqof') tag = 'seq';else if (tag === 'setof') tag = 'set';\n if (der.tagByName.hasOwnProperty(tag)) res = der.tagByName[tag];else if (typeof tag === 'number' && (tag | 0) === tag) res = tag;else return reporter.error('Unknown tag: ' + tag);\n if (res >= 0x1f) return reporter.error('Multi-octet tag encoding unsupported');\n if (!primitive) res |= 0x20;\n res |= der.tagClassByName[cls || 'universal'] << 6;\n return res;\n}","'use strict';\n\nvar decoders = exports;\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');","'use strict';\n\nvar inherits = require('inherits');\n\nvar bignum = require('bn.js');\n\nvar DecoderBuffer = require('../base/buffer').DecoderBuffer;\n\nvar Node = require('../base/node'); // Import DER constants\n\n\nvar der = require('../constants/der');\n\nfunction DERDecoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity; // Construct base tree\n\n this.tree = new DERNode();\n\n this.tree._init(entity.body);\n}\n\nmodule.exports = DERDecoder;\n\nDERDecoder.prototype.decode = function decode(data, options) {\n if (!DecoderBuffer.isDecoderBuffer(data)) {\n data = new DecoderBuffer(data, options);\n }\n\n return this.tree._decode(data, options);\n}; // Tree methods\n\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\n\ninherits(DERNode, Node);\n\nDERNode.prototype._peekTag = function peekTag(buffer, tag, any) {\n if (buffer.isEmpty()) return false;\n var state = buffer.save();\n var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n if (buffer.isError(decodedTag)) return decodedTag;\n buffer.restore(state);\n return decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + 'of' === tag || any;\n};\n\nDERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {\n var decodedTag = derDecodeTag(buffer, 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag)) return decodedTag;\n var len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of \"' + tag + '\"'); // Failure\n\n if (buffer.isError(len)) return len;\n\n if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + 'of' !== tag) {\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n }\n\n if (decodedTag.primitive || len !== null) return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"'); // Indefinite length... find END tag\n\n var state = buffer.save();\n\n var res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n\n if (buffer.isError(res)) return res;\n len = buffer.offset - state.offset;\n buffer.restore(state);\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n};\n\nDERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {\n for (;;) {\n var tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag)) return tag;\n var len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len)) return len;\n var res = void 0;\n if (tag.primitive || len !== null) res = buffer.skip(len);else res = this._skipUntilEnd(buffer, fail); // Failure\n\n if (buffer.isError(res)) return res;\n if (tag.tagStr === 'end') break;\n }\n};\n\nDERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, options) {\n var result = [];\n\n while (!buffer.isEmpty()) {\n var possibleEnd = this._peekTag(buffer, 'end');\n\n if (buffer.isError(possibleEnd)) return possibleEnd;\n var res = decoder.decode(buffer, 'der', options);\n if (buffer.isError(res) && possibleEnd) break;\n result.push(res);\n }\n\n return result;\n};\n\nDERNode.prototype._decodeStr = function decodeStr(buffer, tag) {\n if (tag === 'bitstr') {\n var unused = buffer.readUInt8();\n if (buffer.isError(unused)) return unused;\n return {\n unused: unused,\n data: buffer.raw()\n };\n } else if (tag === 'bmpstr') {\n var raw = buffer.raw();\n if (raw.length % 2 === 1) return buffer.error('Decoding of string type: bmpstr length mismatch');\n var str = '';\n\n for (var i = 0; i < raw.length / 2; i++) {\n str += String.fromCharCode(raw.readUInt16BE(i * 2));\n }\n\n return str;\n } else if (tag === 'numstr') {\n var numstr = buffer.raw().toString('ascii');\n\n if (!this._isNumstr(numstr)) {\n return buffer.error('Decoding of string type: ' + 'numstr unsupported characters');\n }\n\n return numstr;\n } else if (tag === 'octstr') {\n return buffer.raw();\n } else if (tag === 'objDesc') {\n return buffer.raw();\n } else if (tag === 'printstr') {\n var printstr = buffer.raw().toString('ascii');\n\n if (!this._isPrintstr(printstr)) {\n return buffer.error('Decoding of string type: ' + 'printstr unsupported characters');\n }\n\n return printstr;\n } else if (/str$/.test(tag)) {\n return buffer.raw().toString();\n } else {\n return buffer.error('Decoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {\n var result;\n var identifiers = [];\n var ident = 0;\n var subident = 0;\n\n while (!buffer.isEmpty()) {\n subident = buffer.readUInt8();\n ident <<= 7;\n ident |= subident & 0x7f;\n\n if ((subident & 0x80) === 0) {\n identifiers.push(ident);\n ident = 0;\n }\n }\n\n if (subident & 0x80) identifiers.push(ident);\n var first = identifiers[0] / 40 | 0;\n var second = identifiers[0] % 40;\n if (relative) result = identifiers;else result = [first, second].concat(identifiers.slice(1));\n\n if (values) {\n var tmp = values[result.join(' ')];\n if (tmp === undefined) tmp = values[result.join('.')];\n if (tmp !== undefined) result = tmp;\n }\n\n return result;\n};\n\nDERNode.prototype._decodeTime = function decodeTime(buffer, tag) {\n var str = buffer.raw().toString();\n var year;\n var mon;\n var day;\n var hour;\n var min;\n var sec;\n\n if (tag === 'gentime') {\n year = str.slice(0, 4) | 0;\n mon = str.slice(4, 6) | 0;\n day = str.slice(6, 8) | 0;\n hour = str.slice(8, 10) | 0;\n min = str.slice(10, 12) | 0;\n sec = str.slice(12, 14) | 0;\n } else if (tag === 'utctime') {\n year = str.slice(0, 2) | 0;\n mon = str.slice(2, 4) | 0;\n day = str.slice(4, 6) | 0;\n hour = str.slice(6, 8) | 0;\n min = str.slice(8, 10) | 0;\n sec = str.slice(10, 12) | 0;\n if (year < 70) year = 2000 + year;else year = 1900 + year;\n } else {\n return buffer.error('Decoding ' + tag + ' time is not supported yet');\n }\n\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n};\n\nDERNode.prototype._decodeNull = function decodeNull() {\n return null;\n};\n\nDERNode.prototype._decodeBool = function decodeBool(buffer) {\n var res = buffer.readUInt8();\n if (buffer.isError(res)) return res;else return res !== 0;\n};\n\nDERNode.prototype._decodeInt = function decodeInt(buffer, values) {\n // Bigint, return as it is (assume big endian)\n var raw = buffer.raw();\n var res = new bignum(raw);\n if (values) res = values[res.toString(10)] || res;\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function') entity = entity(obj);\n return entity._getDecoder('der').tree;\n}; // Utility methods\n\n\nfunction derDecodeTag(buf, fail) {\n var tag = buf.readUInt8(fail);\n if (buf.isError(tag)) return tag;\n var cls = der.tagClass[tag >> 6];\n var primitive = (tag & 0x20) === 0; // Multi-octet tag - load\n\n if ((tag & 0x1f) === 0x1f) {\n var oct = tag;\n tag = 0;\n\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct)) return oct;\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n\n var tagStr = der.tag[tag];\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n var len = buf.readUInt8(fail);\n if (buf.isError(len)) return len; // Indefinite form\n\n if (!primitive && len === 0x80) return null; // Definite form\n\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n } // Long form\n\n\n var num = len & 0x7f;\n if (num > 4) return buf.error('length octect is too long');\n len = 0;\n\n for (var i = 0; i < num; i++) {\n len <<= 8;\n var j = buf.readUInt8(fail);\n if (buf.isError(j)) return j;\n len |= j;\n }\n\n return len;\n}","var createHash = require('create-hash');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nmodule.exports = function (seed, len) {\n var t = Buffer.alloc(0);\n var i = 0;\n var c;\n\n while (t.length < len) {\n c = i2ops(i++);\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);\n }\n\n return t.slice(0, len);\n};\n\nfunction i2ops(c) {\n var out = Buffer.allocUnsafe(4);\n out.writeUInt32BE(c, 0);\n return out;\n}","module.exports = function xor(a, b) {\n var len = a.length;\n var i = -1;\n\n while (++i < len) {\n a[i] ^= b[i];\n }\n\n return a;\n};","var BN = require('bn.js');\n\nvar Buffer = require('safe-buffer').Buffer;\n\nfunction withPublic(paddedMsg, key) {\n return Buffer.from(paddedMsg.toRed(BN.mont(key.modulus)).redPow(new BN(key.publicExponent)).fromRed().toArray());\n}\n\nmodule.exports = withPublic;","function _typeof2(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof2(obj); }\n\n/**\n * vee-validate v2.2.15\n * (c) 2019 Abdelrahman Awad\n * @license MIT\n */\n// \nvar isTextInput = function isTextInput(el) {\n return includes(['text', 'password', 'search', 'email', 'tel', 'url', 'textarea', 'number'], el.type);\n};\n\nvar isCheckboxOrRadioInput = function isCheckboxOrRadioInput(el) {\n return includes(['radio', 'checkbox'], el.type);\n};\n\nvar isDateInput = function isDateInput(el) {\n return includes(['date', 'week', 'month', 'datetime-local', 'time'], el.type);\n};\n/**\n * Gets the data attribute. the name must be kebab-case.\n */\n\n\nvar getDataAttribute = function getDataAttribute(el, name) {\n return el.getAttribute(\"data-vv-\" + name);\n};\n\nvar isNaN$1 = function isNaN$1(value) {\n if ('isNaN' in Number) {\n return Number.isNaN(value);\n } // eslint-disable-next-line\n\n\n return typeof value === 'number' && value !== value;\n};\n/**\n * Checks if the values are either null or undefined.\n */\n\n\nvar isNullOrUndefined = function isNullOrUndefined() {\n var values = [],\n len = arguments.length;\n\n while (len--) {\n values[len] = arguments[len];\n }\n\n return values.every(function (value) {\n return value === null || value === undefined;\n });\n};\n/**\n * Creates the default flags object.\n */\n\n\nvar createFlags = function createFlags() {\n return {\n untouched: true,\n touched: false,\n dirty: false,\n pristine: true,\n valid: null,\n invalid: null,\n validated: false,\n pending: false,\n required: false,\n changed: false\n };\n};\n/**\n * Shallow object comparison.\n */\n\n\nvar isEqual = function isEqual(lhs, rhs) {\n if (lhs instanceof RegExp && rhs instanceof RegExp) {\n return isEqual(lhs.source, rhs.source) && isEqual(lhs.flags, rhs.flags);\n }\n\n if (Array.isArray(lhs) && Array.isArray(rhs)) {\n if (lhs.length !== rhs.length) {\n return false;\n }\n\n for (var i = 0; i < lhs.length; i++) {\n if (!isEqual(lhs[i], rhs[i])) {\n return false;\n }\n }\n\n return true;\n } // if both are objects, compare each key recursively.\n\n\n if (isObject(lhs) && isObject(rhs)) {\n return Object.keys(lhs).every(function (key) {\n return isEqual(lhs[key], rhs[key]);\n }) && Object.keys(rhs).every(function (key) {\n return isEqual(lhs[key], rhs[key]);\n });\n }\n\n if (isNaN$1(lhs) && isNaN$1(rhs)) {\n return true;\n }\n\n return lhs === rhs;\n};\n/**\n * Determines the input field scope.\n */\n\n\nvar getScope = function getScope(el) {\n var scope = getDataAttribute(el, 'scope');\n\n if (isNullOrUndefined(scope)) {\n var form = getForm(el);\n\n if (form) {\n scope = getDataAttribute(form, 'scope');\n }\n }\n\n return !isNullOrUndefined(scope) ? scope : null;\n};\n/**\n * Get the closest form element.\n */\n\n\nvar getForm = function getForm(el) {\n if (isNullOrUndefined(el)) {\n return null;\n }\n\n if (el.tagName === 'FORM') {\n return el;\n }\n\n if (!isNullOrUndefined(el.form)) {\n return el.form;\n }\n\n return !isNullOrUndefined(el.parentNode) ? getForm(el.parentNode) : null;\n};\n/**\n * Gets the value in an object safely.\n */\n\n\nvar getPath = function getPath(path, target, def) {\n if (def === void 0) def = undefined;\n\n if (!path || !target) {\n return def;\n }\n\n var value = target;\n path.split('.').every(function (prop) {\n if (prop in value) {\n value = value[prop];\n return true;\n }\n\n value = def;\n return false;\n });\n return value;\n};\n/**\n * Checks if path exists within an object.\n */\n\n\nvar hasPath = function hasPath(path, target) {\n var obj = target;\n var previousPath = null;\n var isNullOrNonObject = false;\n var isValidPath = path.split('.').reduce(function (reducer, prop) {\n if (obj == null || _typeof2(obj) !== 'object') {\n isNullOrNonObject = true;\n return reducer && false;\n }\n\n if (prop in obj) {\n obj = obj[prop];\n previousPath = previousPath === null ? prop : previousPath + '.' + prop;\n return reducer && true;\n }\n\n return reducer && false;\n }, true);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isNullOrNonObject) {\n throw new Error(previousPath + ' is not an object');\n }\n }\n\n return isValidPath;\n};\n/**\n * Parses a rule string expression.\n */\n\n\nvar parseRule = function parseRule(rule) {\n var params = [];\n var name = rule.split(':')[0];\n\n if (includes(rule, ':')) {\n params = rule.split(':').slice(1).join(':').split(',');\n }\n\n return {\n name: name,\n params: params\n };\n};\n/**\n * Debounces a function.\n */\n\n\nvar debounce = function debounce(fn, wait, token) {\n if (wait === void 0) wait = 0;\n if (token === void 0) token = {\n cancelled: false\n };\n\n if (wait === 0) {\n return fn;\n }\n\n var timeout;\n return function () {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n var later = function later() {\n timeout = null; // check if the fn call was cancelled.\n\n if (!token.cancelled) {\n fn.apply(void 0, args);\n }\n };\n\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n\n if (!timeout) {\n fn.apply(void 0, args);\n }\n };\n};\n/**\n * Appends a rule definition to a list of rules.\n */\n\n\nvar appendRule = function appendRule(rule, rules) {\n if (!rules) {\n return normalizeRules(rule);\n }\n\n if (!rule) {\n return normalizeRules(rules);\n }\n\n if (typeof rules === 'string') {\n rules = normalizeRules(rules);\n }\n\n return assign({}, rules, normalizeRules(rule));\n};\n/**\n * Normalizes the given rules expression.\n */\n\n\nvar normalizeRules = function normalizeRules(rules) {\n // if falsy value return an empty object.\n if (!rules) {\n return {};\n }\n\n if (isObject(rules)) {\n // $FlowFixMe\n return Object.keys(rules).reduce(function (prev, curr) {\n var params = []; // $FlowFixMe\n\n if (rules[curr] === true) {\n params = [];\n } else if (Array.isArray(rules[curr])) {\n params = rules[curr];\n } else if (isObject(rules[curr])) {\n params = rules[curr];\n } else {\n params = [rules[curr]];\n } // $FlowFixMe\n\n\n if (rules[curr] !== false) {\n prev[curr] = params;\n }\n\n return prev;\n }, {});\n }\n\n if (typeof rules !== 'string') {\n warn('rules must be either a string or an object.');\n return {};\n }\n\n return rules.split('|').reduce(function (prev, rule) {\n var parsedRule = parseRule(rule);\n\n if (!parsedRule.name) {\n return prev;\n }\n\n prev[parsedRule.name] = parsedRule.params;\n return prev;\n }, {});\n};\n/**\n * Emits a warning to the console.\n */\n\n\nvar warn = function warn(message) {\n console.warn(\"[vee-validate] \" + message); // eslint-disable-line\n};\n/**\n * Creates a branded error object.\n */\n\n\nvar createError = function createError(message) {\n return new Error(\"[vee-validate] \" + message);\n};\n/**\n * Checks if the value is an object.\n */\n\n\nvar isObject = function isObject(obj) {\n return obj !== null && obj && _typeof2(obj) === 'object' && !Array.isArray(obj);\n};\n/**\n * Checks if a function is callable.\n */\n\n\nvar isCallable = function isCallable(func) {\n return typeof func === 'function';\n};\n/**\n * Check if element has the css class on it.\n */\n\n\nvar hasClass = function hasClass(el, className) {\n if (el.classList) {\n return el.classList.contains(className);\n }\n\n return !!el.className.match(new RegExp(\"(\\\\s|^)\" + className + \"(\\\\s|$)\"));\n};\n/**\n * Adds the provided css className to the element.\n */\n\n\nvar addClass = function addClass(el, className) {\n if (el.classList) {\n el.classList.add(className);\n return;\n }\n\n if (!hasClass(el, className)) {\n el.className += \" \" + className;\n }\n};\n/**\n * Remove the provided css className from the element.\n */\n\n\nvar removeClass = function removeClass(el, className) {\n if (el.classList) {\n el.classList.remove(className);\n return;\n }\n\n if (hasClass(el, className)) {\n var reg = new RegExp(\"(\\\\s|^)\" + className + \"(\\\\s|$)\");\n el.className = el.className.replace(reg, ' ');\n }\n};\n/**\n * Adds or removes a class name on the input depending on the status flag.\n */\n\n\nvar toggleClass = function toggleClass(el, className, status) {\n if (!el || !className) {\n return;\n }\n\n if (Array.isArray(className)) {\n className.forEach(function (item) {\n return toggleClass(el, item, status);\n });\n return;\n }\n\n if (status) {\n return addClass(el, className);\n }\n\n removeClass(el, className);\n};\n/**\n * Converts an array-like object to array, provides a simple polyfill for Array.from\n */\n\n\nvar toArray = function toArray(arrayLike) {\n if (isCallable(Array.from)) {\n return Array.from(arrayLike);\n }\n\n var array = [];\n var length = arrayLike.length;\n /* istanbul ignore next */\n\n for (var i = 0; i < length; i++) {\n array.push(arrayLike[i]);\n }\n /* istanbul ignore next */\n\n\n return array;\n};\n/**\n * Converts an array-like object to array and place other elements in an array\n */\n\n\nvar ensureArray = function ensureArray(arrayLike) {\n if (Array.isArray(arrayLike)) {\n return [].concat(arrayLike);\n }\n\n var array = toArray(arrayLike);\n return isEmptyArray(array) ? [arrayLike] : array;\n};\n/**\n * Assign polyfill from the mdn.\n */\n\n\nvar assign = function assign(target) {\n var others = [],\n len = arguments.length - 1;\n\n while (len-- > 0) {\n others[len] = arguments[len + 1];\n }\n /* istanbul ignore else */\n\n\n if (isCallable(Object.assign)) {\n return Object.assign.apply(Object, [target].concat(others));\n }\n /* istanbul ignore next */\n\n\n if (target == null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n /* istanbul ignore next */\n\n\n var to = Object(target);\n /* istanbul ignore next */\n\n others.forEach(function (arg) {\n // Skip over if undefined or null\n if (arg != null) {\n Object.keys(arg).forEach(function (key) {\n to[key] = arg[key];\n });\n }\n });\n /* istanbul ignore next */\n\n return to;\n};\n\nvar id = 0;\nvar idTemplate = '{id}';\n/**\n * Generates a unique id.\n */\n\nvar uniqId = function uniqId() {\n // handle too many uses of uniqId, although unlikely.\n if (id >= 9999) {\n id = 0; // shift the template.\n\n idTemplate = idTemplate.replace('{id}', '_{id}');\n }\n\n id++;\n var newId = idTemplate.replace('{id}', String(id));\n return newId;\n};\n\nvar findIndex = function findIndex(arrayLike, predicate) {\n var array = Array.isArray(arrayLike) ? arrayLike : toArray(arrayLike);\n\n for (var i = 0; i < array.length; i++) {\n if (predicate(array[i])) {\n return i;\n }\n }\n\n return -1;\n};\n/**\n * finds the first element that satisfies the predicate callback, polyfills array.find\n */\n\n\nvar find = function find(arrayLike, predicate) {\n var array = Array.isArray(arrayLike) ? arrayLike : toArray(arrayLike);\n var idx = findIndex(array, predicate);\n return idx === -1 ? undefined : array[idx];\n};\n\nvar isBuiltInComponent = function isBuiltInComponent(vnode) {\n if (!vnode) {\n return false;\n }\n\n var tag = vnode.componentOptions.tag;\n return /^(keep-alive|transition|transition-group)$/.test(tag);\n};\n\nvar makeDelayObject = function makeDelayObject(events, delay, delayConfig) {\n if (typeof delay === 'number') {\n return events.reduce(function (prev, e) {\n prev[e] = delay;\n return prev;\n }, {});\n }\n\n return events.reduce(function (prev, e) {\n if (_typeof2(delay) === 'object' && e in delay) {\n prev[e] = delay[e];\n return prev;\n }\n\n if (typeof delayConfig === 'number') {\n prev[e] = delayConfig;\n return prev;\n }\n\n prev[e] = delayConfig && delayConfig[e] || 0;\n return prev;\n }, {});\n};\n\nvar deepParseInt = function deepParseInt(input) {\n if (typeof input === 'number') {\n return input;\n }\n\n if (typeof input === 'string') {\n return parseInt(input);\n }\n\n var map = {};\n\n for (var element in input) {\n map[element] = parseInt(input[element]);\n }\n\n return map;\n};\n\nvar merge = function merge(target, source) {\n if (!(isObject(target) && isObject(source))) {\n return target;\n }\n\n Object.keys(source).forEach(function (key) {\n var obj, obj$1;\n\n if (isObject(source[key])) {\n if (!target[key]) {\n assign(target, (obj = {}, obj[key] = {}, obj));\n }\n\n merge(target[key], source[key]);\n return;\n }\n\n assign(target, (obj$1 = {}, obj$1[key] = source[key], obj$1));\n });\n return target;\n};\n\nvar fillRulesFromElement = function fillRulesFromElement(el, rules) {\n if (el.required) {\n rules = appendRule('required', rules);\n }\n\n if (isTextInput(el)) {\n if (el.type === 'email') {\n rules = appendRule(\"email\" + (el.multiple ? ':multiple' : ''), rules);\n }\n\n if (el.pattern) {\n rules = appendRule({\n regex: el.pattern\n }, rules);\n } // 524288 is the max on some browsers and test environments.\n\n\n if (el.maxLength >= 0 && el.maxLength < 524288) {\n rules = appendRule(\"max:\" + el.maxLength, rules);\n }\n\n if (el.minLength > 0) {\n rules = appendRule(\"min:\" + el.minLength, rules);\n }\n\n if (el.type === 'number') {\n rules = appendRule('decimal', rules);\n\n if (el.min !== '') {\n rules = appendRule(\"min_value:\" + el.min, rules);\n }\n\n if (el.max !== '') {\n rules = appendRule(\"max_value:\" + el.max, rules);\n }\n }\n\n return rules;\n }\n\n if (isDateInput(el)) {\n var timeFormat = el.step && Number(el.step) < 60 ? 'HH:mm:ss' : 'HH:mm';\n\n if (el.type === 'date') {\n return appendRule('date_format:yyyy-MM-dd', rules);\n }\n\n if (el.type === 'datetime-local') {\n return appendRule(\"date_format:yyyy-MM-ddT\" + timeFormat, rules);\n }\n\n if (el.type === 'month') {\n return appendRule('date_format:yyyy-MM', rules);\n }\n\n if (el.type === 'week') {\n return appendRule('date_format:yyyy-[W]WW', rules);\n }\n\n if (el.type === 'time') {\n return appendRule(\"date_format:\" + timeFormat, rules);\n }\n }\n\n return rules;\n};\n\nvar values = function values(obj) {\n if (isCallable(Object.values)) {\n return Object.values(obj);\n } // fallback to keys()\n\n /* istanbul ignore next */\n\n\n return Object.keys(obj).map(function (k) {\n return obj[k];\n });\n};\n\nvar parseSelector = function parseSelector(selector) {\n var rule = null;\n\n if (includes(selector, ':')) {\n rule = selector.split(':').pop();\n selector = selector.replace(\":\" + rule, '');\n }\n\n if (selector[0] === '#') {\n return {\n id: selector.slice(1),\n rule: rule,\n name: null,\n scope: null\n };\n }\n\n var scope = null;\n var name = selector;\n\n if (includes(selector, '.')) {\n var parts = selector.split('.');\n scope = parts[0];\n name = parts.slice(1).join('.');\n }\n\n return {\n id: null,\n scope: scope,\n name: name,\n rule: rule\n };\n};\n\nvar includes = function includes(collection, item) {\n return collection.indexOf(item) !== -1;\n};\n\nvar isEmptyArray = function isEmptyArray(arr) {\n return Array.isArray(arr) && arr.length === 0;\n};\n\nvar defineNonReactive = function defineNonReactive(obj, prop, value) {\n Object.defineProperty(obj, prop, {\n configurable: false,\n writable: true,\n value: value\n });\n}; // \n\n\nvar LOCALE = 'en';\n\nvar Dictionary = function Dictionary(dictionary) {\n if (dictionary === void 0) dictionary = {};\n this.container = {};\n this.merge(dictionary);\n};\n\nvar prototypeAccessors = {\n locale: {\n configurable: true\n }\n};\n\nprototypeAccessors.locale.get = function () {\n return LOCALE;\n};\n\nprototypeAccessors.locale.set = function (value) {\n LOCALE = value || 'en';\n};\n\nDictionary.prototype.hasLocale = function hasLocale(locale) {\n return !!this.container[locale];\n};\n\nDictionary.prototype.setDateFormat = function setDateFormat(locale, format) {\n if (!this.container[locale]) {\n this.container[locale] = {};\n }\n\n this.container[locale].dateFormat = format;\n};\n\nDictionary.prototype.getDateFormat = function getDateFormat(locale) {\n if (!this.container[locale] || !this.container[locale].dateFormat) {\n return null;\n }\n\n return this.container[locale].dateFormat;\n};\n\nDictionary.prototype.getMessage = function getMessage(locale, key, data) {\n var message = null;\n\n if (!this.hasMessage(locale, key)) {\n message = this._getDefaultMessage(locale);\n } else {\n message = this.container[locale].messages[key];\n }\n\n return isCallable(message) ? message.apply(void 0, data) : message;\n};\n/**\n * Gets a specific message for field. falls back to the rule message.\n */\n\n\nDictionary.prototype.getFieldMessage = function getFieldMessage(locale, field, key, data) {\n if (!this.hasLocale(locale)) {\n return this.getMessage(locale, key, data);\n }\n\n var dict = this.container[locale].custom && this.container[locale].custom[field];\n\n if (!dict || !dict[key]) {\n return this.getMessage(locale, key, data);\n }\n\n var message = dict[key];\n return isCallable(message) ? message.apply(void 0, data) : message;\n};\n\nDictionary.prototype._getDefaultMessage = function _getDefaultMessage(locale) {\n if (this.hasMessage(locale, '_default')) {\n return this.container[locale].messages._default;\n }\n\n return this.container.en.messages._default;\n};\n\nDictionary.prototype.getAttribute = function getAttribute(locale, key, fallback) {\n if (fallback === void 0) fallback = '';\n\n if (!this.hasAttribute(locale, key)) {\n return fallback;\n }\n\n return this.container[locale].attributes[key];\n};\n\nDictionary.prototype.hasMessage = function hasMessage(locale, key) {\n return !!(this.hasLocale(locale) && this.container[locale].messages && this.container[locale].messages[key]);\n};\n\nDictionary.prototype.hasAttribute = function hasAttribute(locale, key) {\n return !!(this.hasLocale(locale) && this.container[locale].attributes && this.container[locale].attributes[key]);\n};\n\nDictionary.prototype.merge = function merge$1(dictionary) {\n merge(this.container, dictionary);\n};\n\nDictionary.prototype.setMessage = function setMessage(locale, key, message) {\n if (!this.hasLocale(locale)) {\n this.container[locale] = {\n messages: {},\n attributes: {}\n };\n }\n\n if (!this.container[locale].messages) {\n this.container[locale].messages = {};\n }\n\n this.container[locale].messages[key] = message;\n};\n\nDictionary.prototype.setAttribute = function setAttribute(locale, key, attribute) {\n if (!this.hasLocale(locale)) {\n this.container[locale] = {\n messages: {},\n attributes: {}\n };\n }\n\n this.container[locale].attributes[key] = attribute;\n};\n\nObject.defineProperties(Dictionary.prototype, prototypeAccessors);\nvar drivers = {\n default: new Dictionary({\n en: {\n messages: {},\n attributes: {},\n custom: {}\n }\n })\n};\nvar currentDriver = 'default';\n\nvar DictionaryResolver = function DictionaryResolver() {};\n\nDictionaryResolver._checkDriverName = function _checkDriverName(driver) {\n if (!driver) {\n throw createError('you must provide a name to the dictionary driver');\n }\n};\n\nDictionaryResolver.setDriver = function setDriver(driver, implementation) {\n if (implementation === void 0) implementation = null;\n\n this._checkDriverName(driver);\n\n if (implementation) {\n drivers[driver] = implementation;\n }\n\n currentDriver = driver;\n};\n\nDictionaryResolver.getDriver = function getDriver() {\n return drivers[currentDriver];\n}; // \n\n\nvar ErrorBag = function ErrorBag(errorBag, id) {\n if (errorBag === void 0) errorBag = null;\n if (id === void 0) id = null;\n this.vmId = id || null; // make this bag a mirror of the provided one, sharing the same items reference.\n\n if (errorBag && errorBag instanceof ErrorBag) {\n this.items = errorBag.items;\n } else {\n this.items = [];\n }\n};\n\nErrorBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {\n var this$1 = this;\n var index = 0;\n return {\n next: function next() {\n return {\n value: this$1.items[index++],\n done: index > this$1.items.length\n };\n }\n };\n};\n/**\n * Adds an error to the internal array.\n */\n\n\nErrorBag.prototype.add = function add(error) {\n var ref;\n (ref = this.items).push.apply(ref, this._normalizeError(error));\n};\n/**\n * Normalizes passed errors to an error array.\n */\n\n\nErrorBag.prototype._normalizeError = function _normalizeError(error) {\n var this$1 = this;\n\n if (Array.isArray(error)) {\n return error.map(function (e) {\n e.scope = !isNullOrUndefined(e.scope) ? e.scope : null;\n e.vmId = !isNullOrUndefined(e.vmId) ? e.vmId : this$1.vmId || null;\n return e;\n });\n }\n\n error.scope = !isNullOrUndefined(error.scope) ? error.scope : null;\n error.vmId = !isNullOrUndefined(error.vmId) ? error.vmId : this.vmId || null;\n return [error];\n};\n/**\n * Regenrates error messages if they have a generator function.\n */\n\n\nErrorBag.prototype.regenerate = function regenerate() {\n this.items.forEach(function (i) {\n i.msg = isCallable(i.regenerate) ? i.regenerate() : i.msg;\n });\n};\n/**\n * Updates a field error with the new field scope.\n */\n\n\nErrorBag.prototype.update = function update(id, error) {\n var item = find(this.items, function (i) {\n return i.id === id;\n });\n\n if (!item) {\n return;\n }\n\n var idx = this.items.indexOf(item);\n this.items.splice(idx, 1);\n item.scope = error.scope;\n this.items.push(item);\n};\n/**\n * Gets all error messages from the internal array.\n */\n\n\nErrorBag.prototype.all = function all(scope) {\n var this$1 = this;\n\n var filterFn = function filterFn(item) {\n var matchesScope = true;\n var matchesVM = true;\n\n if (!isNullOrUndefined(scope)) {\n matchesScope = item.scope === scope;\n }\n\n if (!isNullOrUndefined(this$1.vmId)) {\n matchesVM = item.vmId === this$1.vmId;\n }\n\n return matchesVM && matchesScope;\n };\n\n return this.items.filter(filterFn).map(function (e) {\n return e.msg;\n });\n};\n/**\n * Checks if there are any errors in the internal array.\n */\n\n\nErrorBag.prototype.any = function any(scope) {\n var this$1 = this;\n\n var filterFn = function filterFn(item) {\n var matchesScope = true;\n var matchesVM = true;\n\n if (!isNullOrUndefined(scope)) {\n matchesScope = item.scope === scope;\n }\n\n if (!isNullOrUndefined(this$1.vmId)) {\n matchesVM = item.vmId === this$1.vmId;\n }\n\n return matchesVM && matchesScope;\n };\n\n return !!this.items.filter(filterFn).length;\n};\n/**\n * Removes all items from the internal array.\n */\n\n\nErrorBag.prototype.clear = function clear(scope) {\n var this$1 = this;\n var matchesVM = isNullOrUndefined(this.vmId) ? function () {\n return true;\n } : function (i) {\n return i.vmId === this$1.vmId;\n };\n\n var matchesScope = function matchesScope(i) {\n return i.scope === scope;\n };\n\n if (arguments.length === 0) {\n matchesScope = function matchesScope() {\n return true;\n };\n } else if (isNullOrUndefined(scope)) {\n scope = null;\n }\n\n for (var i = 0; i < this.items.length; ++i) {\n if (matchesVM(this.items[i]) && matchesScope(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n/**\n * Collects errors into groups or for a specific field.\n */\n\n\nErrorBag.prototype.collect = function collect(field, scope, map) {\n var this$1 = this;\n if (map === void 0) map = true;\n var isSingleField = !isNullOrUndefined(field) && !field.includes('*');\n\n var groupErrors = function groupErrors(items) {\n var errors = items.reduce(function (collection, error) {\n if (!isNullOrUndefined(this$1.vmId) && error.vmId !== this$1.vmId) {\n return collection;\n }\n\n if (!collection[error.field]) {\n collection[error.field] = [];\n }\n\n collection[error.field].push(map ? error.msg : error);\n return collection;\n }, {}); // reduce the collection to be a single array.\n\n if (isSingleField) {\n return values(errors)[0] || [];\n }\n\n return errors;\n };\n\n if (isNullOrUndefined(field)) {\n return groupErrors(this.items);\n }\n\n var selector = isNullOrUndefined(scope) ? String(field) : scope + \".\" + field;\n\n var ref = this._makeCandidateFilters(selector);\n\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n var collected = this.items.reduce(function (prev, curr) {\n if (isPrimary(curr)) {\n prev.primary.push(curr);\n }\n\n if (isAlt(curr)) {\n prev.alt.push(curr);\n }\n\n return prev;\n }, {\n primary: [],\n alt: []\n });\n collected = collected.primary.length ? collected.primary : collected.alt;\n return groupErrors(collected);\n};\n/**\n * Gets the internal array length.\n */\n\n\nErrorBag.prototype.count = function count() {\n var this$1 = this;\n\n if (this.vmId) {\n return this.items.filter(function (e) {\n return e.vmId === this$1.vmId;\n }).length;\n }\n\n return this.items.length;\n};\n/**\n * Finds and fetches the first error message for the specified field id.\n */\n\n\nErrorBag.prototype.firstById = function firstById(id) {\n var error = find(this.items, function (i) {\n return i.id === id;\n });\n return error ? error.msg : undefined;\n};\n/**\n * Gets the first error message for a specific field.\n */\n\n\nErrorBag.prototype.first = function first(field, scope) {\n if (scope === void 0) scope = null;\n var selector = isNullOrUndefined(scope) ? field : scope + \".\" + field;\n\n var match = this._match(selector);\n\n return match && match.msg;\n};\n/**\n * Returns the first error rule for the specified field\n */\n\n\nErrorBag.prototype.firstRule = function firstRule(field, scope) {\n var errors = this.collect(field, scope, false);\n return errors.length && errors[0].rule || undefined;\n};\n/**\n * Checks if the internal array has at least one error for the specified field.\n */\n\n\nErrorBag.prototype.has = function has(field, scope) {\n if (scope === void 0) scope = null;\n return !!this.first(field, scope);\n};\n/**\n * Gets the first error message for a specific field and a rule.\n */\n\n\nErrorBag.prototype.firstByRule = function firstByRule(name, rule, scope) {\n if (scope === void 0) scope = null;\n var error = this.collect(name, scope, false).filter(function (e) {\n return e.rule === rule;\n })[0];\n return error && error.msg || undefined;\n};\n/**\n * Gets the first error message for a specific field that not match the rule.\n */\n\n\nErrorBag.prototype.firstNot = function firstNot(name, rule, scope) {\n if (rule === void 0) rule = 'required';\n if (scope === void 0) scope = null;\n var error = this.collect(name, scope, false).filter(function (e) {\n return e.rule !== rule;\n })[0];\n return error && error.msg || undefined;\n};\n/**\n * Removes errors by matching against the id or ids.\n */\n\n\nErrorBag.prototype.removeById = function removeById(id) {\n var condition = function condition(item) {\n return item.id === id;\n };\n\n if (Array.isArray(id)) {\n condition = function condition(item) {\n return id.indexOf(item.id) !== -1;\n };\n }\n\n for (var i = 0; i < this.items.length; ++i) {\n if (condition(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n/**\n * Removes all error messages associated with a specific field.\n */\n\n\nErrorBag.prototype.remove = function remove(field, scope, vmId) {\n if (isNullOrUndefined(field)) {\n return;\n }\n\n var selector = isNullOrUndefined(scope) ? String(field) : scope + \".\" + field;\n\n var ref = this._makeCandidateFilters(selector);\n\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n\n var matches = function matches(item) {\n return isPrimary(item) || isAlt(item);\n };\n\n var shouldRemove = function shouldRemove(item) {\n if (isNullOrUndefined(vmId)) {\n return matches(item);\n }\n\n return matches(item) && item.vmId === vmId;\n };\n\n for (var i = 0; i < this.items.length; ++i) {\n if (shouldRemove(this.items[i])) {\n this.items.splice(i, 1);\n --i;\n }\n }\n};\n\nErrorBag.prototype._makeCandidateFilters = function _makeCandidateFilters(selector) {\n var this$1 = this;\n\n var matchesRule = function matchesRule() {\n return true;\n };\n\n var matchesScope = function matchesScope() {\n return true;\n };\n\n var matchesName = function matchesName() {\n return true;\n };\n\n var matchesVM = function matchesVM() {\n return true;\n };\n\n var ref = parseSelector(selector);\n var id = ref.id;\n var rule = ref.rule;\n var scope = ref.scope;\n var name = ref.name;\n\n if (rule) {\n matchesRule = function matchesRule(item) {\n return item.rule === rule;\n };\n } // match by id, can be combined with rule selection.\n\n\n if (id) {\n return {\n isPrimary: function isPrimary(item) {\n return matchesRule(item) && function (item) {\n return id === item.id;\n };\n },\n isAlt: function isAlt() {\n return false;\n }\n };\n }\n\n if (isNullOrUndefined(scope)) {\n // if no scope specified, make sure the found error has no scope.\n matchesScope = function matchesScope(item) {\n return isNullOrUndefined(item.scope);\n };\n } else {\n matchesScope = function matchesScope(item) {\n return item.scope === scope;\n };\n }\n\n if (!isNullOrUndefined(name) && name !== '*') {\n matchesName = function matchesName(item) {\n return item.field === name;\n };\n }\n\n if (!isNullOrUndefined(this.vmId)) {\n matchesVM = function matchesVM(item) {\n return item.vmId === this$1.vmId;\n };\n } // matches the first candidate.\n\n\n var isPrimary = function isPrimary(item) {\n return matchesVM(item) && matchesName(item) && matchesRule(item) && matchesScope(item);\n }; // matches a second candidate, which is a field with a name containing the '.' character.\n\n\n var isAlt = function isAlt(item) {\n return matchesVM(item) && matchesRule(item) && item.field === scope + \".\" + name;\n };\n\n return {\n isPrimary: isPrimary,\n isAlt: isAlt\n };\n};\n\nErrorBag.prototype._match = function _match(selector) {\n if (isNullOrUndefined(selector)) {\n return undefined;\n }\n\n var ref = this._makeCandidateFilters(selector);\n\n var isPrimary = ref.isPrimary;\n var isAlt = ref.isAlt;\n return this.items.reduce(function (prev, item, idx, arr) {\n var isLast = idx === arr.length - 1;\n\n if (prev.primary) {\n return isLast ? prev.primary : prev;\n }\n\n if (isPrimary(item)) {\n prev.primary = item;\n }\n\n if (isAlt(item)) {\n prev.alt = item;\n } // keep going.\n\n\n if (!isLast) {\n return prev;\n }\n\n return prev.primary || prev.alt;\n }, {});\n};\n\nvar DEFAULT_CONFIG = {\n locale: 'en',\n delay: 0,\n errorBagName: 'errors',\n dictionary: null,\n fieldsBagName: 'fields',\n classes: false,\n classNames: null,\n events: 'input',\n inject: true,\n fastExit: true,\n aria: true,\n validity: false,\n mode: 'aggressive',\n useConstraintAttrs: true,\n i18n: null,\n i18nRootKey: 'validation'\n};\nvar currentConfig = assign({}, DEFAULT_CONFIG);\n\nvar resolveConfig = function resolveConfig(ctx) {\n var selfConfig = getPath('$options.$_veeValidate', ctx, {});\n return assign({}, currentConfig, selfConfig);\n};\n\nvar getConfig = function getConfig() {\n return currentConfig;\n};\n\nvar setConfig = function setConfig(newConf) {\n currentConfig = assign({}, currentConfig, newConf);\n}; // VNode Utils\n// Gets the model object on the vnode.\n\n\nfunction findModel(vnode) {\n if (!vnode.data) {\n return null;\n } // Component Model\n\n\n if (vnode.data.model) {\n return vnode.data.model;\n }\n\n return !!vnode.data.directives && find(vnode.data.directives, function (d) {\n return d.name === 'model';\n });\n}\n\nfunction extractChildren(vnode) {\n if (Array.isArray(vnode)) {\n return vnode;\n }\n\n if (Array.isArray(vnode.children)) {\n return vnode.children;\n }\n\n if (vnode.componentOptions && Array.isArray(vnode.componentOptions.children)) {\n return vnode.componentOptions.children;\n }\n\n return [];\n}\n\nfunction extractVNodes(vnode) {\n if (findModel(vnode)) {\n return [vnode];\n }\n\n var children = extractChildren(vnode);\n return children.reduce(function (nodes, node) {\n var candidates = extractVNodes(node);\n\n if (candidates.length) {\n nodes.push.apply(nodes, candidates);\n }\n\n return nodes;\n }, []);\n} // Resolves v-model config if exists.\n\n\nfunction findModelConfig(vnode) {\n if (!vnode.componentOptions) {\n return null;\n }\n\n return vnode.componentOptions.Ctor.options.model;\n} // Adds a listener to vnode listener object.\n\n\nfunction mergeVNodeListeners(obj, eventName, handler) {\n // Has a single listener, convert to array.\n if (isCallable(obj[eventName])) {\n var prevHandler = obj[eventName];\n obj[eventName] = [prevHandler];\n } // no listeners, create the array.\n\n\n if (isNullOrUndefined(obj[eventName])) {\n obj[eventName] = [];\n }\n\n obj[eventName].push(handler);\n} // Adds a listener to a native HTML vnode.\n\n\nfunction addNativeNodeListener(node, eventName, handler) {\n if (isNullOrUndefined(node.data.on)) {\n node.data.on = {};\n }\n\n mergeVNodeListeners(node.data.on, eventName, handler);\n} // Adds a listener to a Vue component vnode.\n\n\nfunction addComponentNodeListener(node, eventName, handler) {\n /* istanbul ignore next */\n if (!node.componentOptions.listeners) {\n node.componentOptions.listeners = {};\n }\n\n mergeVNodeListeners(node.componentOptions.listeners, eventName, handler);\n}\n\nfunction addVNodeListener(vnode, eventName, handler) {\n if (vnode.componentOptions) {\n addComponentNodeListener(vnode, eventName, handler);\n return;\n }\n\n addNativeNodeListener(vnode, eventName, handler);\n} // Determines if `change` should be used over `input` for listeners.\n\n\nfunction getInputEventName(vnode, model) {\n // Is a component.\n if (vnode.componentOptions) {\n var ref = findModelConfig(vnode) || {\n event: 'input'\n };\n var event = ref.event;\n return event;\n } // Lazy Models and select tag typically use change event\n\n\n if (model && model.modifiers && model.modifiers.lazy || vnode.tag === 'select') {\n return 'change';\n } // is a textual-type input.\n\n\n if (vnode.data.attrs && isTextInput({\n type: vnode.data.attrs.type || 'text'\n })) {\n return 'input';\n }\n\n return 'change';\n}\n\nfunction normalizeSlots(slots, ctx) {\n return Object.keys(slots).reduce(function (arr, key) {\n slots[key].forEach(function (vnode) {\n if (!vnode.context) {\n slots[key].context = ctx;\n\n if (!vnode.data) {\n vnode.data = {};\n }\n\n vnode.data.slot = key;\n }\n });\n return arr.concat(slots[key]);\n }, []);\n}\n\nfunction createRenderless(h, children) {\n // Only render the first item of the node.\n if (Array.isArray(children) && children[0]) {\n return children[0];\n } // a single node.\n\n\n if (children) {\n return children;\n } // No slots, render nothing.\n\n\n return h();\n}\n/**\n * Generates the options required to construct a field.\n */\n\n\nvar Resolver = function Resolver() {};\n\nResolver.generate = function generate(el, binding, vnode) {\n var model = Resolver.resolveModel(binding, vnode);\n var options = resolveConfig(vnode.context);\n return {\n name: Resolver.resolveName(el, vnode),\n el: el,\n listen: !binding.modifiers.disable,\n bails: binding.modifiers.bails ? true : binding.modifiers.continues === true ? false : undefined,\n scope: Resolver.resolveScope(el, binding, vnode),\n vm: vnode.context,\n expression: binding.value,\n component: vnode.componentInstance,\n classes: options.classes,\n classNames: options.classNames,\n getter: Resolver.resolveGetter(el, vnode, model),\n events: Resolver.resolveEvents(el, vnode) || options.events,\n model: model,\n delay: Resolver.resolveDelay(el, vnode, options),\n rules: Resolver.resolveRules(el, binding, vnode),\n immediate: !!binding.modifiers.initial || !!binding.modifiers.immediate,\n persist: !!binding.modifiers.persist,\n validity: options.validity && !vnode.componentInstance,\n aria: options.aria && !vnode.componentInstance,\n initialValue: Resolver.resolveInitialValue(vnode)\n };\n};\n\nResolver.getCtorConfig = function getCtorConfig(vnode) {\n if (!vnode.componentInstance) {\n return null;\n }\n\n var config = getPath('componentInstance.$options.$_veeValidate', vnode);\n return config;\n};\n/**\n * Resolves the rules defined on an element.\n */\n\n\nResolver.resolveRules = function resolveRules(el, binding, vnode) {\n var rules = '';\n\n if (!binding.value && (!binding || !binding.expression)) {\n rules = getDataAttribute(el, 'rules');\n }\n\n if (binding.value && includes(['string', 'object'], _typeof2(binding.value.rules))) {\n rules = binding.value.rules;\n } else if (binding.value) {\n rules = binding.value;\n }\n\n if (vnode.componentInstance) {\n return rules;\n } // If validity is disabled, ignore field rules.\n\n\n var normalized = normalizeRules(rules);\n\n if (!getConfig().useConstraintAttrs) {\n return normalized;\n }\n\n return assign({}, fillRulesFromElement(el, {}), normalized);\n};\n/**\n * @param {*} vnode\n */\n\n\nResolver.resolveInitialValue = function resolveInitialValue(vnode) {\n var model = vnode.data.model || find(vnode.data.directives, function (d) {\n return d.name === 'model';\n });\n return model && model.value;\n};\n/**\n * Resolves the delay value.\n * @param {*} el\n * @param {*} vnode\n * @param {Object} options\n */\n\n\nResolver.resolveDelay = function resolveDelay(el, vnode, options) {\n var delay = getDataAttribute(el, 'delay');\n var globalDelay = options && 'delay' in options ? options.delay : 0;\n\n if (!delay && vnode.componentInstance && vnode.componentInstance.$attrs) {\n delay = vnode.componentInstance.$attrs['data-vv-delay'];\n }\n\n if (!isObject(globalDelay)) {\n return deepParseInt(delay || globalDelay);\n }\n\n if (!isNullOrUndefined(delay)) {\n globalDelay.input = delay;\n }\n\n return deepParseInt(globalDelay);\n};\n/**\n * Resolves the events to validate in response to.\n * @param {*} el\n * @param {*} vnode\n */\n\n\nResolver.resolveEvents = function resolveEvents(el, vnode) {\n // resolve it from the root element.\n var events = getDataAttribute(el, 'validate-on'); // resolve from data-vv-validate-on if its a vue component.\n\n if (!events && vnode.componentInstance && vnode.componentInstance.$attrs) {\n events = vnode.componentInstance.$attrs['data-vv-validate-on'];\n } // resolve it from $_veeValidate options.\n\n\n if (!events && vnode.componentInstance) {\n var config = Resolver.getCtorConfig(vnode);\n events = config && config.events;\n }\n\n if (!events && getConfig().events) {\n events = getConfig().events;\n } // resolve the model event if its configured for custom components.\n\n\n if (events && vnode.componentInstance && includes(events, 'input')) {\n var ref = vnode.componentInstance.$options.model || {\n event: 'input'\n };\n var event = ref.event; // if the prop was configured but not the model.\n\n if (!event) {\n return events;\n }\n\n events = events.replace('input', event);\n }\n\n return events;\n};\n/**\n * Resolves the scope for the field.\n * @param {*} el\n * @param {*} binding\n */\n\n\nResolver.resolveScope = function resolveScope(el, binding, vnode) {\n if (vnode === void 0) vnode = {};\n var scope = null;\n\n if (vnode.componentInstance && isNullOrUndefined(scope)) {\n scope = vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-scope'];\n }\n\n return !isNullOrUndefined(scope) ? scope : getScope(el);\n};\n/**\n * Checks if the node directives contains a v-model or a specified arg.\n * Args take priority over models.\n *\n * @return {Object}\n */\n\n\nResolver.resolveModel = function resolveModel(binding, vnode) {\n if (binding.arg) {\n return {\n expression: binding.arg\n };\n }\n\n var model = findModel(vnode);\n\n if (!model) {\n return null;\n } // https://github.com/vuejs/vue/blob/dev/src/core/util/lang.js#L26\n\n\n var watchable = !/[^\\w.$]/.test(model.expression) && hasPath(model.expression, vnode.context);\n var lazy = !!(model.modifiers && model.modifiers.lazy);\n\n if (!watchable) {\n return {\n expression: null,\n lazy: lazy\n };\n }\n\n return {\n expression: model.expression,\n lazy: lazy\n };\n};\n/**\n * Resolves the field name to trigger validations.\n * @return {String} The field name.\n */\n\n\nResolver.resolveName = function resolveName(el, vnode) {\n var name = getDataAttribute(el, 'name');\n\n if (!name && !vnode.componentInstance) {\n return el.name;\n }\n\n if (!name && vnode.componentInstance && vnode.componentInstance.$attrs) {\n name = vnode.componentInstance.$attrs['data-vv-name'] || vnode.componentInstance.$attrs['name'];\n }\n\n if (!name && vnode.componentInstance) {\n var config = Resolver.getCtorConfig(vnode);\n\n if (config && isCallable(config.name)) {\n var boundGetter = config.name.bind(vnode.componentInstance);\n return boundGetter();\n }\n\n return vnode.componentInstance.name;\n }\n\n return name;\n};\n/**\n * Returns a value getter input type.\n */\n\n\nResolver.resolveGetter = function resolveGetter(el, vnode, model) {\n if (model && model.expression) {\n return function () {\n return getPath(model.expression, vnode.context);\n };\n }\n\n if (vnode.componentInstance) {\n var path = getDataAttribute(el, 'value-path') || vnode.componentInstance.$attrs && vnode.componentInstance.$attrs['data-vv-value-path'];\n\n if (path) {\n return function () {\n return getPath(path, vnode.componentInstance);\n };\n }\n\n var config = Resolver.getCtorConfig(vnode);\n\n if (config && isCallable(config.value)) {\n var boundGetter = config.value.bind(vnode.componentInstance);\n return function () {\n return boundGetter();\n };\n }\n\n var ref = vnode.componentInstance.$options.model || {\n prop: 'value'\n };\n var prop = ref.prop;\n return function () {\n return vnode.componentInstance[prop];\n };\n }\n\n switch (el.type) {\n case 'checkbox':\n return function () {\n var els = document.querySelectorAll(\"input[name=\\\"\" + el.name + \"\\\"]\");\n els = toArray(els).filter(function (el) {\n return el.checked;\n });\n\n if (!els.length) {\n return undefined;\n }\n\n return els.map(function (checkbox) {\n return checkbox.value;\n });\n };\n\n case 'radio':\n return function () {\n var els = document.querySelectorAll(\"input[name=\\\"\" + el.name + \"\\\"]\");\n var elm = find(els, function (el) {\n return el.checked;\n });\n return elm && elm.value;\n };\n\n case 'file':\n return function (context) {\n return toArray(el.files);\n };\n\n case 'select-multiple':\n return function () {\n return toArray(el.options).filter(function (opt) {\n return opt.selected;\n }).map(function (opt) {\n return opt.value;\n });\n };\n\n default:\n return function () {\n return el && el.value;\n };\n }\n};\n\nvar RULES = {};\n\nvar RuleContainer = function RuleContainer() {};\n\nvar staticAccessors = {\n rules: {\n configurable: true\n }\n};\n\nRuleContainer.add = function add(name, ref) {\n var validate = ref.validate;\n var options = ref.options;\n var paramNames = ref.paramNames;\n RULES[name] = {\n validate: validate,\n options: options,\n paramNames: paramNames\n };\n};\n\nstaticAccessors.rules.get = function () {\n return RULES;\n};\n\nRuleContainer.has = function has(name) {\n return !!RULES[name];\n};\n\nRuleContainer.isImmediate = function isImmediate(name) {\n return !!(RULES[name] && RULES[name].options.immediate);\n};\n\nRuleContainer.isRequireRule = function isRequireRule(name) {\n return !!(RULES[name] && RULES[name].options.computesRequired);\n};\n\nRuleContainer.isTargetRule = function isTargetRule(name) {\n return !!(RULES[name] && RULES[name].options.hasTarget);\n};\n\nRuleContainer.remove = function remove(ruleName) {\n delete RULES[ruleName];\n};\n\nRuleContainer.getParamNames = function getParamNames(ruleName) {\n return RULES[ruleName] && RULES[ruleName].paramNames;\n};\n\nRuleContainer.getOptions = function getOptions(ruleName) {\n return RULES[ruleName] && RULES[ruleName].options;\n};\n\nRuleContainer.getValidatorMethod = function getValidatorMethod(ruleName) {\n return RULES[ruleName] ? RULES[ruleName].validate : null;\n};\n\nObject.defineProperties(RuleContainer, staticAccessors); // \n\nvar isEvent = function isEvent(evt) {\n return typeof Event !== 'undefined' && isCallable(Event) && evt instanceof Event || evt && evt.srcElement;\n};\n\nvar normalizeEvents = function normalizeEvents(evts) {\n if (!evts) {\n return [];\n }\n\n return typeof evts === 'string' ? evts.split('|') : evts;\n};\n\nvar supportsPassive = true;\n\nvar detectPassiveSupport = function detectPassiveSupport() {\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n supportsPassive = true;\n }\n });\n window.addEventListener('testPassive', null, opts);\n window.removeEventListener('testPassive', null, opts);\n } catch (e) {\n supportsPassive = false;\n }\n\n return supportsPassive;\n};\n\nvar addEventListener = function addEventListener(el, eventName, cb) {\n el.addEventListener(eventName, cb, supportsPassive ? {\n passive: true\n } : false);\n}; // \n\n\nvar DEFAULT_OPTIONS = {\n targetOf: null,\n immediate: false,\n persist: false,\n scope: null,\n listen: true,\n name: null,\n rules: {},\n vm: null,\n classes: false,\n validity: true,\n aria: true,\n events: 'input|blur',\n delay: 0,\n classNames: {\n touched: 'touched',\n // the control has been blurred\n untouched: 'untouched',\n // the control hasn't been blurred\n valid: 'valid',\n // model is valid\n invalid: 'invalid',\n // model is invalid\n pristine: 'pristine',\n // control has not been interacted with\n dirty: 'dirty' // control has been interacted with\n\n }\n};\n\nvar Field = function Field(options) {\n if (options === void 0) options = {};\n this.id = uniqId();\n this.el = options.el;\n this.updated = false;\n this.vmId = options.vmId;\n defineNonReactive(this, 'dependencies', []);\n defineNonReactive(this, 'watchers', []);\n defineNonReactive(this, 'events', []);\n this.delay = 0;\n this.rules = {};\n this.forceRequired = false;\n\n this._cacheId(options);\n\n this.classNames = assign({}, DEFAULT_OPTIONS.classNames);\n options = assign({}, DEFAULT_OPTIONS, options);\n this._delay = !isNullOrUndefined(options.delay) ? options.delay : 0; // cache initial delay\n\n this.validity = options.validity;\n this.aria = options.aria;\n this.flags = options.flags || createFlags();\n defineNonReactive(this, 'vm', options.vm);\n defineNonReactive(this, 'componentInstance', options.component);\n this.ctorConfig = this.componentInstance ? getPath('$options.$_veeValidate', this.componentInstance) : undefined;\n this.update(options); // set initial value.\n\n this.initialValue = this.value;\n this.updated = false;\n};\n\nvar prototypeAccessors$1 = {\n validator: {\n configurable: true\n },\n isRequired: {\n configurable: true\n },\n isDisabled: {\n configurable: true\n },\n alias: {\n configurable: true\n },\n value: {\n configurable: true\n },\n bails: {\n configurable: true\n },\n rejectsFalse: {\n configurable: true\n }\n};\n\nprototypeAccessors$1.validator.get = function () {\n if (!this.vm || !this.vm.$validator) {\n return {\n validate: function validate() {\n return Promise.resolve(true);\n }\n };\n }\n\n return this.vm.$validator;\n};\n\nprototypeAccessors$1.isRequired.get = function () {\n return !!this.rules.required || this.forceRequired;\n};\n\nprototypeAccessors$1.isDisabled.get = function () {\n return !!(this.el && this.el.disabled);\n};\n/**\n * Gets the display name (user-friendly name).\n */\n\n\nprototypeAccessors$1.alias.get = function () {\n if (this._alias) {\n return this._alias;\n }\n\n var alias = null;\n\n if (this.ctorConfig && this.ctorConfig.alias) {\n alias = isCallable(this.ctorConfig.alias) ? this.ctorConfig.alias.call(this.componentInstance) : this.ctorConfig.alias;\n }\n\n if (!alias && this.el) {\n alias = getDataAttribute(this.el, 'as');\n }\n\n if (!alias && this.componentInstance) {\n return this.componentInstance.$attrs && this.componentInstance.$attrs['data-vv-as'];\n }\n\n return alias;\n};\n/**\n * Gets the input value.\n */\n\n\nprototypeAccessors$1.value.get = function () {\n if (!isCallable(this.getter)) {\n return undefined;\n }\n\n return this.getter();\n};\n\nprototypeAccessors$1.bails.get = function () {\n return this._bails;\n};\n/**\n * If the field rejects false as a valid value for the required rule.\n */\n\n\nprototypeAccessors$1.rejectsFalse.get = function () {\n if (this.componentInstance && this.ctorConfig) {\n return !!this.ctorConfig.rejectsFalse;\n }\n\n if (!this.el) {\n return false;\n }\n\n return this.el.type === 'checkbox';\n};\n/**\n * Determines if the instance matches the options provided.\n */\n\n\nField.prototype.matches = function matches(options) {\n var this$1 = this;\n\n if (!options) {\n return true;\n }\n\n if (options.id) {\n return this.id === options.id;\n }\n\n var matchesComponentId = isNullOrUndefined(options.vmId) ? function () {\n return true;\n } : function (id) {\n return id === this$1.vmId;\n };\n\n if (!matchesComponentId(options.vmId)) {\n return false;\n }\n\n if (options.name === undefined && options.scope === undefined) {\n return true;\n }\n\n if (options.scope === undefined) {\n return this.name === options.name;\n }\n\n if (options.name === undefined) {\n return this.scope === options.scope;\n }\n\n return options.name === this.name && options.scope === this.scope;\n};\n/**\n * Caches the field id.\n */\n\n\nField.prototype._cacheId = function _cacheId(options) {\n if (this.el && !options.targetOf) {\n this.el._veeValidateId = this.id;\n }\n};\n/**\n * Keeps a reference of the most current validation run.\n */\n\n\nField.prototype.waitFor = function waitFor(pendingPromise) {\n this._waitingFor = pendingPromise;\n};\n\nField.prototype.isWaitingFor = function isWaitingFor(promise) {\n return this._waitingFor === promise;\n};\n/**\n * Updates the field with changed data.\n */\n\n\nField.prototype.update = function update(options) {\n var this$1 = this;\n this.targetOf = options.targetOf || null;\n this.immediate = options.immediate || this.immediate || false;\n this.persist = options.persist || this.persist || false; // update errors scope if the field scope was changed.\n\n if (!isNullOrUndefined(options.scope) && options.scope !== this.scope && isCallable(this.validator.update)) {\n this.validator.update(this.id, {\n scope: options.scope\n });\n }\n\n this.scope = !isNullOrUndefined(options.scope) ? options.scope : !isNullOrUndefined(this.scope) ? this.scope : null;\n this.name = (!isNullOrUndefined(options.name) ? String(options.name) : options.name) || this.name || null;\n this.rules = options.rules !== undefined ? normalizeRules(options.rules) : this.rules;\n this._bails = options.bails !== undefined ? options.bails : this._bails;\n this.model = options.model || this.model;\n this.listen = options.listen !== undefined ? options.listen : this.listen;\n this.classes = (options.classes || this.classes || false) && !this.componentInstance;\n this.classNames = isObject(options.classNames) ? merge(this.classNames, options.classNames) : this.classNames;\n this.getter = isCallable(options.getter) ? options.getter : this.getter;\n this._alias = options.alias || this._alias;\n this.events = options.events ? normalizeEvents(options.events) : this.events;\n this.delay = makeDelayObject(this.events, options.delay || this.delay, this._delay);\n this.updateDependencies();\n this.addActionListeners();\n\n if (process.env.NODE_ENV !== 'production' && !this.name && !this.targetOf) {\n warn('A field is missing a \"name\" or \"data-vv-name\" attribute');\n } // update required flag flags\n\n\n if (options.rules !== undefined) {\n this.flags.required = this.isRequired;\n }\n\n if (Object.keys(options.rules || {}).length === 0 && this.updated) {\n var resetFlag = this.flags.validated;\n this.validator.validate(\"#\" + this.id).then(function () {\n this$1.flags.validated = resetFlag;\n });\n } // validate if it was validated before and field was updated and there was a rules mutation.\n\n\n if (this.flags.validated && options.rules !== undefined && this.updated) {\n this.validator.validate(\"#\" + this.id);\n }\n\n this.updated = true;\n this.addValueListeners(); // no need to continue.\n\n if (!this.el) {\n return;\n }\n\n this.updateClasses();\n this.updateAriaAttrs();\n};\n/**\n * Resets field flags and errors.\n */\n\n\nField.prototype.reset = function reset() {\n var this$1 = this;\n\n if (this._cancellationToken) {\n this._cancellationToken.cancelled = true;\n delete this._cancellationToken;\n }\n\n var defaults = createFlags();\n Object.keys(this.flags).filter(function (flag) {\n return flag !== 'required';\n }).forEach(function (flag) {\n this$1.flags[flag] = defaults[flag];\n }); // update initial value\n\n this.initialValue = this.value;\n this.flags.changed = false;\n this.addValueListeners();\n this.addActionListeners();\n this.updateClasses(true);\n this.updateAriaAttrs();\n this.updateCustomValidity();\n};\n/**\n * Sets the flags and their negated counterparts, and updates the classes and re-adds action listeners.\n */\n\n\nField.prototype.setFlags = function setFlags(flags) {\n var this$1 = this;\n var negated = {\n pristine: 'dirty',\n dirty: 'pristine',\n valid: 'invalid',\n invalid: 'valid',\n touched: 'untouched',\n untouched: 'touched'\n };\n Object.keys(flags).forEach(function (flag) {\n this$1.flags[flag] = flags[flag]; // if it has a negation and was not specified, set it as well.\n\n if (negated[flag] && flags[negated[flag]] === undefined) {\n this$1.flags[negated[flag]] = !flags[flag];\n }\n });\n\n if (flags.untouched !== undefined || flags.touched !== undefined || flags.dirty !== undefined || flags.pristine !== undefined) {\n this.addActionListeners();\n }\n\n this.updateClasses();\n this.updateAriaAttrs();\n this.updateCustomValidity();\n};\n/**\n * Determines if the field requires references to target fields.\n*/\n\n\nField.prototype.updateDependencies = function updateDependencies() {\n var this$1 = this; // reset dependencies.\n\n this.dependencies.forEach(function (d) {\n return d.field.destroy();\n });\n this.dependencies = []; // we get the selectors for each field.\n\n var fields = Object.keys(this.rules).reduce(function (prev, r) {\n if (RuleContainer.isTargetRule(r)) {\n prev.push({\n selector: this$1.rules[r][0],\n name: r\n });\n }\n\n return prev;\n }, []);\n\n if (!fields.length || !this.vm || !this.vm.$el) {\n return;\n } // must be contained within the same component, so we use the vm root element constrain our dom search.\n\n\n fields.forEach(function (ref$1) {\n var selector = ref$1.selector;\n var name = ref$1.name;\n var ref = this$1.vm.$refs[selector];\n var el = Array.isArray(ref) ? ref[0] : ref;\n\n if (!el) {\n return;\n }\n\n var options = {\n vm: this$1.vm,\n classes: this$1.classes,\n classNames: this$1.classNames,\n delay: this$1.delay,\n scope: this$1.scope,\n events: this$1.events.join('|'),\n immediate: this$1.immediate,\n targetOf: this$1.id\n }; // probably a component.\n\n if (isCallable(el.$watch)) {\n options.component = el;\n options.el = el.$el;\n options.getter = Resolver.resolveGetter(el.$el, el.$vnode);\n } else {\n options.el = el;\n options.getter = Resolver.resolveGetter(el, {});\n }\n\n this$1.dependencies.push({\n name: name,\n field: new Field(options)\n });\n });\n};\n/**\n * Removes listeners.\n */\n\n\nField.prototype.unwatch = function unwatch(tag) {\n if (tag === void 0) tag = null;\n\n if (!tag) {\n this.watchers.forEach(function (w) {\n return w.unwatch();\n });\n this.watchers = [];\n return;\n }\n\n this.watchers.filter(function (w) {\n return tag.test(w.tag);\n }).forEach(function (w) {\n return w.unwatch();\n });\n this.watchers = this.watchers.filter(function (w) {\n return !tag.test(w.tag);\n });\n};\n/**\n * Updates the element classes depending on each field flag status.\n */\n\n\nField.prototype.updateClasses = function updateClasses(isReset) {\n var this$1 = this;\n if (isReset === void 0) isReset = false;\n\n if (!this.classes || this.isDisabled) {\n return;\n }\n\n var applyClasses = function applyClasses(el) {\n toggleClass(el, this$1.classNames.dirty, this$1.flags.dirty);\n toggleClass(el, this$1.classNames.pristine, this$1.flags.pristine);\n toggleClass(el, this$1.classNames.touched, this$1.flags.touched);\n toggleClass(el, this$1.classNames.untouched, this$1.flags.untouched); // remove valid/invalid classes on reset.\n\n if (isReset) {\n toggleClass(el, this$1.classNames.valid, false);\n toggleClass(el, this$1.classNames.invalid, false);\n } // make sure we don't set any classes if the state is undetermined.\n\n\n if (!isNullOrUndefined(this$1.flags.valid) && this$1.flags.validated) {\n toggleClass(el, this$1.classNames.valid, this$1.flags.valid);\n }\n\n if (!isNullOrUndefined(this$1.flags.invalid) && this$1.flags.validated) {\n toggleClass(el, this$1.classNames.invalid, this$1.flags.invalid);\n }\n };\n\n if (!isCheckboxOrRadioInput(this.el)) {\n applyClasses(this.el);\n return;\n }\n\n var els = document.querySelectorAll(\"input[name=\\\"\" + this.el.name + \"\\\"]\");\n toArray(els).forEach(applyClasses);\n};\n/**\n * Adds the listeners required for automatic classes and some flags.\n */\n\n\nField.prototype.addActionListeners = function addActionListeners() {\n var this$1 = this; // remove previous listeners.\n\n this.unwatch(/class/);\n\n if (!this.el) {\n return;\n }\n\n var onBlur = function onBlur() {\n this$1.flags.touched = true;\n this$1.flags.untouched = false;\n\n if (this$1.classes) {\n toggleClass(this$1.el, this$1.classNames.touched, true);\n toggleClass(this$1.el, this$1.classNames.untouched, false);\n } // only needed once.\n\n\n this$1.unwatch(/^class_blur$/);\n };\n\n var inputEvent = isTextInput(this.el) ? 'input' : 'change';\n\n var onInput = function onInput() {\n this$1.flags.dirty = true;\n this$1.flags.pristine = false;\n\n if (this$1.classes) {\n toggleClass(this$1.el, this$1.classNames.pristine, false);\n toggleClass(this$1.el, this$1.classNames.dirty, true);\n } // only needed once.\n\n\n this$1.unwatch(/^class_input$/);\n };\n\n if (this.componentInstance && isCallable(this.componentInstance.$once)) {\n this.componentInstance.$once('input', onInput);\n this.componentInstance.$once('blur', onBlur);\n this.watchers.push({\n tag: 'class_input',\n unwatch: function unwatch() {\n this$1.componentInstance.$off('input', onInput);\n }\n });\n this.watchers.push({\n tag: 'class_blur',\n unwatch: function unwatch() {\n this$1.componentInstance.$off('blur', onBlur);\n }\n });\n return;\n }\n\n if (!this.el) {\n return;\n }\n\n addEventListener(this.el, inputEvent, onInput); // Checkboxes and radio buttons on Mac don't emit blur naturally, so we listen on click instead.\n\n var blurEvent = isCheckboxOrRadioInput(this.el) ? 'change' : 'blur';\n addEventListener(this.el, blurEvent, onBlur);\n this.watchers.push({\n tag: 'class_input',\n unwatch: function unwatch() {\n this$1.el.removeEventListener(inputEvent, onInput);\n }\n });\n this.watchers.push({\n tag: 'class_blur',\n unwatch: function unwatch() {\n this$1.el.removeEventListener(blurEvent, onBlur);\n }\n });\n};\n\nField.prototype.checkValueChanged = function checkValueChanged() {\n // handle some people initialize the value to null, since text inputs have empty string value.\n if (this.initialValue === null && this.value === '' && isTextInput(this.el)) {\n return false;\n }\n\n return this.value !== this.initialValue;\n};\n/**\n * Determines the suitable primary event to listen for.\n */\n\n\nField.prototype._determineInputEvent = function _determineInputEvent() {\n // if its a custom component, use the customized model event or the input event.\n if (this.componentInstance) {\n return this.componentInstance.$options.model && this.componentInstance.$options.model.event || 'input';\n }\n\n if (this.model && this.model.lazy) {\n return 'change';\n }\n\n if (isTextInput(this.el)) {\n return 'input';\n }\n\n return 'change';\n};\n/**\n * Determines the list of events to listen to.\n */\n\n\nField.prototype._determineEventList = function _determineEventList(defaultInputEvent) {\n var this$1 = this; // if no event is configured, or it is a component or a text input then respect the user choice.\n\n if (!this.events.length || this.componentInstance || isTextInput(this.el)) {\n return [].concat(this.events).map(function (evt) {\n if (evt === 'input' && this$1.model && this$1.model.lazy) {\n return 'change';\n }\n\n return evt;\n });\n } // force suitable event for non-text type fields.\n\n\n return this.events.map(function (e) {\n if (e === 'input') {\n return defaultInputEvent;\n }\n\n return e;\n });\n};\n/**\n * Adds the listeners required for validation.\n */\n\n\nField.prototype.addValueListeners = function addValueListeners() {\n var this$1 = this;\n this.unwatch(/^input_.+/);\n\n if (!this.listen || !this.el) {\n return;\n }\n\n var token = {\n cancelled: false\n };\n var fn = this.targetOf ? function () {\n var target = this$1.validator._resolveField(\"#\" + this$1.targetOf);\n\n if (target && target.flags.validated) {\n this$1.validator.validate(\"#\" + this$1.targetOf);\n }\n } : function () {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n } // if its a DOM event, resolve the value, otherwise use the first parameter as the value.\n\n\n if (args.length === 0 || isEvent(args[0])) {\n args[0] = this$1.value;\n }\n\n this$1.flags.pending = true;\n this$1._cancellationToken = token;\n this$1.validator.validate(\"#\" + this$1.id, args[0]);\n };\n\n var inputEvent = this._determineInputEvent();\n\n var events = this._determineEventList(inputEvent); // if on input validation is requested.\n\n\n if (includes(events, inputEvent)) {\n var ctx = null;\n var expression = null;\n var watchCtxVm = false; // if its watchable from the context vm.\n\n if (this.model && this.model.expression) {\n ctx = this.vm;\n expression = this.model.expression;\n watchCtxVm = true;\n } // watch it from the custom component vm instead.\n\n\n if (!expression && this.componentInstance && this.componentInstance.$options.model) {\n ctx = this.componentInstance;\n expression = this.componentInstance.$options.model.prop || 'value';\n }\n\n if (ctx && expression) {\n var debouncedFn = debounce(fn, this.delay[inputEvent], token);\n\n var _unwatch = ctx.$watch(expression, debouncedFn);\n\n this.watchers.push({\n tag: 'input_model',\n unwatch: function unwatch() {\n this$1.vm.$nextTick(function () {\n _unwatch();\n });\n }\n }); // filter out input event when we are watching from the context vm.\n\n if (watchCtxVm) {\n events = events.filter(function (e) {\n return e !== inputEvent;\n });\n }\n }\n } // Add events.\n\n\n events.forEach(function (e) {\n var debouncedFn = debounce(fn, this$1.delay[e], token);\n\n this$1._addComponentEventListener(e, debouncedFn);\n\n this$1._addHTMLEventListener(e, debouncedFn);\n });\n};\n\nField.prototype._addComponentEventListener = function _addComponentEventListener(evt, validate) {\n var this$1 = this;\n\n if (!this.componentInstance) {\n return;\n }\n\n this.componentInstance.$on(evt, validate);\n this.watchers.push({\n tag: 'input_vue',\n unwatch: function unwatch() {\n this$1.componentInstance.$off(evt, validate);\n }\n });\n};\n\nField.prototype._addHTMLEventListener = function _addHTMLEventListener(evt, validate) {\n var this$1 = this;\n\n if (!this.el || this.componentInstance) {\n return;\n } // listen for the current element.\n\n\n var addListener = function addListener(el) {\n addEventListener(el, evt, validate);\n this$1.watchers.push({\n tag: 'input_native',\n unwatch: function unwatch() {\n el.removeEventListener(evt, validate);\n }\n });\n };\n\n addListener(this.el);\n\n if (!isCheckboxOrRadioInput(this.el)) {\n return;\n }\n\n var els = document.querySelectorAll(\"input[name=\\\"\" + this.el.name + \"\\\"]\");\n toArray(els).forEach(function (el) {\n // skip if it is added by v-validate and is not the current element.\n if (el._veeValidateId && el !== this$1.el) {\n return;\n }\n\n addListener(el);\n });\n};\n/**\n * Updates aria attributes on the element.\n */\n\n\nField.prototype.updateAriaAttrs = function updateAriaAttrs() {\n var this$1 = this;\n\n if (!this.aria || !this.el || !isCallable(this.el.setAttribute)) {\n return;\n }\n\n var applyAriaAttrs = function applyAriaAttrs(el) {\n el.setAttribute('aria-required', this$1.isRequired ? 'true' : 'false');\n el.setAttribute('aria-invalid', this$1.flags.invalid ? 'true' : 'false');\n };\n\n if (!isCheckboxOrRadioInput(this.el)) {\n applyAriaAttrs(this.el);\n return;\n }\n\n var els = document.querySelectorAll(\"input[name=\\\"\" + this.el.name + \"\\\"]\");\n toArray(els).forEach(applyAriaAttrs);\n};\n/**\n * Updates the custom validity for the field.\n */\n\n\nField.prototype.updateCustomValidity = function updateCustomValidity() {\n if (!this.validity || !this.el || !isCallable(this.el.setCustomValidity) || !this.validator.errors) {\n return;\n }\n\n this.el.setCustomValidity(this.flags.valid ? '' : this.validator.errors.firstById(this.id) || '');\n};\n/**\n * Removes all listeners.\n */\n\n\nField.prototype.destroy = function destroy() {\n // ignore the result of any ongoing validation.\n if (this._cancellationToken) {\n this._cancellationToken.cancelled = true;\n }\n\n this.unwatch();\n this.dependencies.forEach(function (d) {\n return d.field.destroy();\n });\n this.dependencies = [];\n};\n\nObject.defineProperties(Field.prototype, prototypeAccessors$1); // \n\nvar FieldBag = function FieldBag(items) {\n if (items === void 0) items = [];\n this.items = items || [];\n this.itemsById = this.items.reduce(function (itemsById, item) {\n itemsById[item.id] = item;\n return itemsById;\n }, {});\n};\n\nvar prototypeAccessors$2 = {\n length: {\n configurable: true\n }\n};\n\nFieldBag.prototype[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'] = function () {\n var this$1 = this;\n var index = 0;\n return {\n next: function next() {\n return {\n value: this$1.items[index++],\n done: index > this$1.items.length\n };\n }\n };\n};\n/**\n * Gets the current items length.\n */\n\n\nprototypeAccessors$2.length.get = function () {\n return this.items.length;\n};\n/**\n * Finds the first field that matches the provided matcher object.\n */\n\n\nFieldBag.prototype.find = function find$1(matcher) {\n return find(this.items, function (item) {\n return item.matches(matcher);\n });\n};\n/**\n * Finds the field with the given id, using a plain object as a map to link\n * ids to items faster than by looping over the array and matching.\n */\n\n\nFieldBag.prototype.findById = function findById(id) {\n return this.itemsById[id] || null;\n};\n/**\n * Filters the items down to the matched fields.\n */\n\n\nFieldBag.prototype.filter = function filter(matcher) {\n // multiple matchers to be tried.\n if (Array.isArray(matcher)) {\n return this.items.filter(function (item) {\n return matcher.some(function (m) {\n return item.matches(m);\n });\n });\n }\n\n return this.items.filter(function (item) {\n return item.matches(matcher);\n });\n};\n/**\n * Maps the field items using the mapping function.\n */\n\n\nFieldBag.prototype.map = function map(mapper) {\n return this.items.map(mapper);\n};\n/**\n * Finds and removes the first field that matches the provided matcher object, returns the removed item.\n */\n\n\nFieldBag.prototype.remove = function remove(matcher) {\n var item = null;\n\n if (matcher instanceof Field) {\n item = matcher;\n } else {\n item = this.find(matcher);\n }\n\n if (!item) {\n return null;\n }\n\n var index = this.items.indexOf(item);\n this.items.splice(index, 1);\n delete this.itemsById[item.id];\n return item;\n};\n/**\n * Adds a field item to the list.\n */\n\n\nFieldBag.prototype.push = function push(item) {\n if (!(item instanceof Field)) {\n throw createError('FieldBag only accepts instances of Field that has an id defined.');\n }\n\n if (!item.id) {\n throw createError('Field id must be defined.');\n }\n\n if (this.findById(item.id)) {\n throw createError(\"Field with id \" + item.id + \" is already added.\");\n }\n\n this.items.push(item);\n this.itemsById[item.id] = item;\n};\n\nObject.defineProperties(FieldBag.prototype, prototypeAccessors$2);\n\nvar ScopedValidator = function ScopedValidator(base, vm) {\n this.id = vm._uid;\n this._base = base;\n this._paused = false; // create a mirror bag with limited component scope.\n\n this.errors = new ErrorBag(base.errors, this.id);\n};\n\nvar prototypeAccessors$3 = {\n flags: {\n configurable: true\n },\n rules: {\n configurable: true\n },\n fields: {\n configurable: true\n },\n dictionary: {\n configurable: true\n },\n locale: {\n configurable: true\n }\n};\n\nprototypeAccessors$3.flags.get = function () {\n var this$1 = this;\n return this._base.fields.items.filter(function (f) {\n return f.vmId === this$1.id;\n }).reduce(function (acc, field) {\n if (field.scope) {\n if (!acc[\"$\" + field.scope]) {\n acc[\"$\" + field.scope] = {};\n }\n\n acc[\"$\" + field.scope][field.name] = field.flags;\n }\n\n acc[field.name] = field.flags;\n return acc;\n }, {});\n};\n\nprototypeAccessors$3.rules.get = function () {\n return this._base.rules;\n};\n\nprototypeAccessors$3.fields.get = function () {\n return new FieldBag(this._base.fields.filter({\n vmId: this.id\n }));\n};\n\nprototypeAccessors$3.dictionary.get = function () {\n return this._base.dictionary;\n};\n\nprototypeAccessors$3.locale.get = function () {\n return this._base.locale;\n};\n\nprototypeAccessors$3.locale.set = function (val) {\n this._base.locale = val;\n};\n\nScopedValidator.prototype.localize = function localize() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base).localize.apply(ref, args);\n};\n\nScopedValidator.prototype.update = function update() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base).update.apply(ref, args);\n};\n\nScopedValidator.prototype.attach = function attach(opts) {\n var attachOpts = assign({}, opts, {\n vmId: this.id\n });\n return this._base.attach(attachOpts);\n};\n\nScopedValidator.prototype.pause = function pause() {\n this._paused = true;\n};\n\nScopedValidator.prototype.resume = function resume() {\n this._paused = false;\n};\n\nScopedValidator.prototype.remove = function remove(ruleName) {\n return this._base.remove(ruleName);\n};\n\nScopedValidator.prototype.detach = function detach(name, scope) {\n return this._base.detach(name, scope, this.id);\n};\n\nScopedValidator.prototype.extend = function extend() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base).extend.apply(ref, args);\n};\n\nScopedValidator.prototype.validate = function validate(descriptor, value, opts) {\n if (opts === void 0) opts = {};\n\n if (this._paused) {\n return Promise.resolve(true);\n }\n\n return this._base.validate(descriptor, value, assign({}, {\n vmId: this.id\n }, opts || {}));\n};\n\nScopedValidator.prototype.verify = function verify() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base).verify.apply(ref, args);\n};\n\nScopedValidator.prototype.validateAll = function validateAll(values, opts) {\n if (opts === void 0) opts = {};\n\n if (this._paused) {\n return Promise.resolve(true);\n }\n\n return this._base.validateAll(values, assign({}, {\n vmId: this.id\n }, opts || {}));\n};\n\nScopedValidator.prototype.validateScopes = function validateScopes(opts) {\n if (opts === void 0) opts = {};\n\n if (this._paused) {\n return Promise.resolve(true);\n }\n\n return this._base.validateScopes(assign({}, {\n vmId: this.id\n }, opts || {}));\n};\n\nScopedValidator.prototype.destroy = function destroy() {\n delete this.id;\n delete this._base;\n};\n\nScopedValidator.prototype.reset = function reset(matcher) {\n return this._base.reset(Object.assign({}, matcher || {}, {\n vmId: this.id\n }));\n};\n\nScopedValidator.prototype.flag = function flag() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base).flag.apply(ref, args.concat([this.id]));\n};\n\nScopedValidator.prototype._resolveField = function _resolveField() {\n var ref;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return (ref = this._base)._resolveField.apply(ref, args);\n};\n\nObject.defineProperties(ScopedValidator.prototype, prototypeAccessors$3);\nvar VALIDATOR = null;\n\nvar getValidator = function getValidator() {\n return VALIDATOR;\n};\n\nvar setValidator = function setValidator(value) {\n VALIDATOR = value;\n return value;\n}; // \n\n/**\n * Checks if a parent validator instance was requested.\n */\n\n\nvar requestsValidator = function requestsValidator(injections) {\n if (isObject(injections) && injections.$validator) {\n return true;\n }\n\n return false;\n};\n\nvar mixin = {\n provide: function provide() {\n if (this.$validator && !isBuiltInComponent(this.$vnode)) {\n return {\n $validator: this.$validator\n };\n }\n\n return {};\n },\n beforeCreate: function beforeCreate() {\n // if built in do nothing.\n if (isBuiltInComponent(this.$vnode) || this.$options.$__veeInject === false) {\n return;\n } // if its a root instance set the config if it exists.\n\n\n if (!this.$parent) {\n setConfig(this.$options.$_veeValidate || {});\n }\n\n var options = resolveConfig(this); // if its a root instance, inject anyways, or if it requested a new instance.\n\n if (!this.$parent || this.$options.$_veeValidate && /new/.test(this.$options.$_veeValidate.validator)) {\n this.$validator = new ScopedValidator(getValidator(), this);\n }\n\n var requested = requestsValidator(this.$options.inject); // if automatic injection is enabled and no instance was requested.\n\n if (!this.$validator && options.inject && !requested) {\n this.$validator = new ScopedValidator(getValidator(), this);\n } // don't inject errors or fieldBag as no validator was resolved.\n\n\n if (!requested && !this.$validator) {\n return;\n } // There is a validator but it isn't injected, mark as reactive.\n\n\n if (!requested && this.$validator) {\n var Vue = this.$options._base; // the vue constructor.\n\n Vue.util.defineReactive(this.$validator, 'errors', this.$validator.errors);\n }\n\n if (!this.$options.computed) {\n this.$options.computed = {};\n }\n\n this.$options.computed[options.errorBagName || 'errors'] = function errorBagGetter() {\n return this.$validator.errors;\n };\n\n this.$options.computed[options.fieldsBagName || 'fields'] = function fieldBagGetter() {\n return this.$validator.fields.items.reduce(function (acc, field) {\n if (field.scope) {\n if (!acc[\"$\" + field.scope]) {\n acc[\"$\" + field.scope] = {};\n }\n\n acc[\"$\" + field.scope][field.name] = field.flags;\n return acc;\n }\n\n acc[field.name] = field.flags;\n return acc;\n }, {});\n };\n },\n beforeDestroy: function beforeDestroy() {\n if (this.$validator && this._uid === this.$validator.id) {\n this.$validator.errors.clear(); // remove errors generated by this component.\n }\n }\n}; // \n\n/**\n * Finds the requested field by id from the context object.\n */\n\nfunction findField(el, context) {\n if (!context || !context.$validator) {\n return null;\n }\n\n return context.$validator.fields.findById(el._veeValidateId);\n}\n\nvar directive = {\n bind: function bind(el, binding, vnode) {\n var validator = vnode.context.$validator;\n\n if (!validator) {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"No validator instance is present on vm, did you forget to inject '$validator'?\");\n }\n\n return;\n }\n\n var fieldOptions = Resolver.generate(el, binding, vnode);\n validator.attach(fieldOptions);\n },\n inserted: function inserted(el, binding, vnode) {\n var field = findField(el, vnode.context);\n var scope = Resolver.resolveScope(el, binding, vnode); // skip if scope hasn't changed.\n\n if (!field || scope === field.scope) {\n return;\n } // only update scope.\n\n\n field.update({\n scope: scope\n }); // allows the field to re-evaluated once more in the update hook.\n\n field.updated = false;\n },\n update: function update(el, binding, vnode) {\n var field = findField(el, vnode.context); // make sure we don't do unneccasary work if no important change was done.\n\n if (!field || field.updated && isEqual(binding.value, binding.oldValue)) {\n return;\n }\n\n var scope = Resolver.resolveScope(el, binding, vnode);\n var rules = Resolver.resolveRules(el, binding, vnode);\n field.update({\n scope: scope,\n rules: rules\n });\n },\n unbind: function unbind(el, binding, ref) {\n var context = ref.context;\n var field = findField(el, context);\n\n if (!field) {\n return;\n }\n\n context.$validator.detach(field);\n }\n}; // \n\nvar Validator = function Validator(validations, options, pluginContainer) {\n if (options === void 0) options = {\n fastExit: true\n };\n if (pluginContainer === void 0) pluginContainer = null;\n this.errors = new ErrorBag();\n this.fields = new FieldBag();\n\n this._createFields(validations);\n\n this.paused = false;\n this.fastExit = !isNullOrUndefined(options && options.fastExit) ? options.fastExit : true;\n this.$vee = pluginContainer || {\n _vm: {\n $nextTick: function $nextTick(cb) {\n return isCallable(cb) ? cb() : Promise.resolve();\n },\n $emit: function $emit() {},\n $off: function $off() {}\n }\n };\n};\n\nvar prototypeAccessors$4 = {\n rules: {\n configurable: true\n },\n dictionary: {\n configurable: true\n },\n flags: {\n configurable: true\n },\n locale: {\n configurable: true\n }\n};\nvar staticAccessors$1 = {\n rules: {\n configurable: true\n },\n dictionary: {\n configurable: true\n },\n locale: {\n configurable: true\n }\n};\n/**\n * @deprecated\n */\n\nstaticAccessors$1.rules.get = function () {\n if (process.env.NODE_ENV !== 'production') {\n warn('this accessor will be deprecated, use `import { rules } from \"vee-validate\"` instead.');\n }\n\n return RuleContainer.rules;\n};\n/**\n * @deprecated\n */\n\n\nprototypeAccessors$4.rules.get = function () {\n if (process.env.NODE_ENV !== 'production') {\n warn('this accessor will be deprecated, use `import { rules } from \"vee-validate\"` instead.');\n }\n\n return RuleContainer.rules;\n};\n\nprototypeAccessors$4.dictionary.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nstaticAccessors$1.dictionary.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nprototypeAccessors$4.flags.get = function () {\n return this.fields.items.reduce(function (acc, field) {\n var obj;\n\n if (field.scope) {\n acc[\"$\" + field.scope] = (obj = {}, obj[field.name] = field.flags, obj);\n return acc;\n }\n\n acc[field.name] = field.flags;\n return acc;\n }, {});\n};\n/**\n * Getter for the current locale.\n */\n\n\nprototypeAccessors$4.locale.get = function () {\n return Validator.locale;\n};\n/**\n * Setter for the validator locale.\n */\n\n\nprototypeAccessors$4.locale.set = function (value) {\n Validator.locale = value;\n};\n\nstaticAccessors$1.locale.get = function () {\n return DictionaryResolver.getDriver().locale;\n};\n/**\n * Setter for the validator locale.\n */\n\n\nstaticAccessors$1.locale.set = function (value) {\n var hasChanged = value !== DictionaryResolver.getDriver().locale;\n DictionaryResolver.getDriver().locale = value;\n\n if (hasChanged && Validator.$vee && Validator.$vee._vm) {\n Validator.$vee._vm.$emit('localeChanged');\n }\n};\n/**\n * Static constructor.\n * @deprecated\n */\n\n\nValidator.create = function create(validations, options) {\n if (process.env.NODE_ENV !== 'production') {\n warn('Please use `new` to create new validator instances.');\n }\n\n return new Validator(validations, options);\n};\n/**\n * Adds a custom validator to the list of validation rules.\n */\n\n\nValidator.extend = function extend(name, validator, options) {\n if (options === void 0) options = {};\n\n Validator._guardExtend(name, validator); // rules imported from the minimal bundle\n // will have the options embedded in them\n\n\n var mergedOpts = validator.options || {};\n\n Validator._merge(name, {\n validator: validator,\n paramNames: options && options.paramNames || validator.paramNames,\n options: assign({\n hasTarget: false,\n immediate: true\n }, mergedOpts, options || {})\n });\n};\n/**\n * Removes a rule from the list of validators.\n * @deprecated\n */\n\n\nValidator.remove = function remove(name) {\n if (process.env.NODE_ENV !== 'production') {\n warn('this method will be deprecated, you can still override your rules with `extend`');\n }\n\n RuleContainer.remove(name);\n};\n/**\n * Adds and sets the current locale for the validator.\n*/\n\n\nValidator.prototype.localize = function localize(lang, dictionary) {\n Validator.localize(lang, dictionary);\n};\n/**\n * Adds and sets the current locale for the validator.\n */\n\n\nValidator.localize = function localize(lang, dictionary) {\n var obj;\n\n if (isObject(lang)) {\n DictionaryResolver.getDriver().merge(lang);\n return;\n } // merge the dictionary.\n\n\n if (dictionary) {\n var locale = lang || dictionary.name;\n dictionary = assign({}, dictionary);\n DictionaryResolver.getDriver().merge((obj = {}, obj[locale] = dictionary, obj));\n }\n\n if (lang) {\n // set the locale.\n Validator.locale = lang;\n }\n};\n/**\n * Registers a field to be validated.\n */\n\n\nValidator.prototype.attach = function attach(fieldOpts) {\n var this$1 = this; // We search for a field with the same name & scope, having persist enabled\n\n var oldFieldMatcher = {\n name: fieldOpts.name,\n scope: fieldOpts.scope,\n persist: true\n };\n var oldField = fieldOpts.persist ? this.fields.find(oldFieldMatcher) : null;\n\n if (oldField) {\n // We keep the flags of the old field, then we remove its instance\n fieldOpts.flags = oldField.flags;\n oldField.destroy();\n this.fields.remove(oldField);\n } // fixes initial value detection with v-model and select elements.\n\n\n var value = fieldOpts.initialValue;\n var field = new Field(fieldOpts);\n this.fields.push(field); // validate the field initially\n\n if (field.immediate) {\n this.$vee._vm.$nextTick(function () {\n return this$1.validate(\"#\" + field.id, value || field.value, {\n vmId: fieldOpts.vmId\n });\n });\n } else {\n this._validate(field, value || field.value, {\n initial: true\n }).then(function (result) {\n field.flags.valid = result.valid;\n field.flags.invalid = !result.valid;\n });\n }\n\n return field;\n};\n/**\n * Sets the flags on a field.\n */\n\n\nValidator.prototype.flag = function flag(name, flags, uid) {\n if (uid === void 0) uid = null;\n\n var field = this._resolveField(name, undefined, uid);\n\n if (!field || !flags) {\n return;\n }\n\n field.setFlags(flags);\n};\n/**\n * Removes a field from the validator.\n */\n\n\nValidator.prototype.detach = function detach(name, scope, uid) {\n var field = isCallable(name.destroy) ? name : this._resolveField(name, scope, uid);\n\n if (!field) {\n return;\n } // We destroy/remove the field & error instances if it's not a `persist` one\n\n\n if (!field.persist) {\n field.destroy();\n this.errors.remove(field.name, field.scope, field.vmId);\n this.fields.remove(field);\n }\n};\n/**\n * Adds a custom validator to the list of validation rules.\n */\n\n\nValidator.prototype.extend = function extend(name, validator, options) {\n if (options === void 0) options = {};\n Validator.extend(name, validator, options);\n};\n\nValidator.prototype.reset = function reset(matcher) {\n var this$1 = this; // two ticks\n\n return this.$vee._vm.$nextTick().then(function () {\n return this$1.$vee._vm.$nextTick();\n }).then(function () {\n this$1.fields.filter(matcher).forEach(function (field) {\n field.waitFor(null);\n field.reset(); // reset field flags.\n\n this$1.errors.remove(field.name, field.scope, matcher && matcher.vmId);\n });\n });\n};\n/**\n * Updates a field, updating both errors and flags.\n */\n\n\nValidator.prototype.update = function update(id, ref) {\n var scope = ref.scope;\n\n var field = this._resolveField(\"#\" + id);\n\n if (!field) {\n return;\n } // remove old scope.\n\n\n this.errors.update(id, {\n scope: scope\n });\n};\n/**\n * Removes a rule from the list of validators.\n * @deprecated\n */\n\n\nValidator.prototype.remove = function remove(name) {\n Validator.remove(name);\n};\n/**\n * Validates a value against a registered field validations.\n */\n\n\nValidator.prototype.validate = function validate(fieldDescriptor, value, ref) {\n var this$1 = this;\n if (ref === void 0) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) {\n return Promise.resolve(true);\n } // overload to validate all.\n\n\n if (isNullOrUndefined(fieldDescriptor)) {\n return this.validateScopes({\n silent: silent,\n vmId: vmId\n });\n } // overload to validate scope-less fields.\n\n\n if (fieldDescriptor === '*') {\n return this.validateAll(undefined, {\n silent: silent,\n vmId: vmId\n });\n } // if scope validation was requested.\n\n\n if (/^(.+)\\.\\*$/.test(fieldDescriptor)) {\n var matched = fieldDescriptor.match(/^(.+)\\.\\*$/)[1];\n return this.validateAll(matched);\n }\n\n var field = this._resolveField(fieldDescriptor);\n\n if (!field) {\n return this._handleFieldNotFound(fieldDescriptor);\n }\n\n if (!silent) {\n field.flags.pending = true;\n }\n\n if (value === undefined) {\n value = field.value;\n }\n\n var validationPromise = this._validate(field, value);\n\n field.waitFor(validationPromise);\n return validationPromise.then(function (result) {\n if (!silent && field.isWaitingFor(validationPromise)) {\n // allow next validation to mutate the state.\n field.waitFor(null);\n\n this$1._handleValidationResults([result], vmId);\n }\n\n return result.valid;\n });\n};\n/**\n * Pauses the validator.\n */\n\n\nValidator.prototype.pause = function pause() {\n this.paused = true;\n return this;\n};\n/**\n * Resumes the validator.\n */\n\n\nValidator.prototype.resume = function resume() {\n this.paused = false;\n return this;\n};\n/**\n * Validates each value against the corresponding field validations.\n */\n\n\nValidator.prototype.validateAll = function validateAll(values, ref) {\n var this$1 = this;\n if (ref === void 0) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) {\n return Promise.resolve(true);\n }\n\n var matcher = null;\n var providedValues = false;\n\n if (typeof values === 'string') {\n matcher = {\n scope: values,\n vmId: vmId\n };\n } else if (isObject(values)) {\n matcher = Object.keys(values).map(function (key) {\n return {\n name: key,\n vmId: vmId,\n scope: null\n };\n });\n providedValues = true;\n } else if (Array.isArray(values)) {\n matcher = values.map(function (key) {\n return _typeof2(key) === 'object' ? Object.assign({\n vmId: vmId\n }, key) : {\n name: key,\n vmId: vmId\n };\n });\n } else {\n matcher = {\n scope: null,\n vmId: vmId\n };\n }\n\n return Promise.all(this.fields.filter(matcher).map(function (field) {\n return this$1._validate(field, providedValues ? values[field.name] : field.value);\n })).then(function (results) {\n if (!silent) {\n this$1._handleValidationResults(results, vmId);\n }\n\n return results.every(function (t) {\n return t.valid;\n });\n });\n};\n/**\n * Validates all scopes.\n */\n\n\nValidator.prototype.validateScopes = function validateScopes(ref) {\n var this$1 = this;\n if (ref === void 0) ref = {};\n var silent = ref.silent;\n var vmId = ref.vmId;\n\n if (this.paused) {\n return Promise.resolve(true);\n }\n\n return Promise.all(this.fields.filter({\n vmId: vmId\n }).map(function (field) {\n return this$1._validate(field, field.value);\n })).then(function (results) {\n if (!silent) {\n this$1._handleValidationResults(results, vmId);\n }\n\n return results.every(function (t) {\n return t.valid;\n });\n });\n};\n/**\n * Validates a value against the rules.\n */\n\n\nValidator.prototype.verify = function verify(value, rules, options) {\n if (options === void 0) options = {};\n var field = {\n name: options && options.name || '{field}',\n rules: normalizeRules(rules),\n bails: getPath('bails', options, true),\n forceRequired: false,\n\n get isRequired() {\n return !!this.rules.required || this.forceRequired;\n }\n\n };\n var targetRules = Object.keys(field.rules).filter(RuleContainer.isTargetRule);\n\n if (targetRules.length && options && isObject(options.values)) {\n field.dependencies = targetRules.map(function (rule) {\n var ref = field.rules[rule];\n var targetKey = ref[0];\n return {\n name: rule,\n field: {\n value: options.values[targetKey]\n }\n };\n });\n }\n\n return this._validate(field, value).then(function (result) {\n var errors = [];\n var ruleMap = {};\n result.errors.forEach(function (e) {\n errors.push(e.msg);\n ruleMap[e.rule] = e.msg;\n });\n return {\n valid: result.valid,\n errors: errors,\n failedRules: ruleMap\n };\n });\n};\n/**\n * Perform cleanup.\n */\n\n\nValidator.prototype.destroy = function destroy() {\n this.$vee._vm.$off('localeChanged');\n};\n/**\n * Creates the fields to be validated.\n */\n\n\nValidator.prototype._createFields = function _createFields(validations) {\n var this$1 = this;\n\n if (!validations) {\n return;\n }\n\n Object.keys(validations).forEach(function (field) {\n var options = assign({}, {\n name: field,\n rules: validations[field]\n });\n this$1.attach(options);\n });\n};\n/**\n * Date rules need the existence of a format, so date_format must be supplied.\n */\n\n\nValidator.prototype._getDateFormat = function _getDateFormat(validations) {\n var format = null;\n\n if (validations.date_format && Array.isArray(validations.date_format)) {\n format = validations.date_format[0];\n }\n\n return format || DictionaryResolver.getDriver().getDateFormat(this.locale);\n};\n/**\n * Formats an error message for field and a rule.\n */\n\n\nValidator.prototype._formatErrorMessage = function _formatErrorMessage(field, rule, data, targetName) {\n if (data === void 0) data = {};\n if (targetName === void 0) targetName = null;\n\n var name = this._getFieldDisplayName(field);\n\n var params = this._getLocalizedParams(rule, targetName);\n\n return DictionaryResolver.getDriver().getFieldMessage(this.locale, field.name, rule.name, [name, params, data]);\n};\n/**\n * We need to convert any object param to an array format since the locales do not handle params as objects yet.\n */\n\n\nValidator.prototype._convertParamObjectToArray = function _convertParamObjectToArray(obj, ruleName) {\n if (Array.isArray(obj)) {\n return obj;\n }\n\n var paramNames = RuleContainer.getParamNames(ruleName);\n\n if (!paramNames || !isObject(obj)) {\n return obj;\n }\n\n return paramNames.reduce(function (prev, paramName) {\n if (paramName in obj) {\n prev.push(obj[paramName]);\n }\n\n return prev;\n }, []);\n};\n/**\n * Translates the parameters passed to the rule (mainly for target fields).\n */\n\n\nValidator.prototype._getLocalizedParams = function _getLocalizedParams(rule, targetName) {\n if (targetName === void 0) targetName = null;\n\n var params = this._convertParamObjectToArray(rule.params, rule.name);\n\n if (rule.options.hasTarget && params && params[0]) {\n var localizedName = targetName || DictionaryResolver.getDriver().getAttribute(this.locale, params[0], params[0]);\n return [localizedName].concat(params.slice(1));\n }\n\n return params;\n};\n/**\n * Resolves an appropriate display name, first checking 'data-as' or the registered 'prettyName'\n */\n\n\nValidator.prototype._getFieldDisplayName = function _getFieldDisplayName(field) {\n return field.alias || DictionaryResolver.getDriver().getAttribute(this.locale, field.name, field.name);\n};\n/**\n * Converts an array of params to an object with named properties.\n * Only works if the rule is configured with a paramNames array.\n * Returns the same params if it cannot convert it.\n */\n\n\nValidator.prototype._convertParamArrayToObj = function _convertParamArrayToObj(params, ruleName) {\n var paramNames = RuleContainer.getParamNames(ruleName);\n\n if (!paramNames) {\n return params;\n }\n\n if (isObject(params)) {\n // check if the object is either a config object or a single parameter that is an object.\n var hasKeys = paramNames.some(function (name) {\n return Object.keys(params).indexOf(name) !== -1;\n }); // if it has some of the keys, return it as is.\n\n if (hasKeys) {\n return params;\n } // otherwise wrap the object in an array.\n\n\n params = [params];\n } // Reduce the paramsNames to a param object.\n\n\n return params.reduce(function (prev, value, idx) {\n prev[paramNames[idx]] = value;\n return prev;\n }, {});\n};\n/**\n * Tests a single input value against a rule.\n */\n\n\nValidator.prototype._test = function _test(field, value, rule) {\n var this$1 = this;\n var validator = RuleContainer.getValidatorMethod(rule.name);\n var params = Array.isArray(rule.params) ? toArray(rule.params) : rule.params;\n\n if (!params) {\n params = [];\n }\n\n var targetName = null;\n\n if (!validator || typeof validator !== 'function') {\n return Promise.reject(createError(\"No such validator '\" + rule.name + \"' exists.\"));\n } // has field dependencies.\n\n\n if (rule.options.hasTarget && field.dependencies) {\n var target = find(field.dependencies, function (d) {\n return d.name === rule.name;\n });\n\n if (target) {\n targetName = target.field.alias;\n params = [target.field.value].concat(params.slice(1));\n }\n } else if (rule.name === 'required' && field.rejectsFalse) {\n // invalidate false if no args were specified and the field rejects false by default.\n params = params.length ? params : [true];\n }\n\n if (rule.options.isDate) {\n var dateFormat = this._getDateFormat(field.rules);\n\n if (rule.name !== 'date_format') {\n params.push(dateFormat);\n }\n }\n\n var result = validator(value, this._convertParamArrayToObj(params, rule.name)); // If it is a promise.\n\n if (isCallable(result.then)) {\n return result.then(function (values) {\n var allValid = true;\n var data = {};\n\n if (Array.isArray(values)) {\n allValid = values.every(function (t) {\n return isObject(t) ? t.valid : t;\n });\n } else {\n // Is a single object/boolean.\n allValid = isObject(values) ? values.valid : values;\n data = values.data;\n }\n\n return {\n valid: allValid,\n data: result.data,\n errors: allValid ? [] : [this$1._createFieldError(field, rule, data, targetName)]\n };\n });\n }\n\n if (!isObject(result)) {\n result = {\n valid: result,\n data: {}\n };\n }\n\n return {\n valid: result.valid,\n data: result.data,\n errors: result.valid ? [] : [this._createFieldError(field, rule, result.data, targetName)]\n };\n};\n/**\n * Merges a validator object into the RULES and Messages.\n */\n\n\nValidator._merge = function _merge(name, ref) {\n var validator = ref.validator;\n var options = ref.options;\n var paramNames = ref.paramNames;\n var validate = isCallable(validator) ? validator : validator.validate;\n\n if (validator.getMessage) {\n DictionaryResolver.getDriver().setMessage(Validator.locale, name, validator.getMessage);\n }\n\n RuleContainer.add(name, {\n validate: validate,\n options: options,\n paramNames: paramNames\n });\n};\n/**\n * Guards from extension violations.\n */\n\n\nValidator._guardExtend = function _guardExtend(name, validator) {\n if (isCallable(validator)) {\n return;\n }\n\n if (!isCallable(validator.validate)) {\n throw createError(\"Extension Error: The validator '\" + name + \"' must be a function or have a 'validate' method.\");\n }\n};\n/**\n * Creates a Field Error Object.\n */\n\n\nValidator.prototype._createFieldError = function _createFieldError(field, rule, data, targetName) {\n var this$1 = this;\n return {\n id: field.id,\n vmId: field.vmId,\n field: field.name,\n msg: this._formatErrorMessage(field, rule, data, targetName),\n rule: rule.name,\n scope: field.scope,\n regenerate: function regenerate() {\n return this$1._formatErrorMessage(field, rule, data, targetName);\n }\n };\n};\n/**\n * Tries different strategies to find a field.\n */\n\n\nValidator.prototype._resolveField = function _resolveField(name, scope, uid) {\n if (name[0] === '#') {\n return this.fields.findById(name.slice(1));\n }\n\n if (!isNullOrUndefined(scope)) {\n return this.fields.find({\n name: name,\n scope: scope,\n vmId: uid\n });\n }\n\n if (includes(name, '.')) {\n var ref = name.split('.');\n var fieldScope = ref[0];\n var fieldName = ref.slice(1);\n var field = this.fields.find({\n name: fieldName.join('.'),\n scope: fieldScope,\n vmId: uid\n });\n\n if (field) {\n return field;\n }\n }\n\n return this.fields.find({\n name: name,\n scope: null,\n vmId: uid\n });\n};\n/**\n * Handles when a field is not found.\n */\n\n\nValidator.prototype._handleFieldNotFound = function _handleFieldNotFound(name, scope) {\n var fullName = isNullOrUndefined(scope) ? name : \"\" + (!isNullOrUndefined(scope) ? scope + '.' : '') + name;\n return Promise.reject(createError(\"Validating a non-existent field: \\\"\" + fullName + \"\\\". Use \\\"attach()\\\" first.\"));\n};\n/**\n * Handles validation results.\n */\n\n\nValidator.prototype._handleValidationResults = function _handleValidationResults(results, vmId) {\n var this$1 = this;\n var matchers = results.map(function (result) {\n return {\n id: result.id\n };\n });\n this.errors.removeById(matchers.map(function (m) {\n return m.id;\n })); // remove by name and scope to remove any custom errors added.\n\n results.forEach(function (result) {\n this$1.errors.remove(result.field, result.scope, vmId);\n });\n var allErrors = results.reduce(function (prev, curr) {\n prev.push.apply(prev, curr.errors);\n return prev;\n }, []);\n this.errors.add(allErrors); // handle flags.\n\n this.fields.filter(matchers).forEach(function (field) {\n var result = find(results, function (r) {\n return r.id === field.id;\n });\n field.setFlags({\n pending: false,\n valid: result.valid,\n validated: true\n });\n });\n};\n\nValidator.prototype._shouldSkip = function _shouldSkip(field, value) {\n // field is configured to run through the pipeline regardless\n if (field.bails === false) {\n return false;\n } // disabled fields are skipped if useConstraintAttrs is enabled in config\n\n\n if (field.isDisabled && getConfig().useConstraintAttrs) {\n return true;\n } // skip if the field is not required and has an empty value.\n\n\n return !field.isRequired && (isNullOrUndefined(value) || value === '' || isEmptyArray(value));\n};\n\nValidator.prototype._shouldBail = function _shouldBail(field) {\n // if the field was configured explicitly.\n if (field.bails !== undefined) {\n return field.bails;\n }\n\n return this.fastExit;\n};\n/**\n * Starts the validation process.\n */\n\n\nValidator.prototype._validate = function _validate(field, value, ref) {\n var this$1 = this;\n if (ref === void 0) ref = {};\n var initial = ref.initial;\n var requireRules = Object.keys(field.rules).filter(RuleContainer.isRequireRule);\n field.forceRequired = false;\n requireRules.forEach(function (rule) {\n var ruleOptions = RuleContainer.getOptions(rule);\n\n var result = this$1._test(field, value, {\n name: rule,\n params: field.rules[rule],\n options: ruleOptions\n });\n\n if (isCallable(result.then)) {\n throw createError('Require rules cannot be async');\n }\n\n if (!isObject(result)) {\n throw createError('Require rules has to return an object (see docs)');\n }\n\n if (result.data.required === true) {\n field.forceRequired = true;\n }\n });\n\n if (this._shouldSkip(field, value)) {\n return Promise.resolve({\n valid: true,\n id: field.id,\n field: field.name,\n scope: field.scope,\n errors: []\n });\n }\n\n var promises = [];\n var errors = [];\n var isExitEarly = false;\n\n if (isCallable(field.checkValueChanged)) {\n field.flags.changed = field.checkValueChanged();\n } // use of '.some()' is to break iteration in middle by returning true\n\n\n Object.keys(field.rules).filter(function (rule) {\n if (!initial || !RuleContainer.has(rule)) {\n return true;\n }\n\n return RuleContainer.isImmediate(rule);\n }).some(function (rule) {\n var ruleOptions = RuleContainer.getOptions(rule);\n\n var result = this$1._test(field, value, {\n name: rule,\n params: field.rules[rule],\n options: ruleOptions\n });\n\n if (isCallable(result.then)) {\n promises.push(result);\n } else if (!result.valid && this$1._shouldBail(field)) {\n errors.push.apply(errors, result.errors);\n isExitEarly = true;\n } else {\n // promisify the result.\n promises.push(new Promise(function (resolve) {\n return resolve(result);\n }));\n }\n\n return isExitEarly;\n });\n\n if (isExitEarly) {\n return Promise.resolve({\n valid: false,\n errors: errors,\n id: field.id,\n field: field.name,\n scope: field.scope\n });\n }\n\n return Promise.all(promises).then(function (results) {\n return results.reduce(function (prev, v) {\n var ref;\n\n if (!v.valid) {\n (ref = prev.errors).push.apply(ref, v.errors);\n }\n\n prev.valid = prev.valid && v.valid;\n return prev;\n }, {\n valid: true,\n errors: errors,\n id: field.id,\n field: field.name,\n scope: field.scope\n });\n });\n};\n\nObject.defineProperties(Validator.prototype, prototypeAccessors$4);\nObject.defineProperties(Validator, staticAccessors$1); // \n\nvar normalizeValue = function normalizeValue(value) {\n if (isObject(value)) {\n return Object.keys(value).reduce(function (prev, key) {\n prev[key] = normalizeValue(value[key]);\n return prev;\n }, {});\n }\n\n if (isCallable(value)) {\n return value('{0}', ['{1}', '{2}', '{3}']);\n }\n\n return value;\n};\n\nvar normalizeFormat = function normalizeFormat(locale) {\n // normalize messages\n var dictionary = {};\n\n if (locale.messages) {\n dictionary.messages = normalizeValue(locale.messages);\n }\n\n if (locale.custom) {\n dictionary.custom = normalizeValue(locale.custom);\n }\n\n if (locale.attributes) {\n dictionary.attributes = locale.attributes;\n }\n\n if (!isNullOrUndefined(locale.dateFormat)) {\n dictionary.dateFormat = locale.dateFormat;\n }\n\n return dictionary;\n};\n\nvar I18nDictionary = function I18nDictionary(i18n, rootKey) {\n this.i18n = i18n;\n this.rootKey = rootKey;\n};\n\nvar prototypeAccessors$5 = {\n locale: {\n configurable: true\n }\n};\n\nprototypeAccessors$5.locale.get = function () {\n return this.i18n.locale;\n};\n\nprototypeAccessors$5.locale.set = function (value) {\n warn('Cannot set locale from the validator when using vue-i18n, use i18n.locale setter instead');\n};\n\nI18nDictionary.prototype.getDateFormat = function getDateFormat(locale) {\n return this.i18n.getDateTimeFormat(locale || this.locale);\n};\n\nI18nDictionary.prototype.setDateFormat = function setDateFormat(locale, value) {\n this.i18n.setDateTimeFormat(locale || this.locale, value);\n};\n\nI18nDictionary.prototype.getMessage = function getMessage(_, key, data) {\n var path = this.rootKey + \".messages.\" + key;\n var dataOptions = data;\n\n if (Array.isArray(data)) {\n dataOptions = [].concat.apply([], data);\n }\n\n if (this.i18n.te(path)) {\n return this.i18n.t(path, dataOptions);\n } // fallback to the fallback message\n\n\n if (this.i18n.te(path, this.i18n.fallbackLocale)) {\n return this.i18n.t(path, this.i18n.fallbackLocale, dataOptions);\n } // fallback to the root message\n\n\n return this.i18n.t(this.rootKey + \".messages._default\", dataOptions);\n};\n\nI18nDictionary.prototype.getAttribute = function getAttribute(_, key, fallback) {\n if (fallback === void 0) fallback = '';\n var path = this.rootKey + \".attributes.\" + key;\n\n if (this.i18n.te(path)) {\n return this.i18n.t(path);\n }\n\n return fallback;\n};\n\nI18nDictionary.prototype.getFieldMessage = function getFieldMessage(_, field, key, data) {\n var path = this.rootKey + \".custom.\" + field + \".\" + key;\n\n if (this.i18n.te(path)) {\n return this.i18n.t(path, data);\n }\n\n return this.getMessage(_, key, data);\n};\n\nI18nDictionary.prototype.merge = function merge$1(dictionary) {\n var this$1 = this;\n Object.keys(dictionary).forEach(function (localeKey) {\n var obj; // i18n doesn't deep merge\n // first clone the existing locale (avoid mutations to locale)\n\n var clone = merge({}, getPath(localeKey + \".\" + this$1.rootKey, this$1.i18n.messages, {})); // Merge cloned locale with new one\n\n var locale = merge(clone, normalizeFormat(dictionary[localeKey]));\n this$1.i18n.mergeLocaleMessage(localeKey, (obj = {}, obj[this$1.rootKey] = locale, obj));\n\n if (locale.dateFormat) {\n this$1.i18n.setDateTimeFormat(localeKey, locale.dateFormat);\n }\n });\n};\n\nI18nDictionary.prototype.setMessage = function setMessage(locale, key, value) {\n var obj, obj$1;\n this.merge((obj$1 = {}, obj$1[locale] = {\n messages: (obj = {}, obj[key] = value, obj)\n }, obj$1));\n};\n\nI18nDictionary.prototype.setAttribute = function setAttribute(locale, key, value) {\n var obj, obj$1;\n this.merge((obj$1 = {}, obj$1[locale] = {\n attributes: (obj = {}, obj[key] = value, obj)\n }, obj$1));\n};\n\nObject.defineProperties(I18nDictionary.prototype, prototypeAccessors$5);\n\nvar aggressive = function aggressive() {\n return {\n on: ['input']\n };\n};\n\nvar lazy = function lazy() {\n return {\n on: ['change']\n };\n};\n\nvar eager = function eager(ref) {\n var errors = ref.errors;\n\n if (errors.length) {\n return {\n on: ['input']\n };\n }\n\n return {\n on: ['change', 'blur']\n };\n};\n\nvar passive = function passive() {\n return {\n on: []\n };\n};\n\nvar modes = {\n aggressive: aggressive,\n eager: eager,\n passive: passive,\n lazy: lazy\n}; // \n\nvar Vue;\nvar pendingPlugins;\nvar pluginInstance;\n\nvar VeeValidate$1 = function VeeValidate(config, _Vue) {\n this.configure(config);\n pluginInstance = this;\n\n if (_Vue) {\n Vue = _Vue;\n }\n\n this._validator = setValidator(new Validator(null, {\n fastExit: config && config.fastExit\n }, this));\n\n this._initVM(this.config);\n\n this._initI18n(this.config);\n};\n\nvar prototypeAccessors$6 = {\n i18nDriver: {\n configurable: true\n },\n config: {\n configurable: true\n }\n};\nvar staticAccessors$2 = {\n i18nDriver: {\n configurable: true\n },\n config: {\n configurable: true\n }\n};\n\nVeeValidate$1.setI18nDriver = function setI18nDriver(driver, instance) {\n DictionaryResolver.setDriver(driver, instance);\n};\n\nVeeValidate$1.configure = function configure(cfg) {\n setConfig(cfg);\n};\n\nVeeValidate$1.setMode = function setMode(mode, implementation) {\n setConfig({\n mode: mode\n });\n\n if (!implementation) {\n return;\n }\n\n if (!isCallable(implementation)) {\n throw new Error('A mode implementation must be a function');\n }\n\n modes[mode] = implementation;\n};\n\nVeeValidate$1.use = function use(plugin, options) {\n if (options === void 0) options = {};\n\n if (!isCallable(plugin)) {\n return warn('The plugin must be a callable function');\n } // Don't install plugins until vee-validate is installed.\n\n\n if (!pluginInstance) {\n if (!pendingPlugins) {\n pendingPlugins = [];\n }\n\n pendingPlugins.push({\n plugin: plugin,\n options: options\n });\n return;\n }\n\n plugin({\n Validator: Validator,\n ErrorBag: ErrorBag,\n Rules: Validator.rules\n }, options);\n};\n\nVeeValidate$1.install = function install(_Vue, opts) {\n if (Vue && _Vue === Vue) {\n if (process.env.NODE_ENV !== 'production') {\n warn('already installed, Vue.use(VeeValidate) should only be called once.');\n }\n\n return;\n }\n\n Vue = _Vue;\n pluginInstance = new VeeValidate$1(opts); // inject the plugin container statically into the validator class\n\n Validator.$vee = pluginInstance;\n detectPassiveSupport();\n Vue.mixin(mixin);\n Vue.directive('validate', directive);\n\n if (pendingPlugins) {\n pendingPlugins.forEach(function (ref) {\n var plugin = ref.plugin;\n var options = ref.options;\n VeeValidate$1.use(plugin, options);\n });\n pendingPlugins = null;\n }\n};\n\nprototypeAccessors$6.i18nDriver.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nstaticAccessors$2.i18nDriver.get = function () {\n return DictionaryResolver.getDriver();\n};\n\nprototypeAccessors$6.config.get = function () {\n return getConfig();\n};\n\nstaticAccessors$2.config.get = function () {\n return getConfig();\n};\n\nVeeValidate$1.prototype._initVM = function _initVM(config) {\n var this$1 = this;\n this._vm = new Vue({\n data: function data() {\n return {\n errors: this$1._validator.errors,\n fields: this$1._validator.fields\n };\n }\n });\n};\n\nVeeValidate$1.prototype._initI18n = function _initI18n(config) {\n var this$1 = this;\n var dictionary = config.dictionary;\n var i18n = config.i18n;\n var i18nRootKey = config.i18nRootKey;\n var locale = config.locale;\n\n var onLocaleChanged = function onLocaleChanged() {\n if (dictionary) {\n this$1.i18nDriver.merge(dictionary);\n }\n\n this$1._validator.errors.regenerate();\n }; // i18 is being used for localization.\n\n\n if (i18n) {\n VeeValidate$1.setI18nDriver('i18n', new I18nDictionary(i18n, i18nRootKey));\n\n i18n._vm.$watch('locale', onLocaleChanged);\n } else if (typeof window !== 'undefined') {\n this._vm.$on('localeChanged', onLocaleChanged);\n }\n\n if (dictionary) {\n this.i18nDriver.merge(dictionary);\n }\n\n if (locale && !i18n) {\n this._validator.localize(locale);\n }\n};\n\nVeeValidate$1.prototype.configure = function configure(cfg) {\n setConfig(cfg);\n};\n\nObject.defineProperties(VeeValidate$1.prototype, prototypeAccessors$6);\nObject.defineProperties(VeeValidate$1, staticAccessors$2);\nVeeValidate$1.mixin = mixin;\nVeeValidate$1.directive = directive;\nVeeValidate$1.Validator = Validator;\nVeeValidate$1.ErrorBag = ErrorBag;\n/**\n * Formates file size.\n *\n * @param {Number|String} size\n */\n\nvar formatFileSize = function formatFileSize(size) {\n var units = ['Byte', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n var threshold = 1024;\n size = Number(size) * threshold;\n var i = size === 0 ? 0 : Math.floor(Math.log(size) / Math.log(threshold));\n return (size / Math.pow(threshold, i)).toFixed(2) * 1 + \" \" + units[i];\n};\n/**\n * Checks if vee-validate is defined globally.\n */\n\n\nvar isDefinedGlobally = function isDefinedGlobally() {\n return typeof VeeValidate !== 'undefined';\n};\n\nvar obj;\nvar messages = {\n _default: function _default(field) {\n return \"The \" + field + \" value is not valid\";\n },\n after: function after(field, ref) {\n var target = ref[0];\n var inclusion = ref[1];\n return \"The \" + field + \" must be after \" + (inclusion ? 'or equal to ' : '') + target;\n },\n alpha: function alpha(field) {\n return \"The \" + field + \" field may only contain alphabetic characters\";\n },\n alpha_dash: function alpha_dash(field) {\n return \"The \" + field + \" field may contain alpha-numeric characters as well as dashes and underscores\";\n },\n alpha_num: function alpha_num(field) {\n return \"The \" + field + \" field may only contain alpha-numeric characters\";\n },\n alpha_spaces: function alpha_spaces(field) {\n return \"The \" + field + \" field may only contain alphabetic characters as well as spaces\";\n },\n before: function before(field, ref) {\n var target = ref[0];\n var inclusion = ref[1];\n return \"The \" + field + \" must be before \" + (inclusion ? 'or equal to ' : '') + target;\n },\n between: function between(field, ref) {\n var min = ref[0];\n var max = ref[1];\n return \"The \" + field + \" field must be between \" + min + \" and \" + max;\n },\n confirmed: function confirmed(field) {\n return \"The \" + field + \" confirmation does not match\";\n },\n credit_card: function credit_card(field) {\n return \"The \" + field + \" field is invalid\";\n },\n date_between: function date_between(field, ref) {\n var min = ref[0];\n var max = ref[1];\n return \"The \" + field + \" must be between \" + min + \" and \" + max;\n },\n date_format: function date_format(field, ref) {\n var format = ref[0];\n return \"The \" + field + \" must be in the format \" + format;\n },\n decimal: function decimal(field, ref) {\n if (ref === void 0) ref = [];\n var decimals = ref[0];\n if (decimals === void 0) decimals = '*';\n return \"The \" + field + \" field must be numeric and may contain\" + (!decimals || decimals === '*' ? '' : ' ' + decimals) + \" decimal points\";\n },\n digits: function digits(field, ref) {\n var length = ref[0];\n return \"The \" + field + \" field must be numeric and contains exactly \" + length + \" digits\";\n },\n dimensions: function dimensions(field, ref) {\n var width = ref[0];\n var height = ref[1];\n return \"The \" + field + \" field must be \" + width + \" pixels by \" + height + \" pixels\";\n },\n email: function email(field) {\n return \"The \" + field + \" field must be a valid email\";\n },\n excluded: function excluded(field) {\n return \"The \" + field + \" field must be a valid value\";\n },\n ext: function ext(field) {\n return \"The \" + field + \" field must be a valid file\";\n },\n image: function image(field) {\n return \"The \" + field + \" field must be an image\";\n },\n included: function included(field) {\n return \"The \" + field + \" field must be a valid value\";\n },\n integer: function integer(field) {\n return \"The \" + field + \" field must be an integer\";\n },\n ip: function ip(field) {\n return \"The \" + field + \" field must be a valid ip address\";\n },\n ip_or_fqdn: function ip_or_fqdn(field) {\n return \"The \" + field + \" field must be a valid ip address or FQDN\";\n },\n length: function length(field, ref) {\n var length = ref[0];\n var max = ref[1];\n\n if (max) {\n return \"The \" + field + \" length must be between \" + length + \" and \" + max;\n }\n\n return \"The \" + field + \" length must be \" + length;\n },\n max: function max(field, ref) {\n var length = ref[0];\n return \"The \" + field + \" field may not be greater than \" + length + \" characters\";\n },\n max_value: function max_value(field, ref) {\n var max = ref[0];\n return \"The \" + field + \" field must be \" + max + \" or less\";\n },\n mimes: function mimes(field) {\n return \"The \" + field + \" field must have a valid file type\";\n },\n min: function min(field, ref) {\n var length = ref[0];\n return \"The \" + field + \" field must be at least \" + length + \" characters\";\n },\n min_value: function min_value(field, ref) {\n var min = ref[0];\n return \"The \" + field + \" field must be \" + min + \" or more\";\n },\n numeric: function numeric(field) {\n return \"The \" + field + \" field may only contain numeric characters\";\n },\n regex: function regex(field) {\n return \"The \" + field + \" field format is invalid\";\n },\n required: function required(field) {\n return \"The \" + field + \" field is required\";\n },\n required_if: function required_if(field, ref) {\n var target = ref[0];\n return \"The \" + field + \" field is required when the \" + target + \" field has this value\";\n },\n size: function size(field, ref) {\n var size = ref[0];\n return \"The \" + field + \" size must be less than \" + formatFileSize(size);\n },\n url: function url(field) {\n return \"The \" + field + \" field is not a valid URL\";\n }\n};\nvar locale = {\n name: 'en',\n messages: messages,\n attributes: {}\n};\n\nif (isDefinedGlobally()) {\n // eslint-disable-next-line\n VeeValidate.Validator.localize((obj = {}, obj[locale.name] = locale, obj));\n}\n\nfunction toInteger(dirtyNumber) {\n if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {\n return NaN;\n }\n\n var number = Number(dirtyNumber);\n\n if (isNaN(number)) {\n return number;\n }\n\n return number < 0 ? Math.ceil(number) : Math.floor(number);\n}\n\nvar MILLISECONDS_IN_MINUTE = 60000;\n/**\n * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.\n * They usually appear for dates that denote time before the timezones were introduced\n * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891\n * and GMT+01:00:00 after that date)\n *\n * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,\n * which would lead to incorrect calculations.\n *\n * This function returns the timezone offset in milliseconds that takes seconds in account.\n */\n\nfunction getTimezoneOffsetInMilliseconds(dirtyDate) {\n var date = new Date(dirtyDate.getTime());\n var baseTimezoneOffset = date.getTimezoneOffset();\n date.setSeconds(0, 0);\n var millisecondsPartOfTimezoneOffset = date.getTime() % MILLISECONDS_IN_MINUTE;\n return baseTimezoneOffset * MILLISECONDS_IN_MINUTE + millisecondsPartOfTimezoneOffset;\n}\n\nvar MILLISECONDS_IN_HOUR = 3600000;\nvar MILLISECONDS_IN_MINUTE$1 = 60000;\nvar DEFAULT_ADDITIONAL_DIGITS = 2;\nvar patterns = {\n dateTimeDelimeter: /[T ]/,\n plainTime: /:/,\n timeZoneDelimeter: /[Z ]/i,\n // year tokens\n YY: /^(\\d{2})$/,\n YYY: [/^([+-]\\d{2})$/, // 0 additional digits\n /^([+-]\\d{3})$/, // 1 additional digit\n /^([+-]\\d{4})$/ // 2 additional digits\n ],\n YYYY: /^(\\d{4})/,\n YYYYY: [/^([+-]\\d{4})/, // 0 additional digits\n /^([+-]\\d{5})/, // 1 additional digit\n /^([+-]\\d{6})/ // 2 additional digits\n ],\n // date tokens\n MM: /^-(\\d{2})$/,\n DDD: /^-?(\\d{3})$/,\n MMDD: /^-?(\\d{2})-?(\\d{2})$/,\n Www: /^-?W(\\d{2})$/,\n WwwD: /^-?W(\\d{2})-?(\\d{1})$/,\n HH: /^(\\d{2}([.,]\\d*)?)$/,\n HHMM: /^(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n HHMMSS: /^(\\d{2}):?(\\d{2}):?(\\d{2}([.,]\\d*)?)$/,\n // timezone tokens\n timezone: /([Z+-].*)$/,\n timezoneZ: /^(Z)$/,\n timezoneHH: /^([+-])(\\d{2})$/,\n timezoneHHMM: /^([+-])(\\d{2}):?(\\d{2})$/\n};\n/**\n * @name toDate\n * @category Common Helpers\n * @summary Convert the given argument to an instance of Date.\n *\n * @description\n * Convert the given argument to an instance of Date.\n *\n * If the argument is an instance of Date, the function returns its clone.\n *\n * If the argument is a number, it is treated as a timestamp.\n *\n * If an argument is a string, the function tries to parse it.\n * Function accepts complete ISO 8601 formats as well as partial implementations.\n * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601\n * If the function cannot parse the string or the values are invalid, it returns Invalid Date.\n *\n * If the argument is none of the above, the function returns Invalid Date.\n *\n * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.\n * All *date-fns* functions will throw `RangeError` if `options.additionalDigits` is not 0, 1, 2 or undefined.\n *\n * @param {Date|String|Number} argument - the value to convert\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format\n * @returns {Date} the parsed date in the local time zone\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Convert string '2014-02-11T11:30:30' to date:\n * var result = toDate('2014-02-11T11:30:30')\n * //=> Tue Feb 11 2014 11:30:30\n *\n * @example\n * // Convert string '+02014101' to date,\n * // if the additional number of digits in the extended year format is 1:\n * var result = toDate('+02014101', {additionalDigits: 1})\n * //=> Fri Apr 11 2014 00:00:00\n */\n\nfunction toDate(argument, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n if (argument === null) {\n return new Date(NaN);\n }\n\n var options = dirtyOptions || {};\n var additionalDigits = options.additionalDigits == null ? DEFAULT_ADDITIONAL_DIGITS : toInteger(options.additionalDigits);\n\n if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {\n throw new RangeError('additionalDigits must be 0, 1 or 2');\n } // Clone the date\n\n\n if (argument instanceof Date || _typeof2(argument) === 'object' && Object.prototype.toString.call(argument) === '[object Date]') {\n // Prevent the date to lose the milliseconds when passed to new Date() in IE10\n return new Date(argument.getTime());\n } else if (typeof argument === 'number' || Object.prototype.toString.call(argument) === '[object Number]') {\n return new Date(argument);\n } else if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {\n return new Date(NaN);\n }\n\n var dateStrings = splitDateString(argument);\n var parseYearResult = parseYear(dateStrings.date, additionalDigits);\n var year = parseYearResult.year;\n var restDateString = parseYearResult.restDateString;\n var date = parseDate(restDateString, year);\n\n if (isNaN(date)) {\n return new Date(NaN);\n }\n\n if (date) {\n var timestamp = date.getTime();\n var time = 0;\n var offset;\n\n if (dateStrings.time) {\n time = parseTime(dateStrings.time);\n\n if (isNaN(time)) {\n return new Date(NaN);\n }\n }\n\n if (dateStrings.timezone) {\n offset = parseTimezone(dateStrings.timezone);\n\n if (isNaN(offset)) {\n return new Date(NaN);\n }\n } else {\n // get offset accurate to hour in timezones that change offset\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time));\n offset = getTimezoneOffsetInMilliseconds(new Date(timestamp + time + offset));\n }\n\n return new Date(timestamp + time + offset);\n } else {\n return new Date(NaN);\n }\n}\n\nfunction splitDateString(dateString) {\n var dateStrings = {};\n var array = dateString.split(patterns.dateTimeDelimeter);\n var timeString;\n\n if (patterns.plainTime.test(array[0])) {\n dateStrings.date = null;\n timeString = array[0];\n } else {\n dateStrings.date = array[0];\n timeString = array[1];\n\n if (patterns.timeZoneDelimeter.test(dateStrings.date)) {\n dateStrings.date = dateString.split(patterns.timeZoneDelimeter)[0];\n timeString = dateString.substr(dateStrings.date.length, dateString.length);\n }\n }\n\n if (timeString) {\n var token = patterns.timezone.exec(timeString);\n\n if (token) {\n dateStrings.time = timeString.replace(token[1], '');\n dateStrings.timezone = token[1];\n } else {\n dateStrings.time = timeString;\n }\n }\n\n return dateStrings;\n}\n\nfunction parseYear(dateString, additionalDigits) {\n var patternYYY = patterns.YYY[additionalDigits];\n var patternYYYYY = patterns.YYYYY[additionalDigits];\n var token; // YYYY or ±YYYYY\n\n token = patterns.YYYY.exec(dateString) || patternYYYYY.exec(dateString);\n\n if (token) {\n var yearString = token[1];\n return {\n year: parseInt(yearString, 10),\n restDateString: dateString.slice(yearString.length)\n };\n } // YY or ±YYY\n\n\n token = patterns.YY.exec(dateString) || patternYYY.exec(dateString);\n\n if (token) {\n var centuryString = token[1];\n return {\n year: parseInt(centuryString, 10) * 100,\n restDateString: dateString.slice(centuryString.length)\n };\n } // Invalid ISO-formatted year\n\n\n return {\n year: null\n };\n}\n\nfunction parseDate(dateString, year) {\n // Invalid ISO-formatted year\n if (year === null) {\n return null;\n }\n\n var token;\n var date;\n var month;\n var week; // YYYY\n\n if (dateString.length === 0) {\n date = new Date(0);\n date.setUTCFullYear(year);\n return date;\n } // YYYY-MM\n\n\n token = patterns.MM.exec(dateString);\n\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n\n if (!validateDate(year, month)) {\n return new Date(NaN);\n }\n\n date.setUTCFullYear(year, month);\n return date;\n } // YYYY-DDD or YYYYDDD\n\n\n token = patterns.DDD.exec(dateString);\n\n if (token) {\n date = new Date(0);\n var dayOfYear = parseInt(token[1], 10);\n\n if (!validateDayOfYearDate(year, dayOfYear)) {\n return new Date(NaN);\n }\n\n date.setUTCFullYear(year, 0, dayOfYear);\n return date;\n } // YYYY-MM-DD or YYYYMMDD\n\n\n token = patterns.MMDD.exec(dateString);\n\n if (token) {\n date = new Date(0);\n month = parseInt(token[1], 10) - 1;\n var day = parseInt(token[2], 10);\n\n if (!validateDate(year, month, day)) {\n return new Date(NaN);\n }\n\n date.setUTCFullYear(year, month, day);\n return date;\n } // YYYY-Www or YYYYWww\n\n\n token = patterns.Www.exec(dateString);\n\n if (token) {\n week = parseInt(token[1], 10) - 1;\n\n if (!validateWeekDate(year, week)) {\n return new Date(NaN);\n }\n\n return dayOfISOWeekYear(year, week);\n } // YYYY-Www-D or YYYYWwwD\n\n\n token = patterns.WwwD.exec(dateString);\n\n if (token) {\n week = parseInt(token[1], 10) - 1;\n var dayOfWeek = parseInt(token[2], 10) - 1;\n\n if (!validateWeekDate(year, week, dayOfWeek)) {\n return new Date(NaN);\n }\n\n return dayOfISOWeekYear(year, week, dayOfWeek);\n } // Invalid ISO-formatted date\n\n\n return null;\n}\n\nfunction parseTime(timeString) {\n var token;\n var hours;\n var minutes; // hh\n\n token = patterns.HH.exec(timeString);\n\n if (token) {\n hours = parseFloat(token[1].replace(',', '.'));\n\n if (!validateTime(hours)) {\n return NaN;\n }\n\n return hours % 24 * MILLISECONDS_IN_HOUR;\n } // hh:mm or hhmm\n\n\n token = patterns.HHMM.exec(timeString);\n\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseFloat(token[2].replace(',', '.'));\n\n if (!validateTime(hours, minutes)) {\n return NaN;\n }\n\n return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1;\n } // hh:mm:ss or hhmmss\n\n\n token = patterns.HHMMSS.exec(timeString);\n\n if (token) {\n hours = parseInt(token[1], 10);\n minutes = parseInt(token[2], 10);\n var seconds = parseFloat(token[3].replace(',', '.'));\n\n if (!validateTime(hours, minutes, seconds)) {\n return NaN;\n }\n\n return hours % 24 * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1 + seconds * 1000;\n } // Invalid ISO-formatted time\n\n\n return null;\n}\n\nfunction parseTimezone(timezoneString) {\n var token;\n var absoluteOffset; // Z\n\n token = patterns.timezoneZ.exec(timezoneString);\n\n if (token) {\n return 0;\n }\n\n var hours; // ±hh\n\n token = patterns.timezoneHH.exec(timezoneString);\n\n if (token) {\n hours = parseInt(token[2], 10);\n\n if (!validateTimezone()) {\n return NaN;\n }\n\n absoluteOffset = hours * MILLISECONDS_IN_HOUR;\n return token[1] === '+' ? -absoluteOffset : absoluteOffset;\n } // ±hh:mm or ±hhmm\n\n\n token = patterns.timezoneHHMM.exec(timezoneString);\n\n if (token) {\n hours = parseInt(token[2], 10);\n var minutes = parseInt(token[3], 10);\n\n if (!validateTimezone(hours, minutes)) {\n return NaN;\n }\n\n absoluteOffset = hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE$1;\n return token[1] === '+' ? -absoluteOffset : absoluteOffset;\n }\n\n return 0;\n}\n\nfunction dayOfISOWeekYear(isoWeekYear, week, day) {\n week = week || 0;\n day = day || 0;\n var date = new Date(0);\n date.setUTCFullYear(isoWeekYear, 0, 4);\n var fourthOfJanuaryDay = date.getUTCDay() || 7;\n var diff = week * 7 + day + 1 - fourthOfJanuaryDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n} // Validation functions\n\n\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\n\nfunction validateDate(year, month, date) {\n if (month < 0 || month > 11) {\n return false;\n }\n\n if (date != null) {\n if (date < 1) {\n return false;\n }\n\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear && date > DAYS_IN_MONTH_LEAP_YEAR[month]) {\n return false;\n }\n\n if (!isLeapYear && date > DAYS_IN_MONTH[month]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction validateDayOfYearDate(year, dayOfYear) {\n if (dayOfYear < 1) {\n return false;\n }\n\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear && dayOfYear > 366) {\n return false;\n }\n\n if (!isLeapYear && dayOfYear > 365) {\n return false;\n }\n\n return true;\n}\n\nfunction validateWeekDate(year, week, day) {\n if (week < 0 || week > 52) {\n return false;\n }\n\n if (day != null && (day < 0 || day > 6)) {\n return false;\n }\n\n return true;\n}\n\nfunction validateTime(hours, minutes, seconds) {\n if (hours != null && (hours < 0 || hours >= 25)) {\n return false;\n }\n\n if (minutes != null && (minutes < 0 || minutes >= 60)) {\n return false;\n }\n\n if (seconds != null && (seconds < 0 || seconds >= 60)) {\n return false;\n }\n\n return true;\n}\n\nfunction validateTimezone(hours, minutes) {\n if (minutes != null && (minutes < 0 || minutes > 59)) {\n return false;\n }\n\n return true;\n}\n/**\n * @name addMilliseconds\n * @category Millisecond Helpers\n * @summary Add the specified number of milliseconds to the given date.\n *\n * @description\n * Add the specified number of milliseconds to the given date.\n *\n * @param {Date|String|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be added\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the new date with the milliseconds added\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Add 750 milliseconds to 10 July 2014 12:45:30.000:\n * var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:30.750\n */\n\n\nfunction addMilliseconds(dirtyDate, dirtyAmount, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var timestamp = toDate(dirtyDate, dirtyOptions).getTime();\n var amount = toInteger(dirtyAmount);\n return new Date(timestamp + amount);\n}\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {*} date - the date to check\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // For the valid date:\n * var result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * var result = isValid('2014-02-31')\n * //=> true\n *\n * @example\n * // For the invalid date:\n * var result = isValid(new Date(''))\n * //=> false\n */\n\n\nfunction isValid(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n return !isNaN(date);\n}\n\nvar formatDistanceLocale = {\n lessThanXSeconds: {\n one: 'less than a second',\n other: 'less than {{count}} seconds'\n },\n xSeconds: {\n one: '1 second',\n other: '{{count}} seconds'\n },\n halfAMinute: 'half a minute',\n lessThanXMinutes: {\n one: 'less than a minute',\n other: 'less than {{count}} minutes'\n },\n xMinutes: {\n one: '1 minute',\n other: '{{count}} minutes'\n },\n aboutXHours: {\n one: 'about 1 hour',\n other: 'about {{count}} hours'\n },\n xHours: {\n one: '1 hour',\n other: '{{count}} hours'\n },\n xDays: {\n one: '1 day',\n other: '{{count}} days'\n },\n aboutXMonths: {\n one: 'about 1 month',\n other: 'about {{count}} months'\n },\n xMonths: {\n one: '1 month',\n other: '{{count}} months'\n },\n aboutXYears: {\n one: 'about 1 year',\n other: 'about {{count}} years'\n },\n xYears: {\n one: '1 year',\n other: '{{count}} years'\n },\n overXYears: {\n one: 'over 1 year',\n other: 'over {{count}} years'\n },\n almostXYears: {\n one: 'almost 1 year',\n other: 'almost {{count}} years'\n }\n};\n\nfunction formatDistance(token, count, options) {\n options = options || {};\n var result;\n\n if (typeof formatDistanceLocale[token] === 'string') {\n result = formatDistanceLocale[token];\n } else if (count === 1) {\n result = formatDistanceLocale[token].one;\n } else {\n result = formatDistanceLocale[token].other.replace('{{count}}', count);\n }\n\n if (options.addSuffix) {\n if (options.comparison > 0) {\n return 'in ' + result;\n } else {\n return result + ' ago';\n }\n }\n\n return result;\n}\n\nfunction buildFormatLongFn(args) {\n return function (dirtyOptions) {\n var options = dirtyOptions || {};\n var width = options.width ? String(options.width) : args.defaultWidth;\n var format = args.formats[width] || args.formats[args.defaultWidth];\n return format;\n };\n}\n\nvar dateFormats = {\n full: 'EEEE, MMMM do, y',\n long: 'MMMM do, y',\n medium: 'MMM d, y',\n short: 'MM/dd/yyyy'\n};\nvar timeFormats = {\n full: 'h:mm:ss a zzzz',\n long: 'h:mm:ss a z',\n medium: 'h:mm:ss a',\n short: 'h:mm a'\n};\nvar dateTimeFormats = {\n full: \"{{date}} 'at' {{time}}\",\n long: \"{{date}} 'at' {{time}}\",\n medium: '{{date}}, {{time}}',\n short: '{{date}}, {{time}}'\n};\nvar formatLong = {\n date: buildFormatLongFn({\n formats: dateFormats,\n defaultWidth: 'full'\n }),\n time: buildFormatLongFn({\n formats: timeFormats,\n defaultWidth: 'full'\n }),\n dateTime: buildFormatLongFn({\n formats: dateTimeFormats,\n defaultWidth: 'full'\n })\n};\nvar formatRelativeLocale = {\n lastWeek: \"'last' eeee 'at' p\",\n yesterday: \"'yesterday at' p\",\n today: \"'today at' p\",\n tomorrow: \"'tomorrow at' p\",\n nextWeek: \"eeee 'at' p\",\n other: 'P'\n};\n\nfunction formatRelative(token, date, baseDate, options) {\n return formatRelativeLocale[token];\n}\n\nfunction buildLocalizeFn(args) {\n return function (dirtyIndex, dirtyOptions) {\n var options = dirtyOptions || {};\n var width = options.width ? String(options.width) : args.defaultWidth;\n var context = options.context ? String(options.context) : 'standalone';\n var valuesArray;\n\n if (context === 'formatting' && args.formattingValues) {\n valuesArray = args.formattingValues[width] || args.formattingValues[args.defaultFormattingWidth];\n } else {\n valuesArray = args.values[width] || args.values[args.defaultWidth];\n }\n\n var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;\n return valuesArray[index];\n };\n}\n\nvar eraValues = {\n narrow: ['B', 'A'],\n abbreviated: ['BC', 'AD'],\n wide: ['Before Christ', 'Anno Domini']\n};\nvar quarterValues = {\n narrow: ['1', '2', '3', '4'],\n abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],\n wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']\n}; // Note: in English, the names of days of the week and months are capitalized.\n// If you are making a new locale based on this one, check if the same is true for the language you're working on.\n// Generally, formatted dates should look like they are in the middle of a sentence,\n// e.g. in Spanish language the weekdays and months should be in the lowercase.\n\nvar monthValues = {\n narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],\n abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\nvar dayValues = {\n narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],\n short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],\n abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']\n};\nvar dayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n }\n};\nvar formattingDayPeriodValues = {\n narrow: {\n am: 'a',\n pm: 'p',\n midnight: 'mi',\n noon: 'n',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n abbreviated: {\n am: 'AM',\n pm: 'PM',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n },\n wide: {\n am: 'a.m.',\n pm: 'p.m.',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'in the morning',\n afternoon: 'in the afternoon',\n evening: 'in the evening',\n night: 'at night'\n }\n};\n\nfunction ordinalNumber(dirtyNumber, dirtyOptions) {\n var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,\n // if they are different for different grammatical genders,\n // use `options.unit`:\n //\n // var options = dirtyOptions || {}\n // var unit = String(options.unit)\n //\n // where `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',\n // 'day', 'hour', 'minute', 'second'\n\n var rem100 = number % 100;\n\n if (rem100 > 20 || rem100 < 10) {\n switch (rem100 % 10) {\n case 1:\n return number + 'st';\n\n case 2:\n return number + 'nd';\n\n case 3:\n return number + 'rd';\n }\n }\n\n return number + 'th';\n}\n\nvar localize = {\n ordinalNumber: ordinalNumber,\n era: buildLocalizeFn({\n values: eraValues,\n defaultWidth: 'wide'\n }),\n quarter: buildLocalizeFn({\n values: quarterValues,\n defaultWidth: 'wide',\n argumentCallback: function argumentCallback(quarter) {\n return Number(quarter) - 1;\n }\n }),\n month: buildLocalizeFn({\n values: monthValues,\n defaultWidth: 'wide'\n }),\n day: buildLocalizeFn({\n values: dayValues,\n defaultWidth: 'wide'\n }),\n dayPeriod: buildLocalizeFn({\n values: dayPeriodValues,\n defaultWidth: 'wide',\n formattingValues: formattingDayPeriodValues,\n defaulFormattingWidth: 'wide'\n })\n};\n\nfunction buildMatchPatternFn(args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString);\n var options = dirtyOptions || {};\n var matchResult = string.match(args.matchPattern);\n\n if (!matchResult) {\n return null;\n }\n\n var matchedString = matchResult[0];\n var parseResult = string.match(args.parsePattern);\n\n if (!parseResult) {\n return null;\n }\n\n var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];\n value = options.valueCallback ? options.valueCallback(value) : value;\n return {\n value: value,\n rest: string.slice(matchedString.length)\n };\n };\n}\n\nfunction buildMatchFn(args) {\n return function (dirtyString, dirtyOptions) {\n var string = String(dirtyString);\n var options = dirtyOptions || {};\n var width = options.width;\n var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];\n var matchResult = string.match(matchPattern);\n\n if (!matchResult) {\n return null;\n }\n\n var matchedString = matchResult[0];\n var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];\n var value;\n\n if (Object.prototype.toString.call(parsePatterns) === '[object Array]') {\n value = parsePatterns.findIndex(function (pattern) {\n return pattern.test(string);\n });\n } else {\n value = findKey(parsePatterns, function (pattern) {\n return pattern.test(string);\n });\n }\n\n value = args.valueCallback ? args.valueCallback(value) : value;\n value = options.valueCallback ? options.valueCallback(value) : value;\n return {\n value: value,\n rest: string.slice(matchedString.length)\n };\n };\n}\n\nfunction findKey(object, predicate) {\n for (var key in object) {\n if (object.hasOwnProperty(key) && predicate(object[key])) {\n return key;\n }\n }\n}\n\nvar matchOrdinalNumberPattern = /^(\\d+)(th|st|nd|rd)?/i;\nvar parseOrdinalNumberPattern = /\\d+/i;\nvar matchEraPatterns = {\n narrow: /^(b|a)/i,\n abbreviated: /^(b\\.?\\s?c\\.?|b\\.?\\s?c\\.?\\s?e\\.?|a\\.?\\s?d\\.?|c\\.?\\s?e\\.?)/i,\n wide: /^(before christ|before common era|anno domini|common era)/i\n};\nvar parseEraPatterns = {\n any: [/^b/i, /^(a|c)/i]\n};\nvar matchQuarterPatterns = {\n narrow: /^[1234]/i,\n abbreviated: /^q[1234]/i,\n wide: /^[1234](th|st|nd|rd)? quarter/i\n};\nvar parseQuarterPatterns = {\n any: [/1/i, /2/i, /3/i, /4/i]\n};\nvar matchMonthPatterns = {\n narrow: /^[jfmasond]/i,\n abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,\n wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i\n};\nvar parseMonthPatterns = {\n narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],\n any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]\n};\nvar matchDayPatterns = {\n narrow: /^[smtwf]/i,\n short: /^(su|mo|tu|we|th|fr|sa)/i,\n abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,\n wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i\n};\nvar parseDayPatterns = {\n narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],\n any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]\n};\nvar matchDayPeriodPatterns = {\n narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,\n any: /^([ap]\\.?\\s?m\\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i\n};\nvar parseDayPeriodPatterns = {\n any: {\n am: /^a/i,\n pm: /^p/i,\n midnight: /^mi/i,\n noon: /^no/i,\n morning: /morning/i,\n afternoon: /afternoon/i,\n evening: /evening/i,\n night: /night/i\n }\n};\nvar match = {\n ordinalNumber: buildMatchPatternFn({\n matchPattern: matchOrdinalNumberPattern,\n parsePattern: parseOrdinalNumberPattern,\n valueCallback: function valueCallback(value) {\n return parseInt(value, 10);\n }\n }),\n era: buildMatchFn({\n matchPatterns: matchEraPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseEraPatterns,\n defaultParseWidth: 'any'\n }),\n quarter: buildMatchFn({\n matchPatterns: matchQuarterPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseQuarterPatterns,\n defaultParseWidth: 'any',\n valueCallback: function valueCallback(index) {\n return index + 1;\n }\n }),\n month: buildMatchFn({\n matchPatterns: matchMonthPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseMonthPatterns,\n defaultParseWidth: 'any'\n }),\n day: buildMatchFn({\n matchPatterns: matchDayPatterns,\n defaultMatchWidth: 'wide',\n parsePatterns: parseDayPatterns,\n defaultParseWidth: 'any'\n }),\n dayPeriod: buildMatchFn({\n matchPatterns: matchDayPeriodPatterns,\n defaultMatchWidth: 'any',\n parsePatterns: parseDayPeriodPatterns,\n defaultParseWidth: 'any'\n })\n};\n/**\n * @type {Locale}\n * @category Locales\n * @summary English locale (United States).\n * @language English\n * @iso-639-2 eng\n * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}\n * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}\n */\n\nvar locale$1 = {\n formatDistance: formatDistance,\n formatLong: formatLong,\n formatRelative: formatRelative,\n localize: localize,\n match: match,\n options: {\n weekStartsOn: 0\n /* Sunday */\n ,\n firstWeekContainsDate: 1\n }\n};\nvar MILLISECONDS_IN_DAY = 86400000; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nfunction getUTCDayOfYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var timestamp = date.getTime();\n date.setUTCMonth(0, 1);\n date.setUTCHours(0, 0, 0, 0);\n var startOfYearTimestamp = date.getTime();\n var difference = timestamp - startOfYearTimestamp;\n return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction startOfUTCISOWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction getUTCISOWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var year = date.getUTCFullYear();\n var fourthOfJanuaryOfNextYear = new Date(0);\n fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);\n fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear, dirtyOptions);\n var fourthOfJanuaryOfThisYear = new Date(0);\n fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);\n fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear, dirtyOptions);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction startOfUTCISOWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var year = getUTCISOWeekYear(dirtyDate, dirtyOptions);\n var fourthOfJanuary = new Date(0);\n fourthOfJanuary.setUTCFullYear(year, 0, 4);\n fourthOfJanuary.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCISOWeek(fourthOfJanuary, dirtyOptions);\n return date;\n}\n\nvar MILLISECONDS_IN_WEEK = 604800000; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nfunction getUTCISOWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var diff = startOfUTCISOWeek(date, dirtyOptions).getTime() - startOfUTCISOWeekYear(date, dirtyOptions).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction startOfUTCWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate, options);\n var day = date.getUTCDay();\n var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;\n date.setUTCDate(date.getUTCDate() - diff);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction getUTCWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var year = date.getUTCFullYear();\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var firstWeekOfNextYear = new Date(0);\n firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);\n firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);\n var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, dirtyOptions);\n var firstWeekOfThisYear = new Date(0);\n firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);\n var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, dirtyOptions);\n\n if (date.getTime() >= startOfNextYear.getTime()) {\n return year + 1;\n } else if (date.getTime() >= startOfThisYear.getTime()) {\n return year;\n } else {\n return year - 1;\n }\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction startOfUTCWeekYear(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeFirstWeekContainsDate = locale && locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate);\n var year = getUTCWeekYear(dirtyDate, dirtyOptions);\n var firstWeek = new Date(0);\n firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);\n firstWeek.setUTCHours(0, 0, 0, 0);\n var date = startOfUTCWeek(firstWeek, dirtyOptions);\n return date;\n}\n\nvar MILLISECONDS_IN_WEEK$1 = 604800000; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nfunction getUTCWeek(dirtyDate, dirtyOptions) {\n if (arguments.length < 1) {\n throw new TypeError('1 argument required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var diff = startOfUTCWeek(date, dirtyOptions).getTime() - startOfUTCWeekYear(date, dirtyOptions).getTime(); // Round the number of days to the nearest integer\n // because the number of milliseconds in a week is not constant\n // (e.g. it's different in the week of the daylight saving time clock shift)\n\n return Math.round(diff / MILLISECONDS_IN_WEEK$1) + 1;\n}\n\nvar dayPeriodEnum = {\n am: 'am',\n pm: 'pm',\n midnight: 'midnight',\n noon: 'noon',\n morning: 'morning',\n afternoon: 'afternoon',\n evening: 'evening',\n night: 'night'\n};\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O | Timezone (GMT) |\n * | p! | Long localized time | P! | Long localized date |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n * - `P` is long localized date format\n * - `p` is long localized time format\n */\n\nvar formatters = {\n // Era\n G: function G(date, token, localize) {\n var era = date.getUTCFullYear() > 0 ? 1 : 0;\n\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return localize.era(era, {\n width: 'abbreviated'\n });\n // A, B\n\n case 'GGGGG':\n return localize.era(era, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return localize.era(era, {\n width: 'wide'\n });\n }\n },\n // Year\n y: function y(date, token, localize, options) {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)\n\n var year = signedYear > 0 ? signedYear : 1 - signedYear; // Two digit year\n\n if (token === 'yy') {\n var twoDigitYear = year % 100;\n return addLeadingZeros(twoDigitYear, 2);\n } // Ordinal number\n\n\n if (token === 'yo') {\n return localize.ordinalNumber(year, {\n unit: 'year'\n });\n } // Padding\n\n\n return addLeadingZeros(year, token.length);\n },\n // Local week-numbering year\n Y: function Y(date, token, localize, options) {\n var signedWeekYear = getUTCWeekYear(date, options);\n var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year\n\n if (token === 'YY') {\n var twoDigitYear = weekYear % 100;\n return addLeadingZeros(twoDigitYear, 2);\n } // Ordinal number\n\n\n if (token === 'Yo') {\n return localize.ordinalNumber(weekYear, {\n unit: 'year'\n });\n } // Padding\n\n\n return addLeadingZeros(weekYear, token.length);\n },\n // ISO week-numbering year\n R: function R(date, token, localize, options) {\n var isoWeekYear = getUTCISOWeekYear(date, options); // Padding\n\n return addLeadingZeros(isoWeekYear, token.length);\n },\n // Extended year. This is a single number designating the year of this calendar system.\n // The main difference between `y` and `u` localizers are B.C. years:\n // | Year | `y` | `u` |\n // |------|-----|-----|\n // | AC 1 | 1 | 1 |\n // | BC 1 | 1 | 0 |\n // | BC 2 | 2 | -1 |\n // Also `yy` always returns the last two digits of a year,\n // while `uu` pads single digit years to 2 characters and returns other years unchanged.\n u: function u(date, token, localize, options) {\n var year = date.getUTCFullYear();\n return addLeadingZeros(year, token.length);\n },\n // Quarter\n Q: function Q(date, token, localize, options) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'QQ':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone quarter\n q: function q(date, token, localize, options) {\n var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);\n\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n return String(quarter);\n // 01, 02, 03, 04\n\n case 'qq':\n return addLeadingZeros(quarter, 2);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return localize.ordinalNumber(quarter, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return localize.quarter(quarter, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return localize.quarter(quarter, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return localize.quarter(quarter, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Month\n M: function M(date, token, localize, options) {\n var month = date.getUTCMonth();\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return String(month + 1);\n // 01, 02, ..., 12\n\n case 'MM':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return localize.month(month, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone month\n L: function L(date, token, localize, options) {\n var month = date.getUTCMonth();\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return String(month + 1);\n // 01, 02, ..., 12\n\n case 'LL':\n return addLeadingZeros(month + 1, 2);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return localize.ordinalNumber(month + 1, {\n unit: 'month'\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return localize.month(month, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return localize.month(month, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return localize.month(month, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // Local week of year\n w: function w(date, token, localize, options) {\n var week = getUTCWeek(date, options);\n\n if (token === 'wo') {\n return localize.ordinalNumber(week, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(week, token.length);\n },\n // ISO week of year\n I: function I(date, token, localize, options) {\n var isoWeek = getUTCISOWeek(date, options);\n\n if (token === 'Io') {\n return localize.ordinalNumber(isoWeek, {\n unit: 'week'\n });\n }\n\n return addLeadingZeros(isoWeek, token.length);\n },\n // Day of the month\n d: function d(date, token, localize, options) {\n var dayOfMonth = date.getUTCDate();\n\n if (token === 'do') {\n return localize.ordinalNumber(dayOfMonth, {\n unit: 'date'\n });\n }\n\n return addLeadingZeros(dayOfMonth, token.length);\n },\n // Day of year\n D: function D(date, token, localize, options) {\n var dayOfYear = getUTCDayOfYear(date, options);\n\n if (token === 'Do') {\n return localize.ordinalNumber(dayOfYear, {\n unit: 'dayOfYear'\n });\n }\n\n return addLeadingZeros(dayOfYear, token.length);\n },\n // Day of week\n E: function E(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Local day of week\n e: function e(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (Nth day of week with current locale or weekStartsOn)\n case 'e':\n return String(localDayOfWeek);\n // Padded numerical value\n\n case 'ee':\n return addLeadingZeros(localDayOfWeek, 2);\n // 1st, 2nd, ..., 7th\n\n case 'eo':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'eee':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Stand-alone local day of week\n c: function c(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;\n\n switch (token) {\n // Numerical value (same as in `e`)\n case 'c':\n return String(localDayOfWeek);\n // Padded numberical value\n\n case 'cc':\n return addLeadingZeros(localDayOfWeek, token.length);\n // 1st, 2nd, ..., 7th\n\n case 'co':\n return localize.ordinalNumber(localDayOfWeek, {\n unit: 'day'\n });\n\n case 'ccc':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'standalone'\n });\n }\n },\n // ISO day of week\n i: function i(date, token, localize, options) {\n var dayOfWeek = date.getUTCDay();\n var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;\n\n switch (token) {\n // 2\n case 'i':\n return String(isoDayOfWeek);\n // 02\n\n case 'ii':\n return addLeadingZeros(isoDayOfWeek, token.length);\n // 2nd\n\n case 'io':\n return localize.ordinalNumber(isoDayOfWeek, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return localize.day(dayOfWeek, {\n width: 'abbreviated',\n context: 'formatting'\n });\n // T\n\n case 'iiiii':\n return localize.day(dayOfWeek, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'iiiiii':\n return localize.day(dayOfWeek, {\n width: 'short',\n context: 'formatting'\n });\n // Tuesday\n\n case 'iiii':\n default:\n return localize.day(dayOfWeek, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM or PM\n a: function a(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // AM, PM, midnight, noon\n b: function b(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours === 12) {\n dayPeriodEnumValue = dayPeriodEnum.noon;\n } else if (hours === 0) {\n dayPeriodEnumValue = dayPeriodEnum.midnight;\n } else {\n dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';\n }\n\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: function B(date, token, localize) {\n var hours = date.getUTCHours();\n var dayPeriodEnumValue;\n\n if (hours >= 17) {\n dayPeriodEnumValue = dayPeriodEnum.evening;\n } else if (hours >= 12) {\n dayPeriodEnumValue = dayPeriodEnum.afternoon;\n } else if (hours >= 4) {\n dayPeriodEnumValue = dayPeriodEnum.morning;\n } else {\n dayPeriodEnumValue = dayPeriodEnum.night;\n }\n\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'abbreviated',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return localize.dayPeriod(dayPeriodEnumValue, {\n width: 'wide',\n context: 'formatting'\n });\n }\n },\n // Hour [1-12]\n h: function h(date, token, localize, options) {\n var hours = date.getUTCHours() % 12;\n\n if (hours === 0) {\n hours = 12;\n }\n\n if (token === 'ho') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [0-23]\n H: function H(date, token, localize, options) {\n var hours = date.getUTCHours();\n\n if (token === 'Ho') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [0-11]\n K: function K(date, token, localize, options) {\n var hours = date.getUTCHours() % 12;\n\n if (token === 'Ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Hour [1-24]\n k: function k(date, token, localize, options) {\n var hours = date.getUTCHours();\n\n if (hours === 0) {\n hours = 24;\n }\n\n if (token === 'ko') {\n return localize.ordinalNumber(hours, {\n unit: 'hour'\n });\n }\n\n return addLeadingZeros(hours, token.length);\n },\n // Minute\n m: function m(date, token, localize, options) {\n var minutes = date.getUTCMinutes();\n\n if (token === 'mo') {\n return localize.ordinalNumber(minutes, {\n unit: 'minute'\n });\n }\n\n return addLeadingZeros(minutes, token.length);\n },\n // Second\n s: function s(date, token, localize, options) {\n var seconds = date.getUTCSeconds();\n\n if (token === 'so') {\n return localize.ordinalNumber(seconds, {\n unit: 'second'\n });\n }\n\n return addLeadingZeros(seconds, token.length);\n },\n // Fraction of second\n S: function S(date, token, localize, options) {\n var numberOfDigits = token.length;\n var milliseconds = date.getUTCMilliseconds();\n var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));\n return addLeadingZeros(fractionalSeconds, numberOfDigits);\n },\n // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)\n X: function X(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n if (timezoneOffset === 0) {\n return 'Z';\n }\n\n switch (token) {\n // Hours and optional minutes\n case 'X':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XX`\n\n case 'XXXX':\n case 'XX':\n // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `XXX`\n\n case 'XXXXX':\n case 'XXX': // Hours and minutes with `:` delimeter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)\n x: function x(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Hours and optional minutes\n case 'x':\n return formatTimezoneWithOptionalMinutes(timezoneOffset);\n // Hours, minutes and optional seconds without `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xx`\n\n case 'xxxx':\n case 'xx':\n // Hours and minutes without `:` delimeter\n return formatTimezone(timezoneOffset);\n // Hours, minutes and optional seconds with `:` delimeter\n // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets\n // so this token always has the same output as `xxx`\n\n case 'xxxxx':\n case 'xxx': // Hours and minutes with `:` delimeter\n\n default:\n return formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (GMT)\n O: function O(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'O':\n case 'OO':\n case 'OOO':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'OOOO':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Timezone (specific non-location)\n z: function z(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timezoneOffset = originalDate.getTimezoneOffset();\n\n switch (token) {\n // Short\n case 'z':\n case 'zz':\n case 'zzz':\n return 'GMT' + formatTimezoneShort(timezoneOffset, ':');\n // Long\n\n case 'zzzz':\n default:\n return 'GMT' + formatTimezone(timezoneOffset, ':');\n }\n },\n // Seconds timestamp\n t: function t(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = Math.floor(originalDate.getTime() / 1000);\n return addLeadingZeros(timestamp, token.length);\n },\n // Milliseconds timestamp\n T: function T(date, token, localize, options) {\n var originalDate = options._originalDate || date;\n var timestamp = originalDate.getTime();\n return addLeadingZeros(timestamp, token.length);\n }\n};\n\nfunction addLeadingZeros(number, targetLength) {\n var sign = number < 0 ? '-' : '';\n var output = Math.abs(number).toString();\n\n while (output.length < targetLength) {\n output = '0' + output;\n }\n\n return sign + output;\n}\n\nfunction formatTimezone(offset, dirtyDelimeter) {\n var delimeter = dirtyDelimeter || '';\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);\n var minutes = addLeadingZeros(absOffset % 60, 2);\n return sign + hours + delimeter + minutes;\n}\n\nfunction formatTimezoneWithOptionalMinutes(offset, dirtyDelimeter) {\n if (offset % 60 === 0) {\n var sign = offset > 0 ? '-' : '+';\n return sign + addLeadingZeros(Math.abs(offset) / 60, 2);\n }\n\n return formatTimezone(offset, dirtyDelimeter);\n}\n\nfunction formatTimezoneShort(offset, dirtyDelimeter) {\n var sign = offset > 0 ? '-' : '+';\n var absOffset = Math.abs(offset);\n var hours = Math.floor(absOffset / 60);\n var minutes = absOffset % 60;\n\n if (minutes === 0) {\n return sign + String(hours);\n }\n\n var delimeter = dirtyDelimeter || '';\n return sign + String(hours) + delimeter + addLeadingZeros(minutes, 2);\n}\n\nfunction dateLongFormatter(pattern, formatLong, options) {\n switch (pattern) {\n case 'P':\n return formatLong.date({\n width: 'short'\n });\n\n case 'PP':\n return formatLong.date({\n width: 'medium'\n });\n\n case 'PPP':\n return formatLong.date({\n width: 'long'\n });\n\n case 'PPPP':\n default:\n return formatLong.date({\n width: 'full'\n });\n }\n}\n\nfunction timeLongFormatter(pattern, formatLong, options) {\n switch (pattern) {\n case 'p':\n return formatLong.time({\n width: 'short'\n });\n\n case 'pp':\n return formatLong.time({\n width: 'medium'\n });\n\n case 'ppp':\n return formatLong.time({\n width: 'long'\n });\n\n case 'pppp':\n default:\n return formatLong.time({\n width: 'full'\n });\n }\n}\n\nfunction dateTimeLongFormatter(pattern, formatLong, options) {\n var matchResult = pattern.match(/(P+)(p+)?/);\n var datePattern = matchResult[1];\n var timePattern = matchResult[2];\n\n if (!timePattern) {\n return dateLongFormatter(pattern, formatLong);\n }\n\n var dateTimeFormat;\n\n switch (datePattern) {\n case 'P':\n dateTimeFormat = formatLong.dateTime({\n width: 'short'\n });\n break;\n\n case 'PP':\n dateTimeFormat = formatLong.dateTime({\n width: 'medium'\n });\n break;\n\n case 'PPP':\n dateTimeFormat = formatLong.dateTime({\n width: 'long'\n });\n break;\n\n case 'PPPP':\n default:\n dateTimeFormat = formatLong.dateTime({\n width: 'full'\n });\n break;\n }\n\n return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));\n}\n\nvar longFormatters = {\n p: timeLongFormatter,\n P: dateTimeLongFormatter\n};\n/**\n * @name subMilliseconds\n * @category Millisecond Helpers\n * @summary Subtract the specified number of milliseconds from the given date.\n *\n * @description\n * Subtract the specified number of milliseconds from the given date.\n *\n * @param {Date|String|Number} date - the date to be changed\n * @param {Number} amount - the amount of milliseconds to be subtracted\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Date} the new date with the milliseconds subtracted\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:\n * var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)\n * //=> Thu Jul 10 2014 12:45:29.250\n */\n\nfunction subMilliseconds(dirtyDate, dirtyAmount, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, -amount, dirtyOptions);\n}\n\nvar protectedTokens = ['D', 'DD', 'YY', 'YYYY'];\n\nfunction isProtectedToken(token) {\n return protectedTokens.indexOf(token) !== -1;\n}\n\nfunction throwProtectedError(token) {\n throw new RangeError('`options.awareOfUnicodeTokens` must be set to `true` to use `' + token + '` token; see: https://git.io/fxCyr');\n} // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'(.*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\n/**\n * @name format\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 8 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 8 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Su | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Su | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | a..aaa | AM, PM | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bbb | AM, PM, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 0001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 05/29/1453 | 7 |\n * | | PP | May 29, 1453 | 7 |\n * | | PPP | May 29th, 1453 | 7 |\n * | | PPPP | Sunday, May 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 05/29/1453, 12:00 AM | 7 |\n * | | PPpp | May 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | May 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Sunday, May 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}\n * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * @param {Date|String|Number} date - the original date\n * @param {String} format - the string of tokens\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {String} the formatted date string\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.locale` must contain `localize` property\n * @throws {RangeError} `options.locale` must contain `formatLong` property\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * var result = format(\n * new Date(2014, 1, 11),\n * 'MM/dd/yyyy'\n * )\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * var result = format(\n * new Date(2014, 6, 2),\n * \"do 'de' MMMM yyyy\",\n * {locale: eoLocale}\n * )\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * var result = format(\n * new Date(2014, 6, 2, 15),\n * \"h 'o''clock'\"\n * )\n * //=> \"3 o'clock\"\n */\n\nfunction format(dirtyDate, dirtyFormatStr, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var formatStr = String(dirtyFormatStr);\n var options = dirtyOptions || {};\n var locale = options.locale || locale$1;\n var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (!locale.localize) {\n throw new RangeError('locale must contain localize property');\n }\n\n if (!locale.formatLong) {\n throw new RangeError('locale must contain formatLong property');\n }\n\n var originalDate = toDate(dirtyDate, options);\n\n if (!isValid(originalDate, options)) {\n return 'Invalid Date';\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376\n\n\n var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);\n var utcDate = subMilliseconds(originalDate, timezoneOffset, options);\n var formatterOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale,\n _originalDate: originalDate\n };\n var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong, formatterOptions);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp).map(function (substring) {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return \"'\";\n }\n\n var firstCharacter = substring[0];\n\n if (firstCharacter === \"'\") {\n return cleanEscapedString(substring);\n }\n\n var formatter = formatters[firstCharacter];\n\n if (formatter) {\n if (!options.awareOfUnicodeTokens && isProtectedToken(substring)) {\n throwProtectedError(substring);\n }\n\n return formatter(utcDate, substring, locale.localize, formatterOptions);\n }\n\n return substring;\n }).join('');\n return result;\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}\n/**\n * @name isAfter\n * @category Common Helpers\n * @summary Is the first date after the second one?\n *\n * @description\n * Is the first date after the second one?\n *\n * @param {Date|String|Number} date - the date that should be after the other one to return true\n * @param {Date|String|Number} dateToCompare - the date to compare with\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the first date is after the second date\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Is 10 July 1989 after 11 February 1987?\n * var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> true\n */\n\n\nfunction isAfter(dirtyDate, dirtyDateToCompare, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);\n return date.getTime() > dateToCompare.getTime();\n}\n/**\n * @name isBefore\n * @category Common Helpers\n * @summary Is the first date before the second one?\n *\n * @description\n * Is the first date before the second one?\n *\n * @param {Date|String|Number} date - the date that should be before the other one to return true\n * @param {Date|String|Number} dateToCompare - the date to compare with\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the first date is before the second date\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Is 10 July 1989 before 11 February 1987?\n * var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))\n * //=> false\n */\n\n\nfunction isBefore(dirtyDate, dirtyDateToCompare, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var dateToCompare = toDate(dirtyDateToCompare, dirtyOptions);\n return date.getTime() < dateToCompare.getTime();\n}\n/**\n * @name isEqual\n * @category Common Helpers\n * @summary Are the given dates equal?\n *\n * @description\n * Are the given dates equal?\n *\n * @param {Date|String|Number} dateLeft - the first date to compare\n * @param {Date|String|Number} dateRight - the second date to compare\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @returns {Boolean} the dates are equal\n * @throws {TypeError} 2 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n *\n * @example\n * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?\n * var result = isEqual(\n * new Date(2014, 6, 2, 6, 30, 45, 0)\n * new Date(2014, 6, 2, 6, 30, 45, 500)\n * )\n * //=> false\n */\n\n\nfunction isEqual$1(dirtyLeftDate, dirtyRightDate, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var dateLeft = toDate(dirtyLeftDate, dirtyOptions);\n var dateRight = toDate(dirtyRightDate, dirtyOptions);\n return dateLeft.getTime() === dateRight.getTime();\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction setUTCWeek(dirtyDate, dirtyWeek, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, dirtyOptions) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction setUTCISODay(dirtyDate, dirtyDay, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate, dirtyOptions);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n} // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\n\nfunction setUTCISOWeek(dirtyDate, dirtyISOWeek, dirtyOptions) {\n if (arguments.length < 2) {\n throw new TypeError('2 arguments required, but only ' + arguments.length + ' present');\n }\n\n var date = toDate(dirtyDate, dirtyOptions);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date, dirtyOptions) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}\n\nvar MILLISECONDS_IN_HOUR$1 = 3600000;\nvar MILLISECONDS_IN_MINUTE$2 = 60000;\nvar MILLISECONDS_IN_SECOND = 1000;\nvar numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n\n};\nvar timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};\n\nfunction parseNumericPattern(pattern, string, valueCallback) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null;\n }\n\n var value = parseInt(matchResult[0], 10);\n return {\n value: valueCallback ? valueCallback(value) : value,\n rest: string.slice(matchResult[0].length)\n };\n}\n\nfunction parseTimezonePattern(pattern, string) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null;\n } // Input is 'Z'\n\n\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: string.slice(1)\n };\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * MILLISECONDS_IN_HOUR$1 + minutes * MILLISECONDS_IN_MINUTE$2 + seconds * MILLISECONDS_IN_SECOND),\n rest: string.slice(matchResult[0].length)\n };\n}\n\nfunction parseAnyDigitsSigned(string, valueCallback) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback);\n}\n\nfunction parseNDigits(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback);\n\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), string, valueCallback);\n }\n}\n\nfunction parseNDigitsSigned(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback);\n\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), string, valueCallback);\n }\n}\n\nfunction dayPeriodEnumToHours(enumValue) {\n switch (enumValue) {\n case 'morning':\n return 4;\n\n case 'evening':\n return 17;\n\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\n\nfunction normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0; // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result;\n}\n\nvar DAYS_IN_MONTH$1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR$1 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // User for validation\n\nfunction isLeapYearIndex$1(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\n\n\nvar parsers = {\n // Era\n G: {\n priority: 140,\n parse: function parse(string, token, match, options) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(string, {\n width: 'abbreviated'\n }) || match.era(string, {\n width: 'narrow'\n });\n // A, B\n\n case 'GGGGG':\n return match.era(string, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return match.era(string, {\n width: 'wide'\n }) || match.era(string, {\n width: 'abbreviated'\n }) || match.era(string, {\n width: 'narrow'\n });\n }\n },\n set: function set(date, value, options) {\n // Sets year 10 BC if BC, or 10 AC if AC\n date.setUTCFullYear(value === 1 ? 10 : -9, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Year\n y: {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n priority: 130,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n\n switch (token) {\n case 'y':\n return parseNDigits(4, string, valueCallback);\n\n case 'yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n });\n\n default:\n return parseNDigits(token.length, string, valueCallback);\n }\n },\n validate: function validate(date, value, options) {\n return value.isTwoDigitYear || value.year > 0;\n },\n set: function set(date, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Local week-numbering year\n Y: {\n priority: 130,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n\n switch (token) {\n case 'Y':\n return parseNDigits(4, string, valueCallback);\n\n case 'Yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n });\n\n default:\n return parseNDigits(token.length, string, valueCallback);\n }\n },\n validate: function validate(date, value, options) {\n return value.isTwoDigitYear || value.year > 0;\n },\n set: function set(date, value, options) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n\n var year = currentYear > 0 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n },\n // ISO week-numbering year\n R: {\n priority: 130,\n parse: function parse(string, token, match, options) {\n if (token === 'R') {\n return parseNDigitsSigned(4, string);\n }\n\n return parseNDigitsSigned(token.length, string);\n },\n set: function set(date, value, options) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n }\n },\n // Extended year\n u: {\n priority: 130,\n parse: function parse(string, token, match, options) {\n if (token === 'u') {\n return parseNDigitsSigned(4, string);\n }\n\n return parseNDigitsSigned(token.length, string);\n },\n set: function set(date, value, options) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Quarter\n Q: {\n priority: 120,\n parse: function parse(string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, string);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return match.ordinalNumber(string, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return match.quarter(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 4;\n },\n set: function set(date, value, options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Stand-alone quarter\n q: {\n priority: 120,\n parse: function parse(string, token, match, options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, string);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return match.ordinalNumber(string, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return match.quarter(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 4;\n },\n set: function set(date, value, options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Month\n M: {\n priority: 110,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return parseNumericPattern(numericPatterns.month, string, valueCallback);\n // 01, 02, ..., 12\n\n case 'MM':\n return parseNDigits(2, string, valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return match.month(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 11;\n },\n set: function set(date, value, options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Stand-alone month\n L: {\n priority: 110,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return parseNumericPattern(numericPatterns.month, string, valueCallback);\n // 01, 02, ..., 12\n\n case 'LL':\n return parseNDigits(2, string, valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return match.month(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 11;\n },\n set: function set(date, value, options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Local week of year\n w: {\n priority: 100,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, string);\n\n case 'wo':\n return match.ordinalNumber(string, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 53;\n },\n set: function set(date, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n }\n },\n // ISO week of year\n I: {\n priority: 100,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, string);\n\n case 'Io':\n return match.ordinalNumber(string, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 53;\n },\n set: function set(date, value, options) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options);\n }\n },\n // Day of the month\n d: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, string);\n\n case 'do':\n return match.ordinalNumber(string, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex$1(year);\n var month = date.getUTCMonth();\n\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR$1[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH$1[month];\n }\n },\n set: function set(date, value, options) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Day of year\n D: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, string);\n\n case 'Do':\n return match.ordinalNumber(string, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex$1(year);\n\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n },\n set: function set(date, value, options) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Day of week\n E: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 6;\n },\n set: function set(date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Local day of week\n e: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return parseNDigits(token.length, string, valueCallback);\n // 3rd\n\n case 'eo':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n });\n // Tue\n\n case 'eee':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 6;\n },\n set: function set(date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // Stand-alone local day of week\n c: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return parseNDigits(token.length, string, valueCallback);\n // 3rd\n\n case 'co':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n });\n // Tue\n\n case 'ccc':\n return match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 6;\n },\n set: function set(date, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // ISO day of week\n i: {\n priority: 90,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n if (value === 0) {\n return 7;\n }\n\n return value;\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, string);\n // 2nd\n\n case 'io':\n return match.ordinalNumber(string, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // T\n\n case 'iiiii':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // Tu\n\n case 'iiiiii':\n return match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // Tuesday\n\n case 'iiii':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 7;\n },\n set: function set(date, value, options) {\n date = setUTCISODay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n },\n // AM or PM\n a: {\n priority: 80,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function set(date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n },\n // AM, PM, midnight\n b: {\n priority: 80,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function set(date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n },\n // in the morning, in the afternoon, in the evening, at night\n B: {\n priority: 80,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function set(date, value, options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n }\n },\n // Hour [1-12]\n h: {\n priority: 70,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, string);\n\n case 'ho':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 12;\n },\n set: function set(date, value, options) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n },\n // Hour [0-23]\n H: {\n priority: 70,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, string);\n\n case 'Ho':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 23;\n },\n set: function set(date, value, options) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n }\n },\n // Hour [0-11]\n K: {\n priority: 70,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, string);\n\n case 'Ko':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 11;\n },\n set: function set(date, value, options) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n }\n },\n // Hour [1-24]\n k: {\n priority: 70,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, string);\n\n case 'ko':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 1 && value <= 24;\n },\n set: function set(date, value, options) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n }\n },\n // Minute\n m: {\n priority: 60,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, string);\n\n case 'mo':\n return match.ordinalNumber(string, {\n unit: 'minute'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 59;\n },\n set: function set(date, value, options) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n }\n },\n // Second\n s: {\n priority: 50,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, string);\n\n case 'so':\n return match.ordinalNumber(string, {\n unit: 'second'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function validate(date, value, options) {\n return value >= 0 && value <= 59;\n },\n set: function set(date, value, options) {\n date.setUTCSeconds(value, 0);\n return date;\n }\n },\n // Fraction of second\n S: {\n priority: 40,\n parse: function parse(string, token, match, options) {\n var valueCallback = function valueCallback(value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n\n return parseNDigits(token.length, string, valueCallback);\n },\n set: function set(date, value, options) {\n date.setUTCMilliseconds(value);\n return date;\n }\n },\n // Timezone (ISO-8601. +00:00 is `'Z'`)\n X: {\n priority: 20,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);\n\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, string);\n\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);\n\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);\n\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string);\n }\n },\n set: function set(date, value, options) {\n return new Date(date.getTime() - value);\n }\n },\n // Timezone (ISO-8601)\n x: {\n priority: 20,\n parse: function parse(string, token, match, options) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);\n\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, string);\n\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);\n\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);\n\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string);\n }\n },\n set: function set(date, value, options) {\n return new Date(date.getTime() - value);\n }\n },\n // Seconds timestamp\n t: {\n priority: 10,\n parse: function parse(string, token, match, options) {\n return parseAnyDigitsSigned(string);\n },\n set: function set(date, value, options) {\n return new Date(value * 1000);\n }\n },\n // Milliseconds timestamp\n T: {\n priority: 10,\n parse: function parse(string, token, match, options) {\n return parseAnyDigitsSigned(string);\n },\n set: function set(date, value, options) {\n return new Date(value);\n }\n }\n};\nvar TIMEZONE_UNIT_PRIORITY = 20; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp$1 = /^'(.*?)'?$/;\nvar doubleQuoteRegExp$1 = /''/g;\nvar notWhitespaceRegExp = /\\S/;\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 6 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 6 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Su | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Su | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Su | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Su | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 1, 2, ..., 11, 0 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | 40 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 0001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 20 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 20 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Seconds timestamp | 10 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Milliseconds timestamp | 10 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `baseDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n *\n * 6. These tokens are often confused with others. See: https://git.io/fxCyr\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `baseDate` which works as a context of parsing.\n *\n * `baseDate` must be passed for correct work of the function.\n * If you're not sure which `baseDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `baseDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `baseDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|String|Number} baseDate - defines values missing from the parsed dateString\n * @param {Options} [options] - the object with options. See [Options]{@link https://date-fns.org/docs/Options}\n * @param {0|1|2} [options.additionalDigits=2] - passed to `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.awareOfUnicodeTokens=false] - if true, allows usage of Unicode tokens causes confusion:\n * - Some of the day of year tokens (`D`, `DD`) that are confused with the day of month tokens (`d`, `dd`).\n * - Some of the local week-numbering year tokens (`YY`, `YYYY`) that are confused with the calendar year tokens (`yy`, `yyyy`).\n * See: https://git.io/fxCyr\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} `options.awareOfUnicodeTokens` must be set to `true` to use `XX` token; see: https://git.io/fxCyr\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse(\n * '02/11/2014',\n * 'MM/dd/yyyy',\n * new Date()\n * )\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse(\n * '28-a de februaro',\n * \"do 'de' MMMM\",\n * new Date(2010, 0, 1),\n * {locale: eo}\n * )\n * //=> Sun Feb 28 2010 00:00:00\n */\n\nfunction parse(dirtyDateString, dirtyFormatString, dirtyBaseDate, dirtyOptions) {\n if (arguments.length < 3) {\n throw new TypeError('3 arguments required, but only ' + arguments.length + ' present');\n }\n\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var options = dirtyOptions || {};\n var locale = options.locale || locale$1;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n\n var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyBaseDate, options);\n } else {\n return new Date(NaN);\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }; // If timezone isn't specified, it will be set to the system timezone\n\n var setters = [{\n priority: TIMEZONE_UNIT_PRIORITY,\n set: dateToSystemTimezone,\n index: 0\n }];\n var i;\n var tokens = formatString.match(formattingTokensRegExp$1);\n\n for (i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (!options.awareOfUnicodeTokens && isProtectedToken(token)) {\n throwProtectedError(token);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n\n if (parser) {\n var parseResult = parser.parse(dateString, token, locale.match, subFnOptions);\n\n if (!parseResult) {\n return new Date(NaN);\n }\n\n setters.push({\n priority: parser.priority,\n set: parser.set,\n validate: parser.validate,\n value: parseResult.value,\n index: setters.length\n });\n dateString = parseResult.rest;\n } else {\n // Replace two single quote characters with one single quote character\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString$1(token);\n } // Cut token from string, or, if string doesn't match the token, return Invalid Date\n\n\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return new Date(NaN);\n }\n }\n } // Check if the remaining input contains something other than whitespace\n\n\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).reverse();\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyBaseDate, options);\n\n if (isNaN(date)) {\n return new Date(NaN);\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37\n\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n\n for (i = 0; i < uniquePrioritySetters.length; i++) {\n var setter = uniquePrioritySetters[i];\n\n if (setter.validate && !setter.validate(utcDate, setter.value, subFnOptions)) {\n return new Date(NaN);\n }\n\n utcDate = setter.set(utcDate, setter.value, subFnOptions);\n }\n\n return utcDate;\n}\n\nfunction dateToSystemTimezone(date) {\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n}\n\nfunction cleanEscapedString$1(input) {\n return input.match(escapedStringRegExp$1)[1].replace(doubleQuoteRegExp$1, \"'\");\n} // \n\n/**\n * Custom parse behavior on top of date-fns parse function.\n */\n\n\nfunction parseDate$1(date, format$1) {\n if (typeof date !== 'string') {\n return isValid(date) ? date : null;\n }\n\n var parsed = parse(date, format$1, new Date()); // if date is not valid or the formatted output after parsing does not match\n // the string value passed in (avoids overflows)\n\n if (!isValid(parsed) || format(parsed, format$1) !== date) {\n return null;\n }\n\n return parsed;\n}\n\nvar afterValidator = function afterValidator(value, ref) {\n if (ref === void 0) ref = {};\n var targetValue = ref.targetValue;\n var inclusion = ref.inclusion;\n if (inclusion === void 0) inclusion = false;\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusion;\n inclusion = false;\n }\n\n value = parseDate$1(value, format);\n targetValue = parseDate$1(targetValue, format); // if either is not valid.\n\n if (!value || !targetValue) {\n return false;\n }\n\n return isAfter(value, targetValue) || inclusion && isEqual$1(value, targetValue);\n};\n\nvar options = {\n hasTarget: true,\n isDate: true\n}; // required to convert from a list of array values to an object.\n\nvar paramNames = ['targetValue', 'inclusion', 'format'];\nvar after = {\n validate: afterValidator,\n options: options,\n paramNames: paramNames\n};\n/**\n * Some Alpha Regex helpers.\n * https://github.com/chriso/validator.js/blob/master/src/lib/alpha.js\n */\n\nvar alpha = {\n en: /^[A-Z]*$/i,\n cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,\n da: /^[A-ZÆØÅ]*$/i,\n de: /^[A-ZÄÖÜß]*$/i,\n es: /^[A-ZÁÉÍÑÓÚÜ]*$/i,\n fa: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی]*$/,\n fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,\n it: /^[A-Z\\xC0-\\xFF]*$/i,\n lt: /^[A-ZĄČĘĖĮŠŲŪŽ]*$/i,\n nl: /^[A-ZÉËÏÓÖÜ]*$/i,\n hu: /^[A-ZÁÉÍÓÖŐÚÜŰ]*$/i,\n pl: /^[A-ZĄĆĘŚŁŃÓŻŹ]*$/i,\n pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,\n ru: /^[А-ЯЁ]*$/i,\n sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,\n sr: /^[A-ZČĆŽŠĐ]*$/i,\n sv: /^[A-ZÅÄÖ]*$/i,\n tr: /^[A-ZÇĞİıÖŞÜ]*$/i,\n uk: /^[А-ЩЬЮЯЄІЇҐ]*$/i,\n ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,\n az: /^[A-ZÇƏĞİıÖŞÜ]*$/i\n};\nvar alphaSpaces = {\n en: /^[A-Z\\s]*$/i,\n cs: /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ\\s]*$/i,\n da: /^[A-ZÆØÅ\\s]*$/i,\n de: /^[A-ZÄÖÜß\\s]*$/i,\n es: /^[A-ZÁÉÍÑÓÚÜ\\s]*$/i,\n fa: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی\\s]*$/,\n fr: /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ\\s]*$/i,\n it: /^[A-Z\\xC0-\\xFF\\s]*$/i,\n lt: /^[A-ZĄČĘĖĮŠŲŪŽ\\s]*$/i,\n nl: /^[A-ZÉËÏÓÖÜ\\s]*$/i,\n hu: /^[A-ZÁÉÍÓÖŐÚÜŰ\\s]*$/i,\n pl: /^[A-ZĄĆĘŚŁŃÓŻŹ\\s]*$/i,\n pt: /^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ\\s]*$/i,\n ru: /^[А-ЯЁ\\s]*$/i,\n sk: /^[A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ\\s]*$/i,\n sr: /^[A-ZČĆŽŠĐ\\s]*$/i,\n sv: /^[A-ZÅÄÖ\\s]*$/i,\n tr: /^[A-ZÇĞİıÖŞÜ\\s]*$/i,\n uk: /^[А-ЩЬЮЯЄІЇҐ\\s]*$/i,\n ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ\\s]*$/,\n az: /^[A-ZÇƏĞİıÖŞÜ\\s]*$/i\n};\nvar alphanumeric = {\n en: /^[0-9A-Z]*$/i,\n cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]*$/i,\n da: /^[0-9A-ZÆØÅ]$/i,\n de: /^[0-9A-ZÄÖÜß]*$/i,\n es: /^[0-9A-ZÁÉÍÑÓÚÜ]*$/i,\n fa: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی]*$/,\n fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]*$/i,\n it: /^[0-9A-Z\\xC0-\\xFF]*$/i,\n lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ]*$/i,\n hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]*$/i,\n nl: /^[0-9A-ZÉËÏÓÖÜ]*$/i,\n pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]*$/i,\n pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]*$/i,\n ru: /^[0-9А-ЯЁ]*$/i,\n sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ]*$/i,\n sr: /^[0-9A-ZČĆŽŠĐ]*$/i,\n sv: /^[0-9A-ZÅÄÖ]*$/i,\n tr: /^[0-9A-ZÇĞİıÖŞÜ]*$/i,\n uk: /^[0-9А-ЩЬЮЯЄІЇҐ]*$/i,\n ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]*$/,\n az: /^[0-9A-ZÇƏĞİıÖŞÜ]*$/i\n};\nvar alphaDash = {\n en: /^[0-9A-Z_-]*$/i,\n cs: /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ_-]*$/i,\n da: /^[0-9A-ZÆØÅ_-]*$/i,\n de: /^[0-9A-ZÄÖÜß_-]*$/i,\n es: /^[0-9A-ZÁÉÍÑÓÚÜ_-]*$/i,\n fa: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰپژگچکی_-]*$/,\n fr: /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ_-]*$/i,\n it: /^[0-9A-Z\\xC0-\\xFF_-]*$/i,\n lt: /^[0-9A-ZĄČĘĖĮŠŲŪŽ_-]*$/i,\n nl: /^[0-9A-ZÉËÏÓÖÜ_-]*$/i,\n hu: /^[0-9A-ZÁÉÍÓÖŐÚÜŰ_-]*$/i,\n pl: /^[0-9A-ZĄĆĘŚŁŃÓŻŹ_-]*$/i,\n pt: /^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ_-]*$/i,\n ru: /^[0-9А-ЯЁ_-]*$/i,\n sk: /^[0-9A-ZÁÄČĎÉÍĹĽŇÓŔŠŤÚÝŽ_-]*$/i,\n sr: /^[0-9A-ZČĆŽŠĐ_-]*$/i,\n sv: /^[0-9A-ZÅÄÖ_-]*$/i,\n tr: /^[0-9A-ZÇĞİıÖŞÜ_-]*$/i,\n uk: /^[0-9А-ЩЬЮЯЄІЇҐ_-]*$/i,\n ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ_-]*$/,\n az: /^[0-9A-ZÇƏĞİıÖŞÜ_-]*$/i\n};\n\nvar validate = function validate(value, ref) {\n if (ref === void 0) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate(val, [locale]);\n });\n } // Match at least one locale.\n\n\n if (!locale) {\n return Object.keys(alpha).some(function (loc) {\n return alpha[loc].test(value);\n });\n }\n\n return (alpha[locale] || alpha.en).test(value);\n};\n\nvar paramNames$1 = ['locale'];\nvar alpha$1 = {\n validate: validate,\n paramNames: paramNames$1\n};\n\nvar validate$1 = function validate$1(value, ref) {\n if (ref === void 0) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$1(val, [locale]);\n });\n } // Match at least one locale.\n\n\n if (!locale) {\n return Object.keys(alphaDash).some(function (loc) {\n return alphaDash[loc].test(value);\n });\n }\n\n return (alphaDash[locale] || alphaDash.en).test(value);\n};\n\nvar paramNames$2 = ['locale'];\nvar alpha_dash = {\n validate: validate$1,\n paramNames: paramNames$2\n};\n\nvar validate$2 = function validate$2(value, ref) {\n if (ref === void 0) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$2(val, [locale]);\n });\n } // Match at least one locale.\n\n\n if (!locale) {\n return Object.keys(alphanumeric).some(function (loc) {\n return alphanumeric[loc].test(value);\n });\n }\n\n return (alphanumeric[locale] || alphanumeric.en).test(value);\n};\n\nvar paramNames$3 = ['locale'];\nvar alpha_num = {\n validate: validate$2,\n paramNames: paramNames$3\n};\n\nvar validate$3 = function validate$3(value, ref) {\n if (ref === void 0) ref = {};\n var locale = ref.locale;\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$3(val, [locale]);\n });\n } // Match at least one locale.\n\n\n if (!locale) {\n return Object.keys(alphaSpaces).some(function (loc) {\n return alphaSpaces[loc].test(value);\n });\n }\n\n return (alphaSpaces[locale] || alphaSpaces.en).test(value);\n};\n\nvar paramNames$4 = ['locale'];\nvar alpha_spaces = {\n validate: validate$3,\n paramNames: paramNames$4\n};\n\nvar validate$4 = function validate$4(value, ref) {\n if (ref === void 0) ref = {};\n var targetValue = ref.targetValue;\n var inclusion = ref.inclusion;\n if (inclusion === void 0) inclusion = false;\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusion;\n inclusion = false;\n }\n\n value = parseDate$1(value, format);\n targetValue = parseDate$1(targetValue, format); // if either is not valid.\n\n if (!value || !targetValue) {\n return false;\n }\n\n return isBefore(value, targetValue) || inclusion && isEqual$1(value, targetValue);\n};\n\nvar options$1 = {\n hasTarget: true,\n isDate: true\n};\nvar paramNames$5 = ['targetValue', 'inclusion', 'format'];\nvar before = {\n validate: validate$4,\n options: options$1,\n paramNames: paramNames$5\n};\n\nvar validate$5 = function validate$5(value, ref) {\n if (ref === void 0) ref = {};\n var min = ref.min;\n var max = ref.max;\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$5(val, {\n min: min,\n max: max\n });\n });\n }\n\n return Number(min) <= value && Number(max) >= value;\n};\n\nvar paramNames$6 = ['min', 'max'];\nvar between = {\n validate: validate$5,\n paramNames: paramNames$6\n};\n\nvar validate$6 = function validate$6(value, ref) {\n var targetValue = ref.targetValue;\n return String(value) === String(targetValue);\n};\n\nvar options$2 = {\n hasTarget: true\n};\nvar paramNames$7 = ['targetValue'];\nvar confirmed = {\n validate: validate$6,\n options: options$2,\n paramNames: paramNames$7\n};\n\nfunction unwrapExports(x) {\n return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n return module = {\n exports: {}\n }, fn(module, module.exports), module.exports;\n}\n\nvar assertString_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = assertString;\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n }\n\n function assertString(input) {\n var isString = typeof input === 'string' || input instanceof String;\n\n if (!isString) {\n var invalidType;\n\n if (input === null) {\n invalidType = 'null';\n } else {\n invalidType = _typeof(input);\n\n if (invalidType === 'object' && input.constructor && input.constructor.hasOwnProperty('name')) {\n invalidType = input.constructor.name;\n } else {\n invalidType = \"a \".concat(invalidType);\n }\n }\n\n throw new TypeError(\"Expected string but received \".concat(invalidType, \".\"));\n }\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nunwrapExports(assertString_1);\nvar isCreditCard_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isCreditCard;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n /* eslint-disable max-len */\n\n\n var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$/;\n /* eslint-enable max-len */\n\n function isCreditCard(str) {\n (0, _assertString.default)(str);\n var sanitized = str.replace(/[- ]+/g, '');\n\n if (!creditCard.test(sanitized)) {\n return false;\n }\n\n var sum = 0;\n var digit;\n var tmpNum;\n var shouldDouble;\n\n for (var i = sanitized.length - 1; i >= 0; i--) {\n digit = sanitized.substring(i, i + 1);\n tmpNum = parseInt(digit, 10);\n\n if (shouldDouble) {\n tmpNum *= 2;\n\n if (tmpNum >= 10) {\n sum += tmpNum % 10 + 1;\n } else {\n sum += tmpNum;\n }\n } else {\n sum += tmpNum;\n }\n\n shouldDouble = !shouldDouble;\n }\n\n return !!(sum % 10 === 0 ? sanitized : false);\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nvar isCreditCard = unwrapExports(isCreditCard_1);\n\nvar validate$7 = function validate$7(value) {\n return isCreditCard(String(value));\n};\n\nvar credit_card = {\n validate: validate$7\n};\n\nvar validate$8 = function validate$8(value, ref) {\n if (ref === void 0) ref = {};\n var min = ref.min;\n var max = ref.max;\n var inclusivity = ref.inclusivity;\n if (inclusivity === void 0) inclusivity = '()';\n var format = ref.format;\n\n if (typeof format === 'undefined') {\n format = inclusivity;\n inclusivity = '()';\n }\n\n var minDate = parseDate$1(String(min), format);\n var maxDate = parseDate$1(String(max), format);\n var dateVal = parseDate$1(String(value), format);\n\n if (!minDate || !maxDate || !dateVal) {\n return false;\n }\n\n if (inclusivity === '()') {\n return isAfter(dateVal, minDate) && isBefore(dateVal, maxDate);\n }\n\n if (inclusivity === '(]') {\n return isAfter(dateVal, minDate) && (isEqual$1(dateVal, maxDate) || isBefore(dateVal, maxDate));\n }\n\n if (inclusivity === '[)') {\n return isBefore(dateVal, maxDate) && (isEqual$1(dateVal, minDate) || isAfter(dateVal, minDate));\n }\n\n return isEqual$1(dateVal, maxDate) || isEqual$1(dateVal, minDate) || isBefore(dateVal, maxDate) && isAfter(dateVal, minDate);\n};\n\nvar options$3 = {\n isDate: true\n};\nvar paramNames$8 = ['min', 'max', 'inclusivity', 'format'];\nvar date_between = {\n validate: validate$8,\n options: options$3,\n paramNames: paramNames$8\n};\n\nvar validate$9 = function validate$9(value, ref) {\n var format = ref.format;\n return !!parseDate$1(value, format);\n};\n\nvar options$4 = {\n isDate: true\n};\nvar paramNames$9 = ['format'];\nvar date_format = {\n validate: validate$9,\n options: options$4,\n paramNames: paramNames$9\n};\n\nvar validate$a = function validate$a(value, ref) {\n if (ref === void 0) ref = {};\n var decimals = ref.decimals;\n if (decimals === void 0) decimals = '*';\n var separator = ref.separator;\n if (separator === void 0) separator = '.';\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$a(val, {\n decimals: decimals,\n separator: separator\n });\n });\n } // if is 0.\n\n\n if (Number(decimals) === 0) {\n return /^-?\\d*$/.test(value);\n }\n\n var regexPart = decimals === '*' ? '+' : \"{1,\" + decimals + \"}\";\n var regex = new RegExp(\"^[-+]?\\\\d*(\\\\\" + separator + \"\\\\d\" + regexPart + \")?([eE]{1}[-]?\\\\d+)?$\");\n\n if (!regex.test(value)) {\n return false;\n }\n\n var parsedValue = parseFloat(value); // eslint-disable-next-line\n\n return parsedValue === parsedValue;\n};\n\nvar paramNames$a = ['decimals', 'separator'];\nvar decimal = {\n validate: validate$a,\n paramNames: paramNames$a\n};\n\nvar validate$b = function validate$b(value, ref) {\n var length = ref[0];\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$b(val, [length]);\n });\n }\n\n var strVal = String(value);\n return /^[0-9]*$/.test(strVal) && strVal.length === Number(length);\n};\n\nvar digits = {\n validate: validate$b\n};\nvar imageRegex = /\\.(jpg|svg|jpeg|png|bmp|gif)$/i;\n\nvar validateImage = function validateImage(file, width, height) {\n var URL = window.URL || window.webkitURL;\n return new Promise(function (resolve) {\n var image = new Image();\n\n image.onerror = function () {\n return resolve({\n valid: false\n });\n };\n\n image.onload = function () {\n return resolve({\n valid: image.width === Number(width) && image.height === Number(height)\n });\n };\n\n image.src = URL.createObjectURL(file);\n });\n};\n\nvar validate$c = function validate$c(files, ref) {\n var width = ref[0];\n var height = ref[1];\n var images = ensureArray(files).filter(function (file) {\n return imageRegex.test(file.name);\n });\n\n if (images.length === 0) {\n return false;\n }\n\n return Promise.all(images.map(function (image) {\n return validateImage(image, width, height);\n }));\n};\n\nvar dimensions = {\n validate: validate$c\n};\nvar merge_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = merge;\n\n function merge() {\n var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var defaults = arguments.length > 1 ? arguments[1] : undefined;\n\n for (var key in defaults) {\n if (typeof obj[key] === 'undefined') {\n obj[key] = defaults[key];\n }\n }\n\n return obj;\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nunwrapExports(merge_1);\nvar isByteLength_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isByteLength;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _typeof(obj) {\n if (typeof Symbol === \"function\" && _typeof2(Symbol.iterator) === \"symbol\") {\n _typeof = function _typeof(obj) {\n return _typeof2(obj);\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : _typeof2(obj);\n };\n }\n\n return _typeof(obj);\n }\n /* eslint-disable prefer-rest-params */\n\n\n function isByteLength(str, options) {\n (0, _assertString.default)(str);\n var min;\n var max;\n\n if (_typeof(options) === 'object') {\n min = options.min || 0;\n max = options.max;\n } else {\n // backwards compatibility: isByteLength(str, min [, max])\n min = arguments[1];\n max = arguments[2];\n }\n\n var len = encodeURI(str).split(/%..|./).length - 1;\n return len >= min && (typeof max === 'undefined' || len <= max);\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nunwrapExports(isByteLength_1);\nvar isFQDN_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isFQDN;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n var _merge = _interopRequireDefault(merge_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var default_fqdn_options = {\n require_tld: true,\n allow_underscores: false,\n allow_trailing_dot: false\n };\n\n function isFQDN(str, options) {\n (0, _assertString.default)(str);\n options = (0, _merge.default)(options, default_fqdn_options);\n /* Remove the optional trailing dot before checking validity */\n\n if (options.allow_trailing_dot && str[str.length - 1] === '.') {\n str = str.substring(0, str.length - 1);\n }\n\n var parts = str.split('.');\n\n for (var i = 0; i < parts.length; i++) {\n if (parts[i].length > 63) {\n return false;\n }\n }\n\n if (options.require_tld) {\n var tld = parts.pop();\n\n if (!parts.length || !/^([a-z\\u00a1-\\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) {\n return false;\n } // disallow spaces\n\n\n if (/[\\s\\u2002-\\u200B\\u202F\\u205F\\u3000\\uFEFF\\uDB40\\uDC20]/.test(tld)) {\n return false;\n }\n }\n\n for (var part, _i = 0; _i < parts.length; _i++) {\n part = parts[_i];\n\n if (options.allow_underscores) {\n part = part.replace(/_/g, '');\n }\n\n if (!/^[a-z\\u00a1-\\uffff0-9-]+$/i.test(part)) {\n return false;\n } // disallow full-width chars\n\n\n if (/[\\uff01-\\uff5e]/.test(part)) {\n return false;\n }\n\n if (part[0] === '-' || part[part.length - 1] === '-') {\n return false;\n }\n }\n\n return true;\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nvar isFQDN = unwrapExports(isFQDN_1);\nvar isIP_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isIP;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var ipv4Maybe = /^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$/;\n var ipv6Block = /^[0-9A-F]{1,4}$/i;\n\n function isIP(str) {\n var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n (0, _assertString.default)(str);\n version = String(version);\n\n if (!version) {\n return isIP(str, 4) || isIP(str, 6);\n } else if (version === '4') {\n if (!ipv4Maybe.test(str)) {\n return false;\n }\n\n var parts = str.split('.').sort(function (a, b) {\n return a - b;\n });\n return parts[3] <= 255;\n } else if (version === '6') {\n var blocks = str.split(':');\n var foundOmissionBlock = false; // marker to indicate ::\n // At least some OS accept the last 32 bits of an IPv6 address\n // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says\n // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses,\n // and '::a.b.c.d' is deprecated, but also valid.\n\n var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4);\n var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8;\n\n if (blocks.length > expectedNumberOfBlocks) {\n return false;\n } // initial or final ::\n\n\n if (str === '::') {\n return true;\n } else if (str.substr(0, 2) === '::') {\n blocks.shift();\n blocks.shift();\n foundOmissionBlock = true;\n } else if (str.substr(str.length - 2) === '::') {\n blocks.pop();\n blocks.pop();\n foundOmissionBlock = true;\n }\n\n for (var i = 0; i < blocks.length; ++i) {\n // test for a :: which can not be at the string start/end\n // since those cases have been handled above\n if (blocks[i] === '' && i > 0 && i < blocks.length - 1) {\n if (foundOmissionBlock) {\n return false; // multiple :: in address\n }\n\n foundOmissionBlock = true;\n } else if (foundIPv4TransitionBlock && i === blocks.length - 1) ;else if (!ipv6Block.test(blocks[i])) {\n return false;\n }\n }\n\n if (foundOmissionBlock) {\n return blocks.length >= 1;\n }\n\n return blocks.length === expectedNumberOfBlocks;\n }\n\n return false;\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nvar isIP = unwrapExports(isIP_1);\nvar isEmail_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isEmail;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n var _merge = _interopRequireDefault(merge_1);\n\n var _isByteLength = _interopRequireDefault(isByteLength_1);\n\n var _isFQDN = _interopRequireDefault(isFQDN_1);\n\n var _isIP = _interopRequireDefault(isIP_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var default_email_options = {\n allow_display_name: false,\n require_display_name: false,\n allow_utf8_local_part: true,\n require_tld: true\n };\n /* eslint-disable max-len */\n\n /* eslint-disable no-control-regex */\n\n var displayName = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\,\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF\\s]*<(.+)>$/i;\n var emailUserPart = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]+$/i;\n var gmailUserPart = /^[a-z\\d]+$/;\n var quotedEmailUser = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]))*$/i;\n var emailUserUtf8Part = /^[a-z\\d!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+$/i;\n var quotedEmailUserUtf8 = /^([\\s\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f\\x21\\x23-\\x5b\\x5d-\\x7e\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]|(\\\\[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))*$/i;\n /* eslint-enable max-len */\n\n /* eslint-enable no-control-regex */\n\n function isEmail(str, options) {\n (0, _assertString.default)(str);\n options = (0, _merge.default)(options, default_email_options);\n\n if (options.require_display_name || options.allow_display_name) {\n var display_email = str.match(displayName);\n\n if (display_email) {\n str = display_email[1];\n } else if (options.require_display_name) {\n return false;\n }\n }\n\n var parts = str.split('@');\n var domain = parts.pop();\n var user = parts.join('@');\n var lower_domain = domain.toLowerCase();\n\n if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) {\n /*\n Previously we removed dots for gmail addresses before validating.\n This was removed because it allows `multiple..dots@gmail.com`\n to be reported as valid, but it is not.\n Gmail only normalizes single dots, removing them from here is pointless,\n should be done in normalizeEmail\n */\n user = user.toLowerCase(); // Removing sub-address from username before gmail validation\n\n var username = user.split('+')[0]; // Dots are not included in gmail length restriction\n\n if (!(0, _isByteLength.default)(username.replace('.', ''), {\n min: 6,\n max: 30\n })) {\n return false;\n }\n\n var _user_parts = username.split('.');\n\n for (var i = 0; i < _user_parts.length; i++) {\n if (!gmailUserPart.test(_user_parts[i])) {\n return false;\n }\n }\n }\n\n if (!(0, _isByteLength.default)(user, {\n max: 64\n }) || !(0, _isByteLength.default)(domain, {\n max: 254\n })) {\n return false;\n }\n\n if (!(0, _isFQDN.default)(domain, {\n require_tld: options.require_tld\n })) {\n if (!options.allow_ip_domain) {\n return false;\n }\n\n if (!(0, _isIP.default)(domain)) {\n if (!domain.startsWith('[') || !domain.endsWith(']')) {\n return false;\n }\n\n var noBracketdomain = domain.substr(1, domain.length - 2);\n\n if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) {\n return false;\n }\n }\n }\n\n if (user[0] === '\"') {\n user = user.slice(1, user.length - 1);\n return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user);\n }\n\n var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart;\n var user_parts = user.split('.');\n\n for (var _i = 0; _i < user_parts.length; _i++) {\n if (!pattern.test(user_parts[_i])) {\n return false;\n }\n }\n\n return true;\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nvar isEmail = unwrapExports(isEmail_1);\n\nfunction objectWithoutProperties(obj, exclude) {\n var target = {};\n\n for (var k in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, k) && exclude.indexOf(k) === -1) target[k] = obj[k];\n }\n\n return target;\n}\n\nvar validate$d = function validate$d(value, ref) {\n if (ref === void 0) ref = {};\n var multiple = ref.multiple;\n if (multiple === void 0) multiple = false;\n var rest = objectWithoutProperties(ref, [\"multiple\"]);\n var options = rest;\n\n if (multiple && !Array.isArray(value)) {\n value = String(value).split(',').map(function (emailStr) {\n return emailStr.trim();\n });\n }\n\n var validatorOptions = assign({}, options);\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return isEmail(String(val), validatorOptions);\n });\n }\n\n return isEmail(String(value), validatorOptions);\n};\n\nvar email = {\n validate: validate$d\n};\n\nvar validate$e = function validate$e(value, options) {\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$e(val, options);\n });\n }\n\n return toArray(options).some(function (item) {\n // eslint-disable-next-line\n return item == value;\n });\n};\n\nvar included = {\n validate: validate$e\n};\n\nvar validate$f = function validate$f() {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return !validate$e.apply(void 0, args);\n};\n\nvar excluded = {\n validate: validate$f\n};\n\nvar validate$g = function validate$g(files, extensions) {\n var regex = new RegExp(\".(\" + extensions.join('|') + \")$\", 'i');\n return ensureArray(files).every(function (file) {\n return regex.test(file.name);\n });\n};\n\nvar ext = {\n validate: validate$g\n};\n\nvar validate$h = function validate$h(files) {\n return (Array.isArray(files) ? files : [files]).every(function (file) {\n return /\\.(jpg|svg|jpeg|png|bmp|gif)$/i.test(file.name);\n });\n};\n\nvar image = {\n validate: validate$h\n};\n\nvar validate$i = function validate$i(value) {\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return /^-?[0-9]+$/.test(String(val));\n });\n }\n\n return /^-?[0-9]+$/.test(String(value));\n};\n\nvar integer = {\n validate: validate$i\n};\n\nvar validate$j = function validate$j(value, ref) {\n if (ref === void 0) ref = {};\n var version = ref.version;\n if (version === void 0) version = 4;\n\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return isIP(val, version);\n });\n }\n\n return isIP(value, version);\n};\n\nvar paramNames$b = ['version'];\nvar ip = {\n validate: validate$j,\n paramNames: paramNames$b\n};\n\nvar validate$k = function validate$k(value) {\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return isIP(val, '') || isFQDN(val);\n });\n }\n\n return isIP(value, '') || isFQDN(value);\n};\n\nvar ip_or_fqdn = {\n validate: validate$k\n};\n\nvar validate$l = function validate$l(value, ref) {\n if (ref === void 0) ref = [];\n var other = ref[0];\n return value === other;\n};\n\nvar is = {\n validate: validate$l\n};\n\nvar validate$m = function validate$m(value, ref) {\n if (ref === void 0) ref = [];\n var other = ref[0];\n return value !== other;\n};\n\nvar is_not = {\n validate: validate$m\n};\n/**\n * @param {Array|String} value\n * @param {Number} length\n * @param {Number} max\n */\n\nvar compare = function compare(value, length, max) {\n if (max === undefined) {\n return value.length === length;\n } // cast to number.\n\n\n max = Number(max);\n return value.length >= length && value.length <= max;\n};\n\nvar validate$n = function validate$n(value, ref) {\n var length = ref[0];\n var max = ref[1];\n if (max === void 0) max = undefined;\n\n if (isNullOrUndefined(value)) {\n return false;\n }\n\n length = Number(length);\n\n if (typeof value === 'number') {\n value = String(value);\n }\n\n if (!value.length) {\n value = toArray(value);\n }\n\n return compare(value, length, max);\n};\n\nvar length = {\n validate: validate$n\n};\n\nvar validate$o = function validate$o(value, ref) {\n var length = ref[0];\n\n if (isNullOrUndefined(value)) {\n return length >= 0;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$o(val, [length]);\n });\n }\n\n return String(value).length <= length;\n};\n\nvar max = {\n validate: validate$o\n};\n\nvar validate$p = function validate$p(value, ref) {\n var max = ref[0];\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 && value.every(function (val) {\n return validate$p(val, [max]);\n });\n }\n\n return Number(value) <= max;\n};\n\nvar max_value = {\n validate: validate$p\n};\n\nvar validate$q = function validate$q(files, mimes) {\n var regex = new RegExp(mimes.join('|').replace('*', '.+') + \"$\", 'i');\n return ensureArray(files).every(function (file) {\n return regex.test(file.type);\n });\n};\n\nvar mimes = {\n validate: validate$q\n};\n\nvar validate$r = function validate$r(value, ref) {\n var length = ref[0];\n\n if (isNullOrUndefined(value)) {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$r(val, [length]);\n });\n }\n\n return String(value).length >= length;\n};\n\nvar min = {\n validate: validate$r\n};\n\nvar validate$s = function validate$s(value, ref) {\n var min = ref[0];\n\n if (isNullOrUndefined(value) || value === '') {\n return false;\n }\n\n if (Array.isArray(value)) {\n return value.length > 0 && value.every(function (val) {\n return validate$s(val, [min]);\n });\n }\n\n return Number(value) >= min;\n};\n\nvar min_value = {\n validate: validate$s\n};\nvar ar = /^[٠١٢٣٤٥٦٧٨٩]+$/;\nvar en = /^[0-9]+$/;\n\nvar validate$t = function validate$t(value) {\n var testValue = function testValue(val) {\n var strValue = String(val);\n return en.test(strValue) || ar.test(strValue);\n };\n\n if (Array.isArray(value)) {\n return value.every(testValue);\n }\n\n return testValue(value);\n};\n\nvar numeric = {\n validate: validate$t\n};\n\nvar validate$u = function validate$u(value, ref) {\n var expression = ref.expression;\n\n if (typeof expression === 'string') {\n expression = new RegExp(expression);\n }\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return validate$u(val, {\n expression: expression\n });\n });\n }\n\n return expression.test(String(value));\n};\n\nvar paramNames$c = ['expression'];\nvar regex = {\n validate: validate$u,\n paramNames: paramNames$c\n};\n\nvar validate$v = function validate$v(value, ref) {\n if (ref === void 0) ref = [];\n var invalidateFalse = ref[0];\n if (invalidateFalse === void 0) invalidateFalse = false;\n\n if (isNullOrUndefined(value) || isEmptyArray(value)) {\n return false;\n } // incase a field considers `false` as an empty value like checkboxes.\n\n\n if (value === false && invalidateFalse) {\n return false;\n }\n\n return !!String(value).trim().length;\n};\n\nvar required = {\n validate: validate$v\n};\n\nvar validate$w = function validate$w(value, ref) {\n if (ref === void 0) ref = [];\n var otherFieldVal = ref[0];\n var possibleVals = ref.slice(1);\n var required = possibleVals.includes(String(otherFieldVal).trim());\n\n if (!required) {\n return {\n valid: true,\n data: {\n required: required\n }\n };\n }\n\n var invalid = isEmptyArray(value) || [false, null, undefined].includes(value);\n invalid = invalid || !String(value).trim().length;\n return {\n valid: !invalid,\n data: {\n required: required\n }\n };\n};\n\nvar options$5 = {\n hasTarget: true,\n computesRequired: true\n};\nvar required_if = {\n validate: validate$w,\n options: options$5\n};\n\nvar validate$x = function validate$x(files, ref) {\n var size = ref[0];\n\n if (isNaN(size)) {\n return false;\n }\n\n var nSize = Number(size) * 1024;\n return ensureArray(files).every(function (file) {\n return file.size <= nSize;\n });\n};\n\nvar size = {\n validate: validate$x\n};\nvar isURL_1 = createCommonjsModule(function (module, exports) {\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.default = isURL;\n\n var _assertString = _interopRequireDefault(assertString_1);\n\n var _isFQDN = _interopRequireDefault(isFQDN_1);\n\n var _isIP = _interopRequireDefault(isIP_1);\n\n var _merge = _interopRequireDefault(merge_1);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var default_url_options = {\n protocols: ['http', 'https', 'ftp'],\n require_tld: true,\n require_protocol: false,\n require_host: true,\n require_valid_protocol: true,\n allow_underscores: false,\n allow_trailing_dot: false,\n allow_protocol_relative_urls: false\n };\n var wrapped_ipv6 = /^\\[([^\\]]+)\\](?::([0-9]+))?$/;\n\n function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n }\n\n function checkHost(host, matches) {\n for (var i = 0; i < matches.length; i++) {\n var match = matches[i];\n\n if (host === match || isRegExp(match) && match.test(host)) {\n return true;\n }\n }\n\n return false;\n }\n\n function isURL(url, options) {\n (0, _assertString.default)(url);\n\n if (!url || url.length >= 2083 || /[\\s<>]/.test(url)) {\n return false;\n }\n\n if (url.indexOf('mailto:') === 0) {\n return false;\n }\n\n options = (0, _merge.default)(options, default_url_options);\n var protocol, auth, host, hostname, port, port_str, split, ipv6;\n split = url.split('#');\n url = split.shift();\n split = url.split('?');\n url = split.shift();\n split = url.split('://');\n\n if (split.length > 1) {\n protocol = split.shift().toLowerCase();\n\n if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {\n return false;\n }\n } else if (options.require_protocol) {\n return false;\n } else if (url.substr(0, 2) === '//') {\n if (!options.allow_protocol_relative_urls) {\n return false;\n }\n\n split[0] = url.substr(2);\n }\n\n url = split.join('://');\n\n if (url === '') {\n return false;\n }\n\n split = url.split('/');\n url = split.shift();\n\n if (url === '' && !options.require_host) {\n return true;\n }\n\n split = url.split('@');\n\n if (split.length > 1) {\n if (options.disallow_auth) {\n return false;\n }\n\n auth = split.shift();\n\n if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) {\n return false;\n }\n }\n\n hostname = split.join('@');\n port_str = null;\n ipv6 = null;\n var ipv6_match = hostname.match(wrapped_ipv6);\n\n if (ipv6_match) {\n host = '';\n ipv6 = ipv6_match[1];\n port_str = ipv6_match[2] || null;\n } else {\n split = hostname.split(':');\n host = split.shift();\n\n if (split.length) {\n port_str = split.join(':');\n }\n }\n\n if (port_str !== null) {\n port = parseInt(port_str, 10);\n\n if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) {\n return false;\n }\n }\n\n if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) {\n return false;\n }\n\n host = host || ipv6;\n\n if (options.host_whitelist && !checkHost(host, options.host_whitelist)) {\n return false;\n }\n\n if (options.host_blacklist && checkHost(host, options.host_blacklist)) {\n return false;\n }\n\n return true;\n }\n\n module.exports = exports.default;\n module.exports.default = exports.default;\n});\nvar isURL = unwrapExports(isURL_1);\n\nvar validate$y = function validate$y(value, options) {\n if (options === void 0) options = {};\n\n if (isNullOrUndefined(value)) {\n value = '';\n }\n\n var validatorOptions = assign({}, options);\n\n if (Array.isArray(value)) {\n return value.every(function (val) {\n return isURL(val, validatorOptions);\n });\n }\n\n return isURL(value, validatorOptions);\n};\n\nvar url = {\n validate: validate$y\n};\n/* eslint-disable camelcase */\n\nvar Rules = /*#__PURE__*/Object.freeze({\n after: after,\n alpha_dash: alpha_dash,\n alpha_num: alpha_num,\n alpha_spaces: alpha_spaces,\n alpha: alpha$1,\n before: before,\n between: between,\n confirmed: confirmed,\n credit_card: credit_card,\n date_between: date_between,\n date_format: date_format,\n decimal: decimal,\n digits: digits,\n dimensions: dimensions,\n email: email,\n ext: ext,\n image: image,\n included: included,\n integer: integer,\n length: length,\n ip: ip,\n ip_or_fqdn: ip_or_fqdn,\n is_not: is_not,\n is: is,\n max: max,\n max_value: max_value,\n mimes: mimes,\n min: min,\n min_value: min_value,\n excluded: excluded,\n numeric: numeric,\n regex: regex,\n required: required,\n required_if: required_if,\n size: size,\n url: url\n}); // \n\nvar normalize = function normalize(fields) {\n if (Array.isArray(fields)) {\n return fields.reduce(function (prev, curr) {\n if (includes(curr, '.')) {\n prev[curr.split('.')[1]] = curr;\n } else {\n prev[curr] = curr;\n }\n\n return prev;\n }, {});\n }\n\n return fields;\n}; // Combines two flags using either AND or OR depending on the flag type.\n\n\nvar combine = function combine(lhs, rhs) {\n var mapper = {\n pristine: function pristine(lhs, rhs) {\n return lhs && rhs;\n },\n dirty: function dirty(lhs, rhs) {\n return lhs || rhs;\n },\n touched: function touched(lhs, rhs) {\n return lhs || rhs;\n },\n untouched: function untouched(lhs, rhs) {\n return lhs && rhs;\n },\n valid: function valid(lhs, rhs) {\n return lhs && rhs;\n },\n invalid: function invalid(lhs, rhs) {\n return lhs || rhs;\n },\n pending: function pending(lhs, rhs) {\n return lhs || rhs;\n },\n required: function required(lhs, rhs) {\n return lhs || rhs;\n },\n validated: function validated(lhs, rhs) {\n return lhs && rhs;\n }\n };\n return Object.keys(mapper).reduce(function (flags, flag) {\n flags[flag] = mapper[flag](lhs[flag], rhs[flag]);\n return flags;\n }, {});\n};\n\nvar mapScope = function mapScope(scope, deep) {\n if (deep === void 0) deep = true;\n return Object.keys(scope).reduce(function (flags, field) {\n if (!flags) {\n flags = assign({}, scope[field]);\n return flags;\n } // scope.\n\n\n var isScope = field.indexOf('$') === 0;\n\n if (deep && isScope) {\n return combine(mapScope(scope[field]), flags);\n } else if (!deep && isScope) {\n return flags;\n }\n\n flags = combine(flags, scope[field]);\n return flags;\n }, null);\n};\n/**\n * Maps fields to computed functions.\n */\n\n\nvar mapFields = function mapFields(fields) {\n if (!fields) {\n return function () {\n return mapScope(this.$validator.flags);\n };\n }\n\n var normalized = normalize(fields);\n return Object.keys(normalized).reduce(function (prev, curr) {\n var field = normalized[curr];\n\n prev[curr] = function mappedField() {\n // if field exists\n if (this.$validator.flags[field]) {\n return this.$validator.flags[field];\n } // scopeless fields were selected.\n\n\n if (normalized[curr] === '*') {\n return mapScope(this.$validator.flags, false);\n } // if it has a scope defined\n\n\n var index = field.indexOf('.');\n\n if (index <= 0) {\n return {};\n }\n\n var ref = field.split('.');\n var scope = ref[0];\n var name = ref.slice(1);\n scope = this.$validator.flags[\"$\" + scope];\n name = name.join('.'); // an entire scope was selected: scope.*\n\n if (name === '*' && scope) {\n return mapScope(scope);\n }\n\n if (scope && scope[name]) {\n return scope[name];\n }\n\n return {};\n };\n\n return prev;\n }, {});\n};\n\nvar $validator = null;\nvar PROVIDER_COUNTER = 0;\nvar ValidationProvider = {\n $__veeInject: false,\n inject: {\n $_veeObserver: {\n from: '$_veeObserver',\n default: function default$1() {\n if (!this.$vnode.context.$_veeObserver) {\n this.$vnode.context.$_veeObserver = createObserver();\n }\n\n return this.$vnode.context.$_veeObserver;\n }\n }\n },\n props: {\n vid: {\n type: [String, Number],\n default: function _default() {\n PROVIDER_COUNTER++;\n return \"_vee_\" + PROVIDER_COUNTER;\n }\n },\n name: {\n type: String,\n default: null\n },\n mode: {\n type: [String, Function],\n default: function _default() {\n return getConfig().mode;\n }\n },\n events: {\n type: Array,\n validate: function validate() {\n /* istanbul ignore next */\n if (process.env.NODE_ENV !== 'production') {\n warn('events prop and config will be deprecated in future version please use the interaction modes instead');\n }\n\n return true;\n },\n default: function _default() {\n var events = getConfig().events;\n\n if (typeof events === 'string') {\n return events.split('|');\n }\n\n return events;\n }\n },\n rules: {\n type: [Object, String],\n default: null\n },\n immediate: {\n type: Boolean,\n default: false\n },\n persist: {\n type: Boolean,\n default: false\n },\n bails: {\n type: Boolean,\n default: function _default() {\n return getConfig().fastExit;\n }\n },\n debounce: {\n type: Number,\n default: function _default() {\n return getConfig().delay || 0;\n }\n },\n tag: {\n type: String,\n default: 'span'\n },\n slim: {\n type: Boolean,\n default: false\n }\n },\n watch: {\n rules: {\n deep: true,\n handler: function handler(val, oldVal) {\n this._needsValidation = !isEqual(val, oldVal);\n }\n }\n },\n data: function data() {\n return {\n messages: [],\n value: undefined,\n initialized: false,\n initialValue: undefined,\n flags: createFlags(),\n failedRules: {},\n forceRequired: false,\n isDeactivated: false,\n id: null\n };\n },\n computed: {\n isValid: function isValid() {\n return this.flags.valid;\n },\n fieldDeps: function fieldDeps() {\n var this$1 = this;\n var rules = normalizeRules(this.rules);\n return Object.keys(rules).filter(RuleContainer.isTargetRule).map(function (rule) {\n var depName = rules[rule][0];\n watchCrossFieldDep(this$1, depName);\n return depName;\n });\n },\n normalizedEvents: function normalizedEvents() {\n var this$1 = this;\n var ref = computeModeSetting(this);\n var on = ref.on;\n return normalizeEvents(on || this.events || []).map(function (e) {\n if (e === 'input') {\n return this$1._inputEventName;\n }\n\n return e;\n });\n },\n isRequired: function isRequired() {\n var rules = normalizeRules(this.rules);\n var forceRequired = this.forceRequired;\n var isRequired = rules.required || forceRequired;\n this.flags.required = isRequired;\n return isRequired;\n },\n classes: function classes() {\n var this$1 = this;\n var names = getConfig().classNames;\n return Object.keys(this.flags).reduce(function (classes, flag) {\n var className = names && names[flag] || flag;\n\n if (isNullOrUndefined(this$1.flags[flag])) {\n return classes;\n }\n\n if (className) {\n classes[className] = this$1.flags[flag];\n }\n\n return classes;\n }, {});\n }\n },\n render: function render(h) {\n var this$1 = this;\n this.registerField();\n var ctx = createValidationCtx(this); // Gracefully handle non-existent scoped slots.\n\n var slot = this.$scopedSlots.default;\n /* istanbul ignore next */\n\n if (!isCallable(slot)) {\n if (process.env.NODE_ENV !== 'production') {\n warn('ValidationProvider expects a scoped slot. Did you forget to add \"v-slot\" to your slot?');\n }\n\n return h(this.tag, this.$slots.default);\n }\n\n var nodes = slot(ctx); // Handle single-root slot.\n\n extractVNodes(nodes).forEach(function (input) {\n addListeners.call(this$1, input);\n });\n return this.slim ? createRenderless(h, nodes) : h(this.tag, nodes);\n },\n beforeDestroy: function beforeDestroy() {\n // cleanup reference.\n this.$_veeObserver.unsubscribe(this);\n },\n activated: function activated() {\n this.$_veeObserver.subscribe(this);\n this.isDeactivated = false;\n },\n deactivated: function deactivated() {\n this.$_veeObserver.unsubscribe(this);\n this.isDeactivated = true;\n },\n methods: {\n setFlags: function setFlags(flags) {\n var this$1 = this;\n Object.keys(flags).forEach(function (flag) {\n this$1.flags[flag] = flags[flag];\n });\n },\n syncValue: function syncValue(e) {\n var value = normalizeValue$1(e);\n this.value = value;\n this.flags.changed = this.initialValue !== value;\n },\n reset: function reset() {\n this.messages = [];\n this._pendingValidation = null;\n this.initialValue = this.value;\n var flags = createFlags();\n this.setFlags(flags);\n },\n validate: function validate() {\n var this$1 = this;\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n if (args.length > 0) {\n this.syncValue(args[0]);\n }\n\n return this.validateSilent().then(function (result) {\n this$1.applyResult(result);\n return result;\n });\n },\n validateSilent: function validateSilent() {\n var this$1 = this;\n this.setFlags({\n pending: true\n });\n return $validator.verify(this.value, this.rules, {\n name: this.name,\n values: createValuesLookup(this),\n bails: this.bails\n }).then(function (result) {\n this$1.setFlags({\n pending: false\n });\n\n if (!this$1.isRequired) {\n this$1.setFlags({\n valid: result.valid,\n invalid: !result.valid\n });\n }\n\n return result;\n });\n },\n applyResult: function applyResult(ref) {\n var errors = ref.errors;\n var failedRules = ref.failedRules;\n this.messages = errors;\n this.failedRules = assign({}, failedRules);\n this.setFlags({\n valid: !errors.length,\n changed: this.value !== this.initialValue,\n invalid: !!errors.length,\n validated: true\n });\n },\n registerField: function registerField() {\n if (!$validator) {\n $validator = getValidator() || new Validator(null, {\n fastExit: getConfig().fastExit\n });\n }\n\n updateRenderingContextRefs(this);\n }\n }\n};\n\nfunction createValidationCtx(ctx) {\n return {\n errors: ctx.messages,\n flags: ctx.flags,\n classes: ctx.classes,\n valid: ctx.isValid,\n failedRules: ctx.failedRules,\n reset: function reset() {\n return ctx.reset();\n },\n validate: function validate() {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return ctx.validate.apply(ctx, args);\n },\n aria: {\n 'aria-invalid': ctx.flags.invalid ? 'true' : 'false',\n 'aria-required': ctx.isRequired ? 'true' : 'false'\n }\n };\n}\n\nfunction normalizeValue$1(value) {\n if (isEvent(value)) {\n return value.target.type === 'file' ? toArray(value.target.files) : value.target.value;\n }\n\n return value;\n}\n/**\n * Determines if a provider needs to run validation.\n */\n\n\nfunction shouldValidate(ctx, model) {\n // when an immediate/initial validation is needed and wasn't done before.\n if (!ctx._ignoreImmediate && ctx.immediate) {\n return true;\n } // when the value changes for whatever reason.\n\n\n if (ctx.value !== model.value) {\n return true;\n } // when it needs validation due to props/cross-fields changes.\n\n\n if (ctx._needsValidation) {\n return true;\n } // when the initial value is undefined and the field wasn't rendered yet.\n\n\n if (!ctx.initialized && model.value === undefined) {\n return true;\n }\n\n return false;\n}\n\nfunction computeModeSetting(ctx) {\n var compute = isCallable(ctx.mode) ? ctx.mode : modes[ctx.mode];\n return compute({\n errors: ctx.messages,\n value: ctx.value,\n flags: ctx.flags\n });\n}\n\nfunction onRenderUpdate(model) {\n if (!this.initialized) {\n this.initialValue = model.value;\n }\n\n var validateNow = shouldValidate(this, model);\n this._needsValidation = false;\n this.value = model.value;\n this._ignoreImmediate = true;\n\n if (!validateNow) {\n return;\n }\n\n this.validateSilent().then(this.immediate || this.flags.validated ? this.applyResult : function (x) {\n return x;\n });\n} // Creates the common handlers for a validatable context.\n\n\nfunction createCommonHandlers(ctx) {\n var onInput = function onInput(e) {\n ctx.syncValue(e); // track and keep the value updated.\n\n ctx.setFlags({\n dirty: true,\n pristine: false\n });\n }; // Blur event listener.\n\n\n var onBlur = function onBlur() {\n ctx.setFlags({\n touched: true,\n untouched: false\n });\n };\n\n var onValidate = ctx.$veeHandler;\n var mode = computeModeSetting(ctx); // Handle debounce changes.\n\n if (!onValidate || ctx.$veeDebounce !== ctx.debounce) {\n onValidate = debounce(function () {\n ctx.$nextTick(function () {\n var pendingPromise = ctx.validateSilent(); // avoids race conditions between successive validations.\n\n ctx._pendingValidation = pendingPromise;\n pendingPromise.then(function (result) {\n if (pendingPromise === ctx._pendingValidation) {\n ctx.applyResult(result);\n ctx._pendingValidation = null;\n }\n });\n });\n }, mode.debounce || ctx.debounce); // Cache the handler so we don't create it each time.\n\n ctx.$veeHandler = onValidate; // cache the debounce value so we detect if it was changed.\n\n ctx.$veeDebounce = ctx.debounce;\n }\n\n return {\n onInput: onInput,\n onBlur: onBlur,\n onValidate: onValidate\n };\n} // Adds all plugin listeners to the vnode.\n\n\nfunction addListeners(node) {\n var model = findModel(node); // cache the input eventName.\n\n this._inputEventName = this._inputEventName || getInputEventName(node, model);\n onRenderUpdate.call(this, model);\n var ref = createCommonHandlers(this);\n var onInput = ref.onInput;\n var onBlur = ref.onBlur;\n var onValidate = ref.onValidate;\n addVNodeListener(node, this._inputEventName, onInput);\n addVNodeListener(node, 'blur', onBlur); // add the validation listeners.\n\n this.normalizedEvents.forEach(function (evt) {\n addVNodeListener(node, evt, onValidate);\n });\n this.initialized = true;\n}\n\nfunction createValuesLookup(ctx) {\n var providers = ctx.$_veeObserver.refs;\n return ctx.fieldDeps.reduce(function (acc, depName) {\n if (!providers[depName]) {\n return acc;\n }\n\n acc[depName] = providers[depName].value;\n return acc;\n }, {});\n}\n\nfunction updateRenderingContextRefs(ctx) {\n // IDs should not be nullable.\n if (isNullOrUndefined(ctx.id) && ctx.id === ctx.vid) {\n ctx.id = PROVIDER_COUNTER;\n PROVIDER_COUNTER++;\n }\n\n var id = ctx.id;\n var vid = ctx.vid; // Nothing has changed.\n\n if (ctx.isDeactivated || id === vid && ctx.$_veeObserver.refs[id]) {\n return;\n } // vid was changed.\n\n\n if (id !== vid && ctx.$_veeObserver.refs[id] === ctx) {\n ctx.$_veeObserver.unsubscribe({\n vid: id\n });\n }\n\n ctx.$_veeObserver.subscribe(ctx);\n ctx.id = vid;\n}\n\nfunction createObserver() {\n return {\n refs: {},\n subscribe: function subscribe(ctx) {\n this.refs[ctx.vid] = ctx;\n },\n unsubscribe: function unsubscribe(ctx) {\n delete this.refs[ctx.vid];\n }\n };\n}\n\nfunction watchCrossFieldDep(ctx, depName, withHooks) {\n if (withHooks === void 0) withHooks = true;\n var providers = ctx.$_veeObserver.refs;\n\n if (!ctx._veeWatchers) {\n ctx._veeWatchers = {};\n }\n\n if (!providers[depName] && withHooks) {\n return ctx.$once('hook:mounted', function () {\n watchCrossFieldDep(ctx, depName, false);\n });\n }\n\n if (!isCallable(ctx._veeWatchers[depName]) && providers[depName]) {\n ctx._veeWatchers[depName] = providers[depName].$watch('value', function () {\n if (ctx.flags.validated) {\n ctx._needsValidation = true;\n ctx.validate();\n }\n });\n }\n}\n\nvar flagMergingStrategy = {\n pristine: 'every',\n dirty: 'some',\n touched: 'some',\n untouched: 'every',\n valid: 'every',\n invalid: 'some',\n pending: 'some',\n validated: 'every'\n};\n\nfunction mergeFlags(lhs, rhs, strategy) {\n var stratName = flagMergingStrategy[strategy];\n return [lhs, rhs][stratName](function (f) {\n return f;\n });\n}\n\nvar OBSERVER_COUNTER = 0;\nvar ValidationObserver = {\n name: 'ValidationObserver',\n provide: function provide() {\n return {\n $_veeObserver: this\n };\n },\n inject: {\n $_veeObserver: {\n from: '$_veeObserver',\n default: function default$1() {\n if (!this.$vnode.context.$_veeObserver) {\n return null;\n }\n\n return this.$vnode.context.$_veeObserver;\n }\n }\n },\n props: {\n tag: {\n type: String,\n default: 'span'\n },\n slim: {\n type: Boolean,\n default: false\n }\n },\n data: function data() {\n return {\n vid: \"obs_\" + OBSERVER_COUNTER++,\n refs: {},\n observers: [],\n persistedStore: {}\n };\n },\n computed: {\n ctx: function ctx() {\n var this$1 = this;\n var ctx = {\n errors: {},\n validate: function validate(arg) {\n var promise = this$1.validate(arg);\n return {\n then: function then(thenable) {\n return promise.then(function (success) {\n if (success && isCallable(thenable)) {\n return Promise.resolve(thenable());\n }\n\n return Promise.resolve(success);\n });\n }\n };\n },\n reset: function reset() {\n return this$1.reset();\n }\n };\n return values(this.refs).concat(Object.keys(this.persistedStore).map(function (key) {\n return {\n vid: key,\n flags: this$1.persistedStore[key].flags,\n messages: this$1.persistedStore[key].errors\n };\n }), this.observers).reduce(function (acc, provider) {\n Object.keys(flagMergingStrategy).forEach(function (flag) {\n var flags = provider.flags || provider.ctx;\n\n if (!(flag in acc)) {\n acc[flag] = flags[flag];\n return;\n }\n\n acc[flag] = mergeFlags(acc[flag], flags[flag], flag);\n });\n acc.errors[provider.vid] = provider.messages || values(provider.ctx.errors).reduce(function (errs, obsErrors) {\n return errs.concat(obsErrors);\n }, []);\n return acc;\n }, ctx);\n }\n },\n created: function created() {\n if (this.$_veeObserver) {\n this.$_veeObserver.subscribe(this, 'observer');\n }\n },\n activated: function activated() {\n if (this.$_veeObserver) {\n this.$_veeObserver.subscribe(this, 'observer');\n }\n },\n deactivated: function deactivated() {\n if (this.$_veeObserver) {\n this.$_veeObserver.unsubscribe(this, 'observer');\n }\n },\n beforeDestroy: function beforeDestroy() {\n if (this.$_veeObserver) {\n this.$_veeObserver.unsubscribe(this, 'observer');\n }\n },\n render: function render(h) {\n var slots = this.$slots.default || this.$scopedSlots.default || [];\n\n if (isCallable(slots)) {\n slots = slots(this.ctx);\n }\n\n return this.slim ? createRenderless(h, slots) : h(this.tag, {\n on: this.$listeners,\n attrs: this.$attrs\n }, slots);\n },\n methods: {\n subscribe: function subscribe(subscriber, kind) {\n var obj;\n if (kind === void 0) kind = 'provider';\n\n if (kind === 'observer') {\n this.observers.push(subscriber);\n return;\n }\n\n this.refs = Object.assign({}, this.refs, (obj = {}, obj[subscriber.vid] = subscriber, obj));\n\n if (subscriber.persist && this.persistedStore[subscriber.vid]) {\n this.restoreProviderState(subscriber);\n }\n },\n unsubscribe: function unsubscribe(ref, kind) {\n var vid = ref.vid;\n if (kind === void 0) kind = 'provider';\n\n if (kind === 'provider') {\n this.removeProvider(vid);\n }\n\n var idx = findIndex(this.observers, function (o) {\n return o.vid === vid;\n });\n\n if (idx !== -1) {\n this.observers.splice(idx, 1);\n }\n },\n validate: function validate(ref) {\n if (ref === void 0) ref = {\n silent: false\n };\n var silent = ref.silent;\n return Promise.all(values(this.refs).map(function (ref) {\n return ref[silent ? 'validateSilent' : 'validate']().then(function (r) {\n return r.valid;\n });\n }).concat(this.observers.map(function (obs) {\n return obs.validate({\n silent: silent\n });\n }))).then(function (results) {\n return results.every(function (r) {\n return r;\n });\n });\n },\n reset: function reset() {\n var this$1 = this;\n Object.keys(this.persistedStore).forEach(function (key) {\n this$1.$delete(this$1.persistedStore, key);\n });\n return values(this.refs).concat(this.observers).forEach(function (ref) {\n return ref.reset();\n });\n },\n restoreProviderState: function restoreProviderState(provider) {\n var state = this.persistedStore[provider.vid];\n provider.setFlags(state.flags);\n provider.applyResult(state);\n this.$delete(this.persistedStore, provider.vid);\n },\n removeProvider: function removeProvider(vid) {\n var obj;\n var provider = this.refs[vid]; // save it for the next time.\n\n if (provider && provider.persist) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n if (vid.indexOf('_vee_') === 0) {\n warn('Please provide a `vid` prop when using `persist`, there might be unexpected issues otherwise.');\n }\n }\n\n this.persistedStore = assign({}, this.persistedStore, (obj = {}, obj[vid] = {\n flags: provider.flags,\n errors: provider.messages,\n failedRules: provider.failedRules\n }, obj));\n }\n\n this.$delete(this.refs, vid);\n }\n }\n};\n\nfunction withValidation(component, ctxToProps) {\n if (ctxToProps === void 0) ctxToProps = null;\n var options = isCallable(component) ? component.options : component;\n options.$__veeInject = false;\n var hoc = {\n name: (options.name || 'AnonymousHoc') + \"WithValidation\",\n props: assign({}, ValidationProvider.props),\n data: ValidationProvider.data,\n computed: assign({}, ValidationProvider.computed),\n methods: assign({}, ValidationProvider.methods),\n $__veeInject: false,\n beforeDestroy: ValidationProvider.beforeDestroy,\n inject: ValidationProvider.inject\n }; // Default ctx converts ctx props to component props.\n\n if (!ctxToProps) {\n ctxToProps = function ctxToProps(ctx) {\n return ctx;\n };\n }\n\n var eventName = options.model && options.model.event || 'input';\n\n hoc.render = function (h) {\n var obj;\n this.registerField();\n var vctx = createValidationCtx(this);\n var listeners = assign({}, this.$listeners);\n var model = findModel(this.$vnode);\n this._inputEventName = this._inputEventName || getInputEventName(this.$vnode, model);\n onRenderUpdate.call(this, model);\n var ref = createCommonHandlers(this);\n var onInput = ref.onInput;\n var onBlur = ref.onBlur;\n var onValidate = ref.onValidate;\n mergeVNodeListeners(listeners, eventName, onInput);\n mergeVNodeListeners(listeners, 'blur', onBlur);\n this.normalizedEvents.forEach(function (evt, idx) {\n mergeVNodeListeners(listeners, evt, onValidate);\n }); // Props are any attrs not associated with ValidationProvider Plus the model prop.\n // WARNING: Accidental prop overwrite will probably happen.\n\n var ref$1 = findModelConfig(this.$vnode) || {\n prop: 'value'\n };\n var prop = ref$1.prop;\n var props = assign({}, this.$attrs, (obj = {}, obj[prop] = model.value, obj), ctxToProps(vctx));\n return h(options, {\n attrs: this.$attrs,\n props: props,\n on: listeners\n }, normalizeSlots(this.$slots, this.$vnode.context));\n };\n\n return hoc;\n}\n\nvar version = '2.2.15';\nObject.keys(Rules).forEach(function (rule) {\n Validator.extend(rule, Rules[rule].validate, assign({}, Rules[rule].options, {\n paramNames: Rules[rule].paramNames\n }));\n}); // Merge the english messages.\n\nValidator.localize({\n en: locale\n});\nvar install = VeeValidate$1.install;\nVeeValidate$1.version = version;\nVeeValidate$1.mapFields = mapFields;\nVeeValidate$1.ValidationProvider = ValidationProvider;\nVeeValidate$1.ValidationObserver = ValidationObserver;\nVeeValidate$1.withValidation = withValidation;\nexport default VeeValidate$1;\nexport { ErrorBag, Rules, ValidationObserver, ValidationProvider, Validator, directive, install, mapFields, mixin, version, withValidation };","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar placeholderChar = '_';\nvar strFunction = 'function';\nvar emptyArray$1 = [];\n\nfunction convertMaskToPlaceholder() {\n var mask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : emptyArray$1;\n var placeholderChar$1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : placeholderChar;\n\n if (!isArray(mask)) {\n throw new Error('Text-mask:convertMaskToPlaceholder; The mask property must be an array.');\n }\n\n if (mask.indexOf(placeholderChar$1) !== -1) {\n throw new Error('Placeholder character must not be used as part of the mask. Please specify a character ' + 'that is not present in your mask as your placeholder character.\\n\\n' + \"The placeholder character that was received is: \".concat(JSON.stringify(placeholderChar$1), \"\\n\\n\") + \"The mask that was received is: \".concat(JSON.stringify(mask)));\n }\n\n return mask.map(function (char) {\n return char instanceof RegExp ? placeholderChar$1 : char;\n }).join('');\n}\n\nfunction isArray(value) {\n return Array.isArray && Array.isArray(value) || value instanceof Array;\n}\n\nvar strCaretTrap = '[]';\n\nfunction processCaretTraps(mask) {\n var indexes = [];\n var indexOfCaretTrap;\n\n while (indexOfCaretTrap = mask.indexOf(strCaretTrap), indexOfCaretTrap !== -1) {\n indexes.push(indexOfCaretTrap);\n mask.splice(indexOfCaretTrap, 1);\n }\n\n return {\n maskWithoutCaretTraps: mask,\n indexes: indexes\n };\n}\n\nvar emptyArray = [];\nvar emptyString = '';\n\nfunction conformToMask() {\n var rawValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : emptyString;\n var mask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : emptyArray;\n var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!isArray(mask)) {\n if (_typeof(mask) === strFunction) {\n mask = mask(rawValue, config);\n mask = processCaretTraps(mask).maskWithoutCaretTraps;\n } else {\n throw new Error('Text-mask:conformToMask; The mask property must be an array.');\n }\n }\n\n var _config$guide = config.guide,\n guide = _config$guide === void 0 ? true : _config$guide,\n _config$previousConfo = config.previousConformedValue,\n previousConformedValue = _config$previousConfo === void 0 ? emptyString : _config$previousConfo,\n _config$placeholderCh = config.placeholderChar,\n placeholderChar$1 = _config$placeholderCh === void 0 ? placeholderChar : _config$placeholderCh,\n _config$placeholder = config.placeholder,\n placeholder = _config$placeholder === void 0 ? convertMaskToPlaceholder(mask, placeholderChar$1) : _config$placeholder,\n currentCaretPosition = config.currentCaretPosition,\n keepCharPositions = config.keepCharPositions;\n var suppressGuide = guide === false && previousConformedValue !== undefined;\n var rawValueLength = rawValue.length;\n var previousConformedValueLength = previousConformedValue.length;\n var placeholderLength = placeholder.length;\n var maskLength = mask.length;\n var editDistance = rawValueLength - previousConformedValueLength;\n var isAddition = editDistance > 0;\n var indexOfFirstChange = currentCaretPosition + (isAddition ? -editDistance : 0);\n var indexOfLastChange = indexOfFirstChange + Math.abs(editDistance);\n\n if (keepCharPositions === true && !isAddition) {\n var compensatingPlaceholderChars = emptyString;\n\n for (var i = indexOfFirstChange; i < indexOfLastChange; i++) {\n if (placeholder[i] === placeholderChar$1) {\n compensatingPlaceholderChars += placeholderChar$1;\n }\n }\n\n rawValue = rawValue.slice(0, indexOfFirstChange) + compensatingPlaceholderChars + rawValue.slice(indexOfFirstChange, rawValueLength);\n }\n\n var rawValueArr = rawValue.split(emptyString).map(function (char, i) {\n return {\n char: char,\n isNew: i >= indexOfFirstChange && i < indexOfLastChange\n };\n });\n\n for (var _i = rawValueLength - 1; _i >= 0; _i--) {\n var char = rawValueArr[_i].char;\n\n if (char !== placeholderChar$1) {\n var shouldOffset = _i >= indexOfFirstChange && previousConformedValueLength === maskLength;\n\n if (char === placeholder[shouldOffset ? _i - editDistance : _i]) {\n rawValueArr.splice(_i, 1);\n }\n }\n }\n\n var conformedValue = emptyString;\n var someCharsRejected = false;\n\n placeholderLoop: for (var _i2 = 0; _i2 < placeholderLength; _i2++) {\n var charInPlaceholder = placeholder[_i2];\n\n if (charInPlaceholder === placeholderChar$1) {\n if (rawValueArr.length > 0) {\n while (rawValueArr.length > 0) {\n var _rawValueArr$shift = rawValueArr.shift(),\n rawValueChar = _rawValueArr$shift.char,\n isNew = _rawValueArr$shift.isNew;\n\n if (rawValueChar === placeholderChar$1 && suppressGuide !== true) {\n conformedValue += placeholderChar$1;\n continue placeholderLoop;\n } else if (mask[_i2].test(rawValueChar)) {\n if (keepCharPositions !== true || isNew === false || previousConformedValue === emptyString || guide === false || !isAddition) {\n conformedValue += rawValueChar;\n } else {\n var rawValueArrLength = rawValueArr.length;\n var indexOfNextAvailablePlaceholderChar = null;\n\n for (var _i3 = 0; _i3 < rawValueArrLength; _i3++) {\n var charData = rawValueArr[_i3];\n\n if (charData.char !== placeholderChar$1 && charData.isNew === false) {\n break;\n }\n\n if (charData.char === placeholderChar$1) {\n indexOfNextAvailablePlaceholderChar = _i3;\n break;\n }\n }\n\n if (indexOfNextAvailablePlaceholderChar !== null) {\n conformedValue += rawValueChar;\n rawValueArr.splice(indexOfNextAvailablePlaceholderChar, 1);\n } else {\n _i2--;\n }\n }\n\n continue placeholderLoop;\n } else {\n someCharsRejected = true;\n }\n }\n }\n\n if (suppressGuide === false) {\n conformedValue += placeholder.substr(_i2, placeholderLength);\n }\n\n break;\n } else {\n conformedValue += charInPlaceholder;\n }\n }\n\n if (suppressGuide && isAddition === false) {\n var indexOfLastFilledPlaceholderChar = null;\n\n for (var _i4 = 0; _i4 < conformedValue.length; _i4++) {\n if (placeholder[_i4] === placeholderChar$1) {\n indexOfLastFilledPlaceholderChar = _i4;\n }\n }\n\n if (indexOfLastFilledPlaceholderChar !== null) {\n conformedValue = conformedValue.substr(0, indexOfLastFilledPlaceholderChar + 1);\n } else {\n conformedValue = emptyString;\n }\n }\n\n return {\n conformedValue: conformedValue,\n meta: {\n someCharsRejected: someCharsRejected\n }\n };\n}\n\nvar NEXT_CHAR_OPTIONAL = {\n __nextCharOptional__: true\n};\nvar defaultMaskReplacers = {\n '#': /\\d/,\n A: /[a-z]/i,\n N: /[a-z0-9]/i,\n '?': NEXT_CHAR_OPTIONAL,\n X: /./\n};\n\nvar stringToRegexp = function stringToRegexp(str) {\n var lastSlash = str.lastIndexOf('/');\n return new RegExp(str.slice(1, lastSlash), str.slice(lastSlash + 1));\n};\n\nvar makeRegexpOptional = function makeRegexpOptional(charRegexp) {\n return stringToRegexp(charRegexp.toString().replace(/.(\\/)[gmiyus]{0,6}$/, function (match) {\n return match.replace('/', '?/');\n }));\n};\n\nvar escapeIfNeeded = function escapeIfNeeded(char) {\n return '[\\\\^$.|?*+()'.indexOf(char) > -1 ? \"\\\\\".concat(char) : char;\n};\n\nvar charRegexp = function charRegexp(char) {\n return new RegExp(\"/[\".concat(escapeIfNeeded(char), \"]/\"));\n};\n\nvar isRegexp$1 = function isRegexp(entity) {\n return entity instanceof RegExp;\n};\n\nvar castToRegexp = function castToRegexp(char) {\n return isRegexp$1(char) ? char : charRegexp(char);\n};\n\nfunction maskToRegExpMask(mask) {\n var maskReplacers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMaskReplacers;\n return mask.map(function (char, index, array) {\n var maskChar = maskReplacers[char] || char;\n var previousChar = array[index - 1];\n var previousMaskChar = maskReplacers[previousChar] || previousChar;\n\n if (maskChar === NEXT_CHAR_OPTIONAL) {\n return null;\n }\n\n if (previousMaskChar === NEXT_CHAR_OPTIONAL) {\n return makeRegexpOptional(castToRegexp(maskChar));\n }\n\n return maskChar;\n }).filter(Boolean);\n}\n\nfunction stringMaskToRegExpMask(stringMask) {\n var maskReplacers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMaskReplacers;\n return maskToRegExpMask(stringMask.split(''), maskReplacers);\n}\n\nfunction arrayMaskToRegExpMask(arrayMask) {\n var maskReplacers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMaskReplacers;\n var flattenedMask = arrayMask.map(function (part) {\n if (part instanceof RegExp) {\n return part;\n }\n\n if (typeof part === 'string') {\n return part.split('');\n }\n\n return null;\n }).filter(Boolean).reduce(function (mask, part) {\n return mask.concat(part);\n }, []);\n return maskToRegExpMask(flattenedMask, maskReplacers);\n}\n\nvar trigger = function trigger(el, type) {\n var e = document.createEvent('HTMLEvents');\n e.initEvent(type, true, true);\n el.dispatchEvent(e);\n};\n\nvar queryInputElementInside = function queryInputElementInside(el) {\n return el instanceof HTMLInputElement ? el : el.querySelector('input') || el;\n};\n\nvar isFunction = function isFunction(val) {\n return typeof val === 'function';\n};\n\nvar isString = function isString(val) {\n return typeof val === 'string';\n};\n\nvar isRegexp = function isRegexp(val) {\n return val instanceof RegExp;\n};\n\nfunction parseMask(inputMask, maskReplacers) {\n if (Array.isArray(inputMask)) {\n return arrayMaskToRegExpMask(inputMask, maskReplacers);\n }\n\n if (isFunction(inputMask)) {\n return inputMask;\n }\n\n if (isString(inputMask) && inputMask.length > 0) {\n return stringMaskToRegExpMask(inputMask, maskReplacers);\n }\n\n return inputMask;\n}\n\nfunction createOptions() {\n var elementOptions = new Map();\n var defaultOptions = {\n previousValue: '',\n mask: []\n };\n\n function get(el) {\n return elementOptions.get(el) || _objectSpread2({}, defaultOptions);\n }\n\n function partiallyUpdate(el, newOptions) {\n elementOptions.set(el, _objectSpread2(_objectSpread2({}, get(el)), newOptions));\n }\n\n function remove(el) {\n elementOptions.delete(el);\n }\n\n return {\n partiallyUpdate: partiallyUpdate,\n remove: remove,\n get: get\n };\n}\n\nfunction extendMaskReplacers(maskReplacers) {\n var baseMaskReplacers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultMaskReplacers;\n\n if (maskReplacers === null || Array.isArray(maskReplacers) || _typeof(maskReplacers) !== 'object') {\n return baseMaskReplacers;\n }\n\n return Object.keys(maskReplacers).reduce(function (extendedMaskReplacers, key) {\n var value = maskReplacers[key];\n\n if (value !== null && !(value instanceof RegExp)) {\n return extendedMaskReplacers;\n }\n\n return _objectSpread2(_objectSpread2({}, extendedMaskReplacers), {}, _defineProperty({}, key, value));\n }, baseMaskReplacers);\n}\n\nvar options = createOptions();\n\nfunction triggerInputUpdate(el) {\n trigger(el, 'input');\n}\n\nfunction updateValue(el) {\n var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var value = el.value;\n\n var _options$get = options.get(el),\n previousValue = _options$get.previousValue,\n mask = _options$get.mask;\n\n var isValueChanged = value !== previousValue;\n var isLengthIncreased = value.length > previousValue.length;\n var isUpdateNeeded = value && isValueChanged && isLengthIncreased;\n\n if ((force || isUpdateNeeded) && mask) {\n var _conformToMask = conformToMask(value, mask, {\n guide: false\n }),\n conformedValue = _conformToMask.conformedValue;\n\n el.value = conformedValue;\n triggerInputUpdate(el);\n }\n\n options.partiallyUpdate(el, {\n previousValue: value\n });\n}\n\nfunction updateMask(el, inputMask, maskReplacers) {\n var mask = parseMask(inputMask, maskReplacers);\n options.partiallyUpdate(el, {\n mask: mask\n });\n}\n\nfunction maskToString(mask) {\n var maskArray = Array.isArray(mask) ? mask : [mask];\n var filteredMaskArray = maskArray.filter(function (part) {\n return isString(part) || isRegexp(part);\n });\n return filteredMaskArray.toString();\n}\n\nfunction createDirective() {\n var directiveOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var instanceMaskReplacers = extendMaskReplacers(directiveOptions && directiveOptions.placeholders);\n return {\n bind: function bind(el, _ref) {\n var value = _ref.value;\n el = queryInputElementInside(el);\n updateMask(el, value, instanceMaskReplacers);\n updateValue(el);\n },\n componentUpdated: function componentUpdated(el, _ref2) {\n var value = _ref2.value,\n oldValue = _ref2.oldValue;\n el = queryInputElementInside(el);\n var isMaskChanged = isFunction(value) || maskToString(oldValue) !== maskToString(value);\n\n if (isMaskChanged) {\n updateMask(el, value, instanceMaskReplacers);\n }\n\n updateValue(el, isMaskChanged);\n },\n unbind: function unbind(el) {\n el = queryInputElementInside(el);\n options.remove(el);\n }\n };\n}\n\nvar directive = createDirective();\n\nfunction createFilter() {\n var filterOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var instanceMaskReplacers = extendMaskReplacers(filterOptions && filterOptions.placeholders);\n return function (value, inputMask) {\n if (!isString(value) && !Number.isFinite(value)) return value;\n var mask = parseMask(inputMask, instanceMaskReplacers);\n\n var _conformToMask = conformToMask(\"\".concat(value), mask, {\n guide: false\n }),\n conformedValue = _conformToMask.conformedValue;\n\n return conformedValue;\n };\n}\n\nvar filter = createFilter();\n\nvar plugin = function plugin(Vue) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n Vue.directive('mask', createDirective(options));\n Vue.filter('VMask', createFilter(options));\n};\n\nexport { directive as VueMaskDirective, filter as VueMaskFilter, plugin as VueMaskPlugin, plugin as default };","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_c('div',{staticClass:\"row\"},[_c('div',{staticClass:\"red-text text-darken-3\"},[_vm._v(_vm._s(_vm.errorMessage))]),_vm._v(\" \"),_c('div',[_c('card-input',{attrs:{\"submit\":_vm.submit,\"reset-token\":_vm.resetToken,\"presetAddressZip\":_vm.presetAddressZip}}),_vm._v(\" \"),_c('div',{directives:[{name:\"show\",rawName:\"v-show\",value:(_vm.creatingToken),expression:\"creatingToken\"}],staticClass:\"center\"},[_c('i',{staticClass:\"fas fa-spinner fa-spin grey-text\"}),_vm._v(\"\\n Verifying data\\n \")])],1)])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","import mod from \"-!../../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./public_generic_card_element.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../../../shared/node_modules/babel-loader/lib/index.js??ref--8-0!../../../../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./public_generic_card_element.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./public_generic_card_element.vue?vue&type=template&id=bd462db0&\"\nimport script from \"./public_generic_card_element.vue?vue&type=script&lang=js&\"\nexport * from \"./public_generic_card_element.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../../../shared/node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/*!\n * Signature Pad v3.0.0-beta.4 | https://github.com/szimek/signature_pad\n * (c) 2020 Szymon Nowak | Released under the MIT license\n */\nvar Point = /*#__PURE__*/function () {\n function Point(x, y, time) {\n _classCallCheck(this, Point);\n\n this.x = x;\n this.y = y;\n this.time = time || Date.now();\n }\n\n _createClass(Point, [{\n key: \"distanceTo\",\n value: function distanceTo(start) {\n return Math.sqrt(Math.pow(this.x - start.x, 2) + Math.pow(this.y - start.y, 2));\n }\n }, {\n key: \"equals\",\n value: function equals(other) {\n return this.x === other.x && this.y === other.y && this.time === other.time;\n }\n }, {\n key: \"velocityFrom\",\n value: function velocityFrom(start) {\n return this.time !== start.time ? this.distanceTo(start) / (this.time - start.time) : 0;\n }\n }]);\n\n return Point;\n}();\n\nvar Bezier = /*#__PURE__*/function () {\n function Bezier(startPoint, control2, control1, endPoint, startWidth, endWidth) {\n _classCallCheck(this, Bezier);\n\n this.startPoint = startPoint;\n this.control2 = control2;\n this.control1 = control1;\n this.endPoint = endPoint;\n this.startWidth = startWidth;\n this.endWidth = endWidth;\n }\n\n _createClass(Bezier, [{\n key: \"length\",\n value: function length() {\n var steps = 10;\n var length = 0;\n var px;\n var py;\n\n for (var i = 0; i <= steps; i += 1) {\n var t = i / steps;\n var cx = this.point(t, this.startPoint.x, this.control1.x, this.control2.x, this.endPoint.x);\n var cy = this.point(t, this.startPoint.y, this.control1.y, this.control2.y, this.endPoint.y);\n\n if (i > 0) {\n var xdiff = cx - px;\n var ydiff = cy - py;\n length += Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n }\n\n px = cx;\n py = cy;\n }\n\n return length;\n }\n }, {\n key: \"point\",\n value: function point(t, start, c1, c2, end) {\n return start * (1.0 - t) * (1.0 - t) * (1.0 - t) + 3.0 * c1 * (1.0 - t) * (1.0 - t) * t + 3.0 * c2 * (1.0 - t) * t * t + end * t * t * t;\n }\n }], [{\n key: \"fromPoints\",\n value: function fromPoints(points, widths) {\n var c2 = this.calculateControlPoints(points[0], points[1], points[2]).c2;\n var c3 = this.calculateControlPoints(points[1], points[2], points[3]).c1;\n return new Bezier(points[1], c2, c3, points[2], widths.start, widths.end);\n }\n }, {\n key: \"calculateControlPoints\",\n value: function calculateControlPoints(s1, s2, s3) {\n var dx1 = s1.x - s2.x;\n var dy1 = s1.y - s2.y;\n var dx2 = s2.x - s3.x;\n var dy2 = s2.y - s3.y;\n var m1 = {\n x: (s1.x + s2.x) / 2.0,\n y: (s1.y + s2.y) / 2.0\n };\n var m2 = {\n x: (s2.x + s3.x) / 2.0,\n y: (s2.y + s3.y) / 2.0\n };\n var l1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);\n var l2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);\n var dxm = m1.x - m2.x;\n var dym = m1.y - m2.y;\n var k = l2 / (l1 + l2);\n var cm = {\n x: m2.x + dxm * k,\n y: m2.y + dym * k\n };\n var tx = s2.x - cm.x;\n var ty = s2.y - cm.y;\n return {\n c1: new Point(m1.x + tx, m1.y + ty),\n c2: new Point(m2.x + tx, m2.y + ty)\n };\n }\n }]);\n\n return Bezier;\n}();\n\nfunction throttle(fn) {\n var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;\n var previous = 0;\n var timeout = null;\n var result;\n var storedContext;\n var storedArgs;\n\n var later = function later() {\n previous = Date.now();\n timeout = null;\n result = fn.apply(storedContext, storedArgs);\n\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n };\n\n return function wrapper() {\n var now = Date.now();\n var remaining = wait - (now - previous);\n storedContext = this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n storedArgs = args;\n\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n\n previous = now;\n result = fn.apply(storedContext, storedArgs);\n\n if (!timeout) {\n storedContext = null;\n storedArgs = [];\n }\n } else if (!timeout) {\n timeout = window.setTimeout(later, remaining);\n }\n\n return result;\n };\n}\n\nvar SignaturePad = /*#__PURE__*/function () {\n function SignaturePad(canvas) {\n var _this = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n _classCallCheck(this, SignaturePad);\n\n this.canvas = canvas;\n this.options = options;\n\n this._handleMouseDown = function (event) {\n if (event.which === 1) {\n _this._mouseButtonDown = true;\n\n _this._strokeBegin(event);\n }\n };\n\n this._handleMouseMove = function (event) {\n if (_this._mouseButtonDown) {\n _this._strokeMoveUpdate(event);\n }\n };\n\n this._handleMouseUp = function (event) {\n if (event.which === 1 && _this._mouseButtonDown) {\n _this._mouseButtonDown = false;\n\n _this._strokeEnd(event);\n }\n };\n\n this._handleTouchStart = function (event) {\n event.preventDefault();\n\n if (event.targetTouches.length === 1) {\n var touch = event.changedTouches[0];\n\n _this._strokeBegin(touch);\n }\n };\n\n this._handleTouchMove = function (event) {\n event.preventDefault();\n var touch = event.targetTouches[0];\n\n _this._strokeMoveUpdate(touch);\n };\n\n this._handleTouchEnd = function (event) {\n var wasCanvasTouched = event.target === _this.canvas;\n\n if (wasCanvasTouched) {\n event.preventDefault();\n var touch = event.changedTouches[0];\n\n _this._strokeEnd(touch);\n }\n };\n\n this.velocityFilterWeight = options.velocityFilterWeight || 0.7;\n this.minWidth = options.minWidth || 0.5;\n this.maxWidth = options.maxWidth || 2.5;\n this.throttle = 'throttle' in options ? options.throttle : 16;\n this.minDistance = 'minDistance' in options ? options.minDistance : 5;\n\n this.dotSize = options.dotSize || function dotSize() {\n return (this.minWidth + this.maxWidth) / 2;\n };\n\n this.penColor = options.penColor || 'black';\n this.backgroundColor = options.backgroundColor || 'rgba(0,0,0,0)';\n this.onBegin = options.onBegin;\n this.onEnd = options.onEnd;\n this._strokeMoveUpdate = this.throttle ? throttle(SignaturePad.prototype._strokeUpdate, this.throttle) : SignaturePad.prototype._strokeUpdate;\n this._ctx = canvas.getContext('2d');\n this.clear();\n this.on();\n }\n\n _createClass(SignaturePad, [{\n key: \"clear\",\n value: function clear() {\n var ctx = this._ctx,\n canvas = this.canvas;\n ctx.fillStyle = this.backgroundColor;\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n this._data = [];\n\n this._reset();\n\n this._isEmpty = true;\n }\n }, {\n key: \"fromDataURL\",\n value: function fromDataURL(dataUrl) {\n var _this2 = this;\n\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var image = new Image();\n var ratio = options.ratio || window.devicePixelRatio || 1;\n var width = options.width || this.canvas.width / ratio;\n var height = options.height || this.canvas.height / ratio;\n\n this._reset();\n\n image.onload = function () {\n _this2._ctx.drawImage(image, 0, 0, width, height);\n\n if (callback) {\n callback();\n }\n };\n\n image.onerror = function (error) {\n if (callback) {\n callback(error);\n }\n };\n\n image.src = dataUrl;\n this._isEmpty = false;\n }\n }, {\n key: \"toDataURL\",\n value: function toDataURL() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'image/png';\n var encoderOptions = arguments.length > 1 ? arguments[1] : undefined;\n\n switch (type) {\n case 'image/svg+xml':\n return this._toSVG();\n\n default:\n return this.canvas.toDataURL(type, encoderOptions);\n }\n }\n }, {\n key: \"on\",\n value: function on() {\n this.canvas.style.touchAction = 'none';\n this.canvas.style.msTouchAction = 'none';\n\n if (window.PointerEvent) {\n this._handlePointerEvents();\n } else {\n this._handleMouseEvents();\n\n if ('ontouchstart' in window) {\n this._handleTouchEvents();\n }\n }\n }\n }, {\n key: \"off\",\n value: function off() {\n this.canvas.style.touchAction = 'auto';\n this.canvas.style.msTouchAction = 'auto';\n this.canvas.removeEventListener('pointerdown', this._handleMouseDown);\n this.canvas.removeEventListener('pointermove', this._handleMouseMove);\n document.removeEventListener('pointerup', this._handleMouseUp);\n this.canvas.removeEventListener('mousedown', this._handleMouseDown);\n this.canvas.removeEventListener('mousemove', this._handleMouseMove);\n document.removeEventListener('mouseup', this._handleMouseUp);\n this.canvas.removeEventListener('touchstart', this._handleTouchStart);\n this.canvas.removeEventListener('touchmove', this._handleTouchMove);\n this.canvas.removeEventListener('touchend', this._handleTouchEnd);\n }\n }, {\n key: \"isEmpty\",\n value: function isEmpty() {\n return this._isEmpty;\n }\n }, {\n key: \"fromData\",\n value: function fromData(pointGroups) {\n var _this3 = this;\n\n this.clear();\n\n this._fromData(pointGroups, function (_ref) {\n var color = _ref.color,\n curve = _ref.curve;\n return _this3._drawCurve({\n color: color,\n curve: curve\n });\n }, function (_ref2) {\n var color = _ref2.color,\n point = _ref2.point;\n return _this3._drawDot({\n color: color,\n point: point\n });\n });\n\n this._data = pointGroups;\n }\n }, {\n key: \"toData\",\n value: function toData() {\n return this._data;\n }\n }, {\n key: \"_strokeBegin\",\n value: function _strokeBegin(event) {\n var newPointGroup = {\n color: this.penColor,\n points: []\n };\n\n if (typeof this.onBegin === 'function') {\n this.onBegin(event);\n }\n\n this._data.push(newPointGroup);\n\n this._reset();\n\n this._strokeUpdate(event);\n }\n }, {\n key: \"_strokeUpdate\",\n value: function _strokeUpdate(event) {\n if (this._data.length === 0) {\n this._strokeBegin(event);\n\n return;\n }\n\n var x = event.clientX;\n var y = event.clientY;\n\n var point = this._createPoint(x, y);\n\n var lastPointGroup = this._data[this._data.length - 1];\n var lastPoints = lastPointGroup.points;\n var lastPoint = lastPoints.length > 0 && lastPoints[lastPoints.length - 1];\n var isLastPointTooClose = lastPoint ? point.distanceTo(lastPoint) <= this.minDistance : false;\n var color = lastPointGroup.color;\n\n if (!lastPoint || !(lastPoint && isLastPointTooClose)) {\n var curve = this._addPoint(point);\n\n if (!lastPoint) {\n this._drawDot({\n color: color,\n point: point\n });\n } else if (curve) {\n this._drawCurve({\n color: color,\n curve: curve\n });\n }\n\n lastPoints.push({\n time: point.time,\n x: point.x,\n y: point.y\n });\n }\n }\n }, {\n key: \"_strokeEnd\",\n value: function _strokeEnd(event) {\n this._strokeUpdate(event);\n\n if (typeof this.onEnd === 'function') {\n this.onEnd(event);\n }\n }\n }, {\n key: \"_handlePointerEvents\",\n value: function _handlePointerEvents() {\n this._mouseButtonDown = false;\n this.canvas.addEventListener('pointerdown', this._handleMouseDown);\n this.canvas.addEventListener('pointermove', this._handleMouseMove);\n document.addEventListener('pointerup', this._handleMouseUp);\n }\n }, {\n key: \"_handleMouseEvents\",\n value: function _handleMouseEvents() {\n this._mouseButtonDown = false;\n this.canvas.addEventListener('mousedown', this._handleMouseDown);\n this.canvas.addEventListener('mousemove', this._handleMouseMove);\n document.addEventListener('mouseup', this._handleMouseUp);\n }\n }, {\n key: \"_handleTouchEvents\",\n value: function _handleTouchEvents() {\n this.canvas.addEventListener('touchstart', this._handleTouchStart);\n this.canvas.addEventListener('touchmove', this._handleTouchMove);\n this.canvas.addEventListener('touchend', this._handleTouchEnd);\n }\n }, {\n key: \"_reset\",\n value: function _reset() {\n this._lastPoints = [];\n this._lastVelocity = 0;\n this._lastWidth = (this.minWidth + this.maxWidth) / 2;\n this._ctx.fillStyle = this.penColor;\n }\n }, {\n key: \"_createPoint\",\n value: function _createPoint(x, y) {\n var rect = this.canvas.getBoundingClientRect();\n return new Point(x - rect.left, y - rect.top, new Date().getTime());\n }\n }, {\n key: \"_addPoint\",\n value: function _addPoint(point) {\n var _lastPoints = this._lastPoints;\n\n _lastPoints.push(point);\n\n if (_lastPoints.length > 2) {\n if (_lastPoints.length === 3) {\n _lastPoints.unshift(_lastPoints[0]);\n }\n\n var widths = this._calculateCurveWidths(_lastPoints[1], _lastPoints[2]);\n\n var curve = Bezier.fromPoints(_lastPoints, widths);\n\n _lastPoints.shift();\n\n return curve;\n }\n\n return null;\n }\n }, {\n key: \"_calculateCurveWidths\",\n value: function _calculateCurveWidths(startPoint, endPoint) {\n var velocity = this.velocityFilterWeight * endPoint.velocityFrom(startPoint) + (1 - this.velocityFilterWeight) * this._lastVelocity;\n\n var newWidth = this._strokeWidth(velocity);\n\n var widths = {\n end: newWidth,\n start: this._lastWidth\n };\n this._lastVelocity = velocity;\n this._lastWidth = newWidth;\n return widths;\n }\n }, {\n key: \"_strokeWidth\",\n value: function _strokeWidth(velocity) {\n return Math.max(this.maxWidth / (velocity + 1), this.minWidth);\n }\n }, {\n key: \"_drawCurveSegment\",\n value: function _drawCurveSegment(x, y, width) {\n var ctx = this._ctx;\n ctx.moveTo(x, y);\n ctx.arc(x, y, width, 0, 2 * Math.PI, false);\n this._isEmpty = false;\n }\n }, {\n key: \"_drawCurve\",\n value: function _drawCurve(_ref3) {\n var color = _ref3.color,\n curve = _ref3.curve;\n var ctx = this._ctx;\n var widthDelta = curve.endWidth - curve.startWidth;\n var drawSteps = Math.floor(curve.length()) * 2;\n ctx.beginPath();\n ctx.fillStyle = color;\n\n for (var i = 0; i < drawSteps; i += 1) {\n var t = i / drawSteps;\n var tt = t * t;\n var ttt = tt * t;\n var u = 1 - t;\n var uu = u * u;\n var uuu = uu * u;\n var x = uuu * curve.startPoint.x;\n x += 3 * uu * t * curve.control1.x;\n x += 3 * u * tt * curve.control2.x;\n x += ttt * curve.endPoint.x;\n var y = uuu * curve.startPoint.y;\n y += 3 * uu * t * curve.control1.y;\n y += 3 * u * tt * curve.control2.y;\n y += ttt * curve.endPoint.y;\n var width = Math.min(curve.startWidth + ttt * widthDelta, this.maxWidth);\n\n this._drawCurveSegment(x, y, width);\n }\n\n ctx.closePath();\n ctx.fill();\n }\n }, {\n key: \"_drawDot\",\n value: function _drawDot(_ref4) {\n var color = _ref4.color,\n point = _ref4.point;\n var ctx = this._ctx;\n var width = typeof this.dotSize === 'function' ? this.dotSize() : this.dotSize;\n ctx.beginPath();\n\n this._drawCurveSegment(point.x, point.y, width);\n\n ctx.closePath();\n ctx.fillStyle = color;\n ctx.fill();\n }\n }, {\n key: \"_fromData\",\n value: function _fromData(pointGroups, drawCurve, drawDot) {\n var _iterator = _createForOfIteratorHelper(pointGroups),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var group = _step.value;\n var color = group.color,\n points = group.points;\n\n if (points.length > 1) {\n for (var j = 0; j < points.length; j += 1) {\n var basicPoint = points[j];\n var point = new Point(basicPoint.x, basicPoint.y, basicPoint.time);\n this.penColor = color;\n\n if (j === 0) {\n this._reset();\n }\n\n var curve = this._addPoint(point);\n\n if (curve) {\n drawCurve({\n color: color,\n curve: curve\n });\n }\n }\n } else {\n this._reset();\n\n drawDot({\n color: color,\n point: points[0]\n });\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n }, {\n key: \"_toSVG\",\n value: function _toSVG() {\n var _this4 = this;\n\n var pointGroups = this._data;\n var ratio = Math.max(window.devicePixelRatio || 1, 1);\n var minX = 0;\n var minY = 0;\n var maxX = this.canvas.width / ratio;\n var maxY = this.canvas.height / ratio;\n var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n svg.setAttribute('width', this.canvas.width.toString());\n svg.setAttribute('height', this.canvas.height.toString());\n\n this._fromData(pointGroups, function (_ref5) {\n var color = _ref5.color,\n curve = _ref5.curve;\n var path = document.createElement('path');\n\n if (!isNaN(curve.control1.x) && !isNaN(curve.control1.y) && !isNaN(curve.control2.x) && !isNaN(curve.control2.y)) {\n var attr = \"M \".concat(curve.startPoint.x.toFixed(3), \",\").concat(curve.startPoint.y.toFixed(3), \" \") + \"C \".concat(curve.control1.x.toFixed(3), \",\").concat(curve.control1.y.toFixed(3), \" \") + \"\".concat(curve.control2.x.toFixed(3), \",\").concat(curve.control2.y.toFixed(3), \" \") + \"\".concat(curve.endPoint.x.toFixed(3), \",\").concat(curve.endPoint.y.toFixed(3));\n path.setAttribute('d', attr);\n path.setAttribute('stroke-width', (curve.endWidth * 2.25).toFixed(3));\n path.setAttribute('stroke', color);\n path.setAttribute('fill', 'none');\n path.setAttribute('stroke-linecap', 'round');\n svg.appendChild(path);\n }\n }, function (_ref6) {\n var color = _ref6.color,\n point = _ref6.point;\n var circle = document.createElement('circle');\n var dotSize = typeof _this4.dotSize === 'function' ? _this4.dotSize() : _this4.dotSize;\n circle.setAttribute('r', dotSize.toString());\n circle.setAttribute('cx', point.x.toString());\n circle.setAttribute('cy', point.y.toString());\n circle.setAttribute('fill', color);\n svg.appendChild(circle);\n });\n\n var prefix = 'data:image/svg+xml;base64,';\n var header = '';\n var data = header + body + footer;\n return prefix + btoa(data);\n }\n }]);\n\n return SignaturePad;\n}();\n\nexport default SignaturePad;","// Defaults\nvar defaultOptions = {\n format: 'image/png',\n quality: 0.92,\n width: undefined,\n height: undefined,\n Canvas: undefined,\n crossOrigin: undefined\n}; // Return Promise\n\nvar mergeImages = function mergeImages(sources, options) {\n if (sources === void 0) sources = [];\n if (options === void 0) options = {};\n return new Promise(function (resolve) {\n options = Object.assign({}, defaultOptions, options); // Setup browser/Node.js specific variables\n\n var canvas = options.Canvas ? new options.Canvas() : window.document.createElement('canvas');\n var Image = options.Canvas ? options.Canvas.Image : window.Image;\n\n if (options.Canvas) {\n options.quality *= 100;\n } // Load sources\n\n\n var images = sources.map(function (source) {\n return new Promise(function (resolve, reject) {\n // Convert sources to objects\n if (source.constructor.name !== 'Object') {\n source = {\n src: source\n };\n } // Resolve source and img when loaded\n\n\n var img = new Image();\n img.crossOrigin = options.crossOrigin;\n\n img.onerror = function () {\n return reject(new Error('Couldn\\'t load image'));\n };\n\n img.onload = function () {\n return resolve(Object.assign({}, source, {\n img: img\n }));\n };\n\n img.src = source.src;\n });\n }); // Get canvas context\n\n var ctx = canvas.getContext('2d'); // When sources have loaded\n\n resolve(Promise.all(images).then(function (images) {\n // Set canvas dimensions\n var getSize = function getSize(dim) {\n return options[dim] || Math.max.apply(Math, images.map(function (image) {\n return image.img[dim];\n }));\n };\n\n canvas.width = getSize('width');\n canvas.height = getSize('height'); // Draw images to canvas\n\n images.forEach(function (image) {\n ctx.globalAlpha = image.opacity ? image.opacity : 1;\n return ctx.drawImage(image.img, image.x || 0, image.y || 0);\n });\n\n if (options.Canvas && options.format === 'image/jpeg') {\n // Resolve data URI for node-canvas jpeg async\n return new Promise(function (resolve) {\n canvas.toDataURL(options.format, {\n quality: options.quality,\n progressive: false\n }, function (err, jpeg) {\n if (err) {\n throw err;\n }\n\n resolve(jpeg);\n });\n });\n } // Resolve all other data URIs sync\n\n\n return canvas.toDataURL(options.format, options.quality);\n }));\n });\n};\n\nexport default mergeImages;","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport SignaturePad from 'signature_pad';\nimport mergeImages from 'merge-images';\nvar IMAGE_TYPES = ['image/png', 'image/jpeg', 'image/svg+xml'];\n\nvar checkSaveType = function checkSaveType(type) {\n return IMAGE_TYPES.includes(type);\n};\n\nvar DEFAULT_OPTIONS = {\n dotSize: (0.5 + 2.5) / 2,\n minWidth: 0.5,\n maxWidth: 2.5,\n throttle: 16,\n minDistance: 5,\n backgroundColor: 'rgba(0,0,0,0)',\n penColor: 'black',\n velocityFilterWeight: 0.7,\n onBegin: function onBegin() {},\n onEnd: function onEnd() {}\n};\n\nvar convert2NonReactive = function convert2NonReactive(observerValue) {\n return JSON.parse(JSON.stringify(observerValue));\n};\n\nvar TRANSPARENT_PNG = {\n src: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=',\n x: 0,\n y: 0\n};\nvar script = {\n name: 'VueSignaturePad',\n props: {\n width: {\n type: String,\n default: '100%'\n },\n height: {\n type: String,\n default: '100%'\n },\n customStyle: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n options: {\n type: Object,\n default: function _default() {\n return {};\n }\n },\n images: {\n type: Array,\n default: function _default() {\n return [];\n }\n }\n },\n data: function data() {\n return {\n signaturePad: {},\n cacheImages: [],\n signatureData: TRANSPARENT_PNG,\n onResizeHandler: null\n };\n },\n computed: {\n propsImagesAndCustomImages: function propsImagesAndCustomImages() {\n var nonReactiveProrpImages = convert2NonReactive(this.images);\n var nonReactiveCachImages = convert2NonReactive(this.cacheImages);\n return [].concat(_toConsumableArray(nonReactiveProrpImages), _toConsumableArray(nonReactiveCachImages));\n }\n },\n watch: {\n options: function options(nextOptions) {\n var _this = this;\n\n Object.keys(nextOptions).forEach(function (option) {\n if (_this.signaturePad[option]) {\n _this.signaturePad[option] = nextOptions[option];\n }\n });\n }\n },\n mounted: function mounted() {\n var options = this.options;\n var canvas = this.$refs.signaturePadCanvas;\n var signaturePad = new SignaturePad(canvas, _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options));\n this.signaturePad = signaturePad;\n\n if (options.resizeHandler) {\n this.resizeCanvas = options.resizeHandler.bind(this);\n }\n\n this.onResizeHandler = this.resizeCanvas.bind(this);\n window.addEventListener('resize', this.onResizeHandler, false);\n this.resizeCanvas();\n },\n beforeDestroy: function beforeDestroy() {\n if (this.onResizeHandler) {\n window.removeEventListener('resize', this.onResizeHandler, false);\n }\n },\n methods: {\n resizeCanvas: function resizeCanvas() {\n var canvas = this.$refs.signaturePadCanvas;\n var data = this.signaturePad.toData();\n var ratio = Math.max(window.devicePixelRatio || 1, 1);\n canvas.width = canvas.offsetWidth * ratio;\n canvas.height = canvas.offsetHeight * ratio;\n canvas.getContext('2d').scale(ratio, ratio);\n this.signaturePad.clear();\n this.signatureData = TRANSPARENT_PNG;\n this.signaturePad.fromData(data);\n },\n saveSignature: function saveSignature() {\n var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : IMAGE_TYPES[0];\n var encoderOptions = arguments.length > 1 ? arguments[1] : undefined;\n var signaturePad = this.signaturePad;\n var status = {\n isEmpty: false,\n data: undefined\n };\n\n if (!checkSaveType(type)) {\n var imageTypesString = IMAGE_TYPES.join(', ');\n throw new Error(\"The Image type is incorrect! We are support \".concat(imageTypesString, \" types.\"));\n }\n\n if (signaturePad.isEmpty()) {\n return _objectSpread(_objectSpread({}, status), {}, {\n isEmpty: true\n });\n } else {\n this.signatureData = signaturePad.toDataURL(type, encoderOptions);\n return _objectSpread(_objectSpread({}, status), {}, {\n data: this.signatureData\n });\n }\n },\n undoSignature: function undoSignature() {\n var signaturePad = this.signaturePad;\n var record = signaturePad.toData();\n\n if (record) {\n return signaturePad.fromData(record.slice(0, -1));\n }\n },\n mergeImageAndSignature: function mergeImageAndSignature(customSignature) {\n this.signatureData = customSignature;\n return mergeImages([].concat(_toConsumableArray(this.images), _toConsumableArray(this.cacheImages), [this.signatureData]));\n },\n addImages: function addImages() {\n var images = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n this.cacheImages = [].concat(_toConsumableArray(this.cacheImages), _toConsumableArray(images));\n return mergeImages([].concat(_toConsumableArray(this.images), _toConsumableArray(this.cacheImages), [this.signatureData]));\n },\n fromDataURL: function fromDataURL(data) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n return this.signaturePad.fromDataURL(data, options, callback);\n },\n fromData: function fromData(data) {\n return this.signaturePad.fromData(data);\n },\n toData: function toData() {\n return this.signaturePad.toData();\n },\n lockSignaturePad: function lockSignaturePad() {\n return this.signaturePad.off();\n },\n openSignaturePad: function openSignaturePad() {\n return this.signaturePad.on();\n },\n isEmpty: function isEmpty() {\n return this.signaturePad.isEmpty();\n },\n getPropImagesAndCacheImages: function getPropImagesAndCacheImages() {\n return this.propsImagesAndCustomImages;\n },\n clearCacheImages: function clearCacheImages() {\n this.cacheImages = [];\n return this.cacheImages;\n },\n clearSignature: function clearSignature() {\n return this.signaturePad.clear();\n }\n },\n render: function render(createElement) {\n var width = this.width,\n height = this.height,\n customStyle = this.customStyle;\n return createElement('div', {\n style: _objectSpread({\n width: width,\n height: height\n }, customStyle)\n }, [createElement('canvas', {\n style: {\n width: width,\n height: height\n },\n ref: 'signaturePadCanvas'\n })]);\n }\n};\n\nfunction normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier\n/* server only */\n, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {\n if (typeof shadowMode !== 'boolean') {\n createInjectorSSR = createInjector;\n createInjector = shadowMode;\n shadowMode = false;\n } // Vue.extend constructor export interop.\n\n\n var options = typeof script === 'function' ? script.options : script; // render functions\n\n if (template && template.render) {\n options.render = template.render;\n options.staticRenderFns = template.staticRenderFns;\n options._compiled = true; // functional template\n\n if (isFunctionalTemplate) {\n options.functional = true;\n }\n } // scopedId\n\n\n if (scopeId) {\n options._scopeId = scopeId;\n }\n\n var hook;\n\n if (moduleIdentifier) {\n // server build\n hook = function hook(context) {\n // 2.3 injection\n context = context || // cached call\n this.$vnode && this.$vnode.ssrContext || // stateful\n this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; // functional\n // 2.2 with runInNewContext: true\n\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__;\n } // inject component styles\n\n\n if (style) {\n style.call(this, createInjectorSSR(context));\n } // register component module identifier for async chunk inference\n\n\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier);\n }\n }; // used by ssr in case component is cached and beforeCreate\n // never gets called\n\n\n options._ssrRegister = hook;\n } else if (style) {\n hook = shadowMode ? function (context) {\n style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));\n } : function (context) {\n style.call(this, createInjector(context));\n };\n }\n\n if (hook) {\n if (options.functional) {\n // register for functional component in vue file\n var originalRender = options.render;\n\n options.render = function renderWithStyleInjection(h, context) {\n hook.call(context);\n return originalRender(h, context);\n };\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate;\n options.beforeCreate = existing ? [].concat(existing, hook) : [hook];\n }\n }\n\n return script;\n}\n/* script */\n\n\nvar __vue_script__ = script;\n/* template */\n\n/* style */\n\nvar __vue_inject_styles__ = undefined;\n/* scoped */\n\nvar __vue_scope_id__ = undefined;\n/* module identifier */\n\nvar __vue_module_identifier__ = undefined;\n/* functional template */\n\nvar __vue_is_functional_template__ = undefined;\n/* style inject */\n\n/* style inject SSR */\n\n/* style inject shadow dom */\n\nvar __vue_component__ = /*#__PURE__*/normalizeComponent({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);\n\nvar components = /*#__PURE__*/Object.freeze({\n __proto__: null,\n VueSignaturePad: __vue_component__\n});\n\nvar install = function installVSignature(Vue) {\n Object.entries(components).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n componentName = _ref2[0],\n component = _ref2[1];\n\n Vue.component(componentName, component);\n });\n};\n\nexport default install;\nexport { __vue_component__ as VueSignaturePad };","import sendBill from \"./en/send_bill\"\nimport vote from \"./en/vote\"\n\nexport default {\n sendBill: sendBill,\n vote: vote\n}\n","export default {\n payment: \"Payment\",\n to: \"to\",\n changeLanguage: \"Cambiar el idioma\",\n checkByPhoto: \"Check by photo\",\n replace: \"Replace\",\n pleaseConfirmCheckAmount: \"Please confirm check amount is equal to {amount} and submit\",\n confirmCheckAmountAndSubmit: \"Confirm {amount} & submit\",\n submittedSuccessfully: \"Submitted successully\",\n // Pay by card\n payWithCard: \"Pay with Credit Card\",\n payWithAch: \"Bank Transfer\",\n fillInCardDetails: \"Fill in card details\",\n pleaseSignHere: \"Please sign here\",\n pleaseSignHereAutoSubmit: \"Please sign here (will submit the form)\",\n noTip: \"No tip\",\n agreePayAboveAmount: \"I agree to pay the above amount\",\n agreePayAboveAmountFirst: \"I agree with\",\n agreePayAboveAmountUrl: \"company policy\",\n agreePayAboveAmountLast: \"and to pay the above amount, which is non-refundable\",\n grossAmount: \"Gross amount\",\n nonCashAdj: \"Non-cash adj\",\n pay: \"Pay\",\n processing: \"Processing...\",\n loading: \"Loading...\",\n couldNotProcess: \"You could not process payment for this order\",\n noPaymentMethod: \"Please reach out to the merchant. No active payment methods available\",\n buyNowPayLaterButton: \"Buy now pay later (Klarna)\",\n withTipAmount: \"Amount with tip\",\n firstName: \"First name\",\n lastName: \"Last name\",\n routing: \"Routing\",\n accountNumber: \"Account number\"\n}\n","export default {\n howDidWeDoToday: \"How did we do today?\",\n whatTheBadReason: \"What is the main reason you are not satisfied?\",\n whatTheGoodReason: \"Please share your happy experiences\",\n shareFeedback: \"Share your feedback\",\n leaveReview: \"Would you like to leave review?\",\n yes: \"Yes\",\n no: \"No\",\n showSuccess: \"Thanks for the feedback\",\n redirecting: \"Redirecting...\"\n}\n\n","import sendBill from \"./es/send_bill\"\nimport vote from \"./es/vote\"\n\nexport default {\n sendBill: sendBill,\n vote: vote\n}\n","export default {\n payment: \"Pago\",\n to: \"al\",\n changeLanguage: \"Change language\",\n checkByPhoto: \"Cheque por foto\",\n replace: \"Reemplace\",\n pleaseConfirmCheckAmount: \"Confirme que el monto del cheque sea igual a {amount} y envíelo\",\n confirmCheckAmountAndSubmit: \"Confirmar {amount} y enviar\",\n submittedSuccessfully: \"Enviado con éxito\",\n // Pay by card\n payWithCard: \"Paga con tarjeta\",\n payWithAch: \"Transferencia Bancaria\",\n fillInCardDetails: \"Rellene los datos de la tarjeta\",\n pleaseSignHere: \"Firme aquí por favor\",\n pleaseSignHereAutoSubmit: \"Firme aquí (se enviará el formulario)\",\n noTip: \"Sin propina\",\n agreePayAboveAmount: \"Estoy de acuerdo en pagar la cantidad anterior\",\n agreePayAboveAmountFirst: \"Estoy de acuerdo con\",\n agreePayAboveAmountUrl: \"política de la compañía\",\n agreePayAboveAmountLast: \"y a abonar el importe anterior, que no es reembolsable\",\n grossAmount: \"Cantidad bruta\",\n nonCashAdj: \"Ajuste no en efectivo\",\n pay: \"Pagar\",\n processing: \"Procesando...\",\n loading: \"Cargando...\",\n couldNotProcess: \"No se ha podido procesar el pago de este pedido\",\n noPaymentMethod: \"Póngase en contacto con el comerciante. No hay métodos de pago activos disponibles\",\n buyNowPayLaterButton: \"Compra y paga luego (Klarna)\",\n withTipAmount: \"Importe total con propinas\",\n firstName: \"Nombre\",\n lastName: \"Apellido\",\n routing: \"Número de ruta\",\n accountNumber: \"Número de cuenta\"\n}\n","export default {\n howDidWeDoToday: \"¿Cómo nos ha ido hoy?\",\n whatTheBadReason: \"¿Cuál es la principal razón por la que no está satisfecho?\",\n whatTheGoodReason: \"Por favor, comparta sus experiencias felices\",\n shareFeedback: \"Comparta su opinión\",\n leaveReview: \"¿Quiere dejar su opinión?\",\n yes: \"Sí\",\n no: \"No\",\n showSuccess: \"Gracias por la respuesta\",\n redirecting: \"Redirigiendo...\"\n}\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n } // Copy function arguments\n\n\n var args = new Array(arguments.length - 1);\n\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n } // Store and register the task\n\n\n var task = {\n callback: callback,\n args: args\n };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n\n switch (args.length) {\n case 0:\n callback();\n break;\n\n case 1:\n callback(args[0]);\n break;\n\n case 2:\n callback(args[0], args[1]);\n break;\n\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n\n if (task) {\n currentlyRunningATask = true;\n\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function registerImmediate(handle) {\n process.nextTick(function () {\n runIfPresent(handle);\n });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n\n global.onmessage = function () {\n postMessageIsAsynchronous = false;\n };\n\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n\n var onGlobalMessage = function onGlobalMessage(event) {\n if (event.source === global && typeof event.data === \"string\" && event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function registerImmediate(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n\n channel.port1.onmessage = function (event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function registerImmediate(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n\n registerImmediate = function registerImmediate(handle) {\n // Create a \n","/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\nexport function dedentBlockStringValue(rawString) {\n // Expand a block string's raw value into independent lines.\n var lines = rawString.split(/\\r\\n|[\\n\\r]/g); // Remove common indentation from all lines but first.\n\n var commonIndent = getBlockStringIndentation(rawString);\n\n if (commonIndent !== 0) {\n for (var i = 1; i < lines.length; i++) {\n lines[i] = lines[i].slice(commonIndent);\n }\n } // Remove leading and trailing blank lines.\n\n\n var startLine = 0;\n\n while (startLine < lines.length && isBlank(lines[startLine])) {\n ++startLine;\n }\n\n var endLine = lines.length;\n\n while (endLine > startLine && isBlank(lines[endLine - 1])) {\n --endLine;\n } // Return a string of the lines joined with U+000A.\n\n\n return lines.slice(startLine, endLine).join('\\n');\n}\n\nfunction isBlank(str) {\n for (var i = 0; i < str.length; ++i) {\n if (str[i] !== ' ' && str[i] !== '\\t') {\n return false;\n }\n }\n\n return true;\n}\n/**\n * @internal\n */\n\n\nexport function getBlockStringIndentation(value) {\n var _commonIndent;\n\n var isFirstLine = true;\n var isEmptyLine = true;\n var indent = 0;\n var commonIndent = null;\n\n for (var i = 0; i < value.length; ++i) {\n switch (value.charCodeAt(i)) {\n case 13:\n // \\r\n if (value.charCodeAt(i + 1) === 10) {\n ++i; // skip \\r\\n as one symbol\n }\n\n // falls through\n\n case 10:\n // \\n\n isFirstLine = false;\n isEmptyLine = true;\n indent = 0;\n break;\n\n case 9: // \\t\n\n case 32:\n // \n ++indent;\n break;\n\n default:\n if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {\n commonIndent = indent;\n }\n\n isEmptyLine = false;\n }\n }\n\n return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value) {\n var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var isSingleLine = value.indexOf('\\n') === -1;\n var hasLeadingSpace = value[0] === ' ' || value[0] === '\\t';\n var hasTrailingQuote = value[value.length - 1] === '\"';\n var hasTrailingSlash = value[value.length - 1] === '\\\\';\n var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines;\n var result = ''; // Format a multi-line block quote to account for leading space.\n\n if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {\n result += '\\n' + indentation;\n }\n\n result += indentation ? value.replace(/\\n/g, '\\n' + indentation) : value;\n\n if (printAsMultipleLines) {\n result += '\\n';\n }\n\n return '\"\"\"' + result.replace(/\"\"\"/g, '\\\\\"\"\"') + '\"\"\"';\n}","export default function _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}","import defineProperty from \"./defineProperty.js\";\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n\n if (enumerableOnly) {\n symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n }\n\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nexports.default = function (vueInst, googleMapsInst, events) {\n var _loop = function _loop(eventName) {\n if (vueInst.$gmapOptions.autobindAllEvents || vueInst.$listeners[eventName]) {\n googleMapsInst.addListener(eventName, function (ev) {\n vueInst.$emit(eventName, ev);\n });\n }\n };\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = events[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var eventName = _step.value;\n\n _loop(eventName);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n};","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = WatchPrimitiveProperties;\n/**\r\n * Watch the individual properties of a PoD object, instead of the object\r\n * per se. This is different from a deep watch where both the reference\r\n * and the individual values are watched.\r\n *\r\n * In effect, it throttles the multiple $watch to execute at most once per tick.\r\n */\n\nfunction WatchPrimitiveProperties(vueInst, propertiesToTrack, handler) {\n var immediate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var isHandled = false;\n\n function requestHandle() {\n if (!isHandled) {\n isHandled = true;\n vueInst.$nextTick(function () {\n isHandled = false;\n handler();\n });\n }\n }\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = propertiesToTrack[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var prop = _step.value;\n vueInst.$watch(prop, requestHandle, {\n immediate: immediate\n });\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n}","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n/*\nMixin for objects that are mounted by Google Maps\nJavascript API.\n\nThese are objects that are sensitive to element resize\noperations so it exposes a property which accepts a bus\n\n*/\n\nexports.default = {\n props: ['resizeBus'],\n data: function data() {\n return {\n _actualResizeBus: null\n };\n },\n created: function created() {\n if (typeof this.resizeBus === 'undefined') {\n this.$data._actualResizeBus = this.$gmapDefaultResizeBus;\n } else {\n this.$data._actualResizeBus = this.resizeBus;\n }\n },\n methods: {\n _resizeCallback: function _resizeCallback() {\n this.resize();\n },\n _delayedResizeCallback: function _delayedResizeCallback() {\n var _this = this;\n\n this.$nextTick(function () {\n return _this._resizeCallback();\n });\n }\n },\n watch: {\n resizeBus: function resizeBus(newVal) {\n // eslint-disable-line no-unused-vars\n this.$data._actualResizeBus = newVal;\n },\n '$data._actualResizeBus': function $data_actualResizeBus(newVal, oldVal) {\n if (oldVal) {\n oldVal.$off('resize', this._delayedResizeCallback);\n }\n\n if (newVal) {\n newVal.$on('resize', this._delayedResizeCallback);\n }\n }\n },\n destroyed: function destroyed() {\n if (this.$data._actualResizeBus) {\n this.$data._actualResizeBus.$off('resize', this._delayedResizeCallback);\n }\n }\n};","export * from \"-!../../../../../shared/node_modules/mini-css-extract-plugin/dist/loader.js!../../../../../shared/node_modules/css-loader/dist/cjs.js??ref--3-1!../../../../../shared/node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../shared/node_modules/postcss-loader/src/index.js??ref--3-2!../../../../../shared/node_modules/vue-loader/lib/index.js??vue-loader-options!./tips.vue?vue&type=style&index=0&id=218095e5&scoped=true&lang=css&\"","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/*!\n * Vue.js v2.6.14\n * (c) 2014-2021 Evan You\n * Released under the MIT License.\n */\n\n/* */\nvar emptyObject = Object.freeze({}); // These helpers produce better VM code in JS engines due to their\n// explicitness and function inlining.\n\nfunction isUndef(v) {\n return v === undefined || v === null;\n}\n\nfunction isDef(v) {\n return v !== undefined && v !== null;\n}\n\nfunction isTrue(v) {\n return v === true;\n}\n\nfunction isFalse(v) {\n return v === false;\n}\n/**\n * Check if value is primitive.\n */\n\n\nfunction isPrimitive(value) {\n return typeof value === 'string' || typeof value === 'number' || // $flow-disable-line\n _typeof(value) === 'symbol' || typeof value === 'boolean';\n}\n/**\n * Quick object check - this is primarily used to tell\n * Objects from primitive values when we know the value\n * is a JSON-compliant type.\n */\n\n\nfunction isObject(obj) {\n return obj !== null && _typeof(obj) === 'object';\n}\n/**\n * Get the raw type string of a value, e.g., [object Object].\n */\n\n\nvar _toString = Object.prototype.toString;\n\nfunction toRawType(value) {\n return _toString.call(value).slice(8, -1);\n}\n/**\n * Strict object type check. Only returns true\n * for plain JavaScript objects.\n */\n\n\nfunction isPlainObject(obj) {\n return _toString.call(obj) === '[object Object]';\n}\n\nfunction isRegExp(v) {\n return _toString.call(v) === '[object RegExp]';\n}\n/**\n * Check if val is a valid array index.\n */\n\n\nfunction isValidArrayIndex(val) {\n var n = parseFloat(String(val));\n return n >= 0 && Math.floor(n) === n && isFinite(val);\n}\n\nfunction isPromise(val) {\n return isDef(val) && typeof val.then === 'function' && typeof val.catch === 'function';\n}\n/**\n * Convert a value to a string that is actually rendered.\n */\n\n\nfunction toString(val) {\n return val == null ? '' : Array.isArray(val) || isPlainObject(val) && val.toString === _toString ? JSON.stringify(val, null, 2) : String(val);\n}\n/**\n * Convert an input value to a number for persistence.\n * If the conversion fails, return original string.\n */\n\n\nfunction toNumber(val) {\n var n = parseFloat(val);\n return isNaN(n) ? val : n;\n}\n/**\n * Make a map and return a function for checking if a key\n * is in that map.\n */\n\n\nfunction makeMap(str, expectsLowerCase) {\n var map = Object.create(null);\n var list = str.split(',');\n\n for (var i = 0; i < list.length; i++) {\n map[list[i]] = true;\n }\n\n return expectsLowerCase ? function (val) {\n return map[val.toLowerCase()];\n } : function (val) {\n return map[val];\n };\n}\n/**\n * Check if a tag is a built-in tag.\n */\n\n\nvar isBuiltInTag = makeMap('slot,component', true);\n/**\n * Check if an attribute is a reserved attribute.\n */\n\nvar isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');\n/**\n * Remove an item from an array.\n */\n\nfunction remove(arr, item) {\n if (arr.length) {\n var index = arr.indexOf(item);\n\n if (index > -1) {\n return arr.splice(index, 1);\n }\n }\n}\n/**\n * Check whether an object has the property.\n */\n\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nfunction hasOwn(obj, key) {\n return hasOwnProperty.call(obj, key);\n}\n/**\n * Create a cached version of a pure function.\n */\n\n\nfunction cached(fn) {\n var cache = Object.create(null);\n return function cachedFn(str) {\n var hit = cache[str];\n return hit || (cache[str] = fn(str));\n };\n}\n/**\n * Camelize a hyphen-delimited string.\n */\n\n\nvar camelizeRE = /-(\\w)/g;\nvar camelize = cached(function (str) {\n return str.replace(camelizeRE, function (_, c) {\n return c ? c.toUpperCase() : '';\n });\n});\n/**\n * Capitalize a string.\n */\n\nvar capitalize = cached(function (str) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n});\n/**\n * Hyphenate a camelCase string.\n */\n\nvar hyphenateRE = /\\B([A-Z])/g;\nvar hyphenate = cached(function (str) {\n return str.replace(hyphenateRE, '-$1').toLowerCase();\n});\n/**\n * Simple bind polyfill for environments that do not support it,\n * e.g., PhantomJS 1.x. Technically, we don't need this anymore\n * since native bind is now performant enough in most browsers.\n * But removing it would mean breaking code that was able to run in\n * PhantomJS 1.x, so this must be kept for backward compatibility.\n */\n\n/* istanbul ignore next */\n\nfunction polyfillBind(fn, ctx) {\n function boundFn(a) {\n var l = arguments.length;\n return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);\n }\n\n boundFn._length = fn.length;\n return boundFn;\n}\n\nfunction nativeBind(fn, ctx) {\n return fn.bind(ctx);\n}\n\nvar bind = Function.prototype.bind ? nativeBind : polyfillBind;\n/**\n * Convert an Array-like object to a real Array.\n */\n\nfunction toArray(list, start) {\n start = start || 0;\n var i = list.length - start;\n var ret = new Array(i);\n\n while (i--) {\n ret[i] = list[i + start];\n }\n\n return ret;\n}\n/**\n * Mix properties into target object.\n */\n\n\nfunction extend(to, _from) {\n for (var key in _from) {\n to[key] = _from[key];\n }\n\n return to;\n}\n/**\n * Merge an Array of Objects into a single Object.\n */\n\n\nfunction toObject(arr) {\n var res = {};\n\n for (var i = 0; i < arr.length; i++) {\n if (arr[i]) {\n extend(res, arr[i]);\n }\n }\n\n return res;\n}\n/* eslint-disable no-unused-vars */\n\n/**\n * Perform no operation.\n * Stubbing args to make Flow happy without leaving useless transpiled code\n * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).\n */\n\n\nfunction noop(a, b, c) {}\n/**\n * Always return false.\n */\n\n\nvar no = function no(a, b, c) {\n return false;\n};\n/* eslint-enable no-unused-vars */\n\n/**\n * Return the same value.\n */\n\n\nvar identity = function identity(_) {\n return _;\n};\n/**\n * Check if two values are loosely equal - that is,\n * if they are plain objects, do they have the same shape?\n */\n\n\nfunction looseEqual(a, b) {\n if (a === b) {\n return true;\n }\n\n var isObjectA = isObject(a);\n var isObjectB = isObject(b);\n\n if (isObjectA && isObjectB) {\n try {\n var isArrayA = Array.isArray(a);\n var isArrayB = Array.isArray(b);\n\n if (isArrayA && isArrayB) {\n return a.length === b.length && a.every(function (e, i) {\n return looseEqual(e, b[i]);\n });\n } else if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n } else if (!isArrayA && !isArrayB) {\n var keysA = Object.keys(a);\n var keysB = Object.keys(b);\n return keysA.length === keysB.length && keysA.every(function (key) {\n return looseEqual(a[key], b[key]);\n });\n } else {\n /* istanbul ignore next */\n return false;\n }\n } catch (e) {\n /* istanbul ignore next */\n return false;\n }\n } else if (!isObjectA && !isObjectB) {\n return String(a) === String(b);\n } else {\n return false;\n }\n}\n/**\n * Return the first index at which a loosely equal value can be\n * found in the array (if value is a plain object, the array must\n * contain an object of the same shape), or -1 if it is not present.\n */\n\n\nfunction looseIndexOf(arr, val) {\n for (var i = 0; i < arr.length; i++) {\n if (looseEqual(arr[i], val)) {\n return i;\n }\n }\n\n return -1;\n}\n/**\n * Ensure a function is called only once.\n */\n\n\nfunction once(fn) {\n var called = false;\n return function () {\n if (!called) {\n called = true;\n fn.apply(this, arguments);\n }\n };\n}\n\nvar SSR_ATTR = 'data-server-rendered';\nvar ASSET_TYPES = ['component', 'directive', 'filter'];\nvar LIFECYCLE_HOOKS = ['beforeCreate', 'created', 'beforeMount', 'mounted', 'beforeUpdate', 'updated', 'beforeDestroy', 'destroyed', 'activated', 'deactivated', 'errorCaptured', 'serverPrefetch'];\n/* */\n\nvar config = {\n /**\n * Option merge strategies (used in core/util/options)\n */\n // $flow-disable-line\n optionMergeStrategies: Object.create(null),\n\n /**\n * Whether to suppress warnings.\n */\n silent: false,\n\n /**\n * Show production mode tip message on boot?\n */\n productionTip: process.env.NODE_ENV !== 'production',\n\n /**\n * Whether to enable devtools\n */\n devtools: process.env.NODE_ENV !== 'production',\n\n /**\n * Whether to record perf\n */\n performance: false,\n\n /**\n * Error handler for watcher errors\n */\n errorHandler: null,\n\n /**\n * Warn handler for watcher warns\n */\n warnHandler: null,\n\n /**\n * Ignore certain custom elements\n */\n ignoredElements: [],\n\n /**\n * Custom user key aliases for v-on\n */\n // $flow-disable-line\n keyCodes: Object.create(null),\n\n /**\n * Check if a tag is reserved so that it cannot be registered as a\n * component. This is platform-dependent and may be overwritten.\n */\n isReservedTag: no,\n\n /**\n * Check if an attribute is reserved so that it cannot be used as a component\n * prop. This is platform-dependent and may be overwritten.\n */\n isReservedAttr: no,\n\n /**\n * Check if a tag is an unknown element.\n * Platform-dependent.\n */\n isUnknownElement: no,\n\n /**\n * Get the namespace of an element\n */\n getTagNamespace: noop,\n\n /**\n * Parse the real tag name for the specific platform.\n */\n parsePlatformTagName: identity,\n\n /**\n * Check if an attribute must be bound using property, e.g. value\n * Platform-dependent.\n */\n mustUseProp: no,\n\n /**\n * Perform updates asynchronously. Intended to be used by Vue Test Utils\n * This will significantly reduce performance if set to false.\n */\n async: true,\n\n /**\n * Exposed for legacy reasons\n */\n _lifecycleHooks: LIFECYCLE_HOOKS\n};\n/* */\n\n/**\n * unicode letters used for parsing html tags, component names and property paths.\n * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname\n * skipping \\u10000-\\uEFFFF due to it freezing up PhantomJS\n */\n\nvar 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/;\n/**\n * Check if a string starts with $ or _\n */\n\nfunction isReserved(str) {\n var c = (str + '').charCodeAt(0);\n return c === 0x24 || c === 0x5F;\n}\n/**\n * Define a property.\n */\n\n\nfunction def(obj, key, val, enumerable) {\n Object.defineProperty(obj, key, {\n value: val,\n enumerable: !!enumerable,\n writable: true,\n configurable: true\n });\n}\n/**\n * Parse simple path.\n */\n\n\nvar bailRE = new RegExp(\"[^\" + unicodeRegExp.source + \".$_\\\\d]\");\n\nfunction parsePath(path) {\n if (bailRE.test(path)) {\n return;\n }\n\n var segments = path.split('.');\n return function (obj) {\n for (var i = 0; i < segments.length; i++) {\n if (!obj) {\n return;\n }\n\n obj = obj[segments[i]];\n }\n\n return obj;\n };\n}\n/* */\n// can we use __proto__?\n\n\nvar hasProto = ('__proto__' in {}); // Browser environment sniffing\n\nvar inBrowser = typeof window !== 'undefined';\nvar inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;\nvar weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();\nvar UA = inBrowser && window.navigator.userAgent.toLowerCase();\nvar isIE = UA && /msie|trident/.test(UA);\nvar isIE9 = UA && UA.indexOf('msie 9.0') > 0;\nvar isEdge = UA && UA.indexOf('edge/') > 0;\nvar isAndroid = UA && UA.indexOf('android') > 0 || weexPlatform === 'android';\nvar isIOS = UA && /iphone|ipad|ipod|ios/.test(UA) || weexPlatform === 'ios';\nvar isChrome = UA && /chrome\\/\\d+/.test(UA) && !isEdge;\nvar isPhantomJS = UA && /phantomjs/.test(UA);\nvar isFF = UA && UA.match(/firefox\\/(\\d+)/); // Firefox has a \"watch\" function on Object.prototype...\n\nvar nativeWatch = {}.watch;\nvar supportsPassive = false;\n\nif (inBrowser) {\n try {\n var opts = {};\n Object.defineProperty(opts, 'passive', {\n get: function get() {\n /* istanbul ignore next */\n supportsPassive = true;\n }\n }); // https://github.com/facebook/flow/issues/285\n\n window.addEventListener('test-passive', null, opts);\n } catch (e) {}\n} // this needs to be lazy-evaled because vue may be required before\n// vue-server-renderer can set VUE_ENV\n\n\nvar _isServer;\n\nvar isServerRendering = function isServerRendering() {\n if (_isServer === undefined) {\n /* istanbul ignore if */\n if (!inBrowser && !inWeex && typeof global !== 'undefined') {\n // detect presence of vue-server-renderer and avoid\n // Webpack shimming the process\n _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';\n } else {\n _isServer = false;\n }\n }\n\n return _isServer;\n}; // detect devtools\n\n\nvar devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;\n/* istanbul ignore next */\n\nfunction isNative(Ctor) {\n return typeof Ctor === 'function' && /native code/.test(Ctor.toString());\n}\n\nvar hasSymbol = typeof Symbol !== 'undefined' && isNative(Symbol) && typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);\n\nvar _Set;\n/* istanbul ignore if */\n// $flow-disable-line\n\n\nif (typeof Set !== 'undefined' && isNative(Set)) {\n // use native Set when available.\n _Set = Set;\n} else {\n // a non-standard Set polyfill that only works with primitive keys.\n _Set = /*@__PURE__*/function () {\n function Set() {\n this.set = Object.create(null);\n }\n\n Set.prototype.has = function has(key) {\n return this.set[key] === true;\n };\n\n Set.prototype.add = function add(key) {\n this.set[key] = true;\n };\n\n Set.prototype.clear = function clear() {\n this.set = Object.create(null);\n };\n\n return Set;\n }();\n}\n/* */\n\n\nvar warn = noop;\nvar tip = noop;\nvar generateComponentTrace = noop; // work around flow check\n\nvar formatComponentName = noop;\n\nif (process.env.NODE_ENV !== 'production') {\n var hasConsole = typeof console !== 'undefined';\n var classifyRE = /(?:^|[-_])(\\w)/g;\n\n var classify = function classify(str) {\n return str.replace(classifyRE, function (c) {\n return c.toUpperCase();\n }).replace(/[-_]/g, '');\n };\n\n warn = function warn(msg, vm) {\n var trace = vm ? generateComponentTrace(vm) : '';\n\n if (config.warnHandler) {\n config.warnHandler.call(null, msg, vm, trace);\n } else if (hasConsole && !config.silent) {\n console.error(\"[Vue warn]: \" + msg + trace);\n }\n };\n\n tip = function tip(msg, vm) {\n if (hasConsole && !config.silent) {\n console.warn(\"[Vue tip]: \" + msg + (vm ? generateComponentTrace(vm) : ''));\n }\n };\n\n formatComponentName = function formatComponentName(vm, includeFile) {\n if (vm.$root === vm) {\n return '';\n }\n\n var options = typeof vm === 'function' && vm.cid != null ? vm.options : vm._isVue ? vm.$options || vm.constructor.options : vm;\n var name = options.name || options._componentTag;\n var file = options.__file;\n\n if (!name && file) {\n var match = file.match(/([^/\\\\]+)\\.vue$/);\n name = match && match[1];\n }\n\n return (name ? \"<\" + classify(name) + \">\" : \"\") + (file && includeFile !== false ? \" at \" + file : '');\n };\n\n var repeat = function repeat(str, n) {\n var res = '';\n\n while (n) {\n if (n % 2 === 1) {\n res += str;\n }\n\n if (n > 1) {\n str += str;\n }\n\n n >>= 1;\n }\n\n return res;\n };\n\n generateComponentTrace = function generateComponentTrace(vm) {\n if (vm._isVue && vm.$parent) {\n var tree = [];\n var currentRecursiveSequence = 0;\n\n while (vm) {\n if (tree.length > 0) {\n var last = tree[tree.length - 1];\n\n if (last.constructor === vm.constructor) {\n currentRecursiveSequence++;\n vm = vm.$parent;\n continue;\n } else if (currentRecursiveSequence > 0) {\n tree[tree.length - 1] = [last, currentRecursiveSequence];\n currentRecursiveSequence = 0;\n }\n }\n\n tree.push(vm);\n vm = vm.$parent;\n }\n\n return '\\n\\nfound in\\n\\n' + tree.map(function (vm, i) {\n return \"\" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm) ? formatComponentName(vm[0]) + \"... (\" + vm[1] + \" recursive calls)\" : formatComponentName(vm));\n }).join('\\n');\n } else {\n return \"\\n\\n(found in \" + formatComponentName(vm) + \")\";\n }\n };\n}\n/* */\n\n\nvar uid = 0;\n/**\n * A dep is an observable that can have multiple\n * directives subscribing to it.\n */\n\nvar Dep = function Dep() {\n this.id = uid++;\n this.subs = [];\n};\n\nDep.prototype.addSub = function addSub(sub) {\n this.subs.push(sub);\n};\n\nDep.prototype.removeSub = function removeSub(sub) {\n remove(this.subs, sub);\n};\n\nDep.prototype.depend = function depend() {\n if (Dep.target) {\n Dep.target.addDep(this);\n }\n};\n\nDep.prototype.notify = function notify() {\n // stabilize the subscriber list first\n var subs = this.subs.slice();\n\n if (process.env.NODE_ENV !== 'production' && !config.async) {\n // subs aren't sorted in scheduler if not running async\n // we need to sort them now to make sure they fire in correct\n // order\n subs.sort(function (a, b) {\n return a.id - b.id;\n });\n }\n\n for (var i = 0, l = subs.length; i < l; i++) {\n subs[i].update();\n }\n}; // The current target watcher being evaluated.\n// This is globally unique because only one watcher\n// can be evaluated at a time.\n\n\nDep.target = null;\nvar targetStack = [];\n\nfunction pushTarget(target) {\n targetStack.push(target);\n Dep.target = target;\n}\n\nfunction popTarget() {\n targetStack.pop();\n Dep.target = targetStack[targetStack.length - 1];\n}\n/* */\n\n\nvar VNode = function VNode(tag, data, children, text, elm, context, componentOptions, asyncFactory) {\n this.tag = tag;\n this.data = data;\n this.children = children;\n this.text = text;\n this.elm = elm;\n this.ns = undefined;\n this.context = context;\n this.fnContext = undefined;\n this.fnOptions = undefined;\n this.fnScopeId = undefined;\n this.key = data && data.key;\n this.componentOptions = componentOptions;\n this.componentInstance = undefined;\n this.parent = undefined;\n this.raw = false;\n this.isStatic = false;\n this.isRootInsert = true;\n this.isComment = false;\n this.isCloned = false;\n this.isOnce = false;\n this.asyncFactory = asyncFactory;\n this.asyncMeta = undefined;\n this.isAsyncPlaceholder = false;\n};\n\nvar prototypeAccessors = {\n child: {\n configurable: true\n }\n}; // DEPRECATED: alias for componentInstance for backwards compat.\n\n/* istanbul ignore next */\n\nprototypeAccessors.child.get = function () {\n return this.componentInstance;\n};\n\nObject.defineProperties(VNode.prototype, prototypeAccessors);\n\nvar createEmptyVNode = function createEmptyVNode(text) {\n if (text === void 0) text = '';\n var node = new VNode();\n node.text = text;\n node.isComment = true;\n return node;\n};\n\nfunction createTextVNode(val) {\n return new VNode(undefined, undefined, undefined, String(val));\n} // optimized shallow clone\n// used for static nodes and slot nodes because they may be reused across\n// multiple renders, cloning them avoids errors when DOM manipulations rely\n// on their elm reference.\n\n\nfunction cloneVNode(vnode) {\n var cloned = new VNode(vnode.tag, vnode.data, // #7975\n // clone children array to avoid mutating original in case of cloning\n // a child.\n vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory);\n cloned.ns = vnode.ns;\n cloned.isStatic = vnode.isStatic;\n cloned.key = vnode.key;\n cloned.isComment = vnode.isComment;\n cloned.fnContext = vnode.fnContext;\n cloned.fnOptions = vnode.fnOptions;\n cloned.fnScopeId = vnode.fnScopeId;\n cloned.asyncMeta = vnode.asyncMeta;\n cloned.isCloned = true;\n return cloned;\n}\n/*\n * not type checking this file because flow doesn't play well with\n * dynamically accessing methods on Array prototype\n */\n\n\nvar arrayProto = Array.prototype;\nvar arrayMethods = Object.create(arrayProto);\nvar methodsToPatch = ['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'];\n/**\n * Intercept mutating methods and emit events\n */\n\nmethodsToPatch.forEach(function (method) {\n // cache original method\n var original = arrayProto[method];\n def(arrayMethods, method, function mutator() {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n var result = original.apply(this, args);\n var ob = this.__ob__;\n var inserted;\n\n switch (method) {\n case 'push':\n case 'unshift':\n inserted = args;\n break;\n\n case 'splice':\n inserted = args.slice(2);\n break;\n }\n\n if (inserted) {\n ob.observeArray(inserted);\n } // notify change\n\n\n ob.dep.notify();\n return result;\n });\n});\n/* */\n\nvar arrayKeys = Object.getOwnPropertyNames(arrayMethods);\n/**\n * In some cases we may want to disable observation inside a component's\n * update computation.\n */\n\nvar shouldObserve = true;\n\nfunction toggleObserving(value) {\n shouldObserve = value;\n}\n/**\n * Observer class that is attached to each observed\n * object. Once attached, the observer converts the target\n * object's property keys into getter/setters that\n * collect dependencies and dispatch updates.\n */\n\n\nvar Observer = function Observer(value) {\n this.value = value;\n this.dep = new Dep();\n this.vmCount = 0;\n def(value, '__ob__', this);\n\n if (Array.isArray(value)) {\n if (hasProto) {\n protoAugment(value, arrayMethods);\n } else {\n copyAugment(value, arrayMethods, arrayKeys);\n }\n\n this.observeArray(value);\n } else {\n this.walk(value);\n }\n};\n/**\n * Walk through all properties and convert them into\n * getter/setters. This method should only be called when\n * value type is Object.\n */\n\n\nObserver.prototype.walk = function walk(obj) {\n var keys = Object.keys(obj);\n\n for (var i = 0; i < keys.length; i++) {\n defineReactive$$1(obj, keys[i]);\n }\n};\n/**\n * Observe a list of Array items.\n */\n\n\nObserver.prototype.observeArray = function observeArray(items) {\n for (var i = 0, l = items.length; i < l; i++) {\n observe(items[i]);\n }\n}; // helpers\n\n/**\n * Augment a target Object or Array by intercepting\n * the prototype chain using __proto__\n */\n\n\nfunction protoAugment(target, src) {\n /* eslint-disable no-proto */\n target.__proto__ = src;\n /* eslint-enable no-proto */\n}\n/**\n * Augment a target Object or Array by defining\n * hidden properties.\n */\n\n/* istanbul ignore next */\n\n\nfunction copyAugment(target, src, keys) {\n for (var i = 0, l = keys.length; i < l; i++) {\n var key = keys[i];\n def(target, key, src[key]);\n }\n}\n/**\n * Attempt to create an observer instance for a value,\n * returns the new observer if successfully observed,\n * or the existing observer if the value already has one.\n */\n\n\nfunction observe(value, asRootData) {\n if (!isObject(value) || value instanceof VNode) {\n return;\n }\n\n var ob;\n\n if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {\n ob = value.__ob__;\n } else if (shouldObserve && !isServerRendering() && (Array.isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {\n ob = new Observer(value);\n }\n\n if (asRootData && ob) {\n ob.vmCount++;\n }\n\n return ob;\n}\n/**\n * Define a reactive property on an Object.\n */\n\n\nfunction defineReactive$$1(obj, key, val, customSetter, shallow) {\n var dep = new Dep();\n var property = Object.getOwnPropertyDescriptor(obj, key);\n\n if (property && property.configurable === false) {\n return;\n } // cater for pre-defined getter/setters\n\n\n var getter = property && property.get;\n var setter = property && property.set;\n\n if ((!getter || setter) && arguments.length === 2) {\n val = obj[key];\n }\n\n var childOb = !shallow && observe(val);\n Object.defineProperty(obj, key, {\n enumerable: true,\n configurable: true,\n get: function reactiveGetter() {\n var value = getter ? getter.call(obj) : val;\n\n if (Dep.target) {\n dep.depend();\n\n if (childOb) {\n childOb.dep.depend();\n\n if (Array.isArray(value)) {\n dependArray(value);\n }\n }\n }\n\n return value;\n },\n set: function reactiveSetter(newVal) {\n var value = getter ? getter.call(obj) : val;\n /* eslint-disable no-self-compare */\n\n if (newVal === value || newVal !== newVal && value !== value) {\n return;\n }\n /* eslint-enable no-self-compare */\n\n\n if (process.env.NODE_ENV !== 'production' && customSetter) {\n customSetter();\n } // #7981: for accessor properties without setter\n\n\n if (getter && !setter) {\n return;\n }\n\n if (setter) {\n setter.call(obj, newVal);\n } else {\n val = newVal;\n }\n\n childOb = !shallow && observe(newVal);\n dep.notify();\n }\n });\n}\n/**\n * Set a property on an object. Adds the new property and\n * triggers change notification if the property doesn't\n * already exist.\n */\n\n\nfunction set(target, key, val) {\n if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {\n warn(\"Cannot set reactive property on undefined, null, or primitive value: \" + target);\n }\n\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.length = Math.max(target.length, key);\n target.splice(key, 1, val);\n return val;\n }\n\n if (key in target && !(key in Object.prototype)) {\n target[key] = val;\n return val;\n }\n\n var ob = target.__ob__;\n\n if (target._isVue || ob && ob.vmCount) {\n process.env.NODE_ENV !== 'production' && warn('Avoid adding reactive properties to a Vue instance or its root $data ' + 'at runtime - declare it upfront in the data option.');\n return val;\n }\n\n if (!ob) {\n target[key] = val;\n return val;\n }\n\n defineReactive$$1(ob.value, key, val);\n ob.dep.notify();\n return val;\n}\n/**\n * Delete a property and trigger change if necessary.\n */\n\n\nfunction del(target, key) {\n if (process.env.NODE_ENV !== 'production' && (isUndef(target) || isPrimitive(target))) {\n warn(\"Cannot delete reactive property on undefined, null, or primitive value: \" + target);\n }\n\n if (Array.isArray(target) && isValidArrayIndex(key)) {\n target.splice(key, 1);\n return;\n }\n\n var ob = target.__ob__;\n\n if (target._isVue || ob && ob.vmCount) {\n process.env.NODE_ENV !== 'production' && warn('Avoid deleting properties on a Vue instance or its root $data ' + '- just set it to null.');\n return;\n }\n\n if (!hasOwn(target, key)) {\n return;\n }\n\n delete target[key];\n\n if (!ob) {\n return;\n }\n\n ob.dep.notify();\n}\n/**\n * Collect dependencies on array elements when the array is touched, since\n * we cannot intercept array element access like property getters.\n */\n\n\nfunction dependArray(value) {\n for (var e = void 0, i = 0, l = value.length; i < l; i++) {\n e = value[i];\n e && e.__ob__ && e.__ob__.dep.depend();\n\n if (Array.isArray(e)) {\n dependArray(e);\n }\n }\n}\n/* */\n\n/**\n * Option overwriting strategies are functions that handle\n * how to merge a parent option value and a child option\n * value into the final value.\n */\n\n\nvar strats = config.optionMergeStrategies;\n/**\n * Options with restrictions\n */\n\nif (process.env.NODE_ENV !== 'production') {\n strats.el = strats.propsData = function (parent, child, vm, key) {\n if (!vm) {\n warn(\"option \\\"\" + key + \"\\\" can only be used during instance \" + 'creation with the `new` keyword.');\n }\n\n return defaultStrat(parent, child);\n };\n}\n/**\n * Helper that recursively merges two data objects together.\n */\n\n\nfunction mergeData(to, from) {\n if (!from) {\n return to;\n }\n\n var key, toVal, fromVal;\n var keys = hasSymbol ? Reflect.ownKeys(from) : Object.keys(from);\n\n for (var i = 0; i < keys.length; i++) {\n key = keys[i]; // in case the object is already observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n toVal = to[key];\n fromVal = from[key];\n\n if (!hasOwn(to, key)) {\n set(to, key, fromVal);\n } else if (toVal !== fromVal && isPlainObject(toVal) && isPlainObject(fromVal)) {\n mergeData(toVal, fromVal);\n }\n }\n\n return to;\n}\n/**\n * Data\n */\n\n\nfunction mergeDataOrFn(parentVal, childVal, vm) {\n if (!vm) {\n // in a Vue.extend merge, both should be functions\n if (!childVal) {\n return parentVal;\n }\n\n if (!parentVal) {\n return childVal;\n } // when parentVal & childVal are both present,\n // we need to return a function that returns the\n // merged result of both functions... no need to\n // check if parentVal is a function here because\n // it has to be a function to pass previous merges.\n\n\n return function mergedDataFn() {\n return mergeData(typeof childVal === 'function' ? childVal.call(this, this) : childVal, typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal);\n };\n } else {\n return function mergedInstanceDataFn() {\n // instance merge\n var instanceData = typeof childVal === 'function' ? childVal.call(vm, vm) : childVal;\n var defaultData = typeof parentVal === 'function' ? parentVal.call(vm, vm) : parentVal;\n\n if (instanceData) {\n return mergeData(instanceData, defaultData);\n } else {\n return defaultData;\n }\n };\n }\n}\n\nstrats.data = function (parentVal, childVal, vm) {\n if (!vm) {\n if (childVal && typeof childVal !== 'function') {\n process.env.NODE_ENV !== 'production' && warn('The \"data\" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);\n return parentVal;\n }\n\n return mergeDataOrFn(parentVal, childVal);\n }\n\n return mergeDataOrFn(parentVal, childVal, vm);\n};\n/**\n * Hooks and props are merged as arrays.\n */\n\n\nfunction mergeHook(parentVal, childVal) {\n var res = childVal ? parentVal ? parentVal.concat(childVal) : Array.isArray(childVal) ? childVal : [childVal] : parentVal;\n return res ? dedupeHooks(res) : res;\n}\n\nfunction dedupeHooks(hooks) {\n var res = [];\n\n for (var i = 0; i < hooks.length; i++) {\n if (res.indexOf(hooks[i]) === -1) {\n res.push(hooks[i]);\n }\n }\n\n return res;\n}\n\nLIFECYCLE_HOOKS.forEach(function (hook) {\n strats[hook] = mergeHook;\n});\n/**\n * Assets\n *\n * When a vm is present (instance creation), we need to do\n * a three-way merge between constructor options, instance\n * options and parent options.\n */\n\nfunction mergeAssets(parentVal, childVal, vm, key) {\n var res = Object.create(parentVal || null);\n\n if (childVal) {\n process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);\n return extend(res, childVal);\n } else {\n return res;\n }\n}\n\nASSET_TYPES.forEach(function (type) {\n strats[type + 's'] = mergeAssets;\n});\n/**\n * Watchers.\n *\n * Watchers hashes should not overwrite one\n * another, so we merge them as arrays.\n */\n\nstrats.watch = function (parentVal, childVal, vm, key) {\n // work around Firefox's Object.prototype.watch...\n if (parentVal === nativeWatch) {\n parentVal = undefined;\n }\n\n if (childVal === nativeWatch) {\n childVal = undefined;\n }\n /* istanbul ignore if */\n\n\n if (!childVal) {\n return Object.create(parentVal || null);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assertObjectType(key, childVal, vm);\n }\n\n if (!parentVal) {\n return childVal;\n }\n\n var ret = {};\n extend(ret, parentVal);\n\n for (var key$1 in childVal) {\n var parent = ret[key$1];\n var child = childVal[key$1];\n\n if (parent && !Array.isArray(parent)) {\n parent = [parent];\n }\n\n ret[key$1] = parent ? parent.concat(child) : Array.isArray(child) ? child : [child];\n }\n\n return ret;\n};\n/**\n * Other object hashes.\n */\n\n\nstrats.props = strats.methods = strats.inject = strats.computed = function (parentVal, childVal, vm, key) {\n if (childVal && process.env.NODE_ENV !== 'production') {\n assertObjectType(key, childVal, vm);\n }\n\n if (!parentVal) {\n return childVal;\n }\n\n var ret = Object.create(null);\n extend(ret, parentVal);\n\n if (childVal) {\n extend(ret, childVal);\n }\n\n return ret;\n};\n\nstrats.provide = mergeDataOrFn;\n/**\n * Default strategy.\n */\n\nvar defaultStrat = function defaultStrat(parentVal, childVal) {\n return childVal === undefined ? parentVal : childVal;\n};\n/**\n * Validate component names\n */\n\n\nfunction checkComponents(options) {\n for (var key in options.components) {\n validateComponentName(key);\n }\n}\n\nfunction validateComponentName(name) {\n if (!new RegExp(\"^[a-zA-Z][\\\\-\\\\.0-9_\" + unicodeRegExp.source + \"]*$\").test(name)) {\n warn('Invalid component name: \"' + name + '\". Component names ' + 'should conform to valid custom element name in html5 specification.');\n }\n\n if (isBuiltInTag(name) || config.isReservedTag(name)) {\n warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + name);\n }\n}\n/**\n * Ensure all props option syntax are normalized into the\n * Object-based format.\n */\n\n\nfunction normalizeProps(options, vm) {\n var props = options.props;\n\n if (!props) {\n return;\n }\n\n var res = {};\n var i, val, name;\n\n if (Array.isArray(props)) {\n i = props.length;\n\n while (i--) {\n val = props[i];\n\n if (typeof val === 'string') {\n name = camelize(val);\n res[name] = {\n type: null\n };\n } else if (process.env.NODE_ENV !== 'production') {\n warn('props must be strings when using array syntax.');\n }\n }\n } else if (isPlainObject(props)) {\n for (var key in props) {\n val = props[key];\n name = camelize(key);\n res[name] = isPlainObject(val) ? val : {\n type: val\n };\n }\n } else if (process.env.NODE_ENV !== 'production') {\n warn(\"Invalid value for option \\\"props\\\": expected an Array or an Object, \" + \"but got \" + toRawType(props) + \".\", vm);\n }\n\n options.props = res;\n}\n/**\n * Normalize all injections into Object-based format\n */\n\n\nfunction normalizeInject(options, vm) {\n var inject = options.inject;\n\n if (!inject) {\n return;\n }\n\n var normalized = options.inject = {};\n\n if (Array.isArray(inject)) {\n for (var i = 0; i < inject.length; i++) {\n normalized[inject[i]] = {\n from: inject[i]\n };\n }\n } else if (isPlainObject(inject)) {\n for (var key in inject) {\n var val = inject[key];\n normalized[key] = isPlainObject(val) ? extend({\n from: key\n }, val) : {\n from: val\n };\n }\n } else if (process.env.NODE_ENV !== 'production') {\n warn(\"Invalid value for option \\\"inject\\\": expected an Array or an Object, \" + \"but got \" + toRawType(inject) + \".\", vm);\n }\n}\n/**\n * Normalize raw function directives into object format.\n */\n\n\nfunction normalizeDirectives(options) {\n var dirs = options.directives;\n\n if (dirs) {\n for (var key in dirs) {\n var def$$1 = dirs[key];\n\n if (typeof def$$1 === 'function') {\n dirs[key] = {\n bind: def$$1,\n update: def$$1\n };\n }\n }\n }\n}\n\nfunction assertObjectType(name, value, vm) {\n if (!isPlainObject(value)) {\n warn(\"Invalid value for option \\\"\" + name + \"\\\": expected an Object, \" + \"but got \" + toRawType(value) + \".\", vm);\n }\n}\n/**\n * Merge two option objects into a new one.\n * Core utility used in both instantiation and inheritance.\n */\n\n\nfunction mergeOptions(parent, child, vm) {\n if (process.env.NODE_ENV !== 'production') {\n checkComponents(child);\n }\n\n if (typeof child === 'function') {\n child = child.options;\n }\n\n normalizeProps(child, vm);\n normalizeInject(child, vm);\n normalizeDirectives(child); // Apply extends and mixins on the child options,\n // but only if it is a raw options object that isn't\n // the result of another mergeOptions call.\n // Only merged options has the _base property.\n\n if (!child._base) {\n if (child.extends) {\n parent = mergeOptions(parent, child.extends, vm);\n }\n\n if (child.mixins) {\n for (var i = 0, l = child.mixins.length; i < l; i++) {\n parent = mergeOptions(parent, child.mixins[i], vm);\n }\n }\n }\n\n var options = {};\n var key;\n\n for (key in parent) {\n mergeField(key);\n }\n\n for (key in child) {\n if (!hasOwn(parent, key)) {\n mergeField(key);\n }\n }\n\n function mergeField(key) {\n var strat = strats[key] || defaultStrat;\n options[key] = strat(parent[key], child[key], vm, key);\n }\n\n return options;\n}\n/**\n * Resolve an asset.\n * This function is used because child instances need access\n * to assets defined in its ancestor chain.\n */\n\n\nfunction resolveAsset(options, type, id, warnMissing) {\n /* istanbul ignore if */\n if (typeof id !== 'string') {\n return;\n }\n\n var assets = options[type]; // check local registration variations first\n\n if (hasOwn(assets, id)) {\n return assets[id];\n }\n\n var camelizedId = camelize(id);\n\n if (hasOwn(assets, camelizedId)) {\n return assets[camelizedId];\n }\n\n var PascalCaseId = capitalize(camelizedId);\n\n if (hasOwn(assets, PascalCaseId)) {\n return assets[PascalCaseId];\n } // fallback to prototype chain\n\n\n var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];\n\n if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {\n warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);\n }\n\n return res;\n}\n/* */\n\n\nfunction validateProp(key, propOptions, propsData, vm) {\n var prop = propOptions[key];\n var absent = !hasOwn(propsData, key);\n var value = propsData[key]; // boolean casting\n\n var booleanIndex = getTypeIndex(Boolean, prop.type);\n\n if (booleanIndex > -1) {\n if (absent && !hasOwn(prop, 'default')) {\n value = false;\n } else if (value === '' || value === hyphenate(key)) {\n // only cast empty string / same name to boolean if\n // boolean has higher priority\n var stringIndex = getTypeIndex(String, prop.type);\n\n if (stringIndex < 0 || booleanIndex < stringIndex) {\n value = true;\n }\n }\n } // check default value\n\n\n if (value === undefined) {\n value = getPropDefaultValue(vm, prop, key); // since the default value is a fresh copy,\n // make sure to observe it.\n\n var prevShouldObserve = shouldObserve;\n toggleObserving(true);\n observe(value);\n toggleObserving(prevShouldObserve);\n }\n\n if (process.env.NODE_ENV !== 'production' && // skip validation for weex recycle-list child component props\n !false) {\n assertProp(prop, key, value, vm, absent);\n }\n\n return value;\n}\n/**\n * Get the default value of a prop.\n */\n\n\nfunction getPropDefaultValue(vm, prop, key) {\n // no default, return undefined\n if (!hasOwn(prop, 'default')) {\n return undefined;\n }\n\n var def = prop.default; // warn against non-factory defaults for Object & Array\n\n if (process.env.NODE_ENV !== 'production' && isObject(def)) {\n warn('Invalid default value for prop \"' + key + '\": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', vm);\n } // the raw prop value was also undefined from previous render,\n // return previous default value to avoid unnecessary watcher trigger\n\n\n if (vm && vm.$options.propsData && vm.$options.propsData[key] === undefined && vm._props[key] !== undefined) {\n return vm._props[key];\n } // call factory function for non-Function types\n // a value is Function if its prototype is function even across different execution context\n\n\n return typeof def === 'function' && getType(prop.type) !== 'Function' ? def.call(vm) : def;\n}\n/**\n * Assert whether a prop is valid.\n */\n\n\nfunction assertProp(prop, name, value, vm, absent) {\n if (prop.required && absent) {\n warn('Missing required prop: \"' + name + '\"', vm);\n return;\n }\n\n if (value == null && !prop.required) {\n return;\n }\n\n var type = prop.type;\n var valid = !type || type === true;\n var expectedTypes = [];\n\n if (type) {\n if (!Array.isArray(type)) {\n type = [type];\n }\n\n for (var i = 0; i < type.length && !valid; i++) {\n var assertedType = assertType(value, type[i], vm);\n expectedTypes.push(assertedType.expectedType || '');\n valid = assertedType.valid;\n }\n }\n\n var haveExpectedTypes = expectedTypes.some(function (t) {\n return t;\n });\n\n if (!valid && haveExpectedTypes) {\n warn(getInvalidTypeMessage(name, value, expectedTypes), vm);\n return;\n }\n\n var validator = prop.validator;\n\n if (validator) {\n if (!validator(value)) {\n warn('Invalid prop: custom validator check failed for prop \"' + name + '\".', vm);\n }\n }\n}\n\nvar simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;\n\nfunction assertType(value, type, vm) {\n var valid;\n var expectedType = getType(type);\n\n if (simpleCheckRE.test(expectedType)) {\n var t = _typeof(value);\n\n valid = t === expectedType.toLowerCase(); // for primitive wrapper objects\n\n if (!valid && t === 'object') {\n valid = value instanceof type;\n }\n } else if (expectedType === 'Object') {\n valid = isPlainObject(value);\n } else if (expectedType === 'Array') {\n valid = Array.isArray(value);\n } else {\n try {\n valid = value instanceof type;\n } catch (e) {\n warn('Invalid prop type: \"' + String(type) + '\" is not a constructor', vm);\n valid = false;\n }\n }\n\n return {\n valid: valid,\n expectedType: expectedType\n };\n}\n\nvar functionTypeCheckRE = /^\\s*function (\\w+)/;\n/**\n * Use function string name to check built-in types,\n * because a simple equality check will fail when running\n * across different vms / iframes.\n */\n\nfunction getType(fn) {\n var match = fn && fn.toString().match(functionTypeCheckRE);\n return match ? match[1] : '';\n}\n\nfunction isSameType(a, b) {\n return getType(a) === getType(b);\n}\n\nfunction getTypeIndex(type, expectedTypes) {\n if (!Array.isArray(expectedTypes)) {\n return isSameType(expectedTypes, type) ? 0 : -1;\n }\n\n for (var i = 0, len = expectedTypes.length; i < len; i++) {\n if (isSameType(expectedTypes[i], type)) {\n return i;\n }\n }\n\n return -1;\n}\n\nfunction getInvalidTypeMessage(name, value, expectedTypes) {\n var message = \"Invalid prop: type check failed for prop \\\"\" + name + \"\\\".\" + \" Expected \" + expectedTypes.map(capitalize).join(', ');\n var expectedType = expectedTypes[0];\n var receivedType = toRawType(value); // check if we need to specify expected value\n\n if (expectedTypes.length === 1 && isExplicable(expectedType) && isExplicable(_typeof(value)) && !isBoolean(expectedType, receivedType)) {\n message += \" with value \" + styleValue(value, expectedType);\n }\n\n message += \", got \" + receivedType + \" \"; // check if we need to specify received value\n\n if (isExplicable(receivedType)) {\n message += \"with value \" + styleValue(value, receivedType) + \".\";\n }\n\n return message;\n}\n\nfunction styleValue(value, type) {\n if (type === 'String') {\n return \"\\\"\" + value + \"\\\"\";\n } else if (type === 'Number') {\n return \"\" + Number(value);\n } else {\n return \"\" + value;\n }\n}\n\nvar EXPLICABLE_TYPES = ['string', 'number', 'boolean'];\n\nfunction isExplicable(value) {\n return EXPLICABLE_TYPES.some(function (elem) {\n return value.toLowerCase() === elem;\n });\n}\n\nfunction isBoolean() {\n var args = [],\n len = arguments.length;\n\n while (len--) {\n args[len] = arguments[len];\n }\n\n return args.some(function (elem) {\n return elem.toLowerCase() === 'boolean';\n });\n}\n/* */\n\n\nfunction handleError(err, vm, info) {\n // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.\n // See: https://github.com/vuejs/vuex/issues/1505\n pushTarget();\n\n try {\n if (vm) {\n var cur = vm;\n\n while (cur = cur.$parent) {\n var hooks = cur.$options.errorCaptured;\n\n if (hooks) {\n for (var i = 0; i < hooks.length; i++) {\n try {\n var capture = hooks[i].call(cur, err, vm, info) === false;\n\n if (capture) {\n return;\n }\n } catch (e) {\n globalHandleError(e, cur, 'errorCaptured hook');\n }\n }\n }\n }\n }\n\n globalHandleError(err, vm, info);\n } finally {\n popTarget();\n }\n}\n\nfunction invokeWithErrorHandling(handler, context, args, vm, info) {\n var res;\n\n try {\n res = args ? handler.apply(context, args) : handler.call(context);\n\n if (res && !res._isVue && isPromise(res) && !res._handled) {\n res.catch(function (e) {\n return handleError(e, vm, info + \" (Promise/async)\");\n }); // issue #9511\n // avoid catch triggering multiple times when nested calls\n\n res._handled = true;\n }\n } catch (e) {\n handleError(e, vm, info);\n }\n\n return res;\n}\n\nfunction globalHandleError(err, vm, info) {\n if (config.errorHandler) {\n try {\n return config.errorHandler.call(null, err, vm, info);\n } catch (e) {\n // if the user intentionally throws the original error in the handler,\n // do not log it twice\n if (e !== err) {\n logError(e, null, 'config.errorHandler');\n }\n }\n }\n\n logError(err, vm, info);\n}\n\nfunction logError(err, vm, info) {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Error in \" + info + \": \\\"\" + err.toString() + \"\\\"\", vm);\n }\n /* istanbul ignore else */\n\n\n if ((inBrowser || inWeex) && typeof console !== 'undefined') {\n console.error(err);\n } else {\n throw err;\n }\n}\n/* */\n\n\nvar isUsingMicroTask = false;\nvar callbacks = [];\nvar pending = false;\n\nfunction flushCallbacks() {\n pending = false;\n var copies = callbacks.slice(0);\n callbacks.length = 0;\n\n for (var i = 0; i < copies.length; i++) {\n copies[i]();\n }\n} // Here we have async deferring wrappers using microtasks.\n// In 2.5 we used (macro) tasks (in combination with microtasks).\n// However, it has subtle problems when state is changed right before repaint\n// (e.g. #6813, out-in transitions).\n// Also, using (macro) tasks in event handler would cause some weird behaviors\n// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).\n// So we now use microtasks everywhere, again.\n// A major drawback of this tradeoff is that there are some scenarios\n// where microtasks have too high a priority and fire in between supposedly\n// sequential events (e.g. #4521, #6690, which have workarounds)\n// or even between bubbling of the same event (#6566).\n\n\nvar timerFunc; // The nextTick behavior leverages the microtask queue, which can be accessed\n// via either native Promise.then or MutationObserver.\n// MutationObserver has wider support, however it is seriously bugged in\n// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It\n// completely stops working after triggering a few times... so, if native\n// Promise is available, we will use it:\n\n/* istanbul ignore next, $flow-disable-line */\n\nif (typeof Promise !== 'undefined' && isNative(Promise)) {\n var p = Promise.resolve();\n\n timerFunc = function timerFunc() {\n p.then(flushCallbacks); // In problematic UIWebViews, Promise.then doesn't completely break, but\n // it can get stuck in a weird state where callbacks are pushed into the\n // microtask queue but the queue isn't being flushed, until the browser\n // needs to do some other work, e.g. handle a timer. Therefore we can\n // \"force\" the microtask queue to be flushed by adding an empty timer.\n\n if (isIOS) {\n setTimeout(noop);\n }\n };\n\n isUsingMicroTask = true;\n} else if (!isIE && typeof MutationObserver !== 'undefined' && (isNative(MutationObserver) || // PhantomJS and iOS 7.x\nMutationObserver.toString() === '[object MutationObserverConstructor]')) {\n // Use MutationObserver where native Promise is not available,\n // e.g. PhantomJS, iOS7, Android 4.4\n // (#6466 MutationObserver is unreliable in IE11)\n var counter = 1;\n var observer = new MutationObserver(flushCallbacks);\n var textNode = document.createTextNode(String(counter));\n observer.observe(textNode, {\n characterData: true\n });\n\n timerFunc = function timerFunc() {\n counter = (counter + 1) % 2;\n textNode.data = String(counter);\n };\n\n isUsingMicroTask = true;\n} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {\n // Fallback to setImmediate.\n // Technically it leverages the (macro) task queue,\n // but it is still a better choice than setTimeout.\n timerFunc = function timerFunc() {\n setImmediate(flushCallbacks);\n };\n} else {\n // Fallback to setTimeout.\n timerFunc = function timerFunc() {\n setTimeout(flushCallbacks, 0);\n };\n}\n\nfunction nextTick(cb, ctx) {\n var _resolve;\n\n callbacks.push(function () {\n if (cb) {\n try {\n cb.call(ctx);\n } catch (e) {\n handleError(e, ctx, 'nextTick');\n }\n } else if (_resolve) {\n _resolve(ctx);\n }\n });\n\n if (!pending) {\n pending = true;\n timerFunc();\n } // $flow-disable-line\n\n\n if (!cb && typeof Promise !== 'undefined') {\n return new Promise(function (resolve) {\n _resolve = resolve;\n });\n }\n}\n/* */\n\n/* not type checking this file because flow doesn't play well with Proxy */\n\n\nvar initProxy;\n\nif (process.env.NODE_ENV !== 'production') {\n var allowedGlobals = 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\n );\n\n var warnNonPresent = function warnNonPresent(target, key) {\n warn(\"Property or method \\\"\" + 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://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target);\n };\n\n var warnReservedPrefix = function warnReservedPrefix(target, key) {\n warn(\"Property \\\"\" + key + \"\\\" must be accessed with \\\"$data.\" + key + \"\\\" because \" + 'properties starting with \"$\" or \"_\" are not proxied in the Vue instance to ' + 'prevent conflicts with Vue internals. ' + 'See: https://vuejs.org/v2/api/#data', target);\n };\n\n var hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy);\n\n if (hasProxy) {\n var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');\n config.keyCodes = new Proxy(config.keyCodes, {\n set: function set(target, key, value) {\n if (isBuiltInModifier(key)) {\n warn(\"Avoid overwriting built-in modifier in config.keyCodes: .\" + key);\n return false;\n } else {\n target[key] = value;\n return true;\n }\n }\n });\n }\n\n var hasHandler = {\n has: function has(target, key) {\n var has = (key in target);\n var isAllowed = allowedGlobals(key) || typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data);\n\n if (!has && !isAllowed) {\n if (key in target.$data) {\n warnReservedPrefix(target, key);\n } else {\n warnNonPresent(target, key);\n }\n }\n\n return has || !isAllowed;\n }\n };\n var getHandler = {\n get: function get(target, key) {\n if (typeof key === 'string' && !(key in target)) {\n if (key in target.$data) {\n warnReservedPrefix(target, key);\n } else {\n warnNonPresent(target, key);\n }\n }\n\n return target[key];\n }\n };\n\n initProxy = function initProxy(vm) {\n if (hasProxy) {\n // determine which proxy handler to use\n var options = vm.$options;\n var handlers = options.render && options.render._withStripped ? getHandler : hasHandler;\n vm._renderProxy = new Proxy(vm, handlers);\n } else {\n vm._renderProxy = vm;\n }\n };\n}\n/* */\n\n\nvar seenObjects = new _Set();\n/**\n * Recursively traverse an object to evoke all converted\n * getters, so that every nested property inside the object\n * is collected as a \"deep\" dependency.\n */\n\nfunction traverse(val) {\n _traverse(val, seenObjects);\n\n seenObjects.clear();\n}\n\nfunction _traverse(val, seen) {\n var i, keys;\n var isA = Array.isArray(val);\n\n if (!isA && !isObject(val) || Object.isFrozen(val) || val instanceof VNode) {\n return;\n }\n\n if (val.__ob__) {\n var depId = val.__ob__.dep.id;\n\n if (seen.has(depId)) {\n return;\n }\n\n seen.add(depId);\n }\n\n if (isA) {\n i = val.length;\n\n while (i--) {\n _traverse(val[i], seen);\n }\n } else {\n keys = Object.keys(val);\n i = keys.length;\n\n while (i--) {\n _traverse(val[keys[i]], seen);\n }\n }\n}\n\nvar mark;\nvar measure;\n\nif (process.env.NODE_ENV !== 'production') {\n var perf = inBrowser && window.performance;\n /* istanbul ignore if */\n\n if (perf && perf.mark && perf.measure && perf.clearMarks && perf.clearMeasures) {\n mark = function mark(tag) {\n return perf.mark(tag);\n };\n\n measure = function measure(name, startTag, endTag) {\n perf.measure(name, startTag, endTag);\n perf.clearMarks(startTag);\n perf.clearMarks(endTag); // perf.clearMeasures(name)\n };\n }\n}\n/* */\n\n\nvar normalizeEvent = cached(function (name) {\n var passive = name.charAt(0) === '&';\n name = passive ? name.slice(1) : name;\n var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first\n\n name = once$$1 ? name.slice(1) : name;\n var capture = name.charAt(0) === '!';\n name = capture ? name.slice(1) : name;\n return {\n name: name,\n once: once$$1,\n capture: capture,\n passive: passive\n };\n});\n\nfunction createFnInvoker(fns, vm) {\n function invoker() {\n var arguments$1 = arguments;\n var fns = invoker.fns;\n\n if (Array.isArray(fns)) {\n var cloned = fns.slice();\n\n for (var i = 0; i < cloned.length; i++) {\n invokeWithErrorHandling(cloned[i], null, arguments$1, vm, \"v-on handler\");\n }\n } else {\n // return handler return value for single handlers\n return invokeWithErrorHandling(fns, null, arguments, vm, \"v-on handler\");\n }\n }\n\n invoker.fns = fns;\n return invoker;\n}\n\nfunction updateListeners(on, oldOn, add, remove$$1, createOnceHandler, vm) {\n var name, def$$1, cur, old, event;\n\n for (name in on) {\n def$$1 = cur = on[name];\n old = oldOn[name];\n event = normalizeEvent(name);\n\n if (isUndef(cur)) {\n process.env.NODE_ENV !== 'production' && warn(\"Invalid handler for event \\\"\" + event.name + \"\\\": got \" + String(cur), vm);\n } else if (isUndef(old)) {\n if (isUndef(cur.fns)) {\n cur = on[name] = createFnInvoker(cur, vm);\n }\n\n if (isTrue(event.once)) {\n cur = on[name] = createOnceHandler(event.name, cur, event.capture);\n }\n\n add(event.name, cur, event.capture, event.passive, event.params);\n } else if (cur !== old) {\n old.fns = cur;\n on[name] = old;\n }\n }\n\n for (name in oldOn) {\n if (isUndef(on[name])) {\n event = normalizeEvent(name);\n remove$$1(event.name, oldOn[name], event.capture);\n }\n }\n}\n/* */\n\n\nfunction mergeVNodeHook(def, hookKey, hook) {\n if (def instanceof VNode) {\n def = def.data.hook || (def.data.hook = {});\n }\n\n var invoker;\n var oldHook = def[hookKey];\n\n function wrappedHook() {\n hook.apply(this, arguments); // important: remove merged hook to ensure it's called only once\n // and prevent memory leak\n\n remove(invoker.fns, wrappedHook);\n }\n\n if (isUndef(oldHook)) {\n // no existing hook\n invoker = createFnInvoker([wrappedHook]);\n } else {\n /* istanbul ignore if */\n if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {\n // already a merged invoker\n invoker = oldHook;\n invoker.fns.push(wrappedHook);\n } else {\n // existing plain hook\n invoker = createFnInvoker([oldHook, wrappedHook]);\n }\n }\n\n invoker.merged = true;\n def[hookKey] = invoker;\n}\n/* */\n\n\nfunction extractPropsFromVNodeData(data, Ctor, tag) {\n // we are only extracting raw values here.\n // validation and default values are handled in the child\n // component itself.\n var propOptions = Ctor.options.props;\n\n if (isUndef(propOptions)) {\n return;\n }\n\n var res = {};\n var attrs = data.attrs;\n var props = data.props;\n\n if (isDef(attrs) || isDef(props)) {\n for (var key in propOptions) {\n var altKey = hyphenate(key);\n\n if (process.env.NODE_ENV !== 'production') {\n var keyInLowerCase = key.toLowerCase();\n\n if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) {\n tip(\"Prop \\\"\" + keyInLowerCase + \"\\\" is passed to component \" + formatComponentName(tag || Ctor) + \", but the declared prop name is\" + \" \\\"\" + 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 \\\"\" + altKey + \"\\\" instead of \\\"\" + key + \"\\\".\");\n }\n }\n\n checkProp(res, props, key, altKey, true) || checkProp(res, attrs, key, altKey, false);\n }\n }\n\n return res;\n}\n\nfunction checkProp(res, hash, key, altKey, preserve) {\n if (isDef(hash)) {\n if (hasOwn(hash, key)) {\n res[key] = hash[key];\n\n if (!preserve) {\n delete hash[key];\n }\n\n return true;\n } else if (hasOwn(hash, altKey)) {\n res[key] = hash[altKey];\n\n if (!preserve) {\n delete hash[altKey];\n }\n\n return true;\n }\n }\n\n return false;\n}\n/* */\n// The template compiler attempts to minimize the need for normalization by\n// statically analyzing the template at compile time.\n//\n// For plain HTML markup, normalization can be completely skipped because the\n// generated render function is guaranteed to return Array. There are\n// two cases where extra normalization is needed:\n// 1. When the children contains components - because a functional component\n// may return an Array instead of a single root. In this case, just a simple\n// normalization is needed - if any child is an Array, we flatten the whole\n// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep\n// because functional components already normalize their own children.\n\n\nfunction simpleNormalizeChildren(children) {\n for (var i = 0; i < children.length; i++) {\n if (Array.isArray(children[i])) {\n return Array.prototype.concat.apply([], children);\n }\n }\n\n return children;\n} // 2. When the children contains constructs that always generated nested Arrays,\n// e.g. , , v-for, or when the children is provided by user\n// with hand-written render functions / JSX. In such cases a full normalization\n// is needed to cater to all possible types of children values.\n\n\nfunction normalizeChildren(children) {\n return isPrimitive(children) ? [createTextVNode(children)] : Array.isArray(children) ? normalizeArrayChildren(children) : undefined;\n}\n\nfunction isTextNode(node) {\n return isDef(node) && isDef(node.text) && isFalse(node.isComment);\n}\n\nfunction normalizeArrayChildren(children, nestedIndex) {\n var res = [];\n var i, c, lastIndex, last;\n\n for (i = 0; i < children.length; i++) {\n c = children[i];\n\n if (isUndef(c) || typeof c === 'boolean') {\n continue;\n }\n\n lastIndex = res.length - 1;\n last = res[lastIndex]; // nested\n\n if (Array.isArray(c)) {\n if (c.length > 0) {\n c = normalizeArrayChildren(c, (nestedIndex || '') + \"_\" + i); // merge adjacent text nodes\n\n if (isTextNode(c[0]) && isTextNode(last)) {\n res[lastIndex] = createTextVNode(last.text + c[0].text);\n c.shift();\n }\n\n res.push.apply(res, c);\n }\n } else if (isPrimitive(c)) {\n if (isTextNode(last)) {\n // merge adjacent text nodes\n // this is necessary for SSR hydration because text nodes are\n // essentially merged when rendered to HTML strings\n res[lastIndex] = createTextVNode(last.text + c);\n } else if (c !== '') {\n // convert primitive to vnode\n res.push(createTextVNode(c));\n }\n } else {\n if (isTextNode(c) && isTextNode(last)) {\n // merge adjacent text nodes\n res[lastIndex] = createTextVNode(last.text + c.text);\n } else {\n // default key for nested array children (likely generated by v-for)\n if (isTrue(children._isVList) && isDef(c.tag) && isUndef(c.key) && isDef(nestedIndex)) {\n c.key = \"__vlist\" + nestedIndex + \"_\" + i + \"__\";\n }\n\n res.push(c);\n }\n }\n }\n\n return res;\n}\n/* */\n\n\nfunction initProvide(vm) {\n var provide = vm.$options.provide;\n\n if (provide) {\n vm._provided = typeof provide === 'function' ? provide.call(vm) : provide;\n }\n}\n\nfunction initInjections(vm) {\n var result = resolveInject(vm.$options.inject, vm);\n\n if (result) {\n toggleObserving(false);\n Object.keys(result).forEach(function (key) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n defineReactive$$1(vm, key, result[key], function () {\n warn(\"Avoid mutating an injected value directly since the changes will be \" + \"overwritten whenever the provided component re-renders. \" + \"injection being mutated: \\\"\" + key + \"\\\"\", vm);\n });\n } else {\n defineReactive$$1(vm, key, result[key]);\n }\n });\n toggleObserving(true);\n }\n}\n\nfunction resolveInject(inject, vm) {\n if (inject) {\n // inject is :any because flow is not smart enough to figure out cached\n var result = Object.create(null);\n var keys = hasSymbol ? Reflect.ownKeys(inject) : Object.keys(inject);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i]; // #6574 in case the inject object is observed...\n\n if (key === '__ob__') {\n continue;\n }\n\n var provideKey = inject[key].from;\n var source = vm;\n\n while (source) {\n if (source._provided && hasOwn(source._provided, provideKey)) {\n result[key] = source._provided[provideKey];\n break;\n }\n\n source = source.$parent;\n }\n\n if (!source) {\n if ('default' in inject[key]) {\n var provideDefault = inject[key].default;\n result[key] = typeof provideDefault === 'function' ? provideDefault.call(vm) : provideDefault;\n } else if (process.env.NODE_ENV !== 'production') {\n warn(\"Injection \\\"\" + key + \"\\\" not found\", vm);\n }\n }\n }\n\n return result;\n }\n}\n/* */\n\n/**\n * Runtime helper for resolving raw children VNodes into a slot object.\n */\n\n\nfunction resolveSlots(children, context) {\n if (!children || !children.length) {\n return {};\n }\n\n var slots = {};\n\n for (var i = 0, l = children.length; i < l; i++) {\n var child = children[i];\n var data = child.data; // remove slot attribute if the node is resolved as a Vue slot node\n\n if (data && data.attrs && data.attrs.slot) {\n delete data.attrs.slot;\n } // named slots should only be respected if the vnode was rendered in the\n // same context.\n\n\n if ((child.context === context || child.fnContext === context) && data && data.slot != null) {\n var name = data.slot;\n var slot = slots[name] || (slots[name] = []);\n\n if (child.tag === 'template') {\n slot.push.apply(slot, child.children || []);\n } else {\n slot.push(child);\n }\n } else {\n (slots.default || (slots.default = [])).push(child);\n }\n } // ignore slots that contains only whitespace\n\n\n for (var name$1 in slots) {\n if (slots[name$1].every(isWhitespace)) {\n delete slots[name$1];\n }\n }\n\n return slots;\n}\n\nfunction isWhitespace(node) {\n return node.isComment && !node.asyncFactory || node.text === ' ';\n}\n/* */\n\n\nfunction isAsyncPlaceholder(node) {\n return node.isComment && node.asyncFactory;\n}\n/* */\n\n\nfunction normalizeScopedSlots(slots, normalSlots, prevSlots) {\n var res;\n var hasNormalSlots = Object.keys(normalSlots).length > 0;\n var isStable = slots ? !!slots.$stable : !hasNormalSlots;\n var key = slots && slots.$key;\n\n if (!slots) {\n res = {};\n } else if (slots._normalized) {\n // fast path 1: child component re-render only, parent did not change\n return slots._normalized;\n } else if (isStable && prevSlots && prevSlots !== emptyObject && key === prevSlots.$key && !hasNormalSlots && !prevSlots.$hasNormal) {\n // fast path 2: stable scoped slots w/ no normal slots to proxy,\n // only need to normalize once\n return prevSlots;\n } else {\n res = {};\n\n for (var key$1 in slots) {\n if (slots[key$1] && key$1[0] !== '$') {\n res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);\n }\n }\n } // expose normal slots on scopedSlots\n\n\n for (var key$2 in normalSlots) {\n if (!(key$2 in res)) {\n res[key$2] = proxyNormalSlot(normalSlots, key$2);\n }\n } // avoriaz seems to mock a non-extensible $scopedSlots object\n // and when that is passed down this would cause an error\n\n\n if (slots && Object.isExtensible(slots)) {\n slots._normalized = res;\n }\n\n def(res, '$stable', isStable);\n def(res, '$key', key);\n def(res, '$hasNormal', hasNormalSlots);\n return res;\n}\n\nfunction normalizeScopedSlot(normalSlots, key, fn) {\n var normalized = function normalized() {\n var res = arguments.length ? fn.apply(null, arguments) : fn({});\n res = res && _typeof(res) === 'object' && !Array.isArray(res) ? [res] // single vnode\n : normalizeChildren(res);\n var vnode = res && res[0];\n return res && (!vnode || res.length === 1 && vnode.isComment && !isAsyncPlaceholder(vnode) // #9658, #10391\n ) ? undefined : res;\n }; // this is a slot using the new v-slot syntax without scope. although it is\n // compiled as a scoped slot, render fn users would expect it to be present\n // on this.$slots because the usage is semantically a normal slot.\n\n\n if (fn.proxy) {\n Object.defineProperty(normalSlots, key, {\n get: normalized,\n enumerable: true,\n configurable: true\n });\n }\n\n return normalized;\n}\n\nfunction proxyNormalSlot(slots, key) {\n return function () {\n return slots[key];\n };\n}\n/* */\n\n/**\n * Runtime helper for rendering v-for lists.\n */\n\n\nfunction renderList(val, render) {\n var ret, i, l, keys, key;\n\n if (Array.isArray(val) || typeof val === 'string') {\n ret = new Array(val.length);\n\n for (i = 0, l = val.length; i < l; i++) {\n ret[i] = render(val[i], i);\n }\n } else if (typeof val === 'number') {\n ret = new Array(val);\n\n for (i = 0; i < val; i++) {\n ret[i] = render(i + 1, i);\n }\n } else if (isObject(val)) {\n if (hasSymbol && val[Symbol.iterator]) {\n ret = [];\n var iterator = val[Symbol.iterator]();\n var result = iterator.next();\n\n while (!result.done) {\n ret.push(render(result.value, ret.length));\n result = iterator.next();\n }\n } else {\n keys = Object.keys(val);\n ret = new Array(keys.length);\n\n for (i = 0, l = keys.length; i < l; i++) {\n key = keys[i];\n ret[i] = render(val[key], key, i);\n }\n }\n }\n\n if (!isDef(ret)) {\n ret = [];\n }\n\n ret._isVList = true;\n return ret;\n}\n/* */\n\n/**\n * Runtime helper for rendering \n */\n\n\nfunction renderSlot(name, fallbackRender, props, bindObject) {\n var scopedSlotFn = this.$scopedSlots[name];\n var nodes;\n\n if (scopedSlotFn) {\n // scoped slot\n props = props || {};\n\n if (bindObject) {\n if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {\n warn('slot v-bind without argument expects an Object', this);\n }\n\n props = extend(extend({}, bindObject), props);\n }\n\n nodes = scopedSlotFn(props) || (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);\n } else {\n nodes = this.$slots[name] || (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);\n }\n\n var target = props && props.slot;\n\n if (target) {\n return this.$createElement('template', {\n slot: target\n }, nodes);\n } else {\n return nodes;\n }\n}\n/* */\n\n/**\n * Runtime helper for resolving filters\n */\n\n\nfunction resolveFilter(id) {\n return resolveAsset(this.$options, 'filters', id, true) || identity;\n}\n/* */\n\n\nfunction isKeyNotMatch(expect, actual) {\n if (Array.isArray(expect)) {\n return expect.indexOf(actual) === -1;\n } else {\n return expect !== actual;\n }\n}\n/**\n * Runtime helper for checking keyCodes from config.\n * exposed as Vue.prototype._k\n * passing in eventKeyName as last argument separately for backwards compat\n */\n\n\nfunction checkKeyCodes(eventKeyCode, key, builtInKeyCode, eventKeyName, builtInKeyName) {\n var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;\n\n if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {\n return isKeyNotMatch(builtInKeyName, eventKeyName);\n } else if (mappedKeyCode) {\n return isKeyNotMatch(mappedKeyCode, eventKeyCode);\n } else if (eventKeyName) {\n return hyphenate(eventKeyName) !== key;\n }\n\n return eventKeyCode === undefined;\n}\n/* */\n\n/**\n * Runtime helper for merging v-bind=\"object\" into a VNode's data.\n */\n\n\nfunction bindObjectProps(data, tag, value, asProp, isSync) {\n if (value) {\n if (!isObject(value)) {\n process.env.NODE_ENV !== 'production' && warn('v-bind without argument expects an Object or Array value', this);\n } else {\n if (Array.isArray(value)) {\n value = toObject(value);\n }\n\n var hash;\n\n var loop = function loop(key) {\n if (key === 'class' || key === 'style' || isReservedAttribute(key)) {\n hash = data;\n } else {\n var type = data.attrs && data.attrs.type;\n hash = asProp || config.mustUseProp(tag, type, key) ? data.domProps || (data.domProps = {}) : data.attrs || (data.attrs = {});\n }\n\n var camelizedKey = camelize(key);\n var hyphenatedKey = hyphenate(key);\n\n if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {\n hash[key] = value[key];\n\n if (isSync) {\n var on = data.on || (data.on = {});\n\n on[\"update:\" + key] = function ($event) {\n value[key] = $event;\n };\n }\n }\n };\n\n for (var key in value) {\n loop(key);\n }\n }\n }\n\n return data;\n}\n/* */\n\n/**\n * Runtime helper for rendering static trees.\n */\n\n\nfunction renderStatic(index, isInFor) {\n var cached = this._staticTrees || (this._staticTrees = []);\n var tree = cached[index]; // if has already-rendered static tree and not inside v-for,\n // we can reuse the same tree.\n\n if (tree && !isInFor) {\n return tree;\n } // otherwise, render a fresh tree.\n\n\n tree = cached[index] = this.$options.staticRenderFns[index].call(this._renderProxy, null, this // for render fns generated for functional component templates\n );\n markStatic(tree, \"__static__\" + index, false);\n return tree;\n}\n/**\n * Runtime helper for v-once.\n * Effectively it means marking the node as static with a unique key.\n */\n\n\nfunction markOnce(tree, index, key) {\n markStatic(tree, \"__once__\" + index + (key ? \"_\" + key : \"\"), true);\n return tree;\n}\n\nfunction markStatic(tree, key, isOnce) {\n if (Array.isArray(tree)) {\n for (var i = 0; i < tree.length; i++) {\n if (tree[i] && typeof tree[i] !== 'string') {\n markStaticNode(tree[i], key + \"_\" + i, isOnce);\n }\n }\n } else {\n markStaticNode(tree, key, isOnce);\n }\n}\n\nfunction markStaticNode(node, key, isOnce) {\n node.isStatic = true;\n node.key = key;\n node.isOnce = isOnce;\n}\n/* */\n\n\nfunction bindObjectListeners(data, value) {\n if (value) {\n if (!isPlainObject(value)) {\n process.env.NODE_ENV !== 'production' && warn('v-on without argument expects an Object value', this);\n } else {\n var on = data.on = data.on ? extend({}, data.on) : {};\n\n for (var key in value) {\n var existing = on[key];\n var ours = value[key];\n on[key] = existing ? [].concat(existing, ours) : ours;\n }\n }\n }\n\n return data;\n}\n/* */\n\n\nfunction resolveScopedSlots(fns, // see flow/vnode\nres, // the following are added in 2.6\nhasDynamicKeys, contentHashKey) {\n res = res || {\n $stable: !hasDynamicKeys\n };\n\n for (var i = 0; i < fns.length; i++) {\n var slot = fns[i];\n\n if (Array.isArray(slot)) {\n resolveScopedSlots(slot, res, hasDynamicKeys);\n } else if (slot) {\n // marker for reverse proxying v-slot without scope on this.$slots\n if (slot.proxy) {\n slot.fn.proxy = true;\n }\n\n res[slot.key] = slot.fn;\n }\n }\n\n if (contentHashKey) {\n res.$key = contentHashKey;\n }\n\n return res;\n}\n/* */\n\n\nfunction bindDynamicKeys(baseObj, values) {\n for (var i = 0; i < values.length; i += 2) {\n var key = values[i];\n\n if (typeof key === 'string' && key) {\n baseObj[values[i]] = values[i + 1];\n } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {\n // null is a special value for explicitly removing a binding\n warn(\"Invalid value for dynamic directive argument (expected string or null): \" + key, this);\n }\n }\n\n return baseObj;\n} // helper to dynamically append modifier runtime markers to event names.\n// ensure only append when value is already string, otherwise it will be cast\n// to string and cause the type check to miss.\n\n\nfunction prependModifier(value, symbol) {\n return typeof value === 'string' ? symbol + value : value;\n}\n/* */\n\n\nfunction installRenderHelpers(target) {\n target._o = markOnce;\n target._n = toNumber;\n target._s = toString;\n target._l = renderList;\n target._t = renderSlot;\n target._q = looseEqual;\n target._i = looseIndexOf;\n target._m = renderStatic;\n target._f = resolveFilter;\n target._k = checkKeyCodes;\n target._b = bindObjectProps;\n target._v = createTextVNode;\n target._e = createEmptyVNode;\n target._u = resolveScopedSlots;\n target._g = bindObjectListeners;\n target._d = bindDynamicKeys;\n target._p = prependModifier;\n}\n/* */\n\n\nfunction FunctionalRenderContext(data, props, children, parent, Ctor) {\n var this$1 = this;\n var options = Ctor.options; // ensure the createElement function in functional components\n // gets a unique context - this is necessary for correct named slot check\n\n var contextVm;\n\n if (hasOwn(parent, '_uid')) {\n contextVm = Object.create(parent); // $flow-disable-line\n\n contextVm._original = parent;\n } else {\n // the context vm passed in is a functional context as well.\n // in this case we want to make sure we are able to get a hold to the\n // real context instance.\n contextVm = parent; // $flow-disable-line\n\n parent = parent._original;\n }\n\n var isCompiled = isTrue(options._compiled);\n var needNormalization = !isCompiled;\n this.data = data;\n this.props = props;\n this.children = children;\n this.parent = parent;\n this.listeners = data.on || emptyObject;\n this.injections = resolveInject(options.inject, parent);\n\n this.slots = function () {\n if (!this$1.$slots) {\n normalizeScopedSlots(data.scopedSlots, this$1.$slots = resolveSlots(children, parent));\n }\n\n return this$1.$slots;\n };\n\n Object.defineProperty(this, 'scopedSlots', {\n enumerable: true,\n get: function get() {\n return normalizeScopedSlots(data.scopedSlots, this.slots());\n }\n }); // support for compiled functional template\n\n if (isCompiled) {\n // exposing $options for renderStatic()\n this.$options = options; // pre-resolve slots for renderSlot()\n\n this.$slots = this.slots();\n this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);\n }\n\n if (options._scopeId) {\n this._c = function (a, b, c, d) {\n var vnode = createElement(contextVm, a, b, c, d, needNormalization);\n\n if (vnode && !Array.isArray(vnode)) {\n vnode.fnScopeId = options._scopeId;\n vnode.fnContext = parent;\n }\n\n return vnode;\n };\n } else {\n this._c = function (a, b, c, d) {\n return createElement(contextVm, a, b, c, d, needNormalization);\n };\n }\n}\n\ninstallRenderHelpers(FunctionalRenderContext.prototype);\n\nfunction createFunctionalComponent(Ctor, propsData, data, contextVm, children) {\n var options = Ctor.options;\n var props = {};\n var propOptions = options.props;\n\n if (isDef(propOptions)) {\n for (var key in propOptions) {\n props[key] = validateProp(key, propOptions, propsData || emptyObject);\n }\n } else {\n if (isDef(data.attrs)) {\n mergeProps(props, data.attrs);\n }\n\n if (isDef(data.props)) {\n mergeProps(props, data.props);\n }\n }\n\n var renderContext = new FunctionalRenderContext(data, props, children, contextVm, Ctor);\n var vnode = options.render.call(null, renderContext._c, renderContext);\n\n if (vnode instanceof VNode) {\n return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext);\n } else if (Array.isArray(vnode)) {\n var vnodes = normalizeChildren(vnode) || [];\n var res = new Array(vnodes.length);\n\n for (var i = 0; i < vnodes.length; i++) {\n res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);\n }\n\n return res;\n }\n}\n\nfunction cloneAndMarkFunctionalResult(vnode, data, contextVm, options, renderContext) {\n // #7817 clone node before setting fnContext, otherwise if the node is reused\n // (e.g. it was from a cached normal slot) the fnContext causes named slots\n // that should not be matched to match.\n var clone = cloneVNode(vnode);\n clone.fnContext = contextVm;\n clone.fnOptions = options;\n\n if (process.env.NODE_ENV !== 'production') {\n (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;\n }\n\n if (data.slot) {\n (clone.data || (clone.data = {})).slot = data.slot;\n }\n\n return clone;\n}\n\nfunction mergeProps(to, from) {\n for (var key in from) {\n to[camelize(key)] = from[key];\n }\n}\n/* */\n\n/* */\n\n/* */\n\n/* */\n// inline hooks to be invoked on component VNodes during patch\n\n\nvar componentVNodeHooks = {\n init: function init(vnode, hydrating) {\n if (vnode.componentInstance && !vnode.componentInstance._isDestroyed && vnode.data.keepAlive) {\n // kept-alive components, treat as a patch\n var mountedNode = vnode; // work around flow\n\n componentVNodeHooks.prepatch(mountedNode, mountedNode);\n } else {\n var child = vnode.componentInstance = createComponentInstanceForVnode(vnode, activeInstance);\n child.$mount(hydrating ? vnode.elm : undefined, hydrating);\n }\n },\n prepatch: function prepatch(oldVnode, vnode) {\n var options = vnode.componentOptions;\n var child = vnode.componentInstance = oldVnode.componentInstance;\n updateChildComponent(child, options.propsData, // updated props\n options.listeners, // updated listeners\n vnode, // new parent vnode\n options.children // new children\n );\n },\n insert: function insert(vnode) {\n var context = vnode.context;\n var componentInstance = vnode.componentInstance;\n\n if (!componentInstance._isMounted) {\n componentInstance._isMounted = true;\n callHook(componentInstance, 'mounted');\n }\n\n if (vnode.data.keepAlive) {\n if (context._isMounted) {\n // vue-router#1212\n // During updates, a kept-alive component's child components may\n // change, so directly walking the tree here may call activated hooks\n // on incorrect children. Instead we push them into a queue which will\n // be processed after the whole patch process ended.\n queueActivatedComponent(componentInstance);\n } else {\n activateChildComponent(componentInstance, true\n /* direct */\n );\n }\n }\n },\n destroy: function destroy(vnode) {\n var componentInstance = vnode.componentInstance;\n\n if (!componentInstance._isDestroyed) {\n if (!vnode.data.keepAlive) {\n componentInstance.$destroy();\n } else {\n deactivateChildComponent(componentInstance, true\n /* direct */\n );\n }\n }\n }\n};\nvar hooksToMerge = Object.keys(componentVNodeHooks);\n\nfunction createComponent(Ctor, data, context, children, tag) {\n if (isUndef(Ctor)) {\n return;\n }\n\n var baseCtor = context.$options._base; // plain options object: turn it into a constructor\n\n if (isObject(Ctor)) {\n Ctor = baseCtor.extend(Ctor);\n } // if at this stage it's not a constructor or an async component factory,\n // reject.\n\n\n if (typeof Ctor !== 'function') {\n if (process.env.NODE_ENV !== 'production') {\n warn(\"Invalid Component definition: \" + String(Ctor), context);\n }\n\n return;\n } // async component\n\n\n var asyncFactory;\n\n if (isUndef(Ctor.cid)) {\n asyncFactory = Ctor;\n Ctor = resolveAsyncComponent(asyncFactory, baseCtor);\n\n if (Ctor === undefined) {\n // return a placeholder node for async component, which is rendered\n // as a comment node but preserves all the raw information for the node.\n // the information will be used for async server-rendering and hydration.\n return createAsyncPlaceholder(asyncFactory, data, context, children, tag);\n }\n }\n\n data = data || {}; // resolve constructor options in case global mixins are applied after\n // component constructor creation\n\n resolveConstructorOptions(Ctor); // transform component v-model data into props & events\n\n if (isDef(data.model)) {\n transformModel(Ctor.options, data);\n } // extract props\n\n\n var propsData = extractPropsFromVNodeData(data, Ctor, tag); // functional component\n\n if (isTrue(Ctor.options.functional)) {\n return createFunctionalComponent(Ctor, propsData, data, context, children);\n } // extract listeners, since these needs to be treated as\n // child component listeners instead of DOM listeners\n\n\n var listeners = data.on; // replace with listeners with .native modifier\n // so it gets processed during parent component patch.\n\n data.on = data.nativeOn;\n\n if (isTrue(Ctor.options.abstract)) {\n // abstract components do not keep anything\n // other than props & listeners & slot\n // work around flow\n var slot = data.slot;\n data = {};\n\n if (slot) {\n data.slot = slot;\n }\n } // install component management hooks onto the placeholder node\n\n\n installComponentHooks(data); // return a placeholder vnode\n\n var name = Ctor.options.name || tag;\n var vnode = new VNode(\"vue-component-\" + Ctor.cid + (name ? \"-\" + name : ''), data, undefined, undefined, undefined, context, {\n Ctor: Ctor,\n propsData: propsData,\n listeners: listeners,\n tag: tag,\n children: children\n }, asyncFactory);\n return vnode;\n}\n\nfunction createComponentInstanceForVnode( // we know it's MountedComponentVNode but flow doesn't\nvnode, // activeInstance in lifecycle state\nparent) {\n var options = {\n _isComponent: true,\n _parentVnode: vnode,\n parent: parent\n }; // check inline-template render functions\n\n var inlineTemplate = vnode.data.inlineTemplate;\n\n if (isDef(inlineTemplate)) {\n options.render = inlineTemplate.render;\n options.staticRenderFns = inlineTemplate.staticRenderFns;\n }\n\n return new vnode.componentOptions.Ctor(options);\n}\n\nfunction installComponentHooks(data) {\n var hooks = data.hook || (data.hook = {});\n\n for (var i = 0; i < hooksToMerge.length; i++) {\n var key = hooksToMerge[i];\n var existing = hooks[key];\n var toMerge = componentVNodeHooks[key];\n\n if (existing !== toMerge && !(existing && existing._merged)) {\n hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;\n }\n }\n}\n\nfunction mergeHook$1(f1, f2) {\n var merged = function merged(a, b) {\n // flow complains about extra args which is why we use any\n f1(a, b);\n f2(a, b);\n };\n\n merged._merged = true;\n return merged;\n} // transform component v-model info (value and callback) into\n// prop and event handler respectively.\n\n\nfunction transformModel(options, data) {\n var prop = options.model && options.model.prop || 'value';\n var event = options.model && options.model.event || 'input';\n (data.attrs || (data.attrs = {}))[prop] = data.model.value;\n var on = data.on || (data.on = {});\n var existing = on[event];\n var callback = data.model.callback;\n\n if (isDef(existing)) {\n if (Array.isArray(existing) ? existing.indexOf(callback) === -1 : existing !== callback) {\n on[event] = [callback].concat(existing);\n }\n } else {\n on[event] = callback;\n }\n}\n/* */\n\n\nvar SIMPLE_NORMALIZE = 1;\nvar ALWAYS_NORMALIZE = 2; // wrapper function for providing a more flexible interface\n// without getting yelled at by flow\n\nfunction createElement(context, tag, data, children, normalizationType, alwaysNormalize) {\n if (Array.isArray(data) || isPrimitive(data)) {\n normalizationType = children;\n children = data;\n data = undefined;\n }\n\n if (isTrue(alwaysNormalize)) {\n normalizationType = ALWAYS_NORMALIZE;\n }\n\n return _createElement(context, tag, data, children, normalizationType);\n}\n\nfunction _createElement(context, tag, data, children, normalizationType) {\n if (isDef(data) && isDef(data.__ob__)) {\n process.env.NODE_ENV !== 'production' && warn(\"Avoid using observed data object as vnode data: \" + JSON.stringify(data) + \"\\n\" + 'Always create fresh vnode data objects in each render!', context);\n return createEmptyVNode();\n } // object syntax in v-bind\n\n\n if (isDef(data) && isDef(data.is)) {\n tag = data.is;\n }\n\n if (!tag) {\n // in case of component :is set to falsy value\n return createEmptyVNode();\n } // warn against non-primitive key\n\n\n if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.key) && !isPrimitive(data.key)) {\n {\n warn('Avoid using non-primitive value as key, ' + 'use string/number value instead.', context);\n }\n } // support single function children as default scoped slot\n\n\n if (Array.isArray(children) && typeof children[0] === 'function') {\n data = data || {};\n data.scopedSlots = {\n default: children[0]\n };\n children.length = 0;\n }\n\n if (normalizationType === ALWAYS_NORMALIZE) {\n children = normalizeChildren(children);\n } else if (normalizationType === SIMPLE_NORMALIZE) {\n children = simpleNormalizeChildren(children);\n }\n\n var vnode, ns;\n\n if (typeof tag === 'string') {\n var Ctor;\n ns = context.$vnode && context.$vnode.ns || config.getTagNamespace(tag);\n\n if (config.isReservedTag(tag)) {\n // platform built-in elements\n if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {\n warn(\"The .native modifier for v-on is only valid on components but it was used on <\" + tag + \">.\", context);\n }\n\n vnode = new VNode(config.parsePlatformTagName(tag), data, children, undefined, undefined, context);\n } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {\n // component\n vnode = createComponent(Ctor, data, context, children, tag);\n } else {\n // unknown or unlisted namespaced elements\n // check at runtime because it may get assigned a namespace when its\n // parent normalizes children\n vnode = new VNode(tag, data, children, undefined, undefined, context);\n }\n } else {\n // direct component options / constructor\n vnode = createComponent(tag, data, context, children);\n }\n\n if (Array.isArray(vnode)) {\n return vnode;\n } else if (isDef(vnode)) {\n if (isDef(ns)) {\n applyNS(vnode, ns);\n }\n\n if (isDef(data)) {\n registerDeepBindings(data);\n }\n\n return vnode;\n } else {\n return createEmptyVNode();\n }\n}\n\nfunction applyNS(vnode, ns, force) {\n vnode.ns = ns;\n\n if (vnode.tag === 'foreignObject') {\n // use default namespace inside foreignObject\n ns = undefined;\n force = true;\n }\n\n if (isDef(vnode.children)) {\n for (var i = 0, l = vnode.children.length; i < l; i++) {\n var child = vnode.children[i];\n\n if (isDef(child.tag) && (isUndef(child.ns) || isTrue(force) && child.tag !== 'svg')) {\n applyNS(child, ns, force);\n }\n }\n }\n} // ref #5318\n// necessary to ensure parent re-render when deep bindings like :style and\n// :class are used on slot nodes\n\n\nfunction registerDeepBindings(data) {\n if (isObject(data.style)) {\n traverse(data.style);\n }\n\n if (isObject(data.class)) {\n traverse(data.class);\n }\n}\n/* */\n\n\nfunction initRender(vm) {\n vm._vnode = null; // the root of the child tree\n\n vm._staticTrees = null; // v-once cached trees\n\n var options = vm.$options;\n var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree\n\n var renderContext = parentVnode && parentVnode.context;\n vm.$slots = resolveSlots(options._renderChildren, renderContext);\n vm.$scopedSlots = emptyObject; // bind the createElement fn to this instance\n // so that we get proper render context inside it.\n // args order: tag, data, children, normalizationType, alwaysNormalize\n // internal version is used by render functions compiled from templates\n\n vm._c = function (a, b, c, d) {\n return createElement(vm, a, b, c, d, false);\n }; // normalization is always applied for the public version, used in\n // user-written render functions.\n\n\n vm.$createElement = function (a, b, c, d) {\n return createElement(vm, a, b, c, d, true);\n }; // $attrs & $listeners are exposed for easier HOC creation.\n // they need to be reactive so that HOCs using them are always updated\n\n\n var parentData = parentVnode && parentVnode.data;\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production') {\n defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {\n !isUpdatingChildComponent && warn(\"$attrs is readonly.\", vm);\n }, true);\n defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {\n !isUpdatingChildComponent && warn(\"$listeners is readonly.\", vm);\n }, true);\n } else {\n defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, null, true);\n defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, null, true);\n }\n}\n\nvar currentRenderingInstance = null;\n\nfunction renderMixin(Vue) {\n // install runtime convenience helpers\n installRenderHelpers(Vue.prototype);\n\n Vue.prototype.$nextTick = function (fn) {\n return nextTick(fn, this);\n };\n\n Vue.prototype._render = function () {\n var vm = this;\n var ref = vm.$options;\n var render = ref.render;\n var _parentVnode = ref._parentVnode;\n\n if (_parentVnode) {\n vm.$scopedSlots = normalizeScopedSlots(_parentVnode.data.scopedSlots, vm.$slots, vm.$scopedSlots);\n } // set parent vnode. this allows render functions to have access\n // to the data on the placeholder node.\n\n\n vm.$vnode = _parentVnode; // render self\n\n var vnode;\n\n try {\n // There's no need to maintain a stack because all render fns are called\n // separately from one another. Nested component's render fns are called\n // when parent component is patched.\n currentRenderingInstance = vm;\n vnode = render.call(vm._renderProxy, vm.$createElement);\n } catch (e) {\n handleError(e, vm, \"render\"); // return error render result,\n // or previous vnode to prevent render error causing blank component\n\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production' && vm.$options.renderError) {\n try {\n vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);\n } catch (e) {\n handleError(e, vm, \"renderError\");\n vnode = vm._vnode;\n }\n } else {\n vnode = vm._vnode;\n }\n } finally {\n currentRenderingInstance = null;\n } // if the returned array contains only a single node, allow it\n\n\n if (Array.isArray(vnode) && vnode.length === 1) {\n vnode = vnode[0];\n } // return empty vnode in case the render function errored out\n\n\n if (!(vnode instanceof VNode)) {\n if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {\n warn('Multiple root nodes returned from render function. Render function ' + 'should return a single root node.', vm);\n }\n\n vnode = createEmptyVNode();\n } // set parent\n\n\n vnode.parent = _parentVnode;\n return vnode;\n };\n}\n/* */\n\n\nfunction ensureCtor(comp, base) {\n if (comp.__esModule || hasSymbol && comp[Symbol.toStringTag] === 'Module') {\n comp = comp.default;\n }\n\n return isObject(comp) ? base.extend(comp) : comp;\n}\n\nfunction createAsyncPlaceholder(factory, data, context, children, tag) {\n var node = createEmptyVNode();\n node.asyncFactory = factory;\n node.asyncMeta = {\n data: data,\n context: context,\n children: children,\n tag: tag\n };\n return node;\n}\n\nfunction resolveAsyncComponent(factory, baseCtor) {\n if (isTrue(factory.error) && isDef(factory.errorComp)) {\n return factory.errorComp;\n }\n\n if (isDef(factory.resolved)) {\n return factory.resolved;\n }\n\n var owner = currentRenderingInstance;\n\n if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {\n // already pending\n factory.owners.push(owner);\n }\n\n if (isTrue(factory.loading) && isDef(factory.loadingComp)) {\n return factory.loadingComp;\n }\n\n if (owner && !isDef(factory.owners)) {\n var owners = factory.owners = [owner];\n var sync = true;\n var timerLoading = null;\n var timerTimeout = null;\n owner.$on('hook:destroyed', function () {\n return remove(owners, owner);\n });\n\n var forceRender = function forceRender(renderCompleted) {\n for (var i = 0, l = owners.length; i < l; i++) {\n owners[i].$forceUpdate();\n }\n\n if (renderCompleted) {\n owners.length = 0;\n\n if (timerLoading !== null) {\n clearTimeout(timerLoading);\n timerLoading = null;\n }\n\n if (timerTimeout !== null) {\n clearTimeout(timerTimeout);\n timerTimeout = null;\n }\n }\n };\n\n var resolve = once(function (res) {\n // cache resolved\n factory.resolved = ensureCtor(res, baseCtor); // invoke callbacks only if this is not a synchronous resolve\n // (async resolves are shimmed as synchronous during SSR)\n\n if (!sync) {\n forceRender(true);\n } else {\n owners.length = 0;\n }\n });\n var reject = once(function (reason) {\n process.env.NODE_ENV !== 'production' && warn(\"Failed to resolve async component: \" + String(factory) + (reason ? \"\\nReason: \" + reason : ''));\n\n if (isDef(factory.errorComp)) {\n factory.error = true;\n forceRender(true);\n }\n });\n var res = factory(resolve, reject);\n\n if (isObject(res)) {\n if (isPromise(res)) {\n // () => Promise\n if (isUndef(factory.resolved)) {\n res.then(resolve, reject);\n }\n } else if (isPromise(res.component)) {\n res.component.then(resolve, reject);\n\n if (isDef(res.error)) {\n factory.errorComp = ensureCtor(res.error, baseCtor);\n }\n\n if (isDef(res.loading)) {\n factory.loadingComp = ensureCtor(res.loading, baseCtor);\n\n if (res.delay === 0) {\n factory.loading = true;\n } else {\n timerLoading = setTimeout(function () {\n timerLoading = null;\n\n if (isUndef(factory.resolved) && isUndef(factory.error)) {\n factory.loading = true;\n forceRender(false);\n }\n }, res.delay || 200);\n }\n }\n\n if (isDef(res.timeout)) {\n timerTimeout = setTimeout(function () {\n timerTimeout = null;\n\n if (isUndef(factory.resolved)) {\n reject(process.env.NODE_ENV !== 'production' ? \"timeout (\" + res.timeout + \"ms)\" : null);\n }\n }, res.timeout);\n }\n }\n }\n\n sync = false; // return in case resolved synchronously\n\n return factory.loading ? factory.loadingComp : factory.resolved;\n }\n}\n/* */\n\n\nfunction getFirstComponentChild(children) {\n if (Array.isArray(children)) {\n for (var i = 0; i < children.length; i++) {\n var c = children[i];\n\n if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {\n return c;\n }\n }\n }\n}\n/* */\n\n/* */\n\n\nfunction initEvents(vm) {\n vm._events = Object.create(null);\n vm._hasHookEvent = false; // init parent attached events\n\n var listeners = vm.$options._parentListeners;\n\n if (listeners) {\n updateComponentListeners(vm, listeners);\n }\n}\n\nvar target;\n\nfunction add(event, fn) {\n target.$on(event, fn);\n}\n\nfunction remove$1(event, fn) {\n target.$off(event, fn);\n}\n\nfunction createOnceHandler(event, fn) {\n var _target = target;\n return function onceHandler() {\n var res = fn.apply(null, arguments);\n\n if (res !== null) {\n _target.$off(event, onceHandler);\n }\n };\n}\n\nfunction updateComponentListeners(vm, listeners, oldListeners) {\n target = vm;\n updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);\n target = undefined;\n}\n\nfunction eventsMixin(Vue) {\n var hookRE = /^hook:/;\n\n Vue.prototype.$on = function (event, fn) {\n var vm = this;\n\n if (Array.isArray(event)) {\n for (var i = 0, l = event.length; i < l; i++) {\n vm.$on(event[i], fn);\n }\n } else {\n (vm._events[event] || (vm._events[event] = [])).push(fn); // optimize hook:event cost by using a boolean flag marked at registration\n // instead of a hash lookup\n\n if (hookRE.test(event)) {\n vm._hasHookEvent = true;\n }\n }\n\n return vm;\n };\n\n Vue.prototype.$once = function (event, fn) {\n var vm = this;\n\n function on() {\n vm.$off(event, on);\n fn.apply(vm, arguments);\n }\n\n on.fn = fn;\n vm.$on(event, on);\n return vm;\n };\n\n Vue.prototype.$off = function (event, fn) {\n var vm = this; // all\n\n if (!arguments.length) {\n vm._events = Object.create(null);\n return vm;\n } // array of events\n\n\n if (Array.isArray(event)) {\n for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {\n vm.$off(event[i$1], fn);\n }\n\n return vm;\n } // specific event\n\n\n var cbs = vm._events[event];\n\n if (!cbs) {\n return vm;\n }\n\n if (!fn) {\n vm._events[event] = null;\n return vm;\n } // specific handler\n\n\n var cb;\n var i = cbs.length;\n\n while (i--) {\n cb = cbs[i];\n\n if (cb === fn || cb.fn === fn) {\n cbs.splice(i, 1);\n break;\n }\n }\n\n return vm;\n };\n\n Vue.prototype.$emit = function (event) {\n var vm = this;\n\n if (process.env.NODE_ENV !== 'production') {\n var lowerCaseEvent = event.toLowerCase();\n\n if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {\n tip(\"Event \\\"\" + lowerCaseEvent + \"\\\" is emitted in component \" + formatComponentName(vm) + \" but the handler is registered for \\\"\" + 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 \\\"\" + hyphenate(event) + \"\\\" instead of \\\"\" + event + \"\\\".\");\n }\n }\n\n var cbs = vm._events[event];\n\n if (cbs) {\n cbs = cbs.length > 1 ? toArray(cbs) : cbs;\n var args = toArray(arguments, 1);\n var info = \"event handler for \\\"\" + event + \"\\\"\";\n\n for (var i = 0, l = cbs.length; i < l; i++) {\n invokeWithErrorHandling(cbs[i], vm, args, vm, info);\n }\n }\n\n return vm;\n };\n}\n/* */\n\n\nvar activeInstance = null;\nvar isUpdatingChildComponent = false;\n\nfunction setActiveInstance(vm) {\n var prevActiveInstance = activeInstance;\n activeInstance = vm;\n return function () {\n activeInstance = prevActiveInstance;\n };\n}\n\nfunction initLifecycle(vm) {\n var options = vm.$options; // locate first non-abstract parent\n\n var parent = options.parent;\n\n if (parent && !options.abstract) {\n while (parent.$options.abstract && parent.$parent) {\n parent = parent.$parent;\n }\n\n parent.$children.push(vm);\n }\n\n vm.$parent = parent;\n vm.$root = parent ? parent.$root : vm;\n vm.$children = [];\n vm.$refs = {};\n vm._watcher = null;\n vm._inactive = null;\n vm._directInactive = false;\n vm._isMounted = false;\n vm._isDestroyed = false;\n vm._isBeingDestroyed = false;\n}\n\nfunction lifecycleMixin(Vue) {\n Vue.prototype._update = function (vnode, hydrating) {\n var vm = this;\n var prevEl = vm.$el;\n var prevVnode = vm._vnode;\n var restoreActiveInstance = setActiveInstance(vm);\n vm._vnode = vnode; // Vue.prototype.__patch__ is injected in entry points\n // based on the rendering backend used.\n\n if (!prevVnode) {\n // initial render\n vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false\n /* removeOnly */\n );\n } else {\n // updates\n vm.$el = vm.__patch__(prevVnode, vnode);\n }\n\n restoreActiveInstance(); // update __vue__ reference\n\n if (prevEl) {\n prevEl.__vue__ = null;\n }\n\n if (vm.$el) {\n vm.$el.__vue__ = vm;\n } // if parent is an HOC, update its $el as well\n\n\n if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {\n vm.$parent.$el = vm.$el;\n } // updated hook is called by the scheduler to ensure that children are\n // updated in a parent's updated hook.\n\n };\n\n Vue.prototype.$forceUpdate = function () {\n var vm = this;\n\n if (vm._watcher) {\n vm._watcher.update();\n }\n };\n\n Vue.prototype.$destroy = function () {\n var vm = this;\n\n if (vm._isBeingDestroyed) {\n return;\n }\n\n callHook(vm, 'beforeDestroy');\n vm._isBeingDestroyed = true; // remove self from parent\n\n var parent = vm.$parent;\n\n if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {\n remove(parent.$children, vm);\n } // teardown watchers\n\n\n if (vm._watcher) {\n vm._watcher.teardown();\n }\n\n var i = vm._watchers.length;\n\n while (i--) {\n vm._watchers[i].teardown();\n } // remove reference from data ob\n // frozen object may not have observer.\n\n\n if (vm._data.__ob__) {\n vm._data.__ob__.vmCount--;\n } // call the last hook...\n\n\n vm._isDestroyed = true; // invoke destroy hooks on current rendered tree\n\n vm.__patch__(vm._vnode, null); // fire destroyed hook\n\n\n callHook(vm, 'destroyed'); // turn off all instance listeners.\n\n vm.$off(); // remove __vue__ reference\n\n if (vm.$el) {\n vm.$el.__vue__ = null;\n } // release circular reference (#6759)\n\n\n if (vm.$vnode) {\n vm.$vnode.parent = null;\n }\n };\n}\n\nfunction mountComponent(vm, el, hydrating) {\n vm.$el = el;\n\n if (!vm.$options.render) {\n vm.$options.render = createEmptyVNode;\n\n if (process.env.NODE_ENV !== 'production') {\n /* istanbul ignore if */\n if (vm.$options.template && vm.$options.template.charAt(0) !== '#' || vm.$options.el || el) {\n 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);\n } else {\n warn('Failed to mount component: template or render function not defined.', vm);\n }\n }\n }\n\n callHook(vm, 'beforeMount');\n var updateComponent;\n /* istanbul ignore if */\n\n if (process.env.NODE_ENV !== 'production' && config.performance && mark) {\n updateComponent = function updateComponent() {\n var name = vm._name;\n var id = vm._uid;\n var startTag = \"vue-perf-start:\" + id;\n var endTag = \"vue-perf-end:\" + id;\n mark(startTag);\n\n var vnode = vm._render();\n\n mark(endTag);\n measure(\"vue \" + name + \" render\", startTag, endTag);\n mark(startTag);\n\n vm._update(vnode, hydrating);\n\n mark(endTag);\n measure(\"vue \" + name + \" patch\", startTag, endTag);\n };\n } else {\n updateComponent = function updateComponent() {\n vm._update(vm._render(), hydrating);\n };\n } // we set this to vm._watcher inside the watcher's constructor\n // since the watcher's initial patch may call $forceUpdate (e.g. inside child\n // component's mounted hook), which relies on vm._watcher being already defined\n\n\n new Watcher(vm, updateComponent, noop, {\n before: function before() {\n if (vm._isMounted && !vm._isDestroyed) {\n callHook(vm, 'beforeUpdate');\n }\n }\n }, true\n /* isRenderWatcher */\n );\n hydrating = false; // manually mounted instance, call mounted on self\n // mounted is called for render-created child components in its inserted hook\n\n if (vm.$vnode == null) {\n vm._isMounted = true;\n callHook(vm, 'mounted');\n }\n\n return vm;\n}\n\nfunction updateChildComponent(vm, propsData, listeners, parentVnode, renderChildren) {\n if (process.env.NODE_ENV !== 'production') {\n isUpdatingChildComponent = true;\n } // determine whether component has slot children\n // we need to do this before overwriting $options._renderChildren.\n // check if there are dynamic scopedSlots (hand-written or compiled but with\n // dynamic slot names). Static scoped slots compiled from template has the\n // \"$stable\" marker.\n\n\n var newScopedSlots = parentVnode.data.scopedSlots;\n var oldScopedSlots = vm.$scopedSlots;\n 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\n // update. Dynamic scoped slots may also have changed. In such cases, a forced\n // update is necessary to ensure correctness.\n\n var needsForceUpdate = !!(renderChildren || // has new static slots\n vm.$options._renderChildren || // has old static slots\n hasDynamicScopedSlot);\n vm.$options._parentVnode = parentVnode;\n vm.$vnode = parentVnode; // update vm's placeholder node without re-render\n\n if (vm._vnode) {\n // update child tree's parent\n vm._vnode.parent = parentVnode;\n }\n\n vm.$options._renderChildren = renderChildren; // update $attrs and $listeners hash\n // these are also reactive so they may trigger child update if the child\n // used them during render\n\n vm.$attrs = parentVnode.data.attrs || emptyObject;\n vm.$listeners = listeners || emptyObject; // update props\n\n if (propsData && vm.$options.props) {\n toggleObserving(false);\n var props = vm._props;\n var propKeys = vm.$options._propKeys || [];\n\n for (var i = 0; i < propKeys.length; i++) {\n var key = propKeys[i];\n var propOptions = vm.$options.props; // wtf flow?\n\n props[key] = validateProp(key, propOptions, propsData, vm);\n }\n\n toggleObserving(true); // keep a copy of raw propsData\n\n vm.$options.propsData = propsData;\n } // update listeners\n\n\n listeners = listeners || emptyObject;\n var oldListeners = vm.$options._parentListeners;\n vm.$options._parentListeners = listeners;\n updateComponentListeners(vm, listeners, oldListeners); // resolve slots + force update if has children\n\n if (needsForceUpdate) {\n vm.$slots = resolveSlots(renderChildren, parentVnode.context);\n vm.$forceUpdate();\n }\n\n if (process.env.NODE_ENV !== 'production') {\n isUpdatingChildComponent = false;\n }\n}\n\nfunction isInInactiveTree(vm) {\n while (vm && (vm = vm.$parent)) {\n if (vm._inactive) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction activateChildComponent(vm, direct) {\n if (direct) {\n vm._directInactive = false;\n\n if (isInInactiveTree(vm)) {\n return;\n }\n } else if (vm._directInactive) {\n return;\n }\n\n if (vm._inactive || vm._inactive === null) {\n vm._inactive = false;\n\n for (var i = 0; i < vm.$children.length; i++) {\n activateChildComponent(vm.$children[i]);\n }\n\n callHook(vm, 'activated');\n }\n}\n\nfunction deactivateChildComponent(vm, direct) {\n if (direct) {\n vm._directInactive = true;\n\n if (isInInactiveTree(vm)) {\n return;\n }\n }\n\n if (!vm._inactive) {\n vm._inactive = true;\n\n for (var i = 0; i < vm.$children.length; i++) {\n deactivateChildComponent(vm.$children[i]);\n }\n\n callHook(vm, 'deactivated');\n }\n}\n\nfunction callHook(vm, hook) {\n // #7573 disable dep collection when invoking lifecycle hooks\n pushTarget();\n var handlers = vm.$options[hook];\n var info = hook + \" hook\";\n\n if (handlers) {\n for (var i = 0, j = handlers.length; i < j; i++) {\n invokeWithErrorHandling(handlers[i], vm, null, vm, info);\n }\n }\n\n if (vm._hasHookEvent) {\n vm.$emit('hook:' + hook);\n }\n\n popTarget();\n}\n/* */\n\n\nvar MAX_UPDATE_COUNT = 100;\nvar queue = [];\nvar activatedChildren = [];\nvar has = {};\nvar circular = {};\nvar waiting = false;\nvar flushing = false;\nvar index = 0;\n/**\n * Reset the scheduler's state.\n */\n\nfunction resetSchedulerState() {\n index = queue.length = activatedChildren.length = 0;\n has = {};\n\n if (process.env.NODE_ENV !== 'production') {\n circular = {};\n }\n\n waiting = flushing = false;\n} // Async edge case #6566 requires saving the timestamp when event listeners are\n// attached. However, calling performance.now() has a perf overhead especially\n// if the page has thousands of event listeners. Instead, we take a timestamp\n// every time the scheduler flushes and use that for all event listeners\n// attached during that flush.\n\n\nvar currentFlushTimestamp = 0; // Async edge case fix requires storing an event listener's attach timestamp.\n\nvar getNow = Date.now; // Determine what event timestamp the browser is using. Annoyingly, the\n// timestamp can either be hi-res (relative to page load) or low-res\n// (relative to UNIX epoch), so in order to compare time we have to use the\n// same timestamp type when saving the flush timestamp.\n// All IE versions use low-res event timestamps, and have problematic clock\n// implementations (#9632)\n\nif (inBrowser && !isIE) {\n var performance = window.performance;\n\n if (performance && typeof performance.now === 'function' && getNow() > document.createEvent('Event').timeStamp) {\n // if the event timestamp, although evaluated AFTER the Date.now(), is\n // smaller than it, it means the event is using a hi-res timestamp,\n // and we need to use the hi-res version for event listener timestamps as\n // well.\n getNow = function getNow() {\n return performance.now();\n };\n }\n}\n/**\n * Flush both queues and run the watchers.\n */\n\n\nfunction flushSchedulerQueue() {\n currentFlushTimestamp = getNow();\n flushing = true;\n var watcher, id; // Sort queue before flush.\n // This ensures that:\n // 1. Components are updated from parent to child. (because parent is always\n // created before the child)\n // 2. A component's user watchers are run before its render watcher (because\n // user watchers are created before the render watcher)\n // 3. If a component is destroyed during a parent component's watcher run,\n // its watchers can be skipped.\n\n queue.sort(function (a, b) {\n return a.id - b.id;\n }); // do not cache length because more watchers might be pushed\n // as we run existing watchers\n\n for (index = 0; index < queue.length; index++) {\n watcher = queue[index];\n\n if (watcher.before) {\n watcher.before();\n }\n\n id = watcher.id;\n has[id] = null;\n watcher.run(); // in dev build, check and stop circular updates.\n\n if (process.env.NODE_ENV !== 'production' && has[id] != null) {\n circular[id] = (circular[id] || 0) + 1;\n\n if (circular[id] > MAX_UPDATE_COUNT) {\n warn('You may have an infinite update loop ' + (watcher.user ? \"in watcher with expression \\\"\" + watcher.expression + \"\\\"\" : \"in a component render function.\"), watcher.vm);\n break;\n }\n }\n } // keep copies of post queues before resetting state\n\n\n var activatedQueue = activatedChildren.slice();\n var updatedQueue = queue.slice();\n resetSchedulerState(); // call component updated and activated hooks\n\n callActivatedHooks(activatedQueue);\n callUpdatedHooks(updatedQueue); // devtool hook\n\n /* istanbul ignore if */\n\n if (devtools && config.devtools) {\n devtools.emit('flush');\n }\n}\n\nfunction callUpdatedHooks(queue) {\n var i = queue.length;\n\n while (i--) {\n var watcher = queue[i];\n var vm = watcher.vm;\n\n if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {\n callHook(vm, 'updated');\n }\n }\n}\n/**\n * Queue a kept-alive component that was activated during patch.\n * The queue will be processed after the entire tree has been patched.\n */\n\n\nfunction queueActivatedComponent(vm) {\n // setting _inactive to false here so that a render function can\n // rely on checking whether it's in an inactive tree (e.g. router-view)\n vm._inactive = false;\n activatedChildren.push(vm);\n}\n\nfunction callActivatedHooks(queue) {\n for (var i = 0; i < queue.length; i++) {\n queue[i]._inactive = true;\n activateChildComponent(queue[i], true\n /* true */\n );\n }\n}\n/**\n * Push a watcher into the watcher queue.\n * Jobs with duplicate IDs will be skipped unless it's\n * pushed when the queue is being flushed.\n */\n\n\nfunction queueWatcher(watcher) {\n var id = watcher.id;\n\n if (has[id] == null) {\n has[id] = true;\n\n if (!flushing) {\n queue.push(watcher);\n } else {\n // if already flushing, splice the watcher based on its id\n // if already past its id, it will be run next immediately.\n var i = queue.length - 1;\n\n while (i > index && queue[i].id > watcher.id) {\n i--;\n }\n\n queue.splice(i + 1, 0, watcher);\n } // queue the flush\n\n\n if (!waiting) {\n waiting = true;\n\n if (process.env.NODE_ENV !== 'production' && !config.async) {\n flushSchedulerQueue();\n return;\n }\n\n nextTick(flushSchedulerQueue);\n }\n }\n}\n/* */\n\n\nvar uid$2 = 0;\n/**\n * A watcher parses an expression, collects dependencies,\n * and fires callback when the expression value changes.\n * This is used for both the $watch() api and directives.\n */\n\nvar Watcher = function Watcher(vm, expOrFn, cb, options, isRenderWatcher) {\n this.vm = vm;\n\n if (isRenderWatcher) {\n vm._watcher = this;\n }\n\n vm._watchers.push(this); // options\n\n\n if (options) {\n this.deep = !!options.deep;\n this.user = !!options.user;\n this.lazy = !!options.lazy;\n this.sync = !!options.sync;\n this.before = options.before;\n } else {\n this.deep = this.user = this.lazy = this.sync = false;\n }\n\n this.cb = cb;\n this.id = ++uid$2; // uid for batching\n\n this.active = true;\n this.dirty = this.lazy; // for lazy watchers\n\n this.deps = [];\n this.newDeps = [];\n this.depIds = new _Set();\n this.newDepIds = new _Set();\n this.expression = process.env.NODE_ENV !== 'production' ? expOrFn.toString() : ''; // parse expression for getter\n\n if (typeof expOrFn === 'function') {\n this.getter = expOrFn;\n } else {\n this.getter = parsePath(expOrFn);\n\n if (!this.getter) {\n this.getter = noop;\n process.env.NODE_ENV !== 'production' && warn(\"Failed watching path: \\\"\" + expOrFn + \"\\\" \" + 'Watcher only accepts simple dot-delimited paths. ' + 'For full control, use a function instead.', vm);\n }\n }\n\n this.value = this.lazy ? undefined : this.get();\n};\n/**\n * Evaluate the getter, and re-collect dependencies.\n */\n\n\nWatcher.prototype.get = function get() {\n pushTarget(this);\n var value;\n var vm = this.vm;\n\n try {\n value = this.getter.call(vm, vm);\n } catch (e) {\n if (this.user) {\n handleError(e, vm, \"getter for watcher \\\"\" + this.expression + \"\\\"\");\n } else {\n throw e;\n }\n } finally {\n // \"touch\" every property so they are all tracked as\n // dependencies for deep watching\n if (this.deep) {\n traverse(value);\n }\n\n popTarget();\n this.cleanupDeps();\n }\n\n return value;\n};\n/**\n * Add a dependency to this directive.\n */\n\n\nWatcher.prototype.addDep = function addDep(dep) {\n var id = dep.id;\n\n if (!this.newDepIds.has(id)) {\n this.newDepIds.add(id);\n this.newDeps.push(dep);\n\n if (!this.depIds.has(id)) {\n dep.addSub(this);\n }\n }\n};\n/**\n * Clean up for dependency collection.\n */\n\n\nWatcher.prototype.cleanupDeps = function cleanupDeps() {\n var i = this.deps.length;\n\n while (i--) {\n var dep = this.deps[i];\n\n if (!this.newDepIds.has(dep.id)) {\n dep.removeSub(this);\n }\n }\n\n var tmp = this.depIds;\n this.depIds = this.newDepIds;\n this.newDepIds = tmp;\n this.newDepIds.clear();\n tmp = this.deps;\n this.deps = this.newDeps;\n this.newDeps = tmp;\n this.newDeps.length = 0;\n};\n/**\n * Subscriber interface.\n * Will be called when a dependency changes.\n */\n\n\nWatcher.prototype.update = function update() {\n /* istanbul ignore else */\n if (this.lazy) {\n this.dirty = true;\n } else if (this.sync) {\n this.run();\n } else {\n queueWatcher(this);\n }\n};\n/**\n * Scheduler job interface.\n * Will be called by the scheduler.\n */\n\n\nWatcher.prototype.run = function run() {\n if (this.active) {\n var value = this.get();\n\n if (value !== this.value || // Deep watchers and watchers on Object/Arrays should fire even\n // when the value is the same, because the value may\n // have mutated.\n isObject(value) || this.deep) {\n // set new value\n var oldValue = this.value;\n this.value = value;\n\n if (this.user) {\n var info = \"callback for watcher \\\"\" + this.expression + \"\\\"\";\n invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);\n } else {\n this.cb.call(this.vm, value, oldValue);\n }\n }\n }\n};\n/**\n * Evaluate the value of the watcher.\n * This only gets called for lazy watchers.\n */\n\n\nWatcher.prototype.evaluate = function evaluate() {\n this.value = this.get();\n this.dirty = false;\n};\n/**\n * Depend on all deps collected by this watcher.\n */\n\n\nWatcher.prototype.depend = function depend() {\n var i = this.deps.length;\n\n while (i--) {\n this.deps[i].depend();\n }\n};\n/**\n * Remove self from all dependencies' subscriber list.\n */\n\n\nWatcher.prototype.teardown = function teardown() {\n if (this.active) {\n // remove self from vm's watcher list\n // this is a somewhat expensive operation so we skip it\n // if the vm is being destroyed.\n if (!this.vm._isBeingDestroyed) {\n remove(this.vm._watchers, this);\n }\n\n var i = this.deps.length;\n\n while (i--) {\n this.deps[i].removeSub(this);\n }\n\n this.active = false;\n }\n};\n/* */\n\n\nvar sharedPropertyDefinition = {\n enumerable: true,\n configurable: true,\n get: noop,\n set: noop\n};\n\nfunction proxy(target, sourceKey, key) {\n sharedPropertyDefinition.get = function proxyGetter() {\n return this[sourceKey][key];\n };\n\n sharedPropertyDefinition.set = function proxySetter(val) {\n this[sourceKey][key] = val;\n };\n\n Object.defineProperty(target, key, sharedPropertyDefinition);\n}\n\nfunction initState(vm) {\n vm._watchers = [];\n var opts = vm.$options;\n\n if (opts.props) {\n initProps(vm, opts.props);\n }\n\n if (opts.methods) {\n initMethods(vm, opts.methods);\n }\n\n if (opts.data) {\n initData(vm);\n } else {\n observe(vm._data = {}, true\n /* asRootData */\n );\n }\n\n if (opts.computed) {\n initComputed(vm, opts.computed);\n }\n\n if (opts.watch && opts.watch !== nativeWatch) {\n initWatch(vm, opts.watch);\n }\n}\n\nfunction initProps(vm, propsOptions) {\n var propsData = vm.$options.propsData || {};\n var props = vm._props = {}; // cache prop keys so that future props updates can iterate using Array\n // instead of dynamic object key enumeration.\n\n var keys = vm.$options._propKeys = [];\n var isRoot = !vm.$parent; // root instance props should be converted\n\n if (!isRoot) {\n toggleObserving(false);\n }\n\n var loop = function loop(key) {\n keys.push(key);\n var value = validateProp(key, propsOptions, propsData, vm);\n /* istanbul ignore else */\n\n if (process.env.NODE_ENV !== 'production') {\n var hyphenatedKey = hyphenate(key);\n\n if (isReservedAttribute(hyphenatedKey) || config.isReservedAttr(hyphenatedKey)) {\n warn(\"\\\"\" + hyphenatedKey + \"\\\" is a reserved attribute and cannot be used as component prop.\", vm);\n }\n\n defineReactive$$1(props, key, value, function () {\n if (!isRoot && !isUpdatingChildComponent) {\n 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: \\\"\" + key + \"\\\"\", vm);\n }\n });\n } else {\n defineReactive$$1(props, key, value);\n } // static props are already proxied on the component's prototype\n // during Vue.extend(). We only need to proxy props defined at\n // instantiation here.\n\n\n if (!(key in vm)) {\n proxy(vm, \"_props\", key);\n }\n };\n\n for (var key in propsOptions) {\n loop(key);\n }\n\n toggleObserving(true);\n}\n\nfunction initData(vm) {\n var data = vm.$options.data;\n data = vm._data = typeof data === 'function' ? getData(data, vm) : data || {};\n\n if (!isPlainObject(data)) {\n data = {};\n process.env.NODE_ENV !== 'production' && warn('data functions should return an object:\\n' + 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function', vm);\n } // proxy data on instance\n\n\n var keys = Object.keys(data);\n var props = vm.$options.props;\n var methods = vm.$options.methods;\n var i = keys.length;\n\n while (i--) {\n var key = keys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (methods && hasOwn(methods, key)) {\n warn(\"Method \\\"\" + key + \"\\\" has already been defined as a data property.\", vm);\n }\n }\n\n if (props && hasOwn(props, key)) {\n process.env.NODE_ENV !== 'production' && warn(\"The data property \\\"\" + key + \"\\\" is already declared as a prop. \" + \"Use prop default value instead.\", vm);\n } else if (!isReserved(key)) {\n proxy(vm, \"_data\", key);\n }\n } // observe data\n\n\n observe(data, true\n /* asRootData */\n );\n}\n\nfunction getData(data, vm) {\n // #7573 disable dep collection when invoking data getters\n pushTarget();\n\n try {\n return data.call(vm, vm);\n } catch (e) {\n handleError(e, vm, \"data()\");\n return {};\n } finally {\n popTarget();\n }\n}\n\nvar computedWatcherOptions = {\n lazy: true\n};\n\nfunction initComputed(vm, computed) {\n // $flow-disable-line\n var watchers = vm._computedWatchers = Object.create(null); // computed properties are just getters during SSR\n\n var isSSR = isServerRendering();\n\n for (var key in computed) {\n var userDef = computed[key];\n var getter = typeof userDef === 'function' ? userDef : userDef.get;\n\n if (process.env.NODE_ENV !== 'production' && getter == null) {\n warn(\"Getter is missing for computed property \\\"\" + key + \"\\\".\", vm);\n }\n\n if (!isSSR) {\n // create internal watcher for the computed property.\n watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);\n } // component-defined computed properties are already defined on the\n // component prototype. We only need to define computed properties defined\n // at instantiation here.\n\n\n if (!(key in vm)) {\n defineComputed(vm, key, userDef);\n } else if (process.env.NODE_ENV !== 'production') {\n if (key in vm.$data) {\n warn(\"The computed property \\\"\" + key + \"\\\" is already defined in data.\", vm);\n } else if (vm.$options.props && key in vm.$options.props) {\n warn(\"The computed property \\\"\" + key + \"\\\" is already defined as a prop.\", vm);\n } else if (vm.$options.methods && key in vm.$options.methods) {\n warn(\"The computed property \\\"\" + key + \"\\\" is already defined as a method.\", vm);\n }\n }\n }\n}\n\nfunction defineComputed(target, key, userDef) {\n var shouldCache = !isServerRendering();\n\n if (typeof userDef === 'function') {\n sharedPropertyDefinition.get = shouldCache ? createComputedGetter(key) : createGetterInvoker(userDef);\n sharedPropertyDefinition.set = noop;\n } else {\n sharedPropertyDefinition.get = userDef.get ? shouldCache && userDef.cache !== false ? createComputedGetter(key) : createGetterInvoker(userDef.get) : noop;\n sharedPropertyDefinition.set = userDef.set || noop;\n }\n\n if (process.env.NODE_ENV !== 'production' && sharedPropertyDefinition.set === noop) {\n sharedPropertyDefinition.set = function () {\n warn(\"Computed property \\\"\" + key + \"\\\" was assigned to but it has no setter.\", this);\n };\n }\n\n Object.defineProperty(target, key, sharedPropertyDefinition);\n}\n\nfunction createComputedGetter(key) {\n return function computedGetter() {\n var watcher = this._computedWatchers && this._computedWatchers[key];\n\n if (watcher) {\n if (watcher.dirty) {\n watcher.evaluate();\n }\n\n if (Dep.target) {\n watcher.depend();\n }\n\n return watcher.value;\n }\n };\n}\n\nfunction createGetterInvoker(fn) {\n return function computedGetter() {\n return fn.call(this, this);\n };\n}\n\nfunction initMethods(vm, methods) {\n var props = vm.$options.props;\n\n for (var key in methods) {\n if (process.env.NODE_ENV !== 'production') {\n if (typeof methods[key] !== 'function') {\n warn(\"Method \\\"\" + key + \"\\\" has type \\\"\" + _typeof(methods[key]) + \"\\\" in the component definition. \" + \"Did you reference the function correctly?\", vm);\n }\n\n if (props && hasOwn(props, key)) {\n warn(\"Method \\\"\" + key + \"\\\" has already been defined as a prop.\", vm);\n }\n\n if (key in vm && isReserved(key)) {\n warn(\"Method \\\"\" + key + \"\\\" conflicts with an existing Vue instance method. \" + \"Avoid defining component methods that start with _ or $.\");\n }\n }\n\n vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);\n }\n}\n\nfunction initWatch(vm, watch) {\n for (var key in watch) {\n var handler = watch[key];\n\n if (Array.isArray(handler)) {\n for (var i = 0; i < handler.length; i++) {\n createWatcher(vm, key, handler[i]);\n }\n } else {\n createWatcher(vm, key, handler);\n }\n }\n}\n\nfunction createWatcher(vm, expOrFn, handler, options) {\n if (isPlainObject(handler)) {\n options = handler;\n handler = handler.handler;\n }\n\n if (typeof handler === 'string') {\n handler = vm[handler];\n }\n\n return vm.$watch(expOrFn, handler, options);\n}\n\nfunction stateMixin(Vue) {\n // flow somehow has problems with directly declared definition object\n // when using Object.defineProperty, so we have to procedurally build up\n // the object here.\n var dataDef = {};\n\n dataDef.get = function () {\n return this._data;\n };\n\n var propsDef = {};\n\n propsDef.get = function () {\n return this._props;\n };\n\n if (process.env.NODE_ENV !== 'production') {\n dataDef.set = function () {\n warn('Avoid replacing instance root $data. ' + 'Use nested data properties instead.', this);\n };\n\n propsDef.set = function () {\n warn(\"$props is readonly.\", this);\n };\n }\n\n Object.defineProperty(Vue.prototype, '$data', dataDef);\n Object.defineProperty(Vue.prototype, '$props', propsDef);\n Vue.prototype.$set = set;\n Vue.prototype.$delete = del;\n\n Vue.prototype.$watch = function (expOrFn, cb, options) {\n var vm = this;\n\n if (isPlainObject(cb)) {\n return createWatcher(vm, expOrFn, cb, options);\n }\n\n options = options || {};\n options.user = true;\n var watcher = new Watcher(vm, expOrFn, cb, options);\n\n if (options.immediate) {\n var info = \"callback for immediate watcher \\\"\" + watcher.expression + \"\\\"\";\n pushTarget();\n invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);\n popTarget();\n }\n\n return function unwatchFn() {\n watcher.teardown();\n };\n };\n}\n/* */\n\n\nvar uid$3 = 0;\n\nfunction initMixin(Vue) {\n Vue.prototype._init = function (options) {\n var vm = this; // a uid\n\n vm._uid = uid$3++;\n var startTag, endTag;\n /* istanbul ignore if */\n\n if (process.env.NODE_ENV !== 'production' && config.performance && mark) {\n startTag = \"vue-perf-start:\" + vm._uid;\n endTag = \"vue-perf-end:\" + vm._uid;\n mark(startTag);\n } // a flag to avoid this being observed\n\n\n vm._isVue = true; // merge options\n\n if (options && options._isComponent) {\n // optimize internal component instantiation\n // since dynamic options merging is pretty slow, and none of the\n // internal component options needs special treatment.\n initInternalComponent(vm, options);\n } else {\n vm.$options = mergeOptions(resolveConstructorOptions(vm.constructor), options || {}, vm);\n }\n /* istanbul ignore else */\n\n\n if (process.env.NODE_ENV !== 'production') {\n initProxy(vm);\n } else {\n vm._renderProxy = vm;\n } // expose real self\n\n\n vm._self = vm;\n initLifecycle(vm);\n initEvents(vm);\n initRender(vm);\n callHook(vm, 'beforeCreate');\n initInjections(vm); // resolve injections before data/props\n\n initState(vm);\n initProvide(vm); // resolve provide after data/props\n\n callHook(vm, 'created');\n /* istanbul ignore if */\n\n if (process.env.NODE_ENV !== 'production' && config.performance && mark) {\n vm._name = formatComponentName(vm, false);\n mark(endTag);\n measure(\"vue \" + vm._name + \" init\", startTag, endTag);\n }\n\n if (vm.$options.el) {\n vm.$mount(vm.$options.el);\n }\n };\n}\n\nfunction initInternalComponent(vm, options) {\n var opts = vm.$options = Object.create(vm.constructor.options); // doing this because it's faster than dynamic enumeration.\n\n var parentVnode = options._parentVnode;\n opts.parent = options.parent;\n opts._parentVnode = parentVnode;\n var vnodeComponentOptions = parentVnode.componentOptions;\n opts.propsData = vnodeComponentOptions.propsData;\n opts._parentListeners = vnodeComponentOptions.listeners;\n opts._renderChildren = vnodeComponentOptions.children;\n opts._componentTag = vnodeComponentOptions.tag;\n\n if (options.render) {\n opts.render = options.render;\n opts.staticRenderFns = options.staticRenderFns;\n }\n}\n\nfunction resolveConstructorOptions(Ctor) {\n var options = Ctor.options;\n\n if (Ctor.super) {\n var superOptions = resolveConstructorOptions(Ctor.super);\n var cachedSuperOptions = Ctor.superOptions;\n\n if (superOptions !== cachedSuperOptions) {\n // super option changed,\n // need to resolve new options.\n Ctor.superOptions = superOptions; // check if there are any late-modified/attached options (#4976)\n\n var modifiedOptions = resolveModifiedOptions(Ctor); // update base extend options\n\n if (modifiedOptions) {\n extend(Ctor.extendOptions, modifiedOptions);\n }\n\n options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);\n\n if (options.name) {\n options.components[options.name] = Ctor;\n }\n }\n }\n\n return options;\n}\n\nfunction resolveModifiedOptions(Ctor) {\n var modified;\n var latest = Ctor.options;\n var sealed = Ctor.sealedOptions;\n\n for (var key in latest) {\n if (latest[key] !== sealed[key]) {\n if (!modified) {\n modified = {};\n }\n\n modified[key] = latest[key];\n }\n }\n\n return modified;\n}\n\nfunction Vue(options) {\n if (process.env.NODE_ENV !== 'production' && !(this instanceof Vue)) {\n warn('Vue is a constructor and should be called with the `new` keyword');\n }\n\n this._init(options);\n}\n\ninitMixin(Vue);\nstateMixin(Vue);\neventsMixin(Vue);\nlifecycleMixin(Vue);\nrenderMixin(Vue);\n/* */\n\nfunction initUse(Vue) {\n Vue.use = function (plugin) {\n var installedPlugins = this._installedPlugins || (this._installedPlugins = []);\n\n if (installedPlugins.indexOf(plugin) > -1) {\n return this;\n } // additional parameters\n\n\n var args = toArray(arguments, 1);\n args.unshift(this);\n\n if (typeof plugin.install === 'function') {\n plugin.install.apply(plugin, args);\n } else if (typeof plugin === 'function') {\n plugin.apply(null, args);\n }\n\n installedPlugins.push(plugin);\n return this;\n };\n}\n/* */\n\n\nfunction initMixin$1(Vue) {\n Vue.mixin = function (mixin) {\n this.options = mergeOptions(this.options, mixin);\n return this;\n };\n}\n/* */\n\n\nfunction initExtend(Vue) {\n /**\n * Each instance constructor, including Vue, has a unique\n * cid. This enables us to create wrapped \"child\n * constructors\" for prototypal inheritance and cache them.\n */\n Vue.cid = 0;\n var cid = 1;\n /**\n * Class inheritance\n */\n\n Vue.extend = function (extendOptions) {\n extendOptions = extendOptions || {};\n var Super = this;\n var SuperId = Super.cid;\n var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});\n\n if (cachedCtors[SuperId]) {\n return cachedCtors[SuperId];\n }\n\n var name = extendOptions.name || Super.options.name;\n\n if (process.env.NODE_ENV !== 'production' && name) {\n validateComponentName(name);\n }\n\n var Sub = function VueComponent(options) {\n this._init(options);\n };\n\n Sub.prototype = Object.create(Super.prototype);\n Sub.prototype.constructor = Sub;\n Sub.cid = cid++;\n Sub.options = mergeOptions(Super.options, extendOptions);\n Sub['super'] = Super; // For props and computed properties, we define the proxy getters on\n // the Vue instances at extension time, on the extended prototype. This\n // avoids Object.defineProperty calls for each instance created.\n\n if (Sub.options.props) {\n initProps$1(Sub);\n }\n\n if (Sub.options.computed) {\n initComputed$1(Sub);\n } // allow further extension/mixin/plugin usage\n\n\n Sub.extend = Super.extend;\n Sub.mixin = Super.mixin;\n Sub.use = Super.use; // create asset registers, so extended classes\n // can have their private assets too.\n\n ASSET_TYPES.forEach(function (type) {\n Sub[type] = Super[type];\n }); // enable recursive self-lookup\n\n if (name) {\n Sub.options.components[name] = Sub;\n } // keep a reference to the super options at extension time.\n // later at instantiation we can check if Super's options have\n // been updated.\n\n\n Sub.superOptions = Super.options;\n Sub.extendOptions = extendOptions;\n Sub.sealedOptions = extend({}, Sub.options); // cache constructor\n\n cachedCtors[SuperId] = Sub;\n return Sub;\n };\n}\n\nfunction initProps$1(Comp) {\n var props = Comp.options.props;\n\n for (var key in props) {\n proxy(Comp.prototype, \"_props\", key);\n }\n}\n\nfunction initComputed$1(Comp) {\n var computed = Comp.options.computed;\n\n for (var key in computed) {\n defineComputed(Comp.prototype, key, computed[key]);\n }\n}\n/* */\n\n\nfunction initAssetRegisters(Vue) {\n /**\n * Create asset registration methods.\n */\n ASSET_TYPES.forEach(function (type) {\n Vue[type] = function (id, definition) {\n if (!definition) {\n return this.options[type + 's'][id];\n } else {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && type === 'component') {\n validateComponentName(id);\n }\n\n if (type === 'component' && isPlainObject(definition)) {\n definition.name = definition.name || id;\n definition = this.options._base.extend(definition);\n }\n\n if (type === 'directive' && typeof definition === 'function') {\n definition = {\n bind: definition,\n update: definition\n };\n }\n\n this.options[type + 's'][id] = definition;\n return definition;\n }\n };\n });\n}\n/* */\n\n\nfunction getComponentName(opts) {\n return opts && (opts.Ctor.options.name || opts.tag);\n}\n\nfunction matches(pattern, name) {\n if (Array.isArray(pattern)) {\n return pattern.indexOf(name) > -1;\n } else if (typeof pattern === 'string') {\n return pattern.split(',').indexOf(name) > -1;\n } else if (isRegExp(pattern)) {\n return pattern.test(name);\n }\n /* istanbul ignore next */\n\n\n return false;\n}\n\nfunction pruneCache(keepAliveInstance, filter) {\n var cache = keepAliveInstance.cache;\n var keys = keepAliveInstance.keys;\n var _vnode = keepAliveInstance._vnode;\n\n for (var key in cache) {\n var entry = cache[key];\n\n if (entry) {\n var name = entry.name;\n\n if (name && !filter(name)) {\n pruneCacheEntry(cache, key, keys, _vnode);\n }\n }\n }\n}\n\nfunction pruneCacheEntry(cache, key, keys, current) {\n var entry = cache[key];\n\n if (entry && (!current || entry.tag !== current.tag)) {\n entry.componentInstance.$destroy();\n }\n\n cache[key] = null;\n remove(keys, key);\n}\n\nvar patternTypes = [String, RegExp, Array];\nvar KeepAlive = {\n name: 'keep-alive',\n abstract: true,\n props: {\n include: patternTypes,\n exclude: patternTypes,\n max: [String, Number]\n },\n methods: {\n cacheVNode: function cacheVNode() {\n var ref = this;\n var cache = ref.cache;\n var keys = ref.keys;\n var vnodeToCache = ref.vnodeToCache;\n var keyToCache = ref.keyToCache;\n\n if (vnodeToCache) {\n var tag = vnodeToCache.tag;\n var componentInstance = vnodeToCache.componentInstance;\n var componentOptions = vnodeToCache.componentOptions;\n cache[keyToCache] = {\n name: getComponentName(componentOptions),\n tag: tag,\n componentInstance: componentInstance\n };\n keys.push(keyToCache); // prune oldest entry\n\n if (this.max && keys.length > parseInt(this.max)) {\n pruneCacheEntry(cache, keys[0], keys, this._vnode);\n }\n\n this.vnodeToCache = null;\n }\n }\n },\n created: function created() {\n this.cache = Object.create(null);\n this.keys = [];\n },\n destroyed: function destroyed() {\n for (var key in this.cache) {\n pruneCacheEntry(this.cache, key, this.keys);\n }\n },\n mounted: function mounted() {\n var this$1 = this;\n this.cacheVNode();\n this.$watch('include', function (val) {\n pruneCache(this$1, function (name) {\n return matches(val, name);\n });\n });\n this.$watch('exclude', function (val) {\n pruneCache(this$1, function (name) {\n return !matches(val, name);\n });\n });\n },\n updated: function updated() {\n this.cacheVNode();\n },\n render: function render() {\n var slot = this.$slots.default;\n var vnode = getFirstComponentChild(slot);\n var componentOptions = vnode && vnode.componentOptions;\n\n if (componentOptions) {\n // check pattern\n var name = getComponentName(componentOptions);\n var ref = this;\n var include = ref.include;\n var exclude = ref.exclude;\n\n if ( // not included\n include && (!name || !matches(include, name)) || // excluded\n exclude && name && matches(exclude, name)) {\n return vnode;\n }\n\n var ref$1 = this;\n var cache = ref$1.cache;\n var keys = ref$1.keys;\n var key = vnode.key == null // same constructor may get registered as different local components\n // so cid alone is not enough (#3269)\n ? componentOptions.Ctor.cid + (componentOptions.tag ? \"::\" + componentOptions.tag : '') : vnode.key;\n\n if (cache[key]) {\n vnode.componentInstance = cache[key].componentInstance; // make current key freshest\n\n remove(keys, key);\n keys.push(key);\n } else {\n // delay setting the cache until update\n this.vnodeToCache = vnode;\n this.keyToCache = key;\n }\n\n vnode.data.keepAlive = true;\n }\n\n return vnode || slot && slot[0];\n }\n};\nvar builtInComponents = {\n KeepAlive: KeepAlive\n};\n/* */\n\nfunction initGlobalAPI(Vue) {\n // config\n var configDef = {};\n\n configDef.get = function () {\n return config;\n };\n\n if (process.env.NODE_ENV !== 'production') {\n configDef.set = function () {\n warn('Do not replace the Vue.config object, set individual fields instead.');\n };\n }\n\n Object.defineProperty(Vue, 'config', configDef); // exposed util methods.\n // NOTE: these are not considered part of the public API - avoid relying on\n // them unless you are aware of the risk.\n\n Vue.util = {\n warn: warn,\n extend: extend,\n mergeOptions: mergeOptions,\n defineReactive: defineReactive$$1\n };\n Vue.set = set;\n Vue.delete = del;\n Vue.nextTick = nextTick; // 2.6 explicit observable API\n\n Vue.observable = function (obj) {\n observe(obj);\n return obj;\n };\n\n Vue.options = Object.create(null);\n ASSET_TYPES.forEach(function (type) {\n Vue.options[type + 's'] = Object.create(null);\n }); // this is used to identify the \"base\" constructor to extend all plain-object\n // components with in Weex's multi-instance scenarios.\n\n Vue.options._base = Vue;\n extend(Vue.options.components, builtInComponents);\n initUse(Vue);\n initMixin$1(Vue);\n initExtend(Vue);\n initAssetRegisters(Vue);\n}\n\ninitGlobalAPI(Vue);\nObject.defineProperty(Vue.prototype, '$isServer', {\n get: isServerRendering\n});\nObject.defineProperty(Vue.prototype, '$ssrContext', {\n get: function get() {\n /* istanbul ignore next */\n return this.$vnode && this.$vnode.ssrContext;\n }\n}); // expose FunctionalRenderContext for ssr runtime helper installation\n\nObject.defineProperty(Vue, 'FunctionalRenderContext', {\n value: FunctionalRenderContext\n});\nVue.version = '2.6.14';\n/* */\n// these are reserved for web because they are directly compiled away\n// during template compilation\n\nvar isReservedAttr = makeMap('style,class'); // attributes that should be using props for binding\n\nvar acceptValue = makeMap('input,textarea,option,select,progress');\n\nvar mustUseProp = function mustUseProp(tag, type, attr) {\n return attr === 'value' && acceptValue(tag) && type !== 'button' || attr === 'selected' && tag === 'option' || attr === 'checked' && tag === 'input' || attr === 'muted' && tag === 'video';\n};\n\nvar isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');\nvar isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');\n\nvar convertEnumeratedValue = function convertEnumeratedValue(key, value) {\n return isFalsyAttrValue(value) || value === 'false' ? 'false' // allow arbitrary string value for contenteditable\n : key === 'contenteditable' && isValidContentEditableValue(value) ? value : 'true';\n};\n\nvar 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');\nvar xlinkNS = 'http://www.w3.org/1999/xlink';\n\nvar isXlink = function isXlink(name) {\n return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink';\n};\n\nvar getXlinkProp = function getXlinkProp(name) {\n return isXlink(name) ? name.slice(6, name.length) : '';\n};\n\nvar isFalsyAttrValue = function isFalsyAttrValue(val) {\n return val == null || val === false;\n};\n/* */\n\n\nfunction genClassForVnode(vnode) {\n var data = vnode.data;\n var parentNode = vnode;\n var childNode = vnode;\n\n while (isDef(childNode.componentInstance)) {\n childNode = childNode.componentInstance._vnode;\n\n if (childNode && childNode.data) {\n data = mergeClassData(childNode.data, data);\n }\n }\n\n while (isDef(parentNode = parentNode.parent)) {\n if (parentNode && parentNode.data) {\n data = mergeClassData(data, parentNode.data);\n }\n }\n\n return renderClass(data.staticClass, data.class);\n}\n\nfunction mergeClassData(child, parent) {\n return {\n staticClass: concat(child.staticClass, parent.staticClass),\n class: isDef(child.class) ? [child.class, parent.class] : parent.class\n };\n}\n\nfunction renderClass(staticClass, dynamicClass) {\n if (isDef(staticClass) || isDef(dynamicClass)) {\n return concat(staticClass, stringifyClass(dynamicClass));\n }\n /* istanbul ignore next */\n\n\n return '';\n}\n\nfunction concat(a, b) {\n return a ? b ? a + ' ' + b : a : b || '';\n}\n\nfunction stringifyClass(value) {\n if (Array.isArray(value)) {\n return stringifyArray(value);\n }\n\n if (isObject(value)) {\n return stringifyObject(value);\n }\n\n if (typeof value === 'string') {\n return value;\n }\n /* istanbul ignore next */\n\n\n return '';\n}\n\nfunction stringifyArray(value) {\n var res = '';\n var stringified;\n\n for (var i = 0, l = value.length; i < l; i++) {\n if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {\n if (res) {\n res += ' ';\n }\n\n res += stringified;\n }\n }\n\n return res;\n}\n\nfunction stringifyObject(value) {\n var res = '';\n\n for (var key in value) {\n if (value[key]) {\n if (res) {\n res += ' ';\n }\n\n res += key;\n }\n }\n\n return res;\n}\n/* */\n\n\nvar namespaceMap = {\n svg: 'http://www.w3.org/2000/svg',\n math: 'http://www.w3.org/1998/Math/MathML'\n};\nvar 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\n// contain child elements.\n\nvar 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);\n\nvar isReservedTag = function isReservedTag(tag) {\n return isHTMLTag(tag) || isSVG(tag);\n};\n\nfunction getTagNamespace(tag) {\n if (isSVG(tag)) {\n return 'svg';\n } // basic support for MathML\n // note it doesn't support other MathML elements being component roots\n\n\n if (tag === 'math') {\n return 'math';\n }\n}\n\nvar unknownElementCache = Object.create(null);\n\nfunction isUnknownElement(tag) {\n /* istanbul ignore if */\n if (!inBrowser) {\n return true;\n }\n\n if (isReservedTag(tag)) {\n return false;\n }\n\n tag = tag.toLowerCase();\n /* istanbul ignore if */\n\n if (unknownElementCache[tag] != null) {\n return unknownElementCache[tag];\n }\n\n var el = document.createElement(tag);\n\n if (tag.indexOf('-') > -1) {\n // http://stackoverflow.com/a/28210364/1070244\n return unknownElementCache[tag] = el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;\n } else {\n return unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString());\n }\n}\n\nvar isTextInputType = makeMap('text,number,password,search,email,tel,url');\n/* */\n\n/**\n * Query an element selector if it's not an element already.\n */\n\nfunction query(el) {\n if (typeof el === 'string') {\n var selected = document.querySelector(el);\n\n if (!selected) {\n process.env.NODE_ENV !== 'production' && warn('Cannot find element: ' + el);\n return document.createElement('div');\n }\n\n return selected;\n } else {\n return el;\n }\n}\n/* */\n\n\nfunction createElement$1(tagName, vnode) {\n var elm = document.createElement(tagName);\n\n if (tagName !== 'select') {\n return elm;\n } // false or null will remove the attribute but undefined will not\n\n\n if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {\n elm.setAttribute('multiple', 'multiple');\n }\n\n return elm;\n}\n\nfunction createElementNS(namespace, tagName) {\n return document.createElementNS(namespaceMap[namespace], tagName);\n}\n\nfunction createTextNode(text) {\n return document.createTextNode(text);\n}\n\nfunction createComment(text) {\n return document.createComment(text);\n}\n\nfunction insertBefore(parentNode, newNode, referenceNode) {\n parentNode.insertBefore(newNode, referenceNode);\n}\n\nfunction removeChild(node, child) {\n node.removeChild(child);\n}\n\nfunction appendChild(node, child) {\n node.appendChild(child);\n}\n\nfunction parentNode(node) {\n return node.parentNode;\n}\n\nfunction nextSibling(node) {\n return node.nextSibling;\n}\n\nfunction tagName(node) {\n return node.tagName;\n}\n\nfunction setTextContent(node, text) {\n node.textContent = text;\n}\n\nfunction setStyleScope(node, scopeId) {\n node.setAttribute(scopeId, '');\n}\n\nvar nodeOps = /*#__PURE__*/Object.freeze({\n createElement: createElement$1,\n createElementNS: createElementNS,\n createTextNode: createTextNode,\n createComment: createComment,\n insertBefore: insertBefore,\n removeChild: removeChild,\n appendChild: appendChild,\n parentNode: parentNode,\n nextSibling: nextSibling,\n tagName: tagName,\n setTextContent: setTextContent,\n setStyleScope: setStyleScope\n});\n/* */\n\nvar ref = {\n create: function create(_, vnode) {\n registerRef(vnode);\n },\n update: function update(oldVnode, vnode) {\n if (oldVnode.data.ref !== vnode.data.ref) {\n registerRef(oldVnode, true);\n registerRef(vnode);\n }\n },\n destroy: function destroy(vnode) {\n registerRef(vnode, true);\n }\n};\n\nfunction registerRef(vnode, isRemoval) {\n var key = vnode.data.ref;\n\n if (!isDef(key)) {\n return;\n }\n\n var vm = vnode.context;\n var ref = vnode.componentInstance || vnode.elm;\n var refs = vm.$refs;\n\n if (isRemoval) {\n if (Array.isArray(refs[key])) {\n remove(refs[key], ref);\n } else if (refs[key] === ref) {\n refs[key] = undefined;\n }\n } else {\n if (vnode.data.refInFor) {\n if (!Array.isArray(refs[key])) {\n refs[key] = [ref];\n } else if (refs[key].indexOf(ref) < 0) {\n // $flow-disable-line\n refs[key].push(ref);\n }\n } else {\n refs[key] = ref;\n }\n }\n}\n/**\n * Virtual DOM patching algorithm based on Snabbdom by\n * Simon Friis Vindum (@paldepind)\n * Licensed under the MIT License\n * https://github.com/paldepind/snabbdom/blob/master/LICENSE\n *\n * modified by Evan You (@yyx990803)\n *\n * Not type-checking this because this file is perf-critical and the cost\n * of making flow understand it is not worth it.\n */\n\n\nvar emptyNode = new VNode('', {}, []);\nvar hooks = ['create', 'activate', 'update', 'remove', 'destroy'];\n\nfunction sameVnode(a, b) {\n 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));\n}\n\nfunction sameInputType(a, b) {\n if (a.tag !== 'input') {\n return true;\n }\n\n var i;\n var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;\n var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;\n return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB);\n}\n\nfunction createKeyToOldIdx(children, beginIdx, endIdx) {\n var i, key;\n var map = {};\n\n for (i = beginIdx; i <= endIdx; ++i) {\n key = children[i].key;\n\n if (isDef(key)) {\n map[key] = i;\n }\n }\n\n return map;\n}\n\nfunction createPatchFunction(backend) {\n var i, j;\n var cbs = {};\n var modules = backend.modules;\n var nodeOps = backend.nodeOps;\n\n for (i = 0; i < hooks.length; ++i) {\n cbs[hooks[i]] = [];\n\n for (j = 0; j < modules.length; ++j) {\n if (isDef(modules[j][hooks[i]])) {\n cbs[hooks[i]].push(modules[j][hooks[i]]);\n }\n }\n }\n\n function emptyNodeAt(elm) {\n return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm);\n }\n\n function createRmCb(childElm, listeners) {\n function remove$$1() {\n if (--remove$$1.listeners === 0) {\n removeNode(childElm);\n }\n }\n\n remove$$1.listeners = listeners;\n return remove$$1;\n }\n\n function removeNode(el) {\n var parent = nodeOps.parentNode(el); // element may have already been removed due to v-html / v-text\n\n if (isDef(parent)) {\n nodeOps.removeChild(parent, el);\n }\n }\n\n function isUnknownElement$$1(vnode, inVPre) {\n return !inVPre && !vnode.ns && !(config.ignoredElements.length && config.ignoredElements.some(function (ignore) {\n return isRegExp(ignore) ? ignore.test(vnode.tag) : ignore === vnode.tag;\n })) && config.isUnknownElement(vnode.tag);\n }\n\n var creatingElmInVPre = 0;\n\n function createElm(vnode, insertedVnodeQueue, parentElm, refElm, nested, ownerArray, index) {\n if (isDef(vnode.elm) && isDef(ownerArray)) {\n // This vnode was used in a previous render!\n // now it's used as a new node, overwriting its elm would cause\n // potential patch errors down the road when it's used as an insertion\n // reference node. Instead, we clone the node on-demand before creating\n // associated DOM element for it.\n vnode = ownerArray[index] = cloneVNode(vnode);\n }\n\n vnode.isRootInsert = !nested; // for transition enter check\n\n if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {\n return;\n }\n\n var data = vnode.data;\n var children = vnode.children;\n var tag = vnode.tag;\n\n if (isDef(tag)) {\n if (process.env.NODE_ENV !== 'production') {\n if (data && data.pre) {\n creatingElmInVPre++;\n }\n\n if (isUnknownElement$$1(vnode, creatingElmInVPre)) {\n warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the \"name\" option.', vnode.context);\n }\n }\n\n vnode.elm = vnode.ns ? nodeOps.createElementNS(vnode.ns, tag) : nodeOps.createElement(tag, vnode);\n setScope(vnode);\n /* istanbul ignore if */\n\n {\n createChildren(vnode, children, insertedVnodeQueue);\n\n if (isDef(data)) {\n invokeCreateHooks(vnode, insertedVnodeQueue);\n }\n\n insert(parentElm, vnode.elm, refElm);\n }\n\n if (process.env.NODE_ENV !== 'production' && data && data.pre) {\n creatingElmInVPre--;\n }\n } else if (isTrue(vnode.isComment)) {\n vnode.elm = nodeOps.createComment(vnode.text);\n insert(parentElm, vnode.elm, refElm);\n } else {\n vnode.elm = nodeOps.createTextNode(vnode.text);\n insert(parentElm, vnode.elm, refElm);\n }\n }\n\n function createComponent(vnode, insertedVnodeQueue, parentElm, refElm) {\n var i = vnode.data;\n\n if (isDef(i)) {\n var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;\n\n if (isDef(i = i.hook) && isDef(i = i.init)) {\n i(vnode, false\n /* hydrating */\n );\n } // after calling the init hook, if the vnode is a child component\n // it should've created a child instance and mounted it. the child\n // component also has set the placeholder vnode's elm.\n // in that case we can just return the element and be done.\n\n\n if (isDef(vnode.componentInstance)) {\n initComponent(vnode, insertedVnodeQueue);\n insert(parentElm, vnode.elm, refElm);\n\n if (isTrue(isReactivated)) {\n reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);\n }\n\n return true;\n }\n }\n }\n\n function initComponent(vnode, insertedVnodeQueue) {\n if (isDef(vnode.data.pendingInsert)) {\n insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);\n vnode.data.pendingInsert = null;\n }\n\n vnode.elm = vnode.componentInstance.$el;\n\n if (isPatchable(vnode)) {\n invokeCreateHooks(vnode, insertedVnodeQueue);\n setScope(vnode);\n } else {\n // empty component root.\n // skip all element-related modules except for ref (#3455)\n registerRef(vnode); // make sure to invoke the insert hook\n\n insertedVnodeQueue.push(vnode);\n }\n }\n\n function reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm) {\n var i; // hack for #4339: a reactivated component with inner transition\n // does not trigger because the inner node's created hooks are not called\n // again. It's not ideal to involve module-specific logic in here but\n // there doesn't seem to be a better way to do it.\n\n var innerNode = vnode;\n\n while (innerNode.componentInstance) {\n innerNode = innerNode.componentInstance._vnode;\n\n if (isDef(i = innerNode.data) && isDef(i = i.transition)) {\n for (i = 0; i < cbs.activate.length; ++i) {\n cbs.activate[i](emptyNode, innerNode);\n }\n\n insertedVnodeQueue.push(innerNode);\n break;\n }\n } // unlike a newly created component,\n // a reactivated keep-alive component doesn't insert itself\n\n\n insert(parentElm, vnode.elm, refElm);\n }\n\n function insert(parent, elm, ref$$1) {\n if (isDef(parent)) {\n if (isDef(ref$$1)) {\n if (nodeOps.parentNode(ref$$1) === parent) {\n nodeOps.insertBefore(parent, elm, ref$$1);\n }\n } else {\n nodeOps.appendChild(parent, elm);\n }\n }\n }\n\n function createChildren(vnode, children, insertedVnodeQueue) {\n if (Array.isArray(children)) {\n if (process.env.NODE_ENV !== 'production') {\n checkDuplicateKeys(children);\n }\n\n for (var i = 0; i < children.length; ++i) {\n createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);\n }\n } else if (isPrimitive(vnode.text)) {\n nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));\n }\n }\n\n function isPatchable(vnode) {\n while (vnode.componentInstance) {\n vnode = vnode.componentInstance._vnode;\n }\n\n return isDef(vnode.tag);\n }\n\n function invokeCreateHooks(vnode, insertedVnodeQueue) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, vnode);\n }\n\n i = vnode.data.hook; // Reuse variable\n\n if (isDef(i)) {\n if (isDef(i.create)) {\n i.create(emptyNode, vnode);\n }\n\n if (isDef(i.insert)) {\n insertedVnodeQueue.push(vnode);\n }\n }\n } // set scope id attribute for scoped CSS.\n // this is implemented as a special case to avoid the overhead\n // of going through the normal attribute patching process.\n\n\n function setScope(vnode) {\n var i;\n\n if (isDef(i = vnode.fnScopeId)) {\n nodeOps.setStyleScope(vnode.elm, i);\n } else {\n var ancestor = vnode;\n\n while (ancestor) {\n if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {\n nodeOps.setStyleScope(vnode.elm, i);\n }\n\n ancestor = ancestor.parent;\n }\n } // for slot content they should also get the scopeId from the host instance.\n\n\n if (isDef(i = activeInstance) && i !== vnode.context && i !== vnode.fnContext && isDef(i = i.$options._scopeId)) {\n nodeOps.setStyleScope(vnode.elm, i);\n }\n }\n\n function addVnodes(parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {\n for (; startIdx <= endIdx; ++startIdx) {\n createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);\n }\n }\n\n function invokeDestroyHook(vnode) {\n var i, j;\n var data = vnode.data;\n\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.destroy)) {\n i(vnode);\n }\n\n for (i = 0; i < cbs.destroy.length; ++i) {\n cbs.destroy[i](vnode);\n }\n }\n\n if (isDef(i = vnode.children)) {\n for (j = 0; j < vnode.children.length; ++j) {\n invokeDestroyHook(vnode.children[j]);\n }\n }\n }\n\n function removeVnodes(vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n var ch = vnodes[startIdx];\n\n if (isDef(ch)) {\n if (isDef(ch.tag)) {\n removeAndInvokeRemoveHook(ch);\n invokeDestroyHook(ch);\n } else {\n // Text node\n removeNode(ch.elm);\n }\n }\n }\n }\n\n function removeAndInvokeRemoveHook(vnode, rm) {\n if (isDef(rm) || isDef(vnode.data)) {\n var i;\n var listeners = cbs.remove.length + 1;\n\n if (isDef(rm)) {\n // we have a recursively passed down rm callback\n // increase the listeners count\n rm.listeners += listeners;\n } else {\n // directly removing\n rm = createRmCb(vnode.elm, listeners);\n } // recursively invoke hooks on child component root node\n\n\n if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {\n removeAndInvokeRemoveHook(i, rm);\n }\n\n for (i = 0; i < cbs.remove.length; ++i) {\n cbs.remove[i](vnode, rm);\n }\n\n if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {\n i(vnode, rm);\n } else {\n rm();\n }\n } else {\n removeNode(vnode.elm);\n }\n }\n\n function updateChildren(parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {\n var oldStartIdx = 0;\n var newStartIdx = 0;\n var oldEndIdx = oldCh.length - 1;\n var oldStartVnode = oldCh[0];\n var oldEndVnode = oldCh[oldEndIdx];\n var newEndIdx = newCh.length - 1;\n var newStartVnode = newCh[0];\n var newEndVnode = newCh[newEndIdx];\n var oldKeyToIdx, idxInOld, vnodeToMove, refElm; // removeOnly is a special flag used only by \n // to ensure removed elements stay in correct relative positions\n // during leaving transitions\n\n var canMove = !removeOnly;\n\n if (process.env.NODE_ENV !== 'production') {\n checkDuplicateKeys(newCh);\n }\n\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (isUndef(oldStartVnode)) {\n oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left\n } else if (isUndef(oldEndVnode)) {\n oldEndVnode = oldCh[--oldEndIdx];\n } else if (sameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n } else if (sameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (sameVnode(oldStartVnode, newEndVnode)) {\n // Vnode moved right\n patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);\n canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (sameVnode(oldEndVnode, newStartVnode)) {\n // Vnode moved left\n patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n } else {\n if (isUndef(oldKeyToIdx)) {\n oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n }\n\n idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);\n\n if (isUndef(idxInOld)) {\n // New element\n createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);\n } else {\n vnodeToMove = oldCh[idxInOld];\n\n if (sameVnode(vnodeToMove, newStartVnode)) {\n patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);\n oldCh[idxInOld] = undefined;\n canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);\n } else {\n // same key but different element. treat as new element\n createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);\n }\n }\n\n newStartVnode = newCh[++newStartIdx];\n }\n }\n\n if (oldStartIdx > oldEndIdx) {\n refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;\n addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);\n } else if (newStartIdx > newEndIdx) {\n removeVnodes(oldCh, oldStartIdx, oldEndIdx);\n }\n }\n\n function checkDuplicateKeys(children) {\n var seenKeys = {};\n\n for (var i = 0; i < children.length; i++) {\n var vnode = children[i];\n var key = vnode.key;\n\n if (isDef(key)) {\n if (seenKeys[key]) {\n warn(\"Duplicate keys detected: '\" + key + \"'. This may cause an update error.\", vnode.context);\n } else {\n seenKeys[key] = true;\n }\n }\n }\n }\n\n function findIdxInOld(node, oldCh, start, end) {\n for (var i = start; i < end; i++) {\n var c = oldCh[i];\n\n if (isDef(c) && sameVnode(node, c)) {\n return i;\n }\n }\n }\n\n function patchVnode(oldVnode, vnode, insertedVnodeQueue, ownerArray, index, removeOnly) {\n if (oldVnode === vnode) {\n return;\n }\n\n if (isDef(vnode.elm) && isDef(ownerArray)) {\n // clone reused vnode\n vnode = ownerArray[index] = cloneVNode(vnode);\n }\n\n var elm = vnode.elm = oldVnode.elm;\n\n if (isTrue(oldVnode.isAsyncPlaceholder)) {\n if (isDef(vnode.asyncFactory.resolved)) {\n hydrate(oldVnode.elm, vnode, insertedVnodeQueue);\n } else {\n vnode.isAsyncPlaceholder = true;\n }\n\n return;\n } // reuse element for static trees.\n // note we only do this if the vnode is cloned -\n // if the new node is not cloned it means the render functions have been\n // reset by the hot-reload-api and we need to do a proper re-render.\n\n\n if (isTrue(vnode.isStatic) && isTrue(oldVnode.isStatic) && vnode.key === oldVnode.key && (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {\n vnode.componentInstance = oldVnode.componentInstance;\n return;\n }\n\n var i;\n var data = vnode.data;\n\n if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {\n i(oldVnode, vnode);\n }\n\n var oldCh = oldVnode.children;\n var ch = vnode.children;\n\n if (isDef(data) && isPatchable(vnode)) {\n for (i = 0; i < cbs.update.length; ++i) {\n cbs.update[i](oldVnode, vnode);\n }\n\n if (isDef(i = data.hook) && isDef(i = i.update)) {\n i(oldVnode, vnode);\n }\n }\n\n if (isUndef(vnode.text)) {\n if (isDef(oldCh) && isDef(ch)) {\n if (oldCh !== ch) {\n updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly);\n }\n } else if (isDef(ch)) {\n if (process.env.NODE_ENV !== 'production') {\n checkDuplicateKeys(ch);\n }\n\n if (isDef(oldVnode.text)) {\n nodeOps.setTextContent(elm, '');\n }\n\n addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);\n } else if (isDef(oldCh)) {\n removeVnodes(oldCh, 0, oldCh.length - 1);\n } else if (isDef(oldVnode.text)) {\n nodeOps.setTextContent(elm, '');\n }\n } else if (oldVnode.text !== vnode.text) {\n nodeOps.setTextContent(elm, vnode.text);\n }\n\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.postpatch)) {\n i(oldVnode, vnode);\n }\n }\n }\n\n function invokeInsertHook(vnode, queue, initial) {\n // delay insert hooks for component root nodes, invoke them after the\n // element is really inserted\n if (isTrue(initial) && isDef(vnode.parent)) {\n vnode.parent.data.pendingInsert = queue;\n } else {\n for (var i = 0; i < queue.length; ++i) {\n queue[i].data.hook.insert(queue[i]);\n }\n }\n }\n\n var hydrationBailed = false; // list of modules that can skip create hook during hydration because they\n // are already rendered on the client or has no need for initialization\n // Note: style is excluded because it relies on initial clone for future\n // deep updates (#7063).\n\n var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key'); // Note: this is a browser-only function so we can assume elms are DOM nodes.\n\n function hydrate(elm, vnode, insertedVnodeQueue, inVPre) {\n var i;\n var tag = vnode.tag;\n var data = vnode.data;\n var children = vnode.children;\n inVPre = inVPre || data && data.pre;\n vnode.elm = elm;\n\n if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {\n vnode.isAsyncPlaceholder = true;\n return true;\n } // assert node match\n\n\n if (process.env.NODE_ENV !== 'production') {\n if (!assertNodeMatch(elm, vnode, inVPre)) {\n return false;\n }\n }\n\n if (isDef(data)) {\n if (isDef(i = data.hook) && isDef(i = i.init)) {\n i(vnode, true\n /* hydrating */\n );\n }\n\n if (isDef(i = vnode.componentInstance)) {\n // child component. it should have hydrated its own tree.\n initComponent(vnode, insertedVnodeQueue);\n return true;\n }\n }\n\n if (isDef(tag)) {\n if (isDef(children)) {\n // empty element, allow client to pick up and populate children\n if (!elm.hasChildNodes()) {\n createChildren(vnode, children, insertedVnodeQueue);\n } else {\n // v-html and domProps: innerHTML\n if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {\n if (i !== elm.innerHTML) {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined' && !hydrationBailed) {\n hydrationBailed = true;\n console.warn('Parent: ', elm);\n console.warn('server innerHTML: ', i);\n console.warn('client innerHTML: ', elm.innerHTML);\n }\n\n return false;\n }\n } else {\n // iterate and compare children lists\n var childrenMatch = true;\n var childNode = elm.firstChild;\n\n for (var i$1 = 0; i$1 < children.length; i$1++) {\n if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {\n childrenMatch = false;\n break;\n }\n\n childNode = childNode.nextSibling;\n } // if childNode is not null, it means the actual childNodes list is\n // longer than the virtual children list.\n\n\n if (!childrenMatch || childNode) {\n /* istanbul ignore if */\n if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined' && !hydrationBailed) {\n hydrationBailed = true;\n console.warn('Parent: ', elm);\n console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);\n }\n\n return false;\n }\n }\n }\n }\n\n if (isDef(data)) {\n var fullInvoke = false;\n\n for (var key in data) {\n if (!isRenderedModule(key)) {\n fullInvoke = true;\n invokeCreateHooks(vnode, insertedVnodeQueue);\n break;\n }\n }\n\n if (!fullInvoke && data['class']) {\n // ensure collecting deps for deep class bindings for future updates\n traverse(data['class']);\n }\n }\n } else if (elm.data !== vnode.text) {\n elm.data = vnode.text;\n }\n\n return true;\n }\n\n function assertNodeMatch(node, vnode, inVPre) {\n if (isDef(vnode.tag)) {\n return vnode.tag.indexOf('vue-component') === 0 || !isUnknownElement$$1(vnode, inVPre) && vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase());\n } else {\n return node.nodeType === (vnode.isComment ? 8 : 3);\n }\n }\n\n return function patch(oldVnode, vnode, hydrating, removeOnly) {\n if (isUndef(vnode)) {\n if (isDef(oldVnode)) {\n invokeDestroyHook(oldVnode);\n }\n\n return;\n }\n\n var isInitialPatch = false;\n var insertedVnodeQueue = [];\n\n if (isUndef(oldVnode)) {\n // empty mount (likely as component), create new root element\n isInitialPatch = true;\n createElm(vnode, insertedVnodeQueue);\n } else {\n var isRealElement = isDef(oldVnode.nodeType);\n\n if (!isRealElement && sameVnode(oldVnode, vnode)) {\n // patch existing root node\n patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);\n } else {\n if (isRealElement) {\n // mounting to a real element\n // check if this is server-rendered content and if we can perform\n // a successful hydration.\n if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {\n oldVnode.removeAttribute(SSR_ATTR);\n hydrating = true;\n }\n\n if (isTrue(hydrating)) {\n if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {\n invokeInsertHook(vnode, insertedVnodeQueue, true);\n return oldVnode;\n } else if (process.env.NODE_ENV !== 'production') {\n 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 ' + ', or missing
. Bailing hydration and performing ' + 'full client-side render.');\n }\n } // either not server-rendered, or hydration failed.\n // create an empty node and replace it\n\n\n oldVnode = emptyNodeAt(oldVnode);\n } // replacing existing element\n\n\n var oldElm = oldVnode.elm;\n var parentElm = nodeOps.parentNode(oldElm); // create new node\n\n createElm(vnode, insertedVnodeQueue, // extremely rare edge case: do not insert if old element is in a\n // leaving transition. Only happens when combining transition +\n // keep-alive + HOCs. (#4590)\n oldElm._leaveCb ? null : parentElm, nodeOps.nextSibling(oldElm)); // update parent placeholder node element, recursively\n\n if (isDef(vnode.parent)) {\n var ancestor = vnode.parent;\n var patchable = isPatchable(vnode);\n\n while (ancestor) {\n for (var i = 0; i < cbs.destroy.length; ++i) {\n cbs.destroy[i](ancestor);\n }\n\n ancestor.elm = vnode.elm;\n\n if (patchable) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, ancestor);\n } // #6513\n // invoke insert hooks that may have been merged by create hooks.\n // e.g. for directives that uses the \"inserted\" hook.\n\n\n var insert = ancestor.data.hook.insert;\n\n if (insert.merged) {\n // start at index 1 to avoid re-invoking component mounted hook\n for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {\n insert.fns[i$2]();\n }\n }\n } else {\n registerRef(ancestor);\n }\n\n ancestor = ancestor.parent;\n }\n } // destroy old node\n\n\n if (isDef(parentElm)) {\n removeVnodes([oldVnode], 0, 0);\n } else if (isDef(oldVnode.tag)) {\n invokeDestroyHook(oldVnode);\n }\n }\n }\n\n invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);\n return vnode.elm;\n };\n}\n/* */\n\n\nvar directives = {\n create: updateDirectives,\n update: updateDirectives,\n destroy: function unbindDirectives(vnode) {\n updateDirectives(vnode, emptyNode);\n }\n};\n\nfunction updateDirectives(oldVnode, vnode) {\n if (oldVnode.data.directives || vnode.data.directives) {\n _update(oldVnode, vnode);\n }\n}\n\nfunction _update(oldVnode, vnode) {\n var isCreate = oldVnode === emptyNode;\n var isDestroy = vnode === emptyNode;\n var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);\n var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);\n var dirsWithInsert = [];\n var dirsWithPostpatch = [];\n var key, oldDir, dir;\n\n for (key in newDirs) {\n oldDir = oldDirs[key];\n dir = newDirs[key];\n\n if (!oldDir) {\n // new directive, bind\n callHook$1(dir, 'bind', vnode, oldVnode);\n\n if (dir.def && dir.def.inserted) {\n dirsWithInsert.push(dir);\n }\n } else {\n // existing directive, update\n dir.oldValue = oldDir.value;\n dir.oldArg = oldDir.arg;\n callHook$1(dir, 'update', vnode, oldVnode);\n\n if (dir.def && dir.def.componentUpdated) {\n dirsWithPostpatch.push(dir);\n }\n }\n }\n\n if (dirsWithInsert.length) {\n var callInsert = function callInsert() {\n for (var i = 0; i < dirsWithInsert.length; i++) {\n callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);\n }\n };\n\n if (isCreate) {\n mergeVNodeHook(vnode, 'insert', callInsert);\n } else {\n callInsert();\n }\n }\n\n if (dirsWithPostpatch.length) {\n mergeVNodeHook(vnode, 'postpatch', function () {\n for (var i = 0; i < dirsWithPostpatch.length; i++) {\n callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);\n }\n });\n }\n\n if (!isCreate) {\n for (key in oldDirs) {\n if (!newDirs[key]) {\n // no longer present, unbind\n callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);\n }\n }\n }\n}\n\nvar emptyModifiers = Object.create(null);\n\nfunction normalizeDirectives$1(dirs, vm) {\n var res = Object.create(null);\n\n if (!dirs) {\n // $flow-disable-line\n return res;\n }\n\n var i, dir;\n\n for (i = 0; i < dirs.length; i++) {\n dir = dirs[i];\n\n if (!dir.modifiers) {\n // $flow-disable-line\n dir.modifiers = emptyModifiers;\n }\n\n res[getRawDirName(dir)] = dir;\n dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);\n } // $flow-disable-line\n\n\n return res;\n}\n\nfunction getRawDirName(dir) {\n return dir.rawName || dir.name + \".\" + Object.keys(dir.modifiers || {}).join('.');\n}\n\nfunction callHook$1(dir, hook, vnode, oldVnode, isDestroy) {\n var fn = dir.def && dir.def[hook];\n\n if (fn) {\n try {\n fn(vnode.elm, dir, vnode, oldVnode, isDestroy);\n } catch (e) {\n handleError(e, vnode.context, \"directive \" + dir.name + \" \" + hook + \" hook\");\n }\n }\n}\n\nvar baseModules = [ref, directives];\n/* */\n\nfunction updateAttrs(oldVnode, vnode) {\n var opts = vnode.componentOptions;\n\n if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {\n return;\n }\n\n if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {\n return;\n }\n\n var key, cur, old;\n var elm = vnode.elm;\n var oldAttrs = oldVnode.data.attrs || {};\n var attrs = vnode.data.attrs || {}; // clone observed objects, as the user probably wants to mutate it\n\n if (isDef(attrs.__ob__)) {\n attrs = vnode.data.attrs = extend({}, attrs);\n }\n\n for (key in attrs) {\n cur = attrs[key];\n old = oldAttrs[key];\n\n if (old !== cur) {\n setAttr(elm, key, cur, vnode.data.pre);\n }\n } // #4391: in IE9, setting type can reset value for input[type=radio]\n // #6666: IE/Edge forces progress value down to 1 before setting a max\n\n /* istanbul ignore if */\n\n\n if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {\n setAttr(elm, 'value', attrs.value);\n }\n\n for (key in oldAttrs) {\n if (isUndef(attrs[key])) {\n if (isXlink(key)) {\n elm.removeAttributeNS(xlinkNS, getXlinkProp(key));\n } else if (!isEnumeratedAttr(key)) {\n elm.removeAttribute(key);\n }\n }\n }\n}\n\nfunction setAttr(el, key, value, isInPre) {\n if (isInPre || el.tagName.indexOf('-') > -1) {\n baseSetAttr(el, key, value);\n } else if (isBooleanAttr(key)) {\n // set attribute for blank value\n // e.g. \n if (isFalsyAttrValue(value)) {\n el.removeAttribute(key);\n } else {\n // technically allowfullscreen is a boolean attribute for