monaco-editor11 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1068) hide show
  1. package/dist/index.d.ts +0 -7
  2. package/dist/monaco-editor11.es.js +0 -49
  3. package/dist/monaco-editor11.umd.js +1 -1
  4. package/dist/workers/_.contribution.js +120 -0
  5. package/dist/workers/abap.contribution.js +8 -0
  6. package/dist/workers/abap.js +1397 -0
  7. package/dist/workers/abstractCodeEditorService.js +129 -0
  8. package/dist/workers/abstractKeybindingService.js +286 -0
  9. package/dist/workers/abstractScrollbar.js +214 -0
  10. package/dist/workers/abstractSyntaxTokenBackend.js +128 -0
  11. package/dist/workers/abstractText.js +89 -0
  12. package/dist/workers/abstractTree.js +2027 -0
  13. package/dist/workers/accessibility.js +11 -0
  14. package/dist/workers/accessibilityService.js +111 -0
  15. package/dist/workers/accessibilitySignalService.js +331 -0
  16. package/dist/workers/accessibleDiffViewer.js +588 -0
  17. package/dist/workers/accessibleViewRegistry.js +25 -0
  18. package/dist/workers/action.js +15 -0
  19. package/dist/workers/actionCommonCategories.js +16 -0
  20. package/dist/workers/actionList.js +344 -0
  21. package/dist/workers/actionViewItemService.js +29 -0
  22. package/dist/workers/actionViewItems.js +376 -0
  23. package/dist/workers/actionWidget.js +236 -0
  24. package/dist/workers/actionbar.js +462 -0
  25. package/dist/workers/actions.js +483 -0
  26. package/dist/workers/anchorSelect.js +160 -0
  27. package/dist/workers/animation.js +74 -0
  28. package/dist/workers/apex.contribution.js +9 -0
  29. package/dist/workers/apex.js +329 -0
  30. package/dist/workers/aria.js +84 -0
  31. package/dist/workers/arrays.js +529 -0
  32. package/dist/workers/arraysFind.js +177 -0
  33. package/dist/workers/assert.js +79 -0
  34. package/dist/workers/ast.js +485 -0
  35. package/dist/workers/async.js +938 -0
  36. package/dist/workers/asyncDataTree.js +946 -0
  37. package/dist/workers/autoIndent.js +390 -0
  38. package/dist/workers/autorun.js +89 -0
  39. package/dist/workers/autorunImpl.js +215 -0
  40. package/dist/workers/azcli.contribution.js +8 -0
  41. package/dist/workers/azcli.js +67 -0
  42. package/dist/workers/bannerController.js +118 -0
  43. package/dist/workers/base.js +19 -0
  44. package/dist/workers/baseColors.js +31 -0
  45. package/dist/workers/baseObservable.js +106 -0
  46. package/dist/workers/baseRenderStrategy.js +19 -0
  47. package/dist/workers/baseResolvedKeybinding.js +56 -0
  48. package/dist/workers/bat.contribution.js +8 -0
  49. package/dist/workers/bat.js +99 -0
  50. package/dist/workers/beforeEditPositionMapper.js +110 -0
  51. package/dist/workers/bicep.contribution.js +8 -0
  52. package/dist/workers/bicep.js +108 -0
  53. package/dist/workers/blockCommentCommand.js +149 -0
  54. package/dist/workers/blockDecorations.js +97 -0
  55. package/dist/workers/bracketMatching.js +359 -0
  56. package/dist/workers/bracketPairsImpl.js +717 -0
  57. package/dist/workers/bracketPairsTree.js +343 -0
  58. package/dist/workers/bracketSelections.js +149 -0
  59. package/dist/workers/brackets.js +108 -0
  60. package/dist/workers/browser.js +57 -0
  61. package/dist/workers/buffer.js +81 -0
  62. package/dist/workers/bufferDirtyTracker.js +45 -0
  63. package/dist/workers/bulkEditService.js +76 -0
  64. package/dist/workers/button.js +226 -0
  65. package/dist/workers/cache.js +61 -0
  66. package/dist/workers/cameligo.contribution.js +8 -0
  67. package/dist/workers/cameligo.js +173 -0
  68. package/dist/workers/canIUse.js +23 -0
  69. package/dist/workers/cancellation.js +116 -0
  70. package/dist/workers/caretOperations.js +48 -0
  71. package/dist/workers/changeRecorder.js +78 -0
  72. package/dist/workers/changeTracker.js +80 -0
  73. package/dist/workers/charWidthReader.js +104 -0
  74. package/dist/workers/characterClassifier.js +59 -0
  75. package/dist/workers/characterPair.js +40 -0
  76. package/dist/workers/chartsColors.js +18 -0
  77. package/dist/workers/clickLinkGesture.js +161 -0
  78. package/dist/workers/clipboard.js +308 -0
  79. package/dist/workers/clipboardService.js +9 -0
  80. package/dist/workers/clipboardUtils.js +85 -0
  81. package/dist/workers/clojure.contribution.js +8 -0
  82. package/dist/workers/clojure.js +760 -0
  83. package/dist/workers/codeAction.js +306 -0
  84. package/dist/workers/codeActionCommands.js +230 -0
  85. package/dist/workers/codeActionContributions.js +55 -0
  86. package/dist/workers/codeActionController.js +372 -0
  87. package/dist/workers/codeActionKeybindingResolver.js +90 -0
  88. package/dist/workers/codeActionMenu.js +68 -0
  89. package/dist/workers/codeActionModel.js +334 -0
  90. package/dist/workers/codeEditorContributions.js +132 -0
  91. package/dist/workers/codeEditorService.js +9 -0
  92. package/dist/workers/codeEditorWidget.js +1856 -0
  93. package/dist/workers/codeLensCache.js +112 -0
  94. package/dist/workers/codelens.js +114 -0
  95. package/dist/workers/codelensController.js +469 -0
  96. package/dist/workers/codelensWidget.js +265 -0
  97. package/dist/workers/codicons.js +50 -0
  98. package/dist/workers/codiconsLibrary.js +642 -0
  99. package/dist/workers/codiconsUtil.js +22 -0
  100. package/dist/workers/coffee.contribution.js +9 -0
  101. package/dist/workers/coffee.js +231 -0
  102. package/dist/workers/collections.js +98 -0
  103. package/dist/workers/color.js +94 -0
  104. package/dist/workers/colorDetector.js +245 -0
  105. package/dist/workers/colorPickerBody.js +71 -0
  106. package/dist/workers/colorPickerCloseButton.js +34 -0
  107. package/dist/workers/colorPickerContribution.js +50 -0
  108. package/dist/workers/colorPickerHeader.js +79 -0
  109. package/dist/workers/colorPickerInsertButton.js +27 -0
  110. package/dist/workers/colorPickerModel.js +74 -0
  111. package/dist/workers/colorPickerParticipantUtils.js +52 -0
  112. package/dist/workers/colorPickerSaturationBox.js +106 -0
  113. package/dist/workers/colorPickerStrip.js +98 -0
  114. package/dist/workers/colorPickerWidget.js +32 -0
  115. package/dist/workers/colorUtils.js +199 -0
  116. package/dist/workers/colorizedBracketPairsDecorationProvider.js +97 -0
  117. package/dist/workers/colorizer.js +120 -0
  118. package/dist/workers/colors.js +20 -0
  119. package/dist/workers/columnRange.js +35 -0
  120. package/dist/workers/combineTextEditInfos.js +124 -0
  121. package/dist/workers/commandIds.js +12 -0
  122. package/dist/workers/commands.js +329 -0
  123. package/dist/workers/commandsQuickAccess.js +40 -0
  124. package/dist/workers/comment.js +147 -0
  125. package/dist/workers/common.js +20 -0
  126. package/dist/workers/comparers.js +87 -0
  127. package/dist/workers/completionModel.js +227 -0
  128. package/dist/workers/compressedObjectTreeModel.js +385 -0
  129. package/dist/workers/computeGhostText.js +182 -0
  130. package/dist/workers/computeMovedLines.js +249 -0
  131. package/dist/workers/concat23Trees.js +192 -0
  132. package/dist/workers/configuration.js +92 -0
  133. package/dist/workers/configurationModels.js +614 -0
  134. package/dist/workers/configurationRegistry.js +400 -0
  135. package/dist/workers/configurations.js +46 -0
  136. package/dist/workers/consoleObservableLogger.js +83 -0
  137. package/dist/workers/constObservable.js +35 -0
  138. package/dist/workers/contentHoverComputer.js +71 -0
  139. package/dist/workers/contentHoverController.js +320 -0
  140. package/dist/workers/contentHoverRendered.js +336 -0
  141. package/dist/workers/contentHoverStatusBar.js +52 -0
  142. package/dist/workers/contentHoverTypes.js +29 -0
  143. package/dist/workers/contentHoverWidget.js +394 -0
  144. package/dist/workers/contentHoverWidgetWrapper.js +362 -0
  145. package/dist/workers/contentSegmenter.js +52 -0
  146. package/dist/workers/contentWidgets.js +495 -0
  147. package/dist/workers/contextKeyService.js +468 -0
  148. package/dist/workers/contextMenuHandler.js +126 -0
  149. package/dist/workers/contextMenuService.js +103 -0
  150. package/dist/workers/contextScopedHistoryWidget.js +106 -0
  151. package/dist/workers/contextViewService.js +73 -0
  152. package/dist/workers/contextkey.js +1551 -0
  153. package/dist/workers/contextkeys.js +21 -0
  154. package/dist/workers/contextmenu.js +334 -0
  155. package/dist/workers/contextview.js +298 -0
  156. package/dist/workers/contiguousMultilineTokens.js +32 -0
  157. package/dist/workers/contiguousMultilineTokensBuilder.js +23 -0
  158. package/dist/workers/contiguousTokensEditing.js +128 -0
  159. package/dist/workers/contiguousTokensStore.js +207 -0
  160. package/dist/workers/contribution.js +36 -0
  161. package/dist/workers/coordinatesConverter.js +51 -0
  162. package/dist/workers/copyLinesCommand.js +73 -0
  163. package/dist/workers/copyPasteContribution.js +114 -0
  164. package/dist/workers/copyPasteController.js +585 -0
  165. package/dist/workers/copySelection.js +47 -0
  166. package/dist/workers/coreCommands.js +1731 -0
  167. package/dist/workers/countBadge.js +52 -0
  168. package/dist/workers/cpp.contribution.js +14 -0
  169. package/dist/workers/cpp.js +388 -0
  170. package/dist/workers/csharp.contribution.js +8 -0
  171. package/dist/workers/csharp.js +325 -0
  172. package/dist/workers/csp.contribution.js +8 -0
  173. package/dist/workers/csp.js +52 -0
  174. package/dist/workers/css.contribution.js +9 -0
  175. package/dist/workers/css.js +184 -0
  176. package/dist/workers/cssMode.js +198 -0
  177. package/dist/workers/cssValue.js +69 -0
  178. package/dist/workers/cssWorker.js +183 -0
  179. package/dist/workers/currentLineHighlight.js +205 -0
  180. package/dist/workers/cursor.js +899 -0
  181. package/dist/workers/cursorAtomicMoveOperations.js +145 -0
  182. package/dist/workers/cursorCollection.js +194 -0
  183. package/dist/workers/cursorColumnSelection.js +93 -0
  184. package/dist/workers/cursorColumns.js +112 -0
  185. package/dist/workers/cursorCommon.js +250 -0
  186. package/dist/workers/cursorContext.js +15 -0
  187. package/dist/workers/cursorDeleteOperations.js +231 -0
  188. package/dist/workers/cursorMoveCommands.js +676 -0
  189. package/dist/workers/cursorMoveOperations.js +290 -0
  190. package/dist/workers/cursorTypeEditOperations.js +968 -0
  191. package/dist/workers/cursorTypeOperations.js +173 -0
  192. package/dist/workers/cursorUndo.js +133 -0
  193. package/dist/workers/cursorUtils.js +75 -0
  194. package/dist/workers/cursorWordOperations.js +720 -0
  195. package/dist/workers/cypher.contribution.js +8 -0
  196. package/dist/workers/cypher.js +262 -0
  197. package/dist/workers/dart.contribution.js +9 -0
  198. package/dist/workers/dart.js +280 -0
  199. package/dist/workers/dataChannel.js +12 -0
  200. package/dist/workers/dataTransfer.js +80 -0
  201. package/dist/workers/dataTree.js +20 -0
  202. package/dist/workers/date.js +57 -0
  203. package/dist/workers/debugLocation.js +66 -0
  204. package/dist/workers/debugName.js +110 -0
  205. package/dist/workers/debuggerRpc.js +67 -0
  206. package/dist/workers/decorationCssRuleExtractor.js +73 -0
  207. package/dist/workers/decorationStyleCache.js +40 -0
  208. package/dist/workers/decorations.js +196 -0
  209. package/dist/workers/decorationsOverviewRuler.js +416 -0
  210. package/dist/workers/decorators.js +33 -0
  211. package/dist/workers/defaultDocumentColorProvider.js +55 -0
  212. package/dist/workers/defaultDocumentColorsComputer.js +138 -0
  213. package/dist/workers/defaultLinesDiffComputer.js +188 -0
  214. package/dist/workers/defaultProviders.js +230 -0
  215. package/dist/workers/defaultStyles.js +194 -0
  216. package/dist/workers/delegatingEditorImpl.js +111 -0
  217. package/dist/workers/derived.js +80 -0
  218. package/dist/workers/derivedImpl.js +353 -0
  219. package/dist/workers/descriptors.js +13 -0
  220. package/dist/workers/devToolsLogger.js +442 -0
  221. package/dist/workers/dialogs.js +5 -0
  222. package/dist/workers/diff.js +902 -0
  223. package/dist/workers/diffAlgorithm.js +139 -0
  224. package/dist/workers/diffChange.js +34 -0
  225. package/dist/workers/diffEditor.contribution.js +83 -0
  226. package/dist/workers/diffEditor.js +38 -0
  227. package/dist/workers/diffEditorDecorations.js +115 -0
  228. package/dist/workers/diffEditorEditors.js +190 -0
  229. package/dist/workers/diffEditorItemTemplate.js +272 -0
  230. package/dist/workers/diffEditorOptions.js +152 -0
  231. package/dist/workers/diffEditorSash.js +86 -0
  232. package/dist/workers/diffEditorViewModel.js +608 -0
  233. package/dist/workers/diffEditorViewZones.js +525 -0
  234. package/dist/workers/diffEditorWidget.js +590 -0
  235. package/dist/workers/diffProviderFactoryService.js +142 -0
  236. package/dist/workers/dnd.js +198 -0
  237. package/dist/workers/dockerfile.contribution.js +9 -0
  238. package/dist/workers/dockerfile.js +129 -0
  239. package/dist/workers/documentSemanticTokens.js +362 -0
  240. package/dist/workers/documentSymbols.js +24 -0
  241. package/dist/workers/dom.js +1454 -0
  242. package/dist/workers/domFontInfo.js +28 -0
  243. package/dist/workers/domLineBreaksComputer.js +301 -0
  244. package/dist/workers/domReadingContext.js +43 -0
  245. package/dist/workers/domSanitize.js +312 -0
  246. package/dist/workers/domStylesheets.js +145 -0
  247. package/dist/workers/dompurify.js +1347 -0
  248. package/dist/workers/dragAndDropCommand.js +65 -0
  249. package/dist/workers/dragScrolling.js +174 -0
  250. package/dist/workers/dropIntoEditorContribution.js +41 -0
  251. package/dist/workers/dropIntoEditorController.js +173 -0
  252. package/dist/workers/dropdown.js +141 -0
  253. package/dist/workers/dropdownActionViewItem.js +109 -0
  254. package/dist/workers/dynamicProgrammingDiffing.js +101 -0
  255. package/dist/workers/dynamicViewOverlay.js +10 -0
  256. package/dist/workers/ecl.contribution.js +8 -0
  257. package/dist/workers/ecl.js +455 -0
  258. package/dist/workers/edcore.main.js +74 -0
  259. package/dist/workers/edit.js +83 -0
  260. package/dist/workers/editContext.js +10 -0
  261. package/dist/workers/editContextFactory.js +16 -0
  262. package/dist/workers/editOperation.js +36 -0
  263. package/dist/workers/editStack.js +363 -0
  264. package/dist/workers/editor.all.js +65 -0
  265. package/dist/workers/editor.api.js +2 -0
  266. package/dist/workers/editor.api2.js +60 -0
  267. package/dist/workers/editor.js +15 -0
  268. package/dist/workers/editor.main.js +170 -0
  269. package/dist/workers/editor.worker.start.js +44 -0
  270. package/dist/workers/editorAction.js +26 -0
  271. package/dist/workers/editorBaseApi.js +43 -0
  272. package/dist/workers/editorBrowser.js +53 -0
  273. package/dist/workers/editorColorRegistry.js +102 -0
  274. package/dist/workers/editorColors.js +128 -0
  275. package/dist/workers/editorCommon.js +13 -0
  276. package/dist/workers/editorConfiguration.js +292 -0
  277. package/dist/workers/editorConfigurationSchema.js +338 -0
  278. package/dist/workers/editorContextKeys.js +84 -0
  279. package/dist/workers/editorDom.js +299 -0
  280. package/dist/workers/editorExtensions.js +489 -0
  281. package/dist/workers/editorFeatures.js +17 -0
  282. package/dist/workers/editorGutter.js +117 -0
  283. package/dist/workers/editorMarkdownCodeBlockRenderer.js +85 -0
  284. package/dist/workers/editorNavigationQuickAccess.js +152 -0
  285. package/dist/workers/editorOptions.js +3440 -0
  286. package/dist/workers/editorScrollbar.js +151 -0
  287. package/dist/workers/editorState.js +115 -0
  288. package/dist/workers/editorTheme.js +23 -0
  289. package/dist/workers/editorWebWorker.js +299 -0
  290. package/dist/workers/editorWorker.js +9 -0
  291. package/dist/workers/editorWorkerHost.js +15 -0
  292. package/dist/workers/editorWorkerService.js +366 -0
  293. package/dist/workers/editorZoom.js +26 -0
  294. package/dist/workers/electricCharacter.js +55 -0
  295. package/dist/workers/elementSizeObserver.js +107 -0
  296. package/dist/workers/elixir.contribution.js +8 -0
  297. package/dist/workers/elixir.js +568 -0
  298. package/dist/workers/embeddedCodeEditorWidget.js +66 -0
  299. package/dist/workers/encodedTokenAttributes.js +79 -0
  300. package/dist/workers/enterAction.js +53 -0
  301. package/dist/workers/environment.js +5 -0
  302. package/dist/workers/eolCounter.js +44 -0
  303. package/dist/workers/equals.js +84 -0
  304. package/dist/workers/errorMessage.js +71 -0
  305. package/dist/workers/errors.js +163 -0
  306. package/dist/workers/event.js +1197 -0
  307. package/dist/workers/extensions.js +18 -0
  308. package/dist/workers/extpath.js +147 -0
  309. package/dist/workers/fastDomNode.js +255 -0
  310. package/dist/workers/files.js +19 -0
  311. package/dist/workers/filters.js +742 -0
  312. package/dist/workers/findController.js +970 -0
  313. package/dist/workers/findDecorations.js +311 -0
  314. package/dist/workers/findInput.js +294 -0
  315. package/dist/workers/findInputToggles.js +52 -0
  316. package/dist/workers/findModel.js +497 -0
  317. package/dist/workers/findOptionsWidget.js +155 -0
  318. package/dist/workers/findSectionHeaders.js +128 -0
  319. package/dist/workers/findState.js +244 -0
  320. package/dist/workers/findWidget.js +1168 -0
  321. package/dist/workers/findWidgetSearchHistory.js +85 -0
  322. package/dist/workers/fixBrackets.js +67 -0
  323. package/dist/workers/fixedArray.js +70 -0
  324. package/dist/workers/floatingMenu.contribution.js +9 -0
  325. package/dist/workers/floatingMenu.js +94 -0
  326. package/dist/workers/flow9.contribution.js +8 -0
  327. package/dist/workers/flow9.js +141 -0
  328. package/dist/workers/folding.js +1136 -0
  329. package/dist/workers/foldingDecorations.js +158 -0
  330. package/dist/workers/foldingModel.js +532 -0
  331. package/dist/workers/foldingRanges.js +354 -0
  332. package/dist/workers/fontInfo.js +172 -0
  333. package/dist/workers/fontInfoFromSettings.js +29 -0
  334. package/dist/workers/fontMeasurements.js +206 -0
  335. package/dist/workers/fontZoom.js +47 -0
  336. package/dist/workers/fonts.js +17 -0
  337. package/dist/workers/format.js +367 -0
  338. package/dist/workers/formatActions.js +263 -0
  339. package/dist/workers/formattedTextRenderer.js +160 -0
  340. package/dist/workers/formattingEdit.js +57 -0
  341. package/dist/workers/forwardingTelemetryService.js +60 -0
  342. package/dist/workers/freemarker2.contribution.js +52 -0
  343. package/dist/workers/freemarker2.js +1062 -0
  344. package/dist/workers/fsharp.contribution.js +8 -0
  345. package/dist/workers/fsharp.js +216 -0
  346. package/dist/workers/fullFileRenderStrategy.js +414 -0
  347. package/dist/workers/fullFileRenderStrategy.wgsl.js +93 -0
  348. package/dist/workers/functional.js +24 -0
  349. package/dist/workers/fuzzyScorer.js +143 -0
  350. package/dist/workers/getHover.js +56 -0
  351. package/dist/workers/getIconClasses.js +106 -0
  352. package/dist/workers/getLinks.js +157 -0
  353. package/dist/workers/getPositionOffsetTransformerFromTextModel.js +24 -0
  354. package/dist/workers/getSemanticTokens.js +211 -0
  355. package/dist/workers/ghostText.js +111 -0
  356. package/dist/workers/ghostTextView.js +449 -0
  357. package/dist/workers/glob.js +581 -0
  358. package/dist/workers/globalPointerMoveMonitor.js +83 -0
  359. package/dist/workers/glyphHoverComputer.js +40 -0
  360. package/dist/workers/glyphHoverController.js +171 -0
  361. package/dist/workers/glyphHoverWidget.js +184 -0
  362. package/dist/workers/glyphLanesModel.js +61 -0
  363. package/dist/workers/glyphMargin.js +403 -0
  364. package/dist/workers/glyphRasterizer.js +276 -0
  365. package/dist/workers/go.contribution.js +8 -0
  366. package/dist/workers/go.js +217 -0
  367. package/dist/workers/goToCommands.js +694 -0
  368. package/dist/workers/goToDefinitionAtPosition.js +267 -0
  369. package/dist/workers/goToSymbol.js +128 -0
  370. package/dist/workers/gotoError.js +272 -0
  371. package/dist/workers/gotoErrorWidget.js +352 -0
  372. package/dist/workers/gotoLineQuickAccess.js +183 -0
  373. package/dist/workers/gotoSymbolQuickAccess.js +395 -0
  374. package/dist/workers/gpuActions.js +126 -0
  375. package/dist/workers/gpuDisposable.js +48 -0
  376. package/dist/workers/gpuMark.js +80 -0
  377. package/dist/workers/gpuUtils.js +58 -0
  378. package/dist/workers/graph.js +74 -0
  379. package/dist/workers/graphql.contribution.js +9 -0
  380. package/dist/workers/graphql.js +150 -0
  381. package/dist/workers/guidesTextModelPart.js +405 -0
  382. package/dist/workers/gutterFeature.js +238 -0
  383. package/dist/workers/gutterIndicatorMenu.js +252 -0
  384. package/dist/workers/gutterIndicatorView.js +456 -0
  385. package/dist/workers/handlebars.contribution.js +9 -0
  386. package/dist/workers/handlebars.js +485 -0
  387. package/dist/workers/hash.js +256 -0
  388. package/dist/workers/hcl.contribution.js +8 -0
  389. package/dist/workers/hcl.js +182 -0
  390. package/dist/workers/helpQuickAccess.js +77 -0
  391. package/dist/workers/heuristicSequenceOptimizations.js +374 -0
  392. package/dist/workers/hiddenRangeModel.js +126 -0
  393. package/dist/workers/hideUnchangedRegionsFeature.js +433 -0
  394. package/dist/workers/hierarchicalKind.js +26 -0
  395. package/dist/workers/highlightDecorations.js +111 -0
  396. package/dist/workers/highlightedLabel.js +129 -0
  397. package/dist/workers/history.js +85 -0
  398. package/dist/workers/historyWidgetKeybindingHint.js +9 -0
  399. package/dist/workers/horizontalScrollbar.js +91 -0
  400. package/dist/workers/hotReloadHelpers.js +17 -0
  401. package/dist/workers/hover.js +11 -0
  402. package/dist/workers/hoverAccessibleViews.js +8 -0
  403. package/dist/workers/hoverActionIds.js +23 -0
  404. package/dist/workers/hoverActions.js +424 -0
  405. package/dist/workers/hoverColorPicker.js +14 -0
  406. package/dist/workers/hoverColorPickerContribution.js +44 -0
  407. package/dist/workers/hoverColorPickerParticipant.js +151 -0
  408. package/dist/workers/hoverContribution.js +56 -0
  409. package/dist/workers/hoverCopyButton.js +54 -0
  410. package/dist/workers/hoverDelegate2.js +39 -0
  411. package/dist/workers/hoverDelegateFactory.js +34 -0
  412. package/dist/workers/hoverOperation.js +168 -0
  413. package/dist/workers/hoverParticipant.js +161 -0
  414. package/dist/workers/hoverService.js +542 -0
  415. package/dist/workers/hoverTypes.js +64 -0
  416. package/dist/workers/hoverUtils.js +18 -0
  417. package/dist/workers/hoverWidget.js +93 -0
  418. package/dist/workers/html.contribution.js +9 -0
  419. package/dist/workers/html.js +374 -0
  420. package/dist/workers/htmlContent.js +164 -0
  421. package/dist/workers/htmlMode.js +213 -0
  422. package/dist/workers/htmlWorker.js +126 -0
  423. package/dist/workers/iPadShowKeyboard.js +74 -0
  424. package/dist/workers/iconLabel.js +291 -0
  425. package/dist/workers/iconLabels.js +33 -0
  426. package/dist/workers/iconRegistry.js +183 -0
  427. package/dist/workers/iconsStyleSheet.js +75 -0
  428. package/dist/workers/idGenerator.js +16 -0
  429. package/dist/workers/iframe.js +87 -0
  430. package/dist/workers/ime.js +33 -0
  431. package/dist/workers/inPlaceReplace.js +151 -0
  432. package/dist/workers/inPlaceReplaceCommand.js +27 -0
  433. package/dist/workers/indentGuides.js +254 -0
  434. package/dist/workers/indentRangeProvider.js +166 -0
  435. package/dist/workers/indentRules.js +63 -0
  436. package/dist/workers/indentUtils.js +33 -0
  437. package/dist/workers/indentation.js +100 -0
  438. package/dist/workers/indentationGuesser.js +178 -0
  439. package/dist/workers/indentationLineProcessor.js +193 -0
  440. package/dist/workers/index.js +21 -0
  441. package/dist/workers/indexTreeModel.js +538 -0
  442. package/dist/workers/ini.contribution.js +9 -0
  443. package/dist/workers/ini.js +70 -0
  444. package/dist/workers/initialize.js +11 -0
  445. package/dist/workers/inlayHints.js +147 -0
  446. package/dist/workers/inlayHintsContribution.js +11 -0
  447. package/dist/workers/inlayHintsController.js +686 -0
  448. package/dist/workers/inlayHintsHover.js +162 -0
  449. package/dist/workers/inlayHintsLocations.js +96 -0
  450. package/dist/workers/inlineCompletionContextKeys.js +23 -0
  451. package/dist/workers/inlineCompletions.contribution.js +31 -0
  452. package/dist/workers/inlineCompletionsAccessibleView.js +4 -0
  453. package/dist/workers/inlineCompletionsController.js +427 -0
  454. package/dist/workers/inlineCompletionsHintsWidget.js +356 -0
  455. package/dist/workers/inlineCompletionsModel.js +1048 -0
  456. package/dist/workers/inlineCompletionsService.js +170 -0
  457. package/dist/workers/inlineCompletionsSource.js +548 -0
  458. package/dist/workers/inlineCompletionsView.js +86 -0
  459. package/dist/workers/inlineDecorations.js +26 -0
  460. package/dist/workers/inlineDiffDeletedCodeMargin.js +138 -0
  461. package/dist/workers/inlineEdit.js +17 -0
  462. package/dist/workers/inlineEditWithChanges.js +30 -0
  463. package/dist/workers/inlineEditsCollapsedView.js +132 -0
  464. package/dist/workers/inlineEditsCustomView.js +256 -0
  465. package/dist/workers/inlineEditsDeletionView.js +178 -0
  466. package/dist/workers/inlineEditsInsertionView.js +267 -0
  467. package/dist/workers/inlineEditsLineReplacementView.js +329 -0
  468. package/dist/workers/inlineEditsModel.js +59 -0
  469. package/dist/workers/inlineEditsNewUsers.js +174 -0
  470. package/dist/workers/inlineEditsSideBySideView.js +517 -0
  471. package/dist/workers/inlineEditsView.js +561 -0
  472. package/dist/workers/inlineEditsViewInterface.js +21 -0
  473. package/dist/workers/inlineEditsViewProducer.js +119 -0
  474. package/dist/workers/inlineEditsWordReplacementView.js +211 -0
  475. package/dist/workers/inlineProgress.js +139 -0
  476. package/dist/workers/inlineSuggestionItem.js +497 -0
  477. package/dist/workers/inplaceReplaceSupport.js +87 -0
  478. package/dist/workers/inputBox.js +510 -0
  479. package/dist/workers/inputColors.js +66 -0
  480. package/dist/workers/inputMode.js +22 -0
  481. package/dist/workers/insertFinalNewLine.js +32 -0
  482. package/dist/workers/insertFinalNewLineCommand.js +39 -0
  483. package/dist/workers/inspectTokens.js +240 -0
  484. package/dist/workers/instantiation.js +44 -0
  485. package/dist/workers/instantiationService.js +403 -0
  486. package/dist/workers/intervalTree.js +1002 -0
  487. package/dist/workers/iterator.js +186 -0
  488. package/dist/workers/java.contribution.js +9 -0
  489. package/dist/workers/java.js +231 -0
  490. package/dist/workers/javascript.contribution.js +11 -0
  491. package/dist/workers/javascript.js +70 -0
  492. package/dist/workers/jsonContributionRegistry.js +42 -0
  493. package/dist/workers/jsonMode.js +224 -0
  494. package/dist/workers/jsonWorker.js +187 -0
  495. package/dist/workers/julia.contribution.js +8 -0
  496. package/dist/workers/julia.js +510 -0
  497. package/dist/workers/keyCodes.js +351 -0
  498. package/dist/workers/keybinding.js +9 -0
  499. package/dist/workers/keybindingCancellation.js +81 -0
  500. package/dist/workers/keybindingLabel.js +122 -0
  501. package/dist/workers/keybindingLabels.js +139 -0
  502. package/dist/workers/keybindingResolver.js +304 -0
  503. package/dist/workers/keybindings.js +104 -0
  504. package/dist/workers/keybindingsRegistry.js +111 -0
  505. package/dist/workers/keyboardEvent.js +125 -0
  506. package/dist/workers/korean.js +321 -0
  507. package/dist/workers/kotlin.contribution.js +9 -0
  508. package/dist/workers/kotlin.js +251 -0
  509. package/dist/workers/label.js +5 -0
  510. package/dist/workers/labels.js +15 -0
  511. package/dist/workers/language.js +9 -0
  512. package/dist/workers/languageBracketsConfiguration.js +133 -0
  513. package/dist/workers/languageConfiguration.js +138 -0
  514. package/dist/workers/languageConfigurationRegistry.js +361 -0
  515. package/dist/workers/languageFeatureDebounce.js +137 -0
  516. package/dist/workers/languageFeatureRegistry.js +180 -0
  517. package/dist/workers/languageFeatures.js +9 -0
  518. package/dist/workers/languageFeaturesService.js +47 -0
  519. package/dist/workers/languageSelector.js +112 -0
  520. package/dist/workers/languageService.js +92 -0
  521. package/dist/workers/languages.js +522 -0
  522. package/dist/workers/languagesAssociations.js +193 -0
  523. package/dist/workers/languagesRegistry.js +237 -0
  524. package/dist/workers/layoutService.js +9 -0
  525. package/dist/workers/lazy.js +49 -0
  526. package/dist/workers/lazyObservableValue.js +125 -0
  527. package/dist/workers/legacyLinesDiffComputer.js +468 -0
  528. package/dist/workers/length.js +129 -0
  529. package/dist/workers/less.contribution.js +9 -0
  530. package/dist/workers/less.js +160 -0
  531. package/dist/workers/lexon.contribution.js +8 -0
  532. package/dist/workers/lexon.js +156 -0
  533. package/dist/workers/lib.index.js +103 -0
  534. package/dist/workers/lib.js +1107 -0
  535. package/dist/workers/lifecycle.js +311 -0
  536. package/dist/workers/lightBulbWidget.js +427 -0
  537. package/dist/workers/lineCommentCommand.js +328 -0
  538. package/dist/workers/lineDecorations.js +208 -0
  539. package/dist/workers/lineEdit.js +75 -0
  540. package/dist/workers/lineHeights.js +370 -0
  541. package/dist/workers/lineNumbers.js +184 -0
  542. package/dist/workers/linePart.js +25 -0
  543. package/dist/workers/lineRange.js +312 -0
  544. package/dist/workers/lineSelection.js +36 -0
  545. package/dist/workers/lineSequence.js +36 -0
  546. package/dist/workers/lineTokens.js +405 -0
  547. package/dist/workers/linesDecorations.js +104 -0
  548. package/dist/workers/linesDiffComputer.js +29 -0
  549. package/dist/workers/linesDiffComputers.js +13 -0
  550. package/dist/workers/linesLayout.js +765 -0
  551. package/dist/workers/linesOperations.js +1187 -0
  552. package/dist/workers/linesSliceCharSequence.js +205 -0
  553. package/dist/workers/link.js +95 -0
  554. package/dist/workers/linkComputer.js +269 -0
  555. package/dist/workers/linkedEditing.js +381 -0
  556. package/dist/workers/linkedList.js +126 -0
  557. package/dist/workers/linkedText.js +48 -0
  558. package/dist/workers/links.js +376 -0
  559. package/dist/workers/liquid.contribution.js +9 -0
  560. package/dist/workers/liquid.js +306 -0
  561. package/dist/workers/list.js +11 -0
  562. package/dist/workers/listColors.js +51 -0
  563. package/dist/workers/listPaging.js +128 -0
  564. package/dist/workers/listService.js +1025 -0
  565. package/dist/workers/listView.js +1173 -0
  566. package/dist/workers/listWidget.js +1535 -0
  567. package/dist/workers/log.js +271 -0
  568. package/dist/workers/logService.js +40 -0
  569. package/dist/workers/logging.js +86 -0
  570. package/dist/workers/longLinesHelper.js +23 -0
  571. package/dist/workers/lspLanguageFeatures.js +716 -0
  572. package/dist/workers/lua.contribution.js +8 -0
  573. package/dist/workers/lua.js +161 -0
  574. package/dist/workers/m3.contribution.js +8 -0
  575. package/dist/workers/m3.js +209 -0
  576. package/dist/workers/map.js +670 -0
  577. package/dist/workers/margin.js +71 -0
  578. package/dist/workers/marginDecorations.js +84 -0
  579. package/dist/workers/markdown.contribution.js +8 -0
  580. package/dist/workers/markdown.js +228 -0
  581. package/dist/workers/markdownHoverParticipant.js +419 -0
  582. package/dist/workers/markdownRenderer.js +73 -0
  583. package/dist/workers/marked.js +2478 -0
  584. package/dist/workers/markerDecorations.js +9 -0
  585. package/dist/workers/markerDecorationsService.js +248 -0
  586. package/dist/workers/markerHoverParticipant.js +270 -0
  587. package/dist/workers/markerNavigationService.js +223 -0
  588. package/dist/workers/markerService.js +330 -0
  589. package/dist/workers/markers.js +127 -0
  590. package/dist/workers/marshalling.js +62 -0
  591. package/dist/workers/mdx.contribution.js +8 -0
  592. package/dist/workers/mdx.js +230 -0
  593. package/dist/workers/menu.js +1147 -0
  594. package/dist/workers/menuColors.js +19 -0
  595. package/dist/workers/menuEntryActionViewItem.js +519 -0
  596. package/dist/workers/menuService.js +436 -0
  597. package/dist/workers/messageController.js +186 -0
  598. package/dist/workers/middleScroll.contribution.js +8 -0
  599. package/dist/workers/middleScrollController.js +128 -0
  600. package/dist/workers/migrateOptions.js +220 -0
  601. package/dist/workers/mime.js +11 -0
  602. package/dist/workers/minimap.js +1662 -0
  603. package/dist/workers/minimapCharRenderer.js +90 -0
  604. package/dist/workers/minimapCharRendererFactory.js +136 -0
  605. package/dist/workers/minimapCharSheet.js +25 -0
  606. package/dist/workers/minimapColors.js +23 -0
  607. package/dist/workers/minimapPreBaked.js +52 -0
  608. package/dist/workers/minimapTokensColorTracker.js +58 -0
  609. package/dist/workers/mips.contribution.js +9 -0
  610. package/dist/workers/mips.js +197 -0
  611. package/dist/workers/mirrorTextModel.js +117 -0
  612. package/dist/workers/miscColors.js +32 -0
  613. package/dist/workers/model.js +9 -0
  614. package/dist/workers/modelLineProjection.js +350 -0
  615. package/dist/workers/modelLineProjectionData.js +297 -0
  616. package/dist/workers/modelService.js +413 -0
  617. package/dist/workers/modesRegistry.js +75 -0
  618. package/dist/workers/monaco.contribution.js +302 -0
  619. package/dist/workers/monarchCommon.js +147 -0
  620. package/dist/workers/monarchCompile.js +546 -0
  621. package/dist/workers/monarchLexer.js +764 -0
  622. package/dist/workers/monospaceLineBreaksComputer.js +473 -0
  623. package/dist/workers/mouseCursor.js +9 -0
  624. package/dist/workers/mouseEvent.js +153 -0
  625. package/dist/workers/mouseHandler.js +539 -0
  626. package/dist/workers/mouseTarget.js +978 -0
  627. package/dist/workers/moveCaretCommand.js +49 -0
  628. package/dist/workers/moveLinesCommand.js +394 -0
  629. package/dist/workers/movedBlocksLinesFeature.js +277 -0
  630. package/dist/workers/msdax.contribution.js +8 -0
  631. package/dist/workers/msdax.js +374 -0
  632. package/dist/workers/multiDiffEditorWidget.js +43 -0
  633. package/dist/workers/multiDiffEditorWidgetImpl.js +427 -0
  634. package/dist/workers/multicursor.js +1004 -0
  635. package/dist/workers/myersDiffAlgorithm.js +159 -0
  636. package/dist/workers/mysql.contribution.js +8 -0
  637. package/dist/workers/mysql.js +877 -0
  638. package/dist/workers/nativeEditContext.js +518 -0
  639. package/dist/workers/nativeEditContextRegistry.js +23 -0
  640. package/dist/workers/nativeEditContextUtils.js +85 -0
  641. package/dist/workers/navigator.js +36 -0
  642. package/dist/workers/network.js +267 -0
  643. package/dist/workers/nls.js +76 -0
  644. package/dist/workers/nls.messages.js +18 -0
  645. package/dist/workers/nodeReader.js +127 -0
  646. package/dist/workers/normalization.js +41 -0
  647. package/dist/workers/notification.js +9 -0
  648. package/dist/workers/nullTokenize.js +29 -0
  649. package/dist/workers/numbers.js +45 -0
  650. package/dist/workers/objectCollectionBuffer.js +102 -0
  651. package/dist/workers/objectPool.js +47 -0
  652. package/dist/workers/objectTree.js +204 -0
  653. package/dist/workers/objectTreeModel.js +220 -0
  654. package/dist/workers/objective-c.contribution.js +8 -0
  655. package/dist/workers/objective-c.js +182 -0
  656. package/dist/workers/objects.js +152 -0
  657. package/dist/workers/observableCodeEditor.js +373 -0
  658. package/dist/workers/observableFromEvent.js +123 -0
  659. package/dist/workers/observableSignal.js +47 -0
  660. package/dist/workers/observableSignalFromEvent.js +41 -0
  661. package/dist/workers/observableValue.js +105 -0
  662. package/dist/workers/observableValueOpts.js +20 -0
  663. package/dist/workers/offsetRange.js +225 -0
  664. package/dist/workers/onEnter.js +109 -0
  665. package/dist/workers/oneCursor.js +117 -0
  666. package/dist/workers/opener.js +43 -0
  667. package/dist/workers/openerService.js +222 -0
  668. package/dist/workers/originalEditorInlineDiffView.js +215 -0
  669. package/dist/workers/outlineModel.js +265 -0
  670. package/dist/workers/overlayWidgets.js +181 -0
  671. package/dist/workers/overviewRuler.js +134 -0
  672. package/dist/workers/overviewRulerFeature.js +168 -0
  673. package/dist/workers/overviewZoneManager.js +176 -0
  674. package/dist/workers/parameterHints.js +126 -0
  675. package/dist/workers/parameterHintsModel.js +258 -0
  676. package/dist/workers/parameterHintsWidget.js +318 -0
  677. package/dist/workers/parser.js +121 -0
  678. package/dist/workers/pascal.contribution.js +9 -0
  679. package/dist/workers/pascal.js +250 -0
  680. package/dist/workers/pascaligo.contribution.js +8 -0
  681. package/dist/workers/pascaligo.js +163 -0
  682. package/dist/workers/path.js +1451 -0
  683. package/dist/workers/peekView.js +246 -0
  684. package/dist/workers/performance.js +222 -0
  685. package/dist/workers/perl.contribution.js +8 -0
  686. package/dist/workers/perl.js +625 -0
  687. package/dist/workers/pgsql.contribution.js +8 -0
  688. package/dist/workers/pgsql.js +850 -0
  689. package/dist/workers/php.contribution.js +9 -0
  690. package/dist/workers/php.js +499 -0
  691. package/dist/workers/pickerQuickAccess.js +271 -0
  692. package/dist/workers/pieceTreeBase.js +1473 -0
  693. package/dist/workers/pieceTreeTextBuffer.js +461 -0
  694. package/dist/workers/pieceTreeTextBufferBuilder.js +140 -0
  695. package/dist/workers/pixelRatio.js +88 -0
  696. package/dist/workers/pla.contribution.js +7 -0
  697. package/dist/workers/pla.js +136 -0
  698. package/dist/workers/placeholderText.contribution.js +14 -0
  699. package/dist/workers/placeholderTextContribution.js +77 -0
  700. package/dist/workers/platform.js +32 -0
  701. package/dist/workers/platformObservableUtils.js +31 -0
  702. package/dist/workers/point.js +50 -0
  703. package/dist/workers/pointerHandler.js +132 -0
  704. package/dist/workers/position.js +142 -0
  705. package/dist/workers/positionToOffset.js +17 -0
  706. package/dist/workers/positionToOffsetImpl.js +98 -0
  707. package/dist/workers/postEditWidget.js +220 -0
  708. package/dist/workers/postiats.contribution.js +8 -0
  709. package/dist/workers/postiats.js +906 -0
  710. package/dist/workers/powerquery.contribution.js +8 -0
  711. package/dist/workers/powerquery.js +889 -0
  712. package/dist/workers/powershell.contribution.js +8 -0
  713. package/dist/workers/powershell.js +238 -0
  714. package/dist/workers/prefixSumComputer.js +226 -0
  715. package/dist/workers/process.js +61 -0
  716. package/dist/workers/product.js +70 -0
  717. package/dist/workers/productService.js +9 -0
  718. package/dist/workers/progress.js +16 -0
  719. package/dist/workers/progressbar.js +105 -0
  720. package/dist/workers/promise.js +56 -0
  721. package/dist/workers/protobuf.contribution.js +8 -0
  722. package/dist/workers/protobuf.js +419 -0
  723. package/dist/workers/provideInlineCompletions.js +372 -0
  724. package/dist/workers/provideSignatureHelp.js +59 -0
  725. package/dist/workers/pug.contribution.js +8 -0
  726. package/dist/workers/pug.js +401 -0
  727. package/dist/workers/python.contribution.js +9 -0
  728. package/dist/workers/python.js +366 -0
  729. package/dist/workers/qsharp.contribution.js +8 -0
  730. package/dist/workers/qsharp.js +300 -0
  731. package/dist/workers/quickAccess.js +56 -0
  732. package/dist/workers/quickInput.js +108 -0
  733. package/dist/workers/quickInputActions.js +189 -0
  734. package/dist/workers/quickInputBox.js +104 -0
  735. package/dist/workers/quickInputController.js +901 -0
  736. package/dist/workers/quickInputDelegate.js +19 -0
  737. package/dist/workers/quickInputList.js +1391 -0
  738. package/dist/workers/quickInputService.js +197 -0
  739. package/dist/workers/quickInputTree.js +37 -0
  740. package/dist/workers/quickInputTreeAccessibilityProvider.js +39 -0
  741. package/dist/workers/quickInputTreeController.js +181 -0
  742. package/dist/workers/quickInputTreeFilter.js +42 -0
  743. package/dist/workers/quickInputTreeRenderer.js +141 -0
  744. package/dist/workers/quickInputTreeSorter.js +48 -0
  745. package/dist/workers/quickInputUtils.js +89 -0
  746. package/dist/workers/quickpickColors.js +21 -0
  747. package/dist/workers/r.contribution.js +8 -0
  748. package/dist/workers/r.js +242 -0
  749. package/dist/workers/range.js +421 -0
  750. package/dist/workers/rangeMap.js +161 -0
  751. package/dist/workers/rangeMapping.js +229 -0
  752. package/dist/workers/rangeSingleLine.js +17 -0
  753. package/dist/workers/rangeUtil.js +117 -0
  754. package/dist/workers/razor.contribution.js +9 -0
  755. package/dist/workers/razor.js +616 -0
  756. package/dist/workers/rbTreeBase.js +362 -0
  757. package/dist/workers/rect.js +163 -0
  758. package/dist/workers/rectangleRenderer.js +214 -0
  759. package/dist/workers/rectangleRenderer.wgsl.js +68 -0
  760. package/dist/workers/redis.contribution.js +8 -0
  761. package/dist/workers/redis.js +301 -0
  762. package/dist/workers/redshift.contribution.js +8 -0
  763. package/dist/workers/redshift.js +808 -0
  764. package/dist/workers/reducer.js +46 -0
  765. package/dist/workers/referencesController.js +382 -0
  766. package/dist/workers/referencesModel.js +241 -0
  767. package/dist/workers/referencesTree.js +200 -0
  768. package/dist/workers/referencesWidget.js +525 -0
  769. package/dist/workers/registrations.contribution.js +82 -0
  770. package/dist/workers/rename.js +458 -0
  771. package/dist/workers/renameWidget.js +741 -0
  772. package/dist/workers/renderLines.js +185 -0
  773. package/dist/workers/renderingContext.js +118 -0
  774. package/dist/workers/replaceAllCommand.js +54 -0
  775. package/dist/workers/replaceCommand.js +158 -0
  776. package/dist/workers/replaceInput.js +176 -0
  777. package/dist/workers/replacePattern.js +289 -0
  778. package/dist/workers/replaceWidgetHistory.js +85 -0
  779. package/dist/workers/resizable.js +150 -0
  780. package/dist/workers/resizableContentWidget.js +92 -0
  781. package/dist/workers/resolvedKeybindingItem.js +35 -0
  782. package/dist/workers/resolverService.js +5 -0
  783. package/dist/workers/resources.js +231 -0
  784. package/dist/workers/restructuredtext.contribution.js +8 -0
  785. package/dist/workers/restructuredtext.js +173 -0
  786. package/dist/workers/revertButtonsFeature.js +149 -0
  787. package/dist/workers/rgba.js +35 -0
  788. package/dist/workers/richEditBrackets.js +356 -0
  789. package/dist/workers/rowCache.js +110 -0
  790. package/dist/workers/rpc.js +57 -0
  791. package/dist/workers/ruby.contribution.js +9 -0
  792. package/dist/workers/ruby.js +510 -0
  793. package/dist/workers/rulers.js +82 -0
  794. package/dist/workers/rulersGpu.js +66 -0
  795. package/dist/workers/runOnChange.js +61 -0
  796. package/dist/workers/rust.contribution.js +8 -0
  797. package/dist/workers/rust.js +342 -0
  798. package/dist/workers/sash.js +451 -0
  799. package/dist/workers/sb.contribution.js +8 -0
  800. package/dist/workers/sb.js +114 -0
  801. package/dist/workers/scala.contribution.js +9 -0
  802. package/dist/workers/scala.js +369 -0
  803. package/dist/workers/scanner.js +287 -0
  804. package/dist/workers/scheme.contribution.js +8 -0
  805. package/dist/workers/scheme.js +107 -0
  806. package/dist/workers/screenReaderContentRich.js +337 -0
  807. package/dist/workers/screenReaderContentSimple.js +194 -0
  808. package/dist/workers/screenReaderSupport.js +175 -0
  809. package/dist/workers/screenReaderUtils.js +111 -0
  810. package/dist/workers/scrollDecoration.js +70 -0
  811. package/dist/workers/scrollable.js +323 -0
  812. package/dist/workers/scrollableElement.js +603 -0
  813. package/dist/workers/scrollbarArrow.js +78 -0
  814. package/dist/workers/scrollbarState.js +163 -0
  815. package/dist/workers/scrollbarVisibilityController.js +93 -0
  816. package/dist/workers/scss.contribution.js +9 -0
  817. package/dist/workers/scss.js +259 -0
  818. package/dist/workers/search.js +52 -0
  819. package/dist/workers/searchColors.js +13 -0
  820. package/dist/workers/sectionHeaders.js +179 -0
  821. package/dist/workers/selectBox.js +47 -0
  822. package/dist/workers/selectBoxCustom.js +858 -0
  823. package/dist/workers/selectBoxNative.js +142 -0
  824. package/dist/workers/selection.js +145 -0
  825. package/dist/workers/selections.js +338 -0
  826. package/dist/workers/semanticTokensConfig.js +14 -0
  827. package/dist/workers/semanticTokensDto.js +82 -0
  828. package/dist/workers/semanticTokensProviderStyling.js +263 -0
  829. package/dist/workers/semanticTokensStyling.js +9 -0
  830. package/dist/workers/semanticTokensStylingService.js +47 -0
  831. package/dist/workers/serviceCollection.js +22 -0
  832. package/dist/workers/severity.js +52 -0
  833. package/dist/workers/severityIcon.js +29 -0
  834. package/dist/workers/shell.contribution.js +8 -0
  835. package/dist/workers/shell.js +220 -0
  836. package/dist/workers/shiftCommand.js +241 -0
  837. package/dist/workers/singleTextEditHelpers.js +32 -0
  838. package/dist/workers/smallImmutableSet.js +108 -0
  839. package/dist/workers/smartSelect.js +281 -0
  840. package/dist/workers/snippetController2.js +297 -0
  841. package/dist/workers/snippetParser.js +890 -0
  842. package/dist/workers/snippetSession.js +650 -0
  843. package/dist/workers/snippetVariables.js +323 -0
  844. package/dist/workers/solidity.contribution.js +8 -0
  845. package/dist/workers/solidity.js +1366 -0
  846. package/dist/workers/sophia.contribution.js +8 -0
  847. package/dist/workers/sophia.js +198 -0
  848. package/dist/workers/sortLinesCommand.js +81 -0
  849. package/dist/workers/sparql.contribution.js +8 -0
  850. package/dist/workers/sparql.js +200 -0
  851. package/dist/workers/sparseMultilineTokens.js +548 -0
  852. package/dist/workers/sparseTokensStore.js +210 -0
  853. package/dist/workers/splice.js +14 -0
  854. package/dist/workers/splitview.js +829 -0
  855. package/dist/workers/sql.contribution.js +8 -0
  856. package/dist/workers/sql.js +852 -0
  857. package/dist/workers/st.contribution.js +8 -0
  858. package/dist/workers/st.js +415 -0
  859. package/dist/workers/stableEditorScroll.js +52 -0
  860. package/dist/workers/standaloneCodeEditor.js +335 -0
  861. package/dist/workers/standaloneCodeEditorService.js +96 -0
  862. package/dist/workers/standaloneColorPickerActions.js +81 -0
  863. package/dist/workers/standaloneColorPickerController.js +62 -0
  864. package/dist/workers/standaloneColorPickerParticipant.js +117 -0
  865. package/dist/workers/standaloneColorPickerWidget.js +215 -0
  866. package/dist/workers/standaloneCommandsQuickAccess.js +82 -0
  867. package/dist/workers/standaloneEditor.js +519 -0
  868. package/dist/workers/standaloneEnums.js +1017 -0
  869. package/dist/workers/standaloneGotoLineQuickAccess.js +67 -0
  870. package/dist/workers/standaloneGotoSymbolQuickAccess.js +77 -0
  871. package/dist/workers/standaloneHelpQuickAccess.js +14 -0
  872. package/dist/workers/standaloneLanguages.js +621 -0
  873. package/dist/workers/standaloneLayoutService.js +74 -0
  874. package/dist/workers/standaloneQuickInputService.js +150 -0
  875. package/dist/workers/standaloneReferenceSearch.js +38 -0
  876. package/dist/workers/standaloneServices.js +787 -0
  877. package/dist/workers/standaloneStrings.js +42 -0
  878. package/dist/workers/standaloneTheme.js +9 -0
  879. package/dist/workers/standaloneThemeService.js +367 -0
  880. package/dist/workers/standaloneTreeSitterLibraryService.js +23 -0
  881. package/dist/workers/standaloneWebWorker.js +55 -0
  882. package/dist/workers/stickyScrollActions.js +132 -0
  883. package/dist/workers/stickyScrollContribution.js +16 -0
  884. package/dist/workers/stickyScrollController.js +566 -0
  885. package/dist/workers/stickyScrollElement.js +39 -0
  886. package/dist/workers/stickyScrollModelProvider.js +338 -0
  887. package/dist/workers/stickyScrollProvider.js +197 -0
  888. package/dist/workers/stickyScrollWidget.js +474 -0
  889. package/dist/workers/stopwatch.js +30 -0
  890. package/dist/workers/storage.js +200 -0
  891. package/dist/workers/stringBuilder.js +122 -0
  892. package/dist/workers/stringEdit.js +165 -0
  893. package/dist/workers/strings.js +834 -0
  894. package/dist/workers/structuredLogger.js +56 -0
  895. package/dist/workers/suggest.js +322 -0
  896. package/dist/workers/suggestAlternatives.js +95 -0
  897. package/dist/workers/suggestCommitCharacters.js +59 -0
  898. package/dist/workers/suggestController.js +941 -0
  899. package/dist/workers/suggestInlineCompletions.js +193 -0
  900. package/dist/workers/suggestMemory.js +254 -0
  901. package/dist/workers/suggestModel.js +667 -0
  902. package/dist/workers/suggestOvertypingCapturer.js +62 -0
  903. package/dist/workers/suggestWidget.js +890 -0
  904. package/dist/workers/suggestWidgetAdapter.js +210 -0
  905. package/dist/workers/suggestWidgetDetails.js +393 -0
  906. package/dist/workers/suggestWidgetRenderer.js +208 -0
  907. package/dist/workers/suggestWidgetStatus.js +74 -0
  908. package/dist/workers/supports.js +58 -0
  909. package/dist/workers/surroundSelectionCommand.js +44 -0
  910. package/dist/workers/swift.contribution.js +9 -0
  911. package/dist/workers/swift.js +311 -0
  912. package/dist/workers/symbolIcons.js +101 -0
  913. package/dist/workers/symbolNavigation.js +178 -0
  914. package/dist/workers/symbols.js +10 -0
  915. package/dist/workers/syntaxRangeProvider.js +177 -0
  916. package/dist/workers/systemverilog.contribution.js +14 -0
  917. package/dist/workers/systemverilog.js +575 -0
  918. package/dist/workers/tabFocus.js +29 -0
  919. package/dist/workers/tableWidget.js +181 -0
  920. package/dist/workers/taskQueue.js +116 -0
  921. package/dist/workers/tcl.contribution.js +8 -0
  922. package/dist/workers/tcl.js +231 -0
  923. package/dist/workers/telemetry.js +9 -0
  924. package/dist/workers/ternarySearchTree.js +674 -0
  925. package/dist/workers/textAreaEditContext.js +720 -0
  926. package/dist/workers/textAreaEditContextInput.js +588 -0
  927. package/dist/workers/textAreaEditContextState.js +160 -0
  928. package/dist/workers/textChange.js +248 -0
  929. package/dist/workers/textEdit.js +269 -0
  930. package/dist/workers/textLength.js +87 -0
  931. package/dist/workers/textModel.js +2031 -0
  932. package/dist/workers/textModelBracketPairs.js +45 -0
  933. package/dist/workers/textModelDefaults.js +18 -0
  934. package/dist/workers/textModelEditSource.js +166 -0
  935. package/dist/workers/textModelEvents.js +216 -0
  936. package/dist/workers/textModelGuides.js +40 -0
  937. package/dist/workers/textModelPart.js +23 -0
  938. package/dist/workers/textModelSearch.js +455 -0
  939. package/dist/workers/textModelStringEdit.js +11 -0
  940. package/dist/workers/textModelSync.impl.js +307 -0
  941. package/dist/workers/textModelText.js +26 -0
  942. package/dist/workers/textModelTokens.js +436 -0
  943. package/dist/workers/textResourceConfiguration.js +6 -0
  944. package/dist/workers/textToHtmlTokenizer.js +139 -0
  945. package/dist/workers/textualHighlightProvider.js +78 -0
  946. package/dist/workers/textureAtlas.js +179 -0
  947. package/dist/workers/textureAtlasPage.js +110 -0
  948. package/dist/workers/textureAtlasShelfAllocator.js +129 -0
  949. package/dist/workers/textureAtlasSlabAllocator.js +346 -0
  950. package/dist/workers/tfIdf.js +179 -0
  951. package/dist/workers/themables.js +100 -0
  952. package/dist/workers/theme.js +110 -0
  953. package/dist/workers/themeService.js +67 -0
  954. package/dist/workers/themes.js +242 -0
  955. package/dist/workers/toggle.js +242 -0
  956. package/dist/workers/toggleHighContrast.js +35 -0
  957. package/dist/workers/toggleTabFocusMode.js +42 -0
  958. package/dist/workers/tokenStore.js +407 -0
  959. package/dist/workers/tokenWithTextArray.js +73 -0
  960. package/dist/workers/tokenization.js +29 -0
  961. package/dist/workers/tokenizationRegistry.js +123 -0
  962. package/dist/workers/tokenizationTextModelPart.js +275 -0
  963. package/dist/workers/tokenizer.js +301 -0
  964. package/dist/workers/tokenizerSyntaxTokenBackend.js +261 -0
  965. package/dist/workers/toolbar.js +244 -0
  966. package/dist/workers/touch.js +270 -0
  967. package/dist/workers/transaction.js +109 -0
  968. package/dist/workers/transpose.js +65 -0
  969. package/dist/workers/tree.js +45 -0
  970. package/dist/workers/treeSitterLibraryService.js +9 -0
  971. package/dist/workers/treeSitterSyntaxTokenBackend.js +167 -0
  972. package/dist/workers/treeSitterThemeService.js +9 -0
  973. package/dist/workers/treeSitterTokenizationImpl.js +713 -0
  974. package/dist/workers/treeSitterTree.js +395 -0
  975. package/dist/workers/treeViewsDnd.js +24 -0
  976. package/dist/workers/treeViewsDndService.js +12 -0
  977. package/dist/workers/triggerInlineEditCommandsRegistry.js +18 -0
  978. package/dist/workers/trimTrailingWhitespaceCommand.js +98 -0
  979. package/dist/workers/trustedTypes.js +29 -0
  980. package/dist/workers/tsMode.js +212 -0
  981. package/dist/workers/tsWorker.js +352 -0
  982. package/dist/workers/twig.contribution.js +9 -0
  983. package/dist/workers/twig.js +391 -0
  984. package/dist/workers/types.js +144 -0
  985. package/dist/workers/typescript.contribution.js +11 -0
  986. package/dist/workers/typescript.js +408 -0
  987. package/dist/workers/typescriptServices.js +210154 -0
  988. package/dist/workers/typescriptServicesMetadata.js +3 -0
  989. package/dist/workers/typespec.contribution.js +8 -0
  990. package/dist/workers/typespec.js +126 -0
  991. package/dist/workers/typingSpeed.js +165 -0
  992. package/dist/workers/uint.js +24 -0
  993. package/dist/workers/undoRedo.js +43 -0
  994. package/dist/workers/undoRedoService.js +1076 -0
  995. package/dist/workers/unicodeHighlighter.js +673 -0
  996. package/dist/workers/unicodeTextModelHighlighter.js +188 -0
  997. package/dist/workers/unusualLineTerminators.js +113 -0
  998. package/dist/workers/updatableHoverWidget.js +107 -0
  999. package/dist/workers/uri.js +606 -0
  1000. package/dist/workers/usLayoutResolvedKeybinding.js +175 -0
  1001. package/dist/workers/utils.js +209 -0
  1002. package/dist/workers/utilsCancellation.js +63 -0
  1003. package/dist/workers/uuid.js +53 -0
  1004. package/dist/workers/validation.js +159 -0
  1005. package/dist/workers/vb.contribution.js +8 -0
  1006. package/dist/workers/vb.js +371 -0
  1007. package/dist/workers/verticalScrollbar.js +94 -0
  1008. package/dist/workers/view.js +720 -0
  1009. package/dist/workers/viewContext.js +22 -0
  1010. package/dist/workers/viewController.js +274 -0
  1011. package/dist/workers/viewCursor.js +218 -0
  1012. package/dist/workers/viewCursors.js +339 -0
  1013. package/dist/workers/viewEventHandler.js +186 -0
  1014. package/dist/workers/viewEvents.js +180 -0
  1015. package/dist/workers/viewGpuContext.js +241 -0
  1016. package/dist/workers/viewLayer.js +478 -0
  1017. package/dist/workers/viewLayout.js +368 -0
  1018. package/dist/workers/viewLine.js +544 -0
  1019. package/dist/workers/viewLineOptions.js +43 -0
  1020. package/dist/workers/viewLineRenderer.js +948 -0
  1021. package/dist/workers/viewLines.js +721 -0
  1022. package/dist/workers/viewLinesGpu.js +571 -0
  1023. package/dist/workers/viewLinesViewportData.js +30 -0
  1024. package/dist/workers/viewModel.js +98 -0
  1025. package/dist/workers/viewModelDecoration.js +55 -0
  1026. package/dist/workers/viewModelDecorations.js +132 -0
  1027. package/dist/workers/viewModelEventDispatcher.js +398 -0
  1028. package/dist/workers/viewModelImpl.js +1163 -0
  1029. package/dist/workers/viewModelLines.js +938 -0
  1030. package/dist/workers/viewOverlays.js +204 -0
  1031. package/dist/workers/viewPart.js +49 -0
  1032. package/dist/workers/viewUserInputEvents.js +91 -0
  1033. package/dist/workers/viewZones.js +335 -0
  1034. package/dist/workers/viewportRenderStrategy.js +316 -0
  1035. package/dist/workers/viewportSemanticTokens.js +166 -0
  1036. package/dist/workers/webWorker.js +396 -0
  1037. package/dist/workers/webWorkerBootstrap.js +20 -0
  1038. package/dist/workers/webWorkerFactory.js +171 -0
  1039. package/dist/workers/wgsl.contribution.js +8 -0
  1040. package/dist/workers/wgsl.js +452 -0
  1041. package/dist/workers/whitespace.js +277 -0
  1042. package/dist/workers/widget.js +44 -0
  1043. package/dist/workers/window.js +60 -0
  1044. package/dist/workers/wordCharacterClassifier.js +87 -0
  1045. package/dist/workers/wordContextKey.js +69 -0
  1046. package/dist/workers/wordDistance.js +64 -0
  1047. package/dist/workers/wordHelper.js +127 -0
  1048. package/dist/workers/wordHighlighter.js +796 -0
  1049. package/dist/workers/wordOperations.js +442 -0
  1050. package/dist/workers/wordPartOperations.js +145 -0
  1051. package/dist/workers/wordSelections.js +82 -0
  1052. package/dist/workers/workerManager.js +147 -0
  1053. package/dist/workers/workers.js +141 -0
  1054. package/dist/workers/workspace.js +84 -0
  1055. package/dist/workers/workspaceTrust.js +9 -0
  1056. package/dist/workers/wrapInHotClass.js +41 -0
  1057. package/dist/workers/wrapInReloadableClass.js +35 -0
  1058. package/dist/workers/xml.contribution.js +28 -0
  1059. package/dist/workers/xml.js +160 -0
  1060. package/dist/workers/yaml.contribution.js +9 -0
  1061. package/dist/workers/yaml.js +271 -0
  1062. package/dist/workers/zoneWidget.js +406 -0
  1063. package/package.json +2 -2
  1064. package/dist/assets/css.worker-C7FogG4G.js +0 -93
  1065. package/dist/assets/editor.worker-iXcRX1Tq.js +0 -26
  1066. package/dist/assets/html.worker-C8VxctEJ.js +0 -470
  1067. package/dist/assets/json.worker-CMC9kgPL.js +0 -58
  1068. package/dist/assets/ts.worker-CtTJ3hNN.js +0 -67731
@@ -0,0 +1,2478 @@
1
+ /**
2
+ * marked v14.0.0 - a markdown parser
3
+ * Copyright (c) 2011-2024, Christopher Jeffrey. (MIT Licensed)
4
+ * https://github.com/markedjs/marked
5
+ */
6
+
7
+ /**
8
+ * DO NOT EDIT THIS FILE
9
+ * The code in this file is generated from files in ./src/
10
+ */
11
+
12
+ /**
13
+ * Gets the original marked default options.
14
+ */
15
+ function _getDefaults() {
16
+ return {
17
+ async: false,
18
+ breaks: false,
19
+ extensions: null,
20
+ gfm: true,
21
+ hooks: null,
22
+ pedantic: false,
23
+ renderer: null,
24
+ silent: false,
25
+ tokenizer: null,
26
+ walkTokens: null,
27
+ };
28
+ }
29
+ let _defaults = _getDefaults();
30
+ function changeDefaults(newDefaults) {
31
+ _defaults = newDefaults;
32
+ }
33
+
34
+ /**
35
+ * Helpers
36
+ */
37
+ const escapeTest = /[&<>"']/;
38
+ const escapeReplace = new RegExp(escapeTest.source, 'g');
39
+ const escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
40
+ const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
41
+ const escapeReplacements = {
42
+ '&': '&amp;',
43
+ '<': '&lt;',
44
+ '>': '&gt;',
45
+ '"': '&quot;',
46
+ "'": '&#39;',
47
+ };
48
+ const getEscapeReplacement = (ch) => escapeReplacements[ch];
49
+ function escape$1(html, encode) {
50
+ if (encode) {
51
+ if (escapeTest.test(html)) {
52
+ return html.replace(escapeReplace, getEscapeReplacement);
53
+ }
54
+ }
55
+ else {
56
+ if (escapeTestNoEncode.test(html)) {
57
+ return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
58
+ }
59
+ }
60
+ return html;
61
+ }
62
+ const caret = /(^|[^\[])\^/g;
63
+ function edit(regex, opt) {
64
+ let source = typeof regex === 'string' ? regex : regex.source;
65
+ opt = opt || '';
66
+ const obj = {
67
+ replace: (name, val) => {
68
+ let valSource = typeof val === 'string' ? val : val.source;
69
+ valSource = valSource.replace(caret, '$1');
70
+ source = source.replace(name, valSource);
71
+ return obj;
72
+ },
73
+ getRegex: () => {
74
+ return new RegExp(source, opt);
75
+ },
76
+ };
77
+ return obj;
78
+ }
79
+ function cleanUrl(href) {
80
+ try {
81
+ href = encodeURI(href).replace(/%25/g, '%');
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ return href;
87
+ }
88
+ const noopTest = { exec: () => null };
89
+ function splitCells(tableRow, count) {
90
+ // ensure that every cell-delimiting pipe has a space
91
+ // before it to distinguish it from an escaped pipe
92
+ const row = tableRow.replace(/\|/g, (match, offset, str) => {
93
+ let escaped = false;
94
+ let curr = offset;
95
+ while (--curr >= 0 && str[curr] === '\\')
96
+ escaped = !escaped;
97
+ if (escaped) {
98
+ // odd number of slashes means | is escaped
99
+ // so we leave it alone
100
+ return '|';
101
+ }
102
+ else {
103
+ // add space before unescaped |
104
+ return ' |';
105
+ }
106
+ }), cells = row.split(/ \|/);
107
+ let i = 0;
108
+ // First/last cell in a row cannot be empty if it has no leading/trailing pipe
109
+ if (!cells[0].trim()) {
110
+ cells.shift();
111
+ }
112
+ if (cells.length > 0 && !cells[cells.length - 1].trim()) {
113
+ cells.pop();
114
+ }
115
+ if (count) {
116
+ if (cells.length > count) {
117
+ cells.splice(count);
118
+ }
119
+ else {
120
+ while (cells.length < count)
121
+ cells.push('');
122
+ }
123
+ }
124
+ for (; i < cells.length; i++) {
125
+ // leading or trailing whitespace is ignored per the gfm spec
126
+ cells[i] = cells[i].trim().replace(/\\\|/g, '|');
127
+ }
128
+ return cells;
129
+ }
130
+ /**
131
+ * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
132
+ * /c*$/ is vulnerable to REDOS.
133
+ *
134
+ * @param str
135
+ * @param c
136
+ * @param invert Remove suffix of non-c chars instead. Default falsey.
137
+ */
138
+ function rtrim(str, c, invert) {
139
+ const l = str.length;
140
+ if (l === 0) {
141
+ return '';
142
+ }
143
+ // Length of suffix matching the invert condition.
144
+ let suffLen = 0;
145
+ // Step left until we fail to match the invert condition.
146
+ while (suffLen < l) {
147
+ const currChar = str.charAt(l - suffLen - 1);
148
+ if (currChar === c && true) {
149
+ suffLen++;
150
+ }
151
+ else {
152
+ break;
153
+ }
154
+ }
155
+ return str.slice(0, l - suffLen);
156
+ }
157
+ function findClosingBracket(str, b) {
158
+ if (str.indexOf(b[1]) === -1) {
159
+ return -1;
160
+ }
161
+ let level = 0;
162
+ for (let i = 0; i < str.length; i++) {
163
+ if (str[i] === '\\') {
164
+ i++;
165
+ }
166
+ else if (str[i] === b[0]) {
167
+ level++;
168
+ }
169
+ else if (str[i] === b[1]) {
170
+ level--;
171
+ if (level < 0) {
172
+ return i;
173
+ }
174
+ }
175
+ }
176
+ return -1;
177
+ }
178
+
179
+ function outputLink(cap, link, raw, lexer) {
180
+ const href = link.href;
181
+ const title = link.title ? escape$1(link.title) : null;
182
+ const text = cap[1].replace(/\\([\[\]])/g, '$1');
183
+ if (cap[0].charAt(0) !== '!') {
184
+ lexer.state.inLink = true;
185
+ const token = {
186
+ type: 'link',
187
+ raw,
188
+ href,
189
+ title,
190
+ text,
191
+ tokens: lexer.inlineTokens(text),
192
+ };
193
+ lexer.state.inLink = false;
194
+ return token;
195
+ }
196
+ return {
197
+ type: 'image',
198
+ raw,
199
+ href,
200
+ title,
201
+ text: escape$1(text),
202
+ };
203
+ }
204
+ function indentCodeCompensation(raw, text) {
205
+ const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
206
+ if (matchIndentToCode === null) {
207
+ return text;
208
+ }
209
+ const indentToCode = matchIndentToCode[1];
210
+ return text
211
+ .split('\n')
212
+ .map(node => {
213
+ const matchIndentInNode = node.match(/^\s+/);
214
+ if (matchIndentInNode === null) {
215
+ return node;
216
+ }
217
+ const [indentInNode] = matchIndentInNode;
218
+ if (indentInNode.length >= indentToCode.length) {
219
+ return node.slice(indentToCode.length);
220
+ }
221
+ return node;
222
+ })
223
+ .join('\n');
224
+ }
225
+ /**
226
+ * Tokenizer
227
+ */
228
+ class _Tokenizer {
229
+ options;
230
+ rules; // set by the lexer
231
+ lexer; // set by the lexer
232
+ constructor(options) {
233
+ this.options = options || _defaults;
234
+ }
235
+ space(src) {
236
+ const cap = this.rules.block.newline.exec(src);
237
+ if (cap && cap[0].length > 0) {
238
+ return {
239
+ type: 'space',
240
+ raw: cap[0],
241
+ };
242
+ }
243
+ }
244
+ code(src) {
245
+ const cap = this.rules.block.code.exec(src);
246
+ if (cap) {
247
+ const text = cap[0].replace(/^ {1,4}/gm, '');
248
+ return {
249
+ type: 'code',
250
+ raw: cap[0],
251
+ codeBlockStyle: 'indented',
252
+ text: !this.options.pedantic
253
+ ? rtrim(text, '\n')
254
+ : text,
255
+ };
256
+ }
257
+ }
258
+ fences(src) {
259
+ const cap = this.rules.block.fences.exec(src);
260
+ if (cap) {
261
+ const raw = cap[0];
262
+ const text = indentCodeCompensation(raw, cap[3] || '');
263
+ return {
264
+ type: 'code',
265
+ raw,
266
+ lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, '$1') : cap[2],
267
+ text,
268
+ };
269
+ }
270
+ }
271
+ heading(src) {
272
+ const cap = this.rules.block.heading.exec(src);
273
+ if (cap) {
274
+ let text = cap[2].trim();
275
+ // remove trailing #s
276
+ if (/#$/.test(text)) {
277
+ const trimmed = rtrim(text, '#');
278
+ if (this.options.pedantic) {
279
+ text = trimmed.trim();
280
+ }
281
+ else if (!trimmed || / $/.test(trimmed)) {
282
+ // CommonMark requires space before trailing #s
283
+ text = trimmed.trim();
284
+ }
285
+ }
286
+ return {
287
+ type: 'heading',
288
+ raw: cap[0],
289
+ depth: cap[1].length,
290
+ text,
291
+ tokens: this.lexer.inline(text),
292
+ };
293
+ }
294
+ }
295
+ hr(src) {
296
+ const cap = this.rules.block.hr.exec(src);
297
+ if (cap) {
298
+ return {
299
+ type: 'hr',
300
+ raw: rtrim(cap[0], '\n'),
301
+ };
302
+ }
303
+ }
304
+ blockquote(src) {
305
+ const cap = this.rules.block.blockquote.exec(src);
306
+ if (cap) {
307
+ let lines = rtrim(cap[0], '\n').split('\n');
308
+ let raw = '';
309
+ let text = '';
310
+ const tokens = [];
311
+ while (lines.length > 0) {
312
+ let inBlockquote = false;
313
+ const currentLines = [];
314
+ let i;
315
+ for (i = 0; i < lines.length; i++) {
316
+ // get lines up to a continuation
317
+ if (/^ {0,3}>/.test(lines[i])) {
318
+ currentLines.push(lines[i]);
319
+ inBlockquote = true;
320
+ }
321
+ else if (!inBlockquote) {
322
+ currentLines.push(lines[i]);
323
+ }
324
+ else {
325
+ break;
326
+ }
327
+ }
328
+ lines = lines.slice(i);
329
+ const currentRaw = currentLines.join('\n');
330
+ const currentText = currentRaw
331
+ // precede setext continuation with 4 spaces so it isn't a setext
332
+ .replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, '\n $1')
333
+ .replace(/^ {0,3}>[ \t]?/gm, '');
334
+ raw = raw ? `${raw}\n${currentRaw}` : currentRaw;
335
+ text = text ? `${text}\n${currentText}` : currentText;
336
+ // parse blockquote lines as top level tokens
337
+ // merge paragraphs if this is a continuation
338
+ const top = this.lexer.state.top;
339
+ this.lexer.state.top = true;
340
+ this.lexer.blockTokens(currentText, tokens, true);
341
+ this.lexer.state.top = top;
342
+ // if there is no continuation then we are done
343
+ if (lines.length === 0) {
344
+ break;
345
+ }
346
+ const lastToken = tokens[tokens.length - 1];
347
+ if (lastToken?.type === 'code') {
348
+ // blockquote continuation cannot be preceded by a code block
349
+ break;
350
+ }
351
+ else if (lastToken?.type === 'blockquote') {
352
+ // include continuation in nested blockquote
353
+ const oldToken = lastToken;
354
+ const newText = oldToken.raw + '\n' + lines.join('\n');
355
+ const newToken = this.blockquote(newText);
356
+ tokens[tokens.length - 1] = newToken;
357
+ raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
358
+ text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
359
+ break;
360
+ }
361
+ else if (lastToken?.type === 'list') {
362
+ // include continuation in nested list
363
+ const oldToken = lastToken;
364
+ const newText = oldToken.raw + '\n' + lines.join('\n');
365
+ const newToken = this.list(newText);
366
+ tokens[tokens.length - 1] = newToken;
367
+ raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
368
+ text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
369
+ lines = newText.substring(tokens[tokens.length - 1].raw.length).split('\n');
370
+ continue;
371
+ }
372
+ }
373
+ return {
374
+ type: 'blockquote',
375
+ raw,
376
+ tokens,
377
+ text,
378
+ };
379
+ }
380
+ }
381
+ list(src) {
382
+ let cap = this.rules.block.list.exec(src);
383
+ if (cap) {
384
+ let bull = cap[1].trim();
385
+ const isordered = bull.length > 1;
386
+ const list = {
387
+ type: 'list',
388
+ raw: '',
389
+ ordered: isordered,
390
+ start: isordered ? +bull.slice(0, -1) : '',
391
+ loose: false,
392
+ items: [],
393
+ };
394
+ bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
395
+ if (this.options.pedantic) {
396
+ bull = isordered ? bull : '[*+-]';
397
+ }
398
+ // Get next list item
399
+ const itemRegex = new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`);
400
+ let endsWithBlankLine = false;
401
+ // Check if current bullet point can start a new List Item
402
+ while (src) {
403
+ let endEarly = false;
404
+ let raw = '';
405
+ let itemContents = '';
406
+ if (!(cap = itemRegex.exec(src))) {
407
+ break;
408
+ }
409
+ if (this.rules.block.hr.test(src)) { // End list if bullet was actually HR (possibly move into itemRegex?)
410
+ break;
411
+ }
412
+ raw = cap[0];
413
+ src = src.substring(raw.length);
414
+ let line = cap[2].split('\n', 1)[0].replace(/^\t+/, (t) => ' '.repeat(3 * t.length));
415
+ let nextLine = src.split('\n', 1)[0];
416
+ let blankLine = !line.trim();
417
+ let indent = 0;
418
+ if (this.options.pedantic) {
419
+ indent = 2;
420
+ itemContents = line.trimStart();
421
+ }
422
+ else if (blankLine) {
423
+ indent = cap[1].length + 1;
424
+ }
425
+ else {
426
+ indent = cap[2].search(/[^ ]/); // Find first non-space char
427
+ indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
428
+ itemContents = line.slice(indent);
429
+ indent += cap[1].length;
430
+ }
431
+ if (blankLine && /^ *$/.test(nextLine)) { // Items begin with at most one blank line
432
+ raw += nextLine + '\n';
433
+ src = src.substring(nextLine.length + 1);
434
+ endEarly = true;
435
+ }
436
+ if (!endEarly) {
437
+ const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`);
438
+ const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
439
+ const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
440
+ const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
441
+ // Check if following lines should be included in List Item
442
+ while (src) {
443
+ const rawLine = src.split('\n', 1)[0];
444
+ nextLine = rawLine;
445
+ // Re-align to follow commonmark nesting rules
446
+ if (this.options.pedantic) {
447
+ nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
448
+ }
449
+ // End list item if found code fences
450
+ if (fencesBeginRegex.test(nextLine)) {
451
+ break;
452
+ }
453
+ // End list item if found start of new heading
454
+ if (headingBeginRegex.test(nextLine)) {
455
+ break;
456
+ }
457
+ // End list item if found start of new bullet
458
+ if (nextBulletRegex.test(nextLine)) {
459
+ break;
460
+ }
461
+ // Horizontal rule found
462
+ if (hrRegex.test(src)) {
463
+ break;
464
+ }
465
+ if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) { // Dedent if possible
466
+ itemContents += '\n' + nextLine.slice(indent);
467
+ }
468
+ else {
469
+ // not enough indentation
470
+ if (blankLine) {
471
+ break;
472
+ }
473
+ // paragraph continuation unless last line was a different block level element
474
+ if (line.search(/[^ ]/) >= 4) { // indented code block
475
+ break;
476
+ }
477
+ if (fencesBeginRegex.test(line)) {
478
+ break;
479
+ }
480
+ if (headingBeginRegex.test(line)) {
481
+ break;
482
+ }
483
+ if (hrRegex.test(line)) {
484
+ break;
485
+ }
486
+ itemContents += '\n' + nextLine;
487
+ }
488
+ if (!blankLine && !nextLine.trim()) { // Check if current line is blank
489
+ blankLine = true;
490
+ }
491
+ raw += rawLine + '\n';
492
+ src = src.substring(rawLine.length + 1);
493
+ line = nextLine.slice(indent);
494
+ }
495
+ }
496
+ if (!list.loose) {
497
+ // If the previous item ended with a blank line, the list is loose
498
+ if (endsWithBlankLine) {
499
+ list.loose = true;
500
+ }
501
+ else if (/\n *\n *$/.test(raw)) {
502
+ endsWithBlankLine = true;
503
+ }
504
+ }
505
+ let istask = null;
506
+ let ischecked;
507
+ // Check for task list items
508
+ if (this.options.gfm) {
509
+ istask = /^\[[ xX]\] /.exec(itemContents);
510
+ if (istask) {
511
+ ischecked = istask[0] !== '[ ] ';
512
+ itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
513
+ }
514
+ }
515
+ list.items.push({
516
+ type: 'list_item',
517
+ raw,
518
+ task: !!istask,
519
+ checked: ischecked,
520
+ loose: false,
521
+ text: itemContents,
522
+ tokens: [],
523
+ });
524
+ list.raw += raw;
525
+ }
526
+ // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
527
+ list.items[list.items.length - 1].raw = list.items[list.items.length - 1].raw.trimEnd();
528
+ list.items[list.items.length - 1].text = list.items[list.items.length - 1].text.trimEnd();
529
+ list.raw = list.raw.trimEnd();
530
+ // Item child tokens handled here at end because we needed to have the final item to trim it first
531
+ for (let i = 0; i < list.items.length; i++) {
532
+ this.lexer.state.top = false;
533
+ list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
534
+ if (!list.loose) {
535
+ // Check if list should be loose
536
+ const spacers = list.items[i].tokens.filter(t => t.type === 'space');
537
+ const hasMultipleLineBreaks = spacers.length > 0 && spacers.some(t => /\n.*\n/.test(t.raw));
538
+ list.loose = hasMultipleLineBreaks;
539
+ }
540
+ }
541
+ // Set all items to loose if list is loose
542
+ if (list.loose) {
543
+ for (let i = 0; i < list.items.length; i++) {
544
+ list.items[i].loose = true;
545
+ }
546
+ }
547
+ return list;
548
+ }
549
+ }
550
+ html(src) {
551
+ const cap = this.rules.block.html.exec(src);
552
+ if (cap) {
553
+ const token = {
554
+ type: 'html',
555
+ block: true,
556
+ raw: cap[0],
557
+ pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',
558
+ text: cap[0],
559
+ };
560
+ return token;
561
+ }
562
+ }
563
+ def(src) {
564
+ const cap = this.rules.block.def.exec(src);
565
+ if (cap) {
566
+ const tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
567
+ const href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline.anyPunctuation, '$1') : '';
568
+ const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, '$1') : cap[3];
569
+ return {
570
+ type: 'def',
571
+ tag,
572
+ raw: cap[0],
573
+ href,
574
+ title,
575
+ };
576
+ }
577
+ }
578
+ table(src) {
579
+ const cap = this.rules.block.table.exec(src);
580
+ if (!cap) {
581
+ return;
582
+ }
583
+ if (!/[:|]/.test(cap[2])) {
584
+ // delimiter row must have a pipe (|) or colon (:) otherwise it is a setext heading
585
+ return;
586
+ }
587
+ const headers = splitCells(cap[1]);
588
+ const aligns = cap[2].replace(/^\||\| *$/g, '').split('|');
589
+ const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [];
590
+ const item = {
591
+ type: 'table',
592
+ raw: cap[0],
593
+ header: [],
594
+ align: [],
595
+ rows: [],
596
+ };
597
+ if (headers.length !== aligns.length) {
598
+ // header and align columns must be equal, rows can be different.
599
+ return;
600
+ }
601
+ for (const align of aligns) {
602
+ if (/^ *-+: *$/.test(align)) {
603
+ item.align.push('right');
604
+ }
605
+ else if (/^ *:-+: *$/.test(align)) {
606
+ item.align.push('center');
607
+ }
608
+ else if (/^ *:-+ *$/.test(align)) {
609
+ item.align.push('left');
610
+ }
611
+ else {
612
+ item.align.push(null);
613
+ }
614
+ }
615
+ for (let i = 0; i < headers.length; i++) {
616
+ item.header.push({
617
+ text: headers[i],
618
+ tokens: this.lexer.inline(headers[i]),
619
+ header: true,
620
+ align: item.align[i],
621
+ });
622
+ }
623
+ for (const row of rows) {
624
+ item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
625
+ return {
626
+ text: cell,
627
+ tokens: this.lexer.inline(cell),
628
+ header: false,
629
+ align: item.align[i],
630
+ };
631
+ }));
632
+ }
633
+ return item;
634
+ }
635
+ lheading(src) {
636
+ const cap = this.rules.block.lheading.exec(src);
637
+ if (cap) {
638
+ return {
639
+ type: 'heading',
640
+ raw: cap[0],
641
+ depth: cap[2].charAt(0) === '=' ? 1 : 2,
642
+ text: cap[1],
643
+ tokens: this.lexer.inline(cap[1]),
644
+ };
645
+ }
646
+ }
647
+ paragraph(src) {
648
+ const cap = this.rules.block.paragraph.exec(src);
649
+ if (cap) {
650
+ const text = cap[1].charAt(cap[1].length - 1) === '\n'
651
+ ? cap[1].slice(0, -1)
652
+ : cap[1];
653
+ return {
654
+ type: 'paragraph',
655
+ raw: cap[0],
656
+ text,
657
+ tokens: this.lexer.inline(text),
658
+ };
659
+ }
660
+ }
661
+ text(src) {
662
+ const cap = this.rules.block.text.exec(src);
663
+ if (cap) {
664
+ return {
665
+ type: 'text',
666
+ raw: cap[0],
667
+ text: cap[0],
668
+ tokens: this.lexer.inline(cap[0]),
669
+ };
670
+ }
671
+ }
672
+ escape(src) {
673
+ const cap = this.rules.inline.escape.exec(src);
674
+ if (cap) {
675
+ return {
676
+ type: 'escape',
677
+ raw: cap[0],
678
+ text: escape$1(cap[1]),
679
+ };
680
+ }
681
+ }
682
+ tag(src) {
683
+ const cap = this.rules.inline.tag.exec(src);
684
+ if (cap) {
685
+ if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
686
+ this.lexer.state.inLink = true;
687
+ }
688
+ else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
689
+ this.lexer.state.inLink = false;
690
+ }
691
+ if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
692
+ this.lexer.state.inRawBlock = true;
693
+ }
694
+ else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
695
+ this.lexer.state.inRawBlock = false;
696
+ }
697
+ return {
698
+ type: 'html',
699
+ raw: cap[0],
700
+ inLink: this.lexer.state.inLink,
701
+ inRawBlock: this.lexer.state.inRawBlock,
702
+ block: false,
703
+ text: cap[0],
704
+ };
705
+ }
706
+ }
707
+ link(src) {
708
+ const cap = this.rules.inline.link.exec(src);
709
+ if (cap) {
710
+ const trimmedUrl = cap[2].trim();
711
+ if (!this.options.pedantic && /^</.test(trimmedUrl)) {
712
+ // commonmark requires matching angle brackets
713
+ if (!(/>$/.test(trimmedUrl))) {
714
+ return;
715
+ }
716
+ // ending angle bracket cannot be escaped
717
+ const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
718
+ if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
719
+ return;
720
+ }
721
+ }
722
+ else {
723
+ // find closing parenthesis
724
+ const lastParenIndex = findClosingBracket(cap[2], '()');
725
+ if (lastParenIndex > -1) {
726
+ const start = cap[0].indexOf('!') === 0 ? 5 : 4;
727
+ const linkLen = start + cap[1].length + lastParenIndex;
728
+ cap[2] = cap[2].substring(0, lastParenIndex);
729
+ cap[0] = cap[0].substring(0, linkLen).trim();
730
+ cap[3] = '';
731
+ }
732
+ }
733
+ let href = cap[2];
734
+ let title = '';
735
+ if (this.options.pedantic) {
736
+ // split pedantic href and title
737
+ const link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
738
+ if (link) {
739
+ href = link[1];
740
+ title = link[3];
741
+ }
742
+ }
743
+ else {
744
+ title = cap[3] ? cap[3].slice(1, -1) : '';
745
+ }
746
+ href = href.trim();
747
+ if (/^</.test(href)) {
748
+ if (this.options.pedantic && !(/>$/.test(trimmedUrl))) {
749
+ // pedantic allows starting angle bracket without ending angle bracket
750
+ href = href.slice(1);
751
+ }
752
+ else {
753
+ href = href.slice(1, -1);
754
+ }
755
+ }
756
+ return outputLink(cap, {
757
+ href: href ? href.replace(this.rules.inline.anyPunctuation, '$1') : href,
758
+ title: title ? title.replace(this.rules.inline.anyPunctuation, '$1') : title,
759
+ }, cap[0], this.lexer);
760
+ }
761
+ }
762
+ reflink(src, links) {
763
+ let cap;
764
+ if ((cap = this.rules.inline.reflink.exec(src))
765
+ || (cap = this.rules.inline.nolink.exec(src))) {
766
+ const linkString = (cap[2] || cap[1]).replace(/\s+/g, ' ');
767
+ const link = links[linkString.toLowerCase()];
768
+ if (!link) {
769
+ const text = cap[0].charAt(0);
770
+ return {
771
+ type: 'text',
772
+ raw: text,
773
+ text,
774
+ };
775
+ }
776
+ return outputLink(cap, link, cap[0], this.lexer);
777
+ }
778
+ }
779
+ emStrong(src, maskedSrc, prevChar = '') {
780
+ let match = this.rules.inline.emStrongLDelim.exec(src);
781
+ if (!match)
782
+ return;
783
+ // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
784
+ if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
785
+ return;
786
+ const nextChar = match[1] || match[2] || '';
787
+ if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
788
+ // unicode Regex counts emoji as 1 char; spread into array for proper count (used multiple times below)
789
+ const lLength = [...match[0]].length - 1;
790
+ let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
791
+ const endReg = match[0][0] === '*' ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
792
+ endReg.lastIndex = 0;
793
+ // Clip maskedSrc to same section of string as src (move to lexer?)
794
+ maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
795
+ while ((match = endReg.exec(maskedSrc)) != null) {
796
+ rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
797
+ if (!rDelim)
798
+ continue; // skip single * in __abc*abc__
799
+ rLength = [...rDelim].length;
800
+ if (match[3] || match[4]) { // found another Left Delim
801
+ delimTotal += rLength;
802
+ continue;
803
+ }
804
+ else if (match[5] || match[6]) { // either Left or Right Delim
805
+ if (lLength % 3 && !((lLength + rLength) % 3)) {
806
+ midDelimTotal += rLength;
807
+ continue; // CommonMark Emphasis Rules 9-10
808
+ }
809
+ }
810
+ delimTotal -= rLength;
811
+ if (delimTotal > 0)
812
+ continue; // Haven't found enough closing delimiters
813
+ // Remove extra characters. *a*** -> *a*
814
+ rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
815
+ // char length can be >1 for unicode characters;
816
+ const lastCharLength = [...match[0]][0].length;
817
+ const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
818
+ // Create `em` if smallest delimiter has odd char count. *a***
819
+ if (Math.min(lLength, rLength) % 2) {
820
+ const text = raw.slice(1, -1);
821
+ return {
822
+ type: 'em',
823
+ raw,
824
+ text,
825
+ tokens: this.lexer.inlineTokens(text),
826
+ };
827
+ }
828
+ // Create 'strong' if smallest delimiter has even char count. **a***
829
+ const text = raw.slice(2, -2);
830
+ return {
831
+ type: 'strong',
832
+ raw,
833
+ text,
834
+ tokens: this.lexer.inlineTokens(text),
835
+ };
836
+ }
837
+ }
838
+ }
839
+ codespan(src) {
840
+ const cap = this.rules.inline.code.exec(src);
841
+ if (cap) {
842
+ let text = cap[2].replace(/\n/g, ' ');
843
+ const hasNonSpaceChars = /[^ ]/.test(text);
844
+ const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
845
+ if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
846
+ text = text.substring(1, text.length - 1);
847
+ }
848
+ text = escape$1(text, true);
849
+ return {
850
+ type: 'codespan',
851
+ raw: cap[0],
852
+ text,
853
+ };
854
+ }
855
+ }
856
+ br(src) {
857
+ const cap = this.rules.inline.br.exec(src);
858
+ if (cap) {
859
+ return {
860
+ type: 'br',
861
+ raw: cap[0],
862
+ };
863
+ }
864
+ }
865
+ del(src) {
866
+ const cap = this.rules.inline.del.exec(src);
867
+ if (cap) {
868
+ return {
869
+ type: 'del',
870
+ raw: cap[0],
871
+ text: cap[2],
872
+ tokens: this.lexer.inlineTokens(cap[2]),
873
+ };
874
+ }
875
+ }
876
+ autolink(src) {
877
+ const cap = this.rules.inline.autolink.exec(src);
878
+ if (cap) {
879
+ let text, href;
880
+ if (cap[2] === '@') {
881
+ text = escape$1(cap[1]);
882
+ href = 'mailto:' + text;
883
+ }
884
+ else {
885
+ text = escape$1(cap[1]);
886
+ href = text;
887
+ }
888
+ return {
889
+ type: 'link',
890
+ raw: cap[0],
891
+ text,
892
+ href,
893
+ tokens: [
894
+ {
895
+ type: 'text',
896
+ raw: text,
897
+ text,
898
+ },
899
+ ],
900
+ };
901
+ }
902
+ }
903
+ url(src) {
904
+ let cap;
905
+ if (cap = this.rules.inline.url.exec(src)) {
906
+ let text, href;
907
+ if (cap[2] === '@') {
908
+ text = escape$1(cap[0]);
909
+ href = 'mailto:' + text;
910
+ }
911
+ else {
912
+ // do extended autolink path validation
913
+ let prevCapZero;
914
+ do {
915
+ prevCapZero = cap[0];
916
+ cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? '';
917
+ } while (prevCapZero !== cap[0]);
918
+ text = escape$1(cap[0]);
919
+ if (cap[1] === 'www.') {
920
+ href = 'http://' + cap[0];
921
+ }
922
+ else {
923
+ href = cap[0];
924
+ }
925
+ }
926
+ return {
927
+ type: 'link',
928
+ raw: cap[0],
929
+ text,
930
+ href,
931
+ tokens: [
932
+ {
933
+ type: 'text',
934
+ raw: text,
935
+ text,
936
+ },
937
+ ],
938
+ };
939
+ }
940
+ }
941
+ inlineText(src) {
942
+ const cap = this.rules.inline.text.exec(src);
943
+ if (cap) {
944
+ let text;
945
+ if (this.lexer.state.inRawBlock) {
946
+ text = cap[0];
947
+ }
948
+ else {
949
+ text = escape$1(cap[0]);
950
+ }
951
+ return {
952
+ type: 'text',
953
+ raw: cap[0],
954
+ text,
955
+ };
956
+ }
957
+ }
958
+ }
959
+
960
+ /**
961
+ * Block-Level Grammar
962
+ */
963
+ const newline = /^(?: *(?:\n|$))+/;
964
+ const blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
965
+ const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
966
+ const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
967
+ const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
968
+ const bullet = /(?:[*+-]|\d{1,9}[.)])/;
969
+ const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
970
+ .replace(/bull/g, bullet) // lists can interrupt
971
+ .replace(/blockCode/g, / {4}/) // indented code blocks can interrupt
972
+ .replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
973
+ .replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
974
+ .replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
975
+ .replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
976
+ .getRegex();
977
+ const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
978
+ const blockText = /^[^\n]+/;
979
+ const _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
980
+ const def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/)
981
+ .replace('label', _blockLabel)
982
+ .replace('title', /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/)
983
+ .getRegex();
984
+ const list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/)
985
+ .replace(/bull/g, bullet)
986
+ .getRegex();
987
+ const _tag = 'address|article|aside|base|basefont|blockquote|body|caption'
988
+ + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption'
989
+ + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe'
990
+ + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option'
991
+ + '|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title'
992
+ + '|tr|track|ul';
993
+ const _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
994
+ const html = edit('^ {0,3}(?:' // optional indentation
995
+ + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
996
+ + '|comment[^\\n]*(\\n+|$)' // (2)
997
+ + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
998
+ + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
999
+ + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
1000
+ + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
1001
+ + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
1002
+ + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
1003
+ + ')', 'i')
1004
+ .replace('comment', _comment)
1005
+ .replace('tag', _tag)
1006
+ .replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
1007
+ .getRegex();
1008
+ const paragraph = edit(_paragraph)
1009
+ .replace('hr', hr)
1010
+ .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
1011
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
1012
+ .replace('|table', '')
1013
+ .replace('blockquote', ' {0,3}>')
1014
+ .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
1015
+ .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1016
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
1017
+ .replace('tag', _tag) // pars can be interrupted by type (6) html blocks
1018
+ .getRegex();
1019
+ const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/)
1020
+ .replace('paragraph', paragraph)
1021
+ .getRegex();
1022
+ /**
1023
+ * Normal Block Grammar
1024
+ */
1025
+ const blockNormal = {
1026
+ blockquote,
1027
+ code: blockCode,
1028
+ def,
1029
+ fences,
1030
+ heading,
1031
+ hr,
1032
+ html,
1033
+ lheading,
1034
+ list,
1035
+ newline,
1036
+ paragraph,
1037
+ table: noopTest,
1038
+ text: blockText,
1039
+ };
1040
+ /**
1041
+ * GFM Block Grammar
1042
+ */
1043
+ const gfmTable = edit('^ *([^\\n ].*)\\n' // Header
1044
+ + ' {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)' // Align
1045
+ + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)') // Cells
1046
+ .replace('hr', hr)
1047
+ .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
1048
+ .replace('blockquote', ' {0,3}>')
1049
+ .replace('code', ' {4}[^\\n]')
1050
+ .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
1051
+ .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1052
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
1053
+ .replace('tag', _tag) // tables can be interrupted by type (6) html blocks
1054
+ .getRegex();
1055
+ const blockGfm = {
1056
+ ...blockNormal,
1057
+ table: gfmTable,
1058
+ paragraph: edit(_paragraph)
1059
+ .replace('hr', hr)
1060
+ .replace('heading', ' {0,3}#{1,6}(?:\\s|$)')
1061
+ .replace('|lheading', '') // setext headings don't interrupt commonmark paragraphs
1062
+ .replace('table', gfmTable) // interrupt paragraphs with table
1063
+ .replace('blockquote', ' {0,3}>')
1064
+ .replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n')
1065
+ .replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
1066
+ .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)')
1067
+ .replace('tag', _tag) // pars can be interrupted by type (6) html blocks
1068
+ .getRegex(),
1069
+ };
1070
+ /**
1071
+ * Pedantic grammar (original John Gruber's loose markdown specification)
1072
+ */
1073
+ const blockPedantic = {
1074
+ ...blockNormal,
1075
+ html: edit('^ *(?:comment *(?:\\n|\\s*$)'
1076
+ + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
1077
+ + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))')
1078
+ .replace('comment', _comment)
1079
+ .replace(/tag/g, '(?!(?:'
1080
+ + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub'
1081
+ + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)'
1082
+ + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b')
1083
+ .getRegex(),
1084
+ def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
1085
+ heading: /^(#{1,6})(.*)(?:\n+|$)/,
1086
+ fences: noopTest, // fences not supported
1087
+ lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
1088
+ paragraph: edit(_paragraph)
1089
+ .replace('hr', hr)
1090
+ .replace('heading', ' *#{1,6} *[^\n]')
1091
+ .replace('lheading', lheading)
1092
+ .replace('|table', '')
1093
+ .replace('blockquote', ' {0,3}>')
1094
+ .replace('|fences', '')
1095
+ .replace('|list', '')
1096
+ .replace('|html', '')
1097
+ .replace('|tag', '')
1098
+ .getRegex(),
1099
+ };
1100
+ /**
1101
+ * Inline-Level Grammar
1102
+ */
1103
+ const escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
1104
+ const inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
1105
+ const br = /^( {2,}|\\)\n(?!\s*$)/;
1106
+ const inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
1107
+ // list of unicode punctuation marks, plus any missing characters from CommonMark spec
1108
+ const _punctuation = '\\p{P}\\p{S}';
1109
+ const punctuation = edit(/^((?![*_])[\spunctuation])/, 'u')
1110
+ .replace(/punctuation/g, _punctuation).getRegex();
1111
+ // sequences em should skip over [title](link), `code`, <html>
1112
+ const blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
1113
+ const emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, 'u')
1114
+ .replace(/punct/g, _punctuation)
1115
+ .getRegex();
1116
+ const emStrongRDelimAst = edit('^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)' // Skip orphan inside strong
1117
+ + '|[^*]+(?=[^*])' // Consume to delim
1118
+ + '|(?!\\*)[punct](\\*+)(?=[\\s]|$)' // (1) #*** can only be a Right Delimiter
1119
+ + '|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)' // (2) a***#, a*** can only be a Right Delimiter
1120
+ + '|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])' // (3) #***a, ***a can only be Left Delimiter
1121
+ + '|[\\s](\\*+)(?!\\*)(?=[punct])' // (4) ***# can only be Left Delimiter
1122
+ + '|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])' // (5) #***# can be either Left or Right Delimiter
1123
+ + '|[^punct\\s](\\*+)(?=[^punct\\s])', 'gu') // (6) a***a can be either Left or Right Delimiter
1124
+ .replace(/punct/g, _punctuation)
1125
+ .getRegex();
1126
+ // (6) Not allowed for _
1127
+ const emStrongRDelimUnd = edit('^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)' // Skip orphan inside strong
1128
+ + '|[^_]+(?=[^_])' // Consume to delim
1129
+ + '|(?!_)[punct](_+)(?=[\\s]|$)' // (1) #___ can only be a Right Delimiter
1130
+ + '|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)' // (2) a___#, a___ can only be a Right Delimiter
1131
+ + '|(?!_)[punct\\s](_+)(?=[^punct\\s])' // (3) #___a, ___a can only be Left Delimiter
1132
+ + '|[\\s](_+)(?!_)(?=[punct])' // (4) ___# can only be Left Delimiter
1133
+ + '|(?!_)[punct](_+)(?!_)(?=[punct])', 'gu') // (5) #___# can be either Left or Right Delimiter
1134
+ .replace(/punct/g, _punctuation)
1135
+ .getRegex();
1136
+ const anyPunctuation = edit(/\\([punct])/, 'gu')
1137
+ .replace(/punct/g, _punctuation)
1138
+ .getRegex();
1139
+ const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/)
1140
+ .replace('scheme', /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/)
1141
+ .replace('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])?)+(?![-_])/)
1142
+ .getRegex();
1143
+ const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex();
1144
+ const tag = edit('^comment'
1145
+ + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
1146
+ + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
1147
+ + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
1148
+ + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
1149
+ + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>') // CDATA section
1150
+ .replace('comment', _inlineComment)
1151
+ .replace('attribute', /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/)
1152
+ .getRegex();
1153
+ const _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
1154
+ const link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/)
1155
+ .replace('label', _inlineLabel)
1156
+ .replace('href', /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/)
1157
+ .replace('title', /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/)
1158
+ .getRegex();
1159
+ const reflink = edit(/^!?\[(label)\]\[(ref)\]/)
1160
+ .replace('label', _inlineLabel)
1161
+ .replace('ref', _blockLabel)
1162
+ .getRegex();
1163
+ const nolink = edit(/^!?\[(ref)\](?:\[\])?/)
1164
+ .replace('ref', _blockLabel)
1165
+ .getRegex();
1166
+ const reflinkSearch = edit('reflink|nolink(?!\\()', 'g')
1167
+ .replace('reflink', reflink)
1168
+ .replace('nolink', nolink)
1169
+ .getRegex();
1170
+ /**
1171
+ * Normal Inline Grammar
1172
+ */
1173
+ const inlineNormal = {
1174
+ _backpedal: noopTest, // only used for GFM url
1175
+ anyPunctuation,
1176
+ autolink,
1177
+ blockSkip,
1178
+ br,
1179
+ code: inlineCode,
1180
+ del: noopTest,
1181
+ emStrongLDelim,
1182
+ emStrongRDelimAst,
1183
+ emStrongRDelimUnd,
1184
+ escape,
1185
+ link,
1186
+ nolink,
1187
+ punctuation,
1188
+ reflink,
1189
+ reflinkSearch,
1190
+ tag,
1191
+ text: inlineText,
1192
+ url: noopTest,
1193
+ };
1194
+ /**
1195
+ * Pedantic Inline Grammar
1196
+ */
1197
+ const inlinePedantic = {
1198
+ ...inlineNormal,
1199
+ link: edit(/^!?\[(label)\]\((.*?)\)/)
1200
+ .replace('label', _inlineLabel)
1201
+ .getRegex(),
1202
+ reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/)
1203
+ .replace('label', _inlineLabel)
1204
+ .getRegex(),
1205
+ };
1206
+ /**
1207
+ * GFM Inline Grammar
1208
+ */
1209
+ const inlineGfm = {
1210
+ ...inlineNormal,
1211
+ escape: edit(escape).replace('])', '~|])').getRegex(),
1212
+ url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i')
1213
+ .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
1214
+ .getRegex(),
1215
+ _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
1216
+ del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
1217
+ text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/,
1218
+ };
1219
+ /**
1220
+ * GFM + Line Breaks Inline Grammar
1221
+ */
1222
+ const inlineBreaks = {
1223
+ ...inlineGfm,
1224
+ br: edit(br).replace('{2,}', '*').getRegex(),
1225
+ text: edit(inlineGfm.text)
1226
+ .replace('\\b_', '\\b_| {2,}\\n')
1227
+ .replace(/\{2,\}/g, '*')
1228
+ .getRegex(),
1229
+ };
1230
+ /**
1231
+ * exports
1232
+ */
1233
+ const block = {
1234
+ normal: blockNormal,
1235
+ gfm: blockGfm,
1236
+ pedantic: blockPedantic,
1237
+ };
1238
+ const inline = {
1239
+ normal: inlineNormal,
1240
+ gfm: inlineGfm,
1241
+ breaks: inlineBreaks,
1242
+ pedantic: inlinePedantic,
1243
+ };
1244
+
1245
+ /**
1246
+ * Block Lexer
1247
+ */
1248
+ class _Lexer {
1249
+ tokens;
1250
+ options;
1251
+ state;
1252
+ tokenizer;
1253
+ inlineQueue;
1254
+ constructor(options) {
1255
+ // TokenList cannot be created in one go
1256
+ this.tokens = [];
1257
+ this.tokens.links = Object.create(null);
1258
+ this.options = options || _defaults;
1259
+ this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
1260
+ this.tokenizer = this.options.tokenizer;
1261
+ this.tokenizer.options = this.options;
1262
+ this.tokenizer.lexer = this;
1263
+ this.inlineQueue = [];
1264
+ this.state = {
1265
+ inLink: false,
1266
+ inRawBlock: false,
1267
+ top: true,
1268
+ };
1269
+ const rules = {
1270
+ block: block.normal,
1271
+ inline: inline.normal,
1272
+ };
1273
+ if (this.options.pedantic) {
1274
+ rules.block = block.pedantic;
1275
+ rules.inline = inline.pedantic;
1276
+ }
1277
+ else if (this.options.gfm) {
1278
+ rules.block = block.gfm;
1279
+ if (this.options.breaks) {
1280
+ rules.inline = inline.breaks;
1281
+ }
1282
+ else {
1283
+ rules.inline = inline.gfm;
1284
+ }
1285
+ }
1286
+ this.tokenizer.rules = rules;
1287
+ }
1288
+ /**
1289
+ * Expose Rules
1290
+ */
1291
+ static get rules() {
1292
+ return {
1293
+ block,
1294
+ inline,
1295
+ };
1296
+ }
1297
+ /**
1298
+ * Static Lex Method
1299
+ */
1300
+ static lex(src, options) {
1301
+ const lexer = new _Lexer(options);
1302
+ return lexer.lex(src);
1303
+ }
1304
+ /**
1305
+ * Static Lex Inline Method
1306
+ */
1307
+ static lexInline(src, options) {
1308
+ const lexer = new _Lexer(options);
1309
+ return lexer.inlineTokens(src);
1310
+ }
1311
+ /**
1312
+ * Preprocessing
1313
+ */
1314
+ lex(src) {
1315
+ src = src
1316
+ .replace(/\r\n|\r/g, '\n');
1317
+ this.blockTokens(src, this.tokens);
1318
+ for (let i = 0; i < this.inlineQueue.length; i++) {
1319
+ const next = this.inlineQueue[i];
1320
+ this.inlineTokens(next.src, next.tokens);
1321
+ }
1322
+ this.inlineQueue = [];
1323
+ return this.tokens;
1324
+ }
1325
+ blockTokens(src, tokens = [], lastParagraphClipped = false) {
1326
+ if (this.options.pedantic) {
1327
+ src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
1328
+ }
1329
+ else {
1330
+ src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
1331
+ return leading + ' '.repeat(tabs.length);
1332
+ });
1333
+ }
1334
+ let token;
1335
+ let lastToken;
1336
+ let cutSrc;
1337
+ while (src) {
1338
+ if (this.options.extensions
1339
+ && this.options.extensions.block
1340
+ && this.options.extensions.block.some((extTokenizer) => {
1341
+ if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
1342
+ src = src.substring(token.raw.length);
1343
+ tokens.push(token);
1344
+ return true;
1345
+ }
1346
+ return false;
1347
+ })) {
1348
+ continue;
1349
+ }
1350
+ // newline
1351
+ if (token = this.tokenizer.space(src)) {
1352
+ src = src.substring(token.raw.length);
1353
+ if (token.raw.length === 1 && tokens.length > 0) {
1354
+ // if there's a single \n as a spacer, it's terminating the last line,
1355
+ // so move it there so that we don't get unnecessary paragraph tags
1356
+ tokens[tokens.length - 1].raw += '\n';
1357
+ }
1358
+ else {
1359
+ tokens.push(token);
1360
+ }
1361
+ continue;
1362
+ }
1363
+ // code
1364
+ if (token = this.tokenizer.code(src)) {
1365
+ src = src.substring(token.raw.length);
1366
+ lastToken = tokens[tokens.length - 1];
1367
+ // An indented code block cannot interrupt a paragraph.
1368
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1369
+ lastToken.raw += '\n' + token.raw;
1370
+ lastToken.text += '\n' + token.text;
1371
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1372
+ }
1373
+ else {
1374
+ tokens.push(token);
1375
+ }
1376
+ continue;
1377
+ }
1378
+ // fences
1379
+ if (token = this.tokenizer.fences(src)) {
1380
+ src = src.substring(token.raw.length);
1381
+ tokens.push(token);
1382
+ continue;
1383
+ }
1384
+ // heading
1385
+ if (token = this.tokenizer.heading(src)) {
1386
+ src = src.substring(token.raw.length);
1387
+ tokens.push(token);
1388
+ continue;
1389
+ }
1390
+ // hr
1391
+ if (token = this.tokenizer.hr(src)) {
1392
+ src = src.substring(token.raw.length);
1393
+ tokens.push(token);
1394
+ continue;
1395
+ }
1396
+ // blockquote
1397
+ if (token = this.tokenizer.blockquote(src)) {
1398
+ src = src.substring(token.raw.length);
1399
+ tokens.push(token);
1400
+ continue;
1401
+ }
1402
+ // list
1403
+ if (token = this.tokenizer.list(src)) {
1404
+ src = src.substring(token.raw.length);
1405
+ tokens.push(token);
1406
+ continue;
1407
+ }
1408
+ // html
1409
+ if (token = this.tokenizer.html(src)) {
1410
+ src = src.substring(token.raw.length);
1411
+ tokens.push(token);
1412
+ continue;
1413
+ }
1414
+ // def
1415
+ if (token = this.tokenizer.def(src)) {
1416
+ src = src.substring(token.raw.length);
1417
+ lastToken = tokens[tokens.length - 1];
1418
+ if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
1419
+ lastToken.raw += '\n' + token.raw;
1420
+ lastToken.text += '\n' + token.raw;
1421
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1422
+ }
1423
+ else if (!this.tokens.links[token.tag]) {
1424
+ this.tokens.links[token.tag] = {
1425
+ href: token.href,
1426
+ title: token.title,
1427
+ };
1428
+ }
1429
+ continue;
1430
+ }
1431
+ // table (gfm)
1432
+ if (token = this.tokenizer.table(src)) {
1433
+ src = src.substring(token.raw.length);
1434
+ tokens.push(token);
1435
+ continue;
1436
+ }
1437
+ // lheading
1438
+ if (token = this.tokenizer.lheading(src)) {
1439
+ src = src.substring(token.raw.length);
1440
+ tokens.push(token);
1441
+ continue;
1442
+ }
1443
+ // top-level paragraph
1444
+ // prevent paragraph consuming extensions by clipping 'src' to extension start
1445
+ cutSrc = src;
1446
+ if (this.options.extensions && this.options.extensions.startBlock) {
1447
+ let startIndex = Infinity;
1448
+ const tempSrc = src.slice(1);
1449
+ let tempStart;
1450
+ this.options.extensions.startBlock.forEach((getStartIndex) => {
1451
+ tempStart = getStartIndex.call({ lexer: this }, tempSrc);
1452
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1453
+ startIndex = Math.min(startIndex, tempStart);
1454
+ }
1455
+ });
1456
+ if (startIndex < Infinity && startIndex >= 0) {
1457
+ cutSrc = src.substring(0, startIndex + 1);
1458
+ }
1459
+ }
1460
+ if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
1461
+ lastToken = tokens[tokens.length - 1];
1462
+ if (lastParagraphClipped && lastToken?.type === 'paragraph') {
1463
+ lastToken.raw += '\n' + token.raw;
1464
+ lastToken.text += '\n' + token.text;
1465
+ this.inlineQueue.pop();
1466
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1467
+ }
1468
+ else {
1469
+ tokens.push(token);
1470
+ }
1471
+ lastParagraphClipped = (cutSrc.length !== src.length);
1472
+ src = src.substring(token.raw.length);
1473
+ continue;
1474
+ }
1475
+ // text
1476
+ if (token = this.tokenizer.text(src)) {
1477
+ src = src.substring(token.raw.length);
1478
+ lastToken = tokens[tokens.length - 1];
1479
+ if (lastToken && lastToken.type === 'text') {
1480
+ lastToken.raw += '\n' + token.raw;
1481
+ lastToken.text += '\n' + token.text;
1482
+ this.inlineQueue.pop();
1483
+ this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
1484
+ }
1485
+ else {
1486
+ tokens.push(token);
1487
+ }
1488
+ continue;
1489
+ }
1490
+ if (src) {
1491
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1492
+ if (this.options.silent) {
1493
+ console.error(errMsg);
1494
+ break;
1495
+ }
1496
+ else {
1497
+ throw new Error(errMsg);
1498
+ }
1499
+ }
1500
+ }
1501
+ this.state.top = true;
1502
+ return tokens;
1503
+ }
1504
+ inline(src, tokens = []) {
1505
+ this.inlineQueue.push({ src, tokens });
1506
+ return tokens;
1507
+ }
1508
+ /**
1509
+ * Lexing/Compiling
1510
+ */
1511
+ inlineTokens(src, tokens = []) {
1512
+ let token, lastToken, cutSrc;
1513
+ // String with links masked to avoid interference with em and strong
1514
+ let maskedSrc = src;
1515
+ let match;
1516
+ let keepPrevChar, prevChar;
1517
+ // Mask out reflinks
1518
+ if (this.tokens.links) {
1519
+ const links = Object.keys(this.tokens.links);
1520
+ if (links.length > 0) {
1521
+ while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
1522
+ if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
1523
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
1524
+ }
1525
+ }
1526
+ }
1527
+ }
1528
+ // Mask out other blocks
1529
+ while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
1530
+ maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
1531
+ }
1532
+ // Mask out escaped characters
1533
+ while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
1534
+ maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
1535
+ }
1536
+ while (src) {
1537
+ if (!keepPrevChar) {
1538
+ prevChar = '';
1539
+ }
1540
+ keepPrevChar = false;
1541
+ // extensions
1542
+ if (this.options.extensions
1543
+ && this.options.extensions.inline
1544
+ && this.options.extensions.inline.some((extTokenizer) => {
1545
+ if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
1546
+ src = src.substring(token.raw.length);
1547
+ tokens.push(token);
1548
+ return true;
1549
+ }
1550
+ return false;
1551
+ })) {
1552
+ continue;
1553
+ }
1554
+ // escape
1555
+ if (token = this.tokenizer.escape(src)) {
1556
+ src = src.substring(token.raw.length);
1557
+ tokens.push(token);
1558
+ continue;
1559
+ }
1560
+ // tag
1561
+ if (token = this.tokenizer.tag(src)) {
1562
+ src = src.substring(token.raw.length);
1563
+ lastToken = tokens[tokens.length - 1];
1564
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1565
+ lastToken.raw += token.raw;
1566
+ lastToken.text += token.text;
1567
+ }
1568
+ else {
1569
+ tokens.push(token);
1570
+ }
1571
+ continue;
1572
+ }
1573
+ // link
1574
+ if (token = this.tokenizer.link(src)) {
1575
+ src = src.substring(token.raw.length);
1576
+ tokens.push(token);
1577
+ continue;
1578
+ }
1579
+ // reflink, nolink
1580
+ if (token = this.tokenizer.reflink(src, this.tokens.links)) {
1581
+ src = src.substring(token.raw.length);
1582
+ lastToken = tokens[tokens.length - 1];
1583
+ if (lastToken && token.type === 'text' && lastToken.type === 'text') {
1584
+ lastToken.raw += token.raw;
1585
+ lastToken.text += token.text;
1586
+ }
1587
+ else {
1588
+ tokens.push(token);
1589
+ }
1590
+ continue;
1591
+ }
1592
+ // em & strong
1593
+ if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
1594
+ src = src.substring(token.raw.length);
1595
+ tokens.push(token);
1596
+ continue;
1597
+ }
1598
+ // code
1599
+ if (token = this.tokenizer.codespan(src)) {
1600
+ src = src.substring(token.raw.length);
1601
+ tokens.push(token);
1602
+ continue;
1603
+ }
1604
+ // br
1605
+ if (token = this.tokenizer.br(src)) {
1606
+ src = src.substring(token.raw.length);
1607
+ tokens.push(token);
1608
+ continue;
1609
+ }
1610
+ // del (gfm)
1611
+ if (token = this.tokenizer.del(src)) {
1612
+ src = src.substring(token.raw.length);
1613
+ tokens.push(token);
1614
+ continue;
1615
+ }
1616
+ // autolink
1617
+ if (token = this.tokenizer.autolink(src)) {
1618
+ src = src.substring(token.raw.length);
1619
+ tokens.push(token);
1620
+ continue;
1621
+ }
1622
+ // url (gfm)
1623
+ if (!this.state.inLink && (token = this.tokenizer.url(src))) {
1624
+ src = src.substring(token.raw.length);
1625
+ tokens.push(token);
1626
+ continue;
1627
+ }
1628
+ // text
1629
+ // prevent inlineText consuming extensions by clipping 'src' to extension start
1630
+ cutSrc = src;
1631
+ if (this.options.extensions && this.options.extensions.startInline) {
1632
+ let startIndex = Infinity;
1633
+ const tempSrc = src.slice(1);
1634
+ let tempStart;
1635
+ this.options.extensions.startInline.forEach((getStartIndex) => {
1636
+ tempStart = getStartIndex.call({ lexer: this }, tempSrc);
1637
+ if (typeof tempStart === 'number' && tempStart >= 0) {
1638
+ startIndex = Math.min(startIndex, tempStart);
1639
+ }
1640
+ });
1641
+ if (startIndex < Infinity && startIndex >= 0) {
1642
+ cutSrc = src.substring(0, startIndex + 1);
1643
+ }
1644
+ }
1645
+ if (token = this.tokenizer.inlineText(cutSrc)) {
1646
+ src = src.substring(token.raw.length);
1647
+ if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started
1648
+ prevChar = token.raw.slice(-1);
1649
+ }
1650
+ keepPrevChar = true;
1651
+ lastToken = tokens[tokens.length - 1];
1652
+ if (lastToken && lastToken.type === 'text') {
1653
+ lastToken.raw += token.raw;
1654
+ lastToken.text += token.text;
1655
+ }
1656
+ else {
1657
+ tokens.push(token);
1658
+ }
1659
+ continue;
1660
+ }
1661
+ if (src) {
1662
+ const errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
1663
+ if (this.options.silent) {
1664
+ console.error(errMsg);
1665
+ break;
1666
+ }
1667
+ else {
1668
+ throw new Error(errMsg);
1669
+ }
1670
+ }
1671
+ }
1672
+ return tokens;
1673
+ }
1674
+ }
1675
+
1676
+ /**
1677
+ * Renderer
1678
+ */
1679
+ class _Renderer {
1680
+ options;
1681
+ parser; // set by the parser
1682
+ constructor(options) {
1683
+ this.options = options || _defaults;
1684
+ }
1685
+ space(token) {
1686
+ return '';
1687
+ }
1688
+ code({ text, lang, escaped }) {
1689
+ const langString = (lang || '').match(/^\S*/)?.[0];
1690
+ const code = text.replace(/\n$/, '') + '\n';
1691
+ if (!langString) {
1692
+ return '<pre><code>'
1693
+ + (escaped ? code : escape$1(code, true))
1694
+ + '</code></pre>\n';
1695
+ }
1696
+ return '<pre><code class="language-'
1697
+ + escape$1(langString)
1698
+ + '">'
1699
+ + (escaped ? code : escape$1(code, true))
1700
+ + '</code></pre>\n';
1701
+ }
1702
+ blockquote({ tokens }) {
1703
+ const body = this.parser.parse(tokens);
1704
+ return `<blockquote>\n${body}</blockquote>\n`;
1705
+ }
1706
+ html({ text }) {
1707
+ return text;
1708
+ }
1709
+ heading({ tokens, depth }) {
1710
+ return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>\n`;
1711
+ }
1712
+ hr(token) {
1713
+ return '<hr>\n';
1714
+ }
1715
+ list(token) {
1716
+ const ordered = token.ordered;
1717
+ const start = token.start;
1718
+ let body = '';
1719
+ for (let j = 0; j < token.items.length; j++) {
1720
+ const item = token.items[j];
1721
+ body += this.listitem(item);
1722
+ }
1723
+ const type = ordered ? 'ol' : 'ul';
1724
+ const startAttr = (ordered && start !== 1) ? (' start="' + start + '"') : '';
1725
+ return '<' + type + startAttr + '>\n' + body + '</' + type + '>\n';
1726
+ }
1727
+ listitem(item) {
1728
+ let itemBody = '';
1729
+ if (item.task) {
1730
+ const checkbox = this.checkbox({ checked: !!item.checked });
1731
+ if (item.loose) {
1732
+ if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
1733
+ item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
1734
+ if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
1735
+ item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
1736
+ }
1737
+ }
1738
+ else {
1739
+ item.tokens.unshift({
1740
+ type: 'text',
1741
+ raw: checkbox + ' ',
1742
+ text: checkbox + ' ',
1743
+ });
1744
+ }
1745
+ }
1746
+ else {
1747
+ itemBody += checkbox + ' ';
1748
+ }
1749
+ }
1750
+ itemBody += this.parser.parse(item.tokens, !!item.loose);
1751
+ return `<li>${itemBody}</li>\n`;
1752
+ }
1753
+ checkbox({ checked }) {
1754
+ return '<input '
1755
+ + (checked ? 'checked="" ' : '')
1756
+ + 'disabled="" type="checkbox">';
1757
+ }
1758
+ paragraph({ tokens }) {
1759
+ return `<p>${this.parser.parseInline(tokens)}</p>\n`;
1760
+ }
1761
+ table(token) {
1762
+ let header = '';
1763
+ // header
1764
+ let cell = '';
1765
+ for (let j = 0; j < token.header.length; j++) {
1766
+ cell += this.tablecell(token.header[j]);
1767
+ }
1768
+ header += this.tablerow({ text: cell });
1769
+ let body = '';
1770
+ for (let j = 0; j < token.rows.length; j++) {
1771
+ const row = token.rows[j];
1772
+ cell = '';
1773
+ for (let k = 0; k < row.length; k++) {
1774
+ cell += this.tablecell(row[k]);
1775
+ }
1776
+ body += this.tablerow({ text: cell });
1777
+ }
1778
+ if (body)
1779
+ body = `<tbody>${body}</tbody>`;
1780
+ return '<table>\n'
1781
+ + '<thead>\n'
1782
+ + header
1783
+ + '</thead>\n'
1784
+ + body
1785
+ + '</table>\n';
1786
+ }
1787
+ tablerow({ text }) {
1788
+ return `<tr>\n${text}</tr>\n`;
1789
+ }
1790
+ tablecell(token) {
1791
+ const content = this.parser.parseInline(token.tokens);
1792
+ const type = token.header ? 'th' : 'td';
1793
+ const tag = token.align
1794
+ ? `<${type} align="${token.align}">`
1795
+ : `<${type}>`;
1796
+ return tag + content + `</${type}>\n`;
1797
+ }
1798
+ /**
1799
+ * span level renderer
1800
+ */
1801
+ strong({ tokens }) {
1802
+ return `<strong>${this.parser.parseInline(tokens)}</strong>`;
1803
+ }
1804
+ em({ tokens }) {
1805
+ return `<em>${this.parser.parseInline(tokens)}</em>`;
1806
+ }
1807
+ codespan({ text }) {
1808
+ return `<code>${text}</code>`;
1809
+ }
1810
+ br(token) {
1811
+ return '<br>';
1812
+ }
1813
+ del({ tokens }) {
1814
+ return `<del>${this.parser.parseInline(tokens)}</del>`;
1815
+ }
1816
+ link({ href, title, tokens }) {
1817
+ const text = this.parser.parseInline(tokens);
1818
+ const cleanHref = cleanUrl(href);
1819
+ if (cleanHref === null) {
1820
+ return text;
1821
+ }
1822
+ href = cleanHref;
1823
+ let out = '<a href="' + href + '"';
1824
+ if (title) {
1825
+ out += ' title="' + title + '"';
1826
+ }
1827
+ out += '>' + text + '</a>';
1828
+ return out;
1829
+ }
1830
+ image({ href, title, text }) {
1831
+ const cleanHref = cleanUrl(href);
1832
+ if (cleanHref === null) {
1833
+ return text;
1834
+ }
1835
+ href = cleanHref;
1836
+ let out = `<img src="${href}" alt="${text}"`;
1837
+ if (title) {
1838
+ out += ` title="${title}"`;
1839
+ }
1840
+ out += '>';
1841
+ return out;
1842
+ }
1843
+ text(token) {
1844
+ return 'tokens' in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
1845
+ }
1846
+ }
1847
+
1848
+ /**
1849
+ * TextRenderer
1850
+ * returns only the textual part of the token
1851
+ */
1852
+ class _TextRenderer {
1853
+ // no need for block level renderers
1854
+ strong({ text }) {
1855
+ return text;
1856
+ }
1857
+ em({ text }) {
1858
+ return text;
1859
+ }
1860
+ codespan({ text }) {
1861
+ return text;
1862
+ }
1863
+ del({ text }) {
1864
+ return text;
1865
+ }
1866
+ html({ text }) {
1867
+ return text;
1868
+ }
1869
+ text({ text }) {
1870
+ return text;
1871
+ }
1872
+ link({ text }) {
1873
+ return '' + text;
1874
+ }
1875
+ image({ text }) {
1876
+ return '' + text;
1877
+ }
1878
+ br() {
1879
+ return '';
1880
+ }
1881
+ }
1882
+
1883
+ /**
1884
+ * Parsing & Compiling
1885
+ */
1886
+ class _Parser {
1887
+ options;
1888
+ renderer;
1889
+ textRenderer;
1890
+ constructor(options) {
1891
+ this.options = options || _defaults;
1892
+ this.options.renderer = this.options.renderer || new _Renderer();
1893
+ this.renderer = this.options.renderer;
1894
+ this.renderer.options = this.options;
1895
+ this.renderer.parser = this;
1896
+ this.textRenderer = new _TextRenderer();
1897
+ }
1898
+ /**
1899
+ * Static Parse Method
1900
+ */
1901
+ static parse(tokens, options) {
1902
+ const parser = new _Parser(options);
1903
+ return parser.parse(tokens);
1904
+ }
1905
+ /**
1906
+ * Static Parse Inline Method
1907
+ */
1908
+ static parseInline(tokens, options) {
1909
+ const parser = new _Parser(options);
1910
+ return parser.parseInline(tokens);
1911
+ }
1912
+ /**
1913
+ * Parse Loop
1914
+ */
1915
+ parse(tokens, top = true) {
1916
+ let out = '';
1917
+ for (let i = 0; i < tokens.length; i++) {
1918
+ const anyToken = tokens[i];
1919
+ // Run any renderer extensions
1920
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
1921
+ const genericToken = anyToken;
1922
+ const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
1923
+ if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(genericToken.type)) {
1924
+ out += ret || '';
1925
+ continue;
1926
+ }
1927
+ }
1928
+ const token = anyToken;
1929
+ switch (token.type) {
1930
+ case 'space': {
1931
+ out += this.renderer.space(token);
1932
+ continue;
1933
+ }
1934
+ case 'hr': {
1935
+ out += this.renderer.hr(token);
1936
+ continue;
1937
+ }
1938
+ case 'heading': {
1939
+ out += this.renderer.heading(token);
1940
+ continue;
1941
+ }
1942
+ case 'code': {
1943
+ out += this.renderer.code(token);
1944
+ continue;
1945
+ }
1946
+ case 'table': {
1947
+ out += this.renderer.table(token);
1948
+ continue;
1949
+ }
1950
+ case 'blockquote': {
1951
+ out += this.renderer.blockquote(token);
1952
+ continue;
1953
+ }
1954
+ case 'list': {
1955
+ out += this.renderer.list(token);
1956
+ continue;
1957
+ }
1958
+ case 'html': {
1959
+ out += this.renderer.html(token);
1960
+ continue;
1961
+ }
1962
+ case 'paragraph': {
1963
+ out += this.renderer.paragraph(token);
1964
+ continue;
1965
+ }
1966
+ case 'text': {
1967
+ let textToken = token;
1968
+ let body = this.renderer.text(textToken);
1969
+ while (i + 1 < tokens.length && tokens[i + 1].type === 'text') {
1970
+ textToken = tokens[++i];
1971
+ body += '\n' + this.renderer.text(textToken);
1972
+ }
1973
+ if (top) {
1974
+ out += this.renderer.paragraph({
1975
+ type: 'paragraph',
1976
+ raw: body,
1977
+ text: body,
1978
+ tokens: [{ type: 'text', raw: body, text: body }],
1979
+ });
1980
+ }
1981
+ else {
1982
+ out += body;
1983
+ }
1984
+ continue;
1985
+ }
1986
+ default: {
1987
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
1988
+ if (this.options.silent) {
1989
+ console.error(errMsg);
1990
+ return '';
1991
+ }
1992
+ else {
1993
+ throw new Error(errMsg);
1994
+ }
1995
+ }
1996
+ }
1997
+ }
1998
+ return out;
1999
+ }
2000
+ /**
2001
+ * Parse Inline Tokens
2002
+ */
2003
+ parseInline(tokens, renderer) {
2004
+ renderer = renderer || this.renderer;
2005
+ let out = '';
2006
+ for (let i = 0; i < tokens.length; i++) {
2007
+ const anyToken = tokens[i];
2008
+ // Run any renderer extensions
2009
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
2010
+ const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
2011
+ if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(anyToken.type)) {
2012
+ out += ret || '';
2013
+ continue;
2014
+ }
2015
+ }
2016
+ const token = anyToken;
2017
+ switch (token.type) {
2018
+ case 'escape': {
2019
+ out += renderer.text(token);
2020
+ break;
2021
+ }
2022
+ case 'html': {
2023
+ out += renderer.html(token);
2024
+ break;
2025
+ }
2026
+ case 'link': {
2027
+ out += renderer.link(token);
2028
+ break;
2029
+ }
2030
+ case 'image': {
2031
+ out += renderer.image(token);
2032
+ break;
2033
+ }
2034
+ case 'strong': {
2035
+ out += renderer.strong(token);
2036
+ break;
2037
+ }
2038
+ case 'em': {
2039
+ out += renderer.em(token);
2040
+ break;
2041
+ }
2042
+ case 'codespan': {
2043
+ out += renderer.codespan(token);
2044
+ break;
2045
+ }
2046
+ case 'br': {
2047
+ out += renderer.br(token);
2048
+ break;
2049
+ }
2050
+ case 'del': {
2051
+ out += renderer.del(token);
2052
+ break;
2053
+ }
2054
+ case 'text': {
2055
+ out += renderer.text(token);
2056
+ break;
2057
+ }
2058
+ default: {
2059
+ const errMsg = 'Token with "' + token.type + '" type was not found.';
2060
+ if (this.options.silent) {
2061
+ console.error(errMsg);
2062
+ return '';
2063
+ }
2064
+ else {
2065
+ throw new Error(errMsg);
2066
+ }
2067
+ }
2068
+ }
2069
+ }
2070
+ return out;
2071
+ }
2072
+ }
2073
+
2074
+ class _Hooks {
2075
+ options;
2076
+ constructor(options) {
2077
+ this.options = options || _defaults;
2078
+ }
2079
+ static passThroughHooks = new Set([
2080
+ 'preprocess',
2081
+ 'postprocess',
2082
+ 'processAllTokens',
2083
+ ]);
2084
+ /**
2085
+ * Process markdown before marked
2086
+ */
2087
+ preprocess(markdown) {
2088
+ return markdown;
2089
+ }
2090
+ /**
2091
+ * Process HTML after marked is finished
2092
+ */
2093
+ postprocess(html) {
2094
+ return html;
2095
+ }
2096
+ /**
2097
+ * Process all tokens before walk tokens
2098
+ */
2099
+ processAllTokens(tokens) {
2100
+ return tokens;
2101
+ }
2102
+ }
2103
+
2104
+ class Marked {
2105
+ defaults = _getDefaults();
2106
+ options = this.setOptions;
2107
+ parse = this.parseMarkdown(_Lexer.lex, _Parser.parse);
2108
+ parseInline = this.parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
2109
+ Parser = _Parser;
2110
+ Renderer = _Renderer;
2111
+ TextRenderer = _TextRenderer;
2112
+ Lexer = _Lexer;
2113
+ Tokenizer = _Tokenizer;
2114
+ Hooks = _Hooks;
2115
+ constructor(...args) {
2116
+ this.use(...args);
2117
+ }
2118
+ /**
2119
+ * Run callback for every token
2120
+ */
2121
+ walkTokens(tokens, callback) {
2122
+ let values = [];
2123
+ for (const token of tokens) {
2124
+ values = values.concat(callback.call(this, token));
2125
+ switch (token.type) {
2126
+ case 'table': {
2127
+ const tableToken = token;
2128
+ for (const cell of tableToken.header) {
2129
+ values = values.concat(this.walkTokens(cell.tokens, callback));
2130
+ }
2131
+ for (const row of tableToken.rows) {
2132
+ for (const cell of row) {
2133
+ values = values.concat(this.walkTokens(cell.tokens, callback));
2134
+ }
2135
+ }
2136
+ break;
2137
+ }
2138
+ case 'list': {
2139
+ const listToken = token;
2140
+ values = values.concat(this.walkTokens(listToken.items, callback));
2141
+ break;
2142
+ }
2143
+ default: {
2144
+ const genericToken = token;
2145
+ if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
2146
+ this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
2147
+ const tokens = genericToken[childTokens].flat(Infinity);
2148
+ values = values.concat(this.walkTokens(tokens, callback));
2149
+ });
2150
+ }
2151
+ else if (genericToken.tokens) {
2152
+ values = values.concat(this.walkTokens(genericToken.tokens, callback));
2153
+ }
2154
+ }
2155
+ }
2156
+ }
2157
+ return values;
2158
+ }
2159
+ use(...args) {
2160
+ const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
2161
+ args.forEach((pack) => {
2162
+ // copy options to new object
2163
+ const opts = { ...pack };
2164
+ // set async to true if it was set to true before
2165
+ opts.async = this.defaults.async || opts.async || false;
2166
+ // ==-- Parse "addon" extensions --== //
2167
+ if (pack.extensions) {
2168
+ pack.extensions.forEach((ext) => {
2169
+ if (!ext.name) {
2170
+ throw new Error('extension name required');
2171
+ }
2172
+ if ('renderer' in ext) { // Renderer extensions
2173
+ const prevRenderer = extensions.renderers[ext.name];
2174
+ if (prevRenderer) {
2175
+ // Replace extension with func to run new extension but fall back if false
2176
+ extensions.renderers[ext.name] = function (...args) {
2177
+ let ret = ext.renderer.apply(this, args);
2178
+ if (ret === false) {
2179
+ ret = prevRenderer.apply(this, args);
2180
+ }
2181
+ return ret;
2182
+ };
2183
+ }
2184
+ else {
2185
+ extensions.renderers[ext.name] = ext.renderer;
2186
+ }
2187
+ }
2188
+ if ('tokenizer' in ext) { // Tokenizer Extensions
2189
+ if (!ext.level || (ext.level !== 'block' && ext.level !== 'inline')) {
2190
+ throw new Error("extension level must be 'block' or 'inline'");
2191
+ }
2192
+ const extLevel = extensions[ext.level];
2193
+ if (extLevel) {
2194
+ extLevel.unshift(ext.tokenizer);
2195
+ }
2196
+ else {
2197
+ extensions[ext.level] = [ext.tokenizer];
2198
+ }
2199
+ if (ext.start) { // Function to check for start of token
2200
+ if (ext.level === 'block') {
2201
+ if (extensions.startBlock) {
2202
+ extensions.startBlock.push(ext.start);
2203
+ }
2204
+ else {
2205
+ extensions.startBlock = [ext.start];
2206
+ }
2207
+ }
2208
+ else if (ext.level === 'inline') {
2209
+ if (extensions.startInline) {
2210
+ extensions.startInline.push(ext.start);
2211
+ }
2212
+ else {
2213
+ extensions.startInline = [ext.start];
2214
+ }
2215
+ }
2216
+ }
2217
+ }
2218
+ if ('childTokens' in ext && ext.childTokens) { // Child tokens to be visited by walkTokens
2219
+ extensions.childTokens[ext.name] = ext.childTokens;
2220
+ }
2221
+ });
2222
+ opts.extensions = extensions;
2223
+ }
2224
+ // ==-- Parse "overwrite" extensions --== //
2225
+ if (pack.renderer) {
2226
+ const renderer = this.defaults.renderer || new _Renderer(this.defaults);
2227
+ for (const prop in pack.renderer) {
2228
+ if (!(prop in renderer)) {
2229
+ throw new Error(`renderer '${prop}' does not exist`);
2230
+ }
2231
+ if (['options', 'parser'].includes(prop)) {
2232
+ // ignore options property
2233
+ continue;
2234
+ }
2235
+ const rendererProp = prop;
2236
+ const rendererFunc = pack.renderer[rendererProp];
2237
+ const prevRenderer = renderer[rendererProp];
2238
+ // Replace renderer with func to run extension, but fall back if false
2239
+ renderer[rendererProp] = (...args) => {
2240
+ let ret = rendererFunc.apply(renderer, args);
2241
+ if (ret === false) {
2242
+ ret = prevRenderer.apply(renderer, args);
2243
+ }
2244
+ return ret || '';
2245
+ };
2246
+ }
2247
+ opts.renderer = renderer;
2248
+ }
2249
+ if (pack.tokenizer) {
2250
+ const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
2251
+ for (const prop in pack.tokenizer) {
2252
+ if (!(prop in tokenizer)) {
2253
+ throw new Error(`tokenizer '${prop}' does not exist`);
2254
+ }
2255
+ if (['options', 'rules', 'lexer'].includes(prop)) {
2256
+ // ignore options, rules, and lexer properties
2257
+ continue;
2258
+ }
2259
+ const tokenizerProp = prop;
2260
+ const tokenizerFunc = pack.tokenizer[tokenizerProp];
2261
+ const prevTokenizer = tokenizer[tokenizerProp];
2262
+ // Replace tokenizer with func to run extension, but fall back if false
2263
+ // @ts-expect-error cannot type tokenizer function dynamically
2264
+ tokenizer[tokenizerProp] = (...args) => {
2265
+ let ret = tokenizerFunc.apply(tokenizer, args);
2266
+ if (ret === false) {
2267
+ ret = prevTokenizer.apply(tokenizer, args);
2268
+ }
2269
+ return ret;
2270
+ };
2271
+ }
2272
+ opts.tokenizer = tokenizer;
2273
+ }
2274
+ // ==-- Parse Hooks extensions --== //
2275
+ if (pack.hooks) {
2276
+ const hooks = this.defaults.hooks || new _Hooks();
2277
+ for (const prop in pack.hooks) {
2278
+ if (!(prop in hooks)) {
2279
+ throw new Error(`hook '${prop}' does not exist`);
2280
+ }
2281
+ if (prop === 'options') {
2282
+ // ignore options property
2283
+ continue;
2284
+ }
2285
+ const hooksProp = prop;
2286
+ const hooksFunc = pack.hooks[hooksProp];
2287
+ const prevHook = hooks[hooksProp];
2288
+ if (_Hooks.passThroughHooks.has(prop)) {
2289
+ // @ts-expect-error cannot type hook function dynamically
2290
+ hooks[hooksProp] = (arg) => {
2291
+ if (this.defaults.async) {
2292
+ return Promise.resolve(hooksFunc.call(hooks, arg)).then(ret => {
2293
+ return prevHook.call(hooks, ret);
2294
+ });
2295
+ }
2296
+ const ret = hooksFunc.call(hooks, arg);
2297
+ return prevHook.call(hooks, ret);
2298
+ };
2299
+ }
2300
+ else {
2301
+ // @ts-expect-error cannot type hook function dynamically
2302
+ hooks[hooksProp] = (...args) => {
2303
+ let ret = hooksFunc.apply(hooks, args);
2304
+ if (ret === false) {
2305
+ ret = prevHook.apply(hooks, args);
2306
+ }
2307
+ return ret;
2308
+ };
2309
+ }
2310
+ }
2311
+ opts.hooks = hooks;
2312
+ }
2313
+ // ==-- Parse WalkTokens extensions --== //
2314
+ if (pack.walkTokens) {
2315
+ const walkTokens = this.defaults.walkTokens;
2316
+ const packWalktokens = pack.walkTokens;
2317
+ opts.walkTokens = function (token) {
2318
+ let values = [];
2319
+ values.push(packWalktokens.call(this, token));
2320
+ if (walkTokens) {
2321
+ values = values.concat(walkTokens.call(this, token));
2322
+ }
2323
+ return values;
2324
+ };
2325
+ }
2326
+ this.defaults = { ...this.defaults, ...opts };
2327
+ });
2328
+ return this;
2329
+ }
2330
+ setOptions(opt) {
2331
+ this.defaults = { ...this.defaults, ...opt };
2332
+ return this;
2333
+ }
2334
+ lexer(src, options) {
2335
+ return _Lexer.lex(src, options ?? this.defaults);
2336
+ }
2337
+ parser(tokens, options) {
2338
+ return _Parser.parse(tokens, options ?? this.defaults);
2339
+ }
2340
+ parseMarkdown(lexer, parser) {
2341
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2342
+ const parse = (src, options) => {
2343
+ const origOpt = { ...options };
2344
+ const opt = { ...this.defaults, ...origOpt };
2345
+ const throwError = this.onError(!!opt.silent, !!opt.async);
2346
+ // throw error if an extension set async to true but parse was called with async: false
2347
+ if (this.defaults.async === true && origOpt.async === false) {
2348
+ return throwError(new Error('marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.'));
2349
+ }
2350
+ // throw error in case of non string input
2351
+ if (typeof src === 'undefined' || src === null) {
2352
+ return throwError(new Error('marked(): input parameter is undefined or null'));
2353
+ }
2354
+ if (typeof src !== 'string') {
2355
+ return throwError(new Error('marked(): input parameter is of type '
2356
+ + Object.prototype.toString.call(src) + ', string expected'));
2357
+ }
2358
+ if (opt.hooks) {
2359
+ opt.hooks.options = opt;
2360
+ }
2361
+ if (opt.async) {
2362
+ return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src)
2363
+ .then(src => lexer(src, opt))
2364
+ .then(tokens => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens)
2365
+ .then(tokens => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens)
2366
+ .then(tokens => parser(tokens, opt))
2367
+ .then(html => opt.hooks ? opt.hooks.postprocess(html) : html)
2368
+ .catch(throwError);
2369
+ }
2370
+ try {
2371
+ if (opt.hooks) {
2372
+ src = opt.hooks.preprocess(src);
2373
+ }
2374
+ let tokens = lexer(src, opt);
2375
+ if (opt.hooks) {
2376
+ tokens = opt.hooks.processAllTokens(tokens);
2377
+ }
2378
+ if (opt.walkTokens) {
2379
+ this.walkTokens(tokens, opt.walkTokens);
2380
+ }
2381
+ let html = parser(tokens, opt);
2382
+ if (opt.hooks) {
2383
+ html = opt.hooks.postprocess(html);
2384
+ }
2385
+ return html;
2386
+ }
2387
+ catch (e) {
2388
+ return throwError(e);
2389
+ }
2390
+ };
2391
+ return parse;
2392
+ }
2393
+ onError(silent, async) {
2394
+ return (e) => {
2395
+ e.message += '\nPlease report this to https://github.com/markedjs/marked.';
2396
+ if (silent) {
2397
+ const msg = '<p>An error occurred:</p><pre>'
2398
+ + escape$1(e.message + '', true)
2399
+ + '</pre>';
2400
+ if (async) {
2401
+ return Promise.resolve(msg);
2402
+ }
2403
+ return msg;
2404
+ }
2405
+ if (async) {
2406
+ return Promise.reject(e);
2407
+ }
2408
+ throw e;
2409
+ };
2410
+ }
2411
+ }
2412
+
2413
+ const markedInstance = new Marked();
2414
+ function marked(src, opt) {
2415
+ return markedInstance.parse(src, opt);
2416
+ }
2417
+ /**
2418
+ * Sets the default options.
2419
+ *
2420
+ * @param options Hash of options
2421
+ */
2422
+ marked.options =
2423
+ marked.setOptions = function (options) {
2424
+ markedInstance.setOptions(options);
2425
+ marked.defaults = markedInstance.defaults;
2426
+ changeDefaults(marked.defaults);
2427
+ return marked;
2428
+ };
2429
+ /**
2430
+ * Gets the original marked default options.
2431
+ */
2432
+ marked.getDefaults = _getDefaults;
2433
+ marked.defaults = _defaults;
2434
+ /**
2435
+ * Use Extension
2436
+ */
2437
+ marked.use = function (...args) {
2438
+ markedInstance.use(...args);
2439
+ marked.defaults = markedInstance.defaults;
2440
+ changeDefaults(marked.defaults);
2441
+ return marked;
2442
+ };
2443
+ /**
2444
+ * Run callback for every token
2445
+ */
2446
+ marked.walkTokens = function (tokens, callback) {
2447
+ return markedInstance.walkTokens(tokens, callback);
2448
+ };
2449
+ /**
2450
+ * Compiles markdown to HTML without enclosing `p` tag.
2451
+ *
2452
+ * @param src String of markdown source to be compiled
2453
+ * @param options Hash of options
2454
+ * @return String of compiled HTML
2455
+ */
2456
+ marked.parseInline = markedInstance.parseInline;
2457
+ /**
2458
+ * Expose
2459
+ */
2460
+ marked.Parser = _Parser;
2461
+ marked.parser = _Parser.parse;
2462
+ marked.Renderer = _Renderer;
2463
+ marked.TextRenderer = _TextRenderer;
2464
+ marked.Lexer = _Lexer;
2465
+ marked.lexer = _Lexer.lex;
2466
+ marked.Tokenizer = _Tokenizer;
2467
+ marked.Hooks = _Hooks;
2468
+ marked.parse = marked;
2469
+ marked.options;
2470
+ marked.setOptions;
2471
+ marked.use;
2472
+ marked.walkTokens;
2473
+ marked.parseInline;
2474
+ const parse = marked;
2475
+ _Parser.parse;
2476
+ const lexer = _Lexer.lex;
2477
+
2478
+ export { _Hooks as Hooks, _Lexer as Lexer, Marked, _Parser as Parser, _Renderer as Renderer, _TextRenderer as TextRenderer, _Tokenizer as Tokenizer, _defaults as defaults, _getDefaults as getDefaults, lexer, marked, parse };