{"version":3,"sources":["webpack://typescriptlang-org/./src/components/workbench/plugins/about.ts","webpack://typescriptlang-org/./src/components/workbench/plugins/debug.ts","webpack://typescriptlang-org/./src/components/workbench/plugins/assertions.ts","webpack://typescriptlang-org/./src/components/workbench/plugins/markdown.ts","webpack://typescriptlang-org/./src/components/workbench/plugins/docs.ts","webpack://typescriptlang-org/./src/pages/dev/bug-workbench.tsx"],"names":["intro","trim","why","how","cta","workbenchHelpPlugin","i","utils","id","displayName","didMount","sandbox","container","ds","createDesignSystem","title","p","workbenchDebugPlugin","pluginContainer","_sandbox","noResults","clear","getResults","results","dtsMap","subtitle","extension","code","staticQuickInfos","JSON","stringify","files","Array","from","keys","reverse","dtsFiles","forEach","filename","startsWith","push","replace","get","join","workbenchAssertionsPlugin","err","message","stack","_dtsMap","emitRequested","queries","length","errors","queriesAsDiags","map","t","msg","kind","text","completions","all","c","name","prefixed","filter","completionsPrefix","category","file","undefined","messageText","start","listDiags","getModel","errorsAsDiags","renderedMessage","e","workbenchMarkdownPlugin","render","button","label","onclick","navigator","clipboard","writeText","mdCode","url","document","location","href","getText","examples","issue","blurb","reference","content","tsconfigOptions","l","r","localeCompare","opt","includes","categoryID","oneliner","createElement","textContent","setText","appendChild","workbenchReferencePlugin","tabContainer","tabBar","createTabBar","tabs","tab","createTabButton","classList","remove","add","Play","props","createInternational","useIntl","Map","useEffect","window","react","React","reactDOM","ReactDOM","getLoaderScript","src","withPrefix","async","onload","params","URLSearchParams","search","tsVersionParam","fetch","cache","nightlyLookup","json","nightlyJSON","version","getPlaygroundUrls","sandboxRoot","playgroundRoot","playgroundWorker","re","global","require","config","paths","vs","ignoreDuplicateModules","main","tsWorker","playground","ts","getElementById","parentNode","removeChild","console","error","style","display","height","Math","max","innerHeight","round","getClientRects","top","createTypeScriptSandbox","localStorage","getItem","compilerOptions","domID","filetype","acquireTypes","supportTwoslashCompilerOptions","monacoSettings","fontFamily","fontLigatures","customTypeScriptWorkerPath","origin","sandboxEnv","playgroundConfig","lang","prefix","supportCustomPlugins","plugins","workbenchAboutPlugin","playgroundEnv","setupPlayground","createUtils","updateDTSEnv","opts","createDefaultMapFromCDN","lzstring","then","defaultMap","runTwoslash","setDidUpdateCompilerSettings","getCompilerOptions","debouncedTwoslash","debounce","editor","onDidChangeModelContent","currentTwoslashResults","currentDTSMap","isError","setDidUpdateTab","newPlugin","ext","filepath","split","twoslash","twoslasher","defaultOptions","noStaticSemanticInfo","emit","noErrorValidation","tsModule","lzstringModule","fsMap","currentPlugin","getCurrentPlugin","assertionCount","setNotifications","log","documentElement","contains","monaco","setTheme","focus","layout","body","description","className","paddingTop","marginTop","marginBottom","paddingBottom","role","aria-label","Intl","locale"],"mappings":"0RAIMA,EAAQ,6SAIZC,OAEIC,EAAM,iJAEVD,OAEIE,EAAM,yNAOVF,OAEIG,EAAM,gEAGVH,OAEWI,EAA+B,SAACC,EAAGC,GAC9C,MAAO,CACLC,GAAI,QACJC,YAAa,QACbC,SAAU,SAACC,EAASC,GAClB,IAAMC,EAAKN,EAAMO,mBAAmBF,GAEpCC,EAAGE,MAAM,qBACTF,EAAGG,EAAEhB,GAELa,EAAGG,EAAEd,GACLW,EAAGG,EAAEb,GACLU,EAAGG,EAAEZ,MCrCEa,EAAsC,SAACX,EAAGC,GACrD,IAAIW,EAEJ,MAAO,CACLV,GAAI,UACJC,YAAa,QACbC,SAAU,SAACS,EAAUP,GACnBM,EAAkBN,GAEpBQ,UAAW,WACT,IAAMP,EAAKN,EAAMO,mBAAmBI,GACpCL,EAAGQ,QAEHR,EAAGG,EAAE,eAEPM,WAAY,SACVH,EACAI,EACAC,GAEA,IAAMX,EAAKN,EAAMO,mBAAmBI,GACpCL,EAAGQ,QAEHR,EAAGG,EACD,iSAGFH,EAAGY,SAAH,kBAA8BF,EAAQG,WACtCb,EAAGc,KAAKJ,EAAQI,MAGhBJ,EAAQK,iBAAmB,CAAC,OAE5Bf,EAAGY,SAAH,iBACAZ,EAAGc,KAAKE,KAAKC,UAAUP,EAAS,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,UACN,uBAAKsO,UAAU,YAAW,4BAAW,4BAAW,4BAAW,4BAAW,4BAAW,4BAAW,4BAAW,4BAAW,6BAClH,qBAAGtO,GAAG,kBAAkB2O,KAAK,UAAU7O,EAAE,iCAE3C,uBAAKE,GAAG,uBAAuB2J,MAAO,CAAEC,QAAS,SAC/C,uBAAK5J,GAAG,oBACN,uBAAKA,GAAG,iBAAiBsO,UAAU,cAEjC,0BACE,sBAAItO,GAAG,WAAWsO,UAAU,YAC1B,qBAAGtJ,KAAK,KAAKlF,EAAE,4BAAf,OAA+C,wBAAMwO,UAAU,WAC/D,sBAAIA,UAAU,6BAKlB,sBAAIA,UAAU,SACZ,0BAAI,qBAAGtO,GAAG,iBAAiB4O,aAAW,eAAe5J,KAAK,KAAtD,QAIR,uBAAKhF,GAAG,6BASpB,WAAgB8G,GAAD,OAAkB,gBAAC+H,EAAA,EAAD,CAAMC,OAAO,MAAK,gBAACjI,EAASC","file":"component---src-pages-dev-bug-workbench-tsx-35ab985064d116145aa8.js","sourcesContent":["type Sandbox = import(\"@typescript/sandbox\").Sandbox\ntype Factory = import(\"../../../../static/js/playground\").PluginFactory\ntype PluginUtils = import(\"../../../../static/js/playground\").PluginUtils\n\nconst intro = `\nThe bug workbench uses Twoslash to help you create accurate bug reports. \nTwoslash is a markup format for TypeScript files which lets you highlight code, handle-multiple files and\nshow the files the TypeScript compiler creates.\n`.trim()\n\nconst why = `\nThe bug workbench lets you make reproductions of bugs which are trivial to verify against many different versions of TypeScript over time.\n`.trim()\n\nconst how = `\nA repro can highlight an issue in a few ways:\n\n`.trim()\n\nconst cta = `\nTo learn how the tools for making a repro, go to \"Docs\"\n\n`.trim()\n\nexport const workbenchHelpPlugin: Factory = (i, utils) => {\n return {\n id: \"about\",\n displayName: \"About\",\n didMount: (sandbox, container) => {\n const ds = utils.createDesignSystem(container)\n\n ds.title(\"Twoslash Overview\")\n ds.p(intro)\n\n ds.p(why)\n ds.p(how)\n ds.p(cta)\n },\n }\n}\n","type TwoSlashReturns = import(\"@typescript/twoslash\").TwoSlashReturn\ntype PluginFactory = import(\"../../../../static/js/playground\").PluginFactory\n\nexport const workbenchDebugPlugin: PluginFactory = (i, utils) => {\n let pluginContainer: HTMLDivElement\n\n return {\n id: \"results\",\n displayName: \"Debug\",\n didMount: (_sandbox, container) => {\n pluginContainer = container\n },\n noResults: () => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n\n ds.p(\"No results\")\n },\n getResults: (\n _sandbox: any,\n results: TwoSlashReturns,\n dtsMap: Map\n ) => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n\n ds.p(\n \"This tab shows the raw data passed back from Twoslash. This can be useful in debugging if something isn't working as you would expect. That said, if you're struggling with a repro - ask in the #compiler-api channel of the TypeScript Discord.\"\n )\n\n ds.subtitle(`Output Code as ${results.extension}`)\n ds.code(results.code)\n\n // @ts-ignore\n results.staticQuickInfos = [\"...\"]\n\n ds.subtitle(`Twoslash JSON`)\n ds.code(JSON.stringify(results, null, \" \"))\n\n ds.subtitle(\"Virtual File System\")\n\n const files = Array.from(dtsMap.keys()).reverse()\n const dtsFiles: string[] = []\n files.forEach(filename => {\n if (filename.startsWith(\"/lib.\")) {\n dtsFiles.push(filename.replace(\"/lib\", \"lib\"))\n } else {\n ds.p(\"\" + filename + \"\")\n ds.code(dtsMap.get(filename)!.trim())\n }\n })\n ds.subtitle(\"Lib files\")\n ds.p(dtsFiles.join(\", \"))\n },\n }\n}\n","type TwoSlashReturns = import(\"@typescript/twoslash\").TwoSlashReturn\n\nexport const workbenchAssertionsPlugin: import(\"../../../../static/js/playground\").PluginFactory = (\n i,\n utils\n) => {\n let pluginContainer: HTMLDivElement\n return {\n id: \"assertions\",\n displayName: \"Asserts\",\n didMount: (sandbox, container) => {\n pluginContainer = container\n },\n noResults: (sandbox, err) => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n\n ds.title(\"Exception Raised\")\n ds.p(\n \"This could be a successful repro of a crashing compiler bug, or potentially an issue in Twoslash.\"\n )\n\n ds.subtitle(\"Error:\")\n if (err.message) ds.p(err.message)\n if (err.stack) ds.code(err.stack)\n },\n getResults: (\n sandbox: any,\n results: TwoSlashReturns,\n _dtsMap: Map,\n emitRequested: boolean\n ) => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n\n const anyOutput =\n results.queries.length > 0 || emitRequested || results.errors.length > 0\n\n if (!anyOutput) {\n ds.title(\"No Assertions\")\n ds.p(\n \"Assuming that this repro is for code which compiles but should not.\"\n )\n } else {\n ds.title(\"Assertions Found\")\n }\n\n const queriesAsDiags = results.queries.map(t => {\n let msg = \"\"\n switch (t.kind) {\n case \"query\": {\n msg = t.text || \"No text found for query\"\n break\n }\n case \"completions\": {\n if (!t.completions) {\n msg = \"Could not get completions\"\n } else {\n const all = t.completions.map(c => c.name).join(\", \")\n // prettier-ignore\n const prefixed = t.completions.filter(c => c.name.startsWith(t.completionsPrefix || \"____\")).map(c => c.name).join(\", \")\n const prefix = t.completionsPrefix?.length\n ? `Filtered Completions: ${prefixed}.\\n\\n`\n : \"\"\n msg = `${prefix}All: ${all}.`\n }\n }\n }\n\n const diag: import(\"typescript\").DiagnosticRelatedInformation = {\n category: 3, // ts.DiagnosticCategory.Message,\n code: 0,\n file: undefined,\n length: 0,\n messageText: msg || \"-\",\n start: 0,\n }\n return diag\n })\n if (queriesAsDiags.length) {\n ds.subtitle(\"Queries in Code\")\n ds.listDiags(sandbox.getModel(), queriesAsDiags)\n }\n\n const errorsAsDiags = results.errors.map(t => {\n const diag: import(\"typescript\").DiagnosticRelatedInformation = {\n category: 1, // ts.DiagnosticCategory.Message,\n code: t.code,\n file: undefined,\n length: 0,\n messageText: t.renderedMessage,\n start: 0,\n }\n return diag\n })\n\n if (errorsAsDiags.length) {\n ds.subtitle(\"Compiler Errors\")\n ds.listDiags(sandbox.getModel(), errorsAsDiags)\n\n ds.subtitle(\"If want these errors:\")\n ds.code(`// @errors: ${results.errors.map(e => e.code).join(\" \")}`)\n }\n\n if (emitRequested) {\n ds.subtitle(\"Output\")\n ds.code(results.code)\n }\n },\n }\n}\n","type PluginFactory = import(\"../../../../static/js/playground\").PluginFactory\ntype PluginUtils = import(\"../../../../static/js/playground\").PluginUtils\n\nexport const workbenchMarkdownPlugin: PluginFactory = (i, utils) => {\n let pluginContainer: HTMLDivElement\n\n const render = (\n container: HTMLElement,\n ds: ReturnType,\n code: string\n ) => {\n ds.subtitle(\"Markdown for issue\")\n ds.button({\n label: \"Copy Markdown\",\n onclick: () => navigator.clipboard.writeText(mdCode),\n })\n ds.p(\"\")\n\n const url = document && document.location ? document.location.href : \"\"\n const mdCode = `\n\\`\\`\\`ts repro\n${code.replace(/ {\n pluginContainer = container\n },\n noResults: (sandbox: any) => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n render(pluginContainer, ds, sandbox.getText())\n },\n getResults: (sandbox: any) => {\n const ds = utils.createDesignSystem(pluginContainer)\n ds.clear()\n render(pluginContainer, ds, sandbox.getText())\n },\n }\n}\n","type Sandbox = import(\"@typescript/sandbox\").Sandbox\ntype Factory = import(\"../../../../static/js/playground\").PluginFactory\ntype PluginUtils = import(\"../../../../static/js/playground\").PluginUtils\n\nimport tsconfigOptions from \"../../../../../tsconfig-reference/output/en-summary.json\"\n\nconst examples = [\n {\n issue: 37231,\n name: \"Incorrect Type Inference Example\",\n blurb:\n \"Using // ^? to highlight how inference gives different results at different locations\",\n code: `// @noImplicitAny: false\n\ntype Entity = {\n someDate: Date | null;\n} & ({ id: string; } | { id: number; })\n\ntype RowRendererMeta = {\n [key in keyof TInput]: { key: key; caption: string; formatter?: (value: TInput[key]) => string; };\n}\ntype RowRenderer = RowRendererMeta[keyof RowRendererMeta];\n\nconst test: RowRenderer = {\n key: 'someDate',\n caption: 'My Date',\n formatter: (value) => value ? value.toString() : '-' // value: any\n// ^?\n}\n\nconst thisIsNotTheIssue: Partial> = {\n someDate: {\n key: 'someDate',\n caption: 'My Date',\n formatter: (value) => value ? value.toString() : '-' // value: Date | null\n// ^?\n }\n}`,\n },\n]\n\nconst reference: {\n name: string\n content: (\n sandbox: Sandbox,\n container: HTMLDivElement,\n ds: ReturnType\n ) => void\n}[] = [\n {\n name: \"Compiler Options\",\n content: (sandbox, container, ds) => {\n ds.p(`\nYou can set compiler flags via // @[option] comments inside the sample.\n
    \n
  • Booleans: // @strict: true or // @strict: false.
    You can omit : true to get the same behavior.
  • \n
  • Strings: // @target: ES2015
  • \n
  • Numbers: // @target: 4
  • \n
  • Lists: // @types: ['jest']
  • \n
\n`)\n\n ds.subtitle(\"Compiler Option Reference\")\n tsconfigOptions.options\n .sort((l, r) => l.id.localeCompare(r.id))\n .forEach(opt => {\n const skip = [\"Project_Files_0\", \"Watch_Options_999\"]\n if (skip.includes(opt.categoryID)) return\n\n ds.p(`// @${opt.id}
${opt.oneliner}.`)\n })\n },\n },\n {\n name: \"Multi File\",\n content: (sandbox, container, ds) => {\n ds.p(\n \"The code file can be converted into multiple files behind the scenes. This is done by chopping the code sample whenever there is a // @filename: [path].\"\n )\n\n ds.code(\n `\n// @showEmit\n// @filename: index.ts\nimport {pi} from \"./utils\"\nconsole.log(pi)\n\n// @filename: utils.ts\nexport const pi = \"3.14\"\n`.trim()\n )\n\n const button = document.createElement(\"button\")\n button.textContent = \"See an Example\"\n button.onclick = () =>\n sandbox.setText(\n `\n// @filename: service.ts\nexport type Service = {\n id: string\n display: string\n}\n\n// @filename: app.ts\nimport type { Service } from \"./service\";\n// ^ - this error is OK\n\nconst myServices: Service[] = [\n { id: \"launch\", display: \"Launch\" },\n { id: \"lunch\", disply: \"Lunch\" },\n// ^ - this error is real but hidden\n// you can see it in 'Assertions'\n]\n `.trim()\n )\n container.appendChild(button)\n },\n },\n {\n name: \"Queries\",\n content: (sandbox, container, ds) => {\n ds.p(\n \"Twoslash supports making queries for what the type is at a particular location of code. It also is a specially crafted comment. \"\n )\n ds.code(\n `\nconst myExample = {\n hello: \"world\"\n}\n\nmyExample.hello;\n// ^?\n `.trim()\n )\n\n ds.p(\n \"You can use as many as you want of these, but you can only have one per line.\"\n )\n const button = document.createElement(\"button\")\n button.textContent = \"See an Example\"\n button.onclick = () =>\n sandbox.setText(\n `\nconst button = document.createElement(\"button\");\nbutton.textContent = \"See an Example\";\n\nbutton.onclick = () => {\n console.log(\"Example has been clicked\");\n button.disabled = true;\n// ^?\n}\n\ndocument.body.appendChild(button);\n// ^?\n `.trim()\n )\n container.appendChild(button)\n\n ds.p(\n \"The repro testing system will use these queries as an indicator of what has changed, so if you highlight a bug in inference then when it is fixed and the type has changed it will be raised.\"\n )\n },\n },\n {\n name: \"Emitter\",\n content: (sandbox, container, ds) => {\n ds.p(\n `\nThere are ways to have your test repro be about the output of running TypeScript. There are two comment types which can be used to highlight these files.\n

// @showEmit is a shortcut for showing the .js file for a single file code sample:\n`.trim()\n )\n ds.code(\n `\n// @showEmit\nexport const helloWorld: string = \"Hi\"\n`.trim()\n )\n ds.p(\n `The long-form is // @showEmittedFile: [filename] which allows for showing any emitted file`\n )\n ds.code(\n `\n// @declaration: true\n// @showEmit\n// @showEmittedFile: index.d.ts\n\nexport function getStringLength(value: string) {\n return value.length\n}\n`.trim()\n )\n ds.p(\"Multi-file seems to be buggy ATM, but this should work eventually:\")\n ds.code(\n `\n// @showEmit\n// @showEmittedFile: b.js\n\n// @filename: a.ts\nexport const helloWorld: string = \"Hi\"\n\n// @filename: b.ts\nconst abc = \"\"\n`.trim()\n )\n },\n },\n {\n name: \"Defaults\",\n content: (sandbox, container, ds) => {\n examples.forEach(e => {\n ds.p(\n \"The twoslash compiler only has a few changes from the default empty TSConfig \"\n )\n ds.code(`\n const defaultCompilerOptions: CompilerOptions = {\n strict: true,\n target: ts.ScriptTarget.ES2016,\n allowJs: true\n }\n`)\n })\n ds.p(\n \"You may need to undo strict for some samples, but the others shouldn't affect most code repros.\"\n )\n },\n },\n {\n name: \"Examples\",\n content: (sandbox, container, ds) => {\n ds.p(\n \"Note: this section is tricky to document... These bugs may have been fixed since the docs were created. Consider theses as ideas in how to make repros rather than useful bug reproductions.\"\n )\n examples.forEach(e => {\n // prettier-ignore\n ds.subtitle(e.name + ` ${e.issue}`)\n ds.p(e.blurb)\n const button = document.createElement(\"button\")\n button.textContent = \"Show example\"\n button.onclick = () => sandbox.setText(e.code)\n container.appendChild(button)\n })\n },\n },\n]\n\nexport const workbenchReferencePlugin: Factory = (i, utils) => {\n return {\n id: \"ref\",\n displayName: \"Docs\",\n didMount: (sandbox, container) => {\n const ds = utils.createDesignSystem(container)\n\n const tabContainer = document.createElement(\"div\")\n const tabBar = ds.createTabBar()\n const tabs: HTMLElement[] = []\n\n reference.forEach((r, i) => {\n const tab = ds.createTabButton(r.name)\n tabs.push(tab)\n tab.onclick = () => {\n tabs.forEach(t => t.classList.remove(\"active\"))\n tab.classList.add(\"active\")\n\n const ds = utils.createDesignSystem(tabContainer)\n ds.clear()\n r.content(sandbox, tabContainer, ds)\n }\n tabBar.appendChild(tab)\n\n if (i === 0) tab.onclick({} as any)\n })\n\n container.appendChild(tabBar)\n container.appendChild(tabContainer)\n },\n }\n}\n","import React, { useEffect } from \"react\"\nimport ReactDOM from \"react-dom\"\nimport { Layout } from \"../../components/layout\"\nimport { withPrefix, graphql } from \"gatsby\"\nimport { debounce } from 'ts-debounce';\n\nimport \"../../templates/play.scss\"\n\nimport { useIntl } from \"react-intl\";\nimport { createInternational } from \"../../lib/createInternational\"\nimport { headCopy } from \"../../copy/en/head-seo\"\nimport { playCopy } from \"../../copy/en/playground\"\n\nimport { Intl } from \"../../components/Intl\"\n\nimport { workbenchHelpPlugin as workbenchAboutPlugin } from \"../../components/workbench/plugins/about\"\nimport { workbenchDebugPlugin } from \"../../components/workbench/plugins/debug\"\nimport { workbenchAssertionsPlugin } from \"../../components/workbench/plugins/assertions\"\nimport { workbenchMarkdownPlugin } from \"../../components/workbench/plugins/markdown\"\nimport { workbenchReferencePlugin } from \"../../components/workbench/plugins/docs\"\nimport { createDefaultMapFromCDN } from \"@typescript/vfs\"\nimport { twoslasher, TwoSlashReturn } from \"@typescript/twoslash\"\nimport { getPlaygroundUrls } from \"../../lib/playgroundURLs\";\n\ntype TwoSlashReturns = import(\"@typescript/twoslash\").TwoSlashReturn\n\ntype Props = {}\n\nconst Play: React.FC = (props) => {\n const i = createInternational(useIntl())\n let dtsMap: Map = new Map()\n\n useEffect(() => {\n if (\"playgroundLoaded\" in window) return\n window[\"playgroundLoaded\"] = true\n\n // @ts-ignore - for React-based plugins\n window.react = React\n // @ts-ignore - for React-based plugins\n window.reactDOM = ReactDOM\n // @ts-ignore - so that plugins etc can use local functions\n window.i = i\n\n const getLoaderScript = document.createElement('script');\n getLoaderScript.src = withPrefix(\"/js/vs.loader.js\");\n getLoaderScript.async = true;\n getLoaderScript.onload = async () => {\n const params = new URLSearchParams(location.search)\n\n let tsVersionParam = params.get(\"ts\")\n // handle the nightly lookup \n if (!tsVersionParam || tsVersionParam && tsVersionParam === \"Nightly\" || tsVersionParam === \"next\") {\n // Avoids the CDN to doubly skip caching\n const nightlyLookup = await fetch(\"https://tswebinfra.blob.core.windows.net/indexes/next.json\", { cache: \"no-cache\" })\n const nightlyJSON = await nightlyLookup.json()\n tsVersionParam = nightlyJSON.version\n }\n // Allow prod/staging builds to set a custom commit prefix to bust caches\n const { sandboxRoot, playgroundRoot, playgroundWorker } = getPlaygroundUrls()\n\n // @ts-ignore\n const re: any = global.require\n re.config({\n paths: {\n vs: `https://typescript.azureedge.net/cdn/${tsVersionParam}/monaco/dev/vs`,\n \"typescript-sandbox\": sandboxRoot,\n \"typescript-playground\": playgroundRoot,\n \"unpkg\": \"https://unpkg.com/\",\n \"local\": \"http://localhost:5000\"\n },\n ignoreDuplicateModules: [\"vs/editor/editor.main\"],\n });\n\n re([\"vs/editor/editor.main\", \"vs/language/typescript/tsWorker\", \"typescript-sandbox/index\", \"typescript-playground/index\"], async (main: typeof import(\"monaco-editor\"), tsWorker: any, sandbox: typeof import(\"@typescript/sandbox\"), playground: typeof import(\"@typescript/playground\")) => {\n // Importing \"vs/language/typescript/tsWorker\" will set ts as a global\n const ts = (global as any).ts\n const isOK = main && ts && sandbox && playground\n if (isOK) {\n document.getElementById(\"loader\")!.parentNode?.removeChild(document.getElementById(\"loader\")!)\n } else {\n console.error(\"Errr\")\n console.error(\"main\", !!main, \"ts\", !!ts, \"sandbox\", !!sandbox, \"playground\", !!playground)\n }\n\n // Set the height of monaco to be either your window height or 600px - whichever is smallest\n const container = document.getElementById(\"playground-container\")!\n container.style.display = \"flex\"\n const height = Math.max(window.innerHeight, 600)\n container.style.height = `${height - Math.round(container.getClientRects()[0].top) - 18}px`\n\n // Create the sandbox\n const sandboxEnv = await sandbox.createTypeScriptSandbox({\n text: localStorage.getItem('sandbox-history') || i(\"play_default_code_sample\"),\n compilerOptions: {},\n domID: \"monaco-editor-embed\",\n filetype: \"ts\",\n acquireTypes: !localStorage.getItem(\"disable-ata\"),\n supportTwoslashCompilerOptions: true,\n monacoSettings: {\n fontFamily: \"var(--code-font)\",\n fontLigatures: true\n },\n customTypeScriptWorkerPath: document.location.origin + playgroundWorker\n }, main, ts)\n\n const playgroundConfig = {\n lang: \"en\",\n prefix: withPrefix(\"/\"),\n supportCustomPlugins: false,\n plugins: [\n workbenchAboutPlugin,\n workbenchReferencePlugin,\n workbenchAssertionsPlugin,\n workbenchMarkdownPlugin,\n workbenchDebugPlugin\n ]\n }\n\n const playgroundEnv = playground.setupPlayground(sandboxEnv, main, playgroundConfig, i as any, React)\n\n const utils = playgroundEnv.createUtils(sandbox, React)\n\n const updateDTSEnv = (opts) => {\n createDefaultMapFromCDN(opts, tsVersionParam!, true, ts, sandboxEnv.lzstring as any).then((defaultMap) => {\n dtsMap = defaultMap\n runTwoslash()\n })\n }\n\n // When the compiler notices a twoslash compiler flag change, this will get triggered and reset the DTS map\n sandboxEnv.setDidUpdateCompilerSettings(updateDTSEnv)\n updateDTSEnv(sandboxEnv.getCompilerOptions())\n\n \n const debouncedTwoslash = debounce(() => {\n if (dtsMap) runTwoslash()\n }, 1000)\n\n sandboxEnv.editor.onDidChangeModelContent(debouncedTwoslash)\n\n let currentTwoslashResults: Error | TwoSlashReturn | undefined = undefined\n let currentDTSMap: Map | undefined = undefined\n\n let isError = (e: any) => e && e.stack && e.message;\n\n playgroundEnv.setDidUpdateTab((newPlugin) => {\n if (!isError(currentTwoslashResults) && \"getResults\" in newPlugin) {\n // @ts-ignore\n newPlugin.getResults(sandboxEnv, currentTwoslashResults, currentDTSMap, sandboxEnv.getText().includes(\"// @showEmit\"))\n } else if (\"noResults\" in newPlugin) {\n // @ts-ignore\n newPlugin.noResults(currentTwoslashResults, currentTwoslashResults)\n }\n })\n\n const runTwoslash = () => {\n const code = sandboxEnv.getText()\n if (!code) return\n\n try {\n currentDTSMap = new Map(dtsMap)\n const twoslashConfig = { noStaticSemanticInfo: true, emit: true, noErrorValidation: true } as const\n const ext = sandboxEnv.filepath.split(\".\")[1]\n const twoslash: TwoSlashReturns = twoslasher(code, ext, {\n defaultOptions: twoslashConfig,\n tsModule: ts,\n lzstringModule: sandboxEnv.lzstring as any,\n fsMap: currentDTSMap\n })\n currentTwoslashResults = twoslash\n\n const currentPlugin = playgroundEnv.getCurrentPlugin()\n if (\"getResults\" in currentPlugin) {\n // @ts-ignore\n currentPlugin.getResults(sandboxEnv, twoslash, currentDTSMap, code.includes(\"// @showEmit\"))\n }\n\n const assertionCount = twoslash.queries.length + (code.includes(\"// @showEmit\") ? 1 : 0) + twoslash.errors.length\n utils.setNotifications(\"assertions\", assertionCount)\n\n } catch (error) {\n const err = error as Error\n console.log(err)\n currentTwoslashResults = err\n const currentPlugin = playgroundEnv.getCurrentPlugin()\n if (\"noResults\" in currentPlugin) {\n // @ts-ignore\n currentPlugin.noResults(sandboxEnv, err)\n }\n utils.setNotifications(\"assertions\", 1)\n }\n }\n\n // Dark mode faff\n const darkModeEnabled = document.documentElement.classList.contains(\"dark-theme\")\n if (darkModeEnabled) {\n sandboxEnv.monaco.editor.setTheme(\"sandbox-dark\");\n }\n\n sandboxEnv.editor.focus()\n sandboxEnv.editor.layout()\n\n debouncedTwoslash()\n });\n }\n\n document.body.appendChild(getLoaderScript);\n }, [])\n\n\n return (\n \n {/** This is the top nav, which is outside of the editor */}\n \n\n
\n
\n
\n

{i(\"play_downloading_typescript\")}

\n
\n
\n
\n
\n\n \n \n
\n { /** This is the div which monaco is added into **/}\n
\n
\n
\n
\n \n )\n}\n\n\nexport default (props: Props) => \n"],"sourceRoot":""}