{"version":3,"file":"shiki-twoslash.cjs.production.min.js","sources":["../src/annotations.ts","../src/utils.ts","../src/renderers/plain.ts","../src/renderers/twoslash.ts","../src/renderers/shiki.ts","../src/tsconfig-oneliners.generated.ts","../src/renderers/tsconfig.ts","../src/index.ts"],"sourcesContent":["import { TwoslashError, TwoSlashReturn } from \"@typescript/twoslash\"\n\nexport const htmlForTags = (tags: TwoSlashReturn[\"tags\"]) => {\n let html = \"\"\n tags.forEach(t => {\n if (t.name === \"annotate\" && t.annotation) {\n const meta = t.annotation.split(\" - \")\n const text = meta.pop()\n const info = (meta[0] || \"\").trim()\n const flipped = info.includes(\"right\")\n let settings = {\n flipped,\n arrowRot: flipped ? \"90deg 20px 20px\" : \"90deg 20px 20px\",\n textDegree: \"0deg\",\n top: `${t.line}em`\n }\n \n \n if (info.includes(\"{\")) {\n const theInfo = \"{\" + info.split(\"{\")[1]\n try {\n const specificSettings = JSON.parse(theInfo)\n settings = {...settings, ...specificSettings }\n } catch (error) {\n throw new TwoslashError(\"Could not parse annotation\", `The annotation ${JSON.stringify(t)} could convert '${theInfo}' into JSON`, `Look at ${(error as any).message}.`)\n }\n }\n \n const arrowSVG = arrow(settings)\n\n html += `\n
\n ${arrowSVG}\n

${text}

\n
`\n }\n })\n\n return html\n}\n\nconst arrow = (style: { flipped: boolean; arrowRot: string, textDegree: string, top: string }) => {\n const leftInner = `M27 39C26.5 32.7511 21.9 17.5173 7.5 6.57333M16.5 4.04L0.999999 0.999998C3.16667 4.88444 7.5 13.16 7.5 15.1867`\n const rightInner = `M1 39C1.5 32.7511 6.1 17.5173 20.5 6.57333M11.5 4.04L27 0.999998C24.8333 4.88444 20.5 13.16 20.5 15.1867`\n const inner = style.flipped ? leftInner : rightInner\n const rot = style.arrowRot.split(\" \")\n return `\n \n`\n}\n","import type { parse } from \"fenceparser\"\n\nexport type Meta = NonNullable>\n\ntype Range = {\n begin: number\n end: number\n text?: string\n count?: number\n tooltip?: string[]\n classes?: string\n lsp?: string\n}\n\n/**\n * We're given the text which lives inside the token, and this function will\n * annotate it with twoslash metadata\n */\nexport function createHighlightedString(ranges: Range[], text: string, targetedWord: string = \"\") {\n // Why the weird chars? We need to make sure that generic syntax isn't\n // interpreted as html tags - to do that we need to switch out < to < - *but*\n // making that transition changes the indexes because it's gone from 1 char to 4 chars\n //\n // So, use an obscure character to indicate a real < for HTML, then switch it after\n const tag = (x: string) => `⇍${x}⇏`\n const makeTagFromRange = (r: Range, close?: true) => {\n switch (r.classes) {\n case \"lsp\":\n // The LSP response lives inside a dom attribute, which _can_ have < inside it, so switch them ahead of time.\n const lsp = htmlAttrReplacer(r.lsp || \"\")\n const underLineTargetedWord = r.lsp === targetedWord ? \"style=⇯border-bottom: solid 2px lightgrey;⇯\" : \"\"\n return close ? tag(\"/data-lsp\") : tag(`data-lsp lsp=¿${lsp}¿ ${underLineTargetedWord}`)\n case \"query\":\n return tag(`${close ? \"/\" : \"\"}data-highlight`)\n // handle both unknown and err variant as error-tag\n // case \"err\": is not required, just to be useful for others\n case \"err\":\n default:\n return tag(`${close ? \"/\" : \"\"}data-err`)\n }\n }\n\n ranges.sort((a, b) => {\n // Order of precedence\n // if two same offset meet, the lsp will be put as innermost than err and query\n const precedenceOf = (x?: string) => [\"err\", \"query\", \"lsp\"].indexOf(x ?? \"\")\n\n let cmp = 0\n // Can be desugared into,\n // 1. compare based on smaller begin, !(cmp) means if it's 0 then\n // 2. compare based on bigger end, ^ same thing again then\n // 3. compare based on higher precedence\n // && is so that if a step made cmp to something other than 0, it stops\n /***1*/ !(cmp = a.begin - b.begin) &&\n /*2*/ !(cmp = b.end - a.end) &&\n /*3*/ !(cmp = precedenceOf(a.classes) - precedenceOf(b.classes))\n return cmp\n }) // `Array.sort` works in place\n\n // Marks how much of the text has been put into the output/html\n let cursor = 0\n // should be maximum of O(n) where n is length of ranges\n const nest = (data: typeof ranges) => {\n let stack = \"\"\n const top = data.shift()! // I have made sure data can't be empty\n\n // parse from cursor to top.begin to make sure\n // strings on the way are parsed\n stack += text.substring(cursor, top.begin)\n cursor = top.begin\n\n // open tag\n stack += makeTagFromRange(top)\n\n // if the data still have an element that's in the top's range\n if (data.some(x => x.begin < top.end)) {\n stack += nest(data)\n } else {\n // othewise slice the text and set cursor\n stack += text.substring(top.begin, top.end)\n cursor = top.end\n }\n\n // close tag\n stack += makeTagFromRange(top, true)\n\n // if the tag is complete but still have some data left in the range\n if (data.length !== 0) {\n stack += nest(data)\n }\n\n return stack\n }\n\n // cloned because I don't feel comfortable modifying this as a side-effect from recursion\n const data = JSON.parse(JSON.stringify(ranges))\n const html = nest(data) + text.substring(cursor) // nested + leftover texts\n\n return htmlAttrUnReplacer(replaceTripleArrow(stripHTML(html)))\n}\n\n// HTML attributes have different rules,\nconst htmlAttrReplacer = (str: string) => str.replace(/\"/g, \"⃟\")\nconst htmlAttrUnReplacer = (str: string) => str.replace(/⃟/g, '\"')\n\n// Inline strings which are shown at HTML level\nexport const subTripleArrow = (str: string) => str.replace(//g, \"⇏\").replace(/'/g, \"⇯\")\nexport const replaceTripleArrow = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\").replace(/¿/g, \"'\")\nexport const replaceTripleArrowEncoded = (str: string) =>\n str.replace(/⇍/g, \"<\").replace(/⇏/g, \">\").replace(/⇯/g, \"'\")\n\nexport function stripHTML(text: string) {\n var table: any = {\n \"<\": \"lt\",\n '\"': \"quot\",\n \"'\": \"apos\",\n \"&\": \"amp\",\n \"\\r\": \"#13\",\n \"\\n\": \"#10\",\n }\n\n return text.toString().replace(/[<\"'\\r\\n&]/g, function (chr) {\n return \"&\" + table[chr] + \";\"\n })\n}\n\nexport function escapeHtml(html: string) {\n return html.replace(//g, \">\")\n}\n\n/** Does anything in the object imply that we should highlight any lines? */\nexport const shouldBeHighlightable = (highlight: any) => {\n return !!Object.keys(highlight || {}).find(key => {\n if (key.includes(\"-\")) return true\n if (!isNaN(parseInt(key))) return true\n return false\n })\n}\n\n/** Returns a func for figuring out if this line should be highlighted */\nexport const shouldHighlightLine = (highlight: any) => {\n const lines: number[] = []\n Object.keys(highlight || {}).find(key => {\n if (!isNaN(parseInt(key))) lines.push(parseInt(key))\n if (key.includes(\"-\")) {\n const [first, last] = key.split(\"-\")\n const lastIndex = parseInt(last) + 1\n for (let i = parseInt(first); i < lastIndex; i++) {\n lines.push(i)\n }\n }\n })\n\n return (line: number) => lines.includes(line)\n}\n","import { escapeHtml, Meta } from \"../utils\"\n\n// C&P'd from shiki\nexport interface HtmlRendererOptions {\n langId?: string\n fg?: string\n bg?: string\n themeName?: string\n}\n\n/** A func for setting a consistent
 */\nexport const preOpenerFromRenderingOptsWithExtras = (opts: HtmlRendererOptions, meta: Meta, classes?: string[]) => {\n  const bg = opts.bg || \"#fff\"\n  const fg = opts.fg || \"black\"\n  const theme = opts.themeName || \"\"\n\n  // shiki + `class` from fence + with-title if title exists + classes\n  const classList = [\"shiki\", theme, meta.class, meta.title ? \"with-title\" : \"\", ...(classes || [])]\n    .filter(Boolean)\n    .join(\" \")\n    .trim()\n\n  const attributes = Object.entries(meta)\n    .filter(entry => {\n      // exclude types other than string, number, boolean\n      // exclude keys class, twoslash\n      // exclude falsy booleans\n      return (\n        [\"string\", \"number\", \"boolean\"].includes(typeof entry[1]) &&\n        ![\"class\", \"twoslash\"].includes(entry[0]) &&\n        entry[1] !== false\n      )\n    })\n    .map(([key, value]) => `${key}=\"${value}\"`)\n    .join(\" \")\n    .trim()\n\n  // prettier-ignore\n  return `
`\n}\n\n/** You don't have a language which shiki twoslash can handle, make a DOM compatible version  */\nexport function plainTextRenderer(code: string, options: HtmlRendererOptions, meta: Meta) {\n  let html = \"\"\n\n  html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n  if (meta.title) {\n    html += `
${meta.title}
`\n }\n\n if (options.langId) {\n html += `
${options.langId}
`\n }\n\n html += `
`\n html += escapeHtml(code)\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
`\n return html\n}\n","type Lines = import(\"shiki\").IThemedToken[][]\ntype TwoSlash = import(\"@typescript/twoslash\").TwoSlashReturn\n\nimport { TwoslashShikiOptions } from \"..\"\nimport { htmlForTags } from \"../annotations\"\nimport {\n shouldBeHighlightable,\n shouldHighlightLine,\n createHighlightedString,\n subTripleArrow,\n replaceTripleArrowEncoded,\n escapeHtml,\n Meta,\n} from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n// OK, so - this is just straight up complex code.\n\n// What we're trying to do is merge two sets of information into a single tree for HTML\n\n// 1: Syntax highlight info from shiki\n// 2: Twoslash metadata like errors, identifiers etc\n\n// Because shiki gives use a set of lines to work from, then the first thing which happens\n// is converting twoslash data into the same format.\n\n// Things which make it hard:\n//\n// - Twoslash results can be cut, so sometimes there is edge cases between twoslash results\n// - Twoslash results can be multi-file\n// - the DOM requires a flattened graph of html elements (e.g. spans can' be interspersed)\n//\n\nexport function twoslashRenderer(lines: Lines, options: HtmlRendererOptions & TwoslashShikiOptions, twoslash: TwoSlash, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n if (twoslash.tags && twoslash.tags.length) html += \"
\"\n \n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"twoslash\", \"lsp\"])\n if (meta.title) {\n html += `
${meta.title}
`\n }\n\n if (options.langId) {\n html += `
${options.langId}
`\n }\n\n html += `
`\n\n const errorsGroupedByLine = groupBy(twoslash.errors, e => e.line) || new Map()\n const staticQuickInfosGroupedByLine = groupBy(twoslash.staticQuickInfos, q => q.line) || new Map()\n // A query is always about the line above it!\n const queriesGroupedByLine = groupBy(twoslash.queries, q => q.line - 1) || new Map()\n const tagsGroupedByLine = groupBy(twoslash.tags, q => q.line - 1) || new Map()\n\n /**\n * This is the index of the original twoslash code reference, it is not\n * related to the HTML output\n */\n let filePos = 0\n\n lines.forEach((l, i) => {\n const errors = errorsGroupedByLine.get(i) || []\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const queries = queriesGroupedByLine.get(i) || []\n const tags = tagsGroupedByLine.get(i) || []\n\n const hiClass = hasHighlight ? (hl(i + 1) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
`\n\n if (l.length === 0 && i === 0) {\n // Skip the first newline if it's blank\n filePos += 1\n } else if (l.length === 0) {\n const emptyLine = `${prefix} 
` \n html += emptyLine\n filePos += 1\n } else {\n html += prefix\n\n // Keep track of the position of the current token in a line so we can match it up to the\n // errors and lang serv identifiers\n let tokenPos = 0\n\n l.forEach(token => {\n let targetedQueryWord: typeof twoslash.staticQuickInfos[number] | undefined\n\n let tokenContent = \"\"\n // Underlining particular words\n const findTokenFunc = (start: number) => (e: any) =>\n start <= e.character && start + token.content.length >= e.character + e.length\n\n const findTokenDebug = (start: number) => (e: any) => {\n const result = start <= e.character && start + token.content.length >= e.character + e.length\n // prettier-ignore\n console.log(result, start, '<=', e.character, '&&', start + token.content.length, '>=', e.character + e.length)\n if (result) {\n console.log(\"Found:\", e)\n console.log(\"Inside:\", token)\n }\n return result\n }\n\n const errorsInToken = errors.filter(findTokenFunc(tokenPos))\n const lspResponsesInToken = lspValues.filter(findTokenFunc(tokenPos))\n const queriesInToken = queries.filter(findTokenFunc(tokenPos))\n\n // Does this line have a word targeted by a query?\n targetedQueryWord = targetedQueryWord || lspResponsesInToken.find(response => response.text === (queries.length && queries[0].text))!\n\n const allTokens = [...errorsInToken, ...lspResponsesInToken, ...queriesInToken]\n const allTokensByStart = allTokens.sort((l, r) => {\n return (l.start || 0) - (r.start || 0)\n })\n\n if (allTokensByStart.length) {\n const ranges = allTokensByStart.map(token => {\n const range: any = {\n begin: token.start! - filePos,\n end: token.start! + token.length! - filePos,\n }\n\n // prettier-ignore\n if (range.begin < 0 || range.end < 0) {\n // prettier-ignore\n // throw new Error(`The begin range of a token is at a minus location, filePos:${filePos} current token: ${JSON.stringify(token, null, ' ')}\\n result: ${JSON.stringify(range, null, ' ')}`)\n }\n\n if (\"renderedMessage\" in token) range.classes = \"err\"\n if (\"kind\" in token) range.classes = token.kind\n if (\"targetString\" in token) {\n range.classes = \"lsp\"\n const lspText = options.includeJSDocInHover && token.docs ? `${token.docs}\\n\\n${token.text}` : token.text\n range[\"lsp\"] = lspText\n }\n return range\n })\n\n tokenContent += createHighlightedString(ranges, token.content, targetedQueryWord?.text)\n } else {\n tokenContent += subTripleArrow(token.content)\n }\n\n html += `${tokenContent}`\n tokenPos += token.content.length\n filePos += token.content.length\n })\n\n html += `
`\n // This is the \\n which the
represents\n filePos += 1\n }\n\n // Adding error messages to the line after\n if (errors.length) {\n const messages = errors.map(e => escapeHtml(e.renderedMessage)).join(\"
\")\n const codes = errors.map(e => e.code).join(\"
\")\n html += `${messages}${codes}`\n html += `${messages}`\n }\n\n // Add queries to the next line\n if (queries.length) {\n queries.forEach(query => {\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
`\n\n switch (query.kind) {\n case \"query\": {\n const queryTextWithPrefix = escapeHtml(query.text!)\n const lspValues = staticQuickInfosGroupedByLine.get(i) || []\n const targetedWord = lspValues.find(response => response.text === (queries.length && queries[0].text))!\n const halfWayAcrossTheTargetedWord = ((targetedWord && targetedWord.character + targetedWord?.length / 2) - 1) || 0\n html +=\n `` +\n \" \".repeat(halfWayAcrossTheTargetedWord) +\n \"\" +\n `
${queryTextWithPrefix}
`\n break\n }\n\n case \"completions\": {\n if (!query.completions) {\n html += `${\"//\" + \"\".padStart(query.offset - 2) + \"^ - No completions found\"}`\n } else {\n const prefixed = query.completions.filter(c => c.name.startsWith(query.completionsPrefix || \"____\"))\n\n const lis = prefixed\n .sort((l, r) => l.name.localeCompare(r.name))\n .map(c => {\n const after = c.name.substr(query.completionsPrefix?.length || 0)\n const name = `${query.completionsPrefix || \"\"}${after}`\n const isDeprecated = c.kindModifiers?.split(\",\").includes(\"deprecated\")\n const liClass = isDeprecated ? \"deprecated\" : \"\"\n return `
  • ${name}
  • `\n })\n .join(\"\")\n html += `${\" \".repeat(query.offset)}`\n }\n }\n }\n html += \"
    \"\n })\n }\n\n // Any tags (currently that's warn/error/log)\n if (tags.length) {\n tags.forEach(tag => {\n if(![\"error\", \"warn\", \"log\"].includes(tag.name)) return\n\n // This is used to wrap popovers and completions to improve styling options for users.\n html += `
    `\n switch(tag.name) {\n case \"error\": html += `${errorSVG}${tag.annotation || \"N/A\"}`; break;\n case \"warn\": html += `${warningSVG}${tag.annotation || \"N/A\"}`; break;\n case \"log\": html += `${logSVG}${tag.annotation || \"N/A\"}`; break;\n }\n html += \"
    \"\n })\n }\n })\n html = replaceTripleArrowEncoded(html.replace(/\\n*$/, \"\")) // Get rid of final new lines\n\n if (options.addTryButton) {\n const playgroundLink = `Try`\n html += `
    ${playgroundLink}`\n } else {\n html += ``\n }\n\n html += `
    `\n\n // Attach annotations which live above of the code\n if (twoslash.tags && twoslash.tags.length) {\n html += htmlForTags(twoslash.tags)\n html += \"\"\n }\n\n return html\n}\n\n/** Returns a map where all the keys are the value in keyGetter */\nfunction groupBy(list: T[], keyGetter: (obj: any) => number) {\n const map = new Map()\n list.forEach(item => {\n const key = keyGetter(item)\n const collection = map.get(key)\n if (!collection) {\n map.set(key, [item])\n } else {\n collection.push(item)\n }\n })\n return map\n}\n\n\nconst errorSVG = ``\nconst warningSVG = ``\nconst logSVG = ``","import { shouldBeHighlightable, shouldHighlightLine, escapeHtml, Meta } from \"../utils\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\ntype Lines = import(\"shiki\").IThemedToken[][]\n\nexport function defaultShikiRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n const hasHighlight = meta.highlight && shouldBeHighlightable(meta.highlight)\n const hl = shouldHighlightLine(meta.highlight)\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach((l, i) => {\n if (l.length === 0) {\n html += `
    `\n } else {\n const hiClass = hasHighlight ? (hl(i) ? \" highlight\" : \" dim\") : \"\"\n const prefix = `
    `\n html += prefix\n\n l.forEach(token => {\n html += `${escapeHtml(token.content)}`\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","export const tsconfig = {\n compilerOptions: `The set of compiler options for your project`,\n allowJs: `Allow JavaScript files to be a part of your program. Use the \\`checkJS\\` option to get errors from these files.`,\n allowSyntheticDefaultImports: `Allow 'import x from y' when a module doesn't have a default export.`,\n allowUmdGlobalAccess: `Allow accessing UMD globals from modules.`,\n allowUnreachableCode: `Disable error reporting for unreachable code.`,\n allowUnusedLabels: `Disable error reporting for unused labels.`,\n alwaysStrict: `Ensure 'use strict' is always emitted.`,\n assumeChangesOnlyAffectDirectDependencies: `Have recompiles in projects that use [\\`incremental\\`](#incremental) and \\`watch\\` mode assume that changes within a file will only affect files directly depending on it.`,\n baseUrl: `Specify the base directory to resolve non-relative module names.`,\n charset: `No longer supported. In early versions, manually set the text encoding for reading files.`,\n checkJs: `Enable error reporting in type-checked JavaScript files.`,\n clean: `Delete the outputs of all projects.`,\n composite: `Enable constraints that allow a TypeScript project to be used with project references.`,\n declaration: `Generate .d.ts files from TypeScript and JavaScript files in your project.`,\n declarationDir: `Specify the output directory for generated declaration files.`,\n declarationMap: `Create sourcemaps for d.ts files.`,\n diagnostics: `Output compiler performance information after building.`,\n disableFilenameBasedTypeAcquisition: `Disables inference for type acquisition by looking at filenames in a project.`,\n disableReferencedProjectLoad: `Reduce the number of projects loaded automatically by TypeScript.`,\n disableSizeLimit: `Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.`,\n disableSolutionSearching: `Opt a project out of multi-project reference checking when editing.`,\n disableSourceOfProjectReferenceRedirect: `Disable preferring source files instead of declaration files when referencing composite projects.`,\n downlevelIteration: `Emit more compliant, but verbose and less performant JavaScript for iteration.`,\n emitBOM: `Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.`,\n emitDeclarationOnly: `Only output d.ts files and not JavaScript files.`,\n emitDecoratorMetadata: `Emit design-type metadata for decorated declarations in source files.`,\n enable: `Disable the type acquisition for JavaScript projects.`,\n esModuleInterop: `Emit additional JavaScript to ease support for importing CommonJS modules. This enables [\\`allowSyntheticDefaultImports\\`](#allowSyntheticDefaultImports) for type compatibility.`,\n exactOptionalPropertyTypes: `Interpret optional property types as written, rather than adding \\`undefined\\`.`,\n exclude: `Filters results from the [\\`include\\`](#include) option.`,\n excludeDirectories: `Remove a list of directories from the watch process.`,\n excludeFiles: `Remove a list of files from the watch mode's processing.`,\n experimentalDecorators: `Enable experimental support for TC39 stage 2 draft decorators.`,\n explainFiles: `Print files read during the compilation including why it was included.`,\n extendedDiagnostics: `Output more detailed compiler performance information after building.`,\n extends: `Specify one or more path or node module references to base configuration files from which settings are inherited.`,\n fallbackPolling: `Specify what approach the watcher should use if the system runs out of native file watchers.`,\n files: `Include a list of files. This does not support glob patterns, as opposed to [\\`include\\`](#include).`,\n force: `Build all projects, including those that appear to be up to date.`,\n forceConsistentCasingInFileNames: `Ensure that casing is correct in imports.`,\n generateCpuProfile: `Emit a v8 CPU profile of the compiler run for debugging.`,\n importHelpers: `Allow importing helper functions from tslib once per project, instead of including them per-file.`,\n importsNotUsedAsValues: `Specify emit/checking behavior for imports that are only used for types.`,\n include: `Specify a list of glob patterns that match files to be included in compilation.`,\n incremental: `Save .tsbuildinfo files to allow for incremental compilation of projects.`,\n inlineSourceMap: `Include sourcemap files inside the emitted JavaScript.`,\n inlineSources: `Include source code in the sourcemaps inside the emitted JavaScript.`,\n isolatedModules: `Ensure that each file can be safely transpiled without relying on other imports.`,\n jsx: `Specify what JSX code is generated.`,\n jsxFactory: `Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'.`,\n jsxFragmentFactory: `Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.`,\n jsxImportSource: `Specify module specifier used to import the JSX factory functions when using \\`jsx: react-jsx*\\`.`,\n keyofStringsOnly: `Make keyof only return strings instead of string, numbers or symbols. Legacy option.`,\n lib: `Specify a set of bundled library declaration files that describe the target runtime environment.`,\n listEmittedFiles: `Print the names of emitted files after a compilation.`,\n listFiles: `Print all of the files read during the compilation.`,\n locale: `Set the language of the messaging from TypeScript. This does not affect emit.`,\n mapRoot: `Specify the location where debugger should locate map files instead of generated locations.`,\n maxNodeModuleJsDepth: `Specify the maximum folder depth used for checking JavaScript files from \\`node_modules\\`. Only applicable with [\\`allowJs\\`](#allowJs).`,\n module: `Specify what module code is generated.`,\n moduleDetection: `Control what method is used to detect the whether a JS file is a module.`,\n moduleResolution: `Specify how TypeScript looks up a file from a given module specifier.`,\n moduleSuffixes: `List of file name suffixes to search when resolving a module.`,\n newLine: `Set the newline character for emitting files.`,\n noEmit: `Disable emitting files from a compilation.`,\n noEmitHelpers: `Disable generating custom helper functions like \\`__extends\\` in compiled output.`,\n noEmitOnError: `Disable emitting files if any type checking errors are reported.`,\n noErrorTruncation: `Disable truncating types in error messages.`,\n noFallthroughCasesInSwitch: `Enable error reporting for fallthrough cases in switch statements.`,\n noImplicitAny: `Enable error reporting for expressions and declarations with an implied \\`any\\` type.`,\n noImplicitOverride: `Ensure overriding members in derived classes are marked with an override modifier.`,\n noImplicitReturns: `Enable error reporting for codepaths that do not explicitly return in a function.`,\n noImplicitThis: `Enable error reporting when \\`this\\` is given the type \\`any\\`.`,\n noImplicitUseStrict: `Disable adding 'use strict' directives in emitted JavaScript files.`,\n noLib: `Disable including any library files, including the default lib.d.ts.`,\n noPropertyAccessFromIndexSignature: `Enforces using indexed accessors for keys declared using an indexed type.`,\n noResolve: `Disallow \\`import\\`s, \\`require\\`s or \\`\\`s from expanding the number of files TypeScript should add to a project.`,\n noStrictGenericChecks: `Disable strict checking of generic signatures in function types.`,\n noUncheckedIndexedAccess: `Add \\`undefined\\` to a type when accessed using an index.`,\n noUnusedLocals: `Enable error reporting when local variables aren't read.`,\n noUnusedParameters: `Raise an error when a function parameter isn't read.`,\n out: `Deprecated setting. Use [\\`outFile\\`](#outFile) instead.`,\n outDir: `Specify an output folder for all emitted files.`,\n outFile: `Specify a file that bundles all outputs into one JavaScript file. If [\\`declaration\\`](#declaration) is true, also designates a file that bundles all .d.ts output.`,\n paths: `Specify a set of entries that re-map imports to additional lookup locations.`,\n plugins: `Specify a list of language service plugins to include.`,\n preserveConstEnums: `Disable erasing \\`const enum\\` declarations in generated code.`,\n preserveSymlinks: `Disable resolving symlinks to their realpath. This correlates to the same flag in node.`,\n preserveValueImports: `Preserve unused imported values in the JavaScript output that would otherwise be removed.`,\n preserveWatchOutput: `Disable wiping the console in watch mode.`,\n pretty: `Enable color and formatting in TypeScript's output to make compiler errors easier to read.`,\n reactNamespace: `Specify the object invoked for \\`createElement\\`. This only applies when targeting \\`react\\` JSX emit.`,\n references: `Specify an array of objects that specify paths for projects. Used in project references.`,\n removeComments: `Disable emitting comments.`,\n resolveJsonModule: `Enable importing .json files.`,\n rootDir: `Specify the root folder within your source files.`,\n rootDirs: `Allow multiple folders to be treated as one when resolving modules.`,\n skipDefaultLibCheck: `Skip type checking .d.ts files that are included with TypeScript.`,\n skipLibCheck: `Skip type checking all .d.ts files.`,\n sourceMap: `Create source map files for emitted JavaScript files.`,\n sourceRoot: `Specify the root path for debuggers to find the reference source code.`,\n strict: `Enable all strict type-checking options.`,\n strictBindCallApply: `Check that the arguments for \\`bind\\`, \\`call\\`, and \\`apply\\` methods match the original function.`,\n strictFunctionTypes: `When assigning functions, check to ensure parameters and the return values are subtype-compatible.`,\n strictNullChecks: `When type checking, take into account \\`null\\` and \\`undefined\\`.`,\n strictPropertyInitialization: `Check for class properties that are declared but not set in the constructor.`,\n stripInternal: `Disable emitting declarations that have \\`@internal\\` in their JSDoc comments.`,\n suppressExcessPropertyErrors: `Disable reporting of excess property errors during the creation of object literals.`,\n suppressImplicitAnyIndexErrors: `Suppress [\\`noImplicitAny\\`](#noImplicitAny) errors when indexing objects that lack index signatures.`,\n synchronousWatchDirectory: `Synchronously call callbacks and update the state of directory watchers on platforms that don\\`t support recursive watching natively.`,\n target: `Set the JavaScript language version for emitted JavaScript and include compatible library declarations.`,\n traceResolution: `Log paths used during the [\\`moduleResolution\\`](#moduleResolution) process.`,\n tsBuildInfoFile: `Specify the folder for .tsbuildinfo incremental compilation files.`,\n typeAcquisition: `Specify options for automatic acquisition of declaration files.`,\n typeRoots: `Specify multiple folders that act like \\`./node_modules/@types\\`.`,\n types: `Specify type package names to be included without being referenced in a source file.`,\n useDefineForClassFields: `Emit ECMAScript-standard-compliant class fields.`,\n useUnknownInCatchVariables: `Default catch clause variables as \\`unknown\\` instead of \\`any\\`.`,\n verbose: `Enable verbose logging.`,\n watchDirectory: `Specify how directories are watched on systems that lack recursive file-watching functionality.`,\n watchFile: `Specify how the TypeScript watch mode works.`,\n};\n","type Lines = import(\"shiki\").IThemedToken[][]\n\nimport type { IThemedToken } from \"shiki\"\nimport { escapeHtml, Meta } from \"../utils\"\nimport { tsconfig } from \"../tsconfig-oneliners.generated\"\nimport { HtmlRendererOptions, preOpenerFromRenderingOptsWithExtras } from \"./plain\"\n\n/** Uses tmLanguage scopes to determine what the content of the token is */\nconst tokenIsJSONKey = (token: IThemedToken) => {\n if (!token.explanation) return false\n return token.explanation.find(e => e.scopes.find(s => s.scopeName.includes(\"support.type.property-name\")))\n}\n\n/** Can you look up the token in the tsconfig reference? */\nconst isKeyInTSConfig = (token: IThemedToken) => {\n if (token.content === '\"') return\n const name = token.content.slice(1, token.content.length - 1)\n return name in tsconfig\n}\n\n/**\n * Renders a TSConfig JSON object with additional LSP-ish information\n * @param lines the result of shiki highlighting\n * @param options shiki display options\n */\nexport function tsconfigJSONRenderer(lines: Lines, options: HtmlRendererOptions, meta: Meta) {\n let html = \"\"\n\n html += preOpenerFromRenderingOptsWithExtras(options, meta, [\"tsconfig\", \"lsp\"])\n if (meta.title) {\n html += `
    ${meta.title}
    `\n }\n\n if (options.langId) {\n html += `
    ${options.langId}
    `\n }\n\n html += `
    `\n\n lines.forEach(l => {\n if (l.length === 0) {\n html += `
    `\n } else {\n html += `
    `\n l.forEach(token => {\n // This means we're looking at a token which could be '\"module\"', '\"', '\"compilerOptions\"' etc\n if (tokenIsJSONKey(token) && isKeyInTSConfig(token)) {\n const key = token.content.slice(1, token.content.length - 1)\n const oneliner = (tsconfig as Record)[key]\n // prettier-ignore\n html += `\"\"`\n } else {\n html += `${escapeHtml(token.content)}`\n }\n })\n html += `
    `\n }\n })\n\n html = html.replace(/\\n*$/, \"\") // Get rid of final new lines\n html += `
    `\n return html\n}\n","import { getHighlighter, Highlighter, HighlighterOptions, IThemedToken } from \"shiki\"\nimport { twoslasher, TwoSlashOptions, TwoSlashReturn } from \"@typescript/twoslash\"\nimport { twoslashRenderer } from \"./renderers/twoslash\"\nimport { HtmlRendererOptions, plainTextRenderer } from \"./renderers/plain\"\nimport { defaultShikiRenderer } from \"./renderers/shiki\"\nimport { tsconfigJSONRenderer } from \"./renderers/tsconfig\"\nimport { Meta } from \"./utils\"\n\nexport interface TwoslashShikiOptions {\n /** A way to turn on the try buttons seen on the TS website */\n addTryButton?: true\n /** A way to disable implicit React imports on tsx/jsx language codeblocks */\n disableImplicitReactImport?: true\n /** A way to add a div wrapper for multi-theme outputs */\n wrapFragments?: true\n /** Include JSDoc comments in the hovers */\n includeJSDocInHover?: true\n /** Instead of showing twoslash exceptions inline, throw the entire process like it will on CI */\n alwayRaiseForTwoslashExceptions?: true\n /** Ignore transforming certain code blocks */\n ignoreCodeblocksWithCodefenceMeta?: string[]\n}\n\n/** The possible user config, a combination of all shiki, twoslash and twoslash-shiki options */\nexport type UserConfigSettings = HighlighterOptions & TwoSlashOptions & TwoslashShikiOptions\n\n/**\n * This gets filled in by the promise below, then should\n * hopefully be more or less synchronous access by each parse\n * of the highlighter\n */\nlet storedHighlighter: Highlighter = null as any\n\n/**\n * Creates a *cached singleton* Shiki highlighter, this is an async call because of the call to WASM to get\n * the regex parser set up.\n *\n * In other functions, passing a the result of this highlighter function is kind of optional but it's the author's\n * opinion that you should be in control of the highlighter, and not this library.\n *\n */\nexport const createShikiHighlighter = (options: HighlighterOptions) => {\n if (storedHighlighter) return Promise.resolve(storedHighlighter)\n\n return getHighlighter(options).then(newHighlighter => {\n storedHighlighter = newHighlighter\n return storedHighlighter\n })\n}\n\n/**\n * Renders a code sample to HTML, automatically taking into account:\n *\n * - rendering overrides for twoslash and tsconfig\n * - whether the language exists in shiki\n *\n * @param code the source code to render\n * @param lang the language to use in highlighting\n * @param info additional metadata which lives after the code-fence lang (e.g. `{ twoslash: true }`)\n * @param shikiOptions user settings\n * @param highlighter optional, but you should use it, highlighter\n * @param twoslash optional, but required when info contains 'twoslash' as a string\n */\nexport const renderCodeToHTML = (\n code: string,\n lang: string,\n meta: Meta,\n shikiOptions?: UserConfigSettings & { themeName: string },\n highlighter?: Highlighter,\n twoslash?: TwoSlashReturn\n) => {\n if (!highlighter && !storedHighlighter) {\n throw new Error(\"The highlighter object hasn't been initialised via `setupHighLighter` yet in shiki-twoslash\")\n }\n\n // Shiki does know the lang, so tokenize\n const renderHighlighter = highlighter || storedHighlighter\n\n const renderOpts: HtmlRendererOptions = {\n fg: renderHighlighter.getForegroundColor(),\n bg: renderHighlighter.getBackgroundColor(),\n ...shikiOptions,\n }\n\n let tokens: IThemedToken[][]\n try {\n // I'm a little unsure about why we need this, perhaps the jsx language\n // upstream in shiki is broken?\n const tmpLang = lang === \"jsx\" ? \"tsx\" : lang\n\n tokens = renderHighlighter.codeToThemedTokens(code, tmpLang as any)\n } catch (error) {\n // Shiki doesn't know this lang, so render it as plain text, but\n // also add a note at the end as a HTML comment\n const note = ``\n return plainTextRenderer(code, renderOpts, meta) + note\n }\n\n // Twoslash specific renderer\n if (lang && meta.twoslash && twoslash) {\n return twoslashRenderer(tokens, { ...renderOpts, langId: lang }, twoslash, meta)\n }\n\n // TSConfig renderer\n if (lang && lang.startsWith(\"json\") && meta.tsconfig) {\n return tsconfigJSONRenderer(tokens, renderOpts, meta)\n }\n\n // Otherwise just the normal shiki renderer\n return defaultShikiRenderer(tokens, { ...renderOpts, langId: lang }, meta)\n}\n\n/**\n * Runs Twoslash over the code passed in with a particular language as the default file.\n */\nexport const runTwoSlash = (input: string, lang: string, settings: UserConfigSettings = {}): TwoSlashReturn => {\n let code = input\n\n // Shiki doesn't handle a few filetype mappings, so do that ahead of time. Oddly enough, this also\n // gets re-done at remark-shiki level\n const replacer = {\n json5: \"json\",\n yml: \"yaml\",\n }\n\n // @ts-ignore\n if (replacer[lang]) lang = replacer[lang]\n\n const hasReactImport = /^import\\s+React(?:.*)\\s+from\\s+('|\")react\\1/gm\n\n // Add react import to code samples indicating they're needing react.\n if ([\"tsx\", \"jsx\"].includes(lang) && !settings.disableImplicitReactImport && !hasReactImport.test(code)) {\n const reactImport = \"import React from 'react'\\n\"\n const cutString = \"// ---cut---\\n\"\n // ^ cutString taken directly from\n // https://github.com/microsoft/TypeScript-Website/blob/0c8d98a69d520365c1909d536fa1323f03a8438c/packages/ts-twoslasher/src/index.ts#L694\n\n if (code.includes(cutString)) {\n code = code\n .split(cutString)\n .map((item, index) => (index == 0 ? reactImport.concat(item) : item))\n .join(cutString)\n } else {\n code = [reactImport, cutString, code].join(\"\")\n }\n }\n\n settings.customTags = [\"annotate\", \"log\", \"warn\", \"error\"]\n const results = twoslasher(code, lang, settings)\n return results\n}\n\n/** Set of renderers if you want to explicitly call one instead of using renderCodeToHTML */\nexport const renderers = {\n plainTextRenderer,\n defaultShikiRenderer,\n twoslashRenderer,\n tsconfigJSONRenderer,\n}\n"],"names":["htmlForTags","tags","html","forEach","t","name","annotation","meta","split","text","pop","info","trim","flipped","includes","settings","arrowRot","textDegree","top","line","theInfo","JSON","parse","error","TwoslashError","stringify","message","arrowSVG","arrow","style","inner","rot","escapeHtml","replace","shouldBeHighlightable","highlight","Object","keys","find","key","isNaN","parseInt","shouldHighlightLine","lines","push","first","lastIndex","i","preOpenerFromRenderingOptsWithExtras","opts","classes","bg","fg","classList","themeName","title","filter","Boolean","join","attributes","entries","entry","map","plainTextRenderer","code","options","langId","twoslashRenderer","twoslash","hasHighlight","hl","length","str","errorsGroupedByLine","groupBy","errors","e","Map","staticQuickInfosGroupedByLine","staticQuickInfos","q","queriesGroupedByLine","queries","tagsGroupedByLine","filePos","l","get","lspValues","prefix","tokenPos","token","targetedQueryWord","tokenContent","findTokenFunc","start","character","content","errorsInToken","lspResponsesInToken","queriesInToken","response","allTokensByStart","sort","r","ranges","targetedWord","tag","x","makeTagFromRange","close","lsp","htmlAttrReplacer","a","b","precedenceOf","indexOf","cmp","begin","end","cursor","htmlAttrUnReplacer","replaceTripleArrow","table","toString","chr","stripHTML","nest","data","stack","shift","substring","some","createHighlightedString","range","kind","includeJSDocInHover","docs","_targetedQueryWord","color","messages","renderedMessage","codes","query","queryTextWithPrefix","repeat","completions","lis","c","startsWith","completionsPrefix","localeCompare","after","substr","kindModifiers","_c$kindModifiers","offset","padStart","errorSVG","warningSVG","logSVG","addTryButton","playgroundURL","list","keyGetter","item","collection","set","defaultShikiRenderer","hiClass","tsconfig","compilerOptions","allowJs","allowSyntheticDefaultImports","allowUmdGlobalAccess","allowUnreachableCode","allowUnusedLabels","alwaysStrict","assumeChangesOnlyAffectDirectDependencies","baseUrl","charset","checkJs","clean","composite","declaration","declarationDir","declarationMap","diagnostics","disableFilenameBasedTypeAcquisition","disableReferencedProjectLoad","disableSizeLimit","disableSolutionSearching","disableSourceOfProjectReferenceRedirect","downlevelIteration","emitBOM","emitDeclarationOnly","emitDecoratorMetadata","enable","esModuleInterop","exactOptionalPropertyTypes","exclude","excludeDirectories","excludeFiles","experimentalDecorators","explainFiles","extendedDiagnostics","fallbackPolling","files","force","forceConsistentCasingInFileNames","generateCpuProfile","importHelpers","importsNotUsedAsValues","include","incremental","inlineSourceMap","inlineSources","isolatedModules","jsx","jsxFactory","jsxFragmentFactory","jsxImportSource","keyofStringsOnly","lib","listEmittedFiles","listFiles","locale","mapRoot","maxNodeModuleJsDepth","module","moduleDetection","moduleResolution","moduleSuffixes","newLine","noEmit","noEmitHelpers","noEmitOnError","noErrorTruncation","noFallthroughCasesInSwitch","noImplicitAny","noImplicitOverride","noImplicitReturns","noImplicitThis","noImplicitUseStrict","noLib","noPropertyAccessFromIndexSignature","noResolve","noStrictGenericChecks","noUncheckedIndexedAccess","noUnusedLocals","noUnusedParameters","out","outDir","outFile","paths","plugins","preserveConstEnums","preserveSymlinks","preserveValueImports","preserveWatchOutput","pretty","reactNamespace","references","removeComments","resolveJsonModule","rootDir","rootDirs","skipDefaultLibCheck","skipLibCheck","sourceMap","sourceRoot","strict","strictBindCallApply","strictFunctionTypes","strictNullChecks","strictPropertyInitialization","stripInternal","suppressExcessPropertyErrors","suppressImplicitAnyIndexErrors","synchronousWatchDirectory","target","traceResolution","tsBuildInfoFile","typeAcquisition","typeRoots","types","useDefineForClassFields","useUnknownInCatchVariables","verbose","watchDirectory","watchFile","tsconfigJSONRenderer","explanation","scopes","s","scopeName","tokenIsJSONKey","slice","isKeyInTSConfig","storedHighlighter","renderers","Promise","resolve","getHighlighter","then","newHighlighter","lang","shikiOptions","highlighter","Error","tokens","renderHighlighter","renderOpts","getForegroundColor","getBackgroundColor","codeToThemedTokens","note","input","replacer","json5","yml","disableImplicitReactImport","test","reactImport","cutString","index","concat","customTags","twoslasher"],"mappings":"4UAEO,IAAMA,EAAc,SAACC,OACtBC,EAAO,UACXD,EAAKE,SAAQ,SAAAC,MACI,aAAXA,EAAEC,MAAuBD,EAAEE,WAAY,KACnCC,EAAOH,EAAEE,WAAWE,MAAM,OAC1BC,EAAOF,EAAKG,MACZC,GAAQJ,EAAK,IAAM,IAAIK,OACvBC,EAAUF,EAAKG,SAAS,SAC1BC,EAAW,CACbF,QAAAA,EACAG,SAAoB,kBACpBC,WAAY,OACZC,IAAQd,EAAEe,cAIRR,EAAKG,SAAS,KAAM,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D,8BAAmCK,EAAKgD,gBAGtCU,EAAQC,SACVhE,+BAAoC+D,EAAQC,iBAG9ChE,wCAEAyC,EAAMxC,SAAQ,SAACkF,EAAGtC,MACC,IAAbsC,EAAEd,OACJrE,kCACK,KACCsK,EAAUnG,EAAgBC,EAAGvB,GAAK,aAAe,OAAU,GAEjE7C,sBADkCsK,OAGlCnF,EAAElF,SAAQ,SAAAuF,GACRxF,0BAA+BwF,EAAMgD,WAAU1G,EAAW0D,EAAMM,sBAElE9F,gBAIJA,EAAOA,EAAK+B,QAAQ,OAAQ,IAC5B/B,6BCtCWuK,EAAW,CACtBC,+DACAC,wHACAC,oGACAC,iEACAC,qEACAC,+DACAC,sDACAC,mNACAC,2EACAC,oGACAC,mEACAC,4CACAC,mGACAC,yFACAC,+EACAC,mDACAC,sEACAC,oHACAC,iGACAC,yHACAC,+FACAC,4IACAC,oGACAC,+EACAC,uEACAC,8FACAC,+DACAC,kMACAC,2GACAC,iEACAC,0EACAC,wEACAC,wFACAC,sFACAC,wNAEAC,+GACAC,2GACAC,0EACAC,6EACAC,8EACAC,kHACAC,kGACAC,0FACAC,wFACAC,yEACAC,qFACAC,mGACAC,0CACAC,qHACAC,8IACAC,kHACAC,wGACAC,uGACAC,yEACAC,gEACAC,uFACAC,sGACAC,4JACAC,gDACAC,2FACAC,yFACAC,+EACAC,wDACAC,oDACAC,gGACAC,iFACAC,gEACAC,gGACAC,oGACAC,wGACAC,sGACAC,6EACAC,0FACAC,6EACAC,+GACAC,oIACAC,yFACAC,mFACAC,0EACAC,0EACAC,6DACAC,yDACAC,4KACAC,qFACAC,iEACAC,kFACAC,2GACAC,iHACAC,gEACAC,oGACAC,oHACAC,sGACAC,4CACAC,kDACAC,4DACAC,+EACAC,wFACAC,mDACAC,kEACAC,oFACAC,kDACAC,oHACAC,yHACAC,iFACAC,4GACAC,6FACAC,mHACAC,qIACAC,iKACAC,iHACAC,6FACAC,qFACAC,kFACAC,4EACAC,6FACAC,2EACAC,2FACAC,kCAC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