(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[152,6,7],{ /***/ "+NIl": /*!***************************************************!*\ !*** ./node_modules/codemirror/mode/stex/stex.js ***! \***************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE /* * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de) * Licence: MIT */ (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { "use strict"; CodeMirror.defineMode("stex", function(_config, parserConfig) { "use strict"; function pushCommand(state, command) { state.cmdState.push(command); } function peekCommand(state) { if (state.cmdState.length > 0) { return state.cmdState[state.cmdState.length - 1]; } else { return null; } } function popCommand(state) { var plug = state.cmdState.pop(); if (plug) { plug.closeBracket(); } } // returns the non-default plugin closest to the end of the list function getMostPowerful(state) { var context = state.cmdState; for (var i = context.length - 1; i >= 0; i--) { var plug = context[i]; if (plug.name == "DEFAULT") { continue; } return plug; } return { styleIdentifier: function() { return null; } }; } function addPluginPattern(pluginName, cmdStyle, styles) { return function () { this.name = pluginName; this.bracketNo = 0; this.style = cmdStyle; this.styles = styles; this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin this.styleIdentifier = function() { return this.styles[this.bracketNo - 1] || null; }; this.openBracket = function() { this.bracketNo++; return "bracket"; }; this.closeBracket = function() {}; }; } var plugins = {}; plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]); plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]); plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]); plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]); plugins["end"] = addPluginPattern("end", "tag", ["atom"]); plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]); plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]); plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]); plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]); plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]); plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]); plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]); plugins["DEFAULT"] = function () { this.name = "DEFAULT"; this.style = "tag"; this.styleIdentifier = this.openBracket = this.closeBracket = function() {}; }; function setState(state, f) { state.f = f; } // called when in a normal (no environment) context function normal(source, state) { var plug; // Do we look like '\command' ? If so, attempt to apply the plugin 'command' if (source.match(/^\\[a-zA-Z@]+/)) { var cmdName = source.current().slice(1); plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"]; plug = new plug(); pushCommand(state, plug); setState(state, beginParams); return plug.style; } // escape characters if (source.match(/^\\[$&%#{}_]/)) { return "tag"; } // white space control characters if (source.match(/^\\[,;!\/\\]/)) { return "tag"; } // find if we're starting various math modes if (source.match("\\[")) { setState(state, function(source, state){ return inMathMode(source, state, "\\]"); }); return "keyword"; } if (source.match("\\(")) { setState(state, function(source, state){ return inMathMode(source, state, "\\)"); }); return "keyword"; } if (source.match("$$")) { setState(state, function(source, state){ return inMathMode(source, state, "$$"); }); return "keyword"; } if (source.match("$")) { setState(state, function(source, state){ return inMathMode(source, state, "$"); }); return "keyword"; } var ch = source.next(); if (ch == "%") { source.skipToEnd(); return "comment"; } else if (ch == '}' || ch == ']') { plug = peekCommand(state); if (plug) { plug.closeBracket(ch); setState(state, beginParams); } else { return "error"; } return "bracket"; } else if (ch == '{' || ch == '[') { plug = plugins["DEFAULT"]; plug = new plug(); pushCommand(state, plug); return "bracket"; } else if (/\d/.test(ch)) { source.eatWhile(/[\w.%]/); return "atom"; } else { source.eatWhile(/[\w\-_]/); plug = getMostPowerful(state); if (plug.name == 'begin') { plug.argument = source.current(); } return plug.styleIdentifier(); } } function inMathMode(source, state, endModeSeq) { if (source.eatSpace()) { return null; } if (endModeSeq && source.match(endModeSeq)) { setState(state, normal); return "keyword"; } if (source.match(/^\\[a-zA-Z@]+/)) { return "tag"; } if (source.match(/^[a-zA-Z]+/)) { return "variable-2"; } // escape characters if (source.match(/^\\[$&%#{}_]/)) { return "tag"; } // white space control characters if (source.match(/^\\[,;!\/]/)) { return "tag"; } // special math-mode characters if (source.match(/^[\^_&]/)) { return "tag"; } // non-special characters if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) { return null; } if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) { return "number"; } var ch = source.next(); if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") { return "bracket"; } if (ch == "%") { source.skipToEnd(); return "comment"; } return "error"; } function beginParams(source, state) { var ch = source.peek(), lastPlug; if (ch == '{' || ch == '[') { lastPlug = peekCommand(state); lastPlug.openBracket(ch); source.eat(ch); setState(state, normal); return "bracket"; } if (/[ \t\r]/.test(ch)) { source.eat(ch); return null; } setState(state, normal); popCommand(state); return normal(source, state); } return { startState: function() { var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal; return { cmdState: [], f: f }; }, copyState: function(s) { return { cmdState: s.cmdState.slice(), f: s.f }; }, token: function(stream, state) { return state.f(stream, state); }, blankLine: function(state) { state.f = normal; state.cmdState.length = 0; }, lineComment: "%" }; }); CodeMirror.defineMIME("text/x-stex", "stex"); CodeMirror.defineMIME("text/x-latex", "stex"); }); /***/ }), /***/ "19Vz": /*!**************************************************************!*\ !*** ./node_modules/codemirror/addon/display/placeholder.js ***! \**************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { CodeMirror.defineOption("placeholder", "", function(cm, val, old) { var prev = old && old != CodeMirror.Init; if (val && !prev) { cm.on("blur", onBlur); cm.on("change", onChange); cm.on("swapDoc", onChange); CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) }) onChange(cm); } else if (!val && prev) { cm.off("blur", onBlur); cm.off("change", onChange); cm.off("swapDoc", onChange); CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose) clearPlaceholder(cm); var wrapper = cm.getWrapperElement(); wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); } if (val && !cm.hasFocus()) onBlur(cm); }); function clearPlaceholder(cm) { if (cm.state.placeholder) { cm.state.placeholder.parentNode.removeChild(cm.state.placeholder); cm.state.placeholder = null; } } function setPlaceholder(cm) { clearPlaceholder(cm); var elt = cm.state.placeholder = document.createElement("pre"); elt.style.cssText = "height: 0; overflow: visible"; elt.style.direction = cm.getOption("direction"); elt.className = "CodeMirror-placeholder CodeMirror-line-like"; var placeHolder = cm.getOption("placeholder") if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder) elt.appendChild(placeHolder) cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); } function onComposition(cm) { setTimeout(function() { var empty = false, input = cm.getInputField() if (input.nodeName == "TEXTAREA") empty = !input.value else if (cm.lineCount() == 1) empty = !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent) if (empty) setPlaceholder(cm) else clearPlaceholder(cm) }, 20) } function onBlur(cm) { if (isEmpty(cm)) setPlaceholder(cm); } function onChange(cm) { var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); if (empty) setPlaceholder(cm); else clearPlaceholder(cm); } function isEmpty(cm) { return (cm.lineCount() === 1) && (cm.getLine(0) === ""); } }); /***/ }), /***/ "1eCo": /*!*************************************************!*\ !*** ./node_modules/codemirror/mode/xml/xml.js ***! \*************************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { "use strict"; var htmlConfig = { autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true, 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true, 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true, 'track': true, 'wbr': true, 'menuitem': true}, implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true, 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true, 'th': true, 'tr': true}, contextGrabbers: { 'dd': {'dd': true, 'dt': true}, 'dt': {'dd': true, 'dt': true}, 'li': {'li': true}, 'option': {'option': true, 'optgroup': true}, 'optgroup': {'optgroup': true}, 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true, 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true, 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true, 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true, 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true}, 'rp': {'rp': true, 'rt': true}, 'rt': {'rp': true, 'rt': true}, 'tbody': {'tbody': true, 'tfoot': true}, 'td': {'td': true, 'th': true}, 'tfoot': {'tbody': true}, 'th': {'td': true, 'th': true}, 'thead': {'tbody': true, 'tfoot': true}, 'tr': {'tr': true} }, doNotIndent: {"pre": true}, allowUnquoted: true, allowMissing: true, caseFold: true } var xmlConfig = { autoSelfClosers: {}, implicitlyClosed: {}, contextGrabbers: {}, doNotIndent: {}, allowUnquoted: false, allowMissing: false, allowMissingTagName: false, caseFold: false } CodeMirror.defineMode("xml", function(editorConf, config_) { var indentUnit = editorConf.indentUnit var config = {} var defaults = config_.htmlMode ? htmlConfig : xmlConfig for (var prop in defaults) config[prop] = defaults[prop] for (var prop in config_) config[prop] = config_[prop] // Return variables for tokenizers var type, setStyle; function inText(stream, state) { function chain(parser) { state.tokenize = parser; return parser(stream, state); } var ch = stream.next(); if (ch == "<") { if (stream.eat("!")) { if (stream.eat("[")) { if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>")); else return null; } else if (stream.match("--")) { return chain(inBlock("comment", "-->")); } else if (stream.match("DOCTYPE", true, true)) { stream.eatWhile(/[\w\._\-]/); return chain(doctype(1)); } else { return null; } } else if (stream.eat("?")) { stream.eatWhile(/[\w\._\-]/); state.tokenize = inBlock("meta", "?>"); return "meta"; } else { type = stream.eat("/") ? "closeTag" : "openTag"; state.tokenize = inTag; return "tag bracket"; } } else if (ch == "&") { var ok; if (stream.eat("#")) { if (stream.eat("x")) { ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";"); } else { ok = stream.eatWhile(/[\d]/) && stream.eat(";"); } } else { ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";"); } return ok ? "atom" : "error"; } else { stream.eatWhile(/[^&<]/); return null; } } inText.isInText = true; function inTag(stream, state) { var ch = stream.next(); if (ch == ">" || (ch == "/" && stream.eat(">"))) { state.tokenize = inText; type = ch == ">" ? "endTag" : "selfcloseTag"; return "tag bracket"; } else if (ch == "=") { type = "equals"; return null; } else if (ch == "<") { state.tokenize = inText; state.state = baseState; state.tagName = state.tagStart = null; var next = state.tokenize(stream, state); return next ? next + " tag error" : "tag error"; } else if (/[\'\"]/.test(ch)) { state.tokenize = inAttribute(ch); state.stringStartCol = stream.column(); return state.tokenize(stream, state); } else { stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/); return "word"; } } function inAttribute(quote) { var closure = function(stream, state) { while (!stream.eol()) { if (stream.next() == quote) { state.tokenize = inTag; break; } } return "string"; }; closure.isInAttribute = true; return closure; } function inBlock(style, terminator) { return function(stream, state) { while (!stream.eol()) { if (stream.match(terminator)) { state.tokenize = inText; break; } stream.next(); } return style; } } function doctype(depth) { return function(stream, state) { var ch; while ((ch = stream.next()) != null) { if (ch == "<") { state.tokenize = doctype(depth + 1); return state.tokenize(stream, state); } else if (ch == ">") { if (depth == 1) { state.tokenize = inText; break; } else { state.tokenize = doctype(depth - 1); return state.tokenize(stream, state); } } } return "meta"; }; } function Context(state, tagName, startOfLine) { this.prev = state.context; this.tagName = tagName; this.indent = state.indented; this.startOfLine = startOfLine; if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent)) this.noIndent = true; } function popContext(state) { if (state.context) state.context = state.context.prev; } function maybePopContext(state, nextTagName) { var parentTagName; while (true) { if (!state.context) { return; } parentTagName = state.context.tagName; if (!config.contextGrabbers.hasOwnProperty(parentTagName) || !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) { return; } popContext(state); } } function baseState(type, stream, state) { if (type == "openTag") { state.tagStart = stream.column(); return tagNameState; } else if (type == "closeTag") { return closeTagNameState; } else { return baseState; } } function tagNameState(type, stream, state) { if (type == "word") { state.tagName = stream.current(); setStyle = "tag"; return attrState; } else if (config.allowMissingTagName && type == "endTag") { setStyle = "tag bracket"; return attrState(type, stream, state); } else { setStyle = "error"; return tagNameState; } } function closeTagNameState(type, stream, state) { if (type == "word") { var tagName = stream.current(); if (state.context && state.context.tagName != tagName && config.implicitlyClosed.hasOwnProperty(state.context.tagName)) popContext(state); if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { setStyle = "tag"; return closeState; } else { setStyle = "tag error"; return closeStateErr; } } else if (config.allowMissingTagName && type == "endTag") { setStyle = "tag bracket"; return closeState(type, stream, state); } else { setStyle = "error"; return closeStateErr; } } function closeState(type, _stream, state) { if (type != "endTag") { setStyle = "error"; return closeState; } popContext(state); return baseState; } function closeStateErr(type, stream, state) { setStyle = "error"; return closeState(type, stream, state); } function attrState(type, _stream, state) { if (type == "word") { setStyle = "attribute"; return attrEqState; } else if (type == "endTag" || type == "selfcloseTag") { var tagName = state.tagName, tagStart = state.tagStart; state.tagName = state.tagStart = null; if (type == "selfcloseTag" || config.autoSelfClosers.hasOwnProperty(tagName)) { maybePopContext(state, tagName); } else { maybePopContext(state, tagName); state.context = new Context(state, tagName, tagStart == state.indented); } return baseState; } setStyle = "error"; return attrState; } function attrEqState(type, stream, state) { if (type == "equals") return attrValueState; if (!config.allowMissing) setStyle = "error"; return attrState(type, stream, state); } function attrValueState(type, stream, state) { if (type == "string") return attrContinuedState; if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;} setStyle = "error"; return attrState(type, stream, state); } function attrContinuedState(type, stream, state) { if (type == "string") return attrContinuedState; return attrState(type, stream, state); } return { startState: function(baseIndent) { var state = {tokenize: inText, state: baseState, indented: baseIndent || 0, tagName: null, tagStart: null, context: null} if (baseIndent != null) state.baseIndent = baseIndent return state }, token: function(stream, state) { if (!state.tagName && stream.sol()) state.indented = stream.indentation(); if (stream.eatSpace()) return null; type = null; var style = state.tokenize(stream, state); if ((style || type) && style != "comment") { setStyle = null; state.state = state.state(type || style, stream, state); if (setStyle) style = setStyle == "error" ? style + " error" : setStyle; } return style; }, indent: function(state, textAfter, fullLine) { var context = state.context; // Indent multi-line strings (e.g. css). if (state.tokenize.isInAttribute) { if (state.tagStart == state.indented) return state.stringStartCol + 1; else return state.indented + indentUnit; } if (context && context.noIndent) return CodeMirror.Pass; if (state.tokenize != inTag && state.tokenize != inText) return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0; // Indent the starts of attribute names. if (state.tagName) { if (config.multilineTagIndentPastTag !== false) return state.tagStart + state.tagName.length + 2; else return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1); } if (config.alignCDATA && /$/, blockCommentStart: "", configuration: config.htmlMode ? "html" : "xml", helperType: config.htmlMode ? "html" : "xml", skipAttribute: function(state) { if (state.state == attrValueState) state.state = attrState }, xmlCurrentTag: function(state) { return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null }, xmlCurrentContext: function(state) { var context = [] for (var cx = state.context; cx; cx = cx.prev) if (cx.tagName) context.push(cx.tagName) return context.reverse() } }; }); CodeMirror.defineMIME("text/xml", "xml"); CodeMirror.defineMIME("application/xml", "xml"); if (!CodeMirror.mimeModes.hasOwnProperty("text/html")) CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true}); }); /***/ }), /***/ "7ahc": /*!*************************************************************!*\ !*** ./src/components/markdown-editor/code-block/index.tsx ***! \*************************************************************/ /*! exports provided: default, MyCodeMirror */ /*! exports used: MyCodeMirror, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MyCodeMirror; }); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */ "k1fw"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */ "0Owb"); /* harmony import */ var antd_es_button_style__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! antd/es/button/style */ "+L6B"); /* harmony import */ var antd_es_button__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! antd/es/button */ "2/Rp"); /* harmony import */ var antd_es_form_style__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! antd/es/form/style */ "y8nQ"); /* harmony import */ var antd_es_form__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! antd/es/form */ "Vl3Y"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */ "tJVT"); /* harmony import */ var antd_es_select_style__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! antd/es/select/style */ "OaEy"); /* harmony import */ var antd_es_select__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! antd/es/select */ "2fM7"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! react */ "cDcd"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__); /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! codemirror */ "VrN/"); /* harmony import */ var codemirror__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(codemirror__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! codemirror/lib/codemirror.css */ "p77/"); /* harmony import */ var codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(codemirror_lib_codemirror_css__WEBPACK_IMPORTED_MODULE_11__); /* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! codemirror/theme/blackboard.css */ "c5Ni"); /* harmony import */ var codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(codemirror_theme_blackboard_css__WEBPACK_IMPORTED_MODULE_12__); var Option = antd_es_select__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].Option; //https://github.com/codemirror/CodeMirror/issues/4838 var formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 20 } }; var LanguageDesc = { asp: ['ASP', 'vbscript'], actionscript: ['ActionScript(3.0)/Flash/Flex', 'clike'], bash: ['Bash/Bat', 'shell'], css: ['CSS', 'css'], c: ['C', 'clike'], cpp: ['C++', 'clike'], csharp: ['C#', 'clike'], coffeescript: ['CoffeeScript', 'coffeescript'], d: ['D', 'd'], dart: ['Dart', 'dart'], delphi: ['Delphi/Pascal', 'pascal'], erlang: ['Erlang', 'erlang'], go: ['Golang', 'go'], groovy: ['Groovy', 'groovy'], html: ['HTML', 'text/html'], java: ['Java', 'clike'], json: ['JSON', 'text/json'], javascript: ['Javascript', 'javascript'], lua: ['Lua', 'lua'], less: ['LESS', 'css'], markdown: ['Markdown', 'gfm'], 'objective-c': ['Objective-C', 'clike'], php: ['PHP', 'php'], perl: ['Perl', 'perl'], python: ['Python', 'python'], r: ['R', 'r'], rst: ['reStructedText', 'rst'], ruby: ['Ruby', 'ruby'], sql: ['SQL', 'sql'], sass: ['SASS/SCSS', 'sass'], shell: ['Shell', 'shell'], scala: ['Scala', 'clike'], swift: ['Swift', 'clike'], vb: ['VB/VBScript', 'vb'], xml: ['XML', 'text/xml'], yaml: ['YAML', 'yaml'] }; /* harmony default export */ __webpack_exports__["b"] = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; var _useState = Object(react__WEBPACK_IMPORTED_MODULE_9__["useState"])('python'), _useState2 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_useState, 2), mode = _useState2[0], setMode = _useState2[1]; function onSetMode(value) { setMode(LanguageDesc[value][1]); } function onSubmit(values) { callback(values); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])({}, formItemLayout, { className: "code-block-panel", initialValues: { language: 'python', content: '' }, onFinish: onSubmit }), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, { label: "\u4EE3\u7801\u8BED\u8A00", name: "language" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_select__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"], { onChange: onSetMode }, Object.keys(LanguageDesc).map(function (item) { return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(Option, { key: item, value: item }, LanguageDesc[item][0]); }))), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_form__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].Item, { label: "\u4EE3\u7801\u5185\u5BB9", name: "content", rules: [{ required: true, message: '请输入代码内容' }] }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(MyCodeMirror, { mode: mode })), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("div", { className: "flex-container flex-end" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(antd_es_button__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); function MyCodeMirror(_ref2) { var value = _ref2.value, onChange = _ref2.onChange, mode = _ref2.mode, _ref2$options = _ref2.options, options = _ref2$options === void 0 ? {} : _ref2$options; var el = Object(react__WEBPACK_IMPORTED_MODULE_9__["useRef"])(); var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_9__["useState"])(), _useState4 = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"])(_useState3, 2), cm = _useState4[0], setCm = _useState4[1]; Object(react__WEBPACK_IMPORTED_MODULE_9__["useEffect"])(function () { if (cm) { function onChangeHandler(cm) { var content = cm.getValue(); onChange && onChange(content); } cm.on('change', onChangeHandler); return function () { cm.off('change', onChangeHandler); }; } }, [cm, onChange]); Object(react__WEBPACK_IMPORTED_MODULE_9__["useEffect"])(function () { if (cm) { cm.setOption('mode', mode); } }, [cm, mode]); Object(react__WEBPACK_IMPORTED_MODULE_9__["useEffect"])(function () { if (cm) { if (value !== cm.getValue() || value === '') { setTimeout(function () { cm.setValue(value || ' '); }, 300); } } }, [cm, value]); Object(react__WEBPACK_IMPORTED_MODULE_9__["useEffect"])(function () { if (el.current && !cm) { var instance = codemirror__WEBPACK_IMPORTED_MODULE_10___default.a.fromTextArea(el.current, Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({ mode: mode, lineNumbers: true, lineWrapping: true, autoCloseBrackets: true, tabSize: 4, autofocus: true, autoCloseTags: true, matchBrackets: true, styleActiveLine: true }, options)); setCm(instance); } }, [el.current, cm]); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("div", { className: "my-codemirror-container" }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement("textarea", { ref: el })); } /***/ }), /***/ "7ixt": /*!**************************************************!*\ !*** ./node_modules/rc-tooltip/es/placements.js ***! \**************************************************/ /*! exports provided: placements, default */ /*! exports used: placements */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return placements; }); var autoAdjustOverflow = { adjustX: 1, adjustY: 1 }; var targetOffset = [0, 0]; var placements = { left: { points: ['cr', 'cl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset }, right: { points: ['cl', 'cr'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, top: { points: ['bc', 'tc'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, bottom: { points: ['tc', 'bc'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, topLeft: { points: ['bl', 'tl'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, leftTop: { points: ['tr', 'tl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset }, topRight: { points: ['br', 'tr'], overflow: autoAdjustOverflow, offset: [0, -4], targetOffset: targetOffset }, rightTop: { points: ['tl', 'tr'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, bottomRight: { points: ['tr', 'br'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, rightBottom: { points: ['bl', 'br'], overflow: autoAdjustOverflow, offset: [4, 0], targetOffset: targetOffset }, bottomLeft: { points: ['tl', 'bl'], overflow: autoAdjustOverflow, offset: [0, 4], targetOffset: targetOffset }, leftBottom: { points: ['br', 'bl'], overflow: autoAdjustOverflow, offset: [-4, 0], targetOffset: targetOffset } }; /* unused harmony default export */ var _unused_webpack_default_export = (placements); /***/ }), /***/ "8EBN": /*!**********************************************!*\ !*** ./node_modules/codemirror/mode/meta.js ***! \**********************************************/ /*! no static exports found */ /*! all exports used */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { "use strict"; CodeMirror.modeInfo = [ {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, {name: "PGP", mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["asc", "pgp", "sig"]}, {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]}, {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i}, {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]}, {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]}, {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]}, {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]}, {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/}, {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]}, {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]}, {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]}, {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]}, {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]}, {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]}, {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]}, {name: "Django", mime: "text/x-django", mode: "django"}, {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/}, {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"}, {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]}, {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]}, {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, {name: "Esper", mime: "text/x-esper", mode: "sql"}, {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]}, {name: "FCL", mime: "text/x-fcl", mode: "fcl"}, {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]}, {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history)\.md$/i}, {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/}, {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]}, {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]}, {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]}, {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]}, {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]}, {name: "HTTP", mime: "message/http", mode: "http"}, {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]}, {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]}, {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]}, {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]}, {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]}, {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]}, {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]}, {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]}, {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]}, {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]}, {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]}, {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, {name: "mIRC", mime: "text/mirc", mode: "mirc"}, {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]}, {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]}, {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]}, {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]}, {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"], mode: "ntriples", ext: ["nt", "nq"]}, {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m"], alias: ["objective-c", "objc"]}, {name: "Objective-C++", mime: "text/x-objectivec++", mode: "clike", ext: ["mm"], alias: ["objective-c++", "objc++"]}, {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]}, {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]}, {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, {name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]}, {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"}, {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]}, {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]}, {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]}, {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/}, {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]}, {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]}, {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"}, {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]}, {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]}, {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]}, {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]}, {name: "Shell", mimes: ["text/x-sh", "application/x-sh"], mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"], file: /^PKGBUILD$/}, {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]}, {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]}, {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, {name: "Solr", mime: "text/x-solr", mode: "solr"}, {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]}, {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]}, {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]}, {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]}, {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, {name: "SQLite", mime: "text/x-sqlite", mode: "sql"}, {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]}, {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]}, {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]}, {name: "sTeX", mime: "text/x-stex", mode: "stex"}, {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]}, {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]}, {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]}, {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]}, {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]}, {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]}, {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]}, {name: "Twig", mime: "text/x-twig", mode: "twig"}, {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]}, {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]}, {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]}, {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd", "svg"], alias: ["rss", "wsdl", "xsd"]}, {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]}, {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]}, {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]}, {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]}, {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]}, {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]}, {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]}, ]; // Ensure all modes have a mime property for backwards compatibility for (var i = 0; i < CodeMirror.modeInfo.length; i++) { var info = CodeMirror.modeInfo[i]; if (info.mimes) info.mime = info.mimes[0]; } CodeMirror.findModeByMIME = function(mime) { mime = mime.toLowerCase(); for (var i = 0; i < CodeMirror.modeInfo.length; i++) { var info = CodeMirror.modeInfo[i]; if (info.mime == mime) return info; if (info.mimes) for (var j = 0; j < info.mimes.length; j++) if (info.mimes[j] == mime) return info; } if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml") if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json") }; CodeMirror.findModeByExtension = function(ext) { ext = ext.toLowerCase(); for (var i = 0; i < CodeMirror.modeInfo.length; i++) { var info = CodeMirror.modeInfo[i]; if (info.ext) for (var j = 0; j < info.ext.length; j++) if (info.ext[j] == ext) return info; } }; CodeMirror.findModeByFileName = function(filename) { for (var i = 0; i < CodeMirror.modeInfo.length; i++) { var info = CodeMirror.modeInfo[i]; if (info.file && info.file.test(filename)) return info; } var dot = filename.lastIndexOf("."); var ext = dot > -1 && filename.substring(dot + 1, filename.length); if (ext) return CodeMirror.findModeByExtension(ext); }; CodeMirror.findModeByName = function(name) { name = name.toLowerCase(); for (var i = 0; i < CodeMirror.modeInfo.length; i++) { var info = CodeMirror.modeInfo[i]; if (info.name.toLowerCase() == name) return info; if (info.alias) for (var j = 0; j < info.alias.length; j++) if (info.alias[j].toLowerCase() == name) return info; } }; }); /***/ }), /***/ "9Bee": /*!*********************************************************!*\ !*** ./src/components/RenderHtml/index.tsx + 1 modules ***! \*********************************************************/ /*! exports provided: default */ /*! exports used: default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/PreviewAll/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/hls.js/dist/hls.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/katex/dist/katex.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/lib/marked.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/marked/src/helpers.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js var objectSpread2 = __webpack_require__("k1fw"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("tJVT"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_); // EXTERNAL MODULE: ./node_modules/katex/dist/katex.min.css var katex_min = __webpack_require__("vg9a"); // EXTERNAL MODULE: ./node_modules/marked/lib/marked.js var marked = __webpack_require__("DlQD"); var marked_default = /*#__PURE__*/__webpack_require__.n(marked); // EXTERNAL MODULE: ./node_modules/marked/src/helpers.js var helpers = __webpack_require__("rUJ1"); // CONCATENATED MODULE: ./src/utils/marked.ts function indentCodeCompensation(raw, text) { var matchIndentToCode = raw.match(/^(\s+)(?:```)/); if (matchIndentToCode === null) { return text; } var indentToCode = matchIndentToCode[1]; return text.split('\n').map(function (node) { var matchIndentInNode = node.match(/^\s+/); if (matchIndentInNode === null) { return node; } var _matchIndentInNode = Object(slicedToArray["a" /* default */])(matchIndentInNode, 1), indentInNode = _matchIndentInNode[0]; if (indentInNode.length >= indentToCode.length) { return node.slice(indentToCode.length); } return node; }).join('\n'); } //兼容之前的 ##标题式写法 var toc = []; var ctx = ["
' + (escaped ? code : Object(helpers["escape"])(code, true)) + '';
}
if (['latex', 'katex', 'math'].indexOf(lang) >= 0) {
return "".concat(code, "
"); } else { return "").concat(escaped ? code : Object(helpers["escape"])(code, true), "\n");
}
};
renderer.heading = function (text, level, raw) {
var anchor = this.options.headerPrefix + raw.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g, '-');
toc.push({
anchor: anchor,
level: level,
text: text
});
return ']*>/g;
function _unescape(str) {
var div = document.createElement('div');
div.innerHTML = str;
return div.childNodes.length === 0 ? '' : div.childNodes[0].nodeValue;
}
/* harmony default export */ var RenderHtml = __webpack_exports__["a"] = (function (_ref) {
var _ref$value = _ref.value,
value = _ref$value === void 0 ? '' : _ref$value,
className = _ref.className,
showTextOnly = _ref.showTextOnly,
showLines = _ref.showLines,
_ref$style = _ref.style,
style = _ref$style === void 0 ? {} : _ref$style,
_ref$stylesPrev = _ref.stylesPrev,
stylesPrev = _ref$stylesPrev === void 0 ? {} : _ref$stylesPrev;
var str = String(value);
var _useState = Object(external_window_React_["useState"])(""),
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
data = _useState2[0],
setData = _useState2[1];
var html = Object(external_window_React_["useMemo"])(function () {
try {
var reg = /\(\s+\/api\/attachments\/|\(\/api\/attachments\/|\(\/attachments\/download\//g;
var reg2 = /\"\/api\/attachments\/|\"\/attachments\/download\//g;
var reg3 = /\(\s+\/files\/uploads\/|\"\/files\/uploads\//g;
str = str.replace(reg, "(" + env["a" /* default */].API_SERVER + "/api/attachments/").replace(reg2, '"' + env["a" /* default */].API_SERVER + "/api/attachments/").replace(reg3, '"' + env["a" /* default */].API_SERVER + "/files/uploads/").replaceAll("http://video.educoder", "https://video.educoder").replaceAll("http://www.educoder.net/api", "https://data.educoder.net/api").replaceAll("https://www.educoder.net/api", "https://data.educoder.net/api").replace(/\r\n/g, "\n");
str = str.replace(new RegExp("(?[TOC]', getTocContent());
cleanToc();
}
rs = rs.replace(/(__special_katext_id_\d+__)/g, function (_match, capture) {
var _math_expressions$cap = math_expressions[capture],
type = _math_expressions$cap.type,
expression = _math_expressions$cap.expression;
return Object(katex["renderToString"])(_unescape(expression) || '', {
displayMode: type === 'block',
throwOnError: false,
output: 'html'
});
});
rs = rs.replace(/▁/g, '▁▁▁');
resetMathExpressions(); // return dompurify.sanitize(rs)
if (showTextOnly) {
var dom = document.createElement('div');
dom.innerHTML = rs;
return dom.innerText;
}
setTimeout(function () {
return onLoad();
}, 500);
return rs;
}, [str]);
var el = Object(external_window_React_["useRef"])();
lines['WebkitLineClamp'] = showLines;
if (showLines) {
style = Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({}, style), lines);
}
function onAncherHandler(e) {
var target = e.target;
if (target.tagName.toUpperCase() === 'A') {
var ancher = target.getAttribute('href');
if (ancher.indexOf("office") > -1) {
e.preventDefault();
setData(ancher);
} else if (ancher.startsWith('#')) {
e.preventDefault();
var viewEl = document.getElementById(ancher.replace('#', ''));
if (viewEl) {
viewEl.scrollIntoView(true);
}
}
}
}
var onLoad = function onLoad() {
var _el$current;
var videoElement = (_el$current = el.current) === null || _el$current === void 0 ? void 0 : _el$current.querySelectorAll('video');
videoElement === null || videoElement === void 0 ? void 0 : videoElement.forEach(function (item) {
item.oncontextmenu = function () {
return false;
};
if (item.src.indexOf('.m3u8') > -1) {
if (item.canPlayType('application/vnd.apple.mpegurl')) {} else if (hls_default.a.isSupported()) {
var hls = new hls_default.a();
hls.loadSource(item.src);
hls.attachMedia(item);
}
}
});
};
Object(external_window_React_["useEffect"])(function () {
if (el.current && html) {
if (html.match(preRegex)) {
window.PR.prettyPrint();
}
}
if (el.current) {
el.current.addEventListener('click', onAncherHandler);
return function () {
el.current.removeEventListener('click', onAncherHandler);
resetMathExpressions();
cleanToc();
};
}
}, [html, el.current, onAncherHandler]);
return /*#__PURE__*/external_window_React_default.a.createElement(external_window_React_default.a.Fragment, null, /*#__PURE__*/external_window_React_default.a.createElement("div", {
ref: el,
style: Object(objectSpread2["a" /* default */])({}, style),
className: "".concat(className ? className : '', " markdown-body "),
dangerouslySetInnerHTML: {
__html: html
}
}), /*#__PURE__*/external_window_React_default.a.createElement(PreviewAll["a" /* default */], {
close: true,
data: data,
type: !!(data !== null && data !== void 0 && data.length) ? "office" : "",
style: Object(objectSpread2["a" /* default */])({}, stylesPrev),
onClose: function onClose() {
return setData("");
}
}));
});
/***/ }),
/***/ "9VGf":
/*!****************************************!*\
!*** ./src/components/useInterval.tsx ***!
\****************************************/
/*! exports provided: default */
/*! exports used: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useInterval; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
function useInterval(callback, delay) {
var savedCallback = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(); // 保存新回调
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
savedCallback.current = callback;
}); // 建立 interval
Object(react__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(function () {
function tick() {
savedCallback.current();
}
if (delay !== null) {
var id = setInterval(tick, delay);
return function () {
return clearInterval(id);
};
}
}, [delay]);
}
/***/ }),
/***/ "9ivq":
/*!********************************************!*\
!*** ./src/pages/HttpStatus/hpccourse.css ***!
\********************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "Bd2K":
/*!********************************************************!*\
!*** ./node_modules/codemirror/addon/edit/closetag.js ***!
\********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/LICENSE
/**
* Tag-closer extension for CodeMirror.
*
* This extension adds an "autoCloseTags" option that can be set to
* either true to get the default behavior, or an object to further
* configure its behavior.
*
* These are supported options:
*
* `whenClosing` (default true)
* Whether to autoclose when the '/' of a closing tag is typed.
* `whenOpening` (default true)
* Whether to autoclose the tag when the final '>' of an opening
* tag is typed.
* `dontCloseTags` (default is empty tags for HTML, none for XML)
* An array of tag names that should not be autoclosed.
* `indentTags` (default is block tags for HTML, none for XML)
* An array of tag names that should, when opened, cause a
* blank line to be added inside the tag, and the blank line and
* closing line to be indented.
* `emptyTags` (default is none)
* An array of XML tag names that should be autoclosed with '/>'.
*
* See demos/closetag.html for a usage example.
*/
(function(mod) {
if (true) // CommonJS
mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/"), __webpack_require__(/*! ../fold/xml-fold */ "osHv"));
else {}
})(function(CodeMirror) {
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
if (old != CodeMirror.Init && old)
cm.removeKeyMap("autoCloseTags");
if (!val) return;
var map = {name: "autoCloseTags"};
if (typeof val != "object" || val.whenClosing !== false)
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
if (typeof val != "object" || val.whenOpening !== false)
map["'>'"] = function(cm) { return autoCloseGT(cm); };
cm.addKeyMap(map);
});
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
"source", "track", "wbr"];
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
function autoCloseGT(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), replacements = [];
var opt = cm.getOption("autoCloseTags");
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
var tagInfo = inner.mode.xmlCurrentTag && inner.mode.xmlCurrentTag(state)
var tagName = tagInfo && tagInfo.name
if (!tagName) return CodeMirror.Pass
var html = inner.mode.configuration == "html";
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
var lowerTagName = tagName.toLowerCase();
// Don't process the '>' at the end of an end-tag or self-closing tag
if (!tagName ||
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
tok.type == "tag" && tagInfo.close ||
tok.string.indexOf("/") == (pos.ch - tok.start - 1) || // match something like
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
return CodeMirror.Pass;
var emptyTags = typeof opt == "object" && opt.emptyTags;
if (emptyTags && indexOf(emptyTags, tagName) > -1) {
replacements[i] = { text: "/>", newPos: CodeMirror.Pos(pos.line, pos.ch + 2) };
continue;
}
var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
replacements[i] = {indent: indent,
text: ">" + (indent ? "\n\n" : "") + "" + tagName + ">",
newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
}
var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnAutoClose);
for (var i = ranges.length - 1; i >= 0; i--) {
var info = replacements[i];
cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
var sel = cm.listSelections().slice(0);
sel[i] = {head: info.newPos, anchor: info.newPos};
cm.setSelections(sel);
if (!dontIndentOnAutoClose && info.indent) {
cm.indentLine(info.newPos.line, null, true);
cm.indentLine(info.newPos.line + 1, null, true);
}
}
}
function autoCloseCurrent(cm, typingSlash) {
var ranges = cm.listSelections(), replacements = [];
var head = typingSlash ? "/" : "";
var opt = cm.getOption("autoCloseTags");
var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnSlash);
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var pos = ranges[i].head, tok = cm.getTokenAt(pos);
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||
tok.start != pos.ch - 1))
return CodeMirror.Pass;
// Kludge to get around the fact that we are not in XML mode
// when completing in JS/CSS snippet in htmlmixed mode. Does not
// work for other XML embedded languages (there is no general
// way to go from a mixed mode to its current XML state).
var replacement, mixed = inner.mode.name != "xml" && cm.getMode().name == "htmlmixed"
if (mixed && inner.mode.name == "javascript") {
replacement = head + "script";
} else if (mixed && inner.mode.name == "css") {
replacement = head + "style";
} else {
var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
if (!context || (context.length && closingTagExists(cm, context, context[context.length - 1], pos)))
return CodeMirror.Pass;
replacement = head + context[context.length - 1]
}
if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
replacements[i] = replacement;
}
cm.replaceSelections(replacements);
ranges = cm.listSelections();
if (!dontIndentOnAutoClose) {
for (var i = 0; i < ranges.length; i++)
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
cm.indentLine(ranges[i].head.line);
}
}
function autoCloseSlash(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
return autoCloseCurrent(cm, true);
}
CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };
function indexOf(collection, elt) {
if (collection.indexOf) return collection.indexOf(elt);
for (var i = 0, e = collection.length; i < e; ++i)
if (collection[i] == elt) return i;
return -1;
}
// If xml-fold is loaded, we use its functionality to try and verify
// whether a given tag is actually unclosed.
function closingTagExists(cm, context, tagName, pos, newTag) {
if (!CodeMirror.scanForClosingTag) return false;
var end = Math.min(cm.lastLine() + 1, pos.line + 500);
var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!nextClose || nextClose.tag != tagName) return false;
// If the immediate wrapping context contains onCx instances of
// the same tag, a closing tag only exists if there are at least
// that many closing tags of that type following.
var onCx = newTag ? 1 : 0
for (var i = context.length - 1; i >= 0; i--) {
if (context[i] == tagName) ++onCx
else break
}
pos = nextClose.to;
for (var i = 1; i < onCx; i++) {
var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
if (!next || next.tag != tagName) return false;
pos = next.to;
}
return true;
}
});
/***/ }),
/***/ "BjJ7":
/*!*********************************!*\
!*** ./src/pages/tasks/util.js ***!
\*********************************/
/*! exports provided: isCompileOk, getTreeData, processTreeData, debounce, isProd, apiPref */
/*! exports used: apiPref, debounce, getTreeData, isCompileOk, processTreeData */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return isCompileOk; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getTreeData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return processTreeData; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return debounce; });
/* unused harmony export isProd */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return apiPref; });
/* harmony import */ var _utils_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/env */ "m3rI");
function isCompileOk(rs) {
var flag = true;
if (rs.length > 0) {
for (var i = 0; i < rs.length; i++) {
if (rs[i].compile_success == 0 || !rs[i].compile_success) {
flag = false;
break;
}
}
} else {
flag = false;
}
return flag;
}
function getTreeData(data) {
var parentKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var result = [];
for (var i = 0; i < data.length; i++) {
var item = data[i];
var key = parentKey ? "".concat(parentKey, "/").concat(item.name) : "".concat(item.name);
result.push({
title: item.name,
isLeaf: item.type === 'tree' ? false : true,
key: key
});
}
return result;
}
function processTreeData(repos, key, newData) {
for (var i = 0; i < repos.length; i++) {
var item = repos[i];
if (item.key === key) {
item.children = newData;
break;
}
if (item.children) {
processTreeData(item.children, key, newData);
}
}
return repos;
}
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this,
args = arguments;
var later = function later() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
var isProd = true;
var apiPref = _utils_env__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"].API_SERVER; // export const isProd =
// window.location.href.indexOf('test-') > 0 ||
// window.location.href.indexOf('localhost') > 0
// ? false
// : true;
// export const apiPref = isProd
// ? 'https://www.educoder.net'
// : 'https://test-newweb.educoder.net';
/***/ }),
/***/ "C+DQ":
/*!*********************************************************!*\
!*** ./src/components/markdown-editor/css/iconfont.css ***!
\*********************************************************/
/*! no static exports found */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
// extracted by mini-css-extract-plugin
/***/ }),
/***/ "DlQD":
/*!*******************************************!*\
!*** ./node_modules/marked/lib/marked.js ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */
/***/ (function(module, exports, __webpack_require__) {
/**
* marked - a markdown parser
* Copyright (c) 2011-2020, Christopher Jeffrey. (MIT Licensed)
* https://github.com/markedjs/marked
*/
/**
* DO NOT EDIT THIS FILE
* The code in this file is generated from files in ./src/
*/
(function (global, factory) {
true ? module.exports = factory() :
undefined;
}(this, (function () { 'use strict';
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
var defaults = createCommonjsModule(function (module) {
function getDefaults() {
return {
baseUrl: null,
breaks: false,
gfm: true,
headerIds: true,
headerPrefix: '',
highlight: null,
langPrefix: 'language-',
mangle: true,
pedantic: false,
renderer: null,
sanitize: false,
sanitizer: null,
silent: false,
smartLists: false,
smartypants: false,
tokenizer: null,
walkTokens: null,
xhtml: false
};
}
function changeDefaults(newDefaults) {
module.exports.defaults = newDefaults;
}
module.exports = {
defaults: getDefaults(),
getDefaults: getDefaults,
changeDefaults: changeDefaults
};
});
var defaults_1 = defaults.defaults;
var defaults_2 = defaults.getDefaults;
var defaults_3 = defaults.changeDefaults;
/**
* Helpers
*/
var escapeTest = /[&<>"']/;
var escapeReplace = /[&<>"']/g;
var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
var escapeReplacements = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
var getEscapeReplacement = function getEscapeReplacement(ch) {
return escapeReplacements[ch];
};
function escape(html, encode) {
if (encode) {
if (escapeTest.test(html)) {
return html.replace(escapeReplace, getEscapeReplacement);
}
} else {
if (escapeTestNoEncode.test(html)) {
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
}
}
return html;
}
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
function unescape(html) {
// explicitly match decimal, hex, and named HTML entities
return html.replace(unescapeTest, function (_, n) {
n = n.toLowerCase();
if (n === 'colon') return ':';
if (n.charAt(0) === '#') {
return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
}
return '';
});
}
var caret = /(^|[^\[])\^/g;
function edit(regex, opt) {
regex = regex.source || regex;
opt = opt || '';
var obj = {
replace: function replace(name, val) {
val = val.source || val;
val = val.replace(caret, '$1');
regex = regex.replace(name, val);
return obj;
},
getRegex: function getRegex() {
return new RegExp(regex, opt);
}
};
return obj;
}
var nonWordAndColonTest = /[^\w:]/g;
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
function cleanUrl(sanitize, base, href) {
if (sanitize) {
var prot;
try {
prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
} catch (e) {
return null;
}
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
return null;
}
}
if (base && !originIndependentUrl.test(href)) {
href = resolveUrl(base, href);
}
try {
href = encodeURI(href).replace(/%25/g, '%');
} catch (e) {
return null;
}
return href;
}
var baseUrls = {};
var justDomain = /^[^:]+:\/*[^/]*$/;
var protocol = /^([^:]+:)[\s\S]*$/;
var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
function resolveUrl(base, href) {
if (!baseUrls[' ' + base]) {
// we can ignore everything in base after the last slash of its path component,
// but we might need to add _that_
// https://tools.ietf.org/html/rfc3986#section-3
if (justDomain.test(base)) {
baseUrls[' ' + base] = base + '/';
} else {
baseUrls[' ' + base] = rtrim(base, '/', true);
}
}
base = baseUrls[' ' + base];
var relativeBase = base.indexOf(':') === -1;
if (href.substring(0, 2) === '//') {
if (relativeBase) {
return href;
}
return base.replace(protocol, '$1') + href;
} else if (href.charAt(0) === '/') {
if (relativeBase) {
return href;
}
return base.replace(domain, '$1') + href;
} else {
return base + href;
}
}
var noopTest = {
exec: function noopTest() {}
};
function merge(obj) {
var i = 1,
target,
key;
for (; i < arguments.length; i++) {
target = arguments[i];
for (key in target) {
if (Object.prototype.hasOwnProperty.call(target, key)) {
obj[key] = target[key];
}
}
}
return obj;
}
function splitCells(tableRow, count) {
// ensure that every cell-delimiting pipe has a space
// before it to distinguish it from an escaped pipe
var row = tableRow.replace(/\|/g, function (match, offset, str) {
var escaped = false,
curr = offset;
while (--curr >= 0 && str[curr] === '\\') {
escaped = !escaped;
}
if (escaped) {
// odd number of slashes means | is escaped
// so we leave it alone
return '|';
} else {
// add space before unescaped |
return ' |';
}
}),
cells = row.split(/ \|/);
var i = 0;
if (cells.length > count) {
cells.splice(count);
} else {
while (cells.length < count) {
cells.push('');
}
}
for (; i < cells.length; i++) {
// leading or trailing whitespace is ignored per the gfm spec
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
}
return cells;
} // Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
// /c*$/ is vulnerable to REDOS.
// invert: Remove suffix of non-c chars instead. Default falsey.
function rtrim(str, c, invert) {
var l = str.length;
if (l === 0) {
return '';
} // Length of suffix matching the invert condition.
var suffLen = 0; // Step left until we fail to match the invert condition.
while (suffLen < l) {
var currChar = str.charAt(l - suffLen - 1);
if (currChar === c && !invert) {
suffLen++;
} else if (currChar !== c && invert) {
suffLen++;
} else {
break;
}
}
return str.substr(0, l - suffLen);
}
function findClosingBracket(str, b) {
if (str.indexOf(b[1]) === -1) {
return -1;
}
var l = str.length;
var level = 0,
i = 0;
for (; i < l; i++) {
if (str[i] === '\\') {
i++;
} else if (str[i] === b[0]) {
level++;
} else if (str[i] === b[1]) {
level--;
if (level < 0) {
return i;
}
}
}
return -1;
}
function checkSanitizeDeprecation(opt) {
if (opt && opt.sanitize && !opt.silent) {
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
}
}
var helpers = {
escape: escape,
unescape: unescape,
edit: edit,
cleanUrl: cleanUrl,
resolveUrl: resolveUrl,
noopTest: noopTest,
merge: merge,
splitCells: splitCells,
rtrim: rtrim,
findClosingBracket: findClosingBracket,
checkSanitizeDeprecation: checkSanitizeDeprecation
};
var defaults$1 = defaults.defaults;
var rtrim$1 = helpers.rtrim,
splitCells$1 = helpers.splitCells,
_escape = helpers.escape,
findClosingBracket$1 = helpers.findClosingBracket;
function outputLink(cap, link, raw) {
var href = link.href;
var title = link.title ? _escape(link.title) : null;
var text = cap[1].replace(/\\([\[\]])/g, '$1');
if (cap[0].charAt(0) !== '!') {
return {
type: 'link',
raw: raw,
href: href,
title: title,
text: text
};
} else {
return {
type: 'image',
raw: raw,
href: href,
title: title,
text: _escape(text)
};
}
}
function indentCodeCompensation(raw, text) {
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
if (matchIndentToCode === null) {
return text;
}
var indentToCode = matchIndentToCode[1];
return text.split('\n').map(function (node) {
var matchIndentInNode = node.match(/^\s+/);
if (matchIndentInNode === null) {
return node;
}
var indentInNode = matchIndentInNode[0];
if (indentInNode.length >= indentToCode.length) {
return node.slice(indentToCode.length);
}
return node;
}).join('\n');
}
/**
* Tokenizer
*/
var Tokenizer_1 = /*#__PURE__*/function () {
function Tokenizer(options) {
this.options = options || defaults$1;
}
var _proto = Tokenizer.prototype;
_proto.space = function space(src) {
var cap = this.rules.block.newline.exec(src);
if (cap) {
if (cap[0].length > 1) {
return {
type: 'space',
raw: cap[0]
};
}
return {
raw: '\n'
};
}
};
_proto.code = function code(src, tokens) {
var cap = this.rules.block.code.exec(src);
if (cap) {
var lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
if (lastToken && lastToken.type === 'paragraph') {
return {
raw: cap[0],
text: cap[0].trimRight()
};
}
var text = cap[0].replace(/^ {4}/gm, '');
return {
type: 'code',
raw: cap[0],
codeBlockStyle: 'indented',
text: !this.options.pedantic ? rtrim$1(text, '\n') : text
};
}
};
_proto.fences = function fences(src) {
var cap = this.rules.block.fences.exec(src);
if (cap) {
var raw = cap[0];
var text = indentCodeCompensation(raw, cap[3] || '');
return {
type: 'code',
raw: raw,
lang: cap[2] ? cap[2].trim() : cap[2],
text: text
};
}
};
_proto.heading = function heading(src) {
var cap = this.rules.block.heading.exec(src);
if (cap) {
return {
type: 'heading',
raw: cap[0],
depth: cap[1].length,
text: cap[2]
};
}
};
_proto.nptable = function nptable(src) {
var cap = this.rules.block.nptable.exec(src);
if (cap) {
var item = {
type: 'table',
header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
raw: cap[0]
};
if (item.header.length === item.align.length) {
var l = item.align.length;
var i;
for (i = 0; i < l; i++) {
if (/^ *-+: *$/.test(item.align[i])) {
item.align[i] = 'right';
} else if (/^ *:-+: *$/.test(item.align[i])) {
item.align[i] = 'center';
} else if (/^ *:-+ *$/.test(item.align[i])) {
item.align[i] = 'left';
} else {
item.align[i] = null;
}
}
l = item.cells.length;
for (i = 0; i < l; i++) {
item.cells[i] = splitCells$1(item.cells[i], item.header.length);
}
return item;
}
}
};
_proto.hr = function hr(src) {
var cap = this.rules.block.hr.exec(src);
if (cap) {
return {
type: 'hr',
raw: cap[0]
};
}
};
_proto.blockquote = function blockquote(src) {
var cap = this.rules.block.blockquote.exec(src);
if (cap) {
var text = cap[0].replace(/^ *> ?/gm, '');
return {
type: 'blockquote',
raw: cap[0],
text: text
};
}
};
_proto.list = function list(src) {
var cap = this.rules.block.list.exec(src);
if (cap) {
var raw = cap[0];
var bull = cap[2];
var isordered = bull.length > 1;
var isparen = bull[bull.length - 1] === ')';
var list = {
type: 'list',
raw: raw,
ordered: isordered,
start: isordered ? +bull.slice(0, -1) : '',
loose: false,
items: []
}; // Get each top-level item.
var itemMatch = cap[0].match(this.rules.block.item);
var next = false,
item,
space,
b,
addBack,
loose,
istask,
ischecked;
var l = itemMatch.length;
for (var i = 0; i < l; i++) {
item = itemMatch[i];
raw = item; // Remove the list item's bullet
// so it is seen as the next token.
space = item.length;
item = item.replace(/^ *([*+-]|\d+[.)]) */, ''); // Outdent whatever the
// list item contains. Hacky.
if (~item.indexOf('\n ')) {
space -= item.length;
item = !this.options.pedantic ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '') : item.replace(/^ {1,4}/gm, '');
} // Determine whether the next list item belongs here.
// Backpedal if it does not belong in this list.
if (i !== l - 1) {
b = this.rules.block.bullet.exec(itemMatch[i + 1])[0];
if (isordered ? b.length === 1 || !isparen && b[b.length - 1] === ')' : b.length > 1 || this.options.smartLists && b !== bull) {
addBack = itemMatch.slice(i + 1).join('\n');
list.raw = list.raw.substring(0, list.raw.length - addBack.length);
i = l - 1;
}
} // Determine whether item is loose or not.
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
// for discount behavior.
loose = next || /\n\n(?!\s*$)/.test(item);
if (i !== l - 1) {
next = item.charAt(item.length - 1) === '\n';
if (!loose) loose = next;
}
if (loose) {
list.loose = true;
} // Check for task list items
istask = /^\[[ xX]\] /.test(item);
ischecked = undefined;
if (istask) {
ischecked = item[1] !== ' ';
item = item.replace(/^\[[ xX]\] +/, '');
}
list.items.push({
type: 'list_item',
raw: raw,
task: istask,
checked: ischecked,
loose: loose,
text: item
});
}
return list;
}
};
_proto.html = function html(src) {
var cap = this.rules.block.html.exec(src);
if (cap) {
return {
type: this.options.sanitize ? 'paragraph' : 'html',
raw: cap[0],
pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
};
}
};
_proto.def = function def(src) {
var cap = this.rules.block.def.exec(src);
if (cap) {
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
return {
tag: tag,
raw: cap[0],
href: cap[2],
title: cap[3]
};
}
};
_proto.table = function table(src) {
var cap = this.rules.block.table.exec(src);
if (cap) {
var item = {
type: 'table',
header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
};
if (item.header.length === item.align.length) {
item.raw = cap[0];
var l = item.align.length;
var i;
for (i = 0; i < l; i++) {
if (/^ *-+: *$/.test(item.align[i])) {
item.align[i] = 'right';
} else if (/^ *:-+: *$/.test(item.align[i])) {
item.align[i] = 'center';
} else if (/^ *:-+ *$/.test(item.align[i])) {
item.align[i] = 'left';
} else {
item.align[i] = null;
}
}
l = item.cells.length;
for (i = 0; i < l; i++) {
item.cells[i] = splitCells$1(item.cells[i].replace(/^ *\| *| *\| *$/g, ''), item.header.length);
}
return item;
}
}
};
_proto.lheading = function lheading(src) {
var cap = this.rules.block.lheading.exec(src);
if (cap) {
return {
type: 'heading',
raw: cap[0],
depth: cap[2].charAt(0) === '=' ? 1 : 2,
text: cap[1]
};
}
};
_proto.paragraph = function paragraph(src) {
var cap = this.rules.block.paragraph.exec(src);
if (cap) {
return {
type: 'paragraph',
raw: cap[0],
text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1]
};
}
};
_proto.text = function text(src, tokens) {
var cap = this.rules.block.text.exec(src);
if (cap) {
var lastToken = tokens[tokens.length - 1];
if (lastToken && lastToken.type === 'text') {
return {
raw: cap[0],
text: cap[0]
};
}
return {
type: 'text',
raw: cap[0],
text: cap[0]
};
}
};
_proto.escape = function escape(src) {
var cap = this.rules.inline.escape.exec(src);
if (cap) {
return {
type: 'escape',
raw: cap[0],
text: _escape(cap[1])
};
}
};
_proto.tag = function tag(src, inLink, inRawBlock) {
var cap = this.rules.inline.tag.exec(src);
if (cap) {
if (!inLink && /^/i.test(cap[0])) {
inLink = false;
}
if (!inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
inRawBlock = true;
} else if (inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
inRawBlock = false;
}
return {
type: this.options.sanitize ? 'text' : 'html',
raw: cap[0],
inLink: inLink,
inRawBlock: inRawBlock,
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0]
};
}
};
_proto.link = function link(src) {
var cap = this.rules.inline.link.exec(src);
if (cap) {
var lastParenIndex = findClosingBracket$1(cap[2], '()');
if (lastParenIndex > -1) {
var start = cap[0].indexOf('!') === 0 ? 5 : 4;
var linkLen = start + cap[1].length + lastParenIndex;
cap[2] = cap[2].substring(0, lastParenIndex);
cap[0] = cap[0].substring(0, linkLen).trim();
cap[3] = '';
}
var href = cap[2];
var title = '';
if (this.options.pedantic) {
var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
if (link) {
href = link[1];
title = link[3];
} else {
title = '';
}
} else {
title = cap[3] ? cap[3].slice(1, -1) : '';
}
href = href.trim().replace(/^<([\s\S]*)>$/, '$1');
var token = outputLink(cap, {
href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
title: title ? title.replace(this.rules.inline._escapes, '$1') : title
}, cap[0]);
return token;
}
};
_proto.reflink = function reflink(src, links) {
var cap;
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
link = links[link.toLowerCase()];
if (!link || !link.href) {
var text = cap[0].charAt(0);
return {
type: 'text',
raw: text,
text: text
};
}
var token = outputLink(cap, link, cap[0]);
return token;
}
};
_proto.strong = function strong(src, maskedSrc, prevChar) {
if (prevChar === void 0) {
prevChar = '';
}
var match = this.rules.inline.strong.start.exec(src);
if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
maskedSrc = maskedSrc.slice(-1 * src.length);
var endReg = match[0] === '**' ? this.rules.inline.strong.endAst : this.rules.inline.strong.endUnd;
endReg.lastIndex = 0;
var cap;
while ((match = endReg.exec(maskedSrc)) != null) {
cap = this.rules.inline.strong.middle.exec(maskedSrc.slice(0, match.index + 3));
if (cap) {
return {
type: 'strong',
raw: src.slice(0, cap[0].length),
text: src.slice(2, cap[0].length - 2)
};
}
}
}
};
_proto.em = function em(src, maskedSrc, prevChar) {
if (prevChar === void 0) {
prevChar = '';
}
var match = this.rules.inline.em.start.exec(src);
if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
maskedSrc = maskedSrc.slice(-1 * src.length);
var endReg = match[0] === '*' ? this.rules.inline.em.endAst : this.rules.inline.em.endUnd;
endReg.lastIndex = 0;
var cap;
while ((match = endReg.exec(maskedSrc)) != null) {
cap = this.rules.inline.em.middle.exec(maskedSrc.slice(0, match.index + 2));
if (cap) {
return {
type: 'em',
raw: src.slice(0, cap[0].length),
text: src.slice(1, cap[0].length - 1)
};
}
}
}
};
_proto.codespan = function codespan(src) {
var cap = this.rules.inline.code.exec(src);
if (cap) {
var text = cap[2].replace(/\n/g, ' ');
var hasNonSpaceChars = /[^ ]/.test(text);
var hasSpaceCharsOnBothEnds = text.startsWith(' ') && text.endsWith(' ');
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
text = text.substring(1, text.length - 1);
}
text = _escape(text, true);
return {
type: 'codespan',
raw: cap[0],
text: text
};
}
};
_proto.br = function br(src) {
var cap = this.rules.inline.br.exec(src);
if (cap) {
return {
type: 'br',
raw: cap[0]
};
}
};
_proto.del = function del(src) {
var cap = this.rules.inline.del.exec(src);
if (cap) {
return {
type: 'del',
raw: cap[0],
text: cap[1]
};
}
};
_proto.autolink = function autolink(src, mangle) {
var cap = this.rules.inline.autolink.exec(src);
if (cap) {
var text, href;
if (cap[2] === '@') {
text = _escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
href = 'mailto:' + text;
} else {
text = _escape(cap[1]);
href = text;
}
return {
type: 'link',
raw: cap[0],
text: text,
href: href,
tokens: [{
type: 'text',
raw: text,
text: text
}]
};
}
};
_proto.url = function url(src, mangle) {
var cap;
if (cap = this.rules.inline.url.exec(src)) {
var text, href;
if (cap[2] === '@') {
text = _escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
href = 'mailto:' + text;
} else {
// do extended autolink path validation
var prevCapZero;
do {
prevCapZero = cap[0];
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
} while (prevCapZero !== cap[0]);
text = _escape(cap[0]);
if (cap[1] === 'www.') {
href = 'http://' + text;
} else {
href = text;
}
}
return {
type: 'link',
raw: cap[0],
text: text,
href: href,
tokens: [{
type: 'text',
raw: text,
text: text
}]
};
}
};
_proto.inlineText = function inlineText(src, inRawBlock, smartypants) {
var cap = this.rules.inline.text.exec(src);
if (cap) {
var text;
if (inRawBlock) {
text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0];
} else {
text = _escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
}
return {
type: 'text',
raw: cap[0],
text: text
};
}
};
return Tokenizer;
}();
var noopTest$1 = helpers.noopTest,
edit$1 = helpers.edit,
merge$1 = helpers.merge;
/**
* Block-Level Grammar
*/
var block = {
newline: /^\n+/,
code: /^( {4}[^\n]+\n*)+/,
fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
heading: /^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
list: /^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,
html: '^ {0,3}(?:' // optional indentation
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:\\1>[^\\n]*\\n+|$)' // (1)
+ '|comment[^\\n]*(\\n+|$)' // (2)
+ '|<\\?[\\s\\S]*?\\?>\\n*' // (3)
+ '|\\n*' // (4)
+ '|\\n*' // (5)
+ '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n{2,}|$)' // (6)
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) open tag
+ '|(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)' // (7) closing tag
+ ')',
def: /^ {0,3}\[(label)\]: *\n? *([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,
nptable: noopTest$1,
table: noopTest$1,
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
// regex template, placeholders will be replaced according to different paragraph
// interruption rules of commonmark and the original markdown spec:
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
text: /^[^\n]+/
};
block._label = /(?!\s*\])(?:\\[\[\]]|[^\[\]])+/;
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
block.def = edit$1(block.def).replace('label', block._label).replace('title', block._title).getRegex();
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
block.item = /^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/;
block.item = edit$1(block.item, 'gm').replace(/bull/g, block.bullet).getRegex();
block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
block._comment = //;
block.html = edit$1(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
block.paragraph = edit$1(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
.replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
.getRegex();
block.blockquote = edit$1(block.blockquote).replace('paragraph', block.paragraph).getRegex();
/**
* Normal Block Grammar
*/
block.normal = merge$1({}, block);
/**
* GFM Block Grammar
*/
block.gfm = merge$1({}, block.normal, {
nptable: '^ *([^|\\n ].*\\|.*)\\n' // Header
+ ' *([-:]+ *\\|[-| :]*)' // Align
+ '(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)',
// Cells
table: '^ *\\|(.+)\\n' // Header
+ ' *\\|?( *[-:]+[-| :]*)' // Align
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
});
block.gfm.nptable = edit$1(block.gfm.nptable).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
.replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
.getRegex();
block.gfm.table = edit$1(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
.replace('html', '?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
.getRegex();
/**
* Pedantic grammar (original John Gruber's loose markdown specification)
*/
block.pedantic = merge$1({}, block.normal, {
html: edit$1('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?\\1> *(?:\\n{2,}|\\s*$)' // closed tag
+ '| \\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
def: /^ *\[([^\]]+)\]: *([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
heading: /^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,
fences: noopTest$1,
// fences not supported
paragraph: edit$1(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
});
/**
* Inline-Level Grammar
*/
var inline = {
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
url: noopTest$1,
tag: '^comment' + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g.
+ '|^' // declaration, e.g.
+ '|^',
// CDATA section
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
reflink: /^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,
nolink: /^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,
reflinkSearch: 'reflink|nolink(?!\\()',
strong: {
start: /^(?:(\*\*(?=[*punctuation]))|\*\*)(?![\s])|__/,
// (1) returns if starts w/ punctuation
middle: /^\*\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*\*$|^__(?![\s])((?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?)__$/,
endAst: /[^punctuation\s]\*\*(?!\*)|[punctuation]\*\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
em: {
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
// (1) returns if starts w/ punctuation
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
// last char can't be punct, or final * must also be followed by punct (or endline)
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
},
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
br: /^( {2,}|\\)\n(?!\s*$)/,
del: noopTest$1,
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[\\]`^{|}~';
inline.punctuation = edit$1(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`,
inline._blockSkip = '\\[[^\\]]*?\\]\\([^\\)]*?\\)|`[^`]*?`|<[^>]*?>';
inline._overlapSkip = '__[^_]*?__|\\*\\*\\[^\\*\\]*?\\*\\*';
inline.em.start = edit$1(inline.em.start).replace(/punctuation/g, inline._punctuation).getRegex();
inline.em.middle = edit$1(inline.em.middle).replace(/punctuation/g, inline._punctuation).replace(/overlapSkip/g, inline._overlapSkip).getRegex();
inline.em.endAst = edit$1(inline.em.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
inline.em.endUnd = edit$1(inline.em.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
inline.strong.start = edit$1(inline.strong.start).replace(/punctuation/g, inline._punctuation).getRegex();
inline.strong.middle = edit$1(inline.strong.middle).replace(/punctuation/g, inline._punctuation).replace(/blockSkip/g, inline._blockSkip).getRegex();
inline.strong.endAst = edit$1(inline.strong.endAst, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
inline.strong.endUnd = edit$1(inline.strong.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
inline.blockSkip = edit$1(inline._blockSkip, 'g').getRegex();
inline.overlapSkip = edit$1(inline._overlapSkip, 'g').getRegex();
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[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])?)+(?![-_])/;
inline.autolink = edit$1(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
inline.tag = edit$1(inline.tag).replace('comment', block._comment).replace('attribute', inline._attribute).getRegex();
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
inline._href = /<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/;
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
inline.link = edit$1(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
inline.reflink = edit$1(inline.reflink).replace('label', inline._label).getRegex();
inline.reflinkSearch = edit$1(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
/**
* Normal Inline Grammar
*/
inline.normal = merge$1({}, inline);
/**
* Pedantic Inline Grammar
*/
inline.pedantic = merge$1({}, inline.normal, {
strong: {
start: /^__|\*\*/,
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
endAst: /\*\*(?!\*)/g,
endUnd: /__(?!_)/g
},
em: {
start: /^_|\*/,
middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
endAst: /\*(?!\*)/g,
endUnd: /_(?!_)/g
},
link: edit$1(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
reflink: edit$1(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
});
/**
* GFM Inline Grammar
*/
inline.gfm = merge$1({}, inline.normal, {
escape: edit$1(inline.escape).replace('])', '~|])').getRegex(),
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
del: /^~+(?=\S)([\s\S]*?\S)~+/,
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\ 0.5) {
ch = 'x' + ch.toString(16);
}
out += '' + ch + ';';
}
return out;
}
/**
* Block Lexer
*/
var Lexer_1 = /*#__PURE__*/function () {
function Lexer(options) {
this.tokens = [];
this.tokens.links = Object.create(null);
this.options = options || defaults$2;
this.options.tokenizer = this.options.tokenizer || new Tokenizer_1();
this.tokenizer = this.options.tokenizer;
this.tokenizer.options = this.options;
var rules = {
block: block$1.normal,
inline: inline$1.normal
};
if (this.options.pedantic) {
rules.block = block$1.pedantic;
rules.inline = inline$1.pedantic;
} else if (this.options.gfm) {
rules.block = block$1.gfm;
if (this.options.breaks) {
rules.inline = inline$1.breaks;
} else {
rules.inline = inline$1.gfm;
}
}
this.tokenizer.rules = rules;
}
/**
* Expose Rules
*/
/**
* Static Lex Method
*/
Lexer.lex = function lex(src, options) {
var lexer = new Lexer(options);
return lexer.lex(src);
}
/**
* Preprocessing
*/
;
var _proto = Lexer.prototype;
_proto.lex = function lex(src) {
src = src.replace(/\r\n|\r/g, '\n').replace(/\t/g, ' ');
this.blockTokens(src, this.tokens, true);
this.inline(this.tokens);
return this.tokens;
}
/**
* Lexing
*/
;
_proto.blockTokens = function blockTokens(src, tokens, top) {
if (tokens === void 0) {
tokens = [];
}
if (top === void 0) {
top = true;
}
src = src.replace(/^ +$/gm, '');
var token, i, l, lastToken;
while (src) {
// newline
if (token = this.tokenizer.space(src)) {
src = src.substring(token.raw.length);
if (token.type) {
tokens.push(token);
}
continue;
} // code
if (token = this.tokenizer.code(src, tokens)) {
src = src.substring(token.raw.length);
if (token.type) {
tokens.push(token);
} else {
lastToken = tokens[tokens.length - 1];
lastToken.raw += '\n' + token.raw;
lastToken.text += '\n' + token.text;
}
continue;
} // fences
if (token = this.tokenizer.fences(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // heading
if (token = this.tokenizer.heading(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // table no leading pipe (gfm)
if (token = this.tokenizer.nptable(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // hr
if (token = this.tokenizer.hr(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // blockquote
if (token = this.tokenizer.blockquote(src)) {
src = src.substring(token.raw.length);
token.tokens = this.blockTokens(token.text, [], top);
tokens.push(token);
continue;
} // list
if (token = this.tokenizer.list(src)) {
src = src.substring(token.raw.length);
l = token.items.length;
for (i = 0; i < l; i++) {
token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
}
tokens.push(token);
continue;
} // html
if (token = this.tokenizer.html(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // def
if (top && (token = this.tokenizer.def(src))) {
src = src.substring(token.raw.length);
if (!this.tokens.links[token.tag]) {
this.tokens.links[token.tag] = {
href: token.href,
title: token.title
};
}
continue;
} // table (gfm)
if (token = this.tokenizer.table(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // lheading
if (token = this.tokenizer.lheading(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // top-level paragraph
if (top && (token = this.tokenizer.paragraph(src))) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // text
if (token = this.tokenizer.text(src, tokens)) {
src = src.substring(token.raw.length);
if (token.type) {
tokens.push(token);
} else {
lastToken = tokens[tokens.length - 1];
lastToken.raw += '\n' + token.raw;
lastToken.text += '\n' + token.text;
}
continue;
}
if (src) {
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
if (this.options.silent) {
console.error(errMsg);
break;
} else {
throw new Error(errMsg);
}
}
}
return tokens;
};
_proto.inline = function inline(tokens) {
var i, j, k, l2, row, token;
var l = tokens.length;
for (i = 0; i < l; i++) {
token = tokens[i];
switch (token.type) {
case 'paragraph':
case 'text':
case 'heading':
{
token.tokens = [];
this.inlineTokens(token.text, token.tokens);
break;
}
case 'table':
{
token.tokens = {
header: [],
cells: []
}; // header
l2 = token.header.length;
for (j = 0; j < l2; j++) {
token.tokens.header[j] = [];
this.inlineTokens(token.header[j], token.tokens.header[j]);
} // cells
l2 = token.cells.length;
for (j = 0; j < l2; j++) {
row = token.cells[j];
token.tokens.cells[j] = [];
for (k = 0; k < row.length; k++) {
token.tokens.cells[j][k] = [];
this.inlineTokens(row[k], token.tokens.cells[j][k]);
}
}
break;
}
case 'blockquote':
{
this.inline(token.tokens);
break;
}
case 'list':
{
l2 = token.items.length;
for (j = 0; j < l2; j++) {
this.inline(token.items[j].tokens);
}
break;
}
}
}
return tokens;
}
/**
* Lexing/Compiling
*/
;
_proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock, prevChar) {
if (tokens === void 0) {
tokens = [];
}
if (inLink === void 0) {
inLink = false;
}
if (inRawBlock === void 0) {
inRawBlock = false;
}
if (prevChar === void 0) {
prevChar = '';
}
var token; // String with links masked to avoid interference with em and strong
var maskedSrc = src;
var match; // Mask out reflinks
if (this.tokens.links) {
var links = Object.keys(this.tokens.links);
if (links.length > 0) {
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
}
}
}
} // Mask out other blocks
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
}
while (src) {
// escape
if (token = this.tokenizer.escape(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // tag
if (token = this.tokenizer.tag(src, inLink, inRawBlock)) {
src = src.substring(token.raw.length);
inLink = token.inLink;
inRawBlock = token.inRawBlock;
tokens.push(token);
continue;
} // link
if (token = this.tokenizer.link(src)) {
src = src.substring(token.raw.length);
if (token.type === 'link') {
token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
}
tokens.push(token);
continue;
} // reflink, nolink
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
src = src.substring(token.raw.length);
if (token.type === 'link') {
token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
}
tokens.push(token);
continue;
} // strong
if (token = this.tokenizer.strong(src, maskedSrc, prevChar)) {
src = src.substring(token.raw.length);
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
tokens.push(token);
continue;
} // em
if (token = this.tokenizer.em(src, maskedSrc, prevChar)) {
src = src.substring(token.raw.length);
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
tokens.push(token);
continue;
} // code
if (token = this.tokenizer.codespan(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // br
if (token = this.tokenizer.br(src)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // del (gfm)
if (token = this.tokenizer.del(src)) {
src = src.substring(token.raw.length);
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
tokens.push(token);
continue;
} // autolink
if (token = this.tokenizer.autolink(src, mangle)) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // url (gfm)
if (!inLink && (token = this.tokenizer.url(src, mangle))) {
src = src.substring(token.raw.length);
tokens.push(token);
continue;
} // text
if (token = this.tokenizer.inlineText(src, inRawBlock, smartypants)) {
src = src.substring(token.raw.length);
prevChar = token.raw.slice(-1);
tokens.push(token);
continue;
}
if (src) {
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
if (this.options.silent) {
console.error(errMsg);
break;
} else {
throw new Error(errMsg);
}
}
}
return tokens;
};
_createClass(Lexer, null, [{
key: "rules",
get: function get() {
return {
block: block$1,
inline: inline$1
};
}
}]);
return Lexer;
}();
var defaults$3 = defaults.defaults;
var cleanUrl$1 = helpers.cleanUrl,
escape$1 = helpers.escape;
/**
* Renderer
*/
var Renderer_1 = /*#__PURE__*/function () {
function Renderer(options) {
this.options = options || defaults$3;
}
var _proto = Renderer.prototype;
_proto.code = function code(_code, infostring, escaped) {
var lang = (infostring || '').match(/\S*/)[0];
if (this.options.highlight) {
var out = this.options.highlight(_code, lang);
if (out != null && out !== _code) {
escaped = true;
_code = out;
}
}
if (!lang) {
return '' + (escaped ? _code : escape$1(_code, true)) + '
\n';
}
return '' + (escaped ? _code : escape$1(_code, true)) + '
\n';
};
_proto.blockquote = function blockquote(quote) {
return '\n' + quote + '
\n';
};
_proto.html = function html(_html) {
return _html;
};
_proto.heading = function heading(text, level, raw, slugger) {
if (this.options.headerIds) {
return '' + text + ' \n';
} // ignore IDs
return '' + text + ' \n';
};
_proto.hr = function hr() {
return this.options.xhtml ? '
\n' : '
\n';
};
_proto.list = function list(body, ordered, start) {
var type = ordered ? 'ol' : 'ul',
startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
return '<' + type + startatt + '>\n' + body + '' + type + '>\n';
};
_proto.listitem = function listitem(text) {
return '' + text + ' \n';
};
_proto.checkbox = function checkbox(checked) {
return ' ';
};
_proto.paragraph = function paragraph(text) {
return '' + text + '
\n';
};
_proto.table = function table(header, body) {
if (body) body = '' + body + '';
return '' + text + '';
};
_proto.br = function br() {
return this.options.xhtml ? 'An error occurred:
' + escape$2(e.message + '', true) + ''; } throw e; } } /** * Options */ marked.options = marked.setOptions = function (opt) { merge$2(marked.defaults, opt); changeDefaults(marked.defaults); return marked; }; marked.getDefaults = getDefaults; marked.defaults = defaults$5; /** * Use Extension */ marked.use = function (extension) { var opts = merge$2({}, extension); if (extension.renderer) { (function () { var renderer = marked.defaults.renderer || new Renderer_1(); var _loop = function _loop(prop) { var prevRenderer = renderer[prop]; renderer[prop] = function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } var ret = extension.renderer[prop].apply(renderer, args); if (ret === false) { ret = prevRenderer.apply(renderer, args); } return ret; }; }; for (var prop in extension.renderer) { _loop(prop); } opts.renderer = renderer; })(); } if (extension.tokenizer) { (function () { var tokenizer = marked.defaults.tokenizer || new Tokenizer_1(); var _loop2 = function _loop2(prop) { var prevTokenizer = tokenizer[prop]; tokenizer[prop] = function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } var ret = extension.tokenizer[prop].apply(tokenizer, args); if (ret === false) { ret = prevTokenizer.apply(tokenizer, args); } return ret; }; }; for (var prop in extension.tokenizer) { _loop2(prop); } opts.tokenizer = tokenizer; })(); } if (extension.walkTokens) { var walkTokens = marked.defaults.walkTokens; opts.walkTokens = function (token) { extension.walkTokens(token); if (walkTokens) { walkTokens(token); } }; } marked.setOptions(opts); }; /** * Run callback for every token */ marked.walkTokens = function (tokens, callback) { for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) { var token = _step.value; callback(token); switch (token.type) { case 'table': { for (var _iterator2 = _createForOfIteratorHelperLoose(token.tokens.header), _step2; !(_step2 = _iterator2()).done;) { var cell = _step2.value; marked.walkTokens(cell, callback); } for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) { var row = _step3.value; for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) { var _cell = _step4.value; marked.walkTokens(_cell, callback); } } break; } case 'list': { marked.walkTokens(token.items, callback); break; } default: { if (token.tokens) { marked.walkTokens(token.tokens, callback); } } } } }; /** * Expose */ marked.Parser = Parser_1; marked.parser = Parser_1.parse; marked.Renderer = Renderer_1; marked.TextRenderer = TextRenderer_1; marked.Lexer = Lexer_1; marked.lexer = Lexer_1.lex; marked.Tokenizer = Tokenizer_1; marked.Slugger = Slugger_1; marked.parse = marked; var marked_1 = marked; return marked_1; }))); /***/ }), /***/ "ELLl": /*!*************************************************************!*\ !*** ./node_modules/codemirror/addon/edit/closebrackets.js ***! \*************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: https://codemirror.net/LICENSE (function(mod) { if (true) // CommonJS mod(__webpack_require__(/*! ../../lib/codemirror */ "VrN/")); else {} })(function(CodeMirror) { var defaults = { pairs: "()[]{}''\"\"", closeBefore: ")]}'\":;>", triples: "", explode: "[]{}" }; var Pos = CodeMirror.Pos; CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { if (old && old != CodeMirror.Init) { cm.removeKeyMap(keyMap); cm.state.closeBrackets = null; } if (val) { ensureBound(getOption(val, "pairs")) cm.state.closeBrackets = val; cm.addKeyMap(keyMap); } }); function getOption(conf, name) { if (name == "pairs" && typeof conf == "string") return conf; if (typeof conf == "object" && conf[name] != null) return conf[name]; return defaults[name]; } var keyMap = {Backspace: handleBackspace, Enter: handleEnter}; function ensureBound(chars) { for (var i = 0; i < chars.length; i++) { var ch = chars.charAt(i), key = "'" + ch + "'" if (!keyMap[key]) keyMap[key] = handler(ch) } } ensureBound(defaults.pairs + "`") function handler(ch) { return function(cm) { return handleChar(cm, ch); }; } function getConfig(cm) { var deflt = cm.state.closeBrackets; if (!deflt || deflt.override) return deflt; var mode = cm.getModeAt(cm.getCursor()); return mode.closeBrackets || deflt; } function handleBackspace(cm) { var conf = getConfig(cm); if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; var pairs = getOption(conf, "pairs"); var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) return CodeMirror.Pass; var around = charsAround(cm, ranges[i].head); if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; } for (var i = ranges.length - 1; i >= 0; i--) { var cur = ranges[i].head; cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete"); } } function handleEnter(cm) { var conf = getConfig(cm); var explode = conf && getOption(conf, "explode"); if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass; var ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { if (!ranges[i].empty()) return CodeMirror.Pass; var around = charsAround(cm, ranges[i].head); if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass; } cm.operation(function() { var linesep = cm.lineSeparator() || "\n"; cm.replaceSelection(linesep + linesep, null); cm.execCommand("goCharLeft"); ranges = cm.listSelections(); for (var i = 0; i < ranges.length; i++) { var line = ranges[i].head.line; cm.indentLine(line, null, true); cm.indentLine(line + 1, null, true); } }); } function contractSelection(sel) { var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0; return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)), head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))}; } function handleChar(cm, ch) { var conf = getConfig(cm); if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass; var pairs = getOption(conf, "pairs"); var pos = pairs.indexOf(ch); if (pos == -1) return CodeMirror.Pass; var closeBefore = getOption(conf,"closeBefore"); var triples = getOption(conf, "triples"); var identical = pairs.charAt(pos + 1) == ch; var ranges = cm.listSelections(); var opening = pos % 2 == 0; var type; for (var i = 0; i < ranges.length; i++) { var range = ranges[i], cur = range.head, curType; var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); if (opening && !range.empty()) { curType = "surround"; } else if ((identical || !opening) && next == ch) { if (identical && stringStartsAfter(cm, cur)) curType = "both"; else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch) curType = "skipThree"; else curType = "skip"; } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 && cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) { if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass; curType = "addFour"; } else if (identical) { var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur) if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both"; else return CodeMirror.Pass; } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) { curType = "both"; } else { return CodeMirror.Pass; } if (!type) type = curType; else if (type != curType) return CodeMirror.Pass; } var left = pos % 2 ? pairs.charAt(pos - 1) : ch; var right = pos % 2 ? ch : pairs.charAt(pos + 1); cm.operation(function() { if (type == "skip") { cm.execCommand("goCharRight"); } else if (type == "skipThree") { for (var i = 0; i < 3; i++) cm.execCommand("goCharRight"); } else if (type == "surround") { var sels = cm.getSelections(); for (var i = 0; i < sels.length; i++) sels[i] = left + sels[i] + right; cm.replaceSelections(sels, "around"); sels = cm.listSelections().slice(); for (var i = 0; i < sels.length; i++) sels[i] = contractSelection(sels[i]); cm.setSelections(sels); } else if (type == "both") { cm.replaceSelection(left + right, null); cm.triggerElectric(left + right); cm.execCommand("goCharLeft"); } else if (type == "addFour") { cm.replaceSelection(left + left + left + left, "before"); cm.execCommand("goCharRight"); } }); } function charsAround(cm, pos) { var str = cm.getRange(Pos(pos.line, pos.ch - 1), Pos(pos.line, pos.ch + 1)); return str.length == 2 ? str : null; } function stringStartsAfter(cm, pos) { var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1)) return /\bstring/.test(token.type) && token.start == pos.ch && (pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos))) } }); /***/ }), /***/ "GfqC": /*!********************************************************!*\ !*** ./node_modules/rc-upload/es/index.js + 6 modules ***! \********************************************************/ /*! exports provided: default */ /*! exports used: default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // CONCATENATED MODULE: ./node_modules/rc-upload/es/request.js function getError(option, xhr) { var msg = 'cannot ' + option.method + ' ' + option.action + ' ' + xhr.status + '\''; var err = new Error(msg); err.status = xhr.status; err.method = option.method; err.url = option.action; return err; } function getBody(xhr) { var text = xhr.responseText || xhr.response; if (!text) { return text; } try { return JSON.parse(text); } catch (e) { return text; } } // option { // onProgress: (event: { percent: number }): void, // onError: (event: Error, body?: Object): void, // onSuccess: (body: Object): void, // data: Object, // filename: String, // file: File, // withCredentials: Boolean, // action: String, // headers: Object, // } function upload(option) { // eslint-disable-next-line no-undef var xhr = new XMLHttpRequest(); if (option.onProgress && xhr.upload) { xhr.upload.onprogress = function progress(e) { if (e.total > 0) { e.percent = e.loaded / e.total * 100; } option.onProgress(e); }; } // eslint-disable-next-line no-undef var formData = new FormData(); if (option.data) { Object.keys(option.data).forEach(function (key) { var value = option.data[key]; // support key-value array data if (Array.isArray(value)) { value.forEach(function (item) { // { list: [ 11, 22 ] } // formData.append('list[]', 11); formData.append(key + '[]', item); }); return; } formData.append(key, option.data[key]); }); } // eslint-disable-next-line no-undef if (option.file instanceof Blob) { formData.append(option.filename, option.file, option.file.name); } else { formData.append(option.filename, option.file); } xhr.onerror = function error(e) { option.onError(e); }; xhr.onload = function onload() { // allow success when 2xx status // see https://github.com/react-component/upload/issues/34 if (xhr.status < 200 || xhr.status >= 300) { return option.onError(getError(option, xhr), getBody(xhr)); } return option.onSuccess(getBody(xhr), xhr); }; xhr.open(option.method, option.action, true); // Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179 if (option.withCredentials && 'withCredentials' in xhr) { xhr.withCredentials = true; } var headers = option.headers || {}; // when set headers['X-Requested-With'] = null , can close default XHR header // see https://github.com/react-component/upload/issues/33 if (headers['X-Requested-With'] !== null) { xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); } Object.keys(headers).forEach(function (h) { if (headers[h] !== null) { xhr.setRequestHeader(h, headers[h]); } }); xhr.send(formData); return { abort: function abort() { xhr.abort(); } }; } // CONCATENATED MODULE: ./node_modules/rc-upload/es/uid.js var now = +new Date(); var index = 0; function uid_uid() { return "rc-upload-" + now + "-" + ++index; } // CONCATENATED MODULE: ./node_modules/rc-upload/es/attr-accept.js function endsWith(str, suffix) { return str.indexOf(suffix, str.length - suffix.length) !== -1; } /* harmony default export */ var attr_accept = (function (file, acceptedFiles) { if (file && acceptedFiles) { var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(','); var fileName = file.name || ''; var mimeType = file.type || ''; var baseMimeType = mimeType.replace(/\/.*$/, ''); return acceptedFilesArray.some(function (type) { var validType = type.trim(); if (validType.charAt(0) === '.') { return endsWith(fileName.toLowerCase(), validType.toLowerCase()); } else if (/\/\*$/.test(validType)) { // This is something like a image/* mime type return baseMimeType === validType.replace(/\/.*$/, ''); } return mimeType === validType; }); } return true; }); // CONCATENATED MODULE: ./node_modules/rc-upload/es/traverseFileTree.js function loopFiles(item, callback) { var dirReader = item.createReader(); var fileList = []; function sequence() { dirReader.readEntries(function (entries) { var entryList = Array.prototype.slice.apply(entries); fileList = fileList.concat(entryList); // Check if all the file has been viewed var isFinished = !entryList.length; if (isFinished) { callback(fileList); } else { sequence(); } }); } sequence(); } var traverseFileTree = function traverseFileTree(files, callback, isAccepted) { var _traverseFileTree = function _traverseFileTree(item, path) { path = path || ''; if (item.isFile) { item.file(function (file) { if (isAccepted(file)) { // https://github.com/ant-design/ant-design/issues/16426 if (item.fullPath && !file.webkitRelativePath) { Object.defineProperties(file, { webkitRelativePath: { writable: true } }); file.webkitRelativePath = item.fullPath.replace(/^\//, ''); Object.defineProperties(file, { webkitRelativePath: { writable: false } }); } callback([file]); } }); } else if (item.isDirectory) { loopFiles(item, function (entries) { entries.forEach(function (entryItem) { _traverseFileTree(entryItem, '' + path + item.name + '/'); }); }); } }; files.forEach(function (file) { _traverseFileTree(file.webkitGetAsEntry()); }); }; /* harmony default export */ var es_traverseFileTree = (traverseFileTree); // CONCATENATED MODULE: ./node_modules/rc-upload/es/AjaxUploader.js var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint react/no-is-mounted:0,react/sort-comp:0,react/prop-types:0 */ var dataOrAriaAttributeProps = function dataOrAriaAttributeProps(props) { return Object.keys(props).reduce(function (acc, key) { if (key.substr(0, 5) === 'data-' || key.substr(0, 5) === 'aria-' || key === 'role') { acc[key] = props[key]; } return acc; }, {}); }; var AjaxUploader_AjaxUploader = function (_Component) { _inherits(AjaxUploader, _Component); function AjaxUploader() { var _ref; var _temp, _this, _ret; _classCallCheck(this, AjaxUploader); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = AjaxUploader.__proto__ || Object.getPrototypeOf(AjaxUploader)).call.apply(_ref, [this].concat(args))), _this), _this.state = { uid: uid_uid() }, _this.reqs = {}, _this.onChange = function (e) { var files = e.target.files; _this.uploadFiles(files); _this.reset(); }, _this.onClick = function (e) { var el = _this.fileInput; if (!el) { return; } var _this$props = _this.props, children = _this$props.children, onClick = _this$props.onClick; if (children && children.type === 'button') { el.parentNode.focus(); el.parentNode.querySelector('button').blur(); } el.click(); if (onClick) { onClick(e); } }, _this.onKeyDown = function (e) { if (e.key === 'Enter') { _this.onClick(); } }, _this.onFileDrop = function (e) { var multiple = _this.props.multiple; e.preventDefault(); if (e.type === 'dragover') { return; } if (_this.props.directory) { es_traverseFileTree(Array.prototype.slice.call(e.dataTransfer.items), _this.uploadFiles, function (_file) { return attr_accept(_file, _this.props.accept); }); } else { var files = Array.prototype.slice.call(e.dataTransfer.files).filter(function (file) { return attr_accept(file, _this.props.accept); }); if (multiple === false) { files = files.slice(0, 1); } _this.uploadFiles(files); } }, _this.uploadFiles = function (files) { var postFiles = Array.prototype.slice.call(files); postFiles.map(function (file) { file.uid = uid_uid(); return file; }).forEach(function (file) { _this.upload(file, postFiles); }); }, _this.saveFileInput = function (node) { _this.fileInput = node; }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(AjaxUploader, [{ key: 'componentDidMount', value: function componentDidMount() { this._isMounted = true; } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this._isMounted = false; this.abort(); } }, { key: 'upload', value: function upload(file, fileList) { var _this2 = this; var props = this.props; if (!props.beforeUpload) { // always async in case use react state to keep fileList return setTimeout(function () { return _this2.post(file); }, 0); } var before = props.beforeUpload(file, fileList); if (before && before.then) { before.then(function (processedFile) { var processedFileType = Object.prototype.toString.call(processedFile); if (processedFileType === '[object File]' || processedFileType === '[object Blob]') { return _this2.post(processedFile); } return _this2.post(file); })['catch'](function (e) { // eslint-disable-next-line no-console console.log(e); }); } else if (before !== false) { setTimeout(function () { return _this2.post(file); }, 0); } return undefined; } }, { key: 'post', value: function post(file) { var _this3 = this; if (!this._isMounted) { return; } var props = this.props; var onStart = props.onStart, onProgress = props.onProgress, _props$transformFile = props.transformFile, transformFile = _props$transformFile === undefined ? function (originFile) { return originFile; } : _props$transformFile; new Promise(function (resolve) { var action = props.action; if (typeof action === 'function') { action = action(file); } return resolve(action); }).then(function (action) { var uid = file.uid; var request = props.customRequest || upload; var transform = Promise.resolve(transformFile(file)).then(function (transformedFile) { var data = props.data; if (typeof data === 'function') { data = data(transformedFile); } return Promise.all([transformedFile, data]); })['catch'](function (e) { console.error(e); // eslint-disable-line no-console }); transform.then(function (_ref2) { var _ref3 = _slicedToArray(_ref2, 2), transformedFile = _ref3[0], data = _ref3[1]; var requestOption = { action: action, filename: props.name, data: data, file: transformedFile, headers: props.headers, withCredentials: props.withCredentials, method: props.method || 'post', onProgress: onProgress ? function (e) { onProgress(e, file); } : null, onSuccess: function onSuccess(ret, xhr) { delete _this3.reqs[uid]; props.onSuccess(ret, file, xhr); }, onError: function onError(err, ret) { delete _this3.reqs[uid]; props.onError(err, ret, file); } }; onStart(file); _this3.reqs[uid] = request(requestOption); }); }); } }, { key: 'reset', value: function reset() { this.setState({ uid: uid_uid() }); } }, { key: 'abort', value: function abort(file) { var reqs = this.reqs; if (file) { var uid = file; if (file && file.uid) { uid = file.uid; } if (reqs[uid] && reqs[uid].abort) { reqs[uid].abort(); } delete reqs[uid]; } else { Object.keys(reqs).forEach(function (uid) { if (reqs[uid] && reqs[uid].abort) { reqs[uid].abort(); } delete reqs[uid]; }); } } }, { key: 'render', value: function render() { var _classNames; var _props = this.props, Tag = _props.component, prefixCls = _props.prefixCls, className = _props.className, disabled = _props.disabled, id = _props.id, style = _props.style, multiple = _props.multiple, accept = _props.accept, children = _props.children, directory = _props.directory, openFileDialogOnClick = _props.openFileDialogOnClick, onMouseEnter = _props.onMouseEnter, onMouseLeave = _props.onMouseLeave, otherProps = _objectWithoutProperties(_props, ['component', 'prefixCls', 'className', 'disabled', 'id', 'style', 'multiple', 'accept', 'children', 'directory', 'openFileDialogOnClick', 'onMouseEnter', 'onMouseLeave']); var cls = classnames_default()((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, prefixCls + '-disabled', disabled), _defineProperty(_classNames, className, className), _classNames)); var events = disabled ? {} : { onClick: openFileDialogOnClick ? this.onClick : function () {}, onKeyDown: openFileDialogOnClick ? this.onKeyDown : function () {}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onDrop: this.onFileDrop, onDragOver: this.onFileDrop, tabIndex: '0' }; return external_window_React_default.a.createElement( Tag, _extends({}, events, { className: cls, role: 'button', style: style }), external_window_React_default.a.createElement('input', _extends({}, dataOrAriaAttributeProps(otherProps), { id: id, type: 'file', ref: this.saveFileInput, onClick: function onClick(e) { return e.stopPropagation(); } // https://github.com/ant-design/ant-design/issues/19948 , key: this.state.uid, style: { display: 'none' }, accept: accept, directory: directory ? 'directory' : null, webkitdirectory: directory ? 'webkitdirectory' : null, multiple: multiple, onChange: this.onChange })), children ); } }]); return AjaxUploader; }(external_window_React_["Component"]); /* harmony default export */ var es_AjaxUploader = (AjaxUploader_AjaxUploader); // CONCATENATED MODULE: ./node_modules/rc-upload/es/Upload.js var Upload_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var Upload_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function Upload_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function Upload_possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function Upload_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint react/prop-types:0 */ function empty() {} var Upload_Upload = function (_Component) { Upload_inherits(Upload, _Component); function Upload() { var _ref; var _temp, _this, _ret; Upload_classCallCheck(this, Upload); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = Upload_possibleConstructorReturn(this, (_ref = Upload.__proto__ || Object.getPrototypeOf(Upload)).call.apply(_ref, [this].concat(args))), _this), _this.saveUploader = function (node) { _this.uploader = node; }, _temp), Upload_possibleConstructorReturn(_this, _ret); } Upload_createClass(Upload, [{ key: 'abort', value: function abort(file) { this.uploader.abort(file); } }, { key: 'render', value: function render() { return external_window_React_default.a.createElement(es_AjaxUploader, Upload_extends({}, this.props, { ref: this.saveUploader })); } }]); return Upload; }(external_window_React_["Component"]); Upload_Upload.defaultProps = { component: 'span', prefixCls: 'rc-upload', data: {}, headers: {}, name: 'file', multipart: false, onStart: empty, onError: empty, onSuccess: empty, multiple: false, beforeUpload: null, customRequest: null, withCredentials: false, openFileDialogOnClick: true }; /* harmony default export */ var es_Upload = (Upload_Upload); // CONCATENATED MODULE: ./node_modules/rc-upload/es/index.js // export this package's api /* harmony default export */ var es = __webpack_exports__["a"] = (es_Upload); /***/ }), /***/ "Gytx": /*!********************************************!*\ !*** ./node_modules/shallowequal/index.js ***! \********************************************/ /*! no static exports found */ /*! exports used: default */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports) { // module.exports = function shallowEqual(objA, objB, compare, compareContext) { var ret = compare ? compare.call(compareContext, objA, objB) : void 0; if (ret !== void 0) { return !!ret; } if (objA === objB) { return true; } if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { return false; } var keysA = Object.keys(objA); var keysB = Object.keys(objB); if (keysA.length !== keysB.length) { return false; } var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B. for (var idx = 0; idx < keysA.length; idx++) { var key = keysA[idx]; if (!bHasOwnProperty(key)) { return false; } var valueA = objA[key]; var valueB = objB[key]; ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (ret === false || (ret === void 0 && valueA !== valueB)) { return false; } } return true; }; /***/ }), /***/ "HmJG": /*!****************************************************************!*\ !*** ./src/components/markdown-editor/upload-image/index.less ***! \****************************************************************/ /*! no static exports found */ /*! ModuleConcatenation bailout: Module is not an ECMAScript module */ /***/ (function(module, exports, __webpack_require__) { // extracted by mini-css-extract-plugin /***/ }), /***/ "LdHM": /*!********************************************************!*\ !*** ./node_modules/rc-select/es/index.js + 6 modules ***! \********************************************************/ /*! exports provided: Option, OptGroup, default */ /*! exports used: OptGroup, Option, default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/TransBtn.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/generate.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/commonUtil.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-select/es/utils/valueUtil.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/KeyCode.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/hooks/useMemo.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/pickAttrs.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/warning.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-virtual-list/es/index.js */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ es_Option; }); __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ es_OptGroup; }); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js var classCallCheck = __webpack_require__("1OyB"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js var createClass = __webpack_require__("vuIU"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js var inherits = __webpack_require__("Ji7U"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createSuper.js + 1 modules var createSuper = __webpack_require__("LK+K"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__("rePB"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js var objectWithoutProperties = __webpack_require__("Ff2n"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("ODXe"); // EXTERNAL MODULE: ./node_modules/rc-util/es/KeyCode.js var KeyCode = __webpack_require__("4IlW"); // EXTERNAL MODULE: ./node_modules/rc-util/es/pickAttrs.js var pickAttrs = __webpack_require__("bX4T"); // EXTERNAL MODULE: ./node_modules/rc-util/es/hooks/useMemo.js var useMemo = __webpack_require__("YrtM"); // EXTERNAL MODULE: ./node_modules/classnames/index.js var classnames = __webpack_require__("TSYQ"); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); // EXTERNAL MODULE: ./node_modules/rc-virtual-list/es/index.js + 19 modules var es = __webpack_require__("+nKL"); // EXTERNAL MODULE: ./node_modules/rc-select/es/TransBtn.js var TransBtn = __webpack_require__("8OUc"); // CONCATENATED MODULE: ./node_modules/rc-select/es/OptionList.js /** * Using virtual list of option display. * Will fallback to dom if use customize render. */ var OptionList_OptionList = function OptionList(_ref, ref) { var prefixCls = _ref.prefixCls, id = _ref.id, flattenOptions = _ref.flattenOptions, childrenAsData = _ref.childrenAsData, values = _ref.values, searchValue = _ref.searchValue, multiple = _ref.multiple, defaultActiveFirstOption = _ref.defaultActiveFirstOption, height = _ref.height, itemHeight = _ref.itemHeight, notFoundContent = _ref.notFoundContent, open = _ref.open, menuItemSelectedIcon = _ref.menuItemSelectedIcon, virtual = _ref.virtual, onSelect = _ref.onSelect, onToggleOpen = _ref.onToggleOpen, onActiveValue = _ref.onActiveValue, onScroll = _ref.onScroll, onMouseEnter = _ref.onMouseEnter; var itemPrefixCls = "".concat(prefixCls, "-item"); var memoFlattenOptions = Object(useMemo["a" /* default */])(function () { return flattenOptions; }, [open, flattenOptions], function (prev, next) { return next[0] && prev[1] !== next[1]; }); // =========================== List =========================== var listRef = external_window_React_["useRef"](null); var onListMouseDown = function onListMouseDown(event) { event.preventDefault(); }; var scrollIntoView = function scrollIntoView(index) { if (listRef.current) { listRef.current.scrollTo({ index: index }); } }; // ========================== Active ========================== var getEnabledActiveIndex = function getEnabledActiveIndex(index) { var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var len = memoFlattenOptions.length; for (var i = 0; i < len; i += 1) { var current = (index + i * offset + len) % len; var _memoFlattenOptions$c = memoFlattenOptions[current], group = _memoFlattenOptions$c.group, data = _memoFlattenOptions$c.data; if (!group && !data.disabled) { return current; } } return -1; }; var _React$useState = external_window_React_["useState"](function () { return getEnabledActiveIndex(0); }), _React$useState2 = Object(slicedToArray["a" /* default */])(_React$useState, 2), activeIndex = _React$useState2[0], setActiveIndex = _React$useState2[1]; var setActive = function setActive(index) { setActiveIndex(index); // Trigger active event var flattenItem = memoFlattenOptions[index]; if (!flattenItem) { onActiveValue(null, -1); return; } onActiveValue(flattenItem.data.value, index); }; // Auto active first item when list length or searchValue changed external_window_React_["useEffect"](function () { setActive(defaultActiveFirstOption !== false ? getEnabledActiveIndex(0) : -1); }, [memoFlattenOptions.length, searchValue]); // Auto scroll to item position in single mode external_window_React_["useEffect"](function () { /** * React will skip `onChange` when component update. * `setActive` function will call root accessibility state update which makes re-render. * So we need to delay to let Input component trigger onChange first. */ var timeoutId = setTimeout(function () { if (!multiple && open && values.size === 1) { var value = Array.from(values)[0]; var index = memoFlattenOptions.findIndex(function (_ref2) { var data = _ref2.data; return data.value === value; }); setActive(index); scrollIntoView(index); } }); return function () { return clearTimeout(timeoutId); }; }, [open]); // ========================== Values ========================== var onSelectValue = function onSelectValue(value) { if (value !== undefined) { onSelect(value, { selected: !values.has(value) }); } // Single mode should always close by select if (!multiple) { onToggleOpen(false); } }; // ========================= Keyboard ========================= external_window_React_["useImperativeHandle"](ref, function () { return { onKeyDown: function onKeyDown(event) { var which = event.which; switch (which) { // >>> Arrow keys case KeyCode["a" /* default */].UP: case KeyCode["a" /* default */].DOWN: { var offset = 0; if (which === KeyCode["a" /* default */].UP) { offset = -1; } else if (which === KeyCode["a" /* default */].DOWN) { offset = 1; } if (offset !== 0) { var nextActiveIndex = getEnabledActiveIndex(activeIndex + offset, offset); scrollIntoView(nextActiveIndex); setActive(nextActiveIndex); } break; } // >>> Select case KeyCode["a" /* default */].ENTER: { // value var item = memoFlattenOptions[activeIndex]; if (item && !item.data.disabled) { onSelectValue(item.data.value); } else { onSelectValue(undefined); } if (open) { event.preventDefault(); } break; } // >>> Close case KeyCode["a" /* default */].ESC: { onToggleOpen(false); } } }, onKeyUp: function onKeyUp() {}, scrollTo: function scrollTo(index) { scrollIntoView(index); } }; }); // ========================== Render ========================== if (memoFlattenOptions.length === 0) { return external_window_React_["createElement"]("div", { role: "listbox", id: "".concat(id, "_list"), className: "".concat(itemPrefixCls, "-empty"), onMouseDown: onListMouseDown }, notFoundContent); } function renderItem(index) { var item = memoFlattenOptions[index]; if (!item) return null; var itemData = item.data || {}; var value = itemData.value, label = itemData.label, children = itemData.children; var attrs = Object(pickAttrs["a" /* default */])(itemData, true); var mergedLabel = childrenAsData ? children : label; return item ? external_window_React_["createElement"]("div", Object.assign({ "aria-label": typeof mergedLabel === 'string' ? mergedLabel : null }, attrs, { key: index, role: "option", id: "".concat(id, "_list_").concat(index), "aria-selected": values.has(value) }), value) : null; } return external_window_React_["createElement"](external_window_React_["Fragment"], null, external_window_React_["createElement"]("div", { role: "listbox", id: "".concat(id, "_list"), style: { height: 0, width: 0, overflow: 'hidden' } }, renderItem(activeIndex - 1), renderItem(activeIndex), renderItem(activeIndex + 1)), external_window_React_["createElement"](es["a" /* default */], { itemKey: "key", ref: listRef, data: memoFlattenOptions, height: height, itemHeight: itemHeight, fullHeight: false, onMouseDown: onListMouseDown, onScroll: onScroll, virtual: virtual, onMouseEnter: onMouseEnter }, function (_ref3, itemIndex) { var _classNames; var group = _ref3.group, groupOption = _ref3.groupOption, data = _ref3.data; var label = data.label, key = data.key; // Group if (group) { return external_window_React_["createElement"]("div", { className: classnames_default()(itemPrefixCls, "".concat(itemPrefixCls, "-group")) }, label !== undefined ? label : key); } var disabled = data.disabled, value = data.value, title = data.title, children = data.children, style = data.style, className = data.className, otherProps = Object(objectWithoutProperties["a" /* default */])(data, ["disabled", "value", "title", "children", "style", "className"]); // Option var selected = values.has(value); var optionPrefixCls = "".concat(itemPrefixCls, "-option"); var optionClassName = classnames_default()(itemPrefixCls, optionPrefixCls, className, (_classNames = {}, Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-grouped"), groupOption), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-active"), activeIndex === itemIndex && !disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-disabled"), disabled), Object(defineProperty["a" /* default */])(_classNames, "".concat(optionPrefixCls, "-selected"), selected), _classNames)); var mergedLabel = childrenAsData ? children : label; var iconVisible = !menuItemSelectedIcon || typeof menuItemSelectedIcon === 'function' || selected; return external_window_React_["createElement"]("div", Object.assign({}, otherProps, { "aria-selected": selected, className: optionClassName, title: title, onMouseMove: function onMouseMove() { if (activeIndex === itemIndex || disabled) { return; } setActive(itemIndex); }, onClick: function onClick() { if (!disabled) { onSelectValue(value); } }, style: style }), external_window_React_["createElement"]("div", { className: "".concat(optionPrefixCls, "-content") }, mergedLabel || value), external_window_React_["isValidElement"](menuItemSelectedIcon) || selected, iconVisible && external_window_React_["createElement"](TransBtn["a" /* default */], { className: "".concat(itemPrefixCls, "-option-state"), customizeIcon: menuItemSelectedIcon, customizeIconProps: { isSelected: selected } }, selected ? '✓' : null)); })); }; var RefOptionList = external_window_React_["forwardRef"](OptionList_OptionList); RefOptionList.displayName = 'OptionList'; /* harmony default export */ var es_OptionList = (RefOptionList); // CONCATENATED MODULE: ./node_modules/rc-select/es/Option.js /** This is a placeholder, not real render in dom */ var Option = function Option() { return null; }; Option.isSelectOption = true; /* harmony default export */ var es_Option = (Option); // CONCATENATED MODULE: ./node_modules/rc-select/es/OptGroup.js /** This is a placeholder, not real render in dom */ var OptGroup = function OptGroup() { return null; }; OptGroup.isSelectOptGroup = true; /* harmony default export */ var es_OptGroup = (OptGroup); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js var objectSpread2 = __webpack_require__("VTBJ"); // EXTERNAL MODULE: ./node_modules/rc-util/es/Children/toArray.js var toArray = __webpack_require__("Zm9Q"); // CONCATENATED MODULE: ./node_modules/rc-select/es/utils/legacyUtil.js function convertNodeToOption(node) { var key = node.key, _node$props = node.props, children = _node$props.children, value = _node$props.value, restProps = Object(objectWithoutProperties["a" /* default */])(_node$props, ["children", "value"]); return Object(objectSpread2["a" /* default */])({ key: key, value: value !== undefined ? value : key, children: children }, restProps); } function convertChildrenToData(nodes) { var optionOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return Object(toArray["a" /* default */])(nodes).map(function (node, index) { if (!external_window_React_["isValidElement"](node) || !node.type) { return null; } var isSelectOptGroup = node.type.isSelectOptGroup, key = node.key, _node$props2 = node.props, children = _node$props2.children, restProps = Object(objectWithoutProperties["a" /* default */])(_node$props2, ["children"]); if (optionOnly || !isSelectOptGroup) { return convertNodeToOption(node); } return Object(objectSpread2["a" /* default */])(Object(objectSpread2["a" /* default */])({ key: "__RC_SELECT_GRP__".concat(key === null ? index : key, "__"), label: key }, restProps), {}, { options: convertChildrenToData(children) }); }).filter(function (data) { return data; }); } // EXTERNAL MODULE: ./node_modules/rc-select/es/utils/valueUtil.js var valueUtil = __webpack_require__("2Qr1"); // EXTERNAL MODULE: ./node_modules/rc-select/es/generate.js + 11 modules var generate = __webpack_require__("qNPg"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__("U8pU"); // EXTERNAL MODULE: ./node_modules/rc-util/es/warning.js var warning = __webpack_require__("Kwbf"); // EXTERNAL MODULE: ./node_modules/rc-select/es/utils/commonUtil.js var commonUtil = __webpack_require__("WKfj"); // CONCATENATED MODULE: ./node_modules/rc-select/es/utils/warningPropsUtil.js function warningProps(props) { var mode = props.mode, options = props.options, children = props.children, backfill = props.backfill, allowClear = props.allowClear, placeholder = props.placeholder, getInputElement = props.getInputElement, showSearch = props.showSearch, onSearch = props.onSearch, defaultOpen = props.defaultOpen, autoFocus = props.autoFocus, labelInValue = props.labelInValue, value = props.value, inputValue = props.inputValue, optionLabelProp = props.optionLabelProp; var multiple = mode === 'multiple' || mode === 'tags'; var mergedShowSearch = showSearch !== undefined ? showSearch : multiple || mode === 'combobox'; var mergedOptions = options || convertChildrenToData(children); // `tags` should not set option as disabled Object(warning["a" /* default */])(mode !== 'tags' || mergedOptions.every(function (opt) { return !opt.disabled; }), 'Please avoid setting option to disabled in tags mode since user can always type text as tag.'); // `combobox` & `tags` should option be `string` type if (mode === 'tags' || mode === 'combobox') { var hasNumberValue = mergedOptions.some(function (item) { if (item.options) { return item.options.some(function (opt) { return typeof ('value' in opt ? opt.value : opt.key) === 'number'; }); } return typeof ('value' in item ? item.value : item.key) === 'number'; }); Object(warning["a" /* default */])(!hasNumberValue, '`value` of Option should not use number type when `mode` is `tags` or `combobox`.'); } // `combobox` should not use `optionLabelProp` Object(warning["a" /* default */])(mode !== 'combobox' || !optionLabelProp, '`combobox` mode not support `optionLabelProp`. Please set `value` on Option directly.'); // Only `combobox` support `backfill` Object(warning["a" /* default */])(mode === 'combobox' || !backfill, '`backfill` only works with `combobox` mode.'); // Only `combobox` support `getInputElement` Object(warning["a" /* default */])(mode === 'combobox' || !getInputElement, '`getInputElement` only work with `combobox` mode.'); // Customize `getInputElement` should not use `allowClear` & `placeholder` Object(warning["b" /* noteOnce */])(mode !== 'combobox' || !getInputElement || !allowClear || !placeholder, 'Customize `getInputElement` should customize clear and placeholder logic instead of configuring `allowClear` and `placeholder`.'); // `onSearch` should use in `combobox` or `showSearch` if (onSearch && !mergedShowSearch && mode !== 'combobox' && mode !== 'tags') { Object(warning["a" /* default */])(false, '`onSearch` should work with `showSearch` instead of use alone.'); } Object(warning["b" /* noteOnce */])(!defaultOpen || autoFocus, '`defaultOpen` makes Select open without focus which means it will not close by click outside. You can set `autoFocus` if needed.'); if (value !== undefined && value !== null) { var values = Object(commonUtil["d" /* toArray */])(value); Object(warning["a" /* default */])(!labelInValue || values.every(function (val) { return Object(esm_typeof["a" /* default */])(val) === 'object' && ('key' in val || 'value' in val); }), '`value` should in shape of `{ value: string | number, label?: ReactNode }` when you set `labelInValue` to `true`'); Object(warning["a" /* default */])(!multiple || Array.isArray(value), '`value` should be array when `mode` is `multiple` or `tags`'); } // Syntactic sugar should use correct children type if (children) { var invalidateChildType = null; Object(toArray["a" /* default */])(children).some(function (node) { if (!external_window_React_["isValidElement"](node) || !node.type) { return false; } var type = node.type; if (type.isSelectOption) { return false; } if (type.isSelectOptGroup) { var allChildrenValid = Object(toArray["a" /* default */])(node.props.children).every(function (subNode) { if (!external_window_React_["isValidElement"](subNode) || !node.type || subNode.type.isSelectOption) { return true; } invalidateChildType = subNode.type; return false; }); if (allChildrenValid) { return false; } return true; } invalidateChildType = type; return true; }); if (invalidateChildType) { Object(warning["a" /* default */])(false, "`children` should be `Select.Option` or `Select.OptGroup` instead of `".concat(invalidateChildType.displayName || invalidateChildType.name || invalidateChildType, "`.")); } Object(warning["a" /* default */])(inputValue === undefined, '`inputValue` is deprecated, please use `searchValue` instead.'); } } /* harmony default export */ var warningPropsUtil = (warningProps); // CONCATENATED MODULE: ./node_modules/rc-select/es/Select.js /** * To match accessibility requirement, we always provide an input in the component. * Other element will not set `tabIndex` to avoid `onBlur` sequence problem. * For focused select, we set `aria-live="polite"` to update the accessibility content. * * ref: * - keyboard: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role#Keyboard_interactions * * New api: * - listHeight * - listItemHeight * - component * * Remove deprecated api: * - multiple * - tags * - combobox * - firstActiveValue * - dropdownMenuStyle * - openClassName (Not list in api) * * Update: * - `backfill` only support `combobox` mode * - `combobox` mode not support `labelInValue` since it's meaningless * - `getInputElement` only support `combobox` mode * - `onChange` return OptionData instead of ReactNode * - `filterOption` `onChange` `onSelect` accept OptionData instead of ReactNode * - `combobox` mode trigger `onChange` will get `undefined` if no `value` match in Option * - `combobox` mode not support `optionLabelProp` */ var RefSelect = Object(generate["a" /* default */])({ prefixCls: 'rc-select', components: { optionList: es_OptionList }, convertChildrenToData: convertChildrenToData, flattenOptions: valueUtil["d" /* flattenOptions */], getLabeledValue: valueUtil["e" /* getLabeledValue */], filterOptions: valueUtil["b" /* filterOptions */], isValueDisabled: valueUtil["g" /* isValueDisabled */], findValueOption: valueUtil["c" /* findValueOption */], warningProps: warningPropsUtil, fillOptionsWithMissingValue: valueUtil["a" /* fillOptionsWithMissingValue */] }); /** * Typescript not support generic with function component, * we have to wrap an class component to handle this. */ var Select_Select = /*#__PURE__*/function (_React$Component) { Object(inherits["a" /* default */])(Select, _React$Component); var _super = Object(createSuper["a" /* default */])(Select); function Select() { var _this; Object(classCallCheck["a" /* default */])(this, Select); _this = _super.apply(this, arguments); _this.selectRef = external_window_React_["createRef"](); _this.focus = function () { _this.selectRef.current.focus(); }; _this.blur = function () { _this.selectRef.current.blur(); }; return _this; } Object(createClass["a" /* default */])(Select, [{ key: "render", value: function render() { return external_window_React_["createElement"](RefSelect, Object.assign({ ref: this.selectRef }, this.props)); } }]); return Select; }(external_window_React_["Component"]); Select_Select.Option = es_Option; Select_Select.OptGroup = es_OptGroup; /* harmony default export */ var es_Select = (Select_Select); // CONCATENATED MODULE: ./node_modules/rc-select/es/index.js /* harmony default export */ var rc_select_es = __webpack_exports__["c"] = (es_Select); /***/ }), /***/ "M8RZ": /*!**********************************!*\ !*** ./src/components/modal.tsx ***! \**********************************/ /*! exports provided: default */ /*! exports used: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Dialog; }); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/classCallCheck */ "fWQN"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createClass */ "mtLc"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/inherits */ "yKVA"); /* harmony import */ var _Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createSuper */ "879j"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "cDcd"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_4__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-dom */ "faye"); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_5__); var Dialog = /*#__PURE__*/function (_React$Component) { Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_inherits__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(Dialog, _React$Component); var _super = Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createSuper__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])(Dialog); function Dialog(props) { var _this; Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(this, Dialog); _this = _super.call(this, props); var doc = window.document; _this.node = doc.createElement('div'); doc.body.appendChild(_this.node); return _this; } Object(_Users_dingyongkang_Documents_workspace_zhiqing_educoder_node_modules_umijs_babel_preset_umi_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(Dialog, [{ key: "render", value: function render() { var children = this.props.children; return /*#__PURE__*/Object(react_dom__WEBPACK_IMPORTED_MODULE_5__["createPortal"])(children, this.node); } }, { key: "componentWillUnmount", value: function componentWillUnmount() { window.document.body.removeChild(this.node); } }]); return Dialog; }(react__WEBPACK_IMPORTED_MODULE_4___default.a.Component); /***/ }), /***/ "OLES": /*!*********************************************************!*\ !*** ./node_modules/rc-tooltip/es/index.js + 2 modules ***! \*********************************************************/ /*! exports provided: default */ /*! exports used: default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tooltip/es/placements.js because of ./node_modules/antd/es/tooltip/placements.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-trigger/es/index.js */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__("U8pU"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js var objectSpread2 = __webpack_require__("VTBJ"); // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js var objectWithoutProperties = __webpack_require__("Ff2n"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); // EXTERNAL MODULE: ./node_modules/rc-trigger/es/index.js + 5 modules var es = __webpack_require__("uciX"); // EXTERNAL MODULE: ./node_modules/rc-tooltip/es/placements.js var placements = __webpack_require__("7ixt"); // CONCATENATED MODULE: ./node_modules/rc-tooltip/es/Content.js var Content_Content = function Content(props) { var overlay = props.overlay, prefixCls = props.prefixCls, id = props.id, overlayInnerStyle = props.overlayInnerStyle; return external_window_React_["createElement"]("div", { className: "".concat(prefixCls, "-inner"), id: id, role: "tooltip", style: overlayInnerStyle }, typeof overlay === 'function' ? overlay() : overlay); }; /* harmony default export */ var es_Content = (Content_Content); // CONCATENATED MODULE: ./node_modules/rc-tooltip/es/Tooltip.js var Tooltip_Tooltip = function Tooltip(props, ref) { var overlayClassName = props.overlayClassName, _props$trigger = props.trigger, trigger = _props$trigger === void 0 ? ['hover'] : _props$trigger, _props$mouseEnterDela = props.mouseEnterDelay, mouseEnterDelay = _props$mouseEnterDela === void 0 ? 0 : _props$mouseEnterDela, _props$mouseLeaveDela = props.mouseLeaveDelay, mouseLeaveDelay = _props$mouseLeaveDela === void 0 ? 0.1 : _props$mouseLeaveDela, overlayStyle = props.overlayStyle, _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? 'rc-tooltip' : _props$prefixCls, children = props.children, onVisibleChange = props.onVisibleChange, afterVisibleChange = props.afterVisibleChange, transitionName = props.transitionName, animation = props.animation, _props$placement = props.placement, placement = _props$placement === void 0 ? 'right' : _props$placement, _props$align = props.align, align = _props$align === void 0 ? {} : _props$align, _props$destroyTooltip = props.destroyTooltipOnHide, destroyTooltipOnHide = _props$destroyTooltip === void 0 ? false : _props$destroyTooltip, defaultVisible = props.defaultVisible, getTooltipContainer = props.getTooltipContainer, overlayInnerStyle = props.overlayInnerStyle, restProps = Object(objectWithoutProperties["a" /* default */])(props, ["overlayClassName", "trigger", "mouseEnterDelay", "mouseLeaveDelay", "overlayStyle", "prefixCls", "children", "onVisibleChange", "afterVisibleChange", "transitionName", "animation", "placement", "align", "destroyTooltipOnHide", "defaultVisible", "getTooltipContainer", "overlayInnerStyle"]); var domRef = Object(external_window_React_["useRef"])(null); Object(external_window_React_["useImperativeHandle"])(ref, function () { return domRef.current; }); var extraProps = Object(objectSpread2["a" /* default */])({}, restProps); if ('visible' in props) { extraProps.popupVisible = props.visible; } var getPopupElement = function getPopupElement() { var _props$arrowContent = props.arrowContent, arrowContent = _props$arrowContent === void 0 ? null : _props$arrowContent, overlay = props.overlay, id = props.id; return [external_window_React_["createElement"]("div", { className: "".concat(prefixCls, "-arrow"), key: "arrow" }, arrowContent), external_window_React_["createElement"](es_Content, { key: "content", prefixCls: prefixCls, id: id, overlay: overlay, overlayInnerStyle: overlayInnerStyle })]; }; var destroyTooltip = false; var autoDestroy = false; if (typeof destroyTooltipOnHide === 'boolean') { destroyTooltip = destroyTooltipOnHide; } else if (destroyTooltipOnHide && Object(esm_typeof["a" /* default */])(destroyTooltipOnHide) === 'object') { var keepParent = destroyTooltipOnHide.keepParent; destroyTooltip = keepParent === true; autoDestroy = keepParent === false; } return external_window_React_["createElement"](es["a" /* default */], Object.assign({ popupClassName: overlayClassName, prefixCls: prefixCls, popup: getPopupElement, action: trigger, builtinPlacements: placements["a" /* placements */], popupPlacement: placement, ref: domRef, popupAlign: align, getPopupContainer: getTooltipContainer, onPopupVisibleChange: onVisibleChange, afterPopupVisibleChange: afterVisibleChange, popupTransitionName: transitionName, popupAnimation: animation, defaultPopupVisible: defaultVisible, destroyPopupOnHide: destroyTooltip, autoDestroy: autoDestroy, mouseLeaveDelay: mouseLeaveDelay, popupStyle: overlayStyle, mouseEnterDelay: mouseEnterDelay }, extraProps), children); }; /* harmony default export */ var es_Tooltip = (Object(external_window_React_["forwardRef"])(Tooltip_Tooltip)); // CONCATENATED MODULE: ./node_modules/rc-tooltip/es/index.js /* harmony default export */ var rc_tooltip_es = __webpack_exports__["a"] = (es_Tooltip); /***/ }), /***/ "Ot1p": /*!**************************************************************!*\ !*** ./src/components/markdown-editor/index.tsx + 6 modules ***! \**************************************************************/ /*! exports provided: default */ /*! exports used: default */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/RenderHtml/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/markdown-editor/code-block/index.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/modal.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/components/useInterval.tsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/pages/tasks/util.js because of ./src/pages/tasks/index.jsx */ /*! ModuleConcatenation bailout: Cannot concat with ./src/utils/env.ts */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/form/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input-number/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/input/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/radio/style/index.js */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/codemirror/lib/codemirror.js (<- Module is not an ECMAScript module) */ /*! ModuleConcatenation bailout: Cannot concat with ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js (<- Module uses injected variables (global)) */ /*! ModuleConcatenation bailout: Cannot concat with external "window.React" (<- Module is not an ECMAScript module) */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // EXTERNAL MODULE: ./node_modules/antd/es/modal/style/index.js var modal_style = __webpack_require__("2qtc"); // EXTERNAL MODULE: ./node_modules/antd/es/modal/index.js + 7 modules var modal = __webpack_require__("kLXV"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js var createForOfIteratorHelper = __webpack_require__("rAM+"); // EXTERNAL MODULE: ./node_modules/antd/es/message/style/index.js var message_style = __webpack_require__("miYZ"); // EXTERNAL MODULE: ./node_modules/antd/es/message/index.js + 1 modules var message = __webpack_require__("tsqr"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js + 1 modules var slicedToArray = __webpack_require__("tJVT"); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/defineProperty.js var defineProperty = __webpack_require__("jrin"); // EXTERNAL MODULE: external "window.React" var external_window_React_ = __webpack_require__("cDcd"); var external_window_React_default = /*#__PURE__*/__webpack_require__.n(external_window_React_); // EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.js var codemirror = __webpack_require__("VrN/"); var codemirror_default = /*#__PURE__*/__webpack_require__.n(codemirror); // EXTERNAL MODULE: ./node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js var ResizeObserver_es = __webpack_require__("bdgK"); // EXTERNAL MODULE: ./node_modules/codemirror/lib/codemirror.css var lib_codemirror = __webpack_require__("p77/"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closetag.js var closetag = __webpack_require__("Bd2K"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/edit/closebrackets.js var closebrackets = __webpack_require__("ELLl"); // EXTERNAL MODULE: ./node_modules/codemirror/addon/display/placeholder.js var display_placeholder = __webpack_require__("19Vz"); // EXTERNAL MODULE: ./node_modules/codemirror/mode/markdown/markdown.js var markdown = __webpack_require__("lZu9"); // EXTERNAL MODULE: ./node_modules/codemirror/mode/stex/stex.js var stex = __webpack_require__("+NIl"); // EXTERNAL MODULE: ./src/components/markdown-editor/index.less var markdown_editor = __webpack_require__("kSUc"); // EXTERNAL MODULE: ./src/components/RenderHtml/index.tsx + 1 modules var RenderHtml = __webpack_require__("9Bee"); // CONCATENATED MODULE: ./src/components/RenderHtml/stex.tsx // const latexjs = require('latex-l.js/dist/latex.js'); // import "latex-l.js/dist/css/base.css" /* harmony default export */ var RenderHtml_stex = (function (_ref) { var _ref$value = _ref.value, value = _ref$value === void 0 ? '' : _ref$value, className = _ref.className, showTextOnly = _ref.showTextOnly, showLines = _ref.showLines, _ref$style = _ref.style, style = _ref$style === void 0 ? {} : _ref$style; var html = Object(external_window_React_["useMemo"])(function () { // try { // const latex = value || 'This is some text'; // let generator = new latexjs.default.HtmlGenerator({ hyphenate: true }) // let doc = latexjs.default.parse(latex, { generator: generator }).htmlDocument() // return doc.body.innerHTML // }catch(e){ // console.log("e:",e) // return "错误的latex语法,请检查" // } return ""; }, [value]); return /*#__PURE__*/external_window_React_default.a.createElement(external_window_React_default.a.Fragment, null, /*#__PURE__*/external_window_React_default.a.createElement("div", { dangerouslySetInnerHTML: { __html: html } })); }); // EXTERNAL MODULE: ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends.js var esm_extends = __webpack_require__("0Owb"); // EXTERNAL MODULE: ./src/components/markdown-editor/toolbar/index.less var toolbar = __webpack_require__("dejd"); // EXTERNAL MODULE: ./src/components/markdown-editor/css/iconfont.css var iconfont = __webpack_require__("C+DQ"); // CONCATENATED MODULE: ./src/components/markdown-editor/toolbar/index.tsx var DEFAULTICONS = [{ title: '粗体', icon: 'icon-bold', actionName: 'bold' }, { title: '斜体', icon: 'icon-italic', actionName: 'italic' }, '|', { title: '无序列表', icon: 'icon-unorder-list', actionName: 'list-ul' }, { title: '有序列表', icon: 'icon-order-list', actionName: 'list-ol' }, '|', { title: '行内代码', icon: 'icon-code', actionName: 'code' }, { title: '代码块(多语言风格)', icon: 'icon-file-code', actionName: 'code-block' }, { title: '链接', icon: 'icon-link', actionName: 'link' }, '|', { title: '行内公式', icon: 'icon-sum', actionName: 'inline-latex' }, { title: '多行公式', icon: 'icon-formula', actionName: 'latex' }, '|', { title: '添加图片', icon: 'icon-picture', actionName: 'upload-image' }, { title: '表格', icon: 'icon-table', actionName: 'add-table' }, '|', { title: '换行', icon: 'icon-minus', actionName: 'line-break' }, { title: '清空', icon: 'icon-eraser', actionName: 'eraser' }]; function AButton(_ref) { var onActionCallback = _ref.onActionCallback, title = _ref.title, icon = _ref.icon, actionName = _ref.actionName, _ref$className = _ref.className, className = _ref$className === void 0 ? '' : _ref$className, children = _ref.children; function onAction() { onActionCallback(actionName); } return /*#__PURE__*/external_window_React_default.a.createElement("a", { title: title, className: className, onClick: onAction }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "md-iconfont ".concat(icon) }), children); } /* harmony default export */ var markdown_editor_toolbar = (function (_ref2) { var watch = _ref2.watch, showNullButton = _ref2.showNullButton, onActionCallback = _ref2.onActionCallback, fullScreen = _ref2.fullScreen, insertTemp = _ref2.insertTemp, hidetoolBar = _ref2.hidetoolBar; var icons = [].concat(DEFAULTICONS, [{ title: "".concat(watch ? '关闭实时预览' : '开启实时预览'), icon: "".concat(watch ? 'icon-eye-slash' : 'icon-eye'), actionName: 'trigger-watch' }]); return /*#__PURE__*/external_window_React_default.a.createElement("ul", { className: "markdown-toolbar-container" }, !hidetoolBar && icons.map(function (item, index) { return /*#__PURE__*/external_window_React_default.a.createElement("li", { key: index }, item.actionName ? /*#__PURE__*/external_window_React_default.a.createElement(AButton, Object(esm_extends["a" /* default */])({}, item, { onActionCallback: onActionCallback })) : /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "v-line" })); }), showNullButton ? /*#__PURE__*/external_window_React_default.a.createElement("li", null, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "icon-edit", className: "btn-null", title: "\u589E\u52A0\u586B\u7A7A", actionName: "add-null-ch", onActionCallback: onActionCallback }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fill-tip" }, "\u70B9\u51FB\u63D2\u5165\b\u586B\u7A7A\u9879"))) : null, insertTemp && /*#__PURE__*/external_window_React_default.a.createElement("li", null, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "icon-edit", className: "btn-null", title: "\u63D2\u5165\u6A21\u677F", actionName: "inster-template-".concat(insertTemp), onActionCallback: onActionCallback }, /*#__PURE__*/external_window_React_default.a.createElement("span", { className: "fill-tip" }, "\u63D2\u5165\u6A21\u677F"))), /*#__PURE__*/external_window_React_default.a.createElement("li", { className: "btn-full-screen" }, /*#__PURE__*/external_window_React_default.a.createElement(AButton, { icon: "".concat(fullScreen ? 'icon-shrink' : 'icon-enlarge'), title: fullScreen ? '关闭全屏' : '开启全屏', actionName: "trigger-full-screen", onActionCallback: onActionCallback }))); }); // EXTERNAL MODULE: ./src/components/modal.tsx var components_modal = __webpack_require__("M8RZ"); // EXTERNAL MODULE: ./node_modules/antd/es/button/style/index.js var button_style = __webpack_require__("+L6B"); // EXTERNAL MODULE: ./node_modules/antd/es/button/index.js var es_button = __webpack_require__("2/Rp"); // EXTERNAL MODULE: ./node_modules/antd/es/form/style/index.js var form_style = __webpack_require__("y8nQ"); // EXTERNAL MODULE: ./node_modules/antd/es/form/index.js + 11 modules var es_form = __webpack_require__("Vl3Y"); // EXTERNAL MODULE: ./node_modules/antd/es/input/style/index.js var input_style = __webpack_require__("5NDa"); // EXTERNAL MODULE: ./node_modules/antd/es/input/index.js + 3 modules var input = __webpack_require__("5rEg"); // CONCATENATED MODULE: ./src/components/markdown-editor/link/index.tsx var formItemLayout = { labelCol: { span: 4 }, wrapperCol: { span: 20 } }; /* harmony default export */ var markdown_editor_link = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; function onSubmit(values) { callback(values); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], Object(esm_extends["a" /* default */])({}, formItemLayout, { initialValues: { link: 'http://', title: '' }, className: "link-panel", onFinish: onSubmit }), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u94FE\u63A5\u5730\u5740", name: "link", rules: [{ required: true, message: '请输入链接地址' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u94FE\u63A5\u6807\u9898", name: "title", rules: [{ required: true, message: '请输入链接标题' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container flex-end" }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); // EXTERNAL MODULE: ./src/components/markdown-editor/code-block/index.tsx var code_block = __webpack_require__("7ahc"); // EXTERNAL MODULE: ./src/components/markdown-editor/upload-image/index.less var upload_image = __webpack_require__("HmJG"); // EXTERNAL MODULE: ./src/pages/tasks/util.js var util = __webpack_require__("BjJ7"); // CONCATENATED MODULE: ./src/components/markdown-editor/upload-image/index.tsx var useForm = es_form["a" /* default */].useForm; var upload_image_style = { width: 280, marginRight: 10 }; var upload_image_formItemLayout = { labelCol: { span: 5 }, wrapperCol: { span: 19 } }; /* harmony default export */ var markdown_editor_upload_image = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; var _useForm = useForm(), _useForm2 = Object(slicedToArray["a" /* default */])(_useForm, 1), form = _useForm2[0]; function onSubmit(values) { callback(values); } function onAddUrl(data, file) { form.setFieldsValue({ src: "/api/attachments/".concat(data.id), type: file.type }); } function onFileChange(e) { var file = e.target.files[0]; uploadImage(file, onAddUrl); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], Object(esm_extends["a" /* default */])({ form: form }, upload_image_formItemLayout, { className: "upload-image-panel", onFinish: onSubmit }), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u56FE\u7247\u5730\u5740", required: true }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container" }, /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { noStyle: true, name: "src", rules: [{ required: true, message: '请输入图片地址' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { style: upload_image_style })), /*#__PURE__*/external_window_React_default.a.createElement(UploadButton, { onFileChange: onFileChange }))), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { label: "\u56FE\u7247\u63CF\u8FF0", name: "alt", rules: [{ required: true, message: '请输入图片描述' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input["a" /* default */], { style: { width: 264 } })), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { style: { textAlign: "right" } }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); function UploadButton(_ref2) { var onFileChange = _ref2.onFileChange; return /*#__PURE__*/external_window_React_default.a.createElement("a", { className: "upload-button" }, "\u672C\u5730\u4E0A\u4F20", /*#__PURE__*/external_window_React_default.a.createElement("input", { type: "file", onChange: onFileChange })); } function uploadImage(file, callback) { if (!file) { throw new String('没有文件'); return; } var formData = new FormData(); formData.append('editormd-image-file', file); formData.append('file_param_name', 'editormd-image-file'); formData.append('byxhr', 'true'); var xhr = new window.XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener('load', function (response) { callback(JSON.parse(response.target.responseText), file); }, false); xhr.addEventListener('error', function (error) { console.error(error); }, false); xhr.open('POST', "".concat(util["a" /* apiPref */], "/api/attachments.json")); xhr.send(formData); } // EXTERNAL MODULE: ./node_modules/antd/es/input-number/style/index.js var input_number_style = __webpack_require__("giR+"); // EXTERNAL MODULE: ./node_modules/antd/es/input-number/index.js var input_number = __webpack_require__("fyUT"); // EXTERNAL MODULE: ./node_modules/antd/es/radio/style/index.js var radio_style = __webpack_require__("7Kak"); // EXTERNAL MODULE: ./node_modules/antd/es/radio/index.js + 4 modules var es_radio = __webpack_require__("9yH6"); // CONCATENATED MODULE: ./src/components/markdown-editor/add-table-panel/index.tsx var RadioGroup = es_radio["a" /* default */].Group; var add_table_panel_style = { margin: '0 8px' }; /* harmony default export */ var add_table_panel = (function (_ref) { var callback = _ref.callback, onCancel = _ref.onCancel; function onSubmit(values) { callback(values); } return /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */], { className: "add-table-panel", initialValues: { row: 3, col: 2, align: 'default' }, onFinish: onSubmit }, /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container" }, /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5355\u5143\u683C\u6570\uFF1A"), /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u884C\u6570"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "row", rules: [{ required: true, message: '请输入行数' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], null)), /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5217\u6570"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "col", rules: [{ required: true, message: '请输入列数' }] }, /*#__PURE__*/external_window_React_default.a.createElement(input_number["a" /* default */], null))), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container", style: { marginTop: 12 } }, /*#__PURE__*/external_window_React_default.a.createElement("span", { style: add_table_panel_style }, "\u5BF9\u9F50\u65B9\u5F0F\uFF1A"), /*#__PURE__*/external_window_React_default.a.createElement(es_form["a" /* default */].Item, { name: "align" }, /*#__PURE__*/external_window_React_default.a.createElement(RadioGroup, null, /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "default" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-justify" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "left" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-left" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "center" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-center" })), /*#__PURE__*/external_window_React_default.a.createElement(es_radio["a" /* default */], { value: "right" }, /*#__PURE__*/external_window_React_default.a.createElement("i", { className: "fa fa-align-right" }))))), /*#__PURE__*/external_window_React_default.a.createElement("div", { className: "flex-container flex-end" }, /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "primary", htmlType: "submit", style: { marginRight: 10 } }, "\u786E\u5B9A"), /*#__PURE__*/external_window_React_default.a.createElement(es_button["a" /* default */], { type: "ghost", onClick: onCancel }, "\u53D6\u6D88"))); }); // EXTERNAL MODULE: ./src/utils/env.ts + 1 modules var env = __webpack_require__("m3rI"); // CONCATENATED MODULE: ./src/components/markdown-editor/constant.ts var LINK = 'link'; var UPLOAD_IMAGE = 'upload-image'; var CODE_BLOCK = 'code-block'; var ADD_TABLE = 'add-table'; var HRLINE = '------------'; var ALIGNSIGN = { default: HRLINE, left: ":".concat(HRLINE), center: ":".concat(HRLINE, ":"), right: "".concat(HRLINE, ":") }; // EXTERNAL MODULE: ./src/components/useInterval.tsx var useInterval = __webpack_require__("9VGf"); // CONCATENATED MODULE: ./src/components/markdown-editor/index.tsx var _DEFAULTKEYMAP, _TitleDesc; function noop() {} var pending = 0; var StorageTimeTicket = 10000; var NULL_CH = '▁'; var TEMP1 = '\n**模板标题**\n模板正文内容,可输入文本内容和粘贴图片等操作'; //课程须知模板 function processSize(size) { return !/^\d+$/.test(size) ? size : "".concat(size, "px"); } var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0; var key = isMac ? 'Cmd' : 'Ctrl'; var DEFAULTKEYMAP = (_DEFAULTKEYMAP = {}, Object(defineProperty["a" /* default */])(_DEFAULTKEYMAP, key + '-B', 'bold'), Object(defineProperty["a" /* default */])(_DEFAULTKEYMAP, key + '-I', 'italic'), _DEFAULTKEYMAP); var TitleDesc = (_TitleDesc = {}, Object(defineProperty["a" /* default */])(_TitleDesc, LINK, '添加链接'), Object(defineProperty["a" /* default */])(_TitleDesc, CODE_BLOCK, '添加代码块'), Object(defineProperty["a" /* default */])(_TitleDesc, UPLOAD_IMAGE, '添加图片'), Object(defineProperty["a" /* default */])(_TitleDesc, ADD_TABLE, '添加表格'), _TitleDesc); //https://codemirror.net/demo //The height can be set through CSS (by giving the .CodeMirror class a height property), or by calling the cm's setSize method. /* harmony default export */ var components_markdown_editor = __webpack_exports__["a"] = (function (_ref) { var _ref$defaultValue = _ref.defaultValue, defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue, onChange = _ref.onChange, _ref$width = _ref.width, width = _ref$width === void 0 ? '100%' : _ref$width, _ref$height = _ref.height, height = _ref$height === void 0 ? 400 : _ref$height, _ref$miniToolbar = _ref.miniToolbar, miniToolbar = _ref$miniToolbar === void 0 ? false : _ref$miniToolbar, _ref$isFocus = _ref.isFocus, isFocus = _ref$isFocus === void 0 ? false : _ref$isFocus, watch = _ref.watch, insertTemp = _ref.insertTemp, _ref$mode = _ref.mode, mode = _ref$mode === void 0 ? "markdown" : _ref$mode, _ref$id = _ref.id, id = _ref$id === void 0 ? 'markdown-editor-id' : _ref$id, _ref$showResizeBar = _ref.showResizeBar, showResizeBar = _ref$showResizeBar === void 0 ? false : _ref$showResizeBar, _ref$noStorage = _ref.noStorage, noStorage = _ref$noStorage === void 0 ? false : _ref$noStorage, _ref$showNullButton = _ref.showNullButton, showNullButton = _ref$showNullButton === void 0 ? false : _ref$showNullButton, _ref$hidetoolBar = _ref.hidetoolBar, hidetoolBar = _ref$hidetoolBar === void 0 ? false : _ref$hidetoolBar, _ref$fullScreen = _ref.fullScreen, fullScreen = _ref$fullScreen === void 0 ? false : _ref$fullScreen, onBlur = _ref.onBlur, onCMBeforeChange = _ref.onCMBeforeChange, onFullScreen = _ref.onFullScreen, _ref$className = _ref.className, className = _ref$className === void 0 ? '' : _ref$className, _ref$disablePaste = _ref.disablePaste, disablePaste = _ref$disablePaste === void 0 ? false : _ref$disablePaste, _ref$placeholder = _ref.placeholder, placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder, _ref$values = _ref.values, values = _ref$values === void 0 ? '' : _ref$values; var _useState = Object(external_window_React_["useState"])(null), _useState2 = Object(slicedToArray["a" /* default */])(_useState, 2), cm = _useState2[0], setCm = _useState2[1]; var _useState3 = Object(external_window_React_["useState"])(defaultValue), _useState4 = Object(slicedToArray["a" /* default */])(_useState3, 2), value = _useState4[0], setValue = _useState4[1]; var _useState5 = Object(external_window_React_["useState"])(watch), _useState6 = Object(slicedToArray["a" /* default */])(_useState5, 2), preview = _useState6[0], setPreview = _useState6[1]; var _useState7 = Object(external_window_React_["useState"])(fullScreen), _useState8 = Object(slicedToArray["a" /* default */])(_useState7, 2), isFull = _useState8[0], setIsFull = _useState8[1]; var _useState9 = Object(external_window_React_["useState"])(''), _useState10 = Object(slicedToArray["a" /* default */])(_useState9, 2), action = _useState10[0], setAction = _useState10[1]; var _useState11 = Object(external_window_React_["useState"])(0), _useState12 = Object(slicedToArray["a" /* default */])(_useState11, 2), lastedUpdateTime = _useState12[0], setLastedUpdateTime = _useState12[1]; var _useState13 = Object(external_window_React_["useState"])(height), _useState14 = Object(slicedToArray["a" /* default */])(_useState13, 2), h = _useState14[0], setH = _useState14[1]; var _useState15 = Object(external_window_React_["useState"])(false), _useState16 = Object(slicedToArray["a" /* default */])(_useState15, 2), tip = _useState16[0], setTip = _useState16[1]; var cmEl = Object(external_window_React_["useRef"])(); var containerEl = Object(external_window_React_["useRef"])(); var resizeBarEl = Object(external_window_React_["useRef"])(); var previewEl = Object(external_window_React_["useRef"])(); // useEffect(() => { // setValue(defaultValue) // cm?.setValue(defaultValue) // },[]) Object(external_window_React_["useEffect"])(function () { setValue(values); cm === null || cm === void 0 ? void 0 : cm.setValue(values); }, [values]); Object(external_window_React_["useEffect"])(function () { onFullScreen === null || onFullScreen === void 0 ? void 0 : onFullScreen(isFull); }, [isFull]); Object(external_window_React_["useEffect"])(function () { if (cmEl.current) { var instance = codemirror_default.a.fromTextArea(cmEl.current, { mode: mode, // inputStyle: 'contenteditable', lineNumbers: miniToolbar ? false : true, lineWrapping: true, value: defaultValue, autoCloseTags: true, autoCloseBrackets: true }); isFocus && instance.focus(); function onPaste(_, e) { if (disablePaste) { e.preventDefault(); return; } var clipboardData = e.clipboardData; if (clipboardData) { var types = clipboardData.types.toString(); var items = clipboardData.items; var officeSix = ["pptm", "pptx", "ppt", "pot", "pps", "ppa", "potx", "ppsx", "ppam", "pptm", "potm", "ppsm", "doc", "docx", "dot", "dotx", "docm", "dotm", "xls", "xlsx", "csv", "xlt", "xla", "xltx", "xlsm", "xltm", "xlam", "xlsb"]; if (types === 'Files' || clipboardData.types.indexOf("Files") > -1) { e.preventDefault(); if (mode == "stex") return; try { var _items$; var item = items[1]; if (((_items$ = items[0]) === null || _items$ === void 0 ? void 0 : _items$.kind) === 'file') { item = items[0]; } var file = item.getAsFile(); var fileSix = file.name.split(".").pop(); // console.log("item:", item, file, item?.type?.match(/^video\//i)) uploadImage(file, function (data) { if (data.id) { var _file$type, _file$type2, _file$type3; if ((file === null || file === void 0 ? void 0 : (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.indexOf("image")) > -1) { instance.replaceSelection(".concat(data.content_type, ")")); } else if ((file === null || file === void 0 ? void 0 : (_file$type2 = file.type) === null || _file$type2 === void 0 ? void 0 : _file$type2.indexOf("video")) > -1) { instance.replaceSelection("")); } else if ((file === null || file === void 0 ? void 0 : (_file$type3 = file.type) === null || _file$type3 === void 0 ? void 0 : _file$type3.indexOf("pdf")) > -1) { instance.replaceSelection("").concat(file.name, "")); } else if (officeSix.includes(fileSix)) { instance.replaceSelection("").concat(file.name, "")); } else { instance.replaceSelection("[".concat(file.name, "](").concat(env["a" /* default */].API_SERVER, "/api/attachments/").concat(data.id, "?type=").concat(data.content_type, ")")); } } else { if ((data === null || data === void 0 ? void 0 : data.status) === 401) document.location.href = '/user/login'; } }); } catch (e) { message["b" /* default */].warn("请使用chrome浏览器粘贴"); } return true; } else { //toMarkdown ? // let html = clipboardData.getData('text/html') return true; } } return true; } instance.on('paste', onPaste); setCm(instance); return function () { instance.off('paste', onPaste); }; } }, []); var resizeEditorBodyHeight = Object(external_window_React_["useCallback"])(function () { if (containerEl.current) { try {// let toolH = containerEl.current.getElementsByClassName('markdown-toolbar-container')[0].offsetHeight // let mdBody = containerEl.current.getElementsByClassName('markdown-editor-body')[0] // if (!isFull) { // mdBody.style.height = `${h - toolH}px` // } else { // mdBody.style.height = `calc(100vh - ${toolH}px)` // } } catch (error) { console.log(error, '---- to set md editor body height'); } } }, [h, containerEl, isFull]); Object(external_window_React_["useEffect"])(function () { function onLayout() { var ro = new ResizeObserver_es["default"](function (entries) { var _iterator = Object(createForOfIteratorHelper["a" /* default */])(entries), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var entry = _step.value; if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) { resizeEditorBodyHeight(); cm.setSize('100%', '100%'); cm.refresh(); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } }); ro.observe(cmEl.current.parentElement); return ro; } if (cm) { var ro = onLayout(); return function () { ro.unobserve(cmEl.current.parentElement); }; } }, [cm, resizeEditorBodyHeight]); //keymap Object(external_window_React_["useEffect"])(function () { if (cm) { var keymap = []; var _loop = function _loop() { var _ref2 = _Object$entries[_i]; _ref3 = Object(slicedToArray["a" /* default */])(_ref2, 2); var k = _ref3[0]; var value = _ref3[1]; var map = Object(defineProperty["a" /* default */])({}, k, function () { onActionCallback(value); }); keymap.push(map); cm.addKeyMap(map); }; for (var _i = 0, _Object$entries = Object.entries(DEFAULTKEYMAP); _i < _Object$entries.length; _i++) { var _ref3; _loop(); } return function () { var _iterator2 = Object(createForOfIteratorHelper["a" /* default */])(keymap), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var m = _step2.value; cm.removeKeyMap(m); } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } }; } }, [cm]); Object(external_window_React_["useEffect"])(function () { if (fullScreen !== isFull) { setIsFull(fullScreen); } }, [fullScreen]); Object(useInterval["a" /* default */])(function () { if (!noStorage && lastedUpdateTime > 0) { var currentTime = new Date().getTime(); var lastedValue = window.sessionStorage.getItem(id); if (currentTime >= lastedUpdateTime + StorageTimeTicket && (!lastedValue || lastedValue !== value)) { window.sessionStorage.setItem(id, value); setTip(true); } } }, StorageTimeTicket); Object(external_window_React_["useEffect"])(function () { setPreview(watch); }, [cm, watch]); Object(external_window_React_["useEffect"])(function () { if (cm) { isFocus && cm.focus(); } }, [cm, isFocus]); Object(external_window_React_["useEffect"])(function () { if (preview && cm) { var scrollEl = cm.getScrollerElement(); function syncScroll(e) { var target = e.target; if (previewEl.current) { var ratio = target.scrollTop / target.scrollHeight; previewEl.current.scrollTop = previewEl.current.scrollHeight * ratio; } } scrollEl.addEventListener('scroll', syncScroll); return function () { scrollEl.removeEventListener('scroll', syncScroll); }; } }, [cm, preview]); Object(external_window_React_["useEffect"])(function () { if (cm && onCMBeforeChange) { function onChangeHandler(cm, change) { onCMBeforeChange(cm, change); } cm.on('beforeChange', onChangeHandler); return function () { cm.off('beforeChange', onChangeHandler); }; } }, [cm, onCMBeforeChange]); Object(external_window_React_["useEffect"])(function () { if (cm && onBlur) { function onBlurHandler() { onBlur(cm.getValue()); } cm.on('blur', onBlurHandler); return function () { cm.off('blur', onBlurHandler); }; } }, [cm, onBlur]); Object(external_window_React_["useEffect"])(function () { if (cm) { function onChangeHandler(cm) { var content = cm.getValue(); setValue(content); setLastedUpdateTime(new Date().getTime()); cm.getScrollerElement().dispatchEvent(new CustomEvent('scroll')); onChange && onChange(content); } cm.on('change', onChangeHandler); return function () { cm.off('change', onChangeHandler); }; } }, [cm, onChange]); Object(external_window_React_["useEffect"])(function () { if (cm) { // isFocus && cm.focus() if (defaultValue === null || defaultValue === undefined) { cm.setValue(''); setValue(''); } else { if (defaultValue !== cm.getValue()) { cm.setValue(defaultValue); setValue(defaultValue); cm.setCursor(cm.lineCount(), 0); } } } }, [cm, defaultValue]); var onActionCallback = Object(external_window_React_["useCallback"])(function (actionName) { var cursor = cm.getCursor(); var selection = cm.getSelection(); var selectionText = selection.split('\n'); switch (actionName) { case 'bold': cm.replaceSelection('**' + selection + '**'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 2); } return cm.focus(); case 'italic': cm.replaceSelection('*' + selection + '*'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 1); } return cm.focus(); case 'code': cm.replaceSelection('`' + selection + '`'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 1); } return cm.focus(); case 'inline-latex': cm.replaceSelection('`$$' + selection + '$$`'); if (selection === '') { cm.setCursor(cursor.line, cursor.ch + 3); } return cm.focus(); case 'latex': cm.replaceSelection("```latex\n" + selection + "\n```"); cm.setCursor(cursor.line + 1, selection.length + 1); return cm.focus(); case 'line-break': cm.replaceSelection('
* For a fairly comprehensive set of languages see the * README * file that came with this source. At a minimum, the lexer should work on a * number of languages including C and friends, Java, Python, Bash, SQL, HTML, * XML, CSS, Javascript, and Makefiles. It works passably on Ruby, PHP and Awk * and a subset of Perl, but, because of commenting conventions, doesn't work on * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class. *
* Usage:
} and {@code } tags in your source with
* {@code class=prettyprint.}
* You can also use the (html deprecated) {@code } tag, but the pretty
* printer needs to do more substantial DOM manipulations to support that, so
* some css styles may not be preserved.
* } or {@code } element to specify the
* language, as in {@code }. Any class that
* starts with "lang-" followed by a file extension, specifies the file type.
* See the "lang-*.js" files in this directory for code that implements
* per-language file handlers.
*
* Change log:
* cbeust, 2006/08/22
*
* Java annotations (start with "@") are now captured as literals ("lit")
*
* @requires console
*/
// JSLint declarations
/*global console, document, navigator, setTimeout, window, define */
/**
* @typedef {!Array.}
* Alternating indices and the decorations that should be inserted there.
* The indices are monotonically increasing.
*/
var DecorationsT;
/**
* @typedef {!{
* sourceNode: !Element,
* pre: !(number|boolean),
* langExtension: ?string,
* numberLines: ?(number|boolean),
* sourceCode: ?string,
* spans: ?(Array.),
* basePos: ?number,
* decorations: ?DecorationsT
* }}
*
* - sourceNode
- the element containing the source
*
- sourceCode
- source as plain text
*
- pre
- truthy if white-space in text nodes
* should be considered significant.
*
- spans
- alternating span start indices into source
* and the text node or element (e.g. {@code
}) corresponding to that
* span.
* - decorations
- an array of style classes preceded
* by the position at which they start in job.sourceCode in order
*
- basePos
- integer position of this.sourceCode in the larger chunk of
* source.
*
*/
var JobT;
/**
* @typedef {!{
* sourceCode: string,
* spans: !(Array.)
* }}
*
* - sourceCode
- source as plain text
*
- spans
- alternating span start indices into source
* and the text node or element (e.g. {@code
}) corresponding to that
* span.
*
*/
var SourceSpansT;
/** @define {boolean} */
var IN_GLOBAL_SCOPE = false;
var HACK_TO_FIX_JS_INCLUDE_PL;
/**
* {@type !{
* 'createSimpleLexer': function (Array, Array): (function (JobT)),
* 'registerLangHandler': function (function (JobT), Array.),
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_NAME': string,
* 'PR_ATTRIB_VALUE': string,
* 'PR_COMMENT': string,
* 'PR_DECLARATION': string,
* 'PR_KEYWORD': string,
* 'PR_LITERAL': string,
* 'PR_NOCODE': string,
* 'PR_PLAIN': string,
* 'PR_PUNCTUATION': string,
* 'PR_SOURCE': string,
* 'PR_STRING': string,
* 'PR_TAG': string,
* 'PR_TYPE': string,
* 'prettyPrintOne': function (string, string, number|boolean),
* 'prettyPrint': function (?function, ?(HTMLElement|HTMLDocument))
* }}
* @const
*/
var PR;
/**
* Split {@code prettyPrint} into multiple timeouts so as not to interfere with
* UI events.
* If set to {@code false}, {@code prettyPrint()} is synchronous.
*/
window['PR_SHOULD_USE_CONTINUATION'] = true;
/**
* Pretty print a chunk of code.
* @param {string} sourceCodeHtml The HTML to pretty print.
* @param {string} opt_langExtension The language name to use.
* Typically, a filename extension like 'cpp' or 'java'.
* @param {number|boolean} opt_numberLines True to number lines,
* or the 1-indexed number of the first line in sourceCodeHtml.
* @return {string} code as html, but prettier
*/
var prettyPrintOne;
/**
* Find all the {@code } and {@code } tags in the DOM with
* {@code class=prettyprint} and prettify them.
*
* @param {Function} opt_whenDone called when prettifying is done.
* @param {HTMLElement|HTMLDocument} opt_root an element or document
* containing all the elements to pretty print.
* Defaults to {@code document.body}.
*/
var prettyPrint;
(function () {
var win = window;
// Keyword lists for various languages.
// We use things that coerce to strings to make them compact when minified
// and to defeat aggressive optimizers that fold large string constants.
var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," +
"double,enum,extern,float,goto,inline,int,long,register,restrict,short,signed," +
"sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
"new,operator,private,protected,public,this,throw,true,try,typeof"];
var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignas,alignof,align_union,asm,axiom,bool," +
"concept,concept_map,const_cast,constexpr,decltype,delegate," +
"dynamic_cast,explicit,export,friend,generic,late_check," +
"mutable,namespace,noexcept,noreturn,nullptr,property,reinterpret_cast,static_assert," +
"static_cast,template,typeid,typename,using,virtual,where"];
var JAVA_KEYWORDS = [COMMON_KEYWORDS,
"abstract,assert,boolean,byte,extends,finally,final,implements,import," +
"instanceof,interface,null,native,package,strictfp,super,synchronized," +
"throws,transient"];
var CSHARP_KEYWORDS = [COMMON_KEYWORDS,
"abstract,add,alias,as,ascending,async,await,base,bool,by,byte,checked,decimal,delegate,descending," +
"dynamic,event,finally,fixed,foreach,from,get,global,group,implicit,in,interface," +
"internal,into,is,join,let,lock,null,object,out,override,orderby,params," +
"partial,readonly,ref,remove,sbyte,sealed,select,set,stackalloc,string,select,uint,ulong," +
"unchecked,unsafe,ushort,value,var,virtual,where,yield"];
var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
"for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
"throw,true,try,unless,until,when,while,yes";
var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
"abstract,async,await,constructor,debugger,enum,eval,export,function," +
"get,implements,instanceof,interface,let,null,set,undefined,var,with," +
"yield,Infinity,NaN"];
var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
"goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
"sub,undef,unless,until,use,wantarray,while,BEGIN,END";
var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
"elif,except,exec,finally,from,global,import,in,is,lambda," +
"nonlocal,not,or,pass,print,raise,try,with,yield," +
"False,True,None"];
var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
"rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
"BEGIN,END"];
var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
"function,in,local,set,then,until"];
var ALL_KEYWORDS = [
CPP_KEYWORDS, CSHARP_KEYWORDS, JAVA_KEYWORDS, JSCRIPT_KEYWORDS,
PERL_KEYWORDS, PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
var C_TYPES = /^(DIR|FILE|array|vector|(de|priority_)?queue|(forward_)?list|stack|(const_)?(reverse_)?iterator|(unordered_)?(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
// token style names. correspond to css classes
/**
* token style for a string literal
* @const
*/
var PR_STRING = 'str';
/**
* token style for a keyword
* @const
*/
var PR_KEYWORD = 'kwd';
/**
* token style for a comment
* @const
*/
var PR_COMMENT = 'com';
/**
* token style for a type
* @const
*/
var PR_TYPE = 'typ';
/**
* token style for a literal value. e.g. 1, null, true.
* @const
*/
var PR_LITERAL = 'lit';
/**
* token style for a punctuation string.
* @const
*/
var PR_PUNCTUATION = 'pun';
/**
* token style for plain text.
* @const
*/
var PR_PLAIN = 'pln';
/**
* token style for an sgml tag.
* @const
*/
var PR_TAG = 'tag';
/**
* token style for a markup declaration such as a DOCTYPE.
* @const
*/
var PR_DECLARATION = 'dec';
/**
* token style for embedded source.
* @const
*/
var PR_SOURCE = 'src';
/**
* token style for an sgml attribute name.
* @const
*/
var PR_ATTRIB_NAME = 'atn';
/**
* token style for an sgml attribute value.
* @const
*/
var PR_ATTRIB_VALUE = 'atv';
/**
* A class that indicates a section of markup that is not code, e.g. to allow
* embedding of line numbers within code listings.
* @const
*/
var PR_NOCODE = 'nocode';
/**
* A set of tokens that can precede a regular expression literal in
* javascript
* http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
* has the full list, but I've removed ones that might be problematic when
* seen in languages that don't support regular expression literals.
*
* Specifically, I've removed any keywords that can't precede a regexp
* literal in a syntactically legal javascript program, and I've removed the
* "in" keyword since it's not a keyword in many languages, and might be used
* as a count of inches.
*
*
The link above does not accurately describe EcmaScript rules since
* it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
* very well in practice.
*
* @private
* @const
*/
var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
// CAVEAT: this does not properly handle the case where a regular
// expression immediately follows another since a regular expression may
// have flags for case-sensitivity and the like. Having regexp tokens
// adjacent is not valid in any language I'm aware of, so I'm punting.
// TODO: maybe style special characters inside a regexp as punctuation.
/**
* Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
* matches the union of the sets of strings matched by the input RegExp.
* Since it matches globally, if the input strings have a start-of-input
* anchor (/^.../), it is ignored for the purposes of unioning.
* @param {Array.} regexs non multiline, non-global regexs.
* @return {RegExp} a global regex.
*/
function combinePrefixPatterns(regexs) {
var capturedGroupIndex = 0;
var needToFoldCase = false;
var ignoreCase = false;
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.ignoreCase) {
ignoreCase = true;
} else if (/[a-z]/i.test(regex.source.replace(
/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
needToFoldCase = true;
ignoreCase = false;
break;
}
}
var escapeCharToCodeUnit = {
'b': 8,
't': 9,
'n': 0xa,
'v': 0xb,
'f': 0xc,
'r': 0xd
};
function decodeEscape(charsetPart) {
var cc0 = charsetPart.charCodeAt(0);
if (cc0 !== 92 /* \\ */) {
return cc0;
}
var c1 = charsetPart.charAt(1);
cc0 = escapeCharToCodeUnit[c1];
if (cc0) {
return cc0;
} else if ('0' <= c1 && c1 <= '7') {
return parseInt(charsetPart.substring(1), 8);
} else if (c1 === 'u' || c1 === 'x') {
return parseInt(charsetPart.substring(2), 16);
} else {
return charsetPart.charCodeAt(1);
}
}
function encodeEscape(charCode) {
if (charCode < 0x20) {
return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
}
var ch = String.fromCharCode(charCode);
return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
? "\\" + ch : ch;
}
function caseFoldCharset(charSet) {
var charsetParts = charSet.substring(1, charSet.length - 1).match(
new RegExp(
'\\\\u[0-9A-Fa-f]{4}'
+ '|\\\\x[0-9A-Fa-f]{2}'
+ '|\\\\[0-3][0-7]{0,2}'
+ '|\\\\[0-7]{1,2}'
+ '|\\\\[\\s\\S]'
+ '|-'
+ '|[^-\\\\]',
'g'));
var ranges = [];
var inverse = charsetParts[0] === '^';
var out = ['['];
if (inverse) { out.push('^'); }
for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
var p = charsetParts[i];
if (/\\[bdsw]/i.test(p)) { // Don't muck with named groups.
out.push(p);
} else {
var start = decodeEscape(p);
var end;
if (i + 2 < n && '-' === charsetParts[i + 1]) {
end = decodeEscape(charsetParts[i + 2]);
i += 2;
} else {
end = start;
}
ranges.push([start, end]);
// If the range might intersect letters, then expand it.
// This case handling is too simplistic.
// It does not deal with non-latin case folding.
// It works for latin source code identifiers though.
if (!(end < 65 || start > 122)) {
if (!(end < 65 || start > 90)) {
ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
}
if (!(end < 97 || start > 122)) {
ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
}
}
}
}
// [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
// -> [[1, 12], [14, 14], [16, 17]]
ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1] - a[1]); });
var consolidatedRanges = [];
var lastRange = [];
for (var i = 0; i < ranges.length; ++i) {
var range = ranges[i];
if (range[0] <= lastRange[1] + 1) {
lastRange[1] = Math.max(lastRange[1], range[1]);
} else {
consolidatedRanges.push(lastRange = range);
}
}
for (var i = 0; i < consolidatedRanges.length; ++i) {
var range = consolidatedRanges[i];
out.push(encodeEscape(range[0]));
if (range[1] > range[0]) {
if (range[1] + 1 > range[0]) { out.push('-'); }
out.push(encodeEscape(range[1]));
}
}
out.push(']');
return out.join('');
}
function allowAnywhereFoldCaseAndRenumberGroups(regex) {
// Split into character sets, escape sequences, punctuation strings
// like ('(', '(?:', ')', '^'), and runs of characters that do not
// include any of the above.
var parts = regex.source.match(
new RegExp(
'(?:'
+ '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]' // a character set
+ '|\\\\u[A-Fa-f0-9]{4}' // a unicode escape
+ '|\\\\x[A-Fa-f0-9]{2}' // a hex escape
+ '|\\\\[0-9]+' // a back-reference or octal escape
+ '|\\\\[^ux0-9]' // other escape sequence
+ '|\\(\\?[:!=]' // start of a non-capturing group
+ '|[\\(\\)\\^]' // start/end of a group, or line start
+ '|[^\\x5B\\x5C\\(\\)\\^]+' // run of other characters
+ ')',
'g'));
var n = parts.length;
// Maps captured group numbers to the number they will occupy in
// the output or to -1 if that has not been determined, or to
// undefined if they need not be capturing in the output.
var capturedGroups = [];
// Walk over and identify back references to build the capturedGroups
// mapping.
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
// groups are 1-indexed, so max group index is count of '('
++groupIndex;
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue) {
if (decimalValue <= groupIndex) {
capturedGroups[decimalValue] = -1;
} else {
// Replace with an unambiguous escape sequence so that
// an octal escape sequence does not turn into a backreference
// to a capturing group from an earlier regex.
parts[i] = encodeEscape(decimalValue);
}
}
}
}
// Renumber groups and reduce capturing groups to non-capturing groups
// where possible.
for (var i = 1; i < capturedGroups.length; ++i) {
if (-1 === capturedGroups[i]) {
capturedGroups[i] = ++capturedGroupIndex;
}
}
for (var i = 0, groupIndex = 0; i < n; ++i) {
var p = parts[i];
if (p === '(') {
++groupIndex;
if (!capturedGroups[groupIndex]) {
parts[i] = '(?:';
}
} else if ('\\' === p.charAt(0)) {
var decimalValue = +p.substring(1);
if (decimalValue && decimalValue <= groupIndex) {
parts[i] = '\\' + capturedGroups[decimalValue];
}
}
}
// Remove any prefix anchors so that the output will match anywhere.
// ^^ really does mean an anchored match though.
for (var i = 0; i < n; ++i) {
if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
}
// Expand letters to groups to handle mixing of case-sensitive and
// case-insensitive patterns if necessary.
if (regex.ignoreCase && needToFoldCase) {
for (var i = 0; i < n; ++i) {
var p = parts[i];
var ch0 = p.charAt(0);
if (p.length >= 2 && ch0 === '[') {
parts[i] = caseFoldCharset(p);
} else if (ch0 !== '\\') {
// TODO: handle letters in numeric escapes.
parts[i] = p.replace(
/[a-zA-Z]/g,
function (ch) {
var cc = ch.charCodeAt(0);
return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
});
}
}
}
return parts.join('');
}
var rewritten = [];
for (var i = 0, n = regexs.length; i < n; ++i) {
var regex = regexs[i];
if (regex.global || regex.multiline) { throw new Error('' + regex); }
rewritten.push(
'(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
}
return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
}
/**
* Split markup into a string of source code and an array mapping ranges in
* that string to the text nodes in which they appear.
*
*
* The HTML DOM structure:
*
* (Element "p"
* (Element "b"
* (Text "print ")) ; #1
* (Text "'Hello '") ; #2
* (Element "br") ; #3
* (Text " + 'World';")) ; #4
*
*
* corresponds to the HTML
* {@code
print 'Hello '
+ 'World';
}.
*
*
* It will produce the output:
*
* {
* sourceCode: "print 'Hello '\n + 'World';",
* // 1 2
* // 012345678901234 5678901234567
* spans: [0, #1, 6, #2, 14, #3, 15, #4]
* }
*
*
* where #1 is a reference to the {@code "print "} text node above, and so
* on for the other text nodes.
*
*
*
* The {@code} spans array is an array of pairs. Even elements are the start
* indices of substrings, and odd elements are the text nodes (or BR elements)
* that contain the text for those substrings.
* Substrings continue until the next index or the end of the source.
*
*
* @param {Node} node an HTML DOM subtree containing source-code.
* @param {boolean|number} isPreformatted truthy if white-space in
* text nodes should be considered significant.
* @return {SourceSpansT} source code and the nodes in which they occur.
*/
function extractSourceSpans(node, isPreformatted) {
var nocode = /(?:^|\s)nocode(?:\s|$)/;
var chunks = [];
var length = 0;
var spans = [];
var k = 0;
function walk(node) {
var type = node.nodeType;
if (type == 1) { // Element
if (nocode.test(node.className)) { return; }
for (var child = node.firstChild; child; child = child.nextSibling) {
walk(child);
}
var nodeName = node.nodeName.toLowerCase();
if ('br' === nodeName || 'li' === nodeName) {
chunks[k] = '\n';
spans[k << 1] = length++;
spans[(k++ << 1) | 1] = node;
}
} else if (type == 3 || type == 4) { // Text
var text = node.nodeValue;
if (text.length) {
if (!isPreformatted) {
text = text.replace(/[ \t\r\n]+/g, ' ');
} else {
text = text.replace(/\r\n?/g, '\n'); // Normalize newlines.
}
// TODO: handle tabs here?
chunks[k] = text;
spans[k << 1] = length;
length += text.length;
spans[(k++ << 1) | 1] = node;
}
}
}
walk(node);
return {
sourceCode: chunks.join('').replace(/\n$/, ''),
spans: spans
};
}
/**
* Apply the given language handler to sourceCode and add the resulting
* decorations to out.
* @param {!Element} sourceNode
* @param {number} basePos the index of sourceCode within the chunk of source
* whose decorations are already present on out.
* @param {string} sourceCode
* @param {function(JobT)} langHandler
* @param {DecorationsT} out
*/
function appendDecorations(
sourceNode, basePos, sourceCode, langHandler, out) {
if (!sourceCode) { return; }
/** @type {JobT} */
var job = {
sourceNode: sourceNode,
pre: 1,
langExtension: null,
numberLines: null,
sourceCode: sourceCode,
spans: null,
basePos: basePos,
decorations: null
};
langHandler(job);
out.push.apply(out, job.decorations);
}
var notWs = /\S/;
/**
* Given an element, if it contains only one child element and any text nodes
* it contains contain only space characters, return the sole child element.
* Otherwise returns undefined.
*
* This is meant to return the CODE element in {@code
} when
* there is a single child element that contains all the non-space textual
* content, but not to return anything where there are multiple child elements
* as in {@code ......
} or when there
* is textual content.
*/
function childContentWrapper(element) {
var wrapper = undefined;
for (var c = element.firstChild; c; c = c.nextSibling) {
var type = c.nodeType;
wrapper = (type === 1) // Element Node
? (wrapper ? element : c)
: (type === 3) // Text Node
? (notWs.test(c.nodeValue) ? element : wrapper)
: wrapper;
}
return wrapper === element ? undefined : wrapper;
}
/** Given triples of [style, pattern, context] returns a lexing function,
* The lexing function interprets the patterns to find token boundaries and
* returns a decoration list of the form
* [index_0, style_0, index_1, style_1, ..., index_n, style_n]
* where index_n is an index into the sourceCode, and style_n is a style
* constant like PR_PLAIN. index_n-1 <= index_n, and style_n-1 applies to
* all characters in sourceCode[index_n-1:index_n].
*
* The stylePatterns is a list whose elements have the form
* [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
*
* Style is a style constant like PR_PLAIN, or can be a string of the
* form 'lang-FOO', where FOO is a language extension describing the
* language of the portion of the token in $1 after pattern executes.
* E.g., if style is 'lang-lisp', and group 1 contains the text
* '(hello (world))', then that portion of the token will be passed to the
* registered lisp handler for formatting.
* The text before and after group 1 will be restyled using this decorator
* so decorators should take care that this doesn't result in infinite
* recursion. For example, the HTML lexer rule for SCRIPT elements looks
* something like ['lang-js', /<[s]cript>(.+?)<\/script>/]. This may match
* '