@meridianlabs/log-viewer 0.3.282 → 0.3.284
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/lib/{AnsiDisplayRich-302CIkEj.js → AnsiDisplayRich-Dpc1-E4A.js} +31 -34
- package/lib/AnsiDisplayRich-Dpc1-E4A.js.map +1 -0
- package/lib/{AsciinemaPlayerImpl-BG5NPs0z.js → AsciinemaPlayerImpl-DrztGkXg.js} +40 -35
- package/lib/{AsciinemaPlayerImpl-BG5NPs0z.js.map → AsciinemaPlayerImpl-DrztGkXg.js.map} +1 -1
- package/lib/ToolButton-BGW3G4cu.js +374 -0
- package/lib/ToolButton-BGW3G4cu.js.map +1 -0
- package/lib/e2e/csp/csp.spec.d.ts +2 -0
- package/lib/e2e/csp/csp.spec.d.ts.map +1 -0
- package/lib/e2e/csp/cspLogs.d.ts +10 -0
- package/lib/e2e/csp/cspLogs.d.ts.map +1 -0
- package/lib/e2e/csp/media.d.ts +3 -0
- package/lib/e2e/csp/media.d.ts.map +1 -0
- package/lib/e2e/expandable-panel-nested-toggles.spec.d.ts +2 -0
- package/lib/e2e/expandable-panel-nested-toggles.spec.d.ts.map +1 -0
- package/lib/e2e/fixtures/app.d.ts +12 -1
- package/lib/e2e/fixtures/app.d.ts.map +1 -1
- package/lib/e2e/message-selection.spec.d.ts +2 -0
- package/lib/e2e/message-selection.spec.d.ts.map +1 -0
- package/lib/index.js +35328 -34927
- package/lib/index.js.map +1 -1
- package/lib/{markdownPipeline-C_z-iU9a.js → markdownPipeline-D23f-WkE.js} +456 -427
- package/lib/markdownPipeline-D23f-WkE.js.map +1 -0
- package/lib/{prismHighlighter-D-PZtkPX.js → prismHighlighter-7qrXrStR.js} +1 -2
- package/lib/{prismHighlighter-D-PZtkPX.js.map → prismHighlighter-7qrXrStR.js.map} +1 -1
- package/lib/src/app/App.d.ts.map +1 -1
- package/lib/src/app/AppProviders.d.ts +10 -0
- package/lib/src/app/AppProviders.d.ts.map +1 -0
- package/lib/src/app/log-list/LogsPanel.d.ts.map +1 -1
- package/lib/src/app/log-list/ViewerOptionsButton.d.ts +1 -0
- package/lib/src/app/log-list/ViewerOptionsButton.d.ts.map +1 -1
- package/lib/src/app/log-list/ViewerOptionsPopover.d.ts +1 -0
- package/lib/src/app/log-list/ViewerOptionsPopover.d.ts.map +1 -1
- package/lib/src/app/log-list/grid/columns/hooks.d.ts.map +1 -1
- package/lib/src/app/log-view/error/TaskErrorPanel.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/InfoTab.d.ts +1 -1
- package/lib/src/app/log-view/tabs/JsonTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/ModelsTab.d.ts +1 -1
- package/lib/src/app/log-view/tabs/SamplesTab.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/HistoryList.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineChart.d.ts.map +1 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts +1 -1
- package/lib/src/app/log-view/tabs/timeline/TimelineTab.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/CollapsedTitleBar.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/EditAnnotationsDialog.d.ts +22 -0
- package/lib/src/app/log-view/title-view/EditAnnotationsDialog.d.ts.map +1 -0
- package/lib/src/app/log-view/title-view/EditMetadataDialog.d.ts +3 -3
- package/lib/src/app/log-view/title-view/EditMetadataDialog.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/EditTagsDialog.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/RunningStatusPanel.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/ScoreGrid.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/StatusPanel.d.ts +2 -1
- package/lib/src/app/log-view/title-view/StatusPanel.d.ts.map +1 -1
- package/lib/src/app/log-view/title-view/renderEditDialog.d.ts +12 -0
- package/lib/src/app/log-view/title-view/renderEditDialog.d.ts.map +1 -0
- package/lib/src/app/navbar/ApplicationNavbar.d.ts +3 -0
- package/lib/src/app/navbar/ApplicationNavbar.d.ts.map +1 -1
- package/lib/src/app/navbar/Navbar.d.ts.map +1 -1
- package/lib/src/app/navbar/NavbarButton.d.ts +2 -1
- package/lib/src/app/navbar/NavbarButton.d.ts.map +1 -1
- package/lib/src/app/navbar/ViewSegmentedControl.d.ts.map +1 -1
- package/lib/src/app/plan/DetailStep.d.ts +2 -1
- package/lib/src/app/plan/DetailStep.d.ts.map +1 -1
- package/lib/src/app/plan/ScorerDetailView.d.ts.map +1 -1
- package/lib/src/app/plan/SolverDetailView.d.ts.map +1 -1
- package/lib/src/app/routing/url.d.ts +8 -3
- package/lib/src/app/routing/url.d.ts.map +1 -1
- package/lib/src/app/samples/InlineSampleDisplay.d.ts.map +1 -1
- package/lib/src/app/samples/SampleDisplay.d.ts.map +1 -1
- package/lib/src/app/samples/SampleRetriedErrors.d.ts.map +1 -1
- package/lib/src/app/samples/SamplesTools.d.ts.map +1 -1
- package/lib/src/app/samples/StoreTerminalSessions.d.ts +20 -0
- package/lib/src/app/samples/StoreTerminalSessions.d.ts.map +1 -0
- package/lib/src/app/samples/error/SampleErrorView.d.ts.map +1 -1
- package/lib/src/app/samples/event/SampleEventView.d.ts.map +1 -1
- package/lib/src/app/samples/header-v2/ScorePanel.d.ts.map +1 -1
- package/lib/src/app/samples/list/samplesView.d.ts +1 -1
- package/lib/src/app/samples/print/SamplePrintView.d.ts +3 -1
- package/lib/src/app/samples/print/SamplePrintView.d.ts.map +1 -1
- package/lib/src/app/samples/retry-display/RetryAttemptCard.d.ts.map +1 -1
- package/lib/src/app/samples/retry-display/RetryTerminalAnchor.d.ts.map +1 -1
- package/lib/src/app/samples/sample-tools/SelectScorer.d.ts.map +1 -1
- package/lib/src/app/samples/sample-tools/sample-filter/SampleFilter.d.ts.map +1 -1
- package/lib/src/app/samples/scans/ScansSidebarPanel.d.ts.map +1 -1
- package/lib/src/app/samples/status/status.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/TranscriptPanel.d.ts +4 -2
- package/lib/src/app/samples/transcript/TranscriptPanel.d.ts.map +1 -1
- package/lib/src/app/samples/transcript/search/SearchScoutUnavailable.d.ts.map +1 -1
- package/lib/src/app/samples/useEvidenceSelection.d.ts +56 -0
- package/lib/src/app/samples/useEvidenceSelection.d.ts.map +1 -0
- package/lib/src/app/samples-panel/SamplesPanel.d.ts.map +1 -1
- package/lib/src/app/server/useUserInfo.d.ts +12 -0
- package/lib/src/app/server/useUserInfo.d.ts.map +1 -0
- package/lib/src/app/shared/ColumnSelectorPopover.d.ts.map +1 -1
- package/lib/src/app/shared/contentTrust.d.ts +1 -5
- package/lib/src/app/shared/contentTrust.d.ts.map +1 -1
- package/lib/src/app/shared/data-grid/DataGrid.d.ts +1 -2
- package/lib/src/app/shared/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/src/app/types.d.ts +2 -2
- package/lib/src/app/types.d.ts.map +1 -1
- package/lib/src/app_config/LogLocationGate.d.ts +6 -5
- package/lib/src/app_config/LogLocationGate.d.ts.map +1 -1
- package/lib/src/app_config/appConfig.d.ts +1 -2
- package/lib/src/app_config/appConfig.d.ts.map +1 -1
- package/lib/src/app_config/logLocationTrust.d.ts +5 -4
- package/lib/src/app_config/logLocationTrust.d.ts.map +1 -1
- package/lib/src/app_config/resolveBackend.d.ts +3 -3
- package/lib/src/app_config/resolveBackend.d.ts.map +1 -1
- package/lib/src/client/api/client-api.d.ts.map +1 -1
- package/lib/src/client/api/shared/api-shared.d.ts.map +1 -1
- package/lib/src/client/api/testClientApi.d.ts +2 -1
- package/lib/src/client/api/testClientApi.d.ts.map +1 -1
- package/lib/src/client/api/types.d.ts +2 -5
- package/lib/src/client/api/types.d.ts.map +1 -1
- package/lib/src/client/api/vscode/testExtensionHost.d.ts +28 -0
- package/lib/src/client/api/vscode/testExtensionHost.d.ts.map +1 -0
- package/lib/src/client/database/schema.d.ts.map +1 -1
- package/lib/src/client/json-parse.worker.d.ts +2 -0
- package/lib/src/client/json-parse.worker.d.ts.map +1 -0
- package/lib/src/client/jsonParseWorker.d.ts +2 -0
- package/lib/src/client/jsonParseWorker.d.ts.map +1 -0
- package/lib/src/client/remote/{zstd-worker.d.ts → decompression-worker.d.ts} +15 -8
- package/lib/src/client/remote/decompression-worker.d.ts.map +1 -0
- package/lib/src/client/remote/decompression.d.ts.map +1 -1
- package/lib/src/client/remote/decompression.worker.d.ts +2 -0
- package/lib/src/client/remote/decompression.worker.d.ts.map +1 -0
- package/lib/src/client/remote/inflate.d.ts +11 -0
- package/lib/src/client/remote/inflate.d.ts.map +1 -0
- package/lib/src/client/remote/zstd-decoder.d.ts.map +1 -1
- package/lib/src/client/utils/derive.d.ts.map +1 -1
- package/lib/src/components/DownloadLogButton.d.ts.map +1 -1
- package/lib/src/components/LinkButton.d.ts +2 -1
- package/lib/src/components/LinkButton.d.ts.map +1 -1
- package/lib/src/components/MessageBand.d.ts.map +1 -1
- package/lib/src/index.d.ts +0 -9
- package/lib/src/index.d.ts.map +1 -1
- package/lib/src/log_data/databaseInstance.d.ts +7 -0
- package/lib/src/log_data/databaseInstance.d.ts.map +1 -1
- package/lib/src/log_data/databaseListings.d.ts +3 -1
- package/lib/src/log_data/databaseListings.d.ts.map +1 -1
- package/lib/src/log_data/fetchEngine.d.ts +4 -0
- package/lib/src/log_data/fetchEngine.d.ts.map +1 -1
- package/lib/src/log_data/imperativeLogData.d.ts +1 -1
- package/lib/src/log_data/index.d.ts +3 -1
- package/lib/src/log_data/index.d.ts.map +1 -1
- package/lib/src/log_data/runningSampleQuery.d.ts +4 -1
- package/lib/src/log_data/runningSampleQuery.d.ts.map +1 -1
- package/lib/src/log_data/samplesListing.d.ts +1 -2
- package/lib/src/log_data/samplesListing.d.ts.map +1 -1
- package/lib/src/log_data/testFixtures.d.ts +1 -1
- package/lib/src/log_data/testFixtures.d.ts.map +1 -1
- package/lib/src/log_data/useFetchEngineStatus.d.ts +5 -1
- package/lib/src/log_data/useFetchEngineStatus.d.ts.map +1 -1
- package/lib/src/log_data/useLogsSync.d.ts +7 -1
- package/lib/src/log_data/useLogsSync.d.ts.map +1 -1
- package/lib/src/main.d.ts +0 -1
- package/lib/src/main.d.ts.map +1 -1
- package/lib/src/scoring/headline.d.ts.map +1 -1
- package/lib/src/state/hooks.d.ts.map +1 -1
- package/lib/src/state/sampleSlice.d.ts +6 -6
- package/lib/src/state/sampleSlice.d.ts.map +1 -1
- package/lib/src/test/mswServer.d.ts +9 -0
- package/lib/src/test/mswServer.d.ts.map +1 -0
- package/lib/src/test/nodeWorker.d.ts +2 -0
- package/lib/src/test/nodeWorker.d.ts.map +1 -0
- package/lib/src/test/testApp.d.ts +36 -0
- package/lib/src/test/testApp.d.ts.map +1 -0
- package/lib/styles/index.css +12654 -12529
- package/package.json +20 -20
- package/lib/AnsiDisplayRich-302CIkEj.js.map +0 -1
- package/lib/ToolButton-BmBvTvKO.js +0 -124
- package/lib/ToolButton-BmBvTvKO.js.map +0 -1
- package/lib/markdownPipeline-C_z-iU9a.js.map +0 -1
- package/lib/src/app/appearance/colors.d.ts +0 -10
- package/lib/src/app/appearance/colors.d.ts.map +0 -1
- package/lib/src/app/appearance/icons.d.ts +0 -148
- package/lib/src/app/appearance/icons.d.ts.map +0 -1
- package/lib/src/app/log-view/title-view/ProvenanceFields.d.ts +0 -11
- package/lib/src/app/log-view/title-view/ProvenanceFields.d.ts.map +0 -1
- package/lib/src/app/samples/error/FlatSampleErrorView.d.ts +0 -10
- package/lib/src/app/samples/error/FlatSampleErrorView.d.ts.map +0 -1
- package/lib/src/app/samples/sampleDataAdapter.d.ts +0 -7
- package/lib/src/app/samples/sampleDataAdapter.d.ts.map +0 -1
- package/lib/src/app/samples/transcript/types.d.ts +0 -9
- package/lib/src/app/samples/transcript/types.d.ts.map +0 -1
- package/lib/src/app/shared/openInNewTab.d.ts +0 -13
- package/lib/src/app/shared/openInNewTab.d.ts.map +0 -1
- package/lib/src/client/database/utils.d.ts +0 -3
- package/lib/src/client/database/utils.d.ts.map +0 -1
- package/lib/src/client/remote/zstd-worker-code.d.ts +0 -20
- package/lib/src/client/remote/zstd-worker-code.d.ts.map +0 -1
- package/lib/src/client/remote/zstd-worker.d.ts.map +0 -1
- package/lib/src/components/CodePanel.d.ts +0 -8
- package/lib/src/components/CodePanel.d.ts.map +0 -1
- package/lib/src/test/nodeBlobWorker.d.ts +0 -2
- package/lib/src/test/nodeBlobWorker.d.ts.map +0 -1
- package/lib/src/utils/debugging.d.ts +0 -3
- package/lib/src/utils/debugging.d.ts.map +0 -1
- package/lib/src-s8Cexy_j.js +0 -9977
- package/lib/src-s8Cexy_j.js.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { n as __exportAll$1 } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
|
-
import "./src-s8Cexy_j.js";
|
|
3
2
|
import { d as parseDataUri, n as escapeHtmlCharacters, o as canonicalImageSource, r as simpleMarkdownTruncate, t as defaultMarkdownRenderer, u as parseAbsoluteHttpUrl } from "./markdownText-z5R6PHwt.js";
|
|
4
3
|
//#region ../../node_modules/.pnpm/mdurl@2.1.0/node_modules/mdurl/lib/decode.mjs
|
|
5
4
|
var decodeCache = {};
|
|
@@ -1743,8 +1742,8 @@ var punycode = {
|
|
|
1743
1742
|
"toUnicode": toUnicode
|
|
1744
1743
|
};
|
|
1745
1744
|
//#endregion
|
|
1746
|
-
//#region ../../node_modules/.pnpm/markdown-it@15.0.
|
|
1747
|
-
/*! markdown-it 15.0.
|
|
1745
|
+
//#region ../../node_modules/.pnpm/markdown-it@15.0.3/node_modules/markdown-it/dist/markdown-it.mjs
|
|
1746
|
+
/*! markdown-it 15.0.3 https://github.com/markdown-it/markdown-it @license MIT */
|
|
1748
1747
|
var __defProp = Object.defineProperty;
|
|
1749
1748
|
var __exportAll = (all, no_symbols) => {
|
|
1750
1749
|
let target = {};
|
|
@@ -3106,12 +3105,14 @@ var StateBlock = class {
|
|
|
3106
3105
|
const s = this.src;
|
|
3107
3106
|
for (let start = 0, pos = 0, indent = 0, offset = 0, len = s.length, indent_found = false; pos < len; pos++) {
|
|
3108
3107
|
const ch = s.charCodeAt(pos);
|
|
3109
|
-
if (!indent_found)
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3108
|
+
if (!indent_found) {
|
|
3109
|
+
if (isSpace(ch)) {
|
|
3110
|
+
indent++;
|
|
3111
|
+
if (ch === 9) offset += 4 - offset % 4;
|
|
3112
|
+
else offset++;
|
|
3113
|
+
continue;
|
|
3114
|
+
} else indent_found = true;
|
|
3115
|
+
}
|
|
3115
3116
|
if (ch === 10 || pos === len - 1) {
|
|
3116
3117
|
if (ch !== 10) pos++;
|
|
3117
3118
|
this.bMarks.push(start);
|
|
@@ -3178,9 +3179,10 @@ var StateBlock = class {
|
|
|
3178
3179
|
else last = this.eMarks[line];
|
|
3179
3180
|
while (first < last && lineIndent < indent) {
|
|
3180
3181
|
const ch = this.src.charCodeAt(first);
|
|
3181
|
-
if (isSpace(ch))
|
|
3182
|
-
|
|
3183
|
-
|
|
3182
|
+
if (isSpace(ch)) {
|
|
3183
|
+
if (ch === 9) lineIndent += 4 - (lineIndent + this.bsCount[line]) % 4;
|
|
3184
|
+
else lineIndent++;
|
|
3185
|
+
} else if (first - lineStart < this.tShift[line]) lineIndent++;
|
|
3184
3186
|
else break;
|
|
3185
3187
|
first++;
|
|
3186
3188
|
}
|
|
@@ -3205,13 +3207,15 @@ function escapedSplit(str) {
|
|
|
3205
3207
|
let lastPos = 0;
|
|
3206
3208
|
let current = "";
|
|
3207
3209
|
while (pos < max) {
|
|
3208
|
-
if (ch === 124)
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3210
|
+
if (ch === 124) {
|
|
3211
|
+
if (!isEscaped) {
|
|
3212
|
+
result.push(current + str.substring(lastPos, pos));
|
|
3213
|
+
current = "";
|
|
3214
|
+
lastPos = pos + 1;
|
|
3215
|
+
} else {
|
|
3216
|
+
current += str.substring(lastPos, pos - 1);
|
|
3217
|
+
lastPos = pos;
|
|
3218
|
+
}
|
|
3215
3219
|
}
|
|
3216
3220
|
isEscaped = ch === 92;
|
|
3217
3221
|
pos++;
|
|
@@ -3243,8 +3247,10 @@ function table(state, startLine, endLine, silent) {
|
|
|
3243
3247
|
const aligns = [];
|
|
3244
3248
|
for (let i = 0; i < columns.length; i++) {
|
|
3245
3249
|
const t = columns[i].trim();
|
|
3246
|
-
if (!t)
|
|
3247
|
-
|
|
3250
|
+
if (!t) {
|
|
3251
|
+
if (i === 0 || i === columns.length - 1) continue;
|
|
3252
|
+
else return false;
|
|
3253
|
+
}
|
|
3248
3254
|
if (!/^:?-+:?$/.test(t)) return false;
|
|
3249
3255
|
if (t.charCodeAt(t.length - 1) === 58) aligns.push(t.charCodeAt(0) === 58 ? "center" : "right");
|
|
3250
3256
|
else if (t.charCodeAt(0) === 58) aligns.push("left");
|
|
@@ -3431,9 +3437,10 @@ function blockquote(state, startLine, endLine, silent) {
|
|
|
3431
3437
|
state.bMarks[nextLine] = pos;
|
|
3432
3438
|
while (pos < max) {
|
|
3433
3439
|
const ch = state.src.charCodeAt(pos);
|
|
3434
|
-
if (isSpace(ch))
|
|
3435
|
-
|
|
3436
|
-
|
|
3440
|
+
if (isSpace(ch)) {
|
|
3441
|
+
if (ch === 9) offset += 4 - (offset + state.bsCount[nextLine] + (adjustTab ? 1 : 0)) % 4;
|
|
3442
|
+
else offset++;
|
|
3443
|
+
} else break;
|
|
3437
3444
|
pos++;
|
|
3438
3445
|
}
|
|
3439
3446
|
lastLineEmpty = pos >= max;
|
|
@@ -3660,129 +3667,141 @@ function list(state, startLine, endLine, silent) {
|
|
|
3660
3667
|
if (tight) markTightParagraphs(state, listTokIdx);
|
|
3661
3668
|
return true;
|
|
3662
3669
|
}
|
|
3670
|
+
var MAX_LABEL_LENGTH = 999;
|
|
3671
|
+
function countCodePoints(str) {
|
|
3672
|
+
let length = str.length;
|
|
3673
|
+
for (let i = 0; i < str.length - 1; i++) {
|
|
3674
|
+
const high = str.charCodeAt(i);
|
|
3675
|
+
if (high < 55296 || high > 56319) continue;
|
|
3676
|
+
const low = str.charCodeAt(i + 1);
|
|
3677
|
+
if (low >= 56320 && low <= 57343) {
|
|
3678
|
+
length--;
|
|
3679
|
+
i++;
|
|
3680
|
+
}
|
|
3681
|
+
}
|
|
3682
|
+
return length;
|
|
3683
|
+
}
|
|
3684
|
+
function lineEnd(state, line) {
|
|
3685
|
+
return Math.min(state.eMarks[line] + 1, state.src.length);
|
|
3686
|
+
}
|
|
3687
|
+
function getNextLinePos(state, nextLine) {
|
|
3688
|
+
const endLine = state.lineMax;
|
|
3689
|
+
if (nextLine >= endLine || state.isEmpty(nextLine)) return -1;
|
|
3690
|
+
let isContinuation = false;
|
|
3691
|
+
if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
|
|
3692
|
+
if (state.sCount[nextLine] < 0) isContinuation = true;
|
|
3693
|
+
if (!isContinuation) {
|
|
3694
|
+
const terminatorRules = state.md.block.ruler.getRules("reference");
|
|
3695
|
+
const oldParentType = state.parentType;
|
|
3696
|
+
state.parentType = "reference";
|
|
3697
|
+
let terminate = false;
|
|
3698
|
+
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
3699
|
+
terminate = true;
|
|
3700
|
+
break;
|
|
3701
|
+
}
|
|
3702
|
+
state.parentType = oldParentType;
|
|
3703
|
+
if (terminate) return -1;
|
|
3704
|
+
}
|
|
3705
|
+
return state.bMarks[nextLine] + state.tShift[nextLine];
|
|
3706
|
+
}
|
|
3663
3707
|
function reference(state, startLine, _endLine, silent) {
|
|
3708
|
+
const src = state.src;
|
|
3664
3709
|
let pos = state.bMarks[startLine] + state.tShift[startLine];
|
|
3665
|
-
let max = state.eMarks[startLine];
|
|
3666
3710
|
let nextLine = startLine + 1;
|
|
3667
3711
|
if (state.sCount[startLine] - state.blkIndent >= 4) return false;
|
|
3668
|
-
if (
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
if (nextLine >= endLine || state.isEmpty(nextLine)) return null;
|
|
3672
|
-
let isContinuation = false;
|
|
3673
|
-
if (state.sCount[nextLine] - state.blkIndent > 3) isContinuation = true;
|
|
3674
|
-
if (state.sCount[nextLine] < 0) isContinuation = true;
|
|
3675
|
-
if (!isContinuation) {
|
|
3676
|
-
const terminatorRules = state.md.block.ruler.getRules("reference");
|
|
3677
|
-
const oldParentType = state.parentType;
|
|
3678
|
-
state.parentType = "reference";
|
|
3679
|
-
let terminate = false;
|
|
3680
|
-
for (let i = 0, l = terminatorRules.length; i < l; i++) if (terminatorRules[i](state, nextLine, endLine, true)) {
|
|
3681
|
-
terminate = true;
|
|
3682
|
-
break;
|
|
3683
|
-
}
|
|
3684
|
-
state.parentType = oldParentType;
|
|
3685
|
-
if (terminate) return null;
|
|
3686
|
-
}
|
|
3687
|
-
const pos = state.bMarks[nextLine] + state.tShift[nextLine];
|
|
3688
|
-
const max = state.eMarks[nextLine];
|
|
3689
|
-
return state.src.slice(pos, max + 1);
|
|
3690
|
-
}
|
|
3691
|
-
let str = state.src.slice(pos, max + 1);
|
|
3692
|
-
max = str.length;
|
|
3712
|
+
if (src.charCodeAt(pos) !== 91) return false;
|
|
3713
|
+
let max = lineEnd(state, startLine);
|
|
3714
|
+
let rawLabel = "";
|
|
3693
3715
|
let labelEnd = -1;
|
|
3694
|
-
|
|
3695
|
-
|
|
3716
|
+
let segmentStart = ++pos;
|
|
3717
|
+
while (pos < max) {
|
|
3718
|
+
if (rawLabel.length + pos - segmentStart > MAX_LABEL_LENGTH * 2) return false;
|
|
3719
|
+
let ch = src.charCodeAt(pos);
|
|
3696
3720
|
if (ch === 91) return false;
|
|
3697
|
-
|
|
3721
|
+
if (ch === 93) {
|
|
3698
3722
|
labelEnd = pos;
|
|
3699
3723
|
break;
|
|
3700
|
-
} else if (ch === 10) {
|
|
3701
|
-
const lineContent = getNextLine(nextLine);
|
|
3702
|
-
if (lineContent !== null) {
|
|
3703
|
-
str += lineContent;
|
|
3704
|
-
max = str.length;
|
|
3705
|
-
nextLine++;
|
|
3706
|
-
}
|
|
3707
|
-
} else if (ch === 92) {
|
|
3708
|
-
pos++;
|
|
3709
|
-
if (pos < max && str.charCodeAt(pos) === 10) {
|
|
3710
|
-
const lineContent = getNextLine(nextLine);
|
|
3711
|
-
if (lineContent !== null) {
|
|
3712
|
-
str += lineContent;
|
|
3713
|
-
max = str.length;
|
|
3714
|
-
nextLine++;
|
|
3715
|
-
}
|
|
3716
|
-
}
|
|
3717
3724
|
}
|
|
3725
|
+
if (ch === 92) ch = src.charCodeAt(++pos);
|
|
3726
|
+
if (ch === 10 && pos < max) {
|
|
3727
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
3728
|
+
if (nextPos < 0) return false;
|
|
3729
|
+
rawLabel += src.slice(segmentStart, max);
|
|
3730
|
+
pos = segmentStart = nextPos;
|
|
3731
|
+
max = lineEnd(state, nextLine++);
|
|
3732
|
+
continue;
|
|
3733
|
+
}
|
|
3734
|
+
pos++;
|
|
3718
3735
|
}
|
|
3719
|
-
if (labelEnd < 0 ||
|
|
3720
|
-
|
|
3721
|
-
|
|
3736
|
+
if (labelEnd < 0 || src.charCodeAt(labelEnd + 1) !== 58) return false;
|
|
3737
|
+
rawLabel += src.slice(segmentStart, labelEnd);
|
|
3738
|
+
if (rawLabel.length > MAX_LABEL_LENGTH && countCodePoints(rawLabel) > MAX_LABEL_LENGTH) return false;
|
|
3739
|
+
pos = labelEnd + 2;
|
|
3740
|
+
while (pos < max) {
|
|
3741
|
+
const ch = src.charCodeAt(pos);
|
|
3722
3742
|
if (ch === 10) {
|
|
3723
|
-
const
|
|
3724
|
-
if (
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
const destRes = state.md.helpers.parseLinkDestination(str, pos, max);
|
|
3743
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
3744
|
+
if (nextPos < 0) break;
|
|
3745
|
+
pos = nextPos;
|
|
3746
|
+
max = lineEnd(state, nextLine++);
|
|
3747
|
+
} else if (isSpace(ch)) pos++;
|
|
3748
|
+
else break;
|
|
3749
|
+
}
|
|
3750
|
+
const destRes = state.md.helpers.parseLinkDestination(src, pos, max);
|
|
3732
3751
|
if (!destRes.ok) return false;
|
|
3733
3752
|
const href = state.md.normalizeLink(destRes.str);
|
|
3734
3753
|
if (!state.md.validateLink(href)) return false;
|
|
3735
3754
|
pos = destRes.pos;
|
|
3736
3755
|
const destEndPos = pos;
|
|
3756
|
+
const destEndMax = max;
|
|
3737
3757
|
const destEndLineNo = nextLine;
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
const ch = str.charCodeAt(pos);
|
|
3758
|
+
while (pos < max) {
|
|
3759
|
+
const ch = src.charCodeAt(pos);
|
|
3741
3760
|
if (ch === 10) {
|
|
3742
|
-
const
|
|
3743
|
-
if (
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
let titleRes = state.md.helpers.parseLinkTitle(
|
|
3761
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
3762
|
+
if (nextPos < 0) break;
|
|
3763
|
+
pos = nextPos;
|
|
3764
|
+
max = lineEnd(state, nextLine++);
|
|
3765
|
+
} else if (isSpace(ch)) pos++;
|
|
3766
|
+
else break;
|
|
3767
|
+
}
|
|
3768
|
+
const titleStart = pos;
|
|
3769
|
+
let titleRes = state.md.helpers.parseLinkTitle(src, pos, max);
|
|
3751
3770
|
while (titleRes.can_continue) {
|
|
3752
|
-
const
|
|
3753
|
-
if (
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
nextLine++;
|
|
3758
|
-
titleRes = state.md.helpers.parseLinkTitle(str, pos, max, titleRes);
|
|
3771
|
+
const nextPos = getNextLinePos(state, nextLine);
|
|
3772
|
+
if (nextPos < 0) break;
|
|
3773
|
+
pos = nextPos;
|
|
3774
|
+
max = lineEnd(state, nextLine++);
|
|
3775
|
+
titleRes = state.md.helpers.parseLinkTitle(src, pos, max, titleRes);
|
|
3759
3776
|
}
|
|
3760
3777
|
let title;
|
|
3761
|
-
if (
|
|
3778
|
+
if (titleStart !== destEndPos && titleRes.ok) {
|
|
3762
3779
|
title = titleRes.str;
|
|
3763
3780
|
pos = titleRes.pos;
|
|
3764
3781
|
} else {
|
|
3765
3782
|
title = "";
|
|
3766
3783
|
pos = destEndPos;
|
|
3784
|
+
max = destEndMax;
|
|
3767
3785
|
nextLine = destEndLineNo;
|
|
3768
3786
|
}
|
|
3769
3787
|
while (pos < max) {
|
|
3770
|
-
if (!isSpace(
|
|
3788
|
+
if (!isSpace(src.charCodeAt(pos))) break;
|
|
3771
3789
|
pos++;
|
|
3772
3790
|
}
|
|
3773
|
-
if (pos < max &&
|
|
3791
|
+
if (pos < max && src.charCodeAt(pos) !== 10) {
|
|
3774
3792
|
if (title) {
|
|
3775
3793
|
title = "";
|
|
3776
3794
|
pos = destEndPos;
|
|
3795
|
+
max = destEndMax;
|
|
3777
3796
|
nextLine = destEndLineNo;
|
|
3778
3797
|
while (pos < max) {
|
|
3779
|
-
if (!isSpace(
|
|
3798
|
+
if (!isSpace(src.charCodeAt(pos))) break;
|
|
3780
3799
|
pos++;
|
|
3781
3800
|
}
|
|
3782
3801
|
}
|
|
3783
3802
|
}
|
|
3784
|
-
if (pos < max &&
|
|
3785
|
-
const label = normalizeReference(
|
|
3803
|
+
if (pos < max && src.charCodeAt(pos) !== 10) return false;
|
|
3804
|
+
const label = normalizeReference(rawLabel);
|
|
3786
3805
|
if (!label) return false;
|
|
3787
3806
|
/* istanbul ignore if */
|
|
3788
3807
|
if (silent) return true;
|
|
@@ -3866,7 +3885,7 @@ var html_blocks_default = [
|
|
|
3866
3885
|
];
|
|
3867
3886
|
var open_tag = `<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`;
|
|
3868
3887
|
var close_tag = "<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";
|
|
3869
|
-
|
|
3888
|
+
new RegExp(`^(?:${open_tag}|${close_tag}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);
|
|
3870
3889
|
var HTML_OPEN_CLOSE_TAG_RE = new RegExp(`^(?:${open_tag}|${close_tag})`);
|
|
3871
3890
|
var HTML_SEQUENCES = [
|
|
3872
3891
|
[
|
|
@@ -4180,6 +4199,7 @@ var StateInline = class {
|
|
|
4180
4199
|
_defineProperty(this, "cache", {});
|
|
4181
4200
|
_defineProperty(this, "backticks", {});
|
|
4182
4201
|
_defineProperty(this, "backticksScanned", false);
|
|
4202
|
+
_defineProperty(this, "skipHtmlSpecial", false);
|
|
4183
4203
|
_defineProperty(this, "linkLevel", 0);
|
|
4184
4204
|
_defineProperty(this, "delimiters", []);
|
|
4185
4205
|
_defineProperty(this, "_prev_delimiters", []);
|
|
@@ -4340,16 +4360,19 @@ function newline(state, silent) {
|
|
|
4340
4360
|
if (state.src.charCodeAt(pos) !== 10) return false;
|
|
4341
4361
|
const pmax = state.pending.length - 1;
|
|
4342
4362
|
const max = state.posMax;
|
|
4343
|
-
if (!silent)
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4363
|
+
if (!silent) {
|
|
4364
|
+
if (pmax >= 0 && state.pending.charCodeAt(pmax) === 32) {
|
|
4365
|
+
if (pmax >= 1 && state.pending.charCodeAt(pmax - 1) === 32) {
|
|
4366
|
+
let ws = pmax - 1;
|
|
4367
|
+
while (ws >= 1 && state.pending.charCodeAt(ws - 1) === 32) ws--;
|
|
4368
|
+
state.pending = state.pending.slice(0, ws);
|
|
4369
|
+
state.push("hardbreak", "br", 0);
|
|
4370
|
+
} else {
|
|
4371
|
+
state.pending = state.pending.slice(0, -1);
|
|
4372
|
+
state.push("softbreak", "br", 0);
|
|
4373
|
+
}
|
|
4374
|
+
} else state.push("softbreak", "br", 0);
|
|
4351
4375
|
}
|
|
4352
|
-
else state.push("softbreak", "br", 0);
|
|
4353
4376
|
pos++;
|
|
4354
4377
|
while (pos < max && isSpace(state.src.charCodeAt(pos))) pos++;
|
|
4355
4378
|
state.pos = pos;
|
|
@@ -4822,22 +4845,53 @@ function isLetter(ch) {
|
|
|
4822
4845
|
const lc = ch | 32;
|
|
4823
4846
|
return lc >= 97 && lc <= 122;
|
|
4824
4847
|
}
|
|
4848
|
+
function scanSpecial(state, pos) {
|
|
4849
|
+
const src = state.src;
|
|
4850
|
+
let start;
|
|
4851
|
+
let terminator;
|
|
4852
|
+
if (src.startsWith("<!--", pos)) {
|
|
4853
|
+
if (src.startsWith(">", pos + 4)) return pos + 5;
|
|
4854
|
+
if (src.startsWith("->", pos + 4)) return pos + 6;
|
|
4855
|
+
start = pos + 4;
|
|
4856
|
+
terminator = "-->";
|
|
4857
|
+
} else if (src.startsWith("<![CDATA[", pos)) {
|
|
4858
|
+
start = pos + 9;
|
|
4859
|
+
terminator = "]]>";
|
|
4860
|
+
} else if (src.charCodeAt(pos + 1) === 63) {
|
|
4861
|
+
start = pos + 2;
|
|
4862
|
+
terminator = "?>";
|
|
4863
|
+
} else if (isLetter(src.charCodeAt(pos + 2))) {
|
|
4864
|
+
start = pos + 3;
|
|
4865
|
+
terminator = ">";
|
|
4866
|
+
} else return -1;
|
|
4867
|
+
if (state.skipHtmlSpecial) return -1;
|
|
4868
|
+
const end = src.indexOf(terminator, start);
|
|
4869
|
+
if (end < 0) {
|
|
4870
|
+
state.skipHtmlSpecial = true;
|
|
4871
|
+
return -1;
|
|
4872
|
+
}
|
|
4873
|
+
return end + terminator.length;
|
|
4874
|
+
}
|
|
4825
4875
|
function html_inline(state, silent) {
|
|
4826
4876
|
if (!state.md.options.html) return false;
|
|
4827
4877
|
const max = state.posMax;
|
|
4828
4878
|
const pos = state.pos;
|
|
4829
4879
|
if (state.src.charCodeAt(pos) !== 60 || pos + 2 >= max) return false;
|
|
4880
|
+
let end;
|
|
4830
4881
|
const ch = state.src.charCodeAt(pos + 1);
|
|
4831
|
-
if (ch
|
|
4832
|
-
|
|
4833
|
-
|
|
4882
|
+
if (ch === 33 || ch === 63) end = scanSpecial(state, pos);
|
|
4883
|
+
else if (ch === 47 || isLetter(ch)) {
|
|
4884
|
+
const match = state.src.slice(pos).match(HTML_OPEN_CLOSE_TAG_RE);
|
|
4885
|
+
end = match ? pos + match[0].length : -1;
|
|
4886
|
+
} else return false;
|
|
4887
|
+
if (end < 0) return false;
|
|
4834
4888
|
if (!silent) {
|
|
4835
4889
|
const token = state.push("html_inline", "", 0);
|
|
4836
|
-
token.content =
|
|
4890
|
+
token.content = state.src.slice(pos, end);
|
|
4837
4891
|
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
4838
4892
|
if (isLinkClose(token.content)) state.linkLevel--;
|
|
4839
4893
|
}
|
|
4840
|
-
state.pos
|
|
4894
|
+
state.pos = end;
|
|
4841
4895
|
return true;
|
|
4842
4896
|
}
|
|
4843
4897
|
var DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
|
|
@@ -5520,6 +5574,8 @@ var getMathjaxPlugin = () => {
|
|
|
5520
5574
|
}
|
|
5521
5575
|
return mathjaxPluginPromise;
|
|
5522
5576
|
};
|
|
5577
|
+
var MATHJAX_STYLE = /^(\s*<span id="mjx-[a-f0-9]+">\s*)<style>[\s\S]*?<\/style>/i;
|
|
5578
|
+
var withoutMathJaxStyle = (html) => html.replace(MATHJAX_STYLE, "$1");
|
|
5523
5579
|
var hasMathContent = (text) => text.includes("$") || text.includes("\\(") || text.includes("\\[");
|
|
5524
5580
|
var mdInstanceCache = {};
|
|
5525
5581
|
/** Unescape HTML entities within math token content before MathJax processing.
|
|
@@ -5570,12 +5626,12 @@ var getMarkdownInstance = async (renderer, contentHasMath) => {
|
|
|
5570
5626
|
if (origInline) md.renderer.rules.math_inline = (tokens, idx, options, env, self) => {
|
|
5571
5627
|
const token = tokens[idx];
|
|
5572
5628
|
if (token) token.content = unescapeHtmlForMath(token.content);
|
|
5573
|
-
return origInline(tokens, idx, options, env, self);
|
|
5629
|
+
return withoutMathJaxStyle(origInline(tokens, idx, options, env, self));
|
|
5574
5630
|
};
|
|
5575
5631
|
if (origBlock) md.renderer.rules.math_block = (tokens, idx, options, env, self) => {
|
|
5576
5632
|
const token = tokens[idx];
|
|
5577
5633
|
if (token) token.content = unescapeHtmlForMath(token.content);
|
|
5578
|
-
return origBlock(tokens, idx, options, env, self);
|
|
5634
|
+
return withoutMathJaxStyle(origBlock(tokens, idx, options, env, self));
|
|
5579
5635
|
};
|
|
5580
5636
|
}
|
|
5581
5637
|
mdInstanceCache[cacheKey] = md;
|
|
@@ -5843,8 +5899,8 @@ function hasLinkSyntax(text) {
|
|
|
5843
5899
|
return substr;
|
|
5844
5900
|
}
|
|
5845
5901
|
//#endregion
|
|
5846
|
-
//#region ../../node_modules/.pnpm/dompurify@3.4.
|
|
5847
|
-
/*! @license DOMPurify 3.4.
|
|
5902
|
+
//#region ../../node_modules/.pnpm/dompurify@3.4.17/node_modules/dompurify/dist/purify.es.mjs
|
|
5903
|
+
/*! @license DOMPurify 3.4.17 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.17/LICENSE */
|
|
5848
5904
|
function _OverloadYield(e, d) {
|
|
5849
5905
|
this.v = e, this.k = d;
|
|
5850
5906
|
}
|
|
@@ -5968,9 +6024,12 @@ Array.prototype.indexOf;
|
|
|
5968
6024
|
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
5969
6025
|
var arrayPop = unapply(Array.prototype.pop);
|
|
5970
6026
|
var arrayPush = unapply(Array.prototype.push);
|
|
5971
|
-
Array.prototype.slice;
|
|
6027
|
+
var arraySlice = unapply(Array.prototype.slice);
|
|
5972
6028
|
var arraySplice = unapply(Array.prototype.splice);
|
|
5973
6029
|
var arrayIsArray = Array.isArray;
|
|
6030
|
+
var setCreate = unconstruct(Set);
|
|
6031
|
+
var setAdd = unapply(Set.prototype.add);
|
|
6032
|
+
var setHas = unapply(Set.prototype.has);
|
|
5974
6033
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
5975
6034
|
var stringToString = unapply(String.prototype.toString);
|
|
5976
6035
|
var stringMatch = unapply(String.prototype.match);
|
|
@@ -6115,6 +6174,25 @@ function lookupGetter(object, prop) {
|
|
|
6115
6174
|
}
|
|
6116
6175
|
return fallbackValue;
|
|
6117
6176
|
}
|
|
6177
|
+
/**
|
|
6178
|
+
* Like lookupGetter, but for accessor properties only, and returns null
|
|
6179
|
+
* instead of a null-returning fallback when no getter exists on the chain.
|
|
6180
|
+
* Lets a caller fall back to a direct property read in environments that
|
|
6181
|
+
* lack the getter, where a fallback returning null would be indistinguishable
|
|
6182
|
+
* from a legitimate null value (e.g. namespaceURI of a no-namespace element).
|
|
6183
|
+
*
|
|
6184
|
+
* @param object - The object (usually a prototype) to start the lookup at.
|
|
6185
|
+
* @param prop - The accessor property name.
|
|
6186
|
+
* @returns The unapplied getter, or null if none was found.
|
|
6187
|
+
*/
|
|
6188
|
+
function lookupAccessor(object, prop) {
|
|
6189
|
+
while (object !== null) {
|
|
6190
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
6191
|
+
if (desc) return desc.get ? unapply(desc.get) : null;
|
|
6192
|
+
object = getPrototypeOf(object);
|
|
6193
|
+
}
|
|
6194
|
+
return null;
|
|
6195
|
+
}
|
|
6118
6196
|
function isRegex(value) {
|
|
6119
6197
|
try {
|
|
6120
6198
|
regExpTest(value, "");
|
|
@@ -6799,7 +6877,7 @@ var NODE_TYPE = {
|
|
|
6799
6877
|
documentFragment: 11,
|
|
6800
6878
|
notation: 12
|
|
6801
6879
|
};
|
|
6802
|
-
var
|
|
6880
|
+
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, [
|
|
6803
6881
|
"style",
|
|
6804
6882
|
"script",
|
|
6805
6883
|
"xmp",
|
|
@@ -6808,15 +6886,7 @@ var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
|
6808
6886
|
"noframes",
|
|
6809
6887
|
"plaintext",
|
|
6810
6888
|
"noscript"
|
|
6811
|
-
];
|
|
6812
|
-
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
6813
|
-
var LITERAL_TEXT_CLOSE = function() {
|
|
6814
|
-
const map = {};
|
|
6815
|
-
arrayForEach(LITERAL_TEXT_ELEMENT_NAMES, (name) => {
|
|
6816
|
-
map[name] = seal(new RegExp("</" + name + "(?=[\\t\\n\\f\\r />])", "i"));
|
|
6817
|
-
});
|
|
6818
|
-
return freeze(map);
|
|
6819
|
-
}();
|
|
6889
|
+
]));
|
|
6820
6890
|
var getGlobal = function getGlobal() {
|
|
6821
6891
|
return typeof window === "undefined" ? null : window;
|
|
6822
6892
|
};
|
|
@@ -6894,7 +6964,7 @@ var _resolveObjectOption = function _resolveObjectOption(cfg, key, makeFallback)
|
|
|
6894
6964
|
function createDOMPurify() {
|
|
6895
6965
|
let window = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
6896
6966
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
6897
|
-
DOMPurify.version = "3.4.
|
|
6967
|
+
DOMPurify.version = "3.4.17";
|
|
6898
6968
|
DOMPurify.removed = [];
|
|
6899
6969
|
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
6900
6970
|
DOMPurify.isSupported = false;
|
|
@@ -6926,6 +6996,10 @@ function createDOMPurify() {
|
|
|
6926
6996
|
const _readNodeName = function _readNodeName(node) {
|
|
6927
6997
|
return getNodeName ? getNodeName(node) : node.nodeName;
|
|
6928
6998
|
};
|
|
6999
|
+
const getNamespaceURI = lookupAccessor(ElementPrototype, "namespaceURI");
|
|
7000
|
+
const _readNamespaceURI = function _readNamespaceURI(element) {
|
|
7001
|
+
return getNamespaceURI ? getNamespaceURI(element) : element.namespaceURI;
|
|
7002
|
+
};
|
|
6929
7003
|
if (typeof HTMLTemplateElement === "function") {
|
|
6930
7004
|
const template = document.createElement("template");
|
|
6931
7005
|
if (template.content && template.content.ownerDocument) document = template.content.ownerDocument;
|
|
@@ -7046,6 +7120,7 @@ function createDOMPurify() {
|
|
|
7046
7120
|
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
7047
7121
|
let KEEP_CONTENT = true;
|
|
7048
7122
|
let IN_PLACE = false;
|
|
7123
|
+
let IN_PLACE_VISITED = null;
|
|
7049
7124
|
let USE_PROFILES = {};
|
|
7050
7125
|
let FORBID_CONTENTS = null;
|
|
7051
7126
|
const DEFAULT_FORBID_CONTENTS = addToSet({}, [
|
|
@@ -7319,18 +7394,23 @@ function createDOMPurify() {
|
|
|
7319
7394
|
* return. Return true otherwise.
|
|
7320
7395
|
*/
|
|
7321
7396
|
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7397
|
+
const elementNamespace = _readNamespaceURI(element);
|
|
7398
|
+
const tagName = stringToLowerCase(_readNodeName(element));
|
|
7399
|
+
const parentNode = getParentNode(element);
|
|
7400
|
+
let parent;
|
|
7401
|
+
let parentTagName;
|
|
7402
|
+
if (parentNode && _readNodeType(parentNode) === NODE_TYPE.element) {
|
|
7403
|
+
parent = { namespaceURI: _readNamespaceURI(parentNode) };
|
|
7404
|
+
parentTagName = stringToLowerCase(_readNodeName(parentNode));
|
|
7405
|
+
} else {
|
|
7406
|
+
parent = { namespaceURI: NAMESPACE };
|
|
7407
|
+
parentTagName = "template";
|
|
7408
|
+
}
|
|
7409
|
+
if (!ALLOWED_NAMESPACES[elementNamespace]) return false;
|
|
7410
|
+
if (elementNamespace === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
7411
|
+
if (elementNamespace === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
7412
|
+
if (elementNamespace === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
7413
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[elementNamespace]) return true;
|
|
7334
7414
|
return false;
|
|
7335
7415
|
};
|
|
7336
7416
|
/**
|
|
@@ -7374,36 +7454,21 @@ function createDOMPurify() {
|
|
|
7374
7454
|
}
|
|
7375
7455
|
};
|
|
7376
7456
|
/**
|
|
7377
|
-
*
|
|
7378
|
-
*
|
|
7379
|
-
*
|
|
7380
|
-
* (campaign-3 F2). An internal throw mid-walk — e.g. a page-registered
|
|
7381
|
-
* custom element's reaction detaches a node so `_forceRemove`'s deliberate
|
|
7382
|
-
* parentless guard throws, or any other re-entrant engine mutation — would
|
|
7383
|
-
* otherwise leave the caller's *live* tree half-sanitized, with everything
|
|
7384
|
-
* after the abort point still carrying its handlers. There is no safe way
|
|
7385
|
-
* to resume the walk (the tree mutated under us), so we strip the root bare:
|
|
7386
|
-
* remove every child and every attribute, then let the caller's catch see
|
|
7387
|
-
* the original error. Clobber-safe (cached `remove`/`childNodes`/`attributes`
|
|
7388
|
-
* getters; the root was already clobber-pre-flighted at the IN_PLACE entry).
|
|
7457
|
+
* Fail-closed teardown of an in-place root: strip every disallowed attribute
|
|
7458
|
+
* in the subtree first, so nothing armed is left behind, then remove all
|
|
7459
|
+
* children and the root's own attributes.
|
|
7389
7460
|
*
|
|
7390
7461
|
* @param root the in-place root to empty
|
|
7391
7462
|
*/
|
|
7392
7463
|
const _neutralizeRoot = function _neutralizeRoot(root) {
|
|
7393
7464
|
_neutralizeSubtree(root);
|
|
7394
7465
|
const childNodes = getChildNodes(root);
|
|
7395
|
-
if (childNodes) {
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
try {
|
|
7402
|
-
remove(child);
|
|
7403
|
-
} catch (_) {}
|
|
7404
|
-
});
|
|
7405
|
-
}
|
|
7406
|
-
const attributes = getAttributes(root);
|
|
7466
|
+
if (childNodes) arrayForEach(arraySlice(childNodes), (child) => {
|
|
7467
|
+
try {
|
|
7468
|
+
remove(child);
|
|
7469
|
+
} catch (_) {}
|
|
7470
|
+
});
|
|
7471
|
+
const attributes = _readNodeType(root) === NODE_TYPE.element ? getAttributes(root) : null;
|
|
7407
7472
|
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
7408
7473
|
const attribute = attributes[i];
|
|
7409
7474
|
const name = attribute && attribute.name;
|
|
@@ -7411,18 +7476,9 @@ function createDOMPurify() {
|
|
|
7411
7476
|
}
|
|
7412
7477
|
};
|
|
7413
7478
|
/**
|
|
7414
|
-
*
|
|
7415
|
-
*
|
|
7416
|
-
*
|
|
7417
|
-
* lookup key for HTML elements in an HTML document, so they silently miss an
|
|
7418
|
-
* attribute whose stored qualified name still contains uppercase ASCII
|
|
7419
|
-
* letters. That happens when the node came from a case-preserving source
|
|
7420
|
-
* (an XML/XHTML document imported via importNode(), or createAttributeNS()),
|
|
7421
|
-
* where e.g. `ONERROR` survives the walk: the policy check lowercases to
|
|
7422
|
-
* `onerror` and rejects it, but `removeAttribute('ONERROR')` looks up
|
|
7423
|
-
* `onerror` and finds nothing. Remove the exact Attr node instead, which is
|
|
7424
|
-
* case- and namespace-exact, and fall back to name-based removal only when
|
|
7425
|
-
* the caller could not supply the node.
|
|
7479
|
+
* Removes an attribute, preferably as its exact Attr node: name-based
|
|
7480
|
+
* removal lowercases the name in HTML documents and misses case-preserved
|
|
7481
|
+
* names, e.g. from imported XHTML.
|
|
7426
7482
|
*
|
|
7427
7483
|
* @param name an Attribute name
|
|
7428
7484
|
* @param element a DOM node
|
|
@@ -7456,12 +7512,8 @@ function createDOMPurify() {
|
|
|
7456
7512
|
}
|
|
7457
7513
|
};
|
|
7458
7514
|
/**
|
|
7459
|
-
*
|
|
7460
|
-
*
|
|
7461
|
-
* Removes every attribute the active configuration does not allow from a
|
|
7462
|
-
* single element, using the same allowlist as the main attribute pass (so
|
|
7463
|
-
* `on*` handlers go, but no `/^on/` blocklist is introduced). Used only to
|
|
7464
|
-
* neutralise nodes that are being discarded from an in-place tree.
|
|
7515
|
+
* Removes every attribute the configuration does not allow. Used to
|
|
7516
|
+
* neutralize nodes discarded from an in-place tree.
|
|
7465
7517
|
*
|
|
7466
7518
|
* @param element the element to strip
|
|
7467
7519
|
*/
|
|
@@ -7476,77 +7528,158 @@ function createDOMPurify() {
|
|
|
7476
7528
|
}
|
|
7477
7529
|
};
|
|
7478
7530
|
/**
|
|
7479
|
-
*
|
|
7480
|
-
*
|
|
7481
|
-
*
|
|
7482
|
-
*
|
|
7483
|
-
* namespace, comment, processing-instruction and KEEP_CONTENT:false removals
|
|
7484
|
-
* all drop their subtree wholesale via `_forceRemove`. On the IN_PLACE path
|
|
7485
|
-
* those dropped nodes are detached from the caller's LIVE tree but a
|
|
7486
|
-
* handler-bearing original among them (an `<img onerror>`/`<video>` that was
|
|
7487
|
-
* loading) keeps its queued resource event, which fires in page scope after
|
|
7488
|
-
* sanitize returns. This walks a removed subtree and strips every attribute
|
|
7489
|
-
* the active configuration does not allow — so `on*` handlers are cancelled
|
|
7490
|
-
* through the SAME allowlist that governs kept nodes, not a separate `/^on/`
|
|
7491
|
-
* blocklist. Run synchronously before sanitize returns, i.e. before any
|
|
7492
|
-
* queued event can fire. Hook-free by design: these nodes leave the output,
|
|
7493
|
-
* so firing attribute hooks for them would be surprising. Clobber-safe reads;
|
|
7494
|
-
* a doomed clobbered node may shadow `removeAttribute` (its own attributes are
|
|
7495
|
-
* irrelevant — it is discarded — while its non-clobbered descendants, e.g.
|
|
7496
|
-
* the `<img>`, are reached and scrubbed).
|
|
7531
|
+
* Iterative depth-first walk, so deep trees cannot overflow the call stack,
|
|
7532
|
+
* reading through the cached getters, so clobbering cannot hide children.
|
|
7533
|
+
* When `visit` returns false, the node's children are skipped. With
|
|
7534
|
+
* `intoShadow`, open shadow roots are walked after their host's children.
|
|
7497
7535
|
*
|
|
7498
|
-
* @param root
|
|
7536
|
+
* @param root where to start
|
|
7537
|
+
* @param visit called for every node
|
|
7538
|
+
* @param intoShadow whether to enter open shadow roots
|
|
7499
7539
|
*/
|
|
7500
|
-
const
|
|
7540
|
+
const _walkTree = function _walkTree(root, visit) {
|
|
7541
|
+
let intoShadow = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
7501
7542
|
const stack = [root];
|
|
7502
7543
|
while (stack.length > 0) {
|
|
7503
7544
|
const node = stack.pop();
|
|
7504
|
-
if (
|
|
7545
|
+
if (visit(node) === false) continue;
|
|
7546
|
+
if (intoShadow && _readNodeType(node) === NODE_TYPE.element) {
|
|
7547
|
+
const shadowRoot = getShadowRoot(node);
|
|
7548
|
+
if (_isDocumentFragment(shadowRoot)) stack.push(shadowRoot);
|
|
7549
|
+
}
|
|
7505
7550
|
const childNodes = getChildNodes(node);
|
|
7506
7551
|
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
7507
7552
|
}
|
|
7508
7553
|
};
|
|
7509
7554
|
/**
|
|
7510
|
-
*
|
|
7555
|
+
* Strips disallowed attributes from every element of a discarded subtree,
|
|
7556
|
+
* so a handler that is already queued (a loading image) cannot fire.
|
|
7557
|
+
*
|
|
7558
|
+
* @param root the root of a removed subtree
|
|
7559
|
+
*/
|
|
7560
|
+
const _neutralizeSubtree = function _neutralizeSubtree(root) {
|
|
7561
|
+
_walkTree(root, (node) => {
|
|
7562
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
7563
|
+
});
|
|
7564
|
+
};
|
|
7565
|
+
/**
|
|
7566
|
+
* All nodes under `root`, root first, including open shadow roots. Template
|
|
7567
|
+
* content is not entered, it is inert.
|
|
7511
7568
|
*
|
|
7512
|
-
*
|
|
7513
|
-
*
|
|
7569
|
+
* @param root the in-place root
|
|
7570
|
+
* @return the nodes
|
|
7571
|
+
*/
|
|
7572
|
+
const _collectLiveNodes = function _collectLiveNodes(root) {
|
|
7573
|
+
const nodes = [];
|
|
7574
|
+
_walkTree(root, (node) => {
|
|
7575
|
+
nodes.push(node);
|
|
7576
|
+
}, true);
|
|
7577
|
+
return nodes;
|
|
7578
|
+
};
|
|
7579
|
+
/**
|
|
7580
|
+
* Strips disallowed attributes from every element that was under the
|
|
7581
|
+
* in-place root when the call started and no longer is, whatever removed
|
|
7582
|
+
* or moved it.
|
|
7514
7583
|
*
|
|
7515
|
-
*
|
|
7516
|
-
*
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7584
|
+
* @param root the in-place root
|
|
7585
|
+
* @param before the root's nodes, collected before the walk
|
|
7586
|
+
*/
|
|
7587
|
+
const _neutralizeEscapedElements = function _neutralizeEscapedElements(root, before) {
|
|
7588
|
+
const reachable = setCreate();
|
|
7589
|
+
arrayForEach(_collectLiveNodes(root), (node) => {
|
|
7590
|
+
if (_readNodeType(node) === NODE_TYPE.element) setAdd(reachable, node);
|
|
7591
|
+
});
|
|
7592
|
+
arrayForEach(before, (node) => {
|
|
7593
|
+
if (_readNodeType(node) === NODE_TYPE.element && !setHas(reachable, node)) _stripDisallowedAttributes(node);
|
|
7594
|
+
});
|
|
7595
|
+
};
|
|
7596
|
+
/**
|
|
7597
|
+
* Neutralizes everything that left the in-place tree during the call: what
|
|
7598
|
+
* DOMPurify removed, and what hooks or custom elements removed or moved out.
|
|
7525
7599
|
*
|
|
7526
|
-
*
|
|
7527
|
-
*
|
|
7528
|
-
*
|
|
7529
|
-
|
|
7530
|
-
|
|
7600
|
+
* @param root the in-place root
|
|
7601
|
+
* @param before the root's nodes, collected before the walk
|
|
7602
|
+
* @return true if the root itself was removed
|
|
7603
|
+
*/
|
|
7604
|
+
const _neutralizeDiscarded = function _neutralizeDiscarded(root, before) {
|
|
7605
|
+
let rootRemoved = false;
|
|
7606
|
+
arrayForEach(DOMPurify.removed, (entry) => {
|
|
7607
|
+
if (entry.element) {
|
|
7608
|
+
rootRemoved = rootRemoved || entry.element === root;
|
|
7609
|
+
_neutralizeSubtree(entry.element);
|
|
7610
|
+
}
|
|
7611
|
+
});
|
|
7612
|
+
_neutralizeEscapedElements(root, before);
|
|
7613
|
+
return rootRemoved;
|
|
7614
|
+
};
|
|
7615
|
+
const MAX_UNVISITED_ROUNDS = 8;
|
|
7616
|
+
/**
|
|
7617
|
+
* The walk only moves forward, so a node moved to a position it already
|
|
7618
|
+
* passed is never visited. Give every original node that is still in the
|
|
7619
|
+
* tree but unvisited the normal treatment, hooks included. Nodes created
|
|
7620
|
+
* during the call are left alone. Fails closed if the tree keeps changing.
|
|
7531
7621
|
*
|
|
7532
|
-
*
|
|
7533
|
-
*
|
|
7622
|
+
* @param root the in-place root
|
|
7623
|
+
* @param before the root's nodes, collected before the walk
|
|
7624
|
+
*/
|
|
7625
|
+
const _sanitizeUnvisitedNodes = function _sanitizeUnvisitedNodes(root, before) {
|
|
7626
|
+
const visited = IN_PLACE_VISITED;
|
|
7627
|
+
let original = null;
|
|
7628
|
+
const getOriginal = () => {
|
|
7629
|
+
if (!original) {
|
|
7630
|
+
original = setCreate();
|
|
7631
|
+
arrayForEach(before, (beforeNode) => {
|
|
7632
|
+
setAdd(original, beforeNode);
|
|
7633
|
+
});
|
|
7634
|
+
}
|
|
7635
|
+
return original;
|
|
7636
|
+
};
|
|
7637
|
+
for (let round = 0;; round++) {
|
|
7638
|
+
const live = _collectLiveNodes(root);
|
|
7639
|
+
const containers = [root];
|
|
7640
|
+
let pending = false;
|
|
7641
|
+
arrayForEach(live, (node) => {
|
|
7642
|
+
if (_readNodeType(node) === NODE_TYPE.documentFragment) arrayPush(containers, node);
|
|
7643
|
+
else if (!pending && !setHas(visited, node)) pending = setHas(getOriginal(), node);
|
|
7644
|
+
});
|
|
7645
|
+
if (!pending) return;
|
|
7646
|
+
if (round >= MAX_UNVISITED_ROUNDS) throw typeErrorCreate("the tree kept changing during in-place sanitization; refusing to return it");
|
|
7647
|
+
arrayForEach(containers, (container, index) => {
|
|
7648
|
+
_sanitizeUnvisitedIn(container, index > 0, root, getOriginal());
|
|
7649
|
+
});
|
|
7650
|
+
}
|
|
7651
|
+
};
|
|
7652
|
+
/**
|
|
7653
|
+
* One _sanitizeUnvisitedNodes pass over the root or an open shadow root.
|
|
7534
7654
|
*
|
|
7535
|
-
*
|
|
7536
|
-
*
|
|
7537
|
-
*
|
|
7538
|
-
*
|
|
7539
|
-
|
|
7540
|
-
|
|
7655
|
+
* @param container the root or an open shadow root
|
|
7656
|
+
* @param inShadow whether container is a shadow root
|
|
7657
|
+
* @param root the in-place root
|
|
7658
|
+
* @param original the root's nodes collected before the walk, as a set
|
|
7659
|
+
*/
|
|
7660
|
+
const _sanitizeUnvisitedIn = function _sanitizeUnvisitedIn(container, inShadow, root, original) {
|
|
7661
|
+
const iterator = _createNodeIterator(container);
|
|
7662
|
+
let node;
|
|
7663
|
+
while (node = iterator.nextNode()) {
|
|
7664
|
+
if (!setHas(original, node) || setHas(IN_PLACE_VISITED, node)) continue;
|
|
7665
|
+
if (inShadow) _executeHooks(hooks.uponSanitizeShadowNode, node, null);
|
|
7666
|
+
_sanitizeElements(node, root);
|
|
7667
|
+
_sanitizeAttributes(node, root);
|
|
7668
|
+
if (_isDocumentFragment(node.content)) _sanitizeShadowDOM2(node.content);
|
|
7669
|
+
}
|
|
7670
|
+
};
|
|
7671
|
+
/**
|
|
7672
|
+
* Records that _sanitizeElements processed `node`. No-op outside IN_PLACE.
|
|
7541
7673
|
*
|
|
7542
|
-
* @param
|
|
7674
|
+
* @param node the node being processed
|
|
7543
7675
|
*/
|
|
7676
|
+
const _markVisited = function _markVisited(node) {
|
|
7677
|
+
if (IN_PLACE_VISITED) setAdd(IN_PLACE_VISITED, node);
|
|
7678
|
+
};
|
|
7544
7679
|
/**
|
|
7545
|
-
*
|
|
7546
|
-
*
|
|
7547
|
-
*
|
|
7548
|
-
* everywhere except on <label>/<output>, and the whole policy is gated on
|
|
7549
|
-
* SAFE_FOR_XML (see the rationale block in _isValidAttribute).
|
|
7680
|
+
* Patch-linkage attributes (declarative partial updates): `patchsrc`
|
|
7681
|
+
* always, `for` everywhere except on <label> and <output>. Gated on
|
|
7682
|
+
* SAFE_FOR_XML. Shared by the IN_PLACE pre-pass and _isValidAttribute.
|
|
7550
7683
|
*
|
|
7551
7684
|
* @param lcName the transformCaseFunc'd attribute name
|
|
7552
7685
|
* @param lcTag the transformCaseFunc'd tag name of the carrying element
|
|
@@ -7557,17 +7690,26 @@ function createDOMPurify() {
|
|
|
7557
7690
|
if (lcName === "patchsrc") return true;
|
|
7558
7691
|
return lcName === "for" && lcTag !== "label" && lcTag !== "output";
|
|
7559
7692
|
};
|
|
7693
|
+
/**
|
|
7694
|
+
* IN_PLACE pre-pass: sever all patch linkage before the walk, so no patch
|
|
7695
|
+
* can fire mid-walk into a part of the tree the walker already passed.
|
|
7696
|
+
* Removes range markers (processing instructions, comments with markup)
|
|
7697
|
+
* and strips linkage attributes. It cannot undo a patch that already fired.
|
|
7698
|
+
*
|
|
7699
|
+
* TODO: if the shipped feature can patch through `for` on <label>/<output>,
|
|
7700
|
+
* drop that pair here too (see test/declarative-patch-probe.html).
|
|
7701
|
+
*
|
|
7702
|
+
* @param root the in-place root to sweep
|
|
7703
|
+
*/
|
|
7560
7704
|
const _neutralizePatchLinkage = function _neutralizePatchLinkage(root) {
|
|
7561
7705
|
if (!SAFE_FOR_XML) return;
|
|
7562
|
-
|
|
7563
|
-
while (stack.length > 0) {
|
|
7564
|
-
const node = stack.pop();
|
|
7706
|
+
_walkTree(root, (node) => {
|
|
7565
7707
|
const nodeType = _readNodeType(node);
|
|
7566
7708
|
if (nodeType === NODE_TYPE.processingInstruction || nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, node.data)) {
|
|
7567
7709
|
try {
|
|
7568
7710
|
remove(node);
|
|
7569
7711
|
} catch (_) {}
|
|
7570
|
-
|
|
7712
|
+
return false;
|
|
7571
7713
|
}
|
|
7572
7714
|
if (nodeType === NODE_TYPE.element) {
|
|
7573
7715
|
const element = node;
|
|
@@ -7577,9 +7719,8 @@ function createDOMPurify() {
|
|
|
7577
7719
|
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) element.removeAttribute("for");
|
|
7578
7720
|
} catch (_) {}
|
|
7579
7721
|
}
|
|
7580
|
-
|
|
7581
|
-
|
|
7582
|
-
}
|
|
7722
|
+
return true;
|
|
7723
|
+
});
|
|
7583
7724
|
};
|
|
7584
7725
|
/**
|
|
7585
7726
|
* _initDocument
|
|
@@ -7656,6 +7797,27 @@ function createDOMPurify() {
|
|
|
7656
7797
|
*/
|
|
7657
7798
|
const _scrubTemplateExpressions2 = function _scrubTemplateExpressions(node) {
|
|
7658
7799
|
var _node$querySelectorAl;
|
|
7800
|
+
_scrubOwnCharacterData(node);
|
|
7801
|
+
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
7802
|
+
if (templates) arrayForEach(templates, (tmpl) => {
|
|
7803
|
+
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
7804
|
+
});
|
|
7805
|
+
};
|
|
7806
|
+
/**
|
|
7807
|
+
* _scrubOwnCharacterData
|
|
7808
|
+
*
|
|
7809
|
+
* Non-recursive core of _scrubTemplateExpressions: normalize `node` and
|
|
7810
|
+
* strip template expressions from its own character data only. Does not
|
|
7811
|
+
* enter <template>.content or attached shadow roots (NodeIterator never
|
|
7812
|
+
* does). Used by _sanitizeShadowDOM, where every nested template content
|
|
7813
|
+
* and shadow root is already walked - and therefore scrubbed - by its own
|
|
7814
|
+
* recursive _sanitizeShadowDOM call; recursing here as well would rescrub
|
|
7815
|
+
* each nested fragment once per ancestor, which is quadratic in nesting
|
|
7816
|
+
* depth.
|
|
7817
|
+
*
|
|
7818
|
+
* @param node The root whose own character data should be scrubbed.
|
|
7819
|
+
*/
|
|
7820
|
+
const _scrubOwnCharacterData = function _scrubOwnCharacterData(node) {
|
|
7659
7821
|
node.normalize();
|
|
7660
7822
|
const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
|
|
7661
7823
|
const walker = createNodeIterator.call(doc || node, node, NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_CDATA_SECTION | NodeFilter.SHOW_PROCESSING_INSTRUCTION, null);
|
|
@@ -7664,10 +7826,6 @@ function createDOMPurify() {
|
|
|
7664
7826
|
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
7665
7827
|
currentNode = walker.nextNode();
|
|
7666
7828
|
}
|
|
7667
|
-
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
7668
|
-
if (templates) arrayForEach(templates, (tmpl) => {
|
|
7669
|
-
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
7670
|
-
});
|
|
7671
7829
|
};
|
|
7672
7830
|
/**
|
|
7673
7831
|
* _isClobbered
|
|
@@ -7743,7 +7901,7 @@ function createDOMPurify() {
|
|
|
7743
7901
|
*/
|
|
7744
7902
|
const _isUnsafeNode = function _isUnsafeNode(currentNode, tagName) {
|
|
7745
7903
|
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
7746
|
-
if (SAFE_FOR_XML && currentNode
|
|
7904
|
+
if (SAFE_FOR_XML && LITERAL_TEXT_ELEMENTS[tagName] && _readNodeType(currentNode) === NODE_TYPE.element && _readNamespaceURI(currentNode) === HTML_NAMESPACE && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent))) return true;
|
|
7747
7905
|
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
7748
7906
|
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
7749
7907
|
return false;
|
|
@@ -7787,7 +7945,7 @@ function createDOMPurify() {
|
|
|
7787
7945
|
*/
|
|
7788
7946
|
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode(currentNode, tagName, root) {
|
|
7789
7947
|
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
7790
|
-
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
7948
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName] && !FORBID_CONTENTS[stringToLowerCase(tagName)]) {
|
|
7791
7949
|
const parentNode = getParentNode(currentNode);
|
|
7792
7950
|
const childNodes = getChildNodes(currentNode);
|
|
7793
7951
|
if (childNodes && parentNode) {
|
|
@@ -7820,35 +7978,13 @@ function createDOMPurify() {
|
|
|
7820
7978
|
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
7821
7979
|
};
|
|
7822
7980
|
/**
|
|
7823
|
-
*
|
|
7824
|
-
*
|
|
7825
|
-
*
|
|
7826
|
-
* filtering). Per the cached, unclobberable parentNode getter the node is
|
|
7827
|
-
* genuinely out of the tree, so it can reach neither the serialized
|
|
7828
|
-
* output nor an IN_PLACE live tree; treat it as removed and stop
|
|
7829
|
-
* processing it. Without this guard, the unsafe-node / namespace checks
|
|
7830
|
-
* would call _forceRemove on a parentless node and hit the REPORT-3
|
|
7831
|
-
* fail-closed throw — which exists for nodes DOMPurify wants gone but
|
|
7832
|
-
* *cannot* detach (clobbered / parentless roots), the opposite of a node
|
|
7833
|
-
* that is already safely gone. The walk root is exempt: a detached
|
|
7834
|
-
* IN_PLACE root is legitimate input and must still be fully sanitized,
|
|
7835
|
-
* and a kill-decision on it must keep hitting the REPORT-3 throw.
|
|
7836
|
-
*
|
|
7837
|
-
* Nodes detached by hooks stay the hook's responsibility for placement:
|
|
7838
|
-
* they are not recorded in DOMPurify.removed, so the post-walk IN_PLACE
|
|
7839
|
-
* pass (which iterates DOMPurify.removed) does not reach them. But a
|
|
7840
|
-
* hook-detached subtree can still hold a queued resource-event handler -
|
|
7841
|
-
* e.g. an <img onload> that began loading when the caller built the live
|
|
7842
|
-
* tree - which fires in page scope after sanitize returns even though the
|
|
7843
|
-
* handler never reached the returned tree. That is the audit-5 F1 hazard,
|
|
7844
|
-
* and the documented node.remove() hook pattern walks straight into it.
|
|
7845
|
-
* So on the IN_PLACE path we neutralize the detached subtree inline,
|
|
7846
|
-
* stripping its non-allow-listed attributes before returning, exactly as
|
|
7847
|
-
* the post-walk pass does for _forceRemove'd subtrees.
|
|
7981
|
+
* A hook may have detached the node it was called for. If so, treat it as
|
|
7982
|
+
* removed and stop processing it; the walk root is exempt. On the IN_PLACE
|
|
7983
|
+
* path the detached subtree is neutralized right away.
|
|
7848
7984
|
*
|
|
7849
7985
|
* @param currentNode the node a hook may have detached
|
|
7850
7986
|
* @param root the current walk root
|
|
7851
|
-
* @return true if the node
|
|
7987
|
+
* @return true if the node was detached
|
|
7852
7988
|
*/
|
|
7853
7989
|
const _handleHookDetachedNode = function _handleHookDetachedNode(currentNode, root) {
|
|
7854
7990
|
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
@@ -7865,6 +8001,7 @@ function createDOMPurify() {
|
|
|
7865
8001
|
* @return true if node was killed, false if left alive
|
|
7866
8002
|
*/
|
|
7867
8003
|
const _sanitizeElements = function _sanitizeElements(currentNode, root) {
|
|
8004
|
+
_markVisited(currentNode);
|
|
7868
8005
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
7869
8006
|
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
7870
8007
|
if (_isClobbered(currentNode)) {
|
|
@@ -8008,6 +8145,22 @@ function createDOMPurify() {
|
|
|
8008
8145
|
}
|
|
8009
8146
|
};
|
|
8010
8147
|
/**
|
|
8148
|
+
* _isUnsafeAttributeValue
|
|
8149
|
+
*
|
|
8150
|
+
* Value-based attribute checks that the attribute walk applies before any
|
|
8151
|
+
* hook can force-keep an attribute, shared with the public
|
|
8152
|
+
* isValidAttribute() so that it never approves a value sanitize() would
|
|
8153
|
+
* strip.
|
|
8154
|
+
*
|
|
8155
|
+
* @param name the attribute name as found on the node (case preserved)
|
|
8156
|
+
* @param value the attribute value
|
|
8157
|
+
* @returns true if the attribute must be removed because of its value
|
|
8158
|
+
*/
|
|
8159
|
+
const _isUnsafeAttributeValue = function _isUnsafeAttributeValue(name, value) {
|
|
8160
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, value)) return true;
|
|
8161
|
+
return stringToLowerCase(name) === "attributename" && stringMatch(value, "href") !== null;
|
|
8162
|
+
};
|
|
8163
|
+
/**
|
|
8011
8164
|
* _sanitizeAttributes
|
|
8012
8165
|
*
|
|
8013
8166
|
* @protect attributes
|
|
@@ -8051,11 +8204,7 @@ function createDOMPurify() {
|
|
|
8051
8204
|
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
8052
8205
|
recreatedNamedProp = true;
|
|
8053
8206
|
}
|
|
8054
|
-
if (
|
|
8055
|
-
_removeAttribute(name, currentNode, attr);
|
|
8056
|
-
continue;
|
|
8057
|
-
}
|
|
8058
|
-
if (lcName === "attributename" && stringMatch(value, "href")) {
|
|
8207
|
+
if (_isUnsafeAttributeValue(name, value)) {
|
|
8059
8208
|
_removeAttribute(name, currentNode, attr);
|
|
8060
8209
|
continue;
|
|
8061
8210
|
}
|
|
@@ -8103,24 +8252,13 @@ function createDOMPurify() {
|
|
|
8103
8252
|
}
|
|
8104
8253
|
}
|
|
8105
8254
|
}
|
|
8255
|
+
if (SAFE_FOR_TEMPLATES) _scrubOwnCharacterData(fragment);
|
|
8106
8256
|
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
8107
8257
|
};
|
|
8108
8258
|
/**
|
|
8109
|
-
*
|
|
8110
|
-
*
|
|
8111
|
-
*
|
|
8112
|
-
* the existing _sanitizeShadowDOM pipeline. The default node iterator
|
|
8113
|
-
* does not descend into shadow trees, so nodes inside an attached
|
|
8114
|
-
* shadow root would otherwise be skipped entirely.
|
|
8115
|
-
*
|
|
8116
|
-
* Two real input paths put attached shadow roots in front of us:
|
|
8117
|
-
* 1. IN_PLACE on a DOM node that already has shadow roots attached.
|
|
8118
|
-
* 2. DOM-node input where importNode(dirty, true) deep-clones the
|
|
8119
|
-
* shadow root because it was created with `clonable: true`.
|
|
8120
|
-
*
|
|
8121
|
-
* This pass runs once, up front, so the main iteration loop (and the
|
|
8122
|
-
* existing _sanitizeShadowDOM template-content recursion) stay
|
|
8123
|
-
* untouched — string-input paths are not affected.
|
|
8259
|
+
* Sanitizes every attached shadow root under `root`, since the node
|
|
8260
|
+
* iterator does not enter shadow trees. Needed for IN_PLACE input and for
|
|
8261
|
+
* DOM input whose clonable shadow roots were copied by importNode().
|
|
8124
8262
|
*
|
|
8125
8263
|
* @param root the subtree root to walk for attached shadow roots
|
|
8126
8264
|
*/
|
|
@@ -8185,6 +8323,8 @@ function createDOMPurify() {
|
|
|
8185
8323
|
if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
8186
8324
|
DOMPurify.removed = [];
|
|
8187
8325
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
8326
|
+
let inPlaceNodes = [];
|
|
8327
|
+
const outerVisited = IN_PLACE_VISITED;
|
|
8188
8328
|
if (inPlace) {
|
|
8189
8329
|
_neutralizePatchLinkage(dirty);
|
|
8190
8330
|
const nn = _readNodeName(dirty);
|
|
@@ -8199,12 +8339,8 @@ function createDOMPurify() {
|
|
|
8199
8339
|
_neutralizeRoot(dirty);
|
|
8200
8340
|
throw typeErrorCreate("root node is clobbered and cannot be sanitized in-place");
|
|
8201
8341
|
}
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
} catch (error) {
|
|
8205
|
-
_neutralizeRoot(dirty);
|
|
8206
|
-
throw error;
|
|
8207
|
-
}
|
|
8342
|
+
inPlaceNodes = _collectLiveNodes(dirty);
|
|
8343
|
+
IN_PLACE_VISITED = setCreate();
|
|
8208
8344
|
} else if (_isNode(dirty)) {
|
|
8209
8345
|
body = _initDocument("<!---->");
|
|
8210
8346
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
@@ -8220,30 +8356,25 @@ function createDOMPurify() {
|
|
|
8220
8356
|
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
8221
8357
|
const walkRoot = inPlace ? dirty : body;
|
|
8222
8358
|
try {
|
|
8359
|
+
if (inPlace) _sanitizeAttachedShadowRoots(dirty);
|
|
8223
8360
|
const nodeIterator = _createNodeIterator(walkRoot);
|
|
8224
8361
|
while (currentNode = nodeIterator.nextNode()) {
|
|
8225
8362
|
_sanitizeElements(currentNode, walkRoot);
|
|
8226
8363
|
_sanitizeAttributes(currentNode, walkRoot);
|
|
8227
8364
|
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
8228
8365
|
}
|
|
8366
|
+
if (inPlace) _sanitizeUnvisitedNodes(dirty, inPlaceNodes);
|
|
8229
8367
|
} catch (error) {
|
|
8230
8368
|
if (inPlace) {
|
|
8231
8369
|
_neutralizeRoot(dirty);
|
|
8232
|
-
|
|
8233
|
-
if (entry.element) _neutralizeSubtree(entry.element);
|
|
8234
|
-
});
|
|
8370
|
+
_neutralizeDiscarded(dirty, inPlaceNodes);
|
|
8235
8371
|
}
|
|
8236
8372
|
throw error;
|
|
8373
|
+
} finally {
|
|
8374
|
+
IN_PLACE_VISITED = outerVisited;
|
|
8237
8375
|
}
|
|
8238
8376
|
if (inPlace) {
|
|
8239
|
-
|
|
8240
|
-
arrayForEach(DOMPurify.removed, (entry) => {
|
|
8241
|
-
if (entry.element) {
|
|
8242
|
-
if (entry.element === dirty) rootWasRemoved = true;
|
|
8243
|
-
_neutralizeSubtree(entry.element);
|
|
8244
|
-
}
|
|
8245
|
-
});
|
|
8246
|
-
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
8377
|
+
if (_neutralizeDiscarded(dirty, inPlaceNodes)) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
8247
8378
|
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
8248
8379
|
return dirty;
|
|
8249
8380
|
}
|
|
@@ -8280,6 +8411,7 @@ function createDOMPurify() {
|
|
|
8280
8411
|
if (!CONFIG) _parseConfig({});
|
|
8281
8412
|
const lcTag = transformCaseFunc(tag);
|
|
8282
8413
|
const lcName = transformCaseFunc(attr);
|
|
8414
|
+
if (typeof value === "string" && (_isUnsafeAttributeValue(attr, value) || !ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(SELF_CLOSING_TAG, value))) return false;
|
|
8283
8415
|
return _isValidAttribute(lcTag, lcName, value);
|
|
8284
8416
|
};
|
|
8285
8417
|
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
@@ -8306,93 +8438,6 @@ function createDOMPurify() {
|
|
|
8306
8438
|
}
|
|
8307
8439
|
var purify_default = createDOMPurify();
|
|
8308
8440
|
//#endregion
|
|
8309
|
-
//#region ../../packages/react/src/components/mathjaxStyles.ts
|
|
8310
|
-
var MATHJAX_STYLES = `
|
|
8311
|
-
:scope {
|
|
8312
|
-
display: contents;
|
|
8313
|
-
}
|
|
8314
|
-
:scope mjx-container[jax="SVG"] {
|
|
8315
|
-
direction: ltr;
|
|
8316
|
-
position: relative;
|
|
8317
|
-
}
|
|
8318
|
-
:scope mjx-container[jax="SVG"] > svg {
|
|
8319
|
-
/* WebKit ignores overflow-clip-margin and clips at the SVG box. */
|
|
8320
|
-
overflow: clip;
|
|
8321
|
-
overflow-clip-margin: 1em;
|
|
8322
|
-
min-height: 1px;
|
|
8323
|
-
min-width: 1px;
|
|
8324
|
-
}
|
|
8325
|
-
:scope mjx-container[jax="SVG"] > svg a {
|
|
8326
|
-
fill: blue;
|
|
8327
|
-
stroke: blue;
|
|
8328
|
-
}
|
|
8329
|
-
:scope mjx-assistive-mml {
|
|
8330
|
-
top: 0px;
|
|
8331
|
-
left: 0px;
|
|
8332
|
-
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
8333
|
-
user-select: text !important;
|
|
8334
|
-
position: absolute !important;
|
|
8335
|
-
padding: 1px 0px 0px !important;
|
|
8336
|
-
border: 0px !important;
|
|
8337
|
-
display: block !important;
|
|
8338
|
-
width: auto !important;
|
|
8339
|
-
overflow: hidden !important;
|
|
8340
|
-
}
|
|
8341
|
-
:scope mjx-assistive-mml[display="block"] {
|
|
8342
|
-
width: 100% !important;
|
|
8343
|
-
}
|
|
8344
|
-
:scope mjx-container[jax="SVG"][display="true"] {
|
|
8345
|
-
display: block;
|
|
8346
|
-
text-align: center;
|
|
8347
|
-
margin: 1em 0px;
|
|
8348
|
-
}
|
|
8349
|
-
:scope mjx-container[jax="SVG"][display="true"][width="full"] {
|
|
8350
|
-
display: flex;
|
|
8351
|
-
}
|
|
8352
|
-
:scope mjx-container[jax="SVG"][justify="left"] {
|
|
8353
|
-
text-align: left;
|
|
8354
|
-
}
|
|
8355
|
-
:scope mjx-container[jax="SVG"][justify="right"] {
|
|
8356
|
-
text-align: right;
|
|
8357
|
-
}
|
|
8358
|
-
:scope g[data-mml-node="merror"] > g {
|
|
8359
|
-
fill: red;
|
|
8360
|
-
stroke: red;
|
|
8361
|
-
}
|
|
8362
|
-
:scope g[data-mml-node="merror"] > rect[data-background] {
|
|
8363
|
-
fill: yellow;
|
|
8364
|
-
stroke: none;
|
|
8365
|
-
}
|
|
8366
|
-
:scope g[data-mml-node="mtable"] > line[data-line], :scope svg[data-table] > g > line[data-line] {
|
|
8367
|
-
stroke-width: 70px;
|
|
8368
|
-
fill: none;
|
|
8369
|
-
}
|
|
8370
|
-
:scope g[data-mml-node="mtable"] > rect[data-frame], :scope svg[data-table] > g > rect[data-frame] {
|
|
8371
|
-
stroke-width: 70px;
|
|
8372
|
-
fill: none;
|
|
8373
|
-
}
|
|
8374
|
-
:scope g[data-mml-node="mtable"] > .mjx-dashed, :scope svg[data-table] > g > .mjx-dashed {
|
|
8375
|
-
stroke-dasharray: 140;
|
|
8376
|
-
}
|
|
8377
|
-
:scope g[data-mml-node="mtable"] > .mjx-dotted, :scope svg[data-table] > g > .mjx-dotted {
|
|
8378
|
-
stroke-linecap: round;
|
|
8379
|
-
stroke-dasharray: 0, 140;
|
|
8380
|
-
}
|
|
8381
|
-
:scope g[data-mml-node="mtable"] > g > svg {
|
|
8382
|
-
overflow: visible;
|
|
8383
|
-
}
|
|
8384
|
-
:scope g[data-mml-node="maction"][data-toggle] {
|
|
8385
|
-
cursor: pointer;
|
|
8386
|
-
}
|
|
8387
|
-
:scope mjx-container[jax="SVG"] path[data-c], :scope mjx-container[jax="SVG"] use[data-c] {
|
|
8388
|
-
stroke-width: 3;
|
|
8389
|
-
}
|
|
8390
|
-
:scope g[data-mml-node="xypic"] path {
|
|
8391
|
-
stroke-width: inherit;
|
|
8392
|
-
}
|
|
8393
|
-
`;
|
|
8394
|
-
var mathJaxStyles = (scopeId) => MATHJAX_STYLES.replaceAll(":scope", `#${scopeId}`).trim();
|
|
8395
|
-
//#endregion
|
|
8396
8441
|
//#region ../../packages/react/src/components/renderedHtmlSanitizer.ts
|
|
8397
8442
|
var FORBIDDEN_TAGS = [
|
|
8398
8443
|
"animate",
|
|
@@ -8417,15 +8462,12 @@ var FORBIDDEN_TAGS = [
|
|
|
8417
8462
|
"select",
|
|
8418
8463
|
"set",
|
|
8419
8464
|
"source",
|
|
8465
|
+
"style",
|
|
8420
8466
|
"textarea",
|
|
8421
8467
|
"track",
|
|
8422
8468
|
"video"
|
|
8423
8469
|
];
|
|
8424
|
-
var MATHJAX_TAGS = [
|
|
8425
|
-
"mjx-assistive-mml",
|
|
8426
|
-
"mjx-container",
|
|
8427
|
-
"style"
|
|
8428
|
-
];
|
|
8470
|
+
var MATHJAX_TAGS = ["mjx-assistive-mml", "mjx-container"];
|
|
8429
8471
|
var MATHJAX_ATTRS = [
|
|
8430
8472
|
"display",
|
|
8431
8473
|
"focusable",
|
|
@@ -8501,7 +8543,6 @@ var SAFE_CSS_FUNCTIONS = /* @__PURE__ */ new Set([
|
|
|
8501
8543
|
]);
|
|
8502
8544
|
var UNSAFE_CSS_PATTERN = /@import|behavior\s*:|binding\s*:|expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i;
|
|
8503
8545
|
var RAW_CSS_REJECT_PATTERN = /[\\@<]/;
|
|
8504
|
-
var MATHJAX_WRAPPER_ID = /^mjx-[a-f0-9]+$/i;
|
|
8505
8546
|
var PURIFY_CONFIG = {
|
|
8506
8547
|
ADD_ATTR: [...MATHJAX_ATTRS, "target"],
|
|
8507
8548
|
ADD_DATA_URI_TAGS: ["img"],
|
|
@@ -8537,12 +8578,6 @@ var getPurify = () => {
|
|
|
8537
8578
|
var installHooks = (purify) => {
|
|
8538
8579
|
if (hooksInstalled) return;
|
|
8539
8580
|
hooksInstalled = true;
|
|
8540
|
-
purify.addHook("uponSanitizeElement", (node, hookEvent) => {
|
|
8541
|
-
if (hookEvent.tagName !== "style" || !(node instanceof Element)) return;
|
|
8542
|
-
const css = sanitizeMathJaxStyleElement(node);
|
|
8543
|
-
if (css) node.textContent = css;
|
|
8544
|
-
else node.remove();
|
|
8545
|
-
});
|
|
8546
8581
|
purify.addHook("uponSanitizeAttribute", (node, hookEvent) => {
|
|
8547
8582
|
if (hookEvent.attrName === "style") {
|
|
8548
8583
|
if (node.tagName.toLowerCase() === "mjx-assistive-mml") {
|
|
@@ -8629,13 +8664,7 @@ var isSafeStyleValue = (property, value) => {
|
|
|
8629
8664
|
if (property.startsWith("margin") && /(?:^|\s)-/.test(value)) return false;
|
|
8630
8665
|
return true;
|
|
8631
8666
|
};
|
|
8632
|
-
var sanitizeMathJaxStyleElement = (element) => {
|
|
8633
|
-
const parent = element.parentElement;
|
|
8634
|
-
const scopeId = parent?.getAttribute("id") ?? "";
|
|
8635
|
-
if (parent?.tagName.toLowerCase() !== "span" || !MATHJAX_WRAPPER_ID.test(scopeId)) return "";
|
|
8636
|
-
return mathJaxStyles(scopeId);
|
|
8637
|
-
};
|
|
8638
8667
|
//#endregion
|
|
8639
8668
|
export { renderMarkdown, sanitizeRenderedHtml, truncateMarkdown };
|
|
8640
8669
|
|
|
8641
|
-
//# sourceMappingURL=markdownPipeline-
|
|
8670
|
+
//# sourceMappingURL=markdownPipeline-D23f-WkE.js.map
|