From 5c74bcc10332d82a3e682e046384f6a4b31b20ed Mon Sep 17 00:00:00 2001 From: BUB97 Date: Sat, 29 Jul 2023 22:32:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=8D=A2chatgpt=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/cherry-markdown.js | 29 ++++++++++++++++++++--------- dist/cherry-markdown.js.map | 2 +- src/toolbars/hooks/ChatGpt.js | 27 +++++++++++++++++++-------- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/dist/cherry-markdown.js b/dist/cherry-markdown.js index b2595ed2..7a5a2b37 100644 --- a/dist/cherry-markdown.js +++ b/dist/cherry-markdown.js @@ -66426,9 +66426,9 @@ var inputText = selection || this.$cherry.editor.editor.getValue(); queryMap[name].apply(this, [inputText]).then(function (res) { - var _res$data, _res$data$choices, _res$data$choices$; + var _res$data, _res$data$choices, _res$data$choices$, _res$data$choices$$me; - return _this2.concatText(_this2, [selection, ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$choices = _res$data.choices) === null || _res$data$choices === void 0 ? void 0 : (_res$data$choices$ = _res$data$choices[0]) === null || _res$data$choices$ === void 0 ? void 0 : _res$data$choices$.text) || '']); + return _this2.concatText(selection, ((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$choices = _res$data.choices) === null || _res$data$choices === void 0 ? void 0 : (_res$data$choices$ = _res$data$choices[0]) === null || _res$data$choices$ === void 0 ? void 0 : (_res$data$choices$$me = _res$data$choices$.message) === null || _res$data$choices$$me === void 0 ? void 0 : _res$data$choices$$me.content) || ''); })["catch"](function (res) { var _res$response, _res$response$data, _res$response$data$er; @@ -66446,18 +66446,29 @@ return ChatGpt; }(MenuBase); - var generatePromptMap = (_generatePromptMap = {}, _defineProperty(_generatePromptMap, FUNC_MAP.COMPLEMENT, function (text) { + var generatePromptMap = (_generatePromptMap = {}, _defineProperty(_generatePromptMap, FUNC_MAP.COMPLEMENT, function (text, language) { + if (language === 'zh_CN') { + return "\u8BF7\u7EED\u5199\u4EE5\u4E0B\u6587\u5B57: ".concat(text); + } + return "continue writing with the following text: ".concat(text); - }), _defineProperty(_generatePromptMap, FUNC_MAP.SUMMARY, function (text) { + }), _defineProperty(_generatePromptMap, FUNC_MAP.SUMMARY, function (text, language) { + if (language === 'zh_CN') { + return "\u8BF7\u603B\u7ED3\u4EE5\u4E0B\u6587\u5B57: ".concat(text); + } + return "summary the following text: ".concat(text); }), _generatePromptMap); function queryCompletion(type, input) { - return this.openai.createCompletion({ - model: 'text-davinci-003', - prompt: generatePromptMap[type](input), - temperature: 0.6, - max_tokens: 500 + return this.openai.createChatCompletion({ + model: 'gpt-3.5-turbo', + messages: [{ + role: 'user', + content: generatePromptMap[type](input, this.$cherry.options.locale || '') + }] // temperature: 0.6, + // max_tokens: 500, + }, { proxy: this.proxy }); diff --git a/dist/cherry-markdown.js.map b/dist/cherry-markdown.js.map index c1843c0a..dab1fae1 100644 --- a/dist/cherry-markdown.js.map +++ b/dist/cherry-markdown.js.map @@ -1 +1 @@ -{"version":3,"file":"cherry-markdown.js","sources":["../node_modules/core-js-pure/internals/global.js","../node_modules/core-js-pure/internals/fails.js","../node_modules/core-js-pure/internals/function-bind-native.js","../node_modules/core-js-pure/internals/function-apply.js","../node_modules/core-js-pure/internals/function-uncurry-this.js","../node_modules/core-js-pure/internals/is-callable.js","../node_modules/core-js-pure/internals/descriptors.js","../node_modules/core-js-pure/internals/function-call.js","../node_modules/core-js-pure/internals/object-property-is-enumerable.js","../node_modules/core-js-pure/internals/create-property-descriptor.js","../node_modules/core-js-pure/internals/classof-raw.js","../node_modules/core-js-pure/internals/indexed-object.js","../node_modules/core-js-pure/internals/require-object-coercible.js","../node_modules/core-js-pure/internals/to-indexed-object.js","../node_modules/core-js-pure/internals/is-object.js","../node_modules/core-js-pure/internals/path.js","../node_modules/core-js-pure/internals/get-built-in.js","../node_modules/core-js-pure/internals/object-is-prototype-of.js","../node_modules/core-js-pure/internals/engine-user-agent.js","../node_modules/core-js-pure/internals/engine-v8-version.js","../node_modules/core-js-pure/internals/native-symbol.js","../node_modules/core-js-pure/internals/use-symbol-as-uid.js","../node_modules/core-js-pure/internals/is-symbol.js","../node_modules/core-js-pure/internals/try-to-string.js","../node_modules/core-js-pure/internals/a-callable.js","../node_modules/core-js-pure/internals/get-method.js","../node_modules/core-js-pure/internals/ordinary-to-primitive.js","../node_modules/core-js-pure/internals/is-pure.js","../node_modules/core-js-pure/internals/define-global-property.js","../node_modules/core-js-pure/internals/shared-store.js","../node_modules/core-js-pure/internals/shared.js","../node_modules/core-js-pure/internals/to-object.js","../node_modules/core-js-pure/internals/has-own-property.js","../node_modules/core-js-pure/internals/uid.js","../node_modules/core-js-pure/internals/well-known-symbol.js","../node_modules/core-js-pure/internals/to-primitive.js","../node_modules/core-js-pure/internals/to-property-key.js","../node_modules/core-js-pure/internals/document-create-element.js","../node_modules/core-js-pure/internals/ie8-dom-define.js","../node_modules/core-js-pure/internals/object-get-own-property-descriptor.js","../node_modules/core-js-pure/internals/is-forced.js","../node_modules/core-js-pure/internals/function-bind-context.js","../node_modules/core-js-pure/internals/v8-prototype-define-bug.js","../node_modules/core-js-pure/internals/an-object.js","../node_modules/core-js-pure/internals/object-define-property.js","../node_modules/core-js-pure/internals/create-non-enumerable-property.js","../node_modules/core-js-pure/internals/export.js","../node_modules/core-js-pure/internals/array-slice.js","../node_modules/core-js-pure/internals/function-bind.js","../node_modules/core-js-pure/internals/to-string-tag-support.js","../node_modules/core-js-pure/internals/classof.js","../node_modules/core-js-pure/internals/inspect-source.js","../node_modules/core-js-pure/internals/is-constructor.js","../node_modules/core-js-pure/internals/a-constructor.js","../node_modules/core-js-pure/internals/math-trunc.js","../node_modules/core-js-pure/internals/to-integer-or-infinity.js","../node_modules/core-js-pure/internals/to-absolute-index.js","../node_modules/core-js-pure/internals/to-length.js","../node_modules/core-js-pure/internals/length-of-array-like.js","../node_modules/core-js-pure/internals/array-includes.js","../node_modules/core-js-pure/internals/hidden-keys.js","../node_modules/core-js-pure/internals/object-keys-internal.js","../node_modules/core-js-pure/internals/enum-bug-keys.js","../node_modules/core-js-pure/internals/object-keys.js","../node_modules/core-js-pure/internals/object-define-properties.js","../node_modules/core-js-pure/internals/html.js","../node_modules/core-js-pure/internals/shared-key.js","../node_modules/core-js-pure/internals/object-create.js","../node_modules/core-js-pure/modules/es.reflect.construct.js","../node_modules/core-js-pure/es/reflect/construct.js","../node_modules/core-js-pure/stable/reflect/construct.js","../node_modules/@babel/runtime-corejs3/core-js-stable/reflect/construct.js","../node_modules/core-js-pure/modules/es.object.keys.js","../node_modules/core-js-pure/es/object/keys.js","../node_modules/core-js-pure/stable/object/keys.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/keys.js","../node_modules/core-js-pure/internals/to-string.js","../node_modules/core-js-pure/internals/object-get-own-property-names.js","../node_modules/core-js-pure/internals/create-property.js","../node_modules/core-js-pure/internals/array-slice-simple.js","../node_modules/core-js-pure/internals/object-get-own-property-names-external.js","../node_modules/core-js-pure/internals/object-get-own-property-symbols.js","../node_modules/core-js-pure/internals/define-built-in.js","../node_modules/core-js-pure/internals/well-known-symbol-wrapped.js","../node_modules/core-js-pure/internals/define-well-known-symbol.js","../node_modules/core-js-pure/internals/symbol-define-to-primitive.js","../node_modules/core-js-pure/internals/object-to-string.js","../node_modules/core-js-pure/internals/set-to-string-tag.js","../node_modules/core-js-pure/internals/native-weak-map.js","../node_modules/core-js-pure/internals/internal-state.js","../node_modules/core-js-pure/internals/is-array.js","../node_modules/core-js-pure/internals/array-species-constructor.js","../node_modules/core-js-pure/internals/array-species-create.js","../node_modules/core-js-pure/internals/array-iteration.js","../node_modules/core-js-pure/modules/es.symbol.constructor.js","../node_modules/core-js-pure/internals/native-symbol-registry.js","../node_modules/core-js-pure/modules/es.symbol.for.js","../node_modules/core-js-pure/modules/es.symbol.key-for.js","../node_modules/core-js-pure/modules/es.json.stringify.js","../node_modules/core-js-pure/modules/es.object.get-own-property-symbols.js","../node_modules/core-js-pure/es/object/get-own-property-symbols.js","../node_modules/core-js-pure/stable/object/get-own-property-symbols.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols.js","../node_modules/core-js-pure/internals/array-method-has-species-support.js","../node_modules/core-js-pure/modules/es.array.filter.js","../node_modules/core-js-pure/internals/entry-virtual.js","../node_modules/core-js-pure/es/array/virtual/filter.js","../node_modules/core-js-pure/es/instance/filter.js","../node_modules/core-js-pure/stable/instance/filter.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/filter.js","../node_modules/core-js-pure/modules/es.object.get-own-property-descriptor.js","../node_modules/core-js-pure/es/object/get-own-property-descriptor.js","../node_modules/core-js-pure/stable/object/get-own-property-descriptor.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor.js","../node_modules/core-js-pure/internals/iterators.js","../node_modules/core-js-pure/internals/function-name.js","../node_modules/core-js-pure/internals/correct-prototype-getter.js","../node_modules/core-js-pure/internals/object-get-prototype-of.js","../node_modules/core-js-pure/internals/iterators-core.js","../node_modules/core-js-pure/internals/create-iterator-constructor.js","../node_modules/core-js-pure/internals/a-possible-prototype.js","../node_modules/core-js-pure/internals/object-set-prototype-of.js","../node_modules/core-js-pure/internals/define-iterator.js","../node_modules/core-js-pure/modules/es.array.iterator.js","../node_modules/core-js-pure/internals/dom-iterables.js","../node_modules/core-js-pure/modules/web.dom-collections.iterator.js","../node_modules/core-js-pure/internals/array-method-is-strict.js","../node_modules/core-js-pure/internals/array-for-each.js","../node_modules/core-js-pure/modules/es.array.for-each.js","../node_modules/core-js-pure/es/array/virtual/for-each.js","../node_modules/core-js-pure/stable/array/virtual/for-each.js","../node_modules/core-js-pure/stable/instance/for-each.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/for-each.js","../node_modules/core-js-pure/internals/own-keys.js","../node_modules/core-js-pure/modules/es.object.get-own-property-descriptors.js","../node_modules/core-js-pure/es/object/get-own-property-descriptors.js","../node_modules/core-js-pure/stable/object/get-own-property-descriptors.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors.js","../node_modules/core-js-pure/modules/es.object.define-properties.js","../node_modules/core-js-pure/es/object/define-properties.js","../node_modules/core-js-pure/stable/object/define-properties.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-properties.js","../node_modules/core-js-pure/modules/es.object.define-property.js","../node_modules/core-js-pure/es/object/define-property.js","../node_modules/core-js-pure/stable/object/define-property.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/define-property.js","../node_modules/@babel/runtime-corejs3/helpers/classCallCheck.js","../node_modules/core-js-pure/actual/object/define-property.js","../node_modules/core-js-pure/full/object/define-property.js","../node_modules/core-js-pure/features/object/define-property.js","../node_modules/@babel/runtime-corejs3/core-js/object/define-property.js","../node_modules/@babel/runtime-corejs3/helpers/createClass.js","../node_modules/@babel/runtime-corejs3/helpers/assertThisInitialized.js","../node_modules/core-js-pure/modules/es.object.create.js","../node_modules/core-js-pure/es/object/create.js","../node_modules/core-js-pure/stable/object/create.js","../node_modules/core-js-pure/actual/object/create.js","../node_modules/core-js-pure/full/object/create.js","../node_modules/core-js-pure/features/object/create.js","../node_modules/@babel/runtime-corejs3/core-js/object/create.js","../node_modules/core-js-pure/modules/es.object.set-prototype-of.js","../node_modules/core-js-pure/es/object/set-prototype-of.js","../node_modules/core-js-pure/stable/object/set-prototype-of.js","../node_modules/core-js-pure/actual/object/set-prototype-of.js","../node_modules/core-js-pure/full/object/set-prototype-of.js","../node_modules/core-js-pure/features/object/set-prototype-of.js","../node_modules/@babel/runtime-corejs3/core-js/object/set-prototype-of.js","../node_modules/@babel/runtime-corejs3/helpers/setPrototypeOf.js","../node_modules/@babel/runtime-corejs3/helpers/inherits.js","../node_modules/core-js-pure/modules/es.array.concat.js","../node_modules/core-js-pure/modules/es.symbol.async-iterator.js","../node_modules/core-js-pure/modules/es.symbol.has-instance.js","../node_modules/core-js-pure/modules/es.symbol.is-concat-spreadable.js","../node_modules/core-js-pure/modules/es.symbol.iterator.js","../node_modules/core-js-pure/modules/es.symbol.match.js","../node_modules/core-js-pure/modules/es.symbol.match-all.js","../node_modules/core-js-pure/modules/es.symbol.replace.js","../node_modules/core-js-pure/modules/es.symbol.search.js","../node_modules/core-js-pure/modules/es.symbol.species.js","../node_modules/core-js-pure/modules/es.symbol.split.js","../node_modules/core-js-pure/modules/es.symbol.to-primitive.js","../node_modules/core-js-pure/modules/es.symbol.to-string-tag.js","../node_modules/core-js-pure/modules/es.symbol.unscopables.js","../node_modules/core-js-pure/modules/es.json.to-string-tag.js","../node_modules/core-js-pure/es/symbol/index.js","../node_modules/core-js-pure/stable/symbol/index.js","../node_modules/core-js-pure/actual/symbol/index.js","../node_modules/core-js-pure/modules/esnext.symbol.async-dispose.js","../node_modules/core-js-pure/modules/esnext.symbol.dispose.js","../node_modules/core-js-pure/modules/esnext.symbol.matcher.js","../node_modules/core-js-pure/modules/esnext.symbol.metadata.js","../node_modules/core-js-pure/modules/esnext.symbol.observable.js","../node_modules/core-js-pure/modules/esnext.symbol.pattern-match.js","../node_modules/core-js-pure/modules/esnext.symbol.replace-all.js","../node_modules/core-js-pure/full/symbol/index.js","../node_modules/core-js-pure/features/symbol/index.js","../node_modules/@babel/runtime-corejs3/core-js/symbol.js","../node_modules/core-js-pure/internals/string-multibyte.js","../node_modules/core-js-pure/modules/es.string.iterator.js","../node_modules/core-js-pure/es/symbol/iterator.js","../node_modules/core-js-pure/stable/symbol/iterator.js","../node_modules/core-js-pure/actual/symbol/iterator.js","../node_modules/core-js-pure/full/symbol/iterator.js","../node_modules/core-js-pure/features/symbol/iterator.js","../node_modules/@babel/runtime-corejs3/core-js/symbol/iterator.js","../node_modules/@babel/runtime-corejs3/helpers/typeof.js","../node_modules/@babel/runtime-corejs3/helpers/possibleConstructorReturn.js","../node_modules/core-js-pure/modules/es.object.get-prototype-of.js","../node_modules/core-js-pure/es/object/get-prototype-of.js","../node_modules/core-js-pure/stable/object/get-prototype-of.js","../node_modules/core-js-pure/actual/object/get-prototype-of.js","../node_modules/core-js-pure/full/object/get-prototype-of.js","../node_modules/core-js-pure/features/object/get-prototype-of.js","../node_modules/@babel/runtime-corejs3/core-js/object/get-prototype-of.js","../node_modules/@babel/runtime-corejs3/helpers/getPrototypeOf.js","../node_modules/@babel/runtime-corejs3/helpers/defineProperty.js","../node_modules/core-js-pure/es/array/virtual/concat.js","../node_modules/core-js-pure/es/instance/concat.js","../node_modules/core-js-pure/stable/instance/concat.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/concat.js","../node_modules/core-js-pure/modules/es.function.bind.js","../node_modules/core-js-pure/es/function/virtual/bind.js","../node_modules/core-js-pure/es/instance/bind.js","../node_modules/core-js-pure/stable/instance/bind.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/bind.js","../node_modules/core-js-pure/internals/validate-arguments-length.js","../node_modules/core-js-pure/internals/schedulers-fix.js","../node_modules/core-js-pure/modules/web.set-interval.js","../node_modules/core-js-pure/modules/web.set-timeout.js","../node_modules/core-js-pure/stable/set-timeout.js","../node_modules/@babel/runtime-corejs3/core-js-stable/set-timeout.js","../node_modules/lodash/_listCacheClear.js","../node_modules/lodash/eq.js","../node_modules/lodash/_assocIndexOf.js","../node_modules/lodash/_listCacheDelete.js","../node_modules/lodash/_listCacheGet.js","../node_modules/lodash/_listCacheHas.js","../node_modules/lodash/_listCacheSet.js","../node_modules/lodash/_ListCache.js","../node_modules/lodash/_stackClear.js","../node_modules/lodash/_stackDelete.js","../node_modules/lodash/_stackGet.js","../node_modules/lodash/_stackHas.js","../node_modules/lodash/_freeGlobal.js","../node_modules/lodash/_root.js","../node_modules/lodash/_Symbol.js","../node_modules/lodash/_getRawTag.js","../node_modules/lodash/_objectToString.js","../node_modules/lodash/_baseGetTag.js","../node_modules/lodash/isObject.js","../node_modules/lodash/isFunction.js","../node_modules/lodash/_coreJsData.js","../node_modules/lodash/_isMasked.js","../node_modules/lodash/_toSource.js","../node_modules/lodash/_baseIsNative.js","../node_modules/lodash/_getValue.js","../node_modules/lodash/_getNative.js","../node_modules/lodash/_Map.js","../node_modules/lodash/_nativeCreate.js","../node_modules/lodash/_hashClear.js","../node_modules/lodash/_hashDelete.js","../node_modules/lodash/_hashGet.js","../node_modules/lodash/_hashHas.js","../node_modules/lodash/_hashSet.js","../node_modules/lodash/_Hash.js","../node_modules/lodash/_mapCacheClear.js","../node_modules/lodash/_isKeyable.js","../node_modules/lodash/_getMapData.js","../node_modules/lodash/_mapCacheDelete.js","../node_modules/lodash/_mapCacheGet.js","../node_modules/lodash/_mapCacheHas.js","../node_modules/lodash/_mapCacheSet.js","../node_modules/lodash/_MapCache.js","../node_modules/lodash/_stackSet.js","../node_modules/lodash/_Stack.js","../node_modules/lodash/_defineProperty.js","../node_modules/lodash/_baseAssignValue.js","../node_modules/lodash/_assignMergeValue.js","../node_modules/lodash/_createBaseFor.js","../node_modules/lodash/_baseFor.js","../node_modules/lodash/_cloneBuffer.js","../node_modules/lodash/_Uint8Array.js","../node_modules/lodash/_cloneArrayBuffer.js","../node_modules/lodash/_cloneTypedArray.js","../node_modules/lodash/_copyArray.js","../node_modules/lodash/_baseCreate.js","../node_modules/lodash/_overArg.js","../node_modules/lodash/_getPrototype.js","../node_modules/lodash/_isPrototype.js","../node_modules/lodash/_initCloneObject.js","../node_modules/lodash/isObjectLike.js","../node_modules/lodash/_baseIsArguments.js","../node_modules/lodash/isArguments.js","../node_modules/lodash/isArray.js","../node_modules/lodash/isLength.js","../node_modules/lodash/isArrayLike.js","../node_modules/lodash/isArrayLikeObject.js","../node_modules/lodash/stubFalse.js","../node_modules/lodash/isBuffer.js","../node_modules/lodash/isPlainObject.js","../node_modules/lodash/_baseIsTypedArray.js","../node_modules/lodash/_baseUnary.js","../node_modules/lodash/_nodeUtil.js","../node_modules/lodash/isTypedArray.js","../node_modules/lodash/_safeGet.js","../node_modules/lodash/_assignValue.js","../node_modules/lodash/_copyObject.js","../node_modules/lodash/_baseTimes.js","../node_modules/lodash/_isIndex.js","../node_modules/lodash/_arrayLikeKeys.js","../node_modules/lodash/_nativeKeysIn.js","../node_modules/lodash/_baseKeysIn.js","../node_modules/lodash/keysIn.js","../node_modules/lodash/toPlainObject.js","../node_modules/lodash/_baseMergeDeep.js","../node_modules/lodash/_baseMerge.js","../node_modules/lodash/identity.js","../node_modules/lodash/_apply.js","../node_modules/lodash/_overRest.js","../node_modules/lodash/constant.js","../node_modules/lodash/_baseSetToString.js","../node_modules/lodash/_shortOut.js","../node_modules/lodash/_setToString.js","../node_modules/lodash/_baseRest.js","../node_modules/lodash/_isIterateeCall.js","../node_modules/lodash/_createAssigner.js","../node_modules/lodash/mergeWith.js","../node_modules/core-js-pure/actual/object/get-own-property-symbols.js","../node_modules/core-js-pure/full/object/get-own-property-symbols.js","../node_modules/core-js-pure/features/object/get-own-property-symbols.js","../node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js","../node_modules/core-js-pure/modules/es.array.index-of.js","../node_modules/core-js-pure/es/array/virtual/index-of.js","../node_modules/core-js-pure/es/instance/index-of.js","../node_modules/core-js-pure/stable/instance/index-of.js","../node_modules/core-js-pure/actual/instance/index-of.js","../node_modules/core-js-pure/full/instance/index-of.js","../node_modules/core-js-pure/features/instance/index-of.js","../node_modules/@babel/runtime-corejs3/core-js/instance/index-of.js","../node_modules/core-js-pure/actual/object/keys.js","../node_modules/core-js-pure/full/object/keys.js","../node_modules/core-js-pure/features/object/keys.js","../node_modules/@babel/runtime-corejs3/core-js/object/keys.js","../node_modules/@babel/runtime-corejs3/helpers/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime-corejs3/helpers/objectWithoutProperties.js","../node_modules/core-js-pure/internals/object-assign.js","../node_modules/core-js-pure/modules/es.object.assign.js","../node_modules/core-js-pure/es/object/assign.js","../node_modules/core-js-pure/stable/object/assign.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/assign.js","../node_modules/core-js-pure/internals/whitespaces.js","../node_modules/core-js-pure/internals/string-trim.js","../node_modules/core-js-pure/internals/string-trim-forced.js","../node_modules/core-js-pure/modules/es.string.trim.js","../node_modules/core-js-pure/es/string/virtual/trim.js","../node_modules/core-js-pure/es/instance/trim.js","../node_modules/core-js-pure/stable/instance/trim.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/trim.js","../node_modules/core-js-pure/internals/iterator-close.js","../node_modules/core-js-pure/internals/call-with-safe-iteration-closing.js","../node_modules/core-js-pure/internals/is-array-iterator-method.js","../node_modules/core-js-pure/internals/get-iterator-method.js","../node_modules/core-js-pure/internals/get-iterator.js","../node_modules/core-js-pure/internals/array-from.js","../node_modules/core-js-pure/internals/check-correctness-of-iteration.js","../node_modules/core-js-pure/modules/es.array.from.js","../node_modules/core-js-pure/es/array/from.js","../node_modules/core-js-pure/stable/array/from.js","../node_modules/@babel/runtime-corejs3/core-js-stable/array/from.js","../node_modules/core-js-pure/internals/is-regexp.js","../node_modules/core-js-pure/internals/not-a-regexp.js","../node_modules/core-js-pure/internals/correct-is-regexp-logic.js","../node_modules/core-js-pure/modules/es.string.starts-with.js","../node_modules/core-js-pure/es/string/virtual/starts-with.js","../node_modules/core-js-pure/es/instance/starts-with.js","../node_modules/core-js-pure/stable/instance/starts-with.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/starts-with.js","../node_modules/core-js-pure/modules/es.array.find.js","../node_modules/core-js-pure/es/array/virtual/find.js","../node_modules/core-js-pure/es/instance/find.js","../node_modules/core-js-pure/stable/instance/find.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/find.js","../node_modules/codemirror/lib/codemirror.js","../node_modules/codemirror/mode/xml/xml.js","../node_modules/codemirror/mode/meta.js","../node_modules/codemirror/mode/markdown/markdown.js","../node_modules/codemirror/addon/mode/overlay.js","../node_modules/codemirror/mode/gfm/gfm.js","../node_modules/codemirror/addon/edit/continuelist.js","../node_modules/codemirror/addon/fold/xml-fold.js","../node_modules/codemirror/addon/edit/closetag.js","../node_modules/codemirror/addon/edit/matchtags.js","../node_modules/codemirror/addon/search/searchcursor.js","../node_modules/codemirror/addon/display/placeholder.js","../node_modules/codemirror/addon/edit/matchbrackets.js","../node_modules/codemirror/keymap/sublime.js","../node_modules/cm-search-replace/src/search.js","../node_modules/codemirror/addon/scroll/annotatescrollbar.js","../node_modules/codemirror/addon/search/matchesonscrollbar.js","../node_modules/core-js-pure/modules/es.array.is-array.js","../node_modules/core-js-pure/es/array/is-array.js","../node_modules/core-js-pure/stable/array/is-array.js","../node_modules/core-js-pure/actual/array/is-array.js","../node_modules/core-js-pure/full/array/is-array.js","../node_modules/core-js-pure/features/array/is-array.js","../node_modules/@babel/runtime-corejs3/core-js/array/is-array.js","../node_modules/@babel/runtime-corejs3/helpers/arrayWithHoles.js","../node_modules/core-js-pure/es/get-iterator-method.js","../node_modules/core-js-pure/stable/get-iterator-method.js","../node_modules/core-js-pure/actual/get-iterator-method.js","../node_modules/core-js-pure/full/get-iterator-method.js","../node_modules/core-js-pure/features/get-iterator-method.js","../node_modules/@babel/runtime-corejs3/core-js/get-iterator-method.js","../node_modules/@babel/runtime-corejs3/helpers/iterableToArrayLimit.js","../node_modules/core-js-pure/modules/es.array.slice.js","../node_modules/core-js-pure/es/array/virtual/slice.js","../node_modules/core-js-pure/es/instance/slice.js","../node_modules/core-js-pure/stable/instance/slice.js","../node_modules/core-js-pure/actual/instance/slice.js","../node_modules/core-js-pure/full/instance/slice.js","../node_modules/core-js-pure/features/instance/slice.js","../node_modules/@babel/runtime-corejs3/core-js/instance/slice.js","../node_modules/core-js-pure/actual/array/from.js","../node_modules/core-js-pure/full/array/from.js","../node_modules/core-js-pure/features/array/from.js","../node_modules/@babel/runtime-corejs3/core-js/array/from.js","../node_modules/@babel/runtime-corejs3/helpers/arrayLikeToArray.js","../node_modules/@babel/runtime-corejs3/helpers/unsupportedIterableToArray.js","../node_modules/@babel/runtime-corejs3/helpers/nonIterableRest.js","../node_modules/@babel/runtime-corejs3/helpers/slicedToArray.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/index-of.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/create.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/slice.js","../node_modules/core-js-pure/internals/number-parse-int.js","../node_modules/core-js-pure/modules/es.parse-int.js","../node_modules/core-js-pure/es/parse-int.js","../node_modules/core-js-pure/stable/parse-int.js","../node_modules/@babel/runtime-corejs3/core-js-stable/parse-int.js","../src/utils/htmlparser.js","../node_modules/core-js-pure/actual/object/assign.js","../node_modules/core-js-pure/full/object/assign.js","../node_modules/core-js-pure/features/object/assign.js","../node_modules/@babel/runtime-corejs3/core-js/object/assign.js","../node_modules/@babel/runtime-corejs3/helpers/extends.js","../node_modules/core-js-pure/internals/number-parse-float.js","../node_modules/core-js-pure/modules/es.parse-float.js","../node_modules/core-js-pure/es/parse-float.js","../node_modules/core-js-pure/stable/parse-float.js","../node_modules/@babel/runtime-corejs3/core-js-stable/parse-float.js","../src/utils/dom.js","../src/utils/pasteHelper.js","../src/utils/event.js","../src/Logger.js","../node_modules/mitt/dist/mitt.mjs","../src/Event.js","../src/utils/file.js","../src/utils/regexp.js","../src/utils/autoindent.js","../src/Editor.js","../node_modules/core-js-pure/modules/es.array.find-index.js","../node_modules/core-js-pure/es/array/virtual/find-index.js","../node_modules/core-js-pure/es/instance/find-index.js","../node_modules/core-js-pure/stable/instance/find-index.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/find-index.js","../node_modules/core-js-pure/modules/es.array.splice.js","../node_modules/core-js-pure/es/array/virtual/splice.js","../node_modules/core-js-pure/es/instance/splice.js","../node_modules/core-js-pure/stable/instance/splice.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/splice.js","../src/core/SyntaxBase.js","../node_modules/core-js-pure/modules/es.array.map.js","../node_modules/core-js-pure/es/array/virtual/map.js","../node_modules/core-js-pure/es/instance/map.js","../node_modules/core-js-pure/stable/instance/map.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/map.js","../src/utils/lineFeed.js","../node_modules/@babel/runtime-corejs3/core-js-stable/array/is-array.js","../src/utils/config.js","../node_modules/core-js-pure/modules/es.string.from-code-point.js","../node_modules/core-js-pure/es/string/from-code-point.js","../node_modules/core-js-pure/stable/string/from-code-point.js","../node_modules/@babel/runtime-corejs3/core-js-stable/string/from-code-point.js","../src/utils/sanitize.js","../src/core/ParagraphBase.js","../node_modules/core-js-pure/internals/array-buffer-non-extensible.js","../node_modules/core-js-pure/internals/object-is-extensible.js","../node_modules/core-js-pure/internals/freezing.js","../node_modules/core-js-pure/internals/internal-metadata.js","../node_modules/core-js-pure/internals/iterate.js","../node_modules/core-js-pure/internals/an-instance.js","../node_modules/core-js-pure/internals/collection.js","../node_modules/core-js-pure/internals/define-built-ins.js","../node_modules/core-js-pure/internals/set-species.js","../node_modules/core-js-pure/internals/collection-strong.js","../node_modules/core-js-pure/modules/es.map.constructor.js","../node_modules/core-js-pure/es/map/index.js","../node_modules/core-js-pure/stable/map/index.js","../node_modules/core-js-pure/actual/map/index.js","../node_modules/core-js-pure/internals/collection-from.js","../node_modules/core-js-pure/modules/esnext.map.from.js","../node_modules/core-js-pure/internals/collection-of.js","../node_modules/core-js-pure/modules/esnext.map.of.js","../node_modules/core-js-pure/internals/collection-delete-all.js","../node_modules/core-js-pure/modules/esnext.map.delete-all.js","../node_modules/core-js-pure/internals/map-emplace.js","../node_modules/core-js-pure/modules/esnext.map.emplace.js","../node_modules/core-js-pure/internals/get-map-iterator.js","../node_modules/core-js-pure/modules/esnext.map.every.js","../node_modules/core-js-pure/internals/species-constructor.js","../node_modules/core-js-pure/modules/esnext.map.filter.js","../node_modules/core-js-pure/modules/esnext.map.find.js","../node_modules/core-js-pure/modules/esnext.map.find-key.js","../node_modules/core-js-pure/modules/esnext.map.group-by.js","../node_modules/core-js-pure/internals/same-value-zero.js","../node_modules/core-js-pure/modules/esnext.map.includes.js","../node_modules/core-js-pure/modules/esnext.map.key-by.js","../node_modules/core-js-pure/modules/esnext.map.key-of.js","../node_modules/core-js-pure/modules/esnext.map.map-keys.js","../node_modules/core-js-pure/modules/esnext.map.map-values.js","../node_modules/core-js-pure/modules/esnext.map.merge.js","../node_modules/core-js-pure/modules/esnext.map.reduce.js","../node_modules/core-js-pure/modules/esnext.map.some.js","../node_modules/core-js-pure/modules/esnext.map.update.js","../node_modules/core-js-pure/internals/map-upsert.js","../node_modules/core-js-pure/modules/esnext.map.upsert.js","../node_modules/core-js-pure/modules/esnext.map.update-or-insert.js","../node_modules/core-js-pure/full/map/index.js","../node_modules/core-js-pure/features/map/index.js","../node_modules/@babel/runtime-corejs3/core-js/map.js","../node_modules/@babel/runtime-corejs3/helpers/isNativeFunction.js","../node_modules/core-js-pure/actual/reflect/construct.js","../node_modules/core-js-pure/full/reflect/construct.js","../node_modules/core-js-pure/features/reflect/construct.js","../node_modules/@babel/runtime-corejs3/core-js/reflect/construct.js","../node_modules/core-js-pure/actual/instance/bind.js","../node_modules/core-js-pure/full/instance/bind.js","../node_modules/core-js-pure/features/instance/bind.js","../node_modules/@babel/runtime-corejs3/core-js/instance/bind.js","../node_modules/@babel/runtime-corejs3/helpers/isNativeReflectConstruct.js","../node_modules/@babel/runtime-corejs3/helpers/construct.js","../node_modules/@babel/runtime-corejs3/helpers/wrapNativeSuper.js","../src/utils/error.js","../src/core/HookCenter.js","../node_modules/@babel/runtime-corejs3/helpers/arrayWithoutHoles.js","../node_modules/@babel/runtime-corejs3/helpers/iterableToArray.js","../node_modules/@babel/runtime-corejs3/helpers/nonIterableSpread.js","../node_modules/@babel/runtime-corejs3/helpers/toConsumableArray.js","../node_modules/@babel/runtime-corejs3/helpers/toArray.js","../src/utils/lookbehind-replace.js","../src/core/hooks/Color.js","../src/core/hooks/BackgroundColor.js","../src/core/hooks/Size.js","../src/core/hooks/Strikethrough.js","../src/core/hooks/Sup.js","../src/core/hooks/Sub.js","../node_modules/prismjs/components/prism-core.js","../node_modules/prismjs/components/prism-clike.js","../node_modules/prismjs/components/prism-c.js","../node_modules/prismjs/components/prism-csharp.js","../node_modules/prismjs/components/prism-cpp.js","../node_modules/prismjs/components/prism-markup.js","../node_modules/prismjs/components/prism-css.js","../node_modules/prismjs/components/prism-dart.js","../node_modules/prismjs/components/prism-diff.js","../node_modules/prismjs/components/prism-docker.js","../node_modules/prismjs/components/prism-git.js","../node_modules/prismjs/components/prism-glsl.js","../node_modules/prismjs/components/prism-go.js","../node_modules/prismjs/components/prism-go-module.js","../node_modules/prismjs/components/prism-yaml.js","../node_modules/prismjs/components/prism-markdown.js","../node_modules/prismjs/components/prism-graphql.js","../node_modules/prismjs/components/prism-ruby.js","../node_modules/prismjs/components/prism-regex.js","../node_modules/prismjs/components/prism-javascript.js","../node_modules/prismjs/components/prism-markup-templating.js","../node_modules/prismjs/components/prism-less.js","../node_modules/prismjs/components/prism-scss.js","../node_modules/prismjs/components/prism-haml.js","../node_modules/prismjs/components/prism-ini.js","../node_modules/prismjs/components/prism-java.js","../node_modules/prismjs/components/prism-json.js","../node_modules/prismjs/components/prism-json5.js","../node_modules/prismjs/components/prism-lua.js","../node_modules/prismjs/components/prism-matlab.js","../node_modules/prismjs/components/prism-mongodb.js","../node_modules/prismjs/components/prism-nginx.js","../node_modules/prismjs/components/prism-objectivec.js","../node_modules/prismjs/components/prism-pascal.js","../node_modules/prismjs/components/prism-php.js","../node_modules/prismjs/components/prism-protobuf.js","../node_modules/prismjs/components/prism-python.js","../node_modules/prismjs/components/prism-r.js","../node_modules/prismjs/components/prism-rust.js","../node_modules/prismjs/components/prism-sql.js","../node_modules/prismjs/components/prism-typescript.js","../node_modules/prismjs/components/prism-jsx.js","../node_modules/prismjs/components/prism-tsx.js","../node_modules/prismjs/components/prism-sass.js","../node_modules/prismjs/components/prism-bash.js","../node_modules/prismjs/components/prism-swift.js","../node_modules/prismjs/components/prism-visual-basic.js","../node_modules/prismjs/components/prism-wasm.js","../src/utils/code-preview-language-setting.js","../src/core/hooks/CodeBlock.js","../src/core/hooks/InlineCode.js","../node_modules/crypt/crypt.js","../node_modules/charenc/charenc.js","../node_modules/is-buffer/index.js","../node_modules/md5/md5.js","../src/UrlCache.js","../src/core/hooks/Link.js","../node_modules/core-js-pure/internals/string-repeat.js","../node_modules/core-js-pure/modules/es.string.repeat.js","../node_modules/core-js-pure/es/string/virtual/repeat.js","../node_modules/core-js-pure/es/instance/repeat.js","../node_modules/core-js-pure/stable/instance/repeat.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/repeat.js","../src/core/hooks/Emphasis.js","../src/core/hooks/Paragraph.js","../node_modules/core-js-pure/internals/is-data-descriptor.js","../node_modules/core-js-pure/modules/es.reflect.get.js","../node_modules/core-js-pure/es/reflect/get.js","../node_modules/core-js-pure/stable/reflect/get.js","../node_modules/core-js-pure/actual/reflect/get.js","../node_modules/core-js-pure/full/reflect/get.js","../node_modules/core-js-pure/features/reflect/get.js","../node_modules/@babel/runtime-corejs3/core-js/reflect/get.js","../node_modules/core-js-pure/actual/object/get-own-property-descriptor.js","../node_modules/core-js-pure/full/object/get-own-property-descriptor.js","../node_modules/core-js-pure/features/object/get-own-property-descriptor.js","../node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-descriptor.js","../node_modules/@babel/runtime-corejs3/helpers/superPropBase.js","../node_modules/@babel/runtime-corejs3/helpers/get.js","../src/core/hooks/Header.js","../src/core/hooks/Transfer.js","../node_modules/core-js-pure/internals/array-reduce.js","../node_modules/core-js-pure/internals/engine-is-node.js","../node_modules/core-js-pure/modules/es.array.reduce.js","../node_modules/core-js-pure/es/array/virtual/reduce.js","../node_modules/core-js-pure/es/instance/reduce.js","../node_modules/core-js-pure/stable/instance/reduce.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/reduce.js","../src/core/hooks/Table.js","../src/utils/env.js","../src/core/hooks/Br.js","../src/core/hooks/Hr.js","../src/utils/image.js","../src/core/hooks/Image.js","../src/core/hooks/List.js","../src/core/hooks/Blockquote.js","../src/core/hooks/AutoLink.js","../src/utils/mathjax.js","../src/core/hooks/MathBlock.js","../src/core/hooks/InlineMath.js","../node_modules/core-js-pure/internals/array-fill.js","../node_modules/core-js-pure/modules/es.array.fill.js","../node_modules/core-js-pure/es/array/virtual/fill.js","../node_modules/core-js-pure/es/instance/fill.js","../node_modules/core-js-pure/stable/instance/fill.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/fill.js","../src/core/hooks/Toc.js","../src/core/hooks/Footnote.js","../src/core/hooks/CommentReference.js","../node_modules/core-js-pure/modules/es.array.some.js","../node_modules/core-js-pure/es/array/virtual/some.js","../node_modules/core-js-pure/es/instance/some.js","../node_modules/core-js-pure/stable/instance/some.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/some.js","../node_modules/dompurify/dist/purify.js","../src/Sanitizer.js","../src/core/hooks/HtmlBlock.js","../src/core/hooks/Emoji.config.js","../src/core/hooks/Emoji.js","../src/core/hooks/Underline.js","../src/core/hooks/HighLight.js","../node_modules/core-js-pure/es/json/stringify.js","../node_modules/core-js-pure/stable/json/stringify.js","../node_modules/@babel/runtime-corejs3/core-js-stable/json/stringify.js","../node_modules/core-js-pure/modules/es.array.includes.js","../node_modules/core-js-pure/es/array/virtual/includes.js","../node_modules/core-js-pure/modules/es.string.includes.js","../node_modules/core-js-pure/es/string/virtual/includes.js","../node_modules/core-js-pure/es/instance/includes.js","../node_modules/core-js-pure/stable/instance/includes.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/includes.js","../node_modules/lodash/_arrayMap.js","../node_modules/lodash/isSymbol.js","../node_modules/lodash/_baseToString.js","../node_modules/lodash/toString.js","../node_modules/lodash/escapeRegExp.js","../node_modules/codemirror/src/util/misc.js","../src/core/hooks/Suggester.js","../src/core/hooks/Ruby.js","../src/core/hooks/Panel.js","../src/core/hooks/Detail.js","../src/core/HooksConfig.js","../src/Engine.js","../node_modules/x-is-array/index.js","../node_modules/virtual-dom/vnode/version.js","../node_modules/virtual-dom/vnode/is-vnode.js","../node_modules/virtual-dom/vnode/is-widget.js","../node_modules/virtual-dom/vnode/is-thunk.js","../node_modules/virtual-dom/vnode/is-vhook.js","../node_modules/virtual-dom/vnode/vnode.js","../node_modules/virtual-dom/vnode/vtext.js","../node_modules/virtual-dom/vnode/is-vtext.js","../node_modules/browser-split/index.js","../node_modules/virtual-dom/virtual-hyperscript/parse-tag.js","../node_modules/virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js","../node_modules/individual/index.js","../node_modules/individual/one-version.js","../node_modules/ev-store/index.js","../node_modules/virtual-dom/virtual-hyperscript/hooks/ev-hook.js","../node_modules/virtual-dom/virtual-hyperscript/index.js","../node_modules/virtual-dom/h.js","../node_modules/virtual-dom/vnode/vpatch.js","../node_modules/virtual-dom/vnode/handle-thunk.js","../node_modules/is-object/index.js","../node_modules/virtual-dom/vtree/diff-props.js","../node_modules/virtual-dom/vtree/diff.js","../node_modules/virtual-dom/diff.js","../node_modules/global/document.js","../node_modules/virtual-dom/vdom/apply-properties.js","../node_modules/virtual-dom/vdom/create-element.js","../node_modules/virtual-dom/vdom/dom-index.js","../node_modules/virtual-dom/vdom/update-widget.js","../node_modules/virtual-dom/vdom/patch-op.js","../node_modules/virtual-dom/vdom/patch.js","../node_modules/virtual-dom/patch.js","../src/utils/myersDiff.js","../node_modules/core-js-pure/internals/native-url.js","../node_modules/core-js-pure/internals/define-built-in-accessor.js","../node_modules/core-js-pure/internals/string-punycode-to-ascii.js","../node_modules/core-js-pure/internals/array-sort.js","../node_modules/core-js-pure/modules/web.url-search-params.constructor.js","../node_modules/core-js-pure/modules/web.url.constructor.js","../node_modules/core-js-pure/web/url.js","../node_modules/core-js-pure/stable/url/index.js","../node_modules/@babel/runtime-corejs3/core-js-stable/url.js","../node_modules/html2canvas/dist/html2canvas.js","../src/utils/export.js","../node_modules/core-js-pure/internals/object-to-array.js","../node_modules/core-js-pure/modules/es.object.values.js","../node_modules/core-js-pure/es/object/values.js","../node_modules/core-js-pure/stable/object/values.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/values.js","../node_modules/core-js-pure/modules/es.object.entries.js","../node_modules/core-js-pure/es/object/entries.js","../node_modules/core-js-pure/stable/object/entries.js","../node_modules/@babel/runtime-corejs3/core-js-stable/object/entries.js","../src/utils/imgSizeHander.js","../node_modules/core-js-pure/modules/es.array.every.js","../node_modules/core-js-pure/es/array/virtual/every.js","../node_modules/core-js-pure/es/instance/every.js","../node_modules/core-js-pure/stable/instance/every.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/every.js","../node_modules/core-js-pure/internals/flatten-into-array.js","../node_modules/core-js-pure/modules/es.array.flat.js","../node_modules/core-js-pure/es/array/virtual/flat.js","../node_modules/core-js-pure/es/instance/flat.js","../node_modules/core-js-pure/stable/instance/flat.js","../node_modules/@babel/runtime-corejs3/core-js-stable/instance/flat.js","../src/utils/tableContentHander.js","../src/utils/dialog.js","../src/utils/copy.js","../node_modules/lodash/now.js","../node_modules/lodash/_trimmedEndIndex.js","../node_modules/lodash/_baseTrim.js","../node_modules/lodash/toNumber.js","../node_modules/lodash/debounce.js","../src/toolbars/PreviewerBubble.js","../node_modules/core-js-pure/stable/set-interval.js","../node_modules/@babel/runtime-corejs3/core-js-stable/set-interval.js","../src/utils/lazyLoadImg.js","../src/Previewer.js","../node_modules/codemirror/src/util/browser.js","../src/toolbars/MenuBase.js","../src/toolbars/hooks/Bold.js","../src/toolbars/hooks/Italic.js","../src/toolbars/hooks/Split.js","../src/utils/selection.js","../src/toolbars/hooks/Strikethrough.js","../src/toolbars/hooks/Sub.js","../src/toolbars/hooks/Sup.js","../src/toolbars/hooks/Color.js","../src/toolbars/hooks/Header.js","../src/toolbars/BubbleTable.js","../src/toolbars/hooks/Insert.js","../src/toolbars/hooks/List.js","../src/toolbars/hooks/Ol.js","../src/toolbars/hooks/Ul.js","../src/toolbars/hooks/CheckList.js","../src/toolbars/hooks/Graph.js","../src/toolbars/hooks/Size.js","../src/toolbars/hooks/H1.js","../src/toolbars/hooks/H2.js","../src/toolbars/hooks/H3.js","../src/toolbars/hooks/Quote.js","../src/toolbars/hooks/QuickTable.js","../src/toolbars/hooks/TogglePreview.js","../src/toolbars/hooks/FullScreen.js","../src/toolbars/hooks/Undo.js","../src/toolbars/hooks/Redo.js","../src/toolbars/hooks/Code.js","../src/toolbars/hooks/CodeTheme.js","../src/toolbars/hooks/Export.js","../src/toolbars/hooks/Settings.js","../src/toolbars/hooks/Underline.js","../src/toolbars/hooks/SwitchModel.js","../src/toolbars/hooks/Image.js","../src/toolbars/hooks/Audio.js","../src/toolbars/hooks/Video.js","../src/toolbars/hooks/Br.js","../src/toolbars/hooks/Hr.js","../src/toolbars/hooks/Formula.js","../src/toolbars/hooks/Link.js","../src/toolbars/hooks/Table.js","../src/toolbars/hooks/Toc.js","../src/toolbars/hooks/LineTable.js","../src/toolbars/hooks/BarTable.js","../src/toolbars/hooks/Pdf.js","../src/toolbars/hooks/File.js","../src/toolbars/hooks/Word.js","../src/toolbars/hooks/Ruby.js","../src/toolbars/hooks/Theme.js","../node_modules/axios/lib/helpers/bind.js","../node_modules/axios/lib/utils.js","../node_modules/axios/lib/helpers/buildURL.js","../node_modules/axios/lib/core/InterceptorManager.js","../node_modules/axios/lib/helpers/normalizeHeaderName.js","../node_modules/axios/lib/core/enhanceError.js","../node_modules/axios/lib/defaults/transitional.js","../node_modules/axios/lib/core/createError.js","../node_modules/axios/lib/core/settle.js","../node_modules/axios/lib/helpers/cookies.js","../node_modules/axios/lib/helpers/isAbsoluteURL.js","../node_modules/axios/lib/helpers/combineURLs.js","../node_modules/axios/lib/core/buildFullPath.js","../node_modules/axios/lib/helpers/parseHeaders.js","../node_modules/axios/lib/helpers/isURLSameOrigin.js","../node_modules/axios/lib/cancel/Cancel.js","../node_modules/axios/lib/adapters/xhr.js","../node_modules/axios/lib/defaults/index.js","../node_modules/axios/lib/core/transformData.js","../node_modules/axios/lib/cancel/isCancel.js","../node_modules/axios/lib/core/dispatchRequest.js","../node_modules/axios/lib/core/mergeConfig.js","../node_modules/axios/lib/env/data.js","../node_modules/axios/lib/helpers/validator.js","../node_modules/axios/lib/core/Axios.js","../node_modules/axios/lib/cancel/CancelToken.js","../node_modules/axios/lib/helpers/spread.js","../node_modules/axios/lib/helpers/isAxiosError.js","../node_modules/axios/lib/axios.js","../node_modules/axios/index.js","../node_modules/openai/dist/base.js","../node_modules/openai/dist/common.js","../node_modules/openai/dist/api.js","../node_modules/form-data/lib/browser.js","../node_modules/openai/dist/configuration.js","../node_modules/openai/dist/index.js","../src/toolbars/hooks/ChatGpt.js","../src/toolbars/hooks/MobilePreview.js","../node_modules/core-js-pure/internals/copy-constructor-properties.js","../node_modules/core-js-pure/internals/clear-error-stack.js","../node_modules/core-js-pure/internals/install-error-cause.js","../node_modules/core-js-pure/internals/normalize-string-argument.js","../node_modules/core-js-pure/internals/error-stack-installable.js","../node_modules/core-js-pure/modules/es.aggregate-error.constructor.js","../node_modules/core-js-pure/internals/engine-is-ios.js","../node_modules/core-js-pure/internals/task.js","../node_modules/core-js-pure/internals/engine-is-ios-pebble.js","../node_modules/core-js-pure/internals/engine-is-webos-webkit.js","../node_modules/core-js-pure/internals/microtask.js","../node_modules/core-js-pure/internals/host-report-errors.js","../node_modules/core-js-pure/internals/perform.js","../node_modules/core-js-pure/internals/queue.js","../node_modules/core-js-pure/internals/promise-native-constructor.js","../node_modules/core-js-pure/internals/engine-is-browser.js","../node_modules/core-js-pure/internals/promise-constructor-detection.js","../node_modules/core-js-pure/internals/new-promise-capability.js","../node_modules/core-js-pure/modules/es.promise.constructor.js","../node_modules/core-js-pure/internals/promise-statics-incorrect-iteration.js","../node_modules/core-js-pure/modules/es.promise.all.js","../node_modules/core-js-pure/modules/es.promise.catch.js","../node_modules/core-js-pure/modules/es.promise.race.js","../node_modules/core-js-pure/modules/es.promise.reject.js","../node_modules/core-js-pure/internals/promise-resolve.js","../node_modules/core-js-pure/modules/es.promise.resolve.js","../node_modules/core-js-pure/modules/es.promise.all-settled.js","../node_modules/core-js-pure/modules/es.promise.any.js","../node_modules/core-js-pure/modules/es.promise.finally.js","../node_modules/core-js-pure/es/promise/index.js","../node_modules/core-js-pure/stable/promise/index.js","../node_modules/core-js-pure/actual/promise/index.js","../node_modules/core-js-pure/modules/esnext.promise.try.js","../node_modules/core-js-pure/full/promise/index.js","../node_modules/core-js-pure/features/promise/index.js","../node_modules/@babel/runtime-corejs3/core-js/promise.js","../node_modules/@babel/runtime-corejs3/helpers/asyncToGenerator.js","../node_modules/core-js-pure/actual/instance/for-each.js","../node_modules/core-js-pure/full/instance/for-each.js","../node_modules/core-js-pure/features/instance/for-each.js","../node_modules/@babel/runtime-corejs3/core-js/instance/for-each.js","../node_modules/core-js-pure/modules/es.array.reverse.js","../node_modules/core-js-pure/es/array/virtual/reverse.js","../node_modules/core-js-pure/es/instance/reverse.js","../node_modules/core-js-pure/stable/instance/reverse.js","../node_modules/core-js-pure/actual/instance/reverse.js","../node_modules/core-js-pure/full/instance/reverse.js","../node_modules/core-js-pure/features/instance/reverse.js","../node_modules/@babel/runtime-corejs3/core-js/instance/reverse.js","../node_modules/@babel/runtime-corejs3/helpers/regeneratorRuntime.js","../node_modules/@babel/runtime-corejs3/regenerator/index.js","../node_modules/@babel/runtime-corejs3/core-js-stable/promise.js","../node_modules/cheerio/lib/esm/options.js","../node_modules/domelementtype/lib/esm/index.js","../node_modules/domhandler/lib/esm/node.js","../node_modules/domhandler/lib/esm/index.js","../node_modules/entities/lib/esm/escape.js","../node_modules/dom-serializer/lib/esm/foreignNames.js","../node_modules/dom-serializer/lib/esm/index.js","../node_modules/domutils/lib/esm/stringify.js","../node_modules/domutils/lib/esm/traversal.js","../node_modules/domutils/lib/esm/manipulation.js","../node_modules/domutils/lib/esm/querying.js","../node_modules/domutils/lib/esm/legacy.js","../node_modules/domutils/lib/esm/helpers.js","../node_modules/domutils/lib/esm/feeds.js","../node_modules/domutils/lib/esm/index.js","../node_modules/cheerio/lib/esm/static.js","../node_modules/cheerio/lib/esm/utils.js","../node_modules/cheerio/lib/esm/api/attributes.js","../node_modules/css-what/lib/es/types.js","../node_modules/css-what/lib/es/parse.js","../node_modules/boolbase/index.js","../node_modules/css-select/lib/esm/sort.js","../node_modules/css-select/lib/esm/attributes.js","../node_modules/nth-check/lib/esm/parse.js","../node_modules/nth-check/lib/esm/compile.js","../node_modules/nth-check/lib/esm/index.js","../node_modules/css-select/lib/esm/pseudo-selectors/filters.js","../node_modules/css-select/lib/esm/pseudo-selectors/pseudos.js","../node_modules/css-select/lib/esm/pseudo-selectors/aliases.js","../node_modules/css-select/lib/esm/pseudo-selectors/subselects.js","../node_modules/css-select/lib/esm/pseudo-selectors/index.js","../node_modules/css-select/lib/esm/general.js","../node_modules/css-select/lib/esm/compile.js","../node_modules/css-select/lib/esm/index.js","../node_modules/cheerio-select/lib/esm/positionals.js","../node_modules/cheerio-select/lib/esm/helpers.js","../node_modules/cheerio-select/lib/esm/index.js","../node_modules/cheerio/lib/esm/api/traversing.js","../node_modules/cheerio/lib/esm/parse.js","../node_modules/cheerio/lib/esm/api/manipulation.js","../node_modules/cheerio/lib/esm/api/css.js","../node_modules/cheerio/lib/esm/api/forms.js","../node_modules/cheerio/lib/esm/cheerio.js","../node_modules/cheerio/lib/esm/load.js","../node_modules/cheerio/node_modules/parse5/dist/common/unicode.js","../node_modules/cheerio/node_modules/parse5/dist/common/error-codes.js","../node_modules/cheerio/node_modules/parse5/dist/tokenizer/preprocessor.js","../node_modules/cheerio/node_modules/parse5/dist/common/token.js","../node_modules/entities/lib/generated/decode-data-html.js","../node_modules/entities/lib/generated/decode-data-xml.js","../node_modules/entities/lib/decode_codepoint.js","../node_modules/entities/lib/decode.js","../node_modules/cheerio/node_modules/parse5/dist/common/html.js","../node_modules/cheerio/node_modules/parse5/dist/tokenizer/index.js","../node_modules/cheerio/node_modules/parse5/dist/parser/open-element-stack.js","../node_modules/cheerio/node_modules/parse5/dist/parser/formatting-element-list.js","../node_modules/cheerio/node_modules/parse5/dist/tree-adapters/default.js","../node_modules/cheerio/node_modules/parse5/dist/common/doctype.js","../node_modules/cheerio/node_modules/parse5/dist/common/foreign-content.js","../node_modules/cheerio/node_modules/parse5/dist/parser/index.js","../node_modules/entities/lib/escape.js","../node_modules/cheerio/node_modules/parse5/dist/serializer/index.js","../node_modules/cheerio/node_modules/parse5/dist/index.js","../node_modules/core-js-pure/modules/es.set.constructor.js","../node_modules/core-js-pure/es/set/index.js","../node_modules/core-js-pure/stable/set/index.js","../node_modules/@babel/runtime-corejs3/core-js-stable/set.js","../node_modules/core-js-pure/internals/array-last-index-of.js","../node_modules/core-js-pure/modules/es.array.last-index-of.js","../node_modules/core-js-pure/es/array/virtual/last-index-of.js","../node_modules/core-js-pure/es/array/virtual/entries.js","../node_modules/@babel/runtime-corejs3/core-js-stable/map.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/unicode.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/error-codes.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/token.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/html.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/tokenizer/index.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/parser/open-element-stack.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/parser/formatting-element-list.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/tree-adapters/default.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/doctype.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/common/foreign-content.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/parser/index.js","../node_modules/parse5-htmlparser2-tree-adapter/node_modules/parse5/dist/serializer/index.js","../node_modules/parse5-htmlparser2-tree-adapter/dist/index.js","../node_modules/cheerio/lib/esm/parsers/parse5-adapter.js","../node_modules/htmlparser2/lib/esm/Tokenizer.js","../node_modules/htmlparser2/lib/esm/Parser.js","../node_modules/htmlparser2/lib/esm/index.js","../node_modules/cheerio/lib/esm/index.js","../node_modules/mensch/lib/debug.js","../node_modules/mensch/lib/lexer.js","../node_modules/mensch/lib/parser.js","../node_modules/mensch/lib/stringify.js","../node_modules/mensch/index.js","../node_modules/slick/parser.js","../node_modules/juice/lib/selector.js","../node_modules/juice/lib/property.js","../node_modules/juice/lib/utils.js","../node_modules/juice/lib/cheerio.js","../node_modules/juice/lib/numbers.js","../node_modules/juice/lib/inline.js","../node_modules/juice/client.js","../src/toolbars/hooks/Copy.js","../src/toolbars/hooks/Panel.js","../src/toolbars/hooks/Justify.js","../src/toolbars/hooks/Detail.js","../src/toolbars/hooks/DrawIo.js","../src/toolbars/HookCenter.js","../src/toolbars/Toolbar.js","../src/toolbars/Bubble.js","../src/toolbars/FloatMenu.js","../src/toolbars/Sidebar.js","../node_modules/fast-diff/diff.js","../src/utils/recount-pos.js","../node_modules/lodash/_arrayEach.js","../node_modules/lodash/_nativeKeys.js","../node_modules/lodash/_baseKeys.js","../node_modules/lodash/keys.js","../node_modules/lodash/_baseAssign.js","../node_modules/lodash/_baseAssignIn.js","../node_modules/lodash/_arrayFilter.js","../node_modules/lodash/stubArray.js","../node_modules/lodash/_getSymbols.js","../node_modules/lodash/_copySymbols.js","../node_modules/lodash/_arrayPush.js","../node_modules/lodash/_getSymbolsIn.js","../node_modules/lodash/_copySymbolsIn.js","../node_modules/lodash/_baseGetAllKeys.js","../node_modules/lodash/_getAllKeys.js","../node_modules/lodash/_getAllKeysIn.js","../node_modules/lodash/_DataView.js","../node_modules/lodash/_Promise.js","../node_modules/lodash/_Set.js","../node_modules/lodash/_WeakMap.js","../node_modules/lodash/_getTag.js","../node_modules/lodash/_initCloneArray.js","../node_modules/lodash/_cloneDataView.js","../node_modules/lodash/_cloneRegExp.js","../node_modules/lodash/_cloneSymbol.js","../node_modules/lodash/_initCloneByTag.js","../node_modules/lodash/_baseIsMap.js","../node_modules/lodash/isMap.js","../node_modules/lodash/_baseIsSet.js","../node_modules/lodash/isSet.js","../node_modules/lodash/_baseClone.js","../node_modules/lodash/cloneDeep.js","../src/Cherry.config.js","../src/locales/zh_CN.js","../src/locales/en_US.js","../src/locales/index.js","../src/Factory.js","../src/CherryStatic.js","../src/Cherry.js","../src/index.core.js","../src/addons/cherry-code-block-mermaid-plugin.js","../src/libs/rawdeflate.js","../src/addons/cherry-code-block-plantuml-plugin.js","../node_modules/mermaid/dist/mermaid.esm.min.mjs","../src/index.js"],"sourcesContent":["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-x/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","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (error) {\n return true;\n }\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-function-prototype-bind -- safe\n var test = (function () { /* empty */ }).bind();\n // eslint-disable-next-line no-prototype-builtins -- safe\n return typeof test != 'function' || test.hasOwnProperty('prototype');\n});\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar apply = FunctionPrototype.apply;\nvar call = FunctionPrototype.call;\n\n// eslint-disable-next-line es-x/no-reflect -- safe\nmodule.exports = typeof Reflect == 'object' && Reflect.apply || (NATIVE_BIND ? call.bind(apply) : function () {\n return call.apply(apply, arguments);\n});\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar FunctionPrototype = Function.prototype;\nvar bind = FunctionPrototype.bind;\nvar call = FunctionPrototype.call;\nvar uncurryThis = NATIVE_BIND && bind.bind(call, call);\n\nmodule.exports = NATIVE_BIND ? function (fn) {\n return fn && uncurryThis(fn);\n} : function (fn) {\n return fn && function () {\n return call.apply(fn, arguments);\n };\n};\n","// `IsCallable` abstract operation\n// https://tc39.es/ecma262/#sec-iscallable\nmodule.exports = function (argument) {\n return typeof argument == 'function';\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-x/no-object-defineproperty -- required for testing\n return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;\n});\n","var NATIVE_BIND = require('../internals/function-bind-native');\n\nvar call = Function.prototype.call;\n\nmodule.exports = NATIVE_BIND ? call.bind(call) : function () {\n return call.apply(call, arguments);\n};\n","'use strict';\nvar $propertyIsEnumerable = {}.propertyIsEnumerable;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// Nashorn ~ JDK8 bug\nvar NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);\n\n// `Object.prototype.propertyIsEnumerable` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable\nexports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {\n var descriptor = getOwnPropertyDescriptor(this, V);\n return !!descriptor && descriptor.enumerable;\n} : $propertyIsEnumerable;\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar toString = uncurryThis({}.toString);\nvar stringSlice = uncurryThis(''.slice);\n\nmodule.exports = function (it) {\n return stringSlice(toString(it), 8, -1);\n};\n","var global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar classof = require('../internals/classof-raw');\n\nvar Object = global.Object;\nvar split = uncurryThis(''.split);\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\nmodule.exports = fails(function () {\n // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346\n // eslint-disable-next-line no-prototype-builtins -- safe\n return !Object('z').propertyIsEnumerable(0);\n}) ? function (it) {\n return classof(it) == 'String' ? split(it, '') : Object(it);\n} : Object;\n","var global = require('../internals/global');\n\nvar TypeError = global.TypeError;\n\n// `RequireObjectCoercible` abstract operation\n// https://tc39.es/ecma262/#sec-requireobjectcoercible\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// toObject with fallback for non-array-like ES3 strings\nvar IndexedObject = require('../internals/indexed-object');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nmodule.exports = function (it) {\n return IndexedObject(requireObjectCoercible(it));\n};\n","var isCallable = require('../internals/is-callable');\n\nmodule.exports = function (it) {\n return typeof it == 'object' ? it !== null : isCallable(it);\n};\n","module.exports = {};\n","var path = require('../internals/path');\nvar global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar aFunction = function (variable) {\n return isCallable(variable) ? variable : undefined;\n};\n\nmodule.exports = function (namespace, method) {\n return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])\n : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis({}.isPrototypeOf);\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('navigator', 'userAgent') || '';\n","var global = require('../internals/global');\nvar userAgent = require('../internals/engine-user-agent');\n\nvar process = global.process;\nvar Deno = global.Deno;\nvar versions = process && process.versions || Deno && Deno.version;\nvar v8 = versions && versions.v8;\nvar match, version;\n\nif (v8) {\n match = v8.split('.');\n // in old Chrome, versions of V8 isn't V8 = Chrome / 10\n // but their correct versions are not interesting for us\n version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]);\n}\n\n// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`\n// so check `userAgent` even if `.v8` exists, but 0\nif (!version && userAgent) {\n match = userAgent.match(/Edge\\/(\\d+)/);\n if (!match || match[1] >= 74) {\n match = userAgent.match(/Chrome\\/(\\d+)/);\n if (match) version = +match[1];\n }\n}\n\nmodule.exports = version;\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar V8_VERSION = require('../internals/engine-v8-version');\nvar fails = require('../internals/fails');\n\n// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- required for testing\nmodule.exports = !!Object.getOwnPropertySymbols && !fails(function () {\n var symbol = Symbol();\n // Chrome 38 Symbol has incorrect toString conversion\n // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances\n return !String(symbol) || !(Object(symbol) instanceof Symbol) ||\n // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances\n !Symbol.sham && V8_VERSION && V8_VERSION < 41;\n});\n","/* eslint-disable es-x/no-symbol -- required for testing */\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\n\nmodule.exports = NATIVE_SYMBOL\n && !Symbol.sham\n && typeof Symbol.iterator == 'symbol';\n","var global = require('../internals/global');\nvar getBuiltIn = require('../internals/get-built-in');\nvar isCallable = require('../internals/is-callable');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');\n\nvar Object = global.Object;\n\nmodule.exports = USE_SYMBOL_AS_UID ? function (it) {\n return typeof it == 'symbol';\n} : function (it) {\n var $Symbol = getBuiltIn('Symbol');\n return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it));\n};\n","var global = require('../internals/global');\n\nvar String = global.String;\n\nmodule.exports = function (argument) {\n try {\n return String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\nvar tryToString = require('../internals/try-to-string');\n\nvar TypeError = global.TypeError;\n\n// `Assert: IsCallable(argument) is true`\nmodule.exports = function (argument) {\n if (isCallable(argument)) return argument;\n throw TypeError(tryToString(argument) + ' is not a function');\n};\n","var aCallable = require('../internals/a-callable');\n\n// `GetMethod` abstract operation\n// https://tc39.es/ecma262/#sec-getmethod\nmodule.exports = function (V, P) {\n var func = V[P];\n return func == null ? undefined : aCallable(func);\n};\n","var global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\n\nvar TypeError = global.TypeError;\n\n// `OrdinaryToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-ordinarytoprimitive\nmodule.exports = function (input, pref) {\n var fn, val;\n if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val;\n if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","module.exports = true;\n","var global = require('../internals/global');\n\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar defineProperty = Object.defineProperty;\n\nmodule.exports = function (key, value) {\n try {\n defineProperty(global, key, { value: value, configurable: true, writable: true });\n } catch (error) {\n global[key] = value;\n } return value;\n};\n","var global = require('../internals/global');\nvar defineGlobalProperty = require('../internals/define-global-property');\n\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || defineGlobalProperty(SHARED, {});\n\nmodule.exports = store;\n","var IS_PURE = require('../internals/is-pure');\nvar store = require('../internals/shared-store');\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: '3.22.6',\n mode: IS_PURE ? 'pure' : 'global',\n copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',\n license: 'https://github.com/zloirock/core-js/blob/v3.22.6/LICENSE',\n source: 'https://github.com/zloirock/core-js'\n});\n","var global = require('../internals/global');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar Object = global.Object;\n\n// `ToObject` abstract operation\n// https://tc39.es/ecma262/#sec-toobject\nmodule.exports = function (argument) {\n return Object(requireObjectCoercible(argument));\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar toObject = require('../internals/to-object');\n\nvar hasOwnProperty = uncurryThis({}.hasOwnProperty);\n\n// `HasOwnProperty` abstract operation\n// https://tc39.es/ecma262/#sec-hasownproperty\n// eslint-disable-next-line es-x/no-object-hasown -- safe\nmodule.exports = Object.hasOwn || function hasOwn(it, key) {\n return hasOwnProperty(toObject(it), key);\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nvar id = 0;\nvar postfix = Math.random();\nvar toString = uncurryThis(1.0.toString);\n\nmodule.exports = function (key) {\n return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);\n};\n","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 symbolFor = Symbol && Symbol['for'];\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 var description = 'Symbol.' + name;\n if (NATIVE_SYMBOL && hasOwn(Symbol, name)) {\n WellKnownSymbolsStore[name] = Symbol[name];\n } else if (USE_SYMBOL_AS_UID && symbolFor) {\n WellKnownSymbolsStore[name] = symbolFor(description);\n } else {\n WellKnownSymbolsStore[name] = createWellKnownSymbol(description);\n }\n } return WellKnownSymbolsStore[name];\n};\n","var global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar getMethod = require('../internals/get-method');\nvar ordinaryToPrimitive = require('../internals/ordinary-to-primitive');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TypeError = global.TypeError;\nvar TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n// `ToPrimitive` abstract operation\n// https://tc39.es/ecma262/#sec-toprimitive\nmodule.exports = function (input, pref) {\n if (!isObject(input) || isSymbol(input)) return input;\n var exoticToPrim = getMethod(input, TO_PRIMITIVE);\n var result;\n if (exoticToPrim) {\n if (pref === undefined) pref = 'default';\n result = call(exoticToPrim, input, pref);\n if (!isObject(result) || isSymbol(result)) return result;\n throw TypeError(\"Can't convert object to primitive value\");\n }\n if (pref === undefined) pref = 'number';\n return ordinaryToPrimitive(input, pref);\n};\n","var toPrimitive = require('../internals/to-primitive');\nvar isSymbol = require('../internals/is-symbol');\n\n// `ToPropertyKey` abstract operation\n// https://tc39.es/ecma262/#sec-topropertykey\nmodule.exports = function (argument) {\n var key = toPrimitive(argument, 'string');\n return isSymbol(key) ? key : key + '';\n};\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar document = global.document;\n// typeof document.createElement is 'object' in old IE\nvar EXISTS = isObject(document) && isObject(document.createElement);\n\nmodule.exports = function (it) {\n return EXISTS ? document.createElement(it) : {};\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\nvar createElement = require('../internals/document-create-element');\n\n// Thanks to IE8 for its funny defineProperty\nmodule.exports = !DESCRIPTORS && !fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(createElement('div'), 'a', {\n get: function () { return 7; }\n }).a != 7;\n});\n","var DESCRIPTORS = require('../internals/descriptors');\nvar call = require('../internals/function-call');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar hasOwn = require('../internals/has-own-property');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\n\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\nexports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {\n O = toIndexedObject(O);\n P = toPropertyKey(P);\n if (IE8_DOM_DEFINE) try {\n return $getOwnPropertyDescriptor(O, P);\n } catch (error) { /* empty */ }\n if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]);\n};\n","var fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\n\nvar replacement = /#|\\.prototype\\./;\n\nvar isForced = function (feature, detection) {\n var value = data[normalize(feature)];\n return value == POLYFILL ? true\n : value == NATIVE ? false\n : isCallable(detection) ? fails(detection)\n : !!detection;\n};\n\nvar normalize = isForced.normalize = function (string) {\n return String(string).replace(replacement, '.').toLowerCase();\n};\n\nvar data = isForced.data = {};\nvar NATIVE = isForced.NATIVE = 'N';\nvar POLYFILL = isForced.POLYFILL = 'P';\n\nmodule.exports = isForced;\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar bind = uncurryThis(uncurryThis.bind);\n\n// optional / simple context binding\nmodule.exports = function (fn, that) {\n aCallable(fn);\n return that === undefined ? fn : NATIVE_BIND ? bind(fn, that) : function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar fails = require('../internals/fails');\n\n// V8 ~ Chrome 36-\n// https://bugs.chromium.org/p/v8/issues/detail?id=3334\nmodule.exports = DESCRIPTORS && fails(function () {\n // eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\n return Object.defineProperty(function () { /* empty */ }, 'prototype', {\n value: 42,\n writable: false\n }).prototype != 42;\n});\n","var global = require('../internals/global');\nvar isObject = require('../internals/is-object');\n\nvar String = global.String;\nvar TypeError = global.TypeError;\n\n// `Assert: Type(argument) is Object`\nmodule.exports = function (argument) {\n if (isObject(argument)) return argument;\n throw TypeError(String(argument) + ' is not an object');\n};\n","var global = require('../internals/global');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar IE8_DOM_DEFINE = require('../internals/ie8-dom-define');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar anObject = require('../internals/an-object');\nvar toPropertyKey = require('../internals/to-property-key');\n\nvar TypeError = global.TypeError;\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\nvar $defineProperty = Object.defineProperty;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar ENUMERABLE = 'enumerable';\nvar CONFIGURABLE = 'configurable';\nvar WRITABLE = 'writable';\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\nexports.f = DESCRIPTORS ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPropertyKey(P);\n anObject(Attributes);\n if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {\n var current = $getOwnPropertyDescriptor(O, P);\n if (current && current[WRITABLE]) {\n O[P] = Attributes.value;\n Attributes = {\n configurable: CONFIGURABLE in Attributes ? Attributes[CONFIGURABLE] : current[CONFIGURABLE],\n enumerable: ENUMERABLE in Attributes ? Attributes[ENUMERABLE] : current[ENUMERABLE],\n writable: false\n };\n }\n } return $defineProperty(O, P, Attributes);\n} : $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 DESCRIPTORS = require('../internals/descriptors');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = DESCRIPTORS ? function (object, key, value) {\n return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","'use strict';\nvar global = require('../internals/global');\nvar apply = require('../internals/function-apply');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar isForced = require('../internals/is-forced');\nvar path = require('../internals/path');\nvar bind = require('../internals/function-bind-context');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\n\nvar wrapConstructor = function (NativeConstructor) {\n var Wrapper = function (a, b, c) {\n if (this instanceof Wrapper) {\n switch (arguments.length) {\n case 0: return new NativeConstructor();\n case 1: return new NativeConstructor(a);\n case 2: return new NativeConstructor(a, b);\n } return new NativeConstructor(a, b, c);\n } return apply(NativeConstructor, this, arguments);\n };\n Wrapper.prototype = NativeConstructor.prototype;\n return Wrapper;\n};\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.dontCallGetSet - 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 PROTO = options.proto;\n\n var nativeSource = GLOBAL ? global : STATIC ? global[TARGET] : (global[TARGET] || {}).prototype;\n\n var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET];\n var targetPrototype = target.prototype;\n\n var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;\n var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;\n\n for (key in source) {\n FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);\n // contains in native\n USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key);\n\n targetProperty = target[key];\n\n if (USE_NATIVE) if (options.dontCallGetSet) {\n descriptor = getOwnPropertyDescriptor(nativeSource, key);\n nativeProperty = descriptor && descriptor.value;\n } else nativeProperty = nativeSource[key];\n\n // export native or implementation\n sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];\n\n if (USE_NATIVE && typeof targetProperty == typeof sourceProperty) continue;\n\n // bind timers to global for call from export context\n if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, global);\n // wrap global constructors for prevent changs in this version\n else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);\n // make static versions for prototype methods\n else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty);\n // default case\n else resultProperty = sourceProperty;\n\n // add a flag to not completely full polyfills\n if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {\n createNonEnumerableProperty(resultProperty, 'sham', true);\n }\n\n createNonEnumerableProperty(target, key, resultProperty);\n\n if (PROTO) {\n VIRTUAL_PROTOTYPE = TARGET + 'Prototype';\n if (!hasOwn(path, VIRTUAL_PROTOTYPE)) {\n createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});\n }\n // export virtual prototype methods\n createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty);\n // export real prototype methods\n if (options.real && targetPrototype && !targetPrototype[key]) {\n createNonEnumerableProperty(targetPrototype, key, sourceProperty);\n }\n }\n }\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\n\nmodule.exports = uncurryThis([].slice);\n","'use strict';\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar arraySlice = require('../internals/array-slice');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar Function = global.Function;\nvar concat = uncurryThis([].concat);\nvar join = uncurryThis([].join);\nvar factories = {};\n\nvar construct = function (C, argsLength, args) {\n if (!hasOwn(factories, argsLength)) {\n for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';\n factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')');\n } return factories[argsLength](C, args);\n};\n\n// `Function.prototype.bind` method implementation\n// https://tc39.es/ecma262/#sec-function.prototype.bind\nmodule.exports = NATIVE_BIND ? Function.bind : function bind(that /* , ...args */) {\n var F = aCallable(this);\n var Prototype = F.prototype;\n var partArgs = arraySlice(arguments, 1);\n var boundFunction = function bound(/* args... */) {\n var args = concat(partArgs, arraySlice(arguments));\n return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);\n };\n if (isObject(Prototype)) boundFunction.prototype = Prototype;\n return boundFunction;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar test = {};\n\ntest[TO_STRING_TAG] = 'z';\n\nmodule.exports = String(test) === '[object z]';\n","var global = require('../internals/global');\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar isCallable = require('../internals/is-callable');\nvar classofRaw = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\nvar Object = global.Object;\n\n// ES3 wrong here\nvar CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (error) { /* empty */ }\n};\n\n// getting tag from ES6+ `Object.prototype.toString`\nmodule.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {\n var O, tag, result;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag\n // builtinTag case\n : CORRECT_ARGUMENTS ? classofRaw(O)\n // ES3 arguments fallback\n : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result;\n};\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar isCallable = require('../internals/is-callable');\nvar store = require('../internals/shared-store');\n\nvar functionToString = uncurryThis(Function.toString);\n\n// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper\nif (!isCallable(store.inspectSource)) {\n store.inspectSource = function (it) {\n return functionToString(it);\n };\n}\n\nmodule.exports = store.inspectSource;\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar classof = require('../internals/classof');\nvar getBuiltIn = require('../internals/get-built-in');\nvar inspectSource = require('../internals/inspect-source');\n\nvar noop = function () { /* empty */ };\nvar empty = [];\nvar construct = getBuiltIn('Reflect', 'construct');\nvar constructorRegExp = /^\\s*(?:class|function)\\b/;\nvar exec = uncurryThis(constructorRegExp.exec);\nvar INCORRECT_TO_STRING = !constructorRegExp.exec(noop);\n\nvar isConstructorModern = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n try {\n construct(noop, empty, argument);\n return true;\n } catch (error) {\n return false;\n }\n};\n\nvar isConstructorLegacy = function isConstructor(argument) {\n if (!isCallable(argument)) return false;\n switch (classof(argument)) {\n case 'AsyncFunction':\n case 'GeneratorFunction':\n case 'AsyncGeneratorFunction': return false;\n }\n try {\n // we can't check .prototype since constructors produced by .bind haven't it\n // `Function#toString` throws on some built-it function in some legacy engines\n // (for example, `DOMQuad` and similar in FF41-)\n return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument));\n } catch (error) {\n return true;\n }\n};\n\nisConstructorLegacy.sham = true;\n\n// `IsConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-isconstructor\nmodule.exports = !construct || fails(function () {\n var called;\n return isConstructorModern(isConstructorModern.call)\n || !isConstructorModern(Object)\n || !isConstructorModern(function () { called = true; })\n || called;\n}) ? isConstructorLegacy : isConstructorModern;\n","var global = require('../internals/global');\nvar isConstructor = require('../internals/is-constructor');\nvar tryToString = require('../internals/try-to-string');\n\nvar TypeError = global.TypeError;\n\n// `Assert: IsConstructor(argument) is true`\nmodule.exports = function (argument) {\n if (isConstructor(argument)) return argument;\n throw TypeError(tryToString(argument) + ' is not a constructor');\n};\n","var ceil = Math.ceil;\nvar floor = Math.floor;\n\n// `Math.trunc` method\n// https://tc39.es/ecma262/#sec-math.trunc\n// eslint-disable-next-line es-x/no-math-trunc -- safe\nmodule.exports = Math.trunc || function trunc(x) {\n var n = +x;\n return (n > 0 ? floor : ceil)(n);\n};\n","var trunc = require('../internals/math-trunc');\n\n// `ToIntegerOrInfinity` abstract operation\n// https://tc39.es/ecma262/#sec-tointegerorinfinity\nmodule.exports = function (argument) {\n var number = +argument;\n // eslint-disable-next-line no-self-compare -- NaN check\n return number !== number || number === 0 ? 0 : trunc(number);\n};\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar max = Math.max;\nvar min = Math.min;\n\n// Helper for a popular repeating case of the spec:\n// Let integer be ? ToInteger(index).\n// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).\nmodule.exports = function (index, length) {\n var integer = toIntegerOrInfinity(index);\n return integer < 0 ? max(integer + length, 0) : min(integer, length);\n};\n","var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\n\nvar min = Math.min;\n\n// `ToLength` abstract operation\n// https://tc39.es/ecma262/#sec-tolength\nmodule.exports = function (argument) {\n return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991\n};\n","var toLength = require('../internals/to-length');\n\n// `LengthOfArrayLike` abstract operation\n// https://tc39.es/ecma262/#sec-lengthofarraylike\nmodule.exports = function (obj) {\n return toLength(obj.length);\n};\n","var toIndexedObject = require('../internals/to-indexed-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\n\n// `Array.prototype.{ indexOf, includes }` methods implementation\nvar createMethod = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIndexedObject($this);\n var length = lengthOfArrayLike(O);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare -- NaN check\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare -- NaN check\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) {\n if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.includes` method\n // https://tc39.es/ecma262/#sec-array.prototype.includes\n includes: createMethod(true),\n // `Array.prototype.indexOf` method\n // https://tc39.es/ecma262/#sec-array.prototype.indexof\n indexOf: createMethod(false)\n};\n","module.exports = {};\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar hasOwn = require('../internals/has-own-property');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar indexOf = require('../internals/array-includes').indexOf;\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar push = uncurryThis([].push);\n\nmodule.exports = function (object, names) {\n var O = toIndexedObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (hasOwn(O, key = names[i++])) {\n ~indexOf(result, key) || push(result, key);\n }\n return result;\n};\n","// IE8- don't enum bug keys\nmodule.exports = [\n 'constructor',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toLocaleString',\n 'toString',\n 'valueOf'\n];\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n// eslint-disable-next-line es-x/no-object-keys -- safe\nmodule.exports = Object.keys || function keys(O) {\n return internalObjectKeys(O, enumBugKeys);\n};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar V8_PROTOTYPE_DEFINE_BUG = require('../internals/v8-prototype-define-bug');\nvar definePropertyModule = require('../internals/object-define-property');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar objectKeys = require('../internals/object-keys');\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es-x/no-object-defineproperties -- safe\nexports.f = DESCRIPTORS && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var props = toIndexedObject(Properties);\n var keys = objectKeys(Properties);\n var length = keys.length;\n var index = 0;\n var key;\n while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]);\n return O;\n};\n","var getBuiltIn = require('../internals/get-built-in');\n\nmodule.exports = getBuiltIn('document', 'documentElement');\n","var shared = require('../internals/shared');\nvar uid = require('../internals/uid');\n\nvar keys = shared('keys');\n\nmodule.exports = function (key) {\n return keys[key] || (keys[key] = uid(key));\n};\n","/* global ActiveXObject -- old IE, WSH */\nvar anObject = require('../internals/an-object');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar enumBugKeys = require('../internals/enum-bug-keys');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar html = require('../internals/html');\nvar documentCreateElement = require('../internals/document-create-element');\nvar sharedKey = require('../internals/shared-key');\n\nvar GT = '>';\nvar LT = '<';\nvar PROTOTYPE = 'prototype';\nvar SCRIPT = 'script';\nvar IE_PROTO = sharedKey('IE_PROTO');\n\nvar EmptyConstructor = function () { /* empty */ };\n\nvar scriptTag = function (content) {\n return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;\n};\n\n// Create object with fake `null` prototype: use ActiveX Object with cleared prototype\nvar NullProtoObjectViaActiveX = function (activeXDocument) {\n activeXDocument.write(scriptTag(''));\n activeXDocument.close();\n var temp = activeXDocument.parentWindow.Object;\n activeXDocument = null; // avoid memory leak\n return temp;\n};\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar NullProtoObjectViaIFrame = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = documentCreateElement('iframe');\n var JS = 'java' + SCRIPT + ':';\n var iframeDocument;\n iframe.style.display = 'none';\n html.appendChild(iframe);\n // https://github.com/zloirock/core-js/issues/475\n iframe.src = String(JS);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(scriptTag('document.F=Object'));\n iframeDocument.close();\n return iframeDocument.F;\n};\n\n// Check for document.domain and active x support\n// No need to use active x approach when document.domain is not set\n// see https://github.com/es-shims/es5-shim/issues/150\n// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346\n// avoid IE GC bug\nvar activeXDocument;\nvar NullProtoObject = function () {\n try {\n activeXDocument = new ActiveXObject('htmlfile');\n } catch (error) { /* ignore */ }\n NullProtoObject = typeof document != 'undefined'\n ? document.domain && activeXDocument\n ? NullProtoObjectViaActiveX(activeXDocument) // old IE\n : NullProtoObjectViaIFrame()\n : NullProtoObjectViaActiveX(activeXDocument); // WSH\n var length = enumBugKeys.length;\n while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];\n return NullProtoObject();\n};\n\nhiddenKeys[IE_PROTO] = true;\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n// eslint-disable-next-line es-x/no-object-create -- safe\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n EmptyConstructor[PROTOTYPE] = anObject(O);\n result = new EmptyConstructor();\n EmptyConstructor[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = NullProtoObject();\n return Properties === undefined ? result : definePropertiesModule.f(result, Properties);\n};\n","var $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar apply = require('../internals/function-apply');\nvar bind = require('../internals/function-bind');\nvar aConstructor = require('../internals/a-constructor');\nvar anObject = require('../internals/an-object');\nvar isObject = require('../internals/is-object');\nvar create = require('../internals/object-create');\nvar fails = require('../internals/fails');\n\nvar nativeConstruct = getBuiltIn('Reflect', 'construct');\nvar ObjectPrototype = Object.prototype;\nvar push = [].push;\n\n// `Reflect.construct` method\n// https://tc39.es/ecma262/#sec-reflect.construct\n// MS Edge supports only 2 arguments and argumentsList argument is optional\n// FF Nightly sets third argument as `new.target`, but does not create `this` from it\nvar NEW_TARGET_BUG = fails(function () {\n function F() { /* empty */ }\n return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);\n});\n\nvar ARGS_BUG = !fails(function () {\n nativeConstruct(function () { /* empty */ });\n});\n\nvar FORCED = NEW_TARGET_BUG || ARGS_BUG;\n\n$({ target: 'Reflect', stat: true, forced: FORCED, sham: FORCED }, {\n construct: function construct(Target, args /* , newTarget */) {\n aConstructor(Target);\n anObject(args);\n var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]);\n if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);\n if (Target == newTarget) {\n // w/o altered newTarget, optimization for 0-4 arguments\n switch (args.length) {\n case 0: return new Target();\n case 1: return new Target(args[0]);\n case 2: return new Target(args[0], args[1]);\n case 3: return new Target(args[0], args[1], args[2]);\n case 4: return new Target(args[0], args[1], args[2], args[3]);\n }\n // w/o altered newTarget, lot of arguments case\n var $args = [null];\n apply(push, $args, args);\n return new (apply(bind, Target, $args))();\n }\n // with altered newTarget, not support built-in constructors\n var proto = newTarget.prototype;\n var instance = create(isObject(proto) ? proto : ObjectPrototype);\n var result = apply(Target, instance, args);\n return isObject(result) ? result : instance;\n }\n});\n","require('../../modules/es.reflect.construct');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Reflect.construct;\n","var parent = require('../../es/reflect/construct');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/reflect/construct\");","var $ = require('../internals/export');\nvar toObject = require('../internals/to-object');\nvar nativeKeys = require('../internals/object-keys');\nvar fails = require('../internals/fails');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });\n\n// `Object.keys` method\n// https://tc39.es/ecma262/#sec-object.keys\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {\n keys: function keys(it) {\n return nativeKeys(toObject(it));\n }\n});\n","require('../../modules/es.object.keys');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.keys;\n","var parent = require('../../es/object/keys');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/keys\");","var global = require('../internals/global');\nvar classof = require('../internals/classof');\n\nvar String = global.String;\n\nmodule.exports = function (argument) {\n if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string');\n return String(argument);\n};\n","var internalObjectKeys = require('../internals/object-keys-internal');\nvar enumBugKeys = require('../internals/enum-bug-keys');\n\nvar hiddenKeys = enumBugKeys.concat('length', 'prototype');\n\n// `Object.getOwnPropertyNames` method\n// https://tc39.es/ecma262/#sec-object.getownpropertynames\n// eslint-disable-next-line es-x/no-object-getownpropertynames -- safe\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return internalObjectKeys(O, hiddenKeys);\n};\n","'use strict';\nvar toPropertyKey = require('../internals/to-property-key');\nvar definePropertyModule = require('../internals/object-define-property');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\n\nmodule.exports = function (object, key, value) {\n var propertyKey = toPropertyKey(key);\n if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));\n else object[propertyKey] = value;\n};\n","var global = require('../internals/global');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar createProperty = require('../internals/create-property');\n\nvar Array = global.Array;\nvar max = Math.max;\n\nmodule.exports = function (O, start, end) {\n var length = lengthOfArrayLike(O);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n var result = Array(max(fin - k, 0));\n for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n};\n","/* eslint-disable es-x/no-object-getownpropertynames -- safe */\nvar classof = require('../internals/classof-raw');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;\nvar arraySlice = require('../internals/array-slice-simple');\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return $getOwnPropertyNames(it);\n } catch (error) {\n return arraySlice(windowNames);\n }\n};\n\n// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && classof(it) == 'Window'\n ? getWindowNames(it)\n : $getOwnPropertyNames(toIndexedObject(it));\n};\n","// eslint-disable-next-line es-x/no-object-getownpropertysymbols -- safe\nexports.f = Object.getOwnPropertySymbols;\n","var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\n\nmodule.exports = function (target, key, value, options) {\n if (options && options.enumerable) target[key] = value;\n else createNonEnumerableProperty(target, key, value);\n return target;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nexports.f = wellKnownSymbol;\n","var path = require('../internals/path');\nvar hasOwn = require('../internals/has-own-property');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineProperty = require('../internals/object-define-property').f;\n\nmodule.exports = function (NAME) {\n var Symbol = path.Symbol || (path.Symbol = {});\n if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, {\n value: wrappedWellKnownSymbolModule.f(NAME)\n });\n};\n","var call = require('../internals/function-call');\nvar getBuiltIn = require('../internals/get-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function () {\n var Symbol = getBuiltIn('Symbol');\n var SymbolPrototype = Symbol && Symbol.prototype;\n var valueOf = SymbolPrototype && SymbolPrototype.valueOf;\n var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');\n\n if (SymbolPrototype && !SymbolPrototype[TO_PRIMITIVE]) {\n // `Symbol.prototype[@@toPrimitive]` method\n // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\n // eslint-disable-next-line no-unused-vars -- required for .length\n defineBuiltIn(SymbolPrototype, TO_PRIMITIVE, function (hint) {\n return call(valueOf, this);\n }, { arity: 1 });\n }\n};\n","'use strict';\nvar TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar classof = require('../internals/classof');\n\n// `Object.prototype.toString` method implementation\n// https://tc39.es/ecma262/#sec-object.prototype.tostring\nmodule.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {\n return '[object ' + classof(this) + ']';\n};\n","var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');\nvar defineProperty = require('../internals/object-define-property').f;\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar toString = require('../internals/object-to-string');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nmodule.exports = function (it, TAG, STATIC, SET_METHOD) {\n if (it) {\n var target = STATIC ? it : it.prototype;\n if (!hasOwn(target, TO_STRING_TAG)) {\n defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG });\n }\n if (SET_METHOD && !TO_STRING_TAG_SUPPORT) {\n createNonEnumerableProperty(target, 'toString', toString);\n }\n }\n};\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\nvar inspectSource = require('../internals/inspect-source');\n\nvar WeakMap = global.WeakMap;\n\nmodule.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap));\n","var NATIVE_WEAK_MAP = require('../internals/native-weak-map');\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar isObject = require('../internals/is-object');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar hasOwn = require('../internals/has-own-property');\nvar shared = require('../internals/shared-store');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\n\nvar OBJECT_ALREADY_INITIALIZED = 'Object already initialized';\nvar TypeError = global.TypeError;\nvar WeakMap = global.WeakMap;\nvar set, get, has;\n\nvar enforce = function (it) {\n return has(it) ? get(it) : set(it, {});\n};\n\nvar getterFor = function (TYPE) {\n return function (it) {\n var state;\n if (!isObject(it) || (state = get(it)).type !== TYPE) {\n throw TypeError('Incompatible receiver, ' + TYPE + ' required');\n } return state;\n };\n};\n\nif (NATIVE_WEAK_MAP || shared.state) {\n var store = shared.state || (shared.state = new WeakMap());\n var wmget = uncurryThis(store.get);\n var wmhas = uncurryThis(store.has);\n var wmset = uncurryThis(store.set);\n set = function (it, metadata) {\n if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n wmset(store, it, metadata);\n return metadata;\n };\n get = function (it) {\n return wmget(store, it) || {};\n };\n has = function (it) {\n return wmhas(store, it);\n };\n} else {\n var STATE = sharedKey('state');\n hiddenKeys[STATE] = true;\n set = function (it, metadata) {\n if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);\n metadata.facade = it;\n createNonEnumerableProperty(it, STATE, metadata);\n return metadata;\n };\n get = function (it) {\n return hasOwn(it, STATE) ? it[STATE] : {};\n };\n has = function (it) {\n return hasOwn(it, STATE);\n };\n}\n\nmodule.exports = {\n set: set,\n get: get,\n has: has,\n enforce: enforce,\n getterFor: getterFor\n};\n","var classof = require('../internals/classof-raw');\n\n// `IsArray` abstract operation\n// https://tc39.es/ecma262/#sec-isarray\n// eslint-disable-next-line es-x/no-array-isarray -- safe\nmodule.exports = Array.isArray || function isArray(argument) {\n return classof(argument) == 'Array';\n};\n","var global = require('../internals/global');\nvar isArray = require('../internals/is-array');\nvar isConstructor = require('../internals/is-constructor');\nvar isObject = require('../internals/is-object');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\nvar Array = global.Array;\n\n// a part of `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray) {\n var C;\n if (isArray(originalArray)) {\n C = originalArray.constructor;\n // cross-realm fallback\n if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;\n else if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n","var arraySpeciesConstructor = require('../internals/array-species-constructor');\n\n// `ArraySpeciesCreate` abstract operation\n// https://tc39.es/ecma262/#sec-arrayspeciescreate\nmodule.exports = function (originalArray, length) {\n return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);\n};\n","var bind = require('../internals/function-bind-context');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar IndexedObject = require('../internals/indexed-object');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\nvar push = uncurryThis([].push);\n\n// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation\nvar createMethod = function (TYPE) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var IS_FILTER_REJECT = TYPE == 7;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n return function ($this, callbackfn, that, specificCreate) {\n var O = toObject($this);\n var self = IndexedObject(O);\n var boundFunction = bind(callbackfn, that);\n var length = lengthOfArrayLike(self);\n var index = 0;\n var create = specificCreate || arraySpeciesCreate;\n var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;\n var value, result;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n value = self[index];\n result = boundFunction(value, index, O);\n if (TYPE) {\n if (IS_MAP) target[index] = result; // map\n else if (result) switch (TYPE) {\n case 3: return true; // some\n case 5: return value; // find\n case 6: return index; // findIndex\n case 2: push(target, value); // filter\n } else switch (TYPE) {\n case 4: return false; // every\n case 7: push(target, value); // filterReject\n }\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;\n };\n};\n\nmodule.exports = {\n // `Array.prototype.forEach` method\n // https://tc39.es/ecma262/#sec-array.prototype.foreach\n forEach: createMethod(0),\n // `Array.prototype.map` method\n // https://tc39.es/ecma262/#sec-array.prototype.map\n map: createMethod(1),\n // `Array.prototype.filter` method\n // https://tc39.es/ecma262/#sec-array.prototype.filter\n filter: createMethod(2),\n // `Array.prototype.some` method\n // https://tc39.es/ecma262/#sec-array.prototype.some\n some: createMethod(3),\n // `Array.prototype.every` method\n // https://tc39.es/ecma262/#sec-array.prototype.every\n every: createMethod(4),\n // `Array.prototype.find` method\n // https://tc39.es/ecma262/#sec-array.prototype.find\n find: createMethod(5),\n // `Array.prototype.findIndex` method\n // https://tc39.es/ecma262/#sec-array.prototype.findIndex\n findIndex: createMethod(6),\n // `Array.prototype.filterReject` method\n // https://github.com/tc39/proposal-array-filtering\n filterReject: createMethod(7)\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar fails = require('../internals/fails');\nvar hasOwn = require('../internals/has-own-property');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar anObject = require('../internals/an-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar toPropertyKey = require('../internals/to-property-key');\nvar $toString = require('../internals/to-string');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar nativeObjectCreate = require('../internals/object-create');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar definePropertyModule = require('../internals/object-define-property');\nvar definePropertiesModule = require('../internals/object-define-properties');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar shared = require('../internals/shared');\nvar sharedKey = require('../internals/shared-key');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar uid = require('../internals/uid');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\nvar defineSymbolToPrimitive = require('../internals/symbol-define-to-primitive');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar InternalStateModule = require('../internals/internal-state');\nvar $forEach = require('../internals/array-iteration').forEach;\n\nvar HIDDEN = sharedKey('hidden');\nvar SYMBOL = 'Symbol';\nvar PROTOTYPE = 'prototype';\n\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(SYMBOL);\n\nvar ObjectPrototype = Object[PROTOTYPE];\nvar $Symbol = global.Symbol;\nvar SymbolPrototype = $Symbol && $Symbol[PROTOTYPE];\nvar TypeError = global.TypeError;\nvar QObject = global.QObject;\nvar nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\nvar nativeDefineProperty = definePropertyModule.f;\nvar nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;\nvar nativePropertyIsEnumerable = propertyIsEnumerableModule.f;\nvar push = uncurryThis([].push);\n\nvar AllSymbols = shared('symbols');\nvar ObjectPrototypeSymbols = shared('op-symbols');\nvar WellKnownSymbolsStore = shared('wks');\n\n// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDescriptor = DESCRIPTORS && fails(function () {\n return nativeObjectCreate(nativeDefineProperty({}, 'a', {\n get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }\n })).a != 7;\n}) ? function (O, P, Attributes) {\n var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);\n if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];\n nativeDefineProperty(O, P, Attributes);\n if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {\n nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);\n }\n} : nativeDefineProperty;\n\nvar wrap = function (tag, description) {\n var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype);\n setInternalState(symbol, {\n type: SYMBOL,\n tag: tag,\n description: description\n });\n if (!DESCRIPTORS) symbol.description = description;\n return symbol;\n};\n\nvar $defineProperty = function defineProperty(O, P, Attributes) {\n if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);\n anObject(O);\n var key = toPropertyKey(P);\n anObject(Attributes);\n if (hasOwn(AllSymbols, key)) {\n if (!Attributes.enumerable) {\n if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));\n O[HIDDEN][key] = true;\n } else {\n if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;\n Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });\n } return setSymbolDescriptor(O, key, Attributes);\n } return nativeDefineProperty(O, key, Attributes);\n};\n\nvar $defineProperties = function defineProperties(O, Properties) {\n anObject(O);\n var properties = toIndexedObject(Properties);\n var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));\n $forEach(keys, function (key) {\n if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]);\n });\n return O;\n};\n\nvar $create = function create(O, Properties) {\n return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);\n};\n\nvar $propertyIsEnumerable = function propertyIsEnumerable(V) {\n var P = toPropertyKey(V);\n var enumerable = call(nativePropertyIsEnumerable, this, P);\n if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false;\n return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P]\n ? enumerable : true;\n};\n\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {\n var it = toIndexedObject(O);\n var key = toPropertyKey(P);\n if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return;\n var descriptor = nativeGetOwnPropertyDescriptor(it, key);\n if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) {\n descriptor.enumerable = true;\n }\n return descriptor;\n};\n\nvar $getOwnPropertyNames = function getOwnPropertyNames(O) {\n var names = nativeGetOwnPropertyNames(toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key);\n });\n return result;\n};\n\nvar $getOwnPropertySymbols = function (O) {\n var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;\n var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));\n var result = [];\n $forEach(names, function (key) {\n if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) {\n push(result, AllSymbols[key]);\n }\n });\n return result;\n};\n\n// `Symbol` constructor\n// https://tc39.es/ecma262/#sec-symbol-constructor\nif (!NATIVE_SYMBOL) {\n $Symbol = function Symbol() {\n if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor');\n var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);\n var tag = uid(description);\n var setter = function (value) {\n if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value);\n if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));\n };\n if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });\n return wrap(tag, description);\n };\n\n SymbolPrototype = $Symbol[PROTOTYPE];\n\n defineBuiltIn(SymbolPrototype, 'toString', function toString() {\n return getInternalState(this).tag;\n });\n\n defineBuiltIn($Symbol, 'withoutSetter', function (description) {\n return wrap(uid(description), description);\n });\n\n propertyIsEnumerableModule.f = $propertyIsEnumerable;\n definePropertyModule.f = $defineProperty;\n definePropertiesModule.f = $defineProperties;\n getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;\n getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;\n getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;\n\n wrappedWellKnownSymbolModule.f = function (name) {\n return wrap(wellKnownSymbol(name), name);\n };\n\n if (DESCRIPTORS) {\n // https://github.com/tc39/proposal-Symbol-description\n nativeDefineProperty(SymbolPrototype, 'description', {\n configurable: true,\n get: function description() {\n return getInternalState(this).description;\n }\n });\n if (!IS_PURE) {\n defineBuiltIn(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });\n }\n }\n}\n\n$({ global: true, constructor: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {\n Symbol: $Symbol\n});\n\n$forEach(objectKeys(WellKnownSymbolsStore), function (name) {\n defineWellKnownSymbol(name);\n});\n\n$({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {\n useSetter: function () { USE_SETTER = true; },\n useSimple: function () { USE_SETTER = false; }\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {\n // `Object.create` method\n // https://tc39.es/ecma262/#sec-object.create\n create: $create,\n // `Object.defineProperty` method\n // https://tc39.es/ecma262/#sec-object.defineproperty\n defineProperty: $defineProperty,\n // `Object.defineProperties` method\n // https://tc39.es/ecma262/#sec-object.defineproperties\n defineProperties: $defineProperties,\n // `Object.getOwnPropertyDescriptor` method\n // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor\n});\n\n$({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {\n // `Object.getOwnPropertyNames` method\n // https://tc39.es/ecma262/#sec-object.getownpropertynames\n getOwnPropertyNames: $getOwnPropertyNames\n});\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\ndefineSymbolToPrimitive();\n\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag($Symbol, SYMBOL);\n\nhiddenKeys[HIDDEN] = true;\n","var NATIVE_SYMBOL = require('../internals/native-symbol');\n\n/* eslint-disable es-x/no-symbol -- safe */\nmodule.exports = NATIVE_SYMBOL && !!Symbol['for'] && !!Symbol.keyFor;\n","var $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar hasOwn = require('../internals/has-own-property');\nvar toString = require('../internals/to-string');\nvar shared = require('../internals/shared');\nvar NATIVE_SYMBOL_REGISTRY = require('../internals/native-symbol-registry');\n\nvar StringToSymbolRegistry = shared('string-to-symbol-registry');\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\n\n// `Symbol.for` method\n// https://tc39.es/ecma262/#sec-symbol.for\n$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {\n 'for': function (key) {\n var string = toString(key);\n if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];\n var symbol = getBuiltIn('Symbol')(string);\n StringToSymbolRegistry[string] = symbol;\n SymbolToStringRegistry[symbol] = string;\n return symbol;\n }\n});\n","var $ = require('../internals/export');\nvar hasOwn = require('../internals/has-own-property');\nvar isSymbol = require('../internals/is-symbol');\nvar tryToString = require('../internals/try-to-string');\nvar shared = require('../internals/shared');\nvar NATIVE_SYMBOL_REGISTRY = require('../internals/native-symbol-registry');\n\nvar SymbolToStringRegistry = shared('symbol-to-string-registry');\n\n// `Symbol.keyFor` method\n// https://tc39.es/ecma262/#sec-symbol.keyfor\n$({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, {\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(tryToString(sym) + ' is not a symbol');\n if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];\n }\n});\n","var $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar apply = require('../internals/function-apply');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar fails = require('../internals/fails');\nvar isArray = require('../internals/is-array');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar isSymbol = require('../internals/is-symbol');\nvar arraySlice = require('../internals/array-slice');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\n\nvar $stringify = getBuiltIn('JSON', 'stringify');\nvar exec = uncurryThis(/./.exec);\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar replace = uncurryThis(''.replace);\nvar numberToString = uncurryThis(1.0.toString);\n\nvar tester = /[\\uD800-\\uDFFF]/g;\nvar low = /^[\\uD800-\\uDBFF]$/;\nvar hi = /^[\\uDC00-\\uDFFF]$/;\n\nvar WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () {\n var symbol = getBuiltIn('Symbol')();\n // MS Edge converts symbol values to JSON as {}\n return $stringify([symbol]) != '[null]'\n // WebKit converts symbol values to JSON as null\n || $stringify({ a: symbol }) != '{}'\n // V8 throws on boxed symbols\n || $stringify(Object(symbol)) != '{}';\n});\n\n// https://github.com/tc39/proposal-well-formed-stringify\nvar ILL_FORMED_UNICODE = fails(function () {\n return $stringify('\\uDF06\\uD834') !== '\"\\\\udf06\\\\ud834\"'\n || $stringify('\\uDEAD') !== '\"\\\\udead\"';\n});\n\nvar stringifyWithSymbolsFix = function (it, replacer) {\n var args = arraySlice(arguments);\n var $replacer = replacer;\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (isCallable($replacer)) value = call($replacer, this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return apply($stringify, null, args);\n};\n\nvar fixIllFormed = function (match, offset, string) {\n var prev = charAt(string, offset - 1);\n var next = charAt(string, offset + 1);\n if ((exec(low, match) && !exec(hi, next)) || (exec(hi, match) && !exec(low, prev))) {\n return '\\\\u' + numberToString(charCodeAt(match, 0), 16);\n } return match;\n};\n\nif ($stringify) {\n // `JSON.stringify` method\n // https://tc39.es/ecma262/#sec-json.stringify\n $({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n stringify: function stringify(it, replacer, space) {\n var args = arraySlice(arguments);\n var result = apply(WRONG_SYMBOLS_CONVERSION ? stringifyWithSymbolsFix : $stringify, null, args);\n return ILL_FORMED_UNICODE && typeof result == 'string' ? replace(result, tester, fixIllFormed) : result;\n }\n });\n}\n","var $ = require('../internals/export');\nvar NATIVE_SYMBOL = require('../internals/native-symbol');\nvar fails = require('../internals/fails');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar toObject = require('../internals/to-object');\n\n// V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\nvar FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });\n\n// `Object.getOwnPropertySymbols` method\n// https://tc39.es/ecma262/#sec-object.getownpropertysymbols\n$({ target: 'Object', stat: true, forced: FORCED }, {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];\n }\n});\n","require('../../modules/es.symbol');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getOwnPropertySymbols;\n","var parent = require('../../es/object/get-own-property-symbols');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/get-own-property-symbols\");","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $filter = require('../internals/array-iteration').filter;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');\n\n// `Array.prototype.filter` method\n// https://tc39.es/ecma262/#sec-array.prototype.filter\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","var path = require('../internals/path');\n\nmodule.exports = function (CONSTRUCTOR) {\n return path[CONSTRUCTOR + 'Prototype'];\n};\n","require('../../../modules/es.array.filter');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').filter;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/filter');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.filter;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.filter) ? method : own;\n};\n","var parent = require('../../es/instance/filter');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/filter\");","var $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar nativeGetOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetOwnPropertyDescriptor(1); });\nvar FORCED = !DESCRIPTORS || FAILS_ON_PRIMITIVES;\n\n// `Object.getOwnPropertyDescriptor` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor\n$({ target: 'Object', stat: true, forced: FORCED, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptor: function getOwnPropertyDescriptor(it, key) {\n return nativeGetOwnPropertyDescriptor(toIndexedObject(it), key);\n }\n});\n","require('../../modules/es.object.get-own-property-descriptor');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar getOwnPropertyDescriptor = module.exports = function getOwnPropertyDescriptor(it, key) {\n return Object.getOwnPropertyDescriptor(it, key);\n};\n\nif (Object.getOwnPropertyDescriptor.sham) getOwnPropertyDescriptor.sham = true;\n","var parent = require('../../es/object/get-own-property-descriptor');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/get-own-property-descriptor\");","module.exports = {};\n","var DESCRIPTORS = require('../internals/descriptors');\nvar hasOwn = require('../internals/has-own-property');\n\nvar FunctionPrototype = Function.prototype;\n// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\nvar getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;\n\nvar EXISTS = hasOwn(FunctionPrototype, 'name');\n// additional protection from minified / mangled / dropped function names\nvar PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';\nvar CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));\n\nmodule.exports = {\n EXISTS: EXISTS,\n PROPER: PROPER,\n CONFIGURABLE: CONFIGURABLE\n};\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n function F() { /* empty */ }\n F.prototype.constructor = null;\n // eslint-disable-next-line es-x/no-object-getprototypeof -- required for testing\n return Object.getPrototypeOf(new F()) !== F.prototype;\n});\n","var global = require('../internals/global');\nvar hasOwn = require('../internals/has-own-property');\nvar isCallable = require('../internals/is-callable');\nvar toObject = require('../internals/to-object');\nvar sharedKey = require('../internals/shared-key');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar IE_PROTO = sharedKey('IE_PROTO');\nvar Object = global.Object;\nvar ObjectPrototype = Object.prototype;\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\nmodule.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {\n var object = toObject(O);\n if (hasOwn(object, IE_PROTO)) return object[IE_PROTO];\n var constructor = object.constructor;\n if (isCallable(constructor) && object instanceof constructor) {\n return constructor.prototype;\n } return object instanceof Object ? ObjectPrototype : null;\n};\n","'use strict';\nvar fails = require('../internals/fails');\nvar isCallable = require('../internals/is-callable');\nvar create = require('../internals/object-create');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar IS_PURE = require('../internals/is-pure');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar BUGGY_SAFARI_ITERATORS = false;\n\n// `%IteratorPrototype%` object\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-object\nvar IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;\n\n/* eslint-disable es-x/no-array-prototype-keys -- safe */\nif ([].keys) {\n arrayIterator = [].keys();\n // Safari 8 has buggy iterators w/o `next`\n if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;\n else {\n PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));\n if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;\n }\n}\n\nvar NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {\n var test = {};\n // FF44- legacy iterators case\n return IteratorPrototype[ITERATOR].call(test) !== test;\n});\n\nif (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};\nelse if (IS_PURE) IteratorPrototype = create(IteratorPrototype);\n\n// `%IteratorPrototype%[@@iterator]()` method\n// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator\nif (!isCallable(IteratorPrototype[ITERATOR])) {\n defineBuiltIn(IteratorPrototype, ITERATOR, function () {\n return this;\n });\n}\n\nmodule.exports = {\n IteratorPrototype: IteratorPrototype,\n BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS\n};\n","'use strict';\nvar IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;\nvar create = require('../internals/object-create');\nvar createPropertyDescriptor = require('../internals/create-property-descriptor');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar Iterators = require('../internals/iterators');\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (IteratorConstructor, NAME, next, ENUMERABLE_NEXT) {\n var TO_STRING_TAG = NAME + ' Iterator';\n IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(+!ENUMERABLE_NEXT, next) });\n setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);\n Iterators[TO_STRING_TAG] = returnThis;\n return IteratorConstructor;\n};\n","var global = require('../internals/global');\nvar isCallable = require('../internals/is-callable');\n\nvar String = global.String;\nvar TypeError = global.TypeError;\n\nmodule.exports = function (argument) {\n if (typeof argument == 'object' || isCallable(argument)) return argument;\n throw TypeError(\"Can't set \" + String(argument) + ' as a prototype');\n};\n","/* eslint-disable no-proto -- safe */\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar anObject = require('../internals/an-object');\nvar aPossiblePrototype = require('../internals/a-possible-prototype');\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n// Works with __proto__ only. Old v8 can't work with null proto objects.\n// eslint-disable-next-line es-x/no-object-setprototypeof -- safe\nmodule.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {\n var CORRECT_SETTER = false;\n var test = {};\n var setter;\n try {\n // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe\n setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set);\n setter(test, []);\n CORRECT_SETTER = test instanceof Array;\n } catch (error) { /* empty */ }\n return function setPrototypeOf(O, proto) {\n anObject(O);\n aPossiblePrototype(proto);\n if (CORRECT_SETTER) setter(O, proto);\n else O.__proto__ = proto;\n return O;\n };\n}() : undefined);\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar IS_PURE = require('../internals/is-pure');\nvar FunctionName = require('../internals/function-name');\nvar isCallable = require('../internals/is-callable');\nvar createIteratorConstructor = require('../internals/create-iterator-constructor');\nvar getPrototypeOf = require('../internals/object-get-prototype-of');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar defineBuiltIn = require('../internals/define-built-in');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\nvar IteratorsCore = require('../internals/iterators-core');\n\nvar PROPER_FUNCTION_NAME = FunctionName.PROPER;\nvar CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE;\nvar IteratorPrototype = IteratorsCore.IteratorPrototype;\nvar BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;\nvar ITERATOR = wellKnownSymbol('iterator');\nvar KEYS = 'keys';\nvar VALUES = 'values';\nvar ENTRIES = 'entries';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {\n createIteratorConstructor(IteratorConstructor, NAME, next);\n\n var getIterationMethod = function (KIND) {\n if (KIND === DEFAULT && defaultIterator) return defaultIterator;\n if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];\n switch (KIND) {\n case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };\n case VALUES: return function values() { return new IteratorConstructor(this, KIND); };\n case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };\n } return function () { return new IteratorConstructor(this); };\n };\n\n var TO_STRING_TAG = NAME + ' Iterator';\n var INCORRECT_VALUES_NAME = false;\n var IterablePrototype = Iterable.prototype;\n var nativeIterator = IterablePrototype[ITERATOR]\n || IterablePrototype['@@iterator']\n || DEFAULT && IterablePrototype[DEFAULT];\n var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);\n var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;\n var CurrentIteratorPrototype, methods, KEY;\n\n // fix native\n if (anyNativeIterator) {\n CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));\n if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {\n if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {\n if (setPrototypeOf) {\n setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);\n } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) {\n defineBuiltIn(CurrentIteratorPrototype, ITERATOR, returnThis);\n }\n }\n // Set @@toStringTag to native iterators\n setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);\n if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;\n }\n }\n\n // fix Array.prototype.{ values, @@iterator }.name in V8 / FF\n if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {\n if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) {\n createNonEnumerableProperty(IterablePrototype, 'name', VALUES);\n } else {\n INCORRECT_VALUES_NAME = true;\n defaultIterator = function values() { return call(nativeIterator, this); };\n }\n }\n\n // export additional methods\n if (DEFAULT) {\n methods = {\n values: getIterationMethod(VALUES),\n keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),\n entries: getIterationMethod(ENTRIES)\n };\n if (FORCED) for (KEY in methods) {\n if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {\n defineBuiltIn(IterablePrototype, KEY, methods[KEY]);\n }\n } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);\n }\n\n // define iterator\n if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {\n defineBuiltIn(IterablePrototype, ITERATOR, defaultIterator, { name: DEFAULT });\n }\n Iterators[NAME] = defaultIterator;\n\n return methods;\n};\n","'use strict';\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar addToUnscopables = require('../internals/add-to-unscopables');\nvar Iterators = require('../internals/iterators');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineProperty = require('../internals/object-define-property').f;\nvar defineIterator = require('../internals/define-iterator');\nvar IS_PURE = require('../internals/is-pure');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar ARRAY_ITERATOR = 'Array Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);\n\n// `Array.prototype.entries` method\n// https://tc39.es/ecma262/#sec-array.prototype.entries\n// `Array.prototype.keys` method\n// https://tc39.es/ecma262/#sec-array.prototype.keys\n// `Array.prototype.values` method\n// https://tc39.es/ecma262/#sec-array.prototype.values\n// `Array.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-array.prototype-@@iterator\n// `CreateArrayIterator` internal method\n// https://tc39.es/ecma262/#sec-createarrayiterator\nmodule.exports = defineIterator(Array, 'Array', function (iterated, kind) {\n setInternalState(this, {\n type: ARRAY_ITERATOR,\n target: toIndexedObject(iterated), // target\n index: 0, // next index\n kind: kind // kind\n });\n// `%ArrayIteratorPrototype%.next` method\n// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next\n}, function () {\n var state = getInternalState(this);\n var target = state.target;\n var kind = state.kind;\n var index = state.index++;\n if (!target || index >= target.length) {\n state.target = undefined;\n return { value: undefined, done: true };\n }\n if (kind == 'keys') return { value: index, done: false };\n if (kind == 'values') return { value: target[index], done: false };\n return { value: [index, target[index]], done: false };\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values%\n// https://tc39.es/ecma262/#sec-createunmappedargumentsobject\n// https://tc39.es/ecma262/#sec-createmappedargumentsobject\nvar values = Iterators.Arguments = Iterators.Array;\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n// V8 ~ Chrome 45- bug\nif (!IS_PURE && DESCRIPTORS && values.name !== 'values') try {\n defineProperty(values, 'name', { value: 'values' });\n} catch (error) { /* empty */ }\n","// iterable DOM collections\n// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods\nmodule.exports = {\n CSSRuleList: 0,\n CSSStyleDeclaration: 0,\n CSSValueList: 0,\n ClientRectList: 0,\n DOMRectList: 0,\n DOMStringList: 0,\n DOMTokenList: 1,\n DataTransferItemList: 0,\n FileList: 0,\n HTMLAllCollection: 0,\n HTMLCollection: 0,\n HTMLFormElement: 0,\n HTMLSelectElement: 0,\n MediaList: 0,\n MimeTypeArray: 0,\n NamedNodeMap: 0,\n NodeList: 1,\n PaintRequestList: 0,\n Plugin: 0,\n PluginArray: 0,\n SVGLengthList: 0,\n SVGNumberList: 0,\n SVGPathSegList: 0,\n SVGPointList: 0,\n SVGStringList: 0,\n SVGTransformList: 0,\n SourceBufferList: 0,\n StyleSheetList: 0,\n TextTrackCueList: 0,\n TextTrackList: 0,\n TouchList: 0\n};\n","require('../modules/es.array.iterator');\nvar DOMIterables = require('../internals/dom-iterables');\nvar global = require('../internals/global');\nvar classof = require('../internals/classof');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar TO_STRING_TAG = wellKnownSymbol('toStringTag');\n\nfor (var COLLECTION_NAME in DOMIterables) {\n var Collection = global[COLLECTION_NAME];\n var CollectionPrototype = Collection && Collection.prototype;\n if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG) {\n createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);\n }\n Iterators[COLLECTION_NAME] = Iterators.Array;\n}\n","'use strict';\nvar fails = require('../internals/fails');\n\nmodule.exports = function (METHOD_NAME, argument) {\n var method = [][METHOD_NAME];\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call -- required for testing\n method.call(null, argument || function () { return 1; }, 1);\n });\n};\n","'use strict';\nvar $forEach = require('../internals/array-iteration').forEach;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar STRICT_METHOD = arrayMethodIsStrict('forEach');\n\n// `Array.prototype.forEach` method implementation\n// https://tc39.es/ecma262/#sec-array.prototype.foreach\nmodule.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {\n return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe\n} : [].forEach;\n","'use strict';\nvar $ = require('../internals/export');\nvar forEach = require('../internals/array-for-each');\n\n// `Array.prototype.forEach` method\n// https://tc39.es/ecma262/#sec-array.prototype.foreach\n// eslint-disable-next-line es-x/no-array-prototype-foreach -- safe\n$({ target: 'Array', proto: true, forced: [].forEach != forEach }, {\n forEach: forEach\n});\n","require('../../../modules/es.array.for-each');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').forEach;\n","var parent = require('../../../es/array/virtual/for-each');\n\nmodule.exports = parent;\n","require('../../modules/web.dom-collections.iterator');\nvar classof = require('../../internals/classof');\nvar hasOwn = require('../../internals/has-own-property');\nvar isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/for-each');\n\nvar ArrayPrototype = Array.prototype;\n\nvar DOMIterables = {\n DOMTokenList: true,\n NodeList: true\n};\n\nmodule.exports = function (it) {\n var own = it.forEach;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.forEach)\n || hasOwn(DOMIterables, classof(it)) ? method : own;\n};\n","module.exports = require(\"core-js-pure/stable/instance/for-each\");","var getBuiltIn = require('../internals/get-built-in');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar anObject = require('../internals/an-object');\n\nvar concat = uncurryThis([].concat);\n\n// all object keys, includes non-enumerable and symbols\nmodule.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {\n var keys = getOwnPropertyNamesModule.f(anObject(it));\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys;\n};\n","var $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar ownKeys = require('../internals/own-keys');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');\nvar createProperty = require('../internals/create-property');\n\n// `Object.getOwnPropertyDescriptors` method\n// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIndexedObject(object);\n var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;\n var keys = ownKeys(O);\n var result = {};\n var index = 0;\n var key, descriptor;\n while (keys.length > index) {\n descriptor = getOwnPropertyDescriptor(O, key = keys[index++]);\n if (descriptor !== undefined) createProperty(result, key, descriptor);\n }\n return result;\n }\n});\n","require('../../modules/es.object.get-own-property-descriptors');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getOwnPropertyDescriptors;\n","var parent = require('../../es/object/get-own-property-descriptors');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/get-own-property-descriptors\");","var $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar defineProperties = require('../internals/object-define-properties').f;\n\n// `Object.defineProperties` method\n// https://tc39.es/ecma262/#sec-object.defineproperties\n// eslint-disable-next-line es-x/no-object-defineproperties -- safe\n$({ target: 'Object', stat: true, forced: Object.defineProperties !== defineProperties, sham: !DESCRIPTORS }, {\n defineProperties: defineProperties\n});\n","require('../../modules/es.object.define-properties');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar defineProperties = module.exports = function defineProperties(T, D) {\n return Object.defineProperties(T, D);\n};\n\nif (Object.defineProperties.sham) defineProperties.sham = true;\n","var parent = require('../../es/object/define-properties');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/define-properties\");","var $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar defineProperty = require('../internals/object-define-property').f;\n\n// `Object.defineProperty` method\n// https://tc39.es/ecma262/#sec-object.defineproperty\n// eslint-disable-next-line es-x/no-object-defineproperty -- safe\n$({ target: 'Object', stat: true, forced: Object.defineProperty !== defineProperty, sham: !DESCRIPTORS }, {\n defineProperty: defineProperty\n});\n","require('../../modules/es.object.define-property');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nvar defineProperty = module.exports = function defineProperty(it, key, desc) {\n return Object.defineProperty(it, key, desc);\n};\n\nif (Object.defineProperty.sham) defineProperty.sham = true;\n","var parent = require('../../es/object/define-property');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/define-property\");","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var parent = require('../../stable/object/define-property');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/define-property');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/define-property');\n","module.exports = require(\"core-js-pure/features/object/define-property\");","var _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js/object/define-property\");\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n\n _Object$defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n\n _Object$defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n\n return Constructor;\n}\n\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nmodule.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","// TODO: Remove from `core-js@4`\nvar $ = require('../internals/export');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar create = require('../internals/object-create');\n\n// `Object.create` method\n// https://tc39.es/ecma262/#sec-object.create\n$({ target: 'Object', stat: true, sham: !DESCRIPTORS }, {\n create: create\n});\n","require('../../modules/es.object.create');\nvar path = require('../../internals/path');\n\nvar Object = path.Object;\n\nmodule.exports = function create(P, D) {\n return Object.create(P, D);\n};\n","var parent = require('../../es/object/create');\n\nmodule.exports = parent;\n","var parent = require('../../stable/object/create');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/create');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/create');\n","module.exports = require(\"core-js-pure/features/object/create\");","var $ = require('../internals/export');\nvar setPrototypeOf = require('../internals/object-set-prototype-of');\n\n// `Object.setPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.setprototypeof\n$({ target: 'Object', stat: true }, {\n setPrototypeOf: setPrototypeOf\n});\n","require('../../modules/es.object.set-prototype-of');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.setPrototypeOf;\n","var parent = require('../../es/object/set-prototype-of');\n\nmodule.exports = parent;\n","var parent = require('../../stable/object/set-prototype-of');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/set-prototype-of');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/set-prototype-of');\n","module.exports = require(\"core-js-pure/features/object/set-prototype-of\");","var _Object$setPrototypeOf = require(\"@babel/runtime-corejs3/core-js/object/set-prototype-of\");\n\nfunction _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = _Object$setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _setPrototypeOf(o, p);\n}\n\nmodule.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Object$create = require(\"@babel/runtime-corejs3/core-js/object/create\");\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js/object/define-property\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = _Object$create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n\n _Object$defineProperty(subClass, \"prototype\", {\n writable: false\n });\n\n if (superClass) setPrototypeOf(subClass, superClass);\n}\n\nmodule.exports = _inherits, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar isArray = require('../internals/is-array');\nvar isObject = require('../internals/is-object');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar createProperty = require('../internals/create-property');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';\nvar TypeError = global.TypeError;\n\n// We can't use this feature detection in V8 since it causes\n// deoptimization and serious performance degradation\n// https://github.com/zloirock/core-js/issues/679\nvar IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {\n var array = [];\n array[IS_CONCAT_SPREADABLE] = false;\n return array.concat()[0] !== array;\n});\n\nvar SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');\n\nvar isConcatSpreadable = function (O) {\n if (!isObject(O)) return false;\n var spreadable = O[IS_CONCAT_SPREADABLE];\n return spreadable !== undefined ? !!spreadable : isArray(O);\n};\n\nvar FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;\n\n// `Array.prototype.concat` method\n// https://tc39.es/ecma262/#sec-array.prototype.concat\n// with adding support of @@isConcatSpreadable and @@species\n$({ target: 'Array', proto: true, arity: 1, forced: FORCED }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n concat: function concat(arg) {\n var O = toObject(this);\n var A = arraySpeciesCreate(O, 0);\n var n = 0;\n var i, k, length, len, E;\n for (i = -1, length = arguments.length; i < length; i++) {\n E = i === -1 ? O : arguments[i];\n if (isConcatSpreadable(E)) {\n len = lengthOfArrayLike(E);\n if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);\n } else {\n if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);\n createProperty(A, n++, E);\n }\n }\n A.length = n;\n return A;\n }\n});\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.asyncIterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.asynciterator\ndefineWellKnownSymbol('asyncIterator');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.hasInstance` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.hasinstance\ndefineWellKnownSymbol('hasInstance');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.isConcatSpreadable` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable\ndefineWellKnownSymbol('isConcatSpreadable');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.iterator` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.iterator\ndefineWellKnownSymbol('iterator');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.match` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.match\ndefineWellKnownSymbol('match');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.matchAll` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.matchall\ndefineWellKnownSymbol('matchAll');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.replace` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.replace\ndefineWellKnownSymbol('replace');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.search` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.search\ndefineWellKnownSymbol('search');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.species` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.species\ndefineWellKnownSymbol('species');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.split` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.split\ndefineWellKnownSymbol('split');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\nvar defineSymbolToPrimitive = require('../internals/symbol-define-to-primitive');\n\n// `Symbol.toPrimitive` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.toprimitive\ndefineWellKnownSymbol('toPrimitive');\n\n// `Symbol.prototype[@@toPrimitive]` method\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive\ndefineSymbolToPrimitive();\n","var getBuiltIn = require('../internals/get-built-in');\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\nvar setToStringTag = require('../internals/set-to-string-tag');\n\n// `Symbol.toStringTag` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.tostringtag\ndefineWellKnownSymbol('toStringTag');\n\n// `Symbol.prototype[@@toStringTag]` property\n// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag\nsetToStringTag(getBuiltIn('Symbol'), 'Symbol');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.unscopables` well-known symbol\n// https://tc39.es/ecma262/#sec-symbol.unscopables\ndefineWellKnownSymbol('unscopables');\n","var global = require('../internals/global');\nvar setToStringTag = require('../internals/set-to-string-tag');\n\n// JSON[@@toStringTag] property\n// https://tc39.es/ecma262/#sec-json-@@tostringtag\nsetToStringTag(global.JSON, 'JSON', true);\n","require('../../modules/es.array.concat');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.symbol');\nrequire('../../modules/es.symbol.async-iterator');\nrequire('../../modules/es.symbol.description');\nrequire('../../modules/es.symbol.has-instance');\nrequire('../../modules/es.symbol.is-concat-spreadable');\nrequire('../../modules/es.symbol.iterator');\nrequire('../../modules/es.symbol.match');\nrequire('../../modules/es.symbol.match-all');\nrequire('../../modules/es.symbol.replace');\nrequire('../../modules/es.symbol.search');\nrequire('../../modules/es.symbol.species');\nrequire('../../modules/es.symbol.split');\nrequire('../../modules/es.symbol.to-primitive');\nrequire('../../modules/es.symbol.to-string-tag');\nrequire('../../modules/es.symbol.unscopables');\nrequire('../../modules/es.json.to-string-tag');\nrequire('../../modules/es.math.to-string-tag');\nrequire('../../modules/es.reflect.to-string-tag');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Symbol;\n","var parent = require('../../es/symbol');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","var parent = require('../../stable/symbol');\n\nmodule.exports = parent;\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.asyncDispose` well-known symbol\n// https://github.com/tc39/proposal-using-statement\ndefineWellKnownSymbol('asyncDispose');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.dispose` well-known symbol\n// https://github.com/tc39/proposal-using-statement\ndefineWellKnownSymbol('dispose');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.matcher` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\ndefineWellKnownSymbol('matcher');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.metadata` well-known symbol\n// https://github.com/tc39/proposal-decorators\ndefineWellKnownSymbol('metadata');\n","var defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.observable` well-known symbol\n// https://github.com/tc39/proposal-observable\ndefineWellKnownSymbol('observable');\n","// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\n// `Symbol.patternMatch` well-known symbol\n// https://github.com/tc39/proposal-pattern-matching\ndefineWellKnownSymbol('patternMatch');\n","// TODO: remove from `core-js@4`\nvar defineWellKnownSymbol = require('../internals/define-well-known-symbol');\n\ndefineWellKnownSymbol('replaceAll');\n","var parent = require('../../actual/symbol');\nrequire('../../modules/esnext.symbol.async-dispose');\nrequire('../../modules/esnext.symbol.dispose');\nrequire('../../modules/esnext.symbol.matcher');\nrequire('../../modules/esnext.symbol.metadata');\nrequire('../../modules/esnext.symbol.observable');\n// TODO: Remove from `core-js@4`\nrequire('../../modules/esnext.symbol.pattern-match');\n// TODO: Remove from `core-js@4`\nrequire('../../modules/esnext.symbol.replace-all');\n\nmodule.exports = parent;\n","module.exports = require('../../full/symbol');\n","module.exports = require(\"core-js-pure/features/symbol\");","var uncurryThis = require('../internals/function-uncurry-this');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar toString = require('../internals/to-string');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\n\nvar charAt = uncurryThis(''.charAt);\nvar charCodeAt = uncurryThis(''.charCodeAt);\nvar stringSlice = uncurryThis(''.slice);\n\nvar createMethod = function (CONVERT_TO_STRING) {\n return function ($this, pos) {\n var S = toString(requireObjectCoercible($this));\n var position = toIntegerOrInfinity(pos);\n var size = S.length;\n var first, second;\n if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;\n first = charCodeAt(S, position);\n return first < 0xD800 || first > 0xDBFF || position + 1 === size\n || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF\n ? CONVERT_TO_STRING\n ? charAt(S, position)\n : first\n : CONVERT_TO_STRING\n ? stringSlice(S, position, position + 2)\n : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;\n };\n};\n\nmodule.exports = {\n // `String.prototype.codePointAt` method\n // https://tc39.es/ecma262/#sec-string.prototype.codepointat\n codeAt: createMethod(false),\n // `String.prototype.at` method\n // https://github.com/mathiasbynens/String.prototype.at\n charAt: createMethod(true)\n};\n","'use strict';\nvar charAt = require('../internals/string-multibyte').charAt;\nvar toString = require('../internals/to-string');\nvar InternalStateModule = require('../internals/internal-state');\nvar defineIterator = require('../internals/define-iterator');\n\nvar STRING_ITERATOR = 'String Iterator';\nvar setInternalState = InternalStateModule.set;\nvar getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);\n\n// `String.prototype[@@iterator]` method\n// https://tc39.es/ecma262/#sec-string.prototype-@@iterator\ndefineIterator(String, 'String', function (iterated) {\n setInternalState(this, {\n type: STRING_ITERATOR,\n string: toString(iterated),\n index: 0\n });\n// `%StringIteratorPrototype%.next` method\n// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next\n}, function next() {\n var state = getInternalState(this);\n var string = state.string;\n var index = state.index;\n var point;\n if (index >= string.length) return { value: undefined, done: true };\n point = charAt(string, index);\n state.index += point.length;\n return { value: point, done: false };\n});\n","require('../../modules/es.array.iterator');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.string.iterator');\nrequire('../../modules/es.symbol.iterator');\nvar WrappedWellKnownSymbolModule = require('../../internals/well-known-symbol-wrapped');\n\nmodule.exports = WrappedWellKnownSymbolModule.f('iterator');\n","var parent = require('../../es/symbol/iterator');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","var parent = require('../../stable/symbol/iterator');\n\nmodule.exports = parent;\n","var parent = require('../../actual/symbol/iterator');\n\nmodule.exports = parent;\n","module.exports = require('../../full/symbol/iterator');\n","module.exports = require(\"core-js-pure/features/symbol/iterator\");","var _Symbol = require(\"@babel/runtime-corejs3/core-js/symbol\");\n\nvar _Symbol$iterator = require(\"@babel/runtime-corejs3/core-js/symbol/iterator\");\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof _Symbol && \"symbol\" == typeof _Symbol$iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof _Symbol && obj.constructor === _Symbol && obj !== _Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\n\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _typeof = require(\"./typeof.js\")[\"default\"];\n\nvar assertThisInitialized = require(\"./assertThisInitialized.js\");\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n\n return assertThisInitialized(self);\n}\n\nmodule.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var $ = require('../internals/export');\nvar fails = require('../internals/fails');\nvar toObject = require('../internals/to-object');\nvar nativeGetPrototypeOf = require('../internals/object-get-prototype-of');\nvar CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');\n\nvar FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); });\n\n// `Object.getPrototypeOf` method\n// https://tc39.es/ecma262/#sec-object.getprototypeof\n$({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !CORRECT_PROTOTYPE_GETTER }, {\n getPrototypeOf: function getPrototypeOf(it) {\n return nativeGetPrototypeOf(toObject(it));\n }\n});\n\n","require('../../modules/es.object.get-prototype-of');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.getPrototypeOf;\n","var parent = require('../../es/object/get-prototype-of');\n\nmodule.exports = parent;\n","var parent = require('../../stable/object/get-prototype-of');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/get-prototype-of');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/get-prototype-of');\n","module.exports = require(\"core-js-pure/features/object/get-prototype-of\");","var _Object$setPrototypeOf = require(\"@babel/runtime-corejs3/core-js/object/set-prototype-of\");\n\nvar _Object$getPrototypeOf = require(\"@babel/runtime-corejs3/core-js/object/get-prototype-of\");\n\nfunction _getPrototypeOf(o) {\n module.exports = _getPrototypeOf = _Object$setPrototypeOf ? _Object$getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || _Object$getPrototypeOf(o);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _getPrototypeOf(o);\n}\n\nmodule.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js/object/define-property\");\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\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","require('../../../modules/es.array.concat');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').concat;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/concat');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.concat;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.concat) ? method : own;\n};\n","var parent = require('../../es/instance/concat');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/concat\");","// TODO: Remove from `core-js@4`\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind');\n\n// `Function.prototype.bind` method\n// https://tc39.es/ecma262/#sec-function.prototype.bind\n$({ target: 'Function', proto: true, forced: Function.bind !== bind }, {\n bind: bind\n});\n","require('../../../modules/es.function.bind');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Function').bind;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../function/virtual/bind');\n\nvar FunctionPrototype = Function.prototype;\n\nmodule.exports = function (it) {\n var own = it.bind;\n return it === FunctionPrototype || (isPrototypeOf(FunctionPrototype, it) && own === FunctionPrototype.bind) ? method : own;\n};\n","var parent = require('../../es/instance/bind');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/bind\");","var global = require('../internals/global');\n\nvar TypeError = global.TypeError;\n\nmodule.exports = function (passed, required) {\n if (passed < required) throw TypeError('Not enough arguments');\n return passed;\n};\n","var global = require('../internals/global');\nvar apply = require('../internals/function-apply');\nvar isCallable = require('../internals/is-callable');\nvar userAgent = require('../internals/engine-user-agent');\nvar arraySlice = require('../internals/array-slice');\nvar validateArgumentsLength = require('../internals/validate-arguments-length');\n\nvar MSIE = /MSIE .\\./.test(userAgent); // <- dirty ie9- check\nvar Function = global.Function;\n\nvar wrap = function (scheduler) {\n return MSIE ? function (handler, timeout /* , ...arguments */) {\n var boundArgs = validateArgumentsLength(arguments.length, 1) > 2;\n var fn = isCallable(handler) ? handler : Function(handler);\n var args = boundArgs ? arraySlice(arguments, 2) : undefined;\n return scheduler(boundArgs ? function () {\n apply(fn, this, args);\n } : fn, timeout);\n } : scheduler;\n};\n\n// ie9- setTimeout & setInterval additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers\nmodule.exports = {\n // `setTimeout` method\n // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout\n setTimeout: wrap(global.setTimeout),\n // `setInterval` method\n // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval\n setInterval: wrap(global.setInterval)\n};\n","var $ = require('../internals/export');\nvar global = require('../internals/global');\nvar setInterval = require('../internals/schedulers-fix').setInterval;\n\n// ie9- setInterval additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-setinterval\n$({ global: true, bind: true, forced: global.setInterval !== setInterval }, {\n setInterval: setInterval\n});\n","var $ = require('../internals/export');\nvar global = require('../internals/global');\nvar setTimeout = require('../internals/schedulers-fix').setTimeout;\n\n// ie9- setTimeout additional parameters fix\n// https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-settimeout\n$({ global: true, bind: true, forced: global.setTimeout !== setTimeout }, {\n setTimeout: setTimeout\n});\n","require('../modules/web.timers');\nvar path = require('../internals/path');\n\nmodule.exports = path.setTimeout;\n","module.exports = require(\"core-js-pure/stable/set-timeout\");","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignMergeValue;\n","/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\nmodule.exports = createBaseFor;\n","var createBaseFor = require('./_createBaseFor');\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\nmodule.exports = baseFor;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_Uint8Array');\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n","var isObject = require('./isObject');\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_isPrototype');\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var isArrayLike = require('./isArrayLike'),\n isObjectLike = require('./isObjectLike');\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\nmodule.exports = isArrayLikeObject;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","var baseGetTag = require('./_baseGetTag'),\n getPrototype = require('./_getPrototype'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nmodule.exports = isPlainObject;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\nmodule.exports = safeGet;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\nmodule.exports = toPlainObject;\n","var assignMergeValue = require('./_assignMergeValue'),\n cloneBuffer = require('./_cloneBuffer'),\n cloneTypedArray = require('./_cloneTypedArray'),\n copyArray = require('./_copyArray'),\n initCloneObject = require('./_initCloneObject'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isArrayLikeObject = require('./isArrayLikeObject'),\n isBuffer = require('./isBuffer'),\n isFunction = require('./isFunction'),\n isObject = require('./isObject'),\n isPlainObject = require('./isPlainObject'),\n isTypedArray = require('./isTypedArray'),\n safeGet = require('./_safeGet'),\n toPlainObject = require('./toPlainObject');\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\nmodule.exports = baseMergeDeep;\n","var Stack = require('./_Stack'),\n assignMergeValue = require('./_assignMergeValue'),\n baseFor = require('./_baseFor'),\n baseMergeDeep = require('./_baseMergeDeep'),\n isObject = require('./isObject'),\n keysIn = require('./keysIn'),\n safeGet = require('./_safeGet');\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\nmodule.exports = baseMerge;\n","/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\nmodule.exports = identity;\n","/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\nmodule.exports = apply;\n","var apply = require('./_apply');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\nmodule.exports = overRest;\n","/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\nmodule.exports = constant;\n","var constant = require('./constant'),\n defineProperty = require('./_defineProperty'),\n identity = require('./identity');\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\nmodule.exports = baseSetToString;\n","/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeNow = Date.now;\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\nmodule.exports = shortOut;\n","var baseSetToString = require('./_baseSetToString'),\n shortOut = require('./_shortOut');\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\nmodule.exports = setToString;\n","var identity = require('./identity'),\n overRest = require('./_overRest'),\n setToString = require('./_setToString');\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\nmodule.exports = baseRest;\n","var eq = require('./eq'),\n isArrayLike = require('./isArrayLike'),\n isIndex = require('./_isIndex'),\n isObject = require('./isObject');\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\nmodule.exports = isIterateeCall;\n","var baseRest = require('./_baseRest'),\n isIterateeCall = require('./_isIterateeCall');\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\nmodule.exports = createAssigner;\n","var baseMerge = require('./_baseMerge'),\n createAssigner = require('./_createAssigner');\n\n/**\n * This method is like `_.merge` except that it accepts `customizer` which\n * is invoked to produce the merged values of the destination and source\n * properties. If `customizer` returns `undefined`, merging is handled by the\n * method instead. The `customizer` is invoked with six arguments:\n * (objValue, srcValue, key, object, source, stack).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function customizer(objValue, srcValue) {\n * if (_.isArray(objValue)) {\n * return objValue.concat(srcValue);\n * }\n * }\n *\n * var object = { 'a': [1], 'b': [2] };\n * var other = { 'a': [3], 'b': [4] };\n *\n * _.mergeWith(object, other, customizer);\n * // => { 'a': [1, 3], 'b': [2, 4] }\n */\nvar mergeWith = createAssigner(function(object, source, srcIndex, customizer) {\n baseMerge(object, source, srcIndex, customizer);\n});\n\nmodule.exports = mergeWith;\n","var parent = require('../../stable/object/get-own-property-symbols');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/get-own-property-symbols');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/get-own-property-symbols');\n","module.exports = require(\"core-js-pure/features/object/get-own-property-symbols\");","'use strict';\n/* eslint-disable es-x/no-array-prototype-indexof -- required for testing */\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar $IndexOf = require('../internals/array-includes').indexOf;\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar un$IndexOf = uncurryThis([].indexOf);\n\nvar NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0;\nvar STRICT_METHOD = arrayMethodIsStrict('indexOf');\n\n// `Array.prototype.indexOf` method\n// https://tc39.es/ecma262/#sec-array.prototype.indexof\n$({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD }, {\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n var fromIndex = arguments.length > 1 ? arguments[1] : undefined;\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? un$IndexOf(this, searchElement, fromIndex) || 0\n : $IndexOf(this, searchElement, fromIndex);\n }\n});\n","require('../../../modules/es.array.index-of');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').indexOf;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/index-of');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.indexOf;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.indexOf) ? method : own;\n};\n","var parent = require('../../es/instance/index-of');\n\nmodule.exports = parent;\n","var parent = require('../../stable/instance/index-of');\n\nmodule.exports = parent;\n","var parent = require('../../actual/instance/index-of');\n\nmodule.exports = parent;\n","module.exports = require('../../full/instance/index-of');\n","module.exports = require(\"core-js-pure/features/instance/index-of\");","var parent = require('../../stable/object/keys');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/keys');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/keys');\n","module.exports = require(\"core-js-pure/features/object/keys\");","var _Object$keys = require(\"@babel/runtime-corejs3/core-js/object/keys\");\n\nvar _indexOfInstanceProperty = require(\"@babel/runtime-corejs3/core-js/instance/index-of\");\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n\n var sourceKeys = _Object$keys(source);\n\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (_indexOfInstanceProperty(excluded).call(excluded, key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Object$getOwnPropertySymbols = require(\"@babel/runtime-corejs3/core-js/object/get-own-property-symbols\");\n\nvar _indexOfInstanceProperty = require(\"@babel/runtime-corejs3/core-js/instance/index-of\");\n\nvar objectWithoutPropertiesLoose = require(\"./objectWithoutPropertiesLoose.js\");\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n\n if (_Object$getOwnPropertySymbols) {\n var sourceSymbolKeys = _Object$getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (_indexOfInstanceProperty(excluded).call(excluded, key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nmodule.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","'use strict';\nvar DESCRIPTORS = require('../internals/descriptors');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar call = require('../internals/function-call');\nvar fails = require('../internals/fails');\nvar objectKeys = require('../internals/object-keys');\nvar getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');\nvar propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');\nvar toObject = require('../internals/to-object');\nvar IndexedObject = require('../internals/indexed-object');\n\n// eslint-disable-next-line es-x/no-object-assign -- safe\nvar $assign = Object.assign;\n// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing\nvar defineProperty = Object.defineProperty;\nvar concat = uncurryThis([].concat);\n\n// `Object.assign` method\n// https://tc39.es/ecma262/#sec-object.assign\nmodule.exports = !$assign || fails(function () {\n // should have correct order of operations (Edge bug)\n if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {\n enumerable: true,\n get: function () {\n defineProperty(this, 'b', {\n value: 3,\n enumerable: false\n });\n }\n }), { b: 2 })).b !== 1) return true;\n // should work with symbols and should have deterministic property order (V8 bug)\n var A = {};\n var B = {};\n // eslint-disable-next-line es-x/no-symbol -- safe\n var symbol = Symbol();\n var alphabet = 'abcdefghijklmnopqrst';\n A[symbol] = 7;\n alphabet.split('').forEach(function (chr) { B[chr] = chr; });\n return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`\n var T = toObject(target);\n var argumentsLength = arguments.length;\n var index = 1;\n var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;\n var propertyIsEnumerable = propertyIsEnumerableModule.f;\n while (argumentsLength > index) {\n var S = IndexedObject(arguments[index++]);\n var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key];\n }\n } return T;\n} : $assign;\n","var $ = require('../internals/export');\nvar assign = require('../internals/object-assign');\n\n// `Object.assign` method\n// https://tc39.es/ecma262/#sec-object.assign\n// eslint-disable-next-line es-x/no-object-assign -- required for testing\n$({ target: 'Object', stat: true, arity: 2, forced: Object.assign !== assign }, {\n assign: assign\n});\n","require('../../modules/es.object.assign');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Object.assign;\n","var parent = require('../../es/object/assign');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/object/assign\");","// a string of all valid unicode whitespaces\nmodule.exports = '\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u2000\\u2001\\u2002' +\n '\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u3000\\u2028\\u2029\\uFEFF';\n","var uncurryThis = require('../internals/function-uncurry-this');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar toString = require('../internals/to-string');\nvar whitespaces = require('../internals/whitespaces');\n\nvar replace = uncurryThis(''.replace);\nvar whitespace = '[' + whitespaces + ']';\nvar ltrim = RegExp('^' + whitespace + whitespace + '*');\nvar rtrim = RegExp(whitespace + whitespace + '*$');\n\n// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation\nvar createMethod = function (TYPE) {\n return function ($this) {\n var string = toString(requireObjectCoercible($this));\n if (TYPE & 1) string = replace(string, ltrim, '');\n if (TYPE & 2) string = replace(string, rtrim, '');\n return string;\n };\n};\n\nmodule.exports = {\n // `String.prototype.{ trimLeft, trimStart }` methods\n // https://tc39.es/ecma262/#sec-string.prototype.trimstart\n start: createMethod(1),\n // `String.prototype.{ trimRight, trimEnd }` methods\n // https://tc39.es/ecma262/#sec-string.prototype.trimend\n end: createMethod(2),\n // `String.prototype.trim` method\n // https://tc39.es/ecma262/#sec-string.prototype.trim\n trim: createMethod(3)\n};\n","var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;\nvar fails = require('../internals/fails');\nvar whitespaces = require('../internals/whitespaces');\n\nvar non = '\\u200B\\u0085\\u180E';\n\n// check that a method works with the correct list\n// of whitespaces and has a correct name\nmodule.exports = function (METHOD_NAME) {\n return fails(function () {\n return !!whitespaces[METHOD_NAME]()\n || non[METHOD_NAME]() !== non\n || (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);\n });\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar $trim = require('../internals/string-trim').trim;\nvar forcedStringTrimMethod = require('../internals/string-trim-forced');\n\n// `String.prototype.trim` method\n// https://tc39.es/ecma262/#sec-string.prototype.trim\n$({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {\n trim: function trim() {\n return $trim(this);\n }\n});\n","require('../../../modules/es.string.trim');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('String').trim;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../string/virtual/trim');\n\nvar StringPrototype = String.prototype;\n\nmodule.exports = function (it) {\n var own = it.trim;\n return typeof it == 'string' || it === StringPrototype\n || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.trim) ? method : own;\n};\n","var parent = require('../../es/instance/trim');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/trim\");","var call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar getMethod = require('../internals/get-method');\n\nmodule.exports = function (iterator, kind, value) {\n var innerResult, innerError;\n anObject(iterator);\n try {\n innerResult = getMethod(iterator, 'return');\n if (!innerResult) {\n if (kind === 'throw') throw value;\n return value;\n }\n innerResult = call(innerResult, iterator);\n } catch (error) {\n innerError = true;\n innerResult = error;\n }\n if (kind === 'throw') throw value;\n if (innerError) throw innerResult;\n anObject(innerResult);\n return value;\n};\n","var anObject = require('../internals/an-object');\nvar iteratorClose = require('../internals/iterator-close');\n\n// call something on iterator step with safe closing on error\nmodule.exports = function (iterator, fn, value, ENTRIES) {\n try {\n return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\nvar Iterators = require('../internals/iterators');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar ArrayPrototype = Array.prototype;\n\n// check on default Array iterator\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);\n};\n","var classof = require('../internals/classof');\nvar getMethod = require('../internals/get-method');\nvar Iterators = require('../internals/iterators');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\n\nmodule.exports = function (it) {\n if (it != undefined) return getMethod(it, ITERATOR)\n || getMethod(it, '@@iterator')\n || Iterators[classof(it)];\n};\n","var global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar TypeError = global.TypeError;\n\nmodule.exports = function (argument, usingIterator) {\n var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator;\n if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument));\n throw TypeError(tryToString(argument) + ' is not iterable');\n};\n","'use strict';\nvar global = require('../internals/global');\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar toObject = require('../internals/to-object');\nvar callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar isConstructor = require('../internals/is-constructor');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar createProperty = require('../internals/create-property');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nvar Array = global.Array;\n\n// `Array.from` method implementation\n// https://tc39.es/ecma262/#sec-array.from\nmodule.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var IS_CONSTRUCTOR = isConstructor(this);\n var argumentsLength = arguments.length;\n var mapfn = argumentsLength > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined);\n var iteratorMethod = getIteratorMethod(O);\n var index = 0;\n var length, result, step, iterator, next, value;\n // if the target is not iterable or it's an array with the default iterator - use a simple case\n if (iteratorMethod && !(this == Array && isArrayIteratorMethod(iteratorMethod))) {\n iterator = getIterator(O, iteratorMethod);\n next = iterator.next;\n result = IS_CONSTRUCTOR ? new this() : [];\n for (;!(step = call(next, iterator)).done; index++) {\n value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;\n createProperty(result, index, value);\n }\n } else {\n length = lengthOfArrayLike(O);\n result = IS_CONSTRUCTOR ? new this(length) : Array(length);\n for (;length > index; index++) {\n value = mapping ? mapfn(O[index], index) : O[index];\n createProperty(result, index, value);\n }\n }\n result.length = index;\n return result;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar ITERATOR = wellKnownSymbol('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var called = 0;\n var iteratorWithReturn = {\n next: function () {\n return { done: !!called++ };\n },\n 'return': function () {\n SAFE_CLOSING = true;\n }\n };\n iteratorWithReturn[ITERATOR] = function () {\n return this;\n };\n // eslint-disable-next-line es-x/no-array-from, no-throw-literal -- required for testing\n Array.from(iteratorWithReturn, function () { throw 2; });\n} catch (error) { /* empty */ }\n\nmodule.exports = function (exec, SKIP_CLOSING) {\n if (!SKIP_CLOSING && !SAFE_CLOSING) return false;\n var ITERATION_SUPPORT = false;\n try {\n var object = {};\n object[ITERATOR] = function () {\n return {\n next: function () {\n return { done: ITERATION_SUPPORT = true };\n }\n };\n };\n exec(object);\n } catch (error) { /* empty */ }\n return ITERATION_SUPPORT;\n};\n","var $ = require('../internals/export');\nvar from = require('../internals/array-from');\nvar checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');\n\nvar INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {\n // eslint-disable-next-line es-x/no-array-from -- required for testing\n Array.from(iterable);\n});\n\n// `Array.from` method\n// https://tc39.es/ecma262/#sec-array.from\n$({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {\n from: from\n});\n","require('../../modules/es.string.iterator');\nrequire('../../modules/es.array.from');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Array.from;\n","var parent = require('../../es/array/from');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/array/from\");","var isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\n// `IsRegExp` abstract operation\n// https://tc39.es/ecma262/#sec-isregexp\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');\n};\n","var global = require('../internals/global');\nvar isRegExp = require('../internals/is-regexp');\n\nvar TypeError = global.TypeError;\n\nmodule.exports = function (it) {\n if (isRegExp(it)) {\n throw TypeError(\"The method doesn't accept regular expressions\");\n } return it;\n};\n","var wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar MATCH = wellKnownSymbol('match');\n\nmodule.exports = function (METHOD_NAME) {\n var regexp = /./;\n try {\n '/./'[METHOD_NAME](regexp);\n } catch (error1) {\n try {\n regexp[MATCH] = false;\n return '/./'[METHOD_NAME](regexp);\n } catch (error2) { /* empty */ }\n } return false;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;\nvar toLength = require('../internals/to-length');\nvar toString = require('../internals/to-string');\nvar notARegExp = require('../internals/not-a-regexp');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');\nvar IS_PURE = require('../internals/is-pure');\n\n// eslint-disable-next-line es-x/no-string-prototype-startswith -- safe\nvar un$StartsWith = uncurryThis(''.startsWith);\nvar stringSlice = uncurryThis(''.slice);\nvar min = Math.min;\n\nvar CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith');\n// https://github.com/zloirock/core-js/pull/702\nvar MDN_POLYFILL_BUG = !IS_PURE && !CORRECT_IS_REGEXP_LOGIC && !!function () {\n var descriptor = getOwnPropertyDescriptor(String.prototype, 'startsWith');\n return descriptor && !descriptor.writable;\n}();\n\n// `String.prototype.startsWith` method\n// https://tc39.es/ecma262/#sec-string.prototype.startswith\n$({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {\n startsWith: function startsWith(searchString /* , position = 0 */) {\n var that = toString(requireObjectCoercible(this));\n notARegExp(searchString);\n var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length));\n var search = toString(searchString);\n return un$StartsWith\n ? un$StartsWith(that, search, index)\n : stringSlice(that, index, index + search.length) === search;\n }\n});\n","require('../../../modules/es.string.starts-with');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('String').startsWith;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../string/virtual/starts-with');\n\nvar StringPrototype = String.prototype;\n\nmodule.exports = function (it) {\n var own = it.startsWith;\n return typeof it == 'string' || it === StringPrototype\n || (isPrototypeOf(StringPrototype, it) && own === StringPrototype.startsWith) ? method : own;\n};\n","var parent = require('../../es/instance/starts-with');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/starts-with\");","'use strict';\nvar $ = require('../internals/export');\nvar $find = require('../internals/array-iteration').find;\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\nvar FIND = 'find';\nvar SKIPS_HOLES = true;\n\n// Shouldn't skip holes\nif (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.find` method\n// https://tc39.es/ecma262/#sec-array.prototype.find\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND);\n","require('../../../modules/es.array.find');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').find;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/find');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.find;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.find) ? method : own;\n};\n","var parent = require('../../es/instance/find');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/find\");","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.CodeMirror = factory());\n}(this, (function () { 'use strict';\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n var android = /Android/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) { presto_version = Number(presto_version[1]); }\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\n var rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n { e.removeChild(e.firstChild); }\n return e\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) { e.className = className; }\n if (style) { e.style.cssText = style; }\n if (typeof content == \"string\") { e.appendChild(document.createTextNode(content)); }\n else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }\n return e\n }\n // wrapper for elt, which removes the elt from the accessibility tree\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n }\n\n var range;\n if (document.createRange) { range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n }; }\n else { range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n }; }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n { child = child.parentNode; }\n if (parent.contains)\n { return parent.contains(child) }\n do {\n if (child.nodeType == 11) { child = child.host; }\n if (child == parent) { return true }\n } while (child = child.parentNode)\n }\n\n function activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n try {\n activeElement = document.activeElement;\n } catch(e) {\n activeElement = document.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n { activeElement = activeElement.shadowRoot.activeElement; }\n return activeElement\n }\n\n function addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) { node.className += (current ? \" \" : \"\") + cls; }\n }\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n { if (as[i] && !classTest(as[i]).test(b)) { b += \" \" + as[i]; } }\n return b\n }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }\n else if (ie) // Suppress mysterious IE10 errors\n { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args)}\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) { target = {}; }\n for (var prop in obj)\n { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n { target[prop] = obj[prop]; } }\n return target\n }\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) { end = string.length; }\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n { return n + (end - i) }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n }\n\n var Delayed = function() {\n this.id = null;\n this.f = null;\n this.time = 0;\n this.handler = bind(this.onTimeout, this);\n };\n Delayed.prototype.onTimeout = function (self) {\n self.id = 0;\n if (self.time <= +new Date) {\n self.f();\n } else {\n setTimeout(self.handler, self.time - +new Date);\n }\n };\n Delayed.prototype.set = function (ms, f) {\n this.f = f;\n var time = +new Date + ms;\n if (!this.id || time < this.time) {\n clearTimeout(this.id);\n this.id = setTimeout(this.handler, ms);\n this.time = time;\n }\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n { if (array[i] == elt) { return i } }\n return -1\n }\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 50;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = {toString: function(){return \"CodeMirror.Pass\"}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) { nextTab = string.length; }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n { return pos + Math.min(skipped, goal - col) }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) { return pos }\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n { spaceStrs.push(lst(spaceStrs) + \" \"); }\n return spaceStrs[n]\n }\n\n function lst(arr) { return arr[arr.length-1] }\n\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }\n return out\n }\n\n function insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) { pos++; }\n array.splice(pos, 0, value);\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) { copyObj(props, inst); }\n return inst\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n }\n function isWordChar(ch, helper) {\n if (!helper) { return isWordCharBasic(ch) }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) { return true }\n return helper.test(ch)\n }\n\n function isEmpty(obj) {\n for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }\n return true\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n var extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }\n\n // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }\n return pos\n }\n\n // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) { return pred(mid) ? from : to }\n if (pred(mid)) { to = mid; }\n else { from = mid + dir; }\n }\n }\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) { return f(from, to, \"ltr\", 0) }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) { f(from, to, \"ltr\"); }\n }\n\n var bidiOther = null;\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) { return i }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") { found = i; }\n else { bidiOther = i; }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") { found = i; }\n else { bidiOther = i; }\n }\n }\n return found != null ? found : bidiOther\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n function charType(code) {\n if (code <= 0xf7) { return lowTypes.charAt(code) }\n else if (0x590 <= code && code <= 0x5f4) { return \"R\" }\n else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }\n else if (0x6ee <= code && code <= 0x8ac) { return \"r\" }\n else if (0x2000 <= code && code <= 0x200b) { return \"w\" }\n else if (code == 0x200c) { return \"b\" }\n else { return \"L\" }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) { return false }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i)\n { types.push(charType(str.charCodeAt(i))); }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") { types[i$1] = prev; }\n else { prev = type; }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") { types[i$2] = \"n\"; }\n else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == \"r\") { types[i$2] = \"R\"; } }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3+1] == \"1\") { types[i$3] = \"1\"; }\n else if (type$2 == \",\" && prev$1 == types[i$3+1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) { types[i$3] = prev$1; }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") { types[i$4] = \"N\"; }\n else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i$4 && types[i$4-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) { types[j] = replace; }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") { types[i$5] = \"L\"; }\n else if (isStrong.test(type$4)) { cur$1 = type$4; }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n var before = (i$6 ? types[i$6-1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length, isRTL = direction == \"rtl\" ? 1 : 0;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n at += isRTL;\n pos = j$2;\n } else { ++j$2; }\n }\n if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n })();\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line, direction) {\n var order = line.order;\n if (order == null) { order = line.order = bidiOrdering(line.text, direction); }\n return order\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var noHandlers = [];\n\n var on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers || (emitter._handlers = {});\n map[type] = (map[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers, arr = map && map[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1)\n { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }\n }\n }\n }\n\n function signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) { return }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) { return }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)\n { set.push(arr[i]); } }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n function e_preventDefault(e) {\n if (e.preventDefault) { e.preventDefault(); }\n else { e.returnValue = false; }\n }\n function e_stopPropagation(e) {\n if (e.stopPropagation) { e.stopPropagation(); }\n else { e.cancelBubble = true; }\n }\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n }\n function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}\n\n function e_target(e) {return e.target || e.srcElement}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) { b = 1; }\n else if (e.button & 2) { b = 3; }\n else if (e.button & 4) { b = 2; }\n }\n if (mac && e.ctrlKey && b == 1) { b = 3; }\n return b\n }\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) { return false }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) { return badBidiRects }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) { nl = string.length; }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n } : function (string) { return string.split(/\\r\\n?|\\n/); };\n\n var hasSelection = window.getSelection ? function (te) {\n try { return te.selectionStart != te.selectionEnd }\n catch(e) { return false }\n } : function (te) {\n var range;\n try {range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) { return false }\n return range.compareEndPoints(\"StartToEnd\", range) != 0\n };\n\n var hasCopyEvent = (function () {\n var e = elt(\"div\");\n if (\"oncopy\" in e) { return true }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) { return badZoomedRects }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n }\n\n // Known modes, by name and by MIME\n var modes = {}, mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n }\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") { found = {name: found}; }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") { return {name: spec} }\n else { return spec || {name: \"null\"} }\n }\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) { return getMode(options, \"text/plain\") }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) { continue }\n if (modeObj.hasOwnProperty(prop)) { modeObj[\"_\" + prop] = modeObj[prop]; }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) { modeObj.helperType = spec.helperType; }\n if (spec.modeProps) { for (var prop$1 in spec.modeProps)\n { modeObj[prop$1] = spec.modeProps[prop$1]; } }\n\n return modeObj\n }\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = {};\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) { return state }\n if (mode.copyState) { return mode.copyState(state) }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) { val = val.concat([]); }\n nstate[n] = val;\n }\n return nstate\n }\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n function innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) { break }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n }\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function () {return this.pos >= this.string.length};\n StringStream.prototype.sol = function () {return this.pos == this.lineStart};\n StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};\n StringStream.prototype.next = function () {\n if (this.pos < this.string.length)\n { return this.string.charAt(this.pos++) }\n };\n StringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") { ok = ch == match; }\n else { ok = ch && (match.test ? match.test(ch) : match(ch)); }\n if (ok) {++this.pos; return ch}\n };\n StringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start\n };\n StringStream.prototype.eatSpace = function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }\n return this.pos > start\n };\n StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};\n StringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true}\n };\n StringStream.prototype.backUp = function (n) {this.pos -= n;};\n StringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) { this.pos += pattern.length; }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) { return null }\n if (match && consume !== false) { this.pos += match[0].length; }\n return match\n }\n };\n StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};\n StringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n try { return inner() }\n finally { this.lineStart -= n; }\n };\n StringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n };\n StringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n };\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) { throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\") }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break }\n n -= sz;\n }\n }\n return chunk.lines[n]\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n;\n });\n return out\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value\n return out\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) { chunk = child; continue outer }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) { break }\n h -= lh;\n }\n return n + i\n }\n\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n }\n\n // A Pos instance represents a position within the text.\n function Pos(line, ch, sticky) {\n if ( sticky === void 0 ) sticky = null;\n\n if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n }\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch }\n\n function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }\n\n function copyPos(x) {return Pos(x.line, x.ch)}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) { return Pos(doc.first, 0) }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }\n else if (ch < 0) { return Pos(pos.line, 0) }\n else { return pos }\n }\n function clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }\n return out\n }\n\n var SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }\n return line\n };\n\n Context.prototype.baseToken = function (n) {\n if (!this.baseTokens) { return null }\n while (this.baseTokens[this.baseTokenPos] <= n)\n { this.baseTokenPos += 2; }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n}\n };\n\n Context.prototype.nextLine = function () {\n this.line++;\n if (this.maxLookAhead > 0) { this.maxLookAhead--; }\n };\n\n Context.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext)\n { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }\n else\n { return new Context(doc, copyState(doc.mode, saved), line) }\n };\n\n Context.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n };\n\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) { context.state = resetState; }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) { line.styleClasses = result.classes; }\n else if (line.styleClasses) { line.styleClasses = null; }\n if (updateFrontier === cm.doc.highlightFrontier)\n { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }\n }\n return line.styles\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) { return new Context(doc, true, n) }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) { doc.modeFrontier = context.line; }\n return context\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") { callBlankLine(mode, context.state); }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) { return mode.blankLine(state) }\n if (!mode.innerMode) { return }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) { inner[0] = innerMode(mode, state).mode; }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) { return style }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n }\n\n var Token = function(stream, type, state) {\n this.start = stream.start; this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n };\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) { tokens = []; }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n }\n\n function extractLineClasses(type, output) {\n if (type) { for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) { break }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n { output[prop] = lineClass[2]; }\n else if (!(new RegExp(\"(?:^|\\\\s)\" + lineClass[2] + \"(?:$|\\\\s)\")).test(output[prop]))\n { output[prop] += \" \" + lineClass[2]; }\n } }\n return type\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) { processLine(cm, text, context, stream.pos); }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) { style = \"m-\" + (style ? mName + \" \" + style : mName); }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) { return }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n }\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n } }\n return nw\n }\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n } }\n return nw\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n { spans.splice(i--, 1); }\n }\n if (!spans.length) { return null }\n return spans\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n { (markers || (markers = [])).push(mark); }\n } }\n });\n if (!markers) { return null }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n { newParts.push({from: p.from, to: m.from}); }\n if (dto > 0 || !mk.inclusiveRight && !dto)\n { newParts.push({from: m.to, to: p.to}); }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.attachLine(line); }\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) { return lenDiff }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) { return -fromCmp }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) { return toCmp }\n return b.id - a.id\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n { found = sp.marker; }\n } }\n return found\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }\n } }\n return found\n }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }\n\n function visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return line\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }\n\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n if (sp.from == null) { return true }\n if (sp.marker.widgetNode) { continue }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n { return true }\n } }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n { return true }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) { return true }\n }\n }\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function () { return lineNo(this) };\n eventMixin(Line);\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) { return null }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }\n\n // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, css, attributes) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) { break }\n }\n if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n { widget = builder.content.appendChild(document.createElement(\"span\")); }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n { callbacks[i].call(null); }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }\n }\n } while (i < callbacks.length)\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) { return }\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) { delayed[i](); }\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n }\n return lineView.node\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) { cls += \" CodeMirror-linebackground\"; }\n if (lineView.background) {\n if (cls) { lineView.background.className = cls; }\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass)\n { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }\n else if (lineView.node != lineView.text)\n { lineView.node.className = \"\"; }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n { gutterWrap.className += \" \" + lineView.line.gutterClass; }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n { lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\"))); }\n if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n { gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\"))); }\n } }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) { lineView.alignable = null; }\n var isWidget = classTest(\"CodeMirror-linewidget\");\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (isWidget.test(node.className)) { lineView.node.removeChild(node); }\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) { return }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\"));\n if (!widget.handleMouseEvents) { node.setAttribute(\"cm-ignore-events\", \"true\"); }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n { wrap.insertBefore(node, lineView.gutter || lineView.text); }\n else\n { wrap.appendChild(node); }\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + \"px\"; }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) { return widget.height }\n var cm = widget.doc.cm;\n if (!cm) { return 0 }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n { parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"; }\n if (widget.noHScroll)\n { parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"; }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n }\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}\n function paddingH(display) {\n if (display.cachedPaddingH) { return display.cachedPaddingH }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }\n return data\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n mStart = map[i];\n mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) { collapse = \"right\"; }\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n { collapse = bias; }\n if (bias == \"left\" && start == 0)\n { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n } }\n if (bias == \"right\" && start == mEnd - mStart)\n { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n } }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") { for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) { break }\n } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) { break }\n } }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n { rect = node.parentNode.getBoundingClientRect(); }\n else\n { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }\n if (rect.left || rect.right || start == 0) { break }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) { collapse = bias = \"right\"; }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n { rect = rects[bias == \"right\" ? rects.length - 1 : 0]; }\n else\n { rect = node.getBoundingClientRect(); }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }\n else\n { rect = nullRect; }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++)\n { if (mid < heights[i]) { break } }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) { result.bogus = true; }\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n { return rect }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY}\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { lineView.measure.caches[i] = {}; } }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n { clearLineMeasurementCacheFor(cm.display.view[i]); }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n }\n function pageScrollY() {\n if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }\n return window.pageYOffset || (document.documentElement || document.body).scrollTop\n }\n\n function widgetTopHeight(lineObj) {\n var height = 0;\n if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)\n { height += widgetHeight(lineObj.widgets[i]); } } }\n return height\n }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height; rect.bottom += height;\n }\n if (context == \"line\") { return rect }\n if (!context) { context = \"local\"; }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") { yOff += paddingTop(cm.display); }\n else { yOff -= cm.display.viewOffset; }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) { pos.outside = outside; }\n return pos\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);\n end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);\n return {begin: begin, end: end}\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n }\n\n // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight; box.bottom += widgetHeight;\n if (!boxIsAfter(box, x, y, false)) { return false }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) { ch++; }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)\n }\n\n function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y)\n { part = order[index - 1]; }\n }\n return part\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) { end--; }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) { continue }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) { part = order[order.length - 1]; }\n // Clip the part to the wrapped line.\n if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }\n if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }\n return part\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n });\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) { return null }\n n -= cm.display.viewFrom;\n if (n < 0) { return null }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) { return i }\n }\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n { return {index: index, lineN: newN} }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++)\n { n += view[i].size; }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) { return null }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) { return null }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }\n else if (display.viewFrom < from)\n { display.view = display.view.slice(findViewIndex(cm, from)); }\n display.viewFrom = from;\n if (display.viewTo < to)\n { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }\n else if (display.viewTo > to)\n { display.view = display.view.slice(0, findViewIndex(cm, to)); }\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if ( primary === void 0 ) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) { continue }\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }\n var collapsed = range.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n { drawSelectionCursor(cm, range.head, curFragment); }\n if (!collapsed)\n { drawSelectionRange(cm, range, selFragment); }\n }\n return result\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) { return }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n { display.blinker = setInterval(function () {\n if (!cm.hasFocus()) { onBlur(cm); }\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate); }\n else if (cm.options.cursorBlinkRate < 0)\n { display.cursorDiv.style.visibility = \"hidden\"; }\n }\n\n function ensureFocus(cm) {\n if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n } }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }\n\n if (cm.options.readOnly == \"nocursor\") { return }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) { return }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollTop(cm, top) {\n if (top == null) { return }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) { resolveScrollToPos(cm); }\n if (x != null) { cm.curOp.scrollLeft = x; }\n if (y != null) { cm.curOp.scrollTop = y; }\n }\n\n function scrollToRange(cm, range) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range;\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n }\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) { return }\n if (!gecko) { updateDisplaySimple(cm, {top: val}); }\n setScrollTop(cm, val, true);\n if (gecko) { updateDisplaySimple(cm); }\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));\n if (cm.display.scroller.scrollTop == val && !forceScroll) { return }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }\n }\n\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n }\n\n var NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) { scroll(vert.scrollTop, \"vertical\"); }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) { scroll(horiz.scrollLeft, \"horizontal\"); }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"; }\n };\n\n NativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) { this.zeroWidthHack(); }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n };\n\n NativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }\n if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\"); }\n };\n\n NativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }\n if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\"); }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt != bar) { bar.style.pointerEvents = \"none\"; }\n else { delay.set(1000, maybeDisable); }\n }\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function () {};\n\n NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };\n NullScrollbars.prototype.setScrollLeft = function () {};\n NullScrollbars.prototype.setScrollTop = function () {};\n NullScrollbars.prototype.clear = function () {};\n\n function updateScrollbars(cm, measure) {\n if (!measure) { measure = measureForScrollbars(cm); }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n { updateHeightsInViewport(cm); }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }\n\n var scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function () {\n if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") { setScrollLeft(cm, pos); }\n else { updateScrollTop(cm, pos); }\n }, cm);\n if (cm.display.scrollbars.addClass)\n { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp;\n if (op) { finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++)\n { group.ops[i].cm.curOp = null; }\n endOperations(group);\n }); }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n { endOperation_R1(ops[i]); }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n { endOperation_W1(ops[i$1]); }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n { endOperation_R2(ops[i$2]); }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n { endOperation_W2(ops[i$3]); }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n { endOperation_finish(ops[i$4]); }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) { findMaxLine(cm); }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) { updateHeightsInViewport(cm); }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n { op.preparedSelection = display.input.prepareSelection(); }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n if (op.preparedSelection)\n { cm.display.input.showSelection(op.preparedSelection, takeFocus); }\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n { updateScrollbars(cm, op.barMeasure); }\n if (op.updatedDisplay)\n { setDocumentHeight(cm, op.barMeasure); }\n\n if (op.selectionChanged) { restartBlink(cm); }\n\n if (cm.state.focused && op.updateInput)\n { cm.display.input.reset(op.typing); }\n if (takeFocus) { ensureFocus(op.cm); }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n { display.wheelStartX = display.wheelStartY = null; }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }\n\n if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) { for (var i = 0; i < hidden.length; ++i)\n { if (!hidden[i].lines.length) { signal(hidden[i], \"hide\"); } } }\n if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)\n { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], \"unhide\"); } } }\n\n if (display.wrapper.offsetHeight)\n { doc.scrollTop = cm.display.scroller.scrollTop; }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n { signal(cm, \"changes\", cm, op.changeObjs); }\n if (op.update)\n { op.update.finish(); }\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) { return f.apply(this, arguments) }\n startOperation(cm);\n try { return f.apply(this, arguments) }\n finally { endOperation(cm); }\n }\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo)\n { cm.state.highlight.set(time, bind(highlightWorker, cm)); }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) { return }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) { context.state = resetState; }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) { line.styleClasses = newCls; }\n else if (oldCls) { line.styleClasses = null; }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }\n if (ischange) { changedLines.push(context.line); }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n { processLine(cm, line.text, context); }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) { runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++)\n { regLineChange(cm, changedLines[i], \"text\"); }\n }); }\n }\n\n // DISPLAY DRAWING\n\n var DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type))\n { this.events.push(arguments); }\n };\n DisplayUpdate.prototype.finish = function () {\n for (var i = 0; i < this.events.length; i++)\n { signal.apply(null, this.events[i]); }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) { return null }\n var active = activeElt();\n if (!active || !contains(cm.display.lineDiv, active)) { return null }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = window.getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }\n snapshot.activeElt.focus();\n if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&\n snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(), range = document.createRange();\n range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n { break }\n } else if (first) {\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n }\n if (!updateDisplayIfNeeded(cm, update)) { break }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n }\n\n function updateGutterSpace(display) {\n var width = display.gutters.offsetWidth;\n display.sizer.style.marginLeft = width + \"px\";\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }\n\n function getGutters(gutters, lineNumbers) {\n var result = [], sawLineNumbers = false;\n for (var i = 0; i < gutters.length; i++) {\n var name = gutters[i], style = null;\n if (typeof name != \"string\") { style = name.style; name = name.className; }\n if (name == \"CodeMirror-linenumbers\") {\n if (!lineNumbers) { continue }\n else { sawLineNumbers = true; }\n }\n result.push({className: name, style: style});\n }\n if (lineNumbers && !sawLineNumbers) { result.push({className: \"CodeMirror-linenumbers\", style: null}); }\n return result\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }\n\n function updateGutters(cm) {\n renderGutters(cm.display);\n regChange(cm);\n alignHorizontally(cm);\n }\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input, options) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }\n\n if (place) {\n if (place.appendChild) { place.appendChild(d.wrapper); }\n else { place(d.wrapper); }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);\n renderGutters(d);\n\n input.init(d);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) { wheelPixelsPerUnit = -.53; }\n else if (gecko) { wheelPixelsPerUnit = 15; }\n else if (chrome) { wheelPixelsPerUnit = -.7; }\n else if (safari) { wheelPixelsPerUnit = -1/3; }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }\n else if (dy == null) { dy = e.wheelDelta; }\n return {x: dx, y: dy}\n }\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n }\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) { return }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n { e_preventDefault(e); }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) { top = Math.max(0, top + pixels - 50); }\n else { bot = Math.min(cm.doc.height, bot + pixels + 50); }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) { return }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) { return }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n var Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function () { return this.ranges[this.primIndex] };\n\n Selection.prototype.equals = function (other) {\n if (other == this) { return true }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }\n }\n return true\n };\n\n Selection.prototype.deepCopy = function () {\n var out = [];\n for (var i = 0; i < this.ranges.length; i++)\n { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }\n return new Selection(out, this.primIndex)\n };\n\n Selection.prototype.somethingSelected = function () {\n for (var i = 0; i < this.ranges.length; i++)\n { if (!this.ranges[i].empty()) { return true } }\n return false\n };\n\n Selection.prototype.contains = function (pos, end) {\n if (!end) { end = pos; }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n { return i }\n }\n return -1\n };\n\n var Range = function(anchor, head) {\n this.anchor = anchor; this.head = head;\n };\n\n Range.prototype.from = function () { return minPos(this.anchor, this.head) };\n Range.prototype.to = function () { return maxPos(this.anchor, this.head) };\n Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n }\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n { return Pos(nw.line, pos.ch - old.ch + nw.ch) }\n else\n { return Pos(nw.line + (pos.line - old.line), pos.ch) }\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n }\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) { regChange(cm); }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n { dest.push(sel); }\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) { return null }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n else if (out) { out.push(spans[i]); }\n }\n return !out ? spans : out.length ? out : null\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) { return stretched }\n if (!stretched) { return old }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n { if (oldCur[k].marker == span.marker) { continue spans } }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n { sel = filterSelectionChange(doc, sel, options); }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm)\n { ensureCursorVisible(doc.cm); }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) { return }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = 1;\n doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n\n // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n // is with selectLeft/Right\n var preventCursorLeft = (\"selectLeft\" in m) ? !m.selectLeft : m.inclusiveLeft;\n var preventCursorRight = (\"selectRight\" in m) ? !m.selectRight : m.inclusiveRight;\n\n if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) { break }\n else {--i; continue}\n }\n }\n if (!m.atomic) { continue }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? preventCursorRight : preventCursorLeft)\n { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n { return skipAtomicInner(doc, near, pos, dir, mayClear) }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? preventCursorLeft : preventCursorRight)\n { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n } }\n return pos\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }\n else { return null }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }\n else { return null }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n }\n\n // UPDATING\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) { return }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return\n } else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function ( i ) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) { return }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n ); }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n { regLineChange(doc.cm, l, \"gutter\"); }\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) { to = from; }\n if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }\n if (typeof code == \"string\") { code = doc.splitLines(code); }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length },\n\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n { if (op(this.lines[at])) { return true } }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size },\n\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }\n },\n\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) { return }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) { return true }\n if ((n -= used) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n }\n };\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function(doc, node, options) {\n if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))\n { this[opt] = options[opt]; } } }\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function () {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) { return }\n for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }\n if (!ws.length) { line.widgets = null; }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function () {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) { return }\n if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n { addToScrollTop(cm, diff); }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) { widgets.push(widget); }\n else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) { addToScrollTop(cm, widget.height); }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n if (cm) { signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle)); }\n return widget\n }\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n var TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n\n // Clear the marker.\n TextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) { startOperation(cm); }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) { signalLater(this, \"clear\", found.from, found.to); }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), \"text\"); }\n else if (cm) {\n if (span.to != null) { max = lineNo(line); }\n if (span.from != null) { min = lineNo(line); }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n { updateLineHeight(line, textHeight(cm.display)); }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n } }\n\n if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) { reCheckSelection(cm.doc); }\n }\n if (cm) { signalLater(cm, \"markerCleared\", cm, this, min, max); }\n if (withOp) { endOperation(cm); }\n if (this.parent) { this.parent.clear(); }\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function (side, lineObj) {\n if (side == null && this.type == \"bookmark\") { side = 1; }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) { return from }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) { return to }\n }\n }\n return from && {from: from, to: to}\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function () {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) { return }\n runInOp(cm, function () {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n { updateLineHeight(line, line.height + dHeight); }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }\n }\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp\n ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n eventMixin(TextMarker);\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) { return markTextShared(doc, from, to, options, type) }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) { copyObj(options, marker, false); }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n { return marker }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) { marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\"); }\n if (options.insertLeft) { marker.widgetNode.insertLeft = true; }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n { throw new Error(\"Inserting collapsed marker partially overlapping an existing one\") }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory)\n { addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN); }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n { updateMaxLine = true; }\n if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }\n }); }\n\n if (marker.clearOnEnter) { on(marker, \"beforeCursorEnter\", function () { return marker.clear(); }); }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length)\n { doc.clearHistory(); }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) { cm.curOp.updateMaxLine = true; }\n if (marker.collapsed)\n { regChange(cm, from.line, to.line + 1); }\n else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||\n marker.attributes || marker.title)\n { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, \"text\"); } }\n if (marker.atomic) { reCheckSelection(cm.doc); }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n { markers[i].parent = this; }\n };\n\n SharedTextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n { this.markers[i].clear(); }\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj)\n };\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) { options.widgetNode = widget.cloneNode(true); }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n { if (doc.linked[i].isParent) { return } }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function ( i ) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop( i );\n }\n\n var nextDocId = 0;\n var Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }\n if (firstLine == null) { firstLine = 0; }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") { text = this.splitLines(text); }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) { this.iterN(from - this.first, to - from, op); }\n else { this.iterN(this.first, this.first + this.size, from); }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n if (this.cm) { scrollToCoords(this.cm, 0, 0); }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},\n\n getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},\n getLineNumber: function(line) {return lineNo(line)},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") { line = getLine(this, line); }\n return visualLine(line)\n },\n\n lineCount: function() {return this.size},\n firstLine: function() {return this.first},\n lastLine: function() {return this.first + this.size - 1},\n\n clipPos: function(pos) {return clipPos(this, pos)},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") { pos = range.head; }\n else if (start == \"anchor\") { pos = range.anchor; }\n else if (start == \"end\" || start == \"to\" || start === false) { pos = range.to(); }\n else { pos = range.from(); }\n return pos\n },\n listSelections: function() { return this.sel.ranges },\n somethingSelected: function() {return this.sel.somethingSelected()},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) { return }\n var out = [];\n for (var i = 0; i < ranges.length; i++)\n { out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head)); }\n if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) { return lines }\n else { return lines.join(lineSep || this.lineSeparator()) }\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n { dup[i] = code; }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)\n { makeChange(this, changes[i$1]); }\n if (newSel) { setSelectionReplaceHistory(this, newSel); }\n else if (this.cm) { ensureCursorVisible(this.cm); }\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {\n var this$1 = this;\n\n this.history = new History(this.history.maxGeneration);\n linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);\n },\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }\n return this.history.generation\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)}\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) { line.gutterMarkers = null; }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) { return null }\n n = line;\n line = getLine(this, line);\n if (!line) { return null }\n } else {\n n = lineNo(line);\n if (n == null) { return null }\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets}\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) { line[prop] = cls; }\n else if (classTest(cls).test(line[prop])) { return false }\n else { line[prop] += \" \" + cls; }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) { return false }\n else if (cls == null) { line[prop] = null; }\n else {\n var found = cur.match(classTest(cls));\n if (!found) { return false }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n { markers.push(span.marker.parent || span.marker); }\n } }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n if (spans) { for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n { found.push(span.marker.parent || span.marker); }\n } }\n ++lineNo;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i)\n { if (sps[i].from != null) { markers.push(sps[i].marker); } } }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch))\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) { return 0 }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) { options = {}; }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) { from = options.from; }\n if (options.to != null && options.to < to) { to = options.to; }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) { copy.history = this.history\n ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) { other = other.doc; }\n if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) { continue }\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break\n } }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode},\n getEditor: function() {return this.cm},\n\n splitLines: function(str) {\n if (this.lineSep) { return str.split(this.lineSep) }\n return splitLinesAuto(str)\n },\n lineSeparator: function() { return this.lineSep || \"\\n\" },\n\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") { dir = \"ltr\"; }\n if (dir == this.direction) { return }\n this.direction = dir;\n this.iter(function (line) { return line.order = null; });\n if (this.cm) { directionChanged(this.cm); }\n })\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n { return }\n e_preventDefault(e);\n if (ie) { lastDrop = +new Date; }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) { return }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var markAsReadAndPasteIfAllFilesAreRead = function () {\n if (++read == n) {\n operation(cm, function () {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(\n text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));\n })();\n }\n };\n var readTextFromFile = function (file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n var reader = new FileReader;\n reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };\n reader.onload = function () {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n text[i] = content;\n markAsReadAndPasteIfAllFilesAreRead();\n };\n reader.readAsText(file);\n };\n for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function () { return cm.display.input.focus(); }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n { selected = cm.listSelections(); }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)\n { replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\"); } }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e$1){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) { img.parentNode.removeChild(img); }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) { return }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) { return }\n var byClass = document.getElementsByClassName(\"CodeMirror\"), editors = [];\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) { editors.push(cm); }\n }\n if (editors.length) { editors[0].operation(function () {\n for (var i = 0; i < editors.length; i++) { f(editors[i]); }\n }); }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) { return }\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) { resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100); }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function () { return forEachCodeMirror(onBlur); });\n }\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 145: \"ScrollLock\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 224: \"Mod\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n\n // Number keys\n for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }\n // Alphabetic keys\n for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }\n // Function keys\n for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2; }\n\n var keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { name = \"Alt-\" + name; }\n if (ctrl) { name = \"Ctrl-\" + name; }\n if (cmd) { name = \"Cmd-\" + name; }\n if (shift) { name = \"Shift-\" + name; }\n return name\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n }\n\n function lookupKey(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) { return \"nothing\" }\n if (found === \"...\") { return \"multi\" }\n if (found != null && handle(found)) { return \"handled\" }\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n { return lookupKey(key, map.fallthrough, handle, context) }\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) { return result }\n }\n }\n }\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name; }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name; }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Mod\") { name = \"Cmd-\" + name; }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name; }\n return name\n }\n\n // Look up the name of a key as indicated by an event object.\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n if (cm.doc.direction == \"rtl\") { dir = -dir; }\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") { ch = moveCharLogically(lineObj, ch, 1); }\n } else { ch = dir < 0 ? part.to : part.from; }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) { return moveLogically(line, start, dir) }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };\n var prep;\n var getWrappedLineExtent = function (ch) {\n if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {\n var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\"); };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) { return res }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) { return res }\n }\n\n // Case 4: Nowhere to move\n return null\n }\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = {\n selectAll: selectAll,\n singleSelection: function (cm) { return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll); },\n killLine: function (cm) { return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n { return {from: range.head, to: Pos(range.head.line + 1, 0)} }\n else\n { return {from: range.head, to: Pos(range.head.line, len)} }\n } else {\n return {from: range.from(), to: range.to()}\n }\n }); },\n deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n }); }); },\n delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0), to: range.from()\n }); }); },\n delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n }); },\n delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos }\n }); },\n undo: function (cm) { return cm.undo(); },\n redo: function (cm) { return cm.redo(); },\n undoSelection: function (cm) { return cm.undoSelection(); },\n redoSelection: function (cm) { return cm.redoSelection(); },\n goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },\n goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },\n goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1}\n ); },\n goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move); },\n goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move); },\n goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) { return lineStartSmart(cm, range.head) }\n return pos\n }, sel_move); },\n goLineUp: function (cm) { return cm.moveV(-1, \"line\"); },\n goLineDown: function (cm) { return cm.moveV(1, \"line\"); },\n goPageUp: function (cm) { return cm.moveV(-1, \"page\"); },\n goPageDown: function (cm) { return cm.moveV(1, \"page\"); },\n goCharLeft: function (cm) { return cm.moveH(-1, \"char\"); },\n goCharRight: function (cm) { return cm.moveH(1, \"char\"); },\n goColumnLeft: function (cm) { return cm.moveH(-1, \"column\"); },\n goColumnRight: function (cm) { return cm.moveH(1, \"column\"); },\n goWordLeft: function (cm) { return cm.moveH(-1, \"word\"); },\n goGroupRight: function (cm) { return cm.moveH(1, \"group\"); },\n goGroupLeft: function (cm) { return cm.moveH(-1, \"group\"); },\n goWordRight: function (cm) { return cm.moveH(1, \"word\"); },\n delCharBefore: function (cm) { return cm.deleteH(-1, \"codepoint\"); },\n delCharAfter: function (cm) { return cm.deleteH(1, \"char\"); },\n delWordBefore: function (cm) { return cm.deleteH(-1, \"word\"); },\n delWordAfter: function (cm) { return cm.deleteH(1, \"word\"); },\n delGroupBefore: function (cm) { return cm.deleteH(-1, \"group\"); },\n delGroupAfter: function (cm) { return cm.deleteH(1, \"group\"); },\n indentAuto: function (cm) { return cm.indentSelection(\"smart\"); },\n indentMore: function (cm) { return cm.indentSelection(\"add\"); },\n indentLess: function (cm) { return cm.indentSelection(\"subtract\"); },\n insertTab: function (cm) { return cm.replaceSelection(\"\\t\"); },\n insertSoftTab: function (cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function (cm) {\n if (cm.somethingSelected()) { cm.indentSelection(\"add\"); }\n else { cm.execCommand(\"insertTab\"); }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function (cm) { return runInOp(cm, function () {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) { continue }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n }); },\n newlineAndIndent: function (cm) { return runInOp(cm, function () {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--)\n { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\"); }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++)\n { cm.indentLine(sels[i$1].from().line, null, true); }\n ensureCursorVisible(cm);\n }); },\n openLine: function (cm) { return cm.replaceSelection(\"\\n\", \"start\"); },\n toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }\n };\n\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, visual, lineN, 1)\n }\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, line, lineN, -1)\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(start.ch, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n }\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) { return result }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n }\n\n // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n var stopSeq = new Delayed;\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) { return \"handled\" }\n if (/\\'$/.test(name))\n { cm.state.keySeq = null; }\n else\n { stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n }); }\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) { return true }\n }\n return dispatchKeyInner(cm, name, e, handle)\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n { cm.state.keySeq = name; }\n if (result == \"handled\")\n { signalLater(cm, \"keyHandled\", cm, name, e); }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) { return false }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n { return doHandleBinding(cm, b) }\n })\n } else {\n return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) { return }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n { cm.replaceSelection(\"\", null, \"cut\"); }\n }\n if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)\n { document.execCommand(\"cut\"); }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n { showCrossHair(cm); }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) { this.doc.sel.shift = false; }\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") { return }\n if (handleCharBinding(cm, e, ch)) { return }\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n };\n\n var lastClick, lastDoubleClick;\n function clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") { name = \"Double\" + name; }\n else if (repeat == \"triple\") { name = \"Triple\" + name; }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") { bound = commands[bound]; }\n if (!bound) { return false }\n var done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }\n if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }\n if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }\n return value\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) { setTimeout(bind(ensureFocus, cm), 0); }\n else { cm.curOp.focus = activeElt(); }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0))\n { leftButtonStartDrag(cm, event, pos, behavior); }\n else\n { leftButtonSelect(cm, event, pos, behavior); }\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") { return new Range(pos, pos) }\n if (unit == \"word\") { return cm.findWordAt(pos) }\n if (unit == \"line\") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }\n\n // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n function bidiSimplify(cm, range) {\n var anchor = range.anchor;\n var head = range.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }\n var order = getOrder(anchorLine);\n if (!order) { return range }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) { return range }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) { return range }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary)\n { leftSide = dir < 0; }\n else\n { leftSide = dir > 0; }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)\n }\n\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n if (!captureRightClick) { cm.display.input.onContextMenu(e); }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) { return false }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {toString: function(){return \"CodeMirror.Init\"}};\n\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) { optionHandlers[name] =\n notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function (cm, val) { return cm.setValue(val); }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n if (!val) { return }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) { break }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200c\\u200e\\u200f\\u2028\\u2029\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) { cm.refresh(); }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n option(\"autocorrect\", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);\n option(\"autocapitalize\", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n updateGutters(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) { prev.detach(cm, next); }\n if (next.attach) { next.attach(cm, prev || null); }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm, val) {\n cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);\n updateGutters(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) { return updateScrollbars(cm); }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm, val) {\n cm.display.gutterSpecs = getGutters(cm.options.gutters, val);\n updateGutters(cm);\n }, true);\n option(\"firstLineNumber\", 1, updateGutters, true);\n option(\"lineNumberFormatter\", function (integer) { return integer; }, updateGutters, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n\n option(\"screenReaderLabel\", null, function (cm, val) {\n val = (val === '') ? null : val;\n cm.display.input.screenReaderLabelChanged(val);\n });\n\n option(\"disableInput\", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) { return cm.refresh(); }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) { cm.display.input.resetPosition(); }\n });\n\n option(\"tabindex\", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || \"\"; });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) { return cm.doc.setDirection(val); }, true);\n option(\"phrases\", null);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () { return updateScrollbars(cm); }, 100);\n }\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }\n\n // The default configuration options.\n CodeMirror.defaults = defaults;\n // Functions to run when options are changed.\n CodeMirror.optionHandlers = optionHandlers;\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n { on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) { return }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n })); }\n else\n { on(d.scroller, \"dblclick\", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n on(d.scroller, \"contextmenu\", function (e) { return onContextMenu(cm, e); });\n on(d.input.getField(), \"contextmenu\", function (e) {\n if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }\n });\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) { return false }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n function farAway(touch, other) {\n if (other.left == null) { return true }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) { d.activeTouch.moved = true; }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n { range = new Range(pos, pos); }\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n { range = cm.findWordAt(pos); }\n else // Triple tap\n { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });\n on(d.scroller, \"DOMMouseScroll\", function (e) { return onScrollWheel(cm, e); });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},\n over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function (e) { return onDragStart(cm, e); },\n drop: operation(cm, onDrop),\n leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) { return onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) { return onFocus(cm, e); });\n on(inp, \"blur\", function (e) { return onBlur(cm, e); });\n }\n\n var initHooks = [];\n CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) { sel = doc.sel; }\n\n var recent = +new Date - 200;\n var paste = origin == \"paste\" || cm.state.pasteIncoming > recent;\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasting N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n { multiPaste.push(doc.splitLines(lastCopied.text[i])); }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) { return [l]; });\n }\n }\n\n var updateInput = cm.curOp.updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range = sel.ranges[i$1];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n { from = Pos(from.line, from.ch - deleted); }\n else if (cm.state.overwrite && !paste) // Handle overwrite\n { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }\n else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == textLines.join(\"\\n\"))\n { from = to = Pos(from.line, 0); }\n }\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n { triggerElectric(cm, inserted); }\n\n ensureCursorVisible(cm);\n if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = -1;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, \"paste\"); }); }\n return true\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) { return }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break\n } }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n { indented = indentLine(cm, range.head.line, \"smart\"); }\n }\n if (indented) { signalLater(cm, \"electricInput\", cm, range.head.line); }\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n }\n\n function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n field.setAttribute(\"autocorrect\", autocorrect ? \"\" : \"off\");\n field.setAttribute(\"autocapitalize\", autocapitalize ? \"\" : \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) { te.style.width = \"1000px\"; }\n else { te.setAttribute(\"wrap\", \"off\"); }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) { te.style.border = \"1px solid black\"; }\n disableBrowserMagic(te);\n return div\n }\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"codepoint\", \"char\", \"column\" (like char, but\n // doesn't cross line boundaries), \"word\" (across next word), or\n // \"group\" (to the start of next group of word or\n // non-word-non-whitespace chars). The visually param controls\n // whether, in right-to-left text, direction 1 means to move towards\n // the next index in the string, or towards the character to the right\n // of the current position. The resulting position will have a\n // hitSide=true property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));\n if (isNaN(ch)) { next = null; }\n else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),\n -dir); }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }\n\n // CONTENTEDITABLE INPUT STYLE\n\n var ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);\n\n function belongsToInput(e) {\n for (var t = e.target; t; t = t.parentNode) {\n if (t == div) { return true }\n if (/\\bCodeMirror-(?:line)?widget\\b/.test(t.className)) { break }\n }\n return false\n }\n\n on(div, \"paste\", function (e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }\n });\n\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function () { return input.forceCompositionEnd(); });\n\n on(div, \"input\", function () {\n if (!this$1.composing) { this$1.readFromDOMSoon(); }\n });\n\n function onCopyCut(e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") { cm.replaceSelection(\"\", null, \"cut\"); }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) { input.showPrimarySelection(); }\n }, 50);\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.div.setAttribute('aria-label', label);\n } else {\n this.div.removeAttribute('aria-label');\n }\n };\n\n ContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = document.activeElement == this.div;\n return result\n };\n\n ContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) { return }\n if (info.focus || takeFocus) { this.showPrimarySelection(); }\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function () {\n return this.cm.display.wrapper.ownerDocument.getSelection()\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0)\n { return }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try { rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) { sel.addRange(old); }\n else if (gecko) { this.startGracePeriod(); }\n }\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged())\n { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function () {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function () {\n var sel = this.getSelection();\n if (!sel.rangeCount) { return false }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n };\n\n ContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor() || document.activeElement != this.div)\n { this.showSelection(this.prepareSelection(), true); }\n this.div.focus();\n }\n };\n ContentEditableInput.prototype.blur = function () { this.div.blur(); };\n ContentEditableInput.prototype.getField = function () { return this.div };\n\n ContentEditableInput.prototype.supportsTouch = function () { return true };\n\n ContentEditableInput.prototype.receivedFocus = function () {\n var input = this;\n if (this.selectionInEditor())\n { this.pollSelection(); }\n else\n { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function () {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n };\n\n ContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }\n var sel = this.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) { return }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) { runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }\n }); }\n };\n\n ContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine())\n { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())\n { to = Pos(to.line + 1, 0); }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) { return false }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else { break }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n { ++cutFront; }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n { ++cutEnd; }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) { return }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n ContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) { return }\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) { this$1.composing = null; }\n else { return }\n }\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent())\n { runInOp(this.cm, function () { return regChange(this$1.cm); }); }\n };\n\n ContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0 || this.composing) { return }\n e.preventDefault();\n if (!this.cm.isReadOnly())\n { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function () {};\n ContentEditableInput.prototype.resetPosition = function () {};\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) { return null }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode)\n { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }\n return false\n }\n\n function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;\n function recognizeMarker(id) { return function (marker) { return marker.id == id; } }\n function close() {\n if (closing) {\n text += lineSep;\n if (extraLinebreak) { text += lineSep; }\n closing = extraLinebreak = false;\n }\n }\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText) {\n addText(cmText);\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find(0)))\n { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") { return }\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }\n\n if (isBlock) { close(); }\n for (var i = 0; i < node.childNodes.length; i++)\n { walk(node.childNodes[i]); }\n\n if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }\n if (isBlock) { closing = true; }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n for (;;) {\n walk(from);\n if (from == to) { break }\n from = from.nextSibling;\n extraLinebreak = false;\n }\n return text\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) { return null }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n { return locateNodeInLineView(lineView, node, offset) }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) { offset = textNode.nodeValue.length; }\n }\n while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }\n return Pos(line, ch)\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) { return badPos(found, bad) }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n { return badPos(Pos(found.line, found.ch - dist), bad) }\n else\n { dist += after.textContent.length; }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n { return badPos(Pos(found.line, found.ch + dist$1), bad) }\n else\n { dist$1 += before.textContent.length; }\n }\n }\n\n // TEXTAREA INPUT STYLE\n\n var TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n TextareaInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) { te.style.width = \"0px\"; }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }\n input.poll();\n });\n\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n\n cm.state.pasteIncoming = +new Date;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") { cm.state.cutIncoming = +new Date; }\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }\n if (!te.dispatchEvent) {\n cm.state.pasteIncoming = +new Date;\n input.focus();\n return\n }\n\n // Pass the `paste` event to the textarea so it's handled by its event listener.\n var event = new Event(\"paste\");\n event.clipboardData = e.clipboardData;\n te.dispatchEvent(event);\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) { e_preventDefault(e); }\n });\n\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n if (input.composing) { input.composing.range.clear(); }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function (_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n this.textarea = this.wrapper.firstChild;\n };\n\n TextareaInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.textarea.setAttribute('aria-label', label);\n } else {\n this.textarea.removeAttribute('aria-label');\n }\n };\n\n TextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n };\n\n TextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n };\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n TextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing) { return }\n var cm = this.cm;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) { selectInput(this.textarea); }\n if (ie && ie_version >= 9) { this.hasSelection = content; }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n }\n };\n\n TextareaInput.prototype.getField = function () { return this.textarea };\n\n TextareaInput.prototype.supportsTouch = function () { return false };\n\n TextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n };\n\n TextareaInput.prototype.blur = function () { this.textarea.blur(); };\n\n TextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n TextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) { return }\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n if (this$1.cm.state.focused) { this$1.slowPoll(); }\n });\n };\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n TextareaInput.prototype.fastPoll = function () {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n };\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n TextareaInput.prototype.poll = function () {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n { return false }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) { return false }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) { prevInput = \"\\u200b\"; }\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\") }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) { input.value = this$1.prevInput = \"\"; }\n else { this$1.prevInput = text; }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n };\n\n TextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) { this.pollingFast = false; }\n };\n\n TextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function (e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n if (input.contextMenuPending) { input.contextMenuPending(); }\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) { return } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();\n input.wrapper.style.cssText = \"position: static\";\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) { window.scrollTo(null, oldScrollY); }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) { te.value = input.prevInput = \" \"; }\n input.contextMenuPending = rehide;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n if (input.contextMenuPending != rehide) { return }\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }\n var i = 0, poll = function () {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) { prepareSelectAllHack(); }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function () {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) { this.reset(); }\n this.textarea.disabled = val == \"nocursor\";\n this.textarea.readOnly = !!val;\n };\n\n TextareaInput.prototype.setUneditable = function () {};\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n { options.tabindex = textarea.tabIndex; }\n if (!options.placeholder && textarea.placeholder)\n { options.placeholder = textarea.placeholder; }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n cm.getTextArea = function () { return textarea; };\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == \"function\")\n { textarea.form.submit = realSubmit; }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },\n options);\n return cm\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n }\n\n // EDITOR CONSTRUCTOR\n\n defineOptions(CodeMirror);\n\n addEditorMethods(CodeMirror);\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n { CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments)}\n })(Doc.prototype[prop]); } }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror.defaults.mode && name != \"null\") { CodeMirror.defaults.mode = name; }\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME;\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function (name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n\n addLegacyProps(CodeMirror);\n\n CodeMirror.version = \"5.58.2\";\n\n return CodeMirror;\n\n})));\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar htmlConfig = {\n autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,\n 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,\n 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,\n 'track': true, 'wbr': true, 'menuitem': true},\n implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,\n 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,\n 'th': true, 'tr': true},\n contextGrabbers: {\n 'dd': {'dd': true, 'dt': true},\n 'dt': {'dd': true, 'dt': true},\n 'li': {'li': true},\n 'option': {'option': true, 'optgroup': true},\n 'optgroup': {'optgroup': true},\n 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,\n 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,\n 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,\n 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,\n 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},\n 'rp': {'rp': true, 'rt': true},\n 'rt': {'rp': true, 'rt': true},\n 'tbody': {'tbody': true, 'tfoot': true},\n 'td': {'td': true, 'th': true},\n 'tfoot': {'tbody': true},\n 'th': {'td': true, 'th': true},\n 'thead': {'tbody': true, 'tfoot': true},\n 'tr': {'tr': true}\n },\n doNotIndent: {\"pre\": true},\n allowUnquoted: true,\n allowMissing: true,\n caseFold: true\n}\n\nvar xmlConfig = {\n autoSelfClosers: {},\n implicitlyClosed: {},\n contextGrabbers: {},\n doNotIndent: {},\n allowUnquoted: false,\n allowMissing: false,\n allowMissingTagName: false,\n caseFold: false\n}\n\nCodeMirror.defineMode(\"xml\", function(editorConf, config_) {\n var indentUnit = editorConf.indentUnit\n var config = {}\n var defaults = config_.htmlMode ? htmlConfig : xmlConfig\n for (var prop in defaults) config[prop] = defaults[prop]\n for (var prop in config_) config[prop] = config_[prop]\n\n // Return variables for tokenizers\n var type, setStyle;\n\n function inText(stream, state) {\n function chain(parser) {\n state.tokenize = parser;\n return parser(stream, state);\n }\n\n var ch = stream.next();\n if (ch == \"<\") {\n if (stream.eat(\"!\")) {\n if (stream.eat(\"[\")) {\n if (stream.match(\"CDATA[\")) return chain(inBlock(\"atom\", \"]]>\"));\n else return null;\n } else if (stream.match(\"--\")) {\n return chain(inBlock(\"comment\", \"-->\"));\n } else if (stream.match(\"DOCTYPE\", true, true)) {\n stream.eatWhile(/[\\w\\._\\-]/);\n return chain(doctype(1));\n } else {\n return null;\n }\n } else if (stream.eat(\"?\")) {\n stream.eatWhile(/[\\w\\._\\-]/);\n state.tokenize = inBlock(\"meta\", \"?>\");\n return \"meta\";\n } else {\n type = stream.eat(\"/\") ? \"closeTag\" : \"openTag\";\n state.tokenize = inTag;\n return \"tag bracket\";\n }\n } else if (ch == \"&\") {\n var ok;\n if (stream.eat(\"#\")) {\n if (stream.eat(\"x\")) {\n ok = stream.eatWhile(/[a-fA-F\\d]/) && stream.eat(\";\");\n } else {\n ok = stream.eatWhile(/[\\d]/) && stream.eat(\";\");\n }\n } else {\n ok = stream.eatWhile(/[\\w\\.\\-:]/) && stream.eat(\";\");\n }\n return ok ? \"atom\" : \"error\";\n } else {\n stream.eatWhile(/[^&<]/);\n return null;\n }\n }\n inText.isInText = true;\n\n function inTag(stream, state) {\n var ch = stream.next();\n if (ch == \">\" || (ch == \"/\" && stream.eat(\">\"))) {\n state.tokenize = inText;\n type = ch == \">\" ? \"endTag\" : \"selfcloseTag\";\n return \"tag bracket\";\n } else if (ch == \"=\") {\n type = \"equals\";\n return null;\n } else if (ch == \"<\") {\n state.tokenize = inText;\n state.state = baseState;\n state.tagName = state.tagStart = null;\n var next = state.tokenize(stream, state);\n return next ? next + \" tag error\" : \"tag error\";\n } else if (/[\\'\\\"]/.test(ch)) {\n state.tokenize = inAttribute(ch);\n state.stringStartCol = stream.column();\n return state.tokenize(stream, state);\n } else {\n stream.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/);\n return \"word\";\n }\n }\n\n function inAttribute(quote) {\n var closure = function(stream, state) {\n while (!stream.eol()) {\n if (stream.next() == quote) {\n state.tokenize = inTag;\n break;\n }\n }\n return \"string\";\n };\n closure.isInAttribute = true;\n return closure;\n }\n\n function inBlock(style, terminator) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n state.tokenize = inText;\n break;\n }\n stream.next();\n }\n return style;\n }\n }\n\n function doctype(depth) {\n return function(stream, state) {\n var ch;\n while ((ch = stream.next()) != null) {\n if (ch == \"<\") {\n state.tokenize = doctype(depth + 1);\n return state.tokenize(stream, state);\n } else if (ch == \">\") {\n if (depth == 1) {\n state.tokenize = inText;\n break;\n } else {\n state.tokenize = doctype(depth - 1);\n return state.tokenize(stream, state);\n }\n }\n }\n return \"meta\";\n };\n }\n\n function Context(state, tagName, startOfLine) {\n this.prev = state.context;\n this.tagName = tagName;\n this.indent = state.indented;\n this.startOfLine = startOfLine;\n if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))\n this.noIndent = true;\n }\n function popContext(state) {\n if (state.context) state.context = state.context.prev;\n }\n function maybePopContext(state, nextTagName) {\n var parentTagName;\n while (true) {\n if (!state.context) {\n return;\n }\n parentTagName = state.context.tagName;\n if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||\n !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {\n return;\n }\n popContext(state);\n }\n }\n\n function baseState(type, stream, state) {\n if (type == \"openTag\") {\n state.tagStart = stream.column();\n return tagNameState;\n } else if (type == \"closeTag\") {\n return closeTagNameState;\n } else {\n return baseState;\n }\n }\n function tagNameState(type, stream, state) {\n if (type == \"word\") {\n state.tagName = stream.current();\n setStyle = \"tag\";\n return attrState;\n } else if (config.allowMissingTagName && type == \"endTag\") {\n setStyle = \"tag bracket\";\n return attrState(type, stream, state);\n } else {\n setStyle = \"error\";\n return tagNameState;\n }\n }\n function closeTagNameState(type, stream, state) {\n if (type == \"word\") {\n var tagName = stream.current();\n if (state.context && state.context.tagName != tagName &&\n config.implicitlyClosed.hasOwnProperty(state.context.tagName))\n popContext(state);\n if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {\n setStyle = \"tag\";\n return closeState;\n } else {\n setStyle = \"tag error\";\n return closeStateErr;\n }\n } else if (config.allowMissingTagName && type == \"endTag\") {\n setStyle = \"tag bracket\";\n return closeState(type, stream, state);\n } else {\n setStyle = \"error\";\n return closeStateErr;\n }\n }\n\n function closeState(type, _stream, state) {\n if (type != \"endTag\") {\n setStyle = \"error\";\n return closeState;\n }\n popContext(state);\n return baseState;\n }\n function closeStateErr(type, stream, state) {\n setStyle = \"error\";\n return closeState(type, stream, state);\n }\n\n function attrState(type, _stream, state) {\n if (type == \"word\") {\n setStyle = \"attribute\";\n return attrEqState;\n } else if (type == \"endTag\" || type == \"selfcloseTag\") {\n var tagName = state.tagName, tagStart = state.tagStart;\n state.tagName = state.tagStart = null;\n if (type == \"selfcloseTag\" ||\n config.autoSelfClosers.hasOwnProperty(tagName)) {\n maybePopContext(state, tagName);\n } else {\n maybePopContext(state, tagName);\n state.context = new Context(state, tagName, tagStart == state.indented);\n }\n return baseState;\n }\n setStyle = \"error\";\n return attrState;\n }\n function attrEqState(type, stream, state) {\n if (type == \"equals\") return attrValueState;\n if (!config.allowMissing) setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrValueState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n if (type == \"word\" && config.allowUnquoted) {setStyle = \"string\"; return attrState;}\n setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrContinuedState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n return attrState(type, stream, state);\n }\n\n return {\n startState: function(baseIndent) {\n var state = {tokenize: inText,\n state: baseState,\n indented: baseIndent || 0,\n tagName: null, tagStart: null,\n context: null}\n if (baseIndent != null) state.baseIndent = baseIndent\n return state\n },\n\n token: function(stream, state) {\n if (!state.tagName && stream.sol())\n state.indented = stream.indentation();\n\n if (stream.eatSpace()) return null;\n type = null;\n var style = state.tokenize(stream, state);\n if ((style || type) && style != \"comment\") {\n setStyle = null;\n state.state = state.state(type || style, stream, state);\n if (setStyle)\n style = setStyle == \"error\" ? style + \" error\" : setStyle;\n }\n return style;\n },\n\n indent: function(state, textAfter, fullLine) {\n var context = state.context;\n // Indent multi-line strings (e.g. css).\n if (state.tokenize.isInAttribute) {\n if (state.tagStart == state.indented)\n return state.stringStartCol + 1;\n else\n return state.indented + indentUnit;\n }\n if (context && context.noIndent) return CodeMirror.Pass;\n if (state.tokenize != inTag && state.tokenize != inText)\n return fullLine ? fullLine.match(/^(\\s*)/)[0].length : 0;\n // Indent the starts of attribute names.\n if (state.tagName) {\n if (config.multilineTagIndentPastTag !== false)\n return state.tagStart + state.tagName.length + 2;\n else\n return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);\n }\n if (config.alignCDATA && /$/,\n blockCommentStart: \"\",\n\n configuration: config.htmlMode ? \"html\" : \"xml\",\n helperType: config.htmlMode ? \"html\" : \"xml\",\n\n skipAttribute: function(state) {\n if (state.state == attrValueState)\n state.state = attrState\n },\n\n xmlCurrentTag: function(state) {\n return state.tagName ? {name: state.tagName, close: state.type == \"closeTag\"} : null\n },\n\n xmlCurrentContext: function(state) {\n var context = []\n for (var cx = state.context; cx; cx = cx.prev)\n if (cx.tagName) context.push(cx.tagName)\n return context.reverse()\n }\n };\n});\n\nCodeMirror.defineMIME(\"text/xml\", \"xml\");\nCodeMirror.defineMIME(\"application/xml\", \"xml\");\nif (!CodeMirror.mimeModes.hasOwnProperty(\"text/html\"))\n CodeMirror.defineMIME(\"text/html\", {name: \"xml\", htmlMode: true});\n\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.modeInfo = [\n {name: \"APL\", mime: \"text/apl\", mode: \"apl\", ext: [\"dyalog\", \"apl\"]},\n {name: \"PGP\", mimes: [\"application/pgp\", \"application/pgp-encrypted\", \"application/pgp-keys\", \"application/pgp-signature\"], mode: \"asciiarmor\", ext: [\"asc\", \"pgp\", \"sig\"]},\n {name: \"ASN.1\", mime: \"text/x-ttcn-asn\", mode: \"asn.1\", ext: [\"asn\", \"asn1\"]},\n {name: \"Asterisk\", mime: \"text/x-asterisk\", mode: \"asterisk\", file: /^extensions\\.conf$/i},\n {name: \"Brainfuck\", mime: \"text/x-brainfuck\", mode: \"brainfuck\", ext: [\"b\", \"bf\"]},\n {name: \"C\", mime: \"text/x-csrc\", mode: \"clike\", ext: [\"c\", \"h\", \"ino\"]},\n {name: \"C++\", mime: \"text/x-c++src\", mode: \"clike\", ext: [\"cpp\", \"c++\", \"cc\", \"cxx\", \"hpp\", \"h++\", \"hh\", \"hxx\"], alias: [\"cpp\"]},\n {name: \"Cobol\", mime: \"text/x-cobol\", mode: \"cobol\", ext: [\"cob\", \"cpy\"]},\n {name: \"C#\", mime: \"text/x-csharp\", mode: \"clike\", ext: [\"cs\"], alias: [\"csharp\", \"cs\"]},\n {name: \"Clojure\", mime: \"text/x-clojure\", mode: \"clojure\", ext: [\"clj\", \"cljc\", \"cljx\"]},\n {name: \"ClojureScript\", mime: \"text/x-clojurescript\", mode: \"clojure\", ext: [\"cljs\"]},\n {name: \"Closure Stylesheets (GSS)\", mime: \"text/x-gss\", mode: \"css\", ext: [\"gss\"]},\n {name: \"CMake\", mime: \"text/x-cmake\", mode: \"cmake\", ext: [\"cmake\", \"cmake.in\"], file: /^CMakeLists\\.txt$/},\n {name: \"CoffeeScript\", mimes: [\"application/vnd.coffeescript\", \"text/coffeescript\", \"text/x-coffeescript\"], mode: \"coffeescript\", ext: [\"coffee\"], alias: [\"coffee\", \"coffee-script\"]},\n {name: \"Common Lisp\", mime: \"text/x-common-lisp\", mode: \"commonlisp\", ext: [\"cl\", \"lisp\", \"el\"], alias: [\"lisp\"]},\n {name: \"Cypher\", mime: \"application/x-cypher-query\", mode: \"cypher\", ext: [\"cyp\", \"cypher\"]},\n {name: \"Cython\", mime: \"text/x-cython\", mode: \"python\", ext: [\"pyx\", \"pxd\", \"pxi\"]},\n {name: \"Crystal\", mime: \"text/x-crystal\", mode: \"crystal\", ext: [\"cr\"]},\n {name: \"CSS\", mime: \"text/css\", mode: \"css\", ext: [\"css\"]},\n {name: \"CQL\", mime: \"text/x-cassandra\", mode: \"sql\", ext: [\"cql\"]},\n {name: \"D\", mime: \"text/x-d\", mode: \"d\", ext: [\"d\"]},\n {name: \"Dart\", mimes: [\"application/dart\", \"text/x-dart\"], mode: \"dart\", ext: [\"dart\"]},\n {name: \"diff\", mime: \"text/x-diff\", mode: \"diff\", ext: [\"diff\", \"patch\"]},\n {name: \"Django\", mime: \"text/x-django\", mode: \"django\"},\n {name: \"Dockerfile\", mime: \"text/x-dockerfile\", mode: \"dockerfile\", file: /^Dockerfile$/},\n {name: \"DTD\", mime: \"application/xml-dtd\", mode: \"dtd\", ext: [\"dtd\"]},\n {name: \"Dylan\", mime: \"text/x-dylan\", mode: \"dylan\", ext: [\"dylan\", \"dyl\", \"intr\"]},\n {name: \"EBNF\", mime: \"text/x-ebnf\", mode: \"ebnf\"},\n {name: \"ECL\", mime: \"text/x-ecl\", mode: \"ecl\", ext: [\"ecl\"]},\n {name: \"edn\", mime: \"application/edn\", mode: \"clojure\", ext: [\"edn\"]},\n {name: \"Eiffel\", mime: \"text/x-eiffel\", mode: \"eiffel\", ext: [\"e\"]},\n {name: \"Elm\", mime: \"text/x-elm\", mode: \"elm\", ext: [\"elm\"]},\n {name: \"Embedded Javascript\", mime: \"application/x-ejs\", mode: \"htmlembedded\", ext: [\"ejs\"]},\n {name: \"Embedded Ruby\", mime: \"application/x-erb\", mode: \"htmlembedded\", ext: [\"erb\"]},\n {name: \"Erlang\", mime: \"text/x-erlang\", mode: \"erlang\", ext: [\"erl\"]},\n {name: \"Esper\", mime: \"text/x-esper\", mode: \"sql\"},\n {name: \"Factor\", mime: \"text/x-factor\", mode: \"factor\", ext: [\"factor\"]},\n {name: \"FCL\", mime: \"text/x-fcl\", mode: \"fcl\"},\n {name: \"Forth\", mime: \"text/x-forth\", mode: \"forth\", ext: [\"forth\", \"fth\", \"4th\"]},\n {name: \"Fortran\", mime: \"text/x-fortran\", mode: \"fortran\", ext: [\"f\", \"for\", \"f77\", \"f90\", \"f95\"]},\n {name: \"F#\", mime: \"text/x-fsharp\", mode: \"mllike\", ext: [\"fs\"], alias: [\"fsharp\"]},\n {name: \"Gas\", mime: \"text/x-gas\", mode: \"gas\", ext: [\"s\"]},\n {name: \"Gherkin\", mime: \"text/x-feature\", mode: \"gherkin\", ext: [\"feature\"]},\n {name: \"GitHub Flavored Markdown\", mime: \"text/x-gfm\", mode: \"gfm\", file: /^(readme|contributing|history)\\.md$/i},\n {name: \"Go\", mime: \"text/x-go\", mode: \"go\", ext: [\"go\"]},\n {name: \"Groovy\", mime: \"text/x-groovy\", mode: \"groovy\", ext: [\"groovy\", \"gradle\"], file: /^Jenkinsfile$/},\n {name: \"HAML\", mime: \"text/x-haml\", mode: \"haml\", ext: [\"haml\"]},\n {name: \"Haskell\", mime: \"text/x-haskell\", mode: \"haskell\", ext: [\"hs\"]},\n {name: \"Haskell (Literate)\", mime: \"text/x-literate-haskell\", mode: \"haskell-literate\", ext: [\"lhs\"]},\n {name: \"Haxe\", mime: \"text/x-haxe\", mode: \"haxe\", ext: [\"hx\"]},\n {name: \"HXML\", mime: \"text/x-hxml\", mode: \"haxe\", ext: [\"hxml\"]},\n {name: \"ASP.NET\", mime: \"application/x-aspx\", mode: \"htmlembedded\", ext: [\"aspx\"], alias: [\"asp\", \"aspx\"]},\n {name: \"HTML\", mime: \"text/html\", mode: \"htmlmixed\", ext: [\"html\", \"htm\", \"handlebars\", \"hbs\"], alias: [\"xhtml\"]},\n {name: \"HTTP\", mime: \"message/http\", mode: \"http\"},\n {name: \"IDL\", mime: \"text/x-idl\", mode: \"idl\", ext: [\"pro\"]},\n {name: \"Pug\", mime: \"text/x-pug\", mode: \"pug\", ext: [\"jade\", \"pug\"], alias: [\"jade\"]},\n {name: \"Java\", mime: \"text/x-java\", mode: \"clike\", ext: [\"java\"]},\n {name: \"Java Server Pages\", mime: \"application/x-jsp\", mode: \"htmlembedded\", ext: [\"jsp\"], alias: [\"jsp\"]},\n {name: \"JavaScript\", mimes: [\"text/javascript\", \"text/ecmascript\", \"application/javascript\", \"application/x-javascript\", \"application/ecmascript\"],\n mode: \"javascript\", ext: [\"js\"], alias: [\"ecmascript\", \"js\", \"node\"]},\n {name: \"JSON\", mimes: [\"application/json\", \"application/x-json\"], mode: \"javascript\", ext: [\"json\", \"map\"], alias: [\"json5\"]},\n {name: \"JSON-LD\", mime: \"application/ld+json\", mode: \"javascript\", ext: [\"jsonld\"], alias: [\"jsonld\"]},\n {name: \"JSX\", mime: \"text/jsx\", mode: \"jsx\", ext: [\"jsx\"]},\n {name: \"Jinja2\", mime: \"text/jinja2\", mode: \"jinja2\", ext: [\"j2\", \"jinja\", \"jinja2\"]},\n {name: \"Julia\", mime: \"text/x-julia\", mode: \"julia\", ext: [\"jl\"]},\n {name: \"Kotlin\", mime: \"text/x-kotlin\", mode: \"clike\", ext: [\"kt\"]},\n {name: \"LESS\", mime: \"text/x-less\", mode: \"css\", ext: [\"less\"]},\n {name: \"LiveScript\", mime: \"text/x-livescript\", mode: \"livescript\", ext: [\"ls\"], alias: [\"ls\"]},\n {name: \"Lua\", mime: \"text/x-lua\", mode: \"lua\", ext: [\"lua\"]},\n {name: \"Markdown\", mime: \"text/x-markdown\", mode: \"markdown\", ext: [\"markdown\", \"md\", \"mkd\"]},\n {name: \"mIRC\", mime: \"text/mirc\", mode: \"mirc\"},\n {name: \"MariaDB SQL\", mime: \"text/x-mariadb\", mode: \"sql\"},\n {name: \"Mathematica\", mime: \"text/x-mathematica\", mode: \"mathematica\", ext: [\"m\", \"nb\", \"wl\", \"wls\"]},\n {name: \"Modelica\", mime: \"text/x-modelica\", mode: \"modelica\", ext: [\"mo\"]},\n {name: \"MUMPS\", mime: \"text/x-mumps\", mode: \"mumps\", ext: [\"mps\"]},\n {name: \"MS SQL\", mime: \"text/x-mssql\", mode: \"sql\"},\n {name: \"mbox\", mime: \"application/mbox\", mode: \"mbox\", ext: [\"mbox\"]},\n {name: \"MySQL\", mime: \"text/x-mysql\", mode: \"sql\"},\n {name: \"Nginx\", mime: \"text/x-nginx-conf\", mode: \"nginx\", file: /nginx.*\\.conf$/i},\n {name: \"NSIS\", mime: \"text/x-nsis\", mode: \"nsis\", ext: [\"nsh\", \"nsi\"]},\n {name: \"NTriples\", mimes: [\"application/n-triples\", \"application/n-quads\", \"text/n-triples\"],\n mode: \"ntriples\", ext: [\"nt\", \"nq\"]},\n {name: \"Objective-C\", mime: \"text/x-objectivec\", mode: \"clike\", ext: [\"m\"], alias: [\"objective-c\", \"objc\"]},\n {name: \"Objective-C++\", mime: \"text/x-objectivec++\", mode: \"clike\", ext: [\"mm\"], alias: [\"objective-c++\", \"objc++\"]},\n {name: \"OCaml\", mime: \"text/x-ocaml\", mode: \"mllike\", ext: [\"ml\", \"mli\", \"mll\", \"mly\"]},\n {name: \"Octave\", mime: \"text/x-octave\", mode: \"octave\", ext: [\"m\"]},\n {name: \"Oz\", mime: \"text/x-oz\", mode: \"oz\", ext: [\"oz\"]},\n {name: \"Pascal\", mime: \"text/x-pascal\", mode: \"pascal\", ext: [\"p\", \"pas\"]},\n {name: \"PEG.js\", mime: \"null\", mode: \"pegjs\", ext: [\"jsonld\"]},\n {name: \"Perl\", mime: \"text/x-perl\", mode: \"perl\", ext: [\"pl\", \"pm\"]},\n {name: \"PHP\", mimes: [\"text/x-php\", \"application/x-httpd-php\", \"application/x-httpd-php-open\"], mode: \"php\", ext: [\"php\", \"php3\", \"php4\", \"php5\", \"php7\", \"phtml\"]},\n {name: \"Pig\", mime: \"text/x-pig\", mode: \"pig\", ext: [\"pig\"]},\n {name: \"Plain Text\", mime: \"text/plain\", mode: \"null\", ext: [\"txt\", \"text\", \"conf\", \"def\", \"list\", \"log\"]},\n {name: \"PLSQL\", mime: \"text/x-plsql\", mode: \"sql\", ext: [\"pls\"]},\n {name: \"PostgreSQL\", mime: \"text/x-pgsql\", mode: \"sql\"},\n {name: \"PowerShell\", mime: \"application/x-powershell\", mode: \"powershell\", ext: [\"ps1\", \"psd1\", \"psm1\"]},\n {name: \"Properties files\", mime: \"text/x-properties\", mode: \"properties\", ext: [\"properties\", \"ini\", \"in\"], alias: [\"ini\", \"properties\"]},\n {name: \"ProtoBuf\", mime: \"text/x-protobuf\", mode: \"protobuf\", ext: [\"proto\"]},\n {name: \"Python\", mime: \"text/x-python\", mode: \"python\", ext: [\"BUILD\", \"bzl\", \"py\", \"pyw\"], file: /^(BUCK|BUILD)$/},\n {name: \"Puppet\", mime: \"text/x-puppet\", mode: \"puppet\", ext: [\"pp\"]},\n {name: \"Q\", mime: \"text/x-q\", mode: \"q\", ext: [\"q\"]},\n {name: \"R\", mime: \"text/x-rsrc\", mode: \"r\", ext: [\"r\", \"R\"], alias: [\"rscript\"]},\n {name: \"reStructuredText\", mime: \"text/x-rst\", mode: \"rst\", ext: [\"rst\"], alias: [\"rst\"]},\n {name: \"RPM Changes\", mime: \"text/x-rpm-changes\", mode: \"rpm\"},\n {name: \"RPM Spec\", mime: \"text/x-rpm-spec\", mode: \"rpm\", ext: [\"spec\"]},\n {name: \"Ruby\", mime: \"text/x-ruby\", mode: \"ruby\", ext: [\"rb\"], alias: [\"jruby\", \"macruby\", \"rake\", \"rb\", \"rbx\"]},\n {name: \"Rust\", mime: \"text/x-rustsrc\", mode: \"rust\", ext: [\"rs\"]},\n {name: \"SAS\", mime: \"text/x-sas\", mode: \"sas\", ext: [\"sas\"]},\n {name: \"Sass\", mime: \"text/x-sass\", mode: \"sass\", ext: [\"sass\"]},\n {name: \"Scala\", mime: \"text/x-scala\", mode: \"clike\", ext: [\"scala\"]},\n {name: \"Scheme\", mime: \"text/x-scheme\", mode: \"scheme\", ext: [\"scm\", \"ss\"]},\n {name: \"SCSS\", mime: \"text/x-scss\", mode: \"css\", ext: [\"scss\"]},\n {name: \"Shell\", mimes: [\"text/x-sh\", \"application/x-sh\"], mode: \"shell\", ext: [\"sh\", \"ksh\", \"bash\"], alias: [\"bash\", \"sh\", \"zsh\"], file: /^PKGBUILD$/},\n {name: \"Sieve\", mime: \"application/sieve\", mode: \"sieve\", ext: [\"siv\", \"sieve\"]},\n {name: \"Slim\", mimes: [\"text/x-slim\", \"application/x-slim\"], mode: \"slim\", ext: [\"slim\"]},\n {name: \"Smalltalk\", mime: \"text/x-stsrc\", mode: \"smalltalk\", ext: [\"st\"]},\n {name: \"Smarty\", mime: \"text/x-smarty\", mode: \"smarty\", ext: [\"tpl\"]},\n {name: \"Solr\", mime: \"text/x-solr\", mode: \"solr\"},\n {name: \"SML\", mime: \"text/x-sml\", mode: \"mllike\", ext: [\"sml\", \"sig\", \"fun\", \"smackspec\"]},\n {name: \"Soy\", mime: \"text/x-soy\", mode: \"soy\", ext: [\"soy\"], alias: [\"closure template\"]},\n {name: \"SPARQL\", mime: \"application/sparql-query\", mode: \"sparql\", ext: [\"rq\", \"sparql\"], alias: [\"sparul\"]},\n {name: \"Spreadsheet\", mime: \"text/x-spreadsheet\", mode: \"spreadsheet\", alias: [\"excel\", \"formula\"]},\n {name: \"SQL\", mime: \"text/x-sql\", mode: \"sql\", ext: [\"sql\"]},\n {name: \"SQLite\", mime: \"text/x-sqlite\", mode: \"sql\"},\n {name: \"Squirrel\", mime: \"text/x-squirrel\", mode: \"clike\", ext: [\"nut\"]},\n {name: \"Stylus\", mime: \"text/x-styl\", mode: \"stylus\", ext: [\"styl\"]},\n {name: \"Swift\", mime: \"text/x-swift\", mode: \"swift\", ext: [\"swift\"]},\n {name: \"sTeX\", mime: \"text/x-stex\", mode: \"stex\"},\n {name: \"LaTeX\", mime: \"text/x-latex\", mode: \"stex\", ext: [\"text\", \"ltx\", \"tex\"], alias: [\"tex\"]},\n {name: \"SystemVerilog\", mime: \"text/x-systemverilog\", mode: \"verilog\", ext: [\"v\", \"sv\", \"svh\"]},\n {name: \"Tcl\", mime: \"text/x-tcl\", mode: \"tcl\", ext: [\"tcl\"]},\n {name: \"Textile\", mime: \"text/x-textile\", mode: \"textile\", ext: [\"textile\"]},\n {name: \"TiddlyWiki\", mime: \"text/x-tiddlywiki\", mode: \"tiddlywiki\"},\n {name: \"Tiki wiki\", mime: \"text/tiki\", mode: \"tiki\"},\n {name: \"TOML\", mime: \"text/x-toml\", mode: \"toml\", ext: [\"toml\"]},\n {name: \"Tornado\", mime: \"text/x-tornado\", mode: \"tornado\"},\n {name: \"troff\", mime: \"text/troff\", mode: \"troff\", ext: [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]},\n {name: \"TTCN\", mime: \"text/x-ttcn\", mode: \"ttcn\", ext: [\"ttcn\", \"ttcn3\", \"ttcnpp\"]},\n {name: \"TTCN_CFG\", mime: \"text/x-ttcn-cfg\", mode: \"ttcn-cfg\", ext: [\"cfg\"]},\n {name: \"Turtle\", mime: \"text/turtle\", mode: \"turtle\", ext: [\"ttl\"]},\n {name: \"TypeScript\", mime: \"application/typescript\", mode: \"javascript\", ext: [\"ts\"], alias: [\"ts\"]},\n {name: \"TypeScript-JSX\", mime: \"text/typescript-jsx\", mode: \"jsx\", ext: [\"tsx\"], alias: [\"tsx\"]},\n {name: \"Twig\", mime: \"text/x-twig\", mode: \"twig\"},\n {name: \"Web IDL\", mime: \"text/x-webidl\", mode: \"webidl\", ext: [\"webidl\"]},\n {name: \"VB.NET\", mime: \"text/x-vb\", mode: \"vb\", ext: [\"vb\"]},\n {name: \"VBScript\", mime: \"text/vbscript\", mode: \"vbscript\", ext: [\"vbs\"]},\n {name: \"Velocity\", mime: \"text/velocity\", mode: \"velocity\", ext: [\"vtl\"]},\n {name: \"Verilog\", mime: \"text/x-verilog\", mode: \"verilog\", ext: [\"v\"]},\n {name: \"VHDL\", mime: \"text/x-vhdl\", mode: \"vhdl\", ext: [\"vhd\", \"vhdl\"]},\n {name: \"Vue.js Component\", mimes: [\"script/x-vue\", \"text/x-vue\"], mode: \"vue\", ext: [\"vue\"]},\n {name: \"XML\", mimes: [\"application/xml\", \"text/xml\"], mode: \"xml\", ext: [\"xml\", \"xsl\", \"xsd\", \"svg\"], alias: [\"rss\", \"wsdl\", \"xsd\"]},\n {name: \"XQuery\", mime: \"application/xquery\", mode: \"xquery\", ext: [\"xy\", \"xquery\"]},\n {name: \"Yacas\", mime: \"text/x-yacas\", mode: \"yacas\", ext: [\"ys\"]},\n {name: \"YAML\", mimes: [\"text/x-yaml\", \"text/yaml\"], mode: \"yaml\", ext: [\"yaml\", \"yml\"], alias: [\"yml\"]},\n {name: \"Z80\", mime: \"text/x-z80\", mode: \"z80\", ext: [\"z80\"]},\n {name: \"mscgen\", mime: \"text/x-mscgen\", mode: \"mscgen\", ext: [\"mscgen\", \"mscin\", \"msc\"]},\n {name: \"xu\", mime: \"text/x-xu\", mode: \"mscgen\", ext: [\"xu\"]},\n {name: \"msgenny\", mime: \"text/x-msgenny\", mode: \"mscgen\", ext: [\"msgenny\"]},\n {name: \"WebAssembly\", mime: \"text/webassembly\", mode: \"wast\", ext: [\"wat\", \"wast\"]},\n ];\n // Ensure all modes have a mime property for backwards compatibility\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.mimes) info.mime = info.mimes[0];\n }\n\n CodeMirror.findModeByMIME = function(mime) {\n mime = mime.toLowerCase();\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.mime == mime) return info;\n if (info.mimes) for (var j = 0; j < info.mimes.length; j++)\n if (info.mimes[j] == mime) return info;\n }\n if (/\\+xml$/.test(mime)) return CodeMirror.findModeByMIME(\"application/xml\")\n if (/\\+json$/.test(mime)) return CodeMirror.findModeByMIME(\"application/json\")\n };\n\n CodeMirror.findModeByExtension = function(ext) {\n ext = ext.toLowerCase();\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.ext) for (var j = 0; j < info.ext.length; j++)\n if (info.ext[j] == ext) return info;\n }\n };\n\n CodeMirror.findModeByFileName = function(filename) {\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.file && info.file.test(filename)) return info;\n }\n var dot = filename.lastIndexOf(\".\");\n var ext = dot > -1 && filename.substring(dot + 1, filename.length);\n if (ext) return CodeMirror.findModeByExtension(ext);\n };\n\n CodeMirror.findModeByName = function(name) {\n name = name.toLowerCase();\n for (var i = 0; i < CodeMirror.modeInfo.length; i++) {\n var info = CodeMirror.modeInfo[i];\n if (info.name.toLowerCase() == name) return info;\n if (info.alias) for (var j = 0; j < info.alias.length; j++)\n if (info.alias[j].toLowerCase() == name) return info;\n }\n };\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../xml/xml\"), require(\"../meta\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../xml/xml\", \"../meta\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"markdown\", function(cmCfg, modeCfg) {\n\n var htmlMode = CodeMirror.getMode(cmCfg, \"text/html\");\n var htmlModeMissing = htmlMode.name == \"null\"\n\n function getMode(name) {\n if (CodeMirror.findModeByName) {\n var found = CodeMirror.findModeByName(name);\n if (found) name = found.mime || found.mimes[0];\n }\n var mode = CodeMirror.getMode(cmCfg, name);\n return mode.name == \"null\" ? null : mode;\n }\n\n // Should characters that affect highlighting be highlighted separate?\n // Does not include characters that will be output (such as `1.` and `-` for lists)\n if (modeCfg.highlightFormatting === undefined)\n modeCfg.highlightFormatting = false;\n\n // Maximum number of nested blockquotes. Set to 0 for infinite nesting.\n // Excess `>` will emit `error` token.\n if (modeCfg.maxBlockquoteDepth === undefined)\n modeCfg.maxBlockquoteDepth = 0;\n\n // Turn on task lists? (\"- [ ] \" and \"- [x] \")\n if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;\n\n // Turn on strikethrough syntax\n if (modeCfg.strikethrough === undefined)\n modeCfg.strikethrough = false;\n\n if (modeCfg.emoji === undefined)\n modeCfg.emoji = false;\n\n if (modeCfg.fencedCodeBlockHighlighting === undefined)\n modeCfg.fencedCodeBlockHighlighting = true;\n\n if (modeCfg.fencedCodeBlockDefaultMode === undefined)\n modeCfg.fencedCodeBlockDefaultMode = 'text/plain';\n\n if (modeCfg.xml === undefined)\n modeCfg.xml = true;\n\n // Allow token types to be overridden by user-provided token types.\n if (modeCfg.tokenTypeOverrides === undefined)\n modeCfg.tokenTypeOverrides = {};\n\n var tokenTypes = {\n header: \"header\",\n code: \"comment\",\n quote: \"quote\",\n list1: \"variable-2\",\n list2: \"variable-3\",\n list3: \"keyword\",\n hr: \"hr\",\n image: \"image\",\n imageAltText: \"image-alt-text\",\n imageMarker: \"image-marker\",\n formatting: \"formatting\",\n linkInline: \"link\",\n linkEmail: \"link\",\n linkText: \"link\",\n linkHref: \"string\",\n em: \"em\",\n strong: \"strong\",\n strikethrough: \"strikethrough\",\n emoji: \"builtin\"\n };\n\n for (var tokenType in tokenTypes) {\n if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {\n tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];\n }\n }\n\n var hrRE = /^([*\\-_])(?:\\s*\\1){2,}\\s*$/\n , listRE = /^(?:[*\\-+]|^[0-9]+([.)]))\\s+/\n , taskListRE = /^\\[(x| )\\](?=\\s)/i // Must follow listRE\n , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/\n , setextHeaderRE = /^ {0,3}(?:\\={1,}|-{2,})\\s*$/\n , textRE = /^[^#!\\[\\]*_\\\\<>` \"'(~:]+/\n , fencedCodeRE = /^(~~~+|```+)[ \\t]*([\\w\\/+#-]*)[^\\n`]*$/\n , linkDefRE = /^\\s*\\[[^\\]]+?\\]:.*$/ // naive link-definition\n , punctuation = /[!\"#$%&'()*+,\\-.\\/:;<=>?@\\[\\\\\\]^_`{|}~\\xA1\\xA7\\xAB\\xB6\\xB7\\xBB\\xBF\\u037E\\u0387\\u055A-\\u055F\\u0589\\u058A\\u05BE\\u05C0\\u05C3\\u05C6\\u05F3\\u05F4\\u0609\\u060A\\u060C\\u060D\\u061B\\u061E\\u061F\\u066A-\\u066D\\u06D4\\u0700-\\u070D\\u07F7-\\u07F9\\u0830-\\u083E\\u085E\\u0964\\u0965\\u0970\\u0AF0\\u0DF4\\u0E4F\\u0E5A\\u0E5B\\u0F04-\\u0F12\\u0F14\\u0F3A-\\u0F3D\\u0F85\\u0FD0-\\u0FD4\\u0FD9\\u0FDA\\u104A-\\u104F\\u10FB\\u1360-\\u1368\\u1400\\u166D\\u166E\\u169B\\u169C\\u16EB-\\u16ED\\u1735\\u1736\\u17D4-\\u17D6\\u17D8-\\u17DA\\u1800-\\u180A\\u1944\\u1945\\u1A1E\\u1A1F\\u1AA0-\\u1AA6\\u1AA8-\\u1AAD\\u1B5A-\\u1B60\\u1BFC-\\u1BFF\\u1C3B-\\u1C3F\\u1C7E\\u1C7F\\u1CC0-\\u1CC7\\u1CD3\\u2010-\\u2027\\u2030-\\u2043\\u2045-\\u2051\\u2053-\\u205E\\u207D\\u207E\\u208D\\u208E\\u2308-\\u230B\\u2329\\u232A\\u2768-\\u2775\\u27C5\\u27C6\\u27E6-\\u27EF\\u2983-\\u2998\\u29D8-\\u29DB\\u29FC\\u29FD\\u2CF9-\\u2CFC\\u2CFE\\u2CFF\\u2D70\\u2E00-\\u2E2E\\u2E30-\\u2E42\\u3001-\\u3003\\u3008-\\u3011\\u3014-\\u301F\\u3030\\u303D\\u30A0\\u30FB\\uA4FE\\uA4FF\\uA60D-\\uA60F\\uA673\\uA67E\\uA6F2-\\uA6F7\\uA874-\\uA877\\uA8CE\\uA8CF\\uA8F8-\\uA8FA\\uA8FC\\uA92E\\uA92F\\uA95F\\uA9C1-\\uA9CD\\uA9DE\\uA9DF\\uAA5C-\\uAA5F\\uAADE\\uAADF\\uAAF0\\uAAF1\\uABEB\\uFD3E\\uFD3F\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE61\\uFE63\\uFE68\\uFE6A\\uFE6B\\uFF01-\\uFF03\\uFF05-\\uFF0A\\uFF0C-\\uFF0F\\uFF1A\\uFF1B\\uFF1F\\uFF20\\uFF3B-\\uFF3D\\uFF3F\\uFF5B\\uFF5D\\uFF5F-\\uFF65]|\\uD800[\\uDD00-\\uDD02\\uDF9F\\uDFD0]|\\uD801\\uDD6F|\\uD802[\\uDC57\\uDD1F\\uDD3F\\uDE50-\\uDE58\\uDE7F\\uDEF0-\\uDEF6\\uDF39-\\uDF3F\\uDF99-\\uDF9C]|\\uD804[\\uDC47-\\uDC4D\\uDCBB\\uDCBC\\uDCBE-\\uDCC1\\uDD40-\\uDD43\\uDD74\\uDD75\\uDDC5-\\uDDC9\\uDDCD\\uDDDB\\uDDDD-\\uDDDF\\uDE38-\\uDE3D\\uDEA9]|\\uD805[\\uDCC6\\uDDC1-\\uDDD7\\uDE41-\\uDE43\\uDF3C-\\uDF3E]|\\uD809[\\uDC70-\\uDC74]|\\uD81A[\\uDE6E\\uDE6F\\uDEF5\\uDF37-\\uDF3B\\uDF44]|\\uD82F\\uDC9F|\\uD836[\\uDE87-\\uDE8B]/\n , expandedTab = \" \" // CommonMark specifies tab as 4 spaces\n\n function switchInline(stream, state, f) {\n state.f = state.inline = f;\n return f(stream, state);\n }\n\n function switchBlock(stream, state, f) {\n state.f = state.block = f;\n return f(stream, state);\n }\n\n function lineIsEmpty(line) {\n return !line || !/\\S/.test(line.string)\n }\n\n // Blocks\n\n function blankLine(state) {\n // Reset linkTitle state\n state.linkTitle = false;\n state.linkHref = false;\n state.linkText = false;\n // Reset EM state\n state.em = false;\n // Reset STRONG state\n state.strong = false;\n // Reset strikethrough state\n state.strikethrough = false;\n // Reset state.quote\n state.quote = 0;\n // Reset state.indentedCode\n state.indentedCode = false;\n if (state.f == htmlBlock) {\n var exit = htmlModeMissing\n if (!exit) {\n var inner = CodeMirror.innerMode(htmlMode, state.htmlState)\n exit = inner.mode.name == \"xml\" && inner.state.tagStart === null &&\n (!inner.state.context && inner.state.tokenize.isInText)\n }\n if (exit) {\n state.f = inlineNormal;\n state.block = blockNormal;\n state.htmlState = null;\n }\n }\n // Reset state.trailingSpace\n state.trailingSpace = 0;\n state.trailingSpaceNewLine = false;\n // Mark this line as blank\n state.prevLine = state.thisLine\n state.thisLine = {stream: null}\n return null;\n }\n\n function blockNormal(stream, state) {\n var firstTokenOnLine = stream.column() === state.indentation;\n var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);\n var prevLineIsIndentedCode = state.indentedCode;\n var prevLineIsHr = state.prevLine.hr;\n var prevLineIsList = state.list !== false;\n var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;\n\n state.indentedCode = false;\n\n var lineIndentation = state.indentation;\n // compute once per line (on first token)\n if (state.indentationDiff === null) {\n state.indentationDiff = state.indentation;\n if (prevLineIsList) {\n state.list = null;\n // While this list item's marker's indentation is less than the deepest\n // list item's content's indentation,pop the deepest list item\n // indentation off the stack, and update block indentation state\n while (lineIndentation < state.listStack[state.listStack.length - 1]) {\n state.listStack.pop();\n if (state.listStack.length) {\n state.indentation = state.listStack[state.listStack.length - 1];\n // less than the first list's indent -> the line is no longer a list\n } else {\n state.list = false;\n }\n }\n if (state.list !== false) {\n state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]\n }\n }\n }\n\n // not comprehensive (currently only for setext detection purposes)\n var allowsInlineContinuation = (\n !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&\n (!prevLineIsList || !prevLineIsIndentedCode) &&\n !state.prevLine.fencedCodeEnd\n );\n\n var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&\n state.indentation <= maxNonCodeIndentation && stream.match(hrRE);\n\n var match = null;\n if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||\n state.prevLine.header || prevLineLineIsEmpty)) {\n stream.skipToEnd();\n state.indentedCode = true;\n return tokenTypes.code;\n } else if (stream.eatSpace()) {\n return null;\n } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {\n state.quote = 0;\n state.header = match[1].length;\n state.thisLine.header = true;\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n state.f = state.inline;\n return getType(state);\n } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {\n state.quote = firstTokenOnLine ? 1 : state.quote + 1;\n if (modeCfg.highlightFormatting) state.formatting = \"quote\";\n stream.eatSpace();\n return getType(state);\n } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {\n var listType = match[1] ? \"ol\" : \"ul\";\n\n state.indentation = lineIndentation + stream.current().length;\n state.list = true;\n state.quote = 0;\n\n // Add this list item's content's indentation to the stack\n state.listStack.push(state.indentation);\n // Reset inline styles which shouldn't propagate aross list items\n state.em = false;\n state.strong = false;\n state.code = false;\n state.strikethrough = false;\n\n if (modeCfg.taskLists && stream.match(taskListRE, false)) {\n state.taskList = true;\n }\n state.f = state.inline;\n if (modeCfg.highlightFormatting) state.formatting = [\"list\", \"list-\" + listType];\n return getType(state);\n } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {\n state.quote = 0;\n state.fencedEndRE = new RegExp(match[1] + \"+ *$\");\n // try switching mode\n state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );\n if (state.localMode) state.localState = CodeMirror.startState(state.localMode);\n state.f = state.block = local;\n if (modeCfg.highlightFormatting) state.formatting = \"code-block\";\n state.code = -1\n return getType(state);\n // SETEXT has lowest block-scope precedence after HR, so check it after\n // the others (code, blockquote, list...)\n } else if (\n // if setext set, indicates line after ---/===\n state.setext || (\n // line before ---/===\n (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&\n !state.code && !isHr && !linkDefRE.test(stream.string) &&\n (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))\n )\n ) {\n if ( !state.setext ) {\n state.header = match[0].charAt(0) == '=' ? 1 : 2;\n state.setext = state.header;\n } else {\n state.header = state.setext;\n // has no effect on type so we can reset it now\n state.setext = 0;\n stream.skipToEnd();\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n }\n state.thisLine.header = true;\n state.f = state.inline;\n return getType(state);\n } else if (isHr) {\n stream.skipToEnd();\n state.hr = true;\n state.thisLine.hr = true;\n return tokenTypes.hr;\n } else if (stream.peek() === '[') {\n return switchInline(stream, state, footnoteLink);\n }\n\n return switchInline(stream, state, state.inline);\n }\n\n function htmlBlock(stream, state) {\n var style = htmlMode.token(stream, state.htmlState);\n if (!htmlModeMissing) {\n var inner = CodeMirror.innerMode(htmlMode, state.htmlState)\n if ((inner.mode.name == \"xml\" && inner.state.tagStart === null &&\n (!inner.state.context && inner.state.tokenize.isInText)) ||\n (state.md_inside && stream.current().indexOf(\">\") > -1)) {\n state.f = inlineNormal;\n state.block = blockNormal;\n state.htmlState = null;\n }\n }\n return style;\n }\n\n function local(stream, state) {\n var currListInd = state.listStack[state.listStack.length - 1] || 0;\n var hasExitedList = state.indentation < currListInd;\n var maxFencedEndInd = currListInd + 3;\n if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {\n if (modeCfg.highlightFormatting) state.formatting = \"code-block\";\n var returnType;\n if (!hasExitedList) returnType = getType(state)\n state.localMode = state.localState = null;\n state.block = blockNormal;\n state.f = inlineNormal;\n state.fencedEndRE = null;\n state.code = 0\n state.thisLine.fencedCodeEnd = true;\n if (hasExitedList) return switchBlock(stream, state, state.block);\n return returnType;\n } else if (state.localMode) {\n return state.localMode.token(stream, state.localState);\n } else {\n stream.skipToEnd();\n return tokenTypes.code;\n }\n }\n\n // Inline\n function getType(state) {\n var styles = [];\n\n if (state.formatting) {\n styles.push(tokenTypes.formatting);\n\n if (typeof state.formatting === \"string\") state.formatting = [state.formatting];\n\n for (var i = 0; i < state.formatting.length; i++) {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i]);\n\n if (state.formatting[i] === \"header\") {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i] + \"-\" + state.header);\n }\n\n // Add `formatting-quote` and `formatting-quote-#` for blockquotes\n // Add `error` instead if the maximum blockquote nesting depth is passed\n if (state.formatting[i] === \"quote\") {\n if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {\n styles.push(tokenTypes.formatting + \"-\" + state.formatting[i] + \"-\" + state.quote);\n } else {\n styles.push(\"error\");\n }\n }\n }\n }\n\n if (state.taskOpen) {\n styles.push(\"meta\");\n return styles.length ? styles.join(' ') : null;\n }\n if (state.taskClosed) {\n styles.push(\"property\");\n return styles.length ? styles.join(' ') : null;\n }\n\n if (state.linkHref) {\n styles.push(tokenTypes.linkHref, \"url\");\n } else { // Only apply inline styles to non-url text\n if (state.strong) { styles.push(tokenTypes.strong); }\n if (state.em) { styles.push(tokenTypes.em); }\n if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }\n if (state.emoji) { styles.push(tokenTypes.emoji); }\n if (state.linkText) { styles.push(tokenTypes.linkText); }\n if (state.code) { styles.push(tokenTypes.code); }\n if (state.image) { styles.push(tokenTypes.image); }\n if (state.imageAltText) { styles.push(tokenTypes.imageAltText, \"link\"); }\n if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }\n }\n\n if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + \"-\" + state.header); }\n\n if (state.quote) {\n styles.push(tokenTypes.quote);\n\n // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth\n if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {\n styles.push(tokenTypes.quote + \"-\" + state.quote);\n } else {\n styles.push(tokenTypes.quote + \"-\" + modeCfg.maxBlockquoteDepth);\n }\n }\n\n if (state.list !== false) {\n var listMod = (state.listStack.length - 1) % 3;\n if (!listMod) {\n styles.push(tokenTypes.list1);\n } else if (listMod === 1) {\n styles.push(tokenTypes.list2);\n } else {\n styles.push(tokenTypes.list3);\n }\n }\n\n if (state.trailingSpaceNewLine) {\n styles.push(\"trailing-space-new-line\");\n } else if (state.trailingSpace) {\n styles.push(\"trailing-space-\" + (state.trailingSpace % 2 ? \"a\" : \"b\"));\n }\n\n return styles.length ? styles.join(' ') : null;\n }\n\n function handleText(stream, state) {\n if (stream.match(textRE, true)) {\n return getType(state);\n }\n return undefined;\n }\n\n function inlineNormal(stream, state) {\n var style = state.text(stream, state);\n if (typeof style !== 'undefined')\n return style;\n\n if (state.list) { // List marker (*, +, -, 1., etc)\n state.list = null;\n return getType(state);\n }\n\n if (state.taskList) {\n var taskOpen = stream.match(taskListRE, true)[1] === \" \";\n if (taskOpen) state.taskOpen = true;\n else state.taskClosed = true;\n if (modeCfg.highlightFormatting) state.formatting = \"task\";\n state.taskList = false;\n return getType(state);\n }\n\n state.taskOpen = false;\n state.taskClosed = false;\n\n if (state.header && stream.match(/^#+$/, true)) {\n if (modeCfg.highlightFormatting) state.formatting = \"header\";\n return getType(state);\n }\n\n var ch = stream.next();\n\n // Matches link titles present on next line\n if (state.linkTitle) {\n state.linkTitle = false;\n var matchCh = ch;\n if (ch === '(') {\n matchCh = ')';\n }\n matchCh = (matchCh+'').replace(/([.?*+^\\[\\]\\\\(){}|-])/g, \"\\\\$1\");\n var regex = '^\\\\s*(?:[^' + matchCh + '\\\\\\\\]+|\\\\\\\\\\\\\\\\|\\\\\\\\.)' + matchCh;\n if (stream.match(new RegExp(regex), true)) {\n return tokenTypes.linkHref;\n }\n }\n\n // If this block is changed, it may need to be updated in GFM mode\n if (ch === '`') {\n var previousFormatting = state.formatting;\n if (modeCfg.highlightFormatting) state.formatting = \"code\";\n stream.eatWhile('`');\n var count = stream.current().length\n if (state.code == 0 && (!state.quote || count == 1)) {\n state.code = count\n return getType(state)\n } else if (count == state.code) { // Must be exact\n var t = getType(state)\n state.code = 0\n return t\n } else {\n state.formatting = previousFormatting\n return getType(state)\n }\n } else if (state.code) {\n return getType(state);\n }\n\n if (ch === '\\\\') {\n stream.next();\n if (modeCfg.highlightFormatting) {\n var type = getType(state);\n var formattingEscape = tokenTypes.formatting + \"-escape\";\n return type ? type + \" \" + formattingEscape : formattingEscape;\n }\n }\n\n if (ch === '!' && stream.match(/\\[[^\\]]*\\] ?(?:\\(|\\[)/, false)) {\n state.imageMarker = true;\n state.image = true;\n if (modeCfg.highlightFormatting) state.formatting = \"image\";\n return getType(state);\n }\n\n if (ch === '[' && state.imageMarker && stream.match(/[^\\]]*\\](\\(.*?\\)| ?\\[.*?\\])/, false)) {\n state.imageMarker = false;\n state.imageAltText = true\n if (modeCfg.highlightFormatting) state.formatting = \"image\";\n return getType(state);\n }\n\n if (ch === ']' && state.imageAltText) {\n if (modeCfg.highlightFormatting) state.formatting = \"image\";\n var type = getType(state);\n state.imageAltText = false;\n state.image = false;\n state.inline = state.f = linkHref;\n return type;\n }\n\n if (ch === '[' && !state.image) {\n if (state.linkText && stream.match(/^.*?\\]/)) return getType(state)\n state.linkText = true;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n return getType(state);\n }\n\n if (ch === ']' && state.linkText) {\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n state.linkText = false;\n state.inline = state.f = stream.match(/\\(.*?\\)| ?\\[.*?\\]/, false) ? linkHref : inlineNormal\n return type;\n }\n\n if (ch === '<' && stream.match(/^(https?|ftps?):\\/\\/(?:[^\\\\>]|\\\\.)+>/, false)) {\n state.f = state.inline = linkInline;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkInline;\n }\n\n if (ch === '<' && stream.match(/^[^> \\\\]+@(?:[^\\\\>]|\\\\.)+>/, false)) {\n state.f = state.inline = linkInline;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkEmail;\n }\n\n if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\\?|!\\[CDATA\\[|[a-z][a-z0-9-]*(?:\\s+[a-z_:.\\-]+(?:\\s*=\\s*[^>]+)?)*\\s*(?:>|$))/i, false)) {\n var end = stream.string.indexOf(\">\", stream.pos);\n if (end != -1) {\n var atts = stream.string.substring(stream.start, end);\n if (/markdown\\s*=\\s*('|\"){0,1}1('|\"){0,1}/.test(atts)) state.md_inside = true;\n }\n stream.backUp(1);\n state.htmlState = CodeMirror.startState(htmlMode);\n return switchBlock(stream, state, htmlBlock);\n }\n\n if (modeCfg.xml && ch === '<' && stream.match(/^\\/\\w*?>/)) {\n state.md_inside = false;\n return \"tag\";\n } else if (ch === \"*\" || ch === \"_\") {\n var len = 1, before = stream.pos == 1 ? \" \" : stream.string.charAt(stream.pos - 2)\n while (len < 3 && stream.eat(ch)) len++\n var after = stream.peek() || \" \"\n // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis\n var leftFlanking = !/\\s/.test(after) && (!punctuation.test(after) || /\\s/.test(before) || punctuation.test(before))\n var rightFlanking = !/\\s/.test(before) && (!punctuation.test(before) || /\\s/.test(after) || punctuation.test(after))\n var setEm = null, setStrong = null\n if (len % 2) { // Em\n if (!state.em && leftFlanking && (ch === \"*\" || !rightFlanking || punctuation.test(before)))\n setEm = true\n else if (state.em == ch && rightFlanking && (ch === \"*\" || !leftFlanking || punctuation.test(after)))\n setEm = false\n }\n if (len > 1) { // Strong\n if (!state.strong && leftFlanking && (ch === \"*\" || !rightFlanking || punctuation.test(before)))\n setStrong = true\n else if (state.strong == ch && rightFlanking && (ch === \"*\" || !leftFlanking || punctuation.test(after)))\n setStrong = false\n }\n if (setStrong != null || setEm != null) {\n if (modeCfg.highlightFormatting) state.formatting = setEm == null ? \"strong\" : setStrong == null ? \"em\" : \"strong em\"\n if (setEm === true) state.em = ch\n if (setStrong === true) state.strong = ch\n var t = getType(state)\n if (setEm === false) state.em = false\n if (setStrong === false) state.strong = false\n return t\n }\n } else if (ch === ' ') {\n if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces\n if (stream.peek() === ' ') { // Surrounded by spaces, ignore\n return getType(state);\n } else { // Not surrounded by spaces, back up pointer\n stream.backUp(1);\n }\n }\n }\n\n if (modeCfg.strikethrough) {\n if (ch === '~' && stream.eatWhile(ch)) {\n if (state.strikethrough) {// Remove strikethrough\n if (modeCfg.highlightFormatting) state.formatting = \"strikethrough\";\n var t = getType(state);\n state.strikethrough = false;\n return t;\n } else if (stream.match(/^[^\\s]/, false)) {// Add strikethrough\n state.strikethrough = true;\n if (modeCfg.highlightFormatting) state.formatting = \"strikethrough\";\n return getType(state);\n }\n } else if (ch === ' ') {\n if (stream.match(/^~~/, true)) { // Probably surrounded by space\n if (stream.peek() === ' ') { // Surrounded by spaces, ignore\n return getType(state);\n } else { // Not surrounded by spaces, back up pointer\n stream.backUp(2);\n }\n }\n }\n }\n\n if (modeCfg.emoji && ch === \":\" && stream.match(/^(?:[a-z_\\d+][a-z_\\d+-]*|\\-[a-z_\\d+][a-z_\\d+-]*):/)) {\n state.emoji = true;\n if (modeCfg.highlightFormatting) state.formatting = \"emoji\";\n var retType = getType(state);\n state.emoji = false;\n return retType;\n }\n\n if (ch === ' ') {\n if (stream.match(/^ +$/, false)) {\n state.trailingSpace++;\n } else if (state.trailingSpace) {\n state.trailingSpaceNewLine = true;\n }\n }\n\n return getType(state);\n }\n\n function linkInline(stream, state) {\n var ch = stream.next();\n\n if (ch === \">\") {\n state.f = state.inline = inlineNormal;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var type = getType(state);\n if (type){\n type += \" \";\n } else {\n type = \"\";\n }\n return type + tokenTypes.linkInline;\n }\n\n stream.match(/^[^>]+/, true);\n\n return tokenTypes.linkInline;\n }\n\n function linkHref(stream, state) {\n // Check if space, and return NULL if so (to avoid marking the space)\n if(stream.eatSpace()){\n return null;\n }\n var ch = stream.next();\n if (ch === '(' || ch === '[') {\n state.f = state.inline = getLinkHrefInside(ch === \"(\" ? \")\" : \"]\");\n if (modeCfg.highlightFormatting) state.formatting = \"link-string\";\n state.linkHref = true;\n return getType(state);\n }\n return 'error';\n }\n\n var linkRE = {\n \")\": /^(?:[^\\\\\\(\\)]|\\\\.|\\((?:[^\\\\\\(\\)]|\\\\.)*\\))*?(?=\\))/,\n \"]\": /^(?:[^\\\\\\[\\]]|\\\\.|\\[(?:[^\\\\\\[\\]]|\\\\.)*\\])*?(?=\\])/\n }\n\n function getLinkHrefInside(endChar) {\n return function(stream, state) {\n var ch = stream.next();\n\n if (ch === endChar) {\n state.f = state.inline = inlineNormal;\n if (modeCfg.highlightFormatting) state.formatting = \"link-string\";\n var returnState = getType(state);\n state.linkHref = false;\n return returnState;\n }\n\n stream.match(linkRE[endChar])\n state.linkHref = true;\n return getType(state);\n };\n }\n\n function footnoteLink(stream, state) {\n if (stream.match(/^([^\\]\\\\]|\\\\.)*\\]:/, false)) {\n state.f = footnoteLinkInside;\n stream.next(); // Consume [\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n state.linkText = true;\n return getType(state);\n }\n return switchInline(stream, state, inlineNormal);\n }\n\n function footnoteLinkInside(stream, state) {\n if (stream.match(/^\\]:/, true)) {\n state.f = state.inline = footnoteUrl;\n if (modeCfg.highlightFormatting) state.formatting = \"link\";\n var returnType = getType(state);\n state.linkText = false;\n return returnType;\n }\n\n stream.match(/^([^\\]\\\\]|\\\\.)+/, true);\n\n return tokenTypes.linkText;\n }\n\n function footnoteUrl(stream, state) {\n // Check if space, and return NULL if so (to avoid marking the space)\n if(stream.eatSpace()){\n return null;\n }\n // Match URL\n stream.match(/^[^\\s]+/, true);\n // Check for link title\n if (stream.peek() === undefined) { // End of line, set flag to check next line\n state.linkTitle = true;\n } else { // More content on line, check if link title\n stream.match(/^(?:\\s+(?:\"(?:[^\"\\\\]|\\\\\\\\|\\\\.)+\"|'(?:[^'\\\\]|\\\\\\\\|\\\\.)+'|\\((?:[^)\\\\]|\\\\\\\\|\\\\.)+\\)))?/, true);\n }\n state.f = state.inline = inlineNormal;\n return tokenTypes.linkHref + \" url\";\n }\n\n var mode = {\n startState: function() {\n return {\n f: blockNormal,\n\n prevLine: {stream: null},\n thisLine: {stream: null},\n\n block: blockNormal,\n htmlState: null,\n indentation: 0,\n\n inline: inlineNormal,\n text: handleText,\n\n formatting: false,\n linkText: false,\n linkHref: false,\n linkTitle: false,\n code: 0,\n em: false,\n strong: false,\n header: 0,\n setext: 0,\n hr: false,\n taskList: false,\n list: false,\n listStack: [],\n quote: 0,\n trailingSpace: 0,\n trailingSpaceNewLine: false,\n strikethrough: false,\n emoji: false,\n fencedEndRE: null\n };\n },\n\n copyState: function(s) {\n return {\n f: s.f,\n\n prevLine: s.prevLine,\n thisLine: s.thisLine,\n\n block: s.block,\n htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),\n indentation: s.indentation,\n\n localMode: s.localMode,\n localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,\n\n inline: s.inline,\n text: s.text,\n formatting: false,\n linkText: s.linkText,\n linkTitle: s.linkTitle,\n linkHref: s.linkHref,\n code: s.code,\n em: s.em,\n strong: s.strong,\n strikethrough: s.strikethrough,\n emoji: s.emoji,\n header: s.header,\n setext: s.setext,\n hr: s.hr,\n taskList: s.taskList,\n list: s.list,\n listStack: s.listStack.slice(0),\n quote: s.quote,\n indentedCode: s.indentedCode,\n trailingSpace: s.trailingSpace,\n trailingSpaceNewLine: s.trailingSpaceNewLine,\n md_inside: s.md_inside,\n fencedEndRE: s.fencedEndRE\n };\n },\n\n token: function(stream, state) {\n\n // Reset state.formatting\n state.formatting = false;\n\n if (stream != state.thisLine.stream) {\n state.header = 0;\n state.hr = false;\n\n if (stream.match(/^\\s*$/, true)) {\n blankLine(state);\n return null;\n }\n\n state.prevLine = state.thisLine\n state.thisLine = {stream: stream}\n\n // Reset state.taskList\n state.taskList = false;\n\n // Reset state.trailingSpace\n state.trailingSpace = 0;\n state.trailingSpaceNewLine = false;\n\n if (!state.localState) {\n state.f = state.block;\n if (state.f != htmlBlock) {\n var indentation = stream.match(/^\\s*/, true)[0].replace(/\\t/g, expandedTab).length;\n state.indentation = indentation;\n state.indentationDiff = null;\n if (indentation > 0) return null;\n }\n }\n }\n return state.f(stream, state);\n },\n\n innerMode: function(state) {\n if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};\n if (state.localState) return {state: state.localState, mode: state.localMode};\n return {state: state, mode: mode};\n },\n\n indent: function(state, textAfter, line) {\n if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)\n if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)\n return CodeMirror.Pass\n },\n\n blankLine: blankLine,\n\n getType: getType,\n\n blockCommentStart: \"\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",\n fold: \"markdown\"\n };\n return mode;\n}, \"xml\");\n\nCodeMirror.defineMIME(\"text/markdown\", \"markdown\");\n\nCodeMirror.defineMIME(\"text/x-markdown\", \"markdown\");\n\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// Utility function that allows modes to be combined. The mode given\n// as the base argument takes care of most of the normal mode\n// functionality, but a second (typically simple) mode is used, which\n// can override the style of text. Both modes get to parse all of the\n// text, but when both assign a non-null style to a piece of code, the\n// overlay wins, unless the combine argument was true and not overridden,\n// or state.overlay.combineTokens was true, in which case the styles are\n// combined.\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.overlayMode = function(base, overlay, combine) {\n return {\n startState: function() {\n return {\n base: CodeMirror.startState(base),\n overlay: CodeMirror.startState(overlay),\n basePos: 0, baseCur: null,\n overlayPos: 0, overlayCur: null,\n streamSeen: null\n };\n },\n copyState: function(state) {\n return {\n base: CodeMirror.copyState(base, state.base),\n overlay: CodeMirror.copyState(overlay, state.overlay),\n basePos: state.basePos, baseCur: null,\n overlayPos: state.overlayPos, overlayCur: null\n };\n },\n\n token: function(stream, state) {\n if (stream != state.streamSeen ||\n Math.min(state.basePos, state.overlayPos) < stream.start) {\n state.streamSeen = stream;\n state.basePos = state.overlayPos = stream.start;\n }\n\n if (stream.start == state.basePos) {\n state.baseCur = base.token(stream, state.base);\n state.basePos = stream.pos;\n }\n if (stream.start == state.overlayPos) {\n stream.pos = stream.start;\n state.overlayCur = overlay.token(stream, state.overlay);\n state.overlayPos = stream.pos;\n }\n stream.pos = Math.min(state.basePos, state.overlayPos);\n\n // state.overlay.combineTokens always takes precedence over combine,\n // unless set to null\n if (state.overlayCur == null) return state.baseCur;\n else if (state.baseCur != null &&\n state.overlay.combineTokens ||\n combine && state.overlay.combineTokens == null)\n return state.baseCur + \" \" + state.overlayCur;\n else return state.overlayCur;\n },\n\n indent: base.indent && function(state, textAfter, line) {\n return base.indent(state.base, textAfter, line);\n },\n electricChars: base.electricChars,\n\n innerMode: function(state) { return {state: state.base, mode: base}; },\n\n blankLine: function(state) {\n var baseToken, overlayToken;\n if (base.blankLine) baseToken = base.blankLine(state.base);\n if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);\n\n return overlayToken == null ?\n baseToken :\n (combine && baseToken != null ? baseToken + \" \" + overlayToken : overlayToken);\n }\n };\n};\n\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../markdown/markdown\"), require(\"../../addon/mode/overlay\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../markdown/markdown\", \"../../addon/mode/overlay\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\\.beep|\\.lwz|\\.xpc|\\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\\.beeps?|xmpp|xri|ymsgr|z39\\.50[rs]?):(?:\\/{1,3}|[a-z0-9%])|www\\d{0,3}[.]|[a-z0-9.\\-]+[.][a-z]{2,4}\\/)(?:[^\\s()<>]|\\([^\\s()<>]*\\))+(?:\\([^\\s()<>]*\\)|[^\\s`*!()\\[\\]{};:'\".,<>?«»“”‘’]))/i\n\nCodeMirror.defineMode(\"gfm\", function(config, modeConfig) {\n var codeDepth = 0;\n function blankLine(state) {\n state.code = false;\n return null;\n }\n var gfmOverlay = {\n startState: function() {\n return {\n code: false,\n codeBlock: false,\n ateSpace: false\n };\n },\n copyState: function(s) {\n return {\n code: s.code,\n codeBlock: s.codeBlock,\n ateSpace: s.ateSpace\n };\n },\n token: function(stream, state) {\n state.combineTokens = null;\n\n // Hack to prevent formatting override inside code blocks (block and inline)\n if (state.codeBlock) {\n if (stream.match(/^```+/)) {\n state.codeBlock = false;\n return null;\n }\n stream.skipToEnd();\n return null;\n }\n if (stream.sol()) {\n state.code = false;\n }\n if (stream.sol() && stream.match(/^```+/)) {\n stream.skipToEnd();\n state.codeBlock = true;\n return null;\n }\n // If this block is changed, it may need to be updated in Markdown mode\n if (stream.peek() === '`') {\n stream.next();\n var before = stream.pos;\n stream.eatWhile('`');\n var difference = 1 + stream.pos - before;\n if (!state.code) {\n codeDepth = difference;\n state.code = true;\n } else {\n if (difference === codeDepth) { // Must be exact\n state.code = false;\n }\n }\n return null;\n } else if (state.code) {\n stream.next();\n return null;\n }\n // Check if space. If so, links can be formatted later on\n if (stream.eatSpace()) {\n state.ateSpace = true;\n return null;\n }\n if (stream.sol() || state.ateSpace) {\n state.ateSpace = false;\n if (modeConfig.gitHubSpice !== false) {\n if(stream.match(/^(?:[a-zA-Z0-9\\-_]+\\/)?(?:[a-zA-Z0-9\\-_]+@)?(?=.{0,6}\\d)(?:[a-f0-9]{7,40}\\b)/)) {\n // User/Project@SHA\n // User@SHA\n // SHA\n state.combineTokens = true;\n return \"link\";\n } else if (stream.match(/^(?:[a-zA-Z0-9\\-_]+\\/)?(?:[a-zA-Z0-9\\-_]+)?#[0-9]+\\b/)) {\n // User/Project#Num\n // User#Num\n // #Num\n state.combineTokens = true;\n return \"link\";\n }\n }\n }\n if (stream.match(urlRE) &&\n stream.string.slice(stream.start - 2, stream.start) != \"](\" &&\n (stream.start == 0 || /\\W/.test(stream.string.charAt(stream.start - 1)))) {\n // URLs\n // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls\n // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine\n // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL\n state.combineTokens = true;\n return \"link\";\n }\n stream.next();\n return null;\n },\n blankLine: blankLine\n };\n\n var markdownConfig = {\n taskLists: true,\n strikethrough: true,\n emoji: true\n };\n for (var attr in modeConfig) {\n markdownConfig[attr] = modeConfig[attr];\n }\n markdownConfig.name = \"markdown\";\n return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);\n\n}, \"markdown\");\n\n CodeMirror.defineMIME(\"text/x-gfm\", \"gfm\");\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var listRE = /^(\\s*)(>[> ]*|[*+-] \\[[x ]\\]\\s|[*+-]\\s|(\\d+)([.)]))(\\s*)/,\n emptyListRE = /^(\\s*)(>[> ]*|[*+-] \\[[x ]\\]|[*+-]|(\\d+)[.)])(\\s*)$/,\n unorderedListRE = /[*+-]\\s/;\n\n CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {\n if (cm.getOption(\"disableInput\")) return CodeMirror.Pass;\n var ranges = cm.listSelections(), replacements = [];\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].head;\n\n // If we're not in Markdown mode, fall back to normal newlineAndIndent\n var eolState = cm.getStateAfter(pos.line);\n var inner = CodeMirror.innerMode(cm.getMode(), eolState);\n if (inner.mode.name !== \"markdown\") {\n cm.execCommand(\"newlineAndIndent\");\n return;\n } else {\n eolState = inner.state;\n }\n\n var inList = eolState.list !== false;\n var inQuote = eolState.quote !== 0;\n\n var line = cm.getLine(pos.line), match = listRE.exec(line);\n var cursorBeforeBullet = /^\\s*$/.test(line.slice(0, pos.ch));\n if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {\n cm.execCommand(\"newlineAndIndent\");\n return;\n }\n if (emptyListRE.test(line)) {\n var endOfQuote = inQuote && />\\s*$/.test(line)\n var endOfList = !/>\\s*$/.test(line)\n if (endOfQuote || endOfList) cm.replaceRange(\"\", {\n line: pos.line, ch: 0\n }, {\n line: pos.line, ch: pos.ch + 1\n });\n replacements[i] = \"\\n\";\n } else {\n var indent = match[1], after = match[5];\n var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(\">\") >= 0);\n var bullet = numbered ? (parseInt(match[3], 10) + 1) + match[4] : match[2].replace(\"x\", \" \");\n replacements[i] = \"\\n\" + indent + bullet + after;\n\n if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);\n }\n }\n\n cm.replaceSelections(replacements);\n };\n\n // Auto-updating Markdown list numbers when a new item is added to the\n // middle of a list\n function incrementRemainingMarkdownListNumbers(cm, pos) {\n var startLine = pos.line, lookAhead = 0, skipCount = 0;\n var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];\n\n do {\n lookAhead += 1;\n var nextLineNumber = startLine + lookAhead;\n var nextLine = cm.getLine(nextLineNumber), nextItem = listRE.exec(nextLine);\n\n if (nextItem) {\n var nextIndent = nextItem[1];\n var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);\n var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;\n\n if (startIndent === nextIndent && !isNaN(nextNumber)) {\n if (newNumber === nextNumber) itemNumber = nextNumber + 1;\n if (newNumber > nextNumber) itemNumber = newNumber + 1;\n cm.replaceRange(\n nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),\n {\n line: nextLineNumber, ch: 0\n }, {\n line: nextLineNumber, ch: nextLine.length\n });\n } else {\n if (startIndent.length > nextIndent.length) return;\n // This doesn't run if the next line immediatley indents, as it is\n // not clear of the users intention (new indented item or same level)\n if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return;\n skipCount += 1;\n }\n }\n } while (nextItem);\n }\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var Pos = CodeMirror.Pos;\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }\n\n var nameStartChar = \"A-Z_a-z\\\\u00C0-\\\\u00D6\\\\u00D8-\\\\u00F6\\\\u00F8-\\\\u02FF\\\\u0370-\\\\u037D\\\\u037F-\\\\u1FFF\\\\u200C-\\\\u200D\\\\u2070-\\\\u218F\\\\u2C00-\\\\u2FEF\\\\u3001-\\\\uD7FF\\\\uF900-\\\\uFDCF\\\\uFDF0-\\\\uFFFD\";\n var nameChar = nameStartChar + \"\\-\\:\\.0-9\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040\";\n var xmlTagStart = new RegExp(\"<(/?)([\" + nameStartChar + \"][\" + nameChar + \"]*)\", \"g\");\n\n function Iter(cm, line, ch, range) {\n this.line = line; this.ch = ch;\n this.cm = cm; this.text = cm.getLine(line);\n this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine();\n this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine();\n }\n\n function tagAt(iter, ch) {\n var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));\n return type && /\\btag\\b/.test(type);\n }\n\n function nextLine(iter) {\n if (iter.line >= iter.max) return;\n iter.ch = 0;\n iter.text = iter.cm.getLine(++iter.line);\n return true;\n }\n function prevLine(iter) {\n if (iter.line <= iter.min) return;\n iter.text = iter.cm.getLine(--iter.line);\n iter.ch = iter.text.length;\n return true;\n }\n\n function toTagEnd(iter) {\n for (;;) {\n var gt = iter.text.indexOf(\">\", iter.ch);\n if (gt == -1) { if (nextLine(iter)) continue; else return; }\n if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }\n var lastSlash = iter.text.lastIndexOf(\"/\", gt);\n var selfClose = lastSlash > -1 && !/\\S/.test(iter.text.slice(lastSlash + 1, gt));\n iter.ch = gt + 1;\n return selfClose ? \"selfClose\" : \"regular\";\n }\n }\n function toTagStart(iter) {\n for (;;) {\n var lt = iter.ch ? iter.text.lastIndexOf(\"<\", iter.ch - 1) : -1;\n if (lt == -1) { if (prevLine(iter)) continue; else return; }\n if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }\n xmlTagStart.lastIndex = lt;\n iter.ch = lt;\n var match = xmlTagStart.exec(iter.text);\n if (match && match.index == lt) return match;\n }\n }\n\n function toNextTag(iter) {\n for (;;) {\n xmlTagStart.lastIndex = iter.ch;\n var found = xmlTagStart.exec(iter.text);\n if (!found) { if (nextLine(iter)) continue; else return; }\n if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }\n iter.ch = found.index + found[0].length;\n return found;\n }\n }\n function toPrevTag(iter) {\n for (;;) {\n var gt = iter.ch ? iter.text.lastIndexOf(\">\", iter.ch - 1) : -1;\n if (gt == -1) { if (prevLine(iter)) continue; else return; }\n if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }\n var lastSlash = iter.text.lastIndexOf(\"/\", gt);\n var selfClose = lastSlash > -1 && !/\\S/.test(iter.text.slice(lastSlash + 1, gt));\n iter.ch = gt + 1;\n return selfClose ? \"selfClose\" : \"regular\";\n }\n }\n\n function findMatchingClose(iter, tag) {\n var stack = [];\n for (;;) {\n var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);\n if (!next || !(end = toTagEnd(iter))) return;\n if (end == \"selfClose\") continue;\n if (next[1]) { // closing tag\n for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {\n stack.length = i;\n break;\n }\n if (i < 0 && (!tag || tag == next[2])) return {\n tag: next[2],\n from: Pos(startLine, startCh),\n to: Pos(iter.line, iter.ch)\n };\n } else { // opening tag\n stack.push(next[2]);\n }\n }\n }\n function findMatchingOpen(iter, tag) {\n var stack = [];\n for (;;) {\n var prev = toPrevTag(iter);\n if (!prev) return;\n if (prev == \"selfClose\") { toTagStart(iter); continue; }\n var endLine = iter.line, endCh = iter.ch;\n var start = toTagStart(iter);\n if (!start) return;\n if (start[1]) { // closing tag\n stack.push(start[2]);\n } else { // opening tag\n for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {\n stack.length = i;\n break;\n }\n if (i < 0 && (!tag || tag == start[2])) return {\n tag: start[2],\n from: Pos(iter.line, iter.ch),\n to: Pos(endLine, endCh)\n };\n }\n }\n }\n\n CodeMirror.registerHelper(\"fold\", \"xml\", function(cm, start) {\n var iter = new Iter(cm, start.line, 0);\n for (;;) {\n var openTag = toNextTag(iter)\n if (!openTag || iter.line != start.line) return\n var end = toTagEnd(iter)\n if (!end) return\n if (!openTag[1] && end != \"selfClose\") {\n var startPos = Pos(iter.line, iter.ch);\n var endPos = findMatchingClose(iter, openTag[2]);\n return endPos && cmp(endPos.from, startPos) > 0 ? {from: startPos, to: endPos.from} : null\n }\n }\n });\n CodeMirror.findMatchingTag = function(cm, pos, range) {\n var iter = new Iter(cm, pos.line, pos.ch, range);\n if (iter.text.indexOf(\">\") == -1 && iter.text.indexOf(\"<\") == -1) return;\n var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);\n var start = end && toTagStart(iter);\n if (!end || !start || cmp(iter, pos) > 0) return;\n var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};\n if (end == \"selfClose\") return {open: here, close: null, at: \"open\"};\n\n if (start[1]) { // closing tag\n return {open: findMatchingOpen(iter, start[2]), close: here, at: \"close\"};\n } else { // opening tag\n iter = new Iter(cm, to.line, to.ch, range);\n return {open: here, close: findMatchingClose(iter, start[2]), at: \"open\"};\n }\n };\n\n CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {\n var iter = new Iter(cm, pos.line, pos.ch, range);\n for (;;) {\n var open = findMatchingOpen(iter, tag);\n if (!open) break;\n var forward = new Iter(cm, pos.line, pos.ch, range);\n var close = findMatchingClose(forward, open.tag);\n if (close) return {open: open, close: close};\n }\n };\n\n // Used by addon/edit/closetag.js\n CodeMirror.scanForClosingTag = function(cm, pos, name, end) {\n var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);\n return findMatchingClose(iter, name);\n };\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n/**\n * Tag-closer extension for CodeMirror.\n *\n * This extension adds an \"autoCloseTags\" option that can be set to\n * either true to get the default behavior, or an object to further\n * configure its behavior.\n *\n * These are supported options:\n *\n * `whenClosing` (default true)\n * Whether to autoclose when the '/' of a closing tag is typed.\n * `whenOpening` (default true)\n * Whether to autoclose the tag when the final '>' of an opening\n * tag is typed.\n * `dontCloseTags` (default is empty tags for HTML, none for XML)\n * An array of tag names that should not be autoclosed.\n * `indentTags` (default is block tags for HTML, none for XML)\n * An array of tag names that should, when opened, cause a\n * blank line to be added inside the tag, and the blank line and\n * closing line to be indented.\n * `emptyTags` (default is none)\n * An array of XML tag names that should be autoclosed with '/>'.\n *\n * See demos/closetag.html for a usage example.\n */\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../fold/xml-fold\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../fold/xml-fold\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n CodeMirror.defineOption(\"autoCloseTags\", false, function(cm, val, old) {\n if (old != CodeMirror.Init && old)\n cm.removeKeyMap(\"autoCloseTags\");\n if (!val) return;\n var map = {name: \"autoCloseTags\"};\n if (typeof val != \"object\" || val.whenClosing !== false)\n map[\"'/'\"] = function(cm) { return autoCloseSlash(cm); };\n if (typeof val != \"object\" || val.whenOpening !== false)\n map[\"'>'\"] = function(cm) { return autoCloseGT(cm); };\n cm.addKeyMap(map);\n });\n\n var htmlDontClose = [\"area\", \"base\", \"br\", \"col\", \"command\", \"embed\", \"hr\", \"img\", \"input\", \"keygen\", \"link\", \"meta\", \"param\",\n \"source\", \"track\", \"wbr\"];\n var htmlIndent = [\"applet\", \"blockquote\", \"body\", \"button\", \"div\", \"dl\", \"fieldset\", \"form\", \"frameset\", \"h1\", \"h2\", \"h3\", \"h4\",\n \"h5\", \"h6\", \"head\", \"html\", \"iframe\", \"layer\", \"legend\", \"object\", \"ol\", \"p\", \"select\", \"table\", \"ul\"];\n\n function autoCloseGT(cm) {\n if (cm.getOption(\"disableInput\")) return CodeMirror.Pass;\n var ranges = cm.listSelections(), replacements = [];\n var opt = cm.getOption(\"autoCloseTags\");\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) return CodeMirror.Pass;\n var pos = ranges[i].head, tok = cm.getTokenAt(pos);\n var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;\n var tagInfo = inner.mode.xmlCurrentTag && inner.mode.xmlCurrentTag(state)\n var tagName = tagInfo && tagInfo.name\n if (!tagName) return CodeMirror.Pass\n\n var html = inner.mode.configuration == \"html\";\n var dontCloseTags = (typeof opt == \"object\" && opt.dontCloseTags) || (html && htmlDontClose);\n var indentTags = (typeof opt == \"object\" && opt.indentTags) || (html && htmlIndent);\n\n if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);\n var lowerTagName = tagName.toLowerCase();\n // Don't process the '>' at the end of an end-tag or self-closing tag\n if (!tagName ||\n tok.type == \"string\" && (tok.end != pos.ch || !/[\\\"\\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||\n tok.type == \"tag\" && tagInfo.close ||\n tok.string.indexOf(\"/\") == (pos.ch - tok.start - 1) || // match something like \n dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||\n closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))\n return CodeMirror.Pass;\n\n var emptyTags = typeof opt == \"object\" && opt.emptyTags;\n if (emptyTags && indexOf(emptyTags, tagName) > -1) {\n replacements[i] = { text: \"/>\", newPos: CodeMirror.Pos(pos.line, pos.ch + 2) };\n continue;\n }\n\n var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;\n replacements[i] = {indent: indent,\n text: \">\" + (indent ? \"\\n\\n\" : \"\") + \"\",\n newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};\n }\n\n var dontIndentOnAutoClose = (typeof opt == \"object\" && opt.dontIndentOnAutoClose);\n for (var i = ranges.length - 1; i >= 0; i--) {\n var info = replacements[i];\n cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, \"+insert\");\n var sel = cm.listSelections().slice(0);\n sel[i] = {head: info.newPos, anchor: info.newPos};\n cm.setSelections(sel);\n if (!dontIndentOnAutoClose && info.indent) {\n cm.indentLine(info.newPos.line, null, true);\n cm.indentLine(info.newPos.line + 1, null, true);\n }\n }\n }\n\n function autoCloseCurrent(cm, typingSlash) {\n var ranges = cm.listSelections(), replacements = [];\n var head = typingSlash ? \"/\" : \"\") replacement += \">\";\n replacements[i] = replacement;\n }\n cm.replaceSelections(replacements);\n ranges = cm.listSelections();\n if (!dontIndentOnAutoClose) {\n for (var i = 0; i < ranges.length; i++)\n if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)\n cm.indentLine(ranges[i].head.line);\n }\n }\n\n function autoCloseSlash(cm) {\n if (cm.getOption(\"disableInput\")) return CodeMirror.Pass;\n return autoCloseCurrent(cm, true);\n }\n\n CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };\n\n function indexOf(collection, elt) {\n if (collection.indexOf) return collection.indexOf(elt);\n for (var i = 0, e = collection.length; i < e; ++i)\n if (collection[i] == elt) return i;\n return -1;\n }\n\n // If xml-fold is loaded, we use its functionality to try and verify\n // whether a given tag is actually unclosed.\n function closingTagExists(cm, context, tagName, pos, newTag) {\n if (!CodeMirror.scanForClosingTag) return false;\n var end = Math.min(cm.lastLine() + 1, pos.line + 500);\n var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);\n if (!nextClose || nextClose.tag != tagName) return false;\n // If the immediate wrapping context contains onCx instances of\n // the same tag, a closing tag only exists if there are at least\n // that many closing tags of that type following.\n var onCx = newTag ? 1 : 0\n for (var i = context.length - 1; i >= 0; i--) {\n if (context[i] == tagName) ++onCx\n else break\n }\n pos = nextClose.to;\n for (var i = 1; i < onCx; i++) {\n var next = CodeMirror.scanForClosingTag(cm, pos, null, end);\n if (!next || next.tag != tagName) return false;\n pos = next.to;\n }\n return true;\n }\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"../fold/xml-fold\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../fold/xml-fold\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineOption(\"matchTags\", false, function(cm, val, old) {\n if (old && old != CodeMirror.Init) {\n cm.off(\"cursorActivity\", doMatchTags);\n cm.off(\"viewportChange\", maybeUpdateMatch);\n clear(cm);\n }\n if (val) {\n cm.state.matchBothTags = typeof val == \"object\" && val.bothTags;\n cm.on(\"cursorActivity\", doMatchTags);\n cm.on(\"viewportChange\", maybeUpdateMatch);\n doMatchTags(cm);\n }\n });\n\n function clear(cm) {\n if (cm.state.tagHit) cm.state.tagHit.clear();\n if (cm.state.tagOther) cm.state.tagOther.clear();\n cm.state.tagHit = cm.state.tagOther = null;\n }\n\n function doMatchTags(cm) {\n cm.state.failedTagMatch = false;\n cm.operation(function() {\n clear(cm);\n if (cm.somethingSelected()) return;\n var cur = cm.getCursor(), range = cm.getViewport();\n range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);\n var match = CodeMirror.findMatchingTag(cm, cur, range);\n if (!match) return;\n if (cm.state.matchBothTags) {\n var hit = match.at == \"open\" ? match.open : match.close;\n if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: \"CodeMirror-matchingtag\"});\n }\n var other = match.at == \"close\" ? match.open : match.close;\n if (other)\n cm.state.tagOther = cm.markText(other.from, other.to, {className: \"CodeMirror-matchingtag\"});\n else\n cm.state.failedTagMatch = true;\n });\n }\n\n function maybeUpdateMatch(cm) {\n if (cm.state.failedTagMatch) doMatchTags(cm);\n }\n\n CodeMirror.commands.toMatchingTag = function(cm) {\n var found = CodeMirror.findMatchingTag(cm, cm.getCursor());\n if (found) {\n var other = found.at == \"close\" ? found.open : found.close;\n if (other) cm.extendSelection(other.to, other.from);\n }\n };\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"))\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod)\n else // Plain browser env\n mod(CodeMirror)\n})(function(CodeMirror) {\n \"use strict\"\n var Pos = CodeMirror.Pos\n\n function regexpFlags(regexp) {\n var flags = regexp.flags\n return flags != null ? flags : (regexp.ignoreCase ? \"i\" : \"\")\n + (regexp.global ? \"g\" : \"\")\n + (regexp.multiline ? \"m\" : \"\")\n }\n\n function ensureFlags(regexp, flags) {\n var current = regexpFlags(regexp), target = current\n for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)\n target += flags.charAt(i)\n return current == target ? regexp : new RegExp(regexp.source, target)\n }\n\n function maybeMultiline(regexp) {\n return /\\\\s|\\\\n|\\n|\\\\W|\\\\D|\\[\\^/.test(regexp.source)\n }\n\n function searchRegexpForward(doc, regexp, start) {\n regexp = ensureFlags(regexp, \"g\")\n for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {\n regexp.lastIndex = ch\n var string = doc.getLine(line), match = regexp.exec(string)\n if (match)\n return {from: Pos(line, match.index),\n to: Pos(line, match.index + match[0].length),\n match: match}\n }\n }\n\n function searchRegexpForwardMultiline(doc, regexp, start) {\n if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)\n\n regexp = ensureFlags(regexp, \"gm\")\n var string, chunk = 1\n for (var line = start.line, last = doc.lastLine(); line <= last;) {\n // This grows the search buffer in exponentially-sized chunks\n // between matches, so that nearby matches are fast and don't\n // require concatenating the whole document (in case we're\n // searching for something that has tons of matches), but at the\n // same time, the amount of retries is limited.\n for (var i = 0; i < chunk; i++) {\n if (line > last) break\n var curLine = doc.getLine(line++)\n string = string == null ? curLine : string + \"\\n\" + curLine\n }\n chunk = chunk * 2\n regexp.lastIndex = start.ch\n var match = regexp.exec(string)\n if (match) {\n var before = string.slice(0, match.index).split(\"\\n\"), inside = match[0].split(\"\\n\")\n var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length\n return {from: Pos(startLine, startCh),\n to: Pos(startLine + inside.length - 1,\n inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),\n match: match}\n }\n }\n }\n\n function lastMatchIn(string, regexp, endMargin) {\n var match, from = 0\n while (from <= string.length) {\n regexp.lastIndex = from\n var newMatch = regexp.exec(string)\n if (!newMatch) break\n var end = newMatch.index + newMatch[0].length\n if (end > string.length - endMargin) break\n if (!match || end > match.index + match[0].length)\n match = newMatch\n from = newMatch.index + 1\n }\n return match\n }\n\n function searchRegexpBackward(doc, regexp, start) {\n regexp = ensureFlags(regexp, \"g\")\n for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {\n var string = doc.getLine(line)\n var match = lastMatchIn(string, regexp, ch < 0 ? 0 : string.length - ch)\n if (match)\n return {from: Pos(line, match.index),\n to: Pos(line, match.index + match[0].length),\n match: match}\n }\n }\n\n function searchRegexpBackwardMultiline(doc, regexp, start) {\n if (!maybeMultiline(regexp)) return searchRegexpBackward(doc, regexp, start)\n regexp = ensureFlags(regexp, \"gm\")\n var string, chunkSize = 1, endMargin = doc.getLine(start.line).length - start.ch\n for (var line = start.line, first = doc.firstLine(); line >= first;) {\n for (var i = 0; i < chunkSize && line >= first; i++) {\n var curLine = doc.getLine(line--)\n string = string == null ? curLine : curLine + \"\\n\" + string\n }\n chunkSize *= 2\n\n var match = lastMatchIn(string, regexp, endMargin)\n if (match) {\n var before = string.slice(0, match.index).split(\"\\n\"), inside = match[0].split(\"\\n\")\n var startLine = line + before.length, startCh = before[before.length - 1].length\n return {from: Pos(startLine, startCh),\n to: Pos(startLine + inside.length - 1,\n inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),\n match: match}\n }\n }\n }\n\n var doFold, noFold\n if (String.prototype.normalize) {\n doFold = function(str) { return str.normalize(\"NFD\").toLowerCase() }\n noFold = function(str) { return str.normalize(\"NFD\") }\n } else {\n doFold = function(str) { return str.toLowerCase() }\n noFold = function(str) { return str }\n }\n\n // Maps a position in a case-folded line back to a position in the original line\n // (compensating for codepoints increasing in number during folding)\n function adjustPos(orig, folded, pos, foldFunc) {\n if (orig.length == folded.length) return pos\n for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {\n if (min == max) return min\n var mid = (min + max) >> 1\n var len = foldFunc(orig.slice(0, mid)).length\n if (len == pos) return mid\n else if (len > pos) max = mid\n else min = mid + 1\n }\n }\n\n function searchStringForward(doc, query, start, caseFold) {\n // Empty string would match anything and never progress, so we\n // define it to match nothing instead.\n if (!query.length) return null\n var fold = caseFold ? doFold : noFold\n var lines = fold(query).split(/\\r|\\n\\r?/)\n\n search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {\n var orig = doc.getLine(line).slice(ch), string = fold(orig)\n if (lines.length == 1) {\n var found = string.indexOf(lines[0])\n if (found == -1) continue search\n var start = adjustPos(orig, string, found, fold) + ch\n return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),\n to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}\n } else {\n var cutFrom = string.length - lines[0].length\n if (string.slice(cutFrom) != lines[0]) continue search\n for (var i = 1; i < lines.length - 1; i++)\n if (fold(doc.getLine(line + i)) != lines[i]) continue search\n var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]\n if (endString.slice(0, lastLine.length) != lastLine) continue search\n return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),\n to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}\n }\n }\n }\n\n function searchStringBackward(doc, query, start, caseFold) {\n if (!query.length) return null\n var fold = caseFold ? doFold : noFold\n var lines = fold(query).split(/\\r|\\n\\r?/)\n\n search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {\n var orig = doc.getLine(line)\n if (ch > -1) orig = orig.slice(0, ch)\n var string = fold(orig)\n if (lines.length == 1) {\n var found = string.lastIndexOf(lines[0])\n if (found == -1) continue search\n return {from: Pos(line, adjustPos(orig, string, found, fold)),\n to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}\n } else {\n var lastLine = lines[lines.length - 1]\n if (string.slice(0, lastLine.length) != lastLine) continue search\n for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)\n if (fold(doc.getLine(start + i)) != lines[i]) continue search\n var top = doc.getLine(line + 1 - lines.length), topString = fold(top)\n if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search\n return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),\n to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}\n }\n }\n }\n\n function SearchCursor(doc, query, pos, options) {\n this.atOccurrence = false\n this.doc = doc\n pos = pos ? doc.clipPos(pos) : Pos(0, 0)\n this.pos = {from: pos, to: pos}\n\n var caseFold\n if (typeof options == \"object\") {\n caseFold = options.caseFold\n } else { // Backwards compat for when caseFold was the 4th argument\n caseFold = options\n options = null\n }\n\n if (typeof query == \"string\") {\n if (caseFold == null) caseFold = false\n this.matches = function(reverse, pos) {\n return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)\n }\n } else {\n query = ensureFlags(query, \"gm\")\n if (!options || options.multiline !== false)\n this.matches = function(reverse, pos) {\n return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)\n }\n else\n this.matches = function(reverse, pos) {\n return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)\n }\n }\n }\n\n SearchCursor.prototype = {\n findNext: function() {return this.find(false)},\n findPrevious: function() {return this.find(true)},\n\n find: function(reverse) {\n var result = this.matches(reverse, this.doc.clipPos(reverse ? this.pos.from : this.pos.to))\n\n // Implements weird auto-growing behavior on null-matches for\n // backwards-compatibility with the vim code (unfortunately)\n while (result && CodeMirror.cmpPos(result.from, result.to) == 0) {\n if (reverse) {\n if (result.from.ch) result.from = Pos(result.from.line, result.from.ch - 1)\n else if (result.from.line == this.doc.firstLine()) result = null\n else result = this.matches(reverse, this.doc.clipPos(Pos(result.from.line - 1)))\n } else {\n if (result.to.ch < this.doc.getLine(result.to.line).length) result.to = Pos(result.to.line, result.to.ch + 1)\n else if (result.to.line == this.doc.lastLine()) result = null\n else result = this.matches(reverse, Pos(result.to.line + 1, 0))\n }\n }\n\n if (result) {\n this.pos = result\n this.atOccurrence = true\n return this.pos.match || true\n } else {\n var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)\n this.pos = {from: end, to: end}\n return this.atOccurrence = false\n }\n },\n\n from: function() {if (this.atOccurrence) return this.pos.from},\n to: function() {if (this.atOccurrence) return this.pos.to},\n\n replace: function(newText, origin) {\n if (!this.atOccurrence) return\n var lines = CodeMirror.splitLines(newText)\n this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)\n this.pos.to = Pos(this.pos.from.line + lines.length - 1,\n lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))\n }\n }\n\n CodeMirror.defineExtension(\"getSearchCursor\", function(query, pos, caseFold) {\n return new SearchCursor(this.doc, query, pos, caseFold)\n })\n CodeMirror.defineDocExtension(\"getSearchCursor\", function(query, pos, caseFold) {\n return new SearchCursor(this, query, pos, caseFold)\n })\n\n CodeMirror.defineExtension(\"selectMatches\", function(query, caseFold) {\n var ranges = []\n var cur = this.getSearchCursor(query, this.getCursor(\"from\"), caseFold)\n while (cur.findNext()) {\n if (CodeMirror.cmpPos(cur.to(), this.getCursor(\"to\")) > 0) break\n ranges.push({anchor: cur.from(), head: cur.to()})\n }\n if (ranges.length)\n this.setSelections(ranges, 0)\n })\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n CodeMirror.defineOption(\"placeholder\", \"\", function(cm, val, old) {\n var prev = old && old != CodeMirror.Init;\n if (val && !prev) {\n cm.on(\"blur\", onBlur);\n cm.on(\"change\", onChange);\n cm.on(\"swapDoc\", onChange);\n CodeMirror.on(cm.getInputField(), \"compositionupdate\", cm.state.placeholderCompose = function() { onComposition(cm) })\n onChange(cm);\n } else if (!val && prev) {\n cm.off(\"blur\", onBlur);\n cm.off(\"change\", onChange);\n cm.off(\"swapDoc\", onChange);\n CodeMirror.off(cm.getInputField(), \"compositionupdate\", cm.state.placeholderCompose)\n clearPlaceholder(cm);\n var wrapper = cm.getWrapperElement();\n wrapper.className = wrapper.className.replace(\" CodeMirror-empty\", \"\");\n }\n\n if (val && !cm.hasFocus()) onBlur(cm);\n });\n\n function clearPlaceholder(cm) {\n if (cm.state.placeholder) {\n cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);\n cm.state.placeholder = null;\n }\n }\n function setPlaceholder(cm) {\n clearPlaceholder(cm);\n var elt = cm.state.placeholder = document.createElement(\"pre\");\n elt.style.cssText = \"height: 0; overflow: visible\";\n elt.style.direction = cm.getOption(\"direction\");\n elt.className = \"CodeMirror-placeholder CodeMirror-line-like\";\n var placeHolder = cm.getOption(\"placeholder\")\n if (typeof placeHolder == \"string\") placeHolder = document.createTextNode(placeHolder)\n elt.appendChild(placeHolder)\n cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);\n }\n\n function onComposition(cm) {\n setTimeout(function() {\n var empty = false, input = cm.getInputField()\n if (input.nodeName == \"TEXTAREA\")\n empty = !input.value\n else if (cm.lineCount() == 1)\n empty = !/[^\\u200b]/.test(input.querySelector(\".CodeMirror-line\").textContent)\n if (empty) setPlaceholder(cm)\n else clearPlaceholder(cm)\n }, 20)\n }\n\n function onBlur(cm) {\n if (isEmpty(cm)) setPlaceholder(cm);\n }\n function onChange(cm) {\n var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);\n wrapper.className = wrapper.className.replace(\" CodeMirror-empty\", \"\") + (empty ? \" CodeMirror-empty\" : \"\");\n\n if (empty) setPlaceholder(cm);\n else clearPlaceholder(cm);\n }\n\n function isEmpty(cm) {\n return (cm.lineCount() === 1) && (cm.getLine(0) === \"\");\n }\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n var ie_lt8 = /MSIE \\d/.test(navigator.userAgent) &&\n (document.documentMode == null || document.documentMode < 8);\n\n var Pos = CodeMirror.Pos;\n\n var matching = {\"(\": \")>\", \")\": \"(<\", \"[\": \"]>\", \"]\": \"[<\", \"{\": \"}>\", \"}\": \"{<\", \"<\": \">>\", \">\": \"<<\"};\n\n function bracketRegex(config) {\n return config && config.bracketRegex || /[(){}[\\]]/\n }\n\n function findMatchingBracket(cm, where, config) {\n var line = cm.getLineHandle(where.line), pos = where.ch - 1;\n var afterCursor = config && config.afterCursor\n if (afterCursor == null)\n afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)\n var re = bracketRegex(config)\n\n // A cursor is defined as between two characters, but in in vim command mode\n // (i.e. not insert mode), the cursor is visually represented as a\n // highlighted box on top of the 2nd character. Otherwise, we allow matches\n // from before or after the cursor.\n var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||\n re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];\n if (!match) return null;\n var dir = match.charAt(1) == \">\" ? 1 : -1;\n if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;\n var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));\n\n var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);\n if (found == null) return null;\n return {from: Pos(where.line, pos), to: found && found.pos,\n match: found && found.ch == match.charAt(0), forward: dir > 0};\n }\n\n // bracketRegex is used to specify which type of bracket to scan\n // should be a regexp, e.g. /[[\\]]/\n //\n // Note: If \"where\" is on an open bracket, then this bracket is ignored.\n //\n // Returns false when no bracket was found, null when it reached\n // maxScanLines and gave up\n function scanForBracket(cm, where, dir, style, config) {\n var maxScanLen = (config && config.maxScanLineLength) || 10000;\n var maxScanLines = (config && config.maxScanLines) || 1000;\n\n var stack = [];\n var re = bracketRegex(config)\n var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)\n : Math.max(cm.firstLine() - 1, where.line - maxScanLines);\n for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {\n var line = cm.getLine(lineNo);\n if (!line) continue;\n var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;\n if (line.length > maxScanLen) continue;\n if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);\n for (; pos != end; pos += dir) {\n var ch = line.charAt(pos);\n if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {\n var match = matching[ch];\n if (match && (match.charAt(1) == \">\") == (dir > 0)) stack.push(ch);\n else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};\n else stack.pop();\n }\n }\n }\n return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;\n }\n\n function matchBrackets(cm, autoclear, config) {\n // Disable brace matching in long lines, since it'll cause hugely slow updates\n var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;\n var marks = [], ranges = cm.listSelections();\n for (var i = 0; i < ranges.length; i++) {\n var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);\n if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {\n var style = match.match ? \"CodeMirror-matchingbracket\" : \"CodeMirror-nonmatchingbracket\";\n marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));\n if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)\n marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));\n }\n }\n\n if (marks.length) {\n // Kludge to work around the IE bug from issue #1193, where text\n // input stops going to the textare whever this fires.\n if (ie_lt8 && cm.state.focused) cm.focus();\n\n var clear = function() {\n cm.operation(function() {\n for (var i = 0; i < marks.length; i++) marks[i].clear();\n });\n };\n if (autoclear) setTimeout(clear, 800);\n else return clear;\n }\n }\n\n function doMatchBrackets(cm) {\n cm.operation(function() {\n if (cm.state.matchBrackets.currentlyHighlighted) {\n cm.state.matchBrackets.currentlyHighlighted();\n cm.state.matchBrackets.currentlyHighlighted = null;\n }\n cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);\n });\n }\n\n CodeMirror.defineOption(\"matchBrackets\", false, function(cm, val, old) {\n function clear(cm) {\n if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {\n cm.state.matchBrackets.currentlyHighlighted();\n cm.state.matchBrackets.currentlyHighlighted = null;\n }\n }\n\n if (old && old != CodeMirror.Init) {\n cm.off(\"cursorActivity\", doMatchBrackets);\n cm.off(\"focus\", doMatchBrackets)\n cm.off(\"blur\", clear)\n clear(cm);\n }\n if (val) {\n cm.state.matchBrackets = typeof val == \"object\" ? val : {};\n cm.on(\"cursorActivity\", doMatchBrackets);\n cm.on(\"focus\", doMatchBrackets)\n cm.on(\"blur\", clear)\n }\n });\n\n CodeMirror.defineExtension(\"matchBrackets\", function() {matchBrackets(this, true);});\n CodeMirror.defineExtension(\"findMatchingBracket\", function(pos, config, oldConfig){\n // Backwards-compatibility kludge\n if (oldConfig || typeof config == \"boolean\") {\n if (!oldConfig) {\n config = config ? {strict: true} : null\n } else {\n oldConfig.strict = config\n config = oldConfig\n }\n }\n return findMatchingBracket(this, pos, config)\n });\n CodeMirror.defineExtension(\"scanForBracket\", function(pos, dir, style, config){\n return scanForBracket(this, pos, dir, style, config);\n });\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// A rough approximation of Sublime Text's keybindings\n// Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../lib/codemirror\"), require(\"../addon/search/searchcursor\"), require(\"../addon/edit/matchbrackets\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../lib/codemirror\", \"../addon/search/searchcursor\", \"../addon/edit/matchbrackets\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var cmds = CodeMirror.commands;\n var Pos = CodeMirror.Pos;\n\n // This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.\n function findPosSubword(doc, start, dir) {\n if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));\n var line = doc.getLine(start.line);\n if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));\n var state = \"start\", type, startPos = start.ch;\n for (var pos = startPos, e = dir < 0 ? 0 : line.length, i = 0; pos != e; pos += dir, i++) {\n var next = line.charAt(dir < 0 ? pos - 1 : pos);\n var cat = next != \"_\" && CodeMirror.isWordChar(next) ? \"w\" : \"o\";\n if (cat == \"w\" && next.toUpperCase() == next) cat = \"W\";\n if (state == \"start\") {\n if (cat != \"o\") { state = \"in\"; type = cat; }\n else startPos = pos + dir\n } else if (state == \"in\") {\n if (type != cat) {\n if (type == \"w\" && cat == \"W\" && dir < 0) pos--;\n if (type == \"W\" && cat == \"w\" && dir > 0) { // From uppercase to lowercase\n if (pos == startPos + 1) { type = \"w\"; continue; }\n else pos--;\n }\n break;\n }\n }\n }\n return Pos(start.line, pos);\n }\n\n function moveSubword(cm, dir) {\n cm.extendSelectionsBy(function(range) {\n if (cm.display.shift || cm.doc.extend || range.empty())\n return findPosSubword(cm.doc, range.head, dir);\n else\n return dir < 0 ? range.from() : range.to();\n });\n }\n\n cmds.goSubwordLeft = function(cm) { moveSubword(cm, -1); };\n cmds.goSubwordRight = function(cm) { moveSubword(cm, 1); };\n\n cmds.scrollLineUp = function(cm) {\n var info = cm.getScrollInfo();\n if (!cm.somethingSelected()) {\n var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, \"local\");\n if (cm.getCursor().line >= visibleBottomLine)\n cm.execCommand(\"goLineUp\");\n }\n cm.scrollTo(null, info.top - cm.defaultTextHeight());\n };\n cmds.scrollLineDown = function(cm) {\n var info = cm.getScrollInfo();\n if (!cm.somethingSelected()) {\n var visibleTopLine = cm.lineAtHeight(info.top, \"local\")+1;\n if (cm.getCursor().line <= visibleTopLine)\n cm.execCommand(\"goLineDown\");\n }\n cm.scrollTo(null, info.top + cm.defaultTextHeight());\n };\n\n cmds.splitSelectionByLine = function(cm) {\n var ranges = cm.listSelections(), lineRanges = [];\n for (var i = 0; i < ranges.length; i++) {\n var from = ranges[i].from(), to = ranges[i].to();\n for (var line = from.line; line <= to.line; ++line)\n if (!(to.line > from.line && line == to.line && to.ch == 0))\n lineRanges.push({anchor: line == from.line ? from : Pos(line, 0),\n head: line == to.line ? to : Pos(line)});\n }\n cm.setSelections(lineRanges, 0);\n };\n\n cmds.singleSelectionTop = function(cm) {\n var range = cm.listSelections()[0];\n cm.setSelection(range.anchor, range.head, {scroll: false});\n };\n\n cmds.selectLine = function(cm) {\n var ranges = cm.listSelections(), extended = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n extended.push({anchor: Pos(range.from().line, 0),\n head: Pos(range.to().line + 1, 0)});\n }\n cm.setSelections(extended);\n };\n\n function insertLine(cm, above) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n cm.operation(function() {\n var len = cm.listSelections().length, newSelection = [], last = -1;\n for (var i = 0; i < len; i++) {\n var head = cm.listSelections()[i].head;\n if (head.line <= last) continue;\n var at = Pos(head.line + (above ? 0 : 1), 0);\n cm.replaceRange(\"\\n\", at, null, \"+insertLine\");\n cm.indentLine(at.line, null, true);\n newSelection.push({head: at, anchor: at});\n last = head.line + 1;\n }\n cm.setSelections(newSelection);\n });\n cm.execCommand(\"indentAuto\");\n }\n\n cmds.insertLineAfter = function(cm) { return insertLine(cm, false); };\n\n cmds.insertLineBefore = function(cm) { return insertLine(cm, true); };\n\n function wordAt(cm, pos) {\n var start = pos.ch, end = start, line = cm.getLine(pos.line);\n while (start && CodeMirror.isWordChar(line.charAt(start - 1))) --start;\n while (end < line.length && CodeMirror.isWordChar(line.charAt(end))) ++end;\n return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};\n }\n\n cmds.selectNextOccurrence = function(cm) {\n var from = cm.getCursor(\"from\"), to = cm.getCursor(\"to\");\n var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;\n if (CodeMirror.cmpPos(from, to) == 0) {\n var word = wordAt(cm, from);\n if (!word.word) return;\n cm.setSelection(word.from, word.to);\n fullWord = true;\n } else {\n var text = cm.getRange(from, to);\n var query = fullWord ? new RegExp(\"\\\\b\" + text + \"\\\\b\") : text;\n var cur = cm.getSearchCursor(query, to);\n var found = cur.findNext();\n if (!found) {\n cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));\n found = cur.findNext();\n }\n if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to())) return\n cm.addSelection(cur.from(), cur.to());\n }\n if (fullWord)\n cm.state.sublimeFindFullWord = cm.doc.sel;\n };\n\n cmds.skipAndSelectNextOccurrence = function(cm) {\n var prevAnchor = cm.getCursor(\"anchor\"), prevHead = cm.getCursor(\"head\");\n cmds.selectNextOccurrence(cm);\n if (CodeMirror.cmpPos(prevAnchor, prevHead) != 0) {\n cm.doc.setSelections(cm.doc.listSelections()\n .filter(function (sel) {\n return sel.anchor != prevAnchor || sel.head != prevHead;\n }));\n }\n }\n\n function addCursorToSelection(cm, dir) {\n var ranges = cm.listSelections(), newRanges = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n var newAnchor = cm.findPosV(\n range.anchor, dir, \"line\", range.anchor.goalColumn);\n var newHead = cm.findPosV(\n range.head, dir, \"line\", range.head.goalColumn);\n newAnchor.goalColumn = range.anchor.goalColumn != null ?\n range.anchor.goalColumn : cm.cursorCoords(range.anchor, \"div\").left;\n newHead.goalColumn = range.head.goalColumn != null ?\n range.head.goalColumn : cm.cursorCoords(range.head, \"div\").left;\n var newRange = {anchor: newAnchor, head: newHead};\n newRanges.push(range);\n newRanges.push(newRange);\n }\n cm.setSelections(newRanges);\n }\n cmds.addCursorToPrevLine = function(cm) { addCursorToSelection(cm, -1); };\n cmds.addCursorToNextLine = function(cm) { addCursorToSelection(cm, 1); };\n\n function isSelectedRange(ranges, from, to) {\n for (var i = 0; i < ranges.length; i++)\n if (CodeMirror.cmpPos(ranges[i].from(), from) == 0 &&\n CodeMirror.cmpPos(ranges[i].to(), to) == 0) return true\n return false\n }\n\n var mirror = \"(){}[]\";\n function selectBetweenBrackets(cm) {\n var ranges = cm.listSelections(), newRanges = []\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i], pos = range.head, opening = cm.scanForBracket(pos, -1);\n if (!opening) return false;\n for (;;) {\n var closing = cm.scanForBracket(pos, 1);\n if (!closing) return false;\n if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {\n var startPos = Pos(opening.pos.line, opening.pos.ch + 1);\n if (CodeMirror.cmpPos(startPos, range.from()) == 0 &&\n CodeMirror.cmpPos(closing.pos, range.to()) == 0) {\n opening = cm.scanForBracket(opening.pos, -1);\n if (!opening) return false;\n } else {\n newRanges.push({anchor: startPos, head: closing.pos});\n break;\n }\n }\n pos = Pos(closing.pos.line, closing.pos.ch + 1);\n }\n }\n cm.setSelections(newRanges);\n return true;\n }\n\n cmds.selectScope = function(cm) {\n selectBetweenBrackets(cm) || cm.execCommand(\"selectAll\");\n };\n cmds.selectBetweenBrackets = function(cm) {\n if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;\n };\n\n function puncType(type) {\n return !type ? null : /\\bpunctuation\\b/.test(type) ? type : undefined\n }\n\n cmds.goToBracket = function(cm) {\n cm.extendSelectionsBy(function(range) {\n var next = cm.scanForBracket(range.head, 1, puncType(cm.getTokenTypeAt(range.head)));\n if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;\n var prev = cm.scanForBracket(range.head, -1, puncType(cm.getTokenTypeAt(Pos(range.head.line, range.head.ch + 1))));\n return prev && Pos(prev.pos.line, prev.pos.ch + 1) || range.head;\n });\n };\n\n cmds.swapLineUp = function(cm) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i], from = range.from().line - 1, to = range.to().line;\n newSels.push({anchor: Pos(range.anchor.line - 1, range.anchor.ch),\n head: Pos(range.head.line - 1, range.head.ch)});\n if (range.to().ch == 0 && !range.empty()) --to;\n if (from > at) linesToMove.push(from, to);\n else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;\n at = to;\n }\n cm.operation(function() {\n for (var i = 0; i < linesToMove.length; i += 2) {\n var from = linesToMove[i], to = linesToMove[i + 1];\n var line = cm.getLine(from);\n cm.replaceRange(\"\", Pos(from, 0), Pos(from + 1, 0), \"+swapLine\");\n if (to > cm.lastLine())\n cm.replaceRange(\"\\n\" + line, Pos(cm.lastLine()), null, \"+swapLine\");\n else\n cm.replaceRange(line + \"\\n\", Pos(to, 0), null, \"+swapLine\");\n }\n cm.setSelections(newSels);\n cm.scrollIntoView();\n });\n };\n\n cmds.swapLineDown = function(cm) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;\n for (var i = ranges.length - 1; i >= 0; i--) {\n var range = ranges[i], from = range.to().line + 1, to = range.from().line;\n if (range.to().ch == 0 && !range.empty()) from--;\n if (from < at) linesToMove.push(from, to);\n else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;\n at = to;\n }\n cm.operation(function() {\n for (var i = linesToMove.length - 2; i >= 0; i -= 2) {\n var from = linesToMove[i], to = linesToMove[i + 1];\n var line = cm.getLine(from);\n if (from == cm.lastLine())\n cm.replaceRange(\"\", Pos(from - 1), Pos(from), \"+swapLine\");\n else\n cm.replaceRange(\"\", Pos(from, 0), Pos(from + 1, 0), \"+swapLine\");\n cm.replaceRange(line + \"\\n\", Pos(to, 0), null, \"+swapLine\");\n }\n cm.scrollIntoView();\n });\n };\n\n cmds.toggleCommentIndented = function(cm) {\n cm.toggleComment({ indent: true });\n }\n\n cmds.joinLines = function(cm) {\n var ranges = cm.listSelections(), joined = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i], from = range.from();\n var start = from.line, end = range.to().line;\n while (i < ranges.length - 1 && ranges[i + 1].from().line == end)\n end = ranges[++i].to().line;\n joined.push({start: start, end: end, anchor: !range.empty() && from});\n }\n cm.operation(function() {\n var offset = 0, ranges = [];\n for (var i = 0; i < joined.length; i++) {\n var obj = joined[i];\n var anchor = obj.anchor && Pos(obj.anchor.line - offset, obj.anchor.ch), head;\n for (var line = obj.start; line <= obj.end; line++) {\n var actual = line - offset;\n if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1);\n if (actual < cm.lastLine()) {\n cm.replaceRange(\" \", Pos(actual), Pos(actual + 1, /^\\s*/.exec(cm.getLine(actual + 1))[0].length));\n ++offset;\n }\n }\n ranges.push({anchor: anchor || head, head: head});\n }\n cm.setSelections(ranges, 0);\n });\n };\n\n cmds.duplicateLine = function(cm) {\n cm.operation(function() {\n var rangeCount = cm.listSelections().length;\n for (var i = 0; i < rangeCount; i++) {\n var range = cm.listSelections()[i];\n if (range.empty())\n cm.replaceRange(cm.getLine(range.head.line) + \"\\n\", Pos(range.head.line, 0));\n else\n cm.replaceRange(cm.getRange(range.from(), range.to()), range.from());\n }\n cm.scrollIntoView();\n });\n };\n\n\n function sortLines(cm, caseSensitive) {\n if (cm.isReadOnly()) return CodeMirror.Pass\n var ranges = cm.listSelections(), toSort = [], selected;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.empty()) continue;\n var from = range.from().line, to = range.to().line;\n while (i < ranges.length - 1 && ranges[i + 1].from().line == to)\n to = ranges[++i].to().line;\n if (!ranges[i].to().ch) to--;\n toSort.push(from, to);\n }\n if (toSort.length) selected = true;\n else toSort.push(cm.firstLine(), cm.lastLine());\n\n cm.operation(function() {\n var ranges = [];\n for (var i = 0; i < toSort.length; i += 2) {\n var from = toSort[i], to = toSort[i + 1];\n var start = Pos(from, 0), end = Pos(to);\n var lines = cm.getRange(start, end, false);\n if (caseSensitive)\n lines.sort();\n else\n lines.sort(function(a, b) {\n var au = a.toUpperCase(), bu = b.toUpperCase();\n if (au != bu) { a = au; b = bu; }\n return a < b ? -1 : a == b ? 0 : 1;\n });\n cm.replaceRange(lines, start, end);\n if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)});\n }\n if (selected) cm.setSelections(ranges, 0);\n });\n }\n\n cmds.sortLines = function(cm) { sortLines(cm, true); };\n cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false); };\n\n cmds.nextBookmark = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) while (marks.length) {\n var current = marks.shift();\n var found = current.find();\n if (found) {\n marks.push(current);\n return cm.setSelection(found.from, found.to);\n }\n }\n };\n\n cmds.prevBookmark = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) while (marks.length) {\n marks.unshift(marks.pop());\n var found = marks[marks.length - 1].find();\n if (!found)\n marks.pop();\n else\n return cm.setSelection(found.from, found.to);\n }\n };\n\n cmds.toggleBookmark = function(cm) {\n var ranges = cm.listSelections();\n var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);\n for (var i = 0; i < ranges.length; i++) {\n var from = ranges[i].from(), to = ranges[i].to();\n var found = ranges[i].empty() ? cm.findMarksAt(from) : cm.findMarks(from, to);\n for (var j = 0; j < found.length; j++) {\n if (found[j].sublimeBookmark) {\n found[j].clear();\n for (var k = 0; k < marks.length; k++)\n if (marks[k] == found[j])\n marks.splice(k--, 1);\n break;\n }\n }\n if (j == found.length)\n marks.push(cm.markText(from, to, {sublimeBookmark: true, clearWhenEmpty: false}));\n }\n };\n\n cmds.clearBookmarks = function(cm) {\n var marks = cm.state.sublimeBookmarks;\n if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();\n marks.length = 0;\n };\n\n cmds.selectBookmarks = function(cm) {\n var marks = cm.state.sublimeBookmarks, ranges = [];\n if (marks) for (var i = 0; i < marks.length; i++) {\n var found = marks[i].find();\n if (!found)\n marks.splice(i--, 0);\n else\n ranges.push({anchor: found.from, head: found.to});\n }\n if (ranges.length)\n cm.setSelections(ranges, 0);\n };\n\n function modifyWordOrSelection(cm, mod) {\n cm.operation(function() {\n var ranges = cm.listSelections(), indices = [], replacements = [];\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (range.empty()) { indices.push(i); replacements.push(\"\"); }\n else replacements.push(mod(cm.getRange(range.from(), range.to())));\n }\n cm.replaceSelections(replacements, \"around\", \"case\");\n for (var i = indices.length - 1, at; i >= 0; i--) {\n var range = ranges[indices[i]];\n if (at && CodeMirror.cmpPos(range.head, at) > 0) continue;\n var word = wordAt(cm, range.head);\n at = word.from;\n cm.replaceRange(mod(word.word), word.from, word.to);\n }\n });\n }\n\n cmds.smartBackspace = function(cm) {\n if (cm.somethingSelected()) return CodeMirror.Pass;\n\n cm.operation(function() {\n var cursors = cm.listSelections();\n var indentUnit = cm.getOption(\"indentUnit\");\n\n for (var i = cursors.length - 1; i >= 0; i--) {\n var cursor = cursors[i].head;\n var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);\n var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption(\"tabSize\"));\n\n // Delete by one character by default\n var deletePos = cm.findPosH(cursor, -1, \"char\", false);\n\n if (toStartOfLine && !/\\S/.test(toStartOfLine) && column % indentUnit == 0) {\n var prevIndent = new Pos(cursor.line,\n CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit));\n\n // Smart delete only if we found a valid prevIndent location\n if (prevIndent.ch != cursor.ch) deletePos = prevIndent;\n }\n\n cm.replaceRange(\"\", deletePos, cursor, \"+delete\");\n }\n });\n };\n\n cmds.delLineRight = function(cm) {\n cm.operation(function() {\n var ranges = cm.listSelections();\n for (var i = ranges.length - 1; i >= 0; i--)\n cm.replaceRange(\"\", ranges[i].anchor, Pos(ranges[i].to().line), \"+delete\");\n cm.scrollIntoView();\n });\n };\n\n cmds.upcaseAtCursor = function(cm) {\n modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });\n };\n cmds.downcaseAtCursor = function(cm) {\n modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });\n };\n\n cmds.setSublimeMark = function(cm) {\n if (cm.state.sublimeMark) cm.state.sublimeMark.clear();\n cm.state.sublimeMark = cm.setBookmark(cm.getCursor());\n };\n cmds.selectToSublimeMark = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) cm.setSelection(cm.getCursor(), found);\n };\n cmds.deleteToSublimeMark = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) {\n var from = cm.getCursor(), to = found;\n if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; }\n cm.state.sublimeKilled = cm.getRange(from, to);\n cm.replaceRange(\"\", from, to);\n }\n };\n cmds.swapWithSublimeMark = function(cm) {\n var found = cm.state.sublimeMark && cm.state.sublimeMark.find();\n if (found) {\n cm.state.sublimeMark.clear();\n cm.state.sublimeMark = cm.setBookmark(cm.getCursor());\n cm.setCursor(found);\n }\n };\n cmds.sublimeYank = function(cm) {\n if (cm.state.sublimeKilled != null)\n cm.replaceSelection(cm.state.sublimeKilled, null, \"paste\");\n };\n\n cmds.showInCenter = function(cm) {\n var pos = cm.cursorCoords(null, \"local\");\n cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);\n };\n\n function getTarget(cm) {\n var from = cm.getCursor(\"from\"), to = cm.getCursor(\"to\");\n if (CodeMirror.cmpPos(from, to) == 0) {\n var word = wordAt(cm, from);\n if (!word.word) return;\n from = word.from;\n to = word.to;\n }\n return {from: from, to: to, query: cm.getRange(from, to), word: word};\n }\n\n function findAndGoTo(cm, forward) {\n var target = getTarget(cm);\n if (!target) return;\n var query = target.query;\n var cur = cm.getSearchCursor(query, forward ? target.to : target.from);\n\n if (forward ? cur.findNext() : cur.findPrevious()) {\n cm.setSelection(cur.from(), cur.to());\n } else {\n cur = cm.getSearchCursor(query, forward ? Pos(cm.firstLine(), 0)\n : cm.clipPos(Pos(cm.lastLine())));\n if (forward ? cur.findNext() : cur.findPrevious())\n cm.setSelection(cur.from(), cur.to());\n else if (target.word)\n cm.setSelection(target.from, target.to);\n }\n };\n cmds.findUnder = function(cm) { findAndGoTo(cm, true); };\n cmds.findUnderPrevious = function(cm) { findAndGoTo(cm,false); };\n cmds.findAllUnder = function(cm) {\n var target = getTarget(cm);\n if (!target) return;\n var cur = cm.getSearchCursor(target.query);\n var matches = [];\n var primaryIndex = -1;\n while (cur.findNext()) {\n matches.push({anchor: cur.from(), head: cur.to()});\n if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch)\n primaryIndex++;\n }\n cm.setSelections(matches, primaryIndex);\n };\n\n\n var keyMap = CodeMirror.keyMap;\n keyMap.macSublime = {\n \"Cmd-Left\": \"goLineStartSmart\",\n \"Shift-Tab\": \"indentLess\",\n \"Shift-Ctrl-K\": \"deleteLine\",\n \"Alt-Q\": \"wrapLines\",\n \"Ctrl-Left\": \"goSubwordLeft\",\n \"Ctrl-Right\": \"goSubwordRight\",\n \"Ctrl-Alt-Up\": \"scrollLineUp\",\n \"Ctrl-Alt-Down\": \"scrollLineDown\",\n \"Cmd-L\": \"selectLine\",\n \"Shift-Cmd-L\": \"splitSelectionByLine\",\n \"Esc\": \"singleSelectionTop\",\n \"Cmd-Enter\": \"insertLineAfter\",\n \"Shift-Cmd-Enter\": \"insertLineBefore\",\n \"Cmd-D\": \"selectNextOccurrence\",\n \"Shift-Cmd-Space\": \"selectScope\",\n \"Shift-Cmd-M\": \"selectBetweenBrackets\",\n \"Cmd-M\": \"goToBracket\",\n \"Cmd-Ctrl-Up\": \"swapLineUp\",\n \"Cmd-Ctrl-Down\": \"swapLineDown\",\n \"Cmd-/\": \"toggleCommentIndented\",\n \"Cmd-J\": \"joinLines\",\n \"Shift-Cmd-D\": \"duplicateLine\",\n \"F5\": \"sortLines\",\n \"Cmd-F5\": \"sortLinesInsensitive\",\n \"F2\": \"nextBookmark\",\n \"Shift-F2\": \"prevBookmark\",\n \"Cmd-F2\": \"toggleBookmark\",\n \"Shift-Cmd-F2\": \"clearBookmarks\",\n \"Alt-F2\": \"selectBookmarks\",\n \"Backspace\": \"smartBackspace\",\n \"Cmd-K Cmd-D\": \"skipAndSelectNextOccurrence\",\n \"Cmd-K Cmd-K\": \"delLineRight\",\n \"Cmd-K Cmd-U\": \"upcaseAtCursor\",\n \"Cmd-K Cmd-L\": \"downcaseAtCursor\",\n \"Cmd-K Cmd-Space\": \"setSublimeMark\",\n \"Cmd-K Cmd-A\": \"selectToSublimeMark\",\n \"Cmd-K Cmd-W\": \"deleteToSublimeMark\",\n \"Cmd-K Cmd-X\": \"swapWithSublimeMark\",\n \"Cmd-K Cmd-Y\": \"sublimeYank\",\n \"Cmd-K Cmd-C\": \"showInCenter\",\n \"Cmd-K Cmd-G\": \"clearBookmarks\",\n \"Cmd-K Cmd-Backspace\": \"delLineLeft\",\n \"Cmd-K Cmd-1\": \"foldAll\",\n \"Cmd-K Cmd-0\": \"unfoldAll\",\n \"Cmd-K Cmd-J\": \"unfoldAll\",\n \"Ctrl-Shift-Up\": \"addCursorToPrevLine\",\n \"Ctrl-Shift-Down\": \"addCursorToNextLine\",\n \"Cmd-F3\": \"findUnder\",\n \"Shift-Cmd-F3\": \"findUnderPrevious\",\n \"Alt-F3\": \"findAllUnder\",\n \"Shift-Cmd-[\": \"fold\",\n \"Shift-Cmd-]\": \"unfold\",\n \"Cmd-I\": \"findIncremental\",\n \"Shift-Cmd-I\": \"findIncrementalReverse\",\n \"Cmd-H\": \"replace\",\n \"F3\": \"findNext\",\n \"Shift-F3\": \"findPrev\",\n \"fallthrough\": \"macDefault\"\n };\n CodeMirror.normalizeKeyMap(keyMap.macSublime);\n\n keyMap.pcSublime = {\n \"Shift-Tab\": \"indentLess\",\n \"Shift-Ctrl-K\": \"deleteLine\",\n \"Alt-Q\": \"wrapLines\",\n \"Ctrl-T\": \"transposeChars\",\n \"Alt-Left\": \"goSubwordLeft\",\n \"Alt-Right\": \"goSubwordRight\",\n \"Ctrl-Up\": \"scrollLineUp\",\n \"Ctrl-Down\": \"scrollLineDown\",\n \"Ctrl-L\": \"selectLine\",\n \"Shift-Ctrl-L\": \"splitSelectionByLine\",\n \"Esc\": \"singleSelectionTop\",\n \"Ctrl-Enter\": \"insertLineAfter\",\n \"Shift-Ctrl-Enter\": \"insertLineBefore\",\n \"Ctrl-D\": \"selectNextOccurrence\",\n \"Shift-Ctrl-Space\": \"selectScope\",\n \"Shift-Ctrl-M\": \"selectBetweenBrackets\",\n \"Ctrl-M\": \"goToBracket\",\n \"Shift-Ctrl-Up\": \"swapLineUp\",\n \"Shift-Ctrl-Down\": \"swapLineDown\",\n \"Ctrl-/\": \"toggleCommentIndented\",\n \"Ctrl-J\": \"joinLines\",\n \"Shift-Ctrl-D\": \"duplicateLine\",\n \"F9\": \"sortLines\",\n \"Ctrl-F9\": \"sortLinesInsensitive\",\n \"F2\": \"nextBookmark\",\n \"Shift-F2\": \"prevBookmark\",\n \"Ctrl-F2\": \"toggleBookmark\",\n \"Shift-Ctrl-F2\": \"clearBookmarks\",\n \"Alt-F2\": \"selectBookmarks\",\n \"Backspace\": \"smartBackspace\",\n \"Ctrl-K Ctrl-D\": \"skipAndSelectNextOccurrence\",\n \"Ctrl-K Ctrl-K\": \"delLineRight\",\n \"Ctrl-K Ctrl-U\": \"upcaseAtCursor\",\n \"Ctrl-K Ctrl-L\": \"downcaseAtCursor\",\n \"Ctrl-K Ctrl-Space\": \"setSublimeMark\",\n \"Ctrl-K Ctrl-A\": \"selectToSublimeMark\",\n \"Ctrl-K Ctrl-W\": \"deleteToSublimeMark\",\n \"Ctrl-K Ctrl-X\": \"swapWithSublimeMark\",\n \"Ctrl-K Ctrl-Y\": \"sublimeYank\",\n \"Ctrl-K Ctrl-C\": \"showInCenter\",\n \"Ctrl-K Ctrl-G\": \"clearBookmarks\",\n \"Ctrl-K Ctrl-Backspace\": \"delLineLeft\",\n \"Ctrl-K Ctrl-1\": \"foldAll\",\n \"Ctrl-K Ctrl-0\": \"unfoldAll\",\n \"Ctrl-K Ctrl-J\": \"unfoldAll\",\n \"Ctrl-Alt-Up\": \"addCursorToPrevLine\",\n \"Ctrl-Alt-Down\": \"addCursorToNextLine\",\n \"Ctrl-F3\": \"findUnder\",\n \"Shift-Ctrl-F3\": \"findUnderPrevious\",\n \"Alt-F3\": \"findAllUnder\",\n \"Shift-Ctrl-[\": \"fold\",\n \"Shift-Ctrl-]\": \"unfold\",\n \"Ctrl-I\": \"findIncremental\",\n \"Shift-Ctrl-I\": \"findIncrementalReverse\",\n \"Ctrl-H\": \"replace\",\n \"F3\": \"findNext\",\n \"Shift-F3\": \"findPrev\",\n \"fallthrough\": \"pcDefault\"\n };\n CodeMirror.normalizeKeyMap(keyMap.pcSublime);\n\n var mac = keyMap.default == keyMap.macDefault;\n keyMap.sublime = mac ? keyMap.macSublime : keyMap.pcSublime;\n});\n","(function (mod) {\n \"use strict\";\n\n if (typeof exports === \"object\" && typeof module === \"object\")\n // CommonJS\n mod(require(\"codemirror\"));\n else if (typeof define === \"function\" && define.amd)\n // AMD\n define([\"codemirror\"], mod);\n else mod(CodeMirror);\n})(function (CodeMirror) {\n \"use strict\";\n\n var Search;\n\n CodeMirror.defineOption(\"searchbox\", false, function (cm) {\n cm.addKeyMap({\n \"Ctrl-F\": function () {\n var cmEle = cm.display.wrapper;\n if (!Search || !cmEle.parentElement.contains(Search.searchBox)) {\n Search = new SearchBox(cm);\n }\n var isReplace = false;\n if (cmEle.parentElement.querySelector(\"[action=toggleReplace]\")) {\n isReplace =\n cmEle.parentElement.querySelector(\"[action=toggleReplace]\")\n .innerText === \"-\";\n }\n Search.show(cm.getSelection(), isReplace);\n },\n\n Esc: function () {\n if (!Search || !Search.isVisible()) return CodeMirror.Pass;\n\n Search.hide();\n\n if (typeof event !== \"undefined\") event.stopPropagation();\n },\n\n \"Cmd-F\": function () {\n if (!Search) Search = new SearchBox(cm);\n Search.show();\n },\n });\n });\n\n function SearchBox(cm) {\n var self = this;\n\n init();\n\n function initElements(el) {\n self.searchBox = el.querySelector(\".ace_search_form\");\n self.replaceBox = el.querySelector(\".ace_replace_form\");\n self.searchOptions = el.querySelector(\".ace_search_options\");\n\n self.regExpOption = el.querySelector(\"[action=toggleRegexpMode]\");\n self.caseSensitiveOption = el.querySelector(\n \"[action=toggleCaseSensitive]\"\n );\n self.wholeWordOption = el.querySelector(\"[action=toggleWholeWords]\");\n\n self.searchInput = self.searchBox.querySelector(\".ace_search_field\");\n self.replaceInput = self.replaceBox.querySelector(\".ace_search_field\");\n }\n\n function init() {\n var el = (self.element = addHtml());\n\n addStyle();\n\n initElements(el);\n bindKeys();\n\n el.addEventListener(\"mousedown\", function (e) {\n setTimeout(function () {\n self.activeInput.focus();\n }, 0);\n\n e.stopPropagation();\n });\n\n el.addEventListener(\"click\", function (e) {\n var t = e.target || e.srcElement;\n var action = t.getAttribute(\"action\");\n if (action && self[action]) self[action]();\n else if (self.commands[action]) self.commands[action]();\n e.stopPropagation();\n });\n\n self.searchInput.addEventListener(\"input\", function () {\n self.$onChange.schedule(20);\n });\n\n self.searchInput.addEventListener(\"focus\", function () {\n self.activeInput = self.searchInput;\n });\n\n self.replaceInput.addEventListener(\"focus\", function () {\n self.activeInput = self.replaceInput;\n });\n\n self.$onChange = delayedCall(function () {\n self.find(false, false);\n });\n }\n\n function bindKeys() {\n var sb = self,\n obj = {\n \"Ctrl-F|Cmd-F|Ctrl-H|Command-Alt-F\": function () {\n var isReplace = (sb.isReplace = !sb.isReplace);\n sb.replaceBox.style.display = isReplace ? \"\" : \"none\";\n sb[isReplace ? \"replaceInput\" : \"searchInput\"].focus();\n },\n \"Ctrl-G|Cmd-G\": function () {\n sb.findNext();\n },\n \"Ctrl-Shift-G|Cmd-Shift-G\": function () {\n sb.findPrev();\n },\n Esc: function () {\n setTimeout(function () {\n sb.hide();\n });\n },\n Enter: function () {\n if (sb.activeInput === sb.replaceInput) sb.replace();\n sb.findNext();\n },\n \"Shift-Enter\": function () {\n if (sb.activeInput === sb.replaceInput) sb.replace();\n sb.findPrev();\n },\n \"Alt-Enter\": function () {\n if (sb.activeInput === sb.replaceInput) sb.replaceAll();\n sb.findAll();\n },\n Tab: function () {\n if (self.activeInput === self.replaceInput)\n self.searchInput.focus();\n else self.replaceInput.focus();\n },\n };\n\n self.element.addEventListener(\"keydown\", function (event) {\n Object.keys(obj).some(function (name) {\n var is = key(name, event);\n\n if (is) {\n event.stopPropagation();\n event.preventDefault();\n obj[name](event);\n }\n\n return is;\n });\n });\n }\n\n this.commands = {\n toggleRegexpMode: function () {\n self.regExpOption.checked = !self.regExpOption.checked;\n self.$syncOptions();\n },\n\n toggleCaseSensitive: function () {\n self.caseSensitiveOption.checked = !self.caseSensitiveOption.checked;\n self.$syncOptions();\n },\n\n toggleWholeWords: function () {\n self.wholeWordOption.checked = !self.wholeWordOption.checked;\n self.$syncOptions();\n },\n };\n\n this.$syncOptions = function () {\n setCssClass(this.regExpOption, \"checked\", this.regExpOption.checked);\n setCssClass(\n this.wholeWordOption,\n \"checked\",\n this.wholeWordOption.checked\n );\n setCssClass(\n this.caseSensitiveOption,\n \"checked\",\n this.caseSensitiveOption.checked\n );\n\n this.find(false, false);\n };\n\n this.find = function (skipCurrent, backwards) {\n var value = this.searchInput.value,\n options = {\n skipCurrent: skipCurrent,\n backwards: backwards,\n regExp: this.regExpOption.checked,\n caseSensitive: this.caseSensitiveOption.checked,\n wholeWord: this.wholeWordOption.checked,\n };\n\n find(value, options, function (searchCursor) {\n var current = searchCursor.matches(false, searchCursor.from());\n cm.setSelection(current.from, current.to);\n });\n };\n\n function find(value, options, callback) {\n if (!value) {\n clearSearch(cm);\n updateCount();\n return;\n }\n var done,\n noMatch,\n searchCursor,\n next,\n prev,\n matches,\n cursor,\n position,\n val = value,\n o = options,\n is = true,\n caseSensitive = o.caseSensitive,\n regExp = o.regExp,\n wholeWord = o.wholeWord;\n\n if (regExp) {\n val = val.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n }\n if (wholeWord) {\n if (caseSensitive) {\n val = val = RegExp(\"\\\\b\" + val + \"\\\\b\");\n } else {\n val = RegExp(\"\\\\b\" + val + \"\\\\b\", \"i\");\n }\n }\n if (regExp) {\n val = RegExp(val);\n }\n clearSearch(cm);\n doSearch(cm, val, caseSensitive);\n updateCount();\n if (o.backwards) position = o.skipCurrent ? \"from\" : \"to\";\n else position = o.skipCurrent ? \"to\" : \"from\";\n\n cursor = cm.getCursor(position);\n searchCursor = cm.getSearchCursor(val, cursor, !caseSensitive);\n\n (next = searchCursor.findNext.bind(searchCursor)),\n (prev = searchCursor.findPrevious.bind(searchCursor)),\n (matches = searchCursor.matches.bind(searchCursor));\n\n if (o.backwards && !prev()) {\n is = next();\n\n if (is) {\n cm.setCursor(cm.doc.size - 1, 0);\n find(value, options, callback);\n done = true;\n }\n } else if (!o.backwards && !next()) {\n is = prev();\n\n if (is) {\n cm.setCursor(0, 0);\n find(value, options, callback);\n done = true;\n }\n }\n\n noMatch = !is && self.searchInput.value;\n setCssClass(self.searchBox, \"ace_nomatch\", noMatch);\n\n if (!done && is) callback(searchCursor);\n }\n\n this.findNext = function () {\n this.find(true, false);\n };\n\n this.findPrev = function () {\n this.find(true, true);\n };\n\n this.findAll = function () {\n var value = this.searchInput.value,\n range,\n noMatch = !range && this.searchInput.value;\n\n setCssClass(this.searchBox, \"ace_nomatch\", noMatch);\n\n if (cm.showMatchesOnScrollbar) cm.showMatchesOnScrollbar(value);\n\n this.hide();\n };\n\n this.replace = function () {\n var readOnly = cm.getOption(\"readOnly\"),\n isSelection = !!cm.getSelection();\n if (!readOnly && isSelection)\n cm.replaceSelection(this.replaceInput.value, \"start\");\n updateCount();\n };\n\n this.replaceAndFindNext = function () {\n var readOnly = cm.getOption(\"readOnly\");\n\n if (!readOnly) {\n this.replace();\n this.findNext();\n }\n };\n\n this.replaceAll = function () {\n var value,\n cursor,\n from = this.searchInput.value,\n to = this.replaceInput.value,\n reg = RegExp(from, this.caseSensitiveOption.checked ? \"g\" : \"gi\");\n\n if (this.wholeWordOption.checked && !this.regExpOption.checked) {\n if (this.caseSensitiveOption.checked) {\n reg = RegExp(\"\\\\b\" + from + \"\\\\b\", 'g');\n } else {\n reg = RegExp(\"\\\\b\" + from + \"\\\\b\", \"gi\");\n }\n }\n\n if (!cm.getOption(\"readOnly\") && cm.getSelection()) {\n cursor = cm.getCursor();\n value = cm.getValue();\n value = value.replace(reg, to);\n\n cm.setValue(value);\n cm.setCursor(cursor);\n }\n updateCount();\n };\n\n this.toggleReplace = function () {\n var cmEle = cm.display.wrapper;\n if (\n cmEle.parentElement.querySelector(\"[action=toggleReplace]\")\n .innerText === \"+\"\n ) {\n cmEle.parentElement.querySelector(\"[action=toggleReplace]\").innerText =\n \"-\";\n this.replaceBox.style.display = \"\";\n this.isReplace = true;\n } else {\n cmEle.parentElement.querySelector(\"[action=toggleReplace]\").innerText =\n \"+\";\n this.replaceBox.style.display = \"none\";\n this.isReplace = false;\n }\n };\n\n this.hide = function () {\n clearSearch(cm);\n var cmEle = cm.getWrapperElement();\n Search = null;\n cmEle.removeChild(this.element);\n cm.focus();\n };\n\n this.isVisible = function () {\n var is = this.element.style.display === \"\";\n return is;\n };\n\n this.show = function (value, isReplace) {\n this.element.style.display = \"\";\n if (!isReplace) {\n this.replaceBox.style.display = isReplace ? \"\" : \"none\";\n }\n this.isReplace = isReplace;\n if (value) {\n this.searchInput.value = value;\n this.find(false, false);\n }\n this.searchInput.focus();\n this.searchInput.select();\n };\n\n this.isFocused = function () {\n var el = document.activeElement;\n return el === this.searchInput || el === this.replaceInput;\n };\n\n function doSearch(cm, value, caseSensitive) {\n var state = getSearchState(cm);\n var query = value;\n if (query && query !== state.queryText) {\n startSearch(cm, state, query, caseSensitive);\n state.posFrom = state.posTo = cm.getCursor();\n }\n }\n\n function parseString(string) {\n return string.replace(/\\\\([nrt\\\\])/g, function (match, ch) {\n if (ch == \"n\") return \"\\n\";\n if (ch == \"r\") return \"\\r\";\n if (ch == \"t\") return \"\\t\";\n if (ch == \"\\\\\") return \"\\\\\";\n return match;\n });\n }\n\n function parseQuery(query) {\n var reStr = typeof query === \"object\" ? query.toString() : query;\n var isRE = reStr.match(/^\\/(.*)\\/([a-z]*)$/);\n if (isRE) {\n try {\n query = new RegExp(isRE[1], isRE[2].indexOf(\"i\") == -1 ? \"\" : \"i\");\n } catch (e) {} // Not a regular expression after all, do a string search\n } else {\n query = parseString(query);\n }\n if (typeof query == \"string\" ? query == \"\" : query.test(\"\")) query = /x^/;\n return query;\n }\n\n function startSearch(cm, state, query, caseSensitive) {\n state.queryText = query;\n state.query = parseQuery(query);\n cm.removeOverlay(\n state.overlay,\n queryCaseInsensitive(state.query, caseSensitive)\n );\n state.overlay = searchOverlay(\n state.query,\n queryCaseInsensitive(state.query, caseSensitive)\n );\n cm.addOverlay(state.overlay);\n if (cm.showMatchesOnScrollbar) {\n if (state.annotate) {\n state.annotate.clear();\n state.annotate = null;\n }\n state.annotate = cm.showMatchesOnScrollbar(\n state.query,\n queryCaseInsensitive(state.query, caseSensitive)\n );\n }\n }\n\n function queryCaseInsensitive(query, caseSensitive) {\n return typeof query == \"string\" && !caseSensitive;\n }\n\n function searchOverlay(query, caseInsensitive) {\n if (typeof query == \"string\")\n query = new RegExp(\n query.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\"),\n caseInsensitive ? \"gi\" : \"g\"\n );\n else if (!query.global)\n query = new RegExp(query.source, query.ignoreCase ? \"gi\" : \"g\");\n\n return {\n token: function (stream) {\n query.lastIndex = stream.pos;\n var match = query.exec(stream.string);\n if (match && match.index == stream.pos) {\n stream.pos += match[0].length || 1;\n return \"searching\";\n } else if (match) {\n stream.pos = match.index;\n } else {\n stream.skipToEnd();\n }\n },\n };\n }\n\n function SearchState() {\n this.posFrom = this.posTo = this.lastQuery = this.query = null;\n this.overlay = null;\n }\n\n function getSearchState(cm) {\n return cm.state.search || (cm.state.search = new SearchState());\n }\n\n function clearSearch(cm) {\n cm.operation(function () {\n var state = getSearchState(cm);\n state.lastQuery = state.query;\n if (!state.query) return;\n state.query = state.queryText = null;\n cm.removeOverlay(state.overlay);\n if (state.annotate) {\n state.annotate.clear();\n state.annotate = null;\n }\n });\n }\n\n function updateCount() {\n var val = self.searchInput.value;\n var matches = [];\n if (val) {\n val = val.replace(/[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g, \"\\\\$&\");\n var reg;\n if (self.caseSensitiveOption.checked) {\n reg = RegExp(val, \"g\");\n } else {\n reg = RegExp(val, \"gi\");\n }\n if (self.wholeWordOption.checked) {\n if (self.caseSensitiveOption.checked) {\n reg = RegExp(\"\\\\b\" + val + \"\\\\b\", \"g\");\n } else {\n reg = RegExp(\"\\\\b\" + val + \"\\\\b\", \"gi\");\n }\n }\n if (self.regExpOption.checked) {\n reg = RegExp(val, \"gi\");\n }\n matches = cm.getValue().match(reg);\n }\n var count = matches ? matches.length : 0;\n var cmEle = cm.display.wrapper;\n var countEle = cmEle.parentElement.querySelector(\".ace_search_counter\");\n if (countEle) {\n countEle.innerText = count + \" matches found.\";\n }\n if (count === 0){\n cm.setSelection({ch: 0, line: 0},{ch: 0, line: 0});\n }\n }\n\n function addStyle() {\n var style = document.createElement(\"style\"),\n css = [\n \".ace_search {\",\n \"color: black;\",\n \"background-color: #ddd;\",\n \"border: 1px solid #cbcbcb;\",\n \"border-top: 0 none;\",\n \"max-width: 325px;\",\n \"overflow: hidden;\",\n \"margin: 0;\",\n \"padding: 4px;\",\n \"padding-right: 6px;\",\n \"padding-bottom: 0;\",\n \"position: absolute;\",\n \"top: 0px;\",\n \"z-index: 99;\",\n \"white-space: normal;\",\n \"font-size: 12px;\",\n \"}\",\n \".ace_search.left {\",\n \"border-left: 0 none;\",\n \"border-radius: 0px 0px 5px 0px;\",\n \"left: 0;\",\n \"}\",\n \".ace_search.right {\",\n \"border-radius: 0px 0px 0px 5px;\",\n \"border-right: 0 none;\",\n \"right: 0;\",\n \"}\",\n \".ace_search_form, .ace_replace_form {\",\n \"border-radius: 3px;\",\n \"border: 1px solid #cbcbcb;\",\n \"float: left;\",\n \"margin-bottom: 4px;\",\n \"overflow: hidden;\",\n \"}\",\n \".ace_search_form.ace_nomatch {\",\n \"outline: 1px solid red;\",\n \"}\",\n \".ace_search_field {\",\n \"background-color: white;\",\n \"border-right: 1px solid #cbcbcb;\",\n \"border: 0 none;\",\n \"-webkit-box-sizing: border-box;\",\n \"-moz-box-sizing: border-box;\",\n \"box-sizing: border-box;\",\n \"float: left;\",\n \"height: 22px;\",\n \"outline: 0;\",\n \"padding: 0 7px;\",\n \"width: 238px;\",\n \"margin: 0;\",\n \"}\",\n \".ace_searchbtn,\",\n \".ace_replacebtn {\",\n \"background: #fff;\",\n \"border: 0 none;\",\n \"border-left: 1px solid #dcdcdc;\",\n \"cursor: pointer;\",\n \"float: left;\",\n \"height: 22px;\",\n \"padding: 0 5px;\",\n \"margin: 0;\",\n \"position: relative;\",\n \"}\",\n \".ace_searchbtn:last-child,\",\n \".ace_replacebtn:last-child {\",\n \"border-top-right-radius: 3px;\",\n \"border-bottom-right-radius: 3px;\",\n \"}\",\n \".ace_searchbtn:disabled {\",\n \"background: none;\",\n \"cursor: default;\",\n \"}\",\n \".ace_searchbtn {\",\n \"background-position: 50% 50%;\",\n \"background-repeat: no-repeat;\",\n \"width: 27px;\",\n \"}\",\n \".ace_searchbtn.prev {\",\n \"background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); \",\n \"}\",\n \".ace_searchbtn.next {\",\n \"background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); \",\n \"}\",\n \".ace_searchbtn_close {\",\n \"background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\",\n \"border-radius: 50%;\",\n \"border: 0 none;\",\n \"color: #656565;\",\n \"cursor: pointer;\",\n \"float: right;\",\n \"font: 16px/16px Arial;\",\n \"height: 14px;\",\n \"margin: 5px 1px 9px 5px;\",\n \"padding: 0;\",\n \"text-align: center;\",\n \"width: 14px;\",\n \"}\",\n \".ace_searchbtn_close:hover {\",\n \"background-color: #656565;\",\n \"background-position: 50% 100%;\",\n \"color: white;\",\n \"}\",\n \".ace_replacebtn.prev {\",\n \"width: 54px\",\n \"}\",\n \".ace_replacebtn.next {\",\n \"width: 27px\",\n \"}\",\n \".ace_button {\",\n \"margin-left: 2px;\",\n \"cursor: pointer;\",\n \"-webkit-user-select: none;\",\n \"-moz-user-select: none;\",\n \"-o-user-select: none;\",\n \"-ms-user-select: none;\",\n \"user-select: none;\",\n \"overflow: hidden;\",\n \"opacity: 0.7;\",\n \"border: 1px solid rgba(100,100,100,0.23);\",\n \"padding: 1px;\",\n \"-moz-box-sizing: border-box;\",\n \"box-sizing: border-box;\",\n \"color: black;\",\n \"}\",\n \".ace_button:hover {\",\n \"background-color: #eee;\",\n \"opacity:1;\",\n \"}\",\n \".ace_button:active {\",\n \"background-color: #ddd;\",\n \"}\",\n \".ace_button.checked {\",\n \"border-color: #3399ff;\",\n \"opacity:1;\",\n \"}\",\n \".ace_search_options{\",\n \"clear: both;\",\n \"margin: 4px 0;\",\n \"text-align: right;\",\n \"-webkit-user-select: none;\",\n \"-moz-user-select: none;\",\n \"-o-user-select: none;\",\n \"-ms-user-select: none;\",\n \"user-select: none;\",\n \"}\",\n \".replace_toggle{\",\n \"float: left;\",\n \"margin-top: -2px;\",\n \"padding: 0 5px;\",\n \" }\",\n \".ace_search_counter{\",\n \"float: left;\",\n \"font-family: arial;\",\n \"padding: 0 8px;\",\n \"}\",\n \"button svg,path {\",\n \"pointer-events: none;\",\n \"}\",\n ].join(\"\");\n\n style.setAttribute(\"data-name\", \"js-searchbox\");\n\n style.textContent = css;\n\n document.head.appendChild(style);\n }\n\n function addHtml() {\n var elSearch,\n el = cm.getWrapperElement(),\n div = document.createElement(\"div\"),\n html = [\n '\",\n ].join(\"\");\n\n div.innerHTML = html;\n\n elSearch = div.firstChild;\n\n el.appendChild(elSearch);\n\n return elSearch;\n }\n }\n\n function setCssClass(el, className, condition) {\n var list = el.classList;\n\n list[condition ? \"add\" : \"remove\"](className);\n }\n\n function delayedCall(fcn, defaultTimeout) {\n var timer,\n callback = function () {\n timer = null;\n fcn();\n },\n _self = function (timeout) {\n if (!timer) timer = setTimeout(callback, timeout || defaultTimeout);\n };\n\n _self.delay = function (timeout) {\n timer && clearTimeout(timer);\n timer = setTimeout(callback, timeout || defaultTimeout);\n };\n _self.schedule = _self;\n\n _self.call = function () {\n this.cancel();\n fcn();\n };\n\n _self.cancel = function () {\n timer && clearTimeout(timer);\n timer = null;\n };\n\n _self.isPending = function () {\n return timer;\n };\n\n return _self;\n }\n\n /* https://github.com/coderaiser/key */\n function key(str, event) {\n var right,\n KEY = {\n BACKSPACE: 8,\n TAB: 9,\n ENTER: 13,\n ESC: 27,\n\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n END: 35,\n HOME: 36,\n UP: 38,\n DOWN: 40,\n\n INSERT: 45,\n DELETE: 46,\n\n INSERT_MAC: 96,\n\n ASTERISK: 106,\n PLUS: 107,\n MINUS: 109,\n\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n\n SLASH: 191,\n TRA: 192 /* Typewritten Reverse Apostrophe (`) */,\n BACKSLASH: 220,\n };\n\n keyCheck(str, event);\n\n right = str.split(\"|\").some(function (combination) {\n var wrong;\n\n wrong = combination.split(\"-\").some(function (key) {\n var right;\n\n switch (key) {\n case \"Ctrl\":\n right = event.ctrlKey;\n break;\n\n case \"Shift\":\n right = event.shiftKey;\n break;\n\n case \"Alt\":\n right = event.altKey;\n break;\n\n case \"Cmd\":\n right = event.metaKey;\n break;\n\n default:\n if (key.length === 1) right = event.keyCode === key.charCodeAt(0);\n else\n Object.keys(KEY).some(function (name) {\n var up = key.toUpperCase();\n\n if (up === name) right = event.keyCode === KEY[name];\n });\n break;\n }\n\n return !right;\n });\n\n return !wrong;\n });\n\n return right;\n }\n\n function keyCheck(str, event) {\n if (typeof str !== \"string\") throw Error(\"str should be string!\");\n\n if (typeof event !== \"object\") throw Error(\"event should be object!\");\n }\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineExtension(\"annotateScrollbar\", function(options) {\n if (typeof options == \"string\") options = {className: options};\n return new Annotation(this, options);\n });\n\n CodeMirror.defineOption(\"scrollButtonHeight\", 0);\n\n function Annotation(cm, options) {\n this.cm = cm;\n this.options = options;\n this.buttonHeight = options.scrollButtonHeight || cm.getOption(\"scrollButtonHeight\");\n this.annotations = [];\n this.doRedraw = this.doUpdate = null;\n this.div = cm.getWrapperElement().appendChild(document.createElement(\"div\"));\n this.div.style.cssText = \"position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none\";\n this.computeScale();\n\n function scheduleRedraw(delay) {\n clearTimeout(self.doRedraw);\n self.doRedraw = setTimeout(function() { self.redraw(); }, delay);\n }\n\n var self = this;\n cm.on(\"refresh\", this.resizeHandler = function() {\n clearTimeout(self.doUpdate);\n self.doUpdate = setTimeout(function() {\n if (self.computeScale()) scheduleRedraw(20);\n }, 100);\n });\n cm.on(\"markerAdded\", this.resizeHandler);\n cm.on(\"markerCleared\", this.resizeHandler);\n if (options.listenForChanges !== false)\n cm.on(\"changes\", this.changeHandler = function() {\n scheduleRedraw(250);\n });\n }\n\n Annotation.prototype.computeScale = function() {\n var cm = this.cm;\n var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /\n cm.getScrollerElement().scrollHeight\n if (hScale != this.hScale) {\n this.hScale = hScale;\n return true;\n }\n };\n\n Annotation.prototype.update = function(annotations) {\n this.annotations = annotations;\n this.redraw();\n };\n\n Annotation.prototype.redraw = function(compute) {\n if (compute !== false) this.computeScale();\n var cm = this.cm, hScale = this.hScale;\n\n var frag = document.createDocumentFragment(), anns = this.annotations;\n\n var wrapping = cm.getOption(\"lineWrapping\");\n var singleLineH = wrapping && cm.defaultTextHeight() * 1.5;\n var curLine = null, curLineObj = null;\n\n function getY(pos, top) {\n if (curLine != pos.line) {\n curLine = pos.line\n curLineObj = cm.getLineHandle(pos.line)\n var visual = cm.getLineHandleVisualStart(curLineObj)\n if (visual != curLineObj) {\n curLine = cm.getLineNumber(visual)\n curLineObj = visual\n }\n }\n if ((curLineObj.widgets && curLineObj.widgets.length) ||\n (wrapping && curLineObj.height > singleLineH))\n return cm.charCoords(pos, \"local\")[top ? \"top\" : \"bottom\"];\n var topY = cm.heightAtLine(curLineObj, \"local\");\n return topY + (top ? 0 : curLineObj.height);\n }\n\n var lastLine = cm.lastLine()\n if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) {\n var ann = anns[i];\n if (ann.to.line > lastLine) continue;\n var top = nextTop || getY(ann.from, true) * hScale;\n var bottom = getY(ann.to, false) * hScale;\n while (i < anns.length - 1) {\n if (anns[i + 1].to.line > lastLine) break;\n nextTop = getY(anns[i + 1].from, true) * hScale;\n if (nextTop > bottom + .9) break;\n ann = anns[++i];\n bottom = getY(ann.to, false) * hScale;\n }\n if (bottom == top) continue;\n var height = Math.max(bottom - top, 3);\n\n var elt = frag.appendChild(document.createElement(\"div\"));\n elt.style.cssText = \"position: absolute; right: 0px; width: \" + Math.max(cm.display.barWidth - 1, 2) + \"px; top: \"\n + (top + this.buttonHeight) + \"px; height: \" + height + \"px\";\n elt.className = this.options.className;\n if (ann.id) {\n elt.setAttribute(\"annotation-id\", ann.id);\n }\n }\n this.div.textContent = \"\";\n this.div.appendChild(frag);\n };\n\n Annotation.prototype.clear = function() {\n this.cm.off(\"refresh\", this.resizeHandler);\n this.cm.off(\"markerAdded\", this.resizeHandler);\n this.cm.off(\"markerCleared\", this.resizeHandler);\n if (this.changeHandler) this.cm.off(\"changes\", this.changeHandler);\n this.div.parentNode.removeChild(this.div);\n };\n});\n","// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n(function(mod) {\n if (typeof exports == \"object\" && typeof module == \"object\") // CommonJS\n mod(require(\"../../lib/codemirror\"), require(\"./searchcursor\"), require(\"../scroll/annotatescrollbar\"));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"./searchcursor\", \"../scroll/annotatescrollbar\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n CodeMirror.defineExtension(\"showMatchesOnScrollbar\", function(query, caseFold, options) {\n if (typeof options == \"string\") options = {className: options};\n if (!options) options = {};\n return new SearchAnnotation(this, query, caseFold, options);\n });\n\n function SearchAnnotation(cm, query, caseFold, options) {\n this.cm = cm;\n this.options = options;\n var annotateOptions = {listenForChanges: false};\n for (var prop in options) annotateOptions[prop] = options[prop];\n if (!annotateOptions.className) annotateOptions.className = \"CodeMirror-search-match\";\n this.annotation = cm.annotateScrollbar(annotateOptions);\n this.query = query;\n this.caseFold = caseFold;\n this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};\n this.matches = [];\n this.update = null;\n\n this.findMatches();\n this.annotation.update(this.matches);\n\n var self = this;\n cm.on(\"change\", this.changeHandler = function(_cm, change) { self.onChange(change); });\n }\n\n var MAX_MATCHES = 1000;\n\n SearchAnnotation.prototype.findMatches = function() {\n if (!this.gap) return;\n for (var i = 0; i < this.matches.length; i++) {\n var match = this.matches[i];\n if (match.from.line >= this.gap.to) break;\n if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);\n }\n var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), {caseFold: this.caseFold, multiline: this.options.multiline});\n var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;\n while (cursor.findNext()) {\n var match = {from: cursor.from(), to: cursor.to()};\n if (match.from.line >= this.gap.to) break;\n this.matches.splice(i++, 0, match);\n if (this.matches.length > maxMatches) break;\n }\n this.gap = null;\n };\n\n function offsetLine(line, changeStart, sizeChange) {\n if (line <= changeStart) return line;\n return Math.max(changeStart, line + sizeChange);\n }\n\n SearchAnnotation.prototype.onChange = function(change) {\n var startLine = change.from.line;\n var endLine = CodeMirror.changeEnd(change).line;\n var sizeChange = endLine - change.to.line;\n if (this.gap) {\n this.gap.from = Math.min(offsetLine(this.gap.from, startLine, sizeChange), change.from.line);\n this.gap.to = Math.max(offsetLine(this.gap.to, startLine, sizeChange), change.from.line);\n } else {\n this.gap = {from: change.from.line, to: endLine + 1};\n }\n\n if (sizeChange) for (var i = 0; i < this.matches.length; i++) {\n var match = this.matches[i];\n var newFrom = offsetLine(match.from.line, startLine, sizeChange);\n if (newFrom != match.from.line) match.from = CodeMirror.Pos(newFrom, match.from.ch);\n var newTo = offsetLine(match.to.line, startLine, sizeChange);\n if (newTo != match.to.line) match.to = CodeMirror.Pos(newTo, match.to.ch);\n }\n clearTimeout(this.update);\n var self = this;\n this.update = setTimeout(function() { self.updateAfterChange(); }, 250);\n };\n\n SearchAnnotation.prototype.updateAfterChange = function() {\n this.findMatches();\n this.annotation.update(this.matches);\n };\n\n SearchAnnotation.prototype.clear = function() {\n this.cm.off(\"change\", this.changeHandler);\n this.annotation.clear();\n };\n});\n","var $ = require('../internals/export');\nvar isArray = require('../internals/is-array');\n\n// `Array.isArray` method\n// https://tc39.es/ecma262/#sec-array.isarray\n$({ target: 'Array', stat: true }, {\n isArray: isArray\n});\n","require('../../modules/es.array.is-array');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Array.isArray;\n","var parent = require('../../es/array/is-array');\n\nmodule.exports = parent;\n","var parent = require('../../stable/array/is-array');\n\nmodule.exports = parent;\n","var parent = require('../../actual/array/is-array');\n\nmodule.exports = parent;\n","module.exports = require('../../full/array/is-array');\n","module.exports = require(\"core-js-pure/features/array/is-array\");","var _Array$isArray = require(\"@babel/runtime-corejs3/core-js/array/is-array\");\n\nfunction _arrayWithHoles(arr) {\n if (_Array$isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","require('../modules/es.array.iterator');\nrequire('../modules/es.string.iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\n\nmodule.exports = getIteratorMethod;\n","var parent = require('../es/get-iterator-method');\nrequire('../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","var parent = require('../stable/get-iterator-method');\n\nmodule.exports = parent;\n","var parent = require('../actual/get-iterator-method');\n\nmodule.exports = parent;\n","module.exports = require('../full/get-iterator-method');\n","module.exports = require(\"core-js-pure/features/get-iterator-method\");","var _Symbol = require(\"@babel/runtime-corejs3/core-js/symbol\");\n\nvar _getIteratorMethod = require(\"@babel/runtime-corejs3/core-js/get-iterator-method\");\n\nfunction _iterableToArrayLimit(arr, i) {\n var _i = arr == null ? null : typeof _Symbol !== \"undefined\" && _getIteratorMethod(arr) || arr[\"@@iterator\"];\n\n if (_i == null) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n\n var _s, _e;\n\n try {\n for (_i = _i.call(arr); !(_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\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar isArray = require('../internals/is-array');\nvar isConstructor = require('../internals/is-constructor');\nvar isObject = require('../internals/is-object');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar createProperty = require('../internals/create-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\nvar un$Slice = require('../internals/array-slice');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');\n\nvar SPECIES = wellKnownSymbol('species');\nvar Array = global.Array;\nvar max = Math.max;\n\n// `Array.prototype.slice` method\n// https://tc39.es/ecma262/#sec-array.prototype.slice\n// fallback for not array-like ES3 strings and DOM objects\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n slice: function slice(start, end) {\n var O = toIndexedObject(this);\n var length = lengthOfArrayLike(O);\n var k = toAbsoluteIndex(start, length);\n var fin = toAbsoluteIndex(end === undefined ? length : end, length);\n // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible\n var Constructor, result, n;\n if (isArray(O)) {\n Constructor = O.constructor;\n // cross-realm fallback\n if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) {\n Constructor = undefined;\n } else if (isObject(Constructor)) {\n Constructor = Constructor[SPECIES];\n if (Constructor === null) Constructor = undefined;\n }\n if (Constructor === Array || Constructor === undefined) {\n return un$Slice(O, k, fin);\n }\n }\n result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));\n for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);\n result.length = n;\n return result;\n }\n});\n","require('../../../modules/es.array.slice');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').slice;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/slice');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.slice;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.slice) ? method : own;\n};\n","var parent = require('../../es/instance/slice');\n\nmodule.exports = parent;\n","var parent = require('../../stable/instance/slice');\n\nmodule.exports = parent;\n","var parent = require('../../actual/instance/slice');\n\nmodule.exports = parent;\n","module.exports = require('../../full/instance/slice');\n","module.exports = require(\"core-js-pure/features/instance/slice\");","var parent = require('../../stable/array/from');\n\nmodule.exports = parent;\n","var parent = require('../../actual/array/from');\n\nmodule.exports = parent;\n","module.exports = require('../../full/array/from');\n","module.exports = require(\"core-js-pure/features/array/from\");","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _sliceInstanceProperty = require(\"@babel/runtime-corejs3/core-js/instance/slice\");\n\nvar _Array$from = require(\"@babel/runtime-corejs3/core-js/array/from\");\n\nvar arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n var _context;\n\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n\n var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);\n\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return _Array$from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _nonIterableRest() {\n 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}\n\nmodule.exports = _nonIterableRest, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayWithHoles = require(\"./arrayWithHoles.js\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableRest = require(\"./nonIterableRest.js\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","module.exports = require(\"core-js-pure/stable/instance/index-of\");","module.exports = require(\"core-js-pure/stable/object/create\");","module.exports = require(\"core-js-pure/stable/instance/slice\");","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar trim = require('../internals/string-trim').trim;\nvar whitespaces = require('../internals/whitespaces');\n\nvar $parseInt = global.parseInt;\nvar Symbol = global.Symbol;\nvar ITERATOR = Symbol && Symbol.iterator;\nvar hex = /^[+-]?0x/i;\nvar exec = uncurryThis(hex.exec);\nvar FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22\n // MS Edge 18- broken with boxed symbols\n || (ITERATOR && !fails(function () { $parseInt(Object(ITERATOR)); }));\n\n// `parseInt` method\n// https://tc39.es/ecma262/#sec-parseint-string-radix\nmodule.exports = FORCED ? function parseInt(string, radix) {\n var S = trim(toString(string));\n return $parseInt(S, (radix >>> 0) || (exec(hex, S) ? 16 : 10));\n} : $parseInt;\n","var $ = require('../internals/export');\nvar $parseInt = require('../internals/number-parse-int');\n\n// `parseInt` method\n// https://tc39.es/ecma262/#sec-parseint-string-radix\n$({ global: true, forced: parseInt != $parseInt }, {\n parseInt: $parseInt\n});\n","require('../modules/es.parse-int');\nvar path = require('../internals/path');\n\nmodule.exports = path.parseInt;\n","var parent = require('../es/parse-int');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/parse-int\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// @ts-nocheck\n/**\n * 将html内容转换成md内容的工具\n * 调用方式为:htmlParser.run(htmlStr)\n * 主要流程为:\n * 1、接收html字符串\n * 2、根据html字符串生成html语法树\n * 3、递归遍历语法树,将标签替换为对应的markdown语法\n **/\nconst htmlParser = {\n /**\n * 入口函数,负责将传入的html字符串转成对应的markdown源码\n * @param {string} htmlStr\n * @returns {string} 对应的markdown源码\n */\n run(htmlStr) {\n let $htmlStr = `
${htmlStr}
`;\n // 挂载对应的格式化引擎,这里挂载的是markdown逆向引擎,后续可以扩展支持其他标记语言\n this.tagParser.formatEngine = this.mdFormatEngine;\n // 去掉注释\n $htmlStr = $htmlStr.replace(//g, '');\n // 将html字符串解析成html语法树\n let htmlparsedArrays = this.htmlParser.parseHtml($htmlStr);\n // 预处理,去掉一些不需要的样式、属性\n htmlparsedArrays = this.paragraphStyleClear(htmlparsedArrays);\n // 核心逻辑,遍历html语法树,生成对应的markdown源码\n return this.$dealHtml(htmlparsedArrays)\n .replace(/\\n{3,}/g, '\\n\\n\\n')\n .replace(/>/g, '>')\n .replace(/</g, '<')\n .replace(/&/g, '&')\n .trim('\\n');\n },\n /**\n * 解析html语法树\n * @param {Array} arr\n * @returns {string} 对应的markdown源码\n */\n $dealHtml(arr) {\n let ret = '';\n for (let i = 0; i < arr.length; i++) {\n const temObj = arr[i];\n if (temObj.type === 'tag') ret = this.$handleTagObject(temObj, ret);\n else if (temObj.type === 'text' && temObj.content.length > 0) {\n ret += temObj.content\n .replace(/ /g, ' ')\n .replace(/[\\n]+/g, '\\n')\n .replace(/^[ \\t\\n]+\\n\\s*$/, '\\n');\n }\n }\n return ret;\n },\n /**\n * 处理html标签内容\n * @param {object} temObj\n * @param {string} returnString\n */\n $handleTagObject(temObj, returnString) {\n let ret = returnString;\n if (temObj.attrs.class && /(ch-icon-square|ch-icon-check)/.test(temObj.attrs.class)) {\n // 针对checklist\n if (temObj.attrs.class.indexOf('ch-icon-check') >= 0) {\n ret += '[x]';\n } else {\n ret += '[ ]';\n }\n } else if (temObj.attrs.class && /cherry-code-preview-lang-select/.test(temObj.attrs.class)) {\n // 如果是代码块的选择语言标签,则不做任何处理\n ret += '';\n } else {\n // 如果是标签\n ret += this.$dealTag(temObj);\n }\n return ret;\n },\n /**\n * 解析具体的html标签\n * @param {HTMLElement} obj\n * @returns {string} 对应的markdown源码\n */\n $dealTag(obj) {\n const self = this;\n let tmpText = '';\n if (obj.children) {\n // 递归每一个子元素\n tmpText = self.$dealHtml(obj.children);\n }\n if (obj.name === 'style') {\n // 不解析样式属性,只处理行内样式\n return '';\n }\n if (obj.name === 'code' || obj.name === 'pre') {\n // 解析代码块 或 行内代码\n // pre时,强制转成代码块\n return self.tagParser.codeParser(obj, self.$dealCodeTag(obj), obj.name === 'pre');\n }\n if (typeof self.tagParser[`${obj.name}Parser`] === 'function') {\n // 解析对应的具体标签\n return self.tagParser[`${obj.name}Parser`](obj, tmpText);\n }\n return tmpText;\n },\n /**\n * 解析代码块\n * 本函数认为代码块是由text标签和li标签组成的\n * @param {HTMLElement} obj\n * @returns {string} 对应的markdown源码\n */\n $dealCodeTag(obj) {\n const self = this;\n if (obj.children.length < 0) {\n return '';\n }\n let ret = '';\n for (let i = 0; i < obj.children.length; i++) {\n const temObj = obj.children[i];\n if (temObj.type !== 'text') {\n // 如果是非text标签,则需要处理换行逻辑\n if (temObj.name === 'li') {\n ret += '\\n';\n }\n if (temObj.name === 'br') {\n ret += '\\n';\n }\n // 递归找到对应的代码文本\n ret += self.$dealCodeTag(temObj);\n } else {\n ret += temObj.content;\n }\n }\n return ret;\n },\n\n /** **\n * html解析器\n * 将html解析成对象数组\n * https://github.com/HenrikJoreteg/html-parse-stringify\n **/\n htmlParser: {\n attrRE: /([\\w-]+)|['\"]{1}([^'\"]*)['\"]{1}/g,\n lookup: {\n area: true,\n base: true,\n br: true,\n col: true,\n embed: true,\n hr: true,\n img: true,\n video: true,\n input: true,\n keygen: true,\n link: true,\n menuitem: true,\n meta: true,\n param: true,\n source: true,\n track: true,\n wbr: true,\n },\n tagRE: /<(?:\"[^\"]*\"['\"]*|'[^']*'['\"]*|[^'\">])+>/g,\n empty: Object.create ? Object.create(null) : {},\n parseTags(tag) {\n const self = this;\n let i = 0;\n let key;\n const res = {\n type: 'tag',\n name: '',\n voidElement: false,\n attrs: {},\n children: [],\n };\n\n tag.replace(this.attrRE, (match) => {\n if (i % 2) {\n key = match;\n } else {\n if (i === 0) {\n if (self.lookup[match] || tag.charAt(tag.length - 2) === '/') {\n res.voidElement = true;\n }\n res.name = match;\n } else {\n res.attrs[key] = match.replace(/['\"]/g, '');\n }\n }\n i += 1;\n });\n\n return res;\n },\n parseHtml(html, options) {\n const self = this;\n const $options = options || {};\n $options.components || ($options.components = this.empty);\n const result = [];\n let current;\n let level = -1;\n const arr = [];\n const byTag = {};\n let inComponent = false;\n\n html.replace(this.tagRE, (tag, index) => {\n if (inComponent) {\n if (tag !== ``) {\n return;\n }\n inComponent = false;\n }\n const isOpen = tag.charAt(1) !== '/';\n const start = index + tag.length;\n const nextChar = html.charAt(start);\n let parent;\n\n if (isOpen) {\n level += 1;\n\n current = self.parseTags(tag);\n if (current.type === 'tag' && $options.components[current.name]) {\n current.type = 'component';\n inComponent = true;\n }\n\n if (!current.voidElement && !inComponent && nextChar && nextChar !== '<') {\n current.children.push({\n type: 'text',\n content: html.slice(start, html.indexOf('<', start)),\n });\n }\n\n byTag[current.tagName] = current;\n\n // if we're at root, push new base node\n if (level === 0) {\n result.push(current);\n }\n\n parent = arr[level - 1];\n\n if (parent) {\n parent.children.push(current);\n }\n\n arr[level] = current;\n }\n\n if (!isOpen || current.voidElement) {\n level -= 1;\n if (!inComponent && nextChar !== '<' && nextChar) {\n // trailing text node\n if (arr[level]) {\n arr[level].children.push({\n type: 'text',\n content: html.slice(start, html.indexOf('<', start)),\n });\n }\n }\n }\n });\n return result;\n },\n },\n\n /** **\n * 标签解析器\n * 解析对应的标签,并调用格式化引擎生成对应格式内容\n **/\n tagParser: {\n // 挂载的解析引擎,一次只能挂在一个解析引擎,目前只实现和挂载了markdown解析引擎\n formatEngine: {},\n /**\n * 解析p标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n pParser(obj, str) {\n const $str = str;\n if (/\\n$/.test($str)) {\n return $str;\n }\n return `${$str}\\n`;\n },\n /**\n * 解析div标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n divParser(obj, str) {\n const $str = str;\n if (/\\n$/.test($str)) {\n return $str;\n }\n return `${$str}\\n`;\n },\n /**\n * 解析span标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n spanParser(obj, str) {\n const $str = str.replace(/\\t/g, '').replace(/\\n/g, ' '); // span标签里不应该有\\n的,有的话就转化成空格\n if (obj.attrs && obj.attrs.style) {\n // 先屏蔽字体颜色、字体大小、字体背景色的转义逻辑\n // let color = this.styleParser.colorAttrParser(obj.attrs.style);\n // let size = this.styleParser.sizeAttrParser(obj.attrs.style);\n // bgcolor = this.styleParser.bgColorAttrParser(obj.attrs.style);\n // str = this.formatEngine.convertColor(str, color);\n // str = this.formatEngine.convertSize(str, size);\n // str = this.formatEngine.convertBgColor(str, bgcolor);\n // return str;\n }\n return $str;\n },\n /**\n * 解析code标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @param {boolean} isBlock 是否强制为代码块\n * @returns {string} str\n */\n codeParser(obj, str, isBlock = false) {\n return this.formatEngine.convertCode(str, isBlock);\n },\n /**\n * 解析br标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n brParser(obj, str) {\n return this.formatEngine.convertBr(str, '\\n');\n },\n /**\n * 解析img标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n imgParser(obj, str) {\n if (obj.attrs && obj.attrs['data-control'] === 'tapd-graph') {\n return this.formatEngine.convertGraph(obj.attrs.title, obj.attrs.src, obj.attrs['data-origin-xml'], obj);\n }\n if (obj.attrs && obj.attrs.src) {\n return this.formatEngine.convertImg(obj.attrs.alt, obj.attrs.src);\n }\n },\n /**\n * 解析video标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n videoParser(obj, str) {\n if (obj.attrs && obj.attrs.src) {\n return this.formatEngine.convertVideo(str, obj.attrs.src, obj.attrs.poster, obj.attrs.title);\n }\n },\n /**\n * 解析b标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n bParser(obj, str) {\n const strArr = str.split('\\n');\n const ret = [];\n for (let i = 0; i < strArr.length; i++) {\n ret.push(this.formatEngine.convertB(strArr[i]));\n }\n return ret.join('\\n');\n },\n /**\n * 解析i标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n iParser(obj, str) {\n const strArr = str.split('\\n');\n const ret = [];\n for (let i = 0; i < strArr.length; i++) {\n ret.push(this.formatEngine.convertI(strArr[i]));\n }\n return ret.join('\\n');\n },\n /**\n * 解析strike标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n strikeParser(obj, str) {\n const strArr = str.split('\\n');\n const ret = [];\n for (let i = 0; i < strArr.length; i++) {\n ret.push(this.formatEngine.convertStrike(strArr[i]));\n }\n return ret.join('\\n');\n },\n /**\n * 解析del标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n delParser(obj, str) {\n const strArr = str.split('\\n');\n const ret = [];\n for (let i = 0; i < strArr.length; i++) {\n ret.push(this.formatEngine.convertDel(strArr[i]));\n }\n return ret.join('\\n');\n },\n /**\n * 解析u标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n uParser(obj, str) {\n const strArr = str.split('\\n');\n const ret = [];\n for (let i = 0; i < strArr.length; i++) {\n ret.push(this.formatEngine.convertU(strArr[i]));\n }\n return ret.join('\\n');\n },\n /**\n * 解析a标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n aParser(obj, str) {\n if (obj.attrs && obj.attrs.href) {\n return this.formatEngine.convertA(str, obj.attrs.href);\n }\n return '';\n },\n /**\n * 解析sup标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n supParser(obj, str) {\n return this.formatEngine.convertSup(str);\n },\n /**\n * 解析sub标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n subParser(obj, str) {\n return this.formatEngine.convertSub(str);\n },\n /**\n * 解析td标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n tdParser(obj, str) {\n return this.formatEngine.convertTd(str);\n },\n /**\n * 解析tr标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n trParser(obj, str) {\n return this.formatEngine.convertTr(str);\n },\n /**\n * 解析th标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n thParser(obj, str) {\n return this.formatEngine.convertTh(str);\n },\n /**\n * 解析thead标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n theadParser(obj, str) {\n return this.formatEngine.convertThead(str);\n },\n /**\n * 解析table标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n tableParser(obj, str) {\n return this.formatEngine.convertTable(str);\n },\n /**\n * 解析li标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n liParser(obj, str) {\n return this.formatEngine.convertLi(str);\n },\n /**\n * 解析ul标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n ulParser(obj, str) {\n return this.formatEngine.convertUl(str);\n },\n /**\n * 解析ol标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n olParser(obj, str) {\n return this.formatEngine.convertOl(str);\n },\n /**\n * 解析strong标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n strongParser(obj, str) {\n return this.formatEngine.convertStrong(str);\n },\n /**\n * 解析hr标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n hrParser(obj, str) {\n return this.formatEngine.convertHr(str);\n },\n /**\n * 解析h1标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h1Parser(obj, str) {\n return this.formatEngine.convertH1(str);\n },\n /**\n * 解析h2标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h2Parser(obj, str) {\n return this.formatEngine.convertH2(str);\n },\n /**\n * 解析h3标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h3Parser(obj, str) {\n return this.formatEngine.convertH3(str);\n },\n /**\n * 解析h4标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h4Parser(obj, str) {\n return this.formatEngine.convertH4(str);\n },\n /**\n * 解析h5标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h5Parser(obj, str) {\n return this.formatEngine.convertH5(str);\n },\n /**\n * 解析h6标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n h6Parser(obj, str) {\n return this.formatEngine.convertH6(str);\n },\n /**\n * 解析blockquote标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n blockquoteParser(obj, str) {\n return this.formatEngine.convertBlockquote(str.replace(/\\n+/g, '\\n'));\n },\n /**\n * 解析address标签\n * @param {HTMLElement} obj\n * @param {string} str 需要回填的字符串\n * @returns {string} str\n */\n addressParser(obj, str) {\n return this.formatEngine.convertAddress(str.replace(/\\n+/g, '\\n'));\n },\n // 样式解析器\n styleParser: {\n // 识别字体颜色 color\n colorAttrParser(style) {\n const color = style.match(/color:\\s*(#[a-zA-Z0-9]{3,6});/);\n if (color && color[1]) {\n return color[1];\n }\n return '';\n },\n // 识别字体大小 font-size\n sizeAttrParser(style) {\n const fontSize = style.match(/font-size:\\s*([a-zA-Z0-9-]+?);/);\n if (fontSize && fontSize[1]) {\n let size = 0;\n if (/[0-9]+px/.test(fontSize[1])) {\n size = fontSize[1].replace(/px/, '').trim();\n } else {\n switch (fontSize[1]) {\n case 'x-small':\n size = 10;\n break;\n case 'small':\n size = 12;\n break;\n case 'medium':\n size = 16;\n break;\n case 'large':\n size = 18;\n break;\n case 'x-large':\n size = 24;\n break;\n case 'xx-large':\n size = 32;\n break;\n default:\n size = '';\n }\n }\n return size > 0 ? size : '';\n }\n return '';\n },\n // 识别字体背景颜色 background-color\n bgColorAttrParser(style) {\n const color = style.match(/background-color:\\s*([^;]+?);/);\n if (color && color[1]) {\n let bgColor = '';\n if (/rgb\\([ 0-9]+,[ 0-9]+,[ 0-9]+\\)/.test(color[1])) {\n const values = color[1].match(/rgb\\(([ 0-9]+),([ 0-9]+),([ 0-9]+)\\)/);\n if (values[1] && values[2] && values[3]) {\n values[1] = parseInt(values[1].trim(), 10);\n values[2] = parseInt(values[2].trim(), 10);\n values[3] = parseInt(values[3].trim(), 10);\n bgColor = `#${values[1].toString(16)}${values[2].toString(16)}${values[3].toString(16)}`;\n }\n } else {\n [, bgColor] = color;\n }\n return bgColor;\n }\n return '';\n },\n },\n },\n\n /**\n * 一个格式化引擎\n * 将字符串格式化成markdown语法的引擎\n **/\n mdFormatEngine: {\n convertColor(str, attr) {\n const $str = str.trim();\n if (!$str || /\\n/.test($str)) {\n return $str;\n }\n return attr ? `!!${attr} ${$str}!!` : $str;\n },\n convertSize(str, attr) {\n const $str = str.trim();\n if (!$str || /\\n/.test($str)) {\n return $str;\n }\n return attr ? `!${attr} ${$str}!` : $str;\n },\n convertBgColor(str, attr) {\n const $str = str.trim();\n if (!$str || /\\n/.test($str)) {\n return $str;\n }\n return attr ? `!!!${attr} ${$str}!!!` : $str;\n },\n convertBr(str, attr) {\n return str + attr;\n },\n convertCode(str, isBlock = false) {\n if (/\\n/.test(str) || isBlock) {\n return `\\`\\`\\`\\n${str.replace(/\\n+$/, '')}\\n\\`\\`\\``;\n }\n return `\\`${str.replace(/`/g, '\\\\`')}\\``;\n },\n convertB(str) {\n return /^\\s*$/.test(str) ? '' : `**${str}**`;\n },\n convertI(str) {\n return /^\\s*$/.test(str) ? '' : `*${str}*`;\n },\n convertU(str) {\n return /^\\s*$/.test(str) ? '' : ` /${str}/ `;\n },\n convertImg(alt, src) {\n const $alt = alt && alt.length > 0 ? alt : 'image';\n return `![${$alt}](${src})`;\n },\n convertGraph(str, attr, data, obj) {\n const $str = str && str.length > 0 ? str : 'graph';\n let moreAttrs = '';\n if (obj) {\n try {\n const { attrs } = obj;\n Object.keys(attrs).forEach((prop) => {\n if (Object.prototype.hasOwnProperty.call(attrs, prop)) {\n if (prop.indexOf('data-graph-') >= 0 && attrs[prop]) {\n moreAttrs += ` ${prop}=${attrs[prop]}`;\n }\n }\n });\n } catch (error) {\n // console.log('error', error)\n }\n }\n return `![${$str}](${attr}){data-control=tapd-graph data-origin-xml=${data}${moreAttrs}}`;\n },\n convertVideo(str, src, poster, title) {\n const $title = title && title.length > 0 ? title : 'video';\n return `!video[${$title}](${src}){poster=${poster}}`;\n },\n convertA(str, attr) {\n if (str === attr) {\n return `${str} `;\n }\n const $str = str.trim();\n if (!$str) {\n return $str;\n }\n return `[${$str}](${attr})`;\n },\n convertSup(str) {\n return `^${str.trim().replace(/\\^/g, '\\\\^')}^`;\n },\n convertSub(str) {\n return `^^${str.trim().replace(/\\^\\^/g, '\\\\^\\\\^')}^^`;\n },\n convertTd(str) {\n return `~|${str.trim().replace(/\\n{1,}/g, '
')} ~|`;\n },\n convertTh(str) {\n return `~|${str.trim().replace(/\\n{1,}/g, '
')} ~|`;\n },\n convertTr(str) {\n return `${str.replace(/\\n/g, '')}\\n`;\n },\n convertThead(str) {\n return `${str.replace(/~\\|~\\|/g, '~|').replace(/~\\|/g, '|')}|:--|\\n`;\n },\n convertTable(str) {\n const ret = `\\n${str.replace(/~\\|~\\|/g, '~|').replace(/~\\|/g, '|')}\\n`.replace(/\\n{2,}/g, '\\n');\n if (/\\|:--\\|/.test(ret)) {\n return ret;\n }\n return `\\n| |\\n|:--|${ret}`;\n },\n convertLi(str) {\n return `- ${str.replace(/^\\n/, '').replace(/\\n+$/, '').replace(/\\n+/g, '\\n\\t')}\\n`;\n },\n convertUl(str) {\n return `${str}\\n`;\n },\n convertOl(str) {\n const arr = str.split('\\n');\n let index = 1;\n for (let i = 0; i < arr.length; i++) {\n if (/^- /.test(arr[i])) {\n arr[i] = arr[i].replace(/^- /, `${index}. `);\n index += 1;\n }\n }\n const $str = arr.join('\\n');\n return `${$str}\\n`;\n },\n convertStrong(str) {\n return /^\\s*$/.test(str) ? '' : `**${str}**`;\n },\n convertStrike(str) {\n return /^\\s*$/.test(str) ? '' : `~~${str}~~`;\n },\n convertDel(str) {\n return /^\\s*$/.test(str) ? '' : `~~${str}~~`;\n },\n convertHr(str) {\n return /^\\s*$/.test(str) ? '\\n\\n----\\n' : `\\n\\n----\\n${str}`;\n },\n convertH1(str) {\n return `# ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertH2(str) {\n return `## ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertH3(str) {\n return `### ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertH4(str) {\n return `#### ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertH5(str) {\n return `##### ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertH6(str) {\n return `###### ${str.trim().replace(/\\n+$/, '')}\\n\\n`;\n },\n convertBlockquote(str) {\n return `>${str.trim()}\\n\\n`;\n },\n convertAddress(str) {\n return `>${str.trim()}\\n\\n`;\n },\n },\n /**\n * 清除整段的样式、方便编辑\n * 暂时先屏蔽字体色和背景色\n * @param {Array} htmlparsedArrays 由HTMLElement组成的数组\n */\n paragraphStyleClear(htmlparsedArrays) {\n for (let index = 0; index < htmlparsedArrays[0].children.length; index++) {\n const htmlItem = htmlparsedArrays[0].children[index];\n const stack = [htmlItem];\n let paragraphs = [];\n while (stack.length) {\n const temp = stack.shift();\n const childCount = this.notEmptyTagCount(temp);\n if (childCount === 1) {\n paragraphs.push(temp);\n } else if (childCount > 1) {\n for (let k = 0; k < temp.children.length; k++) {\n stack.push(temp.children[k]);\n }\n } else {\n if (paragraphs.length === 1) {\n this.clearChildColorAttrs(paragraphs.pop());\n }\n paragraphs = [];\n }\n }\n if (paragraphs.length === 1) {\n this.clearChildColorAttrs(paragraphs.pop());\n }\n }\n\n return htmlparsedArrays;\n },\n /**\n * 非空子元素数量\n */\n notEmptyTagCount(htmlItem) {\n if (\n !htmlItem ||\n htmlItem.voidElement ||\n (htmlItem.type === 'tag' && !htmlItem.children.length) ||\n (htmlItem.type === 'text' && !htmlItem.content.replace(/(\\r|\\n|\\s)+/g, ''))\n ) {\n return 0;\n }\n\n if (htmlItem.children && htmlItem.children.length) {\n let res = 0;\n for (let index = 0; index < htmlItem.children.length; index++) {\n res += this.notEmptyTagCount(htmlItem.children[index]);\n }\n return res;\n }\n return 1;\n },\n clearChildColorAttrs(htmlItems) {\n const self = this;\n this.forEachHtmlParsedItems(htmlItems, (htmlItem) => {\n self.clearSelfNodeColorAttrs(htmlItem);\n });\n },\n clearSelfNodeColorAttrs(htmlItem) {\n if (htmlItem.attrs && htmlItem.attrs.style) {\n const styles = htmlItem.attrs.style.split(';');\n const newStyles = [];\n for (let index = 0; index < styles.length; index++) {\n if (styles[index] && styles[index].indexOf('color') === -1) {\n newStyles.push(styles[index]);\n }\n }\n if (newStyles.length) {\n htmlItem.attrs.style = `${newStyles.join(';')};`;\n } else {\n delete htmlItem.attrs.style;\n }\n }\n },\n forEachHtmlParsedItems(htmlItems, cb) {\n if (htmlItems) {\n cb(htmlItems);\n if (htmlItems.children && htmlItems.children.length) {\n for (let index = 0; index < htmlItems.children.length; index++) {\n this.forEachHtmlParsedItems(htmlItems.children[index], cb);\n }\n }\n }\n },\n};\n\nexport default htmlParser;\n","var parent = require('../../stable/object/assign');\n\nmodule.exports = parent;\n","var parent = require('../../actual/object/assign');\n\nmodule.exports = parent;\n","module.exports = require('../../full/object/assign');\n","module.exports = require(\"core-js-pure/features/object/assign\");","var _Object$assign = require(\"@babel/runtime-corejs3/core-js/object/assign\");\n\nfunction _extends() {\n module.exports = _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 }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _extends.apply(this, arguments);\n}\n\nmodule.exports = _extends, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var global = require('../internals/global');\nvar fails = require('../internals/fails');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toString = require('../internals/to-string');\nvar trim = require('../internals/string-trim').trim;\nvar whitespaces = require('../internals/whitespaces');\n\nvar charAt = uncurryThis(''.charAt);\nvar n$ParseFloat = global.parseFloat;\nvar Symbol = global.Symbol;\nvar ITERATOR = Symbol && Symbol.iterator;\nvar FORCED = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity\n // MS Edge 18- broken with boxed symbols\n || (ITERATOR && !fails(function () { n$ParseFloat(Object(ITERATOR)); }));\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\nmodule.exports = FORCED ? function parseFloat(string) {\n var trimmedString = trim(toString(string));\n var result = n$ParseFloat(trimmedString);\n return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result;\n} : n$ParseFloat;\n","var $ = require('../internals/export');\nvar $parseFloat = require('../internals/number-parse-float');\n\n// `parseFloat` method\n// https://tc39.es/ecma262/#sec-parsefloat-string\n$({ global: true, forced: parseFloat != $parseFloat }, {\n parseFloat: $parseFloat\n});\n","require('../modules/es.parse-float');\nvar path = require('../internals/path');\n\nmodule.exports = path.parseFloat;\n","var parent = require('../es/parse-float');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/parse-float\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction mergeMarginBottom(bottom, top) {\n const currentBottom = parseFloat(bottom);\n const nextTop = parseFloat(top);\n if (nextTop >= 0) {\n // 不受合并影响\n return currentBottom;\n }\n if (currentBottom >= 0) {\n return currentBottom + nextTop;\n }\n // 同时为负数,取最小的\n return Math.min(currentBottom, nextTop);\n}\n\nfunction mergeMarginTop(bottom, top) {\n const prevBottom = parseFloat(bottom);\n const currentTop = parseFloat(top);\n if (currentTop < 0) {\n // 负数的margin都被上一个区块吸收了\n return 0;\n }\n if (prevBottom >= 0) {\n // 如果当前margin-top比上一个margin-bottom要大,则只合并部分;反之合并全部,归属于上一个区块\n return Math.max(currentTop - prevBottom, 0);\n }\n // 上一个margin-bottom为负数不受影响\n return currentTop;\n}\n/**\n * 用于解决块级元素边距合并问题\n * @param {HTMLElement} element\n */\nexport function getBlockTopAndHeightWithMargin(element) {\n const prevSibling = element.previousElementSibling;\n const nextSibling = element.nextElementSibling;\n if (!prevSibling) {\n const style = getComputedStyle(element);\n const rect = element.getBoundingClientRect();\n if (!nextSibling) {\n return {\n // marginBottom可能为负数\n height: Math.max(parseFloat(style.marginTop) + rect.height + parseFloat(style.marginBottom), 0),\n offsetTop: element.offsetTop - Math.abs(parseFloat(style.marginTop)),\n };\n }\n const nextSibStyle = getComputedStyle(nextSibling);\n const marginBottom = mergeMarginBottom(style.marginBottom, nextSibStyle.marginTop);\n return {\n height: Math.max(parseFloat(style.marginTop) + rect.height + marginBottom, 0), // marginBottom可能为负数\n offsetTop: element.offsetTop - Math.abs(parseFloat(style.marginTop)),\n };\n }\n const style = getComputedStyle(element);\n const rect = element.getBoundingClientRect();\n const prevSibStyle = getComputedStyle(prevSibling);\n const marginTop = mergeMarginTop(prevSibStyle.marginBottom, style.marginTop);\n if (!nextSibling) {\n return {\n height: Math.max(marginTop + rect.height + parseFloat(style.marginBottom), 0), // marginBottom可能为负数\n offsetTop: element.offsetTop - Math.abs(parseFloat(style.marginTop)),\n };\n }\n const nextSibStyle = getComputedStyle(nextSibling);\n const marginBottom = mergeMarginBottom(style.marginBottom, nextSibStyle.marginTop);\n return {\n height: Math.max(marginTop + rect.height + marginBottom, 0), // marginBottom可能为负数\n offsetTop: element.offsetTop - Math.abs(marginTop),\n };\n}\n\n/**\n * document.elementsFromPoint polyfill\n * ref: https://github.com/JSmith01/elementsfrompoint-polyfill/blob/master/index.js\n * @param {number} x\n * @param {number} y\n */\nexport function elementsFromPoint(x, y) {\n // see https://caniuse.com/#search=elementsFromPoint\n if (typeof document.elementsFromPoint === 'function') {\n return document.elementsFromPoint(x, y);\n }\n\n if (typeof (/** @type {any}*/ (document).msElementsFromPoint) === 'function') {\n const nodeList = /** @type {any}*/ (document).msElementsFromPoint(x, y);\n return nodeList !== null ? Array.from(nodeList) : nodeList;\n }\n const elements = [];\n const pointerEvents = [];\n /** @type {HTMLElement} */\n let ele;\n do {\n const currentElement = /** @type {HTMLElement} */ (document.elementFromPoint(x, y));\n if (ele !== currentElement) {\n ele = currentElement;\n elements.push(ele);\n pointerEvents.push(ele.style.pointerEvents);\n ele.style.pointerEvents = 'none';\n } else {\n ele = null;\n }\n } while (ele);\n elements.forEach((e, index) => {\n e.style.pointerEvents = pointerEvents[index];\n });\n return elements;\n}\n\nexport function getHTML(who, deep) {\n if (!who || !who.tagName) {\n return '';\n }\n let txt;\n let ax;\n let el = document.createElement('div');\n el.appendChild(who.cloneNode(false));\n txt = el.innerHTML;\n if (deep) {\n ax = txt.indexOf('>') + 1;\n txt = txt.substring(0, ax) + who.innerHTML + txt.substring(ax);\n }\n el = null;\n return txt;\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} tagName 标签名\n * @param {string} className 元素类名\n * @param {Record} attributes 附加属性\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function createElement(tagName, className = '', attributes = {}) {\n const element = document.createElement(tagName);\n element.className = className;\n if (typeof attributes !== 'undefined') {\n Object.keys(attributes).forEach((key) => {\n const value = attributes[key];\n if (key.startsWith('data-')) {\n const dataName = key.replace(/^data-/, '');\n element.dataset[dataName] = value;\n return;\n }\n element.setAttribute(key, value);\n });\n }\n return element;\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createElement } from '@/utils/dom';\n\nconst SAFE_AREA_MARGIN = 15;\n\n/**\n * Cherry实现了将粘贴的html内容转成对应的markdown源码的功能\n * 本工具主要实现将粘贴html转成的markdown源码在编辑器中选中,并给出切换按钮\n * 可以切换为纯文本内容,或者markdown内容\n */\nconst pasteHelper = {\n /**\n * 核心方法,粘贴后展示切换按钮\n * 只有粘贴html时才会出现切换按钮\n * @param {Object} currentCursor 当前的光标位置\n * @param {Object} editor 编辑器对象\n * @param {string} html html里的纯文本内容\n * @param {string} md html对应的markdown源码\n * @returns\n */\n showSwitchBtnAfterPasteHtml($cherry, currentCursor, editor, html, md) {\n if (html.trim() === md.trim()) {\n return;\n }\n this.init($cherry, currentCursor, editor, html, md);\n this.setSelection();\n this.bindListener();\n this.initBubble();\n this.showBubble();\n // 默认粘贴成markdown格式,如果用户上次选择粘贴为纯文本,则需要切换为text\n if (this.getTypeFromLocalStorage() === 'text') {\n this.switchTextClick();\n }\n },\n\n init($cherry, currentCursor, editor, html, md) {\n this.$cherry = $cherry;\n this.html = html;\n this.md = md;\n this.codemirror = editor;\n this.currentCursor = currentCursor;\n this.locale = $cherry.locale;\n },\n\n /**\n * 获取缓存中的复制粘贴类型\n */\n getTypeFromLocalStorage() {\n if (typeof localStorage === 'undefined') {\n return 'md';\n }\n return localStorage.getItem('cherry-paste-type') || 'md';\n },\n\n /**\n * 记忆最近一次用户选择的粘贴类型\n */\n setTypeToLocalStorage(type) {\n if (typeof localStorage === 'undefined') {\n return;\n }\n localStorage.setItem('cherry-paste-type', type);\n },\n\n /**\n * 在编辑器中自动选中刚刚粘贴的内容\n */\n setSelection() {\n const { /* sticky, xRel, */ ...end } = this.codemirror.getCursor();\n const begin = this.currentCursor;\n this.codemirror.setSelection(begin, end);\n },\n /**\n * 绑定事件\n * 当编辑器选中区域改变、内容改变时,隐藏切换按钮\n * 当编辑器滚动时,实时更新切换按钮的位置\n * @returns null\n */\n bindListener() {\n if (!this.hasBindListener) {\n this.hasBindListener = true;\n } else {\n return true;\n }\n this.codemirror.on('beforeSelectionChange', (codemirror, info) => {\n this.hideBubble();\n });\n this.codemirror.on('beforeChange', (codemirror, info) => {\n this.hideBubble();\n });\n this.codemirror.on('scroll', (codemirror) => {\n this.updatePositionWhenScroll();\n });\n },\n\n isHidden() {\n return this.bubbleDom.style.display === 'none';\n },\n\n toggleBubbleDisplay() {\n if (this.isHidden()) {\n this.bubbleDom.style.display = '';\n return;\n }\n this.bubbleDom.style.display = 'none';\n return;\n },\n\n hideBubble() {\n if (this.noHide) {\n return true;\n }\n if (this.isHidden()) {\n return;\n }\n this.toggleBubbleDisplay();\n },\n\n updatePositionWhenScroll() {\n if (this.isHidden()) {\n return;\n }\n // FIXME: update position when stick to the bottom\n // const isStickToBottom = !this.bubbleDom.style.top;\n const offset = this.bubbleDom.dataset.scrollTop - this.getScrollTop();\n this.bubbleDom.style.marginTop = `${offset}px`;\n },\n\n getScrollTop() {\n return this.codemirror.getScrollInfo().top;\n },\n\n showBubble() {\n const { top } = this.getLastSelectedPosition();\n if (this.isHidden()) {\n this.toggleBubbleDisplay();\n this.bubbleDom.style.marginTop = '0';\n this.bubbleDom.dataset.scrollTop = this.getScrollTop();\n }\n /**\n * @type {HTMLDivElement}\n */\n const codemirrorWrapper = this.codemirror.getWrapperElement();\n const maxTop = codemirrorWrapper.clientHeight - this.bubbleDom.getBoundingClientRect().height - SAFE_AREA_MARGIN;\n\n if (top > maxTop) {\n this.bubbleDom.style.top = '';\n this.bubbleDom.style.bottom = `${SAFE_AREA_MARGIN}px`;\n } else {\n this.bubbleDom.style.top = `${top}px`;\n this.bubbleDom.style.bottom = '';\n }\n },\n\n initBubble() {\n if (this.bubbleDom) {\n this.bubbleDom.setAttribute('data-type', 'md');\n return true;\n }\n const dom = createElement('div', 'cherry-bubble cherry-bubble--centered cherry-switch-paste');\n dom.style.display = 'none';\n\n const switchText = createElement('span', 'cherry-toolbar-button cherry-text-btn', {\n title: this.locale.pastePlain,\n });\n switchText.innerText = 'TEXT';\n\n const switchMd = createElement('span', 'cherry-toolbar-button cherry-md-btn', {\n title: this.locale.pasteMarkdown,\n });\n switchMd.innerText = 'Markdown';\n\n const switchBG = createElement('span', 'switch-btn--bg');\n\n this.bubbleDom = dom;\n this.switchText = switchText;\n this.switchMd = switchMd;\n this.switchBG = switchBG;\n this.bubbleDom.appendChild(switchText);\n this.bubbleDom.appendChild(switchMd);\n this.bubbleDom.appendChild(switchBG);\n this.bubbleDom.setAttribute('data-type', 'md');\n this.codemirror.getWrapperElement().appendChild(this.bubbleDom);\n this.switchMd.addEventListener('click', this.switchMDClick.bind(this));\n this.switchText.addEventListener('click', this.switchTextClick.bind(this));\n },\n\n switchMDClick(event) {\n this.setTypeToLocalStorage('md');\n if (this.bubbleDom.getAttribute('data-type') === 'md') {\n return;\n }\n this.noHide = true;\n this.bubbleDom.setAttribute('data-type', 'md');\n this.codemirror.doc.replaceSelection(this.md);\n this.setSelection();\n this.showBubble();\n this.noHide = false;\n },\n switchTextClick(event) {\n this.setTypeToLocalStorage('text');\n if (this.bubbleDom.getAttribute('data-type') === 'text') {\n return;\n }\n this.noHide = true;\n this.bubbleDom.setAttribute('data-type', 'text');\n this.codemirror.doc.replaceSelection(this.html);\n this.setSelection();\n this.showBubble();\n this.noHide = false;\n },\n\n getLastSelectedPosition() {\n const selectedObjs = Array.from(this.codemirror.getWrapperElement().getElementsByClassName('CodeMirror-selected'));\n let width = 0;\n let top = 0;\n if (selectedObjs.length <= 0) {\n this.hideBubble();\n return {};\n }\n // FIXME: remove redundant width calculation\n for (let key = 0; key < selectedObjs.length; key++) {\n const item = selectedObjs[key];\n const position = item.getBoundingClientRect();\n const tmpWidth = position.left + position.width / 2;\n const tmpTop = position.top + position.height;\n if (tmpTop > top && tmpWidth >= width) {\n top = tmpTop;\n }\n if (tmpWidth > width) {\n width = tmpWidth;\n }\n }\n return { top };\n },\n};\n\nexport default pasteHelper;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport function addEvent(elm, evType, fn, useCapture) {\n if (elm.addEventListener) {\n elm.addEventListener(evType, fn, useCapture); // DOM2.0\n return true;\n }\n\n if (elm.attachEvent) {\n const r = elm.attachEvent(`on${evType}`, fn); // IE5+\n return r;\n }\n elm[`on${evType}`] = fn; // DOM 0\n}\n\nexport function removeEvent(elm, evType, fn, useCapture) {\n if (elm.removeEventListener) {\n elm.removeEventListener(evType, fn, useCapture); // DOM2.0\n } else if (elm.detachEvent) {\n const r = elm.detachEvent(`on${evType}`, fn); // IE5+\n return r;\n } else {\n elm[`on${evType}`] = null; // DOM 0\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// @ts-check\n/** @type {Partial} */\nconst Logger = new Proxy(\n {},\n {\n get(target, prop, receiver) {\n // @ts-ignore\n if (BUILD_ENV !== 'production' && typeof console !== 'undefined' && prop in console) {\n return console[prop];\n }\n return () => {};\n },\n },\n);\n\nexport default Logger;\n","export default function(n){return{all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e])},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]))},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e)}),(i=n.get(\"*\"))&&i.slice().map(function(n){n(t,e)})}}}\n//# sourceMappingURL=mitt.mjs.map\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mitt from 'mitt';\n\n/**\n * 事件管理\n */\nexport default new (class Event {\n /**\n * 事件列表\n * @property\n */\n Events = {\n previewerClose: 'previewer:close',\n previewerOpen: 'previewer:open',\n editorClose: 'editor:close',\n editorOpen: 'editor:open',\n toolbarHide: 'toolbar:hide',\n toolbarShow: 'toolbar:show',\n cleanAllSubMenus: 'cleanAllSubMenus', // 清除所有子菜单弹窗\n };\n\n /**\n * @property\n * @private\n * @type {import('mitt').Emitter}\n */\n emitter = mitt();\n\n /**\n * 注册监听事件\n * @param {string} instanceId 接收消息的频道\n * @param {string} event 要注册监听的事件\n * @param {(event: any) => void} handler 事件回调\n */\n on(instanceId, event, handler) {\n this.emitter.on(`${instanceId}:${event}`, handler);\n }\n\n /**\n * 触发事件\n * @param {string} instanceId 发送消息的频道\n * @param {string} event 要触发的事件\n */\n emit(instanceId, event) {\n this.emitter.emit(`${instanceId}:${event}`);\n }\n})();\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * 上传文件的逻辑,如果有callback,则不再走默认的替换文本的逻辑,而是调用callback\n * @param {string} type 上传文件的类型\n */\nexport function handleUpload(editor, type = 'image', accept = '*', callback = null) {\n // type为上传文件类型 image|video|audio|pdf|word\n const input = document.createElement('input');\n input.type = 'file';\n input.id = 'fileUpload';\n input.value = '';\n input.style.display = 'none';\n input.accept = accept;\n // document.body.appendChild(input);\n input.addEventListener('change', (event) => {\n // @ts-ignore\n const [file] = event.target.files;\n // 文件上传后的回调函数可以由调用方自己实现\n editor.options.fileUpload(file, (url, params = {}) => {\n // 文件上传的默认回调行数,调用方可以完全不使用该函数\n if (typeof url !== 'string' || !url) {\n return;\n }\n if (callback) {\n return callback(file.name, url, params);\n }\n let code = '';\n if (type === 'image') {\n // 如果是图片,则返回固定的图片markdown源码\n code = `![${file.name}](${url})`;\n } else if (type === 'video') {\n // 如果是视频,则返回固定的视频markdown源码\n code = `!video[${file.name}](${url})`;\n } else if (type === 'audio') {\n // 如果是音频,则返回固定的音频markdown源码\n code = `!audio[${file.name}](${url})`;\n } else {\n // 默认返回超链接\n code = `[${file.name}](${url})`;\n }\n // 替换选中区域\n // @ts-ignore\n editor.editor.doc.replaceSelection(code);\n });\n });\n input.click();\n}\n\n/**\n * 解析params参数\n * @param params?.isBorder 是否有边框样式(图片场景下生效)\n * @param params?.isShadow 是否有阴影样式(图片场景下生效)\n * @param params?.isRadius 是否有圆角样式(图片场景下生效)\n * @param params?.width 设置宽度,可以是像素、也可以是百分比(图片、视频场景下生效)\n * @param params?.height 设置高度,可以是像素、也可以是百分比(图片、视频场景下生效)\n */\nexport function handelParams(params) {\n const ret = [];\n if (params.isBorder) {\n ret.push('#B');\n }\n if (params.isShadow) {\n ret.push('#S');\n }\n if (params.isRadius) {\n ret.push('#R');\n }\n if (params.width) {\n ret.push(`#${params.width}`);\n }\n if (params.height) {\n if (!params.width) {\n ret.push('#auto');\n }\n ret.push(`#${params.height}`);\n }\n return ret.join(' ');\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport function compileRegExp(obj, flags, allowExtendedFlags) {\n let source = obj.begin + obj.content + obj.end;\n if (allowExtendedFlags) {\n // Extend \\h for horizontal whitespace\n source = source.replace(/\\[\\\\h\\]/g, HORIZONTAL_WHITESPACE).replace(/\\\\h/g, HORIZONTAL_WHITESPACE);\n }\n return new RegExp(source, flags || 'g');\n}\n\nexport function isLookbehindSupported() {\n try {\n new RegExp('(?<=.)');\n return true;\n } catch (ignore) {}\n return false;\n}\n\nexport const HORIZONTAL_WHITESPACE = '[ \\\\t\\\\u00a0]';\n\n// 仅适用非多行模式的正则\nexport const ALLOW_WHITESPACE_MULTILINE = '(?:.*?)(?:(?:\\\\n.*?)*?)';\nexport const DO_NOT_STARTS_AND_END_WITH_SPACES = '(?:\\\\S|(?:\\\\S.*?\\\\S))';\nexport const DO_NOT_STARTS_AND_END_WITH_SPACES_MULTILINE =\n '(?:(?:\\\\S|(?:\\\\S[^\\\\n]*?\\\\S))(?:\\\\n(?:\\\\S|(?:\\\\S[^\\\\n]*?\\\\S)))*?)';\nexport const DO_NOT_STARTS_AND_END_WITH_SPACES_MULTILINE_ALLOW_EMPTY = '(?:(?:\\\\S|(?:\\\\S.*?\\\\S))(?:[ \\\\t]*\\\\n.*?)*?)';\n\nexport const NOT_ALL_WHITE_SPACES_INLINE = '(?:[^\\\\n]*?\\\\S[^\\\\n]*?)';\n\nexport const NORMAL_INDENT = '[ ]{0, 3}|\\\\t';\nexport const NO_BACKSLASH_BEFORE_CAPTURE = '[^\\\\\\\\]';\n\n// https://spec.commonmark.org/0.29/#ascii-punctuation-character\n// !, \", #, $, %, &, ', (, ), *, +, ,, -, ., / (U+0021–2F),\n// :, ;, <, =, >, ?, @ (U+003A–0040),\n// [, \\, ], ^, _, ` (U+005B–0060),\n// {, |, }, or ~ (U+007B–007E).\nexport const PUNCTUATION = '[\\\\u0021-\\\\u002F\\\\u003a-\\\\u0040\\\\u005b-\\\\u0060\\\\u007b-\\\\u007e]';\n\n// extra punctuations\nexport const CHINESE_PUNCTUATION = '[!“”¥‘’(),。—:;《》?【】「」·~|]';\n\n// 下划线强调语法允许的边界符号\nexport const UNDERSCORE_EMPHASIS_BOUNDARY =\n '[' +\n '\\\\u0021-\\\\u002F\\\\u003a-\\\\u0040\\\\u005b\\\\u005d\\\\u005e\\\\u0060\\\\u007b-\\\\u007e' + // punctuations defined in commonmark\n ' ' +\n '\\\\t\\\\n' +\n '!“”¥‘’(),。—:;《》?【】「」·~|' + // chinese punctuations\n ']';\n\n// https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type%3Demail)\nexport const EMAIL_INLINE = new RegExp(\n [\n /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+/.source,\n '@',\n /[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*/.source,\n ].join(''),\n);\nexport const EMAIL = new RegExp(`^${EMAIL_INLINE.source}$`);\n\n// https://gist.github.com/dperini/729294\n// [USERNAME[:PASSWORD]@](IP|HOST)[:PORT][/SOURCE_PATH?QUERY_PARAMS#HASH]\nexport const URL_INLINE_NO_SLASH = new RegExp(\n '' + // 针对eslint的特殊处理\n '(?:\\\\S+(?::\\\\S*)?@)?' +\n '(?:' +\n // IP address exclusion\n // IP address dotted notation octets\n // excludes loopback network 0.0.0.0\n // excludes reserved space >= 224.0.0.0\n // excludes network & broadcast addresses\n // (first & last IP address of each class)\n '(?:1\\\\d\\\\d|2[01]\\\\d|22[0-3]|[1-9]\\\\d?)' +\n '(?:\\\\.(?:1?\\\\d{1,2}|2[0-4]\\\\d|25[0-5])){2}' +\n '(?:\\\\.(?:1\\\\d\\\\d|2[0-4]\\\\d|25[0-4]|[1-9]\\\\d?))' +\n '|' +\n // host & domain names, may end with dot\n '(?![-_])(?:[-\\\\w\\\\xa1-\\\\xff]{0,63}[^-_]\\\\.)+' +\n // TLD identifier name, may end with dot\n '(?:[a-zA-Z\\\\xa1-\\\\xff]{2,}\\\\.?)' +\n ')' +\n // port number (optional)\n '(?::\\\\d{2,5})?' +\n // resource path (optional)\n '(?:[/?#][^\\\\s<>\\\\x00-\\\\x1f\"\\\\(\\\\)]*)?',\n);\nexport const URL_INLINE = new RegExp(\n // eslint特殊处理\n // protocol identifier (optional)\n // short syntax // still required\n // '(?:(?:(?:https?|ftp):)?\\\\/\\\\/)' +\n `(?:\\\\/\\\\/)${URL_INLINE_NO_SLASH.source}`,\n);\n\nexport const URL_NO_SLASH = new RegExp(`^${URL_INLINE_NO_SLASH.source}$`);\n\nexport const URL = new RegExp(`^${URL_INLINE.source}$`);\n\nexport function getTableRule(merge = false) {\n // ^(\\|[^\\n]+\\|\\r?\\n)((?:\\|:?[-]+:?)+\\|)(\\n(?:\\|[^\\n]+\\|\\r?\\n?)*)?$\n // (\\\\|?[^\\\\n|]+\\\\|?\\\\n)(?:\\\\|?[\\\\s]*:?[-]{2,}:?[\\\\s]*\n // (?:\\\\|[\\\\s]*:?[-]{2,}:?[\\\\s]*)+\\\\|?)(\\\\n\\\\|?(\\\\|[^\\\\n|]+)*\\\\|?)?\n /**\n * (\\|[^\\n]+\\|\\n) Headers\n * ((\\|[\\s]*:?[-]{2,}:?[\\s]*)+\\|) Column Options\n * ((?:\\n\\|[^\\n]+\\|)*) Rows\n */\n const strict = {\n begin: '(?:^|\\\\n)(\\\\n*)',\n content: [\n '(\\\\h*\\\\|[^\\\\n]+\\\\|?\\\\h*)', // Header\n '\\\\n',\n '(?:(?:\\\\h*\\\\|\\\\h*:?[-]{1,}:?\\\\h*)+\\\\|?\\\\h*)', // Column Options\n '((\\\\n\\\\h*\\\\|[^\\\\n]+\\\\|?\\\\h*)*)', // Rows\n ].join(''),\n end: '(?=$|\\\\n)',\n };\n\n strict.reg = compileRegExp(strict, 'g', true);\n\n const loose = {\n begin: '(?:^|\\\\n)(\\\\n*)',\n content: [\n '(\\\\|?[^\\\\n|]+(\\\\|[^\\\\n|]+)+\\\\|?)', // Header\n '\\\\n',\n '(?:\\\\|?\\\\h*:?[-]{1,}:?[\\\\h]*(?:\\\\|[\\\\h]*:?[-]{1,}:?\\\\h*)+\\\\|?)', // Column Options\n '((\\\\n\\\\|?([^\\\\n|]+(\\\\|[^\\\\n|]*)+)\\\\|?)*)', // Rows\n ].join(''),\n end: '(?=$|\\\\n)',\n };\n\n loose.reg = compileRegExp(loose, 'g', true);\n\n if (merge === false) {\n return { strict, loose };\n }\n const regStr = `(?:${strict.begin + strict.content + strict.end}|${loose.begin + loose.content + loose.end})`;\n return compileRegExp({ begin: '', content: regStr, end: '' }, 'g', true);\n}\n\nexport function getCodeBlockRule() {\n const codeBlock = {\n /**\n * (?:^|\\n)是区块的通用开头\n * (\\n*)捕获区块前的所有换行\n * ((?:>\\s*)*) 捕获代码块前面的引用(\"> > > \" 这种东西)\n * (?:[^\\S\\n]*)捕获```前置的空格字符\n * 只要有连续3个及以上`并且前后`的数量相等,则认为是代码快语法\n */\n begin: /(?:^|\\n)(\\n*((?:>[\\t ]*)*)(?:[^\\S\\n]*))(`{3,})([^`]*?)\\n/,\n content: /([\\w\\W]*?)/, // '([\\\\w\\\\W]*?)',\n end: /[^\\S\\n]*\\3[ \\t]*(?=$|\\n+)/, // '\\\\s*```[ \\\\t]*(?=$|\\\\n+)',\n };\n codeBlock.reg = new RegExp(codeBlock.begin.source + codeBlock.content.source + codeBlock.end.source, 'g');\n return codeBlock;\n}\n\n/**\n * 从selection里获取列表语法\n * @param {*} selection\n * @param {('ol'|'ul'|'checklist')} type 列表类型\n * @returns {String}\n */\nexport function getListFromStr(selection, type) {\n let $selection = selection ? selection : 'Item 1\\n Item 1.1\\nItem 2';\n $selection = $selection.replace(/^\\n+/, '').replace(/\\n+$/, '');\n let pre = '1.';\n switch (type) {\n case 'ol':\n pre = '1.';\n break;\n case 'ul':\n pre = '-';\n break;\n case 'checklist':\n pre = '- [x]';\n break;\n }\n $selection = $selection.replace(/^(\\s*)([0-9a-zA-Z]+\\.|- \\[x\\]|- \\[ \\]|-) /gm, '$1');\n // 对有序列表进行序号自增处理\n if (pre === '1.') {\n const listNum = {};\n $selection = $selection.replace(/^(\\s*)(\\S[\\s\\S]*?)$/gm, (match, p1, p2) => {\n const space = p1.match(/[ \\t]/g)?.length || 0;\n listNum[space] = listNum[space] ? listNum[space] + 1 : 1;\n return `${p1}${listNum[space]}. ${p2}`;\n });\n } else {\n $selection = $selection.replace(/^(\\s*)(\\S[\\s\\S]*?)$/gm, `$1${pre} $2`);\n }\n return $selection;\n}\n\n/**\n * 信息面板的识别正则\n * @returns {object}\n */\nexport function getPanelRule() {\n const ret = {\n begin: /(?:^|\\n)(\\n*(?:[^\\S\\n]*)):::([^:][^\\n]+?)\\s*\\n/,\n content: /([\\w\\W]*?)/,\n end: /\\n[ \\t]*:::[ \\t]*(?=$|\\n+)/,\n };\n ret.reg = new RegExp(ret.begin.source + ret.content.source + ret.end.source, 'g');\n return ret;\n}\n\n/**\n * 手风琴/detail语法的识别正则\n * 例:\n * +++(-) 点击查看详情\n * body\n * body\n * ++ 标题(默认收起内容)\n * 内容\n * ++- 标题(默认展开内容)\n * 内容2\n * +++\n * @returns {object}\n */\nexport function getDetailRule() {\n const ret = {\n begin: /(?:^|\\n)(\\n*(?:[^\\S\\n]*))\\+\\+\\+([-]{0,1})\\s+([^\\n]+)\\n/,\n content: /([\\w\\W]+?)/,\n end: /\\n[ \\t]*\\+\\+\\+[ \\t]*(?=$|\\n+)/,\n };\n ret.reg = new RegExp(ret.begin.source + ret.content.source + ret.end.source, 'g');\n return ret;\n}\n\n// 匹配图片URL里的base64\nexport const imgBase64Reg = /(!\\[[^\\n]*?\\]\\(data:image\\/png;base64,)([^)]+)\\)/g;\n\n// 匹配图片{}里的data-xml属性\nexport const imgDrawioXmlReg = /(!\\[[^\\n]*?\\]\\([^)]+\\)\\{[^}]* data-xml=)([^}]+)\\}/g;\n\n/**\n * 匹配draw.io的图片语法\n * 图片的语法为 ![alt](${base64}){data-type=drawio data-xml=${xml}}\n */\nexport const imgDrawioReg = /(!\\[[^\\n]*?\\]\\(data:image\\/png;base64,[^)]+\\)\\{data-type=drawio data-xml=[^}]+\\})/g;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @param {CodeMirror.Editor} cm\n */\nexport function handleNewlineIndentList(cm) {\n if (handleCherryList(cm)) return;\n cm.execCommand('newlineAndIndentContinueMarkdownList');\n}\n\nfunction handleCherryList(cm) {\n const cherryListRE = /^(\\s*)([I一二三四五六七八九十]+)\\.(\\s+)/;\n const cherryListEmptyRE = /^(\\s*)([I一二三四五六七八九十]+)\\.(\\s+)$/;\n if (cm.getOption('disableInput')) return false;\n const ranges = cm.listSelections();\n const replacements = [];\n for (let i = 0; i < ranges.length; i++) {\n const pos = ranges[i].head;\n const line = cm.getLine(pos.line);\n const match = cherryListRE.exec(line);\n const cursorBeforeBullet = /^\\s*$/.test(line.slice(0, pos.ch));\n if (!ranges[i].empty() || cursorBeforeBullet || !match) return;\n if (cherryListEmptyRE.test(line)) {\n cm.replaceRange(\n '',\n {\n line: pos.line,\n ch: 0,\n },\n {\n line: pos.line,\n ch: pos.ch + 1,\n },\n );\n replacements[i] = '\\n';\n } else {\n const indent = match[1];\n const after = match[3];\n replacements[i] = `\\n${indent}I.${after}`;\n }\n }\n cm.replaceSelections(replacements);\n return true;\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// @ts-check\nimport codemirror from 'codemirror';\nimport 'codemirror/lib/codemirror.css';\n// import 'codemirror/mode/markdown/markdown';\nimport 'codemirror/mode/gfm/gfm'; // https://codemirror.net/mode/gfm/index.html\n// import 'codemirror/mode/xml/xml';\nimport 'codemirror/addon/edit/continuelist';\nimport 'codemirror/addon/edit/closetag';\nimport 'codemirror/addon/fold/xml-fold';\nimport 'codemirror/addon/edit/matchtags';\nimport 'codemirror/addon/search/searchcursor';\nimport 'codemirror/addon/display/placeholder';\nimport 'codemirror/keymap/sublime';\n\nimport 'cm-search-replace/src/search';\nimport 'codemirror/addon/scroll/annotatescrollbar';\nimport 'codemirror/addon/search/matchesonscrollbar';\n// import 'codemirror/addon/selection/active-line';\n// import 'codemirror/addon/edit/matchbrackets';\nimport htmlParser from '@/utils/htmlparser';\nimport pasteHelper from '@/utils/pasteHelper';\nimport { addEvent } from './utils/event';\nimport Logger from '@/Logger';\nimport Event from '@/Event';\nimport { handelParams } from '@/utils/file';\nimport { createElement } from './utils/dom';\nimport { imgBase64Reg, imgDrawioXmlReg } from './utils/regexp';\nimport { handleNewlineIndentList } from './utils/autoindent';\n\n/**\n * @typedef {import('~types/editor').EditorConfiguration} EditorConfiguration\n * @typedef {import('~types/editor').EditorEventCallback} EditorEventCallback\n * @typedef {import('codemirror')} CodeMirror\n */\n\n/** @type {import('~types/editor')} */\nexport default class Editor {\n /**\n * @constructor\n * @param {Partial} options\n */\n constructor(options) {\n /**\n * @property\n * @type {EditorConfiguration}\n */\n this.options = {\n id: 'code', // textarea 的id属性值\n name: 'code', // textarea 的name属性值\n autoSave2Textarea: false,\n editorDom: document.createElement('div'),\n wrapperDom: null,\n autoScrollByCursor: true,\n convertWhenPaste: true,\n codemirror: {\n lineNumbers: false, // 显示行数\n cursorHeight: 0.85, // 光标高度,0.85好看一些\n indentUnit: 4, // 缩进单位为4\n tabSize: 4, // 一个tab转换成的空格数量\n // styleActiveLine: false, // 当前行背景高亮\n // matchBrackets: true, // 括号匹配\n mode: 'gfm', // 从markdown模式改成gfm模式,以使用默认高亮规则\n lineWrapping: true, // 自动换行\n indentWithTabs: true, // 缩进用tab表示\n autofocus: true,\n theme: 'default',\n autoCloseTags: true, // 输入html标签时自动补充闭合标签\n extraKeys: {\n Enter: handleNewlineIndentList,\n }, // 增加markdown回车自动补全\n matchTags: { bothTags: true }, // 自动高亮选中的闭合html标签\n placeholder: '',\n // 设置为 contenteditable 对输入法定位更友好\n // 但已知会影响某些悬浮菜单的定位,如粘贴选择文本或markdown模式的菜单\n // inputStyle: 'contenteditable',\n keyMap: 'sublime',\n },\n toolbars: {},\n onKeydown() {},\n onChange() {},\n onFocus() {},\n onBlur() {},\n onPaste: this.onPaste,\n onScroll: this.onScroll,\n };\n /**\n * @property\n * @private\n * @type {{ timer?: number; destinationTop?: number }}\n */\n this.animation = {};\n const { codemirror, ...restOptions } = options;\n if (codemirror) {\n Object.assign(this.options.codemirror, codemirror);\n }\n Object.assign(this.options, restOptions);\n this.$cherry = this.options.$cherry;\n this.instanceId = this.$cherry.getInstanceId();\n }\n\n /**\n * 处理draw.io的xml数据和图片的base64数据,对这种超大的数据增加省略号\n */\n dealBigData = () => {\n if (this.noChange) {\n this.noChange = false;\n return;\n }\n this.formatBigData2Mark(imgBase64Reg, 'cm-url base64');\n this.formatBigData2Mark(imgDrawioXmlReg, 'cm-url drawio');\n };\n\n /**\n * 把大字符串变成省略号\n * @param {*} reg 正则\n * @param {*} className 利用codemirror的MarkText生成的新元素的class\n */\n formatBigData2Mark = (reg, className) => {\n const codemirror = this.editor;\n const searcher = codemirror.getSearchCursor(reg);\n\n let oneSearch = searcher.findNext();\n for (; oneSearch !== false; oneSearch = searcher.findNext()) {\n const target = searcher.from();\n if (!target) {\n continue;\n }\n const bigString = oneSearch[2] ?? '';\n const targetChFrom = target.ch + oneSearch[1]?.length;\n const targetChTo = targetChFrom + bigString.length;\n const targetLine = target.line;\n const begin = { line: targetLine, ch: targetChFrom };\n const end = { line: targetLine, ch: targetChTo };\n // 如果所在区域已经有mark了,则不再增加mark\n if (codemirror.findMarks(begin, end).length > 0) {\n continue;\n }\n const newSpan = createElement('span', `cm-string ${className}`, { title: bigString });\n newSpan.textContent = bigString;\n this.noChange = true;\n codemirror.markText(begin, end, { replacedWith: newSpan, atomic: true });\n }\n };\n\n /**\n *\n * @param {KeyboardEvent} e\n * @param {CodeMirror.Editor} codemirror\n */\n onKeyup = (e, codemirror) => {\n const { line: targetLine } = codemirror.getCursor();\n this.previewer.highlightLine(targetLine + 1);\n };\n\n /**\n *\n * @param {ClipboardEvent} e\n * @param {CodeMirror.Editor} codemirror\n */\n onPaste(e, codemirror) {\n let { clipboardData } = e;\n if (clipboardData) {\n this.handlePaste(e, clipboardData, codemirror);\n } else {\n ({ clipboardData } = window);\n this.handlePaste(e, clipboardData, codemirror);\n }\n }\n\n /**\n *\n * @param {ClipboardEvent} event\n * @param {ClipboardEvent['clipboardData']} clipboardData\n * @param {CodeMirror.Editor} codemirror\n * @returns {boolean | void}\n */\n handlePaste(event, clipboardData, codemirror) {\n const { items } = clipboardData;\n const types = clipboardData.types || [];\n const codemirrorDoc = codemirror.getDoc();\n for (let i = 0; i < types.length; i++) {\n const item = items[i];\n // 判断是否为图片数据\n if (item && item.kind === 'file' && item.type.match(/^image\\//i)) {\n // 读取该图片\n const file = item.getAsFile();\n this.options.fileUpload(file, (url) => {\n if (typeof url !== 'string') {\n return;\n }\n codemirrorDoc.replaceSelection(`![enter image description here](${url})`);\n });\n event.preventDefault();\n }\n }\n\n // 复制html转换markdown\n const htmlText = clipboardData.getData('text/plain');\n let html = clipboardData.getData('Text/Html');\n if (!html || !this.options.convertWhenPaste) {\n return true;\n }\n /**\n * 这里需要处理一个特殊逻辑:\n * 从excel中复制而来的内容,剪切板里会有一张图片(一个元素)和一段纯文本,在这种场景下,需要丢掉图片,直接粘贴纯文本\n * 与此同时,当剪切板里有图片和其他html标签时(从web页面上复制的内容),则需要走下面的html转md的逻辑\n * 基于上述两个场景,才有了下面四行奇葩的代码\n */\n const test = html.replace(/<(html|head|body|!)/g, '');\n if (test.match(/<[a-zA-Z]/g)?.length <= 1 && / 0) {\n const range = codemirror.listSelections();\n if (codemirror.getSelections().length <= 1 && range[0] && range[0].anchor) {\n const currentCursor = {};\n currentCursor.line = range[0].anchor.line;\n currentCursor.ch = range[0].anchor.ch;\n codemirrorDoc.replaceSelection(mdText);\n pasteHelper.showSwitchBtnAfterPasteHtml(this.$cherry, currentCursor, codemirror, htmlText, mdText);\n } else {\n codemirrorDoc.replaceSelection(mdText);\n }\n event.preventDefault();\n }\n divObj = null;\n }\n\n /**\n *\n * @param {CodeMirror.Editor} codemirror\n */\n onScroll = (codemirror) => {\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus); // 滚动时清除所有子菜单,这不应该在Bubble中处理,我们关注的是编辑器的滚动 add by ufec\n if (this.disableScrollListener) {\n this.disableScrollListener = false;\n return;\n }\n const scroller = codemirror.getScrollerElement();\n if (scroller.scrollTop <= 0) {\n this.previewer.scrollToLineNum(0);\n return;\n }\n if (scroller.scrollTop + scroller.clientHeight >= scroller.scrollHeight - 20) {\n this.previewer.scrollToLineNum(null); // 滚动到底\n return;\n }\n const currentTop = codemirror.getScrollInfo().top;\n const targetLine = codemirror.lineAtHeight(currentTop, 'local');\n const lineRect = codemirror.charCoords({ line: targetLine, ch: 0 }, 'local');\n const lineHeight = codemirror.getLineHandle(targetLine).height;\n const lineTop = lineRect.bottom - lineHeight; // 直接用lineRect.top在自动折行时计算的是最后一行的top\n const percent = (100 * (currentTop - lineTop)) / lineHeight / 100;\n // console.log(percent);\n // codemirror中行号以0开始,所以需要+1\n this.previewer.scrollToLineNum(targetLine + 1, percent);\n };\n\n /**\n *\n * @param {CodeMirror.Editor} codemirror\n * @param {MouseEvent} evt\n */\n onMouseDown = (codemirror, evt) => {\n Event.emit(this.instanceId, Event.Events.cleanAllSubMenus); // Bubble中处理需要考虑太多,直接在编辑器中处理可包括Bubble中所有情况,因为产生Bubble的前提是光标在编辑器中 add by ufec\n const { line: targetLine } = codemirror.getCursor();\n const top = Math.abs(evt.y - codemirror.getWrapperElement().getBoundingClientRect().y);\n this.previewer.scrollToLineNumWithOffset(targetLine + 1, top);\n };\n\n /**\n * 光标变化事件\n */\n onCursorActivity = () => {\n this.refreshWritingStatus();\n };\n\n /**\n *\n * @param {*} previewer\n */\n init(previewer) {\n const textArea = this.options.editorDom.querySelector(`#${this.options.id}`);\n if (!(textArea instanceof HTMLTextAreaElement)) {\n throw new Error('The specific element is not a textarea.');\n }\n const editor = codemirror.fromTextArea(textArea, this.options.codemirror);\n editor.addOverlay({\n name: 'invisibles',\n token: function nextToken(stream) {\n let tokenClass;\n let spaces = 0;\n let peek = stream.peek() === ' ';\n if (peek) {\n while (peek && spaces < Number.MAX_VALUE) {\n spaces += 1;\n stream.next();\n peek = stream.peek() === ' ';\n }\n tokenClass = `whitespace whitespace-${spaces}`;\n } else {\n while (!stream.eol()) {\n stream.next();\n }\n tokenClass = '';\n }\n return tokenClass;\n },\n });\n this.previewer = previewer;\n this.disableScrollListener = false;\n\n if (this.options.value) {\n editor.setOption('value', this.options.value);\n }\n\n editor.on('blur', (codemirror, evt) => {\n this.options.onBlur(evt, codemirror);\n });\n\n editor.on('focus', (codemirror, evt) => {\n this.options.onFocus(evt, codemirror);\n });\n\n editor.on('change', (codemirror, evt) => {\n this.options.onChange(evt, codemirror);\n this.dealBigData();\n if (this.options.autoSave2Textarea) {\n // @ts-ignore\n // 将codemirror里的内容回写到textarea里\n codemirror.save();\n }\n });\n\n editor.on('keydown', (codemirror, evt) => {\n this.options.onKeydown(evt, codemirror);\n });\n\n editor.on('keyup', (codemirror, evt) => {\n this.onKeyup(evt, codemirror);\n });\n\n editor.on('paste', (codemirror, evt) => {\n this.options.onPaste.call(this, evt, codemirror);\n });\n\n if (this.options.autoScrollByCursor) {\n editor.on('mousedown', (codemirror, evt) => {\n setTimeout(() => {\n this.onMouseDown(codemirror, evt);\n });\n });\n }\n\n editor.on('drop', (codemirror, evt) => {\n const files = evt.dataTransfer.files || [];\n if (files && files.length > 0) {\n // 增加延时,让drop的位置变成codemirror的光标位置\n setTimeout(() => {\n for (let i = 0, needBr = false; i < files.length; i++) {\n const file = files[i];\n const fileType = file.type || '';\n // 文本类型或者无类型的,直接读取内容,不做上传文件的操作\n if (fileType === '' || /^text/i.test(fileType)) {\n continue;\n }\n this.options.fileUpload(file, (url, params = {}) => {\n if (typeof url !== 'string') {\n return;\n }\n // 拖拽上传文件时,强制改成没有文字选择区的状态\n codemirror.setSelection(codemirror.getCursor());\n const name = params.name ? params.name : file.name;\n let type = '';\n let poster = '';\n if (/video/i.test(file.type)) {\n type = '!video';\n poster = params.poster ? `{poster=${params.poster}}` : '';\n }\n if (/audio/i.test(file.type)) {\n type = '!audio';\n }\n if (/image/i.test(file.type)) {\n type = '!';\n }\n const style = type ? handelParams(params) : '';\n type = needBr ? `\\n${type}` : type;\n const insertValue = `${type}[${name}${style}](${url})${poster}`;\n // 当批量上传文件时,每个被插入的文件中间需要加个换行,但单个上传文件的时候不需要加换行\n needBr = true;\n codemirror.replaceSelection(insertValue);\n });\n }\n }, 50);\n }\n });\n\n editor.on('scroll', (codemirror) => {\n this.options.onScroll(codemirror);\n this.options.writingStyle === 'focus' && this.refreshWritingStatus();\n });\n\n editor.on('cursorActivity', () => {\n this.onCursorActivity();\n });\n\n addEvent(\n this.getEditorDom(),\n 'wheel',\n () => {\n // 鼠标滚轮滚动时,强制监听滚动事件\n this.disableScrollListener = false;\n // 打断滚动动画\n cancelAnimationFrame(this.animation.timer);\n this.animation.timer = 0;\n },\n false,\n );\n\n /**\n * @property\n * @type {CodeMirror.Editor}\n */\n this.editor = editor;\n\n if (this.options.writingStyle !== 'normal') {\n this.initWritingStyle();\n }\n }\n\n /**\n *\n * @param {number | null} beginLine 起始行,传入null时跳转到文档尾部\n * @param {number} [endLine] 终止行\n * @param {number} [percent] 百分比,取值0~1\n */\n jumpToLine(beginLine, endLine, percent) {\n if (beginLine === null) {\n cancelAnimationFrame(this.animation.timer);\n this.disableScrollListener = true;\n this.editor.scrollIntoView({\n line: this.editor.lineCount() - 1,\n ch: 1,\n });\n this.animation.timer = 0;\n return;\n }\n const position = this.editor.charCoords({ line: beginLine, ch: 0 }, 'local');\n let { top } = position;\n const positionEnd = this.editor.charCoords({ line: beginLine + endLine, ch: 0 }, 'local');\n const height = positionEnd.top - position.top;\n top += height * percent;\n this.animation.destinationTop = Math.ceil(top - 15);\n if (this.animation.timer) {\n return;\n }\n const animationHandler = () => {\n const currentTop = this.editor.getScrollInfo().top;\n const delta = this.animation.destinationTop - currentTop;\n // 100毫秒内完成动画\n const move = Math.ceil(Math.min(Math.abs(delta), Math.max(1, Math.abs(delta) / (100 / 16.7))));\n // console.log('should scroll: ', move, delta, currentTop, this.animation.destinationTop);\n if (delta > 0) {\n if (currentTop >= this.animation.destinationTop) {\n this.animation.timer = 0;\n return;\n }\n this.disableScrollListener = true;\n this.editor.scrollTo(null, currentTop + move);\n } else if (delta < 0) {\n if (currentTop <= this.animation.destinationTop || currentTop <= 0) {\n this.animation.timer = 0;\n return;\n }\n this.disableScrollListener = true;\n this.editor.scrollTo(null, currentTop - move);\n } else {\n this.animation.timer = 0;\n return;\n }\n // 无法再继续滚动\n if (currentTop === this.editor.getScrollInfo().top || move >= Math.abs(delta)) {\n this.animation.timer = 0;\n return;\n }\n this.animation.timer = requestAnimationFrame(animationHandler);\n };\n this.animation.timer = requestAnimationFrame(animationHandler);\n }\n\n /**\n *\n * @param {number | null} lineNum\n * @param {number} [endLine]\n * @param {number} [percent]\n */\n scrollToLineNum(lineNum, endLine, percent) {\n if (lineNum === null) {\n this.jumpToLine(null);\n return;\n }\n const $lineNum = Math.max(0, lineNum);\n this.jumpToLine($lineNum, endLine, percent);\n Logger.log('滚动预览区域,左侧应scroll to ', $lineNum);\n }\n\n /**\n *\n * @returns {HTMLElement}\n */\n getEditorDom() {\n return this.options.editorDom;\n }\n\n /**\n *\n * @param {string} event 事件名\n * @param {EditorEventCallback} callback 回调函数\n */\n addListener(event, callback) {\n this.editor.on(event, callback);\n }\n\n /**\n * 初始化书写风格\n */\n initWritingStyle() {\n const { writingStyle } = this.options;\n const className = `cherry-editor-writing-style--${writingStyle}`;\n const editorDom = this.getEditorDom();\n // 重置状态\n Array.from(editorDom.classList)\n .filter((className) => className.startsWith('cherry-editor-writing-style--'))\n .forEach((className) => editorDom.classList.remove(className));\n if (writingStyle === 'normal') {\n return;\n }\n editorDom.classList.add(className);\n this.refreshWritingStatus();\n }\n\n /**\n * 刷新书写状态\n */\n refreshWritingStatus() {\n const { writingStyle } = this.options;\n const className = `cherry-editor-writing-style--${writingStyle}`;\n /**\n * @type {HTMLStyleElement}\n */\n const style = document.querySelector('#cherry-editor-writing-style') || document.createElement('style');\n style.id = 'cherry-editor-writing-style';\n Array.from(document.head.childNodes).find((node) => node === style) || document.head.appendChild(style);\n const { sheet } = style;\n Array.from(Array(sheet.cssRules.length)).forEach(() => sheet.deleteRule(0));\n if (writingStyle === 'focus') {\n const editorDomRect = this.getEditorDom().getBoundingClientRect();\n // 获取光标所在位置\n const { top, bottom } = this.editor.charCoords(this.editor.getCursor());\n // 光标上部距离编辑器顶部距离(不包含菜单)\n const topHeight = top - editorDomRect.top;\n // 光标下部距离编辑器底部距离\n const bottomHeight = editorDomRect.height - (bottom - editorDomRect.top);\n sheet.insertRule(`.${className}::before { height: ${topHeight > 0 ? topHeight : 0}px; }`, 0);\n sheet.insertRule(`.${className}::after { height: ${bottomHeight > 0 ? bottomHeight : 0}px; }`, 0);\n }\n if (writingStyle === 'typewriter') {\n // 编辑器顶/底部填充的空白高度 (用于内容不足时使光标所在行滚动到编辑器中央)\n const height = this.editor.getScrollInfo().clientHeight / 2;\n sheet.insertRule(`.${className} .CodeMirror-lines::before { height: ${height}px; }`, 0);\n sheet.insertRule(`.${className} .CodeMirror-lines::after { height: ${height}px; }`, 0);\n this.editor.scrollTo(null, this.editor.cursorCoords(null, 'local').top - height);\n }\n }\n\n /**\n * 修改书写风格\n */\n setWritingStyle(writingStyle) {\n this.options.writingStyle = writingStyle;\n this.initWritingStyle();\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar $findIndex = require('../internals/array-iteration').findIndex;\nvar addToUnscopables = require('../internals/add-to-unscopables');\n\nvar FIND_INDEX = 'findIndex';\nvar SKIPS_HOLES = true;\n\n// Shouldn't skip holes\nif (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });\n\n// `Array.prototype.findIndex` method\n// https://tc39.es/ecma262/#sec-array.prototype.findindex\n$({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {\n findIndex: function findIndex(callbackfn /* , that = undefined */) {\n return $findIndex(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\n// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables\naddToUnscopables(FIND_INDEX);\n","require('../../../modules/es.array.find-index');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').findIndex;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/find-index');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.findIndex;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.findIndex) ? method : own;\n};\n","var parent = require('../../es/instance/find-index');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/find-index\");","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toObject = require('../internals/to-object');\nvar arraySpeciesCreate = require('../internals/array-species-create');\nvar createProperty = require('../internals/create-property');\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');\n\nvar TypeError = global.TypeError;\nvar max = Math.max;\nvar min = Math.min;\nvar MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;\nvar MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';\n\n// `Array.prototype.splice` method\n// https://tc39.es/ecma262/#sec-array.prototype.splice\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n splice: function splice(start, deleteCount /* , ...items */) {\n var O = toObject(this);\n var len = lengthOfArrayLike(O);\n var actualStart = toAbsoluteIndex(start, len);\n var argumentsLength = arguments.length;\n var insertCount, actualDeleteCount, A, k, from, to;\n if (argumentsLength === 0) {\n insertCount = actualDeleteCount = 0;\n } else if (argumentsLength === 1) {\n insertCount = 0;\n actualDeleteCount = len - actualStart;\n } else {\n insertCount = argumentsLength - 2;\n actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart);\n }\n if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {\n throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);\n }\n A = arraySpeciesCreate(O, actualDeleteCount);\n for (k = 0; k < actualDeleteCount; k++) {\n from = actualStart + k;\n if (from in O) createProperty(A, k, O[from]);\n }\n A.length = actualDeleteCount;\n if (insertCount < actualDeleteCount) {\n for (k = actualStart; k < len - actualDeleteCount; k++) {\n from = k + actualDeleteCount;\n to = k + insertCount;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];\n } else if (insertCount > actualDeleteCount) {\n for (k = len - actualDeleteCount; k > actualStart; k--) {\n from = k + actualDeleteCount - 1;\n to = k + insertCount - 1;\n if (from in O) O[to] = O[from];\n else delete O[to];\n }\n }\n for (k = 0; k < insertCount; k++) {\n O[k + actualStart] = arguments[k + 2];\n }\n O.length = len - actualDeleteCount + insertCount;\n return A;\n }\n});\n","require('../../../modules/es.array.splice');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').splice;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/splice');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.splice;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.splice) ? method : own;\n};\n","var parent = require('../../es/instance/splice');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/splice\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @typedef {import('~types/syntax').HookType} HookType\n * @typedef {import('~types/syntax').HookTypesList} HookTypesList\n * @typedef {import('~types/syntax').EditorConfig} EditorConfig\n * @typedef {import('~types/syntax').HookRegexpRule} HookRegexpRule\n */\n\n/** @type {boolean} */\nlet isMathjaxConfig = false;\n\n/**\n * @type {HookTypesList}\n */\nexport const HOOKS_TYPE_LIST = {\n SEN: 'sentence',\n PAR: 'paragraph',\n DEFAULT: 'sentence',\n};\n\nexport default class SyntaxBase {\n /**\n * @static\n * @type {string}\n */\n static HOOK_NAME = 'default';\n /**\n * @static\n * @type {HookType}\n */\n static HOOK_TYPE = HOOKS_TYPE_LIST.DEFAULT;\n /**\n * @protected\n * @type {import('../Engine').default}\n */\n $engine;\n $locale;\n\n /**\n * @constructor\n * @param {Partial} editorConfig\n */\n constructor(editorConfig) {\n // editorConfig.pageHooks: 已实例化的页面级hook\n // editorConfig.syntaxOptions: 当前Hook的用户配置\n // editorConfig.externals: 第三方库\n this.RULE = this.rule(editorConfig);\n }\n\n getType() {\n return /** @type {typeof SyntaxBase} */ (this.constructor).HOOK_TYPE || HOOKS_TYPE_LIST.DEFAULT;\n }\n\n getName() {\n return /** @type {typeof SyntaxBase} */ (this.constructor).HOOK_NAME;\n }\n\n afterInit(callback) {\n if (typeof callback === 'function') {\n callback();\n }\n }\n\n setLocale(locale) {\n this.$locale = locale;\n }\n\n /**\n * 生命周期函数\n * @param {string} str 待处理的markdown文本\n * @returns {string} 处理后的文本,一般为html\n */\n beforeMakeHtml(str) {\n return str;\n }\n\n /**\n * 生命周期函数\n * @param {string} str 待处理的markdown文本\n * @returns {string} 处理后的文本,一般为html\n */\n makeHtml(str) {\n return str;\n }\n\n /**\n * 生命周期函数\n * @param {string} str 待处理的markdown文本\n * @returns {string} 处理后的文本,一般为html\n */\n afterMakeHtml(str) {\n return str;\n }\n\n // getMakeHtml() {\n // return this.makeHtml || false;\n // }\n\n /**\n *\n * @param {KeyboardEvent} e 触发事件\n * @param {*} str\n */\n onKeyDown(e, str) {}\n\n getOnKeyDown() {\n return this.onKeyDown || false;\n }\n\n getAttributesTest() {\n return /^(color|fontSize|font-size|id|title|class|target|underline|line-through|overline|sub|super)$/;\n }\n\n /**\n *\n * @param {string} attr\n * @param {() => {}} func 回调函数\n */\n $testAttributes(attr, func) {\n if (this.getAttributesTest().test(attr)) {\n func();\n }\n }\n\n /**\n * 提取属性\n * @param {string} str 待提取字符串\n * @returns {{attrs: Record; str: string}}\n */\n getAttributes(str) {\n const ret = { attrs: {}, str };\n // if(/(?<=[^\\\\]){([a-zA-Z-]+=[0-9a-z-]+(?=;|\\||}))+}$/.test(str)) {\n // str.match(/(?<=[^\\\\]){[^\\n]+?}$/)[0]\n // .match(/([a-zA-Z-]+=[0-9a-z-]+(?=;|\\||}))+/g)\n // .foreach((one) => {\n // one = one.split('=');\n // this._testAttributes(one[0], ()=>{\n // ret.attrs[one[0]] = one[1];\n // });\n // });\n // ret.str = str.replace(/(?<=[^\\\\]){[^\\n]+?}$/, '');\n // }\n return ret;\n }\n\n static getMathJaxConfig() {\n return isMathjaxConfig;\n }\n\n /**\n *\n * @param {boolean} version 指定mathJax是否使用MathJax\n */\n static setMathJaxConfig(version) {\n isMathjaxConfig = version;\n }\n\n /**\n * 测试输入的字符串是否匹配当前Hook规则\n * @param {string} str 待匹配文本\n * @returns {boolean}\n */\n test(str) {\n return this.RULE.reg ? this.RULE.reg.test(str) : false;\n }\n\n /**\n *\n * @param {Partial} editorConfig\n * @returns {HookRegexpRule}\n */\n rule(editorConfig) {\n return { begin: '', end: '', content: '', reg: new RegExp('') };\n }\n\n mounted() {\n // console.log('base mounted');\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar $map = require('../internals/array-iteration').map;\nvar arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');\n\nvar HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');\n\n// `Array.prototype.map` method\n// https://tc39.es/ecma262/#sec-array.prototype.map\n// with adding support of @@species\n$({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n","require('../../../modules/es.array.map');\nvar entryVirtual = require('../../../internals/entry-virtual');\n\nmodule.exports = entryVirtual('Array').map;\n","var isPrototypeOf = require('../../internals/object-is-prototype-of');\nvar method = require('../array/virtual/map');\n\nvar ArrayPrototype = Array.prototype;\n\nmodule.exports = function (it) {\n var own = it.map;\n return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.map) ? method : own;\n};\n","var parent = require('../../es/instance/map');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/instance/map\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 为段落前加换行符\n * @param {string} match 匹配全文\n * @param {string} processedContent 加入的内容\n */\nexport function prependLineFeedForParagraph(match, processedContent, canNestedInList = false) {\n if (!/^\\n/.test(match)) {\n return processedContent;\n }\n if (canNestedInList) {\n const leadingLinesCount = match.match(/^\\n+/g)?.[0]?.length ?? 0;\n // 前置换行符数量大于2时,补充两个换行符,否则只补充一个\n if (leadingLinesCount > 1) {\n return `\\n\\n${processedContent}`;\n }\n return `\\n${processedContent}`;\n }\n return `\\n\\n${processedContent}`;\n}\n\n/**\n * 计算段落所占行数,必须传入通过 prependLineFeedForParagraph 方法处理后的内容,才能计算准确\n * @param {string} preLinesMatch 前置匹配行\n * @param {number} contentLines 实际内容行数\n */\nexport function calculateLinesOfParagraph(preLinesMatch, contentLines) {\n let preLineCount = (preLinesMatch.match(/\\n/g) || []).length;\n // 前置行匹配文本为空,说明是全文开头\n // 非全文开头前面必有两个从 prependLineFeed 方法新增加的换行符\n if (preLinesMatch !== '') {\n preLineCount -= 2;\n }\n return preLineCount + contentLines;\n}\n","module.exports = require(\"core-js-pure/stable/array/is-array\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * 用于lodash.mergeWith的customizer\n * @param {any} objValue\n * @param {any} srcValue\n * @returns\n */\nexport function customizer(objValue, srcValue) {\n if (Array.isArray(srcValue)) {\n return srcValue;\n }\n}\n\n/**\n * 检查本地有没有值\n * @param {string} key\n */\nexport function testKeyInLocal(key) {\n if (typeof localStorage !== 'undefined') {\n return localStorage.getItem(`cherry-${key}`) !== null;\n }\n return false;\n}\n\n/**\n * 保存是否经典换行\n * @param {boolean} isClassicBr\n */\nexport function saveIsClassicBrToLocal(isClassicBr) {\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem('cherry-classicBr', isClassicBr ? 'true' : 'false');\n }\n}\n\n/**\n * 是否经典换行\n */\nexport function getIsClassicBrFromLocal() {\n let ret = 'false';\n if (typeof localStorage !== 'undefined') {\n ret = localStorage.getItem('cherry-classicBr');\n }\n return ret === 'true';\n}\n\n/**\n * 保存当前主题\n * @param {string} theme\n */\nfunction saveThemeToLocal(theme) {\n if (typeof localStorage !== 'undefined') {\n localStorage.setItem('cherry-theme', theme);\n }\n}\n\n/**\n * 获取当前主题\n * @returns {string} 主题名\n */\nexport function getThemeFromLocal(fullClass = false) {\n let ret = 'default';\n if (typeof localStorage !== 'undefined') {\n const localTheme = localStorage.getItem('cherry-theme');\n if (localTheme) {\n ret = localTheme;\n }\n }\n return fullClass ? `theme__${ret}` : ret;\n}\n\n/**\n * 修改主题\n * @param {object} $cherry\n * @param {string} theme 如果没有传theme,则从本地缓存里取\n */\nexport function changeTheme($cherry, theme = '') {\n const newTheme = (theme ? theme : getThemeFromLocal()).replace(/^.*theme__/, '');\n const newClass = ` theme__${newTheme}`;\n $cherry.wrapperDom.className = $cherry.wrapperDom.className.replace(/ theme__[^ $]+?( |$)/g, '') + newClass;\n $cherry.previewer.getDomContainer().className =\n $cherry.previewer.getDomContainer().className.replace(/ theme__[^ $]+?( |$)/g, '') + newClass;\n saveThemeToLocal(newTheme);\n}\n","var $ = require('../internals/export');\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar toAbsoluteIndex = require('../internals/to-absolute-index');\n\nvar RangeError = global.RangeError;\nvar fromCharCode = String.fromCharCode;\n// eslint-disable-next-line es-x/no-string-fromcodepoint -- required for testing\nvar $fromCodePoint = String.fromCodePoint;\nvar join = uncurryThis([].join);\n\n// length should be 1, old FF problem\nvar INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1;\n\n// `String.fromCodePoint` method\n// https://tc39.es/ecma262/#sec-string.fromcodepoint\n$({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n fromCodePoint: function fromCodePoint(x) {\n var elements = [];\n var length = arguments.length;\n var i = 0;\n var code;\n while (length > i) {\n code = +arguments[i++];\n if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point');\n elements[i] = code < 0x10000\n ? fromCharCode(code)\n : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00);\n } return join(elements, '');\n }\n});\n","require('../../modules/es.string.from-code-point');\nvar path = require('../../internals/path');\n\nmodule.exports = path.String.fromCodePoint;\n","var parent = require('../../es/string/from-code-point');\n\nmodule.exports = parent;\n","module.exports = require(\"core-js-pure/stable/string/from-code-point\");","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst escapeMap = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": ''',\n};\n\nconst unescapeMap = {\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n};\n\n// refs: https://www.freeformatter.com/html-entities.html\nconst ASCIICharacters = {\n 34: '"',\n 38: '&',\n 39: ''',\n 60: '<',\n 62: '>',\n};\n\nconst ISO88591Characters = {\n 192: 'À',\n 193: 'Á',\n 194: 'Â',\n 195: 'Ã',\n 196: 'Ä',\n 197: 'Å',\n 198: 'Æ',\n 199: 'Ç',\n 200: 'È',\n 201: 'É',\n 202: 'Ê',\n 203: 'Ë',\n 204: 'Ì',\n 205: 'Í',\n 206: 'Î',\n 207: 'Ï',\n 208: 'Ð',\n 209: 'Ñ',\n 210: 'Ò',\n 211: 'Ó',\n 212: 'Ô',\n 213: 'Õ',\n 214: 'Ö',\n 216: 'Ø',\n 217: 'Ù',\n 218: 'Ú',\n 219: 'Û',\n 220: 'Ü',\n 221: 'Ý',\n 222: 'Þ',\n 223: 'ß',\n 224: 'à',\n 225: 'á',\n 226: 'â',\n 227: 'ã',\n 228: 'ä',\n 229: 'å',\n 230: 'æ',\n 231: 'ç',\n 232: 'è',\n 233: 'é',\n 234: 'ê',\n 235: 'ë',\n 236: 'ì',\n 237: 'í',\n 238: 'î',\n 239: 'ï',\n 240: 'ð',\n 241: 'ñ',\n 242: 'ò',\n 243: 'ó',\n 244: 'ô',\n 245: 'õ',\n 246: 'ö',\n 248: 'ø',\n 249: 'ù',\n 250: 'ú',\n 251: 'û',\n 252: 'ü',\n 253: 'ý',\n 254: 'þ',\n 255: 'ÿ',\n};\n\nconst ISO88591Symbols = {\n 160: ' ',\n 161: '¡',\n 162: '¢',\n 163: '£',\n 164: '¤',\n 165: '¥',\n 166: '¦',\n 167: '§',\n 168: '¨',\n 169: '©',\n 170: 'ª',\n 171: '«',\n 172: '¬',\n 173: '­',\n 174: '®',\n 175: '¯',\n 176: '°',\n 177: '±',\n 178: '²',\n 179: '³',\n 180: '´',\n 181: 'µ',\n 182: '¶',\n 184: '¸',\n 185: '¹',\n 186: 'º',\n 187: '»',\n 188: '¼',\n 189: '½',\n 190: '¾',\n 191: '¿',\n 215: '×',\n 247: '÷',\n};\n\nconst MathSymbols = {\n 8704: '∀',\n 8706: '∂',\n 8707: '∃',\n 8709: '∅',\n 8711: '∇',\n 8712: '∈',\n 8713: '∉',\n 8715: '∋',\n 8719: '∏',\n 8721: '∑',\n 8722: '−',\n 8727: '∗',\n 8730: '√',\n 8733: '∝',\n 8734: '∞',\n 8736: '∠',\n 8743: '∧',\n 8744: '∨',\n 8745: '∩',\n 8746: '∪',\n 8747: '∫',\n 8756: '∴',\n 8764: '∼',\n 8773: '≅',\n 8776: '≈',\n 8800: '≠',\n 8801: '≡',\n 8804: '≤',\n 8805: '≥',\n 8834: '⊂',\n 8835: '⊃',\n 8836: '⊄',\n 8838: '⊆',\n 8839: '⊇',\n 8853: '⊕',\n 8855: '⊗',\n 8869: '⊥',\n 8901: '⋅',\n};\n\nconst GreekLetters = {\n 913: 'Α',\n 914: 'Β',\n 915: 'Γ',\n 916: 'Δ',\n 917: 'Ε',\n 918: 'Ζ',\n 919: 'Η',\n 920: 'Θ',\n 921: 'Ι',\n 922: 'Κ',\n 923: 'Λ',\n 924: 'Μ',\n 925: 'Ν',\n 926: 'Ξ',\n 927: 'Ο',\n 928: 'Π',\n 929: 'Ρ',\n 931: 'Σ',\n 932: 'Τ',\n 933: 'Υ',\n 934: 'Φ',\n 935: 'Χ',\n 936: 'Ψ',\n 937: 'Ω',\n 945: 'α',\n 946: 'β',\n 947: 'γ',\n 948: 'δ',\n 949: 'ε',\n 950: 'ζ',\n 951: 'η',\n 952: 'θ',\n 953: 'ι',\n 954: 'κ',\n 955: 'λ',\n 956: 'μ',\n 957: 'ν',\n 958: 'ξ',\n 959: 'ο',\n 960: 'π',\n 961: 'ρ',\n 962: 'ς',\n 963: 'σ',\n 964: 'τ',\n 965: 'υ',\n 966: 'φ',\n 967: 'χ',\n 968: 'ψ',\n 969: 'ω',\n 977: 'ϑ',\n 978: 'ϒ',\n 982: 'ϖ',\n};\n\nconst MiscellaneousHTMLEntities = {\n 338: 'Œ',\n 339: 'œ',\n 352: 'Š',\n 353: 'š',\n 376: 'Ÿ',\n 402: 'ƒ',\n 710: 'ˆ',\n 732: '˜',\n 8194: ' ',\n 8195: ' ',\n 8201: ' ',\n 8204: '‌',\n 8205: '‍',\n 8206: '‎',\n 8207: '‏',\n 8211: '–',\n 8212: '—',\n 8216: '‘',\n 8217: '’',\n 8218: '‚',\n 8220: '“',\n 8221: '”',\n 8222: '„',\n 8224: '†',\n 8225: '‡',\n 8226: '•',\n 8230: '…',\n 8240: '‰',\n 8242: '′',\n 8243: '″',\n 8249: '‹',\n 8250: '›',\n 8254: '‾',\n 8364: '€',\n 8482: '™',\n 8592: '←',\n 8593: '↑',\n 8594: '→',\n 8595: '↓',\n 8596: '↔',\n 8629: '↵',\n 8968: '⌈',\n 8969: '⌉',\n 8970: '⌊',\n 8971: '⌋',\n 9674: '◊',\n 9824: '♠',\n 9827: '♣',\n 9829: '♥',\n 9830: '♦',\n};\n\n// TODO: 使用whatwg的entities.json\nconst htmlEntitiesMap = {\n ...ASCIICharacters,\n ...ISO88591Characters,\n ...ISO88591Symbols,\n ...MathSymbols,\n ...GreekLetters,\n ...MiscellaneousHTMLEntities,\n};\n\nconst htmlEntitiesCodePoint = Object.keys(htmlEntitiesMap);\n\nconst htmlEntitiesWithoutSemicolon = htmlEntitiesCodePoint.map((code) =>\n htmlEntitiesMap[code].replace(/^&(\\w+);$/g, (match, name) => name.toLowerCase()),\n);\n\n/**\n * 非字符串类型与长度为0的字符串都认为是空串\n * @param {any} str 需要判断的字符串\n * @returns {boolean}\n */\nconst isEmptyString = (str) => typeof str !== 'string' || str.length <= 0;\n\nconst isValidStringCodePoint = (codePoint) => {\n try {\n const string = String.fromCodePoint(codePoint);\n return !isEmptyString(string); // 如果转换的为空串,说明CodePoint不合法\n } catch (e) {\n // 转换出错,也是不合法的CodePoint\n return false;\n }\n};\n\nexport function escapeHTMLEntitiesWithoutSemicolon(content) {\n if (typeof content !== 'string') {\n return '';\n }\n // 先处理字符实体\n const namedRegex = /&(\\w+);?/g;\n let escaped = content.replace(namedRegex, (match, name) => {\n // 不在合法列表里的全部转义,无分号的情况也转义\n if (match.indexOf(';') === -1 || htmlEntitiesWithoutSemicolon.indexOf(name.toLowerCase()) === -1) {\n return match.replace(/&/g, '&');\n }\n return match;\n });\n // 处理十进制数字实体,需要防止误匹配16进制\n const numericRegex = /&#(?!x)(\\d*);?/gi;\n escaped = escaped.replace(numericRegex, (match, decimalCodePoint) => {\n // 不在合法列表里的全部转义,无分号的情况也转义\n // 且位数不能大于7,否则可能导致溢出: https://spec.commonmark.org/0.29/#decimal-numeric-character\n if (\n isEmptyString(decimalCodePoint) ||\n match.indexOf(';') === -1 ||\n decimalCodePoint.lenth > 7 ||\n // Object.keys(htmlEntitiesMap).indexOf(+decimalCodePoint) === -1 ||\n !isValidStringCodePoint(decimalCodePoint)\n ) {\n return match.replace(/&/g, '&');\n }\n return match;\n });\n // 处理十六进制数字实体\n const hexRegex = /&#x([0-9a-f]*);?/gi;\n escaped = escaped.replace(hexRegex, (match, hexCodePoint) => {\n if (isEmptyString(hexCodePoint)) {\n return match.replace(/&/g, '&');\n }\n const hexCode = `0x${hexCodePoint}`;\n const decimalCodePoint = parseInt(hexCode, 16);\n // parseInt非数字、不在合法列表里、无分号的情况全部转义\n // 且位数不能大于6: https://spec.commonmark.org/0.29/#hexadecimal-numeric-character\n if (\n isNaN(decimalCodePoint) ||\n match.indexOf(';') === -1 ||\n hexCodePoint.lenth > 6 ||\n // Object.keys(htmlEntitiesMap).indexOf(decimalCodePoint) === -1\n !isValidStringCodePoint(hexCode)\n ) {\n return match.replace(/&/g, '&');\n }\n return match;\n });\n return escaped;\n}\n\nexport const blockNames = [\n 'h1|h2|h3|h4|h5|h6',\n 'ul|ol|li|dd|dl|dt',\n 'table|thead|tbody|tfoot|col|colgroup|th|td|tr',\n 'div|article|section|footer|aside|details|summary|code|audio|video|canvas|figure',\n 'address|center|cite|p|pre|blockquote|marquee|caption|figcaption|track|source|output|svg',\n].join('|');\nexport const inlineNames = [\n 'span|a|link|b|s|i|del|u|em|strong|sup|sub|kbd',\n 'nav|font|bdi|samp|map|area|small|time|bdo|var|wbr|meter|dfn',\n 'ruby|rt|rp|mark|q|progress|input|textarea|select|ins',\n].join('|');\nexport const inlineBlock = 'br|img|hr';\nexport const whiteList = new RegExp(`^(${blockNames}|${inlineNames}|${inlineBlock})( |$|/)`, 'i');\n\nexport function escapeHTMLSpecialChar(content, enableQuote) {\n if (typeof content !== 'string') {\n return '';\n }\n if (enableQuote) {\n return content.replace(/[<>&]/g, (char) => escapeMap[char] || char);\n }\n return content.replace(/[<>&\"']/g, (char) => escapeMap[char] || char);\n}\n\nexport function unescapeHTMLSpecialChar(content) {\n if (typeof content !== 'string') {\n return '';\n }\n return content.replace(/&(\\w+);?/g, (escaped, name) => unescapeMap[name] || escaped);\n}\n\nexport function escapeHTMLSpecialCharOnce(content, enableQuote) {\n if (typeof content !== 'string') {\n return '';\n }\n let str = convertHTMLNumberToName(content);\n str = unescapeHTMLSpecialChar(str);\n return escapeHTMLSpecialChar(str, enableQuote);\n}\n\nexport function convertHTMLNumberToName(html) {\n const entities = /&#(\\d+);?/g;\n return html.replace(entities, (match, codePoint) => htmlEntitiesMap[codePoint] || match);\n}\n\nexport function unescapeHTMLNumberEntities(html) {\n const entities = /&#(\\d+);?/g;\n return html.replace(entities, (match, codePoint) => {\n try {\n const escaped = String.fromCodePoint(codePoint);\n return escaped;\n } catch (e) {\n return match;\n }\n });\n}\n\nexport function unescapeHTMLHexEntities(html) {\n const entities = /&#x([0-9a-f]+);?/gi;\n return html.replace(entities, (match, codePoint) => {\n const hexCode = parseInt(`0x${codePoint}`, 16);\n try {\n const escaped = String.fromCodePoint(hexCode);\n return escaped;\n } catch (e) {\n return match;\n }\n });\n}\n\nexport function isValidScheme(url) {\n const regex = /^\\s*([\\w\\W]+?)(?=:)/i;\n const match = unescapeHTMLHexEntities(unescapeHTMLNumberEntities(url)).match(regex);\n if (!match) {\n return true;\n }\n const SCHEME_BLACKLIST = ['javascript', 'data'];\n const scheme = match[1].replace(/[\\s]/g, ''); // 协议中间可能会出现空白字符绕过检查\n if (SCHEME_BLACKLIST.indexOf(scheme.toLowerCase()) !== -1) {\n return false;\n }\n return true;\n}\n\n/**\n * ref: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent\n * RFC3986 encodeURIComponent\n * @param {string} str\n */\nexport function encodeURIComponentRFC3986(str) {\n return encodeURIComponent(str).replace(/[!'()*]/g, (char) => `%${char.charCodeAt(0).toString(16)}`);\n}\n\n/**\n * ref: https://stackoverflow.com/questions/9245333/should-encodeuri-ever-be-used\n * @param {string} str\n */\nexport function encodeURIOnce(str) {\n return encodeURI(str)\n .replace(/[!'()*]/g, (char) => `%${char.charCodeAt(0).toString(16)}`)\n .replace(/%25/g, '%');\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase, { HOOKS_TYPE_LIST } from './SyntaxBase';\nimport { prependLineFeedForParagraph } from '@/utils/lineFeed';\nimport { getIsClassicBrFromLocal, testKeyInLocal } from '@/utils/config';\nimport { blockNames } from '@/utils/sanitize';\n\nlet cacheCounter = 0;\n// ~~C${cacheCounter}I${cacheIndex}$\n// let cacheMap = {};\n\nexport default class ParagraphBase extends SyntaxBase {\n static HOOK_TYPE = HOOKS_TYPE_LIST.PAR;\n // 不需要排他的sign前缀,如~~C0I${IN_PARAGRAPH_CACHE_KEY_PREFIX}sign$\n static IN_PARAGRAPH_CACHE_KEY_PREFIX = '!';\n static IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX = '\\\\!';\n\n constructor({ needCache, defaultCache = {} } = { needCache: false }) {\n super({});\n this.needCache = !!needCache;\n this.sign = '';\n if (needCache) {\n this.cache = defaultCache || {};\n this.cacheKey = `~~C${cacheCounter}`;\n cacheCounter += 1;\n }\n }\n\n initBrReg(classicBr = false) {\n // 是否启用经典换行逻辑\n // true:一个换行会被忽略,两个以上连续换行会分割成段落,\n // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落\n this.classicBr = testKeyInLocal('classicBr') ? getIsClassicBrFromLocal() : classicBr;\n this.removeBrAfterBlock = null;\n this.removeBrBeforeBlock = null;\n this.removeNewlinesBetweenTags = null;\n }\n\n /**\n * 处理经典换行问题\n * @param {string} str markdown源码\n * @returns markdown源码\n */\n $cleanParagraph(str) {\n // remove leading and trailing newlines\n const trimedPar = str.replace(/^\\n+/, '').replace(/\\n+$/, '');\n if (this.classicBr) {\n return trimedPar;\n }\n const minifiedPar = this.joinRawHtml(trimedPar);\n return minifiedPar.replace(/\\n/g, '
').replace(/\\r/g, '\\n'); // recover \\n from \\r\n }\n\n /**\n * remove all newlines in html text\n *\n * @param {string} textContainsHtml\n */\n joinRawHtml(textContainsHtml) {\n if (!this.removeBrAfterBlock) {\n // preprocess custom white list\n let customTagWhiteList = this.$engine.htmlWhiteListAppend?.split('|') ?? [];\n customTagWhiteList = customTagWhiteList\n .map((tag) => {\n if (/[a-z-]+/gi.test(tag)) {\n return tag;\n }\n return null;\n })\n .filter((tag) => tag !== null);\n // concat all white list\n const allBlockNames = customTagWhiteList.concat(blockNames).join('|');\n // 段落标签自然换行,所以去掉段落标签两边的换行符\n /**\n * remove newlines after start tag, and remove whitespaces before newline\n * e.g.\n *

\\n text

=>

text

\n * ^^\n * $1$2\n */\n this.removeBrAfterBlock = new RegExp(`<(${allBlockNames})(>| [^>]*?>)[^\\\\S\\\\n]*?\\\\n`, 'ig');\n /**\n * remove newlines before end tag, and whitespaces before end tag will be preserved\n * e.g.\n *

text\\n

=>

text

\n * ^\n * $1\n */\n this.removeBrBeforeBlock = new RegExp(`\\\\n[^\\\\S\\\\n]*?<\\\\/(${allBlockNames})>[^\\\\S\\\\n]*?\\\\n`, 'ig');\n /**\n * remove newlines between end tag & start tag\n * e.g.\n *

\\n

=>

\\r

\n * ^ ^^ ^ ^^^^^^^^^^^^\n * $1 $2 $3 $4\n */\n this.removeNewlinesBetweenTags = new RegExp(\n `<\\\\/(${allBlockNames})>[^\\\\S\\\\n]*?\\\\n([^\\\\S\\\\n]*?)<(${allBlockNames})(>| [^>]*?>)`,\n 'ig',\n );\n }\n return textContainsHtml\n .replace(this.removeBrAfterBlock, '<$1$2')\n .replace(this.removeBrBeforeBlock, '')\n .replace(this.removeNewlinesBetweenTags, '\\r$2<$3$4'); // replace \\n to \\r\n }\n\n toHtml(str, sentenceMakeFunc) {\n return str;\n }\n\n makeHtml(str, sentenceMakeFunc) {\n return sentenceMakeFunc(str).html;\n }\n\n afterMakeHtml(html) {\n return this.restoreCache(html);\n }\n\n isContainsCache(str, fullMatch) {\n if (fullMatch) {\n // 如果是全匹配:不能包含CherryINPRAGRAPH\n const containsParagraphCache = /^(\\s*~~C\\d+I\\w+\\$\\s*)+$/g.test(str);\n const containsInParagraphCache = new RegExp(\n `~~C\\\\d+I${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX}\\\\w+\\\\$`,\n 'g',\n ).test(str);\n return containsParagraphCache && !containsInParagraphCache;\n }\n // 如果是局部匹配: 不能只包含CherryINPRAGRAPH\n // const containsParagraphCache = /~~C\\d+I\\w+\\$/g.test(str);\n // const containsInParagraphCache = new RegExp(\n // `~~C\\\\d+I${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX}\\\\w+\\\\$`, 'g').test(str);\n const containsNonInParagraphCache = new RegExp(\n `~~C\\\\d+I(?!${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX})\\\\w+\\\\$`,\n 'g',\n ).test(str);\n return containsNonInParagraphCache;\n\n // return fullMatch ?\n // /^(\\s*~~C\\d+I\\w+\\$\\s*)+$/g.test(str) && !/^(\\s*~~C\\d+ICherryINPRAGRAPH\\w+\\$\\s*)+$/g.test(str) :\n // /~~C\\d+I\\w+\\$/g.test(str) && !(/~~C\\d+ICherryINPRAGRAPH\\w+\\$/g.test(str)\n // && !/~~C\\d+I(?!CherryINPRAGRAPH)\\w+\\$/g.test(str));\n }\n\n /**\n *\n * @param {string} html\n * @return\n */\n $splitHtmlByCache(html) {\n // ~~C0I(?!prefix)sign$\n const regex = new RegExp(`\\\\n*~~C\\\\d+I(?!${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX})\\\\w+\\\\$\\\\n?`, 'g');\n return {\n caches: html.match(regex),\n contents: html.split(regex),\n };\n }\n\n makeExcludingCached(content, processor) {\n const { caches, contents } = this.$splitHtmlByCache(content);\n const paragraphs = contents.map(processor);\n let ret = '';\n for (let i = 0; i < paragraphs.length; i++) {\n ret += paragraphs[i];\n if (caches && caches[i]) {\n ret += caches[i].trim();\n }\n }\n return ret;\n }\n\n /**\n * 获取非捕获匹配丢掉的换行,适用于能被【嵌套】的段落语法\n *\n * @param {string} cache 需要返回的cache\n * @param {string} md 原始的md字符串\n * @param {boolean} alwaysAlone 是否能被【嵌套】,true:不能被嵌套,如标题、注释等;false:能被嵌套,如代码块、有序列表等\n * @return {string} str\n */\n getCacheWithSpace(cache, md, alwaysAlone = false) {\n const preSpace = md.match(/^\\n+/)?.[0] ?? '';\n const afterSpace = md.match(/\\n+$/)?.[0] ?? '';\n if (alwaysAlone) {\n return prependLineFeedForParagraph(md, cache);\n }\n return `${preSpace}${cache}${afterSpace}`;\n }\n\n /**\n * 获取行号,只负责向上计算\\n\n * 会计算cache的行号\n *\n * @param {string} md md内容\n * @param {string} preSpace 前置换行\n * @return {number} 行数\n */\n getLineCount(md, preSpace = '') {\n let content = md;\n /**\n * 前置换行个数,【注意】:前置换行个数不包括上文的最后一个\\n\n * 例:\n * - aa\\n\n * - bb\\n\n * \\n\n * cc\\n\n *\n * cc的前置换行个数为 1,bb后的\\n不计算在内\n * cc的正则为:/(?:^|\\n)(\\n*)xxxxxx/\n */\n let preLineCount = preSpace.match(/^\\n+/g)?.[0]?.length ?? 0;\n preLineCount = preLineCount === 1 ? 1 : 0; // 前置换行超过2个就交给BR进行渲染\n content = content.replace(/^\\n+/g, '');\n\n const regex = new RegExp(\n `\\n*~~C\\\\d+I(?:${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX})?\\\\w+?_L(\\\\d+)\\\\$`,\n 'g',\n );\n let cacheLineCount = 0;\n content = content.replace(regex, (match, lineCount) => {\n cacheLineCount += parseInt(lineCount, 10);\n return match.replace(/^\\n+/g, '');\n });\n return preLineCount + cacheLineCount + (content.match(/\\n/g) || []).length + 1; // 实际内容所占行数,至少为1行\n }\n\n /**\n *\n * @param {string} str 渲染后的内容\n * @param {string} sign 签名\n * @param {number} lineCount md原文的行数\n * @return {string} cacheKey ~~C0I0_L1$\n */\n pushCache(str, sign = '', lineCount = 0) {\n if (!this.needCache) {\n return;\n }\n const $sign = sign || this.$engine.md5(str);\n this.cache[$sign] = {\n content: str,\n using: true,\n };\n return `${this.cacheKey}I${$sign}_L${lineCount}$`;\n }\n\n popCache(sign) {\n if (!this.needCache) {\n return;\n }\n return this.cache[sign].content || '';\n }\n\n resetCache() {\n if (!this.needCache) {\n return;\n }\n for (const key of Object.keys(this.cache)) {\n if (!this.cache[key].using) delete this.cache[key];\n }\n for (const key of Object.keys(this.cache)) {\n this.cache[key].using = false;\n }\n }\n\n restoreCache(html) {\n // restore cached content\n if (!this.needCache) {\n return html;\n }\n const regex = new RegExp(\n `${this.cacheKey}I((?:${ParagraphBase.IN_PARAGRAPH_CACHE_KEY_PREFIX_REGEX})?\\\\w+)\\\\$`,\n 'g',\n );\n const $html = html.replace(regex, (match, cacheSign) => this.popCache(cacheSign.replace(/_L\\d+$/, '')));\n this.resetCache();\n return $html;\n }\n\n /**\n *\n * @param {string} wholeMatch whole match\n */\n checkCache(wholeMatch, sentenceMakeFunc, lineCount = 0) {\n this.sign = this.$engine.md5(wholeMatch);\n // miss cache\n if (!this.cache[this.sign]) {\n return this.toHtml(wholeMatch, sentenceMakeFunc);\n }\n // hit & mark cache\n this.cache[this.sign].using = true;\n return `${this.cacheKey}I${this.sign}_L${lineCount}$`;\n }\n\n mounted() {\n // console.log('base mounted');\n }\n\n signWithCache(html) {\n return false;\n }\n}\n","// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it\nvar fails = require('../internals/fails');\n\nmodule.exports = fails(function () {\n if (typeof ArrayBuffer == 'function') {\n var buffer = new ArrayBuffer(8);\n // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-defineproperty -- safe\n if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { value: 8 });\n }\n});\n","var fails = require('../internals/fails');\nvar isObject = require('../internals/is-object');\nvar classof = require('../internals/classof-raw');\nvar ARRAY_BUFFER_NON_EXTENSIBLE = require('../internals/array-buffer-non-extensible');\n\n// eslint-disable-next-line es-x/no-object-isextensible -- safe\nvar $isExtensible = Object.isExtensible;\nvar FAILS_ON_PRIMITIVES = fails(function () { $isExtensible(1); });\n\n// `Object.isExtensible` method\n// https://tc39.es/ecma262/#sec-object.isextensible\nmodule.exports = (FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE) ? function isExtensible(it) {\n if (!isObject(it)) return false;\n if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false;\n return $isExtensible ? $isExtensible(it) : true;\n} : $isExtensible;\n","var fails = require('../internals/fails');\n\nmodule.exports = !fails(function () {\n // eslint-disable-next-line es-x/no-object-isextensible, es-x/no-object-preventextensions -- required for testing\n return Object.isExtensible(Object.preventExtensions({}));\n});\n","var $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar hiddenKeys = require('../internals/hidden-keys');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar defineProperty = require('../internals/object-define-property').f;\nvar getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');\nvar getOwnPropertyNamesExternalModule = require('../internals/object-get-own-property-names-external');\nvar isExtensible = require('../internals/object-is-extensible');\nvar uid = require('../internals/uid');\nvar FREEZING = require('../internals/freezing');\n\nvar REQUIRED = false;\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + id++, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!hasOwn(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!hasOwn(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar enable = function () {\n meta.enable = function () { /* empty */ };\n REQUIRED = true;\n var getOwnPropertyNames = getOwnPropertyNamesModule.f;\n var splice = uncurryThis([].splice);\n var test = {};\n test[METADATA] = 1;\n\n // prevent exposing of metadata key\n if (getOwnPropertyNames(test).length) {\n getOwnPropertyNamesModule.f = function (it) {\n var result = getOwnPropertyNames(it);\n for (var i = 0, length = result.length; i < length; i++) {\n if (result[i] === METADATA) {\n splice(result, i, 1);\n break;\n }\n } return result;\n };\n\n $({ target: 'Object', stat: true, forced: true }, {\n getOwnPropertyNames: getOwnPropertyNamesExternalModule.f\n });\n }\n};\n\nvar meta = module.exports = {\n enable: enable,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n","var global = require('../internals/global');\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar tryToString = require('../internals/try-to-string');\nvar isArrayIteratorMethod = require('../internals/is-array-iterator-method');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\nvar getIterator = require('../internals/get-iterator');\nvar getIteratorMethod = require('../internals/get-iterator-method');\nvar iteratorClose = require('../internals/iterator-close');\n\nvar TypeError = global.TypeError;\n\nvar Result = function (stopped, result) {\n this.stopped = stopped;\n this.result = result;\n};\n\nvar ResultPrototype = Result.prototype;\n\nmodule.exports = function (iterable, unboundFunction, options) {\n var that = options && options.that;\n var AS_ENTRIES = !!(options && options.AS_ENTRIES);\n var IS_ITERATOR = !!(options && options.IS_ITERATOR);\n var INTERRUPTED = !!(options && options.INTERRUPTED);\n var fn = bind(unboundFunction, that);\n var iterator, iterFn, index, length, result, next, step;\n\n var stop = function (condition) {\n if (iterator) iteratorClose(iterator, 'normal', condition);\n return new Result(true, condition);\n };\n\n var callFn = function (value) {\n if (AS_ENTRIES) {\n anObject(value);\n return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);\n } return INTERRUPTED ? fn(value, stop) : fn(value);\n };\n\n if (IS_ITERATOR) {\n iterator = iterable;\n } else {\n iterFn = getIteratorMethod(iterable);\n if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable');\n // optimisation for array iterators\n if (isArrayIteratorMethod(iterFn)) {\n for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) {\n result = callFn(iterable[index]);\n if (result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n }\n iterator = getIterator(iterable, iterFn);\n }\n\n next = iterator.next;\n while (!(step = call(next, iterator)).done) {\n try {\n result = callFn(step.value);\n } catch (error) {\n iteratorClose(iterator, 'throw', error);\n }\n if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result;\n } return new Result(false);\n};\n","var global = require('../internals/global');\nvar isPrototypeOf = require('../internals/object-is-prototype-of');\n\nvar TypeError = global.TypeError;\n\nmodule.exports = function (it, Prototype) {\n if (isPrototypeOf(Prototype, it)) return it;\n throw TypeError('Incorrect invocation');\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar fails = require('../internals/fails');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar iterate = require('../internals/iterate');\nvar anInstance = require('../internals/an-instance');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar defineProperty = require('../internals/object-define-property').f;\nvar forEach = require('../internals/array-iteration').forEach;\nvar DESCRIPTORS = require('../internals/descriptors');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var exported = {};\n var Constructor;\n\n if (!DESCRIPTORS || !isCallable(NativeConstructor)\n || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))\n ) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n InternalMetadataModule.enable();\n } else {\n Constructor = wrapper(function (target, iterable) {\n setInternalState(anInstance(target, Prototype), {\n type: CONSTRUCTOR_NAME,\n collection: new NativeConstructor()\n });\n if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {\n var IS_ADDER = KEY == 'add' || KEY == 'set';\n if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {\n createNonEnumerableProperty(Prototype, KEY, function (a, b) {\n var collection = getInternalState(this).collection;\n if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;\n var result = collection[KEY](a === 0 ? 0 : a, b);\n return IS_ADDER ? this : result;\n });\n }\n });\n\n IS_WEAK || defineProperty(Prototype, 'size', {\n configurable: true,\n get: function () {\n return getInternalState(this).collection.size;\n }\n });\n }\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n $({ global: true, forced: true }, exported);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n","var defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) {\n if (options && options.unsafe && target[key]) target[key] = src[key];\n else defineBuiltIn(target, key, src[key], options);\n } return target;\n};\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar definePropertyModule = require('../internals/object-define-property');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar DESCRIPTORS = require('../internals/descriptors');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (CONSTRUCTOR_NAME) {\n var Constructor = getBuiltIn(CONSTRUCTOR_NAME);\n var defineProperty = definePropertyModule.f;\n\n if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {\n defineProperty(Constructor, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n }\n};\n","'use strict';\nvar defineProperty = require('../internals/object-define-property').f;\nvar create = require('../internals/object-create');\nvar defineBuiltIns = require('../internals/define-built-ins');\nvar bind = require('../internals/function-bind-context');\nvar anInstance = require('../internals/an-instance');\nvar iterate = require('../internals/iterate');\nvar defineIterator = require('../internals/define-iterator');\nvar setSpecies = require('../internals/set-species');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fastKey = require('../internals/internal-metadata').fastKey;\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var Constructor = wrapper(function (that, iterable) {\n anInstance(that, Prototype);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n index: create(null),\n first: undefined,\n last: undefined,\n size: 0\n });\n if (!DESCRIPTORS) that.size = 0;\n if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n var previous, index;\n // change existing entry\n if (entry) {\n entry.value = value;\n // create new entry\n } else {\n state.last = entry = {\n index: index = fastKey(key, true),\n key: key,\n value: value,\n previous: previous = state.last,\n next: undefined,\n removed: false\n };\n if (!state.first) state.first = entry;\n if (previous) previous.next = entry;\n if (DESCRIPTORS) state.size++;\n else that.size++;\n // add to index\n if (index !== 'F') state.index[index] = entry;\n } return that;\n };\n\n var getEntry = function (that, key) {\n var state = getInternalState(that);\n // fast case\n var index = fastKey(key);\n var entry;\n if (index !== 'F') return state.index[index];\n // frozen object case\n for (entry = state.first; entry; entry = entry.next) {\n if (entry.key == key) return entry;\n }\n };\n\n defineBuiltIns(Prototype, {\n // `{ Map, Set }.prototype.clear()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.clear\n // https://tc39.es/ecma262/#sec-set.prototype.clear\n clear: function clear() {\n var that = this;\n var state = getInternalState(that);\n var data = state.index;\n var entry = state.first;\n while (entry) {\n entry.removed = true;\n if (entry.previous) entry.previous = entry.previous.next = undefined;\n delete data[entry.index];\n entry = entry.next;\n }\n state.first = state.last = undefined;\n if (DESCRIPTORS) state.size = 0;\n else that.size = 0;\n },\n // `{ Map, Set }.prototype.delete(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.delete\n // https://tc39.es/ecma262/#sec-set.prototype.delete\n 'delete': function (key) {\n var that = this;\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n if (entry) {\n var next = entry.next;\n var prev = entry.previous;\n delete state.index[entry.index];\n entry.removed = true;\n if (prev) prev.next = next;\n if (next) next.previous = prev;\n if (state.first == entry) state.first = next;\n if (state.last == entry) state.last = prev;\n if (DESCRIPTORS) state.size--;\n else that.size--;\n } return !!entry;\n },\n // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.foreach\n // https://tc39.es/ecma262/#sec-set.prototype.foreach\n forEach: function forEach(callbackfn /* , that = undefined */) {\n var state = getInternalState(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var entry;\n while (entry = entry ? entry.next : state.first) {\n boundFunction(entry.value, entry.key, this);\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n }\n },\n // `{ Map, Set}.prototype.has(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.has\n // https://tc39.es/ecma262/#sec-set.prototype.has\n has: function has(key) {\n return !!getEntry(this, key);\n }\n });\n\n defineBuiltIns(Prototype, IS_MAP ? {\n // `Map.prototype.get(key)` method\n // https://tc39.es/ecma262/#sec-map.prototype.get\n get: function get(key) {\n var entry = getEntry(this, key);\n return entry && entry.value;\n },\n // `Map.prototype.set(key, value)` method\n // https://tc39.es/ecma262/#sec-map.prototype.set\n set: function set(key, value) {\n return define(this, key === 0 ? 0 : key, value);\n }\n } : {\n // `Set.prototype.add(value)` method\n // https://tc39.es/ecma262/#sec-set.prototype.add\n add: function add(value) {\n return define(this, value = value === 0 ? 0 : value, value);\n }\n });\n if (DESCRIPTORS) defineProperty(Prototype, 'size', {\n get: function () {\n return getInternalState(this).size;\n }\n });\n return Constructor;\n },\n setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {\n var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';\n var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);\n var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);\n // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.entries\n // https://tc39.es/ecma262/#sec-map.prototype.keys\n // https://tc39.es/ecma262/#sec-map.prototype.values\n // https://tc39.es/ecma262/#sec-map.prototype-@@iterator\n // https://tc39.es/ecma262/#sec-set.prototype.entries\n // https://tc39.es/ecma262/#sec-set.prototype.keys\n // https://tc39.es/ecma262/#sec-set.prototype.values\n // https://tc39.es/ecma262/#sec-set.prototype-@@iterator\n defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {\n setInternalState(this, {\n type: ITERATOR_NAME,\n target: iterated,\n state: getInternalCollectionState(iterated),\n kind: kind,\n last: undefined\n });\n }, function () {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var entry = state.last;\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n // get next entry\n if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {\n // or finish the iteration\n state.target = undefined;\n return { value: undefined, done: true };\n }\n // return step by kind\n if (kind == 'keys') return { value: entry.key, done: false };\n if (kind == 'values') return { value: entry.value, done: false };\n return { value: [entry.key, entry.value], done: false };\n }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);\n\n // `{ Map, Set }.prototype[@@species]` accessors\n // https://tc39.es/ecma262/#sec-get-map-@@species\n // https://tc39.es/ecma262/#sec-get-set-@@species\n setSpecies(CONSTRUCTOR_NAME);\n }\n};\n","'use strict';\nvar collection = require('../internals/collection');\nvar collectionStrong = require('../internals/collection-strong');\n\n// `Map` constructor\n// https://tc39.es/ecma262/#sec-map-objects\ncollection('Map', function (init) {\n return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };\n}, collectionStrong);\n","require('../../modules/es.array.iterator');\nrequire('../../modules/es.map');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.string.iterator');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Map;\n","var parent = require('../../es/map');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","var parent = require('../../stable/map');\n\nmodule.exports = parent;\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar aConstructor = require('../internals/a-constructor');\nvar iterate = require('../internals/iterate');\n\nvar push = [].push;\n\nmodule.exports = function from(source /* , mapFn, thisArg */) {\n var length = arguments.length;\n var mapFn = length > 1 ? arguments[1] : undefined;\n var mapping, array, n, boundFunction;\n aConstructor(this);\n mapping = mapFn !== undefined;\n if (mapping) aCallable(mapFn);\n if (source == undefined) return new this();\n array = [];\n if (mapping) {\n n = 0;\n boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined);\n iterate(source, function (nextItem) {\n call(push, array, boundFunction(nextItem, n++));\n });\n } else {\n iterate(source, push, { that: array });\n }\n return new this(array);\n};\n","var $ = require('../internals/export');\nvar from = require('../internals/collection-from');\n\n// `Map.from` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from\n$({ target: 'Map', stat: true, forced: true }, {\n from: from\n});\n","'use strict';\nvar arraySlice = require('../internals/array-slice');\n\n// https://tc39.github.io/proposal-setmap-offrom/\nmodule.exports = function of() {\n return new this(arraySlice(arguments));\n};\n","var $ = require('../internals/export');\nvar of = require('../internals/collection-of');\n\n// `Map.of` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of\n$({ target: 'Map', stat: true, forced: true }, {\n of: of\n});\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\n\n// https://github.com/tc39/collection-methods\nmodule.exports = function deleteAll(/* ...elements */) {\n var collection = anObject(this);\n var remover = aCallable(collection['delete']);\n var allDeleted = true;\n var wasDeleted;\n for (var k = 0, len = arguments.length; k < len; k++) {\n wasDeleted = call(remover, collection, arguments[k]);\n allDeleted = allDeleted && wasDeleted;\n }\n return !!allDeleted;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar deleteAll = require('../internals/collection-delete-all');\n\n// `Map.prototype.deleteAll` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n deleteAll: deleteAll\n});\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\n\n// `Map.prototype.emplace` method\n// https://github.com/thumbsupep/proposal-upsert\nmodule.exports = function emplace(key, handler) {\n var map = anObject(this);\n var get = aCallable(map.get);\n var has = aCallable(map.has);\n var set = aCallable(map.set);\n var value = (call(has, map, key) && 'update' in handler)\n ? handler.update(call(get, map, key), key, map)\n : handler.insert(key, map);\n call(set, map, key, value);\n return value;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar emplace = require('../internals/map-emplace');\n\n// `Map.prototype.emplace` method\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n emplace: emplace\n});\n","var getIterator = require('../internals/get-iterator');\n\nmodule.exports = getIterator;\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar bind = require('../internals/function-bind-context');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.every` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n every: function every(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return !iterate(iterator, function (key, value, stop) {\n if (!boundFunction(value, key, map)) return stop();\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;\n }\n});\n","var anObject = require('../internals/an-object');\nvar aConstructor = require('../internals/a-constructor');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\n\nvar SPECIES = wellKnownSymbol('species');\n\n// `SpeciesConstructor` abstract operation\n// https://tc39.es/ecma262/#sec-speciesconstructor\nmodule.exports = function (O, defaultConstructor) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar speciesConstructor = require('../internals/species-constructor');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.filter` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n filter: function filter(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();\n var setter = aCallable(newMap.set);\n iterate(iterator, function (key, value) {\n if (boundFunction(value, key, map)) call(setter, newMap, key, value);\n }, { AS_ENTRIES: true, IS_ITERATOR: true });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar bind = require('../internals/function-bind-context');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.find` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n find: function find(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(iterator, function (key, value, stop) {\n if (boundFunction(value, key, map)) return stop(value);\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar bind = require('../internals/function-bind-context');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.findKey` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n findKey: function findKey(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(iterator, function (key, value, stop) {\n if (boundFunction(value, key, map)) return stop(key);\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar getIterator = require('../internals/get-iterator');\nvar iterate = require('../internals/iterate');\n\nvar push = uncurryThis([].push);\n\n// `Map.groupBy` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', stat: true, forced: true }, {\n groupBy: function groupBy(iterable, keyDerivative) {\n aCallable(keyDerivative);\n var iterator = getIterator(iterable);\n var newMap = new this();\n var has = aCallable(newMap.has);\n var get = aCallable(newMap.get);\n var set = aCallable(newMap.set);\n iterate(iterator, function (element) {\n var derivedKey = keyDerivative(element);\n if (!call(has, newMap, derivedKey)) call(set, newMap, derivedKey, [element]);\n else push(call(get, newMap, derivedKey), element);\n }, { IS_ITERATOR: true });\n return newMap;\n }\n});\n","// `SameValueZero` abstract operation\n// https://tc39.es/ecma262/#sec-samevaluezero\nmodule.exports = function (x, y) {\n // eslint-disable-next-line no-self-compare -- NaN check\n return x === y || x != x && y != y;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar sameValueZero = require('../internals/same-value-zero');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.includes` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n includes: function includes(searchElement) {\n return iterate(getMapIterator(anObject(this)), function (key, value, stop) {\n if (sameValueZero(value, searchElement)) return stop();\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar aCallable = require('../internals/a-callable');\n\n// `Map.keyBy` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', stat: true, forced: true }, {\n keyBy: function keyBy(iterable, keyDerivative) {\n var newMap = new this();\n aCallable(keyDerivative);\n var setter = aCallable(newMap.set);\n iterate(iterable, function (element) {\n call(setter, newMap, keyDerivative(element), element);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.keyOf` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n keyOf: function keyOf(searchElement) {\n return iterate(getMapIterator(anObject(this)), function (key, value, stop) {\n if (value === searchElement) return stop(key);\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).result;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar speciesConstructor = require('../internals/species-constructor');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.mapKeys` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapKeys: function mapKeys(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();\n var setter = aCallable(newMap.set);\n iterate(iterator, function (key, value) {\n call(setter, newMap, boundFunction(value, key, map), value);\n }, { AS_ENTRIES: true, IS_ITERATOR: true });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar getBuiltIn = require('../internals/get-built-in');\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar speciesConstructor = require('../internals/species-constructor');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.mapValues` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapValues: function mapValues(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new (speciesConstructor(map, getBuiltIn('Map')))();\n var setter = aCallable(newMap.set);\n iterate(iterator, function (key, value) {\n call(setter, newMap, key, boundFunction(value, key, map));\n }, { AS_ENTRIES: true, IS_ITERATOR: true });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aCallable = require('../internals/a-callable');\nvar anObject = require('../internals/an-object');\nvar iterate = require('../internals/iterate');\n\n// `Map.prototype.merge` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n merge: function merge(iterable /* ...iterables */) {\n var map = anObject(this);\n var setter = aCallable(map.set);\n var argumentsLength = arguments.length;\n var i = 0;\n while (i < argumentsLength) {\n iterate(arguments[i++], setter, { that: map, AS_ENTRIES: true });\n }\n return map;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar anObject = require('../internals/an-object');\nvar aCallable = require('../internals/a-callable');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\nvar TypeError = global.TypeError;\n\n// `Map.prototype.reduce` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var noInitial = arguments.length < 2;\n var accumulator = noInitial ? undefined : arguments[1];\n aCallable(callbackfn);\n iterate(iterator, function (key, value) {\n if (noInitial) {\n noInitial = false;\n accumulator = value;\n } else {\n accumulator = callbackfn(accumulator, value, key, map);\n }\n }, { AS_ENTRIES: true, IS_ITERATOR: true });\n if (noInitial) throw TypeError('Reduce of empty map with no initial value');\n return accumulator;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar anObject = require('../internals/an-object');\nvar bind = require('../internals/function-bind-context');\nvar getMapIterator = require('../internals/get-map-iterator');\nvar iterate = require('../internals/iterate');\n\n// `Set.prototype.some` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n some: function some(callbackfn /* , thisArg */) {\n var map = anObject(this);\n var iterator = getMapIterator(map);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(iterator, function (key, value, stop) {\n if (boundFunction(value, key, map)) return stop();\n }, { AS_ENTRIES: true, IS_ITERATOR: true, INTERRUPTED: true }).stopped;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar anObject = require('../internals/an-object');\nvar aCallable = require('../internals/a-callable');\n\nvar TypeError = global.TypeError;\n\n// `Set.prototype.update` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n update: function update(key, callback /* , thunk */) {\n var map = anObject(this);\n var get = aCallable(map.get);\n var has = aCallable(map.has);\n var set = aCallable(map.set);\n var length = arguments.length;\n aCallable(callback);\n var isPresentInMap = call(has, map, key);\n if (!isPresentInMap && length < 3) {\n throw TypeError('Updating absent value');\n }\n var value = isPresentInMap ? call(get, map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map);\n call(set, map, key, callback(value, key, map));\n return map;\n }\n});\n","'use strict';\nvar global = require('../internals/global');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar isCallable = require('../internals/is-callable');\nvar anObject = require('../internals/an-object');\n\nvar TypeError = global.TypeError;\n\n// `Map.prototype.upsert` method\n// https://github.com/thumbsupep/proposal-upsert\nmodule.exports = function upsert(key, updateFn /* , insertFn */) {\n var map = anObject(this);\n var get = aCallable(map.get);\n var has = aCallable(map.has);\n var set = aCallable(map.set);\n var insertFn = arguments.length > 2 ? arguments[2] : undefined;\n var value;\n if (!isCallable(updateFn) && !isCallable(insertFn)) {\n throw TypeError('At least one callback required');\n }\n if (call(has, map, key)) {\n value = call(get, map, key);\n if (isCallable(updateFn)) {\n value = updateFn(value);\n call(set, map, key, value);\n }\n } else if (isCallable(insertFn)) {\n value = insertFn();\n call(set, map, key, value);\n } return value;\n};\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n upsert: upsert\n});\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, {\n updateOrInsert: upsert\n});\n","var parent = require('../../actual/map');\nrequire('../../modules/esnext.map.from');\nrequire('../../modules/esnext.map.of');\nrequire('../../modules/esnext.map.delete-all');\nrequire('../../modules/esnext.map.emplace');\nrequire('../../modules/esnext.map.every');\nrequire('../../modules/esnext.map.filter');\nrequire('../../modules/esnext.map.find');\nrequire('../../modules/esnext.map.find-key');\nrequire('../../modules/esnext.map.group-by');\nrequire('../../modules/esnext.map.includes');\nrequire('../../modules/esnext.map.key-by');\nrequire('../../modules/esnext.map.key-of');\nrequire('../../modules/esnext.map.map-keys');\nrequire('../../modules/esnext.map.map-values');\nrequire('../../modules/esnext.map.merge');\nrequire('../../modules/esnext.map.reduce');\nrequire('../../modules/esnext.map.some');\nrequire('../../modules/esnext.map.update');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.upsert');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.update-or-insert');\n\nmodule.exports = parent;\n","module.exports = require('../../full/map');\n","module.exports = require(\"core-js-pure/features/map\");","var _indexOfInstanceProperty = require(\"@babel/runtime-corejs3/core-js/instance/index-of\");\n\nfunction _isNativeFunction(fn) {\n var _context;\n\n return _indexOfInstanceProperty(_context = Function.toString.call(fn)).call(_context, \"[native code]\") !== -1;\n}\n\nmodule.exports = _isNativeFunction, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var parent = require('../../stable/reflect/construct');\n\nmodule.exports = parent;\n","var parent = require('../../actual/reflect/construct');\n\nmodule.exports = parent;\n","module.exports = require('../../full/reflect/construct');\n","module.exports = require(\"core-js-pure/features/reflect/construct\");","var parent = require('../../stable/instance/bind');\n\nmodule.exports = parent;\n","var parent = require('../../actual/instance/bind');\n\nmodule.exports = parent;\n","module.exports = require('../../full/instance/bind');\n","module.exports = require(\"core-js-pure/features/instance/bind\");","var _Reflect$construct = require(\"@babel/runtime-corejs3/core-js/reflect/construct\");\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !_Reflect$construct) return false;\n if (_Reflect$construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nmodule.exports = _isNativeReflectConstruct, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Reflect$construct = require(\"@babel/runtime-corejs3/core-js/reflect/construct\");\n\nvar _bindInstanceProperty = require(\"@babel/runtime-corejs3/core-js/instance/bind\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nvar isNativeReflectConstruct = require(\"./isNativeReflectConstruct.js\");\n\nfunction _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n module.exports = _construct = _Reflect$construct, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n } else {\n module.exports = _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n\n var Constructor = _bindInstanceProperty(Function).apply(Parent, a);\n\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n }\n\n return _construct.apply(null, arguments);\n}\n\nmodule.exports = _construct, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Map = require(\"@babel/runtime-corejs3/core-js/map\");\n\nvar _Object$create = require(\"@babel/runtime-corejs3/core-js/object/create\");\n\nvar getPrototypeOf = require(\"./getPrototypeOf.js\");\n\nvar setPrototypeOf = require(\"./setPrototypeOf.js\");\n\nvar isNativeFunction = require(\"./isNativeFunction.js\");\n\nvar construct = require(\"./construct.js\");\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof _Map === \"function\" ? new _Map() : undefined;\n\n module.exports = _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n\n _cache.set(Class, Wrapper);\n }\n\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n\n Wrapper.prototype = _Object$create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n return _wrapNativeSuper(Class);\n}\n\nmodule.exports = _wrapNativeSuper, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 三个地方的错误异常校验\n * 1. markdown 对象参数校验\n * 2. editText 用户输入校验,执行engine过程以防异常\n * 3. 自定义hook校验 对外开发者开发标准校验\n */\n\nexport const $expectTarget = (target, Constructor) => {\n if (\n (!Array.isArray(target) && typeof target !== Constructor.name.toLowerCase()) ||\n (!Array.isArray(target) && Constructor.name.toLowerCase() === 'array')\n ) {\n throw new TypeError(`parameter given must be ${Constructor.name}`);\n }\n\n return true;\n};\n\nexport const $expectInherit = (target, parent) => {\n if (!(target instanceof parent)) {\n throw new Error('the hook does not correctly inherit');\n }\n return true;\n};\n\nexport const $expectInstance = (target) => {\n if (typeof target !== 'object') {\n throw new Error('the hook must be a instance, not a class');\n }\n return true;\n};\n\n// ref: https://github.com/mdlavin/nested-error-stacks\nexport default class NestedError extends Error {\n constructor(message, nested) {\n super(message);\n this.name = 'Error';\n this.stack = this.buildStackTrace(nested);\n }\n\n buildStackTrace(nested) {\n const stack = nested && nested.stack ? nested.stack : '';\n const newStack = `${this.stack}\\nCaused By: ${stack}`;\n return newStack;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase from './SyntaxBase';\nimport ParagraphBase from './ParagraphBase';\nimport { $expectTarget } from '@/utils/error';\nimport Logger from '@/Logger';\n\n/**\n * @typedef {import('~types/cherry').CherryOptions} CherryOptions\n * @typedef {import('~types/cherry').CherryEngineOptions} CherryEngineOptions\n * @typedef {import('~types/cherry').CustomSyntaxRegConfig} CustomSyntaxRegConfig\n * @typedef { (SyntaxBase | ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntax\n * @typedef { (typeof SyntaxBase | typeof ParagraphBase) & { Cherry$$CUSTOM: true } } CustomSyntaxClass\n */\n\nconst WARN_DUPLICATED = -1;\nconst WARN_NOT_A_VALID_HOOK = -2;\n\n/**\n * 处理报错信息,在dev模式下才会输出报错信息\n * @param {number} type\n * @param {any} objClass\n * @param {number} index\n */\nfunction processWarning(type, objClass, index) {\n if (type === WARN_DUPLICATED) {\n Logger.warn(\n `Duplicate hook name [${objClass.HOOK_NAME}] found, hook [${objClass.toString()}] ${\n isNaN(index) ? '' : `at index [${index}] `\n }will not take effect.`,\n );\n } else if (type === WARN_NOT_A_VALID_HOOK) {\n Logger.warn(\n `Hook [${objClass.toString()}] ${\n isNaN(index) ? '' : `at index [${index}] `\n }is not a valid hook, and will not take effect.`,\n );\n }\n}\n\n/**\n * 是否一个合法的 HookClass\n * @param {any} HookClass\n * @returns { HookClass is (typeof SyntaxBase | typeof ParagraphBase) }\n */\nfunction isHookValid(HookClass) {\n return isProtoOfSyntaxBase(HookClass) || isProtoOfParagraphBase(HookClass);\n}\n\n/**\n * 传入的类是否 SyntaxBase 的子类\n * @param {any} value\n * @returns { value is typeof SyntaxBase }\n */\nfunction isProtoOfSyntaxBase(value) {\n return Object.prototype.isPrototypeOf.call(SyntaxBase, value);\n}\n\n/**\n * 传入的类是否 ParagraphBase 的子类\n * @param {any} value\n * @returns { value is typeof ParagraphBase }\n */\nfunction isProtoOfParagraphBase(value) {\n return Object.prototype.isPrototypeOf.call(ParagraphBase, value);\n}\n\n/**\n * 是否一个配置型的自定义语法\n * @param {any} value\n * @returns { value is CustomSyntaxRegConfig }\n */\nfunction isCustomSyntaxConfig(value) {\n const syntaxClass = /** @type {any} */ (/** @type {CustomSyntaxRegConfig} */ (value)?.syntaxClass);\n return isProtoOfSyntaxBase(syntaxClass) || isProtoOfParagraphBase(syntaxClass);\n}\n\n/**\n * 是否一个已注册的自定义语法hook类\n * @param {any} value\n * @returns { value is CustomSyntaxClass }\n */\nfunction isRegisteredCustomSyntaxClass(value) {\n return isHookValid(value) && /** @type {CustomSyntaxClass} */ (value)?.Cherry$$CUSTOM === true;\n}\n\n/**\n * 语法注册中心\n */\nexport default class HookCenter {\n /**\n *\n * @param {(typeof SyntaxBase)[]} hooksConfig\n * @param {Partial} editorConfig\n */\n constructor(hooksConfig, editorConfig, cherry) {\n this.$locale = cherry.locale;\n /**\n * @property\n * @type {Record} hookList hook 名称 -> hook 类型的映射\n */\n this.hookList = /** @type {any} */ ({});\n\n /**\n * @property\n * @type {Record} hookNameList hook 名称 -> hook 类型的映射\n */\n this.hookNameList = {};\n\n $expectTarget(hooksConfig, Array);\n this.registerInternalHooks(hooksConfig, editorConfig);\n this.registerCustomHooks(editorConfig.engine.customSyntax, editorConfig);\n }\n\n /**\n * 注册系统默认的语法hook\n * @param {any[]} hooksConfig 在hookconfig.js里定义的配置\n * @param {Partial} editorConfig 编辑器配置\n */\n registerInternalHooks(hooksConfig, editorConfig) {\n hooksConfig.forEach(\n /**\n *\n * @param {typeof SyntaxBase} HookClass\n * @param {number} index\n */\n (HookClass, index) => {\n const result = this.register(HookClass, editorConfig);\n processWarning(result, HookClass, index);\n },\n );\n }\n\n /**\n * 注册第三方的语法hook\n * @param {CherryEngineOptions['customSyntax']} customHooks 用户传入的配置\n * @param {Partial} editorConfig 编辑器配置\n */\n registerCustomHooks(customHooks, editorConfig) {\n if (!customHooks) {\n return;\n }\n const hookNames = Object.keys(customHooks);\n hookNames.forEach((hookName) => {\n /** @type {number} */\n let result;\n /** @type {typeof SyntaxBase} */\n let HookClass;\n const customHookConfig = {};\n const hookClassOrConfig = customHooks[hookName];\n if (isProtoOfSyntaxBase(hookClassOrConfig)) {\n HookClass = hookClassOrConfig;\n } else if (isCustomSyntaxConfig(hookClassOrConfig)) {\n HookClass = hookClassOrConfig.syntaxClass;\n customHookConfig.force = Boolean(hookClassOrConfig.force);\n if (hookClassOrConfig.before) {\n customHookConfig.before = hookClassOrConfig.before;\n } else if (hookClassOrConfig.after) {\n customHookConfig.after = hookClassOrConfig.after;\n }\n } else {\n return;\n }\n if (isHookValid(HookClass)) {\n // 自定义Hook标识\n Object.defineProperty(HookClass, 'Cherry$$CUSTOM', {\n enumerable: false,\n configurable: false,\n writable: false,\n value: true,\n });\n result = this.register(HookClass, editorConfig, customHookConfig);\n } else {\n result = WARN_NOT_A_VALID_HOOK;\n }\n processWarning(result, HookClass, undefined);\n });\n }\n\n getHookList() {\n return this.hookList;\n }\n\n getHookNameList() {\n return this.hookNameList;\n }\n\n /**\n *\n * @param {((...args: any[]) => any) | typeof SyntaxBase} HookClass\n * @param {Partial} editorConfig\n * @param {Omit} [customHookConfig]\n * @returns\n */\n register(HookClass, editorConfig, customHookConfig) {\n // filter Configs Here\n const { externals, engine } = editorConfig;\n const { syntax } = engine;\n\n /** @type {SyntaxBase | CustomSyntax} */\n let instance;\n\n /** @type {string} */\n let hookName;\n\n // 首先校验Hook是否合法\n if (!isHookValid(HookClass)) {\n // 可能是一个function hook\n if (typeof HookClass === 'function') {\n const funcHook = HookClass;\n instance = funcHook(editorConfig);\n if (!instance || !isHookValid(instance.constructor)) {\n return WARN_NOT_A_VALID_HOOK;\n }\n hookName = instance.getName();\n } else {\n return WARN_NOT_A_VALID_HOOK;\n }\n } else {\n hookName = HookClass.HOOK_NAME;\n // TODO: 需要考虑自定义 hook 配置的传入方式\n const config = syntax?.[hookName] || {};\n instance = new HookClass({ externals, config, globalConfig: engine.global });\n instance.afterInit(() => {\n instance.setLocale(this.$locale);\n });\n }\n // TODO: 待校验是否需要跳过禁用的自定义 hook\n // Skip Disabled Internal Hooks\n if (syntax[hookName] === false && !isRegisteredCustomSyntaxClass(HookClass)) {\n return;\n }\n // 下面处理的都是 CustomSyntax\n const hookType = instance.getType();\n if (this.hookNameList[hookName]) {\n // 内置 hook 重名\n if (!isRegisteredCustomSyntaxClass(HookClass)) {\n return WARN_DUPLICATED;\n }\n // 自定义 hook 重名且没有开启覆盖的选项\n if (!customHookConfig.force) {\n return WARN_DUPLICATED;\n }\n // 强制覆盖以前的Hook,所以需要移除\n const duplicateHookType = this.hookNameList[hookName].type;\n this.hookList[duplicateHookType] = this.hookList[duplicateHookType].filter((hook) => hook.getName() !== hookName);\n }\n this.hookNameList[hookName] = { type: hookType };\n this.hookList[hookType] = this.hookList[hookType] || [];\n // 内置Hook直接push到结尾\n if (!isRegisteredCustomSyntaxClass(HookClass)) {\n this.hookList[hookType].push(instance);\n return;\n }\n // 插入自定义Hook\n let insertIndex = -1;\n if (customHookConfig.before) {\n insertIndex = this.hookList[hookType].findIndex((hook) => hook.getName() === customHookConfig.before);\n if (insertIndex === -1) {\n Logger.warn(\n `Cannot find hook named [${customHookConfig.before}],\n custom hook [${hookName}] will append to the end of the hooks.`,\n );\n }\n } else if (customHookConfig.after) {\n insertIndex = this.hookList[hookType].findIndex((hook) => hook.getName() === customHookConfig.after);\n insertIndex === -1\n ? Logger.warn(\n `Cannot find hook named [${customHookConfig.after}],\n custom hook [${hookName}] will append to the end of the hooks.`,\n )\n : (insertIndex += 1); // 统一处理往前插入的逻辑,所以要插入某Hook之后,索引需要加一\n }\n // 无需插入或目标索引为数组结尾\n if (insertIndex < 0 || insertIndex >= this.hookList[hookType].length) {\n this.hookList[hookType].push(instance);\n } else {\n this.hookList[hookType].splice(insertIndex, 0, instance);\n }\n // console.log(this.hookList[hookType]);\n }\n}\n","var _Array$isArray = require(\"@babel/runtime-corejs3/core-js/array/is-array\");\n\nvar arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _arrayWithoutHoles(arr) {\n if (_Array$isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var _Symbol = require(\"@babel/runtime-corejs3/core-js/symbol\");\n\nvar _getIteratorMethod = require(\"@babel/runtime-corejs3/core-js/get-iterator-method\");\n\nvar _Array$from = require(\"@babel/runtime-corejs3/core-js/array/from\");\n\nfunction _iterableToArray(iter) {\n if (typeof _Symbol !== \"undefined\" && _getIteratorMethod(iter) != null || iter[\"@@iterator\"] != null) return _Array$from(iter);\n}\n\nmodule.exports = _iterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","function _nonIterableSpread() {\n 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}\n\nmodule.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayWithoutHoles = require(\"./arrayWithoutHoles.js\");\n\nvar iterableToArray = require(\"./iterableToArray.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","var arrayWithHoles = require(\"./arrayWithHoles.js\");\n\nvar iterableToArray = require(\"./iterableToArray.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableRest = require(\"./nonIterableRest.js\");\n\nfunction _toArray(arr) {\n return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();\n}\n\nmodule.exports = _toArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n *\n * @param {string} str\n * @param {{replacedText:string;begin:number;length:number;}[]} buffer\n */\nfunction replaceStringByBuffer(str, buffer) {\n if (!buffer.length) {\n return str;\n }\n const slicedString = [];\n let offset = 0;\n buffer.forEach((buf, index) => {\n slicedString.push(str.slice(offset, buf.begin));\n slicedString.push(buf.replacedText);\n offset = buf.begin + buf.length;\n if (index === buffer.length - 1) {\n slicedString.push(str.slice(offset));\n }\n });\n // console.log(slicedString, slicedString.join(''));\n return slicedString.join('');\n}\n\n/**\n * @param {string} str 原始字符串\n * @param {RegExp} regex 正则\n * @param {(...args: any[])=>string} replacer 字符串替换函数\n * @param {boolean} [continuousMatch=false] 是否连续匹配,主要用于需要后向断言的连续语法匹配\n * @param {number} [rollbackLength=1] 连续匹配时,每次指针回退的长度,默认为 1\n */\nexport function replaceLookbehind(str, regex, replacer, continuousMatch = false, rollbackLength = 1) {\n if (!regex) {\n return str;\n }\n // 从头开始匹配\n regex.lastIndex = 0;\n let args;\n let lastIndex = 0;\n const replaceBuffer = [];\n while ((args = regex.exec(str)) !== null) {\n const replaceInfo = {\n begin: args.index,\n length: args[0].length,\n };\n if (continuousMatch && args.index === lastIndex - rollbackLength) {\n const [match, , ...restArgs] = args;\n // 丢弃 leadingChar,需要调整begin和length\n replaceBuffer.push({\n begin: replaceInfo.begin + rollbackLength,\n length: replaceInfo.length - rollbackLength,\n replacedText: replacer(match.slice(rollbackLength), '', ...restArgs),\n });\n } else {\n replaceBuffer.push({\n ...replaceInfo,\n replacedText: replacer(...args),\n });\n }\n // console.log(args);\n lastIndex = regex.lastIndex;\n regex.lastIndex -= rollbackLength;\n }\n // 正则复位,避免影响其他逻辑\n regex.lastIndex = 0;\n return replaceStringByBuffer(str, replaceBuffer);\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase from '@/core/SyntaxBase';\nimport { isLookbehindSupported } from '@/utils/regexp';\nimport { replaceLookbehind } from '@/utils/lookbehind-replace';\n\nexport default class Color extends SyntaxBase {\n static HOOK_NAME = 'fontColor';\n // constructor() {\n // super();\n // }\n\n toHtml(whole, leadingChar, m1, m2) {\n return `${leadingChar}${m2}`;\n }\n\n makeHtml(str) {\n if (isLookbehindSupported()) {\n return str.replace(this.RULE.reg, this.toHtml);\n }\n return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1);\n }\n\n rule() {\n const ret = {\n begin: isLookbehindSupported() ? '((?${m2}`;\n }\n\n makeHtml(str) {\n if (isLookbehindSupported()) {\n return str.replace(this.RULE.reg, this.toHtml);\n }\n return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1);\n }\n\n rule() {\n const ret = {\n begin: isLookbehindSupported() ? '((?${m3}`;\n }\n\n makeHtml(str) {\n if (!this.test(str)) {\n return str;\n }\n\n if (isLookbehindSupported()) {\n return str.replace(this.RULE.reg, this.toHtml);\n }\n return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1);\n }\n\n rule() {\n const ret = {\n begin: isLookbehindSupported() ? '((?$2');\n }\n\n rule({ config } = { config: undefined }) {\n /** @type {Partial} */\n let ret = {};\n if (!!config.needWhitespace) {\n ret = { begin: '(^|[\\\\s])\\\\~T\\\\~T', end: '\\\\~T\\\\~T(?=\\\\s|$)', content: '([\\\\w\\\\W]+?)' };\n } else {\n ret = { begin: '(^|[^\\\\\\\\])\\\\~T\\\\~T', end: '\\\\~T\\\\~T', content: '([\\\\w\\\\W]+?)' };\n }\n ret.reg = new RegExp(ret.begin + ret.content + ret.end, 'g');\n return ret;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase from '@/core/SyntaxBase';\nimport { isLookbehindSupported } from '@/utils/regexp';\nimport { replaceLookbehind } from '@/utils/lookbehind-replace';\n\nexport default class Sup extends SyntaxBase {\n static HOOK_NAME = 'sup';\n\n // constructor() {\n // super();\n // }\n\n toHtml(whole, leadingChar, m1) {\n return `${leadingChar}${m1}`;\n }\n\n makeHtml(str) {\n if (isLookbehindSupported()) {\n return str.replace(this.RULE.reg, this.toHtml);\n }\n return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1);\n }\n\n rule() {\n const ret = {\n begin: isLookbehindSupported() ? '((?${m1}`;\n }\n\n makeHtml(str) {\n if (isLookbehindSupported()) {\n return str.replace(this.RULE.reg, this.toHtml);\n }\n return replaceLookbehind(str, this.RULE.reg, this.toHtml, true, 1);\n }\n\n rule() {\n const ret = {\n begin: isLookbehindSupported() ? '((?\n\nvar _self = (typeof window !== 'undefined')\n\t? window // if in browser\n\t: (\n\t\t(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)\n\t\t\t? self // if in worker\n\t\t\t: {} // if in node js\n\t);\n\n/**\n * Prism: Lightweight, robust, elegant syntax highlighting\n *\n * @license MIT \n * @author Lea Verou \n * @namespace\n * @public\n */\nvar Prism = (function (_self) {\n\n\t// Private helper vars\n\tvar lang = /(?:^|\\s)lang(?:uage)?-([\\w-]+)(?=\\s|$)/i;\n\tvar uniqueId = 0;\n\n\t// The grammar object for plaintext\n\tvar plainTextGrammar = {};\n\n\n\tvar _ = {\n\t\t/**\n\t\t * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the\n\t\t * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load\n\t\t * additional languages or plugins yourself.\n\t\t *\n\t\t * By setting this value to `true`, Prism will not automatically highlight all code elements on the page.\n\t\t *\n\t\t * You obviously have to change this value before the automatic highlighting started. To do this, you can add an\n\t\t * empty Prism object into the global scope before loading the Prism script like this:\n\t\t *\n\t\t * ```js\n\t\t * window.Prism = window.Prism || {};\n\t\t * Prism.manual = true;\n\t\t * // add a new `.\n this.sequenceIndex = Number(c === CharCodes.Lt);\n }\n }\n stateCDATASequence(c) {\n if (c === Sequences.Cdata[this.sequenceIndex]) {\n if (++this.sequenceIndex === Sequences.Cdata.length) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CdataEnd;\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n }\n }\n else {\n this.sequenceIndex = 0;\n this.state = State.InDeclaration;\n this.stateInDeclaration(c); // Reconsume the character\n }\n }\n /**\n * When we wait for one specific character, we can speed things up\n * by skipping through the buffer until we find it.\n *\n * @returns Whether the character was found.\n */\n fastForwardTo(c) {\n while (++this.index < this.buffer.length + this.offset) {\n if (this.buffer.charCodeAt(this.index - this.offset) === c) {\n return true;\n }\n }\n /*\n * We increment the index at the end of the `parse` loop,\n * so set it to `buffer.length - 1` here.\n *\n * TODO: Refactor `parse` to increment index before calling states.\n */\n this.index = this.buffer.length + this.offset - 1;\n return false;\n }\n /**\n * Comments and CDATA end with `-->` and `]]>`.\n *\n * Their common qualities are:\n * - Their end sequences have a distinct character they start with.\n * - That character is then repeated, so we have to check multiple repeats.\n * - All characters but the start character of the sequence can be skipped.\n */\n stateInCommentLike(c) {\n if (c === this.currentSequence[this.sequenceIndex]) {\n if (++this.sequenceIndex === this.currentSequence.length) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, this.index, 2);\n }\n else {\n this.cbs.oncomment(this.sectionStart, this.index, 2);\n }\n this.sequenceIndex = 0;\n this.sectionStart = this.index + 1;\n this.state = State.Text;\n }\n }\n else if (this.sequenceIndex === 0) {\n // Fast-forward to the first character of the sequence\n if (this.fastForwardTo(this.currentSequence[0])) {\n this.sequenceIndex = 1;\n }\n }\n else if (c !== this.currentSequence[this.sequenceIndex - 1]) {\n // Allow long sequences, eg. --->, ]]]>\n this.sequenceIndex = 0;\n }\n }\n /**\n * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.\n *\n * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).\n * We allow anything that wouldn't end the tag.\n */\n isTagStartChar(c) {\n return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);\n }\n startSpecial(sequence, offset) {\n this.isSpecial = true;\n this.currentSequence = sequence;\n this.sequenceIndex = offset;\n this.state = State.SpecialStartSequence;\n }\n stateBeforeTagName(c) {\n if (c === CharCodes.ExclamationMark) {\n this.state = State.BeforeDeclaration;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Questionmark) {\n this.state = State.InProcessingInstruction;\n this.sectionStart = this.index + 1;\n }\n else if (this.isTagStartChar(c)) {\n const lower = c | 0x20;\n this.sectionStart = this.index;\n if (!this.xmlMode && lower === Sequences.TitleEnd[2]) {\n this.startSpecial(Sequences.TitleEnd, 3);\n }\n else {\n this.state =\n !this.xmlMode && lower === Sequences.ScriptEnd[2]\n ? State.BeforeSpecialS\n : State.InTagName;\n }\n }\n else if (c === CharCodes.Slash) {\n this.state = State.BeforeClosingTagName;\n }\n else {\n this.state = State.Text;\n this.stateText(c);\n }\n }\n stateInTagName(c) {\n if (isEndOfTagSection(c)) {\n this.cbs.onopentagname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateBeforeClosingTagName(c) {\n if (isWhitespace(c)) {\n // Ignore\n }\n else if (c === CharCodes.Gt) {\n this.state = State.Text;\n }\n else {\n this.state = this.isTagStartChar(c)\n ? State.InClosingTagName\n : State.InSpecialComment;\n this.sectionStart = this.index;\n }\n }\n stateInClosingTagName(c) {\n if (c === CharCodes.Gt || isWhitespace(c)) {\n this.cbs.onclosetag(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterClosingTagName;\n this.stateAfterClosingTagName(c);\n }\n }\n stateAfterClosingTagName(c) {\n // Skip everything until \">\"\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeAttributeName(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onopentagend(this.index);\n if (this.isSpecial) {\n this.state = State.InSpecialTag;\n this.sequenceIndex = 0;\n }\n else {\n this.state = State.Text;\n }\n this.baseState = this.state;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.Slash) {\n this.state = State.InSelfClosingTag;\n }\n else if (!isWhitespace(c)) {\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateInSelfClosingTag(c) {\n if (c === CharCodes.Gt) {\n this.cbs.onselfclosingtag(this.index);\n this.state = State.Text;\n this.baseState = State.Text;\n this.sectionStart = this.index + 1;\n this.isSpecial = false; // Reset special state, in case of self-closing special tags\n }\n else if (!isWhitespace(c)) {\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n }\n stateInAttributeName(c) {\n if (c === CharCodes.Eq || isEndOfTagSection(c)) {\n this.cbs.onattribname(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.state = State.AfterAttributeName;\n this.stateAfterAttributeName(c);\n }\n }\n stateAfterAttributeName(c) {\n if (c === CharCodes.Eq) {\n this.state = State.BeforeAttributeValue;\n }\n else if (c === CharCodes.Slash || c === CharCodes.Gt) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (!isWhitespace(c)) {\n this.cbs.onattribend(QuoteType.NoValue, this.index);\n this.state = State.InAttributeName;\n this.sectionStart = this.index;\n }\n }\n stateBeforeAttributeValue(c) {\n if (c === CharCodes.DoubleQuote) {\n this.state = State.InAttributeValueDq;\n this.sectionStart = this.index + 1;\n }\n else if (c === CharCodes.SingleQuote) {\n this.state = State.InAttributeValueSq;\n this.sectionStart = this.index + 1;\n }\n else if (!isWhitespace(c)) {\n this.sectionStart = this.index;\n this.state = State.InAttributeValueNq;\n this.stateInAttributeValueNoQuotes(c); // Reconsume token\n }\n }\n handleInAttributeValue(c, quote) {\n if (c === quote ||\n (!this.decodeEntities && this.fastForwardTo(quote))) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(quote === CharCodes.DoubleQuote\n ? QuoteType.Double\n : QuoteType.Single, this.index);\n this.state = State.BeforeAttributeName;\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateInAttributeValueDoubleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.DoubleQuote);\n }\n stateInAttributeValueSingleQuotes(c) {\n this.handleInAttributeValue(c, CharCodes.SingleQuote);\n }\n stateInAttributeValueNoQuotes(c) {\n if (isWhitespace(c) || c === CharCodes.Gt) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = -1;\n this.cbs.onattribend(QuoteType.Unquoted, this.index);\n this.state = State.BeforeAttributeName;\n this.stateBeforeAttributeName(c);\n }\n else if (this.decodeEntities && c === CharCodes.Amp) {\n this.baseState = this.state;\n this.state = State.BeforeEntity;\n }\n }\n stateBeforeDeclaration(c) {\n if (c === CharCodes.OpeningSquareBracket) {\n this.state = State.CDATASequence;\n this.sequenceIndex = 0;\n }\n else {\n this.state =\n c === CharCodes.Dash\n ? State.BeforeComment\n : State.InDeclaration;\n }\n }\n stateInDeclaration(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.ondeclaration(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateInProcessingInstruction(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.onprocessinginstruction(this.sectionStart, this.index);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeComment(c) {\n if (c === CharCodes.Dash) {\n this.state = State.InCommentLike;\n this.currentSequence = Sequences.CommentEnd;\n // Allow short comments (eg. )\n this.sequenceIndex = 2;\n this.sectionStart = this.index + 1;\n }\n else {\n this.state = State.InDeclaration;\n }\n }\n stateInSpecialComment(c) {\n if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {\n this.cbs.oncomment(this.sectionStart, this.index, 0);\n this.state = State.Text;\n this.sectionStart = this.index + 1;\n }\n }\n stateBeforeSpecialS(c) {\n const lower = c | 0x20;\n if (lower === Sequences.ScriptEnd[3]) {\n this.startSpecial(Sequences.ScriptEnd, 4);\n }\n else if (lower === Sequences.StyleEnd[3]) {\n this.startSpecial(Sequences.StyleEnd, 4);\n }\n else {\n this.state = State.InTagName;\n this.stateInTagName(c); // Consume the token again\n }\n }\n stateBeforeEntity(c) {\n // Start excess with 1 to include the '&'\n this.entityExcess = 1;\n this.entityResult = 0;\n if (c === CharCodes.Num) {\n this.state = State.BeforeNumericEntity;\n }\n else if (c === CharCodes.Amp) {\n // We have two `&` characters in a row. Stay in the current state.\n }\n else {\n this.trieIndex = 0;\n this.trieCurrent = this.entityTrie[0];\n this.state = State.InNamedEntity;\n this.stateInNamedEntity(c);\n }\n }\n stateInNamedEntity(c) {\n this.entityExcess += 1;\n this.trieIndex = determineBranch(this.entityTrie, this.trieCurrent, this.trieIndex + 1, c);\n if (this.trieIndex < 0) {\n this.emitNamedEntity();\n this.index--;\n return;\n }\n this.trieCurrent = this.entityTrie[this.trieIndex];\n const masked = this.trieCurrent & BinTrieFlags.VALUE_LENGTH;\n // If the branch is a value, store it and continue\n if (masked) {\n // The mask is the number of bytes of the value, including the current byte.\n const valueLength = (masked >> 14) - 1;\n // If we have a legacy entity while parsing strictly, just skip the number of bytes\n if (!this.allowLegacyEntity() && c !== CharCodes.Semi) {\n this.trieIndex += valueLength;\n }\n else {\n // Add 1 as we have already incremented the excess\n const entityStart = this.index - this.entityExcess + 1;\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n // If this is a surrogate pair, consume the next two bytes\n this.entityResult = this.trieIndex;\n this.trieIndex += valueLength;\n this.entityExcess = 0;\n this.sectionStart = this.index + 1;\n if (valueLength === 0) {\n this.emitNamedEntity();\n }\n }\n }\n }\n emitNamedEntity() {\n this.state = this.baseState;\n if (this.entityResult === 0) {\n return;\n }\n const valueLength = (this.entityTrie[this.entityResult] & BinTrieFlags.VALUE_LENGTH) >>\n 14;\n switch (valueLength) {\n case 1:\n this.emitCodePoint(this.entityTrie[this.entityResult] &\n ~BinTrieFlags.VALUE_LENGTH);\n break;\n case 2:\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n break;\n case 3: {\n this.emitCodePoint(this.entityTrie[this.entityResult + 1]);\n this.emitCodePoint(this.entityTrie[this.entityResult + 2]);\n }\n }\n }\n stateBeforeNumericEntity(c) {\n if ((c | 0x20) === CharCodes.LowerX) {\n this.entityExcess++;\n this.state = State.InHexEntity;\n }\n else {\n this.state = State.InNumericEntity;\n this.stateInNumericEntity(c);\n }\n }\n emitNumericEntity(strict) {\n const entityStart = this.index - this.entityExcess - 1;\n const numberStart = entityStart + 2 + Number(this.state === State.InHexEntity);\n if (numberStart !== this.index) {\n // Emit leading data if any\n if (entityStart > this.sectionStart) {\n this.emitPartial(this.sectionStart, entityStart);\n }\n this.sectionStart = this.index + Number(strict);\n this.emitCodePoint(replaceCodePoint(this.entityResult));\n }\n this.state = this.baseState;\n }\n stateInNumericEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 10 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n stateInHexEntity(c) {\n if (c === CharCodes.Semi) {\n this.emitNumericEntity(true);\n }\n else if (isNumber(c)) {\n this.entityResult = this.entityResult * 16 + (c - CharCodes.Zero);\n this.entityExcess++;\n }\n else if (isHexDigit(c)) {\n this.entityResult =\n this.entityResult * 16 + ((c | 0x20) - CharCodes.LowerA + 10);\n this.entityExcess++;\n }\n else {\n if (this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n }\n else {\n this.state = this.baseState;\n }\n this.index--;\n }\n }\n allowLegacyEntity() {\n return (!this.xmlMode &&\n (this.baseState === State.Text ||\n this.baseState === State.InSpecialTag));\n }\n /**\n * Remove data that has already been consumed from the buffer.\n */\n cleanup() {\n // If we are inside of text or attributes, emit what we already have.\n if (this.running && this.sectionStart !== this.index) {\n if (this.state === State.Text ||\n (this.state === State.InSpecialTag && this.sequenceIndex === 0)) {\n this.cbs.ontext(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n else if (this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueNq) {\n this.cbs.onattribdata(this.sectionStart, this.index);\n this.sectionStart = this.index;\n }\n }\n }\n shouldContinue() {\n return this.index < this.buffer.length + this.offset && this.running;\n }\n /**\n * Iterates through the buffer, calling the function corresponding to the current state.\n *\n * States that are more likely to be hit are higher up, as a performance improvement.\n */\n parse() {\n while (this.shouldContinue()) {\n const c = this.buffer.charCodeAt(this.index - this.offset);\n if (this.state === State.Text) {\n this.stateText(c);\n }\n else if (this.state === State.SpecialStartSequence) {\n this.stateSpecialStartSequence(c);\n }\n else if (this.state === State.InSpecialTag) {\n this.stateInSpecialTag(c);\n }\n else if (this.state === State.CDATASequence) {\n this.stateCDATASequence(c);\n }\n else if (this.state === State.InAttributeValueDq) {\n this.stateInAttributeValueDoubleQuotes(c);\n }\n else if (this.state === State.InAttributeName) {\n this.stateInAttributeName(c);\n }\n else if (this.state === State.InCommentLike) {\n this.stateInCommentLike(c);\n }\n else if (this.state === State.InSpecialComment) {\n this.stateInSpecialComment(c);\n }\n else if (this.state === State.BeforeAttributeName) {\n this.stateBeforeAttributeName(c);\n }\n else if (this.state === State.InTagName) {\n this.stateInTagName(c);\n }\n else if (this.state === State.InClosingTagName) {\n this.stateInClosingTagName(c);\n }\n else if (this.state === State.BeforeTagName) {\n this.stateBeforeTagName(c);\n }\n else if (this.state === State.AfterAttributeName) {\n this.stateAfterAttributeName(c);\n }\n else if (this.state === State.InAttributeValueSq) {\n this.stateInAttributeValueSingleQuotes(c);\n }\n else if (this.state === State.BeforeAttributeValue) {\n this.stateBeforeAttributeValue(c);\n }\n else if (this.state === State.BeforeClosingTagName) {\n this.stateBeforeClosingTagName(c);\n }\n else if (this.state === State.AfterClosingTagName) {\n this.stateAfterClosingTagName(c);\n }\n else if (this.state === State.BeforeSpecialS) {\n this.stateBeforeSpecialS(c);\n }\n else if (this.state === State.InAttributeValueNq) {\n this.stateInAttributeValueNoQuotes(c);\n }\n else if (this.state === State.InSelfClosingTag) {\n this.stateInSelfClosingTag(c);\n }\n else if (this.state === State.InDeclaration) {\n this.stateInDeclaration(c);\n }\n else if (this.state === State.BeforeDeclaration) {\n this.stateBeforeDeclaration(c);\n }\n else if (this.state === State.BeforeComment) {\n this.stateBeforeComment(c);\n }\n else if (this.state === State.InProcessingInstruction) {\n this.stateInProcessingInstruction(c);\n }\n else if (this.state === State.InNamedEntity) {\n this.stateInNamedEntity(c);\n }\n else if (this.state === State.BeforeEntity) {\n this.stateBeforeEntity(c);\n }\n else if (this.state === State.InHexEntity) {\n this.stateInHexEntity(c);\n }\n else if (this.state === State.InNumericEntity) {\n this.stateInNumericEntity(c);\n }\n else {\n // `this._state === State.BeforeNumericEntity`\n this.stateBeforeNumericEntity(c);\n }\n this.index++;\n }\n this.cleanup();\n }\n finish() {\n if (this.state === State.InNamedEntity) {\n this.emitNamedEntity();\n }\n // If there is remaining data, emit it in a reasonable way\n if (this.sectionStart < this.index) {\n this.handleTrailingData();\n }\n this.cbs.onend();\n }\n /** Handle any trailing data. */\n handleTrailingData() {\n const endIndex = this.buffer.length + this.offset;\n if (this.state === State.InCommentLike) {\n if (this.currentSequence === Sequences.CdataEnd) {\n this.cbs.oncdata(this.sectionStart, endIndex, 0);\n }\n else {\n this.cbs.oncomment(this.sectionStart, endIndex, 0);\n }\n }\n else if (this.state === State.InNumericEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InHexEntity &&\n this.allowLegacyEntity()) {\n this.emitNumericEntity(false);\n // All trailing data will have been consumed\n }\n else if (this.state === State.InTagName ||\n this.state === State.BeforeAttributeName ||\n this.state === State.BeforeAttributeValue ||\n this.state === State.AfterAttributeName ||\n this.state === State.InAttributeName ||\n this.state === State.InAttributeValueSq ||\n this.state === State.InAttributeValueDq ||\n this.state === State.InAttributeValueNq ||\n this.state === State.InClosingTagName) {\n /*\n * If we are currently in an opening or closing tag, us not calling the\n * respective callback signals that the tag should be ignored.\n */\n }\n else {\n this.cbs.ontext(this.sectionStart, endIndex);\n }\n }\n emitPartial(start, endIndex) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribdata(start, endIndex);\n }\n else {\n this.cbs.ontext(start, endIndex);\n }\n }\n emitCodePoint(cp) {\n if (this.baseState !== State.Text &&\n this.baseState !== State.InSpecialTag) {\n this.cbs.onattribentity(cp);\n }\n else {\n this.cbs.ontextentity(cp);\n }\n }\n}\n//# sourceMappingURL=Tokenizer.js.map","import Tokenizer, { QuoteType } from \"./Tokenizer.js\";\nimport { fromCodePoint } from \"entities/lib/decode.js\";\nconst formTags = new Set([\n \"input\",\n \"option\",\n \"optgroup\",\n \"select\",\n \"button\",\n \"datalist\",\n \"textarea\",\n]);\nconst pTag = new Set([\"p\"]);\nconst tableSectionTags = new Set([\"thead\", \"tbody\"]);\nconst ddtTags = new Set([\"dd\", \"dt\"]);\nconst rtpTags = new Set([\"rt\", \"rp\"]);\nconst openImpliesClose = new Map([\n [\"tr\", new Set([\"tr\", \"th\", \"td\"])],\n [\"th\", new Set([\"th\"])],\n [\"td\", new Set([\"thead\", \"th\", \"td\"])],\n [\"body\", new Set([\"head\", \"link\", \"script\"])],\n [\"li\", new Set([\"li\"])],\n [\"p\", pTag],\n [\"h1\", pTag],\n [\"h2\", pTag],\n [\"h3\", pTag],\n [\"h4\", pTag],\n [\"h5\", pTag],\n [\"h6\", pTag],\n [\"select\", formTags],\n [\"input\", formTags],\n [\"output\", formTags],\n [\"button\", formTags],\n [\"datalist\", formTags],\n [\"textarea\", formTags],\n [\"option\", new Set([\"option\"])],\n [\"optgroup\", new Set([\"optgroup\", \"option\"])],\n [\"dd\", ddtTags],\n [\"dt\", ddtTags],\n [\"address\", pTag],\n [\"article\", pTag],\n [\"aside\", pTag],\n [\"blockquote\", pTag],\n [\"details\", pTag],\n [\"div\", pTag],\n [\"dl\", pTag],\n [\"fieldset\", pTag],\n [\"figcaption\", pTag],\n [\"figure\", pTag],\n [\"footer\", pTag],\n [\"form\", pTag],\n [\"header\", pTag],\n [\"hr\", pTag],\n [\"main\", pTag],\n [\"nav\", pTag],\n [\"ol\", pTag],\n [\"pre\", pTag],\n [\"section\", pTag],\n [\"table\", pTag],\n [\"ul\", pTag],\n [\"rt\", rtpTags],\n [\"rp\", rtpTags],\n [\"tbody\", tableSectionTags],\n [\"tfoot\", tableSectionTags],\n]);\nconst voidElements = new Set([\n \"area\",\n \"base\",\n \"basefont\",\n \"br\",\n \"col\",\n \"command\",\n \"embed\",\n \"frame\",\n \"hr\",\n \"img\",\n \"input\",\n \"isindex\",\n \"keygen\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\nconst foreignContextElements = new Set([\"math\", \"svg\"]);\nconst htmlIntegrationElements = new Set([\n \"mi\",\n \"mo\",\n \"mn\",\n \"ms\",\n \"mtext\",\n \"annotation-xml\",\n \"foreignobject\",\n \"desc\",\n \"title\",\n]);\nconst reNameEnd = /\\s|\\//;\nexport class Parser {\n constructor(cbs, options = {}) {\n var _a, _b, _c, _d, _e;\n this.options = options;\n /** The start index of the last event. */\n this.startIndex = 0;\n /** The end index of the last event. */\n this.endIndex = 0;\n /**\n * Store the start index of the current open tag,\n * so we can update the start index for attributes.\n */\n this.openTagStart = 0;\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribvalue = \"\";\n this.attribs = null;\n this.stack = [];\n this.foreignContext = [];\n this.buffers = [];\n this.bufferOffset = 0;\n /** The index of the last written buffer. Used when resuming after a `pause()`. */\n this.writeIndex = 0;\n /** Indicates whether the parser has finished running / `.end` has been called. */\n this.ended = false;\n this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};\n this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;\n this.lowerCaseAttributeNames =\n (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;\n this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer)(this.options, this);\n (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);\n }\n // Tokenizer event handlers\n /** @internal */\n ontext(start, endIndex) {\n var _a, _b;\n const data = this.getSlice(start, endIndex);\n this.endIndex = endIndex - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);\n this.startIndex = endIndex;\n }\n /** @internal */\n ontextentity(cp) {\n var _a, _b;\n /*\n * Entities can be emitted on the character, or directly after.\n * We use the section start here to get accurate indices.\n */\n const idx = this.tokenizer.getSectionStart();\n this.endIndex = idx - 1;\n (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, fromCodePoint(cp));\n this.startIndex = idx;\n }\n isVoidElement(name) {\n return !this.options.xmlMode && voidElements.has(name);\n }\n /** @internal */\n onopentagname(start, endIndex) {\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n this.emitOpenTag(name);\n }\n emitOpenTag(name) {\n var _a, _b, _c, _d;\n this.openTagStart = this.startIndex;\n this.tagname = name;\n const impliesClose = !this.options.xmlMode && openImpliesClose.get(name);\n if (impliesClose) {\n while (this.stack.length > 0 &&\n impliesClose.has(this.stack[this.stack.length - 1])) {\n const el = this.stack.pop();\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, el, true);\n }\n }\n if (!this.isVoidElement(name)) {\n this.stack.push(name);\n if (foreignContextElements.has(name)) {\n this.foreignContext.push(true);\n }\n else if (htmlIntegrationElements.has(name)) {\n this.foreignContext.push(false);\n }\n }\n (_d = (_c = this.cbs).onopentagname) === null || _d === void 0 ? void 0 : _d.call(_c, name);\n if (this.cbs.onopentag)\n this.attribs = {};\n }\n endOpenTag(isImplied) {\n var _a, _b;\n this.startIndex = this.openTagStart;\n if (this.attribs) {\n (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs, isImplied);\n this.attribs = null;\n }\n if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) {\n this.cbs.onclosetag(this.tagname, true);\n }\n this.tagname = \"\";\n }\n /** @internal */\n onopentagend(endIndex) {\n this.endIndex = endIndex;\n this.endOpenTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onclosetag(start, endIndex) {\n var _a, _b, _c, _d, _e, _f;\n this.endIndex = endIndex;\n let name = this.getSlice(start, endIndex);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n if (foreignContextElements.has(name) ||\n htmlIntegrationElements.has(name)) {\n this.foreignContext.pop();\n }\n if (!this.isVoidElement(name)) {\n const pos = this.stack.lastIndexOf(name);\n if (pos !== -1) {\n if (this.cbs.onclosetag) {\n let count = this.stack.length - pos;\n while (count--) {\n // We know the stack has sufficient elements.\n this.cbs.onclosetag(this.stack.pop(), count !== 0);\n }\n }\n else\n this.stack.length = pos;\n }\n else if (!this.options.xmlMode && name === \"p\") {\n // Implicit open before close\n this.emitOpenTag(\"p\");\n this.closeCurrentTag(true);\n }\n }\n else if (!this.options.xmlMode && name === \"br\") {\n // We can't use `emitOpenTag` for implicit open, as `br` would be implicitly closed.\n (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, \"br\");\n (_d = (_c = this.cbs).onopentag) === null || _d === void 0 ? void 0 : _d.call(_c, \"br\", {}, true);\n (_f = (_e = this.cbs).onclosetag) === null || _f === void 0 ? void 0 : _f.call(_e, \"br\", false);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onselfclosingtag(endIndex) {\n this.endIndex = endIndex;\n if (this.options.xmlMode ||\n this.options.recognizeSelfClosing ||\n this.foreignContext[this.foreignContext.length - 1]) {\n this.closeCurrentTag(false);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n else {\n // Ignore the fact that the tag is self-closing.\n this.onopentagend(endIndex);\n }\n }\n closeCurrentTag(isOpenImplied) {\n var _a, _b;\n const name = this.tagname;\n this.endOpenTag(isOpenImplied);\n // Self-closing tags will be on the top of the stack\n if (this.stack[this.stack.length - 1] === name) {\n // If the opening tag isn't implied, the closing tag has to be implied.\n (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name, !isOpenImplied);\n this.stack.pop();\n }\n }\n /** @internal */\n onattribname(start, endIndex) {\n this.startIndex = start;\n const name = this.getSlice(start, endIndex);\n this.attribname = this.lowerCaseAttributeNames\n ? name.toLowerCase()\n : name;\n }\n /** @internal */\n onattribdata(start, endIndex) {\n this.attribvalue += this.getSlice(start, endIndex);\n }\n /** @internal */\n onattribentity(cp) {\n this.attribvalue += fromCodePoint(cp);\n }\n /** @internal */\n onattribend(quote, endIndex) {\n var _a, _b;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote === QuoteType.Double\n ? '\"'\n : quote === QuoteType.Single\n ? \"'\"\n : quote === QuoteType.NoValue\n ? undefined\n : null);\n if (this.attribs &&\n !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {\n this.attribs[this.attribname] = this.attribvalue;\n }\n this.attribvalue = \"\";\n }\n getInstructionName(value) {\n const idx = value.search(reNameEnd);\n let name = idx < 0 ? value : value.substr(0, idx);\n if (this.lowerCaseTagNames) {\n name = name.toLowerCase();\n }\n return name;\n }\n /** @internal */\n ondeclaration(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onprocessinginstruction(start, endIndex) {\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex);\n if (this.cbs.onprocessinginstruction) {\n const name = this.getInstructionName(value);\n this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncomment(start, endIndex, offset) {\n var _a, _b, _c, _d;\n this.endIndex = endIndex;\n (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, this.getSlice(start, endIndex - offset));\n (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n oncdata(start, endIndex, offset) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;\n this.endIndex = endIndex;\n const value = this.getSlice(start, endIndex - offset);\n if (this.options.xmlMode || this.options.recognizeCDATA) {\n (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);\n (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);\n (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);\n }\n else {\n (_h = (_g = this.cbs).oncomment) === null || _h === void 0 ? void 0 : _h.call(_g, `[CDATA[${value}]]`);\n (_k = (_j = this.cbs).oncommentend) === null || _k === void 0 ? void 0 : _k.call(_j);\n }\n // Set `startIndex` for next node\n this.startIndex = endIndex + 1;\n }\n /** @internal */\n onend() {\n var _a, _b;\n if (this.cbs.onclosetag) {\n // Set the end index for all remaining tags\n this.endIndex = this.startIndex;\n for (let i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i], true))\n ;\n }\n (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n /**\n * Resets the parser to a blank state, ready to parse a new HTML document\n */\n reset() {\n var _a, _b, _c, _d;\n (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);\n this.tokenizer.reset();\n this.tagname = \"\";\n this.attribname = \"\";\n this.attribs = null;\n this.stack.length = 0;\n this.startIndex = 0;\n this.endIndex = 0;\n (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);\n this.buffers.length = 0;\n this.bufferOffset = 0;\n this.writeIndex = 0;\n this.ended = false;\n }\n /**\n * Resets the parser, then parses a complete document and\n * pushes it to the handler.\n *\n * @param data Document to parse.\n */\n parseComplete(data) {\n this.reset();\n this.end(data);\n }\n getSlice(start, end) {\n while (start - this.bufferOffset >= this.buffers[0].length) {\n this.shiftBuffer();\n }\n let str = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);\n while (end - this.bufferOffset > this.buffers[0].length) {\n this.shiftBuffer();\n str += this.buffers[0].slice(0, end - this.bufferOffset);\n }\n return str;\n }\n shiftBuffer() {\n this.bufferOffset += this.buffers[0].length;\n this.writeIndex--;\n this.buffers.shift();\n }\n /**\n * Parses a chunk of data and calls the corresponding callbacks.\n *\n * @param chunk Chunk to parse.\n */\n write(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, new Error(\".write() after done!\"));\n return;\n }\n this.buffers.push(chunk);\n if (this.tokenizer.running) {\n this.tokenizer.write(chunk);\n this.writeIndex++;\n }\n }\n /**\n * Parses the end of the buffer and clears the stack, calls onend.\n *\n * @param chunk Optional final chunk to parse.\n */\n end(chunk) {\n var _a, _b;\n if (this.ended) {\n (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, Error(\".end() after done!\"));\n return;\n }\n if (chunk)\n this.write(chunk);\n this.ended = true;\n this.tokenizer.end();\n }\n /**\n * Pauses parsing. The parser won't emit events until `resume` is called.\n */\n pause() {\n this.tokenizer.pause();\n }\n /**\n * Resumes parsing after `pause` was called.\n */\n resume() {\n this.tokenizer.resume();\n while (this.tokenizer.running &&\n this.writeIndex < this.buffers.length) {\n this.tokenizer.write(this.buffers[this.writeIndex++]);\n }\n if (this.ended)\n this.tokenizer.end();\n }\n /**\n * Alias of `write`, for backwards compatibility.\n *\n * @param chunk Chunk to parse.\n * @deprecated\n */\n parseChunk(chunk) {\n this.write(chunk);\n }\n /**\n * Alias of `end`, for backwards compatibility.\n *\n * @param chunk Optional final chunk to parse.\n * @deprecated\n */\n done(chunk) {\n this.end(chunk);\n }\n}\n//# sourceMappingURL=Parser.js.map","import { Parser } from \"./Parser.js\";\nexport { Parser };\nimport { DomHandler, } from \"domhandler\";\nexport { DomHandler };\n// Helper methods\n/**\n * Parses the data, returns the resulting document.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n */\nexport function parseDocument(data, options) {\n const handler = new DomHandler(undefined, options);\n new Parser(handler, options).end(data);\n return handler.root;\n}\n/**\n * Parses data, returns an array of the root nodes.\n *\n * Note that the root nodes still have a `Document` node as their parent.\n * Use `parseDocument` to get the `Document` node instead.\n *\n * @param data The data that should be parsed.\n * @param options Optional options for the parser and DOM builder.\n * @deprecated Use `parseDocument` instead.\n */\nexport function parseDOM(data, options) {\n return parseDocument(data, options).children;\n}\n/**\n * Creates a parser instance, with an attached DOM handler.\n *\n * @param cb A callback that will be called once parsing has been completed.\n * @param options Optional options for the parser and DOM builder.\n * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.\n */\nexport function createDomStream(cb, options, elementCb) {\n const handler = new DomHandler(cb, options, elementCb);\n return new Parser(handler, options);\n}\nexport { default as Tokenizer, } from \"./Tokenizer.js\";\n/*\n * All of the following exports exist for backwards-compatibility.\n * They should probably be removed eventually.\n */\nimport * as ElementType from \"domelementtype\";\nexport { ElementType };\nimport { getFeed } from \"domutils\";\nexport { getFeed };\n/**\n * Parse a feed.\n *\n * @param feed The feed that should be parsed, as a string.\n * @param options Optionally, options for parsing. When using this, you should set `xmlMode` to `true`.\n */\nexport function parseFeed(feed, options = { xmlMode: true }) {\n return getFeed(parseDOM(feed, options));\n}\nexport * as DomUtils from \"domutils\";\n// Old name for DomHandler\nexport { DomHandler as DefaultHandler };\n//# sourceMappingURL=index.js.map","/**\n * Types used in signatures of Cheerio methods.\n *\n * @category Cheerio\n */\nexport * from './types.js';\nimport { getLoad } from './load.js';\nimport { getParse } from './parse.js';\nimport { renderWithParse5, parseWithParse5 } from './parsers/parse5-adapter.js';\nimport renderWithHtmlparser2 from 'dom-serializer';\nimport { parseDocument as parseWithHtmlparser2 } from 'htmlparser2';\nconst parse = getParse((content, options, isDocument, context) => options.xmlMode || options._useHtmlParser2\n ? parseWithHtmlparser2(content, options)\n : parseWithParse5(content, options, isDocument, context));\n// Duplicate docs due to https://github.com/TypeStrong/typedoc/issues/1616\n/**\n * Create a querying function, bound to a document created from the provided markup.\n *\n * Note that similar to web browser contexts, this operation may introduce\n * ``, ``, and `` elements; set `isDocument` to `false` to\n * switch to fragment mode and disable this.\n *\n * @param content - Markup to be loaded.\n * @param options - Options for the created instance.\n * @param isDocument - Allows parser to be switched to fragment mode.\n * @returns The loaded document.\n * @see {@link https://cheerio.js.org#loading} for additional usage information.\n */\nexport const load = getLoad(parse, (dom, options) => options.xmlMode || options._useHtmlParser2\n ? renderWithHtmlparser2(dom, options)\n : renderWithParse5(dom));\n/**\n * The default cheerio instance.\n *\n * @deprecated Use the function returned by `load` instead.\n */\nexport default load([]);\nexport { html, xml, text } from './static.js';\nimport * as staticMethods from './static.js';\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('

');\n *\n * $.contains($('div').get(0), $('p').get(0));\n * //=> true\n *\n * $.contains($('p').get(0), $('div').get(0));\n * //=> false\n * ```\n *\n * @returns {boolean}\n */\nexport const { contains } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n *\n * $.merge([1, 2], [3, 4]);\n * //=> [1, 2, 3, 4]\n * ```\n */\nexport const { merge } = staticMethods;\n/**\n * In order to promote consistency with the jQuery library, users are encouraged\n * to instead use the static method of the same name as it is defined on the\n * \"loaded\" Cheerio factory function.\n *\n * @deprecated See {@link static/parseHTML}.\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.parseHTML('markup');\n * ```\n */\nexport const { parseHTML } = staticMethods;\n/**\n * Users seeking to access the top-level element of a parsed document should\n * instead use the `root` static method of a \"loaded\" Cheerio function.\n *\n * @deprecated\n * @example\n *\n * ```js\n * const $ = cheerio.load('');\n * $.root();\n * ```\n */\nexport const { root } = staticMethods;\n//# sourceMappingURL=index.js.map","exports = module.exports = debug;\n\nfunction debug(label) {\n return _debug.bind(null, label);\n}\n\nfunction _debug(label) {\n var args = [].slice.call(arguments, 1);\n args.unshift('[' + label + ']');\n process.stderr.write(args.join(' ') + '\\n');\n}","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `lex()` and print the results.\n\nvar debug = require('./debug')('lex');\n\nexports = module.exports = lex;\n\n/**\n * Convert a CSS string into an array of lexical tokens.\n *\n * @param {String} css CSS\n * @returns {Array} lexical tokens\n */\nfunction lex(css) {\n var start; // Debug timer start.\n\n var buffer = ''; // Character accumulator\n var ch; // Current character\n var column = 0; // Current source column number\n var cursor = -1; // Current source cursor position\n var depth = 0; // Current nesting depth\n var line = 1; // Current source line number\n var state = 'before-selector'; // Current state\n var stack = [state]; // State stack\n var token = {}; // Current token\n var tokens = []; // Token accumulator\n\n // Supported @-rules, in roughly descending order of usage probability.\n var atRules = [\n 'media',\n 'keyframes',\n { name: '-webkit-keyframes', type: 'keyframes', prefix: '-webkit-' },\n { name: '-moz-keyframes', type: 'keyframes', prefix: '-moz-' },\n { name: '-ms-keyframes', type: 'keyframes', prefix: '-ms-' },\n { name: '-o-keyframes', type: 'keyframes', prefix: '-o-' },\n 'font-face',\n { name: 'import', state: 'before-at-value' },\n { name: 'charset', state: 'before-at-value' },\n 'supports',\n 'viewport',\n { name: 'namespace', state: 'before-at-value' },\n 'document',\n { name: '-moz-document', type: 'document', prefix: '-moz-' },\n 'page'\n ];\n\n // -- Functions ------------------------------------------------------------\n\n /**\n * Advance the character cursor and return the next character.\n *\n * @returns {String} The next character.\n */\n function getCh() {\n skip();\n return css[cursor];\n }\n\n /**\n * Return the state at the given index in the stack.\n * The stack is LIFO so indexing is from the right.\n *\n * @param {Number} [index=0] Index to return.\n * @returns {String} state\n */\n function getState(index) {\n return index ? stack[stack.length - 1 - index] : state;\n }\n\n /**\n * Look ahead for a string beginning from the next position. The string\n * being looked for must start at the next position.\n *\n * @param {String} str The string to look for.\n * @returns {Boolean} Whether the string was found.\n */\n function isNextString(str) {\n var start = cursor + 1;\n return (str === css.slice(start, start + str.length));\n }\n\n /**\n * Find the start position of a substring beginning from the next\n * position. The string being looked for may begin anywhere.\n *\n * @param {String} str The substring to look for.\n * @returns {Number|false} The position, or `false` if not found.\n */\n function find(str) {\n var pos = css.slice(cursor).indexOf(str);\n\n return pos > 0 ? pos : false;\n }\n\n /**\n * Determine whether a character is next.\n *\n * @param {String} ch Character.\n * @returns {Boolean} Whether the character is next.\n */\n function isNextChar(ch) {\n return ch === peek(1);\n }\n\n /**\n * Return the character at the given cursor offset. The offset is relative\n * to the cursor, so negative values move backwards.\n *\n * @param {Number} [offset=1] Cursor offset.\n * @returns {String} Character.\n */\n function peek(offset) {\n return css[cursor + (offset || 1)];\n }\n\n /**\n * Remove the current state from the stack and set the new current state.\n *\n * @returns {String} The removed state.\n */\n function popState() {\n var removed = stack.pop();\n state = stack[stack.length - 1];\n\n return removed;\n }\n\n /**\n * Set the current state and add it to the stack.\n *\n * @param {String} newState The new state.\n * @returns {Number} The new stack length.\n */\n function pushState(newState) {\n state = newState;\n stack.push(state);\n\n return stack.length;\n }\n\n /**\n * Replace the current state with a new state.\n *\n * @param {String} newState The new state.\n * @returns {String} The replaced state.\n */\n function replaceState(newState) {\n var previousState = state;\n stack[stack.length - 1] = state = newState;\n\n return previousState;\n }\n\n /**\n * Move the character cursor. Positive numbers move the cursor forward.\n * Negative numbers are not supported!\n *\n * @param {Number} [n=1] Number of characters to skip.\n */\n function skip(n) {\n if ((n || 1) == 1) {\n if (css[cursor] == '\\n') {\n line++;\n column = 1;\n } else {\n column++;\n }\n cursor++;\n } else {\n var skipStr = css.slice(cursor, cursor + n).split('\\n');\n if (skipStr.length > 1) {\n line += skipStr.length - 1;\n column = 1;\n }\n column += skipStr[skipStr.length - 1].length;\n cursor = cursor + n;\n }\n }\n\n /**\n * Add the current token to the pile and reset the buffer.\n */\n function addToken() {\n token.end = {\n line: line,\n col: column\n };\n\n DEBUG && debug('addToken:', JSON.stringify(token, null, 2));\n\n tokens.push(token);\n\n buffer = '';\n token = {};\n }\n\n /**\n * Set the current token.\n *\n * @param {String} type Token type.\n */\n function initializeToken(type) {\n token = {\n type: type,\n start: {\n line: line,\n col : column\n }\n };\n }\n\n // -- Main Loop ------------------------------------------------------------\n\n /*\n The main loop is a state machine that reads in one character at a time,\n and determines what to do based on the current state and character.\n This is implemented as a series of nested `switch` statements and the\n case orders have been mildly optimized based on rough probabilities\n calculated by processing a small sample of real-world CSS.\n\n Further optimization (such as a dispatch table) shouldn't be necessary\n since the total number of cases is very low.\n */\n\n TIMER && (start = Date.now());\n\n while (ch = getCh()) {\n DEBUG && debug(ch, getState());\n\n // column += 1;\n\n switch (ch) {\n // Space\n case ' ':\n switch (getState()) {\n case 'selector':\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'at-value':\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n }\n break;\n\n // Newline or tab\n case '\\n':\n case '\\t':\n case '\\r':\n case '\\f':\n switch (getState()) {\n case 'value':\n case 'value-paren':\n case 'at-group':\n case 'comment':\n case 'single-string':\n case 'double-string':\n case 'selector':\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule if a semi-colon was omitted.\n if ('\\n' === ch) {\n token.value = buffer.trim();\n addToken();\n popState();\n }\n break;\n }\n\n // if ('\\n' === ch) {\n // column = 0;\n // line += 1;\n // }\n break;\n\n case ':':\n switch (getState()) {\n case 'name':\n token.name = buffer.trim();\n buffer = '';\n\n replaceState('before-value');\n break;\n\n case 'before-selector':\n buffer += ch;\n\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case ';':\n switch (getState()) {\n case 'name':\n case 'before-value':\n case 'value':\n // Tokenize a declaration\n // if value is empty skip the declaration\n if (buffer.trim().length > 0) {\n token.value = buffer.trim(),\n addToken();\n }\n replaceState('before-name');\n break;\n\n case 'value-paren':\n // Insignificant semi-colon\n buffer += ch;\n break;\n\n case 'at-value':\n // Tokenize an @-rule\n token.value = buffer.trim();\n addToken();\n popState();\n break;\n\n case 'before-name':\n // Extraneous semi-colon\n break;\n\n default:\n buffer += ch;\n break;\n }\n break;\n\n case '{':\n switch (getState()) {\n case 'selector':\n // If the sequence is `\\{` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n // Tokenize a selector\n token.text = buffer.trim();\n addToken();\n replaceState('before-name');\n depth = depth + 1;\n break;\n\n case 'at-group':\n // Tokenize an @-group\n token.name = buffer.trim();\n\n // XXX: @-rules are starting to get hairy\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n case 'page' :\n pushState('before-name');\n break;\n\n default:\n pushState('before-selector');\n }\n\n addToken();\n depth = depth + 1;\n break;\n\n case 'name':\n case 'at-rule':\n // Tokenize a declaration or an @-rule\n token.name = buffer.trim();\n addToken();\n pushState('before-name');\n depth = depth + 1;\n break;\n\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore braces in comments and strings\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n }\n\n break;\n\n case '}':\n switch (getState()) {\n case 'before-name':\n case 'name':\n case 'before-value':\n case 'value':\n // If the buffer contains anything, it is a value\n if (buffer) {\n token.value = buffer.trim();\n }\n\n // If the current token has a name and a value it should be tokenized.\n if (token.name && token.value) {\n addToken();\n }\n\n // Leave the block\n initializeToken('end');\n addToken();\n popState();\n\n // We might need to leave again.\n // XXX: What about 3 levels deep?\n if ('at-group' === getState()) {\n initializeToken('at-group-end');\n addToken();\n popState();\n }\n \n if (depth > 0) {\n depth = depth - 1;\n }\n\n break;\n\n case 'at-group':\n case 'before-selector':\n case 'selector':\n // If the sequence is `\\}` then assume that the brace should be escaped.\n if (peek(-1) === '\\\\') {\n buffer += ch;\n break;\n }\n\n if (depth > 0) {\n // Leave block if in an at-group\n if ('at-group' === getState(1)) {\n initializeToken('at-group-end');\n addToken();\n }\n }\n\n if (depth > 1) {\n popState();\n }\n\n if (depth > 0) {\n depth = depth - 1;\n }\n break;\n\n case 'double-string':\n case 'single-string':\n case 'comment':\n // Ignore braces in comments and strings.\n buffer += ch;\n break;\n }\n\n break;\n\n // Strings\n case '\"':\n case \"'\":\n switch (getState()) {\n case 'double-string':\n if ('\"' === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'single-string':\n if (\"'\" === ch && '\\\\' !== peek(-1)) {\n popState();\n }\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'before-value':\n replaceState('value');\n pushState('\"' === ch ? 'double-string' : 'single-string');\n break;\n\n case 'comment':\n // Ignore strings within comments.\n break;\n\n default:\n if ('\\\\' !== peek(-1)) {\n pushState('\"' === ch ? 'double-string' : 'single-string');\n }\n }\n\n buffer += ch;\n break;\n\n // Comments\n case '/':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n // Ignore\n buffer += ch;\n break;\n\n case 'before-value':\n case 'selector':\n case 'name':\n case 'value':\n if (isNextChar('*')) {\n // Ignore comments in selectors, properties and values. They are\n // difficult to represent in the AST.\n var pos = find('*/');\n\n if (pos) {\n skip(pos + 1);\n }\n } else {\n if (getState() == 'before-value') replaceState('value');\n buffer += ch;\n }\n break;\n\n default:\n if (isNextChar('*')) {\n // Create a comment token\n initializeToken('comment');\n pushState('comment');\n skip();\n }\n else {\n buffer += ch;\n }\n break;\n }\n break;\n\n // Comment end or universal selector\n case '*':\n switch (getState()) {\n case 'comment':\n if (isNextChar('/')) {\n // Tokenize a comment\n token.text = buffer; // Don't trim()!\n skip();\n addToken();\n popState();\n }\n else {\n buffer += ch;\n }\n break;\n\n case 'before-selector':\n buffer += ch;\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n buffer += ch;\n }\n break;\n\n // @-rules\n case '@':\n switch (getState()) {\n case 'comment':\n case 'double-string':\n case 'single-string':\n buffer += ch;\n break;\n case 'before-value':\n replaceState('value');\n buffer += ch;\n break;\n\n default:\n // Iterate over the supported @-rules and attempt to tokenize one.\n var tokenized = false;\n var name;\n var rule;\n\n for (var j = 0, len = atRules.length; !tokenized && j < len; ++j) {\n rule = atRules[j];\n name = rule.name || rule;\n\n if (!isNextString(name)) { continue; }\n\n tokenized = true;\n\n initializeToken(name);\n pushState(rule.state || 'at-group');\n skip(name.length);\n\n if (rule.prefix) {\n token.prefix = rule.prefix;\n }\n\n if (rule.type) {\n token.type = rule.type;\n }\n }\n\n if (!tokenized) {\n // Keep on truckin' America!\n buffer += ch;\n }\n break;\n }\n break;\n\n // Parentheses are tracked to disambiguate semi-colons, such as within a\n // data URI.\n case '(':\n switch (getState()) {\n case 'value':\n pushState('value-paren');\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n case ')':\n switch (getState()) {\n case 'value-paren':\n popState();\n break;\n case 'before-value':\n replaceState('value');\n break;\n }\n\n buffer += ch;\n break;\n\n default:\n switch (getState()) {\n case 'before-selector':\n initializeToken('selector');\n pushState('selector');\n break;\n\n case 'before-name':\n initializeToken('property');\n replaceState('name');\n break;\n\n case 'before-value':\n replaceState('value');\n break;\n\n case 'before-at-value':\n replaceState('at-value');\n break;\n }\n\n buffer += ch;\n break;\n }\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return tokens;\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `parse()` and print the results.\n\nvar debug = require('./debug')('parse');\nvar lex = require('./lexer');\n\nexports = module.exports = parse;\n\nvar _comments; // Whether comments are allowed.\nvar _depth; // Current block nesting depth.\nvar _position; // Whether to include line/column position.\nvar _tokens; // Array of lexical tokens.\n\n/**\n * Convert a CSS string or array of lexical tokens into a `stringify`-able AST.\n *\n * @param {String} css CSS string or array of lexical token\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comment nodes in the AST\n * @returns {Object} `stringify`-able AST\n */\nfunction parse(css, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _comments = !!options.comments;\n _position = !!options.position;\n\n _depth = 0;\n\n // Operate on a copy of the given tokens, or the lex()'d CSS string.\n _tokens = Array.isArray(css) ? css.slice() : lex(css);\n\n var rule;\n var rules = [];\n var token;\n\n TIMER && (start = Date.now());\n\n while ((token = next())) {\n rule = parseToken(token);\n rule && rules.push(rule);\n }\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return {\n type: \"stylesheet\",\n stylesheet: {\n rules: rules\n }\n };\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Build an AST node from a lexical token.\n *\n * @param {Object} token lexical token\n * @param {Object} [override] object hash of properties that override those\n * already in the token, or that will be added to the token.\n * @returns {Object} AST node\n */\nfunction astNode(token, override) {\n override || (override = {});\n\n var key;\n var keys = ['type', 'name', 'value'];\n var node = {};\n\n // Avoiding [].forEach for performance reasons.\n for (var i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (token[key]) {\n node[key] = override[key] || token[key];\n }\n }\n\n keys = Object.keys(override);\n\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n\n if (!node[key]) {\n node[key] = override[key];\n }\n }\n\n if (_position) {\n node.position = {\n start: token.start,\n end: token.end\n };\n }\n\n DEBUG && debug('astNode:', JSON.stringify(node, null, 2));\n\n return node;\n}\n\n/**\n * Remove a lexical token from the stack and return the removed token.\n *\n * @returns {Object} lexical token\n */\nfunction next() {\n var token = _tokens.shift();\n DEBUG && debug('next:', JSON.stringify(token, null, 2));\n return token;\n}\n\n// -- Parse* Functions ---------------------------------------------------------\n\n/**\n * Convert an @-group lexical token to an AST node.\n *\n * @param {Object} token @-group lexical token\n * @returns {Object} @-group AST node\n */\nfunction parseAtGroup(token) {\n _depth = _depth + 1;\n\n // As the @-group token is assembled, relevant token values are captured here\n // temporarily. They will later be used as `tokenize()` overrides.\n var overrides = {};\n\n switch (token.type) {\n case 'font-face':\n case 'viewport' :\n overrides.declarations = parseDeclarations();\n break;\n\n case 'page':\n overrides.prefix = token.prefix;\n overrides.declarations = parseDeclarations();\n break;\n\n default:\n overrides.prefix = token.prefix;\n overrides.rules = parseRules();\n }\n\n return astNode(token, overrides);\n}\n\n/**\n * Convert an @import lexical token to an AST node.\n *\n * @param {Object} token @import lexical token\n * @returns {Object} @import AST node\n */\nfunction parseAtImport(token) {\n return astNode(token);\n}\n\n/**\n * Convert an @charset token to an AST node.\n *\n * @param {Object} token @charset lexical token\n * @returns {Object} @charset node\n */\nfunction parseCharset(token) {\n return astNode(token);\n}\n\n/**\n * Convert a comment token to an AST Node.\n *\n * @param {Object} token comment lexical token\n * @returns {Object} comment node\n */\nfunction parseComment(token) {\n return astNode(token, {text: token.text});\n}\n\nfunction parseNamespace(token) {\n return astNode(token);\n}\n\n/**\n * Convert a property lexical token to a property AST node.\n *\n * @returns {Object} property node\n */\nfunction parseProperty(token) {\n return astNode(token);\n}\n\n/**\n * Convert a selector lexical token to a selector AST node.\n *\n * @param {Object} token selector lexical token\n * @returns {Object} selector node\n */\nfunction parseSelector(token) {\n function trim(str) {\n return str.trim();\n }\n\n return astNode(token, {\n type: 'rule',\n selectors: token.text.split(',').map(trim),\n declarations: parseDeclarations(token)\n });\n}\n\n/**\n * Convert a lexical token to an AST node.\n *\n * @returns {Object|undefined} AST node\n */\nfunction parseToken(token) {\n switch (token.type) {\n // Cases are listed in roughly descending order of probability.\n case 'property': return parseProperty(token);\n\n case 'selector': return parseSelector(token);\n\n case 'at-group-end': _depth = _depth - 1; return;\n\n case 'media' :\n case 'keyframes' :return parseAtGroup(token);\n\n case 'comment': if (_comments) { return parseComment(token); } break;\n\n case 'charset': return parseCharset(token);\n case 'import': return parseAtImport(token);\n\n case 'namespace': return parseNamespace(token);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return parseAtGroup(token);\n }\n\n DEBUG && debug('parseToken: unexpected token:', JSON.stringify(token));\n}\n\n// -- Parse Helper Functions ---------------------------------------------------\n\n/**\n * Iteratively parses lexical tokens from the stack into AST nodes until a\n * conditional function returns `false`, at which point iteration terminates\n * and any AST nodes collected are returned.\n *\n * @param {Function} conditionFn\n * @param {Object} token the lexical token being parsed\n * @returns {Boolean} `true` if the token should be parsed, `false` otherwise\n * @return {Array} AST nodes\n */\nfunction parseTokensWhile(conditionFn) {\n var node;\n var nodes = [];\n var token;\n\n while ((token = next()) && (conditionFn && conditionFn(token))) {\n node = parseToken(token);\n node && nodes.push(node);\n }\n\n // Place an unused non-`end` lexical token back onto the stack.\n if (token && token.type !== 'end') {\n _tokens.unshift(token);\n }\n\n return nodes;\n}\n\n/**\n * Convert a series of tokens into a sequence of declaration AST nodes.\n *\n * @returns {Array} declaration nodes\n */\nfunction parseDeclarations() {\n return parseTokensWhile(function (token) {\n return (token.type === 'property' || token.type === 'comment');\n });\n}\n\n/**\n * Convert a series of tokens into a sequence of rule nodes.\n *\n * @returns {Array} rule nodes\n */\nfunction parseRules() {\n return parseTokensWhile(function () { return _depth; });\n}\n","var DEBUG = false; // `true` to print debugging info.\nvar TIMER = false; // `true` to time calls to `stringify()` and print the results.\n\nvar debug = require('./debug')('stringify');\n\nvar _comments; // Whether comments are allowed in the stringified CSS.\nvar _compress; // Whether the stringified CSS should be compressed.\nvar _indentation; // Indentation option value.\nvar _level; // Current indentation level.\nvar _n; // Compression-aware newline character.\nvar _s; // Compression-aware space character.\n\nexports = module.exports = stringify;\n\n/**\n * Convert a `stringify`-able AST into a CSS string.\n *\n * @param {Object} `stringify`-able AST\n * @param {Object} [options]\n * @param {Boolean} [options.comments=false] allow comments in the CSS\n * @param {Boolean} [options.compress=false] compress whitespace\n * @param {String} [options.indentation=''] indentation sequence\n * @returns {String} CSS\n */\nfunction stringify(ast, options) {\n var start; // Debug timer start.\n\n options || (options = {});\n _indentation = options.indentation || '';\n _compress = !!options.compress;\n _comments = !!options.comments;\n _level = 1;\n\n if (_compress) {\n _n = _s = '';\n } else {\n _n = '\\n';\n _s = ' ';\n }\n\n TIMER && (start = Date.now());\n\n var css = reduce(ast.stylesheet.rules, stringifyNode).join('\\n').trim();\n\n TIMER && debug('ran in', (Date.now() - start) + 'ms');\n\n return css;\n}\n\n// -- Functions --------------------------------------------------------------\n\n/**\n * Modify the indentation level, or return a compression-aware sequence of\n * spaces equal to the current indentation level.\n *\n * @param {Number} [level=undefined] indentation level modifier\n * @returns {String} sequence of spaces\n */\nfunction indent(level) {\n if (level) {\n _level += level;\n return;\n }\n\n if (_compress) { return ''; }\n\n return Array(_level).join(_indentation || '');\n}\n\n// -- Stringify Functions ------------------------------------------------------\n\n/**\n * Stringify an @-rule AST node.\n *\n * Use `stringifyAtGroup()` when dealing with @-groups that may contain blocks\n * such as @media.\n *\n * @param {String} type @-rule type. E.g., import, charset\n * @returns {String} Stringified @-rule\n */\nfunction stringifyAtRule(node) {\n return '@' + node.type + ' ' + node.value + ';' + _n;\n}\n\n/**\n * Stringify an @-group AST node.\n *\n * Use `stringifyAtRule()` when dealing with @-rules that may not contain blocks\n * such as @import.\n *\n * @param {Object} node @-group AST node\n * @returns {String}\n */\nfunction stringifyAtGroup(node) {\n var label = '';\n var prefix = node.prefix || '';\n\n if (node.name) {\n label = ' ' + node.name;\n }\n\n // FIXME: @-rule conditional logic is leaking everywhere.\n var chomp = node.type !== 'page';\n\n return '@' + prefix + node.type + label + _s + stringifyBlock(node, chomp) + _n;\n}\n\n/**\n * Stringify a comment AST node.\n *\n * @param {Object} node comment AST node\n * @returns {String}\n */\nfunction stringifyComment(node) {\n if (!_comments) { return ''; }\n\n return '/*' + (node.text || '') + '*/' + _n;\n}\n\n/**\n * Stringify a rule AST node.\n *\n * @param {Object} node rule AST node\n * @returns {String}\n */\nfunction stringifyRule(node) {\n var label;\n\n if (node.selectors) {\n label = node.selectors.join(',' + _n);\n } else {\n label = '@' + node.type;\n label += node.name ? ' ' + node.name : '';\n }\n\n return indent() + label + _s + stringifyBlock(node) + _n;\n}\n\n\n// -- Stringify Helper Functions -----------------------------------------------\n\n/**\n * Reduce an array by applying a function to each item and retaining the truthy\n * results.\n *\n * When `item.type` is `'comment'` `stringifyComment` will be applied instead.\n *\n * @param {Array} items array to reduce\n * @param {Function} fn function to call for each item in the array\n * @returns {Mixed} Truthy values will be retained, falsy values omitted\n * @returns {Array} retained results\n */\nfunction reduce(items, fn) {\n return items.reduce(function (results, item) {\n var result = (item.type === 'comment') ? stringifyComment(item) : fn(item);\n result && results.push(result);\n return results;\n }, []);\n}\n\n/**\n * Stringify an AST node with the assumption that it represents a block of\n * declarations or other @-group contents.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\n// FIXME: chomp should not be a magic boolean parameter\nfunction stringifyBlock(node, chomp) {\n var children = node.declarations;\n var fn = stringifyDeclaration;\n\n if (node.rules) {\n children = node.rules;\n fn = stringifyRule;\n }\n\n children = stringifyChildren(children, fn);\n children && (children = _n + children + (chomp ? '' : _n));\n\n return '{' + children + indent() + '}';\n}\n\n/**\n * Stringify an array of child AST nodes by calling the given stringify function\n * once for each child, and concatenating the results.\n *\n * @param {Array} children `node.rules` or `node.declarations`\n * @param {Function} fn stringify function\n * @returns {String}\n */\nfunction stringifyChildren(children, fn) {\n if (!children) { return ''; }\n\n indent(1);\n var results = reduce(children, fn);\n indent(-1);\n\n if (!results.length) { return ''; }\n\n return results.join(_n);\n}\n\n/**\n * Stringify a declaration AST node.\n *\n * @param {Object} node declaration AST node\n * @returns {String}\n */\nfunction stringifyDeclaration(node) {\n if (node.type === 'property') {\n return stringifyProperty(node);\n }\n\n DEBUG && debug('stringifyDeclaration: unexpected node:', JSON.stringify(node));\n}\n\n/**\n * Stringify an AST node.\n *\n * @param {Object} node AST node\n * @returns {String}\n */\nfunction stringifyNode(node) {\n switch (node.type) {\n // Cases are listed in roughly descending order of probability.\n case 'rule': return stringifyRule(node);\n\n case 'media' :\n case 'keyframes': return stringifyAtGroup(node);\n\n case 'comment': return stringifyComment(node);\n\n case 'import' :\n case 'charset' :\n case 'namespace': return stringifyAtRule(node);\n\n case 'font-face':\n case 'supports' :\n case 'viewport' :\n case 'document' :\n case 'page' : return stringifyAtGroup(node);\n }\n\n DEBUG && debug('stringifyNode: unexpected node: ' + JSON.stringify(node));\n}\n\n/**\n * Stringify an AST property node.\n *\n * @param {Object} node AST property node\n * @returns {String}\n */\nfunction stringifyProperty(node) {\n var name = node.name ? node.name + ':' + _s : '';\n\n return indent() + name + node.value + ';';\n}\n","module.exports = {\n lex : require('./lib/lexer'),\n parse: require('./lib/parser'),\n stringify: require('./lib/stringify')\n};\n","/*\r\nSlick Parser\r\n - originally created by the almighty Thomas Aylott <@subtlegradient> (http://subtlegradient.com)\r\n*/\"use strict\"\r\n\r\n// Notable changes from Slick.Parser 1.0.x\r\n\r\n// The parser now uses 2 classes: Expressions and Expression\r\n// `new Expressions` produces an array-like object containing a list of Expression objects\r\n// - Expressions::toString() produces a cleaned up expressions string\r\n// `new Expression` produces an array-like object\r\n// - Expression::toString() produces a cleaned up expression string\r\n// The only exposed method is parse, which produces a (cached) `new Expressions` instance\r\n// parsed.raw is no longer present, use .toString()\r\n// parsed.expression is now useless, just use the indices\r\n// parsed.reverse() has been removed for now, due to its apparent uselessness\r\n// Other changes in the Expressions object:\r\n// - classNames are now unique, and save both escaped and unescaped values\r\n// - attributes now save both escaped and unescaped values\r\n// - pseudos now save both escaped and unescaped values\r\n\r\nvar escapeRe = /([-.*+?^${}()|[\\]\\/\\\\])/g,\r\n unescapeRe = /\\\\/g\r\n\r\nvar escape = function(string){\r\n // XRegExp v2.0.0-beta-3\r\n // « https://github.com/slevithan/XRegExp/blob/master/src/xregexp.js\r\n return (string + \"\").replace(escapeRe, '\\\\$1')\r\n}\r\n\r\nvar unescape = function(string){\r\n return (string + \"\").replace(unescapeRe, '')\r\n}\r\n\r\nvar slickRe = RegExp(\r\n/*\r\n#!/usr/bin/env ruby\r\nputs \"\\t\\t\" + DATA.read.gsub(/\\(\\?x\\)|\\s+#.*$|\\s+|\\\\$|\\\\n/,'')\r\n__END__\r\n \"(?x)^(?:\\\r\n \\\\s* ( , ) \\\\s* # Separator \\n\\\r\n | \\\\s* ( + ) \\\\s* # Combinator \\n\\\r\n | ( \\\\s+ ) # CombinatorChildren \\n\\\r\n | ( + | \\\\* ) # Tag \\n\\\r\n | \\\\# ( + ) # ID \\n\\\r\n | \\\\. ( + ) # ClassName \\n\\\r\n | # Attribute \\n\\\r\n \\\\[ \\\r\n \\\\s* (+) (?: \\\r\n \\\\s* ([*^$!~|]?=) (?: \\\r\n \\\\s* (?:\\\r\n ([\\\"']?)(.*?)\\\\9 \\\r\n )\\\r\n ) \\\r\n )? \\\\s* \\\r\n \\\\](?!\\\\]) \\n\\\r\n | :+ ( + )(?:\\\r\n \\\\( (?:\\\r\n (?:([\\\"'])([^\\\\12]*)\\\\12)|((?:\\\\([^)]+\\\\)|[^()]*)+)\\\r\n ) \\\\)\\\r\n )?\\\r\n )\"\r\n*/\r\n\"^(?:\\\\s*(,)\\\\s*|\\\\s*(+)\\\\s*|(\\\\s+)|(+|\\\\*)|\\\\#(+)|\\\\.(+)|\\\\[\\\\s*(+)(?:\\\\s*([*^$!~|]?=)(?:\\\\s*(?:([\\\"']?)(.*?)\\\\9)))?\\\\s*\\\\](?!\\\\])|(:+)(+)(?:\\\\((?:(?:([\\\"'])([^\\\\13]*)\\\\13)|((?:\\\\([^)]+\\\\)|[^()]*)+))\\\\))?)\"\r\n .replace(//, '[' + escape(\">+~`!@$%^&={}\\\\;/g, '(?:[\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n .replace(//g, '(?:[:\\\\w\\\\u00a1-\\\\uFFFF-]|\\\\\\\\[^\\\\s0-9a-f])')\r\n)\r\n\r\n// Part\r\n\r\nvar Part = function Part(combinator){\r\n this.combinator = combinator || \" \"\r\n this.tag = \"*\"\r\n}\r\n\r\nPart.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\", k, part\r\n\r\n xpr += this.tag || \"*\"\r\n if (this.id) xpr += \"#\" + this.id\r\n if (this.classes) xpr += \".\" + this.classList.join(\".\")\r\n if (this.attributes) for (k = 0; part = this.attributes[k++];){\r\n xpr += \"[\" + part.name + (part.operator ? part.operator + '\"' + part.value + '\"' : '') + \"]\"\r\n }\r\n if (this.pseudos) for (k = 0; part = this.pseudos[k++];){\r\n xpr += \":\" + part.name\r\n if (part.value) xpr += \"(\" + part.value + \")\"\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\n// Expression\r\n\r\nvar Expression = function Expression(){\r\n this.length = 0\r\n}\r\n\r\nExpression.prototype.toString = function(){\r\n\r\n if (!this.raw){\r\n\r\n var xpr = \"\"\r\n\r\n for (var j = 0, bit; bit = this[j++];){\r\n if (j !== 1) xpr += \" \"\r\n if (bit.combinator !== \" \") xpr += bit.combinator + \" \"\r\n xpr += bit\r\n }\r\n\r\n this.raw = xpr\r\n\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar replacer = function(\r\n rawMatch,\r\n\r\n separator,\r\n combinator,\r\n combinatorChildren,\r\n\r\n tagName,\r\n id,\r\n className,\r\n\r\n attributeKey,\r\n attributeOperator,\r\n attributeQuote,\r\n attributeValue,\r\n\r\n pseudoMarker,\r\n pseudoClass,\r\n pseudoQuote,\r\n pseudoClassQuotedValue,\r\n pseudoClassValue\r\n){\r\n\r\n var expression, current\r\n\r\n if (separator || !this.length){\r\n expression = this[this.length++] = new Expression\r\n if (separator) return ''\r\n }\r\n\r\n if (!expression) expression = this[this.length - 1]\r\n\r\n if (combinator || combinatorChildren || !expression.length){\r\n current = expression[expression.length++] = new Part(combinator)\r\n }\r\n\r\n if (!current) current = expression[expression.length - 1]\r\n\r\n if (tagName){\r\n\r\n current.tag = unescape(tagName)\r\n\r\n } else if (id){\r\n\r\n current.id = unescape(id)\r\n\r\n } else if (className){\r\n\r\n var unescaped = unescape(className)\r\n\r\n var classes = current.classes || (current.classes = {})\r\n if (!classes[unescaped]){\r\n classes[unescaped] = escape(className)\r\n var classList = current.classList || (current.classList = [])\r\n classList.push(unescaped)\r\n classList.sort()\r\n }\r\n\r\n } else if (pseudoClass){\r\n\r\n pseudoClassValue = pseudoClassValue || pseudoClassQuotedValue\r\n\r\n ;(current.pseudos || (current.pseudos = [])).push({\r\n type : pseudoMarker.length == 1 ? 'class' : 'element',\r\n name : unescape(pseudoClass),\r\n escapedName : escape(pseudoClass),\r\n value : pseudoClassValue ? unescape(pseudoClassValue) : null,\r\n escapedValue : pseudoClassValue ? escape(pseudoClassValue) : null\r\n })\r\n\r\n } else if (attributeKey){\r\n\r\n attributeValue = attributeValue ? escape(attributeValue) : null\r\n\r\n ;(current.attributes || (current.attributes = [])).push({\r\n operator : attributeOperator,\r\n name : unescape(attributeKey),\r\n escapedName : escape(attributeKey),\r\n value : attributeValue ? unescape(attributeValue) : null,\r\n escapedValue : attributeValue ? escape(attributeValue) : null\r\n })\r\n\r\n }\r\n\r\n return ''\r\n\r\n}\r\n\r\n// Expressions\r\n\r\nvar Expressions = function Expressions(expression){\r\n this.length = 0\r\n\r\n var self = this\r\n\r\n var original = expression, replaced\r\n\r\n while (expression){\r\n replaced = expression.replace(slickRe, function(){\r\n return replacer.apply(self, arguments)\r\n })\r\n if (replaced === expression) throw new Error(original + ' is an invalid expression')\r\n expression = replaced\r\n }\r\n}\r\n\r\nExpressions.prototype.toString = function(){\r\n if (!this.raw){\r\n var expressions = []\r\n for (var i = 0, expression; expression = this[i++];) expressions.push(expression)\r\n this.raw = expressions.join(\", \")\r\n }\r\n\r\n return this.raw\r\n}\r\n\r\nvar cache = {}\r\n\r\nvar parse = function(expression){\r\n if (expression == null) return null\r\n expression = ('' + expression).replace(/^\\s+|\\s+$/g, '')\r\n return cache[expression] || (cache[expression] = new Expressions(expression))\r\n}\r\n\r\nmodule.exports = parse\r\n","'use strict';\n\nvar parser = require('slick/parser');\n\nmodule.exports = exports = Selector;\n\n/**\n * CSS selector constructor.\n *\n * @param {String} selector text\n * @param {Array} optionally, precalculated specificity\n * @api public\n */\n\nfunction Selector(text, styleAttribute) {\n this.text = text;\n this.spec = undefined;\n this.styleAttribute = styleAttribute || false;\n}\n\n/**\n * Get parsed selector.\n *\n * @api public\n */\n\nSelector.prototype.parsed = function() {\n if (!this.tokens) { this.tokens = parse(this.text); }\n return this.tokens;\n};\n\n/**\n * Lazy specificity getter\n *\n * @api public\n */\n\nSelector.prototype.specificity = function() {\n var styleAttribute = this.styleAttribute;\n if (!this.spec) { this.spec = specificity(this.text, this.parsed()); }\n return this.spec;\n\n function specificity(text, parsed) {\n var expressions = parsed || parse(text);\n var spec = [styleAttribute ? 1 : 0, 0, 0, 0];\n var nots = [];\n\n for (var i = 0; i < expressions.length; i++) {\n var expression = expressions[i];\n var pseudos = expression.pseudos;\n\n // id awards a point in the second column\n if (expression.id) { spec[1]++; }\n\n // classes and attributes award a point each in the third column\n if (expression.attributes) { spec[2] += expression.attributes.length; }\n if (expression.classList) { spec[2] += expression.classList.length; }\n\n // tag awards a point in the fourth column\n if (expression.tag && expression.tag !== '*') { spec[3]++; }\n\n // pseudos award a point each in the fourth column\n if (pseudos) {\n spec[3] += pseudos.length;\n\n for (var p = 0; p < pseudos.length; p++) {\n if (pseudos[p].name === 'not') {\n nots.push(pseudos[p].value);\n spec[3]--;\n }\n }\n }\n }\n\n for (var ii = nots.length; ii--;) {\n var not = specificity(nots[ii]);\n for (var jj = 4; jj--;) { spec[jj] += not[jj]; }\n }\n\n return spec;\n }\n};\n\n/**\n * Parses a selector and returns the tokens.\n *\n * @param {String} selector\n * @api private.\n */\n\nfunction parse(text) {\n try {\n return parser(text)[0];\n } catch (e) {\n return [];\n }\n}\n","'use strict';\n\nmodule.exports = exports = Property;\n\n/**\n * Module dependencies.\n */\n\nvar utils = require('./utils');\n\n/**\n * CSS property constructor.\n *\n * @param {String} property\n * @param {String} value\n * @param {Selector} selector the property originates from\n * @param {Integer} priority 0 for normal properties, 2 for !important properties.\n * @param {Array} additional array of integers representing more detailed priorities (sorting)\n * @api public\n */\n\nfunction Property(prop, value, selector, priority, additionalPriority) {\n this.prop = prop;\n this.value = value;\n this.selector = selector;\n this.priority = priority || 0;\n this.additionalPriority = additionalPriority || [];\n}\n\n/**\n * Compares with another Property based on Selector#specificity.\n *\n * @api public\n */\n\nProperty.prototype.compareFunc = function(property) {\n var a = [];\n a.push.apply(a, this.selector.specificity());\n a.push.apply(a, this.additionalPriority);\n a[0] += this.priority;\n var b = [];\n b.push.apply(b, property.selector.specificity());\n b.push.apply(b, property.additionalPriority);\n b[0] += property.priority;\n return utils.compareFunc(a, b);\n};\n\nProperty.prototype.compare = function(property) {\n var winner = this.compareFunc(property);\n if (winner === 1) {\n return this;\n }\n return property;\n};\n\n\n/**\n * Returns CSS property\n *\n * @api public\n */\n\nProperty.prototype.toString = function() {\n return this.prop + ': ' + this.value.replace(/['\"]+/g, '') + ';';\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\n\nvar mensch = require('mensch');\nvar Selector = require('./selector');\nvar Property = require('./property');\n\nexports.Selector = Selector;\nexports.Property = Property;\n\n/**\n * Returns an array of the selectors.\n *\n * @license Sizzle CSS Selector Engine - MIT\n * @param {String} selectorText from mensch\n * @api public\n */\n\nexports.extract = function extract(selectorText) {\n var attr = 0;\n var sels = [];\n var sel = '';\n\n for (var i = 0, l = selectorText.length; i < l; i++) {\n var c = selectorText.charAt(i);\n\n if (attr) {\n if (']' === c || ')' === c) { attr--; }\n sel += c;\n } else {\n if (',' === c) {\n sels.push(sel);\n sel = '';\n } else {\n if ('[' === c || '(' === c) { attr++; }\n if (sel.length || (c !== ',' && c !== '\\n' && c !== ' ')) { sel += c; }\n }\n }\n }\n\n if (sel.length) {\n sels.push(sel);\n }\n\n return sels;\n};\n\n/**\n * Returns a parse tree for a CSS source.\n * If it encounters multiple selectors separated by a comma, it splits the\n * tree.\n *\n * @param {String} css source\n * @api public\n */\n\nexports.parseCSS = function(css) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var ret = [];\n\n for (var i = 0, l = rules.length; i < l; i++) {\n if (rules[i].type == 'rule') {\n var rule = rules[i];\n var selectors = rule.selectors;\n\n for (var ii = 0, ll = selectors.length; ii < ll; ii++) {\n ret.push([selectors[ii], rule.declarations]);\n }\n }\n }\n\n return ret;\n};\n\n/**\n * Returns preserved text for a CSS source.\n *\n * @param {String} css source\n * @param {Object} options\n * @api public\n */\n\nexports.getPreservedText = function(css, options, ignoredPseudos) {\n var parsed = mensch.parse(css, {position: true, comments: true});\n var rules = typeof parsed.stylesheet != 'undefined' && parsed.stylesheet.rules ? parsed.stylesheet.rules : [];\n var preserved = [];\n var lastStart = null;\n\n for (var i = rules.length - 1; i >= 0; i--) {\n if ((options.fontFaces && rules[i].type === 'font-face') ||\n (options.mediaQueries && rules[i].type === 'media') ||\n (options.keyFrames && rules[i].type === 'keyframes') ||\n (options.pseudos && rules[i].selectors && this.matchesPseudo(rules[i].selectors[0], ignoredPseudos))) {\n preserved.unshift(\n mensch.stringify(\n { stylesheet: { rules: [ rules[i] ] }},\n { comments: false, indentation: ' ' }\n )\n );\n }\n lastStart = rules[i].position.start;\n }\n\n if (preserved.length === 0) {\n return false;\n }\n return '\\n' + preserved.join('\\n') + '\\n';\n};\n\nexports.normalizeLineEndings = function(text) {\n return text.replace(/\\r\\n/g, '\\n').replace(/\\n/g, '\\r\\n');\n};\n\nexports.matchesPseudo = function(needle, haystack) {\n return haystack.find(function (element) {\n return needle.indexOf(element) > -1;\n })\n}\n\n/**\n * Compares two specificity vectors, returning the winning one.\n *\n * @param {Array} vector a\n * @param {Array} vector b\n * @return {Array}\n * @api public\n */\n\nexports.compareFunc = function(a, b) {\n var min = Math.min(a.length, b.length);\n for (var i = 0; i < min; i++) {\n if (a[i] === b[i]) { continue; }\n if (a[i] > b[i]) { return 1; }\n return -1;\n }\n\n return a.length - b.length;\n};\n\nexports.compare = function(a, b) {\n return exports.compareFunc(a, b) == 1 ? a : b;\n};\n\nexports.getDefaultOptions = function(options) {\n var result = Object.assign({\n extraCss: '',\n insertPreservedExtraCss: true,\n applyStyleTags: true,\n removeStyleTags: true,\n preserveMediaQueries: true,\n preserveFontFaces: true,\n preserveKeyFrames: true,\n preservePseudos: true,\n applyWidthAttributes: true,\n applyHeightAttributes: true,\n applyAttributesTableElements: true,\n url: ''\n }, options);\n\n result.webResources = result.webResources || {};\n\n return result;\n};\n","'use strict';\n\n/**\n * Module dependencies.\n */\nvar cheerio = require('cheerio');\nvar utils = require('./utils');\n\nvar cheerioLoad = function(html, options, encodeEntities) {\n options = Object.assign({decodeEntities: false, _useHtmlParser2:true}, options);\n html = encodeEntities(html);\n return cheerio.load(html, options);\n};\n\nvar createEntityConverters = function () {\n var codeBlockLookup = [];\n\n var encodeCodeBlocks = function(html) {\n var blocks = module.exports.codeBlocks;\n Object.keys(blocks).forEach(function(key) {\n var re = new RegExp(blocks[key].start + '([\\\\S\\\\s]*?)' + blocks[key].end, 'g');\n html = html.replace(re, function(match, subMatch) {\n codeBlockLookup.push(match);\n return 'JUICE_CODE_BLOCK_' + (codeBlockLookup.length - 1) + '_';\n });\n });\n return html;\n };\n\n var decodeCodeBlocks = function(html) {\n for(var index = 0; index < codeBlockLookup.length; index++) {\n var re = new RegExp('JUICE_CODE_BLOCK_' + index + '_(=\"\")?', 'gi');\n html = html.replace(re, function() {\n return codeBlockLookup[index];\n });\n }\n return html;\n };\n\n return {\n encodeEntities: encodeCodeBlocks,\n decodeEntities: decodeCodeBlocks,\n };\n};\n\n/**\n * Parses the input, calls the callback on the parsed DOM, and generates the output\n *\n * @param {String} html input html to be processed\n * @param {Object} options for the parser\n * @param {Function} callback to be invoked on the DOM\n * @param {Array} callbackExtraArguments to be passed to the callback\n * @return {String} resulting html\n */\nmodule.exports = function(html, options, callback, callbackExtraArguments) {\n var entityConverters = createEntityConverters();\n\n var $ = cheerioLoad(html, options, entityConverters.encodeEntities);\n var args = [ $ ];\n args.push.apply(args, callbackExtraArguments);\n var doc = callback.apply(undefined, args) || $;\n\n if (options && options.xmlMode) {\n return entityConverters.decodeEntities(doc.xml());\n }\n return entityConverters.decodeEntities(doc.html());\n};\n\nmodule.exports.codeBlocks = {\n EJS: { start: '<%', end: '%>' },\n HBS: { start: '{{', end: '}}' }\n};\n","'use strict';\n\n/**\n * Converts a decimal number to roman numeral.\n * https://stackoverflow.com/questions/9083037/convert-a-number-into-a-roman-numeral-in-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.romanize = function(num) {\n if (isNaN(num))\n return NaN;\n var digits = String(+num).split(\"\"),\n key = [\"\",\"C\",\"CC\",\"CCC\",\"CD\",\"D\",\"DC\",\"DCC\",\"DCCC\",\"CM\",\n \"\",\"X\",\"XX\",\"XXX\",\"XL\",\"L\",\"LX\",\"LXX\",\"LXXX\",\"XC\",\n \"\",\"I\",\"II\",\"III\",\"IV\",\"V\",\"VI\",\"VII\",\"VIII\",\"IX\"],\n roman = \"\",\n i = 3;\n while (i--)\n roman = (key[+digits.pop() + (i * 10)] || \"\") + roman;\n return Array(+digits.join(\"\") + 1).join(\"M\") + roman;\n}\n\n/**\n * Converts a decimal number to alphanumeric numeral.\n * https://stackoverflow.com/questions/45787459/convert-number-to-alphabet-string-javascript\n *\n * @param {Number} number\n * @api private.\n */\nexports.alphanumeric = function(num) {\n var s = '', t;\n\n while (num > 0) {\n t = (num - 1) % 26;\n s = String.fromCharCode(65 + t) + s;\n num = (num - t)/26 | 0;\n }\n return s || undefined;\n}","'use strict';\n\nvar utils = require('./utils');\nvar numbers = require('./numbers');\n\nmodule.exports = function makeJuiceClient(juiceClient) {\n\njuiceClient.ignoredPseudos = ['hover', 'active', 'focus', 'visited', 'link'];\njuiceClient.widthElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.heightElements = ['TABLE', 'TD', 'TH', 'IMG'];\njuiceClient.tableElements = ['TABLE', 'TH', 'TR', 'TD', 'CAPTION', 'COLGROUP', 'COL', 'THEAD', 'TBODY', 'TFOOT'];\njuiceClient.nonVisualElements = [ 'HEAD', 'TITLE', 'BASE', 'LINK', 'STYLE', 'META', 'SCRIPT', 'NOSCRIPT' ];\njuiceClient.styleToAttribute = {\n 'background-color': 'bgcolor',\n 'background-image': 'background',\n 'text-align': 'align',\n 'vertical-align': 'valign'\n};\njuiceClient.excludedProperties = [];\n\njuiceClient.juiceDocument = juiceDocument;\njuiceClient.inlineDocument = inlineDocument;\n\nfunction inlineDocument($, css, options) {\n\n options = options || {};\n var rules = utils.parseCSS(css);\n var editedElements = [];\n var styleAttributeName = 'style';\n var counters = {};\n\n if (options.styleAttributeName) {\n styleAttributeName = options.styleAttributeName;\n }\n\n rules.forEach(handleRule);\n editedElements.forEach(setStyleAttrs);\n\n if (options.inlinePseudoElements) {\n editedElements.forEach(inlinePseudoElements);\n }\n\n if (options.applyWidthAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'width');\n });\n }\n\n if (options.applyHeightAttributes) {\n editedElements.forEach(function(el) {\n setDimensionAttrs(el, 'height');\n });\n }\n\n if (options.applyAttributesTableElements) {\n editedElements.forEach(setAttributesOnTableElements);\n }\n\n if (options.insertPreservedExtraCss && options.extraCss) {\n var preservedText = utils.getPreservedText(options.extraCss, {\n mediaQueries: options.preserveMediaQueries,\n fontFaces: options.preserveFontFaces,\n keyFrames: options.preserveKeyFrames\n });\n if (preservedText) {\n var $appendTo = null;\n if (options.insertPreservedExtraCss !== true) {\n $appendTo = $(options.insertPreservedExtraCss);\n } else {\n $appendTo = $('head');\n if (!$appendTo.length) { $appendTo = $('body'); }\n if (!$appendTo.length) { $appendTo = $.root(); }\n }\n\n $appendTo.first().append('');\n }\n }\n\n function handleRule(rule) {\n var sel = rule[0];\n var style = rule[1];\n var selector = new utils.Selector(sel);\n var parsedSelector = selector.parsed();\n\n if (!parsedSelector) {\n return;\n }\n\n var pseudoElementType = getPseudoElementType(parsedSelector);\n\n // skip rule if the selector has any pseudos which are ignored\n for (var i = 0; i < parsedSelector.length; ++i) {\n var subSel = parsedSelector[i];\n if (subSel.pseudos) {\n for (var j = 0; j < subSel.pseudos.length; ++j) {\n var subSelPseudo = subSel.pseudos[j];\n if (juiceClient.ignoredPseudos.indexOf(subSelPseudo.name) >= 0) {\n return;\n }\n }\n }\n }\n\n if (pseudoElementType) {\n var last = parsedSelector[parsedSelector.length - 1];\n var pseudos = last.pseudos;\n last.pseudos = filterElementPseudos(last.pseudos);\n sel = parsedSelector.toString();\n last.pseudos = pseudos;\n }\n\n var els;\n try {\n els = $(sel);\n } catch (err) {\n // skip invalid selector\n return;\n }\n\n els.each(function() {\n var el = this;\n\n if (el.name && juiceClient.nonVisualElements.indexOf(el.name.toUpperCase()) >= 0) {\n return;\n }\n\n if (pseudoElementType) {\n var pseudoElPropName = 'pseudo' + pseudoElementType;\n var pseudoEl = el[pseudoElPropName];\n if (!pseudoEl) {\n pseudoEl = el[pseudoElPropName] = $('').get(0);\n pseudoEl.pseudoElementType = pseudoElementType;\n pseudoEl.pseudoElementParent = el;\n pseudoEl.counterProps = el.counterProps;\n el[pseudoElPropName] = pseudoEl;\n }\n el = pseudoEl;\n }\n\n if (!el.styleProps) {\n el.styleProps = {};\n\n // if the element has inline styles, fake selector with topmost specificity\n if ($(el).attr(styleAttributeName)) {\n var cssText = '* { ' + $(el).attr(styleAttributeName) + ' } ';\n addProps(utils.parseCSS(cssText)[0][1], new utils.Selector('`;\n }\n\n computeStyle() {\n // 计算需要append进富文本的style\n const mathStyle = this.getStyleFromSheets('mjx-container');\n const cherryStyle = this.getStyleFromSheets('cherry');\n const echartStyle =\n '';\n return {\n mathStyle,\n echartStyle,\n cherryStyle,\n };\n }\n\n /**\n * 由于复制操作会随着预览区域的内容增加而耗时变长,所以需要增加“正在复制”的状态回显\n * 同时该状态也用于限频\n */\n toggleLoading() {\n // 切换loading状态\n if (this.isLoading) {\n const loadingButton = document.querySelector('.icon-loading');\n loadingButton.outerHTML = ``;\n } else {\n const copyButton = document.querySelector('.ch-icon-copy');\n copyButton.outerHTML = '
';\n }\n this.isLoading = !this.isLoading;\n }\n\n /**\n * 响应点击事件\n * 该按钮不会引发编辑区域的内容改动,所以不用处理用户在编辑区域的选中内容\n * @param {Event} e 点击事件\n */\n onClick(e) {\n this.toggleLoading();\n const inlineCodeTheme = document.querySelector('.cherry').getAttribute('data-inline-code-theme');\n const codeBlockTheme = document.querySelector('.cherry').getAttribute('data-code-block-theme');\n const { mathStyle, echartStyle, cherryStyle } = this.computeStyle();\n const html = this.previewer.isPreviewerHidden()\n ? this.previewer.options.previewerCache.html\n : this.previewer.getValue();\n // 将css样式以行内样式的形式插入到html内容里\n this.adaptWechat(html).then((html) => {\n copyToClip(\n juice(\n `
\n
${html}
\n
${mathStyle + echartStyle + cherryStyle}`,\n ),\n );\n this.toggleLoading();\n });\n }\n}\n\n/**\n * 将图片转成base64,防止出现由于图片防盗链功能导致图裂的情况\n * @param {string} url 图片的地址\n * @param {Function} [callback] 回调函数,本函数不处理该参数\n * @param {string} [outputFormat]\n * @returns {Promise} img node\n */\nfunction convertImgToBase64(url, callback, outputFormat) {\n return new Promise((resolve) => {\n let canvas = /** @type {HTMLCanvasElement}*/ (document.createElement('CANVAS'));\n const ctx = canvas.getContext('2d');\n const img = new Image();\n img.crossOrigin = 'Anonymous';\n img.onload = function () {\n canvas.height = img.height;\n canvas.width = img.width;\n ctx.drawImage(img, 0, 0);\n const dataURL = canvas.toDataURL(outputFormat || 'image/png');\n resolve(dataURL);\n canvas = null;\n };\n img.src = url;\n });\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport MenuBase from '@/toolbars/MenuBase';\nimport { getPanelRule } from '@/utils/regexp';\nimport { getSelection } from '@/utils/selection';\n/**\n * 插入面板\n */\nexport default class Panel extends MenuBase {\n constructor($cherry) {\n super($cherry);\n this.setName('panel', 'tips');\n this.panelRule = getPanelRule().reg;\n this.subMenuConfig = [\n {\n iconName: 'tips',\n name: 'tips',\n onclick: this.bindSubClick.bind(this, 'primary'),\n },\n {\n iconName: 'info',\n name: 'info',\n onclick: this.bindSubClick.bind(this, 'info'),\n },\n {\n iconName: 'warning',\n name: 'warning',\n onclick: this.bindSubClick.bind(this, 'warning'),\n },\n {\n iconName: 'danger',\n name: 'danger',\n onclick: this.bindSubClick.bind(this, 'danger'),\n },\n {\n iconName: 'success',\n name: 'success',\n onclick: this.bindSubClick.bind(this, 'success'),\n },\n ];\n }\n\n /**\n * 从字符串中找打面板的name\n * @param {string} str\n * @returns {string | false}\n */\n $getNameFromStr(str) {\n let ret = false;\n this.panelRule.lastIndex = 0;\n str.replace(this.panelRule, (match, preLines, name, content) => {\n const $name = /\\s/.test(name.trim()) ? name.trim().replace(/\\s.*$/, '') : name;\n ret = $name ? $name.trim().toLowerCase() : '';\n return match;\n });\n return ret;\n }\n\n $getTitle(str) {\n this.panelRule.lastIndex = 0;\n str.replace(this.panelRule, (match, preLines, name, content) => {\n const $name = name.trim();\n return /\\s/.test($name) ? $name.replace(/[^\\s]+\\s/, '') : '';\n });\n return '';\n }\n\n /**\n * 响应点击事件\n * @param {string} selection 被用户选中的文本内容\n * @param {string} shortKey 快捷键参数\n * @returns {string} 回填到编辑器光标位置/选中文本区域的内容\n */\n onClick(selection, shortKey = '') {\n let $selection = getSelection(this.editor.editor, selection, 'line', true) || '内容';\n let currentName = this.$getNameFromStr($selection);\n let title = this.$getTitle($selection);\n if (currentName === false) {\n // 如果没有命中面板语法,则尝试扩大选区\n this.getMoreSelection('::: ', '\\n', () => {\n const newSelection = this.editor.editor.getSelection();\n const isMatch = this.$getNameFromStr(newSelection);\n if (isMatch !== false) {\n $selection = newSelection;\n currentName = isMatch;\n title = this.$getTitle(newSelection);\n }\n return isMatch !== false;\n });\n }\n if (currentName !== false) {\n // 如果命中了面板语法,则尝试去掉语法或者变更语法\n if (currentName === shortKey) {\n // 去掉面板语法\n this.panelRule.lastIndex = 0;\n return $selection.replace(this.panelRule, (match, preLines, name, content) => {\n const $name = name.trim();\n const $title = /\\s/.test($name) ? $name.replace(/[^\\s]+\\s/, '') : '';\n return `${$title}\\n${content}`;\n });\n }\n // 修改name\n this.registerAfterClickCb(() => {\n this.setLessSelection('::: ', '\\n');\n });\n this.panelRule.lastIndex = 0;\n return $selection.replace(this.panelRule, (match, preLines, name, content) => {\n const $name = name.trim();\n const $title = /\\s/.test($name) ? $name.replace(/[^\\s]+\\s/, '') : '';\n return `::: ${shortKey} ${$title}\\n${content.replace(/\\n+$/, '')}\\n:::`;\n });\n }\n this.registerAfterClickCb(() => {\n this.setLessSelection('::: ', '\\n');\n });\n $selection = $selection.replace(/^\\n+/, '');\n if (/\\n/.test($selection)) {\n if (!title) {\n title = $selection.replace(/\\n[\\w\\W]+$/, '');\n $selection = $selection.replace(/^[^\\n]+\\n/, '');\n }\n } else {\n title = title ? title : '标题';\n }\n return `::: ${shortKey} ${title}\\n${$selection}\\n:::`.replace(/\\n{2,}:::/g, '\\n:::');\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Panel from './Panel';\nimport { getPanelRule } from '@/utils/regexp';\n/**\n * 插入对齐方式\n */\nexport default class Justify extends Panel {\n constructor($cherry) {\n super($cherry);\n this.setName('justify', 'justify');\n this.panelRule = getPanelRule().reg;\n this.subMenuConfig = [\n {\n iconName: 'justifyLeft',\n name: '左对齐',\n onclick: this.bindSubClick.bind(this, 'left'),\n },\n {\n iconName: 'justifyCenter',\n name: '居中',\n onclick: this.bindSubClick.bind(this, 'center'),\n },\n {\n iconName: 'justifyRight',\n name: '右对齐',\n onclick: this.bindSubClick.bind(this, 'right'),\n },\n ];\n }\n\n $getTitle() {\n return ' ';\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport MenuBase from '@/toolbars/MenuBase';\nimport { getDetailRule } from '@/utils/regexp';\nimport { getSelection } from '@/utils/selection';\n/**\n * 插入手风琴\n */\nexport default class Detail extends MenuBase {\n constructor($cherry) {\n super($cherry);\n this.setName('detail', 'insertFlow');\n this.detailRule = getDetailRule().reg;\n }\n\n /**\n * 响应点击事件\n * @param {string} selection 被用户选中的文本内容\n * @returns {string} 回填到编辑器光标位置/选中文本区域的内容\n */\n onClick(selection) {\n let $selection =\n getSelection(this.editor.editor, selection, 'line', true) ||\n '点击展开更多\\n内容\\n++- 默认展开\\n内容\\n++ 默认收起\\n内容';\n this.detailRule.lastIndex = 0;\n if (!this.detailRule.test($selection)) {\n // 如果没有命中手风琴语法,则尝试扩大选区\n this.getMoreSelection('+++ ', '\\n', () => {\n const newSelection = this.editor.editor.getSelection();\n this.detailRule.lastIndex = 0;\n const isMatch = this.detailRule.test(newSelection);\n if (isMatch !== false) {\n $selection = newSelection;\n }\n return isMatch !== false;\n });\n }\n this.detailRule.lastIndex = 0;\n if (this.detailRule.test($selection)) {\n // 如果命中了手风琴语法,则去掉手风琴语法\n this.detailRule.lastIndex = 0;\n return $selection.replace(this.detailRule, (match, preLines, isOpen, title, content) => {\n return `${title}\\n${content}`;\n });\n }\n // 去掉开头的空格\n $selection = $selection.replace(/^\\s+/, '');\n // 如果选中的内容不包含换行,则强制增加一个换行\n if (!/\\n/.test($selection)) {\n $selection = `${$selection}\\n${$selection}`;\n }\n this.registerAfterClickCb(() => {\n this.setLessSelection('+++ ', '\\n');\n });\n return `+++ ${$selection}\\n+++`.replace(/\\n{2,}\\+\\+\\+/g, '\\n+++');\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport MenuBase from '@/toolbars/MenuBase';\nimport { drawioDialog } from '@/utils/dialog';\n/**\n * 打开draw.io画图对话框,点击确定后向编辑器插入图片语法\n */\nexport default class DrawIo extends MenuBase {\n constructor($cherry) {\n super($cherry);\n this.setName('draw.io', 'draw.io');\n this.noIcon = true;\n this.drawioIframeUrl = $cherry.options.drawioIframeUrl;\n }\n\n /**\n * 响应点击事件\n * @param {string} selection 被用户选中的文本内容\n * @param {string} shortKey 快捷键参数,本函数不处理这个参数\n * @returns {string} 回填到编辑器光标位置/选中文本区域的内容\n */\n onClick(selection, shortKey = '') {\n if (!this.drawioIframeUrl) {\n // 如果没有配置drawio的编辑页URL,则直接失效\n return selection;\n }\n if (this.hasCacheOnce()) {\n // @ts-ignore\n const { xmlData, base64 } = this.getAndCleanCacheOnce();\n const begin = '![';\n const end = `](${base64}){data-type=drawio data-xml=${encodeURI(xmlData)}}`;\n this.registerAfterClickCb(() => {\n this.setLessSelection(begin, end);\n });\n return `${begin}在预览区点击图片重新编辑draw.io${end}`;\n }\n // 插入图片,调用上传文件逻辑\n drawioDialog(this.drawioIframeUrl, '', (data) => {\n this.setCacheOnce(data);\n this.fire(null);\n });\n this.updateMarkdown = false;\n return selection;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 工具栏各个实例的注册中心\n */\nimport Bold from './hooks/Bold';\nimport Italic from './hooks/Italic';\nimport Split from './hooks/Split';\nimport Strikethrough from './hooks/Strikethrough';\nimport Sub from './hooks/Sub';\nimport Sup from './hooks/Sup';\nimport Color from './hooks/Color';\nimport Header from './hooks/Header';\nimport Insert from './hooks/Insert';\nimport List from './hooks/List';\nimport Ol from './hooks/Ol';\nimport Ul from './hooks/Ul';\nimport CheckList from './hooks/CheckList';\nimport Graph from './hooks/Graph';\nimport Size from './hooks/Size';\nimport H1 from './hooks/H1';\nimport H2 from './hooks/H2';\nimport H3 from './hooks/H3';\nimport Quote from './hooks/Quote';\nimport QuickTable from './hooks/QuickTable';\nimport TogglePreview from './hooks/TogglePreview';\nimport FullScreen from './hooks/FullScreen';\nimport Undo from './hooks/Undo';\nimport Redo from './hooks/Redo';\nimport Code from './hooks/Code';\nimport CodeTheme from './hooks/CodeTheme';\nimport Export from './hooks/Export';\nimport Settings from './hooks/Settings';\nimport Underline from './hooks/Underline';\nimport SwitchModel from './hooks/SwitchModel';\nimport Image from './hooks/Image';\nimport Audio from './hooks/Audio';\nimport Video from './hooks/Video';\nimport Br from './hooks/Br';\nimport Hr from './hooks/Hr';\nimport Formula from './hooks/Formula';\nimport Link from './hooks/Link';\nimport Table from './hooks/Table';\nimport Toc from './hooks/Toc';\nimport LineTable from './hooks/LineTable';\nimport BarTable from './hooks/BarTable';\nimport Pdf from './hooks/Pdf';\nimport File from './hooks/File';\nimport Word from './hooks/Word';\nimport Ruby from './hooks/Ruby';\nimport Theme from './hooks/Theme';\nimport ChatGpt from './hooks/ChatGpt';\n// Sidebar\nimport MobilePreview from './hooks/MobilePreview';\nimport Copy from './hooks/Copy';\nimport Panel from './hooks/Panel';\nimport Justify from './hooks/Justify';\nimport Detail from './hooks/Detail';\nimport DrawIo from './hooks/DrawIo';\n\n// 定义默认支持的工具栏\n// 目前不支持按需动态加载\n// 如果对CherryMarkdown构建后的文件大小有比较严格的要求,可以根据实际情况删减hook\nconst HookList = {\n bold: Bold,\n italic: Italic,\n '|': Split,\n strikethrough: Strikethrough,\n sub: Sub,\n sup: Sup,\n header: Header,\n insert: Insert,\n list: List,\n ol: Ol,\n ul: Ul,\n checklist: CheckList,\n graph: Graph,\n size: Size,\n h1: H1,\n h2: H2,\n h3: H3,\n color: Color,\n quote: Quote,\n quickTable: QuickTable,\n togglePreview: TogglePreview,\n code: Code,\n codeTheme: CodeTheme,\n export: Export,\n settings: Settings,\n fullScreen: FullScreen,\n mobilePreview: MobilePreview,\n copy: Copy,\n undo: Undo,\n redo: Redo,\n underline: Underline,\n switchModel: SwitchModel,\n image: Image,\n audio: Audio,\n video: Video,\n br: Br,\n hr: Hr,\n formula: Formula,\n link: Link,\n table: Table,\n toc: Toc,\n lineTable: LineTable,\n barTable: BarTable,\n pdf: Pdf,\n word: Word,\n ruby: Ruby,\n theme: Theme,\n file: File,\n panel: Panel,\n justify: Justify,\n detail: Detail,\n drawIo: DrawIo,\n chatgpt: ChatGpt,\n};\n\nexport default class HookCenter {\n constructor(toolbar) {\n this.toolbar = toolbar;\n /**\n * @type {{[key: string]: import('@/toolbars/MenuBase').default}} 保存所有菜单实例\n */\n this.hooks = {};\n /**\n * @type {string[]} 所有注册的菜单名称\n */\n this.allMenusName = [];\n /**\n * @type {string[]} 一级菜单的名称\n */\n this.level1MenusName = [];\n /**\n * @type {{ [parentName: string]: string[]}} 二级菜单的名称, e.g. {一级菜单名称: [二级菜单名称1, 二级菜单名称2]}\n */\n this.level2MenusName = {};\n this.init();\n }\n\n $newMenu(name) {\n if (this.hooks[name]) {\n return;\n }\n const { $cherry, customMenu } = this.toolbar.options;\n if (HookList[name]) {\n this.allMenusName.push(name);\n this.hooks[name] = new HookList[name]($cherry);\n } else if (customMenu !== undefined && customMenu !== null && customMenu[name]) {\n this.allMenusName.push(name);\n // 如果是自定义菜单,传参兼容旧版\n this.hooks[name] = new customMenu[name]($cherry);\n }\n }\n\n /**\n * 根据配置动态渲染、绑定工具栏\n * @returns\n */\n init() {\n const { buttonConfig } = this.toolbar.options;\n buttonConfig.forEach((item) => {\n if (typeof item === 'string') {\n this.level1MenusName.push(item);\n this.$newMenu(item);\n } else if (typeof item === 'object') {\n const keys = Object.keys(item);\n if (keys.length === 1) {\n // 只接受形如{ name: [ subMenu ] }的参数\n const [name] = keys;\n this.level1MenusName.push(name);\n this.$newMenu(name);\n this.level2MenusName[name] = item[name];\n item[name].forEach((subItem) => {\n this.$newMenu(subItem);\n });\n }\n }\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { mac } from 'codemirror/src/util/browser';\nimport HookCenter from './HookCenter';\nimport Event from '@/Event';\nimport { createElement } from '@/utils/dom';\nimport Logger from '@/Logger';\n\nexport default class Toolbar {\n /**\n * @type {Record} 外部获取 toolbarHandler\n */\n toolbarHandlers = {};\n\n constructor(options) {\n // 存储所有菜单的实例\n this.menus = {};\n // 存储所有快捷键的影射 {快捷键: 菜单名称}\n this.shortcutKeyMap = {};\n // 存储所有二级菜单面板\n this.subMenus = {};\n // 默认的菜单配置\n this.options = {\n dom: document.createElement('div'),\n buttonConfig: ['bold'],\n customMenu: [],\n buttonRightConfig: [],\n };\n\n Object.assign(this.options, options);\n this.$cherry = this.options.$cherry;\n this.instanceId = this.$cherry.instanceId;\n this.menus = new HookCenter(this);\n this.drawMenus();\n this.init();\n }\n\n init() {\n this.collectShortcutKey();\n this.collectToolbarHandler();\n Event.on(this.instanceId, Event.Events.cleanAllSubMenus, () => this.hideAllSubMenu());\n }\n\n previewOnly() {\n this.options.dom.classList.add('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarHide);\n }\n\n showToolbar() {\n this.options.dom.classList.remove('preview-only');\n Event.emit(this.instanceId, Event.Events.toolbarShow);\n }\n\n isHasLevel2Menu(name) {\n // FIXME: return boolean\n return this.menus.level2MenusName[name];\n }\n\n isHasConfigMenu(name) {\n // FIXME: return boolean\n return this.menus.hooks[name].subMenuConfig || [];\n }\n\n /**\n * 判断是否有子菜单,目前有两种子菜单配置方式:1、通过`subMenuConfig`属性 2、通过`buttonConfig`配置属性\n * @param {string} name\n * @returns {boolean} 是否有子菜单\n */\n isHasSubMenu(name) {\n return Boolean(this.isHasLevel2Menu(name) || this.isHasConfigMenu(name).length > 0);\n }\n\n /**\n * 根据配置画出来一级工具栏\n */\n drawMenus() {\n const fragLeft = document.createDocumentFragment();\n const toolbarLeft = createElement('div', 'toolbar-left');\n\n this.menus.level1MenusName.forEach((name) => {\n const btn = this.menus.hooks[name].createBtn();\n btn.addEventListener(\n 'click',\n (event) => {\n this.onClick(event, name);\n },\n false,\n );\n if (this.isHasSubMenu(name)) {\n btn.classList.add('cherry-toolbar-dropdown');\n }\n fragLeft.appendChild(btn);\n });\n\n toolbarLeft.appendChild(fragLeft);\n this.options.dom.appendChild(toolbarLeft);\n\n this.options.buttonRightConfig?.length ? this.drawRightMenus(this.options.buttonRightConfig) : null;\n }\n /**\n * 根据配置画出来右侧一级工具栏\n */\n drawRightMenus(buttonRightConfig) {\n const toolbarRight = createElement('div', 'toolbar-right');\n const fragRight = document.createDocumentFragment();\n const rightOptions = {\n options: {\n $cherry: this.$cherry,\n buttonConfig: buttonRightConfig,\n customMenu: [],\n },\n };\n\n const rightMenus = new HookCenter(rightOptions);\n\n rightMenus.level1MenusName.forEach((name) => {\n const btn = rightMenus.hooks[name].createBtn();\n btn.addEventListener(\n 'click',\n (event) => {\n console.log('第一次点击');\n rightMenus.hooks[name].fire(event, name);\n },\n false,\n );\n fragRight.appendChild(btn);\n });\n\n toolbarRight.appendChild(fragRight);\n this.options.dom.appendChild(toolbarRight);\n }\n\n drawSubMenus(name) {\n const menu = this.menus.hooks[name];\n const pos = menu.getMenuPosition();\n this.subMenus[name] = createElement('div', 'cherry-dropdown', { name });\n this.subMenus[name].style.left = `${pos.left + pos.width / 2}px`;\n this.subMenus[name].style.top = `${pos.top + pos.height}px`;\n this.subMenus[name].style.position = menu.positionModel;\n // 如果有配置的二级菜单\n const level2MenusName = this.isHasLevel2Menu(name);\n if (level2MenusName) {\n level2MenusName.forEach((level2Name) => {\n const subMenu = this.menus.hooks[level2Name];\n if (subMenu !== undefined && typeof subMenu.createBtn === 'function') {\n const btn = subMenu.createBtn(true);\n // 二级菜单的dom认定为一级菜单的\n subMenu.dom = subMenu.dom ? subMenu.dom : this.menus.hooks[name].dom;\n btn.addEventListener('click', (event) => this.onClick(event, level2Name, true), false);\n this.subMenus[name].appendChild(btn);\n }\n });\n }\n // 兼容旧版本配置的二级菜单\n const subMenuConfig = this.isHasConfigMenu(name);\n if (subMenuConfig.length > 0) {\n subMenuConfig.forEach((config) => {\n const btn = this.menus.hooks[name].createSubBtnByConfig(config);\n btn.addEventListener('click', () => this.hideAllSubMenu(), false);\n this.subMenus[name].appendChild(btn);\n });\n }\n this.$cherry.wrapperDom.appendChild(this.subMenus[name]);\n }\n\n /**\n * 处理点击事件\n */\n onClick(event, name, focusEvent = false) {\n const menu = this.menus.hooks[name];\n if (!menu) {\n return;\n }\n if (this.isHasSubMenu(name) && !focusEvent) {\n this.toggleSubMenu(name);\n } else {\n this.hideAllSubMenu();\n menu.fire(event, name);\n }\n }\n\n /**\n * 展开/收起二级菜单\n */\n toggleSubMenu(name) {\n if (!this.subMenus[name]) {\n // 如果没有二级菜单,则先画出来,然后再显示\n this.hideAllSubMenu();\n this.drawSubMenus(name);\n this.subMenus[name].style.display = 'block';\n return;\n }\n if (this.subMenus[name].style.display === 'none') {\n // 如果是隐藏的,则先隐藏所有二级菜单,再显示当前二级菜单\n this.hideAllSubMenu();\n this.subMenus[name].style.display = 'block';\n } else {\n // 如果是显示的,则隐藏当前二级菜单\n this.subMenus[name].style.display = 'none';\n }\n }\n\n /**\n * 隐藏所有的二级菜单\n */\n hideAllSubMenu() {\n this.$cherry.wrapperDom.querySelectorAll('.cherry-dropdown').forEach((dom) => {\n dom.style.display = 'none';\n });\n }\n\n /**\n * 收集快捷键\n */\n collectShortcutKey() {\n this.menus.allMenusName.forEach((name) => {\n this.menus.hooks[name].shortcutKeys?.forEach((key) => {\n this.shortcutKeyMap[key] = name;\n });\n });\n }\n\n collectToolbarHandler() {\n this.toolbarHandlers = this.menus.allMenusName.reduce((handlerMap, name) => {\n const menuHook = this.menus.hooks[name];\n if (!menuHook) {\n return handlerMap;\n }\n handlerMap[name] = (shortcut, _callback) => {\n if (typeof _callback === 'function') {\n Logger.warn(\n 'MenuBase#onClick param callback is no longer supported. Please register the callback via MenuBase#registerAfterClickCb instead.',\n );\n }\n menuHook.fire.call(menuHook, undefined, shortcut);\n };\n return handlerMap;\n }, {});\n }\n\n /**\n * 监测是否有对应的快捷键\n * @param {KeyboardEvent} evt keydown 事件\n * @returns {boolean} 是否有对应的快捷键\n */\n matchShortcutKey(evt) {\n return !!this.shortcutKeyMap[this.getCurrentKey(evt)];\n }\n\n /**\n * 触发对应快捷键的事件\n * @param {KeyboardEvent} evt\n */\n fireShortcutKey(evt) {\n const currentKey = this.getCurrentKey(evt);\n this.menus.hooks[this.shortcutKeyMap[currentKey]]?.fire(evt, currentKey);\n }\n\n /**\n * 格式化当前按键,mac下的command按键转换为ctrl\n * @param {KeyboardEvent} event\n * @returns\n */\n getCurrentKey(event) {\n let key = '';\n if (event.ctrlKey) {\n key += 'Ctrl-';\n }\n\n if (event.altKey) {\n key += 'Alt-';\n }\n\n if (event.metaKey && mac) {\n key += 'Ctrl-';\n }\n\n // 如果存在shift键\n if (event.shiftKey) {\n key += `Shift-`;\n }\n\n // 如果还有第三个键 且不是 shift键\n if (event.key && event.key.toLowerCase() !== 'shift') {\n key += event.key.toLowerCase();\n }\n\n return key;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 在编辑区域选中文本时浮现的bubble工具栏\n */\nexport default class Bubble extends Toolbar {\n /**\n * @type {'flex' | 'block'}\n */\n static displayType = 'flex';\n // constructor(options) {\n // super(options);\n // }\n\n set visible(visible) {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n if (visible) {\n bubbleStyle.display === 'none' && (this.bubbleDom.style.display = Bubble.displayType);\n // bubbleStyle.visibility !== 'visible' && (this.bubbleBottom.style.visibility = 'visible');\n } else {\n bubbleStyle.display !== 'none' && (this.bubbleDom.style.display = 'none');\n // bubbleStyle.visibility !== 'hidden' && (this.bubbleBottom.style.visibility = 'hidden');\n }\n }\n\n get visible() {\n const bubbleStyle = window.getComputedStyle(this.bubbleDom);\n return bubbleStyle.display !== 'none' && bubbleStyle.visibility !== 'hidden';\n }\n\n init() {\n this.options.editor = this.$cherry.editor;\n this.addSelectionChangeListener();\n this.bubbleDom = this.options.dom;\n this.editorDom = this.options.editor.getEditorDom();\n this.initBubbleDom();\n this.editorDom.querySelector('.CodeMirror').appendChild(this.bubbleDom);\n }\n\n /**\n * 计算编辑区域的偏移量\n * @returns {number} 编辑区域的滚动区域\n */\n getScrollTop() {\n return this.options.editor.editor.getScrollInfo().top;\n }\n\n /**\n * 当编辑区域滚动的时候自动隐藏bubble工具栏和子工具栏\n */\n updatePositionWhenScroll() {\n if (this.bubbleDom.style.display === Bubble.displayType) {\n this.bubbleDom.style.marginTop = `${parseFloat(this.bubbleDom.dataset.scrollTop) - this.getScrollTop()}px`;\n }\n }\n\n /**\n * 根据高度计算bubble工具栏出现的位置的高度\n * 根据宽度计算bubble工具栏出现的位置的left值,以及bubble工具栏三角箭头的left值\n * @param {number} top 高度\n * @param {number} width 选中文本内容的宽度\n */\n showBubble(top, width) {\n if (!this.visible) {\n this.visible = true;\n this.bubbleDom.style.marginTop = '0';\n this.bubbleDom.dataset.scrollTop = String(this.getScrollTop());\n }\n const positionLimit = this.editorDom.querySelector('.CodeMirror-lines').firstChild.getBoundingClientRect();\n const editorPosition = this.editorDom.getBoundingClientRect();\n const minLeft = positionLimit.left - editorPosition.left;\n const maxLeft = positionLimit.width + minLeft;\n const minTop = this.bubbleDom.offsetHeight * 2;\n let $top = top;\n if ($top < minTop) {\n // 如果高度小于编辑器的顶部,则让bubble工具栏出现在选中文本的下放\n $top += this.bubbleDom.offsetHeight - this.bubbleTop.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'block';\n this.bubbleBottom.style.display = 'none';\n } else {\n // 反之出现在选中文本内容的上方\n $top -= this.bubbleDom.offsetHeight + 2 * this.bubbleBottom.getBoundingClientRect().height;\n this.bubbleTop.style.display = 'none';\n this.bubbleBottom.style.display = 'block';\n }\n this.bubbleDom.style.top = `${$top}px`;\n let left = width - this.bubbleDom.offsetWidth / 2;\n if (left < minLeft) {\n // 如果位置超过了编辑器的最左边,则控制bubble工具栏不超出编辑器最左边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = minLeft;\n this.$setBubbleCursorPosition(`${width - minLeft}px`);\n } else if (left + this.bubbleDom.offsetWidth > maxLeft) {\n // 如果位置超过了编辑器的最右边,则控制bubble工具栏不超出编辑器最右边\n // 同时bubble工具栏上的箭头尽量指向选中文本内容的中间位置\n left = maxLeft - this.bubbleDom.offsetWidth;\n this.$setBubbleCursorPosition(`${width - left}px`);\n } else {\n // 让bubble工具栏的箭头处于工具栏的中间位置\n this.$setBubbleCursorPosition('50%');\n }\n // 安全边距 20px\n this.bubbleDom.style.left = `${Math.max(20, left)}px`;\n }\n\n hideBubble() {\n this.visible = false;\n }\n\n /**\n * 控制bubble工具栏的箭头的位置\n * @param {string} left 左偏移量\n */\n $setBubbleCursorPosition(left = '50%') {\n if (left === '50%') {\n this.bubbleTop.style.left = '50%';\n this.bubbleBottom.style.left = '50%';\n } else {\n const $left = parseFloat(left) < 10 ? '10px' : left;\n this.bubbleTop.style.left = $left;\n this.bubbleBottom.style.left = $left;\n }\n }\n\n initBubbleDom() {\n const top = document.createElement('div');\n top.className = 'cherry-bubble-top';\n const bottom = document.createElement('div');\n bottom.className = 'cherry-bubble-bottom';\n this.bubbleTop = top;\n this.bubbleBottom = bottom;\n this.bubbleDom.appendChild(top);\n this.bubbleDom.appendChild(bottom);\n // 默认不可见\n this.visible = false;\n }\n\n getBubbleDom() {\n return this.bubbleDom;\n }\n\n addSelectionChangeListener() {\n this.options.editor.addListener('change', (codemirror) => {\n // 当编辑区内容变更时自动隐藏bubble工具栏\n this.hideBubble();\n });\n this.options.editor.addListener('refresh', (codemirror) => {\n // 当编辑区内容刷新时自动隐藏bubble工具栏\n this.hideBubble();\n });\n this.options.editor.addListener('scroll', (codemirror) => {\n // 当编辑区滚动时,需要实时同步bubble工具栏的位置\n this.updatePositionWhenScroll();\n });\n this.options.editor.addListener('beforeSelectionChange', (codemirror, info) => {\n // 当编辑区选中内容改变时,需要展示/隐藏bubble工具栏,并计算工具栏位置\n if (info.origin !== '*mouse' && (info.origin !== null || typeof info.origin === 'undefined')) {\n return true;\n }\n if (!info.ranges[0]) {\n return true;\n }\n const anchor = info.ranges[0].anchor.line * 1000000 + info.ranges[0].anchor.ch;\n const head = info.ranges[0].head.line * 1000000 + info.ranges[0].head.ch;\n let direction = 'asc';\n if (anchor > head) {\n direction = 'desc';\n }\n setTimeout(() => {\n const selections = codemirror.getSelections();\n if (selections.join('').length <= 0) {\n this.hideBubble();\n return;\n }\n const selectedObjs = codemirror.getWrapperElement().getElementsByClassName('CodeMirror-selected');\n const editorPosition = this.editorDom.getBoundingClientRect();\n let width = 0;\n let top = 0;\n if (typeof selectedObjs !== 'object' || selectedObjs.length <= 0) {\n this.hideBubble();\n return;\n }\n for (let key = 0; key < selectedObjs.length; key++) {\n const one = selectedObjs[key];\n const position = one.getBoundingClientRect();\n const targetTop = position.top - editorPosition.top;\n if (direction === 'asc') {\n if (targetTop >= top) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n } else {\n if (targetTop <= top || top <= 0) {\n top = targetTop;\n width = position.left - editorPosition.left + position.width / 2;\n }\n }\n }\n this.showBubble(top, width);\n }, 10);\n });\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 当光标处于编辑器新行起始位置时出现的浮动工具栏\n */\nexport default class FloatMenu extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n\n init() {\n this.editor = this.$cherry.editor;\n this.editorDom = this.editor.getEditorDom();\n this.editorDom.querySelector('.CodeMirror-scroll').appendChild(this.options.dom);\n this.initAction();\n }\n\n initAction() {\n const self = this;\n this.editor.addListener('cursorActivity', (codemirror, evt) => {\n // 当编辑区光标位置改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('update', (codemirror, evt) => {\n // 当编辑区内容改变时触发\n self.cursorActivity(evt, codemirror);\n });\n\n this.editor.addListener('refresh', (codemirror, evt) => {\n // 当编辑器刷新时触发\n setTimeout(() => {\n self.cursorActivity(evt, codemirror);\n }, 0);\n });\n }\n\n update(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n }\n\n /**\n * 当光标激活时触发,当光标处于行起始位置时展示float工具栏;反之隐藏\n * @param {Event} evt\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n cursorActivity(evt, codeMirror) {\n const pos = codeMirror.getCursor();\n const codeMirrorLines = document.querySelector('.cherry-editor .CodeMirror-lines');\n if (!codeMirrorLines) {\n return false;\n }\n const computedLinesStyle = getComputedStyle(codeMirrorLines);\n const codeWrapPaddingLeft = parseFloat(computedLinesStyle.paddingLeft);\n const codeWrapPaddingTop = parseFloat(computedLinesStyle.paddingTop);\n // const cursorHandle = codeMirror.getLineHandle(pos.line);\n // const verticalMiddle = cursorHandle.height * 1 / 2;\n\n if (this.isHidden(pos.line, codeMirror)) {\n this.options.dom.style.display = 'none';\n return false;\n }\n this.options.dom.style.display = 'inline-block';\n this.options.dom.style.left = `${codeWrapPaddingLeft}px`;\n this.options.dom.style.top = `${this.getLineHeight(pos.line, codeMirror) + codeWrapPaddingTop}px`;\n }\n\n /**\n * 判断是否需要隐藏Float工具栏\n * 有选中内容,或者光标所在行有内容时隐藏float 工具栏\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns {boolean} 是否需要隐藏float工具栏,true:需要隐藏\n */\n isHidden(line, codeMirror) {\n const selections = codeMirror.getSelections();\n if (selections.length > 1) {\n return true;\n }\n const selection = codeMirror.getSelection();\n if (selection.length > 0) {\n return true;\n }\n if (codeMirror.getLine(line)) {\n return true;\n }\n return false;\n }\n\n /**\n * 获取对应行的行高度,用来让float 工具栏在该行保持垂直居中\n * @param {number} line\n * @param {CodeMirror.Editor} codeMirror\n * @returns\n */\n getLineHeight(line, codeMirror) {\n let height = 0;\n codeMirror.getDoc().eachLine(0, line, (line) => {\n height += line.height;\n });\n\n return height;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Toolbar from './Toolbar';\n/**\n * 预览区域右侧悬浮的工具栏\n * 推荐放置跟编辑区域完全无关的工具栏\n * 比如复制预览区域内容、修改预览区域主题等\n */\nexport default class Sidebar extends Toolbar {\n // constructor(options) {\n // super(options);\n // }\n}\n","/**\n * This library modifies the diff-patch-match library by Neil Fraser\n * by removing the patch and match functionality and certain advanced\n * options in the diff function. The original license is as follows:\n *\n * ===\n *\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * The data structure representing a diff is an array of tuples:\n * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]\n * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n */\nvar DIFF_DELETE = -1;\nvar DIFF_INSERT = 1;\nvar DIFF_EQUAL = 0;\n\n\n/**\n * Find the differences between two texts. Simplifies the problem by stripping\n * any common prefix or suffix off the texts before diffing.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info\n * @return {Array} Array of diff tuples.\n */\nfunction diff_main(text1, text2, cursor_pos, _fix_unicode) {\n // Check for equality\n if (text1 === text2) {\n if (text1) {\n return [[DIFF_EQUAL, text1]];\n }\n return [];\n }\n\n if (cursor_pos != null) {\n var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos);\n if (editdiff) {\n return editdiff;\n }\n }\n\n // Trim off common prefix (speedup).\n var commonlength = diff_commonPrefix(text1, text2);\n var commonprefix = text1.substring(0, commonlength);\n text1 = text1.substring(commonlength);\n text2 = text2.substring(commonlength);\n\n // Trim off common suffix (speedup).\n commonlength = diff_commonSuffix(text1, text2);\n var commonsuffix = text1.substring(text1.length - commonlength);\n text1 = text1.substring(0, text1.length - commonlength);\n text2 = text2.substring(0, text2.length - commonlength);\n\n // Compute the diff on the middle block.\n var diffs = diff_compute_(text1, text2);\n\n // Restore the prefix and suffix.\n if (commonprefix) {\n diffs.unshift([DIFF_EQUAL, commonprefix]);\n }\n if (commonsuffix) {\n diffs.push([DIFF_EQUAL, commonsuffix]);\n }\n diff_cleanupMerge(diffs, _fix_unicode);\n return diffs;\n};\n\n\n/**\n * Find the differences between two texts. Assumes that the texts do not\n * have any common prefix or suffix.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_compute_(text1, text2) {\n var diffs;\n\n if (!text1) {\n // Just add some text (speedup).\n return [[DIFF_INSERT, text2]];\n }\n\n if (!text2) {\n // Just delete some text (speedup).\n return [[DIFF_DELETE, text1]];\n }\n\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n var i = longtext.indexOf(shorttext);\n if (i !== -1) {\n // Shorter text is inside the longer text (speedup).\n diffs = [\n [DIFF_INSERT, longtext.substring(0, i)],\n [DIFF_EQUAL, shorttext],\n [DIFF_INSERT, longtext.substring(i + shorttext.length)]\n ];\n // Swap insertions for deletions if diff is reversed.\n if (text1.length > text2.length) {\n diffs[0][0] = diffs[2][0] = DIFF_DELETE;\n }\n return diffs;\n }\n\n if (shorttext.length === 1) {\n // Single character string.\n // After the previous speedup, the character can't be an equality.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n }\n\n // Check to see if the problem can be split in two.\n var hm = diff_halfMatch_(text1, text2);\n if (hm) {\n // A half-match was found, sort out the return data.\n var text1_a = hm[0];\n var text1_b = hm[1];\n var text2_a = hm[2];\n var text2_b = hm[3];\n var mid_common = hm[4];\n // Send both pairs off for separate processing.\n var diffs_a = diff_main(text1_a, text2_a);\n var diffs_b = diff_main(text1_b, text2_b);\n // Merge the results.\n return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);\n }\n\n return diff_bisect_(text1, text2);\n};\n\n\n/**\n * Find the 'middle snake' of a diff, split the problem in two\n * and return the recursively constructed diff.\n * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @return {Array} Array of diff tuples.\n * @private\n */\nfunction diff_bisect_(text1, text2) {\n // Cache the text lengths to prevent multiple calls.\n var text1_length = text1.length;\n var text2_length = text2.length;\n var max_d = Math.ceil((text1_length + text2_length) / 2);\n var v_offset = max_d;\n var v_length = 2 * max_d;\n var v1 = new Array(v_length);\n var v2 = new Array(v_length);\n // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n // integers and undefined.\n for (var x = 0; x < v_length; x++) {\n v1[x] = -1;\n v2[x] = -1;\n }\n v1[v_offset + 1] = 0;\n v2[v_offset + 1] = 0;\n var delta = text1_length - text2_length;\n // If the total number of characters is odd, then the front path will collide\n // with the reverse path.\n var front = (delta % 2 !== 0);\n // Offsets for start and end of k loop.\n // Prevents mapping of space beyond the grid.\n var k1start = 0;\n var k1end = 0;\n var k2start = 0;\n var k2end = 0;\n for (var d = 0; d < max_d; d++) {\n // Walk the front path one step.\n for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n var k1_offset = v_offset + k1;\n var x1;\n if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n x1 = v1[k1_offset + 1];\n } else {\n x1 = v1[k1_offset - 1] + 1;\n }\n var y1 = x1 - k1;\n while (\n x1 < text1_length && y1 < text2_length &&\n text1.charAt(x1) === text2.charAt(y1)\n ) {\n x1++;\n y1++;\n }\n v1[k1_offset] = x1;\n if (x1 > text1_length) {\n // Ran off the right of the graph.\n k1end += 2;\n } else if (y1 > text2_length) {\n // Ran off the bottom of the graph.\n k1start += 2;\n } else if (front) {\n var k2_offset = v_offset + delta - k1;\n if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {\n // Mirror x2 onto top-left coordinate system.\n var x2 = text1_length - v2[k2_offset];\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n\n // Walk the reverse path one step.\n for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n var k2_offset = v_offset + k2;\n var x2;\n if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n x2 = v2[k2_offset + 1];\n } else {\n x2 = v2[k2_offset - 1] + 1;\n }\n var y2 = x2 - k2;\n while (\n x2 < text1_length && y2 < text2_length &&\n text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1)\n ) {\n x2++;\n y2++;\n }\n v2[k2_offset] = x2;\n if (x2 > text1_length) {\n // Ran off the left of the graph.\n k2end += 2;\n } else if (y2 > text2_length) {\n // Ran off the top of the graph.\n k2start += 2;\n } else if (!front) {\n var k1_offset = v_offset + delta - k2;\n if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {\n var x1 = v1[k1_offset];\n var y1 = v_offset + x1 - k1_offset;\n // Mirror x2 onto top-left coordinate system.\n x2 = text1_length - x2;\n if (x1 >= x2) {\n // Overlap detected.\n return diff_bisectSplit_(text1, text2, x1, y1);\n }\n }\n }\n }\n }\n // Diff took too long and hit the deadline or\n // number of diffs equals number of characters, no commonality at all.\n return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];\n};\n\n\n/**\n * Given the location of the 'middle snake', split the diff in two parts\n * and recurse.\n * @param {string} text1 Old string to be diffed.\n * @param {string} text2 New string to be diffed.\n * @param {number} x Index of split point in text1.\n * @param {number} y Index of split point in text2.\n * @return {Array} Array of diff tuples.\n */\nfunction diff_bisectSplit_(text1, text2, x, y) {\n var text1a = text1.substring(0, x);\n var text2a = text2.substring(0, y);\n var text1b = text1.substring(x);\n var text2b = text2.substring(y);\n\n // Compute both diffs serially.\n var diffs = diff_main(text1a, text2a);\n var diffsb = diff_main(text1b, text2b);\n\n return diffs.concat(diffsb);\n};\n\n\n/**\n * Determine the common prefix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the start of each\n * string.\n */\nfunction diff_commonPrefix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerstart = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(pointerstart, pointermid) ==\n text2.substring(pointerstart, pointermid)\n ) {\n pointermin = pointermid;\n pointerstart = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Determine the common suffix of two strings.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {number} The number of characters common to the end of each string.\n */\nfunction diff_commonSuffix(text1, text2) {\n // Quick check for common null cases.\n if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) {\n return 0;\n }\n // Binary search.\n // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n var pointermin = 0;\n var pointermax = Math.min(text1.length, text2.length);\n var pointermid = pointermax;\n var pointerend = 0;\n while (pointermin < pointermid) {\n if (\n text1.substring(text1.length - pointermid, text1.length - pointerend) ==\n text2.substring(text2.length - pointermid, text2.length - pointerend)\n ) {\n pointermin = pointermid;\n pointerend = pointermin;\n } else {\n pointermax = pointermid;\n }\n pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n }\n\n if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) {\n pointermid--;\n }\n\n return pointermid;\n};\n\n\n/**\n * Do the two texts share a substring which is at least half the length of the\n * longer text?\n * This speedup can produce non-minimal diffs.\n * @param {string} text1 First string.\n * @param {string} text2 Second string.\n * @return {Array.} Five element Array, containing the prefix of\n * text1, the suffix of text1, the prefix of text2, the suffix of\n * text2 and the common middle. Or null if there was no match.\n */\nfunction diff_halfMatch_(text1, text2) {\n var longtext = text1.length > text2.length ? text1 : text2;\n var shorttext = text1.length > text2.length ? text2 : text1;\n if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n return null; // Pointless.\n }\n\n /**\n * Does a substring of shorttext exist within longtext such that the substring\n * is at least half the length of longtext?\n * Closure, but does not reference any external variables.\n * @param {string} longtext Longer string.\n * @param {string} shorttext Shorter string.\n * @param {number} i Start index of quarter length substring within longtext.\n * @return {Array.} Five element Array, containing the prefix of\n * longtext, the suffix of longtext, the prefix of shorttext, the suffix\n * of shorttext and the common middle. Or null if there was no match.\n * @private\n */\n function diff_halfMatchI_(longtext, shorttext, i) {\n // Start with a 1/4 length substring at position i as a seed.\n var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n var j = -1;\n var best_common = '';\n var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;\n while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n var prefixLength = diff_commonPrefix(\n longtext.substring(i), shorttext.substring(j));\n var suffixLength = diff_commonSuffix(\n longtext.substring(0, i), shorttext.substring(0, j));\n if (best_common.length < suffixLength + prefixLength) {\n best_common = shorttext.substring(\n j - suffixLength, j) + shorttext.substring(j, j + prefixLength);\n best_longtext_a = longtext.substring(0, i - suffixLength);\n best_longtext_b = longtext.substring(i + prefixLength);\n best_shorttext_a = shorttext.substring(0, j - suffixLength);\n best_shorttext_b = shorttext.substring(j + prefixLength);\n }\n }\n if (best_common.length * 2 >= longtext.length) {\n return [\n best_longtext_a, best_longtext_b,\n best_shorttext_a, best_shorttext_b, best_common\n ];\n } else {\n return null;\n }\n }\n\n // First check if the second quarter is the seed for a half-match.\n var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4));\n // Check again based on the third quarter.\n var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2));\n var hm;\n if (!hm1 && !hm2) {\n return null;\n } else if (!hm2) {\n hm = hm1;\n } else if (!hm1) {\n hm = hm2;\n } else {\n // Both matched. Select the longest.\n hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n }\n\n // A half-match was found, sort out the return data.\n var text1_a, text1_b, text2_a, text2_b;\n if (text1.length > text2.length) {\n text1_a = hm[0];\n text1_b = hm[1];\n text2_a = hm[2];\n text2_b = hm[3];\n } else {\n text2_a = hm[0];\n text2_b = hm[1];\n text1_a = hm[2];\n text1_b = hm[3];\n }\n var mid_common = hm[4];\n return [text1_a, text1_b, text2_a, text2_b, mid_common];\n};\n\n\n/**\n * Reorder and merge like edit sections. Merge equalities.\n * Any edit section can move as long as it doesn't cross an equality.\n * @param {Array} diffs Array of diff tuples.\n * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff\n */\nfunction diff_cleanupMerge(diffs, fix_unicode) {\n diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.\n var pointer = 0;\n var count_delete = 0;\n var count_insert = 0;\n var text_delete = '';\n var text_insert = '';\n var commonlength;\n while (pointer < diffs.length) {\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n diffs.splice(pointer, 1);\n continue;\n }\n switch (diffs[pointer][0]) {\n case DIFF_INSERT:\n\n count_insert++;\n text_insert += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_DELETE:\n count_delete++;\n text_delete += diffs[pointer][1];\n pointer++;\n break;\n case DIFF_EQUAL:\n var previous_equality = pointer - count_insert - count_delete - 1;\n if (fix_unicode) {\n // prevent splitting of unicode surrogate pairs. when fix_unicode is true,\n // we assume that the old and new text in the diff are complete and correct\n // unicode-encoded JS strings, but the tuple boundaries may fall between\n // surrogate pairs. we fix this by shaving off stray surrogates from the end\n // of the previous equality and the beginning of this equality. this may create\n // empty equalities or a common prefix or suffix. for example, if AB and AC are\n // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and\n // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this\n // particular case, both equalities go away, we absorb any previous inequalities,\n // and we keep scanning for the next equality before rewriting the tuples.\n if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) {\n var stray = diffs[previous_equality][1].slice(-1);\n diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1);\n text_delete = stray + text_delete;\n text_insert = stray + text_insert;\n if (!diffs[previous_equality][1]) {\n // emptied out previous equality, so delete it and include previous delete/insert\n diffs.splice(previous_equality, 1);\n pointer--;\n var k = previous_equality - 1;\n if (diffs[k] && diffs[k][0] === DIFF_INSERT) {\n count_insert++;\n text_insert = diffs[k][1] + text_insert;\n k--;\n }\n if (diffs[k] && diffs[k][0] === DIFF_DELETE) {\n count_delete++;\n text_delete = diffs[k][1] + text_delete;\n k--;\n }\n previous_equality = k;\n }\n }\n if (starts_with_pair_end(diffs[pointer][1])) {\n var stray = diffs[pointer][1].charAt(0);\n diffs[pointer][1] = diffs[pointer][1].slice(1);\n text_delete += stray;\n text_insert += stray;\n }\n }\n if (pointer < diffs.length - 1 && !diffs[pointer][1]) {\n // for empty equality not at end, wait for next equality\n diffs.splice(pointer, 1);\n break;\n }\n if (text_delete.length > 0 || text_insert.length > 0) {\n // note that diff_commonPrefix and diff_commonSuffix are unicode-aware\n if (text_delete.length > 0 && text_insert.length > 0) {\n // Factor out any common prefixes.\n commonlength = diff_commonPrefix(text_insert, text_delete);\n if (commonlength !== 0) {\n if (previous_equality >= 0) {\n diffs[previous_equality][1] += text_insert.substring(0, commonlength);\n } else {\n diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]);\n pointer++;\n }\n text_insert = text_insert.substring(commonlength);\n text_delete = text_delete.substring(commonlength);\n }\n // Factor out any common suffixes.\n commonlength = diff_commonSuffix(text_insert, text_delete);\n if (commonlength !== 0) {\n diffs[pointer][1] =\n text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];\n text_insert = text_insert.substring(0, text_insert.length - commonlength);\n text_delete = text_delete.substring(0, text_delete.length - commonlength);\n }\n }\n // Delete the offending records and add the merged ones.\n var n = count_insert + count_delete;\n if (text_delete.length === 0 && text_insert.length === 0) {\n diffs.splice(pointer - n, n);\n pointer = pointer - n;\n } else if (text_delete.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 1;\n } else if (text_insert.length === 0) {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]);\n pointer = pointer - n + 1;\n } else {\n diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]);\n pointer = pointer - n + 2;\n }\n }\n if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) {\n // Merge this equality with the previous one.\n diffs[pointer - 1][1] += diffs[pointer][1];\n diffs.splice(pointer, 1);\n } else {\n pointer++;\n }\n count_insert = 0;\n count_delete = 0;\n text_delete = '';\n text_insert = '';\n break;\n }\n }\n if (diffs[diffs.length - 1][1] === '') {\n diffs.pop(); // Remove the dummy entry at the end.\n }\n\n // Second pass: look for single edits surrounded on both sides by equalities\n // which can be shifted sideways to eliminate an equality.\n // e.g: ABAC -> ABAC\n var changes = false;\n pointer = 1;\n // Intentionally ignore the first and last element (don't need checking).\n while (pointer < diffs.length - 1) {\n if (diffs[pointer - 1][0] === DIFF_EQUAL &&\n diffs[pointer + 1][0] === DIFF_EQUAL) {\n // This is a single edit surrounded by equalities.\n if (diffs[pointer][1].substring(diffs[pointer][1].length -\n diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) {\n // Shift the edit over the previous equality.\n diffs[pointer][1] = diffs[pointer - 1][1] +\n diffs[pointer][1].substring(0, diffs[pointer][1].length -\n diffs[pointer - 1][1].length);\n diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n diffs.splice(pointer - 1, 1);\n changes = true;\n } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==\n diffs[pointer + 1][1]) {\n // Shift the edit over the next equality.\n diffs[pointer - 1][1] += diffs[pointer + 1][1];\n diffs[pointer][1] =\n diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n diffs[pointer + 1][1];\n diffs.splice(pointer + 1, 1);\n changes = true;\n }\n }\n pointer++;\n }\n // If shifts were made, the diff needs reordering and another shift sweep.\n if (changes) {\n diff_cleanupMerge(diffs, fix_unicode);\n }\n};\n\nfunction is_surrogate_pair_start(charCode) {\n return charCode >= 0xD800 && charCode <= 0xDBFF;\n}\n\nfunction is_surrogate_pair_end(charCode) {\n return charCode >= 0xDC00 && charCode <= 0xDFFF;\n}\n\nfunction starts_with_pair_end(str) {\n return is_surrogate_pair_end(str.charCodeAt(0));\n}\n\nfunction ends_with_pair_start(str) {\n return is_surrogate_pair_start(str.charCodeAt(str.length - 1));\n}\n\nfunction remove_empty_tuples(tuples) {\n var ret = [];\n for (var i = 0; i < tuples.length; i++) {\n if (tuples[i][1].length > 0) {\n ret.push(tuples[i]);\n }\n }\n return ret;\n}\n\nfunction make_edit_splice(before, oldMiddle, newMiddle, after) {\n if (ends_with_pair_start(before) || starts_with_pair_end(after)) {\n return null;\n }\n return remove_empty_tuples([\n [DIFF_EQUAL, before],\n [DIFF_DELETE, oldMiddle],\n [DIFF_INSERT, newMiddle],\n [DIFF_EQUAL, after]\n ]);\n}\n\nfunction find_cursor_edit_diff(oldText, newText, cursor_pos) {\n // note: this runs after equality check has ruled out exact equality\n var oldRange = typeof cursor_pos === 'number' ?\n { index: cursor_pos, length: 0 } : cursor_pos.oldRange;\n var newRange = typeof cursor_pos === 'number' ?\n null : cursor_pos.newRange;\n // take into account the old and new selection to generate the best diff\n // possible for a text edit. for example, a text change from \"xxx\" to \"xx\"\n // could be a delete or forwards-delete of any one of the x's, or the\n // result of selecting two of the x's and typing \"x\".\n var oldLength = oldText.length;\n var newLength = newText.length;\n if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) {\n // see if we have an insert or delete before or after cursor\n var oldCursor = oldRange.index;\n var oldBefore = oldText.slice(0, oldCursor);\n var oldAfter = oldText.slice(oldCursor);\n var maybeNewCursor = newRange ? newRange.index : null;\n editBefore: {\n // is this an insert or delete right before oldCursor?\n var newCursor = oldCursor + newLength - oldLength;\n if (maybeNewCursor !== null && maybeNewCursor !== newCursor) {\n break editBefore;\n }\n if (newCursor < 0 || newCursor > newLength) {\n break editBefore;\n }\n var newBefore = newText.slice(0, newCursor);\n var newAfter = newText.slice(newCursor);\n if (newAfter !== oldAfter) {\n break editBefore;\n }\n var prefixLength = Math.min(oldCursor, newCursor);\n var oldPrefix = oldBefore.slice(0, prefixLength);\n var newPrefix = newBefore.slice(0, prefixLength);\n if (oldPrefix !== newPrefix) {\n break editBefore;\n }\n var oldMiddle = oldBefore.slice(prefixLength);\n var newMiddle = newBefore.slice(prefixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter);\n }\n editAfter: {\n // is this an insert or delete right after oldCursor?\n if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) {\n break editAfter;\n }\n var cursor = oldCursor;\n var newBefore = newText.slice(0, cursor);\n var newAfter = newText.slice(cursor);\n if (newBefore !== oldBefore) {\n break editAfter;\n }\n var suffixLength = Math.min(oldLength - cursor, newLength - cursor);\n var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength);\n var newSuffix = newAfter.slice(newAfter.length - suffixLength);\n if (oldSuffix !== newSuffix) {\n break editAfter;\n }\n var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength);\n var newMiddle = newAfter.slice(0, newAfter.length - suffixLength);\n return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix);\n }\n }\n if (oldRange.length > 0 && newRange && newRange.length === 0) {\n replaceRange: {\n // see if diff could be a splice of the old selection range\n var oldPrefix = oldText.slice(0, oldRange.index);\n var oldSuffix = oldText.slice(oldRange.index + oldRange.length);\n var prefixLength = oldPrefix.length;\n var suffixLength = oldSuffix.length;\n if (newLength < prefixLength + suffixLength) {\n break replaceRange;\n }\n var newPrefix = newText.slice(0, prefixLength);\n var newSuffix = newText.slice(newLength - suffixLength);\n if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) {\n break replaceRange;\n }\n var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength);\n var newMiddle = newText.slice(prefixLength, newLength - suffixLength);\n return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix);\n }\n }\n\n return null;\n}\n\nfunction diff(text1, text2, cursor_pos) {\n // only pass fix_unicode=true at the top level, not when diff_main is\n // recursively invoked\n return diff_main(text1, text2, cursor_pos, true);\n}\n\ndiff.INSERT = DIFF_INSERT;\ndiff.DELETE = DIFF_DELETE;\ndiff.EQUAL = DIFF_EQUAL;\n\nmodule.exports = diff;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport diff from 'fast-diff';\n/**\n * 更新内容时保持光标不变\n * @param {Number} pos 光标相对文档开头的偏移量\n * @param {String} oldContent 变更前的内容\n * @param {String} newContent 变更后的内容\n * @returns {Number} newPos 新的光标偏移量\n */\nexport default function getPosBydiffs(pos, oldContent, newContent) {\n const diffs = diff(oldContent, newContent);\n let newPos = pos;\n let tmpPos = pos;\n for (let i = 0; i < diffs.length; i++) {\n const val = diffs[i];\n if (tmpPos <= 0) {\n return newPos;\n }\n const opType = val[0];\n const opLength = val[1].length;\n switch (opType) {\n // 没有改变的内容\n case diff.EQUAL:\n if (tmpPos <= opLength) {\n return newPos;\n }\n tmpPos -= opLength;\n break;\n // 删除的内容\n case diff.DELETE:\n if (tmpPos <= opLength) {\n return newPos - opLength + tmpPos;\n }\n tmpPos -= opLength;\n newPos -= opLength;\n break;\n // 新增的内容\n case diff.INSERT:\n newPos += opLength;\n break;\n }\n }\n return newPos;\n}\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys'),\n keysIn = require('./keysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport cloneDeep from 'lodash/cloneDeep';\n\nconst callbacks = {\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: (url, srcType) => url,\n fileUpload(file, callback) {\n if (/video/i.test(file.type)) {\n callback('images/demo-dog.png', {\n name: `${file.name.replace(/\\.[^.]+$/, '')}`,\n poster: 'images/demo-dog.png?poster=true',\n isBorder: true,\n isShadow: true,\n isRadius: true,\n });\n } else {\n callback('images/demo-dog.png', { name: `${file.name.replace(/\\.[^.]+$/, '')}`, isShadow: true });\n }\n },\n afterChange: (text, html) => {},\n afterInit: (text, html) => {},\n beforeImageMounted: (srcProp, src) => ({ srcProp, src }),\n onClickPreview: (event) => {},\n onCopyCode: (event, code) => {\n // 阻止默认的粘贴事件\n // return false;\n // 对复制内容进行额外处理\n return code;\n },\n // 获取中文的拼音\n changeString2Pinyin: (string) => {\n /**\n * 推荐使用这个组件:https://github.com/liu11hao11/pinyin_js\n *\n * 可以在 ../scripts/pinyin/pinyin_dist.js 里直接引用\n */\n return string;\n },\n};\n\n/** @type {Partial} */\nconst defaultConfig = {\n // 第三方包\n externals: {\n // externals\n },\n // 解析引擎配置\n engine: {\n // 全局配置\n global: {\n // 是否启用经典换行逻辑\n // true:一个换行会被忽略,两个以上连续换行会分割成段落,\n // false: 一个换行会转成
,两个连续换行会分割成段落,三个以上连续换行会转成
并分割段落\n classicBr: false,\n /**\n * 全局的URL处理器\n * @param {string} url 来源url\n * @param {'image'|'audio'|'video'|'autolink'|'link'} srcType 来源类型\n * @returns\n */\n urlProcessor: callbacks.urlProcessor,\n /**\n * 额外允许渲染的html标签\n * 标签以英文竖线分隔,如:htmlWhiteList: 'iframe|script|style'\n * 默认为空,默认允许渲染的html见src/utils/sanitize.js whiteList 属性\n * 需要注意:\n * - 启用iframe、script等标签后,会产生xss注入,请根据实际场景判断是否需要启用\n * - 一般编辑权限可控的场景(如api文档系统)可以允许iframe、script等标签\n */\n htmlWhiteList: '',\n },\n // 内置语法配置\n syntax: {\n // 语法开关\n // 'hookName': false,\n // 语法配置\n // 'hookName': {\n //\n // }\n autoLink: {\n /** 是否开启短链接 */\n enableShortLink: true,\n /** 短链接长度 */\n shortLinkLength: 20,\n },\n list: {\n listNested: false, // 同级列表类型转换后变为子级\n indentSpace: 2, // 默认2个空格缩进\n },\n table: {\n enableChart: false,\n // chartRenderEngine: EChartsTableEngine,\n // externals: ['echarts'],\n },\n inlineCode: {\n theme: 'red',\n },\n codeBlock: {\n theme: 'dark', // 默认为深色主题\n wrap: true, // 超出长度是否换行,false则显示滚动条\n lineNumber: true, // 默认显示行号\n copyCode: true, // 是否显示“复制”按钮\n customRenderer: {\n // 自定义语法渲染器\n },\n mermaid: {\n svg2img: false, // 是否将mermaid生成的画图变成img格式\n },\n /**\n * indentedCodeBlock是缩进代码块是否启用的开关\n *\n * 在6.X之前的版本中默认不支持该语法。\n * 因为cherry的开发团队认为该语法太丑了(容易误触)\n * 开发团队希望用```代码块语法来彻底取代该语法\n * 但在后续的沟通中,开发团队发现在某些场景下该语法有更好的显示效果\n * 因此开发团队在6.X版本中才引入了该语法\n * 已经引用6.x以下版本的业务如果想做到用户无感知升级,可以去掉该语法:\n * indentedCodeBlock:false\n */\n indentedCodeBlock: true,\n },\n emoji: {\n useUnicode: true, // 是否使用unicode进行渲染\n },\n fontEmphasis: {\n /**\n * 是否允许首尾空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * __ hello __ ====> hello \n * __hello__ ====> hello\n * false:\n * __ hello __ ====> _ hello _\n * __hello__ ====> hello\n */\n allowWhitespace: false,\n },\n strikethrough: {\n /**\n * 是否必须有前后空格\n * 首尾、前后的定义: 语法前**语法首+内容+语法尾**语法后\n * 例:\n * true:\n * hello wor~~l~~d ====> hello wor~~l~~d\n * hello wor ~~l~~ d ====> hello wor l d\n * false:\n * hello wor~~l~~d ====> hello world\n * hello wor ~~l~~ d ====> hello wor l d\n */\n needWhitespace: false,\n },\n mathBlock: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n plugins: true, // 默认加载插件\n },\n inlineMath: {\n engine: 'MathJax', // katex或MathJax\n src: '',\n },\n toc: {\n /** 默认只渲染一个目录 */\n allowMultiToc: false,\n },\n header: {\n /**\n * 标题的样式:\n * - default 默认样式,标题前面有锚点\n * - autonumber 标题前面有自增序号锚点\n * - none 标题没有锚点\n */\n anchorStyle: 'default',\n },\n },\n },\n editor: {\n id: 'code', // textarea 的id属性值\n name: 'code', // textarea 的name属性值\n autoSave2Textarea: false, // 是否自动将编辑区的内容回写到textarea里\n theme: 'default', // depend on codemirror theme name: https://codemirror.net/demo/theme.htm\n // 编辑器的高度,默认100%,如果挂载点存在内联设置的height则以内联样式为主\n height: '100%',\n // defaultModel 编辑器初始化后的默认模式,一共有三种模式:1、双栏编辑预览模式;2、纯编辑模式;3、预览模式\n // edit&preview: 双栏编辑预览模式\n // editOnly: 纯编辑模式(没有预览,可通过toolbar切换成双栏或预览模式)\n // previewOnly: 预览模式(没有编辑框,toolbar只显示“返回编辑”按钮,可通过toolbar切换成编辑模式)\n defaultModel: 'edit&preview',\n // 粘贴时是否自动将html转成markdown\n convertWhenPaste: true,\n codemirror: {\n // 是否自动focus 默认为true\n autofocus: true,\n },\n writingStyle: 'normal', // 书写风格,normal 普通 | typewriter 打字机 | focus 专注,默认normal\n },\n toolbars: {\n theme: 'dark', // light or dark\n showToolbar: true, // false:不展示顶部工具栏; true:展示工具栏; toolbars.showToolbar=false 与 toolbars.toolbar=false 等效\n toolbar: [\n 'bold',\n 'italic',\n 'strikethrough',\n '|',\n 'color',\n 'header',\n 'ruby',\n '|',\n 'list',\n 'panel',\n // 'justify', // 对齐方式,默认不推荐这么“复杂”的样式要求\n 'detail',\n {\n insert: [\n 'image',\n 'audio',\n 'video',\n 'link',\n 'hr',\n 'br',\n 'code',\n 'formula',\n 'toc',\n 'table',\n 'line-table',\n 'bar-table',\n 'pdf',\n 'word',\n ],\n },\n 'graph',\n 'settings',\n ],\n toolbarRight: [],\n sidebar: [],\n bubble: ['bold', 'italic', 'underline', 'strikethrough', 'sub', 'sup', 'quote', '|', 'size', 'color'], // array or false\n float: ['h1', 'h2', 'h3', '|', 'checklist', 'quote', 'table', 'code'], // array or false\n },\n // 打开draw.io编辑页的url,如果为空则drawio按钮失效\n drawioIframeUrl: '',\n // 上传文件的回调\n fileUpload: callbacks.fileUpload,\n /**\n * 上传文件的时候用来指定文件类型\n */\n fileTypeLimitMap: {\n video: 'video/*',\n audio: 'audio/*',\n image: 'image/*',\n word: '.doc,.docx',\n pdf: '.pdf',\n file: '*',\n },\n callback: {\n afterChange: callbacks.afterChange,\n afterInit: callbacks.afterInit,\n beforeImageMounted: callbacks.beforeImageMounted,\n // 预览区域点击事件,previewer.enablePreviewerBubble = true 时生效\n onClickPreview: callbacks.onClickPreview,\n // 复制代码块代码时的回调\n onCopyCode: callbacks.onCopyCode,\n // 把中文变成拼音的回调,当然也可以把中文变成英文、英文变成中文\n changeString2Pinyin: callbacks.changeString2Pinyin,\n },\n previewer: {\n dom: false,\n className: 'cherry-markdown',\n // 是否启用预览区域编辑能力(目前支持编辑图片尺寸、编辑表格内容)\n enablePreviewerBubble: true,\n /**\n * 配置图片懒加载的逻辑\n * - 如果不希望图片懒加载,可配置成 lazyLoadImg = {noLoadImgNum: -1}\n * - 如果希望所有图片都无脑懒加载,可配置成 lazyLoadImg = {noLoadImgNum: 0, autoLoadImgNum: -1}\n * - 如果一共有15张图片,希望:\n * 1、前5张图片(1~5)直接加载;\n * 2、后5张图片(6~10)不论在不在视区内,都无脑懒加载;\n * 3、其他图片(11~15)在视区内时,进行懒加载;\n * 则配置应该为:lazyLoadImg = {noLoadImgNum: 5, autoLoadImgNum: 5}\n */\n lazyLoadImg: {\n // 加载图片时如果需要展示loading图,则配置loading图的地址\n loadingImgPath: '',\n // 同一时间最多有几个图片请求,最大同时加载6张图片\n maxNumPerTime: 2,\n // 不进行懒加载处理的图片数量,如果为0,即所有图片都进行懒加载处理, 如果设置为-1,则所有图片都不进行懒加载处理\n noLoadImgNum: 5,\n // 首次自动加载几张图片(不论图片是否滚动到视野内),autoLoadImgNum = -1 表示会自动加载完所有图片\n autoLoadImgNum: 5,\n // 针对加载失败的图片 或 beforeLoadOneImgCallback 返回false 的图片,最多尝试加载几次,为了防止死循环,最多5次。以图片的src为纬度统计重试次数\n maxTryTimesPerSrc: 2,\n // 加载一张图片之前的回调函数,函数return false 会终止加载操作\n beforeLoadOneImgCallback: (img) => {\n return true;\n },\n // 加载一张图片失败之后的回调函数\n failLoadOneImgCallback: (img) => {},\n // 加载一张图片之后的回调函数,如果图片加载失败,则不会回调该函数\n afterLoadOneImgCallback: (img) => {},\n // 加载完所有图片后调用的回调函数\n afterLoadAllImgCallback: () => {},\n },\n },\n /**\n * 配置主题,第三方可以自行扩展主题\n */\n theme: [\n { className: 'default', label: '默认' },\n { className: 'dark', label: '暗黑' },\n { className: 'light', label: '明亮' },\n { className: 'green', label: '清新' },\n { className: 'red', label: '热情' },\n { className: 'violet', label: '淡雅' },\n ],\n // 预览页面不需要绑定事件\n isPreviewOnly: false,\n // 预览区域跟随编辑器光标自动滚动\n autoScrollByCursor: true,\n // 外层容器不存在时,是否强制输出到body上\n forceAppend: true,\n // The locale Cherry is going to use. Locales live in /src/locales/\n locale: 'zh_CN',\n};\n\nexport default cloneDeep(defaultConfig);\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport default {\n bold: '加粗', // 加粗\n code: '代码', // 代码\n graph: '画图', // 画图\n h1: '一级标题', // 一级标题\n h2: '二级标题', // 二级标题\n h3: '三级标题', // 三级标题\n h4: '四级标题', // 四级标题\n h5: '五级标题', // 五级标题\n header: '标题', // 标题\n insert: '插入', // 插入\n italic: '斜体', // 斜体\n list: '列表', // 列表\n quickTable: '表格', // 表格\n quote: '引用', // 引用\n size: '大小', // 大小\n color: '文字颜色&背景', // 文字颜色&背景\n strikethrough: '删除线', // 删除线\n sub: '下标', // 下标\n sup: '上标', // 上标\n togglePreview: '预览', // 预览\n fullScreen: '全屏', // 全屏\n image: '图片', // 图片\n audio: '音频', // 音频\n video: '视频', // 视频\n link: '超链接', // 超链接\n hr: '分隔线', // 分隔线\n br: '换行', // 换行\n toc: '目录', // 目录\n pdf: 'pdf', // pdf\n word: 'word', // word\n table: '表格', // 表格\n 'line-table': '折线表格', // 折线表格\n 'bar-table': '柱状表格', // 柱状表格\n formula: '公式', // 公式\n insertFormula: '公式', // 公式\n insertFlow: '流程图', // 流程图\n insertSeq: '时序图', // 时序图\n insertState: '状态图', // 状态图\n insertClass: '类图', // 类图\n insertPie: '饼图', // 饼图\n insertGantt: '甘特图', // 甘特图\n checklist: '清单', // 清单\n ol: '有序列表', // 有序列表\n ul: '无序列表', // 无序列表\n undo: '撤销', // 撤销\n redo: '恢复', // 恢复\n previewClose: '关闭预览', // 关闭预览\n codeTheme: '代码主题', // 代码主题\n switchModel: '模式切换', // 模式切换\n switchPreview: '预览', // 预览\n switchEdit: '返回编辑', // 返回编辑\n classicBr: '经典换行', // 经典换行\n normalBr: '常规换行', // 常规换行\n settings: '设置', // 设置\n mobilePreview: '移动端预览', // 移动端预览\n copy: '复制内容', // 复制内容\n export: '导出', // 导出PDF、长图\n underline: '下划线', // 下划线\n pinyin: '拼音', // 拼音\n file: '文件',\n pastePlain: '粘贴为纯文本格式', // 粘贴为纯文本格式\n pasteMarkdown: '粘贴为markdown格式', // 粘贴为markdown格式\n hide: '隐藏(ctrl+0)', // 隐藏(ctrl+0)\n exportToPdf: '导出PDF', // 导出PDF\n exportScreenshot: '导出长图', // 导出长图\n exportMarkdownFile: '导出markdown', // 导出markdown文件\n exportHTMLFile: '导出html', // 导出预览区html文件\n theme: '主题', // 导出长图\n panel: '面板', // 导出长图\n detail: '手风琴', // 手风琴\n 'H1 Heading': 'H1 一级标题',\n 'H2 Heading': 'H2 二级标题',\n 'H3 Heading': 'H3 三级标题',\n complement: '续写',\n summary: '总结',\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport default {\n bold: 'Bold',\n code: 'Code',\n graph: 'Graph',\n h1: 'Heading 1',\n h2: 'Heading 2',\n h3: 'Heading 3',\n h4: 'Heading 4',\n h5: 'Heading 5',\n header: 'Header',\n insert: 'Insert',\n italic: 'Italic',\n list: 'List',\n quickTable: 'Quick Table',\n quote: 'Quote',\n size: 'Size',\n color: 'Text Color & Background',\n strikethrough: 'Strikethrough',\n sub: 'Sub',\n sup: 'Sup',\n togglePreview: 'Toggle Preview',\n fullScreen: 'Full Screen',\n image: 'Image',\n audio: 'Audio',\n video: 'Video',\n link: 'Link',\n hr: 'Horizontal Rule',\n br: 'New Line',\n toc: 'Table Of Content',\n pdf: 'PDF',\n word: 'Word',\n table: 'Table',\n 'line-table': 'Line Table',\n 'bar-table': 'Bar Table',\n formula: 'Formula',\n insertFormula: 'Insert Formula',\n insertFlow: 'Insert Flow',\n insertSeq: 'Insert Seq',\n insertState: 'Insert State',\n insertClass: 'Insert Class',\n insertPie: 'Insert Pie',\n insertGantt: 'Insert Gantt',\n checklist: 'Checklist',\n ol: 'Ordered List',\n ul: 'Unordered List',\n undo: 'Undo',\n redo: 'Redo',\n previewClose: 'Preview Close',\n codeTheme: 'Code Theme',\n switchModel: 'Switch Model',\n switchPreview: 'Switch Preview',\n switchEdit: 'Switch Edit',\n classicBr: 'Classic New Line',\n normalBr: 'Normal New Line',\n settings: 'Settings',\n mobilePreview: 'Mobile Preview',\n copy: 'Copy',\n export: 'Export',\n underline: 'Underline',\n pinyin: 'Pinyin',\n pastePlain: 'Paste as Plain Text',\n pasteMarkdown: 'Paste as Markdown',\n hide: 'Hide (ctrl+0)',\n exportToPdf: 'Export to PDF',\n exportScreenshot: 'Screenshot',\n exportMarkdownFile: 'Export Markdown File',\n exportHTMLFile: 'Export preview HTML File',\n 'H1 Heading': 'H1 Heading',\n 'H2 Heading': 'H1 Heading',\n 'H3 Heading': 'H1 Heading',\n complement: 'Complement',\n summary: 'Summary',\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport zhCn from './zh_CN';\nimport enUs from './en_US';\n\nexport default {\n zh_CN: zhCn,\n en_US: enUs,\n};\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport SyntaxBase, { HOOKS_TYPE_LIST } from './core/SyntaxBase';\nimport ParagraphBase from './core/ParagraphBase';\nimport MenuBase from './toolbars/MenuBase';\n\nfunction filterOptions(options, whiteList, propTypes) {\n const filteredOptions = {};\n Object.keys(options).forEach((key) => {\n if (whiteList.indexOf(key) === -1) {\n return;\n }\n if (typeof propTypes === 'object') {\n if (typeof propTypes[key] === 'string') {\n if (typeof options[key] === propTypes[key]) {\n filteredOptions[key] = options[key];\n }\n } else {\n if (options[key] instanceof propTypes[key]) {\n filteredOptions[key] = options[key];\n }\n }\n } else if (typeof propTypes === 'string') {\n if (typeof options[key] === propTypes) {\n filteredOptions[key] = options[key];\n }\n }\n });\n return filteredOptions;\n}\n\nexport function createSyntaxHook(name, type, options) {\n const BaseClass = type === HOOKS_TYPE_LIST.PAR ? ParagraphBase : SyntaxBase;\n const optionsWhiteList = ['beforeMakeHtml', 'makeHtml', 'afterMakeHtml', 'rule', 'test'];\n const filteredOptions = filterOptions(options, optionsWhiteList, 'function');\n const paragraphConfig = { needCache: options.needCache, defaultCache: options.defaultCache };\n return class CustomSyntax extends BaseClass {\n static HOOK_NAME = name;\n\n constructor(editorConfig = {}) {\n if (type === HOOKS_TYPE_LIST.PAR) {\n super({ needCache: !!paragraphConfig.needCache, defaultCache: paragraphConfig.defaultCache });\n } else {\n super();\n }\n\n this.config = editorConfig.config;\n }\n\n beforeMakeHtml(...args) {\n if (filteredOptions.beforeMakeHtml) {\n return filteredOptions.beforeMakeHtml.apply(this, args);\n }\n return super.beforeMakeHtml(...args);\n }\n\n makeHtml(...args) {\n if (filteredOptions.makeHtml) {\n return filteredOptions.makeHtml.apply(this, args);\n }\n return super.makeHtml(...args);\n }\n\n afterMakeHtml(...args) {\n if (filteredOptions.afterMakeHtml) {\n return filteredOptions.afterMakeHtml.apply(this, args);\n }\n return super.afterMakeHtml(...args);\n }\n\n test(...args) {\n if (filteredOptions.test) {\n return filteredOptions.test.apply(this, args);\n }\n return super.test(...args);\n }\n\n rule(...args) {\n if (filteredOptions.rule) {\n return filteredOptions.rule.apply(this, args);\n }\n return super.rule(...args);\n }\n };\n}\n\nexport function createMenuHook(name, options) {\n const optionsWhiteList = ['subMenuConfig', 'onClick', 'shortcutKeys', 'iconName'];\n const propTypes = {\n subMenuConfig: Array,\n onClick: 'function',\n shortcutKeys: Array,\n iconName: 'string',\n };\n const filteredOptions = filterOptions(options, optionsWhiteList, propTypes);\n return class CustomMenu extends MenuBase {\n constructor(editorInstance) {\n super(editorInstance);\n if (!filteredOptions.iconName) {\n this.noIcon = true;\n }\n this.setName(name, filteredOptions.iconName);\n this.subMenuConfig = filteredOptions.subMenuConfig || [];\n }\n\n onClick(...args) {\n if (filteredOptions.onClick) {\n return filteredOptions.onClick.apply(this, args);\n }\n return super.onClick(...args);\n }\n\n get shortcutKeys() {\n if (filteredOptions.shortcutKeys) {\n return filteredOptions.shortcutKeys;\n }\n return [];\n }\n };\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * 本文件主要维护导出Cherry时需要附加在Cherry对象上的静态属性集合\n * 所有的具名导出都会挂载在Cherry或CherryEngine上\n */\nimport { HOOKS_TYPE_LIST } from './core/SyntaxBase';\nimport { createSyntaxHook, createMenuHook } from './Factory';\nimport { isBrowser } from './utils/env';\n\nconst constants = { HOOKS_TYPE_LIST };\n\nconst plugins = {};\nconst nodeIgnorePlugin = [];\n\nif (!isBrowser()) {\n nodeIgnorePlugin.forEach((key) => {\n delete plugins[key];\n });\n}\n\nconst VERSION = `${process.env.BUILD_VERSION}`;\n\nexport class CherryStatic {\n static createSyntaxHook = createSyntaxHook;\n static createMenuHook = createMenuHook;\n static constants = constants;\n static VERSION = VERSION;\n /**\n * @this {typeof import('./Cherry').default | typeof CherryStatic}\n * @param {{ install: (defaultConfig: any, ...args: any[]) => void }} PluginClass 插件Class\n * @param {...any} args 初始化插件的参数\n * @returns\n */\n static usePlugin(PluginClass, ...args) {\n if (this === CherryStatic) {\n throw new Error('`usePlugin` is not allowed to called through CherryStatic class.');\n }\n // @ts-ignore\n if (this.initialized) {\n throw new Error('The function `usePlugin` should be called before Cherry is instantiated.');\n }\n // @ts-ignore\n if (PluginClass.$cherry$mounted === true) {\n return;\n }\n // @ts-ignore\n PluginClass.install.apply(PluginClass, [this.config.defaults, ...args]);\n // @ts-ignore\n PluginClass.$cherry$mounted = true;\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\nimport Editor from './Editor';\nimport Engine from './Engine';\nimport Previewer from './Previewer';\nimport Bubble from './toolbars/Bubble';\nimport FloatMenu from './toolbars/FloatMenu';\nimport Toolbar from './toolbars/Toolbar';\nimport { createElement } from './utils/dom';\nimport Sidebar from './toolbars/Sidebar';\nimport { customizer, getThemeFromLocal, changeTheme } from './utils/config';\nimport NestedError, { $expectTarget } from './utils/error';\nimport getPosBydiffs from './utils/recount-pos';\nimport defaultConfig from './Cherry.config';\nimport './sass/cherry.scss';\nimport cloneDeep from 'lodash/cloneDeep';\nimport Event from './Event';\nimport locales from '@/locales/index';\n\nimport { urlProcessorProxy } from './UrlCache';\nimport { CherryStatic } from './CherryStatic';\n\n/** @typedef {import('~types/cherry').CherryOptions} CherryOptions */\nexport default class Cherry extends CherryStatic {\n /**\n * @protected\n */\n static initialized = false;\n /**\n * @readonly\n */\n static config = {\n /** @type {Partial} */\n defaults: defaultConfig,\n };\n\n /**\n * @param {Partial} options\n */\n constructor(options) {\n super();\n Cherry.initialized = true;\n const defaultConfigCopy = cloneDeep(Cherry.config.defaults);\n this.defaultToolbar = defaultConfigCopy.toolbars.toolbar;\n $expectTarget(options, Object);\n /**\n * @property\n * @type {Partial}\n */\n this.options = mergeWith({}, defaultConfigCopy, options, customizer);\n\n // loading the locale\n this.locale = locales[this.options.locale];\n\n if (typeof this.options.engine.global.urlProcessor === 'function') {\n this.options.engine.global.urlProcessor = urlProcessorProxy(this.options.engine.global.urlProcessor);\n }\n\n this.status = {\n toolbar: 'show',\n previewer: 'show',\n editor: 'show',\n };\n\n if (this.options.isPreviewOnly || this.options.editor.defaultModel === 'previewOnly') {\n this.options.toolbars.showToolbar = false;\n this.options.editor.defaultModel = 'previewOnly';\n this.status.editor = 'hide';\n this.status.toolbar = 'hide';\n }\n\n /**\n * @property\n * @type {string} 实例ID\n */\n this.instanceId = `cherry-${new Date().getTime()}${Math.random()}`;\n this.options.instanceId = this.instanceId;\n\n /**\n * @private\n * @type {Engine}\n */\n this.engine = new Engine(this.options, this);\n this.init();\n }\n\n /**\n * 初始化工具栏、编辑区、预览区等\n * @private\n */\n init() {\n let mountEl = this.options.id ? document.getElementById(this.options.id) : this.options.el;\n\n if (!mountEl) {\n if (!this.options.forceAppend) {\n return false;\n }\n mountEl = document.createElement('div');\n mountEl.id = this.options.id || 'cherry-markdown';\n document.body.appendChild(mountEl);\n }\n\n if (!mountEl.style.height) {\n mountEl.style.height = this.options.editor.height;\n }\n this.cherryDom = mountEl;\n\n // 蒙层dom,用来拖拽编辑区&预览区宽度时展示蒙层\n const wrapperDom = this.createWrapper();\n // 创建编辑区\n const editor = this.createEditor();\n // 创建预览区\n const previewer = this.createPreviewer();\n\n if (this.options.toolbars.showToolbar === false || this.options.toolbars.toolbar === false) {\n // 即便配置了不展示工具栏,也要让工具栏加载对应的语法hook\n wrapperDom.classList.add('cherry--no-toolbar');\n this.options.toolbars.toolbar = this.defaultToolbar;\n }\n $expectTarget(this.options.toolbars.toolbar, Array);\n // 创建顶部工具栏\n this.toolbar = this.createToolbar();\n\n const wrapperFragment = document.createDocumentFragment();\n wrapperFragment.appendChild(this.toolbar.options.dom);\n wrapperFragment.appendChild(editor.options.editorDom);\n // 创建预览区域的侧边工具栏\n this.createSidebar(wrapperFragment);\n if (!this.options.previewer.dom) {\n wrapperFragment.appendChild(previewer.options.previewerDom);\n }\n wrapperFragment.appendChild(previewer.options.virtualDragLineDom);\n wrapperFragment.appendChild(previewer.options.editorMaskDom);\n wrapperFragment.appendChild(previewer.options.previewerMaskDom);\n\n wrapperDom.appendChild(wrapperFragment);\n mountEl.appendChild(wrapperDom);\n\n editor.init(previewer);\n // 创建bubble工具栏,所谓bubble工具栏,是指在编辑区选中文本时悬浮出现的工具栏\n this.createBubble();\n // 创建float工具栏,所谓float工具栏,是指当编辑区光标处于新行时,在行内联想出的工具栏\n this.createFloatMenu();\n previewer.init(editor);\n\n previewer.registerAfterUpdate(this.engine.mounted.bind(this.engine));\n\n // default value init\n this.initText(editor.editor);\n\n // 切换模式,有纯预览模式、纯编辑模式、双栏编辑模式\n this.switchModel(this.options.editor.defaultModel);\n\n Event.on(this.instanceId, Event.Events.toolbarHide, () => {\n this.status.toolbar = 'hide';\n });\n Event.on(this.instanceId, Event.Events.toolbarShow, () => {\n this.status.toolbar = 'show';\n });\n Event.on(this.instanceId, Event.Events.previewerClose, () => {\n this.status.previewer = 'hide';\n });\n Event.on(this.instanceId, Event.Events.previewerOpen, () => {\n this.status.previewer = 'show';\n });\n Event.on(this.instanceId, Event.Events.editorClose, () => {\n this.status.editor = 'hide';\n // 关闭编辑区时,需要清除所有高亮\n this.previewer.highlightLine(0);\n });\n Event.on(this.instanceId, Event.Events.editorOpen, () => {\n this.status.editor = 'show';\n });\n }\n\n /**\n * 切换编辑模式\n * @param {'edit&preview'|'editOnly'|'previewOnly'} model 模式类型\n * 一般纯预览模式和纯编辑模式适合在屏幕较小的终端使用,比如手机移动端\n *\n * @returns\n */\n switchModel(model = 'edit&preview') {\n switch (model) {\n case 'edit&preview':\n if (this.previewer) {\n this.previewer.editOnly(true);\n this.previewer.recoverPreviewer();\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'editOnly':\n if (!this.previewer.isPreviewerHidden()) {\n this.previewer.editOnly(true);\n }\n if (this.toolbar) {\n this.toolbar.showToolbar();\n }\n break;\n case 'previewOnly':\n this.previewer.previewOnly();\n this.toolbar && this.toolbar.previewOnly();\n break;\n }\n }\n\n /**\n * 获取实例id\n * @returns {string}\n * @public\n */\n getInstanceId() {\n return this.instanceId;\n }\n\n /**\n * 获取编辑器状态\n * @returns {Object}\n */\n getStatus() {\n return this.status;\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getValue() {\n return this.editor.editor.getValue();\n }\n\n /**\n * 获取编辑区内的markdown源码内容\n * @returns markdown源码内容\n */\n getMarkdown() {\n return this.getValue();\n }\n\n /**\n * 获取CodeMirror实例\n * @returns CodeMirror实例\n */\n getCodeMirror() {\n return this.editor.editor;\n }\n\n /**\n * 获取预览区内的html内容\n * @param {boolean} wrapTheme 是否在外层包裹主题class\n * @returns html内容\n */\n getHtml(wrapTheme = true) {\n return this.previewer.getValue(wrapTheme);\n }\n\n getPreviewer() {\n return this.previewer;\n }\n\n /**\n * 获取目录,目录由head1~6组成\n * @returns 标题head数组\n */\n getToc() {\n const str = this.getHtml();\n /** @type {({level: number;id: string;text: string})[]} */\n const headerList = [];\n const headerRegex = /(.+?)<\\/h[0-6]>/g;\n str.replace(headerRegex, (match, level, id, text) => {\n headerList.push({ level: +level, id, text });\n return match;\n });\n return headerList;\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setValue(content, keepCursor = false) {\n if (keepCursor === false) {\n return this.editor.editor.setValue(content);\n }\n const codemirror = this.editor.editor;\n const old = this.getValue();\n const pos = codemirror.getDoc().indexFromPos(codemirror.getCursor());\n const newPos = getPosBydiffs(pos, old, content);\n const ret = codemirror.setValue(content);\n const cursor = codemirror.getDoc().posFromIndex(newPos);\n codemirror.setCursor(cursor);\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insert(content, isSelect = false, anchor = false, focus = true) {\n if (anchor) {\n this.editor.editor.setSelection({ line: anchor[0], ch: anchor[1] }, { line: anchor[0], ch: anchor[1] });\n }\n const ret = this.editor.editor.replaceSelection(content, isSelect ? 'around' : 'end');\n focus && this.editor.editor.focus();\n return ret;\n }\n\n /**\n * 在光标处或者指定行+偏移量插入内容\n * @param {string} content 被插入的文本\n * @param {boolean} [isSelect=false] 是否选中刚插入的内容\n * @param {[number, number]|false} [anchor=false] [x,y] 代表x+1行,y+1字符偏移量,默认false 会从光标处插入\n * @param {boolean} [focus=true] 保持编辑器处于focus状态\n * @returns\n */\n insertValue(content, isSelect = false, anchor = false, focus = true) {\n return this.insert(content, isSelect, anchor, focus);\n }\n\n /**\n * 强制重新渲染预览区域\n */\n refreshPreviewer() {\n try {\n const markdownText = this.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.refresh(html);\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * 覆盖编辑区的内容\n * @param {string} content markdown内容\n * @param {boolean} keepCursor 是否保持光标位置\n * @returns\n */\n setMarkdown(content, keepCursor = false) {\n return this.setValue(content, keepCursor);\n }\n\n /**\n * @private\n * @returns\n */\n createWrapper() {\n const toolbarTheme = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n // TODO: 完善类型\n const inlineCodeTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.inlineCode).theme;\n let codeBlockTheme = /** @type {{theme?: string;}} */ (this.options.engine.syntax.codeBlock).theme;\n if (codeBlockTheme === 'dark') codeBlockTheme = 'tomorrow-night';\n else if (codeBlockTheme === 'light') codeBlockTheme = 'solarized-light';\n const wrapperDom = createElement('div', ['cherry', 'clearfix', getThemeFromLocal(true)].join(' '), {\n 'data-toolbarTheme': toolbarTheme,\n 'data-inlineCodeTheme': inlineCodeTheme,\n 'data-codeBlockTheme': codeBlockTheme,\n });\n this.wrapperDom = wrapperDom;\n return wrapperDom;\n }\n\n /**\n * @private\n * @returns {Toolbar}\n */\n createToolbar() {\n const dom = createElement('div', 'cherry-toolbar');\n this.toolbar = new Toolbar({\n dom,\n $cherry: this,\n buttonRightConfig: this.options.toolbars.toolbarRight,\n buttonConfig: this.options.toolbars.toolbar,\n customMenu: this.options.toolbars.customMenu,\n });\n return this.toolbar;\n }\n\n /**\n * @private\n * @returns\n */\n createSidebar(wrapperFragment) {\n if (this.options.toolbars.sidebar) {\n $expectTarget(this.options.toolbars.sidebar, Array);\n const externalClass = this.options.toolbars.theme === 'dark' ? 'dark' : '';\n const dom = createElement('div', `cherry-sidebar ${externalClass}`);\n this.sidebar = new Sidebar({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.sidebar,\n customMenu: this.options.toolbars.customMenu,\n });\n wrapperFragment.appendChild(this.sidebar.options.dom);\n }\n }\n\n /**\n * @private\n * @returns\n */\n createFloatMenu() {\n if (this.options.toolbars.float) {\n const dom = createElement('div', 'cherry-floatmenu');\n $expectTarget(this.options.toolbars.float, Array);\n this.floatMenu = new FloatMenu({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.float,\n customMenu: this.options.toolbars.customMenu,\n });\n }\n }\n\n /**\n * @private\n * @returns\n */\n createBubble() {\n if (this.options.toolbars.bubble) {\n const dom = createElement('div', 'cherry-bubble');\n $expectTarget(this.options.toolbars.bubble, Array);\n this.bubble = new Bubble({\n dom,\n $cherry: this,\n buttonConfig: this.options.toolbars.bubble,\n customMenu: this.options.toolbars.customMenu,\n engine: this.engine,\n });\n }\n }\n\n /**\n * @private\n * @returns {import('@/Editor').default}\n */\n createEditor() {\n const textArea = createElement('textarea', '', {\n id: this.options.editor.id ?? 'code',\n name: this.options.editor.name ?? 'code',\n });\n textArea.textContent = this.options.value;\n const editor = createElement('div', 'cherry-editor');\n editor.appendChild(textArea);\n\n this.editor = new Editor({\n $cherry: this,\n editorDom: editor,\n wrapperDom: this.wrapperDom,\n value: this.options.value,\n onKeydown: this.fireShortcutKey.bind(this),\n onChange: this.editText.bind(this),\n toolbars: this.options.toolbars,\n fileUpload: this.options.fileUpload,\n autoScrollByCursor: this.options.autoScrollByCursor,\n ...this.options.editor,\n });\n return this.editor;\n }\n\n /**\n * @private\n * @returns {import('@/Previewer').default}\n */\n createPreviewer() {\n /** @type {HTMLDivElement} */\n let previewer;\n const anchorStyle =\n (this.options.engine.syntax.header && this.options.engine.syntax.header.anchorStyle) || 'default';\n const autonumberClass = anchorStyle === 'autonumber' ? ' head-num' : '';\n const { className, dom, enablePreviewerBubble } = this.options.previewer;\n const previewerClassName = [\n 'cherry-previewer cherry-markdown',\n className || '',\n autonumberClass,\n getThemeFromLocal(true),\n ].join(' ');\n if (dom) {\n previewer = dom;\n previewer.className += ` ${previewerClassName}`;\n } else {\n previewer = createElement('div', previewerClassName);\n }\n const virtualDragLine = createElement('div', 'cherry-drag');\n const editorMask = createElement('div', 'cherry-editor-mask');\n const previewerMask = createElement('div', 'cherry-previewer-mask');\n\n this.previewer = new Previewer({\n $cherry: this,\n virtualDragLineDom: virtualDragLine,\n editorMaskDom: editorMask,\n previewerMaskDom: previewerMask,\n previewerDom: previewer,\n value: this.options.value,\n isPreviewOnly: this.options.isPreviewOnly,\n enablePreviewerBubble,\n lazyLoadImg: this.options.previewer.lazyLoadImg,\n });\n\n return this.previewer;\n }\n\n /**\n * @private\n * @param {import('codemirror').Editor} codemirror\n */\n initText(codemirror) {\n try {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterInit) {\n this.options.callback.afterInit(markdownText, html);\n }\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {Event} _evt\n * @param {import('codemirror').Editor} codemirror\n */\n editText(_evt, codemirror) {\n try {\n if (this.timer) {\n clearTimeout(this.timer);\n this.timer = null;\n }\n this.timer = setTimeout(() => {\n const markdownText = codemirror.getValue();\n const html = this.engine.makeHtml(markdownText);\n this.previewer.update(html);\n if (this.options.callback.afterChange) {\n this.options.callback.afterChange(markdownText, html);\n }\n // 强制每次编辑(包括undo、redo)编辑器都会自动滚动到光标位置\n codemirror.scrollIntoView(null);\n }, 50);\n } catch (e) {\n throw new NestedError(e);\n }\n }\n\n /**\n * @private\n * @param {any} cb\n */\n onChange(cb) {\n this.editor.editor.on('change', (codeMirror) => {\n cb({\n markdown: codeMirror.getValue(), // 后续可以按需增加html或其他状态\n });\n });\n }\n\n /**\n * @private\n * @param {*} evt\n */\n fireShortcutKey(evt) {\n if (this.toolbar.matchShortcutKey(evt)) {\n // 快捷键\n evt.preventDefault();\n this.toolbar.fireShortcutKey(evt);\n }\n }\n\n /**\n * 导出预览区域内容\n * @public\n * @param {String} type 'pdf':导出成pdf文件; 'img':导出成图片\n */\n export(type = 'pdf') {\n this.previewer.export(type);\n }\n\n /**\n * 修改主题\n * @param {string} theme option.theme里的className\n */\n setTheme(theme = 'default') {\n changeTheme(this, theme);\n }\n\n /**\n * 修改书写风格\n * @param {string} writingStyle normal 普通 | typewriter 打字机 | focus 专注\n */\n setWritingStyle(writingStyle) {\n this.editor.setWritingStyle(writingStyle);\n }\n}\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport Cherry from './Cherry';\n\nimport SyntaxHookBase from './core/SyntaxBase';\nimport MenuHookBase from './toolbars/MenuBase';\n\n// in browser\nif (window) {\n // @ts-ignore\n window.Cherry = Cherry;\n}\n\nexport { SyntaxHookBase, MenuHookBase };\n\nexport default Cherry;\n","/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\n\nconst DEFAULT_OPTIONS = {\n // TODO: themes\n theme: 'default',\n altFontFamily: 'sans-serif',\n fontFamily: 'sans-serif',\n themeCSS: '.label foreignObject { font-size: 90%; overflow: visible; } .label { font-family: sans-serif; }',\n flowchart: {\n useMaxWidth: false,\n },\n sequence: {\n useMaxWidth: false,\n },\n startOnLoad: false,\n logLevel: 5,\n // fontFamily: 'Arial, monospace'\n};\n\nexport default class MermaidCodeEngine {\n static TYPE = 'figure';\n\n static install(cherryOptions, ...args) {\n mergeWith(cherryOptions, {\n engine: {\n syntax: {\n codeBlock: {\n customRenderer: {\n mermaid: new MermaidCodeEngine(...args),\n },\n },\n },\n },\n });\n }\n\n mermaidAPIRefs = null;\n options = DEFAULT_OPTIONS;\n dom = null;\n mermaidCanvas = null;\n\n constructor(mermaidOptions = {}) {\n const { mermaid, mermaidAPI } = mermaidOptions;\n if (\n !mermaidAPI &&\n !window.mermaidAPI &&\n (!mermaid || !mermaid.mermaidAPI) &&\n (!window.mermaid || !window.mermaid.mermaidAPI)\n ) {\n throw new Error('code-block-mermaid-plugin[init]: Package mermaid or mermaidAPI not found.');\n }\n this.options = { ...DEFAULT_OPTIONS, ...(mermaidOptions || {}) };\n this.mermaidAPIRefs = mermaidAPI || window.mermaidAPI || mermaid.mermaidAPI || window.mermaid.mermaidAPI;\n delete this.options.mermaid;\n delete this.options.mermaidAPI;\n this.mermaidAPIRefs.initialize(this.options);\n }\n\n mountMermaidCanvas($engine) {\n if (this.mermaidCanvas && document.body.contains(this.mermaidCanvas)) {\n return;\n }\n this.mermaidCanvas = document.createElement('div');\n this.mermaidCanvas.style = 'width:1024px;opacity:0;position:fixed;top:100%;';\n const container = $engine.$cherry.wrapperDom || document.body;\n container.appendChild(this.mermaidCanvas);\n }\n\n /**\n * 转换svg为img,如果出错则直出svg\n * @param {string} svgCode\n * @param {string} graphId\n * @returns {string}\n */\n convertMermaidSvgToImg(svgCode, graphId) {\n const domParser = new DOMParser();\n let svgHtml;\n const injectSvgFallback = (svg) =>\n svg.replace('`;\n }\n } else {\n svgHtml = injectSvgFallback(svgCode);\n }\n } catch (e) {\n svgHtml = injectSvgFallback(svgCode);\n }\n return svgHtml;\n }\n\n render(src, sign, $engine, config = {}) {\n let $sign = sign;\n if (!$sign) {\n $sign = Math.round(Math.random() * 100000000);\n }\n this.mountMermaidCanvas($engine);\n let html;\n // 多实例的情况下相同的内容ID相同会导致mermaid渲染异常\n // 需要通过添加时间戳使得多次渲染相同内容的图像ID唯一\n // 图像渲染节流在CodeBlock Hook内部控制\n const graphId = `mermaid-${$sign}-${new Date().getTime()}`;\n this.svg2img = config?.svg2img ?? false;\n try {\n this.mermaidAPIRefs.render(\n graphId,\n src,\n (svgCode) => {\n const fixedSvg = svgCode\n .replace(/\\s*markerUnits=\"0\"/g, '')\n .replace(/\\s*x=\"NaN\"/g, '')\n .replace(/
/g, '
');\n html = this.convertMermaidSvgToImg(fixedSvg, graphId);\n },\n this.mermaidCanvas,\n );\n } catch (e) {\n return e?.str;\n }\n return html;\n }\n}\n","// @ts-nocheck\n/*\n * $Id: rawdeflate.js,v 0.3 2009/03/01 19:05:05 dankogai Exp dankogai $\n *\n * Original:\n * http://www.onicos.com/staff/iz/amuse/javascript/expert/deflate.txt\n */\n\n// if run as a web worker, respond to messages by deflating them\nconst deflate = (function () {\n /* Copyright (C) 1999 Masanao Izumo \n * Version: 1.0.1\n * LastModified: Dec 25 1999\n */\n\n /* Interface:\n * data = deflate(src);\n */\n\n /* constant parameters */\n const zip_WSIZE = 32768; // Sliding Window size\n const zip_STORED_BLOCK = 0;\n const zip_STATIC_TREES = 1;\n const zip_DYN_TREES = 2;\n\n /* for deflate */\n const zip_DEFAULT_LEVEL = 6;\n const zip_FULL_SEARCH = true;\n const zip_INBUFSIZ = 32768; // Input buffer size\n const zip_INBUF_EXTRA = 64; // Extra buffer\n const zip_OUTBUFSIZ = 1024 * 8;\n const zip_window_size = 2 * zip_WSIZE;\n const zip_MIN_MATCH = 3;\n const zip_MAX_MATCH = 258;\n const zip_BITS = 16;\n // for SMALL_MEM\n const zip_LIT_BUFSIZE = 0x2000;\n const zip_HASH_BITS = 13;\n // for MEDIUM_MEM\n // var zip_LIT_BUFSIZE = 0x4000;\n // var zip_HASH_BITS = 14;\n // for BIG_MEM\n // var zip_LIT_BUFSIZE = 0x8000;\n // var zip_HASH_BITS = 15;\n // if(zip_LIT_BUFSIZE > zip_INBUFSIZ)\n // alert(\"error: zip_INBUFSIZ is too small\");\n // if((zip_WSIZE<<1) > (1< zip_BITS-1)\n // alert(\"error: zip_HASH_BITS is too large\");\n // if(zip_HASH_BITS < 8 || zip_MAX_MATCH != 258)\n // alert(\"error: Code too clever\");\n const zip_DIST_BUFSIZE = zip_LIT_BUFSIZE;\n const zip_HASH_SIZE = 1 << zip_HASH_BITS;\n const zip_HASH_MASK = zip_HASH_SIZE - 1;\n const zip_WMASK = zip_WSIZE - 1;\n const zip_NIL = 0; // Tail of hash chains\n const zip_TOO_FAR = 4096;\n const zip_MIN_LOOKAHEAD = zip_MAX_MATCH + zip_MIN_MATCH + 1;\n const zip_MAX_DIST = zip_WSIZE - zip_MIN_LOOKAHEAD;\n const zip_SMALLEST = 1;\n const zip_MAX_BITS = 15;\n const zip_MAX_BL_BITS = 7;\n const zip_LENGTH_CODES = 29;\n const zip_LITERALS = 256;\n const zip_END_BLOCK = 256;\n const zip_L_CODES = zip_LITERALS + 1 + zip_LENGTH_CODES;\n const zip_D_CODES = 30;\n const zip_BL_CODES = 19;\n const zip_REP_3_6 = 16;\n const zip_REPZ_3_10 = 17;\n const zip_REPZ_11_138 = 18;\n const zip_HEAP_SIZE = 2 * zip_L_CODES + 1;\n const zip_H_SHIFT = parseInt((zip_HASH_BITS + zip_MIN_MATCH - 1) / zip_MIN_MATCH);\n\n /* variables */\n let zip_free_queue;\n let zip_qhead;\n let zip_qtail;\n let zip_initflag;\n let zip_outbuf = null;\n let zip_outcnt;\n let zip_outoff;\n let zip_complete;\n let zip_window;\n let zip_d_buf;\n let zip_l_buf;\n let zip_prev;\n let zip_bi_buf;\n let zip_bi_valid;\n let zip_block_start;\n let zip_ins_h;\n let zip_hash_head;\n let zip_prev_match;\n let zip_match_available;\n let zip_match_length;\n let zip_prev_length;\n let zip_strstart;\n let zip_match_start;\n let zip_eofile;\n let zip_lookahead;\n let zip_max_chain_length;\n let zip_max_lazy_match;\n let zip_compr_level;\n let zip_good_match;\n let zip_nice_match;\n let zip_dyn_ltree;\n let zip_dyn_dtree;\n let zip_static_ltree;\n let zip_static_dtree;\n let zip_bl_tree;\n let zip_l_desc;\n let zip_d_desc;\n let zip_bl_desc;\n let zip_bl_count;\n let zip_heap;\n let zip_heap_len;\n let zip_heap_max;\n let zip_depth;\n let zip_length_code;\n let zip_dist_code;\n let zip_base_length;\n let zip_base_dist;\n let zip_flag_buf;\n let zip_last_lit;\n let zip_last_dist;\n let zip_last_flags;\n let zip_flags;\n let zip_flag_bit;\n let zip_opt_len;\n let zip_static_len;\n let zip_deflate_data;\n let zip_deflate_pos;\n\n /* objects (deflate) */\n\n function zip_DeflateCT() {\n this.fc = 0; // frequency count or bit string\n this.dl = 0; // father node in Huffman tree or length of bit string\n }\n\n function zip_DeflateTreeDesc() {\n this.dyn_tree = null; // the dynamic tree\n this.static_tree = null; // corresponding static tree or NULL\n this.extra_bits = null; // extra bits for each code or NULL\n this.extra_base = 0; // base index for extra_bits\n this.elems = 0; // max number of elements in the tree\n this.max_length = 0; // max bit length for the codes\n this.max_code = 0; // largest code with non zero frequency\n }\n\n /* Values for max_lazy_match, good_match and max_chain_length, depending on\n * the desired pack level (0..9). The values given below have been tuned to\n * exclude worst case performance for pathological files. Better values may be\n * found for specific files.\n */\n function zip_DeflateConfiguration(a, b, c, d) {\n this.good_length = a; // reduce lazy search above this match length\n this.max_lazy = b; // do not perform lazy search above this match length\n this.nice_length = c; // quit search above this match length\n this.max_chain = d;\n }\n\n function zip_DeflateBuffer() {\n this.next = null;\n this.len = 0;\n this.ptr = new Array(zip_OUTBUFSIZ);\n this.off = 0;\n }\n\n /* constant tables */\n const zip_extra_lbits = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0];\n const zip_extra_dbits = [\n 0,\n 0,\n 0,\n 0,\n 1,\n 1,\n 2,\n 2,\n 3,\n 3,\n 4,\n 4,\n 5,\n 5,\n 6,\n 6,\n 7,\n 7,\n 8,\n 8,\n 9,\n 9,\n 10,\n 10,\n 11,\n 11,\n 12,\n 12,\n 13,\n 13,\n ];\n const zip_extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];\n const zip_bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];\n const zip_configuration_table = [\n new zip_DeflateConfiguration(0, 0, 0, 0),\n new zip_DeflateConfiguration(4, 4, 8, 4),\n new zip_DeflateConfiguration(4, 5, 16, 8),\n new zip_DeflateConfiguration(4, 6, 32, 32),\n new zip_DeflateConfiguration(4, 4, 16, 16),\n new zip_DeflateConfiguration(8, 16, 32, 32),\n new zip_DeflateConfiguration(8, 16, 128, 128),\n new zip_DeflateConfiguration(8, 32, 128, 256),\n new zip_DeflateConfiguration(32, 128, 258, 1024),\n new zip_DeflateConfiguration(32, 258, 258, 4096),\n ];\n\n /* routines (deflate) */\n\n function zip_deflate_start(level) {\n let i;\n\n if (!level) level = zip_DEFAULT_LEVEL;\n else if (level < 1) level = 1;\n else if (level > 9) level = 9;\n\n zip_compr_level = level;\n zip_initflag = false;\n zip_eofile = false;\n if (zip_outbuf != null) return;\n\n zip_free_queue = zip_qhead = zip_qtail = null;\n zip_outbuf = new Array(zip_OUTBUFSIZ);\n zip_window = new Array(zip_window_size);\n zip_d_buf = new Array(zip_DIST_BUFSIZE);\n zip_l_buf = new Array(zip_INBUFSIZ + zip_INBUF_EXTRA);\n zip_prev = new Array(1 << zip_BITS);\n zip_dyn_ltree = new Array(zip_HEAP_SIZE);\n for (i = 0; i < zip_HEAP_SIZE; i++) zip_dyn_ltree[i] = new zip_DeflateCT();\n zip_dyn_dtree = new Array(2 * zip_D_CODES + 1);\n for (i = 0; i < 2 * zip_D_CODES + 1; i++) zip_dyn_dtree[i] = new zip_DeflateCT();\n zip_static_ltree = new Array(zip_L_CODES + 2);\n for (i = 0; i < zip_L_CODES + 2; i++) zip_static_ltree[i] = new zip_DeflateCT();\n zip_static_dtree = new Array(zip_D_CODES);\n for (i = 0; i < zip_D_CODES; i++) zip_static_dtree[i] = new zip_DeflateCT();\n zip_bl_tree = new Array(2 * zip_BL_CODES + 1);\n for (i = 0; i < 2 * zip_BL_CODES + 1; i++) zip_bl_tree[i] = new zip_DeflateCT();\n zip_l_desc = new zip_DeflateTreeDesc();\n zip_d_desc = new zip_DeflateTreeDesc();\n zip_bl_desc = new zip_DeflateTreeDesc();\n zip_bl_count = new Array(zip_MAX_BITS + 1);\n zip_heap = new Array(2 * zip_L_CODES + 1);\n zip_depth = new Array(2 * zip_L_CODES + 1);\n zip_length_code = new Array(zip_MAX_MATCH - zip_MIN_MATCH + 1);\n zip_dist_code = new Array(512);\n zip_base_length = new Array(zip_LENGTH_CODES);\n zip_base_dist = new Array(zip_D_CODES);\n zip_flag_buf = new Array(parseInt(zip_LIT_BUFSIZE / 8));\n }\n\n function zip_deflate_end() {\n zip_free_queue = zip_qhead = zip_qtail = null;\n zip_outbuf = null;\n zip_window = null;\n zip_d_buf = null;\n zip_l_buf = null;\n zip_prev = null;\n zip_dyn_ltree = null;\n zip_dyn_dtree = null;\n zip_static_ltree = null;\n zip_static_dtree = null;\n zip_bl_tree = null;\n zip_l_desc = null;\n zip_d_desc = null;\n zip_bl_desc = null;\n zip_bl_count = null;\n zip_heap = null;\n zip_depth = null;\n zip_length_code = null;\n zip_dist_code = null;\n zip_base_length = null;\n zip_base_dist = null;\n zip_flag_buf = null;\n }\n\n function zip_reuse_queue(p) {\n p.next = zip_free_queue;\n zip_free_queue = p;\n }\n\n function zip_new_queue() {\n let p;\n\n if (zip_free_queue != null) {\n p = zip_free_queue;\n zip_free_queue = zip_free_queue.next;\n } else p = new zip_DeflateBuffer();\n p.next = null;\n p.len = p.off = 0;\n\n return p;\n }\n\n function zip_head1(i) {\n return zip_prev[zip_WSIZE + i];\n }\n\n function zip_head2(i, val) {\n return (zip_prev[zip_WSIZE + i] = val);\n }\n\n /* put_byte is used for the compressed output, put_ubyte for the\n * uncompressed output. However unlzw() uses window for its\n * suffix table instead of its output buffer, so it does not use put_ubyte\n * (to be cleaned up).\n */\n function zip_put_byte(c) {\n zip_outbuf[zip_outoff + zip_outcnt++] = c;\n if (zip_outoff + zip_outcnt == zip_OUTBUFSIZ) zip_qoutbuf();\n }\n\n /* Output a 16 bit value, lsb first */\n function zip_put_short(w) {\n w &= 0xffff;\n if (zip_outoff + zip_outcnt < zip_OUTBUFSIZ - 2) {\n zip_outbuf[zip_outoff + zip_outcnt++] = w & 0xff;\n zip_outbuf[zip_outoff + zip_outcnt++] = w >>> 8;\n } else {\n zip_put_byte(w & 0xff);\n zip_put_byte(w >>> 8);\n }\n }\n\n /* ==========================================================================\n * Insert string s in the dictionary and set match_head to the previous head\n * of the hash chain (the most recent string with same hash key). Return\n * the previous length of the hash chain.\n * IN assertion: all calls to to INSERT_STRING are made with consecutive\n * input characters and the first MIN_MATCH bytes of s are valid\n * (except for the last MIN_MATCH-1 bytes of the input file).\n */\n function zip_INSERT_STRING() {\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + zip_MIN_MATCH - 1] & 0xff)) & zip_HASH_MASK;\n zip_hash_head = zip_head1(zip_ins_h);\n zip_prev[zip_strstart & zip_WMASK] = zip_hash_head;\n zip_head2(zip_ins_h, zip_strstart);\n }\n\n /* Send a code of the given tree. c and tree must not have side effects */\n function zip_SEND_CODE(c, tree) {\n zip_send_bits(tree[c].fc, tree[c].dl);\n }\n\n /* Mapping from a distance to a distance code. dist is the distance - 1 and\n * must not have side effects. dist_code[256] and dist_code[257] are never\n * used.\n */\n function zip_D_CODE(dist) {\n return (dist < 256 ? zip_dist_code[dist] : zip_dist_code[256 + (dist >> 7)]) & 0xff;\n }\n\n /* ==========================================================================\n * Compares to subtrees, using the tree depth as tie breaker when\n * the subtrees have equal frequency. This minimizes the worst case length.\n */\n function zip_SMALLER(tree, n, m) {\n return tree[n].fc < tree[m].fc || (tree[n].fc == tree[m].fc && zip_depth[n] <= zip_depth[m]);\n }\n\n /* ==========================================================================\n * read string data\n */\n function zip_read_buff(buff, offset, n) {\n let i;\n for (i = 0; i < n && zip_deflate_pos < zip_deflate_data.length; i++)\n buff[offset + i] = zip_deflate_data.charCodeAt(zip_deflate_pos++) & 0xff;\n return i;\n }\n\n /* ==========================================================================\n * Initialize the \"longest match\" routines for a new file\n */\n function zip_lm_init() {\n let j;\n\n /* Initialize the hash table. */\n for (j = 0; j < zip_HASH_SIZE; j++)\n //\tzip_head2(j, zip_NIL);\n zip_prev[zip_WSIZE + j] = 0;\n /* prev will be initialized on the fly */\n\n /* Set the default configuration parameters:\n */\n zip_max_lazy_match = zip_configuration_table[zip_compr_level].max_lazy;\n zip_good_match = zip_configuration_table[zip_compr_level].good_length;\n if (!zip_FULL_SEARCH) zip_nice_match = zip_configuration_table[zip_compr_level].nice_length;\n zip_max_chain_length = zip_configuration_table[zip_compr_level].max_chain;\n\n zip_strstart = 0;\n zip_block_start = 0;\n\n zip_lookahead = zip_read_buff(zip_window, 0, 2 * zip_WSIZE);\n if (zip_lookahead <= 0) {\n zip_eofile = true;\n zip_lookahead = 0;\n return;\n }\n zip_eofile = false;\n /* Make sure that we always have enough lookahead. This is important\n * if input comes from a device such as a tty.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n\n /* If lookahead < MIN_MATCH, ins_h is garbage, but this is\n * not important since only literal bytes will be emitted.\n */\n zip_ins_h = 0;\n for (j = 0; j < zip_MIN_MATCH - 1; j++) {\n // UPDATE_HASH(ins_h, window[j]);\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[j] & 0xff)) & zip_HASH_MASK;\n }\n }\n\n /* ==========================================================================\n * Set match_start to the longest match starting at the given string and\n * return its length. Matches shorter or equal to prev_length are discarded,\n * in which case the result is equal to prev_length and match_start is\n * garbage.\n * IN assertions: cur_match is the head of the hash chain for the current\n * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1\n */\n function zip_longest_match(cur_match) {\n let chain_length = zip_max_chain_length; // max hash chain length\n let scanp = zip_strstart; // current string\n let matchp; // matched string\n let len; // length of current match\n let best_len = zip_prev_length; // best match length so far\n\n /* Stop when cur_match becomes <= limit. To simplify the code,\n * we prevent matches with the string of window index 0.\n */\n const limit = zip_strstart > zip_MAX_DIST ? zip_strstart - zip_MAX_DIST : zip_NIL;\n\n const strendp = zip_strstart + zip_MAX_MATCH;\n let scan_end1 = zip_window[scanp + best_len - 1];\n let scan_end = zip_window[scanp + best_len];\n\n /* Do not waste too much time if we already have a good match: */\n if (zip_prev_length >= zip_good_match) chain_length >>= 2;\n\n // Assert(encoder->strstart <= window_size-MIN_LOOKAHEAD, \"insufficient lookahead\");\n\n do {\n // Assert(cur_match < encoder->strstart, \"no future\");\n matchp = cur_match;\n\n /* Skip to next match if the match length cannot increase\n * or if the match length is less than 2:\n */\n if (\n zip_window[matchp + best_len] != scan_end ||\n zip_window[matchp + best_len - 1] != scan_end1 ||\n zip_window[matchp] != zip_window[scanp] ||\n zip_window[++matchp] != zip_window[scanp + 1]\n ) {\n continue;\n }\n\n /* The check at best_len-1 can be removed because it will be made\n * again later. (This heuristic is not always a win.)\n * It is not necessary to compare scan[2] and match[2] since they\n * are always equal when the other bytes match, given that\n * the hash keys are equal and that HASH_BITS >= 8.\n */\n scanp += 2;\n matchp++;\n\n /* We check for insufficient lookahead only every 8th comparison;\n * the 256th check will be made at strstart+258.\n */\n do {} while (\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n zip_window[++scanp] == zip_window[++matchp] &&\n scanp < strendp\n );\n\n len = zip_MAX_MATCH - (strendp - scanp);\n scanp = strendp - zip_MAX_MATCH;\n\n if (len > best_len) {\n zip_match_start = cur_match;\n best_len = len;\n if (zip_FULL_SEARCH) {\n if (len >= zip_MAX_MATCH) break;\n } else {\n if (len >= zip_nice_match) break;\n }\n\n scan_end1 = zip_window[scanp + best_len - 1];\n scan_end = zip_window[scanp + best_len];\n }\n } while ((cur_match = zip_prev[cur_match & zip_WMASK]) > limit && --chain_length != 0);\n\n return best_len;\n }\n\n /* ==========================================================================\n * Fill the window when the lookahead becomes insufficient.\n * Updates strstart and lookahead, and sets eofile if end of input file.\n * IN assertion: lookahead < MIN_LOOKAHEAD && strstart + lookahead > 0\n * OUT assertions: at least one byte has been read, or eofile is set;\n * file reads are performed for at least two bytes (required for the\n * translate_eol option).\n */\n function zip_fill_window() {\n let n;\n let m;\n\n // Amount of free space at the end of the window.\n let more = zip_window_size - zip_lookahead - zip_strstart;\n\n /* If the window is almost full and there is insufficient lookahead,\n * move the upper half to the lower one to make room in the upper half.\n */\n if (more == -1) {\n /* Very unlikely, but possible on 16 bit machine if strstart == 0\n * and lookahead == 1 (input done one byte at time)\n */\n more--;\n } else if (zip_strstart >= zip_WSIZE + zip_MAX_DIST) {\n /* By the IN assertion, the window is not empty so we can't confuse\n * more == 0 with more == 64K on a 16 bit machine.\n */\n //\tAssert(window_size == (ulg)2*WSIZE, \"no sliding with BIG_MEM\");\n\n //\tSystem.arraycopy(window, WSIZE, window, 0, WSIZE);\n for (n = 0; n < zip_WSIZE; n++) zip_window[n] = zip_window[n + zip_WSIZE];\n\n zip_match_start -= zip_WSIZE;\n zip_strstart -= zip_WSIZE; /* we now have strstart >= MAX_DIST: */\n zip_block_start -= zip_WSIZE;\n\n for (n = 0; n < zip_HASH_SIZE; n++) {\n m = zip_head1(n);\n zip_head2(n, m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL);\n }\n for (n = 0; n < zip_WSIZE; n++) {\n /* If n is not on any hash chain, prev[n] is garbage but\n * its value will never be used.\n */\n m = zip_prev[n];\n zip_prev[n] = m >= zip_WSIZE ? m - zip_WSIZE : zip_NIL;\n }\n more += zip_WSIZE;\n }\n // At this point, more >= 2\n if (!zip_eofile) {\n n = zip_read_buff(zip_window, zip_strstart + zip_lookahead, more);\n if (n <= 0) zip_eofile = true;\n else zip_lookahead += n;\n }\n }\n\n /* ==========================================================================\n * Processes a new input file and return its compressed length. This\n * function does not perform lazy evaluationof matches and inserts\n * new strings in the dictionary only for unmatched strings or for short\n * matches. It is used only for the fast compression options.\n */\n function zip_deflate_fast() {\n while (zip_lookahead != 0 && zip_qhead == null) {\n var flush; // set if current block must be flushed\n\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n zip_INSERT_STRING();\n\n /* Find the longest match, discarding those <= prev_length.\n * At this point we have always match_length < MIN_MATCH\n */\n if (zip_hash_head != zip_NIL && zip_strstart - zip_hash_head <= zip_MAX_DIST) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n zip_match_length = zip_longest_match(zip_hash_head);\n /* longest_match() sets match_start */\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\n }\n if (zip_match_length >= zip_MIN_MATCH) {\n //\t check_match(strstart, match_start, match_length);\n\n flush = zip_ct_tally(zip_strstart - zip_match_start, zip_match_length - zip_MIN_MATCH);\n zip_lookahead -= zip_match_length;\n\n /* Insert new strings in the hash table only if the match length\n * is not too large. This saves time but degrades compression.\n */\n if (zip_match_length <= zip_max_lazy_match) {\n zip_match_length--; // string at strstart already in hash table\n do {\n zip_strstart++;\n zip_INSERT_STRING();\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\n * these bytes are garbage, but it does not matter since\n * the next lookahead bytes will be emitted as literals.\n */\n } while (--zip_match_length != 0);\n zip_strstart++;\n } else {\n zip_strstart += zip_match_length;\n zip_match_length = 0;\n zip_ins_h = zip_window[zip_strstart] & 0xff;\n //\t\tUPDATE_HASH(ins_h, window[strstart + 1]);\n zip_ins_h = ((zip_ins_h << zip_H_SHIFT) ^ (zip_window[zip_strstart + 1] & 0xff)) & zip_HASH_MASK;\n\n // #if MIN_MATCH != 3\n //\t\tCall UPDATE_HASH() MIN_MATCH-3 more times\n // #endif\n }\n } else {\n /* No match, output a literal byte */\n flush = zip_ct_tally(0, zip_window[zip_strstart] & 0xff);\n zip_lookahead--;\n zip_strstart++;\n }\n if (flush) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n }\n }\n\n function zip_deflate_better() {\n /* Process the input block. */\n while (zip_lookahead != 0 && zip_qhead == null) {\n /* Insert the string window[strstart .. strstart+2] in the\n * dictionary, and set hash_head to the head of the hash chain:\n */\n zip_INSERT_STRING();\n\n /* Find the longest match, discarding those <= prev_length.\n */\n zip_prev_length = zip_match_length;\n zip_prev_match = zip_match_start;\n zip_match_length = zip_MIN_MATCH - 1;\n\n if (\n zip_hash_head != zip_NIL &&\n zip_prev_length < zip_max_lazy_match &&\n zip_strstart - zip_hash_head <= zip_MAX_DIST\n ) {\n /* To simplify the code, we prevent matches with the string\n * of window index 0 (in particular we have to avoid a match\n * of the string with itself at the start of the input file).\n */\n zip_match_length = zip_longest_match(zip_hash_head);\n /* longest_match() sets match_start */\n if (zip_match_length > zip_lookahead) zip_match_length = zip_lookahead;\n\n /* Ignore a length 3 match if it is too distant: */\n if (zip_match_length == zip_MIN_MATCH && zip_strstart - zip_match_start > zip_TOO_FAR) {\n /* If prev_match is also MIN_MATCH, match_start is garbage\n * but we will ignore the current match anyway.\n */\n zip_match_length--;\n }\n }\n /* If there was a match at the previous step and the current\n * match is not better, output the previous match:\n */\n if (zip_prev_length >= zip_MIN_MATCH && zip_match_length <= zip_prev_length) {\n var flush; // set if current block must be flushed\n\n //\t check_match(strstart - 1, prev_match, prev_length);\n flush = zip_ct_tally(zip_strstart - 1 - zip_prev_match, zip_prev_length - zip_MIN_MATCH);\n\n /* Insert in hash table all strings up to the end of the match.\n * strstart-1 and strstart are already inserted.\n */\n zip_lookahead -= zip_prev_length - 1;\n zip_prev_length -= 2;\n do {\n zip_strstart++;\n zip_INSERT_STRING();\n /* strstart never exceeds WSIZE-MAX_MATCH, so there are\n * always MIN_MATCH bytes ahead. If lookahead < MIN_MATCH\n * these bytes are garbage, but it does not matter since the\n * next lookahead bytes will always be emitted as literals.\n */\n } while (--zip_prev_length != 0);\n zip_match_available = 0;\n zip_match_length = zip_MIN_MATCH - 1;\n zip_strstart++;\n if (flush) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n } else if (zip_match_available != 0) {\n /* If there was no match at the previous position, output a\n * single literal. If there was a match but the current match\n * is longer, truncate the previous match to a single literal.\n */\n if (zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff)) {\n zip_flush_block(0);\n zip_block_start = zip_strstart;\n }\n zip_strstart++;\n zip_lookahead--;\n } else {\n /* There is no previous match to compare with, wait for\n * the next step to decide.\n */\n zip_match_available = 1;\n zip_strstart++;\n zip_lookahead--;\n }\n\n /* Make sure that we always have enough lookahead, except\n * at the end of the input file. We need MAX_MATCH bytes\n * for the next match, plus MIN_MATCH bytes to insert the\n * string following the next match.\n */\n while (zip_lookahead < zip_MIN_LOOKAHEAD && !zip_eofile) zip_fill_window();\n }\n }\n\n function zip_init_deflate() {\n if (zip_eofile) return;\n zip_bi_buf = 0;\n zip_bi_valid = 0;\n zip_ct_init();\n zip_lm_init();\n\n zip_qhead = null;\n zip_outcnt = 0;\n zip_outoff = 0;\n\n if (zip_compr_level <= 3) {\n zip_prev_length = zip_MIN_MATCH - 1;\n zip_match_length = 0;\n } else {\n zip_match_length = zip_MIN_MATCH - 1;\n zip_match_available = 0;\n }\n\n zip_complete = false;\n }\n\n /* ==========================================================================\n * Same as above, but achieves better compression. We use a lazy\n * evaluation for matches: a match is finally adopted only if there is\n * no better match at the next window position.\n */\n function zip_deflate_internal(buff, off, buff_size) {\n let n;\n\n if (!zip_initflag) {\n zip_init_deflate();\n zip_initflag = true;\n if (zip_lookahead == 0) {\n // empty\n zip_complete = true;\n return 0;\n }\n }\n\n if ((n = zip_qcopy(buff, off, buff_size)) == buff_size) return buff_size;\n\n if (zip_complete) return n;\n\n if (zip_compr_level <= 3)\n // optimized for speed\n zip_deflate_fast();\n else zip_deflate_better();\n if (zip_lookahead == 0) {\n if (zip_match_available != 0) zip_ct_tally(0, zip_window[zip_strstart - 1] & 0xff);\n zip_flush_block(1);\n zip_complete = true;\n }\n return n + zip_qcopy(buff, n + off, buff_size - n);\n }\n\n function zip_qcopy(buff, off, buff_size) {\n let n;\n let i;\n let j;\n\n n = 0;\n while (zip_qhead != null && n < buff_size) {\n i = buff_size - n;\n if (i > zip_qhead.len) i = zip_qhead.len;\n // System.arraycopy(qhead.ptr, qhead.off, buff, off + n, i);\n for (j = 0; j < i; j++) buff[off + n + j] = zip_qhead.ptr[zip_qhead.off + j];\n\n zip_qhead.off += i;\n zip_qhead.len -= i;\n n += i;\n if (zip_qhead.len == 0) {\n var p;\n p = zip_qhead;\n zip_qhead = zip_qhead.next;\n zip_reuse_queue(p);\n }\n }\n\n if (n == buff_size) return n;\n\n if (zip_outoff < zip_outcnt) {\n i = buff_size - n;\n if (i > zip_outcnt - zip_outoff) i = zip_outcnt - zip_outoff;\n // System.arraycopy(outbuf, outoff, buff, off + n, i);\n for (j = 0; j < i; j++) buff[off + n + j] = zip_outbuf[zip_outoff + j];\n zip_outoff += i;\n n += i;\n if (zip_outcnt == zip_outoff) zip_outcnt = zip_outoff = 0;\n }\n return n;\n }\n\n /* ==========================================================================\n * Allocate the match buffer, initialize the various tables and save the\n * location of the internal file attribute (ascii/binary) and method\n * (DEFLATE/STORE).\n */\n function zip_ct_init() {\n let n; // iterates over tree elements\n let bits; // bit counter\n let length; // length value\n let code; // code value\n let dist; // distance index\n\n if (zip_static_dtree[0].dl != 0) return; // ct_init already called\n\n zip_l_desc.dyn_tree = zip_dyn_ltree;\n zip_l_desc.static_tree = zip_static_ltree;\n zip_l_desc.extra_bits = zip_extra_lbits;\n zip_l_desc.extra_base = zip_LITERALS + 1;\n zip_l_desc.elems = zip_L_CODES;\n zip_l_desc.max_length = zip_MAX_BITS;\n zip_l_desc.max_code = 0;\n\n zip_d_desc.dyn_tree = zip_dyn_dtree;\n zip_d_desc.static_tree = zip_static_dtree;\n zip_d_desc.extra_bits = zip_extra_dbits;\n zip_d_desc.extra_base = 0;\n zip_d_desc.elems = zip_D_CODES;\n zip_d_desc.max_length = zip_MAX_BITS;\n zip_d_desc.max_code = 0;\n\n zip_bl_desc.dyn_tree = zip_bl_tree;\n zip_bl_desc.static_tree = null;\n zip_bl_desc.extra_bits = zip_extra_blbits;\n zip_bl_desc.extra_base = 0;\n zip_bl_desc.elems = zip_BL_CODES;\n zip_bl_desc.max_length = zip_MAX_BL_BITS;\n zip_bl_desc.max_code = 0;\n\n // Initialize the mapping length (0..255) -> length code (0..28)\n length = 0;\n for (code = 0; code < zip_LENGTH_CODES - 1; code++) {\n zip_base_length[code] = length;\n for (n = 0; n < 1 << zip_extra_lbits[code]; n++) zip_length_code[length++] = code;\n }\n // Assert (length == 256, \"ct_init: length != 256\");\n\n /* Note that the length 255 (match length 258) can be represented\n * in two different ways: code 284 + 5 bits or code 285, so we\n * overwrite length_code[255] to use the best encoding:\n */\n zip_length_code[length - 1] = code;\n\n /* Initialize the mapping dist (0..32K) -> dist code (0..29) */\n dist = 0;\n for (code = 0; code < 16; code++) {\n zip_base_dist[code] = dist;\n for (n = 0; n < 1 << zip_extra_dbits[code]; n++) {\n zip_dist_code[dist++] = code;\n }\n }\n // Assert (dist == 256, \"ct_init: dist != 256\");\n dist >>= 7; // from now on, all distances are divided by 128\n for (; code < zip_D_CODES; code++) {\n zip_base_dist[code] = dist << 7;\n for (n = 0; n < 1 << (zip_extra_dbits[code] - 7); n++) zip_dist_code[256 + dist++] = code;\n }\n // Assert (dist == 256, \"ct_init: 256+dist != 512\");\n\n // Construct the codes of the static literal tree\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\n n = 0;\n while (n <= 143) {\n zip_static_ltree[n++].dl = 8;\n zip_bl_count[8]++;\n }\n while (n <= 255) {\n zip_static_ltree[n++].dl = 9;\n zip_bl_count[9]++;\n }\n while (n <= 279) {\n zip_static_ltree[n++].dl = 7;\n zip_bl_count[7]++;\n }\n while (n <= 287) {\n zip_static_ltree[n++].dl = 8;\n zip_bl_count[8]++;\n }\n /* Codes 286 and 287 do not exist, but we must include them in the\n * tree construction to get a canonical Huffman tree (longest code\n * all ones)\n */\n zip_gen_codes(zip_static_ltree, zip_L_CODES + 1);\n\n /* The static distance tree is trivial: */\n for (n = 0; n < zip_D_CODES; n++) {\n zip_static_dtree[n].dl = 5;\n zip_static_dtree[n].fc = zip_bi_reverse(n, 5);\n }\n\n // Initialize the first block of the first file:\n zip_init_block();\n }\n\n /* ==========================================================================\n * Initialize a new block.\n */\n function zip_init_block() {\n let n; // iterates over tree elements\n\n // Initialize the trees.\n for (n = 0; n < zip_L_CODES; n++) zip_dyn_ltree[n].fc = 0;\n for (n = 0; n < zip_D_CODES; n++) zip_dyn_dtree[n].fc = 0;\n for (n = 0; n < zip_BL_CODES; n++) zip_bl_tree[n].fc = 0;\n\n zip_dyn_ltree[zip_END_BLOCK].fc = 1;\n zip_opt_len = zip_static_len = 0;\n zip_last_lit = zip_last_dist = zip_last_flags = 0;\n zip_flags = 0;\n zip_flag_bit = 1;\n }\n\n /* ==========================================================================\n * Restore the heap property by moving down the tree starting at node k,\n * exchanging a node with the smallest of its two sons if necessary, stopping\n * when the heap property is re-established (each father smaller than its\n * two sons).\n */\n function zip_pqdownheap(\n tree, // the tree to restore\n k,\n ) {\n // node to move down\n const v = zip_heap[k];\n let j = k << 1; // left son of k\n\n while (j <= zip_heap_len) {\n // Set j to the smallest of the two sons:\n if (j < zip_heap_len && zip_SMALLER(tree, zip_heap[j + 1], zip_heap[j])) j++;\n\n // Exit if v is smaller than both sons\n if (zip_SMALLER(tree, v, zip_heap[j])) break;\n\n // Exchange v with the smallest son\n zip_heap[k] = zip_heap[j];\n k = j;\n\n // And continue down the tree, setting j to the left son of k\n j <<= 1;\n }\n zip_heap[k] = v;\n }\n\n /* ==========================================================================\n * Compute the optimal bit lengths for a tree and update the total bit length\n * for the current block.\n * IN assertion: the fields freq and dad are set, heap[heap_max] and\n * above are the tree nodes sorted by increasing frequency.\n * OUT assertions: the field len is set to the optimal bit length, the\n * array bl_count contains the frequencies for each bit length.\n * The length opt_len is updated; static_len is also updated if stree is\n * not null.\n */\n function zip_gen_bitlen(desc) {\n // the tree descriptor\n const tree = desc.dyn_tree;\n const extra = desc.extra_bits;\n const base = desc.extra_base;\n const { max_code } = desc;\n const { max_length } = desc;\n const stree = desc.static_tree;\n let h; // heap index\n let n;\n let m; // iterate over the tree elements\n let bits; // bit length\n let xbits; // extra bits\n let f; // frequency\n let overflow = 0; // number of elements with bit length too large\n\n for (bits = 0; bits <= zip_MAX_BITS; bits++) zip_bl_count[bits] = 0;\n\n /* In a first pass, compute the optimal bit lengths (which may\n * overflow in the case of the bit length tree).\n */\n tree[zip_heap[zip_heap_max]].dl = 0; // root of the heap\n\n for (h = zip_heap_max + 1; h < zip_HEAP_SIZE; h++) {\n n = zip_heap[h];\n bits = tree[tree[n].dl].dl + 1;\n if (bits > max_length) {\n bits = max_length;\n overflow++;\n }\n tree[n].dl = bits;\n // We overwrite tree[n].dl which is no longer needed\n\n if (n > max_code) continue; // not a leaf node\n\n zip_bl_count[bits]++;\n xbits = 0;\n if (n >= base) xbits = extra[n - base];\n f = tree[n].fc;\n zip_opt_len += f * (bits + xbits);\n if (stree != null) zip_static_len += f * (stree[n].dl + xbits);\n }\n if (overflow == 0) return;\n\n // This happens for example on obj2 and pic of the Calgary corpus\n\n // Find the first bit length which could increase:\n do {\n bits = max_length - 1;\n while (zip_bl_count[bits] == 0) bits--;\n zip_bl_count[bits]--; // move one leaf down the tree\n zip_bl_count[bits + 1] += 2; // move one overflow item as its brother\n zip_bl_count[max_length]--;\n /* The brother of the overflow item also moves one step up,\n * but this does not affect bl_count[max_length]\n */\n overflow -= 2;\n } while (overflow > 0);\n\n /* Now recompute all bit lengths, scanning in increasing frequency.\n * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all\n * lengths instead of fixing only the wrong ones. This idea is taken\n * from 'ar' written by Haruhiko Okumura.)\n */\n for (bits = max_length; bits != 0; bits--) {\n n = zip_bl_count[bits];\n while (n != 0) {\n m = zip_heap[--h];\n if (m > max_code) continue;\n if (tree[m].dl != bits) {\n zip_opt_len += (bits - tree[m].dl) * tree[m].fc;\n tree[m].fc = bits;\n }\n n--;\n }\n }\n }\n\n /* ==========================================================================\n * Generate the codes for a given tree and bit counts (which need not be\n * optimal).\n * IN assertion: the array bl_count contains the bit length statistics for\n * the given tree and the field len is set for all tree elements.\n * OUT assertion: the field code is set for all tree elements of non\n * zero code length.\n */\n function zip_gen_codes(\n tree, // the tree to decorate\n max_code,\n ) {\n // largest code with non zero frequency\n const next_code = new Array(zip_MAX_BITS + 1); // next code value for each bit length\n let code = 0; // running code value\n let bits; // bit index\n let n; // code index\n\n /* The distribution counts are first used to generate the code values\n * without bit reversal.\n */\n for (bits = 1; bits <= zip_MAX_BITS; bits++) {\n code = (code + zip_bl_count[bits - 1]) << 1;\n next_code[bits] = code;\n }\n\n /* Check that the bit counts in bl_count are consistent. The last code\n * must be all ones.\n */\n // Assert (code + encoder->bl_count[MAX_BITS]-1 == (1<> 1; n >= 1; n--) zip_pqdownheap(tree, n);\n\n /* Construct the Huffman tree by repeatedly combining the least two\n * frequent nodes.\n */\n do {\n n = zip_heap[zip_SMALLEST];\n zip_heap[zip_SMALLEST] = zip_heap[zip_heap_len--];\n zip_pqdownheap(tree, zip_SMALLEST);\n\n m = zip_heap[zip_SMALLEST]; // m = node of next least frequency\n\n // keep the nodes sorted by frequency\n zip_heap[--zip_heap_max] = n;\n zip_heap[--zip_heap_max] = m;\n\n // Create a new node father of n and m\n tree[node].fc = tree[n].fc + tree[m].fc;\n //\tdepth[node] = (char)(MAX(depth[n], depth[m]) + 1);\n if (zip_depth[n] > zip_depth[m] + 1) zip_depth[node] = zip_depth[n];\n else zip_depth[node] = zip_depth[m] + 1;\n tree[n].dl = tree[m].dl = node;\n\n // and insert the new node in the heap\n zip_heap[zip_SMALLEST] = node++;\n zip_pqdownheap(tree, zip_SMALLEST);\n } while (zip_heap_len >= 2);\n\n zip_heap[--zip_heap_max] = zip_heap[zip_SMALLEST];\n\n /* At this point, the fields freq and dad are set. We can now\n * generate the bit lengths.\n */\n zip_gen_bitlen(desc);\n\n // The field len is now set, we can generate the bit codes\n zip_gen_codes(tree, max_code);\n }\n\n /* ==========================================================================\n * Scan a literal or distance tree to determine the frequencies of the codes\n * in the bit length tree. Updates opt_len to take into account the repeat\n * counts. (The contribution of the bit length codes will be added later\n * during the construction of bl_tree.)\n */\n function zip_scan_tree(\n tree, // the tree to be scanned\n max_code,\n ) {\n // and its largest code of non zero frequency\n let n; // iterates over all tree elements\n let prevlen = -1; // last emitted length\n let curlen; // length of current code\n let nextlen = tree[0].dl; // length of next code\n let count = 0; // repeat count of the current code\n let max_count = 7; // max repeat count\n let min_count = 4; // min repeat count\n\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n }\n tree[max_code + 1].dl = 0xffff; // guard\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[n + 1].dl;\n if (++count < max_count && curlen == nextlen) continue;\n else if (count < min_count) zip_bl_tree[curlen].fc += count;\n else if (curlen != 0) {\n if (curlen != prevlen) zip_bl_tree[curlen].fc++;\n zip_bl_tree[zip_REP_3_6].fc++;\n } else if (count <= 10) zip_bl_tree[zip_REPZ_3_10].fc++;\n else zip_bl_tree[zip_REPZ_11_138].fc++;\n count = 0;\n prevlen = curlen;\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen == nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n }\n\n /* ==========================================================================\n * Send a literal or distance tree in compressed form, using the codes in\n * bl_tree.\n */\n function zip_send_tree(\n tree, // the tree to be scanned\n max_code,\n ) {\n // and its largest code of non zero frequency\n let n; // iterates over all tree elements\n let prevlen = -1; // last emitted length\n let curlen; // length of current code\n let nextlen = tree[0].dl; // length of next code\n let count = 0; // repeat count of the current code\n let max_count = 7; // max repeat count\n let min_count = 4; /* guard already set */ // min repeat count\n\n /* tree[max_code+1].dl = -1; */ if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n }\n\n for (n = 0; n <= max_code; n++) {\n curlen = nextlen;\n nextlen = tree[n + 1].dl;\n if (++count < max_count && curlen == nextlen) {\n continue;\n } else if (count < min_count) {\n do {\n zip_SEND_CODE(curlen, zip_bl_tree);\n } while (--count != 0);\n } else if (curlen != 0) {\n if (curlen != prevlen) {\n zip_SEND_CODE(curlen, zip_bl_tree);\n count--;\n }\n // Assert(count >= 3 && count <= 6, \" 3_6?\");\n zip_SEND_CODE(zip_REP_3_6, zip_bl_tree);\n zip_send_bits(count - 3, 2);\n } else if (count <= 10) {\n zip_SEND_CODE(zip_REPZ_3_10, zip_bl_tree);\n zip_send_bits(count - 3, 3);\n } else {\n zip_SEND_CODE(zip_REPZ_11_138, zip_bl_tree);\n zip_send_bits(count - 11, 7);\n }\n count = 0;\n prevlen = curlen;\n if (nextlen == 0) {\n max_count = 138;\n min_count = 3;\n } else if (curlen == nextlen) {\n max_count = 6;\n min_count = 3;\n } else {\n max_count = 7;\n min_count = 4;\n }\n }\n }\n\n /* ==========================================================================\n * Construct the Huffman tree for the bit lengths and return the index in\n * bl_order of the last bit length code to send.\n */\n function zip_build_bl_tree() {\n let max_blindex; // index of last bit length code of non zero freq\n\n // Determine the bit length frequencies for literal and distance trees\n zip_scan_tree(zip_dyn_ltree, zip_l_desc.max_code);\n zip_scan_tree(zip_dyn_dtree, zip_d_desc.max_code);\n\n // Build the bit length tree:\n zip_build_tree(zip_bl_desc);\n /* opt_len now includes the length of the tree representations, except\n * the lengths of the bit lengths codes and the 5+5+4 bits for the counts.\n */\n\n /* Determine the number of bit length codes to send. The pkzip format\n * requires that at least 4 bit length codes be sent. (appnote.txt says\n * 3 but the actual value used is 4.)\n */\n for (max_blindex = zip_BL_CODES - 1; max_blindex >= 3; max_blindex--) {\n if (zip_bl_tree[zip_bl_order[max_blindex]].dl != 0) break;\n }\n /* Update opt_len to include the bit length tree and counts */\n zip_opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;\n // Tracev((stderr, \"\\ndyn trees: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n\n return max_blindex;\n }\n\n /* ==========================================================================\n * Send the header for a block using dynamic Huffman trees: the counts, the\n * lengths of the bit length codes, the literal tree and the distance tree.\n * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.\n */\n function zip_send_all_trees(lcodes, dcodes, blcodes) {\n // number of codes for each tree\n let rank; // index in bl_order\n\n // Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, \"not enough codes\");\n // Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,\n //\t \"too many codes\");\n // Tracev((stderr, \"\\nbl counts: \"));\n zip_send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\n zip_send_bits(dcodes - 1, 5);\n zip_send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\n for (rank = 0; rank < blcodes; rank++) {\n // Tracev((stderr, \"\\nbl code %2d \", bl_order[rank]));\n zip_send_bits(zip_bl_tree[zip_bl_order[rank]].dl, 3);\n }\n\n // send the literal tree\n zip_send_tree(zip_dyn_ltree, lcodes - 1);\n\n // send the distance tree\n zip_send_tree(zip_dyn_dtree, dcodes - 1);\n }\n\n /* ==========================================================================\n * Determine the best encoding for the current block: dynamic trees, static\n * trees or store, and output the encoded block to the zip file.\n */\n function zip_flush_block(eof) {\n // true if this is the last block for a file\n let opt_lenb;\n let static_lenb; // opt_len and static_len in bytes\n let max_blindex; // index of last bit length code of non zero freq\n let stored_len; // length of input block\n\n stored_len = zip_strstart - zip_block_start;\n zip_flag_buf[zip_last_flags] = zip_flags; // Save the flags for the last 8 items\n\n // Construct the literal and distance trees\n zip_build_tree(zip_l_desc);\n // Tracev((stderr, \"\\nlit data: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n\n zip_build_tree(zip_d_desc);\n // Tracev((stderr, \"\\ndist data: dyn %ld, stat %ld\",\n //\t encoder->opt_len, encoder->static_len));\n /* At this point, opt_len and static_len are the total bit lengths of\n * the compressed block data, excluding the tree representations.\n */\n\n /* Build the bit length tree for the above two trees, and get the index\n * in bl_order of the last bit length code to send.\n */\n max_blindex = zip_build_bl_tree();\n\n // Determine the best encoding. Compute first the block length in bytes\n opt_lenb = (zip_opt_len + 3 + 7) >> 3;\n static_lenb = (zip_static_len + 3 + 7) >> 3;\n\n // Trace((stderr, \"\\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u dist %u \",\n //\t opt_lenb, encoder->opt_len,\n //\t static_lenb, encoder->static_len, stored_len,\n //\t encoder->last_lit, encoder->last_dist));\n\n if (static_lenb <= opt_lenb) opt_lenb = static_lenb;\n if (\n stored_len + 4 <= opt_lenb && // 4: two words for the lengths\n zip_block_start >= 0\n ) {\n let i;\n\n /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE.\n * Otherwise we can't have processed more than WSIZE input bytes since\n * the last block flush, because compression would have been\n * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to\n * transform a block into a stored block.\n */\n zip_send_bits((zip_STORED_BLOCK << 1) + eof, 3); /* send block type */\n zip_bi_windup(); /* align on byte boundary */\n zip_put_short(stored_len);\n zip_put_short(~stored_len);\n\n // copy block\n /*\n p = &window[block_start];\n for(i = 0; i < stored_len; i++)\n\tput_byte(p[i]);\n*/\n for (i = 0; i < stored_len; i++) zip_put_byte(zip_window[zip_block_start + i]);\n } else if (static_lenb == opt_lenb) {\n zip_send_bits((zip_STATIC_TREES << 1) + eof, 3);\n zip_compress_block(zip_static_ltree, zip_static_dtree);\n } else {\n zip_send_bits((zip_DYN_TREES << 1) + eof, 3);\n zip_send_all_trees(zip_l_desc.max_code + 1, zip_d_desc.max_code + 1, max_blindex + 1);\n zip_compress_block(zip_dyn_ltree, zip_dyn_dtree);\n }\n\n zip_init_block();\n\n if (eof != 0) zip_bi_windup();\n }\n\n /* ==========================================================================\n * Save the match info and tally the frequency counts. Return true if\n * the current block must be flushed.\n */\n function zip_ct_tally(\n dist, // distance of matched string\n lc,\n ) {\n // match length-MIN_MATCH or unmatched char (if dist==0)\n zip_l_buf[zip_last_lit++] = lc;\n if (dist == 0) {\n // lc is the unmatched char\n zip_dyn_ltree[lc].fc++;\n } else {\n // Here, lc is the match length - MIN_MATCH\n dist--; // dist = match distance - 1\n // Assert((ush)dist < (ush)MAX_DIST &&\n //\t (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&\n //\t (ush)D_CODE(dist) < (ush)D_CODES, \"ct_tally: bad match\");\n\n zip_dyn_ltree[zip_length_code[lc] + zip_LITERALS + 1].fc++;\n zip_dyn_dtree[zip_D_CODE(dist)].fc++;\n\n zip_d_buf[zip_last_dist++] = dist;\n zip_flags |= zip_flag_bit;\n }\n zip_flag_bit <<= 1;\n\n // Output the flags if they fill a byte\n if ((zip_last_lit & 7) == 0) {\n zip_flag_buf[zip_last_flags++] = zip_flags;\n zip_flags = 0;\n zip_flag_bit = 1;\n }\n // Try to guess if it is profitable to stop the current block here\n if (zip_compr_level > 2 && (zip_last_lit & 0xfff) == 0) {\n // Compute an upper bound for the compressed length\n let out_length = zip_last_lit * 8;\n const in_length = zip_strstart - zip_block_start;\n let dcode;\n\n for (dcode = 0; dcode < zip_D_CODES; dcode++) {\n out_length += zip_dyn_dtree[dcode].fc * (5 + zip_extra_dbits[dcode]);\n }\n out_length >>= 3;\n // Trace((stderr,\"\\nlast_lit %u, last_dist %u, in %ld, out ~%ld(%ld%%) \",\n //\t encoder->last_lit, encoder->last_dist, in_length, out_length,\n //\t 100L - out_length*100L/in_length));\n if (zip_last_dist < parseInt(zip_last_lit / 2) && out_length < parseInt(in_length / 2)) return true;\n }\n return zip_last_lit == zip_LIT_BUFSIZE - 1 || zip_last_dist == zip_DIST_BUFSIZE;\n /* We avoid equality with LIT_BUFSIZE because of wraparound at 64K\n * on 16 bit machines and because stored blocks are restricted to\n * 64K-1 bytes.\n */\n }\n\n /* ==========================================================================\n * Send the block data compressed using the given Huffman trees\n */\n function zip_compress_block(\n ltree, // literal tree\n dtree,\n ) {\n // distance tree\n let dist; // distance of matched string\n let lc; // match length or unmatched char (if dist == 0)\n let lx = 0; // running index in l_buf\n let dx = 0; // running index in d_buf\n let fx = 0; // running index in flag_buf\n let flag = 0; // current flags\n let code; // the code to send\n let extra; // number of extra bits to send\n\n if (zip_last_lit != 0)\n do {\n if ((lx & 7) == 0) flag = zip_flag_buf[fx++];\n lc = zip_l_buf[lx++] & 0xff;\n if ((flag & 1) == 0) {\n zip_SEND_CODE(lc, ltree); /* send a literal byte */\n //\tTracecv(isgraph(lc), (stderr,\" '%c' \", lc));\n } else {\n // Here, lc is the match length - MIN_MATCH\n code = zip_length_code[lc];\n zip_SEND_CODE(code + zip_LITERALS + 1, ltree); // send the length code\n extra = zip_extra_lbits[code];\n if (extra != 0) {\n lc -= zip_base_length[code];\n zip_send_bits(lc, extra); // send the extra length bits\n }\n dist = zip_d_buf[dx++];\n // Here, dist is the match distance - 1\n code = zip_D_CODE(dist);\n //\tAssert (code < D_CODES, \"bad d_code\");\n\n zip_SEND_CODE(code, dtree); // send the distance code\n extra = zip_extra_dbits[code];\n if (extra != 0) {\n dist -= zip_base_dist[code];\n zip_send_bits(dist, extra); // send the extra distance bits\n }\n } // literal or match pair ?\n flag >>= 1;\n } while (lx < zip_last_lit);\n\n zip_SEND_CODE(zip_END_BLOCK, ltree);\n }\n\n /* ==========================================================================\n * Send a value on a given number of bits.\n * IN assertion: length <= 16 and value fits in length bits.\n */\n const zip_Buf_size = 16; // bit size of bi_buf\n function zip_send_bits(\n value, // value to send\n length,\n ) {\n // number of bits\n /* If not enough room in bi_buf, use (valid) bits from bi_buf and\n * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid))\n * unused bits in value.\n */\n if (zip_bi_valid > zip_Buf_size - length) {\n zip_bi_buf |= value << zip_bi_valid;\n zip_put_short(zip_bi_buf);\n zip_bi_buf = value >> (zip_Buf_size - zip_bi_valid);\n zip_bi_valid += length - zip_Buf_size;\n } else {\n zip_bi_buf |= value << zip_bi_valid;\n zip_bi_valid += length;\n }\n }\n\n /* ==========================================================================\n * Reverse the first len bits of a code, using straightforward code (a faster\n * method would use a table)\n * IN assertion: 1 <= len <= 15\n */\n function zip_bi_reverse(\n code, // the value to invert\n len,\n ) {\n // its bit length\n let res = 0;\n do {\n res |= code & 1;\n code >>= 1;\n res <<= 1;\n } while (--len > 0);\n return res >> 1;\n }\n\n /* ==========================================================================\n * Write out any remaining bits in an incomplete byte.\n */\n function zip_bi_windup() {\n if (zip_bi_valid > 8) {\n zip_put_short(zip_bi_buf);\n } else if (zip_bi_valid > 0) {\n zip_put_byte(zip_bi_buf);\n }\n zip_bi_buf = 0;\n zip_bi_valid = 0;\n }\n\n function zip_qoutbuf() {\n if (zip_outcnt != 0) {\n let q;\n let i;\n q = zip_new_queue();\n if (zip_qhead == null) zip_qhead = zip_qtail = q;\n else zip_qtail = zip_qtail.next = q;\n q.len = zip_outcnt - zip_outoff;\n // System.arraycopy(zip_outbuf, zip_outoff, q.ptr, 0, q.len);\n for (i = 0; i < q.len; i++) q.ptr[i] = zip_outbuf[zip_outoff + i];\n zip_outcnt = zip_outoff = 0;\n }\n }\n\n return function deflate(str, level) {\n let i;\n let j;\n\n zip_deflate_data = str;\n zip_deflate_pos = 0;\n if (typeof level === 'undefined') level = zip_DEFAULT_LEVEL;\n zip_deflate_start(level);\n\n const buff = new Array(1024);\n const aout = [];\n while ((i = zip_deflate_internal(buff, 0, buff.length)) > 0) {\n const cbuf = new Array(i);\n for (j = 0; j < i; j++) {\n cbuf[j] = String.fromCharCode(buff[j]);\n }\n aout[aout.length] = cbuf.join('');\n }\n zip_deflate_data = null; // G.C.\n return aout.join('');\n };\n})();\n\nexport default deflate;\n","// @ts-nocheck\n/**\n * Copyright (C) 2021 THL A29 Limited, a Tencent company.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport mergeWith from 'lodash/mergeWith';\nimport deflate from '@/libs/rawdeflate';\n\nfunction encode64(data) {\n let r = '';\n for (let i = 0; i < data.length; i += 3) {\n if (i + 2 === data.length) {\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), 0);\n } else if (i + 1 === data.length) {\n r += append3bytes(data.charCodeAt(i), 0, 0);\n } else {\n r += append3bytes(data.charCodeAt(i), data.charCodeAt(i + 1), data.charCodeAt(i + 2));\n }\n }\n return r;\n}\n\nfunction append3bytes(b1, b2, b3) {\n const c1 = b1 >> 2;\n const c2 = ((b1 & 0x3) << 4) | (b2 >> 4);\n const c3 = ((b2 & 0xf) << 2) | (b3 >> 6);\n const c4 = b3 & 0x3f;\n let r = '';\n r += encode6bit(c1 & 0x3f);\n r += encode6bit(c2 & 0x3f);\n r += encode6bit(c3 & 0x3f);\n r += encode6bit(c4 & 0x3f);\n return r;\n}\n\nfunction encode6bit(b1) {\n let b = b1;\n if (b < 10) {\n return String.fromCharCode(48 + b);\n }\n b -= 10;\n if (b < 26) {\n return String.fromCharCode(65 + b);\n }\n b -= 26;\n if (b < 26) {\n return String.fromCharCode(97 + b);\n }\n b -= 26;\n if (b === 0) {\n return '-';\n }\n if (b === 1) {\n return '_';\n }\n return '?';\n}\n\nfunction compress(s1, url) {\n const s = unescape(encodeURIComponent(s1));\n return `${url}/svg/${encode64(deflate(s, 9))}`;\n}\n\nexport default class PlantUMLCodeEngine {\n static install(cherryOptions, args) {\n mergeWith(cherryOptions, {\n engine: {\n syntax: {\n codeBlock: {\n customRenderer: {\n plantuml: new PlantUMLCodeEngine({\n ...args,\n ...(cherryOptions.engine.syntax.plantuml ?? {}),\n }),\n },\n },\n },\n },\n });\n }\n\n constructor(plantUMLOptions = {}) {\n const defaultUrl = 'http://www.plantuml.com/plantuml';\n this.baseUrl = plantUMLOptions.baseUrl ?? defaultUrl;\n }\n\n render(src, sign) {\n let $sign = sign;\n if (!$sign) {\n $sign = Math.round(Math.random() * 100000000);\n }\n const graphId = `plantuml-${$sign}-${new Date().getTime()}`;\n return ``;\n }\n}\n","/*! For license information please see mermaid.esm.min.mjs.LICENSE.txt */\nvar t={2536:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,6],n=[1,7],r=[1,8],i=[1,9],a=[1,16],o=[1,11],s=[1,12],l=[1,13],u=[1,14],h=[1,15],f=[1,27],d=[1,33],p=[1,34],g=[1,35],y=[1,36],m=[1,37],b=[1,72],v=[1,73],_=[1,74],x=[1,75],k=[1,76],w=[1,77],T=[1,78],E=[1,38],C=[1,39],S=[1,40],A=[1,41],M=[1,42],N=[1,43],O=[1,44],D=[1,45],B=[1,46],L=[1,47],I=[1,48],F=[1,49],R=[1,50],P=[1,51],j=[1,52],z=[1,53],Y=[1,54],U=[1,55],$=[1,56],W=[1,57],q=[1,59],H=[1,60],V=[1,61],G=[1,62],X=[1,63],Z=[1,64],Q=[1,65],K=[1,66],J=[1,67],tt=[1,68],et=[1,69],nt=[24,52],rt=[24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],it=[15,24,44,46,47,48,49,50,51,52,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],at=[1,94],ot=[1,95],st=[1,96],ct=[1,97],lt=[15,24,52],ut=[7,8,9,10,18,22,25,26,27,28],ht=[15,24,43,52],ft=[15,24,43,52,86,87,89,90],dt=[15,43],pt=[44,46,47,48,49,50,51,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84],gt={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,directive:6,direction_tb:7,direction_bt:8,direction_rl:9,direction_lr:10,graphConfig:11,openDirective:12,typeDirective:13,closeDirective:14,NEWLINE:15,\":\":16,argDirective:17,open_directive:18,type_directive:19,arg_directive:20,close_directive:21,C4_CONTEXT:22,statements:23,EOF:24,C4_CONTAINER:25,C4_COMPONENT:26,C4_DYNAMIC:27,C4_DEPLOYMENT:28,otherStatements:29,diagramStatements:30,otherStatement:31,title:32,accDescription:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,boundaryStatement:39,boundaryStartStatement:40,boundaryStopStatement:41,boundaryStart:42,LBRACE:43,ENTERPRISE_BOUNDARY:44,attributes:45,SYSTEM_BOUNDARY:46,BOUNDARY:47,CONTAINER_BOUNDARY:48,NODE:49,NODE_L:50,NODE_R:51,RBRACE:52,diagramStatement:53,PERSON:54,PERSON_EXT:55,SYSTEM:56,SYSTEM_DB:57,SYSTEM_QUEUE:58,SYSTEM_EXT:59,SYSTEM_EXT_DB:60,SYSTEM_EXT_QUEUE:61,CONTAINER:62,CONTAINER_DB:63,CONTAINER_QUEUE:64,CONTAINER_EXT:65,CONTAINER_EXT_DB:66,CONTAINER_EXT_QUEUE:67,COMPONENT:68,COMPONENT_DB:69,COMPONENT_QUEUE:70,COMPONENT_EXT:71,COMPONENT_EXT_DB:72,COMPONENT_EXT_QUEUE:73,REL:74,BIREL:75,REL_U:76,REL_D:77,REL_L:78,REL_R:79,REL_B:80,REL_INDEX:81,UPDATE_EL_STYLE:82,UPDATE_REL_STYLE:83,UPDATE_LAYOUT_CONFIG:84,attribute:85,STR:86,STR_KEY:87,STR_VALUE:88,ATTRIBUTE:89,ATTRIBUTE_EMPTY:90,$accept:0,$end:1},terminals_:{2:\"error\",7:\"direction_tb\",8:\"direction_bt\",9:\"direction_rl\",10:\"direction_lr\",15:\"NEWLINE\",16:\":\",18:\"open_directive\",19:\"type_directive\",20:\"arg_directive\",21:\"close_directive\",22:\"C4_CONTEXT\",24:\"EOF\",25:\"C4_CONTAINER\",26:\"C4_COMPONENT\",27:\"C4_DYNAMIC\",28:\"C4_DEPLOYMENT\",32:\"title\",33:\"accDescription\",34:\"acc_title\",35:\"acc_title_value\",36:\"acc_descr\",37:\"acc_descr_value\",38:\"acc_descr_multiline_value\",43:\"LBRACE\",44:\"ENTERPRISE_BOUNDARY\",46:\"SYSTEM_BOUNDARY\",47:\"BOUNDARY\",48:\"CONTAINER_BOUNDARY\",49:\"NODE\",50:\"NODE_L\",51:\"NODE_R\",52:\"RBRACE\",54:\"PERSON\",55:\"PERSON_EXT\",56:\"SYSTEM\",57:\"SYSTEM_DB\",58:\"SYSTEM_QUEUE\",59:\"SYSTEM_EXT\",60:\"SYSTEM_EXT_DB\",61:\"SYSTEM_EXT_QUEUE\",62:\"CONTAINER\",63:\"CONTAINER_DB\",64:\"CONTAINER_QUEUE\",65:\"CONTAINER_EXT\",66:\"CONTAINER_EXT_DB\",67:\"CONTAINER_EXT_QUEUE\",68:\"COMPONENT\",69:\"COMPONENT_DB\",70:\"COMPONENT_QUEUE\",71:\"COMPONENT_EXT\",72:\"COMPONENT_EXT_DB\",73:\"COMPONENT_EXT_QUEUE\",74:\"REL\",75:\"BIREL\",76:\"REL_U\",77:\"REL_D\",78:\"REL_L\",79:\"REL_R\",80:\"REL_B\",81:\"REL_INDEX\",82:\"UPDATE_EL_STYLE\",83:\"UPDATE_REL_STYLE\",84:\"UPDATE_LAYOUT_CONFIG\",86:\"STR\",87:\"STR_KEY\",88:\"STR_VALUE\",89:\"ATTRIBUTE\",90:\"ATTRIBUTE_EMPTY\"},productions_:[0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[11,4],[11,4],[11,4],[11,4],[23,1],[23,1],[23,2],[29,1],[29,2],[29,3],[31,1],[31,1],[31,2],[31,2],[31,1],[39,3],[40,3],[40,3],[40,4],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[42,2],[41,1],[30,1],[30,2],[30,3],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,1],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[53,2],[45,1],[45,2],[85,1],[85,2],[85,1],[85,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setDirection(\"TB\");break;case 5:r.setDirection(\"BT\");break;case 6:r.setDirection(\"RL\");break;case 7:r.setDirection(\"LR\");break;case 11:console.log(\"open_directive: \",a[s]),r.parseDirective(\"%%{\",\"open_directive\");break;case 12:break;case 13:a[s]=a[s].trim().replace(/'/g,'\"'),console.log(\"arg_directive: \",a[s]),r.parseDirective(a[s],\"arg_directive\");break;case 14:console.log(\"close_directive: \",a[s]),r.parseDirective(\"}%%\",\"close_directive\",\"c4Context\");break;case 15:case 16:case 17:case 18:case 19:r.setC4Type(a[s-3]);break;case 26:r.setTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 27:r.setAccDescription(a[s].substring(15)),this.$=a[s].substring(15);break;case 28:this.$=a[s].trim(),r.setTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 35:case 36:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,\"ENTERPRISE\"),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 37:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystemBoundary(...a[s]),this.$=a[s];break;case 38:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(2,0,\"CONTAINER\"),r.addContainerBoundary(...a[s]),this.$=a[s];break;case 39:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"node\",...a[s]),this.$=a[s];break;case 40:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"nodeL\",...a[s]),this.$=a[s];break;case 41:console.log(a[s-1],JSON.stringify(a[s])),r.addDeploymentNode(\"nodeR\",...a[s]),this.$=a[s];break;case 42:r.popBoundaryParseStack();break;case 46:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"person\",...a[s]),this.$=a[s];break;case 47:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_person\",...a[s]),this.$=a[s];break;case 48:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system\",...a[s]),this.$=a[s];break;case 49:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system_db\",...a[s]),this.$=a[s];break;case 50:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"system_queue\",...a[s]),this.$=a[s];break;case 51:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system\",...a[s]),this.$=a[s];break;case 52:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system_db\",...a[s]),this.$=a[s];break;case 53:console.log(a[s-1],JSON.stringify(a[s])),r.addPersonOrSystem(\"external_system_queue\",...a[s]),this.$=a[s];break;case 54:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container\",...a[s]),this.$=a[s];break;case 55:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container_db\",...a[s]),this.$=a[s];break;case 56:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"container_queue\",...a[s]),this.$=a[s];break;case 57:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container\",...a[s]),this.$=a[s];break;case 58:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container_db\",...a[s]),this.$=a[s];break;case 59:console.log(a[s-1],JSON.stringify(a[s])),r.addContainer(\"external_container_queue\",...a[s]),this.$=a[s];break;case 60:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component\",...a[s]),this.$=a[s];break;case 61:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component_db\",...a[s]),this.$=a[s];break;case 62:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"component_queue\",...a[s]),this.$=a[s];break;case 63:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component\",...a[s]),this.$=a[s];break;case 64:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component_db\",...a[s]),this.$=a[s];break;case 65:console.log(a[s-1],JSON.stringify(a[s])),r.addComponent(\"external_component_queue\",...a[s]),this.$=a[s];break;case 67:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel\",...a[s]),this.$=a[s];break;case 68:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"birel\",...a[s]),this.$=a[s];break;case 69:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_u\",...a[s]),this.$=a[s];break;case 70:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_d\",...a[s]),this.$=a[s];break;case 71:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_l\",...a[s]),this.$=a[s];break;case 72:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_r\",...a[s]),this.$=a[s];break;case 73:console.log(a[s-1],JSON.stringify(a[s])),r.addRel(\"rel_b\",...a[s]),this.$=a[s];break;case 74:console.log(a[s-1],JSON.stringify(a[s])),a[s].splice(0,1),r.addRel(\"rel\",...a[s]),this.$=a[s];break;case 75:console.log(a[s-1],JSON.stringify(a[s])),r.updateElStyle(\"update_el_style\",...a[s]),this.$=a[s];break;case 76:console.log(a[s-1],JSON.stringify(a[s])),r.updateRelStyle(\"update_rel_style\",...a[s]),this.$=a[s];break;case 77:console.log(a[s-1],JSON.stringify(a[s])),r.updateLayoutConfig(\"update_layout_config\",...a[s]),this.$=a[s];break;case 78:console.log(\"PUSH ATTRIBUTE: \",a[s]),this.$=[a[s]];break;case 79:console.log(\"PUSH ATTRIBUTE: \",a[s-1]),a[s].unshift(a[s-1]),this.$=a[s];break;case 80:case 82:this.$=a[s].trim();break;case 81:console.log(\"kv: \",a[s-1],a[s]);let t={};t[a[s-1].trim()]=a[s].trim(),this.$=t;break;case 83:this.$=\"\"}},table:[{3:1,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[3]},{1:[2,1]},{1:[2,2]},{3:17,4:2,5:3,6:4,7:e,8:n,9:r,10:i,11:5,12:10,18:a,22:o,25:s,26:l,27:u,28:h},{1:[2,8]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{1:[2,7]},{13:18,19:[1,19]},{15:[1,20]},{15:[1,21]},{15:[1,22]},{15:[1,23]},{15:[1,24]},{19:[2,11]},{1:[2,3]},{14:25,16:[1,26],21:f},t([16,21],[2,12]),{23:28,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:79,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:80,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:81,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{23:82,29:29,30:30,31:31,32:d,33:p,34:g,36:y,38:m,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,83]},{17:84,20:[1,85]},{15:[2,14]},{24:[1,86]},t(nt,[2,20],{53:32,39:58,40:70,42:71,30:87,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(nt,[2,21]),t(rt,[2,23],{15:[1,88]}),t(nt,[2,43],{15:[1,89]}),t(it,[2,26]),t(it,[2,27]),{35:[1,90]},{37:[1,91]},t(it,[2,30]),{45:92,85:93,86:at,87:ot,89:st,90:ct},{45:98,85:93,86:at,87:ot,89:st,90:ct},{45:99,85:93,86:at,87:ot,89:st,90:ct},{45:100,85:93,86:at,87:ot,89:st,90:ct},{45:101,85:93,86:at,87:ot,89:st,90:ct},{45:102,85:93,86:at,87:ot,89:st,90:ct},{45:103,85:93,86:at,87:ot,89:st,90:ct},{45:104,85:93,86:at,87:ot,89:st,90:ct},{45:105,85:93,86:at,87:ot,89:st,90:ct},{45:106,85:93,86:at,87:ot,89:st,90:ct},{45:107,85:93,86:at,87:ot,89:st,90:ct},{45:108,85:93,86:at,87:ot,89:st,90:ct},{45:109,85:93,86:at,87:ot,89:st,90:ct},{45:110,85:93,86:at,87:ot,89:st,90:ct},{45:111,85:93,86:at,87:ot,89:st,90:ct},{45:112,85:93,86:at,87:ot,89:st,90:ct},{45:113,85:93,86:at,87:ot,89:st,90:ct},{45:114,85:93,86:at,87:ot,89:st,90:ct},{45:115,85:93,86:at,87:ot,89:st,90:ct},{45:116,85:93,86:at,87:ot,89:st,90:ct},t(lt,[2,66]),{45:117,85:93,86:at,87:ot,89:st,90:ct},{45:118,85:93,86:at,87:ot,89:st,90:ct},{45:119,85:93,86:at,87:ot,89:st,90:ct},{45:120,85:93,86:at,87:ot,89:st,90:ct},{45:121,85:93,86:at,87:ot,89:st,90:ct},{45:122,85:93,86:at,87:ot,89:st,90:ct},{45:123,85:93,86:at,87:ot,89:st,90:ct},{45:124,85:93,86:at,87:ot,89:st,90:ct},{45:125,85:93,86:at,87:ot,89:st,90:ct},{45:126,85:93,86:at,87:ot,89:st,90:ct},{45:127,85:93,86:at,87:ot,89:st,90:ct},{30:128,39:58,40:70,42:71,44:b,46:v,47:_,48:x,49:k,50:w,51:T,53:32,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et},{15:[1,130],43:[1,129]},{45:131,85:93,86:at,87:ot,89:st,90:ct},{45:132,85:93,86:at,87:ot,89:st,90:ct},{45:133,85:93,86:at,87:ot,89:st,90:ct},{45:134,85:93,86:at,87:ot,89:st,90:ct},{45:135,85:93,86:at,87:ot,89:st,90:ct},{45:136,85:93,86:at,87:ot,89:st,90:ct},{45:137,85:93,86:at,87:ot,89:st,90:ct},{24:[1,138]},{24:[1,139]},{24:[1,140]},{24:[1,141]},t(ut,[2,9]),{14:142,21:f},{21:[2,13]},{1:[2,15]},t(nt,[2,22]),t(rt,[2,24],{31:31,29:143,32:d,33:p,34:g,36:y,38:m}),t(nt,[2,44],{29:29,30:30,31:31,53:32,39:58,40:70,42:71,23:144,32:d,33:p,34:g,36:y,38:m,44:b,46:v,47:_,48:x,49:k,50:w,51:T,54:E,55:C,56:S,57:A,58:M,59:N,60:O,61:D,62:B,63:L,64:I,65:F,66:R,67:P,68:j,69:z,70:Y,71:U,72:$,73:W,74:q,75:H,76:V,77:G,78:X,79:Z,80:Q,81:K,82:J,83:tt,84:et}),t(it,[2,28]),t(it,[2,29]),t(lt,[2,46]),t(ht,[2,78],{85:93,45:145,86:at,87:ot,89:st,90:ct}),t(ft,[2,80]),{88:[1,146]},t(ft,[2,82]),t(ft,[2,83]),t(lt,[2,47]),t(lt,[2,48]),t(lt,[2,49]),t(lt,[2,50]),t(lt,[2,51]),t(lt,[2,52]),t(lt,[2,53]),t(lt,[2,54]),t(lt,[2,55]),t(lt,[2,56]),t(lt,[2,57]),t(lt,[2,58]),t(lt,[2,59]),t(lt,[2,60]),t(lt,[2,61]),t(lt,[2,62]),t(lt,[2,63]),t(lt,[2,64]),t(lt,[2,65]),t(lt,[2,67]),t(lt,[2,68]),t(lt,[2,69]),t(lt,[2,70]),t(lt,[2,71]),t(lt,[2,72]),t(lt,[2,73]),t(lt,[2,74]),t(lt,[2,75]),t(lt,[2,76]),t(lt,[2,77]),{41:147,52:[1,148]},{15:[1,149]},{43:[1,150]},t(dt,[2,35]),t(dt,[2,36]),t(dt,[2,37]),t(dt,[2,38]),t(dt,[2,39]),t(dt,[2,40]),t(dt,[2,41]),{1:[2,16]},{1:[2,17]},{1:[2,18]},{1:[2,19]},{15:[1,151]},t(rt,[2,25]),t(nt,[2,45]),t(ht,[2,79]),t(ft,[2,81]),t(lt,[2,31]),t(lt,[2,42]),t(pt,[2,32]),t(pt,[2,33],{15:[1,152]}),t(ut,[2,10]),t(pt,[2,34])],defaultActions:{2:[2,1],3:[2,2],5:[2,8],6:[2,4],7:[2,5],8:[2,6],9:[2,7],16:[2,11],17:[2,3],27:[2,14],85:[2,13],86:[2,15],138:[2,16],139:[2,17],140:[2,18],141:[2,19]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},yt={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),18;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 10;case 5:return this.begin(\"type_directive\"),19;case 6:return this.popState(),this.begin(\"arg_directive\"),16;case 7:return this.popState(),this.popState(),21;case 8:return 20;case 9:return 32;case 10:return 33;case 11:return this.begin(\"acc_title\"),34;case 12:return this.popState(),\"acc_title_value\";case 13:return this.begin(\"acc_descr\"),36;case 14:return this.popState(),\"acc_descr_value\";case 15:this.begin(\"acc_descr_multiline\");break;case 16:this.popState();break;case 17:return\"acc_descr_multiline_value\";case 18:case 21:break;case 19:c;break;case 20:return 15;case 22:return 22;case 23:return 25;case 24:return 26;case 25:return 27;case 26:return 28;case 27:return this.begin(\"person_ext\"),console.log(\"begin person_ext\"),55;case 28:return this.begin(\"person\"),console.log(\"begin person\"),54;case 29:return this.begin(\"system_ext_queue\"),console.log(\"begin system_ext_queue\"),61;case 30:return this.begin(\"system_ext_db\"),console.log(\"begin system_ext_db\"),60;case 31:return this.begin(\"system_ext\"),console.log(\"begin system_ext\"),59;case 32:return this.begin(\"system_queue\"),console.log(\"begin system_queue\"),58;case 33:return this.begin(\"system_db\"),console.log(\"begin system_db\"),57;case 34:return this.begin(\"system\"),console.log(\"begin system\"),56;case 35:return this.begin(\"boundary\"),console.log(\"begin boundary\"),47;case 36:return this.begin(\"enterprise_boundary\"),console.log(\"begin enterprise_boundary\"),44;case 37:return this.begin(\"system_boundary\"),console.log(\"begin system_boundary\"),46;case 38:return this.begin(\"container_ext_queue\"),console.log(\"begin container_ext_queue\"),67;case 39:return this.begin(\"container_ext_db\"),console.log(\"begin container_ext_db\"),66;case 40:return this.begin(\"container_ext\"),console.log(\"begin container_ext\"),65;case 41:return this.begin(\"container_queue\"),console.log(\"begin container_queue\"),64;case 42:return this.begin(\"container_db\"),console.log(\"begin container_db\"),63;case 43:return this.begin(\"container\"),console.log(\"begin container\"),62;case 44:return this.begin(\"container_boundary\"),console.log(\"begin container_boundary\"),48;case 45:return this.begin(\"component_ext_queue\"),console.log(\"begin component_ext_queue\"),73;case 46:return this.begin(\"component_ext_db\"),console.log(\"begin component_ext_db\"),72;case 47:return this.begin(\"component_ext\"),console.log(\"begin component_ext\"),71;case 48:return this.begin(\"component_queue\"),console.log(\"begin component_queue\"),70;case 49:return this.begin(\"component_db\"),console.log(\"begin component_db\"),69;case 50:return this.begin(\"component\"),console.log(\"begin component\"),68;case 51:case 52:return this.begin(\"node\"),console.log(\"begin node\"),49;case 53:return this.begin(\"node_l\"),console.log(\"begin node_l\"),50;case 54:return this.begin(\"node_r\"),console.log(\"begin node_r\"),51;case 55:return this.begin(\"rel\"),console.log(\"begin rel\"),74;case 56:return this.begin(\"birel\"),console.log(\"begin birel\"),75;case 57:case 58:return this.begin(\"rel_u\"),console.log(\"begin rel_u\"),76;case 59:case 60:return this.begin(\"rel_d\"),console.log(\"begin rel_d\"),77;case 61:case 62:return this.begin(\"rel_l\"),console.log(\"begin rel_l\"),78;case 63:case 64:return this.begin(\"rel_r\"),console.log(\"begin rel_r\"),79;case 65:return this.begin(\"rel_b\"),console.log(\"begin rel_b\"),80;case 66:return this.begin(\"rel_index\"),console.log(\"begin rel_index\"),81;case 67:return this.begin(\"update_el_style\"),console.log(\"begin update_el_style\"),82;case 68:return this.begin(\"update_rel_style\"),console.log(\"begin update_rel_style\"),83;case 69:return this.begin(\"update_layout_config\"),console.log(\"begin update_layout_config\"),84;case 70:return\"EOF_IN_STRUCT\";case 71:return console.log(\"begin attribute with ATTRIBUTE_EMPTY\"),this.begin(\"attribute\"),\"ATTRIBUTE_EMPTY\";case 72:console.log(\"begin attribute\"),this.begin(\"attribute\");break;case 73:console.log(\"STOP attribute\"),this.popState(),console.log(\"STOP diagram\"),this.popState();break;case 74:return console.log(\",,\"),90;case 75:console.log(\",\");break;case 76:return console.log(\"ATTRIBUTE_EMPTY\"),90;case 77:console.log(\"begin string\"),this.begin(\"string\");break;case 78:console.log(\"STOP string\"),this.popState();break;case 79:return console.log(\"STR\"),\"STR\";case 80:console.log(\"begin string_kv\"),this.begin(\"string_kv\");break;case 81:return console.log(\"STR_KEY\"),this.begin(\"string_kv_key\"),\"STR_KEY\";case 82:console.log(\"begin string_kv_value\"),this.popState(),this.begin(\"string_kv_value\");break;case 83:return console.log(\"STR_VALUE\"),\"STR_VALUE\";case 84:console.log(\"STOP string_kv_value\"),this.popState(),this.popState();break;case 85:return console.log(\"not STR\"),\"STR\";case 86:return console.log(\"begin boundary block\"),\"LBRACE\";case 87:return console.log(\"STOP boundary block\"),\"RBRACE\";case 88:return\"SPACE\";case 89:return\"EOL\";case 90:return 24}},rules:[/^(?:%%\\{)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:title\\s[^#\\n;]+)/,/^(?:accDescription\\s[^#\\n;]+)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:C4Context\\b)/,/^(?:C4Container\\b)/,/^(?:C4Component\\b)/,/^(?:C4Dynamic\\b)/,/^(?:C4Deployment\\b)/,/^(?:Person_Ext\\b)/,/^(?:Person\\b)/,/^(?:SystemQueue_Ext\\b)/,/^(?:SystemDb_Ext\\b)/,/^(?:System_Ext\\b)/,/^(?:SystemQueue\\b)/,/^(?:SystemDb\\b)/,/^(?:System\\b)/,/^(?:Boundary\\b)/,/^(?:Enterprise_Boundary\\b)/,/^(?:System_Boundary\\b)/,/^(?:ContainerQueue_Ext\\b)/,/^(?:ContainerDb_Ext\\b)/,/^(?:Container_Ext\\b)/,/^(?:ContainerQueue\\b)/,/^(?:ContainerDb\\b)/,/^(?:Container\\b)/,/^(?:Container_Boundary\\b)/,/^(?:ComponentQueue_Ext\\b)/,/^(?:ComponentDb_Ext\\b)/,/^(?:Component_Ext\\b)/,/^(?:ComponentQueue\\b)/,/^(?:ComponentDb\\b)/,/^(?:Component\\b)/,/^(?:Deployment_Node\\b)/,/^(?:Node\\b)/,/^(?:Node_L\\b)/,/^(?:Node_R\\b)/,/^(?:Rel\\b)/,/^(?:BiRel\\b)/,/^(?:Rel_Up\\b)/,/^(?:Rel_U\\b)/,/^(?:Rel_Down\\b)/,/^(?:Rel_D\\b)/,/^(?:Rel_Left\\b)/,/^(?:Rel_L\\b)/,/^(?:Rel_Right\\b)/,/^(?:Rel_R\\b)/,/^(?:Rel_Back\\b)/,/^(?:RelIndex\\b)/,/^(?:UpdateElementStyle\\b)/,/^(?:UpdateRelStyle\\b)/,/^(?:UpdateLayoutConfig\\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*[\"][\"])/,/^(?:[ ]*[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[ ]*[\\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*[\"])/,/^(?:[^\"]+)/,/^(?:[\"])/,/^(?:[^,]+)/,/^(?:\\{)/,/^(?:\\})/,/^(?:[\\s]+)/,/^(?:[\\n\\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},string_kv_value:{rules:[83,84],inclusive:!1},string_kv_key:{rules:[82],inclusive:!1},string_kv:{rules:[81],inclusive:!1},string:{rules:[78,79],inclusive:!1},attribute:{rules:[73,74,75,76,77,80,85],inclusive:!1},update_layout_config:{rules:[70,71,72,73],inclusive:!1},update_rel_style:{rules:[70,71,72,73],inclusive:!1},update_el_style:{rules:[70,71,72,73],inclusive:!1},rel_b:{rules:[70,71,72,73],inclusive:!1},rel_r:{rules:[70,71,72,73],inclusive:!1},rel_l:{rules:[70,71,72,73],inclusive:!1},rel_d:{rules:[70,71,72,73],inclusive:!1},rel_u:{rules:[70,71,72,73],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[70,71,72,73],inclusive:!1},node_r:{rules:[70,71,72,73],inclusive:!1},node_l:{rules:[70,71,72,73],inclusive:!1},node:{rules:[70,71,72,73],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[70,71,72,73],inclusive:!1},component_ext_queue:{rules:[],inclusive:!1},component_ext_db:{rules:[70,71,72,73],inclusive:!1},component_ext:{rules:[70,71,72,73],inclusive:!1},component_queue:{rules:[70,71,72,73],inclusive:!1},component_db:{rules:[70,71,72,73],inclusive:!1},component:{rules:[70,71,72,73],inclusive:!1},container_boundary:{rules:[70,71,72,73],inclusive:!1},container_ext_queue:{rules:[],inclusive:!1},container_ext_db:{rules:[70,71,72,73],inclusive:!1},container_ext:{rules:[70,71,72,73],inclusive:!1},container_queue:{rules:[70,71,72,73],inclusive:!1},container_db:{rules:[70,71,72,73],inclusive:!1},container:{rules:[70,71,72,73],inclusive:!1},birel:{rules:[70,71,72,73],inclusive:!1},system_boundary:{rules:[70,71,72,73],inclusive:!1},enterprise_boundary:{rules:[70,71,72,73],inclusive:!1},boundary:{rules:[70,71,72,73],inclusive:!1},system_ext_queue:{rules:[70,71,72,73],inclusive:!1},system_ext_db:{rules:[70,71,72,73],inclusive:!1},system_ext:{rules:[70,71,72,73],inclusive:!1},system_queue:{rules:[70,71,72,73],inclusive:!1},system_db:{rules:[70,71,72,73],inclusive:!1},system:{rules:[70,71,72,73],inclusive:!1},person_ext:{rules:[70,71,72,73],inclusive:!1},person:{rules:[70,71,72,73],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,86,87,88,89,90],inclusive:!0}}};function mt(){this.yy={}}return gt.lexer=yt,mt.prototype=gt,gt.Parser=mt,new mt}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(555).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},1362:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,7],r=[1,8],i=[1,9],a=[1,10],o=[1,13],s=[1,12],c=[1,16,25],l=[1,20],u=[1,31],h=[1,32],f=[1,33],d=[1,35],p=[1,38],g=[1,36],y=[1,37],m=[1,39],b=[1,40],v=[1,41],_=[1,42],x=[1,45],k=[1,46],w=[1,47],T=[1,48],E=[16,25],C=[1,62],S=[1,63],A=[1,64],M=[1,65],N=[1,66],O=[1,67],D=[1,68],B=[16,25,32,44,45,53,56,57,58,59,60,61,62,67,69],L=[16,25,30,32,44,45,49,53,56,57,58,59,60,61,62,67,69,84,85,86,87],I=[5,8,9,10,11,16,19,23,25],F=[53,84,85,86,87],R=[53,61,62,84,85,86,87],P=[53,56,57,58,59,60,84,85,86,87],j=[16,25,32],z=[1,100],Y={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statments:5,direction:6,directive:7,direction_tb:8,direction_bt:9,direction_rl:10,direction_lr:11,graphConfig:12,openDirective:13,typeDirective:14,closeDirective:15,NEWLINE:16,\":\":17,argDirective:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,CLASS_DIAGRAM:23,statements:24,EOF:25,statement:26,className:27,alphaNumToken:28,classLiteralName:29,GENERICTYPE:30,relationStatement:31,LABEL:32,classStatement:33,methodStatement:34,annotationStatement:35,clickStatement:36,cssClassStatement:37,acc_title:38,acc_title_value:39,acc_descr:40,acc_descr_value:41,acc_descr_multiline_value:42,CLASS:43,STYLE_SEPARATOR:44,STRUCT_START:45,members:46,STRUCT_STOP:47,ANNOTATION_START:48,ANNOTATION_END:49,MEMBER:50,SEPARATOR:51,relation:52,STR:53,relationType:54,lineType:55,AGGREGATION:56,EXTENSION:57,COMPOSITION:58,DEPENDENCY:59,LOLLIPOP:60,LINE:61,DOTTED_LINE:62,CALLBACK:63,LINK:64,LINK_TARGET:65,CLICK:66,CALLBACK_NAME:67,CALLBACK_ARGS:68,HREF:69,CSSCLASS:70,commentToken:71,textToken:72,graphCodeTokens:73,textNoTagsToken:74,TAGSTART:75,TAGEND:76,\"==\":77,\"--\":78,PCT:79,DEFAULT:80,SPACE:81,MINUS:82,keywords:83,UNICODE_TEXT:84,NUM:85,ALPHA:86,BQUOTE_STR:87,$accept:0,$end:1},terminals_:{2:\"error\",5:\"statments\",8:\"direction_tb\",9:\"direction_bt\",10:\"direction_rl\",11:\"direction_lr\",16:\"NEWLINE\",17:\":\",19:\"open_directive\",20:\"type_directive\",21:\"arg_directive\",22:\"close_directive\",23:\"CLASS_DIAGRAM\",25:\"EOF\",30:\"GENERICTYPE\",32:\"LABEL\",38:\"acc_title\",39:\"acc_title_value\",40:\"acc_descr\",41:\"acc_descr_value\",42:\"acc_descr_multiline_value\",43:\"CLASS\",44:\"STYLE_SEPARATOR\",45:\"STRUCT_START\",47:\"STRUCT_STOP\",48:\"ANNOTATION_START\",49:\"ANNOTATION_END\",50:\"MEMBER\",51:\"SEPARATOR\",53:\"STR\",56:\"AGGREGATION\",57:\"EXTENSION\",58:\"COMPOSITION\",59:\"DEPENDENCY\",60:\"LOLLIPOP\",61:\"LINE\",62:\"DOTTED_LINE\",63:\"CALLBACK\",64:\"LINK\",65:\"LINK_TARGET\",66:\"CLICK\",67:\"CALLBACK_NAME\",68:\"CALLBACK_ARGS\",69:\"HREF\",70:\"CSSCLASS\",73:\"graphCodeTokens\",75:\"TAGSTART\",76:\"TAGEND\",77:\"==\",78:\"--\",79:\"PCT\",80:\"DEFAULT\",81:\"SPACE\",82:\"MINUS\",83:\"keywords\",84:\"UNICODE_TEXT\",85:\"NUM\",86:\"ALPHA\",87:\"BQUOTE_STR\"},productions_:[0,[3,1],[3,1],[3,1],[3,2],[6,1],[6,1],[6,1],[6,1],[4,1],[7,4],[7,6],[13,1],[14,1],[18,1],[15,1],[12,4],[24,1],[24,2],[24,3],[27,1],[27,1],[27,2],[27,2],[27,2],[26,1],[26,2],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,2],[26,2],[26,1],[33,2],[33,4],[33,5],[33,7],[35,4],[46,1],[46,2],[34,1],[34,2],[34,1],[34,1],[31,3],[31,4],[31,4],[31,5],[52,3],[52,2],[52,2],[52,1],[54,1],[54,1],[54,1],[54,1],[54,1],[55,1],[55,1],[36,3],[36,4],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[36,3],[36,4],[36,4],[36,5],[37,3],[71,1],[71,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[72,1],[74,1],[74,1],[74,1],[74,1],[28,1],[28,1],[28,1],[29,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setDirection(\"TB\");break;case 6:r.setDirection(\"BT\");break;case 7:r.setDirection(\"RL\");break;case 8:r.setDirection(\"LR\");break;case 12:r.parseDirective(\"%%{\",\"open_directive\");break;case 13:r.parseDirective(a[s],\"type_directive\");break;case 14:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 15:r.parseDirective(\"}%%\",\"close_directive\",\"class\");break;case 20:case 21:this.$=a[s];break;case 22:this.$=a[s-1]+a[s];break;case 23:case 24:this.$=a[s-1]+\"~\"+a[s];break;case 25:r.addRelation(a[s]);break;case 26:a[s-1].title=r.cleanupLabel(a[s]),r.addRelation(a[s-1]);break;case 34:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 35:case 36:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 37:r.addClass(a[s]);break;case 38:r.addClass(a[s-2]),r.setCssClass(a[s-2],a[s]);break;case 39:r.addClass(a[s-3]),r.addMembers(a[s-3],a[s-1]);break;case 40:r.addClass(a[s-5]),r.setCssClass(a[s-5],a[s-3]),r.addMembers(a[s-5],a[s-1]);break;case 41:r.addAnnotation(a[s],a[s-2]);break;case 42:this.$=[a[s]];break;case 43:a[s].push(a[s-1]),this.$=a[s];break;case 44:case 46:case 47:break;case 45:r.addMember(a[s-1],r.cleanupLabel(a[s]));break;case 48:this.$={id1:a[s-2],id2:a[s],relation:a[s-1],relationTitle1:\"none\",relationTitle2:\"none\"};break;case 49:this.$={id1:a[s-3],id2:a[s],relation:a[s-1],relationTitle1:a[s-2],relationTitle2:\"none\"};break;case 50:this.$={id1:a[s-3],id2:a[s],relation:a[s-2],relationTitle1:\"none\",relationTitle2:a[s-1]};break;case 51:this.$={id1:a[s-4],id2:a[s],relation:a[s-2],relationTitle1:a[s-3],relationTitle2:a[s-1]};break;case 52:this.$={type1:a[s-2],type2:a[s],lineType:a[s-1]};break;case 53:this.$={type1:\"none\",type2:a[s],lineType:a[s-1]};break;case 54:this.$={type1:a[s-1],type2:\"none\",lineType:a[s]};break;case 55:this.$={type1:\"none\",type2:\"none\",lineType:a[s]};break;case 56:this.$=r.relationType.AGGREGATION;break;case 57:this.$=r.relationType.EXTENSION;break;case 58:this.$=r.relationType.COMPOSITION;break;case 59:this.$=r.relationType.DEPENDENCY;break;case 60:this.$=r.relationType.LOLLIPOP;break;case 61:this.$=r.lineType.LINE;break;case 62:this.$=r.lineType.DOTTED_LINE;break;case 63:case 69:this.$=a[s-2],r.setClickEvent(a[s-1],a[s]);break;case 64:case 70:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 65:case 73:this.$=a[s-2],r.setLink(a[s-1],a[s]);break;case 66:case 74:this.$=a[s-3],r.setLink(a[s-2],a[s-1],a[s]);break;case 67:case 75:this.$=a[s-3],r.setLink(a[s-2],a[s-1]),r.setTooltip(a[s-2],a[s]);break;case 68:case 76:this.$=a[s-4],r.setLink(a[s-3],a[s-2],a[s]),r.setTooltip(a[s-3],a[s-1]);break;case 71:this.$=a[s-3],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 72:this.$=a[s-4],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setTooltip(a[s-3],a[s]);break;case 77:r.setCssClass(a[s-1],a[s])}},table:[{3:1,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{3:14,4:2,5:e,6:4,7:5,8:n,9:r,10:i,11:a,12:6,13:11,19:o,23:s},{1:[2,9]},t(c,[2,5]),t(c,[2,6]),t(c,[2,7]),t(c,[2,8]),{14:15,20:[1,16]},{16:[1,17]},{20:[2,12]},{1:[2,4]},{15:18,17:[1,19],22:l},t([17,22],[2,13]),{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:21,26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},{16:[1,49]},{18:50,21:[1,51]},{16:[2,15]},{25:[1,52]},{16:[1,53],25:[2,17]},t(E,[2,25],{32:[1,54]}),t(E,[2,27]),t(E,[2,28]),t(E,[2,29]),t(E,[2,30]),t(E,[2,31]),t(E,[2,32]),t(E,[2,33]),{39:[1,55]},{41:[1,56]},t(E,[2,36]),t(E,[2,44],{52:57,54:60,55:61,32:[1,59],53:[1,58],56:C,57:S,58:A,59:M,60:N,61:O,62:D}),{27:69,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,46]),t(E,[2,47]),{28:70,84:x,85:k,86:w},{27:71,28:43,29:44,84:x,85:k,86:w,87:T},{27:72,28:43,29:44,84:x,85:k,86:w,87:T},{27:73,28:43,29:44,84:x,85:k,86:w,87:T},{53:[1,74]},t(B,[2,20],{28:43,29:44,27:75,30:[1,76],84:x,85:k,86:w,87:T}),t(B,[2,21],{30:[1,77]}),t(L,[2,91]),t(L,[2,92]),t(L,[2,93]),t([16,25,30,32,44,45,53,56,57,58,59,60,61,62,67,69],[2,94]),t(I,[2,10]),{15:78,22:l},{22:[2,14]},{1:[2,16]},{6:30,7:29,8:n,9:r,10:i,11:a,13:11,19:o,24:79,25:[2,18],26:22,27:34,28:43,29:44,31:23,33:24,34:25,35:26,36:27,37:28,38:u,40:h,42:f,43:d,48:p,50:g,51:y,63:m,64:b,66:v,70:_,84:x,85:k,86:w,87:T},t(E,[2,26]),t(E,[2,34]),t(E,[2,35]),{27:80,28:43,29:44,53:[1,81],84:x,85:k,86:w,87:T},{52:82,54:60,55:61,56:C,57:S,58:A,59:M,60:N,61:O,62:D},t(E,[2,45]),{55:83,61:O,62:D},t(F,[2,55],{54:84,56:C,57:S,58:A,59:M,60:N}),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,59]),t(R,[2,60]),t(P,[2,61]),t(P,[2,62]),t(E,[2,37],{44:[1,85],45:[1,86]}),{49:[1,87]},{53:[1,88]},{53:[1,89]},{67:[1,90],69:[1,91]},{28:92,84:x,85:k,86:w},t(B,[2,22]),t(B,[2,23]),t(B,[2,24]),{16:[1,93]},{25:[2,19]},t(j,[2,48]),{27:94,28:43,29:44,84:x,85:k,86:w,87:T},{27:95,28:43,29:44,53:[1,96],84:x,85:k,86:w,87:T},t(F,[2,54],{54:97,56:C,57:S,58:A,59:M,60:N}),t(F,[2,53]),{28:98,84:x,85:k,86:w},{46:99,50:z},{27:101,28:43,29:44,84:x,85:k,86:w,87:T},t(E,[2,63],{53:[1,102]}),t(E,[2,65],{53:[1,104],65:[1,103]}),t(E,[2,69],{53:[1,105],68:[1,106]}),t(E,[2,73],{53:[1,108],65:[1,107]}),t(E,[2,77]),t(I,[2,11]),t(j,[2,50]),t(j,[2,49]),{27:109,28:43,29:44,84:x,85:k,86:w,87:T},t(F,[2,52]),t(E,[2,38],{45:[1,110]}),{47:[1,111]},{46:112,47:[2,42],50:z},t(E,[2,41]),t(E,[2,64]),t(E,[2,66]),t(E,[2,67],{65:[1,113]}),t(E,[2,70]),t(E,[2,71],{53:[1,114]}),t(E,[2,74]),t(E,[2,75],{65:[1,115]}),t(j,[2,51]),{46:116,50:z},t(E,[2,39]),{47:[2,43]},t(E,[2,68]),t(E,[2,72]),t(E,[2,76]),{47:[1,117]},t(E,[2,40])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],6:[2,9],13:[2,12],14:[2,4],20:[2,15],51:[2,14],52:[2,16],79:[2,19],112:[2,43]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},U={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),19;case 1:return 8;case 2:return 9;case 3:return 10;case 4:return 11;case 5:return this.begin(\"type_directive\"),20;case 6:return this.popState(),this.begin(\"arg_directive\"),17;case 7:return this.popState(),this.popState(),22;case 8:return 21;case 9:case 10:case 19:case 27:break;case 11:return this.begin(\"acc_title\"),38;case 12:return this.popState(),\"acc_title_value\";case 13:return this.begin(\"acc_descr\"),40;case 14:return this.popState(),\"acc_descr_value\";case 15:this.begin(\"acc_descr_multiline\");break;case 16:case 37:case 40:case 43:case 46:case 49:case 52:this.popState();break;case 17:return\"acc_descr_multiline_value\";case 18:return 16;case 20:case 21:return 23;case 22:return this.begin(\"struct\"),45;case 23:return\"EDGE_STATE\";case 24:return\"EOF_IN_STRUCT\";case 25:return\"OPEN_IN_STRUCT\";case 26:return this.popState(),47;case 28:return\"MEMBER\";case 29:return 43;case 30:return 70;case 31:return 63;case 32:return 64;case 33:return 66;case 34:return 48;case 35:return 49;case 36:this.begin(\"generic\");break;case 38:return\"GENERICTYPE\";case 39:this.begin(\"string\");break;case 41:return\"STR\";case 42:this.begin(\"bqstring\");break;case 44:return\"BQUOTE_STR\";case 45:this.begin(\"href\");break;case 47:return 69;case 48:this.begin(\"callback_name\");break;case 50:this.popState(),this.begin(\"callback_args\");break;case 51:return 67;case 53:return 68;case 54:case 55:case 56:case 57:return 65;case 58:case 59:return 57;case 60:case 61:return 59;case 62:return 58;case 63:return 56;case 64:return 60;case 65:return 61;case 66:return 62;case 67:return 32;case 68:return 44;case 69:return 82;case 70:return\"DOT\";case 71:return\"PLUS\";case 72:return 79;case 73:case 74:return\"EQUALS\";case 75:return 86;case 76:return\"PUNCTUATION\";case 77:return 85;case 78:return 84;case 79:return 81;case 80:return 25}},rules:[/^(?:%%\\{)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)*[^\\n]*(\\r?\\n?)+)/,/^(?:%%[^\\n]*(\\r?\\n)*)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:\\s*(\\r?\\n)+)/,/^(?:\\s+)/,/^(?:classDiagram-v2\\b)/,/^(?:classDiagram\\b)/,/^(?:[{])/,/^(?:\\[\\*\\])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\\n])/,/^(?:[^{}\\n]*)/,/^(?:class\\b)/,/^(?:cssClass\\b)/,/^(?:callback\\b)/,/^(?:link\\b)/,/^(?:click\\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:\\s*<\\|)/,/^(?:\\s*\\|>)/,/^(?:\\s*>)/,/^(?:\\s*<)/,/^(?:\\s*\\*)/,/^(?:\\s*o\\b)/,/^(?:\\s*\\(\\))/,/^(?:--)/,/^(?:\\.\\.)/,/^(?::{1}[^:\\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\\.)/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\\w+)/,/^(?:[!\"#$%&'*+,-.`?\\\\/])/,/^(?:[0-9]+)/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA]|[\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE]|[\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA]|[\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2]|[\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A]|[\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39]|[\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8]|[\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C]|[\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C]|[\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99]|[\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0]|[\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3]|[\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10]|[\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1]|[\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81]|[\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3]|[\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6]|[\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A]|[\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081]|[\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D]|[\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0]|[\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310]|[\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16]|[\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF]|[\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC]|[\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D]|[\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D]|[\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3]|[\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F]|[\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3]|[\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6]|[\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE]|[\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D]|[\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36]|[\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D]|[\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC]|[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF]|[\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC])/,/^(?:\\s)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[16,17],inclusive:!1},acc_descr:{rules:[14],inclusive:!1},acc_title:{rules:[12],inclusive:!1},arg_directive:{rules:[7,8],inclusive:!1},type_directive:{rules:[6,7],inclusive:!1},open_directive:{rules:[5],inclusive:!1},callback_args:{rules:[52,53],inclusive:!1},callback_name:{rules:[49,50,51],inclusive:!1},href:{rules:[46,47],inclusive:!1},struct:{rules:[23,24,25,26,27,28],inclusive:!1},generic:{rules:[37,38],inclusive:!1},bqstring:{rules:[43,44],inclusive:!1},string:{rules:[40,41],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,13,15,18,19,20,21,22,23,29,30,31,32,33,34,35,36,39,42,45,48,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80],inclusive:!0}}};function $(){this.yy={}}return Y.lexer=U,$.prototype=Y,Y.Parser=$,new $}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8218).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},5890:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,23,25,27,29,30,49],i=[1,17],a=[1,18],o=[1,19],s=[1,20],c=[1,21],l=[1,24],u=[1,29],h=[1,30],f=[1,31],d=[1,32],p=[6,9,11,15,20,23,25,27,29,30,42,43,44,45,49],g=[1,45],y=[30,46,47],m=[4,6,9,11,23,25,27,29,30,49],b=[42,43,44,45],v=[22,37],_=[1,64],x={trace:function(){},yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,entityName:17,relSpec:18,role:19,BLOCK_START:20,attributes:21,BLOCK_STOP:22,title:23,title_value:24,acc_title:25,acc_title_value:26,acc_descr:27,acc_descr_value:28,acc_descr_multiline_value:29,ALPHANUM:30,\".\":31,attribute:32,attributeType:33,attributeName:34,attributeKeyType:35,attributeComment:36,ATTRIBUTE_WORD:37,ATTRIBUTE_KEY:38,COMMENT:39,cardinality:40,relType:41,ZERO_OR_ONE:42,ZERO_OR_MORE:43,ONE_OR_MORE:44,ONLY_ONE:45,NON_IDENTIFYING:46,IDENTIFYING:47,WORD:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,$accept:0,$end:1},terminals_:{2:\"error\",4:\"ER_DIAGRAM\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",20:\"BLOCK_START\",22:\"BLOCK_STOP\",23:\"title\",24:\"title_value\",25:\"acc_title\",26:\"acc_title_value\",27:\"acc_descr\",28:\"acc_descr_value\",29:\"acc_descr_multiline_value\",30:\"ALPHANUM\",31:\".\",37:\"ATTRIBUTE_WORD\",38:\"ATTRIBUTE_KEY\",39:\"COMMENT\",42:\"ZERO_OR_ONE\",43:\"ZERO_OR_MORE\",44:\"ONE_OR_MORE\",45:\"ONLY_ONE\",46:\"NON_IDENTIFYING\",47:\"IDENTIFYING\",48:\"WORD\",49:\"open_directive\",50:\"type_directive\",51:\"arg_directive\",52:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[10,2],[10,2],[10,2],[10,1],[17,1],[17,3],[21,1],[21,2],[32,2],[32,3],[32,3],[32,4],[33,1],[34,1],[35,1],[36,1],[18,3],[40,1],[40,1],[40,1],[40,1],[41,1],[41,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:break;case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:case 20:case 28:case 29:case 30:case 40:this.$=a[s];break;case 12:r.addEntity(a[s-4]),r.addEntity(a[s-2]),r.addRelationship(a[s-4],a[s],a[s-2],a[s-3]);break;case 13:r.addEntity(a[s-3]),r.addAttributes(a[s-3],a[s-1]);break;case 14:r.addEntity(a[s-2]);break;case 15:r.addEntity(a[s]);break;case 16:case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 21:this.$=a[s-2]+a[s-1]+a[s];break;case 22:this.$=[a[s]];break;case 23:a[s].push(a[s-1]),this.$=a[s];break;case 24:this.$={attributeType:a[s-1],attributeName:a[s]};break;case 25:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeKeyType:a[s]};break;case 26:this.$={attributeType:a[s-2],attributeName:a[s-1],attributeComment:a[s]};break;case 27:this.$={attributeType:a[s-3],attributeName:a[s-2],attributeKeyType:a[s-1],attributeComment:a[s]};break;case 31:case 39:this.$=a[s].replace(/\"/g,\"\");break;case 32:this.$={cardA:a[s],relType:a[s-1],cardB:a[s-2]};break;case 33:this.$=r.Cardinality.ZERO_OR_ONE;break;case 34:this.$=r.Cardinality.ZERO_OR_MORE;break;case 35:this.$=r.Cardinality.ONE_OR_MORE;break;case 36:this.$=r.Cardinality.ONLY_ONE;break;case 37:this.$=r.Identification.NON_IDENTIFYING;break;case 38:this.$=r.Identification.IDENTIFYING;break;case 41:r.parseDirective(\"%%{\",\"open_directive\");break;case 42:r.parseDirective(a[s],\"type_directive\");break;case 43:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 44:r.parseDirective(\"}%%\",\"close_directive\",\"er\")}},table:[{3:1,4:e,7:3,12:4,49:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,49:n},{13:8,50:[1,9]},{50:[2,41]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},{1:[2,2]},{14:22,15:[1,23],52:l},t([15,52],[2,42]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:15,10:25,12:4,17:16,23:i,25:a,27:o,29:s,30:c,49:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),t(r,[2,15],{18:26,40:28,20:[1,27],42:u,43:h,44:f,45:d}),{24:[1,33]},{26:[1,34]},{28:[1,35]},t(r,[2,19]),t(p,[2,20],{31:[1,36]}),{11:[1,37]},{16:38,51:[1,39]},{11:[2,44]},t(r,[2,5]),{17:40,30:c},{21:41,22:[1,42],32:43,33:44,37:g},{41:46,46:[1,47],47:[1,48]},t(y,[2,33]),t(y,[2,34]),t(y,[2,35]),t(y,[2,36]),t(r,[2,16]),t(r,[2,17]),t(r,[2,18]),{17:49,30:c},t(m,[2,9]),{14:50,52:l},{52:[2,43]},{15:[1,51]},{22:[1,52]},t(r,[2,14]),{21:53,22:[2,22],32:43,33:44,37:g},{34:54,37:[1,55]},{37:[2,28]},{40:56,42:u,43:h,44:f,45:d},t(b,[2,37]),t(b,[2,38]),t(p,[2,21]),{11:[1,57]},{19:58,30:[1,60],48:[1,59]},t(r,[2,13]),{22:[2,23]},t(v,[2,24],{35:61,36:62,38:[1,63],39:_}),t([22,37,38,39],[2,29]),{30:[2,32]},t(m,[2,10]),t(r,[2,12]),t(r,[2,39]),t(r,[2,40]),t(v,[2,25],{36:65,39:_}),t(v,[2,26]),t([22,37,39],[2,30]),t(v,[2,31]),t(v,[2,27])],defaultActions:{5:[2,41],7:[2,2],24:[2,44],39:[2,43],45:[2,28],53:[2,23],56:[2,32]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},k={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"acc_title\"),25;case 1:return this.popState(),\"acc_title_value\";case 2:return this.begin(\"acc_descr\"),27;case 3:return this.popState(),\"acc_descr_value\";case 4:this.begin(\"acc_descr_multiline\");break;case 5:this.popState();break;case 6:return\"acc_descr_multiline_value\";case 7:return this.begin(\"open_directive\"),49;case 8:return this.begin(\"type_directive\"),50;case 9:return this.popState(),this.begin(\"arg_directive\"),15;case 10:return this.popState(),this.popState(),52;case 11:return 51;case 12:case 13:case 15:case 20:case 25:break;case 14:return 11;case 16:return 9;case 17:return 48;case 18:return 4;case 19:return this.begin(\"block\"),20;case 21:return 38;case 22:case 23:return 37;case 24:return 39;case 26:return this.popState(),22;case 27:case 40:return e.yytext[0];case 28:case 32:return 42;case 29:case 33:return 43;case 30:case 34:return 44;case 31:return 45;case 35:case 37:case 38:return 46;case 36:return 47;case 39:return 30;case 41:return 6}},rules:[/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:[\\s]+)/i,/^(?:\"[^\"]*\")/i,/^(?:erDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\s+)/i,/^(?:\\b((?:PK)|(?:FK))\\b)/i,/^(?:(.*?)[~](.*?)*[~])/i,/^(?:[A-Za-z][A-Za-z0-9\\-_\\[\\]]*)/i,/^(?:\"[^\"]*\")/i,/^(?:[\\n]+)/i,/^(?:\\})/i,/^(?:.)/i,/^(?:\\|o\\b)/i,/^(?:\\}o\\b)/i,/^(?:\\}\\|)/i,/^(?:\\|\\|)/i,/^(?:o\\|)/i,/^(?:o\\{)/i,/^(?:\\|\\{)/i,/^(?:\\.\\.)/i,/^(?:--)/i,/^(?:\\.-)/i,/^(?:-\\.)/i,/^(?:[A-Za-z][A-Za-z0-9\\-_]*)/i,/^(?:.)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},open_directive:{rules:[8],inclusive:!1},type_directive:{rules:[9,10],inclusive:!1},arg_directive:{rules:[10,11],inclusive:!1},block:{rules:[20,21,22,23,24,25,26,27],inclusive:!1},INITIAL:{rules:[0,2,4,7,12,13,14,15,16,17,18,19,28,29,30,31,32,33,34,35,36,37,38,39,40,41],inclusive:!0}}};function w(){this.yy={}}return x.lexer=k,w.prototype=x,x.Parser=w,new w}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8009).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3602:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,9],n=[1,7],r=[1,6],i=[1,8],a=[1,20,21,22,23,38,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],o=[2,10],s=[1,20],c=[1,21],l=[1,22],u=[1,23],h=[1,30],f=[1,32],d=[1,33],p=[1,34],g=[1,62],y=[1,48],m=[1,52],b=[1,36],v=[1,37],_=[1,38],x=[1,39],k=[1,40],w=[1,56],T=[1,63],E=[1,51],C=[1,53],S=[1,55],A=[1,59],M=[1,60],N=[1,41],O=[1,42],D=[1,43],B=[1,44],L=[1,61],I=[1,50],F=[1,54],R=[1,57],P=[1,58],j=[1,49],z=[1,66],Y=[1,71],U=[1,20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],$=[1,75],W=[1,74],q=[1,76],H=[20,21,23,81,82],V=[1,99],G=[1,104],X=[1,107],Z=[1,108],Q=[1,101],K=[1,106],J=[1,109],tt=[1,102],et=[1,114],nt=[1,113],rt=[1,103],it=[1,105],at=[1,110],ot=[1,111],st=[1,112],ct=[1,115],lt=[20,21,22,23,81,82],ut=[20,21,22,23,53,81,82],ht=[20,21,22,23,40,52,53,55,57,59,61,63,65,66,67,69,71,73,74,76,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],ft=[20,21,23],dt=[20,21,23,52,66,67,81,82,91,95,105,106,109,111,112,122,123,124,125,126,127],pt=[1,12,20,21,22,23,24,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],gt=[52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],yt=[1,149],mt=[1,157],bt=[1,158],vt=[1,159],_t=[1,160],xt=[1,144],kt=[1,145],wt=[1,141],Tt=[1,152],Et=[1,153],Ct=[1,154],St=[1,155],At=[1,156],Mt=[1,161],Nt=[1,162],Ot=[1,147],Dt=[1,150],Bt=[1,146],Lt=[1,143],It=[20,21,22,23,38,42,44,46,48,52,66,67,86,87,88,89,90,91,95,105,106,109,111,112,118,119,120,121,122,123,124,125,126,127],Ft=[1,165],Rt=[20,21,22,23,26,52,66,67,91,105,106,109,111,112,122,123,124,125,126,127],Pt=[20,21,22,23,24,26,38,40,41,42,52,56,58,60,62,64,66,67,68,70,72,73,75,77,81,82,86,87,88,89,90,91,92,95,105,106,109,111,112,113,114,122,123,124,125,126,127],jt=[12,21,22,24],zt=[22,106],Yt=[1,250],Ut=[1,245],$t=[1,246],Wt=[1,254],qt=[1,251],Ht=[1,248],Vt=[1,247],Gt=[1,249],Xt=[1,252],Zt=[1,253],Qt=[1,255],Kt=[1,273],Jt=[20,21,23,106],te=[20,21,22,23,66,67,86,102,105,106,109,110,111,112,113],ee={trace:function(){},yy:{},symbols_:{error:2,start:3,mermaidDoc:4,directive:5,openDirective:6,typeDirective:7,closeDirective:8,separator:9,\":\":10,argDirective:11,open_directive:12,type_directive:13,arg_directive:14,close_directive:15,graphConfig:16,document:17,line:18,statement:19,SEMI:20,NEWLINE:21,SPACE:22,EOF:23,GRAPH:24,NODIR:25,DIR:26,FirstStmtSeperator:27,ending:28,endToken:29,spaceList:30,spaceListNewline:31,verticeStatement:32,styleStatement:33,linkStyleStatement:34,classDefStatement:35,classStatement:36,clickStatement:37,subgraph:38,text:39,SQS:40,SQE:41,end:42,direction:43,acc_title:44,acc_title_value:45,acc_descr:46,acc_descr_value:47,acc_descr_multiline_value:48,link:49,node:50,vertex:51,AMP:52,STYLE_SEPARATOR:53,idString:54,DOUBLECIRCLESTART:55,DOUBLECIRCLEEND:56,PS:57,PE:58,\"(-\":59,\"-)\":60,STADIUMSTART:61,STADIUMEND:62,SUBROUTINESTART:63,SUBROUTINEEND:64,VERTEX_WITH_PROPS_START:65,ALPHA:66,COLON:67,PIPE:68,CYLINDERSTART:69,CYLINDEREND:70,DIAMOND_START:71,DIAMOND_STOP:72,TAGEND:73,TRAPSTART:74,TRAPEND:75,INVTRAPSTART:76,INVTRAPEND:77,linkStatement:78,arrowText:79,TESTSTR:80,START_LINK:81,LINK:82,textToken:83,STR:84,keywords:85,STYLE:86,LINKSTYLE:87,CLASSDEF:88,CLASS:89,CLICK:90,DOWN:91,UP:92,textNoTags:93,textNoTagsToken:94,DEFAULT:95,stylesOpt:96,alphaNum:97,CALLBACKNAME:98,CALLBACKARGS:99,HREF:100,LINK_TARGET:101,HEX:102,numList:103,INTERPOLATE:104,NUM:105,COMMA:106,style:107,styleComponent:108,MINUS:109,UNIT:110,BRKT:111,DOT:112,PCT:113,TAGSTART:114,alphaNumToken:115,idStringToken:116,alphaNumStatement:117,direction_tb:118,direction_bt:119,direction_rl:120,direction_lr:121,PUNCTUATION:122,UNICODE_TEXT:123,PLUS:124,EQUALS:125,MULT:126,UNDERSCORE:127,graphCodeTokens:128,ARROW_CROSS:129,ARROW_POINT:130,ARROW_CIRCLE:131,ARROW_OPEN:132,QUOTE:133,$accept:0,$end:1},terminals_:{2:\"error\",10:\":\",12:\"open_directive\",13:\"type_directive\",14:\"arg_directive\",15:\"close_directive\",20:\"SEMI\",21:\"NEWLINE\",22:\"SPACE\",23:\"EOF\",24:\"GRAPH\",25:\"NODIR\",26:\"DIR\",38:\"subgraph\",40:\"SQS\",41:\"SQE\",42:\"end\",44:\"acc_title\",45:\"acc_title_value\",46:\"acc_descr\",47:\"acc_descr_value\",48:\"acc_descr_multiline_value\",52:\"AMP\",53:\"STYLE_SEPARATOR\",55:\"DOUBLECIRCLESTART\",56:\"DOUBLECIRCLEEND\",57:\"PS\",58:\"PE\",59:\"(-\",60:\"-)\",61:\"STADIUMSTART\",62:\"STADIUMEND\",63:\"SUBROUTINESTART\",64:\"SUBROUTINEEND\",65:\"VERTEX_WITH_PROPS_START\",66:\"ALPHA\",67:\"COLON\",68:\"PIPE\",69:\"CYLINDERSTART\",70:\"CYLINDEREND\",71:\"DIAMOND_START\",72:\"DIAMOND_STOP\",73:\"TAGEND\",74:\"TRAPSTART\",75:\"TRAPEND\",76:\"INVTRAPSTART\",77:\"INVTRAPEND\",80:\"TESTSTR\",81:\"START_LINK\",82:\"LINK\",84:\"STR\",86:\"STYLE\",87:\"LINKSTYLE\",88:\"CLASSDEF\",89:\"CLASS\",90:\"CLICK\",91:\"DOWN\",92:\"UP\",95:\"DEFAULT\",98:\"CALLBACKNAME\",99:\"CALLBACKARGS\",100:\"HREF\",101:\"LINK_TARGET\",102:\"HEX\",104:\"INTERPOLATE\",105:\"NUM\",106:\"COMMA\",109:\"MINUS\",110:\"UNIT\",111:\"BRKT\",112:\"DOT\",113:\"PCT\",114:\"TAGSTART\",118:\"direction_tb\",119:\"direction_bt\",120:\"direction_rl\",121:\"direction_lr\",122:\"PUNCTUATION\",123:\"UNICODE_TEXT\",124:\"PLUS\",125:\"EQUALS\",126:\"MULT\",127:\"UNDERSCORE\",129:\"ARROW_CROSS\",130:\"ARROW_POINT\",131:\"ARROW_CIRCLE\",132:\"ARROW_OPEN\",133:\"QUOTE\"},productions_:[0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[19,2],[19,2],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[50,1],[50,5],[50,3],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,8],[51,4],[51,4],[51,4],[51,6],[51,4],[51,4],[51,4],[51,4],[51,4],[51,1],[49,2],[49,3],[49,3],[49,1],[49,3],[78,1],[79,3],[39,1],[39,2],[39,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[93,1],[93,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[103,1],[103,3],[96,1],[96,3],[107,1],[107,2],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[83,1],[83,1],[83,1],[83,1],[83,1],[83,1],[94,1],[94,1],[94,1],[94,1],[54,1],[54,2],[97,1],[97,2],[117,1],[117,1],[117,1],[117,1],[43,1],[43,1],[43,1],[43,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[115,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[116,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1],[128,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.parseDirective(\"%%{\",\"open_directive\");break;case 6:r.parseDirective(a[s],\"type_directive\");break;case 7:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 8:r.parseDirective(\"}%%\",\"close_directive\",\"flowchart\");break;case 10:case 36:case 37:case 38:case 39:case 40:this.$=[];break;case 11:a[s]!==[]&&a[s-1].push(a[s]),this.$=a[s-1];break;case 12:case 82:case 84:case 96:case 152:case 154:case 155:case 78:case 150:this.$=a[s];break;case 19:r.setDirection(\"TB\"),this.$=\"TB\";break;case 20:r.setDirection(a[s-1]),this.$=a[s-1];break;case 35:this.$=a[s-1].nodes;break;case 41:this.$=r.addSubGraph(a[s-6],a[s-1],a[s-4]);break;case 42:this.$=r.addSubGraph(a[s-3],a[s-1],a[s-3]);break;case 43:this.$=r.addSubGraph(void 0,a[s-1],void 0);break;case 45:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 46:case 47:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 51:r.addLink(a[s-2].stmt,a[s],a[s-1]),this.$={stmt:a[s],nodes:a[s].concat(a[s-2].nodes)};break;case 52:r.addLink(a[s-3].stmt,a[s-1],a[s-2]),this.$={stmt:a[s-1],nodes:a[s-1].concat(a[s-3].nodes)};break;case 53:this.$={stmt:a[s-1],nodes:a[s-1]};break;case 54:this.$={stmt:a[s],nodes:a[s]};break;case 55:case 123:case 125:this.$=[a[s]];break;case 56:this.$=a[s-4].concat(a[s]);break;case 57:this.$=[a[s-2]],r.setClass(a[s-2],a[s]);break;case 58:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"square\");break;case 59:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"doublecircle\");break;case 60:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"circle\");break;case 61:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"ellipse\");break;case 62:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"stadium\");break;case 63:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"subroutine\");break;case 64:this.$=a[s-7],r.addVertex(a[s-7],a[s-1],\"rect\",void 0,void 0,void 0,Object.fromEntries([[a[s-5],a[s-3]]]));break;case 65:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"cylinder\");break;case 66:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"round\");break;case 67:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"diamond\");break;case 68:this.$=a[s-5],r.addVertex(a[s-5],a[s-2],\"hexagon\");break;case 69:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"odd\");break;case 70:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"trapezoid\");break;case 71:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"inv_trapezoid\");break;case 72:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_right\");break;case 73:this.$=a[s-3],r.addVertex(a[s-3],a[s-1],\"lean_left\");break;case 74:this.$=a[s],r.addVertex(a[s]);break;case 75:a[s-1].text=a[s],this.$=a[s-1];break;case 76:case 77:a[s-2].text=a[s-1],this.$=a[s-2];break;case 79:var c=r.destructLink(a[s],a[s-2]);this.$={type:c.type,stroke:c.stroke,length:c.length,text:a[s-1]};break;case 80:c=r.destructLink(a[s]),this.$={type:c.type,stroke:c.stroke,length:c.length};break;case 81:this.$=a[s-1];break;case 83:case 97:case 153:case 151:this.$=a[s-1]+\"\"+a[s];break;case 98:case 99:this.$=a[s-4],r.addClass(a[s-2],a[s]);break;case 100:this.$=a[s-4],r.setClass(a[s-2],a[s]);break;case 101:case 109:this.$=a[s-1],r.setClickEvent(a[s-1],a[s]);break;case 102:case 110:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 103:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 104:this.$=a[s-4],r.setClickEvent(a[s-4],a[s-3],a[s-2]),r.setTooltip(a[s-4],a[s]);break;case 105:case 111:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 106:case 112:this.$=a[s-3],r.setLink(a[s-3],a[s-2]),r.setTooltip(a[s-3],a[s]);break;case 107:case 113:this.$=a[s-3],r.setLink(a[s-3],a[s-2],a[s]);break;case 108:case 114:this.$=a[s-5],r.setLink(a[s-5],a[s-4],a[s]),r.setTooltip(a[s-5],a[s-2]);break;case 115:this.$=a[s-4],r.addVertex(a[s-2],void 0,void 0,a[s]);break;case 116:case 118:this.$=a[s-4],r.updateLink(a[s-2],a[s]);break;case 117:this.$=a[s-4],r.updateLink([a[s-2]],a[s]);break;case 119:this.$=a[s-8],r.updateLinkInterpolate([a[s-6]],a[s-2]),r.updateLink([a[s-6]],a[s]);break;case 120:this.$=a[s-8],r.updateLinkInterpolate(a[s-6],a[s-2]),r.updateLink(a[s-6],a[s]);break;case 121:this.$=a[s-6],r.updateLinkInterpolate([a[s-4]],a[s]);break;case 122:this.$=a[s-6],r.updateLinkInterpolate(a[s-4],a[s]);break;case 124:case 126:a[s-2].push(a[s]),this.$=a[s-2];break;case 128:this.$=a[s-1]+a[s];break;case 156:this.$=\"v\";break;case 157:this.$=\"-\";break;case 158:this.$={stmt:\"dir\",value:\"TB\"};break;case 159:this.$={stmt:\"dir\",value:\"BT\"};break;case 160:this.$={stmt:\"dir\",value:\"RL\"};break;case 161:this.$={stmt:\"dir\",value:\"LR\"}}},table:[{3:1,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:e,16:4,21:n,22:r,24:i},t(a,o,{17:11}),{7:12,13:[1,13]},{16:14,21:n,22:r,24:i},{16:15,21:n,22:r,24:i},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{8:64,10:[1,65],15:z},t([10,15],[2,6]),t(a,[2,17]),t(a,[2,18]),t(a,[2,19]),{20:[1,68],21:[1,69],22:Y,27:67,30:70},t(U,[2,11]),t(U,[2,12]),t(U,[2,13]),t(U,[2,14]),t(U,[2,15]),t(U,[2,16]),{9:72,20:$,21:W,23:q,49:73,78:77,81:[1,78],82:[1,79]},{9:80,20:$,21:W,23:q},{9:81,20:$,21:W,23:q},{9:82,20:$,21:W,23:q},{9:83,20:$,21:W,23:q},{9:84,20:$,21:W,23:q},{9:86,20:$,21:W,22:[1,85],23:q},t(U,[2,44]),{45:[1,87]},{47:[1,88]},t(U,[2,47]),t(H,[2,54],{30:89,22:Y}),{22:[1,90]},{22:[1,91]},{22:[1,92]},{22:[1,93]},{26:V,52:G,66:X,67:Z,84:[1,97],91:Q,97:96,98:[1,94],100:[1,95],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(U,[2,158]),t(U,[2,159]),t(U,[2,160]),t(U,[2,161]),t(lt,[2,55],{53:[1,116]}),t(ut,[2,74],{116:129,40:[1,117],52:g,55:[1,118],57:[1,119],59:[1,120],61:[1,121],63:[1,122],65:[1,123],66:y,67:m,69:[1,124],71:[1,125],73:[1,126],74:[1,127],76:[1,128],91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),t(ht,[2,150]),t(ht,[2,175]),t(ht,[2,176]),t(ht,[2,177]),t(ht,[2,178]),t(ht,[2,179]),t(ht,[2,180]),t(ht,[2,181]),t(ht,[2,182]),t(ht,[2,183]),t(ht,[2,184]),t(ht,[2,185]),t(ht,[2,186]),t(ht,[2,187]),t(ht,[2,188]),t(ht,[2,189]),t(ht,[2,190]),{9:130,20:$,21:W,23:q},{11:131,14:[1,132]},t(ft,[2,8]),t(a,[2,20]),t(a,[2,26]),t(a,[2,27]),{21:[1,133]},t(dt,[2,34],{30:134,22:Y}),t(U,[2,35]),{50:135,51:45,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},t(pt,[2,48]),t(pt,[2,49]),t(pt,[2,50]),t(gt,[2,78],{79:136,68:[1,138],80:[1,137]}),{22:yt,24:mt,26:bt,38:vt,39:139,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t([52,66,67,68,80,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,80]),t(U,[2,36]),t(U,[2,37]),t(U,[2,38]),t(U,[2,39]),t(U,[2,40]),{22:yt,24:mt,26:bt,38:vt,39:163,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:164}),t(U,[2,45]),t(U,[2,46]),t(H,[2,53],{52:Ft}),{26:V,52:G,66:X,67:Z,91:Q,97:166,102:[1,167],105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{95:[1,168],103:169,105:[1,170]},{26:V,52:G,66:X,67:Z,91:Q,95:[1,171],97:172,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:173,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,101],{22:[1,174],99:[1,175]}),t(ft,[2,105],{22:[1,176]}),t(ft,[2,109],{115:100,117:178,22:[1,177],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,111],{22:[1,179]}),t(Rt,[2,152]),t(Rt,[2,154]),t(Rt,[2,155]),t(Rt,[2,156]),t(Rt,[2,157]),t(Pt,[2,162]),t(Pt,[2,163]),t(Pt,[2,164]),t(Pt,[2,165]),t(Pt,[2,166]),t(Pt,[2,167]),t(Pt,[2,168]),t(Pt,[2,169]),t(Pt,[2,170]),t(Pt,[2,171]),t(Pt,[2,172]),t(Pt,[2,173]),t(Pt,[2,174]),{52:g,54:180,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:yt,24:mt,26:bt,38:vt,39:181,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:182,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:184,42:_t,52:G,57:[1,183],66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:185,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:186,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:187,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{66:[1,188]},{22:yt,24:mt,26:bt,38:vt,39:189,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:190,42:_t,52:G,66:X,67:Z,71:[1,191],73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:192,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:193,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:194,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ht,[2,151]),t(jt,[2,3]),{8:195,15:z},{15:[2,7]},t(a,[2,28]),t(dt,[2,33]),t(H,[2,51],{30:196,22:Y}),t(gt,[2,75],{22:[1,197]}),{22:[1,198]},{22:yt,24:mt,26:bt,38:vt,39:199,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,81:kt,82:[1,200],83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(Pt,[2,82]),t(Pt,[2,84]),t(Pt,[2,140]),t(Pt,[2,141]),t(Pt,[2,142]),t(Pt,[2,143]),t(Pt,[2,144]),t(Pt,[2,145]),t(Pt,[2,146]),t(Pt,[2,147]),t(Pt,[2,148]),t(Pt,[2,149]),t(Pt,[2,85]),t(Pt,[2,86]),t(Pt,[2,87]),t(Pt,[2,88]),t(Pt,[2,89]),t(Pt,[2,90]),t(Pt,[2,91]),t(Pt,[2,92]),t(Pt,[2,93]),t(Pt,[2,94]),t(Pt,[2,95]),{9:203,20:$,21:W,22:yt,23:q,24:mt,26:bt,38:vt,40:[1,202],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,204],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Y,30:205},{22:[1,206],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,207]},{22:[1,208]},{22:[1,209],106:[1,210]},t(zt,[2,123]),{22:[1,211]},{22:[1,212],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:[1,213],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,115:100,117:178,122:rt,123:it,124:at,125:ot,126:st,127:ct},{84:[1,214]},t(ft,[2,103],{22:[1,215]}),{84:[1,216],101:[1,217]},{84:[1,218]},t(Rt,[2,153]),{84:[1,219],101:[1,220]},t(lt,[2,57],{116:129,52:g,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,122:L,123:I,124:F,125:R,126:P,127:j}),{22:yt,24:mt,26:bt,38:vt,41:[1,221],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,56:[1,222],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:223,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,224],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,60:[1,225],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,62:[1,226],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,64:[1,227],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{67:[1,228]},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,70:[1,229],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,230],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,39:231,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,41:[1,232],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,233],77:[1,234],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,73:xt,75:[1,236],77:[1,235],81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{9:237,20:$,21:W,23:q},t(H,[2,52],{52:Ft}),t(gt,[2,77]),t(gt,[2,76]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,68:[1,238],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(gt,[2,79]),t(Pt,[2,83]),{22:yt,24:mt,26:bt,38:vt,39:239,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(It,o,{17:240}),t(U,[2,43]),{51:241,52:g,54:46,66:y,67:m,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:242,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:256,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:257,102:qt,104:[1,258],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:259,102:qt,104:[1,260],105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{105:[1,261]},{22:Yt,66:Ut,67:$t,86:Wt,96:262,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:263,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{26:V,52:G,66:X,67:Z,91:Q,97:264,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,102]),{84:[1,265]},t(ft,[2,106],{22:[1,266]}),t(ft,[2,107]),t(ft,[2,110]),t(ft,[2,112],{22:[1,267]}),t(ft,[2,113]),t(ut,[2,58]),t(ut,[2,59]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,58:[1,268],66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,66]),t(ut,[2,61]),t(ut,[2,62]),t(ut,[2,63]),{66:[1,269]},t(ut,[2,65]),t(ut,[2,67]),{22:yt,24:mt,26:bt,38:vt,42:_t,52:G,66:X,67:Z,72:[1,270],73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,69]),t(ut,[2,70]),t(ut,[2,72]),t(ut,[2,71]),t(ut,[2,73]),t(jt,[2,4]),t([22,52,66,67,91,95,105,106,109,111,112,122,123,124,125,126,127],[2,81]),{22:yt,24:mt,26:bt,38:vt,41:[1,271],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,272],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},t(lt,[2,56]),t(ft,[2,115],{106:Kt}),t(Jt,[2,125],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(te,[2,127]),t(te,[2,129]),t(te,[2,130]),t(te,[2,131]),t(te,[2,132]),t(te,[2,133]),t(te,[2,134]),t(te,[2,135]),t(te,[2,136]),t(te,[2,137]),t(te,[2,138]),t(te,[2,139]),t(ft,[2,116],{106:Kt}),t(ft,[2,117],{106:Kt}),{22:[1,275]},t(ft,[2,118],{106:Kt}),{22:[1,276]},t(zt,[2,124]),t(ft,[2,98],{106:Kt}),t(ft,[2,99],{106:Kt}),t(ft,[2,100],{115:100,117:178,26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,104]),{101:[1,277]},{101:[1,278]},{58:[1,279]},{68:[1,280]},{72:[1,281]},{9:282,20:$,21:W,23:q},t(U,[2,42]),{22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,107:283,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(te,[2,128]),{26:V,52:G,66:X,67:Z,91:Q,97:284,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},{26:V,52:G,66:X,67:Z,91:Q,97:285,105:K,106:J,109:tt,111:et,112:nt,115:100,117:98,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ft,[2,108]),t(ft,[2,114]),t(ut,[2,60]),{22:yt,24:mt,26:bt,38:vt,39:286,42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:140,84:wt,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},t(ut,[2,68]),t(It,o,{17:287}),t(Jt,[2,126],{108:274,22:Yt,66:Ut,67:$t,86:Wt,102:qt,105:Ht,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt}),t(ft,[2,121],{115:100,117:178,22:[1,288],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),t(ft,[2,122],{115:100,117:178,22:[1,289],26:V,52:G,66:X,67:Z,91:Q,105:K,106:J,109:tt,111:et,112:nt,122:rt,123:it,124:at,125:ot,126:st,127:ct}),{22:yt,24:mt,26:bt,38:vt,41:[1,290],42:_t,52:G,66:X,67:Z,73:xt,81:kt,83:201,85:151,86:Tt,87:Et,88:Ct,89:St,90:At,91:Mt,92:Nt,94:142,95:Ot,105:K,106:J,109:Dt,111:et,112:nt,113:Bt,114:Lt,115:148,122:rt,123:it,124:at,125:ot,126:st,127:ct},{18:18,19:19,20:s,21:c,22:l,23:u,32:24,33:25,34:26,35:27,36:28,37:29,38:h,42:[1,291],43:31,44:f,46:d,48:p,50:35,51:45,52:g,54:46,66:y,67:m,86:b,87:v,88:_,89:x,90:k,91:w,95:T,105:E,106:C,109:S,111:A,112:M,116:47,118:N,119:O,120:D,121:B,122:L,123:I,124:F,125:R,126:P,127:j},{22:Yt,66:Ut,67:$t,86:Wt,96:292,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},{22:Yt,66:Ut,67:$t,86:Wt,96:293,102:qt,105:Ht,107:243,108:244,109:Vt,110:Gt,111:Xt,112:Zt,113:Qt},t(ut,[2,64]),t(U,[2,41]),t(ft,[2,119],{106:Kt}),t(ft,[2,120],{106:Kt})],defaultActions:{2:[2,1],9:[2,5],10:[2,2],132:[2,7]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},ne={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),12;case 1:return this.begin(\"type_directive\"),13;case 2:return this.popState(),this.begin(\"arg_directive\"),10;case 3:return this.popState(),this.popState(),15;case 4:return 14;case 5:case 6:break;case 7:return this.begin(\"acc_title\"),44;case 8:return this.popState(),\"acc_title_value\";case 9:return this.begin(\"acc_descr\"),46;case 10:return this.popState(),\"acc_descr_value\";case 11:this.begin(\"acc_descr_multiline\");break;case 12:case 15:case 24:case 27:case 30:case 33:this.popState();break;case 13:return\"acc_descr_multiline_value\";case 14:this.begin(\"string\");break;case 16:return\"STR\";case 17:return 86;case 18:return 95;case 19:return 87;case 20:return 104;case 21:return 88;case 22:return 89;case 23:this.begin(\"href\");break;case 25:return 100;case 26:this.begin(\"callbackname\");break;case 28:this.popState(),this.begin(\"callbackargs\");break;case 29:return 98;case 31:return 99;case 32:this.begin(\"click\");break;case 34:return 90;case 35:case 36:return t.lex.firstGraph()&&this.begin(\"dir\"),24;case 37:return 38;case 38:return 42;case 39:case 40:case 41:case 42:return 101;case 43:return this.popState(),25;case 44:case 45:case 46:case 47:case 48:case 49:case 50:case 51:case 52:case 53:return this.popState(),26;case 54:return 118;case 55:return 119;case 56:return 120;case 57:return 121;case 58:return 105;case 59:return 111;case 60:return 53;case 61:return 67;case 62:return 52;case 63:return 20;case 64:return 106;case 65:return 126;case 66:case 67:case 68:return 82;case 69:case 70:case 71:return 81;case 72:return 59;case 73:return 60;case 74:return 61;case 75:return 62;case 76:return 63;case 77:return 64;case 78:return 65;case 79:return 69;case 80:return 70;case 81:return 55;case 82:return 56;case 83:return 109;case 84:return 112;case 85:return 127;case 86:return 124;case 87:return 113;case 88:case 89:return 125;case 90:return 114;case 91:return 73;case 92:return 92;case 93:return\"SEP\";case 94:return 91;case 95:return 66;case 96:return 75;case 97:return 74;case 98:return 77;case 99:return 76;case 100:return 122;case 101:return 123;case 102:return 68;case 103:return 57;case 104:return 58;case 105:return 40;case 106:return 41;case 107:return 71;case 108:return 72;case 109:return 133;case 110:return 21;case 111:return 22;case 112:return 23}},rules:[/^(?:%%\\{)/,/^(?:((?:(?!\\}%%)[^:.])*))/,/^(?::)/,/^(?:\\}%%)/,/^(?:((?:(?!\\}%%).|\\n)*))/,/^(?:%%(?!\\{)[^\\n]*)/,/^(?:[^\\}]%%[^\\n]*)/,/^(?:accTitle\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*:\\s*)/,/^(?:(?!\\n||)*[^\\n]*)/,/^(?:accDescr\\s*\\{\\s*)/,/^(?:[\\}])/,/^(?:[^\\}]*)/,/^(?:[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:style\\b)/,/^(?:default\\b)/,/^(?:linkStyle\\b)/,/^(?:interpolate\\b)/,/^(?:classDef\\b)/,/^(?:class\\b)/,/^(?:href[\\s]+[\"])/,/^(?:[\"])/,/^(?:[^\"]*)/,/^(?:call[\\s]+)/,/^(?:\\([\\s]*\\))/,/^(?:\\()/,/^(?:[^(]*)/,/^(?:\\))/,/^(?:[^)]*)/,/^(?:click[\\s]+)/,/^(?:[\\s\\n])/,/^(?:[^\\s\\n]*)/,/^(?:graph\\b)/,/^(?:flowchart\\b)/,/^(?:subgraph\\b)/,/^(?:end\\b\\s*)/,/^(?:_self\\b)/,/^(?:_blank\\b)/,/^(?:_parent\\b)/,/^(?:_top\\b)/,/^(?:(\\r?\\n)*\\s*\\n)/,/^(?:\\s*LR\\b)/,/^(?:\\s*RL\\b)/,/^(?:\\s*TB\\b)/,/^(?:\\s*BT\\b)/,/^(?:\\s*TD\\b)/,/^(?:\\s*BR\\b)/,/^(?:\\s*<)/,/^(?:\\s*>)/,/^(?:\\s*\\^)/,/^(?:\\s*v\\b)/,/^(?:.*direction\\s+TB[^\\n]*)/,/^(?:.*direction\\s+BT[^\\n]*)/,/^(?:.*direction\\s+RL[^\\n]*)/,/^(?:.*direction\\s+LR[^\\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\\*)/,/^(?:\\s*[xo<]?--+[-xo>]\\s*)/,/^(?:\\s*[xo<]?==+[=xo>]\\s*)/,/^(?:\\s*[xo<]?-?\\.+-[xo>]?\\s*)/,/^(?:\\s*[xo<]?--\\s*)/,/^(?:\\s*[xo<]?==\\s*)/,/^(?:\\s*[xo<]?-\\.\\s*)/,/^(?:\\(-)/,/^(?:-\\))/,/^(?:\\(\\[)/,/^(?:\\]\\))/,/^(?:\\[\\[)/,/^(?:\\]\\])/,/^(?:\\[\\|)/,/^(?:\\[\\()/,/^(?:\\)\\])/,/^(?:\\(\\(\\()/,/^(?:\\)\\)\\))/,/^(?:-)/,/^(?:\\.)/,/^(?:[\\_])/,/^(?:\\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\\^)/,/^(?:\\\\\\|)/,/^(?:v\\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\\\\])/,/^(?:\\[\\/)/,/^(?:\\/\\])/,/^(?:\\[\\\\)/,/^(?:[!\"#$%&'*+,-.`?\\\\_/])/,/^(?:[\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6]|[\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377]|[\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5]|[\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA]|[\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE]|[\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA]|[\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0]|[\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977]|[\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2]|[\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A]|[\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39]|[\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8]|[\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C]|[\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C]|[\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99]|[\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0]|[\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D]|[\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3]|[\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10]|[\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1]|[\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81]|[\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3]|[\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6]|[\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A]|[\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081]|[\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D]|[\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0]|[\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310]|[\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C]|[\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711]|[\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7]|[\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C]|[\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16]|[\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF]|[\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC]|[\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D]|[\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D]|[\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3]|[\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F]|[\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128]|[\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184]|[\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3]|[\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6]|[\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE]|[\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C]|[\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D]|[\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC]|[\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B]|[\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788]|[\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805]|[\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB]|[\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28]|[\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5]|[\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4]|[\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E]|[\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D]|[\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36]|[\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D]|[\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC]|[\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF]|[\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC])/,/^(?:\\|)/,/^(?:\\()/,/^(?:\\))/,/^(?:\\[)/,/^(?:\\])/,/^(?:\\{)/,/^(?:\\})/,/^(?:\")/,/^(?:(\\r?\\n)+)/,/^(?:\\s)/,/^(?:$)/],conditions:{close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[30,31],inclusive:!1},callbackname:{rules:[27,28,29],inclusive:!1},href:{rules:[24,25],inclusive:!1},click:{rules:[33,34],inclusive:!1},vertex:{rules:[],inclusive:!1},dir:{rules:[43,44,45,46,47,48,49,50,51,52,53],inclusive:!1},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},string:{rules:[15,16],inclusive:!1},INITIAL:{rules:[0,5,6,7,9,11,14,17,18,19,20,21,22,23,26,32,35,36,37,38,39,40,41,42,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112],inclusive:!0}}};function re(){this.yy={}}return ee.lexer=ne,re.prototype=ee,ee.Parser=re,new re}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(5354).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9959:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,23],d=[1,24],p=[1,25],g=[1,26],y=[1,28],m=[1,30],b=[1,33],v=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,24,25,27,34,39],_={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,gantt:5,document:6,EOF:7,line:8,SPACE:9,statement:10,NL:11,dateFormat:12,inclusiveEndDates:13,topAxis:14,axisFormat:15,excludes:16,includes:17,todayMarker:18,title:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,clickStatement:26,taskTxt:27,taskData:28,openDirective:29,typeDirective:30,closeDirective:31,\":\":32,argDirective:33,click:34,callbackname:35,callbackargs:36,href:37,clickStatementDebug:38,open_directive:39,type_directive:40,arg_directive:41,close_directive:42,$accept:0,$end:1},terminals_:{2:\"error\",5:\"gantt\",7:\"EOF\",9:\"SPACE\",11:\"NL\",12:\"dateFormat\",13:\"inclusiveEndDates\",14:\"topAxis\",15:\"axisFormat\",16:\"excludes\",17:\"includes\",18:\"todayMarker\",19:\"title\",20:\"acc_title\",21:\"acc_title_value\",22:\"acc_descr\",23:\"acc_descr_value\",24:\"acc_descr_multiline_value\",25:\"section\",27:\"taskTxt\",28:\"taskData\",32:\":\",34:\"click\",35:\"callbackname\",36:\"callbackargs\",37:\"href\",39:\"open_directive\",40:\"type_directive\",41:\"arg_directive\",42:\"close_directive\"},productions_:[0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[26,2],[26,3],[26,3],[26,4],[26,3],[26,4],[26,2],[38,2],[38,3],[38,3],[38,4],[38,3],[38,4],[38,2],[29,1],[30,1],[33,1],[31,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 2:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 9:r.setDateFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 10:r.enableInclusiveEndDates(),this.$=a[s].substr(18);break;case 11:r.TopAxis(),this.$=a[s].substr(8);break;case 12:r.setAxisFormat(a[s].substr(11)),this.$=a[s].substr(11);break;case 13:r.setExcludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 14:r.setIncludes(a[s].substr(9)),this.$=a[s].substr(9);break;case 15:r.setTodayMarker(a[s].substr(12)),this.$=a[s].substr(12);break;case 16:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 26:this.$=a[s-1],r.setClickEvent(a[s-1],a[s],null);break;case 27:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],a[s]);break;case 28:this.$=a[s-2],r.setClickEvent(a[s-2],a[s-1],null),r.setLink(a[s-2],a[s]);break;case 29:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-2],a[s-1]),r.setLink(a[s-3],a[s]);break;case 30:this.$=a[s-2],r.setClickEvent(a[s-2],a[s],null),r.setLink(a[s-2],a[s-1]);break;case 31:this.$=a[s-3],r.setClickEvent(a[s-3],a[s-1],a[s]),r.setLink(a[s-3],a[s-2]);break;case 32:this.$=a[s-1],r.setLink(a[s-1],a[s]);break;case 33:case 39:this.$=a[s-1]+\" \"+a[s];break;case 34:case 35:case 37:this.$=a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 36:case 38:this.$=a[s-3]+\" \"+a[s-2]+\" \"+a[s-1]+\" \"+a[s];break;case 40:r.parseDirective(\"%%{\",\"open_directive\");break;case 41:r.parseDirective(a[s],\"type_directive\");break;case 42:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 43:r.parseDirective(\"}%%\",\"close_directive\",\"gantt\")}},table:[{3:1,4:2,5:e,29:4,39:n},{1:[3]},{3:6,4:2,5:e,29:4,39:n},t(r,[2,3],{6:7}),{30:8,40:[1,9]},{40:[2,40]},{1:[2,1]},{4:29,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},{31:31,32:[1,32],42:b},t([32,42],[2,41]),t(r,[2,8],{1:[2,2]}),t(r,[2,4]),{4:29,10:34,12:i,13:a,14:o,15:s,16:c,17:l,18:u,19:h,20:f,22:d,24:p,25:g,26:27,27:y,29:4,34:m,39:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,9]),t(r,[2,10]),t(r,[2,11]),t(r,[2,12]),t(r,[2,13]),t(r,[2,14]),t(r,[2,15]),t(r,[2,16]),{21:[1,35]},{23:[1,36]},t(r,[2,19]),t(r,[2,20]),t(r,[2,21]),{28:[1,37]},t(r,[2,23]),{35:[1,38],37:[1,39]},{11:[1,40]},{33:41,41:[1,42]},{11:[2,43]},t(r,[2,5]),t(r,[2,17]),t(r,[2,18]),t(r,[2,22]),t(r,[2,26],{36:[1,43],37:[1,44]}),t(r,[2,32],{35:[1,45]}),t(v,[2,24]),{31:46,42:b},{42:[2,42]},t(r,[2,27],{37:[1,47]}),t(r,[2,28]),t(r,[2,30],{36:[1,48]}),{11:[1,49]},t(r,[2,29]),t(r,[2,31]),t(v,[2,25])],defaultActions:{5:[2,40],6:[2,1],33:[2,43],42:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},x={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),39;case 1:return this.begin(\"type_directive\"),40;case 2:return this.popState(),this.begin(\"arg_directive\"),32;case 3:return this.popState(),this.popState(),42;case 4:return 41;case 5:return this.begin(\"acc_title\"),20;case 6:return this.popState(),\"acc_title_value\";case 7:return this.begin(\"acc_descr\"),22;case 8:return this.popState(),\"acc_descr_value\";case 9:this.begin(\"acc_descr_multiline\");break;case 10:case 20:case 23:case 26:case 29:this.popState();break;case 11:return\"acc_descr_multiline_value\";case 12:case 13:case 14:case 16:case 17:case 18:break;case 15:return 11;case 19:this.begin(\"href\");break;case 21:return 37;case 22:this.begin(\"callbackname\");break;case 24:this.popState(),this.begin(\"callbackargs\");break;case 25:return 35;case 27:return 36;case 28:this.begin(\"click\");break;case 30:return 34;case 31:return 5;case 32:return 12;case 33:return 13;case 34:return 14;case 35:return 15;case 36:return 17;case 37:return 16;case 38:return 18;case 39:return\"date\";case 40:return 19;case 41:return\"accDescription\";case 42:return 25;case 43:return 27;case 44:return 28;case 45:return 32;case 46:return 7;case 47:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:%%(?!\\{)*[^\\n]*)/i,/^(?:[^\\}]%%*[^\\n]*)/i,/^(?:%%*[^\\n]*[\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:href[\\s]+[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:call[\\s]+)/i,/^(?:\\([\\s]*\\))/i,/^(?:\\()/i,/^(?:[^(]*)/i,/^(?:\\))/i,/^(?:[^)]*)/i,/^(?:click[\\s]+)/i,/^(?:[\\s\\n])/i,/^(?:[^\\s\\n]*)/i,/^(?:gantt\\b)/i,/^(?:dateFormat\\s[^#\\n;]+)/i,/^(?:inclusiveEndDates\\b)/i,/^(?:topAxis\\b)/i,/^(?:axisFormat\\s[^#\\n;]+)/i,/^(?:includes\\s[^#\\n;]+)/i,/^(?:excludes\\s[^#\\n;]+)/i,/^(?:todayMarker\\s[^\\n;]+)/i,/^(?:\\d\\d\\d\\d-\\d\\d-\\d\\d\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accDescription\\s[^#\\n;]+)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},callbackargs:{rules:[26,27],inclusive:!1},callbackname:{rules:[23,24,25],inclusive:!1},href:{rules:[20,21],inclusive:!1},click:{rules:[29,30],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,22,28,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],inclusive:!0}}};function k(){this.yy={}}return _.lexer=x,k.prototype=_,_.Parser=k,new k}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(6878).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},2553:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,7],r=[1,5],i=[1,9],a=[1,6],o=[2,6],s=[1,16],c=[6,8,14,20,22,24,25,27,29,32,35,39,49,53],l=[8,14,20,22,24,25,27,29,32,35,39],u=[8,13,14,20,22,24,25,27,29,32,35,39],h=[1,26],f=[6,8,14,49,53],d=[8,14,53],p=[1,64],g=[1,65],y=[1,66],m=[8,14,33,38,41,53],b={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,GG:6,document:7,EOF:8,\":\":9,DIR:10,options:11,body:12,OPT:13,NL:14,line:15,statement:16,commitStatement:17,mergeStatement:18,cherryPickStatement:19,acc_title:20,acc_title_value:21,acc_descr:22,acc_descr_value:23,acc_descr_multiline_value:24,section:25,branchStatement:26,CHECKOUT:27,ID:28,BRANCH:29,ORDER:30,NUM:31,CHERRY_PICK:32,COMMIT_ID:33,STR:34,MERGE:35,COMMIT_TYPE:36,commitType:37,COMMIT_TAG:38,COMMIT:39,commit_arg:40,COMMIT_MSG:41,NORMAL:42,REVERSE:43,HIGHLIGHT:44,openDirective:45,typeDirective:46,closeDirective:47,argDirective:48,open_directive:49,type_directive:50,arg_directive:51,close_directive:52,\";\":53,$accept:0,$end:1},terminals_:{2:\"error\",6:\"GG\",8:\"EOF\",9:\":\",10:\"DIR\",13:\"OPT\",14:\"NL\",20:\"acc_title\",21:\"acc_title_value\",22:\"acc_descr\",23:\"acc_descr_value\",24:\"acc_descr_multiline_value\",25:\"section\",27:\"CHECKOUT\",28:\"ID\",29:\"BRANCH\",30:\"ORDER\",31:\"NUM\",32:\"CHERRY_PICK\",33:\"COMMIT_ID\",34:\"STR\",35:\"MERGE\",36:\"COMMIT_TYPE\",38:\"COMMIT_TAG\",39:\"COMMIT\",41:\"COMMIT_MSG\",42:\"NORMAL\",43:\"REVERSE\",44:\"HIGHLIGHT\",49:\"open_directive\",50:\"type_directive\",51:\"arg_directive\",52:\"close_directive\",53:\";\"},productions_:[0,[3,2],[3,2],[3,3],[3,4],[3,5],[7,0],[7,2],[11,2],[11,1],[12,0],[12,2],[15,2],[15,1],[16,1],[16,1],[16,1],[16,2],[16,2],[16,1],[16,1],[16,1],[16,2],[26,2],[26,4],[19,3],[18,2],[18,4],[18,4],[18,4],[18,6],[18,6],[18,6],[18,6],[18,6],[18,6],[18,8],[18,8],[18,8],[18,8],[18,8],[18,8],[17,2],[17,3],[17,3],[17,5],[17,5],[17,3],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,3],[17,5],[17,5],[17,5],[17,5],[17,5],[17,5],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,7],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[17,9],[40,0],[40,1],[37,1],[37,1],[37,1],[5,3],[5,5],[45,1],[46,1],[48,1],[47,1],[4,1],[4,1],[4,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return a[s];case 4:return a[s-1];case 5:return r.setDirection(a[s-3]),a[s-1];case 7:r.setOptions(a[s-1]),this.$=a[s];break;case 8:a[s-1]+=a[s],this.$=a[s-1];break;case 10:this.$=[];break;case 11:a[s-1].push(a[s]),this.$=a[s-1];break;case 12:this.$=a[s-1];break;case 17:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 18:case 19:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 20:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 22:r.checkout(a[s]);break;case 23:r.branch(a[s]);break;case 24:r.branch(a[s-2],a[s]);break;case 25:r.cherryPick(a[s]);break;case 26:r.merge(a[s],\"\",\"\",\"\");break;case 27:r.merge(a[s-2],a[s],\"\",\"\");break;case 28:r.merge(a[s-2],\"\",a[s],\"\");break;case 29:r.merge(a[s-2],\"\",\"\",a[s]);break;case 30:r.merge(a[s-4],a[s],\"\",a[s-2]);break;case 31:r.merge(a[s-4],\"\",a[s],a[s-2]);break;case 32:r.merge(a[s-4],\"\",a[s-2],a[s]);break;case 33:r.merge(a[s-4],a[s-2],a[s],\"\");break;case 34:r.merge(a[s-4],a[s-2],\"\",a[s]);break;case 35:r.merge(a[s-4],a[s],a[s-2],\"\");break;case 36:r.merge(a[s-6],a[s-4],a[s-2],a[s]);break;case 37:r.merge(a[s-6],a[s],a[s-4],a[s-2]);break;case 38:r.merge(a[s-6],a[s-4],a[s],a[s-2]);break;case 39:r.merge(a[s-6],a[s-2],a[s-4],a[s]);break;case 40:r.merge(a[s-6],a[s],a[s-2],a[s-4]);break;case 41:r.merge(a[s-6],a[s-2],a[s],a[s-4]);break;case 42:r.commit(a[s]);break;case 43:r.commit(\"\",\"\",r.commitType.NORMAL,a[s]);break;case 44:r.commit(\"\",\"\",a[s],\"\");break;case 45:r.commit(\"\",\"\",a[s],a[s-2]);break;case 46:r.commit(\"\",\"\",a[s-2],a[s]);break;case 47:r.commit(\"\",a[s],r.commitType.NORMAL,\"\");break;case 48:r.commit(\"\",a[s-2],r.commitType.NORMAL,a[s]);break;case 49:r.commit(\"\",a[s],r.commitType.NORMAL,a[s-2]);break;case 50:r.commit(\"\",a[s-2],a[s],\"\");break;case 51:r.commit(\"\",a[s],a[s-2],\"\");break;case 52:r.commit(\"\",a[s-4],a[s-2],a[s]);break;case 53:r.commit(\"\",a[s-4],a[s],a[s-2]);break;case 54:r.commit(\"\",a[s-2],a[s-4],a[s]);break;case 55:r.commit(\"\",a[s],a[s-4],a[s-2]);break;case 56:r.commit(\"\",a[s],a[s-2],a[s-4]);break;case 57:r.commit(\"\",a[s-2],a[s],a[s-4]);break;case 58:r.commit(a[s],\"\",r.commitType.NORMAL,\"\");break;case 59:r.commit(a[s],\"\",r.commitType.NORMAL,a[s-2]);break;case 60:r.commit(a[s-2],\"\",r.commitType.NORMAL,a[s]);break;case 61:r.commit(a[s-2],\"\",a[s],\"\");break;case 62:r.commit(a[s],\"\",a[s-2],\"\");break;case 63:r.commit(a[s],a[s-2],r.commitType.NORMAL,\"\");break;case 64:r.commit(a[s-2],a[s],r.commitType.NORMAL,\"\");break;case 65:r.commit(a[s-4],\"\",a[s-2],a[s]);break;case 66:r.commit(a[s-4],\"\",a[s],a[s-2]);break;case 67:r.commit(a[s-2],\"\",a[s-4],a[s]);break;case 68:r.commit(a[s],\"\",a[s-4],a[s-2]);break;case 69:r.commit(a[s],\"\",a[s-2],a[s-4]);break;case 70:r.commit(a[s-2],\"\",a[s],a[s-4]);break;case 71:r.commit(a[s-4],a[s],a[s-2],\"\");break;case 72:r.commit(a[s-4],a[s-2],a[s],\"\");break;case 73:r.commit(a[s-2],a[s],a[s-4],\"\");break;case 74:r.commit(a[s],a[s-2],a[s-4],\"\");break;case 75:r.commit(a[s],a[s-4],a[s-2],\"\");break;case 76:r.commit(a[s-2],a[s-4],a[s],\"\");break;case 77:r.commit(a[s-4],a[s],r.commitType.NORMAL,a[s-2]);break;case 78:r.commit(a[s-4],a[s-2],r.commitType.NORMAL,a[s]);break;case 79:r.commit(a[s-2],a[s],r.commitType.NORMAL,a[s-4]);break;case 80:r.commit(a[s],a[s-2],r.commitType.NORMAL,a[s-4]);break;case 81:r.commit(a[s],a[s-4],r.commitType.NORMAL,a[s-2]);break;case 82:r.commit(a[s-2],a[s-4],r.commitType.NORMAL,a[s]);break;case 83:r.commit(a[s-6],a[s-4],a[s-2],a[s]);break;case 84:r.commit(a[s-6],a[s-4],a[s],a[s-2]);break;case 85:r.commit(a[s-6],a[s-2],a[s-4],a[s]);break;case 86:r.commit(a[s-6],a[s],a[s-4],a[s-2]);break;case 87:r.commit(a[s-6],a[s-2],a[s],a[s-4]);break;case 88:r.commit(a[s-6],a[s],a[s-2],a[s-4]);break;case 89:r.commit(a[s-4],a[s-6],a[s-2],a[s]);break;case 90:r.commit(a[s-4],a[s-6],a[s],a[s-2]);break;case 91:r.commit(a[s-2],a[s-6],a[s-4],a[s]);break;case 92:r.commit(a[s],a[s-6],a[s-4],a[s-2]);break;case 93:r.commit(a[s-2],a[s-6],a[s],a[s-4]);break;case 94:r.commit(a[s],a[s-6],a[s-2],a[s-4]);break;case 95:r.commit(a[s],a[s-4],a[s-2],a[s-6]);break;case 96:r.commit(a[s-2],a[s-4],a[s],a[s-6]);break;case 97:r.commit(a[s],a[s-2],a[s-4],a[s-6]);break;case 98:r.commit(a[s-2],a[s],a[s-4],a[s-6]);break;case 99:r.commit(a[s-4],a[s-2],a[s],a[s-6]);break;case 100:r.commit(a[s-4],a[s],a[s-2],a[s-6]);break;case 101:r.commit(a[s-2],a[s-4],a[s-6],a[s]);break;case 102:r.commit(a[s],a[s-4],a[s-6],a[s-2]);break;case 103:r.commit(a[s-2],a[s],a[s-6],a[s-4]);break;case 104:r.commit(a[s],a[s-2],a[s-6],a[s-4]);break;case 105:r.commit(a[s-4],a[s-2],a[s-6],a[s]);break;case 106:r.commit(a[s-4],a[s],a[s-6],a[s-2]);break;case 107:this.$=\"\";break;case 108:this.$=a[s];break;case 109:this.$=r.commitType.NORMAL;break;case 110:this.$=r.commitType.REVERSE;break;case 111:this.$=r.commitType.HIGHLIGHT;break;case 114:r.parseDirective(\"%%{\",\"open_directive\");break;case 115:r.parseDirective(a[s],\"type_directive\");break;case 116:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 117:r.parseDirective(\"}%%\",\"close_directive\",\"gitGraph\")}},table:[{3:1,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{1:[3]},{3:10,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{3:11,4:2,5:3,6:e,8:n,14:r,45:8,49:i,53:a},{7:12,8:o,9:[1,13],10:[1,14],11:15,14:s},t(c,[2,118]),t(c,[2,119]),t(c,[2,120]),{46:17,50:[1,18]},{50:[2,114]},{1:[2,1]},{1:[2,2]},{8:[1,19]},{7:20,8:o,11:15,14:s},{9:[1,21]},t(l,[2,10],{12:22,13:[1,23]}),t(u,[2,9]),{9:[1,25],47:24,52:h},t([9,52],[2,115]),{1:[2,3]},{8:[1,27]},{7:28,8:o,11:15,14:s},{8:[2,7],14:[1,31],15:29,16:30,17:32,18:33,19:34,20:[1,35],22:[1,36],24:[1,37],25:[1,38],26:39,27:[1,40],29:[1,44],32:[1,43],35:[1,42],39:[1,41]},t(u,[2,8]),t(f,[2,112]),{48:45,51:[1,46]},t(f,[2,117]),{1:[2,4]},{8:[1,47]},t(l,[2,11]),{4:48,8:n,14:r,53:a},t(l,[2,13]),t(d,[2,14]),t(d,[2,15]),t(d,[2,16]),{21:[1,49]},{23:[1,50]},t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),{28:[1,51]},t(d,[2,107],{40:52,33:[1,55],34:[1,57],36:[1,54],38:[1,53],41:[1,56]}),{28:[1,58]},{33:[1,59]},{28:[1,60]},{47:61,52:h},{52:[2,116]},{1:[2,5]},t(l,[2,12]),t(d,[2,17]),t(d,[2,18]),t(d,[2,22]),t(d,[2,42]),{34:[1,62]},{37:63,42:p,43:g,44:y},{34:[1,67]},{34:[1,68]},t(d,[2,108]),t(d,[2,26],{33:[1,69],36:[1,70],38:[1,71]}),{34:[1,72]},t(d,[2,23],{30:[1,73]}),t(f,[2,113]),t(d,[2,43],{33:[1,75],36:[1,74],41:[1,76]}),t(d,[2,44],{33:[1,78],38:[1,77],41:[1,79]}),t(m,[2,109]),t(m,[2,110]),t(m,[2,111]),t(d,[2,47],{36:[1,81],38:[1,80],41:[1,82]}),t(d,[2,58],{33:[1,85],36:[1,84],38:[1,83]}),{34:[1,86]},{37:87,42:p,43:g,44:y},{34:[1,88]},t(d,[2,25]),{31:[1,89]},{37:90,42:p,43:g,44:y},{34:[1,91]},{34:[1,92]},{34:[1,93]},{34:[1,94]},{34:[1,95]},{34:[1,96]},{37:97,42:p,43:g,44:y},{34:[1,98]},{34:[1,99]},{37:100,42:p,43:g,44:y},{34:[1,101]},t(d,[2,27],{36:[1,102],38:[1,103]}),t(d,[2,28],{33:[1,105],38:[1,104]}),t(d,[2,29],{33:[1,106],36:[1,107]}),t(d,[2,24]),t(d,[2,45],{33:[1,108],41:[1,109]}),t(d,[2,49],{36:[1,110],41:[1,111]}),t(d,[2,59],{33:[1,113],36:[1,112]}),t(d,[2,46],{33:[1,114],41:[1,115]}),t(d,[2,51],{38:[1,116],41:[1,117]}),t(d,[2,62],{33:[1,119],38:[1,118]}),t(d,[2,48],{36:[1,120],41:[1,121]}),t(d,[2,50],{38:[1,122],41:[1,123]}),t(d,[2,63],{36:[1,124],38:[1,125]}),t(d,[2,60],{33:[1,127],36:[1,126]}),t(d,[2,61],{33:[1,129],38:[1,128]}),t(d,[2,64],{36:[1,130],38:[1,131]}),{37:132,42:p,43:g,44:y},{34:[1,133]},{34:[1,134]},{34:[1,135]},{34:[1,136]},{37:137,42:p,43:g,44:y},{34:[1,138]},{34:[1,139]},{37:140,42:p,43:g,44:y},{34:[1,141]},{37:142,42:p,43:g,44:y},{34:[1,143]},{34:[1,144]},{34:[1,145]},{34:[1,146]},{34:[1,147]},{34:[1,148]},{34:[1,149]},{37:150,42:p,43:g,44:y},{34:[1,151]},{34:[1,152]},{34:[1,153]},{37:154,42:p,43:g,44:y},{34:[1,155]},{37:156,42:p,43:g,44:y},{34:[1,157]},{34:[1,158]},{34:[1,159]},{37:160,42:p,43:g,44:y},{34:[1,161]},t(d,[2,33],{38:[1,162]}),t(d,[2,34],{36:[1,163]}),t(d,[2,32],{33:[1,164]}),t(d,[2,35],{38:[1,165]}),t(d,[2,30],{36:[1,166]}),t(d,[2,31],{33:[1,167]}),t(d,[2,56],{41:[1,168]}),t(d,[2,69],{33:[1,169]}),t(d,[2,57],{41:[1,170]}),t(d,[2,80],{36:[1,171]}),t(d,[2,70],{33:[1,172]}),t(d,[2,79],{36:[1,173]}),t(d,[2,55],{41:[1,174]}),t(d,[2,68],{33:[1,175]}),t(d,[2,54],{41:[1,176]}),t(d,[2,74],{38:[1,177]}),t(d,[2,67],{33:[1,178]}),t(d,[2,73],{38:[1,179]}),t(d,[2,53],{41:[1,180]}),t(d,[2,81],{36:[1,181]}),t(d,[2,52],{41:[1,182]}),t(d,[2,75],{38:[1,183]}),t(d,[2,76],{38:[1,184]}),t(d,[2,82],{36:[1,185]}),t(d,[2,66],{33:[1,186]}),t(d,[2,77],{36:[1,187]}),t(d,[2,65],{33:[1,188]}),t(d,[2,71],{38:[1,189]}),t(d,[2,72],{38:[1,190]}),t(d,[2,78],{36:[1,191]}),{34:[1,192]},{37:193,42:p,43:g,44:y},{34:[1,194]},{34:[1,195]},{37:196,42:p,43:g,44:y},{34:[1,197]},{34:[1,198]},{34:[1,199]},{34:[1,200]},{37:201,42:p,43:g,44:y},{34:[1,202]},{37:203,42:p,43:g,44:y},{34:[1,204]},{34:[1,205]},{34:[1,206]},{34:[1,207]},{34:[1,208]},{34:[1,209]},{34:[1,210]},{37:211,42:p,43:g,44:y},{34:[1,212]},{34:[1,213]},{34:[1,214]},{37:215,42:p,43:g,44:y},{34:[1,216]},{37:217,42:p,43:g,44:y},{34:[1,218]},{34:[1,219]},{34:[1,220]},{37:221,42:p,43:g,44:y},t(d,[2,36]),t(d,[2,38]),t(d,[2,37]),t(d,[2,39]),t(d,[2,41]),t(d,[2,40]),t(d,[2,97]),t(d,[2,98]),t(d,[2,95]),t(d,[2,96]),t(d,[2,100]),t(d,[2,99]),t(d,[2,104]),t(d,[2,103]),t(d,[2,102]),t(d,[2,101]),t(d,[2,106]),t(d,[2,105]),t(d,[2,94]),t(d,[2,93]),t(d,[2,92]),t(d,[2,91]),t(d,[2,89]),t(d,[2,90]),t(d,[2,88]),t(d,[2,87]),t(d,[2,86]),t(d,[2,85]),t(d,[2,83]),t(d,[2,84])],defaultActions:{9:[2,114],10:[2,1],11:[2,2],19:[2,3],27:[2,4],46:[2,116],47:[2,5]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},v={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),49;case 1:return this.begin(\"type_directive\"),50;case 2:return this.popState(),this.begin(\"arg_directive\"),9;case 3:return this.popState(),this.popState(),52;case 4:return 51;case 5:return this.begin(\"acc_title\"),20;case 6:return this.popState(),\"acc_title_value\";case 7:return this.begin(\"acc_descr\"),22;case 8:return this.popState(),\"acc_descr_value\";case 9:this.begin(\"acc_descr_multiline\");break;case 10:case 35:case 38:this.popState();break;case 11:return\"acc_descr_multiline_value\";case 12:return 14;case 13:case 14:case 15:break;case 16:return 6;case 17:return 39;case 18:return 33;case 19:return 36;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 38;case 25:return 29;case 26:return 30;case 27:return 35;case 28:return 32;case 29:return 27;case 30:case 31:return 10;case 32:return 9;case 33:return\"CARET\";case 34:this.begin(\"options\");break;case 36:return 13;case 37:this.begin(\"string\");break;case 39:return 34;case 40:return 31;case 41:return 28;case 42:return 8}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:gitGraph\\b)/i,/^(?:commit\\b)/i,/^(?:id:)/i,/^(?:type:)/i,/^(?:msg:)/i,/^(?:NORMAL\\b)/i,/^(?:REVERSE\\b)/i,/^(?:HIGHLIGHT\\b)/i,/^(?:tag:)/i,/^(?:branch\\b)/i,/^(?:order:)/i,/^(?:merge\\b)/i,/^(?:cherry-pick\\b)/i,/^(?:checkout\\b)/i,/^(?:LR\\b)/i,/^(?:BT\\b)/i,/^(?::)/i,/^(?:\\^)/i,/^(?:options\\r?\\n)/i,/^(?:[ \\r\\n\\t]+end\\b)/i,/^(?:[\\s\\S]+(?=[ \\r\\n\\t]+end))/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[0-9]+)/i,/^(?:[a-zA-Z][-_\\./a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[10,11],inclusive:!1},acc_descr:{rules:[8],inclusive:!1},acc_title:{rules:[6],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},options:{rules:[35,36],inclusive:!1},string:{rules:[38,39],inclusive:!1},INITIAL:{rules:[0,5,7,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,37,40,41,42],inclusive:!0}}};function _(){this.yy={}}return b.lexer=v,_.prototype=b,b.Parser=_,new _}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8183).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6765:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[6,9,10],n={trace:function(){},yy:{},symbols_:{error:2,start:3,info:4,document:5,EOF:6,line:7,statement:8,NL:9,showInfo:10,$accept:0,$end:1},terminals_:{2:\"error\",4:\"info\",6:\"EOF\",9:\"NL\",10:\"showInfo\"},productions_:[0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],performAction:function(t,e,n,r,i,a,o){switch(a.length,i){case 1:return r;case 4:break;case 6:r.setInfo(!0)}},table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},t(e,[2,3]),t(e,[2,4]),t(e,[2,5]),t(e,[2,6])],defaultActions:{4:[2,1]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},r={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return 4;case 1:return 9;case 2:return\"space\";case 3:return 10;case 4:return 6;case 5:return\"TXT\"}},rules:[/^(?:info\\b)/i,/^(?:[\\s\\n\\r]+)/i,/^(?:[\\s]+)/i,/^(?:showInfo\\b)/i,/^(?:$)/i,/^(?:.)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5],inclusive:!0}}};function i(){this.yy={}}return n.lexer=r,i.prototype=n,n.Parser=i,new i}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1428).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},7062:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,4],n=[1,5],r=[1,6],i=[1,7],a=[1,9],o=[1,11,13,15,17,19,20,26,27,28,29],s=[2,5],c=[1,6,11,13,15,17,19,20,26,27,28,29],l=[26,27,28],u=[2,8],h=[1,18],f=[1,19],d=[1,20],p=[1,21],g=[1,22],y=[1,23],m=[1,28],b=[6,26,27,28,29],v={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,directive:5,PIE:6,document:7,showData:8,line:9,statement:10,txt:11,value:12,title:13,title_value:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,openDirective:21,typeDirective:22,closeDirective:23,\":\":24,argDirective:25,NEWLINE:26,\";\":27,EOF:28,open_directive:29,type_directive:30,arg_directive:31,close_directive:32,$accept:0,$end:1},terminals_:{2:\"error\",6:\"PIE\",8:\"showData\",11:\"txt\",12:\"value\",13:\"title\",14:\"title_value\",15:\"acc_title\",16:\"acc_title_value\",17:\"acc_descr\",18:\"acc_descr_value\",19:\"acc_descr_multiline_value\",20:\"section\",24:\":\",26:\"NEWLINE\",27:\";\",28:\"EOF\",29:\"open_directive\",30:\"type_directive\",31:\"arg_directive\",32:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[21,1],[22,1],[25,1],[23,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:r.setShowData(!0);break;case 7:this.$=a[s-1];break;case 9:r.addSection(a[s-1],r.cleanupValue(a[s]));break;case 10:this.$=a[s].trim(),r.setDiagramTitle(this.$);break;case 11:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 12:case 13:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 14:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 21:r.parseDirective(\"%%{\",\"open_directive\");break;case 22:r.parseDirective(a[s],\"type_directive\");break;case 23:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 24:r.parseDirective(\"}%%\",\"close_directive\",\"pie\")}},table:[{3:1,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{1:[3]},{3:10,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},{3:11,4:2,5:3,6:e,21:8,26:n,27:r,28:i,29:a},t(o,s,{7:12,8:[1,13]}),t(c,[2,18]),t(c,[2,19]),t(c,[2,20]),{22:14,30:[1,15]},{30:[2,21]},{1:[2,1]},{1:[2,2]},t(l,u,{21:8,9:16,10:17,5:24,1:[2,3],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(o,s,{7:25}),{23:26,24:[1,27],32:m},t([24,32],[2,22]),t(o,[2,6]),{4:29,26:n,27:r,28:i},{12:[1,30]},{14:[1,31]},{16:[1,32]},{18:[1,33]},t(l,[2,13]),t(l,[2,14]),t(l,[2,15]),t(l,u,{21:8,9:16,10:17,5:24,1:[2,4],11:h,13:f,15:d,17:p,19:g,20:y,29:a}),t(b,[2,16]),{25:34,31:[1,35]},t(b,[2,24]),t(o,[2,7]),t(l,[2,9]),t(l,[2,10]),t(l,[2,11]),t(l,[2,12]),{23:36,32:m},{32:[2,23]},t(b,[2,17])],defaultActions:{9:[2,21],10:[2,1],11:[2,2],35:[2,23]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},_={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),29;case 1:return this.begin(\"type_directive\"),30;case 2:return this.popState(),this.begin(\"arg_directive\"),24;case 3:return this.popState(),this.popState(),32;case 4:return 31;case 5:case 6:case 8:case 9:break;case 7:return 26;case 10:return this.begin(\"title\"),13;case 11:return this.popState(),\"title_value\";case 12:return this.begin(\"acc_title\"),15;case 13:return this.popState(),\"acc_title_value\";case 14:return this.begin(\"acc_descr\"),17;case 15:return this.popState(),\"acc_descr_value\";case 16:this.begin(\"acc_descr_multiline\");break;case 17:case 20:this.popState();break;case 18:return\"acc_descr_multiline_value\";case 19:this.begin(\"string\");break;case 21:return\"txt\";case 22:return 6;case 23:return 8;case 24:return\"value\";case 25:return 28}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n\\r]+)/i,/^(?:%%[^\\n]*)/i,/^(?:[\\s]+)/i,/^(?:title\\b)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:pie\\b)/i,/^(?:showData\\b)/i,/^(?::[\\s]*[\\d]+(?:\\.[\\d]+)?)/i,/^(?:$)/i],conditions:{acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},title:{rules:[11],inclusive:!1},string:{rules:[20,21],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,12,14,16,19,22,23,24,25],inclusive:!0}}};function x(){this.yy={}}return v.lexer=_,x.prototype=v,v.Parser=x,new x}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(4551).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3176:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,3],n=[1,5],r=[1,6],i=[1,7],a=[1,8],o=[5,6,8,14,16,18,19,40,41,42,43,44,45,53,71,72],s=[1,22],c=[2,13],l=[1,26],u=[1,27],h=[1,28],f=[1,29],d=[1,30],p=[1,31],g=[1,24],y=[1,32],m=[1,33],b=[1,36],v=[71,72],_=[5,8,14,16,18,19,40,41,42,43,44,45,53,60,62,71,72],x=[1,56],k=[1,57],w=[1,58],T=[1,59],E=[1,60],C=[1,61],S=[1,62],A=[62,63],M=[1,74],N=[1,70],O=[1,71],D=[1,72],B=[1,73],L=[1,75],I=[1,79],F=[1,80],R=[1,77],P=[1,78],j=[5,8,14,16,18,19,40,41,42,43,44,45,53,71,72],z={trace:function(){},yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,openDirective:9,typeDirective:10,closeDirective:11,\":\":12,argDirective:13,acc_title:14,acc_title_value:15,acc_descr:16,acc_descr_value:17,acc_descr_multiline_value:18,open_directive:19,type_directive:20,arg_directive:21,close_directive:22,requirementDef:23,elementDef:24,relationshipDef:25,requirementType:26,requirementName:27,STRUCT_START:28,requirementBody:29,ID:30,COLONSEP:31,id:32,TEXT:33,text:34,RISK:35,riskLevel:36,VERIFYMTHD:37,verifyType:38,STRUCT_STOP:39,REQUIREMENT:40,FUNCTIONAL_REQUIREMENT:41,INTERFACE_REQUIREMENT:42,PERFORMANCE_REQUIREMENT:43,PHYSICAL_REQUIREMENT:44,DESIGN_CONSTRAINT:45,LOW_RISK:46,MED_RISK:47,HIGH_RISK:48,VERIFY_ANALYSIS:49,VERIFY_DEMONSTRATION:50,VERIFY_INSPECTION:51,VERIFY_TEST:52,ELEMENT:53,elementName:54,elementBody:55,TYPE:56,type:57,DOCREF:58,ref:59,END_ARROW_L:60,relationship:61,LINE:62,END_ARROW_R:63,CONTAINS:64,COPIES:65,DERIVES:66,SATISFIES:67,VERIFIES:68,REFINES:69,TRACES:70,unqString:71,qString:72,$accept:0,$end:1},terminals_:{2:\"error\",5:\"NEWLINE\",6:\"RD\",8:\"EOF\",12:\":\",14:\"acc_title\",15:\"acc_title_value\",16:\"acc_descr\",17:\"acc_descr_value\",18:\"acc_descr_multiline_value\",19:\"open_directive\",20:\"type_directive\",21:\"arg_directive\",22:\"close_directive\",28:\"STRUCT_START\",30:\"ID\",31:\"COLONSEP\",33:\"TEXT\",35:\"RISK\",37:\"VERIFYMTHD\",39:\"STRUCT_STOP\",40:\"REQUIREMENT\",41:\"FUNCTIONAL_REQUIREMENT\",42:\"INTERFACE_REQUIREMENT\",43:\"PERFORMANCE_REQUIREMENT\",44:\"PHYSICAL_REQUIREMENT\",45:\"DESIGN_CONSTRAINT\",46:\"LOW_RISK\",47:\"MED_RISK\",48:\"HIGH_RISK\",49:\"VERIFY_ANALYSIS\",50:\"VERIFY_DEMONSTRATION\",51:\"VERIFY_INSPECTION\",52:\"VERIFY_TEST\",53:\"ELEMENT\",56:\"TYPE\",58:\"DOCREF\",60:\"END_ARROW_L\",62:\"LINE\",63:\"END_ARROW_R\",64:\"CONTAINS\",65:\"COPIES\",66:\"DERIVES\",67:\"SATISFIES\",68:\"VERIFIES\",69:\"REFINES\",70:\"TRACES\",71:\"unqString\",72:\"qString\"},productions_:[0,[3,3],[3,2],[3,4],[4,3],[4,5],[4,2],[4,2],[4,1],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[23,5],[29,5],[29,5],[29,5],[29,5],[29,2],[29,1],[26,1],[26,1],[26,1],[26,1],[26,1],[26,1],[36,1],[36,1],[36,1],[38,1],[38,1],[38,1],[38,1],[24,5],[55,5],[55,5],[55,2],[55,1],[25,5],[25,5],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[61,1],[27,1],[27,1],[32,1],[32,1],[34,1],[34,1],[54,1],[54,1],[57,1],[57,1],[59,1],[59,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 6:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 7:case 8:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 9:r.parseDirective(\"%%{\",\"open_directive\");break;case 10:r.parseDirective(a[s],\"type_directive\");break;case 11:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 12:r.parseDirective(\"}%%\",\"close_directive\",\"pie\");break;case 13:this.$=[];break;case 19:r.addRequirement(a[s-3],a[s-4]);break;case 20:r.setNewReqId(a[s-2]);break;case 21:r.setNewReqText(a[s-2]);break;case 22:r.setNewReqRisk(a[s-2]);break;case 23:r.setNewReqVerifyMethod(a[s-2]);break;case 26:this.$=r.RequirementType.REQUIREMENT;break;case 27:this.$=r.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 28:this.$=r.RequirementType.INTERFACE_REQUIREMENT;break;case 29:this.$=r.RequirementType.PERFORMANCE_REQUIREMENT;break;case 30:this.$=r.RequirementType.PHYSICAL_REQUIREMENT;break;case 31:this.$=r.RequirementType.DESIGN_CONSTRAINT;break;case 32:this.$=r.RiskLevel.LOW_RISK;break;case 33:this.$=r.RiskLevel.MED_RISK;break;case 34:this.$=r.RiskLevel.HIGH_RISK;break;case 35:this.$=r.VerifyType.VERIFY_ANALYSIS;break;case 36:this.$=r.VerifyType.VERIFY_DEMONSTRATION;break;case 37:this.$=r.VerifyType.VERIFY_INSPECTION;break;case 38:this.$=r.VerifyType.VERIFY_TEST;break;case 39:r.addElement(a[s-3]);break;case 40:r.setNewElementType(a[s-2]);break;case 41:r.setNewElementDocRef(a[s-2]);break;case 44:r.addRelationship(a[s-2],a[s],a[s-4]);break;case 45:r.addRelationship(a[s-2],a[s-4],a[s]);break;case 46:this.$=r.Relationships.CONTAINS;break;case 47:this.$=r.Relationships.COPIES;break;case 48:this.$=r.Relationships.DERIVES;break;case 49:this.$=r.Relationships.SATISFIES;break;case 50:this.$=r.Relationships.VERIFIES;break;case 51:this.$=r.Relationships.REFINES;break;case 52:this.$=r.Relationships.TRACES}},table:[{3:1,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[3]},{3:10,4:2,5:[1,9],6:e,9:4,14:n,16:r,18:i,19:a},{5:[1,11]},{10:12,20:[1,13]},{15:[1,14]},{17:[1,15]},t(o,[2,8]),{20:[2,9]},{3:16,4:2,6:e,9:4,14:n,16:r,18:i,19:a},{1:[2,2]},{4:21,5:s,7:17,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{11:34,12:[1,35],22:b},t([12,22],[2,10]),t(o,[2,6]),t(o,[2,7]),{1:[2,1]},{8:[1,37]},{4:21,5:s,7:38,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:39,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:40,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:41,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{4:21,5:s,7:42,8:c,9:4,14:n,16:r,18:i,19:a,23:18,24:19,25:20,26:23,32:25,40:l,41:u,42:h,43:f,44:d,45:p,53:g,71:y,72:m},{27:43,71:[1,44],72:[1,45]},{54:46,71:[1,47],72:[1,48]},{60:[1,49],62:[1,50]},t(v,[2,26]),t(v,[2,27]),t(v,[2,28]),t(v,[2,29]),t(v,[2,30]),t(v,[2,31]),t(_,[2,55]),t(_,[2,56]),t(o,[2,4]),{13:51,21:[1,52]},t(o,[2,12]),{1:[2,3]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{8:[2,17]},{8:[2,18]},{28:[1,53]},{28:[2,53]},{28:[2,54]},{28:[1,54]},{28:[2,59]},{28:[2,60]},{61:55,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{61:63,64:x,65:k,66:w,67:T,68:E,69:C,70:S},{11:64,22:b},{22:[2,11]},{5:[1,65]},{5:[1,66]},{62:[1,67]},t(A,[2,46]),t(A,[2,47]),t(A,[2,48]),t(A,[2,49]),t(A,[2,50]),t(A,[2,51]),t(A,[2,52]),{63:[1,68]},t(o,[2,5]),{5:M,29:69,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:76,56:R,58:P},{32:81,71:y,72:m},{32:82,71:y,72:m},t(j,[2,19]),{31:[1,83]},{31:[1,84]},{31:[1,85]},{31:[1,86]},{5:M,29:87,30:N,33:O,35:D,37:B,39:L},t(j,[2,25]),t(j,[2,39]),{31:[1,88]},{31:[1,89]},{5:I,39:F,55:90,56:R,58:P},t(j,[2,43]),t(j,[2,44]),t(j,[2,45]),{32:91,71:y,72:m},{34:92,71:[1,93],72:[1,94]},{36:95,46:[1,96],47:[1,97],48:[1,98]},{38:99,49:[1,100],50:[1,101],51:[1,102],52:[1,103]},t(j,[2,24]),{57:104,71:[1,105],72:[1,106]},{59:107,71:[1,108],72:[1,109]},t(j,[2,42]),{5:[1,110]},{5:[1,111]},{5:[2,57]},{5:[2,58]},{5:[1,112]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[1,113]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[2,38]},{5:[1,114]},{5:[2,61]},{5:[2,62]},{5:[1,115]},{5:[2,63]},{5:[2,64]},{5:M,29:116,30:N,33:O,35:D,37:B,39:L},{5:M,29:117,30:N,33:O,35:D,37:B,39:L},{5:M,29:118,30:N,33:O,35:D,37:B,39:L},{5:M,29:119,30:N,33:O,35:D,37:B,39:L},{5:I,39:F,55:120,56:R,58:P},{5:I,39:F,55:121,56:R,58:P},t(j,[2,20]),t(j,[2,21]),t(j,[2,22]),t(j,[2,23]),t(j,[2,40]),t(j,[2,41])],defaultActions:{8:[2,9],10:[2,2],16:[2,1],37:[2,3],38:[2,14],39:[2,15],40:[2,16],41:[2,17],42:[2,18],44:[2,53],45:[2,54],47:[2,59],48:[2,60],52:[2,11],93:[2,57],94:[2,58],96:[2,32],97:[2,33],98:[2,34],100:[2,35],101:[2,36],102:[2,37],103:[2,38],105:[2,61],106:[2,62],108:[2,63],109:[2,64]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),19;case 1:return this.begin(\"type_directive\"),20;case 2:return this.popState(),this.begin(\"arg_directive\"),12;case 3:return this.popState(),this.popState(),22;case 4:return 21;case 5:return\"title\";case 6:return this.begin(\"acc_title\"),14;case 7:return this.popState(),\"acc_title_value\";case 8:return this.begin(\"acc_descr\"),16;case 9:return this.popState(),\"acc_descr_value\";case 10:this.begin(\"acc_descr_multiline\");break;case 11:case 53:this.popState();break;case 12:return\"acc_descr_multiline_value\";case 13:return 5;case 14:case 15:case 16:break;case 17:return 8;case 18:return 6;case 19:return 28;case 20:return 39;case 21:return 31;case 22:return 30;case 23:return 33;case 24:return 35;case 25:return 37;case 26:return 40;case 27:return 41;case 28:return 42;case 29:return 43;case 30:return 44;case 31:return 45;case 32:return 46;case 33:return 47;case 34:return 48;case 35:return 49;case 36:return 50;case 37:return 51;case 38:return 52;case 39:return 53;case 40:return 64;case 41:return 65;case 42:return 66;case 43:return 67;case 44:return 68;case 45:return 69;case 46:return 70;case 47:return 56;case 48:return 58;case 49:return 60;case 50:return 63;case 51:return 62;case 52:this.begin(\"string\");break;case 54:return\"qString\";case 55:return e.yytext=e.yytext.trim(),71}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:(\\r?\\n)+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\\b)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?::)/i,/^(?:id\\b)/i,/^(?:text\\b)/i,/^(?:risk\\b)/i,/^(?:verifyMethod\\b)/i,/^(?:requirement\\b)/i,/^(?:functionalRequirement\\b)/i,/^(?:interfaceRequirement\\b)/i,/^(?:performanceRequirement\\b)/i,/^(?:physicalRequirement\\b)/i,/^(?:designConstraint\\b)/i,/^(?:low\\b)/i,/^(?:medium\\b)/i,/^(?:high\\b)/i,/^(?:analysis\\b)/i,/^(?:demonstration\\b)/i,/^(?:inspection\\b)/i,/^(?:test\\b)/i,/^(?:element\\b)/i,/^(?:contains\\b)/i,/^(?:copies\\b)/i,/^(?:derives\\b)/i,/^(?:satisfies\\b)/i,/^(?:verifies\\b)/i,/^(?:refines\\b)/i,/^(?:traces\\b)/i,/^(?:type\\b)/i,/^(?:docref\\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:[\"])/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[\\w][^\\r\\n\\{\\<\\>\\-\\=]*)/i],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},close_directive:{rules:[],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},open_directive:{rules:[1],inclusive:!1},unqString:{rules:[],inclusive:!1},token:{rules:[],inclusive:!1},string:{rules:[53,54],inclusive:!1},INITIAL:{rules:[0,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,55],inclusive:!0}}};function U(){this.yy={}}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(8800).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},6876:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,18],l=[1,19],u=[1,21],h=[1,22],f=[1,23],d=[1,29],p=[1,30],g=[1,31],y=[1,32],m=[1,33],b=[1,34],v=[1,35],_=[1,36],x=[1,37],k=[1,38],w=[1,39],T=[1,40],E=[1,43],C=[1,44],S=[1,45],A=[1,46],M=[1,47],N=[1,48],O=[1,51],D=[1,4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],B=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,53,58,59,60,61,69,79],L=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,52,53,58,59,60,61,69,79],I=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,51,53,58,59,60,61,69,79],F=[4,5,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,53,58,59,60,61,69,79],R=[67,68,69],P=[1,121],j=[1,4,5,7,16,20,22,25,26,32,33,34,36,38,39,40,41,42,43,45,47,49,50,51,52,53,58,59,60,61,69,79],z={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,directive:6,SD:7,document:8,line:9,statement:10,openDirective:11,typeDirective:12,closeDirective:13,\":\":14,argDirective:15,participant:16,actor:17,AS:18,restOfLine:19,participant_actor:20,signal:21,autonumber:22,NUM:23,off:24,activate:25,deactivate:26,note_statement:27,links_statement:28,link_statement:29,properties_statement:30,details_statement:31,title:32,legacy_title:33,acc_title:34,acc_title_value:35,acc_descr:36,acc_descr_value:37,acc_descr_multiline_value:38,loop:39,end:40,rect:41,opt:42,alt:43,else_sections:44,par:45,par_sections:46,critical:47,option_sections:48,break:49,option:50,and:51,else:52,note:53,placement:54,text2:55,over:56,actor_pair:57,links:58,link:59,properties:60,details:61,spaceList:62,\",\":63,left_of:64,right_of:65,signaltype:66,\"+\":67,\"-\":68,ACTOR:69,SOLID_OPEN_ARROW:70,DOTTED_OPEN_ARROW:71,SOLID_ARROW:72,DOTTED_ARROW:73,SOLID_CROSS:74,DOTTED_CROSS:75,SOLID_POINT:76,DOTTED_POINT:77,TXT:78,open_directive:79,type_directive:80,arg_directive:81,close_directive:82,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NEWLINE\",7:\"SD\",14:\":\",16:\"participant\",18:\"AS\",19:\"restOfLine\",20:\"participant_actor\",22:\"autonumber\",23:\"NUM\",24:\"off\",25:\"activate\",26:\"deactivate\",32:\"title\",33:\"legacy_title\",34:\"acc_title\",35:\"acc_title_value\",36:\"acc_descr\",37:\"acc_descr_value\",38:\"acc_descr_multiline_value\",39:\"loop\",40:\"end\",41:\"rect\",42:\"opt\",43:\"alt\",45:\"par\",47:\"critical\",49:\"break\",50:\"option\",51:\"and\",52:\"else\",53:\"note\",56:\"over\",58:\"links\",59:\"link\",60:\"properties\",61:\"details\",63:\",\",64:\"left_of\",65:\"right_of\",67:\"+\",68:\"-\",69:\"ACTOR\",70:\"SOLID_OPEN_ARROW\",71:\"DOTTED_OPEN_ARROW\",72:\"SOLID_ARROW\",73:\"DOTTED_ARROW\",74:\"SOLID_CROSS\",75:\"DOTTED_CROSS\",76:\"SOLID_POINT\",77:\"DOTTED_POINT\",78:\"TXT\",79:\"open_directive\",80:\"type_directive\",81:\"arg_directive\",82:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,4],[10,3],[10,3],[10,2],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,1],[10,1],[10,2],[10,2],[10,1],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[48,1],[48,4],[46,1],[46,4],[44,1],[44,4],[27,4],[27,4],[28,3],[29,3],[30,3],[31,3],[62,2],[62,1],[57,3],[57,1],[54,1],[54,1],[21,5],[21,5],[21,4],[17,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[66,1],[55,1],[11,1],[12,1],[15,1],[13,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.apply(a[s]),a[s];case 5:case 9:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:case 56:this.$=a[s];break;case 12:a[s-3].type=\"addParticipant\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 13:a[s-1].type=\"addParticipant\",this.$=a[s-1];break;case 14:a[s-3].type=\"addActor\",a[s-3].description=r.parseMessage(a[s-1]),this.$=a[s-3];break;case 15:a[s-1].type=\"addActor\",this.$=a[s-1];break;case 17:this.$={type:\"sequenceIndex\",sequenceIndex:Number(a[s-2]),sequenceIndexStep:Number(a[s-1]),sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 18:this.$={type:\"sequenceIndex\",sequenceIndex:Number(a[s-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 19:this.$={type:\"sequenceIndex\",sequenceVisible:!1,signalType:r.LINETYPE.AUTONUMBER};break;case 20:this.$={type:\"sequenceIndex\",sequenceVisible:!0,signalType:r.LINETYPE.AUTONUMBER};break;case 21:this.$={type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]};break;case 22:this.$={type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-1]};break;case 28:r.setDiagramTitle(a[s].substring(6)),this.$=a[s].substring(6);break;case 29:r.setDiagramTitle(a[s].substring(7)),this.$=a[s].substring(7);break;case 30:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 31:case 32:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:a[s-1].unshift({type:\"loopStart\",loopText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.LOOP_START}),a[s-1].push({type:\"loopEnd\",loopText:a[s-2],signalType:r.LINETYPE.LOOP_END}),this.$=a[s-1];break;case 34:a[s-1].unshift({type:\"rectStart\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_START}),a[s-1].push({type:\"rectEnd\",color:r.parseMessage(a[s-2]),signalType:r.LINETYPE.RECT_END}),this.$=a[s-1];break;case 35:a[s-1].unshift({type:\"optStart\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_START}),a[s-1].push({type:\"optEnd\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.OPT_END}),this.$=a[s-1];break;case 36:a[s-1].unshift({type:\"altStart\",altText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.ALT_START}),a[s-1].push({type:\"altEnd\",signalType:r.LINETYPE.ALT_END}),this.$=a[s-1];break;case 37:a[s-1].unshift({type:\"parStart\",parText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.PAR_START}),a[s-1].push({type:\"parEnd\",signalType:r.LINETYPE.PAR_END}),this.$=a[s-1];break;case 38:a[s-1].unshift({type:\"criticalStart\",criticalText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.CRITICAL_START}),a[s-1].push({type:\"criticalEnd\",signalType:r.LINETYPE.CRITICAL_END}),this.$=a[s-1];break;case 39:a[s-1].unshift({type:\"breakStart\",breakText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_START}),a[s-1].push({type:\"breakEnd\",optText:r.parseMessage(a[s-2]),signalType:r.LINETYPE.BREAK_END}),this.$=a[s-1];break;case 42:this.$=a[s-3].concat([{type:\"option\",optionText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.CRITICAL_OPTION},a[s]]);break;case 44:this.$=a[s-3].concat([{type:\"and\",parText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.PAR_AND},a[s]]);break;case 46:this.$=a[s-3].concat([{type:\"else\",altText:r.parseMessage(a[s-1]),signalType:r.LINETYPE.ALT_ELSE},a[s]]);break;case 47:this.$=[a[s-1],{type:\"addNote\",placement:a[s-2],actor:a[s-1].actor,text:a[s]}];break;case 48:a[s-2]=[].concat(a[s-1],a[s-1]).slice(0,2),a[s-2][0]=a[s-2][0].actor,a[s-2][1]=a[s-2][1].actor,this.$=[a[s-1],{type:\"addNote\",placement:r.PLACEMENT.OVER,actor:a[s-2].slice(0,2),text:a[s]}];break;case 49:this.$=[a[s-1],{type:\"addLinks\",actor:a[s-1].actor,text:a[s]}];break;case 50:this.$=[a[s-1],{type:\"addALink\",actor:a[s-1].actor,text:a[s]}];break;case 51:this.$=[a[s-1],{type:\"addProperties\",actor:a[s-1].actor,text:a[s]}];break;case 52:this.$=[a[s-1],{type:\"addDetails\",actor:a[s-1].actor,text:a[s]}];break;case 55:this.$=[a[s-2],a[s]];break;case 57:this.$=r.PLACEMENT.LEFTOF;break;case 58:this.$=r.PLACEMENT.RIGHTOF;break;case 59:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeStart\",signalType:r.LINETYPE.ACTIVE_START,actor:a[s-1]}];break;case 60:this.$=[a[s-4],a[s-1],{type:\"addMessage\",from:a[s-4].actor,to:a[s-1].actor,signalType:a[s-3],msg:a[s]},{type:\"activeEnd\",signalType:r.LINETYPE.ACTIVE_END,actor:a[s-4]}];break;case 61:this.$=[a[s-3],a[s-1],{type:\"addMessage\",from:a[s-3].actor,to:a[s-1].actor,signalType:a[s-2],msg:a[s]}];break;case 62:this.$={type:\"addParticipant\",actor:a[s]};break;case 63:this.$=r.LINETYPE.SOLID_OPEN;break;case 64:this.$=r.LINETYPE.DOTTED_OPEN;break;case 65:this.$=r.LINETYPE.SOLID;break;case 66:this.$=r.LINETYPE.DOTTED;break;case 67:this.$=r.LINETYPE.SOLID_CROSS;break;case 68:this.$=r.LINETYPE.DOTTED_CROSS;break;case 69:this.$=r.LINETYPE.SOLID_POINT;break;case 70:this.$=r.LINETYPE.DOTTED_POINT;break;case 71:this.$=r.parseMessage(a[s].trim().substring(1));break;case 72:r.parseDirective(\"%%{\",\"open_directive\");break;case 73:r.parseDirective(a[s],\"type_directive\");break;case 74:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 75:r.parseDirective(\"}%%\",\"close_directive\",\"sequence\")}},table:[{3:1,4:e,5:n,6:4,7:r,11:6,79:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,11:6,79:i},{3:9,4:e,5:n,6:4,7:r,11:6,79:i},{3:10,4:e,5:n,6:4,7:r,11:6,79:i},t([1,4,5,16,20,22,25,26,32,33,34,36,38,39,41,42,43,45,47,49,53,58,59,60,61,69,79],a,{8:11}),{12:12,80:[1,13]},{80:[2,72]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{13:49,14:[1,50],82:O},t([14,82],[2,73]),t(D,[2,6]),{6:41,10:52,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},t(D,[2,8]),t(D,[2,9]),{17:53,69:N},{17:54,69:N},{5:[1,55]},{5:[1,58],23:[1,56],24:[1,57]},{17:59,69:N},{17:60,69:N},{5:[1,61]},{5:[1,62]},{5:[1,63]},{5:[1,64]},{5:[1,65]},t(D,[2,28]),t(D,[2,29]),{35:[1,66]},{37:[1,67]},t(D,[2,32]),{19:[1,68]},{19:[1,69]},{19:[1,70]},{19:[1,71]},{19:[1,72]},{19:[1,73]},{19:[1,74]},t(D,[2,40]),{66:75,70:[1,76],71:[1,77],72:[1,78],73:[1,79],74:[1,80],75:[1,81],76:[1,82],77:[1,83]},{54:84,56:[1,85],64:[1,86],65:[1,87]},{17:88,69:N},{17:89,69:N},{17:90,69:N},{17:91,69:N},t([5,18,63,70,71,72,73,74,75,76,77,78],[2,62]),{5:[1,92]},{15:93,81:[1,94]},{5:[2,75]},t(D,[2,7]),{5:[1,96],18:[1,95]},{5:[1,98],18:[1,97]},t(D,[2,16]),{5:[1,100],23:[1,99]},{5:[1,101]},t(D,[2,20]),{5:[1,102]},{5:[1,103]},t(D,[2,23]),t(D,[2,24]),t(D,[2,25]),t(D,[2,26]),t(D,[2,27]),t(D,[2,30]),t(D,[2,31]),t(B,a,{8:104}),t(B,a,{8:105}),t(B,a,{8:106}),t(L,a,{44:107,8:108}),t(I,a,{46:109,8:110}),t(F,a,{48:111,8:112}),t(B,a,{8:113}),{17:116,67:[1,114],68:[1,115],69:N},t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{17:117,69:N},{17:119,57:118,69:N},{69:[2,57]},{69:[2,58]},{55:120,78:P},{55:122,78:P},{55:123,78:P},{55:124,78:P},t(j,[2,10]),{13:125,82:O},{82:[2,74]},{19:[1,126]},t(D,[2,13]),{19:[1,127]},t(D,[2,15]),{5:[1,128]},t(D,[2,18]),t(D,[2,19]),t(D,[2,21]),t(D,[2,22]),{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,129],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,130],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,131],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,132]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,45],41:v,42:_,43:x,45:k,47:w,49:T,52:[1,133],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,134]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,43],41:v,42:_,43:x,45:k,47:w,49:T,51:[1,135],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{40:[1,136]},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[2,41],41:v,42:_,43:x,45:k,47:w,49:T,50:[1,137],53:E,58:C,59:S,60:A,61:M,69:N,79:i},{4:o,5:s,6:41,9:14,10:16,11:6,16:c,17:42,20:l,21:20,22:u,25:h,26:f,27:24,28:25,29:26,30:27,31:28,32:d,33:p,34:g,36:y,38:m,39:b,40:[1,138],41:v,42:_,43:x,45:k,47:w,49:T,53:E,58:C,59:S,60:A,61:M,69:N,79:i},{17:139,69:N},{17:140,69:N},{55:141,78:P},{55:142,78:P},{55:143,78:P},{63:[1,144],78:[2,56]},{5:[2,49]},{5:[2,71]},{5:[2,50]},{5:[2,51]},{5:[2,52]},{5:[1,145]},{5:[1,146]},{5:[1,147]},t(D,[2,17]),t(D,[2,33]),t(D,[2,34]),t(D,[2,35]),t(D,[2,36]),{19:[1,148]},t(D,[2,37]),{19:[1,149]},t(D,[2,38]),{19:[1,150]},t(D,[2,39]),{55:151,78:P},{55:152,78:P},{5:[2,61]},{5:[2,47]},{5:[2,48]},{17:153,69:N},t(j,[2,11]),t(D,[2,12]),t(D,[2,14]),t(L,a,{8:108,44:154}),t(I,a,{8:110,46:155}),t(F,a,{8:112,48:156}),{5:[2,59]},{5:[2,60]},{78:[2,55]},{40:[2,46]},{40:[2,44]},{40:[2,42]}],defaultActions:{7:[2,72],8:[2,1],9:[2,2],10:[2,3],51:[2,75],86:[2,57],87:[2,58],94:[2,74],120:[2,49],121:[2,71],122:[2,50],123:[2,51],124:[2,52],141:[2,61],142:[2,47],143:[2,48],151:[2,59],152:[2,60],153:[2,55],154:[2,46],155:[2,44],156:[2,42]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},Y={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),79;case 1:return this.begin(\"type_directive\"),80;case 2:return this.popState(),this.begin(\"arg_directive\"),14;case 3:return this.popState(),this.popState(),82;case 4:return 81;case 5:case 52:case 65:return 5;case 6:case 7:case 8:case 9:case 10:break;case 11:return 23;case 12:return this.begin(\"ID\"),16;case 13:return this.begin(\"ID\"),20;case 14:return e.yytext=e.yytext.trim(),this.begin(\"ALIAS\"),69;case 15:return this.popState(),this.popState(),this.begin(\"LINE\"),18;case 16:return this.popState(),this.popState(),5;case 17:return this.begin(\"LINE\"),39;case 18:return this.begin(\"LINE\"),41;case 19:return this.begin(\"LINE\"),42;case 20:return this.begin(\"LINE\"),43;case 21:return this.begin(\"LINE\"),52;case 22:return this.begin(\"LINE\"),45;case 23:return this.begin(\"LINE\"),51;case 24:return this.begin(\"LINE\"),47;case 25:return this.begin(\"LINE\"),50;case 26:return this.begin(\"LINE\"),49;case 27:return this.popState(),19;case 28:return 40;case 29:return 64;case 30:return 65;case 31:return 58;case 32:return 59;case 33:return 60;case 34:return 61;case 35:return 56;case 36:return 53;case 37:return this.begin(\"ID\"),25;case 38:return this.begin(\"ID\"),26;case 39:return 32;case 40:return 33;case 41:return this.begin(\"acc_title\"),34;case 42:return this.popState(),\"acc_title_value\";case 43:return this.begin(\"acc_descr\"),36;case 44:return this.popState(),\"acc_descr_value\";case 45:this.begin(\"acc_descr_multiline\");break;case 46:this.popState();break;case 47:return\"acc_descr_multiline_value\";case 48:return 7;case 49:return 22;case 50:return 24;case 51:return 63;case 53:return e.yytext=e.yytext.trim(),69;case 54:return 72;case 55:return 73;case 56:return 70;case 57:return 71;case 58:return 74;case 59:return 75;case 60:return 76;case 61:return 77;case 62:return 78;case 63:return 67;case 64:return 68;case 66:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[0-9]+(?=[ \\n]+))/i,/^(?:participant\\b)/i,/^(?:actor\\b)/i,/^(?:[^\\->:\\n,;]+?(?=((?!\\n)\\s)+as(?!\\n)\\s|[#\\n;]|$))/i,/^(?:as\\b)/i,/^(?:(?:))/i,/^(?:loop\\b)/i,/^(?:rect\\b)/i,/^(?:opt\\b)/i,/^(?:alt\\b)/i,/^(?:else\\b)/i,/^(?:par\\b)/i,/^(?:and\\b)/i,/^(?:critical\\b)/i,/^(?:option\\b)/i,/^(?:break\\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\\n;]*)/i,/^(?:end\\b)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:links\\b)/i,/^(?:link\\b)/i,/^(?:properties\\b)/i,/^(?:details\\b)/i,/^(?:over\\b)/i,/^(?:note\\b)/i,/^(?:activate\\b)/i,/^(?:deactivate\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:title:\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:sequenceDiagram\\b)/i,/^(?:autonumber\\b)/i,/^(?:off\\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\\+\\->:\\n,;]+((?!(-x|--x|-\\)|--\\)))[\\-]*[^\\+\\->:\\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\\)])/i,/^(?:--[\\)])/i,/^(?::(?:(?:no)?wrap)?[^#\\n;]+)/i,/^(?:\\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[46,47],inclusive:!1},acc_descr:{rules:[44],inclusive:!1},acc_title:{rules:[42],inclusive:!1},open_directive:{rules:[1,8],inclusive:!1},type_directive:{rules:[2,3,8],inclusive:!1},arg_directive:{rules:[3,4,8],inclusive:!1},ID:{rules:[7,8,14],inclusive:!1},ALIAS:{rules:[7,8,15,16],inclusive:!1},LINE:{rules:[7,8,27],inclusive:!1},INITIAL:{rules:[0,5,6,8,9,10,11,12,13,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],inclusive:!0}}};function U(){this.yy={}}return z.lexer=Y,U.prototype=z,z.Parser=U,new U}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(1993).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},3584:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,3],r=[1,5],i=[1,7],a=[2,5],o=[1,15],s=[1,17],c=[1,19],l=[1,20],u=[1,21],h=[1,22],f=[1,33],d=[1,23],p=[1,24],g=[1,25],y=[1,26],m=[1,27],b=[1,30],v=[1,31],_=[1,32],x=[1,35],k=[1,36],w=[1,37],T=[1,38],E=[1,34],C=[1,41],S=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],A=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],M=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],N=[4,5,14,15,17,19,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],O={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,directive:6,SD:7,document:8,line:9,statement:10,idStatement:11,DESCR:12,\"--\\x3e\":13,HIDE_EMPTY:14,scale:15,WIDTH:16,COMPOSIT_STATE:17,STRUCT_START:18,STRUCT_STOP:19,STATE_DESCR:20,AS:21,ID:22,FORK:23,JOIN:24,CHOICE:25,CONCURRENT:26,note:27,notePosition:28,NOTE_TEXT:29,direction:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,openDirective:36,typeDirective:37,closeDirective:38,\":\":39,argDirective:40,direction_tb:41,direction_bt:42,direction_rl:43,direction_lr:44,eol:45,\";\":46,EDGE_STATE:47,left_of:48,right_of:49,open_directive:50,type_directive:51,arg_directive:52,close_directive:53,$accept:0,$end:1},terminals_:{2:\"error\",4:\"SPACE\",5:\"NL\",7:\"SD\",12:\"DESCR\",13:\"--\\x3e\",14:\"HIDE_EMPTY\",15:\"scale\",16:\"WIDTH\",17:\"COMPOSIT_STATE\",18:\"STRUCT_START\",19:\"STRUCT_STOP\",20:\"STATE_DESCR\",21:\"AS\",22:\"ID\",23:\"FORK\",24:\"JOIN\",25:\"CHOICE\",26:\"CONCURRENT\",27:\"note\",29:\"NOTE_TEXT\",31:\"acc_title\",32:\"acc_title_value\",33:\"acc_descr\",34:\"acc_descr_value\",35:\"acc_descr_multiline_value\",39:\":\",41:\"direction_tb\",42:\"direction_bt\",43:\"direction_rl\",44:\"direction_lr\",46:\";\",47:\"EDGE_STATE\",48:\"left_of\",49:\"right_of\",50:\"open_directive\",51:\"type_directive\",52:\"arg_directive\",53:\"close_directive\"},productions_:[0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[10,2],[10,2],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[45,1],[45,1],[11,1],[11,1],[28,1],[28,1],[36,1],[37,1],[40,1],[38,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 4:return r.setRootDoc(a[s]),a[s];case 5:this.$=[];break;case 6:\"nl\"!=a[s]&&(a[s-1].push(a[s]),this.$=a[s-1]);break;case 7:case 8:case 39:case 40:this.$=a[s];break;case 9:this.$=\"nl\";break;case 10:this.$={stmt:\"state\",id:a[s],type:\"default\",description:\"\"};break;case 11:this.$={stmt:\"state\",id:a[s-1],type:\"default\",description:r.trimColon(a[s])};break;case 12:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-2],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s],type:\"default\",description:\"\"}};break;case 13:this.$={stmt:\"relation\",state1:{stmt:\"state\",id:a[s-3],type:\"default\",description:\"\"},state2:{stmt:\"state\",id:a[s-1],type:\"default\",description:\"\"},description:a[s].substr(1).trim()};break;case 17:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:\"\",doc:a[s-1]};break;case 18:var c=a[s],l=a[s-2].trim();if(a[s].match(\":\")){var u=a[s].split(\":\");c=u[0],l=[l,u[1]]}this.$={stmt:\"state\",id:c,type:\"default\",description:l};break;case 19:this.$={stmt:\"state\",id:a[s-3],type:\"default\",description:a[s-5],doc:a[s-1]};break;case 20:this.$={stmt:\"state\",id:a[s],type:\"fork\"};break;case 21:this.$={stmt:\"state\",id:a[s],type:\"join\"};break;case 22:this.$={stmt:\"state\",id:a[s],type:\"choice\"};break;case 23:this.$={stmt:\"state\",id:r.getDividerId(),type:\"divider\"};break;case 24:this.$={stmt:\"state\",id:a[s-1].trim(),note:{position:a[s-2].trim(),text:a[s].trim()}};break;case 28:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 29:case 30:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 33:r.setDirection(\"TB\"),this.$={stmt:\"dir\",value:\"TB\"};break;case 34:r.setDirection(\"BT\"),this.$={stmt:\"dir\",value:\"BT\"};break;case 35:r.setDirection(\"RL\"),this.$={stmt:\"dir\",value:\"RL\"};break;case 36:r.setDirection(\"LR\"),this.$={stmt:\"dir\",value:\"LR\"};break;case 43:r.parseDirective(\"%%{\",\"open_directive\");break;case 44:r.parseDirective(a[s],\"type_directive\");break;case 45:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 46:r.parseDirective(\"}%%\",\"close_directive\",\"state\")}},table:[{3:1,4:e,5:n,6:4,7:r,36:6,50:i},{1:[3]},{3:8,4:e,5:n,6:4,7:r,36:6,50:i},{3:9,4:e,5:n,6:4,7:r,36:6,50:i},{3:10,4:e,5:n,6:4,7:r,36:6,50:i},t([1,4,5,14,15,17,20,22,23,24,25,26,27,31,33,35,41,42,43,44,47,50],a,{8:11}),{37:12,51:[1,13]},{51:[2,43]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},{38:39,39:[1,40],53:C},t([39,53],[2,44]),t(S,[2,6]),{6:28,10:42,11:18,14:c,15:l,17:u,20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,8]),t(S,[2,9]),t(S,[2,10],{12:[1,43],13:[1,44]}),t(S,[2,14]),{16:[1,45]},t(S,[2,16],{18:[1,46]}),{21:[1,47]},t(S,[2,20]),t(S,[2,21]),t(S,[2,22]),t(S,[2,23]),{28:48,29:[1,49],48:[1,50],49:[1,51]},t(S,[2,26]),t(S,[2,27]),{32:[1,52]},{34:[1,53]},t(S,[2,30]),t(A,[2,39]),t(A,[2,40]),t(S,[2,33]),t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(M,[2,31]),{40:54,52:[1,55]},t(M,[2,46]),t(S,[2,7]),t(S,[2,11]),{11:56,22:f,47:E},t(S,[2,15]),t(N,a,{8:57}),{22:[1,58]},{22:[1,59]},{21:[1,60]},{22:[2,41]},{22:[2,42]},t(S,[2,28]),t(S,[2,29]),{38:61,53:C},{53:[2,45]},t(S,[2,12],{12:[1,62]}),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,63],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,18],{18:[1,64]}),{29:[1,65]},{22:[1,66]},t(M,[2,32]),t(S,[2,13]),t(S,[2,17]),t(N,a,{8:67}),t(S,[2,24]),t(S,[2,25]),{4:o,5:s,6:28,9:14,10:16,11:18,14:c,15:l,17:u,19:[1,68],20:h,22:f,23:d,24:p,25:g,26:y,27:m,30:29,31:b,33:v,35:_,36:6,41:x,42:k,43:w,44:T,47:E,50:i},t(S,[2,19])],defaultActions:{7:[2,43],8:[2,1],9:[2,2],10:[2,3],50:[2,41],51:[2,42],55:[2,45]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},D={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:case 33:return 41;case 1:case 34:return 42;case 2:case 35:return 43;case 3:case 36:return 44;case 4:return this.begin(\"open_directive\"),50;case 5:return this.begin(\"type_directive\"),51;case 6:return this.popState(),this.begin(\"arg_directive\"),39;case 7:return this.popState(),this.popState(),53;case 8:return 52;case 9:case 10:case 12:case 13:case 14:case 15:case 46:case 52:break;case 11:case 66:return 5;case 16:return this.pushState(\"SCALE\"),15;case 17:return 16;case 18:case 24:case 40:case 43:this.popState();break;case 19:return this.begin(\"acc_title\"),31;case 20:return this.popState(),\"acc_title_value\";case 21:return this.begin(\"acc_descr\"),33;case 22:return this.popState(),\"acc_descr_value\";case 23:this.begin(\"acc_descr_multiline\");break;case 25:return\"acc_descr_multiline_value\";case 26:this.pushState(\"STATE\");break;case 27:case 30:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),23;case 28:case 31:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),24;case 29:case 32:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),25;case 37:this.begin(\"STATE_STRING\");break;case 38:return this.popState(),this.pushState(\"STATE_ID\"),\"AS\";case 39:case 54:return this.popState(),\"ID\";case 41:return\"STATE_DESCR\";case 42:return 17;case 44:return this.popState(),this.pushState(\"struct\"),18;case 45:return this.popState(),19;case 47:return this.begin(\"NOTE\"),27;case 48:return this.popState(),this.pushState(\"NOTE_ID\"),48;case 49:return this.popState(),this.pushState(\"NOTE_ID\"),49;case 50:this.popState(),this.pushState(\"FLOATING_NOTE\");break;case 51:return this.popState(),this.pushState(\"FLOATING_NOTE_ID\"),\"AS\";case 53:return\"NOTE_TEXT\";case 55:return this.popState(),this.pushState(\"NOTE_TEXT\"),22;case 56:return this.popState(),e.yytext=e.yytext.substr(2).trim(),29;case 57:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),29;case 58:case 59:return 7;case 60:return 14;case 61:return 47;case 62:return 22;case 63:return e.yytext=e.yytext.trim(),12;case 64:return 13;case 65:return 26;case 67:return\"INVALID\"}},rules:[/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:[\\s]+)/i,/^(?:((?!\\n)\\s)+)/i,/^(?:#[^\\n]*)/i,/^(?:%[^\\n]*)/i,/^(?:scale\\s+)/i,/^(?:\\d+)/i,/^(?:\\s+width\\b)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:state\\s+)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*<>)/i,/^(?:.*\\[\\[fork\\]\\])/i,/^(?:.*\\[\\[join\\]\\])/i,/^(?:.*\\[\\[choice\\]\\])/i,/^(?:.*direction\\s+TB[^\\n]*)/i,/^(?:.*direction\\s+BT[^\\n]*)/i,/^(?:.*direction\\s+RL[^\\n]*)/i,/^(?:.*direction\\s+LR[^\\n]*)/i,/^(?:[\"])/i,/^(?:\\s*as\\s+)/i,/^(?:[^\\n\\{]*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n\\s\\{]+)/i,/^(?:\\n)/i,/^(?:\\{)/i,/^(?:\\})/i,/^(?:[\\n])/i,/^(?:note\\s+)/i,/^(?:left of\\b)/i,/^(?:right of\\b)/i,/^(?:\")/i,/^(?:\\s*as\\s*)/i,/^(?:[\"])/i,/^(?:[^\"]*)/i,/^(?:[^\\n]*)/i,/^(?:\\s*[^:\\n\\s\\-]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:[\\s\\S]*?end note\\b)/i,/^(?:stateDiagram\\s+)/i,/^(?:stateDiagram-v2\\s+)/i,/^(?:hide empty description\\b)/i,/^(?:\\[\\*\\])/i,/^(?:[^:\\n\\s\\-\\{]+)/i,/^(?:\\s*:[^:\\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[13,14],inclusive:!1},close_directive:{rules:[13,14],inclusive:!1},arg_directive:{rules:[7,8,13,14],inclusive:!1},type_directive:{rules:[6,7,13,14],inclusive:!1},open_directive:{rules:[5,13,14],inclusive:!1},struct:{rules:[13,14,26,33,34,35,36,45,46,47,61,62,63,64,65],inclusive:!1},FLOATING_NOTE_ID:{rules:[54],inclusive:!1},FLOATING_NOTE:{rules:[51,52,53],inclusive:!1},NOTE_TEXT:{rules:[56,57],inclusive:!1},NOTE_ID:{rules:[55],inclusive:!1},NOTE:{rules:[48,49,50],inclusive:!1},acc_descr_multiline:{rules:[24,25],inclusive:!1},acc_descr:{rules:[22],inclusive:!1},acc_title:{rules:[20],inclusive:!1},SCALE:{rules:[17,18],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[39],inclusive:!1},STATE_STRING:{rules:[40,41],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[13,14,27,28,29,30,31,32,37,38,42,43,44],inclusive:!1},ID:{rules:[13,14],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,9,10,11,12,14,15,16,19,21,23,26,44,47,58,59,60,61,62,63,64,66,67],inclusive:!0}}};function B(){this.yy={}}return O.lexer=D,B.prototype=O,O.Parser=B,new B}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(3069).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},9763:(t,e,n)=>{t=n.nmd(t);var r=function(){var t=function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},e=[1,2],n=[1,5],r=[6,9,11,17,18,20,22,23,24,26],i=[1,15],a=[1,16],o=[1,17],s=[1,18],c=[1,19],l=[1,20],u=[1,24],h=[4,6,9,11,17,18,20,22,23,24,26],f={trace:function(){},yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,directive:7,line:8,SPACE:9,statement:10,NEWLINE:11,openDirective:12,typeDirective:13,closeDirective:14,\":\":15,argDirective:16,title:17,acc_title:18,acc_title_value:19,acc_descr:20,acc_descr_value:21,acc_descr_multiline_value:22,section:23,taskName:24,taskData:25,open_directive:26,type_directive:27,arg_directive:28,close_directive:29,$accept:0,$end:1},terminals_:{2:\"error\",4:\"journey\",6:\"EOF\",9:\"SPACE\",11:\"NEWLINE\",15:\":\",17:\"title\",18:\"acc_title\",19:\"acc_title_value\",20:\"acc_descr\",21:\"acc_descr_value\",22:\"acc_descr_multiline_value\",23:\"section\",24:\"taskName\",25:\"taskData\",26:\"open_directive\",27:\"type_directive\",28:\"arg_directive\",29:\"close_directive\"},productions_:[0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,2],[10,2],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],performAction:function(t,e,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:case 7:case 8:this.$=[];break;case 4:a[s-1].push(a[s]),this.$=a[s-1];break;case 5:case 6:this.$=a[s];break;case 11:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 16:r.addTask(a[s-1],a[s]),this.$=\"task\";break;case 18:r.parseDirective(\"%%{\",\"open_directive\");break;case 19:r.parseDirective(a[s],\"type_directive\");break;case 20:a[s]=a[s].trim().replace(/'/g,'\"'),r.parseDirective(a[s],\"arg_directive\");break;case 21:r.parseDirective(\"}%%\",\"close_directive\",\"journey\")}},table:[{3:1,4:e,7:3,12:4,26:n},{1:[3]},t(r,[2,3],{5:6}),{3:7,4:e,7:3,12:4,26:n},{13:8,27:[1,9]},{27:[2,18]},{6:[1,10],7:21,8:11,9:[1,12],10:13,11:[1,14],12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},{1:[2,2]},{14:22,15:[1,23],29:u},t([15,29],[2,19]),t(r,[2,8],{1:[2,1]}),t(r,[2,4]),{7:21,10:25,12:4,17:i,18:a,20:o,22:s,23:c,24:l,26:n},t(r,[2,6]),t(r,[2,7]),t(r,[2,11]),{19:[1,26]},{21:[1,27]},t(r,[2,14]),t(r,[2,15]),{25:[1,28]},t(r,[2,17]),{11:[1,29]},{16:30,28:[1,31]},{11:[2,21]},t(r,[2,5]),t(r,[2,12]),t(r,[2,13]),t(r,[2,16]),t(h,[2,9]),{14:32,29:u},{29:[2,20]},{11:[1,33]},t(h,[2,10])],defaultActions:{5:[2,18],7:[2,2],24:[2,21],31:[2,20]},parseError:function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},parse:function(t){var e=this,n=[0],r=[],i=[null],a=[],o=this.table,s=\"\",c=0,l=0,u=0,h=2,f=1,d=a.slice.call(arguments,1),p=Object.create(this.lexer),g={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(g.yy[y]=this.yy[y]);p.setInput(t,g.yy),g.yy.lexer=p,g.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var m=p.yylloc;a.push(m);var b=p.options&&p.options.ranges;function v(){var t;return\"number\"!=typeof(t=r.pop()||p.lex()||f)&&(t instanceof Array&&(t=(r=t).pop()),t=e.symbols_[t]||t),t}\"function\"==typeof g.yy.parseError?this.parseError=g.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var _,x,k,w,T,E,C,S,A,M={};;){if(k=n[n.length-1],this.defaultActions[k]?w=this.defaultActions[k]:(null==_&&(_=v()),w=o[k]&&o[k][_]),void 0===w||!w.length||!w[0]){var N=\"\";for(E in A=[],o[k])this.terminals_[E]&&E>h&&A.push(\"'\"+this.terminals_[E]+\"'\");N=p.showPosition?\"Parse error on line \"+(c+1)+\":\\n\"+p.showPosition()+\"\\nExpecting \"+A.join(\", \")+\", got '\"+(this.terminals_[_]||_)+\"'\":\"Parse error on line \"+(c+1)+\": Unexpected \"+(_==f?\"end of input\":\"'\"+(this.terminals_[_]||_)+\"'\"),this.parseError(N,{text:p.match,token:this.terminals_[_]||_,line:p.yylineno,loc:m,expected:A})}if(w[0]instanceof Array&&w.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+k+\", token: \"+_);switch(w[0]){case 1:n.push(_),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),_=null,x?(_=x,x=null):(l=p.yyleng,s=p.yytext,c=p.yylineno,m=p.yylloc,u>0&&u--);break;case 2:if(C=this.productions_[w[1]][1],M.$=i[i.length-C],M._$={first_line:a[a.length-(C||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(C||1)].first_column,last_column:a[a.length-1].last_column},b&&(M._$.range=[a[a.length-(C||1)].range[0],a[a.length-1].range[1]]),void 0!==(T=this.performAction.apply(M,[s,l,c,g.yy,w[1],i,a].concat(d))))return T;C&&(n=n.slice(0,-1*C*2),i=i.slice(0,-1*C),a=a.slice(0,-1*C)),n.push(this.productions_[w[1]][0]),i.push(M.$),a.push(M._$),S=o[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0}},d={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=\"\",this.conditionStack=[\"INITIAL\"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\\r\\n?|\\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,n=t.split(/(?:\\r\\n?|\\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\\r\\n?|\\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?\"...\":\"\")+t.substr(-20).replace(/\\n/g,\"\")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?\"...\":\"\")).replace(/\\n/g,\"\")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join(\"-\");return t+this.upcomingInput()+\"\\n\"+e+\"^\"},test_match:function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\\r\\n?|\\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\\r?\\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext=\"\",this.match=\"\");for(var i=this._currentRules(),a=0;ae[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:\"\"===this._input?this.EOF:this.parseError(\"Lexical error on line \"+(this.yylineno+1)+\". Unrecognized text.\\n\"+this.showPosition(),{text:\"\",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:\"INITIAL\"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{\"case-insensitive\":!0},performAction:function(t,e,n,r){switch(n){case 0:return this.begin(\"open_directive\"),26;case 1:return this.begin(\"type_directive\"),27;case 2:return this.popState(),this.begin(\"arg_directive\"),15;case 3:return this.popState(),this.popState(),29;case 4:return 28;case 5:case 6:case 8:case 9:break;case 7:return 11;case 10:return 4;case 11:return 17;case 12:return this.begin(\"acc_title\"),18;case 13:return this.popState(),\"acc_title_value\";case 14:return this.begin(\"acc_descr\"),20;case 15:return this.popState(),\"acc_descr_value\";case 16:this.begin(\"acc_descr_multiline\");break;case 17:this.popState();break;case 18:return\"acc_descr_multiline_value\";case 19:return 23;case 20:return 24;case 21:return 25;case 22:return 15;case 23:return 6;case 24:return\"INVALID\"}},rules:[/^(?:%%\\{)/i,/^(?:((?:(?!\\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\\}%%)/i,/^(?:((?:(?!\\}%%).|\\n)*))/i,/^(?:%(?!\\{)[^\\n]*)/i,/^(?:[^\\}]%%[^\\n]*)/i,/^(?:[\\n]+)/i,/^(?:\\s+)/i,/^(?:#[^\\n]*)/i,/^(?:journey\\b)/i,/^(?:title\\s[^#\\n;]+)/i,/^(?:accTitle\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*:\\s*)/i,/^(?:(?!\\n||)*[^\\n]*)/i,/^(?:accDescr\\s*\\{\\s*)/i,/^(?:[\\}])/i,/^(?:[^\\}]*)/i,/^(?:section\\s[^#:\\n;]+)/i,/^(?:[^#:\\n;]+)/i,/^(?::[^#\\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{open_directive:{rules:[1],inclusive:!1},type_directive:{rules:[2,3],inclusive:!1},arg_directive:{rules:[3,4],inclusive:!1},acc_descr_multiline:{rules:[17,18],inclusive:!1},acc_descr:{rules:[15],inclusive:!1},acc_title:{rules:[13],inclusive:!1},INITIAL:{rules:[0,5,6,7,8,9,10,11,12,14,16,19,20,21,22,23,24],inclusive:!0}}};function p(){this.yy={}}return f.lexer=d,p.prototype=f,f.Parser=p,new p}();e.parser=r,e.Parser=r.Parser,e.parse=function(){return r.parse.apply(r,arguments)},e.main=function(t){t[1]||(console.log(\"Usage: \"+t[0]+\" FILE\"),process.exit(1));var r=n(9143).readFileSync(n(6470).normalize(t[1]),\"utf8\");return e.parser.parse(r)},n.c[n.s]===t&&e.main(process.argv.slice(1))},7967:(t,e)=>{e.N=void 0;var n=/^([^\\w]*)(javascript|data|vbscript)/im,r=/&#(\\w+)(^\\w|;)?/g,i=/[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]/gim,a=/^([^:]+):/gm,o=[\".\",\"/\"];e.N=function(t){var e,s=(e=t||\"\",e.replace(r,(function(t,e){return String.fromCharCode(e)}))).replace(i,\"\").trim();if(!s)return\"about:blank\";if(function(t){return o.indexOf(t[0])>-1}(s))return s;var c=s.match(a);if(!c)return s;var l=c[0];return n.test(l)?\"about:blank\":s}},3841:t=>{t.exports=function(t,e){return t.intersect(e)}},6187:(t,e,n)=>{n.d(e,{Z:()=>fu});var r=n(1941),i=n.n(r),a={debug:1,info:2,warn:3,error:4,fatal:5},o={debug:function(){},info:function(){},warn:function(){},error:function(){},fatal:function(){}},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"fatal\";isNaN(t)&&(t=t.toLowerCase(),void 0!==a[t]&&(t=a[t])),o.trace=function(){},o.debug=function(){},o.info=function(){},o.warn=function(){},o.error=function(){},o.fatal=function(){},t<=a.fatal&&(o.fatal=console.error?console.error.bind(console,c(\"FATAL\"),\"color: orange\"):console.log.bind(console,\"\u001b[35m\",c(\"FATAL\"))),t<=a.error&&(o.error=console.error?console.error.bind(console,c(\"ERROR\"),\"color: orange\"):console.log.bind(console,\"\u001b[31m\",c(\"ERROR\"))),t<=a.warn&&(o.warn=console.warn?console.warn.bind(console,c(\"WARN\"),\"color: orange\"):console.log.bind(console,\"\u001b[33m\",c(\"WARN\"))),t<=a.info&&(o.info=console.info?console.info.bind(console,c(\"INFO\"),\"color: lightblue\"):console.log.bind(console,\"\u001b[34m\",c(\"INFO\"))),t<=a.debug&&(o.debug=console.debug?console.debug.bind(console,c(\"DEBUG\"),\"color: lightgreen\"):console.log.bind(console,\"\u001b[32m\",c(\"DEBUG\")))},c=function(t){var e=i()().format(\"ss.SSS\");return\"%c\".concat(e,\" : \").concat(t,\" : \")},l=n(7543),u=\"comm\",h=\"rule\",f=\"decl\",d=Math.abs,p=String.fromCharCode;function g(t){return t.trim()}function y(t,e,n){return t.replace(e,n)}function m(t,e){return t.indexOf(e)}function b(t,e){return 0|t.charCodeAt(e)}function v(t,e,n){return t.slice(e,n)}function _(t){return t.length}function x(t){return t.length}function k(t,e){return e.push(t),t}function w(t,e){for(var n=\"\",r=x(t),i=0;i0?b(N,--A):0,C--,10===M&&(C=1,E--),M}function B(){return M=A2||R(M)>3?\"\":\" \"}function z(t,e){for(;--e&&B()&&!(M<48||M>102||M>57&&M<65||M>70&&M<97););return F(t,I()+(e<6&&32==L()&&32==B()))}function Y(t){for(;B();)switch(M){case t:return A;case 34:case 39:34!==t&&39!==t&&Y(M);break;case 40:41===t&&Y(t);break;case 92:B()}return A}function U(t,e){for(;B()&&t+M!==57&&(t+M!==84||47!==L()););return\"/*\"+F(e,A-1)+\"*\"+p(47===t?t:B())}function $(t){for(;!R(L());)B();return F(t,A)}function W(t){return function(t){return N=\"\",t}(q(\"\",null,null,null,[\"\"],t=function(t){return E=C=1,S=_(N=t),A=0,[]}(t),0,[0],t))}function q(t,e,n,r,i,a,o,s,c){for(var l=0,u=0,h=o,f=0,d=0,g=0,b=1,v=1,x=1,w=0,T=\"\",E=i,C=a,S=r,A=T;v;)switch(g=w,w=B()){case 40:if(108!=g&&58==A.charCodeAt(h-1)){-1!=m(A+=y(P(w),\"&\",\"&\\f\"),\"&\\f\")&&(x=-1);break}case 34:case 39:case 91:A+=P(w);break;case 9:case 10:case 13:case 32:A+=j(g);break;case 92:A+=z(I()-1,7);continue;case 47:switch(L()){case 42:case 47:k(V(U(B(),I()),e,n),c);break;default:A+=\"/\"}break;case 123*b:s[l++]=_(A)*x;case 125*b:case 59:case 0:switch(w){case 0:case 125:v=0;case 59+u:d>0&&_(A)-h&&k(d>32?G(A+\";\",r,n,h-1):G(y(A,\" \",\"\")+\";\",r,n,h-2),c);break;case 59:A+=\";\";default:if(k(S=H(A,e,n,l,u,i,s,T,E=[],C=[],h),a),123===w)if(0===u)q(A,e,S,S,E,a,h,s,C);else switch(f){case 100:case 109:case 115:q(t,S,S,r&&k(H(t,S,S,0,0,i,s,T,i,E=[],h),C),i,C,h,s,r?E:C);break;default:q(A,S,S,S,[\"\"],C,0,s,C)}}l=u=d=0,b=x=1,T=A=\"\",h=o;break;case 58:h=1+_(A),d=g;default:if(b<1)if(123==w)--b;else if(125==w&&0==b++&&125==D())continue;switch(A+=p(w),w*b){case 38:x=u>0?1:(A+=\"\\f\",-1);break;case 44:s[l++]=(_(A)-1)*x,x=1;break;case 64:45===L()&&(A+=P(B())),f=L(),u=h=_(T=A+=$(I())),w++;break;case 45:45===g&&2==_(A)&&(b=0)}}return a}function H(t,e,n,r,i,a,o,s,c,l,u){for(var f=i-1,p=0===i?a:[\"\"],m=x(p),b=0,_=0,k=0;b0?p[w]+\" \"+T:y(T,/&\\f/g,p[w])))&&(c[k++]=E);return O(t,e,n,0===i?h:s,c,l,u)}function V(t,e,n){return O(t,e,n,u,p(M),v(t,2,-2),0)}function G(t,e,n,r){return O(t,e,n,f,v(t,0,r),v(t,r+1,-1),r)}const X=\"9.1.7\";function Z(t){return Z=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Z(t)}const Q=function t(e,n,r){var i=Object.assign({depth:2,clobber:!1},r),a=i.depth,o=i.clobber;return Array.isArray(n)&&!Array.isArray(e)?(n.forEach((function(n){return t(e,n,r)})),e):Array.isArray(n)&&Array.isArray(e)?(n.forEach((function(t){-1===e.indexOf(t)&&e.push(t)})),e):void 0===e||a<=0?null!=e&&\"object\"===Z(e)&&\"object\"===Z(n)?Object.assign(e,n):n:(void 0!==n&&\"object\"===Z(e)&&\"object\"===Z(n)&&Object.keys(n).forEach((function(r){\"object\"!==Z(n[r])||void 0!==e[r]&&\"object\"!==Z(e[r])?(o||\"object\"!==Z(e[r])&&\"object\"!==Z(n[r]))&&(e[r]=n[r]):(void 0===e[r]&&(e[r]=Array.isArray(n[r])?[]:{}),e[r]=t(e[r],n[r],{depth:a-1,clobber:o}))})),e)},K={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:t=>t>=255?255:t<0?0:t,g:t=>t>=255?255:t<0?0:t,b:t=>t>=255?255:t<0?0:t,h:t=>t%360,s:t=>t>=100?100:t<0?0:t,l:t=>t>=100?100:t<0?0:t,a:t=>t>=1?1:t<0?0:t},toLinear:t=>{const e=t/255;return t>.03928?Math.pow((e+.055)/1.055,2.4):e/12.92},hue2rgb:(t,e,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t),hsl2rgb:({h:t,s:e,l:n},r)=>{if(!e)return 2.55*n;t/=360,e/=100;const i=(n/=100)<.5?n*(1+e):n+e-n*e,a=2*n-i;switch(r){case\"r\":return 255*K.hue2rgb(a,i,t+1/3);case\"g\":return 255*K.hue2rgb(a,i,t);case\"b\":return 255*K.hue2rgb(a,i,t-1/3)}},rgb2hsl:({r:t,g:e,b:n},r)=>{t/=255,e/=255,n/=255;const i=Math.max(t,e,n),a=Math.min(t,e,n),o=(i+a)/2;if(\"l\"===r)return 100*o;if(i===a)return 0;const s=i-a;if(\"s\"===r)return 100*(o>.5?s/(2-i-a):s/(i+a));switch(i){case t:return 60*((e-n)/s+(ee>n?Math.min(e,Math.max(n,t)):Math.min(n,Math.max(e,t)),round:t=>Math.round(1e10*t)/1e10},unit:{dec2hex:t=>{const e=Math.round(t).toString(16);return e.length>1?e:`0${e}`}}},tt={};for(let t=0;t<=255;t++)tt[t]=J.unit.dec2hex(t);const et=new class{constructor(t,e){this.color=e,this.changed=!1,this.data=t,this.type=new class{constructor(){this.type=0}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error(\"Cannot change both RGB and HSL channels at the same time\");this.type=t}reset(){this.type=0}is(t){return this.type===t}}}set(t,e){return this.color=e,this.changed=!1,this.data=t,this.type.type=0,this}_ensureHSL(){const t=this.data,{h:e,s:n,l:r}=t;void 0===e&&(t.h=J.channel.rgb2hsl(t,\"h\")),void 0===n&&(t.s=J.channel.rgb2hsl(t,\"s\")),void 0===r&&(t.l=J.channel.rgb2hsl(t,\"l\"))}_ensureRGB(){const t=this.data,{r:e,g:n,b:r}=t;void 0===e&&(t.r=J.channel.hsl2rgb(t,\"r\")),void 0===n&&(t.g=J.channel.hsl2rgb(t,\"g\")),void 0===r&&(t.b=J.channel.hsl2rgb(t,\"b\"))}get r(){const t=this.data,e=t.r;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"r\")):e}get g(){const t=this.data,e=t.g;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"g\")):e}get b(){const t=this.data,e=t.b;return this.type.is(2)||void 0===e?(this._ensureHSL(),J.channel.hsl2rgb(t,\"b\")):e}get h(){const t=this.data,e=t.h;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"h\")):e}get s(){const t=this.data,e=t.s;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"s\")):e}get l(){const t=this.data,e=t.l;return this.type.is(1)||void 0===e?(this._ensureRGB(),J.channel.rgb2hsl(t,\"l\")):e}get a(){return this.data.a}set r(t){this.type.set(1),this.changed=!0,this.data.r=t}set g(t){this.type.set(1),this.changed=!0,this.data.g=t}set b(t){this.type.set(1),this.changed=!0,this.data.b=t}set h(t){this.type.set(2),this.changed=!0,this.data.h=t}set s(t){this.type.set(2),this.changed=!0,this.data.s=t}set l(t){this.type.set(2),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}({r:0,g:0,b:0,a:0},\"transparent\"),nt={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:t=>{if(35!==t.charCodeAt(0))return;const e=t.match(nt.re);if(!e)return;const n=e[1],r=parseInt(n,16),i=n.length,a=i%4==0,o=i>4,s=o?1:17,c=o?8:4,l=a?0:-1,u=o?255:15;return et.set({r:(r>>c*(l+3)&u)*s,g:(r>>c*(l+2)&u)*s,b:(r>>c*(l+1)&u)*s,a:a?(r&u)*s/255:1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}${tt[Math.round(255*i)]}`:`#${tt[Math.round(e)]}${tt[Math.round(n)]}${tt[Math.round(r)]}`}},rt=nt,it={re:/^hsla?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(?:deg|grad|rad|turn)?)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?%)(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e-?\\d+)?(%)?))?\\s*?\\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:t=>{const e=t.match(it.hueRe);if(e){const[,t,n]=e;switch(n){case\"grad\":return J.channel.clamp.h(.9*parseFloat(t));case\"rad\":return J.channel.clamp.h(180*parseFloat(t)/Math.PI);case\"turn\":return J.channel.clamp.h(360*parseFloat(t))}}return J.channel.clamp.h(parseFloat(t))},parse:t=>{const e=t.charCodeAt(0);if(104!==e&&72!==e)return;const n=t.match(it.re);if(!n)return;const[,r,i,a,o,s]=n;return et.set({h:it._hue2deg(r),s:J.channel.clamp.s(parseFloat(i)),l:J.channel.clamp.l(parseFloat(a)),a:o?J.channel.clamp.a(s?parseFloat(o)/100:parseFloat(o)):1},t)},stringify:t=>{const{h:e,s:n,l:r,a:i}=t;return i<1?`hsla(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%, ${i})`:`hsl(${J.lang.round(e)}, ${J.lang.round(n)}%, ${J.lang.round(r)}%)`}},at=it,ot={colors:{aliceblue:\"#f0f8ff\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",aquamarine:\"#7fffd4\",azure:\"#f0ffff\",beige:\"#f5f5dc\",bisque:\"#ffe4c4\",black:\"#000000\",blanchedalmond:\"#ffebcd\",blue:\"#0000ff\",blueviolet:\"#8a2be2\",brown:\"#a52a2a\",burlywood:\"#deb887\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",cornflowerblue:\"#6495ed\",cornsilk:\"#fff8dc\",crimson:\"#dc143c\",cyanaqua:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkgray:\"#a9a9a9\",darkgreen:\"#006400\",darkgrey:\"#a9a9a9\",darkkhaki:\"#bdb76b\",darkmagenta:\"#8b008b\",darkolivegreen:\"#556b2f\",darkorange:\"#ff8c00\",darkorchid:\"#9932cc\",darkred:\"#8b0000\",darksalmon:\"#e9967a\",darkseagreen:\"#8fbc8f\",darkslateblue:\"#483d8b\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",darkturquoise:\"#00ced1\",darkviolet:\"#9400d3\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",dimgray:\"#696969\",dimgrey:\"#696969\",dodgerblue:\"#1e90ff\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",forestgreen:\"#228b22\",fuchsia:\"#ff00ff\",gainsboro:\"#dcdcdc\",ghostwhite:\"#f8f8ff\",gold:\"#ffd700\",goldenrod:\"#daa520\",gray:\"#808080\",green:\"#008000\",greenyellow:\"#adff2f\",grey:\"#808080\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",ivory:\"#fffff0\",khaki:\"#f0e68c\",lavender:\"#e6e6fa\",lavenderblush:\"#fff0f5\",lawngreen:\"#7cfc00\",lemonchiffon:\"#fffacd\",lightblue:\"#add8e6\",lightcoral:\"#f08080\",lightcyan:\"#e0ffff\",lightgoldenrodyellow:\"#fafad2\",lightgray:\"#d3d3d3\",lightgreen:\"#90ee90\",lightgrey:\"#d3d3d3\",lightpink:\"#ffb6c1\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",lightskyblue:\"#87cefa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",lightsteelblue:\"#b0c4de\",lightyellow:\"#ffffe0\",lime:\"#00ff00\",limegreen:\"#32cd32\",linen:\"#faf0e6\",magenta:\"#ff00ff\",maroon:\"#800000\",mediumaquamarine:\"#66cdaa\",mediumblue:\"#0000cd\",mediumorchid:\"#ba55d3\",mediumpurple:\"#9370db\",mediumseagreen:\"#3cb371\",mediumslateblue:\"#7b68ee\",mediumspringgreen:\"#00fa9a\",mediumturquoise:\"#48d1cc\",mediumvioletred:\"#c71585\",midnightblue:\"#191970\",mintcream:\"#f5fffa\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",navajowhite:\"#ffdead\",navy:\"#000080\",oldlace:\"#fdf5e6\",olive:\"#808000\",olivedrab:\"#6b8e23\",orange:\"#ffa500\",orangered:\"#ff4500\",orchid:\"#da70d6\",palegoldenrod:\"#eee8aa\",palegreen:\"#98fb98\",paleturquoise:\"#afeeee\",palevioletred:\"#db7093\",papayawhip:\"#ffefd5\",peachpuff:\"#ffdab9\",peru:\"#cd853f\",pink:\"#ffc0cb\",plum:\"#dda0dd\",powderblue:\"#b0e0e6\",purple:\"#800080\",rebeccapurple:\"#663399\",red:\"#ff0000\",rosybrown:\"#bc8f8f\",royalblue:\"#4169e1\",saddlebrown:\"#8b4513\",salmon:\"#fa8072\",sandybrown:\"#f4a460\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",sienna:\"#a0522d\",silver:\"#c0c0c0\",skyblue:\"#87ceeb\",slateblue:\"#6a5acd\",slategray:\"#708090\",slategrey:\"#708090\",snow:\"#fffafa\",springgreen:\"#00ff7f\",tan:\"#d2b48c\",teal:\"#008080\",thistle:\"#d8bfd8\",transparent:\"#00000000\",turquoise:\"#40e0d0\",violet:\"#ee82ee\",wheat:\"#f5deb3\",white:\"#ffffff\",whitesmoke:\"#f5f5f5\",yellow:\"#ffff00\",yellowgreen:\"#9acd32\"},parse:t=>{t=t.toLowerCase();const e=ot.colors[t];if(e)return rt.parse(e)},stringify:t=>{const e=rt.stringify(t);for(const t in ot.colors)if(ot.colors[t]===e)return t}},st=ot,ct={re:/^rgba?\\(\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))\\s*?(?:,|\\s)\\s*?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?))(?:\\s*?(?:,|\\/)\\s*?\\+?(-?(?:\\d+(?:\\.\\d+)?|(?:\\.\\d+))(?:e\\d+)?(%?)))?\\s*?\\)$/i,parse:t=>{const e=t.charCodeAt(0);if(114!==e&&82!==e)return;const n=t.match(ct.re);if(!n)return;const[,r,i,a,o,s,c,l,u]=n;return et.set({r:J.channel.clamp.r(i?2.55*parseFloat(r):parseFloat(r)),g:J.channel.clamp.g(o?2.55*parseFloat(a):parseFloat(a)),b:J.channel.clamp.b(c?2.55*parseFloat(s):parseFloat(s)),a:l?J.channel.clamp.a(u?parseFloat(l)/100:parseFloat(l)):1},t)},stringify:t=>{const{r:e,g:n,b:r,a:i}=t;return i<1?`rgba(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)}, ${J.lang.round(i)})`:`rgb(${J.lang.round(e)}, ${J.lang.round(n)}, ${J.lang.round(r)})`}},lt=ct,ut={format:{keyword:st,hex:rt,rgb:lt,rgba:lt,hsl:at,hsla:at},parse:t=>{if(\"string\"!=typeof t)return t;const e=rt.parse(t)||lt.parse(t)||at.parse(t)||st.parse(t);if(e)return e;throw new Error(`Unsupported color format: \"${t}\"`)},stringify:t=>!t.changed&&t.color?t.color:t.type.is(2)||void 0===t.data.r?at.stringify(t):t.a<1||!Number.isInteger(t.r)||!Number.isInteger(t.g)||!Number.isInteger(t.b)?lt.stringify(t):rt.stringify(t)},ht=(t,e)=>{const n=ut.parse(t);for(const t in e)n[t]=J.channel.clamp[t](e[t]);return ut.stringify(n)},ft=(t,e)=>{const n=ut.parse(t),r={};for(const t in e)e[t]&&(r[t]=n[t]+e[t]);return ht(t,r)},dt=(t,e,n=0,r=1)=>{if(\"number\"!=typeof t)return ht(t,{a:e});const i=et.set({r:J.channel.clamp.r(t),g:J.channel.clamp.g(e),b:J.channel.clamp.b(n),a:J.channel.clamp.a(r)});return ut.stringify(i)},pt=(t,e=100)=>{const n=ut.parse(t);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,((t,e,n=50)=>{const{r,g:i,b:a,a:o}=ut.parse(t),{r:s,g:c,b:l,a:u}=ut.parse(e),h=n/100,f=2*h-1,d=o-u,p=((f*d==-1?f:(f+d)/(1+f*d))+1)/2,g=1-p;return dt(r*p+s*g,i*p+c*g,a*p+l*g,o*h+u*(1-h))})(n,t,e)},gt=(t,e,n)=>{const r=ut.parse(t),i=r[e],a=J.channel.clamp[e](i+n);return i!==a&&(r[e]=a),ut.stringify(r)},yt=(t,e)=>gt(t,\"l\",-e),mt=(t,e)=>gt(t,\"l\",e);var bt=function(t,e){return ft(t,e?{s:-40,l:10}:{s:-40,l:-10})};function vt(t){return vt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},vt(t)}function _t(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:\"\";return Object.keys(e).reduce((function(r,i){return Array.isArray(e[i])?r:\"object\"===Rt(e[i])&&null!==e[i]?[].concat(It(r),[n+i],It(t(e[i],\"\"))):[].concat(It(r),[n+i])}),[])}(Pt,\"\");const zt=Pt;function Yt(t){return Yt=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},Yt(t)}var Ut,$t=Object.freeze(zt),Wt=Q({},$t),qt=[],Ht=Q({},$t),Vt=function(t,e){for(var n=Q({},t),r={},i=0;i-1||e[n].indexOf(\">\")>-1||e[n].indexOf(\"url(data:\")>-1)&&delete e[n],\"object\"===Yt(e[n])&&t(e[n])}))},Qt=function(t){t.fontFamily&&(t.themeVariables&&t.themeVariables.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),qt.push(t),Vt(Wt,qt)},Kt=function(){Vt(Wt,qt=[])},Jt=n(7856),te=n.n(Jt),ee=function(t){var e=t.replace(/\\\\u[\\dA-F]{4}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\u/g,\"\"),16))}));return e=(e=(e=e.replace(/\\\\x([0-9a-f]{2})/gi,(function(t,e){return String.fromCharCode(parseInt(e,16))}))).replace(/\\\\[\\d\\d\\d]{3}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))).replace(/\\\\[\\d\\d\\d]{2}/gi,(function(t){return String.fromCharCode(parseInt(t.replace(/\\\\/g,\"\"),8))}))},ne=function(t){for(var e=\"\",n=0;n>=0;){if(!((n=t.indexOf(\"=0)){e+=t,n=-1;break}e+=t.substr(0,n),(n=(t=t.substr(n+1)).indexOf(\"<\\/script>\"))>=0&&(n+=9,t=t.substr(n))}var r=ee(e);return(r=(r=(r=(r=r.replace(/script>/gi,\"#\")).replace(/javascript:/gi,\"#\")).replace(/javascript&colon/gi,\"#\")).replace(/onerror=/gi,\"onerror:\")).replace(/')}else\"loose\"!==s.securityLevel&&(M=te().sanitize(M,{ADD_TAGS:[\"foreignobject\"],ADD_ATTR:[\"dominant-baseline\"]}));if(void 0!==n)switch(b){case\"flowchart\":case\"flowchart-v2\":n(M,la.bindFunctions);break;case\"gantt\":n(M,go.bindFunctions);break;case\"class\":case\"classDiagram\":n(M,fr.bindFunctions);break;default:n(M)}else o.debug(\"CB = undefined!\");vs.forEach((function(t){t()})),vs=[];var D=\"sandbox\"===s.securityLevel?\"#i\"+t:\"#d\"+t,B=(0,l.select)(D).node();if(null!==B&&\"function\"==typeof B.remove&&(0,l.select)(D).node().remove(),u)throw u;return M},parse:function(t,e){ru||(Vl(),ru=!0);var n=!1;try{var r=e||new Ql(t);return r.db.clear(),r.parse(t)}catch(t){if(n=!0,!fu.parseError)throw t;null!=t.str?fu.parseError(t.str,t.hash):fu.parseError(t)}return!n},parseDirective:function(t,e,n,r){try{if(void 0!==e)switch(e=e.trim(),n){case\"open_directive\":au={};break;case\"type_directive\":au.type=e.toLowerCase();break;case\"arg_directive\":au.args=JSON.parse(e);break;case\"close_directive\":(function(t,e,n){switch(o.debug(\"Directive type=\".concat(e.type,\" with args:\"),e.args),e.type){case\"init\":case\"initialize\":[\"config\"].forEach((function(t){void 0!==e.args[t]&&(\"flowchart-v2\"===n&&(n=\"flowchart\"),e.args[n]=e.args[t],delete e.args[t])})),o.debug(\"sanitize in handleDirective\",e.args),Cn(e.args),o.debug(\"sanitize in handleDirective (done)\",e.args),Qt(e.args);break;case\"wrap\":case\"nowrap\":t&&t.setWrap&&t.setWrap(\"wrap\"===e.type);break;case\"themeCss\":o.warn(\"themeCss encountered\");break;default:o.warn(\"Unhandled directive: source: '%%{\".concat(e.type,\": \").concat(JSON.stringify(e.args?e.args:{}),\"}%%\"),e)}})(t,au,r),au=null}}catch(t){o.error(\"Error while rendering sequenceDiagram directive: \".concat(e,\" jison context: \").concat(n)),o.error(t.message)}},initialize:function(t){var e;null!=t&&t.fontFamily&&(null!==(e=t.themeVariables)&&void 0!==e&&e.fontFamily||(t.themeVariables={fontFamily:t.fontFamily})),function(t){Ut=Q({},t)}(t),null!=t&&t.theme&&Lt[t.theme]?t.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=Lt.default.getThemeVariables(t.themeVariables));var n=\"object\"===nu(t)?function(t){return Wt=Q({},$t),Wt=Q(Wt,t),t.theme&&Lt[t.theme]&&(Wt.themeVariables=Lt[t.theme].getThemeVariables(t.themeVariables)),Ht=Vt(Wt,qt),Wt}(t):Gt();ou(n),s(n.logLevel),ru||(Vl(),ru=!0)},getConfig:Xt,setConfig:function(t){return Q(Ht,t),Xt()},getSiteConfig:Gt,updateSiteConfig:function(t){return Wt=Q(Wt,t),Vt(Wt,qt),Wt},reset:function(){Kt()},globalReset:function(){Kt(),ou(Xt())},defaultConfig:$t});s(Xt().logLevel),Kt(Xt());const cu=su;var lu=function(){var t,e,n=cu.getConfig();arguments.length>=2?(void 0!==arguments[0]&&(hu.sequenceConfig=arguments[0]),t=arguments[1]):t=arguments[0],\"function\"==typeof arguments[arguments.length-1]?(e=arguments[arguments.length-1],o.debug(\"Callback function found\")):void 0!==n.mermaid&&(\"function\"==typeof n.mermaid.callback?(e=n.mermaid.callback,o.debug(\"Callback function found\")):o.debug(\"No Callback function found\")),t=void 0===t?document.querySelectorAll(\".mermaid\"):\"string\"==typeof t?document.querySelectorAll(t):t instanceof window.Node?[t]:t,o.debug(\"Start On Load before: \"+hu.startOnLoad),void 0!==hu.startOnLoad&&(o.debug(\"Start On Load inner: \"+hu.startOnLoad),cu.updateSiteConfig({startOnLoad:hu.startOnLoad})),void 0!==hu.ganttConfig&&cu.updateSiteConfig({gantt:hu.ganttConfig});for(var r,i=new An.initIdGenerator(n.deterministicIds,n.deterministicIDSeed),a=[],s=function(n){o.info(\"Rendering diagram: \"+t[n].id,n);var s=t[n];if(s.getAttribute(\"data-processed\"))return\"continue\";s.setAttribute(\"data-processed\",!0);var c=\"mermaid-\".concat(i.next());r=s.innerHTML,r=An.entityDecode(r).trim().replace(//gi,\"
\");var l=An.detectInit(r);l&&o.debug(\"Detected early reinit: \",l);try{cu.render(c,r,(function(t,n){s.innerHTML=t,void 0!==e&&e(c),n&&n(s)}),s)}catch(t){o.warn(\"Catching Error (bootstrap)\",t),\"function\"==typeof hu.parseError&&hu.parseError({error:t,str:t.str,hash:t.hash,message:t.str}),a.push({error:t,str:t.str,hash:t.hash,message:t.str})}},c=0;c0)throw a[0]},uu=function(){hu.startOnLoad?cu.getConfig().startOnLoad&&hu.init():void 0===hu.startOnLoad&&(o.debug(\"In start, no config\"),cu.getConfig().startOnLoad&&hu.init())};\"undefined\"!=typeof document&&window.addEventListener(\"load\",(function(){uu()}),!1);var hu={startOnLoad:!0,htmlLabels:!0,diagrams:{},mermaidAPI:cu,parse:null!=cu?cu.parse:null,render:null!=cu?cu.render:null,init:function(){try{lu.apply(void 0,arguments)}catch(t){o.warn(\"Syntax Error rendering\"),o.warn(t.str)}},initThrowsErrors:lu,initialize:function(t){void 0!==t.mermaid&&(void 0!==t.mermaid.startOnLoad&&(hu.startOnLoad=t.mermaid.startOnLoad),void 0!==t.mermaid.htmlLabels&&(hu.htmlLabels=\"false\"!==t.mermaid.htmlLabels&&!1!==t.mermaid.htmlLabels)),cu.initialize(t)},contentLoaded:uu,setParseErrorHandler:function(t){hu.parseError=t}};const fu=hu},4949:(t,e,n)=>{t.exports={graphlib:n(6614),dagre:n(6478),intersect:n(8114),render:n(5787),util:n(8355),version:n(5689)}},9144:(t,e,n)=>{var r=n(8355);function i(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 0 L 10 5 L 0 10 z\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])}t.exports={default:i,normal:i,vee:function(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 0 L 10 5 L 0 10 L 4 5 z\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])},undirected:function(t,e,n,i){var a=t.append(\"marker\").attr(\"id\",e).attr(\"viewBox\",\"0 0 10 10\").attr(\"refX\",9).attr(\"refY\",5).attr(\"markerUnits\",\"strokeWidth\").attr(\"markerWidth\",8).attr(\"markerHeight\",6).attr(\"orient\",\"auto\").append(\"path\").attr(\"d\",\"M 0 5 L 10 5\").style(\"stroke-width\",1).style(\"stroke-dasharray\",\"1,0\");r.applyStyle(a,n[i+\"Style\"]),n[i+\"Class\"]&&a.attr(\"class\",n[i+\"Class\"])}}},5632:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1322);t.exports=function(t,e){var n,o=e.nodes().filter((function(t){return r.isSubgraph(e,t)})),s=t.selectAll(\"g.cluster\").data(o,(function(t){return t}));return s.selectAll(\"*\").remove(),s.enter().append(\"g\").attr(\"class\",\"cluster\").attr(\"id\",(function(t){return e.node(t).id})).style(\"opacity\",0),s=t.selectAll(\"g.cluster\"),r.applyTransition(s,e).style(\"opacity\",1),s.each((function(t){var n=e.node(t),r=i.select(this);i.select(this).append(\"rect\");var o=r.append(\"g\").attr(\"class\",\"label\");a(o,n,n.clusterLabelPos)})),s.selectAll(\"rect\").each((function(t){var n=e.node(t),a=i.select(this);r.applyStyle(a,n.style)})),n=s.exit?s.exit():s.selectAll(null),r.applyTransition(n,e).style(\"opacity\",0).remove(),s}},6315:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e){var n,s=t.selectAll(\"g.edgeLabel\").data(e.edges(),(function(t){return a.edgeToId(t)})).classed(\"update\",!0);return s.exit().remove(),s.enter().append(\"g\").classed(\"edgeLabel\",!0).style(\"opacity\",0),(s=t.selectAll(\"g.edgeLabel\")).each((function(t){var n=o.select(this);n.select(\".label\").remove();var a=e.edge(t),s=i(n,e.edge(t),0,0).classed(\"label\",!0),c=s.node().getBBox();a.labelId&&s.attr(\"id\",a.labelId),r.has(a,\"width\")||(a.width=c.width),r.has(a,\"height\")||(a.height=c.height)})),n=s.exit?s.exit():s.selectAll(null),a.applyTransition(n,e).style(\"opacity\",0).remove(),s}},940:(t,e,n)=>{var r=n(1034),i=n(3042),a=n(8355),o=n(4322);function s(t,e){var n=(o.line||o.svg.line)().x((function(t){return t.x})).y((function(t){return t.y}));return(n.curve||n.interpolate)(t.curve),n(e)}t.exports=function(t,e,n){var c=t.selectAll(\"g.edgePath\").data(e.edges(),(function(t){return a.edgeToId(t)})).classed(\"update\",!0),l=function(t,e){var n=t.enter().append(\"g\").attr(\"class\",\"edgePath\").style(\"opacity\",0);return n.append(\"path\").attr(\"class\",\"path\").attr(\"d\",(function(t){var n=e.edge(t),i=e.node(t.v).elem;return s(n,r.range(n.points.length).map((function(){return e=(t=i).getBBox(),{x:(n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2)).e,y:n.f};var t,e,n})))})),n.append(\"defs\"),n}(c,e);!function(t,e){var n=t.exit();a.applyTransition(n,e).style(\"opacity\",0).remove()}(c,e);var u=void 0!==c.merge?c.merge(l):c;return a.applyTransition(u,e).style(\"opacity\",1),u.each((function(t){var n=o.select(this),r=e.edge(t);r.elem=this,r.id&&n.attr(\"id\",r.id),a.applyClass(n,r.class,(n.classed(\"update\")?\"update \":\"\")+\"edgePath\")})),u.selectAll(\"path.path\").each((function(t){var n=e.edge(t);n.arrowheadId=r.uniqueId(\"arrowhead\");var c=o.select(this).attr(\"marker-end\",(function(){return\"url(\"+(t=location.href,e=n.arrowheadId,t.split(\"#\")[0]+\"#\"+e+\")\");var t,e})).style(\"fill\",\"none\");a.applyTransition(c,e).attr(\"d\",(function(t){return function(t,e){var n=t.edge(e),r=t.node(e.v),a=t.node(e.w),o=n.points.slice(1,n.points.length-1);return o.unshift(i(r,o[0])),o.push(i(a,o[o.length-1])),s(n,o)}(e,t)})),a.applyStyle(c,n.style)})),u.selectAll(\"defs *\").remove(),u.selectAll(\"defs\").each((function(t){var r=e.edge(t);(0,n[r.arrowhead])(o.select(this),r.arrowheadId,r,\"arrowhead\")})),u}},607:(t,e,n)=>{var r=n(1034),i=n(1322),a=n(8355),o=n(4322);t.exports=function(t,e,n){var s,c=e.nodes().filter((function(t){return!a.isSubgraph(e,t)})),l=t.selectAll(\"g.node\").data(c,(function(t){return t})).classed(\"update\",!0);return l.exit().remove(),l.enter().append(\"g\").attr(\"class\",\"node\").style(\"opacity\",0),(l=t.selectAll(\"g.node\")).each((function(t){var s=e.node(t),c=o.select(this);a.applyClass(c,s.class,(c.classed(\"update\")?\"update \":\"\")+\"node\"),c.select(\"g.label\").remove();var l=c.append(\"g\").attr(\"class\",\"label\"),u=i(l,s),h=n[s.shape],f=r.pick(u.node().getBBox(),\"width\",\"height\");s.elem=this,s.id&&c.attr(\"id\",s.id),s.labelId&&l.attr(\"id\",s.labelId),r.has(s,\"width\")&&(f.width=s.width),r.has(s,\"height\")&&(f.height=s.height),f.width+=s.paddingLeft+s.paddingRight,f.height+=s.paddingTop+s.paddingBottom,l.attr(\"transform\",\"translate(\"+(s.paddingLeft-s.paddingRight)/2+\",\"+(s.paddingTop-s.paddingBottom)/2+\")\");var d=o.select(this);d.select(\".label-container\").remove();var p=h(d,f,s).classed(\"label-container\",!0);a.applyStyle(p,s.style);var g=p.node().getBBox();s.width=g.width,s.height=g.height})),s=l.exit?l.exit():l.selectAll(null),a.applyTransition(s,e).style(\"opacity\",0).remove(),l}},4322:(t,e,n)=>{var r;if(!r)try{r=n(7543)}catch(t){}r||(r=window.d3),t.exports=r},6478:(t,e,n)=>{var r;try{r=n(681)}catch(t){}r||(r=window.dagre),t.exports=r},6614:(t,e,n)=>{var r;try{r=n(8282)}catch(t){}r||(r=window.graphlib),t.exports=r},8114:(t,e,n)=>{t.exports={node:n(3042),circle:n(6587),ellipse:n(3260),polygon:n(5337),rect:n(8049)}},6587:(t,e,n)=>{var r=n(3260);t.exports=function(t,e,n){return r(t,e,e,n)}},3260:t=>{t.exports=function(t,e,n,r){var i=t.x,a=t.y,o=i-r.x,s=a-r.y,c=Math.sqrt(e*e*s*s+n*n*o*o),l=Math.abs(e*n*o/c);r.x{function e(t,e){return t*e>0}t.exports=function(t,n,r,i){var a,o,s,c,l,u,h,f,d,p,g,y,m;if(!(a=n.y-t.y,s=t.x-n.x,l=n.x*t.y-t.x*n.y,d=a*r.x+s*r.y+l,p=a*i.x+s*i.y+l,0!==d&&0!==p&&e(d,p)||(o=i.y-r.y,c=r.x-i.x,u=i.x*r.y-r.x*i.y,h=o*t.x+c*t.y+u,f=o*n.x+c*n.y+u,0!==h&&0!==f&&e(h,f)||0==(g=a*c-o*s))))return y=Math.abs(g/2),{x:(m=s*u-c*l)<0?(m-y)/g:(m+y)/g,y:(m=o*l-a*u)<0?(m-y)/g:(m+y)/g}}},3042:t=>{t.exports=function(t,e){return t.intersect(e)}},5337:(t,e,n)=>{var r=n(6808);t.exports=function(t,e,n){var i=t.x,a=t.y,o=[],s=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;e.forEach((function(t){s=Math.min(s,t.x),c=Math.min(c,t.y)}));for(var l=i-t.width/2-s,u=a-t.height/2-c,h=0;h1&&o.sort((function(t,e){var r=t.x-n.x,i=t.y-n.y,a=Math.sqrt(r*r+i*i),o=e.x-n.x,s=e.y-n.y,c=Math.sqrt(o*o+s*s);return a{t.exports=function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=0===s?0:l*o/s,r=l):(o<0&&(c=-c),n=c,r=0===o?0:c*s/o),{x:i+n,y:a+r}}},8284:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t.append(\"foreignObject\").attr(\"width\",\"100000\"),i=n.append(\"xhtml:div\");i.attr(\"xmlns\",\"http://www.w3.org/1999/xhtml\");var a=e.label;switch(typeof a){case\"function\":i.insert(a);break;case\"object\":i.insert((function(){return a}));break;default:i.html(a)}r.applyStyle(i,e.labelStyle),i.style(\"display\",\"inline-block\"),i.style(\"white-space\",\"nowrap\");var o=i.node().getBoundingClientRect();return n.attr(\"width\",o.width).attr(\"height\",o.height),n}},1322:(t,e,n)=>{var r=n(7318),i=n(8284),a=n(8287);t.exports=function(t,e,n){var o=e.label,s=t.append(\"g\");\"svg\"===e.labelType?a(s,e):\"string\"!=typeof o||\"html\"===e.labelType?i(s,e):r(s,e);var c,l=s.node().getBBox();switch(n){case\"top\":c=-e.height/2;break;case\"bottom\":c=e.height/2-l.height;break;default:c=-l.height/2}return s.attr(\"transform\",\"translate(\"+-l.width/2+\",\"+c+\")\"),s}},8287:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){var n=t;return n.node().appendChild(e.label),r.applyStyle(n,e.labelStyle),n}},7318:(t,e,n)=>{var r=n(8355);t.exports=function(t,e){for(var n=t.append(\"text\"),i=function(t){for(var e,n=\"\",r=!1,i=0;i{var r;try{r={defaults:n(1747),each:n(6073),isFunction:n(3560),isPlainObject:n(8630),pick:n(9722),has:n(8721),range:n(6026),uniqueId:n(3955)}}catch(t){}r||(r=window._),t.exports=r},6381:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){var n=t.filter((function(){return!i.select(this).classed(\"update\")}));function a(t){var n=e.node(t);return\"translate(\"+n.x+\",\"+n.y+\")\"}n.attr(\"transform\",a),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",a),r.applyTransition(n.selectAll(\"rect\"),e).attr(\"width\",(function(t){return e.node(t).width})).attr(\"height\",(function(t){return e.node(t).height})).attr(\"x\",(function(t){return-e.node(t).width/2})).attr(\"y\",(function(t){return-e.node(t).height/2}))}},4577:(t,e,n)=>{var r=n(8355),i=n(4322),a=n(1034);t.exports=function(t,e){function n(t){var n=e.edge(t);return a.has(n,\"x\")?\"translate(\"+n.x+\",\"+n.y+\")\":\"\"}t.filter((function(){return!i.select(this).classed(\"update\")})).attr(\"transform\",n),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",n)}},4849:(t,e,n)=>{var r=n(8355),i=n(4322);t.exports=function(t,e){function n(t){var n=e.node(t);return\"translate(\"+n.x+\",\"+n.y+\")\"}t.filter((function(){return!i.select(this).classed(\"update\")})).attr(\"transform\",n),r.applyTransition(t,e).style(\"opacity\",1).attr(\"transform\",n)}},5787:(t,e,n)=>{var r=n(1034),i=n(4322),a=n(6478).layout;t.exports=function(){var t=n(607),e=n(5632),i=n(6315),l=n(940),u=n(4849),h=n(4577),f=n(6381),d=n(4418),p=n(9144),g=function(n,g){!function(t){t.nodes().forEach((function(e){var n=t.node(e);r.has(n,\"label\")||t.children(e).length||(n.label=e),r.has(n,\"paddingX\")&&r.defaults(n,{paddingLeft:n.paddingX,paddingRight:n.paddingX}),r.has(n,\"paddingY\")&&r.defaults(n,{paddingTop:n.paddingY,paddingBottom:n.paddingY}),r.has(n,\"padding\")&&r.defaults(n,{paddingLeft:n.padding,paddingRight:n.padding,paddingTop:n.padding,paddingBottom:n.padding}),r.defaults(n,o),r.each([\"paddingLeft\",\"paddingRight\",\"paddingTop\",\"paddingBottom\"],(function(t){n[t]=Number(n[t])})),r.has(n,\"width\")&&(n._prevWidth=n.width),r.has(n,\"height\")&&(n._prevHeight=n.height)})),t.edges().forEach((function(e){var n=t.edge(e);r.has(n,\"label\")||(n.label=\"\"),r.defaults(n,s)}))}(g);var y=c(n,\"output\"),m=c(y,\"clusters\"),b=c(y,\"edgePaths\"),v=i(c(y,\"edgeLabels\"),g),_=t(c(y,\"nodes\"),g,d);a(g),u(_,g),h(v,g),l(b,g,p);var x=e(m,g);f(x,g),function(t){r.each(t.nodes(),(function(e){var n=t.node(e);r.has(n,\"_prevWidth\")?n.width=n._prevWidth:delete n.width,r.has(n,\"_prevHeight\")?n.height=n._prevHeight:delete n.height,delete n._prevWidth,delete n._prevHeight}))}(g)};return g.createNodes=function(e){return arguments.length?(t=e,g):t},g.createClusters=function(t){return arguments.length?(e=t,g):e},g.createEdgeLabels=function(t){return arguments.length?(i=t,g):i},g.createEdgePaths=function(t){return arguments.length?(l=t,g):l},g.shapes=function(t){return arguments.length?(d=t,g):d},g.arrows=function(t){return arguments.length?(p=t,g):p},g};var o={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:\"rect\"},s={arrowhead:\"normal\",curve:i.curveLinear};function c(t,e){var n=t.select(\"g.\"+e);return n.empty()&&(n=t.append(\"g\").attr(\"class\",e)),n}},4418:(t,e,n)=>{var r=n(8049),i=n(3260),a=n(6587),o=n(5337);t.exports={rect:function(t,e,n){var i=t.insert(\"rect\",\":first-child\").attr(\"rx\",n.rx).attr(\"ry\",n.ry).attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"width\",e.width).attr(\"height\",e.height);return n.intersect=function(t){return r(n,t)},i},ellipse:function(t,e,n){var r=e.width/2,a=e.height/2,o=t.insert(\"ellipse\",\":first-child\").attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"rx\",r).attr(\"ry\",a);return n.intersect=function(t){return i(n,r,a,t)},o},circle:function(t,e,n){var r=Math.max(e.width,e.height)/2,i=t.insert(\"circle\",\":first-child\").attr(\"x\",-e.width/2).attr(\"y\",-e.height/2).attr(\"r\",r);return n.intersect=function(t){return a(n,r,t)},i},diamond:function(t,e,n){var r=e.width*Math.SQRT2/2,i=e.height*Math.SQRT2/2,a=[{x:0,y:-i},{x:-r,y:0},{x:0,y:i},{x:r,y:0}],s=t.insert(\"polygon\",\":first-child\").attr(\"points\",a.map((function(t){return t.x+\",\"+t.y})).join(\" \"));return n.intersect=function(t){return o(n,a,t)},s}}},8355:(t,e,n)=>{var r=n(1034);t.exports={isSubgraph:function(t,e){return!!t.children(e).length},edgeToId:function(t){return a(t.v)+\":\"+a(t.w)+\":\"+a(t.name)},applyStyle:function(t,e){e&&t.attr(\"style\",e)},applyClass:function(t,e,n){e&&t.attr(\"class\",e).attr(\"class\",n+\" \"+t.attr(\"class\"))},applyTransition:function(t,e){var n=e.graph();if(r.isPlainObject(n)){var i=n.transition;if(r.isFunction(i))return i(t)}return t}};var i=/:/g;function a(t){return t?String(t).replace(i,\"\\\\:\"):\"\"}},5689:t=>{t.exports=\"0.6.4\"},681:(t,e,n)=>{t.exports={graphlib:n(574),layout:n(8123),debug:n(7570),util:{time:n(1138).time,notime:n(1138).notime},version:n(8177)}},2188:(t,e,n)=>{var r=n(8436),i=n(4079);t.exports={run:function(t){var e=\"greedy\"===t.graph().acyclicer?i(t,function(t){return function(e){return t.edge(e).weight}}(t)):function(t){var e=[],n={},i={};return r.forEach(t.nodes(),(function a(o){r.has(i,o)||(i[o]=!0,n[o]=!0,r.forEach(t.outEdges(o),(function(t){r.has(n,t.w)?e.push(t):a(t.w)})),delete n[o])})),e}(t);r.forEach(e,(function(e){var n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,r.uniqueId(\"rev\"))}))},undo:function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}}))}}},1133:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,r,a,o){var s={width:0,height:0,rank:o,borderType:e},c=a[e][o-1],l=i.addDummyNode(t,\"border\",s,n);a[e][o]=l,t.setParent(l,r),c&&t.setEdge(c,l,{weight:1})}t.exports=function(t){r.forEach(t.children(),(function e(n){var i=t.children(n),o=t.node(n);if(i.length&&r.forEach(i,e),r.has(o,\"minRank\")){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,c=o.maxRank+1;s{var r=n(8436);function i(t){r.forEach(t.nodes(),(function(e){a(t.node(e))})),r.forEach(t.edges(),(function(e){a(t.edge(e))}))}function a(t){var e=t.width;t.width=t.height,t.height=e}function o(t){t.y=-t.y}function s(t){var e=t.x;t.x=t.y,t.y=e}t.exports={adjust:function(t){var e=t.graph().rankdir.toLowerCase();\"lr\"!==e&&\"rl\"!==e||i(t)},undo:function(t){var e=t.graph().rankdir.toLowerCase();\"bt\"!==e&&\"rl\"!==e||function(t){r.forEach(t.nodes(),(function(e){o(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,o),r.has(n,\"y\")&&o(n)}))}(t),\"lr\"!==e&&\"rl\"!==e||(function(t){r.forEach(t.nodes(),(function(e){s(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.forEach(n.points,s),r.has(n,\"x\")&&s(n)}))}(t),i(t))}}},7822:t=>{function e(){var t={};t._next=t._prev=t,this._sentinel=t}function n(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function r(t,e){if(\"_next\"!==t&&\"_prev\"!==t)return e}t.exports=e,e.prototype.dequeue=function(){var t=this._sentinel,e=t._prev;if(e!==t)return n(e),e},e.prototype.enqueue=function(t){var e=this._sentinel;t._prev&&t._next&&n(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e},e.prototype.toString=function(){for(var t=[],e=this._sentinel,n=e._prev;n!==e;)t.push(JSON.stringify(n,r)),n=n._prev;return\"[\"+t.join(\", \")+\"]\"}},7570:(t,e,n)=>{var r=n(8436),i=n(1138),a=n(574).Graph;t.exports={debugOrdering:function(t){var e=i.buildLayerMatrix(t),n=new a({compound:!0,multigraph:!0}).setGraph({});return r.forEach(t.nodes(),(function(e){n.setNode(e,{label:e}),n.setParent(e,\"layer\"+t.node(e).rank)})),r.forEach(t.edges(),(function(t){n.setEdge(t.v,t.w,{},t.name)})),r.forEach(e,(function(t,e){var i=\"layer\"+e;n.setNode(i,{rank:\"same\"}),r.reduce(t,(function(t,e){return n.setEdge(t,e,{style:\"invis\"}),e}))})),n}}},574:(t,e,n)=>{var r;try{r=n(8282)}catch(t){}r||(r=window.graphlib),t.exports=r},4079:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(7822);t.exports=function(t,e){if(t.nodeCount()<=1)return[];var n=function(t,e){var n=new i,o=0,s=0;r.forEach(t.nodes(),(function(t){n.setNode(t,{v:t,in:0,out:0})})),r.forEach(t.edges(),(function(t){var r=n.edge(t.v,t.w)||0,i=e(t),a=r+i;n.setEdge(t.v,t.w,a),s=Math.max(s,n.node(t.v).out+=i),o=Math.max(o,n.node(t.w).in+=i)}));var l=r.range(s+o+3).map((function(){return new a})),u=o+1;return r.forEach(n.nodes(),(function(t){c(l,u,n.node(t))})),{graph:n,buckets:l,zeroIdx:u}}(t,e||o),l=function(t,e,n){for(var r,i=[],a=e[e.length-1],o=e[0];t.nodeCount();){for(;r=o.dequeue();)s(t,e,n,r);for(;r=a.dequeue();)s(t,e,n,r);if(t.nodeCount())for(var c=e.length-2;c>0;--c)if(r=e[c].dequeue()){i=i.concat(s(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx);return r.flatten(r.map(l,(function(e){return t.outEdges(e.v,e.w)})),!0)};var o=r.constant(1);function s(t,e,n,i,a){var o=a?[]:void 0;return r.forEach(t.inEdges(i.v),(function(r){var i=t.edge(r),s=t.node(r.v);a&&o.push({v:r.v,w:r.w}),s.out-=i,c(e,n,s)})),r.forEach(t.outEdges(i.v),(function(r){var i=t.edge(r),a=r.w,o=t.node(a);o.in-=i,c(e,n,o)})),t.removeNode(i.v),o}function c(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}},8123:(t,e,n)=>{var r=n(8436),i=n(2188),a=n(5995),o=n(8093),s=n(1138).normalizeRanks,c=n(4219),l=n(1138).removeEmptyRanks,u=n(2981),h=n(1133),f=n(3258),d=n(3408),p=n(7873),g=n(1138),y=n(574).Graph;t.exports=function(t,e){var n=e&&e.debugTiming?g.time:g.notime;n(\"layout\",(function(){var e=n(\" buildLayoutGraph\",(function(){return function(t){var e=new y({multigraph:!0,compound:!0}),n=C(t.graph());return e.setGraph(r.merge({},b,E(n,m),r.pick(n,v))),r.forEach(t.nodes(),(function(n){var i=C(t.node(n));e.setNode(n,r.defaults(E(i,_),x)),e.setParent(n,t.parent(n))})),r.forEach(t.edges(),(function(n){var i=C(t.edge(n));e.setEdge(n,r.merge({},w,E(i,k),r.pick(i,T)))})),e}(t)}));n(\" runLayout\",(function(){!function(t,e){e(\" makeSpaceForEdgeLabels\",(function(){!function(t){var e=t.graph();e.ranksep/=2,r.forEach(t.edges(),(function(n){var r=t.edge(n);r.minlen*=2,\"c\"!==r.labelpos.toLowerCase()&&(\"TB\"===e.rankdir||\"BT\"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(t)})),e(\" removeSelfEdges\",(function(){!function(t){r.forEach(t.edges(),(function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}}))}(t)})),e(\" acyclic\",(function(){i.run(t)})),e(\" nestingGraph.run\",(function(){u.run(t)})),e(\" rank\",(function(){o(g.asNonCompoundGraph(t))})),e(\" injectEdgeLabelProxies\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};g.addDummyNode(t,\"edge-proxy\",i,\"_ep\")}}))}(t)})),e(\" removeEmptyRanks\",(function(){l(t)})),e(\" nestingGraph.cleanup\",(function(){u.cleanup(t)})),e(\" normalizeRanks\",(function(){s(t)})),e(\" assignRankMinMax\",(function(){!function(t){var e=0;r.forEach(t.nodes(),(function(n){var i=t.node(n);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,e=r.max(e,i.maxRank))})),t.graph().maxRank=e}(t)})),e(\" removeEdgeLabelProxies\",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);\"edge-proxy\"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))}))}(t)})),e(\" normalize.run\",(function(){a.run(t)})),e(\" parentDummyChains\",(function(){c(t)})),e(\" addBorderSegments\",(function(){h(t)})),e(\" order\",(function(){d(t)})),e(\" insertSelfEdges\",(function(){!function(t){var e=g.buildLayerMatrix(t);r.forEach(e,(function(e){var n=0;r.forEach(e,(function(e,i){var a=t.node(e);a.order=i+n,r.forEach(a.selfEdges,(function(e){g.addDummyNode(t,\"selfedge\",{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++n,e:e.e,label:e.label},\"_se\")})),delete a.selfEdges}))}))}(t)})),e(\" adjustCoordinateSystem\",(function(){f.adjust(t)})),e(\" position\",(function(){p(t)})),e(\" positionSelfEdges\",(function(){!function(t){r.forEach(t.nodes(),(function(e){var n=t.node(e);if(\"selfedge\"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}}))}(t)})),e(\" removeBorderNodes\",(function(){!function(t){r.forEach(t.nodes(),(function(e){if(t.children(e).length){var n=t.node(e),i=t.node(n.borderTop),a=t.node(n.borderBottom),o=t.node(r.last(n.borderLeft)),s=t.node(r.last(n.borderRight));n.width=Math.abs(s.x-o.x),n.height=Math.abs(a.y-i.y),n.x=o.x+n.width/2,n.y=i.y+n.height/2}})),r.forEach(t.nodes(),(function(e){\"border\"===t.node(e).dummy&&t.removeNode(e)}))}(t)})),e(\" normalize.undo\",(function(){a.undo(t)})),e(\" fixupEdgeLabelCoords\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);if(r.has(n,\"x\"))switch(\"l\"!==n.labelpos&&\"r\"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case\"l\":n.x-=n.width/2+n.labeloffset;break;case\"r\":n.x+=n.width/2+n.labeloffset}}))}(t)})),e(\" undoCoordinateSystem\",(function(){f.undo(t)})),e(\" translateGraph\",(function(){!function(t){var e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,a=0,o=t.graph(),s=o.marginx||0,c=o.marginy||0;function l(t){var r=t.x,o=t.y,s=t.width,c=t.height;e=Math.min(e,r-s/2),n=Math.max(n,r+s/2),i=Math.min(i,o-c/2),a=Math.max(a,o+c/2)}r.forEach(t.nodes(),(function(e){l(t.node(e))})),r.forEach(t.edges(),(function(e){var n=t.edge(e);r.has(n,\"x\")&&l(n)})),e-=s,i-=c,r.forEach(t.nodes(),(function(n){var r=t.node(n);r.x-=e,r.y-=i})),r.forEach(t.edges(),(function(n){var a=t.edge(n);r.forEach(a.points,(function(t){t.x-=e,t.y-=i})),r.has(a,\"x\")&&(a.x-=e),r.has(a,\"y\")&&(a.y-=i)})),o.width=n-e+s,o.height=a-i+c}(t)})),e(\" assignNodeIntersects\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n,r,i=t.edge(e),a=t.node(e.v),o=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=o,r=a),i.points.unshift(g.intersectRect(a,n)),i.points.push(g.intersectRect(o,r))}))}(t)})),e(\" reversePoints\",(function(){!function(t){r.forEach(t.edges(),(function(e){var n=t.edge(e);n.reversed&&n.points.reverse()}))}(t)})),e(\" acyclic.undo\",(function(){i.undo(t)}))}(e,n)})),n(\" updateInputGraph\",(function(){!function(t,e){r.forEach(t.nodes(),(function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))})),r.forEach(t.edges(),(function(n){var i=t.edge(n),a=e.edge(n);i.points=a.points,r.has(a,\"x\")&&(i.x=a.x,i.y=a.y)})),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,e)}))}))};var m=[\"nodesep\",\"edgesep\",\"ranksep\",\"marginx\",\"marginy\"],b={ranksep:50,edgesep:20,nodesep:50,rankdir:\"tb\"},v=[\"acyclicer\",\"ranker\",\"rankdir\",\"align\"],_=[\"width\",\"height\"],x={width:0,height:0},k=[\"minlen\",\"weight\",\"width\",\"height\",\"labeloffset\"],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:\"r\"},T=[\"labelpos\"];function E(t,e){return r.mapValues(r.pick(t,e),Number)}function C(t){var e={};return r.forEach(t,(function(t,n){e[n.toLowerCase()]=t})),e}},8436:(t,e,n)=>{var r;try{r={cloneDeep:n(361),constant:n(5703),defaults:n(1747),each:n(6073),filter:n(3105),find:n(3311),flatten:n(5564),forEach:n(4486),forIn:n(2620),has:n(8721),isUndefined:n(2353),last:n(928),map:n(5161),mapValues:n(6604),max:n(6162),merge:n(3857),min:n(3632),minBy:n(2762),now:n(7771),pick:n(9722),range:n(6026),reduce:n(4061),sortBy:n(9734),uniqueId:n(3955),values:n(2628),zipObject:n(7287)}}catch(t){}r||(r=window._),t.exports=r},2981:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n,o,s,c,l){var u=t.children(l);if(u.length){var h=i.addBorderNode(t,\"_bt\"),f=i.addBorderNode(t,\"_bb\"),d=t.node(l);t.setParent(h,l),d.borderTop=h,t.setParent(f,l),d.borderBottom=f,r.forEach(u,(function(r){a(t,e,n,o,s,c,r);var i=t.node(r),u=i.borderTop?i.borderTop:r,d=i.borderBottom?i.borderBottom:r,p=i.borderTop?o:2*o,g=u!==d?1:s-c[l]+1;t.setEdge(h,u,{weight:p,minlen:g,nestingEdge:!0}),t.setEdge(d,f,{weight:p,minlen:g,nestingEdge:!0})})),t.parent(l)||t.setEdge(e,h,{weight:0,minlen:s+c[l]})}else l!==e&&t.setEdge(e,l,{weight:0,minlen:n})}t.exports={run:function(t){var e=i.addDummyNode(t,\"root\",{},\"_root\"),n=function(t){var e={};function n(i,a){var o=t.children(i);o&&o.length&&r.forEach(o,(function(t){n(t,a+1)})),e[i]=a}return r.forEach(t.children(),(function(t){n(t,1)})),e}(t),o=r.max(r.values(n))-1,s=2*o+1;t.graph().nestingRoot=e,r.forEach(t.edges(),(function(e){t.edge(e).minlen*=s}));var c=function(t){return r.reduce(t.edges(),(function(e,n){return e+t.edge(n).weight}),0)}(t)+1;r.forEach(t.children(),(function(r){a(t,e,s,c,o,n,r)})),t.graph().nodeRankFactor=s},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,r.forEach(t.edges(),(function(e){t.edge(e).nestingEdge&&t.removeEdge(e)}))}}},5995:(t,e,n)=>{var r=n(8436),i=n(1138);t.exports={run:function(t){t.graph().dummyChains=[],r.forEach(t.edges(),(function(e){!function(t,e){var n,r,a,o=e.v,s=t.node(o).rank,c=e.w,l=t.node(c).rank,u=e.name,h=t.edge(e),f=h.labelRank;if(l!==s+1){for(t.removeEdge(e),a=0,++s;s{var r=n(8436);t.exports=function(t,e,n){var i,a={};r.forEach(n,(function(n){for(var r,o,s=t.parent(n);s;){if((r=t.parent(s))?(o=a[r],a[r]=s):(o=i,i=s),o&&o!==s)return void e.setEdge(o,s);s=r}}))}},5439:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){return r.map(e,(function(e){var n=t.inEdges(e);if(n.length){var i=r.reduce(n,(function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}}),{sum:0,weight:0});return{v:e,barycenter:i.sum/i.weight,weight:i.weight}}return{v:e}}))}},3128:(t,e,n)=>{var r=n(8436),i=n(574).Graph;t.exports=function(t,e,n){var a=function(t){for(var e;t.hasNode(e=r.uniqueId(\"_root\")););return e}(t),o=new i({compound:!0}).setGraph({root:a}).setDefaultNodeLabel((function(e){return t.node(e)}));return r.forEach(t.nodes(),(function(i){var s=t.node(i),c=t.parent(i);(s.rank===e||s.minRank<=e&&e<=s.maxRank)&&(o.setNode(i),o.setParent(i,c||a),r.forEach(t[n](i),(function(e){var n=e.v===i?e.w:e.v,a=o.edge(n,i),s=r.isUndefined(a)?0:a.weight;o.setEdge(n,i,{weight:t.edge(e).weight+s})})),r.has(s,\"minRank\")&&o.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]}))})),o}},6630:(t,e,n)=>{var r=n(8436);function i(t,e,n){for(var i=r.zipObject(n,r.map(n,(function(t,e){return e}))),a=r.flatten(r.map(e,(function(e){return r.sortBy(r.map(t.outEdges(e),(function(e){return{pos:i[e.w],weight:t.edge(e).weight}})),\"pos\")})),!0),o=1;o0;)e%2&&(n+=c[e+1]),c[e=e-1>>1]+=t.weight;l+=t.weight*n}))),l}t.exports=function(t,e){for(var n=0,r=1;r{var r=n(8436),i=n(2588),a=n(6630),o=n(1026),s=n(3128),c=n(5093),l=n(574).Graph,u=n(1138);function h(t,e,n){return r.map(e,(function(e){return s(t,e,n)}))}function f(t,e){var n=new l;r.forEach(t,(function(t){var i=t.graph().root,a=o(t,i,n,e);r.forEach(a.vs,(function(e,n){t.node(e).order=n})),c(t,n,a.vs)}))}function d(t,e){r.forEach(e,(function(e){r.forEach(e,(function(e,n){t.node(e).order=n}))}))}t.exports=function(t){var e=u.maxRank(t),n=h(t,r.range(1,e+1),\"inEdges\"),o=h(t,r.range(e-1,-1,-1),\"outEdges\"),s=i(t);d(t,s);for(var c,l=Number.POSITIVE_INFINITY,p=0,g=0;g<4;++p,++g){f(p%2?n:o,p%4>=2),s=u.buildLayerMatrix(t);var y=a(t,s);y{var r=n(8436);t.exports=function(t){var e={},n=r.filter(t.nodes(),(function(e){return!t.children(e).length})),i=r.max(r.map(n,(function(e){return t.node(e).rank}))),a=r.map(r.range(i+1),(function(){return[]})),o=r.sortBy(n,(function(e){return t.node(e).rank}));return r.forEach(o,(function n(i){if(!r.has(e,i)){e[i]=!0;var o=t.node(i);a[o.rank].push(i),r.forEach(t.successors(i),n)}})),a}},9567:(t,e,n)=>{var r=n(8436);t.exports=function(t,e){var n={};return r.forEach(t,(function(t,e){var i=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};r.isUndefined(t.barycenter)||(i.barycenter=t.barycenter,i.weight=t.weight)})),r.forEach(e.edges(),(function(t){var e=n[t.v],i=n[t.w];r.isUndefined(e)||r.isUndefined(i)||(i.indegree++,e.out.push(n[t.w]))})),function(t){var e=[];function n(t){return function(e){var n,i,a,o;e.merged||(r.isUndefined(e.barycenter)||r.isUndefined(t.barycenter)||e.barycenter>=t.barycenter)&&(i=e,a=0,o=0,(n=t).weight&&(a+=n.barycenter*n.weight,o+=n.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),n.vs=i.vs.concat(n.vs),n.barycenter=a/o,n.weight=o,n.i=Math.min(i.i,n.i),i.merged=!0)}}function i(e){return function(n){n.in.push(e),0==--n.indegree&&t.push(n)}}for(;t.length;){var a=t.pop();e.push(a),r.forEach(a.in.reverse(),n(a)),r.forEach(a.out,i(a))}return r.map(r.filter(e,(function(t){return!t.merged})),(function(t){return r.pick(t,[\"vs\",\"i\",\"barycenter\",\"weight\"])}))}(r.filter(n,(function(t){return!t.indegree})))}},1026:(t,e,n)=>{var r=n(8436),i=n(5439),a=n(9567),o=n(7304);t.exports=function t(e,n,s,c){var l=e.children(n),u=e.node(n),h=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,d={};h&&(l=r.filter(l,(function(t){return t!==h&&t!==f})));var p=i(e,l);r.forEach(p,(function(n){if(e.children(n.v).length){var i=t(e,n.v,s,c);d[n.v]=i,r.has(i,\"barycenter\")&&(a=n,o=i,r.isUndefined(a.barycenter)?(a.barycenter=o.barycenter,a.weight=o.weight):(a.barycenter=(a.barycenter*a.weight+o.barycenter*o.weight)/(a.weight+o.weight),a.weight+=o.weight))}var a,o}));var g=a(p,s);!function(t,e){r.forEach(t,(function(t){t.vs=r.flatten(t.vs.map((function(t){return e[t]?e[t].vs:t})),!0)}))}(g,d);var y=o(g,c);if(h&&(y.vs=r.flatten([h,y.vs,f],!0),e.predecessors(h).length)){var m=e.node(e.predecessors(h)[0]),b=e.node(e.predecessors(f)[0]);r.has(y,\"barycenter\")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+m.order+b.order)/(y.weight+2),y.weight+=2}return y}},7304:(t,e,n)=>{var r=n(8436),i=n(1138);function a(t,e,n){for(var i;e.length&&(i=r.last(e)).i<=n;)e.pop(),t.push(i.vs),n++;return n}t.exports=function(t,e){var n,o=i.partition(t,(function(t){return r.has(t,\"barycenter\")})),s=o.lhs,c=r.sortBy(o.rhs,(function(t){return-t.i})),l=[],u=0,h=0,f=0;s.sort((n=!!e,function(t,e){return t.barycentere.barycenter?1:n?e.i-t.i:t.i-e.i})),f=a(l,c,f),r.forEach(s,(function(t){f+=t.vs.length,l.push(t.vs),u+=t.barycenter*t.weight,h+=t.weight,f=a(l,c,f)}));var d={vs:r.flatten(l,!0)};return h&&(d.barycenter=u/h,d.weight=h),d}},4219:(t,e,n)=>{var r=n(8436);t.exports=function(t){var e=function(t){var e={},n=0;return r.forEach(t.children(),(function i(a){var o=n;r.forEach(t.children(a),i),e[a]={low:o,lim:n++}})),e}(t);r.forEach(t.graph().dummyChains,(function(n){for(var r=t.node(n),i=r.edgeObj,a=function(t,e,n,r){var i,a,o=[],s=[],c=Math.min(e[n].low,e[r].low),l=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),o.push(i)}while(i&&(e[i].low>c||l>e[i].lim));for(a=i,i=r;(i=t.parent(i))!==a;)s.push(i);return{path:o.concat(s.reverse()),lca:a}}(t,e,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=t.node(n),u){for(;(l=o[c])!==s&&t.node(l).maxRank{var r=n(8436),i=n(574).Graph,a=n(1138);function o(t,e){var n={};return r.reduce(e,(function(e,i){var a=0,o=0,s=e.length,l=r.last(i);return r.forEach(i,(function(e,u){var h=function(t,e){if(t.node(e).dummy)return r.find(t.predecessors(e),(function(e){return t.node(e).dummy}))}(t,e),f=h?t.node(h).order:s;(h||e===l)&&(r.forEach(i.slice(o,u+1),(function(e){r.forEach(t.predecessors(e),(function(r){var i=t.node(r),o=i.order;!(os)&&c(n,e,l)}))}))}return r.reduce(e,(function(e,n){var a,o=-1,s=0;return r.forEach(n,(function(r,c){if(\"border\"===t.node(r).dummy){var l=t.predecessors(r);l.length&&(a=t.node(l[0]).order,i(n,s,c,o,a),s=c,o=a)}i(n,s,n.length,a,e.length)})),n})),n}function c(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function l(t,e,n){if(e>n){var i=e;e=n,n=i}return r.has(t[e],n)}function u(t,e,n,i){var a={},o={},s={};return r.forEach(e,(function(t){r.forEach(t,(function(t,e){a[t]=t,o[t]=t,s[t]=e}))})),r.forEach(e,(function(t){var e=-1;r.forEach(t,(function(t){var c=i(t);if(c.length){c=r.sortBy(c,(function(t){return s[t]}));for(var u=(c.length-1)/2,h=Math.floor(u),f=Math.ceil(u);h<=f;++h){var d=c[h];o[t]===t&&e{var r=n(8436),i=n(1138),a=n(3573).positionX;t.exports=function(t){(function(t){var e=i.buildLayerMatrix(t),n=t.graph().ranksep,a=0;r.forEach(e,(function(e){var i=r.max(r.map(e,(function(e){return t.node(e).height})));r.forEach(e,(function(e){t.node(e).y=a+i/2})),a+=i+n}))})(t=i.asNonCompoundGraph(t)),r.forEach(a(t),(function(e,n){t.node(n).x=e}))}},300:(t,e,n)=>{var r=n(8436),i=n(574).Graph,a=n(6681).slack;function o(t,e){return r.forEach(t.nodes(),(function n(i){r.forEach(e.nodeEdges(i),(function(r){var o=r.v,s=i===o?r.w:o;t.hasNode(s)||a(e,r)||(t.setNode(s,{}),t.setEdge(i,s,{}),n(s))}))})),t.nodeCount()}function s(t,e){return r.minBy(e.edges(),(function(n){if(t.hasNode(n.v)!==t.hasNode(n.w))return a(e,n)}))}function c(t,e,n){r.forEach(t.nodes(),(function(t){e.node(t).rank+=n}))}t.exports=function(t){var e,n,r=new i({directed:!1}),l=t.nodes()[0],u=t.nodeCount();for(r.setNode(l,{});o(r,t){var r=n(6681).longestPath,i=n(300),a=n(2472);t.exports=function(t){switch(t.graph().ranker){case\"network-simplex\":default:!function(t){a(t)}(t);break;case\"tight-tree\":!function(t){r(t),i(t)}(t);break;case\"longest-path\":o(t)}};var o=r},2472:(t,e,n)=>{var r=n(8436),i=n(300),a=n(6681).slack,o=n(6681).longestPath,s=n(574).alg.preorder,c=n(574).alg.postorder,l=n(1138).simplify;function u(t){t=l(t),o(t);var e,n=i(t);for(d(n),h(n,t);e=g(n);)m(n,t,e,y(n,t,e))}function h(t,e){var n=c(t,t.nodes());n=n.slice(0,n.length-1),r.forEach(n,(function(n){!function(t,e,n){var r=t.node(n).parent;t.edge(n,r).cutvalue=f(t,e,n)}(t,e,n)}))}function f(t,e,n){var i=t.node(n).parent,a=!0,o=e.edge(n,i),s=0;return o||(a=!1,o=e.edge(i,n)),s=o.weight,r.forEach(e.nodeEdges(n),(function(r){var o,c,l=r.v===n,u=l?r.w:r.v;if(u!==i){var h=l===a,f=e.edge(r).weight;if(s+=h?f:-f,o=n,c=u,t.hasEdge(o,c)){var d=t.edge(n,u).cutvalue;s+=h?-d:d}}})),s}function d(t,e){arguments.length<2&&(e=t.nodes()[0]),p(t,{},1,e)}function p(t,e,n,i,a){var o=n,s=t.node(i);return e[i]=!0,r.forEach(t.neighbors(i),(function(a){r.has(e,a)||(n=p(t,e,n,a,i))})),s.low=o,s.lim=n++,a?s.parent=a:delete s.parent,n}function g(t){return r.find(t.edges(),(function(e){return t.edge(e).cutvalue<0}))}function y(t,e,n){var i=n.v,o=n.w;e.hasEdge(i,o)||(i=n.w,o=n.v);var s=t.node(i),c=t.node(o),l=s,u=!1;s.lim>c.lim&&(l=c,u=!0);var h=r.filter(e.edges(),(function(e){return u===b(0,t.node(e.v),l)&&u!==b(0,t.node(e.w),l)}));return r.minBy(h,(function(t){return a(e,t)}))}function m(t,e,n,i){var a=n.v,o=n.w;t.removeEdge(a,o),t.setEdge(i.v,i.w,{}),d(t),h(t,e),function(t,e){var n=r.find(t.nodes(),(function(t){return!e.node(t).parent})),i=s(t,n);i=i.slice(1),r.forEach(i,(function(n){var r=t.node(n).parent,i=e.edge(n,r),a=!1;i||(i=e.edge(r,n),a=!0),e.node(n).rank=e.node(r).rank+(a?i.minlen:-i.minlen)}))}(t,e)}function b(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}t.exports=u,u.initLowLimValues=d,u.initCutValues=h,u.calcCutValue=f,u.leaveEdge=g,u.enterEdge=y,u.exchangeEdges=m},6681:(t,e,n)=>{var r=n(8436);t.exports={longestPath:function(t){var e={};r.forEach(t.sources(),(function n(i){var a=t.node(i);if(r.has(e,i))return a.rank;e[i]=!0;var o=r.min(r.map(t.outEdges(i),(function(e){return n(e.w)-t.edge(e).minlen})));return o!==Number.POSITIVE_INFINITY&&null!=o||(o=0),a.rank=o}))},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}}},1138:(t,e,n)=>{var r=n(8436),i=n(574).Graph;function a(t,e,n,i){var a;do{a=r.uniqueId(i)}while(t.hasNode(a));return n.dummy=e,t.setNode(a,n),a}function o(t){return r.max(r.map(t.nodes(),(function(e){var n=t.node(e).rank;if(!r.isUndefined(n))return n})))}t.exports={addDummyNode:a,simplify:function(t){var e=(new i).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){e.setNode(n,t.node(n))})),r.forEach(t.edges(),(function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})})),e},asNonCompoundGraph:function(t){var e=new i({multigraph:t.isMultigraph()}).setGraph(t.graph());return r.forEach(t.nodes(),(function(n){t.children(n).length||e.setNode(n,t.node(n))})),r.forEach(t.edges(),(function(n){e.setEdge(n,t.edge(n))})),e},successorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.outEdges(e),(function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight})),n}));return r.zipObject(t.nodes(),e)},predecessorWeights:function(t){var e=r.map(t.nodes(),(function(e){var n={};return r.forEach(t.inEdges(e),(function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight})),n}));return r.zipObject(t.nodes(),e)},intersectRect:function(t,e){var n,r,i=t.x,a=t.y,o=e.x-i,s=e.y-a,c=t.width/2,l=t.height/2;if(!o&&!s)throw new Error(\"Not possible to find intersection inside of the rectangle\");return Math.abs(s)*c>Math.abs(o)*l?(s<0&&(l=-l),n=l*o/s,r=l):(o<0&&(c=-c),n=c,r=c*s/o),{x:i+n,y:a+r}},buildLayerMatrix:function(t){var e=r.map(r.range(o(t)+1),(function(){return[]}));return r.forEach(t.nodes(),(function(n){var i=t.node(n),a=i.rank;r.isUndefined(a)||(e[a][i.order]=n)})),e},normalizeRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank})));r.forEach(t.nodes(),(function(n){var i=t.node(n);r.has(i,\"rank\")&&(i.rank-=e)}))},removeEmptyRanks:function(t){var e=r.min(r.map(t.nodes(),(function(e){return t.node(e).rank}))),n=[];r.forEach(t.nodes(),(function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)}));var i=0,a=t.graph().nodeRankFactor;r.forEach(n,(function(e,n){r.isUndefined(e)&&n%a!=0?--i:i&&r.forEach(e,(function(e){t.node(e).rank+=i}))}))},addBorderNode:function(t,e,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),a(t,\"border\",i,e)},maxRank:o,partition:function(t,e){var n={lhs:[],rhs:[]};return r.forEach(t,(function(t){e(t)?n.lhs.push(t):n.rhs.push(t)})),n},time:function(t,e){var n=r.now();try{return e()}finally{console.log(t+\" time: \"+(r.now()-n)+\"ms\")}},notime:function(t,e){return e()}}},8177:t=>{t.exports=\"0.8.5\"},7856:function(t){t.exports=function(){function t(e){return t=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},t(e)}function e(t,n){return e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(t,n)}function n(){if(\"undefined\"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if(\"function\"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function r(t,i,a){return r=n()?Reflect.construct:function(t,n,r){var i=[null];i.push.apply(i,n);var a=new(Function.bind.apply(t,i));return r&&e(a,r.prototype),a},r.apply(null,arguments)}function i(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if(\"undefined\"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t[\"@@iterator\"])return Array.from(t)}(t)||function(t,e){if(t){if(\"string\"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return\"Object\"===n&&t.constructor&&(n=t.constructor.name),\"Map\"===n||\"Set\"===n?Array.from(t):\"Arguments\"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,e):void 0}}(t)||function(){throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?n-1:0),i=1;i/gm),q=f(/^data-[\\-\\w.\\u00B7-\\uFFFF]/),H=f(/^aria-[\\-\\w]+$/),V=f(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\\-]+(?:[^a-z+.\\-:]|$))/i),G=f(/^(?:\\w+script|data):/i),X=f(/[\\u0000-\\u0020\\u00A0\\u1680\\u180E\\u2000-\\u2029\\u205F\\u3000]/g),Z=f(/^html$/i),Q=function(){return\"undefined\"==typeof window?null:window},K=function(e,n){if(\"object\"!==t(e)||\"function\"!=typeof e.createPolicy)return null;var r=null,i=\"data-tt-policy-suffix\";n.currentScript&&n.currentScript.hasAttribute(i)&&(r=n.currentScript.getAttribute(i));var a=\"dompurify\"+(r?\"#\"+r:\"\");try{return e.createPolicy(a,{createHTML:function(t){return t},createScriptURL:function(t){return t}})}catch(t){return console.warn(\"TrustedTypes policy \"+a+\" could not be created.\"),null}};return function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Q(),r=function(t){return e(t)};if(r.version=\"2.4.0\",r.removed=[],!n||!n.document||9!==n.document.nodeType)return r.isSupported=!1,r;var a=n.document,o=n.document,s=n.DocumentFragment,c=n.HTMLTemplateElement,l=n.Node,u=n.Element,f=n.NodeFilter,d=n.NamedNodeMap,p=void 0===d?n.NamedNodeMap||n.MozNamedAttrMap:d,g=n.HTMLFormElement,y=n.DOMParser,m=n.trustedTypes,A=u.prototype,J=O(A,\"cloneNode\"),tt=O(A,\"nextSibling\"),et=O(A,\"childNodes\"),nt=O(A,\"parentNode\");if(\"function\"==typeof c){var rt=o.createElement(\"template\");rt.content&&rt.content.ownerDocument&&(o=rt.content.ownerDocument)}var it=K(m,a),at=it?it.createHTML(\"\"):\"\",ot=o,st=ot.implementation,ct=ot.createNodeIterator,lt=ot.createDocumentFragment,ut=ot.getElementsByTagName,ht=a.importNode,ft={};try{ft=N(o).documentMode?o.documentMode:{}}catch(t){}var dt={};r.isSupported=\"function\"==typeof nt&&st&&void 0!==st.createHTMLDocument&&9!==ft;var pt,gt,yt=$,mt=W,bt=q,vt=H,_t=G,xt=X,kt=V,wt=null,Tt=M({},[].concat(i(D),i(B),i(L),i(F),i(P))),Et=null,Ct=M({},[].concat(i(j),i(z),i(Y),i(U))),St=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),At=null,Mt=null,Nt=!0,Ot=!0,Dt=!1,Bt=!1,Lt=!1,It=!1,Ft=!1,Rt=!1,Pt=!1,jt=!1,zt=!0,Yt=!1,Ut=\"user-content-\",$t=!0,Wt=!1,qt={},Ht=null,Vt=M({},[\"annotation-xml\",\"audio\",\"colgroup\",\"desc\",\"foreignobject\",\"head\",\"iframe\",\"math\",\"mi\",\"mn\",\"mo\",\"ms\",\"mtext\",\"noembed\",\"noframes\",\"noscript\",\"plaintext\",\"script\",\"style\",\"svg\",\"template\",\"thead\",\"title\",\"video\",\"xmp\"]),Gt=null,Xt=M({},[\"audio\",\"video\",\"img\",\"source\",\"image\",\"track\"]),Zt=null,Qt=M({},[\"alt\",\"class\",\"for\",\"id\",\"label\",\"name\",\"pattern\",\"placeholder\",\"role\",\"summary\",\"title\",\"value\",\"style\",\"xmlns\"]),Kt=\"http://www.w3.org/1998/Math/MathML\",Jt=\"http://www.w3.org/2000/svg\",te=\"http://www.w3.org/1999/xhtml\",ee=te,ne=!1,re=[\"application/xhtml+xml\",\"text/html\"],ie=\"text/html\",ae=null,oe=o.createElement(\"form\"),se=function(t){return t instanceof RegExp||t instanceof Function},ce=function(e){ae&&ae===e||(e&&\"object\"===t(e)||(e={}),e=N(e),pt=pt=-1===re.indexOf(e.PARSER_MEDIA_TYPE)?ie:e.PARSER_MEDIA_TYPE,gt=\"application/xhtml+xml\"===pt?function(t){return t}:x,wt=\"ALLOWED_TAGS\"in e?M({},e.ALLOWED_TAGS,gt):Tt,Et=\"ALLOWED_ATTR\"in e?M({},e.ALLOWED_ATTR,gt):Ct,Zt=\"ADD_URI_SAFE_ATTR\"in e?M(N(Qt),e.ADD_URI_SAFE_ATTR,gt):Qt,Gt=\"ADD_DATA_URI_TAGS\"in e?M(N(Xt),e.ADD_DATA_URI_TAGS,gt):Xt,Ht=\"FORBID_CONTENTS\"in e?M({},e.FORBID_CONTENTS,gt):Vt,At=\"FORBID_TAGS\"in e?M({},e.FORBID_TAGS,gt):{},Mt=\"FORBID_ATTR\"in e?M({},e.FORBID_ATTR,gt):{},qt=\"USE_PROFILES\"in e&&e.USE_PROFILES,Nt=!1!==e.ALLOW_ARIA_ATTR,Ot=!1!==e.ALLOW_DATA_ATTR,Dt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Bt=e.SAFE_FOR_TEMPLATES||!1,Lt=e.WHOLE_DOCUMENT||!1,Rt=e.RETURN_DOM||!1,Pt=e.RETURN_DOM_FRAGMENT||!1,jt=e.RETURN_TRUSTED_TYPE||!1,Ft=e.FORCE_BODY||!1,zt=!1!==e.SANITIZE_DOM,Yt=e.SANITIZE_NAMED_PROPS||!1,$t=!1!==e.KEEP_CONTENT,Wt=e.IN_PLACE||!1,kt=e.ALLOWED_URI_REGEXP||kt,ee=e.NAMESPACE||te,e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(St.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&se(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(St.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&\"boolean\"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(St.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Bt&&(Ot=!1),Pt&&(Rt=!0),qt&&(wt=M({},i(P)),Et=[],!0===qt.html&&(M(wt,D),M(Et,j)),!0===qt.svg&&(M(wt,B),M(Et,z),M(Et,U)),!0===qt.svgFilters&&(M(wt,L),M(Et,z),M(Et,U)),!0===qt.mathMl&&(M(wt,F),M(Et,Y),M(Et,U))),e.ADD_TAGS&&(wt===Tt&&(wt=N(wt)),M(wt,e.ADD_TAGS,gt)),e.ADD_ATTR&&(Et===Ct&&(Et=N(Et)),M(Et,e.ADD_ATTR,gt)),e.ADD_URI_SAFE_ATTR&&M(Zt,e.ADD_URI_SAFE_ATTR,gt),e.FORBID_CONTENTS&&(Ht===Vt&&(Ht=N(Ht)),M(Ht,e.FORBID_CONTENTS,gt)),$t&&(wt[\"#text\"]=!0),Lt&&M(wt,[\"html\",\"head\",\"body\"]),wt.table&&(M(wt,[\"tbody\"]),delete At.tbody),h&&h(e),ae=e)},le=M({},[\"mi\",\"mo\",\"mn\",\"ms\",\"mtext\"]),ue=M({},[\"foreignobject\",\"desc\",\"title\",\"annotation-xml\"]),he=M({},[\"title\",\"style\",\"font\",\"a\",\"script\"]),fe=M({},B);M(fe,L),M(fe,I);var de=M({},F);M(de,R);var pe=function(t){var e=nt(t);e&&e.tagName||(e={namespaceURI:te,tagName:\"template\"});var n=x(t.tagName),r=x(e.tagName);return t.namespaceURI===Jt?e.namespaceURI===te?\"svg\"===n:e.namespaceURI===Kt?\"svg\"===n&&(\"annotation-xml\"===r||le[r]):Boolean(fe[n]):t.namespaceURI===Kt?e.namespaceURI===te?\"math\"===n:e.namespaceURI===Jt?\"math\"===n&&ue[r]:Boolean(de[n]):t.namespaceURI===te&&!(e.namespaceURI===Jt&&!ue[r])&&!(e.namespaceURI===Kt&&!le[r])&&!de[n]&&(he[n]||!fe[n])},ge=function(t){_(r.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=at}catch(e){t.remove()}}},ye=function(t,e){try{_(r.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){_(r.removed,{attribute:null,from:e})}if(e.removeAttribute(t),\"is\"===t&&!Et[t])if(Rt||Pt)try{ge(e)}catch(t){}else try{e.setAttribute(t,\"\")}catch(t){}},me=function(t){var e,n;if(Ft)t=\"\"+t;else{var r=k(t,/^[\\r\\n\\t ]+/);n=r&&r[0]}\"application/xhtml+xml\"===pt&&(t=''+t+\"\");var i=it?it.createHTML(t):t;if(ee===te)try{e=(new y).parseFromString(i,pt)}catch(t){}if(!e||!e.documentElement){e=st.createDocument(ee,\"template\",null);try{e.documentElement.innerHTML=ne?\"\":i}catch(t){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),ee===te?ut.call(e,Lt?\"html\":\"body\")[0]:Lt?e.documentElement:a},be=function(t){return ct.call(t.ownerDocument||t,t,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,null,!1)},ve=function(t){return t instanceof g&&(\"string\"!=typeof t.nodeName||\"string\"!=typeof t.textContent||\"function\"!=typeof t.removeChild||!(t.attributes instanceof p)||\"function\"!=typeof t.removeAttribute||\"function\"!=typeof t.setAttribute||\"string\"!=typeof t.namespaceURI||\"function\"!=typeof t.insertBefore)},_e=function(e){return\"object\"===t(l)?e instanceof l:e&&\"object\"===t(e)&&\"number\"==typeof e.nodeType&&\"string\"==typeof e.nodeName},xe=function(t,e,n){dt[t]&&b(dt[t],(function(t){t.call(r,e,n,ae)}))},ke=function(t){var e;if(xe(\"beforeSanitizeElements\",t,null),ve(t))return ge(t),!0;if(C(/[\\u0080-\\uFFFF]/,t.nodeName))return ge(t),!0;var n=gt(t.nodeName);if(xe(\"uponSanitizeElement\",t,{tagName:n,allowedTags:wt}),t.hasChildNodes()&&!_e(t.firstElementChild)&&(!_e(t.content)||!_e(t.content.firstElementChild))&&C(/<[/\\w]/g,t.innerHTML)&&C(/<[/\\w]/g,t.textContent))return ge(t),!0;if(\"select\"===n&&C(/