chrome-devtools-mcp 1.10.1 → 1.12.0
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.
- package/README.md +72 -20
- package/build/src/BrowserManager.js +155 -27
- package/build/src/McpContext.js +598 -200
- package/build/src/McpPage.js +513 -131
- package/build/src/McpResponse.js +291 -116
- package/build/src/McpWorker.js +66 -0
- package/build/src/SlimMcpResponse.js +5 -1
- package/build/src/TextSnapshot.js +40 -20
- package/build/src/ToolHandler.js +306 -147
- package/build/src/bin/chrome-devtools-mcp-main.js +13 -10
- package/build/src/bin/chrome-devtools-mcp.js +1 -1
- package/build/src/bin/chrome-devtools.js +34 -44
- package/build/src/collectors/PageCollector.js +13 -9
- package/build/src/collectors/ServiceWorkerCollector.js +20 -13
- package/build/src/collectors/constants.js +7 -0
- package/build/src/config/ConfigLocator.js +70 -0
- package/build/src/config/ConfigParser.js +159 -0
- package/build/src/config/ConfigWatcher.js +94 -0
- package/build/src/config/ServerConfig.js +251 -0
- package/build/src/config/browser-options.js +15 -17
- package/build/src/config/category-options.js +15 -30
- package/build/src/config/cli-commands.js +165 -5
- package/build/src/config/cli-options.js +441 -58
- package/build/src/config/mcp-options.js +212 -264
- package/build/src/config/puppeteer-options.js +67 -0
- package/build/src/config/tool-options.js +60 -0
- package/build/src/daemon/client.js +84 -44
- package/build/src/daemon/daemon.js +59 -45
- package/build/src/daemon/utils.js +46 -12
- package/build/src/devtools/DevToolsCommentBridge.js +71 -11
- package/build/src/devtools/DevtoolsUtils.js +52 -15
- package/build/src/devtools/McpHostBindingAdapter.js +0 -1
- package/build/src/formatters/CommentFormatter.js +4 -13
- package/build/src/formatters/ConsoleFormatter.js +29 -2
- package/build/src/formatters/CssFormatter.js +3 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +111 -57
- package/build/src/formatters/IssueFormatter.js +33 -32
- package/build/src/formatters/NetworkFormatter.js +62 -22
- package/build/src/formatters/RemoteObjectFormatter.js +231 -0
- package/build/src/formatters/SnapshotFormatter.js +44 -7
- package/build/src/index.js +285 -88
- package/build/src/processors/ChunkedTraceParser.js +11 -11
- package/build/src/processors/HeapSnapshotManager.js +455 -156
- package/build/src/processors/PerformanceTrace.js +9 -9
- package/build/src/telemetry/ClearcutLogger.js +1 -1
- package/build/src/telemetry/transformation.js +7 -11
- package/build/src/telemetry/watchdog/main.js +1 -1
- package/build/src/third_party/THIRD_PARTY_NOTICES +399 -689
- package/build/src/third_party/bundled-packages.json +7 -8
- package/build/src/third_party/cli.js +9239 -0
- package/build/src/third_party/devtools-formatter-worker.js +4299 -2517
- package/build/src/third_party/devtools-heap-snapshot-worker.js +1298 -22
- package/build/src/third_party/index.js +132003 -146852
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -1
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -1
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/build/src/third_party/issue-descriptions/deprecation.md +1 -1
- package/build/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +2 -0
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +54576 -52174
- package/build/src/tools/ToolDefinition.js +102 -12
- package/build/src/tools/comments.js +62 -4
- package/build/src/tools/console.js +6 -4
- package/build/src/tools/css.js +5 -2
- package/build/src/tools/emulation.js +22 -8
- package/build/src/tools/extensions.js +5 -0
- package/build/src/tools/input.js +29 -9
- package/build/src/tools/lighthouse.js +136 -12
- package/build/src/tools/memory.js +166 -59
- package/build/src/tools/network.js +5 -4
- package/build/src/tools/pages.js +52 -7
- package/build/src/tools/performance.js +28 -7
- package/build/src/tools/pwa.js +7 -0
- package/build/src/tools/screencast.js +74 -33
- package/build/src/tools/screenshot.js +52 -21
- package/build/src/tools/script.js +125 -40
- package/build/src/tools/slim/tools.js +27 -13
- package/build/src/tools/snapshot.js +13 -3
- package/build/src/tools/thirdPartyDeveloper.js +9 -5
- package/build/src/tools/tools.js +35 -22
- package/build/src/tools/webmcp.js +11 -6
- package/build/src/types.js +11 -0
- package/build/src/utils/TaskRunner.js +136 -0
- package/build/src/utils/WaitForHelper.js +15 -2
- package/build/src/utils/bytes.js +2 -12
- package/build/src/utils/check-for-updates.js +2 -2
- package/build/src/utils/disclaimers.js +27 -0
- package/build/src/utils/errorHandling.js +20 -0
- package/build/src/utils/keyboard.js +14 -2
- package/build/src/utils/logger.js +84 -5
- package/build/src/utils/resourceType.js +27 -0
- package/build/src/utils/text.js +44 -0
- package/build/src/utils/timeout.js +14 -0
- package/build/src/utils/url.js +140 -3
- package/build/src/version.js +1 -1
- package/package.json +16 -11
- package/skills/a11y-debugging/SKILL.md +7 -12
- package/skills/chrome-devtools/SKILL.md +2 -2
- package/skills/chrome-devtools-cli/SKILL.md +18 -15
- package/skills/cookie-debugging/SKILL.md +8 -5
- package/skills/debug-optimize-lcp/SKILL.md +1 -1
- package/skills/troubleshooting/SKILL.md +5 -6
|
@@ -60,6 +60,11 @@ function lowerBound(array, needle, comparator, left, right) {
|
|
|
60
60
|
}
|
|
61
61
|
return r;
|
|
62
62
|
}
|
|
63
|
+
var NearestSearchStart;
|
|
64
|
+
(function (NearestSearchStart) {
|
|
65
|
+
NearestSearchStart["BEGINNING"] = "BEGINNING";
|
|
66
|
+
NearestSearchStart["END"] = "END";
|
|
67
|
+
})(NearestSearchStart || (NearestSearchStart = {}));
|
|
63
68
|
function arrayDoesNotContainNullOrUndefined(arr) {
|
|
64
69
|
return !arr.includes(null) && !arr.includes(undefined);
|
|
65
70
|
}
|
|
@@ -143,14 +148,14 @@ async function saveScreenshot(options) {
|
|
|
143
148
|
const screenRectHeight = options.clip.screenRectHeight * scale;
|
|
144
149
|
const contentLeft = options.clip.visiblePageRectLeft * scale;
|
|
145
150
|
const contentTop = options.clip.visiblePageRectTop * scale;
|
|
146
|
-
canvas = new OffscreenCanvas(Math.
|
|
147
|
-
Math.min(1 << 14, Math.
|
|
151
|
+
canvas = new OffscreenCanvas(Math.round(screenRectWidth),
|
|
152
|
+
Math.min(1 << 14, Math.round(screenRectHeight)));
|
|
148
153
|
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
149
154
|
if (!ctx) {
|
|
150
155
|
throw new Error('Could not get 2d context from canvas.');
|
|
151
156
|
}
|
|
152
157
|
ctx.imageSmoothingEnabled = false;
|
|
153
|
-
ctx.drawImage(pageImage, Math.
|
|
158
|
+
ctx.drawImage(pageImage, Math.round(contentLeft), Math.round(contentTop));
|
|
154
159
|
}
|
|
155
160
|
else {
|
|
156
161
|
canvas = new OffscreenCanvas(pageImage.naturalWidth, Math.min(1 << 14, Math.floor(pageImage.naturalHeight)));
|
|
@@ -170,6 +175,13 @@ async function saveScreenshot(options) {
|
|
|
170
175
|
link.href = blobUrl;
|
|
171
176
|
link.click();
|
|
172
177
|
}
|
|
178
|
+
async function copyScreenshot(options) {
|
|
179
|
+
const response = await fetch('data:image/png;base64,' + options.base64Png);
|
|
180
|
+
const blob = await response.blob();
|
|
181
|
+
await navigator.clipboard.write([
|
|
182
|
+
new ClipboardItem({ 'image/png': blob }),
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
173
185
|
let cssEvaluationElement = null;
|
|
174
186
|
const HOST_RUNTIME$2 = {
|
|
175
187
|
createWorker(url) {
|
|
@@ -192,6 +204,7 @@ const HOST_RUNTIME$2 = {
|
|
|
192
204
|
return window.devicePixelRatio;
|
|
193
205
|
},
|
|
194
206
|
saveScreenshot,
|
|
207
|
+
copyScreenshot,
|
|
195
208
|
revokeLastScreenshotUrl,
|
|
196
209
|
async loadTextFile(url) {
|
|
197
210
|
const response = await fetch(url);
|
|
@@ -348,6 +361,7 @@ const HOST_RUNTIME$1 = {
|
|
|
348
361
|
return 1;
|
|
349
362
|
},
|
|
350
363
|
async saveScreenshot(_options) { },
|
|
364
|
+
async copyScreenshot(_options) { },
|
|
351
365
|
revokeLastScreenshotUrl() { },
|
|
352
366
|
async loadTextFile(url) {
|
|
353
367
|
return await Fs.promises.readFile(Url.fileURLToPath(url), 'utf-8');
|
|
@@ -384,6 +398,20 @@ const HOST_RUNTIME = await (async () => {
|
|
|
384
398
|
throw new Error('Unknown runtime!');
|
|
385
399
|
})();
|
|
386
400
|
|
|
401
|
+
// Copyright 2020 The Chromium Authors
|
|
402
|
+
var ArrowKey;
|
|
403
|
+
(function (ArrowKey) {
|
|
404
|
+
ArrowKey["UP"] = "ArrowUp";
|
|
405
|
+
ArrowKey["DOWN"] = "ArrowDown";
|
|
406
|
+
ArrowKey["LEFT"] = "ArrowLeft";
|
|
407
|
+
ArrowKey["RIGHT"] = "ArrowRight";
|
|
408
|
+
})(ArrowKey || (ArrowKey = {}));
|
|
409
|
+
var PageKey;
|
|
410
|
+
(function (PageKey) {
|
|
411
|
+
PageKey["UP"] = "PageUp";
|
|
412
|
+
PageKey["DOWN"] = "PageDown";
|
|
413
|
+
})(PageKey || (PageKey = {}));
|
|
414
|
+
|
|
387
415
|
// Copyright 2020 The Chromium Authors
|
|
388
416
|
class Multimap {
|
|
389
417
|
map = new Map();
|
|
@@ -443,6 +471,21 @@ class Multimap {
|
|
|
443
471
|
}
|
|
444
472
|
}
|
|
445
473
|
|
|
474
|
+
// Copyright 2023 The Chromium Authors
|
|
475
|
+
var MimeType;
|
|
476
|
+
(function (MimeType) {
|
|
477
|
+
MimeType["HTML"] = "text/html";
|
|
478
|
+
MimeType["XML"] = "text/xml";
|
|
479
|
+
MimeType["PLAIN"] = "text/plain";
|
|
480
|
+
MimeType["XHTML"] = "application/xhtml+xml";
|
|
481
|
+
MimeType["SVG"] = "image/svg+xml";
|
|
482
|
+
MimeType["CSS"] = "text/css";
|
|
483
|
+
MimeType["XSL"] = "text/xsl";
|
|
484
|
+
MimeType["VTT"] = "text/vtt";
|
|
485
|
+
MimeType["PDF"] = "application/pdf";
|
|
486
|
+
MimeType["EVENTSTREAM"] = "text/event-stream";
|
|
487
|
+
})(MimeType || (MimeType = {}));
|
|
488
|
+
|
|
446
489
|
// Copyright 2020 The Chromium Authors
|
|
447
490
|
const sprintf = (fmt, ...args) => {
|
|
448
491
|
let argIndex = 0;
|
|
@@ -874,6 +917,12 @@ class Location {
|
|
|
874
917
|
this.columnNumber = columnNumber;
|
|
875
918
|
}
|
|
876
919
|
}
|
|
920
|
+
var DOMLinkState;
|
|
921
|
+
(function (DOMLinkState) {
|
|
922
|
+
DOMLinkState[DOMLinkState["UNKNOWN"] = 0] = "UNKNOWN";
|
|
923
|
+
DOMLinkState[DOMLinkState["ATTACHED"] = 1] = "ATTACHED";
|
|
924
|
+
DOMLinkState[DOMLinkState["DETACHED"] = 2] = "DETACHED";
|
|
925
|
+
})(DOMLinkState || (DOMLinkState = {}));
|
|
877
926
|
|
|
878
927
|
var HeapSnapshotModel$1 = /*#__PURE__*/Object.freeze({
|
|
879
928
|
__proto__: null,
|
|
@@ -881,6 +930,7 @@ var HeapSnapshotModel$1 = /*#__PURE__*/Object.freeze({
|
|
|
881
930
|
AllocationNodeCallers: AllocationNodeCallers,
|
|
882
931
|
AllocationStackFrame: AllocationStackFrame,
|
|
883
932
|
ComparatorConfig: ComparatorConfig,
|
|
933
|
+
get DOMLinkState () { return DOMLinkState; },
|
|
884
934
|
Diff: Diff,
|
|
885
935
|
Edge: Edge,
|
|
886
936
|
HeapSnapshotProgressEvent: HeapSnapshotProgressEvent,
|
|
@@ -1358,6 +1408,22 @@ function getColorSpace(colorSpaceText) {
|
|
|
1358
1408
|
}
|
|
1359
1409
|
return null;
|
|
1360
1410
|
}
|
|
1411
|
+
var ColorChannel;
|
|
1412
|
+
(function (ColorChannel) {
|
|
1413
|
+
ColorChannel["A"] = "a";
|
|
1414
|
+
ColorChannel["ALPHA"] = "alpha";
|
|
1415
|
+
ColorChannel["B"] = "b";
|
|
1416
|
+
ColorChannel["C"] = "c";
|
|
1417
|
+
ColorChannel["G"] = "g";
|
|
1418
|
+
ColorChannel["H"] = "h";
|
|
1419
|
+
ColorChannel["L"] = "l";
|
|
1420
|
+
ColorChannel["R"] = "r";
|
|
1421
|
+
ColorChannel["S"] = "s";
|
|
1422
|
+
ColorChannel["W"] = "w";
|
|
1423
|
+
ColorChannel["X"] = "x";
|
|
1424
|
+
ColorChannel["Y"] = "y";
|
|
1425
|
+
ColorChannel["Z"] = "z";
|
|
1426
|
+
})(ColorChannel || (ColorChannel = {}));
|
|
1361
1427
|
function mapPercentToRange(percent, range) {
|
|
1362
1428
|
const sign = Math.sign(percent);
|
|
1363
1429
|
const absPercent = Math.abs(percent);
|
|
@@ -1537,6 +1603,31 @@ function equals(a, b, accuracy = EPSILON) {
|
|
|
1537
1603
|
function lessOrEquals(a, b, accuracy = EPSILON) {
|
|
1538
1604
|
return a - b <= accuracy;
|
|
1539
1605
|
}
|
|
1606
|
+
var Format;
|
|
1607
|
+
(function (Format) {
|
|
1608
|
+
Format["HEX"] = "hex";
|
|
1609
|
+
Format["HEXA"] = "hexa";
|
|
1610
|
+
Format["RGB"] = "rgb";
|
|
1611
|
+
Format["RGBA"] = "rgba";
|
|
1612
|
+
Format["HSL"] = "hsl";
|
|
1613
|
+
Format["HSLA"] = "hsla";
|
|
1614
|
+
Format["HWB"] = "hwb";
|
|
1615
|
+
Format["HWBA"] = "hwba";
|
|
1616
|
+
Format["LCH"] = "lch";
|
|
1617
|
+
Format["OKLCH"] = "oklch";
|
|
1618
|
+
Format["LAB"] = "lab";
|
|
1619
|
+
Format["OKLAB"] = "oklab";
|
|
1620
|
+
Format["SRGB"] = "srgb";
|
|
1621
|
+
Format["SRGB_LINEAR"] = "srgb-linear";
|
|
1622
|
+
Format["DISPLAY_P3"] = "display-p3";
|
|
1623
|
+
Format["DISPLAY_P3_LINEAR"] = "display-p3-linear";
|
|
1624
|
+
Format["A98_RGB"] = "a98-rgb";
|
|
1625
|
+
Format["PROPHOTO_RGB"] = "prophoto-rgb";
|
|
1626
|
+
Format["REC_2020"] = "rec2020";
|
|
1627
|
+
Format["XYZ"] = "xyz";
|
|
1628
|
+
Format["XYZ_D50"] = "xyz-d50";
|
|
1629
|
+
Format["XYZ_D65"] = "xyz-d65";
|
|
1630
|
+
})(Format || (Format = {}));
|
|
1540
1631
|
class Lab {
|
|
1541
1632
|
l;
|
|
1542
1633
|
a;
|
|
@@ -2952,6 +3043,12 @@ const LAYOUT_LINES_HIGHLIGHT_COLOR = [127, 32, 210];
|
|
|
2952
3043
|
GapBackground: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .3]),
|
|
2953
3044
|
GapHatch: Legacy.fromRGBA([...LAYOUT_LINES_HIGHLIGHT_COLOR, .8]),
|
|
2954
3045
|
GridAreaBorder: Legacy.fromRGBA([26, 115, 232, 1]),
|
|
3046
|
+
AnchorIMCB: Legacy.fromRGBA([127, 32, 210, 1]),
|
|
3047
|
+
AnchorIMCBBackground: Legacy.fromRGBA([127, 32, 210, 0.15]),
|
|
3048
|
+
AnchorInsetsBackground: Legacy.fromRGBA([246, 178, 107, 0.25]),
|
|
3049
|
+
AnchorInsetsHatch: Legacy.fromRGBA([246, 178, 107, 0.8]),
|
|
3050
|
+
AnchorTarget: Legacy.fromRGBA([26, 115, 232, 1]),
|
|
3051
|
+
AnchorTargetBackground: Legacy.fromRGBA([26, 115, 232, 0.15]),
|
|
2955
3052
|
});
|
|
2956
3053
|
({
|
|
2957
3054
|
ParentOutline: Legacy.fromRGBA([224, 90, 183, 1]),
|
|
@@ -2972,6 +3069,7 @@ var ExperimentName;
|
|
|
2972
3069
|
ExperimentName["DURABLE_MESSAGES"] = "durable-messages";
|
|
2973
3070
|
ExperimentName["JPEG_XL"] = "jpeg-xl";
|
|
2974
3071
|
ExperimentName["PLUS_BUTTON"] = "plus-button";
|
|
3072
|
+
ExperimentName["SOURCE_MAP_SCOPES_IN_SOURCES_PANEL"] = "source-map-scopes-in-sources-panel";
|
|
2975
3073
|
})(ExperimentName || (ExperimentName = {}));
|
|
2976
3074
|
|
|
2977
3075
|
// Copyright 2021 The Chromium Authors
|
|
@@ -4958,6 +5056,16 @@ const i18nLazyString$1 = getLazilyComputedLocalizedString.bind(undefined, str_$2
|
|
|
4958
5056
|
});
|
|
4959
5057
|
|
|
4960
5058
|
// Copyright 2014 The Chromium Authors
|
|
5059
|
+
var Events$1;
|
|
5060
|
+
(function (Events) {
|
|
5061
|
+
Events["MESSAGE_ADDED"] = "messageAdded";
|
|
5062
|
+
})(Events$1 || (Events$1 = {}));
|
|
5063
|
+
var MessageLevel;
|
|
5064
|
+
(function (MessageLevel) {
|
|
5065
|
+
MessageLevel["INFO"] = "info";
|
|
5066
|
+
MessageLevel["WARNING"] = "warning";
|
|
5067
|
+
MessageLevel["ERROR"] = "error";
|
|
5068
|
+
})(MessageLevel || (MessageLevel = {}));
|
|
4961
5069
|
var FrontendMessageSource;
|
|
4962
5070
|
(function (FrontendMessageSource) {
|
|
4963
5071
|
FrontendMessageSource["CSS"] = "css";
|
|
@@ -5098,7 +5206,11 @@ class ParsedURL {
|
|
|
5098
5206
|
preEncodedPath = 'file:///' + preEncodedPath;
|
|
5099
5207
|
}
|
|
5100
5208
|
}
|
|
5101
|
-
|
|
5209
|
+
let url = new URL(preEncodedPath).toString();
|
|
5210
|
+
while (url.endsWith('/') && url.length > 'file:///'.length) {
|
|
5211
|
+
url = url.substring(0, url.length - 1);
|
|
5212
|
+
}
|
|
5213
|
+
return url;
|
|
5102
5214
|
}
|
|
5103
5215
|
static relativePathToUrlString(relativePath, baseURL) {
|
|
5104
5216
|
const preEncodedPath = ParsedURL.preEncodeSpecialCharactersInPath(relativePath.replace(/\\/g, '/'));
|
|
@@ -5158,7 +5270,7 @@ class ParsedURL {
|
|
|
5158
5270
|
}
|
|
5159
5271
|
const schemeRegex = /([A-Za-z][A-Za-z0-9+.-]*):\/\//;
|
|
5160
5272
|
const userRegex = /(?:([A-Za-z0-9\-._~%!$&'()*+,;=:]*)@)?/;
|
|
5161
|
-
const hostRegex = /((?:\[
|
|
5273
|
+
const hostRegex = /((?:\[[0-9a-fA-F:.]*:[0-9a-fA-F:.]*\])|(?:[^\s\/:]*))/;
|
|
5162
5274
|
const portRegex = /(?::([\d]+))?/;
|
|
5163
5275
|
const pathRegex = /(\/[^#?]*)?/;
|
|
5164
5276
|
const queryRegex = /(?:\?([^#]*))?/;
|
|
@@ -5772,6 +5884,65 @@ const UIStrings = {
|
|
|
5772
5884
|
};
|
|
5773
5885
|
const str_ = registerUIStrings('core/common/SettingRegistration.ts', UIStrings);
|
|
5774
5886
|
getLocalizedString.bind(undefined, str_);
|
|
5887
|
+
var SettingCategory;
|
|
5888
|
+
(function (SettingCategory) {
|
|
5889
|
+
SettingCategory["NONE"] = "";
|
|
5890
|
+
SettingCategory["ELEMENTS"] = "ELEMENTS";
|
|
5891
|
+
SettingCategory["AI"] = "AI";
|
|
5892
|
+
SettingCategory["APPEARANCE"] = "APPEARANCE";
|
|
5893
|
+
SettingCategory["SOURCES"] = "SOURCES";
|
|
5894
|
+
SettingCategory["NETWORK"] = "NETWORK";
|
|
5895
|
+
SettingCategory["PERFORMANCE"] = "PERFORMANCE";
|
|
5896
|
+
SettingCategory["CONSOLE"] = "CONSOLE";
|
|
5897
|
+
SettingCategory["PERSISTENCE"] = "PERSISTENCE";
|
|
5898
|
+
SettingCategory["DEBUGGER"] = "DEBUGGER";
|
|
5899
|
+
SettingCategory["GLOBAL"] = "GLOBAL";
|
|
5900
|
+
SettingCategory["RENDERING"] = "RENDERING";
|
|
5901
|
+
SettingCategory["GRID"] = "GRID";
|
|
5902
|
+
SettingCategory["MOBILE"] = "MOBILE";
|
|
5903
|
+
SettingCategory["EMULATION"] = "EMULATION";
|
|
5904
|
+
SettingCategory["MEMORY"] = "MEMORY";
|
|
5905
|
+
SettingCategory["EXTENSIONS"] = "EXTENSIONS";
|
|
5906
|
+
SettingCategory["ADORNER"] = "ADORNER";
|
|
5907
|
+
SettingCategory["ACCOUNT"] = "ACCOUNT";
|
|
5908
|
+
})(SettingCategory || (SettingCategory = {}));
|
|
5909
|
+
var SettingType;
|
|
5910
|
+
(function (SettingType) {
|
|
5911
|
+
SettingType["ARRAY"] = "array";
|
|
5912
|
+
SettingType["REGEX"] = "regex";
|
|
5913
|
+
SettingType["ENUM"] = "enum";
|
|
5914
|
+
SettingType["BOOLEAN"] = "boolean";
|
|
5915
|
+
})(SettingType || (SettingType = {}));
|
|
5916
|
+
|
|
5917
|
+
// Copyright 2009 The Chromium Authors
|
|
5918
|
+
var SettingAvailability;
|
|
5919
|
+
(function (SettingAvailability) {
|
|
5920
|
+
SettingAvailability[SettingAvailability["AVAILABLE"] = 1] = "AVAILABLE";
|
|
5921
|
+
SettingAvailability[SettingAvailability["UNAVAILABLE"] = 2] = "UNAVAILABLE";
|
|
5922
|
+
SettingAvailability[SettingAvailability["DISABLED"] = 3] = "DISABLED";
|
|
5923
|
+
})(SettingAvailability || (SettingAvailability = {}));
|
|
5924
|
+
var SettingStorageType;
|
|
5925
|
+
(function (SettingStorageType) {
|
|
5926
|
+
SettingStorageType["SYNCED"] = "Synced";
|
|
5927
|
+
SettingStorageType["GLOBAL"] = "Global";
|
|
5928
|
+
SettingStorageType["LOCAL"] = "Local";
|
|
5929
|
+
SettingStorageType["SESSION"] = "Session";
|
|
5930
|
+
})(SettingStorageType || (SettingStorageType = {}));
|
|
5931
|
+
|
|
5932
|
+
// Copyright 2026 The Chromium Authors
|
|
5933
|
+
var TokenType;
|
|
5934
|
+
(function (TokenType) {
|
|
5935
|
+
TokenType[TokenType["LITERAL"] = 0] = "LITERAL";
|
|
5936
|
+
TokenType[TokenType["URL"] = 1] = "URL";
|
|
5937
|
+
})(TokenType || (TokenType = {}));
|
|
5938
|
+
|
|
5939
|
+
// Copyright 2014 The Chromium Authors
|
|
5940
|
+
var Scheduling;
|
|
5941
|
+
(function (Scheduling) {
|
|
5942
|
+
Scheduling["DEFAULT"] = "Default";
|
|
5943
|
+
Scheduling["AS_SOON_AS_POSSIBLE"] = "AsSoonAsPossible";
|
|
5944
|
+
Scheduling["DELAYED"] = "Delayed";
|
|
5945
|
+
})(Scheduling || (Scheduling = {}));
|
|
5775
5946
|
|
|
5776
5947
|
// Copyright 2011 The Chromium Authors
|
|
5777
5948
|
class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
@@ -5930,6 +6101,11 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5930
6101
|
this.worker.postMessage(message, transfer);
|
|
5931
6102
|
}
|
|
5932
6103
|
}
|
|
6104
|
+
(function (HeapSnapshotWorkerProxy) {
|
|
6105
|
+
(function (Events) {
|
|
6106
|
+
Events["WAIT"] = "Wait";
|
|
6107
|
+
})(HeapSnapshotWorkerProxy.Events || (HeapSnapshotWorkerProxy.Events = {}));
|
|
6108
|
+
})(HeapSnapshotWorkerProxy || (HeapSnapshotWorkerProxy = {}));
|
|
5933
6109
|
class HeapSnapshotProxyObject {
|
|
5934
6110
|
worker;
|
|
5935
6111
|
objectId;
|
|
@@ -6153,7 +6329,7 @@ var HeapSnapshotProxy$1 = /*#__PURE__*/Object.freeze({
|
|
|
6153
6329
|
HeapSnapshotProviderProxy: HeapSnapshotProviderProxy,
|
|
6154
6330
|
HeapSnapshotProxy: HeapSnapshotProxy,
|
|
6155
6331
|
HeapSnapshotProxyObject: HeapSnapshotProxyObject,
|
|
6156
|
-
HeapSnapshotWorkerProxy
|
|
6332
|
+
get HeapSnapshotWorkerProxy () { return HeapSnapshotWorkerProxy; }
|
|
6157
6333
|
});
|
|
6158
6334
|
|
|
6159
6335
|
// Copyright 2019 The Chromium Authors
|
|
@@ -6421,7 +6597,7 @@ var AllocationProfile$1 = /*#__PURE__*/Object.freeze({
|
|
|
6421
6597
|
function analyzeContexts(snapshot) {
|
|
6422
6598
|
const scopesByScript = parseEmbeddedScopes(snapshot);
|
|
6423
6599
|
const scan = scanHeap(snapshot);
|
|
6424
|
-
const liveFunctionsByScript = buildLiveFunctions(snapshot, scan.liveClosures);
|
|
6600
|
+
const liveFunctionsByScript = buildLiveFunctions(snapshot, scan.liveClosures, scan.finishedModuleFunctionNodeIndexes);
|
|
6425
6601
|
const { scopes, scriptsWithoutScopes } = correlateContextsWithScopes(snapshot, scan, scopesByScript);
|
|
6426
6602
|
const scopeAnalyses = classifyFields(snapshot, scopes, liveFunctionsByScript);
|
|
6427
6603
|
return sortAndBuildResult(scopeAnalyses, scriptsWithoutScopes);
|
|
@@ -6518,6 +6694,8 @@ function scanHeap(snapshot) {
|
|
|
6518
6694
|
const scripts = new Map();
|
|
6519
6695
|
const contextNodes = [];
|
|
6520
6696
|
const liveClosures = [];
|
|
6697
|
+
const finishedModuleFunctionNodeIndexes = new Set();
|
|
6698
|
+
const generatorMapNodeIndexes = new Map();
|
|
6521
6699
|
const scopeInfoScriptNodeIndexes = new Map();
|
|
6522
6700
|
const node = snapshot.createNode();
|
|
6523
6701
|
const nodes = snapshot.nodes;
|
|
@@ -6528,6 +6706,7 @@ function scanHeap(snapshot) {
|
|
|
6528
6706
|
const rawName = node.rawName();
|
|
6529
6707
|
if (rawName.startsWith('system / Script')) {
|
|
6530
6708
|
processScript(scripts, node);
|
|
6709
|
+
processScriptScopeInfos(scopeInfoScriptNodeIndexes, node);
|
|
6531
6710
|
}
|
|
6532
6711
|
else if (snapshot.isContextObject(node)) {
|
|
6533
6712
|
processContext(contextNodes, node);
|
|
@@ -6535,11 +6714,11 @@ function scanHeap(snapshot) {
|
|
|
6535
6714
|
else if (node.rawType() === nodeClosureType) {
|
|
6536
6715
|
processClosure(liveClosures, node);
|
|
6537
6716
|
}
|
|
6538
|
-
else if (
|
|
6539
|
-
|
|
6717
|
+
else if (isGeneratorObject(generatorMapNodeIndexes, node)) {
|
|
6718
|
+
processGeneratorObject(liveClosures, finishedModuleFunctionNodeIndexes, node);
|
|
6540
6719
|
}
|
|
6541
6720
|
}
|
|
6542
|
-
return { scripts, contextNodes, liveClosures, scopeInfoScriptNodeIndexes };
|
|
6721
|
+
return { scripts, contextNodes, liveClosures, finishedModuleFunctionNodeIndexes, scopeInfoScriptNodeIndexes };
|
|
6543
6722
|
}
|
|
6544
6723
|
function processScript(scripts, node) {
|
|
6545
6724
|
const rawName = node.rawName();
|
|
@@ -6554,6 +6733,71 @@ function processScript(scripts, node) {
|
|
|
6554
6733
|
nodeId: node.id(),
|
|
6555
6734
|
});
|
|
6556
6735
|
}
|
|
6736
|
+
function processScriptScopeInfos(scopeInfoScriptNodeIndexes, scriptNode) {
|
|
6737
|
+
const infos = scriptNode.findInternalEdgeTarget('infos');
|
|
6738
|
+
if (!infos) {
|
|
6739
|
+
return;
|
|
6740
|
+
}
|
|
6741
|
+
const scriptNodeIndex = scriptNode.nodeIndex;
|
|
6742
|
+
const scopeInfoNode = scriptNode.snapshot.createNode();
|
|
6743
|
+
const evalFromScopeInfo = scriptNode.findInternalEdgeTarget('eval_from_scope_info');
|
|
6744
|
+
const stopAtNodeIndex = evalFromScopeInfo?.rawName() === 'system / ScopeInfo' ?
|
|
6745
|
+
evalFromScopeInfo.nodeIndex :
|
|
6746
|
+
undefined;
|
|
6747
|
+
for (let iter = infos.edges(); iter.hasNext(); iter.next()) {
|
|
6748
|
+
const info = iter.edge.node();
|
|
6749
|
+
const infoName = info.rawName();
|
|
6750
|
+
if (infoName === 'system / ScopeInfo') {
|
|
6751
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, info.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6752
|
+
continue;
|
|
6753
|
+
}
|
|
6754
|
+
if (!infoName.startsWith('system / SharedFunctionInfo')) {
|
|
6755
|
+
continue;
|
|
6756
|
+
}
|
|
6757
|
+
const sharedFunctionInfo = info;
|
|
6758
|
+
const scopeInfo = sharedFunctionInfo.findInternalEdgeTarget('name_or_scope_info');
|
|
6759
|
+
if (scopeInfo?.rawName() === 'system / ScopeInfo') {
|
|
6760
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, scopeInfo.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6761
|
+
continue;
|
|
6762
|
+
}
|
|
6763
|
+
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6764
|
+
if (scopeId === undefined || isScriptRootScopeId(scopeId)) {
|
|
6765
|
+
continue;
|
|
6766
|
+
}
|
|
6767
|
+
const outerScopeInfo = sharedFunctionInfo.findInternalEdgeTarget('raw_outer_scope_info_or_feedback_metadata');
|
|
6768
|
+
if (outerScopeInfo?.rawName() === 'system / ScopeInfo') {
|
|
6769
|
+
attributeScopeInfoChain(scopeInfoScriptNodeIndexes, outerScopeInfo.nodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode);
|
|
6770
|
+
}
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
function attributeScopeInfoChain(scopeInfoScriptNodeIndexes, scopeInfoNodeIndex, stopAtNodeIndex, scriptNodeIndex, scopeInfoNode) {
|
|
6774
|
+
let currentNodeIndex = scopeInfoNodeIndex;
|
|
6775
|
+
for (;;) {
|
|
6776
|
+
if (currentNodeIndex === stopAtNodeIndex) {
|
|
6777
|
+
return;
|
|
6778
|
+
}
|
|
6779
|
+
if (scopeInfoScriptNodeIndexes.has(currentNodeIndex)) {
|
|
6780
|
+
return;
|
|
6781
|
+
}
|
|
6782
|
+
scopeInfoScriptNodeIndexes.set(currentNodeIndex, scriptNodeIndex);
|
|
6783
|
+
scopeInfoNode.nodeIndex = currentNodeIndex;
|
|
6784
|
+
if (isScriptRootScopeInfo(scopeInfoNode)) {
|
|
6785
|
+
return;
|
|
6786
|
+
}
|
|
6787
|
+
const outerScopeInfo = scopeInfoNode.findInternalEdgeTarget('outer_scope_info');
|
|
6788
|
+
if (!outerScopeInfo) {
|
|
6789
|
+
return;
|
|
6790
|
+
}
|
|
6791
|
+
currentNodeIndex = outerScopeInfo.nodeIndex;
|
|
6792
|
+
}
|
|
6793
|
+
}
|
|
6794
|
+
function isScriptRootScopeInfo(node) {
|
|
6795
|
+
const scopeId = node.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6796
|
+
return scopeId !== undefined && isScriptRootScopeId(scopeId);
|
|
6797
|
+
}
|
|
6798
|
+
function isScriptRootScopeId(scopeId) {
|
|
6799
|
+
return scopeId === -2;
|
|
6800
|
+
}
|
|
6557
6801
|
function processContext(contextNodes, node) {
|
|
6558
6802
|
const scopeInfoNodeIndex = node.findInternalEdgeTarget('scope_info')?.nodeIndex;
|
|
6559
6803
|
if (scopeInfoNodeIndex === undefined) {
|
|
@@ -6571,6 +6815,9 @@ function processClosure(liveClosures, node) {
|
|
|
6571
6815
|
if (!sharedFunctionInfo || !closureContext) {
|
|
6572
6816
|
return;
|
|
6573
6817
|
}
|
|
6818
|
+
addLiveClosure(liveClosures, node, sharedFunctionInfo, closureContext);
|
|
6819
|
+
}
|
|
6820
|
+
function addLiveClosure(liveClosures, ownerNode, sharedFunctionInfo, contextNode) {
|
|
6574
6821
|
const script = sharedFunctionInfo.findInternalEdgeTarget('script');
|
|
6575
6822
|
if (!script) {
|
|
6576
6823
|
return;
|
|
@@ -6578,24 +6825,65 @@ function processClosure(liveClosures, node) {
|
|
|
6578
6825
|
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6579
6826
|
if (scopeId !== undefined) {
|
|
6580
6827
|
liveClosures.push({
|
|
6581
|
-
|
|
6828
|
+
ownerNodeIndex: ownerNode.nodeIndex,
|
|
6829
|
+
contextNodeIndex: contextNode.nodeIndex,
|
|
6582
6830
|
scriptNodeIndex: script.nodeIndex,
|
|
6583
6831
|
scopeId,
|
|
6584
6832
|
});
|
|
6585
6833
|
}
|
|
6586
6834
|
}
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
const
|
|
6590
|
-
|
|
6835
|
+
const GENERATOR_CLOSED = -1;
|
|
6836
|
+
function processGeneratorObject(liveClosures, finishedModuleFunctionNodeIndexes, node) {
|
|
6837
|
+
const continuation = node.findInternalEdgeTarget('continuation')?.nodeValueAsInt();
|
|
6838
|
+
const generatorFunction = node.findInternalEdgeTarget('function');
|
|
6839
|
+
if (continuation === undefined || generatorFunction?.rawType() !== node.snapshot.nodeClosureType) {
|
|
6840
|
+
return;
|
|
6841
|
+
}
|
|
6842
|
+
const sharedFunctionInfo = generatorFunction.findInternalEdgeTarget('shared');
|
|
6843
|
+
if (!sharedFunctionInfo) {
|
|
6844
|
+
return;
|
|
6845
|
+
}
|
|
6846
|
+
if (continuation === GENERATOR_CLOSED) {
|
|
6847
|
+
const scopeId = sharedFunctionInfo.findInternalEdgeTarget('scope_id')?.nodeValueAsInt();
|
|
6848
|
+
if (scopeId !== undefined && isScriptRootScopeId(scopeId)) {
|
|
6849
|
+
finishedModuleFunctionNodeIndexes.add(generatorFunction.nodeIndex);
|
|
6850
|
+
}
|
|
6591
6851
|
return;
|
|
6592
6852
|
}
|
|
6593
|
-
|
|
6853
|
+
const generatorContext = node.findInternalEdgeTarget('context');
|
|
6854
|
+
if (generatorContext) {
|
|
6855
|
+
addLiveClosure(liveClosures, node, sharedFunctionInfo, generatorContext);
|
|
6856
|
+
}
|
|
6857
|
+
}
|
|
6858
|
+
const GENERATOR_INSTANCE_TYPE_NAMES = new Set([
|
|
6859
|
+
'JS_GENERATOR_OBJECT_TYPE',
|
|
6860
|
+
'JS_ASYNC_FUNCTION_OBJECT_TYPE',
|
|
6861
|
+
'JS_ASYNC_GENERATOR_OBJECT_TYPE',
|
|
6862
|
+
]);
|
|
6863
|
+
function isGeneratorObject(generatorMapNodeIndexes, node) {
|
|
6864
|
+
if (node.rawType() !== node.snapshot.nodeObjectType) {
|
|
6865
|
+
return false;
|
|
6866
|
+
}
|
|
6867
|
+
const map = node.findInternalEdgeTarget('map');
|
|
6868
|
+
if (!map) {
|
|
6869
|
+
return false;
|
|
6870
|
+
}
|
|
6871
|
+
const mapNodeIndex = map.nodeIndex;
|
|
6872
|
+
let isGenerator = generatorMapNodeIndexes.get(mapNodeIndex);
|
|
6873
|
+
if (isGenerator === undefined) {
|
|
6874
|
+
const instanceTypeName = map.findInternalEdgeTarget('instance_type_name')?.rawName();
|
|
6875
|
+
isGenerator = instanceTypeName !== undefined && GENERATOR_INSTANCE_TYPE_NAMES.has(instanceTypeName);
|
|
6876
|
+
generatorMapNodeIndexes.set(mapNodeIndex, isGenerator);
|
|
6877
|
+
}
|
|
6878
|
+
return isGenerator;
|
|
6594
6879
|
}
|
|
6595
|
-
function buildLiveFunctions(snapshot, liveClosures) {
|
|
6880
|
+
function buildLiveFunctions(snapshot, liveClosures, finishedModuleFunctionNodeIndexes) {
|
|
6596
6881
|
const liveFunctionsByScript = new Map();
|
|
6597
6882
|
const node = snapshot.createNode();
|
|
6598
6883
|
for (const closure of liveClosures) {
|
|
6884
|
+
if (finishedModuleFunctionNodeIndexes.has(closure.ownerNodeIndex)) {
|
|
6885
|
+
continue;
|
|
6886
|
+
}
|
|
6599
6887
|
let scriptFunctions = liveFunctionsByScript.get(closure.scriptNodeIndex);
|
|
6600
6888
|
if (!scriptFunctions) {
|
|
6601
6889
|
scriptFunctions = new Map();
|
|
@@ -6726,6 +7014,9 @@ function resolveScopeInfoScriptNodeIndex(snapshot, scopeInfoScriptNodeIndexes, s
|
|
|
6726
7014
|
seen.add(currentNodeIndex);
|
|
6727
7015
|
visited.push(currentNodeIndex);
|
|
6728
7016
|
node.nodeIndex = currentNodeIndex;
|
|
7017
|
+
if (isScriptRootScopeInfo(node)) {
|
|
7018
|
+
break;
|
|
7019
|
+
}
|
|
6729
7020
|
const outerScopeInfo = node.findInternalEdgeTarget('outer_scope_info');
|
|
6730
7021
|
if (!outerScopeInfo) {
|
|
6731
7022
|
break;
|
|
@@ -10590,6 +10881,979 @@ new FinalizationRegistry(url => {
|
|
|
10590
10881
|
URL.revokeObjectURL(url);
|
|
10591
10882
|
});
|
|
10592
10883
|
|
|
10884
|
+
/**
|
|
10885
|
+
* marked v18.0.4 - a markdown parser
|
|
10886
|
+
* Copyright (c) 2018-2026, MarkedJS. (MIT License)
|
|
10887
|
+
* Copyright (c) 2011-2018, Christopher Jeffrey. (MIT License)
|
|
10888
|
+
* https://github.com/markedjs/marked
|
|
10889
|
+
*/
|
|
10890
|
+
function M() { return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null }; }
|
|
10891
|
+
var T = M();
|
|
10892
|
+
function N(l) { T = l; }
|
|
10893
|
+
var _ = { exec: () => null };
|
|
10894
|
+
function E(l) { let e = []; return t => { let n = Math.max(0, Math.min(3, t - 1)), s = e[n]; return s || (s = l(n), e[n] = s), s; }; }
|
|
10895
|
+
function d(l, e = "") { let t = typeof l == "string" ? l : l.source, n = { replace: (s, r) => { let i = typeof r == "string" ? r : r.source; return i = i.replace(m.caret, "$1"), t = t.replace(s, i), n; }, getRegex: () => new RegExp(t, e) }; return n; }
|
|
10896
|
+
var Te = ((l = "") => { try {
|
|
10897
|
+
return !!new RegExp("(?<=1)(?<!1)" + l);
|
|
10898
|
+
}
|
|
10899
|
+
catch {
|
|
10900
|
+
return false;
|
|
10901
|
+
} })(), m = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: l => new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E(l => new RegExp(`^ {0,${l}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E(l => new RegExp(`^ {0,${l}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E(l => new RegExp(`^ {0,${l}}(?:\`\`\`|~~~)`)), headingBeginRegex: E(l => new RegExp(`^ {0,${l}}#`)), htmlBeginRegex: E(l => new RegExp(`^ {0,${l}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E(l => new RegExp(`^ {0,${l}}>`)) }, Oe = /^(?:[ \t]*(?:\n|$))+/, we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, j = / {0,3}(?:[*+-]|\d{1,9}[.)])/, oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, ae = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Se = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), F = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, $e = /^[^\n]+/, U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), _e = d(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, j).getRegex(), H = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ze = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), le = d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex(), W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e }, se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex(), Ee = { ...W, lheading: Se, table: se, paragraph: d(F).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex() }, Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
10902
|
+
]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ue = /^( {2,}|\\)\n(?!\s*$)/, Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, I = /[\p{P}\p{S}]/u, Z = /[\s\p{P}\p{S}]/u, X = /[^\s\p{P}\p{S}]/u, De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z).getRegex(), pe = /(?!~)[\p{P}\p{S}]/u, qe = /(?!~)[\s\p{P}\p{S}]/u, ve = /(?:[^\s\p{P}\p{S}]|~)/u, He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, Ze = d(ce, "u").replace(/punct/g, I).getRegex(), Ge = d(ce, "u").replace(/punct/g, pe).getRegex(), he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex(), je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex(), Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z).replace(/punct/g, I).getRegex(), We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex(), Xe = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).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])?)+(?![-_])/).getRegex(), Je = d(K).replace("(?:-->|$)", "-->").getRegex(), Ve = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex(), de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex(), et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex(), ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ }, tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() }, Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() }, nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, D = { normal: W, gfm: Ee, pedantic: Ie }, A = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
|
|
10903
|
+
var rt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ge = l => rt[l];
|
|
10904
|
+
function O(l, e) { if (e) {
|
|
10905
|
+
if (m.escapeTest.test(l))
|
|
10906
|
+
return l.replace(m.escapeReplace, ge);
|
|
10907
|
+
}
|
|
10908
|
+
else if (m.escapeTestNoEncode.test(l))
|
|
10909
|
+
return l.replace(m.escapeReplaceNoEncode, ge); return l; }
|
|
10910
|
+
function V(l) { try {
|
|
10911
|
+
l = encodeURI(l).replace(m.percentDecode, "%");
|
|
10912
|
+
}
|
|
10913
|
+
catch {
|
|
10914
|
+
return null;
|
|
10915
|
+
} return l; }
|
|
10916
|
+
function Y(l, e) { let t = l.replace(m.findPipe, (r, i, o) => { let u = false, a = i; for (; --a >= 0 && o[a] === "\\";)
|
|
10917
|
+
u = !u; return u ? "|" : " |"; }), n = t.split(m.splitPipe), s = 0; if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e)
|
|
10918
|
+
if (n.length > e)
|
|
10919
|
+
n.splice(e);
|
|
10920
|
+
else
|
|
10921
|
+
for (; n.length < e;)
|
|
10922
|
+
n.push(""); for (; s < n.length; s++)
|
|
10923
|
+
n[s] = n[s].trim().replace(m.slashPipe, "|"); return n; }
|
|
10924
|
+
function $(l, e, t) { let n = l.length; if (n === 0)
|
|
10925
|
+
return ""; let s = 0; for (; s < n;) {
|
|
10926
|
+
let r = l.charAt(n - s - 1);
|
|
10927
|
+
if (r === e && true)
|
|
10928
|
+
s++;
|
|
10929
|
+
else break;
|
|
10930
|
+
} return l.slice(0, n - s); }
|
|
10931
|
+
function ee(l) {
|
|
10932
|
+
let e = l.split(`
|
|
10933
|
+
`), t = e.length - 1;
|
|
10934
|
+
for (; t >= 0 && m.blankLine.test(e[t]);)
|
|
10935
|
+
t--;
|
|
10936
|
+
return e.length - t <= 2 ? l : e.slice(0, t + 1).join(`
|
|
10937
|
+
`);
|
|
10938
|
+
}
|
|
10939
|
+
function fe(l, e) { if (l.indexOf(e[1]) === -1)
|
|
10940
|
+
return -1; let t = 0; for (let n = 0; n < l.length; n++)
|
|
10941
|
+
if (l[n] === "\\")
|
|
10942
|
+
n++;
|
|
10943
|
+
else if (l[n] === e[0])
|
|
10944
|
+
t++;
|
|
10945
|
+
else if (l[n] === e[1] && (t--, t < 0))
|
|
10946
|
+
return n; return t > 0 ? -2 : -1; }
|
|
10947
|
+
function me(l, e = 0) { let t = e, n = ""; for (let s of l)
|
|
10948
|
+
if (s === " ") {
|
|
10949
|
+
let r = 4 - t % 4;
|
|
10950
|
+
n += " ".repeat(r), t += r;
|
|
10951
|
+
}
|
|
10952
|
+
else
|
|
10953
|
+
n += s, t++; return n; }
|
|
10954
|
+
function xe(l, e, t, n, s) { let r = e.href, i = e.title || null, o = l[1].replace(s.other.outputLinkReplace, "$1"); n.state.inLink = true; let u = { type: l[0].charAt(0) === "!" ? "image" : "link", raw: t, href: r, title: i, text: o, tokens: n.inlineTokens(o) }; return n.state.inLink = false, u; }
|
|
10955
|
+
function st(l, e, t) {
|
|
10956
|
+
let n = l.match(t.other.indentCodeCompensation);
|
|
10957
|
+
if (n === null)
|
|
10958
|
+
return e;
|
|
10959
|
+
let s = n[1];
|
|
10960
|
+
return e.split(`
|
|
10961
|
+
`).map(r => { let i = r.match(t.other.beginningSpace); if (i === null)
|
|
10962
|
+
return r; let [o] = i; return o.length >= s.length ? r.slice(s.length) : r; }).join(`
|
|
10963
|
+
`);
|
|
10964
|
+
}
|
|
10965
|
+
var w = class {
|
|
10966
|
+
options;
|
|
10967
|
+
rules;
|
|
10968
|
+
lexer;
|
|
10969
|
+
constructor(e) { this.options = e || T; }
|
|
10970
|
+
space(e) { let t = this.rules.block.newline.exec(e); if (t && t[0].length > 0)
|
|
10971
|
+
return { type: "space", raw: t[0] }; }
|
|
10972
|
+
code(e) { let t = this.rules.block.code.exec(e); if (t) {
|
|
10973
|
+
let n = this.options.pedantic ? t[0] : ee(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
10974
|
+
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
10975
|
+
} }
|
|
10976
|
+
fences(e) { let t = this.rules.block.fences.exec(e); if (t) {
|
|
10977
|
+
let n = t[0], s = st(n, t[3] || "", this.rules);
|
|
10978
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
10979
|
+
} }
|
|
10980
|
+
heading(e) {
|
|
10981
|
+
let t = this.rules.block.heading.exec(e);
|
|
10982
|
+
if (t) {
|
|
10983
|
+
let n = t[2].trim();
|
|
10984
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
10985
|
+
let s = $(n, "#");
|
|
10986
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceChar.test(s)) && (n = s.trim());
|
|
10987
|
+
}
|
|
10988
|
+
return { type: "heading", raw: $(t[0], `
|
|
10989
|
+
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
10990
|
+
}
|
|
10991
|
+
}
|
|
10992
|
+
hr(e) {
|
|
10993
|
+
let t = this.rules.block.hr.exec(e);
|
|
10994
|
+
if (t)
|
|
10995
|
+
return { type: "hr", raw: $(t[0], `
|
|
10996
|
+
`) };
|
|
10997
|
+
}
|
|
10998
|
+
blockquote(e) {
|
|
10999
|
+
let t = this.rules.block.blockquote.exec(e);
|
|
11000
|
+
if (t) {
|
|
11001
|
+
let n = $(t[0], `
|
|
11002
|
+
`).split(`
|
|
11003
|
+
`), s = "", r = "", i = [];
|
|
11004
|
+
for (; n.length > 0;) {
|
|
11005
|
+
let o = false, u = [], a;
|
|
11006
|
+
for (a = 0; a < n.length; a++)
|
|
11007
|
+
if (this.rules.other.blockquoteStart.test(n[a]))
|
|
11008
|
+
u.push(n[a]), o = true;
|
|
11009
|
+
else if (!o)
|
|
11010
|
+
u.push(n[a]);
|
|
11011
|
+
else
|
|
11012
|
+
break;
|
|
11013
|
+
n = n.slice(a);
|
|
11014
|
+
let c = u.join(`
|
|
11015
|
+
`), p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
11016
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
11017
|
+
s = s ? `${s}
|
|
11018
|
+
${c}` : c, r = r ? `${r}
|
|
11019
|
+
${p}` : p;
|
|
11020
|
+
let k = this.lexer.state.top;
|
|
11021
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i, true), this.lexer.state.top = k, n.length === 0)
|
|
11022
|
+
break;
|
|
11023
|
+
let h = i.at(-1);
|
|
11024
|
+
if (h?.type === "code")
|
|
11025
|
+
break;
|
|
11026
|
+
if (h?.type === "blockquote") {
|
|
11027
|
+
let R = h, f = R.raw + `
|
|
11028
|
+
` + n.join(`
|
|
11029
|
+
`), S = this.blockquote(f);
|
|
11030
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - R.raw.length) + S.raw, r = r.substring(0, r.length - R.text.length) + S.text;
|
|
11031
|
+
break;
|
|
11032
|
+
}
|
|
11033
|
+
else if (h?.type === "list") {
|
|
11034
|
+
let R = h, f = R.raw + `
|
|
11035
|
+
` + n.join(`
|
|
11036
|
+
`), S = this.list(f);
|
|
11037
|
+
i[i.length - 1] = S, s = s.substring(0, s.length - h.raw.length) + S.raw, r = r.substring(0, r.length - R.raw.length) + S.raw, n = f.substring(i.at(-1).raw.length).split(`
|
|
11038
|
+
`);
|
|
11039
|
+
continue;
|
|
11040
|
+
}
|
|
11041
|
+
}
|
|
11042
|
+
return { type: "blockquote", raw: s, tokens: i, text: r };
|
|
11043
|
+
}
|
|
11044
|
+
}
|
|
11045
|
+
list(e) {
|
|
11046
|
+
let t = this.rules.block.list.exec(e);
|
|
11047
|
+
if (t) {
|
|
11048
|
+
let n = t[1].trim(), s = n.length > 1, r = { type: "list", raw: "", ordered: s, start: s ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
11049
|
+
n = s ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s ? n : "[*+-]");
|
|
11050
|
+
let i = this.rules.other.listItemRegex(n), o = false;
|
|
11051
|
+
for (; e;) {
|
|
11052
|
+
let a = false, c = "", p = "";
|
|
11053
|
+
if (!(t = i.exec(e)) || this.rules.block.hr.test(e))
|
|
11054
|
+
break;
|
|
11055
|
+
c = t[0], e = e.substring(c.length);
|
|
11056
|
+
let k = me(t[2].split(`
|
|
11057
|
+
`, 1)[0], t[1].length), h = e.split(`
|
|
11058
|
+
`, 1)[0], R = !k.trim(), f = 0;
|
|
11059
|
+
if (this.options.pedantic ? (f = 2, p = k.trimStart()) : R ? f = t[1].length + 1 : (f = k.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, p = k.slice(f), f += t[1].length), R && this.rules.other.blankLine.test(h) && (c += h + `
|
|
11060
|
+
`, e = e.substring(h.length + 1), a = true), !a) {
|
|
11061
|
+
let S = this.rules.other.nextBulletRegex(f), te = this.rules.other.hrRegex(f), ne = this.rules.other.fencesBeginRegex(f), re = this.rules.other.headingBeginRegex(f), be = this.rules.other.htmlBeginRegex(f), Re = this.rules.other.blockquoteBeginRegex(f);
|
|
11062
|
+
for (; e;) {
|
|
11063
|
+
let G = e.split(`
|
|
11064
|
+
`, 1)[0], C;
|
|
11065
|
+
if (h = G, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), C = h) : C = h.replace(this.rules.other.tabCharGlobal, " "), ne.test(h) || re.test(h) || be.test(h) || Re.test(h) || S.test(h) || te.test(h))
|
|
11066
|
+
break;
|
|
11067
|
+
if (C.search(this.rules.other.nonSpaceChar) >= f || !h.trim())
|
|
11068
|
+
p += `
|
|
11069
|
+
` + C.slice(f);
|
|
11070
|
+
else {
|
|
11071
|
+
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k))
|
|
11072
|
+
break;
|
|
11073
|
+
p += `
|
|
11074
|
+
` + h;
|
|
11075
|
+
}
|
|
11076
|
+
R = !h.trim(), c += G + `
|
|
11077
|
+
`, e = e.substring(G.length + 1), k = C.slice(f);
|
|
11078
|
+
}
|
|
11079
|
+
}
|
|
11080
|
+
r.loose || (o ? r.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r.raw += c;
|
|
11081
|
+
}
|
|
11082
|
+
let u = r.items.at(-1);
|
|
11083
|
+
if (u)
|
|
11084
|
+
u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
11085
|
+
else
|
|
11086
|
+
return;
|
|
11087
|
+
r.raw = r.raw.trimEnd();
|
|
11088
|
+
for (let a of r.items) {
|
|
11089
|
+
this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
|
|
11090
|
+
let c = a.tokens[0];
|
|
11091
|
+
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
|
|
11092
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
|
|
11093
|
+
for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--)
|
|
11094
|
+
if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
|
|
11095
|
+
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
|
|
11096
|
+
break;
|
|
11097
|
+
}
|
|
11098
|
+
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
11099
|
+
if (p) {
|
|
11100
|
+
let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
11101
|
+
a.checked = k.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
|
|
11102
|
+
}
|
|
11103
|
+
}
|
|
11104
|
+
else
|
|
11105
|
+
a.task && (a.task = false);
|
|
11106
|
+
if (!r.loose) {
|
|
11107
|
+
let p = a.tokens.filter(h => h.type === "space"), k = p.length > 0 && p.some(h => this.rules.other.anyLine.test(h.raw));
|
|
11108
|
+
r.loose = k;
|
|
11109
|
+
}
|
|
11110
|
+
}
|
|
11111
|
+
if (r.loose)
|
|
11112
|
+
for (let a of r.items) {
|
|
11113
|
+
a.loose = true;
|
|
11114
|
+
for (let c of a.tokens)
|
|
11115
|
+
c.type === "text" && (c.type = "paragraph");
|
|
11116
|
+
}
|
|
11117
|
+
return r;
|
|
11118
|
+
}
|
|
11119
|
+
}
|
|
11120
|
+
html(e) { let t = this.rules.block.html.exec(e); if (t) {
|
|
11121
|
+
let n = ee(t[0]);
|
|
11122
|
+
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
11123
|
+
} }
|
|
11124
|
+
def(e) {
|
|
11125
|
+
let t = this.rules.block.def.exec(e);
|
|
11126
|
+
if (t) {
|
|
11127
|
+
let n = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
11128
|
+
return { type: "def", tag: n, raw: $(t[0], `
|
|
11129
|
+
`), href: s, title: r };
|
|
11130
|
+
}
|
|
11131
|
+
}
|
|
11132
|
+
table(e) {
|
|
11133
|
+
let t = this.rules.block.table.exec(e);
|
|
11134
|
+
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
11135
|
+
return;
|
|
11136
|
+
let n = Y(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
11137
|
+
`) : [], i = { type: "table", raw: $(t[0], `
|
|
11138
|
+
`), header: [], align: [], rows: [] };
|
|
11139
|
+
if (n.length === s.length) {
|
|
11140
|
+
for (let o of s)
|
|
11141
|
+
this.rules.other.tableAlignRight.test(o) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i.align.push("left") : i.align.push(null);
|
|
11142
|
+
for (let o = 0; o < n.length; o++)
|
|
11143
|
+
i.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i.align[o] });
|
|
11144
|
+
for (let o of r)
|
|
11145
|
+
i.rows.push(Y(o, i.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i.align[a] })));
|
|
11146
|
+
return i;
|
|
11147
|
+
}
|
|
11148
|
+
}
|
|
11149
|
+
lheading(e) {
|
|
11150
|
+
let t = this.rules.block.lheading.exec(e);
|
|
11151
|
+
if (t) {
|
|
11152
|
+
let n = t[1].trim();
|
|
11153
|
+
return { type: "heading", raw: $(t[0], `
|
|
11154
|
+
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
11155
|
+
}
|
|
11156
|
+
}
|
|
11157
|
+
paragraph(e) {
|
|
11158
|
+
let t = this.rules.block.paragraph.exec(e);
|
|
11159
|
+
if (t) {
|
|
11160
|
+
let n = t[1].charAt(t[1].length - 1) === `
|
|
11161
|
+
` ? t[1].slice(0, -1) : t[1];
|
|
11162
|
+
return { type: "paragraph", raw: t[0], text: n, tokens: this.lexer.inline(n) };
|
|
11163
|
+
}
|
|
11164
|
+
}
|
|
11165
|
+
text(e) { let t = this.rules.block.text.exec(e); if (t)
|
|
11166
|
+
return { type: "text", raw: t[0], text: t[0], tokens: this.lexer.inline(t[0]) }; }
|
|
11167
|
+
escape(e) { let t = this.rules.inline.escape.exec(e); if (t)
|
|
11168
|
+
return { type: "escape", raw: t[0], text: t[1] }; }
|
|
11169
|
+
tag(e) { let t = this.rules.inline.tag.exec(e); if (t)
|
|
11170
|
+
return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] }; }
|
|
11171
|
+
link(e) { let t = this.rules.inline.link.exec(e); if (t) {
|
|
11172
|
+
let n = t[2].trim();
|
|
11173
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
11174
|
+
if (!this.rules.other.endAngleBracket.test(n))
|
|
11175
|
+
return;
|
|
11176
|
+
let i = $(n.slice(0, -1), "\\");
|
|
11177
|
+
if ((n.length - i.length) % 2 === 0)
|
|
11178
|
+
return;
|
|
11179
|
+
}
|
|
11180
|
+
else {
|
|
11181
|
+
let i = fe(t[2], "()");
|
|
11182
|
+
if (i === -2)
|
|
11183
|
+
return;
|
|
11184
|
+
if (i > -1) {
|
|
11185
|
+
let u = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
11186
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, u).trim(), t[3] = "";
|
|
11187
|
+
}
|
|
11188
|
+
}
|
|
11189
|
+
let s = t[2], r = "";
|
|
11190
|
+
if (this.options.pedantic) {
|
|
11191
|
+
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
11192
|
+
i && (s = i[1], r = i[3]);
|
|
11193
|
+
}
|
|
11194
|
+
else
|
|
11195
|
+
r = t[3] ? t[3].slice(1, -1) : "";
|
|
11196
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), xe(t, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
11197
|
+
} }
|
|
11198
|
+
reflink(e, t) { let n; if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
11199
|
+
let s = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r = t[s.toLowerCase()];
|
|
11200
|
+
if (!r) {
|
|
11201
|
+
let i = n[0].charAt(0);
|
|
11202
|
+
return { type: "text", raw: i, text: i };
|
|
11203
|
+
}
|
|
11204
|
+
return xe(n, r, n[0], this.lexer, this.rules);
|
|
11205
|
+
} }
|
|
11206
|
+
emStrong(e, t, n = "") { let s = this.rules.inline.emStrongLDelim.exec(e); if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric))
|
|
11207
|
+
return; if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
11208
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = 0, p = s[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
11209
|
+
for (p.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = p.exec(t)) !== null;) {
|
|
11210
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o)
|
|
11211
|
+
continue;
|
|
11212
|
+
if (u = [...o].length, s[3] || s[4]) {
|
|
11213
|
+
a += u;
|
|
11214
|
+
continue;
|
|
11215
|
+
}
|
|
11216
|
+
else if ((s[5] || s[6]) && i % 3 && !((i + u) % 3)) {
|
|
11217
|
+
c += u;
|
|
11218
|
+
continue;
|
|
11219
|
+
}
|
|
11220
|
+
if (a -= u, a > 0)
|
|
11221
|
+
continue;
|
|
11222
|
+
u = Math.min(u, u + a + c);
|
|
11223
|
+
let k = [...s[0]][0].length, h = e.slice(0, i + s.index + k + u);
|
|
11224
|
+
if (Math.min(i, u) % 2) {
|
|
11225
|
+
let f = h.slice(1, -1);
|
|
11226
|
+
return { type: "em", raw: h, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
11227
|
+
}
|
|
11228
|
+
let R = h.slice(2, -2);
|
|
11229
|
+
return { type: "strong", raw: h, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
11230
|
+
}
|
|
11231
|
+
} }
|
|
11232
|
+
codespan(e) { let t = this.rules.inline.code.exec(e); if (t) {
|
|
11233
|
+
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "), s = this.rules.other.nonSpaceChar.test(n), r = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
11234
|
+
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
11235
|
+
} }
|
|
11236
|
+
br(e) { let t = this.rules.inline.br.exec(e); if (t)
|
|
11237
|
+
return { type: "br", raw: t[0] }; }
|
|
11238
|
+
del(e, t, n = "") { let s = this.rules.inline.delLDelim.exec(e); if (!s)
|
|
11239
|
+
return; if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
11240
|
+
let i = [...s[0]].length - 1, o, u, a = i, c = this.rules.inline.delRDelim;
|
|
11241
|
+
for (c.lastIndex = 0, t = t.slice(-1 * e.length + i); (s = c.exec(t)) !== null;) {
|
|
11242
|
+
if (o = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !o || (u = [...o].length, u !== i))
|
|
11243
|
+
continue;
|
|
11244
|
+
if (s[3] || s[4]) {
|
|
11245
|
+
a += u;
|
|
11246
|
+
continue;
|
|
11247
|
+
}
|
|
11248
|
+
if (a -= u, a > 0)
|
|
11249
|
+
continue;
|
|
11250
|
+
u = Math.min(u, u + a);
|
|
11251
|
+
let p = [...s[0]][0].length, k = e.slice(0, i + s.index + p + u), h = k.slice(i, -i);
|
|
11252
|
+
return { type: "del", raw: k, text: h, tokens: this.lexer.inlineTokens(h) };
|
|
11253
|
+
}
|
|
11254
|
+
} }
|
|
11255
|
+
autolink(e) { let t = this.rules.inline.autolink.exec(e); if (t) {
|
|
11256
|
+
let n, s;
|
|
11257
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
11258
|
+
} }
|
|
11259
|
+
url(e) { let t; if (t = this.rules.inline.url.exec(e)) {
|
|
11260
|
+
let n, s;
|
|
11261
|
+
if (t[2] === "@")
|
|
11262
|
+
n = t[0], s = "mailto:" + n;
|
|
11263
|
+
else {
|
|
11264
|
+
let r;
|
|
11265
|
+
do
|
|
11266
|
+
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
11267
|
+
while (r !== t[0]);
|
|
11268
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
11269
|
+
}
|
|
11270
|
+
return { type: "link", raw: t[0], text: n, href: s, tokens: [{ type: "text", raw: n, text: n }] };
|
|
11271
|
+
} }
|
|
11272
|
+
inlineText(e) { let t = this.rules.inline.text.exec(e); if (t) {
|
|
11273
|
+
let n = this.lexer.state.inRawBlock;
|
|
11274
|
+
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
11275
|
+
} }
|
|
11276
|
+
};
|
|
11277
|
+
var x = class l {
|
|
11278
|
+
tokens;
|
|
11279
|
+
options;
|
|
11280
|
+
state;
|
|
11281
|
+
inlineQueue;
|
|
11282
|
+
tokenizer;
|
|
11283
|
+
constructor(e) { this.tokens = [], this.tokens.links = Object.create(null), this.options = e || T, this.options.tokenizer = this.options.tokenizer || new w, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true }; let t = { other: m, block: D.normal, inline: A.normal }; this.options.pedantic ? (t.block = D.pedantic, t.inline = A.pedantic) : this.options.gfm && (t.block = D.gfm, this.options.breaks ? t.inline = A.breaks : t.inline = A.gfm), this.tokenizer.rules = t; }
|
|
11284
|
+
static get rules() { return { block: D, inline: A }; }
|
|
11285
|
+
static lex(e, t) { return new l(t).lex(e); }
|
|
11286
|
+
static lexInline(e, t) { return new l(t).inlineTokens(e); }
|
|
11287
|
+
lex(e) {
|
|
11288
|
+
e = e.replace(m.carriageReturn, `
|
|
11289
|
+
`), this.blockTokens(e, this.tokens);
|
|
11290
|
+
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
11291
|
+
let n = this.inlineQueue[t];
|
|
11292
|
+
this.inlineTokens(n.src, n.tokens);
|
|
11293
|
+
}
|
|
11294
|
+
return this.inlineQueue = [], this.tokens;
|
|
11295
|
+
}
|
|
11296
|
+
blockTokens(e, t = [], n = false) {
|
|
11297
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(m.tabCharGlobal, " ").replace(m.spaceLine, ""));
|
|
11298
|
+
let s = 1 / 0;
|
|
11299
|
+
for (; e;) {
|
|
11300
|
+
if (e.length < s)
|
|
11301
|
+
s = e.length;
|
|
11302
|
+
else {
|
|
11303
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11304
|
+
break;
|
|
11305
|
+
}
|
|
11306
|
+
let r;
|
|
11307
|
+
if (this.options.extensions?.block?.some(o => (r = o.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))
|
|
11308
|
+
continue;
|
|
11309
|
+
if (r = this.tokenizer.space(e)) {
|
|
11310
|
+
e = e.substring(r.raw.length);
|
|
11311
|
+
let o = t.at(-1);
|
|
11312
|
+
r.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
11313
|
+
` : t.push(r);
|
|
11314
|
+
continue;
|
|
11315
|
+
}
|
|
11316
|
+
if (r = this.tokenizer.code(e)) {
|
|
11317
|
+
e = e.substring(r.raw.length);
|
|
11318
|
+
let o = t.at(-1);
|
|
11319
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11320
|
+
`) ? "" : `
|
|
11321
|
+
`) + r.raw, o.text += `
|
|
11322
|
+
` + r.text, this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
11323
|
+
continue;
|
|
11324
|
+
}
|
|
11325
|
+
if (r = this.tokenizer.fences(e)) {
|
|
11326
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11327
|
+
continue;
|
|
11328
|
+
}
|
|
11329
|
+
if (r = this.tokenizer.heading(e)) {
|
|
11330
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11331
|
+
continue;
|
|
11332
|
+
}
|
|
11333
|
+
if (r = this.tokenizer.hr(e)) {
|
|
11334
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11335
|
+
continue;
|
|
11336
|
+
}
|
|
11337
|
+
if (r = this.tokenizer.blockquote(e)) {
|
|
11338
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11339
|
+
continue;
|
|
11340
|
+
}
|
|
11341
|
+
if (r = this.tokenizer.list(e)) {
|
|
11342
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11343
|
+
continue;
|
|
11344
|
+
}
|
|
11345
|
+
if (r = this.tokenizer.html(e)) {
|
|
11346
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11347
|
+
continue;
|
|
11348
|
+
}
|
|
11349
|
+
if (r = this.tokenizer.def(e)) {
|
|
11350
|
+
e = e.substring(r.raw.length);
|
|
11351
|
+
let o = t.at(-1);
|
|
11352
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11353
|
+
`) ? "" : `
|
|
11354
|
+
`) + r.raw, o.text += `
|
|
11355
|
+
` + r.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }, t.push(r));
|
|
11356
|
+
continue;
|
|
11357
|
+
}
|
|
11358
|
+
if (r = this.tokenizer.table(e)) {
|
|
11359
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11360
|
+
continue;
|
|
11361
|
+
}
|
|
11362
|
+
if (r = this.tokenizer.lheading(e)) {
|
|
11363
|
+
e = e.substring(r.raw.length), t.push(r);
|
|
11364
|
+
continue;
|
|
11365
|
+
}
|
|
11366
|
+
let i = e;
|
|
11367
|
+
if (this.options.extensions?.startBlock) {
|
|
11368
|
+
let o = 1 / 0, u = e.slice(1), a;
|
|
11369
|
+
this.options.extensions.startBlock.forEach(c => { a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a)); }), o < 1 / 0 && o >= 0 && (i = e.substring(0, o + 1));
|
|
11370
|
+
}
|
|
11371
|
+
if (this.state.top && (r = this.tokenizer.paragraph(i))) {
|
|
11372
|
+
let o = t.at(-1);
|
|
11373
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
11374
|
+
`) ? "" : `
|
|
11375
|
+
`) + r.raw, o.text += `
|
|
11376
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r), n = i.length !== e.length, e = e.substring(r.raw.length);
|
|
11377
|
+
continue;
|
|
11378
|
+
}
|
|
11379
|
+
if (r = this.tokenizer.text(e)) {
|
|
11380
|
+
e = e.substring(r.raw.length);
|
|
11381
|
+
let o = t.at(-1);
|
|
11382
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
11383
|
+
`) ? "" : `
|
|
11384
|
+
`) + r.raw, o.text += `
|
|
11385
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t.push(r);
|
|
11386
|
+
continue;
|
|
11387
|
+
}
|
|
11388
|
+
if (e) {
|
|
11389
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11390
|
+
break;
|
|
11391
|
+
}
|
|
11392
|
+
}
|
|
11393
|
+
return this.state.top = true, t;
|
|
11394
|
+
}
|
|
11395
|
+
inline(e, t = []) { return this.inlineQueue.push({ src: e, tokens: t }), t; }
|
|
11396
|
+
inlineTokens(e, t = []) { this.tokenizer.lexer = this; let n = e, s = null; if (this.tokens.links) {
|
|
11397
|
+
let a = Object.keys(this.tokens.links);
|
|
11398
|
+
if (a.length > 0)
|
|
11399
|
+
for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null;)
|
|
11400
|
+
a.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
11401
|
+
} for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null;)
|
|
11402
|
+
n = n.slice(0, s.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); let r; for (; (s = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null;)
|
|
11403
|
+
r = s[2] ? s[2].length : 0, n = n.slice(0, s.index + r) + "[" + "a".repeat(s[0].length - r - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n; let i = false, o = "", u = 1 / 0; for (; e;) {
|
|
11404
|
+
if (e.length < u)
|
|
11405
|
+
u = e.length;
|
|
11406
|
+
else {
|
|
11407
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11408
|
+
break;
|
|
11409
|
+
}
|
|
11410
|
+
i || (o = ""), i = false;
|
|
11411
|
+
let a;
|
|
11412
|
+
if (this.options.extensions?.inline?.some(p => (a = p.call({ lexer: this }, e, t)) ? (e = e.substring(a.raw.length), t.push(a), true) : false))
|
|
11413
|
+
continue;
|
|
11414
|
+
if (a = this.tokenizer.escape(e)) {
|
|
11415
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11416
|
+
continue;
|
|
11417
|
+
}
|
|
11418
|
+
if (a = this.tokenizer.tag(e)) {
|
|
11419
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11420
|
+
continue;
|
|
11421
|
+
}
|
|
11422
|
+
if (a = this.tokenizer.link(e)) {
|
|
11423
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11424
|
+
continue;
|
|
11425
|
+
}
|
|
11426
|
+
if (a = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
11427
|
+
e = e.substring(a.raw.length);
|
|
11428
|
+
let p = t.at(-1);
|
|
11429
|
+
a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
11430
|
+
continue;
|
|
11431
|
+
}
|
|
11432
|
+
if (a = this.tokenizer.emStrong(e, n, o)) {
|
|
11433
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11434
|
+
continue;
|
|
11435
|
+
}
|
|
11436
|
+
if (a = this.tokenizer.codespan(e)) {
|
|
11437
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11438
|
+
continue;
|
|
11439
|
+
}
|
|
11440
|
+
if (a = this.tokenizer.br(e)) {
|
|
11441
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11442
|
+
continue;
|
|
11443
|
+
}
|
|
11444
|
+
if (a = this.tokenizer.del(e, n, o)) {
|
|
11445
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11446
|
+
continue;
|
|
11447
|
+
}
|
|
11448
|
+
if (a = this.tokenizer.autolink(e)) {
|
|
11449
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11450
|
+
continue;
|
|
11451
|
+
}
|
|
11452
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e))) {
|
|
11453
|
+
e = e.substring(a.raw.length), t.push(a);
|
|
11454
|
+
continue;
|
|
11455
|
+
}
|
|
11456
|
+
let c = e;
|
|
11457
|
+
if (this.options.extensions?.startInline) {
|
|
11458
|
+
let p = 1 / 0, k = e.slice(1), h;
|
|
11459
|
+
this.options.extensions.startInline.forEach(R => { h = R.call({ lexer: this }, k), typeof h == "number" && h >= 0 && (p = Math.min(p, h)); }), p < 1 / 0 && p >= 0 && (c = e.substring(0, p + 1));
|
|
11460
|
+
}
|
|
11461
|
+
if (a = this.tokenizer.inlineText(c)) {
|
|
11462
|
+
e = e.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i = true;
|
|
11463
|
+
let p = t.at(-1);
|
|
11464
|
+
p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t.push(a);
|
|
11465
|
+
continue;
|
|
11466
|
+
}
|
|
11467
|
+
if (e) {
|
|
11468
|
+
this.infiniteLoopError(e.charCodeAt(0));
|
|
11469
|
+
break;
|
|
11470
|
+
}
|
|
11471
|
+
} return t; }
|
|
11472
|
+
infiniteLoopError(e) { let t = "Infinite loop on byte: " + e; if (this.options.silent)
|
|
11473
|
+
console.error(t);
|
|
11474
|
+
else
|
|
11475
|
+
throw new Error(t); }
|
|
11476
|
+
};
|
|
11477
|
+
var y = class {
|
|
11478
|
+
options;
|
|
11479
|
+
parser;
|
|
11480
|
+
constructor(e) { this.options = e || T; }
|
|
11481
|
+
space(e) { return ""; }
|
|
11482
|
+
code({ text: e, lang: t, escaped: n }) {
|
|
11483
|
+
let s = (t || "").match(m.notSpaceStart)?.[0], r = e.replace(m.endingNewline, "") + `
|
|
11484
|
+
`;
|
|
11485
|
+
return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
|
|
11486
|
+
` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
|
|
11487
|
+
`;
|
|
11488
|
+
}
|
|
11489
|
+
blockquote({ tokens: e }) {
|
|
11490
|
+
return `<blockquote>
|
|
11491
|
+
${this.parser.parse(e)}</blockquote>
|
|
11492
|
+
`;
|
|
11493
|
+
}
|
|
11494
|
+
html({ text: e }) { return e; }
|
|
11495
|
+
def(e) { return ""; }
|
|
11496
|
+
heading({ tokens: e, depth: t }) {
|
|
11497
|
+
return `<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
11498
|
+
`;
|
|
11499
|
+
}
|
|
11500
|
+
hr(e) {
|
|
11501
|
+
return `<hr>
|
|
11502
|
+
`;
|
|
11503
|
+
}
|
|
11504
|
+
list(e) {
|
|
11505
|
+
let t = e.ordered, n = e.start, s = "";
|
|
11506
|
+
for (let o = 0; o < e.items.length; o++) {
|
|
11507
|
+
let u = e.items[o];
|
|
11508
|
+
s += this.listitem(u);
|
|
11509
|
+
}
|
|
11510
|
+
let r = t ? "ol" : "ul", i = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
11511
|
+
return "<" + r + i + `>
|
|
11512
|
+
` + s + "</" + r + `>
|
|
11513
|
+
`;
|
|
11514
|
+
}
|
|
11515
|
+
listitem(e) {
|
|
11516
|
+
return `<li>${this.parser.parse(e.tokens)}</li>
|
|
11517
|
+
`;
|
|
11518
|
+
}
|
|
11519
|
+
checkbox({ checked: e }) { return "<input " + (e ? 'checked="" ' : "") + 'disabled="" type="checkbox"> '; }
|
|
11520
|
+
paragraph({ tokens: e }) {
|
|
11521
|
+
return `<p>${this.parser.parseInline(e)}</p>
|
|
11522
|
+
`;
|
|
11523
|
+
}
|
|
11524
|
+
table(e) {
|
|
11525
|
+
let t = "", n = "";
|
|
11526
|
+
for (let r = 0; r < e.header.length; r++)
|
|
11527
|
+
n += this.tablecell(e.header[r]);
|
|
11528
|
+
t += this.tablerow({ text: n });
|
|
11529
|
+
let s = "";
|
|
11530
|
+
for (let r = 0; r < e.rows.length; r++) {
|
|
11531
|
+
let i = e.rows[r];
|
|
11532
|
+
n = "";
|
|
11533
|
+
for (let o = 0; o < i.length; o++)
|
|
11534
|
+
n += this.tablecell(i[o]);
|
|
11535
|
+
s += this.tablerow({ text: n });
|
|
11536
|
+
}
|
|
11537
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
11538
|
+
<thead>
|
|
11539
|
+
` + t + `</thead>
|
|
11540
|
+
` + s + `</table>
|
|
11541
|
+
`;
|
|
11542
|
+
}
|
|
11543
|
+
tablerow({ text: e }) {
|
|
11544
|
+
return `<tr>
|
|
11545
|
+
${e}</tr>
|
|
11546
|
+
`;
|
|
11547
|
+
}
|
|
11548
|
+
tablecell(e) {
|
|
11549
|
+
let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
|
|
11550
|
+
return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
|
|
11551
|
+
`;
|
|
11552
|
+
}
|
|
11553
|
+
strong({ tokens: e }) { return `<strong>${this.parser.parseInline(e)}</strong>`; }
|
|
11554
|
+
em({ tokens: e }) { return `<em>${this.parser.parseInline(e)}</em>`; }
|
|
11555
|
+
codespan({ text: e }) { return `<code>${O(e, true)}</code>`; }
|
|
11556
|
+
br(e) { return "<br>"; }
|
|
11557
|
+
del({ tokens: e }) { return `<del>${this.parser.parseInline(e)}</del>`; }
|
|
11558
|
+
link({ href: e, title: t, tokens: n }) { let s = this.parser.parseInline(n), r = V(e); if (r === null)
|
|
11559
|
+
return s; e = r; let i = '<a href="' + e + '"'; return t && (i += ' title="' + O(t) + '"'), i += ">" + s + "</a>", i; }
|
|
11560
|
+
image({ href: e, title: t, text: n, tokens: s }) { s && (n = this.parser.parseInline(s, this.parser.textRenderer)); let r = V(e); if (r === null)
|
|
11561
|
+
return O(n); e = r; let i = `<img src="${e}" alt="${O(n)}"`; return t && (i += ` title="${O(t)}"`), i += ">", i; }
|
|
11562
|
+
text(e) { return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text); }
|
|
11563
|
+
};
|
|
11564
|
+
var L = class {
|
|
11565
|
+
strong({ text: e }) { return e; }
|
|
11566
|
+
em({ text: e }) { return e; }
|
|
11567
|
+
codespan({ text: e }) { return e; }
|
|
11568
|
+
del({ text: e }) { return e; }
|
|
11569
|
+
html({ text: e }) { return e; }
|
|
11570
|
+
text({ text: e }) { return e; }
|
|
11571
|
+
link({ text: e }) { return "" + e; }
|
|
11572
|
+
image({ text: e }) { return "" + e; }
|
|
11573
|
+
br() { return ""; }
|
|
11574
|
+
checkbox({ raw: e }) { return e; }
|
|
11575
|
+
};
|
|
11576
|
+
var b = class l {
|
|
11577
|
+
options;
|
|
11578
|
+
renderer;
|
|
11579
|
+
textRenderer;
|
|
11580
|
+
constructor(e) { this.options = e || T, this.options.renderer = this.options.renderer || new y, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L; }
|
|
11581
|
+
static parse(e, t) { return new l(t).parse(e); }
|
|
11582
|
+
static parseInline(e, t) { return new l(t).parseInline(e); }
|
|
11583
|
+
parse(e) { this.renderer.parser = this; let t = ""; for (let n = 0; n < e.length; n++) {
|
|
11584
|
+
let s = e[n];
|
|
11585
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
11586
|
+
let i = s, o = this.options.extensions.renderers[i.type].call({ parser: this }, i);
|
|
11587
|
+
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i.type)) {
|
|
11588
|
+
t += o || "";
|
|
11589
|
+
continue;
|
|
11590
|
+
}
|
|
11591
|
+
}
|
|
11592
|
+
let r = s;
|
|
11593
|
+
switch (r.type) {
|
|
11594
|
+
case "space": {
|
|
11595
|
+
t += this.renderer.space(r);
|
|
11596
|
+
break;
|
|
11597
|
+
}
|
|
11598
|
+
case "hr": {
|
|
11599
|
+
t += this.renderer.hr(r);
|
|
11600
|
+
break;
|
|
11601
|
+
}
|
|
11602
|
+
case "heading": {
|
|
11603
|
+
t += this.renderer.heading(r);
|
|
11604
|
+
break;
|
|
11605
|
+
}
|
|
11606
|
+
case "code": {
|
|
11607
|
+
t += this.renderer.code(r);
|
|
11608
|
+
break;
|
|
11609
|
+
}
|
|
11610
|
+
case "table": {
|
|
11611
|
+
t += this.renderer.table(r);
|
|
11612
|
+
break;
|
|
11613
|
+
}
|
|
11614
|
+
case "blockquote": {
|
|
11615
|
+
t += this.renderer.blockquote(r);
|
|
11616
|
+
break;
|
|
11617
|
+
}
|
|
11618
|
+
case "list": {
|
|
11619
|
+
t += this.renderer.list(r);
|
|
11620
|
+
break;
|
|
11621
|
+
}
|
|
11622
|
+
case "checkbox": {
|
|
11623
|
+
t += this.renderer.checkbox(r);
|
|
11624
|
+
break;
|
|
11625
|
+
}
|
|
11626
|
+
case "html": {
|
|
11627
|
+
t += this.renderer.html(r);
|
|
11628
|
+
break;
|
|
11629
|
+
}
|
|
11630
|
+
case "def": {
|
|
11631
|
+
t += this.renderer.def(r);
|
|
11632
|
+
break;
|
|
11633
|
+
}
|
|
11634
|
+
case "paragraph": {
|
|
11635
|
+
t += this.renderer.paragraph(r);
|
|
11636
|
+
break;
|
|
11637
|
+
}
|
|
11638
|
+
case "text": {
|
|
11639
|
+
t += this.renderer.text(r);
|
|
11640
|
+
break;
|
|
11641
|
+
}
|
|
11642
|
+
default: {
|
|
11643
|
+
let i = 'Token with "' + r.type + '" type was not found.';
|
|
11644
|
+
if (this.options.silent)
|
|
11645
|
+
return console.error(i), "";
|
|
11646
|
+
throw new Error(i);
|
|
11647
|
+
}
|
|
11648
|
+
}
|
|
11649
|
+
} return t; }
|
|
11650
|
+
parseInline(e, t = this.renderer) { this.renderer.parser = this; let n = ""; for (let s = 0; s < e.length; s++) {
|
|
11651
|
+
let r = e[s];
|
|
11652
|
+
if (this.options.extensions?.renderers?.[r.type]) {
|
|
11653
|
+
let o = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
11654
|
+
if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
|
|
11655
|
+
n += o || "";
|
|
11656
|
+
continue;
|
|
11657
|
+
}
|
|
11658
|
+
}
|
|
11659
|
+
let i = r;
|
|
11660
|
+
switch (i.type) {
|
|
11661
|
+
case "escape": {
|
|
11662
|
+
n += t.text(i);
|
|
11663
|
+
break;
|
|
11664
|
+
}
|
|
11665
|
+
case "html": {
|
|
11666
|
+
n += t.html(i);
|
|
11667
|
+
break;
|
|
11668
|
+
}
|
|
11669
|
+
case "link": {
|
|
11670
|
+
n += t.link(i);
|
|
11671
|
+
break;
|
|
11672
|
+
}
|
|
11673
|
+
case "image": {
|
|
11674
|
+
n += t.image(i);
|
|
11675
|
+
break;
|
|
11676
|
+
}
|
|
11677
|
+
case "checkbox": {
|
|
11678
|
+
n += t.checkbox(i);
|
|
11679
|
+
break;
|
|
11680
|
+
}
|
|
11681
|
+
case "strong": {
|
|
11682
|
+
n += t.strong(i);
|
|
11683
|
+
break;
|
|
11684
|
+
}
|
|
11685
|
+
case "em": {
|
|
11686
|
+
n += t.em(i);
|
|
11687
|
+
break;
|
|
11688
|
+
}
|
|
11689
|
+
case "codespan": {
|
|
11690
|
+
n += t.codespan(i);
|
|
11691
|
+
break;
|
|
11692
|
+
}
|
|
11693
|
+
case "br": {
|
|
11694
|
+
n += t.br(i);
|
|
11695
|
+
break;
|
|
11696
|
+
}
|
|
11697
|
+
case "del": {
|
|
11698
|
+
n += t.del(i);
|
|
11699
|
+
break;
|
|
11700
|
+
}
|
|
11701
|
+
case "text": {
|
|
11702
|
+
n += t.text(i);
|
|
11703
|
+
break;
|
|
11704
|
+
}
|
|
11705
|
+
default: {
|
|
11706
|
+
let o = 'Token with "' + i.type + '" type was not found.';
|
|
11707
|
+
if (this.options.silent)
|
|
11708
|
+
return console.error(o), "";
|
|
11709
|
+
throw new Error(o);
|
|
11710
|
+
}
|
|
11711
|
+
}
|
|
11712
|
+
} return n; }
|
|
11713
|
+
};
|
|
11714
|
+
var P = class {
|
|
11715
|
+
options;
|
|
11716
|
+
block;
|
|
11717
|
+
constructor(e) { this.options = e || T; }
|
|
11718
|
+
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
11719
|
+
static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
11720
|
+
preprocess(e) { return e; }
|
|
11721
|
+
postprocess(e) { return e; }
|
|
11722
|
+
processAllTokens(e) { return e; }
|
|
11723
|
+
emStrongMask(e) { return e; }
|
|
11724
|
+
provideLexer(e = this.block) { return e ? x.lex : x.lexInline; }
|
|
11725
|
+
provideParser(e = this.block) { return e ? b.parse : b.parseInline; }
|
|
11726
|
+
};
|
|
11727
|
+
var q = class {
|
|
11728
|
+
defaults = M();
|
|
11729
|
+
options = this.setOptions;
|
|
11730
|
+
parse = this.parseMarkdown(true);
|
|
11731
|
+
parseInline = this.parseMarkdown(false);
|
|
11732
|
+
Parser = b;
|
|
11733
|
+
Renderer = y;
|
|
11734
|
+
TextRenderer = L;
|
|
11735
|
+
Lexer = x;
|
|
11736
|
+
Tokenizer = w;
|
|
11737
|
+
Hooks = P;
|
|
11738
|
+
constructor(...e) { this.use(...e); }
|
|
11739
|
+
walkTokens(e, t) { let n = []; for (let s of e)
|
|
11740
|
+
switch (n = n.concat(t.call(this, s)), s.type) {
|
|
11741
|
+
case "table": {
|
|
11742
|
+
let r = s;
|
|
11743
|
+
for (let i of r.header)
|
|
11744
|
+
n = n.concat(this.walkTokens(i.tokens, t));
|
|
11745
|
+
for (let i of r.rows)
|
|
11746
|
+
for (let o of i)
|
|
11747
|
+
n = n.concat(this.walkTokens(o.tokens, t));
|
|
11748
|
+
break;
|
|
11749
|
+
}
|
|
11750
|
+
case "list": {
|
|
11751
|
+
let r = s;
|
|
11752
|
+
n = n.concat(this.walkTokens(r.items, t));
|
|
11753
|
+
break;
|
|
11754
|
+
}
|
|
11755
|
+
default: {
|
|
11756
|
+
let r = s;
|
|
11757
|
+
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach(i => { let o = r[i].flat(1 / 0); n = n.concat(this.walkTokens(o, t)); }) : r.tokens && (n = n.concat(this.walkTokens(r.tokens, t)));
|
|
11758
|
+
}
|
|
11759
|
+
} return n; }
|
|
11760
|
+
use(...e) { let t = this.defaults.extensions || { renderers: {}, childTokens: {} }; return e.forEach(n => { let s = { ...n }; if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach(r => { if (!r.name)
|
|
11761
|
+
throw new Error("extension name required"); if ("renderer" in r) {
|
|
11762
|
+
let i = t.renderers[r.name];
|
|
11763
|
+
i ? t.renderers[r.name] = function (...o) { let u = r.renderer.apply(this, o); return u === false && (u = i.apply(this, o)), u; } : t.renderers[r.name] = r.renderer;
|
|
11764
|
+
} if ("tokenizer" in r) {
|
|
11765
|
+
if (!r.level || r.level !== "block" && r.level !== "inline")
|
|
11766
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
11767
|
+
let i = t[r.level];
|
|
11768
|
+
i ? i.unshift(r.tokenizer) : t[r.level] = [r.tokenizer], r.start && (r.level === "block" ? t.startBlock ? t.startBlock.push(r.start) : t.startBlock = [r.start] : r.level === "inline" && (t.startInline ? t.startInline.push(r.start) : t.startInline = [r.start]));
|
|
11769
|
+
} "childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens); }), s.extensions = t), n.renderer) {
|
|
11770
|
+
let r = this.defaults.renderer || new y(this.defaults);
|
|
11771
|
+
for (let i in n.renderer) {
|
|
11772
|
+
if (!(i in r))
|
|
11773
|
+
throw new Error(`renderer '${i}' does not exist`);
|
|
11774
|
+
if (["options", "parser"].includes(i))
|
|
11775
|
+
continue;
|
|
11776
|
+
let o = i, u = n.renderer[o], a = r[o];
|
|
11777
|
+
r[o] = (...c) => { let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p || ""; };
|
|
11778
|
+
}
|
|
11779
|
+
s.renderer = r;
|
|
11780
|
+
} if (n.tokenizer) {
|
|
11781
|
+
let r = this.defaults.tokenizer || new w(this.defaults);
|
|
11782
|
+
for (let i in n.tokenizer) {
|
|
11783
|
+
if (!(i in r))
|
|
11784
|
+
throw new Error(`tokenizer '${i}' does not exist`);
|
|
11785
|
+
if (["options", "rules", "lexer"].includes(i))
|
|
11786
|
+
continue;
|
|
11787
|
+
let o = i, u = n.tokenizer[o], a = r[o];
|
|
11788
|
+
r[o] = (...c) => { let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p; };
|
|
11789
|
+
}
|
|
11790
|
+
s.tokenizer = r;
|
|
11791
|
+
} if (n.hooks) {
|
|
11792
|
+
let r = this.defaults.hooks || new P;
|
|
11793
|
+
for (let i in n.hooks) {
|
|
11794
|
+
if (!(i in r))
|
|
11795
|
+
throw new Error(`hook '${i}' does not exist`);
|
|
11796
|
+
if (["options", "block"].includes(i))
|
|
11797
|
+
continue;
|
|
11798
|
+
let o = i, u = n.hooks[o], a = r[o];
|
|
11799
|
+
P.passThroughHooks.has(i) ? r[o] = c => { if (this.defaults.async && P.passThroughHooksRespectAsync.has(i))
|
|
11800
|
+
return (async () => { let k = await u.call(r, c); return a.call(r, k); })(); let p = u.call(r, c); return a.call(r, p); } : r[o] = (...c) => { if (this.defaults.async)
|
|
11801
|
+
return (async () => { let k = await u.apply(r, c); return k === false && (k = await a.apply(r, c)), k; })(); let p = u.apply(r, c); return p === false && (p = a.apply(r, c)), p; };
|
|
11802
|
+
}
|
|
11803
|
+
s.hooks = r;
|
|
11804
|
+
} if (n.walkTokens) {
|
|
11805
|
+
let r = this.defaults.walkTokens, i = n.walkTokens;
|
|
11806
|
+
s.walkTokens = function (o) { let u = []; return u.push(i.call(this, o)), r && (u = u.concat(r.call(this, o))), u; };
|
|
11807
|
+
} this.defaults = { ...this.defaults, ...s }; }), this; }
|
|
11808
|
+
setOptions(e) { return this.defaults = { ...this.defaults, ...e }, this; }
|
|
11809
|
+
lexer(e, t) { return x.lex(e, t ?? this.defaults); }
|
|
11810
|
+
parser(e, t) { return b.parse(e, t ?? this.defaults); }
|
|
11811
|
+
parseMarkdown(e) { return (n, s) => { let r = { ...s }, i = { ...this.defaults, ...r }, o = this.onError(!!i.silent, !!i.async); if (this.defaults.async === true && r.async === false)
|
|
11812
|
+
return o(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.")); if (typeof n > "u" || n === null)
|
|
11813
|
+
return o(new Error("marked(): input parameter is undefined or null")); if (typeof n != "string")
|
|
11814
|
+
return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected")); if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async)
|
|
11815
|
+
return (async () => { let u = i.hooks ? await i.hooks.preprocess(n) : n, c = await (i.hooks ? await i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(u, i), p = i.hooks ? await i.hooks.processAllTokens(c) : c; i.walkTokens && await Promise.all(this.walkTokens(p, i.walkTokens)); let h = await (i.hooks ? await i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(p, i); return i.hooks ? await i.hooks.postprocess(h) : h; })().catch(o); try {
|
|
11816
|
+
i.hooks && (n = i.hooks.preprocess(n));
|
|
11817
|
+
let a = (i.hooks ? i.hooks.provideLexer(e) : e ? x.lex : x.lexInline)(n, i);
|
|
11818
|
+
i.hooks && (a = i.hooks.processAllTokens(a)), i.walkTokens && this.walkTokens(a, i.walkTokens);
|
|
11819
|
+
let p = (i.hooks ? i.hooks.provideParser(e) : e ? b.parse : b.parseInline)(a, i);
|
|
11820
|
+
return i.hooks && (p = i.hooks.postprocess(p)), p;
|
|
11821
|
+
}
|
|
11822
|
+
catch (u) {
|
|
11823
|
+
return o(u);
|
|
11824
|
+
} }; }
|
|
11825
|
+
onError(e, t) {
|
|
11826
|
+
return n => {
|
|
11827
|
+
if (n.message += `
|
|
11828
|
+
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
11829
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
11830
|
+
return t ? Promise.resolve(s) : s;
|
|
11831
|
+
}
|
|
11832
|
+
if (t)
|
|
11833
|
+
return Promise.reject(n);
|
|
11834
|
+
throw n;
|
|
11835
|
+
};
|
|
11836
|
+
}
|
|
11837
|
+
};
|
|
11838
|
+
var z = new q;
|
|
11839
|
+
function g(l, e) { return z.parse(l, e); }
|
|
11840
|
+
g.options = g.setOptions = function (l) { return z.setOptions(l), g.defaults = z.defaults, N(g.defaults), g; };
|
|
11841
|
+
g.getDefaults = M;
|
|
11842
|
+
g.defaults = T;
|
|
11843
|
+
g.use = function (...l) { return z.use(...l), g.defaults = z.defaults, N(g.defaults), g; };
|
|
11844
|
+
g.walkTokens = function (l, e) { return z.walkTokens(l, e); };
|
|
11845
|
+
g.parseInline = z.parseInline;
|
|
11846
|
+
g.Parser = b;
|
|
11847
|
+
g.parser = b.parse;
|
|
11848
|
+
g.Renderer = y;
|
|
11849
|
+
g.TextRenderer = L;
|
|
11850
|
+
g.Lexer = x;
|
|
11851
|
+
g.lexer = x.lex;
|
|
11852
|
+
g.Tokenizer = w;
|
|
11853
|
+
g.Hooks = P;
|
|
11854
|
+
g.parse = g;
|
|
11855
|
+
g.options; g.setOptions; g.use; g.walkTokens; g.parseInline; b.parse; x.lex;
|
|
11856
|
+
|
|
10593
11857
|
// Copyright 2013 The Chromium Authors
|
|
10594
11858
|
class BalancedJSONTokenizer {
|
|
10595
11859
|
callback;
|
|
@@ -10660,6 +11924,12 @@ class BalancedJSONTokenizer {
|
|
|
10660
11924
|
}
|
|
10661
11925
|
}
|
|
10662
11926
|
|
|
11927
|
+
// Copyright 2024 The Chromium Authors
|
|
11928
|
+
var Events;
|
|
11929
|
+
(function (Events) {
|
|
11930
|
+
Events["CHUNK_ADDED"] = "ChunkAdded";
|
|
11931
|
+
})(Events || (Events = {}));
|
|
11932
|
+
|
|
10663
11933
|
// Copyright 2012 The Chromium Authors
|
|
10664
11934
|
class HeapSnapshotLoader {
|
|
10665
11935
|
#progress;
|
|
@@ -10703,16 +11973,17 @@ class HeapSnapshotLoader {
|
|
|
10703
11973
|
this.#reset();
|
|
10704
11974
|
return result;
|
|
10705
11975
|
}
|
|
10706
|
-
#
|
|
11976
|
+
#parseIntArray() {
|
|
10707
11977
|
let index = 0;
|
|
10708
11978
|
const char0 = '0'.charCodeAt(0);
|
|
10709
11979
|
const char9 = '9'.charCodeAt(0);
|
|
11980
|
+
const minus = '-'.charCodeAt(0);
|
|
10710
11981
|
const closingBracket = ']'.charCodeAt(0);
|
|
10711
11982
|
const length = this.#json.length;
|
|
10712
11983
|
while (true) {
|
|
10713
11984
|
while (index < length) {
|
|
10714
11985
|
const code = this.#json.charCodeAt(index);
|
|
10715
|
-
if (char0 <= code && code <= char9) {
|
|
11986
|
+
if ((char0 <= code && code <= char9) || code === minus) {
|
|
10716
11987
|
break;
|
|
10717
11988
|
}
|
|
10718
11989
|
else if (code === closingBracket) {
|
|
@@ -10725,8 +11996,13 @@ class HeapSnapshotLoader {
|
|
|
10725
11996
|
this.#json = '';
|
|
10726
11997
|
return true;
|
|
10727
11998
|
}
|
|
10728
|
-
let nextNumber = 0;
|
|
10729
11999
|
const startIndex = index;
|
|
12000
|
+
let negative = false;
|
|
12001
|
+
if (this.#json.charCodeAt(index) === minus) {
|
|
12002
|
+
negative = true;
|
|
12003
|
+
++index;
|
|
12004
|
+
}
|
|
12005
|
+
let nextNumber = 0;
|
|
10730
12006
|
while (index < length) {
|
|
10731
12007
|
const code = this.#json.charCodeAt(index);
|
|
10732
12008
|
if (char0 > code || code > char9) {
|
|
@@ -10743,7 +12019,7 @@ class HeapSnapshotLoader {
|
|
|
10743
12019
|
if (!this.#array) {
|
|
10744
12020
|
throw new Error('Array not instantiated');
|
|
10745
12021
|
}
|
|
10746
|
-
this.#array.setValue(this.#arrayIndex++, nextNumber);
|
|
12022
|
+
this.#array.setValue(this.#arrayIndex++, negative ? -nextNumber : nextNumber);
|
|
10747
12023
|
}
|
|
10748
12024
|
}
|
|
10749
12025
|
#parseStringsArray() {
|
|
@@ -10801,7 +12077,7 @@ class HeapSnapshotLoader {
|
|
|
10801
12077
|
this.#array = length === undefined ? createExpandableBigUint32Array() :
|
|
10802
12078
|
createFixedBigUint32Array(length);
|
|
10803
12079
|
this.#arrayIndex = 0;
|
|
10804
|
-
while (this.#
|
|
12080
|
+
while (this.#parseIntArray()) {
|
|
10805
12081
|
if (length) {
|
|
10806
12082
|
this.#progress.updateProgress(title, this.#arrayIndex, this.#array.length);
|
|
10807
12083
|
}
|