1
|
{"version":3,"sources":["webpack:///./node_modules/highlight.js/lib/languages/typescript.js"],"names":["IDENT_RE","KEYWORDS","LITERALS","BUILT_INS","concat","source","re","lookahead","args","joined","map","x","join","module","exports","hljs","KEYWORDS$1","$pattern","keyword","literal","built_in","DECORATOR","className","begin","swapMode","mode","label","replacement","indx","contains","findIndex","m","Error","splice","tsLanguage","IDENT_RE$1","FRAGMENT","XML_TAG","end","isTrulyOpeningTag","match","response","afterMatchIndex","length","index","nextChar","input","after","tag","slice","indexOf","hasClosingTag","ignoreMatch","frac","NUMBER","variants","relevance","SUBST","keywords","HTML_TEMPLATE","starts","returnEnd","BACKSLASH_ESCAPE","subLanguage","CSS_TEMPLATE","TEMPLATE_STRING","COMMENT","endsParent","C_BLOCK_COMMENT_MODE","C_LINE_COMMENT_MODE","SUBST_INTERNALS","APOS_STRING_MODE","QUOTE_STRING_MODE","REGEXP_MODE","SUBST_AND_COMMENTS","PARAMS_CONTAINS","PARAMS","excludeBegin","excludeEnd","name","aliases","illegal","SHEBANG","binary","RE_STARTERS_RE","UNDERSCORE_IDENT_RE","returnBegin","skip","beginKeywords","inherit","TITLE_MODE","UNDERSCORE_TITLE_MODE","javascript","Object","assign","push","find"],"mappings":"oGAAA,IAAMA,EAAW,2BACXC,EAAW,CACf,KACA,KACA,KACA,KACA,MACA,QACA,UACA,MACA,MACA,WACA,KACA,SACA,OACA,OACA,QACA,QACA,aACA,OACA,QACA,OACA,UACA,MACA,SACA,WACA,SACA,SACA,MACA,QACA,QACA,QAIA,WACA,QACA,QACA,SACA,SACA,OACA,SACA,WAEIC,EAAW,CACf,OACA,QACA,OACA,YACA,MACA,YAiFIC,EAAY,GAAGC,OAlCI,CACvB,cACA,aACA,gBACA,eAEA,UACA,UAEA,OACA,WACA,QACA,aACA,WACA,YACA,qBACA,YACA,qBACA,SACA,YAGyB,CACzB,YACA,OACA,QACA,UACA,SACA,WACA,eACA,SACA,UA3EY,CACZ,OACA,WACA,SACA,OACA,OACA,SACA,SAC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CACErD,MAAO,mBAAqBY,EAAa,OACzCG,IAAK,KACLoB,SAAU,UACV7B,SAAU,CACRd,EAAK0E,QAAQ1E,EAAK2E,WAAY,CAAEnE,MAAOY,IACvC,CAAEZ,MAAO,QACTqD,IAGJ,CACErD,MAAO,YAsEMqE,CAAW7E,GA0B9B,OAtBA8E,OAAOC,OAAO5D,EAAWwB,SAAU1C,GAEnCkB,EAAWpB,QAAQ6D,gBAAgBoB,KAAK1E,GACxCa,EAAWL,SAAWK,EAAWL,SAASzB,OAAO,CAC/CiB,EA5DgB,CAChBmE,cAAe,YAAalD,IAAK,KAAMwC,YAAY,GAEnC,CAChBU,cAAe,YAAalD,IAAK,KAAMwC,YAAY,EACnDpB,SAAU,uBA6DZlC,EAASU,EAAY,UAAWnB,EAAKmE,WAErC1D,EAASU,EAAY,aA7DF,CACjBZ,UAAW,OACXkC,UAAW,GACXjC,MAAO,2BA4DmBW,EAAWL,SAASmE,MAAK,SAAAjE,GAAC,MAAoB,aAAhBA,EAAET,aACxCkC,UAAY,EAEhCqC,OAAOC,OAAO5D,EAAY,CACxB6C,KAAM,aACNC,QAAS,CAAC,QAGL9C","file":"highlight/typescript.js?v=8d54a8fd30585fe6de69","sourcesContent":["const IDENT_RE = '[A-Za-z$_][0-9A-Za-z$_]*';\nconst KEYWORDS = [\n \"as\", // for exports\n \"in\",\n \"of\",\n \"if\",\n \"for\",\n \"while\",\n \"finally\",\n \"var\",\n \"new\",\n \"function\",\n \"do\",\n \"return\",\n \"void\",\n \"else\",\n \"break\",\n \"catch\",\n \"instanceof\",\n \"with\",\n \"throw\",\n \"case\",\n \"default\",\n \"try\",\n \"switch\",\n \"continue\",\n \"typeof\",\n \"delete\",\n \"let\",\n \"yield\",\n \"const\",\n \"class\",\n // JS handles these with a special rule\n // \"get\",\n // \"set\",\n \"debugger\",\n \"async\",\n \"await\",\n \"static\",\n \"import\",\n \"from\",\n \"export\",\n \"extends\"\n];\nconst LITERALS = [\n \"true\",\n \"false\",\n \"null\",\n \"undefined\",\n \"NaN\",\n \"Infinity\"\n];\n\nconst TYPES = [\n \"Intl\",\n \"DataView\",\n \"Number\",\n \"Math\",\n \"Date\",\n \"String\",\n \"RegExp\",\n \"Object\",\n \"Function\",\n \"Boolean\",\n \"Error\",\n \"Symbol\",\n \"Set\",\n \"Map\",\n \"WeakSet\",\n \"WeakMap\",\n \"Proxy\",\n \"Reflect\",\n \"JSON\",\n \"Promise\",\n \"Float64Array\",\n \"Int16Array\",\n \"Int32Array\",\n \"Int8Array\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"Float32Array\",\n \"Array\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"ArrayBuffer\"\n];\n\nconst ERROR_TYPES = [\n \"EvalError\",\n \"InternalError\",\n \"RangeError\",\n \"ReferenceError\",\n \"SyntaxError\",\n \"TypeError\",\n \"URIError\"\n];\n\nconst BUILT_IN_GLOBALS = [\n \"setInterval\",\n \"setTimeout\",\n \"clearInterval\",\n \"clearTimeout\",\n\n \"require\",\n \"exports\",\n\n \"eval\",\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n \"escape\",\n \"unescape\"\n];\n\nconst BUILT_IN_VARIABLES = [\n \"arguments\",\n \"this\",\n \"super\",\n \"console\",\n \"window\",\n \"document\",\n \"localStorage\",\n \"module\",\n \"global\" // Node.js\n];\n\nconst BUILT_INS = [].concat(\n BUILT_IN_GLOBALS,\n BUILT_IN_VARIABLES,\n TYPES,\n ERROR_TYPES\n);\n\n/**\n * @param {string} value\n * @returns {RegExp}\n * */\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction source(re) {\n if (!re) return null;\n if (typeof re === \"string\") return re;\n\n return re.source;\n}\n\n/**\n * @param {RegExp | string } re\n * @returns {string}\n */\nfunction lookahead(re) {\n return concat('(?=', re, ')');\n}\n\n/**\n * @param {...(RegExp | string) } args\n * @returns {string}\n */\nfunction concat(...args) {\n const joined = args.map((x) => source(x)).join(\"\");\n return joined;\n}\n\n/*\nLanguage: JavaScript\nDescription: JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions.\nCategory: common, scripting\nWebsite: https://developer.mozilla.org/en-US/docs/Web/JavaScript\n*/\n\n/** @type LanguageFn */\nfunction javascript(hljs) {\n /**\n * Takes a string like \"<Booger\" and checks to see\n * if we can find a matching \"</Booger\" later in the\n * content.\n * @param {RegExpMatchArray} match\n * @param {{after:number}} param1\n */\n const hasClosingTag = (match, { after }) => {\n const tag = \"</\" + match[0].slice(1);\n const pos = match.input.indexOf(tag, after);\n return pos !== -1;\n };\n\n const IDENT_RE$1 = IDENT_RE;\n const FRAGMENT = {\n begin: '<>',\n end: '</>'\n };\n const XML_TAG = {\n begin: /<[A-Za-z0-9\\\\._:-]+/,\n end: /\\/[A-Za-z0-9\\\\._:-]+>|\\/>/,\n /**\n * @param {RegExpMatchArray} match\n * @param {CallbackResponse} response\n */\n isTrulyOpeningTag: (match, response) => {\n const afterMatchIndex = match[0].length + match.index;\n const nextChar = match.input[afterMatchIndex];\n // nested type?\n // HTML should not include another raw `<` inside a tag\n // But a type might: `<Array<Array<number>>`, etc.\n if (nextChar === \"<\") {\n response.ignoreMatch();\n return;\n }\n // <something>\n // This is now either a tag or a type.\n if (nextChar === \">\") {\n // if we cannot find a matching closing tag, then we\n // will ignore it\n if (!hasClosingTag(match, { after: afterMatchIndex })) {\n response.ignoreMatch();\n }\n }\n }\n };\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.join(\" \"),\n literal: LITERALS.join(\" \"),\n built_in: BUILT_INS.join(\" \")\n };\n\n // https://tc39.es/ecma262/#sec-literals-numeric-literals\n const decimalDigits = '[0-9](_?[0-9])*';\n const frac = `\\\\.(${decimalDigits})`;\n // DecimalIntegerLiteral, including Annex B NonOctalDecimalIntegerLiteral\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n const decimalInteger = `0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`;\n const NUMBER = {\n className: 'number',\n variants: [\n // DecimalLiteral\n { begin: `(\\\\b(${decimalInteger})((${frac})|\\\\.)?|(${frac}))` +\n `[eE][+-]?(${decimalDigits})\\\\b` },\n { begin: `\\\\b(${decimalInteger})\\\\b((${frac})\\\\b|\\\\.)?|(${frac})\\\\b` },\n\n // DecimalBigIntegerLiteral\n { begin: `\\\\b(0|[1-9](_?[0-9])*)n\\\\b` },\n\n // NonDecimalIntegerLiteral\n { begin: \"\\\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\\\b\" },\n { begin: \"\\\\b0[bB][0-1](_?[0-1])*n?\\\\b\" },\n { begin: \"\\\\b0[oO][0-7](_?[0-7])*n?\\\\b\" },\n\n // LegacyOctalIntegerLiteral (does not include underscore separators)\n // https://tc39.es/ecma262/#sec-additional-syntax-numeric-literals\n { begin: \"\\\\b0[0-7]+n?\\\\b\" },\n ],\n relevance: 0\n };\n\n const SUBST = {\n className: 'subst',\n begin: '\\\\$\\\\{',\n end: '\\\\}',\n keywords: KEYWORDS$1,\n contains: [] // defined later\n };\n const HTML_TEMPLATE = {\n begin: 'html`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'xml'\n }\n };\n const CSS_TEMPLATE = {\n begin: 'css`',\n end: '',\n starts: {\n end: '`',\n returnEnd: false,\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ],\n subLanguage: 'css'\n }\n };\n const TEMPLATE_STRING = {\n className: 'string',\n begin: '`',\n end: '`',\n contains: [\n hljs.BACKSLASH_ESCAPE,\n SUBST\n ]\n };\n const JSDOC_COMMENT = hljs.COMMENT(\n '/\\\\*\\\\*',\n '\\\\*/',\n {\n relevance: 0,\n contains: [\n {\n className: 'doctag',\n begin: '@[A-Za-z]+',\n contains: [\n {\n className: 'type',\n begin: '\\\\{',\n end: '\\\\}',\n relevance: 0\n },\n {\n className: 'variable',\n begin: IDENT_RE$1 + '(?=\\\\s*(-)|$)',\n endsParent: true,\n relevance: 0\n },\n // eat spaces (not newlines) so we can find\n // types or variables\n {\n begin: /(?=[^\\n])\\s/,\n relevance: 0\n }\n ]\n }\n ]\n }\n );\n const COMMENT = {\n className: \"comment\",\n variants: [\n JSDOC_COMMENT,\n hljs.C_BLOCK_COMMENT_MODE,\n hljs.C_LINE_COMMENT_MODE\n ]\n };\n const SUBST_INTERNALS = [\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n TEMPLATE_STRING,\n NUMBER,\n hljs.REGEXP_MODE\n ];\n SUBST.contains = SUBST_INTERNALS\n .concat({\n // we need to pair up {} inside our subst to prevent\n // it from ending too early by matching another }\n begin: /\\{/,\n end: /\\}/,\n keywords: KEYWORDS$1,\n contains: [\n \"self\"\n ].concat(SUBST_INTERNALS)\n });\n const SUBST_AND_COMMENTS = [].concat(COMMENT, SUBST.contains);\n const PARAMS_CONTAINS = SUBST_AND_COMMENTS.concat([\n // eat recursive parens in sub expressions\n {\n begin: /\\(/,\n end: /\\)/,\n keywords: KEYWORDS$1,\n contains: [\"self\"].concat(SUBST_AND_COMMENTS)\n }\n ]);\n const PARAMS = {\n className: 'params',\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n };\n\n return {\n name: 'Javascript',\n aliases: ['js', 'jsx', 'mjs', 'cjs'],\n keywords: KEYWORDS$1,\n // this will be extended by TypeScript\n exports: { PARAMS_CONTAINS },\n illegal: /#(?![$_A-z])/,\n contains: [\n hljs.SHEBANG({\n label: \"shebang\",\n binary: \"node\",\n relevance: 5\n }),\n {\n label: \"use_strict\",\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use (strict|asm)['\"]/\n },\n hljs.APOS_STRING_MODE,\n hljs.QUOTE_STRING_MODE,\n HTML_TEMPLATE,\n CSS_TEMPLATE,\n TEMPLATE_STRING,\n COMMENT,\n NUMBER,\n { // object attr container\n begin: concat(/[{,\\n]\\s*/,\n // we need to look ahead to make sure that we actually have an\n // attribute coming up so we don't steal a comma from a potential\n // \"value\" container\n //\n // NOTE: this might not work how you think. We don't actually always\n // enter this mode and stay. Instead it might merely match `,\n // <comments up next>` and then immediately end after the , because it\n // fails to find any actual attrs. But this still does the job because\n // it prevents the value contain rule from grabbing this instead and\n // prevening this rule from firing when we actually DO have keys.\n lookahead(concat(\n // we also need to allow for multiple possible comments inbetween\n // the first key:value pairing\n /(((\\/\\/.*$)|(\\/\\*(\\*[^/]|[^*])*\\*\\/))\\s*)*/,\n IDENT_RE$1 + '\\\\s*:'))),\n relevance: 0,\n contains: [\n {\n className: 'attr',\n begin: IDENT_RE$1 + lookahead('\\\\s*:'),\n relevance: 0\n }\n ]\n },\n { // \"value\" container\n begin: '(' + hljs.RE_STARTERS_RE + '|\\\\b(case|return|throw)\\\\b)\\\\s*',\n keywords: 'return throw case',\n contains: [\n COMMENT,\n hljs.REGEXP_MODE,\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the\n // correct bounding ( ) before the =>. There could be any number of\n // sub-expressions inside also surrounded by parens.\n begin: '(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)|' + hljs.UNDERSCORE_IDENT_RE + ')\\\\s*=>',\n returnBegin: true,\n end: '\\\\s*=>',\n contains: [\n {\n className: 'params',\n variants: [\n {\n begin: hljs.UNDERSCORE_IDENT_RE,\n relevance: 0\n },\n {\n className: null,\n begin: /\\(\\s*\\)/,\n skip: true\n },\n {\n begin: /\\(/,\n end: /\\)/,\n excludeBegin: true,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: PARAMS_CONTAINS\n }\n ]\n }\n ]\n },\n { // could be a comma delimited list of params to a function call\n begin: /,/, relevance: 0\n },\n {\n className: '',\n begin: /\\s/,\n end: /\\s*/,\n skip: true\n },\n { // JSX\n variants: [\n { begin: FRAGMENT.begin, end: FRAGMENT.end },\n {\n begin: XML_TAG.begin,\n // we carefully check the opening tag to see if it truly\n // is a tag and not a false positive\n 'on:begin': XML_TAG.isTrulyOpeningTag,\n end: XML_TAG.end\n }\n ],\n subLanguage: 'xml',\n contains: [\n {\n begin: XML_TAG.begin,\n end: XML_TAG.end,\n skip: true,\n contains: ['self']\n }\n ]\n }\n ],\n relevance: 0\n },\n {\n className: 'function',\n beginKeywords: 'function',\n end: /[{;]/,\n excludeEnd: true,\n keywords: KEYWORDS$1,\n contains: [\n 'self',\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),\n PARAMS\n ],\n illegal: /%/\n },\n {\n // prevent this from getting swallowed up by function\n // since they appear \"function like\"\n beginKeywords: \"while if switch catch for\"\n },\n {\n className: 'function',\n // we have to count the parens to make sure we actually have the correct\n // bounding ( ). There could be any number of sub-expressions inside\n // also surrounded by parens.\n begin: hljs.UNDERSCORE_IDENT_RE +\n '\\\\(' + // first parens\n '[^()]*(\\\\(' +\n '[^()]*(\\\\(' +\n '[^()]*' +\n '\\\\)[^()]*)*' +\n '\\\\)[^()]*)*' +\n '\\\\)\\\\s*\\\\{', // end parens\n returnBegin:true,\n contains: [\n PARAMS,\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),\n ]\n },\n // hack: prevents detection of keywords in some circumstances\n // .keyword()\n // $keyword = x\n {\n variants: [\n { begin: '\\\\.' + IDENT_RE$1 },\n { begin: '\\\\$' + IDENT_RE$1 }\n ],\n relevance: 0\n },\n { // ES6 class\n className: 'class',\n beginKeywords: 'class',\n end: /[{;=]/,\n excludeEnd: true,\n illegal: /[:\"[\\]]/,\n contains: [\n { beginKeywords: 'extends' },\n hljs.UNDERSCORE_TITLE_MODE\n ]\n },\n {\n begin: /\\b(?=constructor)/,\n end: /[{;]/,\n excludeEnd: true,\n contains: [\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),\n 'self',\n PARAMS\n ]\n },\n {\n begin: '(get|set)\\\\s+(?=' + IDENT_RE$1 + '\\\\()',\n end: /\\{/,\n keywords: \"get set\",\n contains: [\n hljs.inherit(hljs.TITLE_MODE, { begin: IDENT_RE$1 }),\n { begin: /\\(\\)/ }, // eat to avoid empty params\n PARAMS\n ]\n },\n {\n begin: /\\$[(.]/ // relevance booster for a pattern common to JS libs: `$(something)` and `$.something`\n }\n ]\n };\n}\n\n/*\nLanguage: TypeScript\nAuthor: Panu Horsmalahti <panu.horsmalahti@iki.fi>\nContributors: Ike Ku <dempfi@yahoo.com>\nDescription: TypeScript is a strict superset of JavaScript\nWebsite: https://www.typescriptlang.org\nCategory: common, scripting\n*/\n\n/** @type LanguageFn */\nfunction typescript(hljs) {\n const IDENT_RE$1 = IDENT_RE;\n const NAMESPACE = {\n beginKeywords: 'namespace', end: /\\{/, excludeEnd: true\n };\n const INTERFACE = {\n beginKeywords: 'interface', end: /\\{/, excludeEnd: true,\n keywords: 'interface extends'\n };\n const USE_STRICT = {\n className: 'meta',\n relevance: 10,\n begin: /^\\s*['\"]use strict['\"]/\n };\n const TYPES = [\n \"any\",\n \"void\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n \"never\",\n \"enum\"\n ];\n const TS_SPECIFIC_KEYWORDS = [\n \"type\",\n \"namespace\",\n \"typedef\",\n \"interface\",\n \"public\",\n \"private\",\n \"protected\",\n \"implements\",\n \"declare\",\n \"abstract\",\n \"readonly\"\n ];\n const KEYWORDS$1 = {\n $pattern: IDENT_RE,\n keyword: KEYWORDS.concat(TS_SPECIFIC_KEYWORDS).join(\" \"),\n literal: LITERALS.join(\" \"),\n built_in: BUILT_INS.concat(TYPES).join(\" \")\n };\n const DECORATOR = {\n className: 'meta',\n begin: '@' + IDENT_RE$1,\n };\n\n const swapMode = (mode, label, replacement) => {\n const indx = mode.contains.findIndex(m => m.label === label);\n if (indx === -1) { throw new Error(\"can not find mode to replace\"); }\n mode.contains.splice(indx, 1, replacement);\n };\n\n const tsLanguage = javascript(hljs);\n\n // this should update anywhere keywords is used since\n // it will be the same actual JS object\n Object.assign(tsLanguage.keywords, KEYWORDS$1);\n\n tsLanguage.exports.PARAMS_CONTAINS.push(DECORATOR);\n tsLanguage.contains = tsLanguage.contains.concat([\n DECORATOR,\n NAMESPACE,\n INTERFACE,\n ]);\n\n // TS gets a simpler shebang rule than JS\n swapMode(tsLanguage, \"shebang\", hljs.SHEBANG());\n // JS use strict rule purposely excludes `asm` which makes no sense\n swapMode(tsLanguage, \"use_strict\", USE_STRICT);\n\n const functionDeclaration = tsLanguage.contains.find(m => m.className === \"function\");\n functionDeclaration.relevance = 0; // () => {} is more typical in TypeScript\n\n Object.assign(tsLanguage, {\n name: 'TypeScript',\n aliases: ['ts']\n });\n\n return tsLanguage;\n}\n\nmodule.exports = typescript;\n"],"sourceRoot":""}
|