@macintacos/caret 1.7.1 → 1.8.1
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/.claude-plugin/plugin.json +1 -1
- package/README.md +10 -7
- package/dist/cli.js +869 -655
- package/opencode/caret.core.ts +14 -6
- package/opencode/caret.plugin.v2.ts +41 -15
- package/opencode/caret.tui.ts +290 -17
- package/opencode/opentui-solid.d.ts +8 -0
- package/opencode/permission.ts +3 -44
- package/opencode/review-bridge.ts +19 -4
- package/package.json +2 -2
- package/ui/dist/assets/{angular-html-C5q3--yq.js → angular-html-BHGQgfyp.js} +1 -1
- package/ui/dist/assets/{angular-ts-BZMKoLwh.js → angular-ts-CjJOXiTk.js} +1 -1
- package/ui/dist/assets/{apl-u_Y-hlKV.js → apl-BKCXbKuk.js} +1 -1
- package/ui/dist/assets/{astro-BcDNk4mM.js → astro-CbIGh4kW.js} +1 -1
- package/ui/dist/assets/{blade-CaHkf-2N.js → blade-Dlz3TW50.js} +1 -1
- package/ui/dist/assets/{c-Dsz8I3ow.js → c-CNaIUpZJ.js} +1 -1
- package/ui/dist/assets/{chapel-D5V-mLwt.js → chapel-BSTn-HqM.js} +1 -1
- package/ui/dist/assets/{cobol-CZ1x39wM.js → cobol-Ch_1nBvr.js} +1 -1
- package/ui/dist/assets/{coffee-CyYxatBI.js → coffee-DlKg6sYw.js} +1 -1
- package/ui/dist/assets/{cpp-BlgzdeXB.js → cpp-CPx3-f9p.js} +1 -1
- package/ui/dist/assets/{crystal-cKocbSAZ.js → crystal-Cgvix66v.js} +1 -1
- package/ui/dist/assets/{css-D0JtH5v_.js → css-CwPT7Xr2.js} +1 -1
- package/ui/dist/assets/{dist-Bj2SQgdr.js → dist-B7Ila1Oa.js} +1 -1
- package/ui/dist/assets/{dist-BIlCJN2Y.js → dist-BdIbTHZ2.js} +1 -1
- package/ui/dist/assets/{dist-BiNUUFHU.js → dist-BqPfD9yL.js} +1 -1
- package/ui/dist/assets/{dist-CrA0chnO.js → dist-BqrHiigI.js} +1 -1
- package/ui/dist/assets/{dist-c4FdccU4.js → dist-C6pK9dBg.js} +1 -1
- package/ui/dist/assets/{dist-BW8E7IFp.js → dist-CMPsnKBn.js} +2 -2
- package/ui/dist/assets/{dist-BtudxTi6.js → dist-CP875olq.js} +1 -1
- package/ui/dist/assets/{dist-CaG2AYjW.js → dist-Cq6qfECE.js} +1 -1
- package/ui/dist/assets/{dist-CM8mgDfc.js → dist-D2BIUS34.js} +1 -1
- package/ui/dist/assets/{dist-8wDQboSp.js → dist-DFQEDf6Q.js} +1 -1
- package/ui/dist/assets/{dist-BvoAsNKa.js → dist-DH3vs96X.js} +1 -1
- package/ui/dist/assets/{dist-C5H8xzaz.js → dist-DXddG2tW.js} +1 -1
- package/ui/dist/assets/{dist-CsUOEXXq.js → dist-Dze-hH7D.js} +1 -1
- package/ui/dist/assets/{dist-C0kJT6Lc.js → dist-H9wPekMH.js} +1 -1
- package/ui/dist/assets/{dist-BzruqOsf.js → dist-NwnWQZNa.js} +1 -1
- package/ui/dist/assets/{dist-Clc7NktG.js → dist-nsVj3Kzw.js} +1 -1
- package/ui/dist/assets/{dist-ldnZ9m94.js → dist-p9qfYPbt.js} +1 -1
- package/ui/dist/assets/{dist--iE_Uraw.js → dist-sf8u9yOd.js} +1 -1
- package/ui/dist/assets/{edge-BXjb1Fky.js → edge-C6856TSk.js} +1 -1
- package/ui/dist/assets/{elixir-D31Kjwlm.js → elixir-nUsO5D1t.js} +1 -1
- package/ui/dist/assets/{elm-B5mUFALO.js → elm-BWmeidnG.js} +1 -1
- package/ui/dist/assets/{erb-COidarKq.js → erb-DgYxypnH.js} +1 -1
- package/ui/dist/assets/{git-rebase-CO-FuYxX.js → git-rebase-Bu77Zji8.js} +1 -1
- package/ui/dist/assets/{glimmer-js-Dw-Aan3t.js → glimmer-js-C-Er2CH_.js} +1 -1
- package/ui/dist/assets/{glimmer-ts-Bm5Mn1Vj.js → glimmer-ts-DHJp3ZV-.js} +1 -1
- package/ui/dist/assets/{glsl-Cu8J8I23.js → glsl-CkN2-uXa.js} +1 -1
- package/ui/dist/assets/{graphql-DRmzT1X9.js → graphql-DM_zS2Al.js} +1 -1
- package/ui/dist/assets/{hack-CLlKhpHv.js → hack-BjOgct5l.js} +1 -1
- package/ui/dist/assets/{haml-BKV1Cxo8.js → haml-CY4ICINw.js} +1 -1
- package/ui/dist/assets/{handlebars-C4E1BT1n.js → handlebars-DLsdnsgP.js} +1 -1
- package/ui/dist/assets/{html-CHYMYiYm.js → html-Cw-p-zYu.js} +1 -1
- package/ui/dist/assets/{html-derivative-Ddt8f4l_.js → html-derivative-CDmHYwVW.js} +1 -1
- package/ui/dist/assets/{http-DroO1D8q.js → http-Bqbe5jqD.js} +1 -1
- package/ui/dist/assets/hurl-Ca-chcCT.js +1 -0
- package/ui/dist/assets/index-DLUt2ehA.js +4303 -0
- package/ui/dist/assets/index-P_fbn8LU.css +1 -0
- package/ui/dist/assets/{java-B83ftZow.js → java-0P1dqfZ8.js} +1 -1
- package/ui/dist/assets/{javascript-BKQ7dRer.js → javascript-VI2-fvZG.js} +1 -1
- package/ui/dist/assets/{jinja-pCX35ufE.js → jinja-Dz73I98G.js} +1 -1
- package/ui/dist/assets/{jison-DKS7kdv3.js → jison-BtT1z3MS.js} +1 -1
- package/ui/dist/assets/{json-DJDjr2Fk.js → json-C4tTi3F5.js} +1 -1
- package/ui/dist/assets/{jsx-BMvVlDf-.js → jsx-tTJjMA8e.js} +1 -1
- package/ui/dist/assets/julia-rokLSeEC.js +1 -0
- package/ui/dist/assets/{just-Bj4rsdYn.js → just-qeFPHb0X.js} +1 -1
- package/ui/dist/assets/{latex-Pfe9R48A.js → latex-Beecofx6.js} +1 -1
- package/ui/dist/assets/{liquid-DyT_91MF.js → liquid-DAA5lUdB.js} +1 -1
- package/ui/dist/assets/{lua-3K4juc6q.js → lua-BsloMLJI.js} +1 -1
- package/ui/dist/assets/marko-BohJpFVB.js +1 -0
- package/ui/dist/assets/{mdc-C99mMz9_.js → mdc-DcoaHcos.js} +1 -1
- package/ui/dist/assets/{nginx-BTww09OP.js → nginx-rrqwgIhx.js} +1 -1
- package/ui/dist/assets/{nim-BzlwRR3n.js → nim-bmLsCyNQ.js} +1 -1
- package/ui/dist/assets/{org-CljTStQ9.js → org-DBqD3zir.js} +1 -1
- package/ui/dist/assets/{perl-BcVv8945.js → perl-DTcxBbd6.js} +1 -1
- package/ui/dist/assets/{php-Cgj2CHLZ.js → php-CtncUr2-.js} +1 -1
- package/ui/dist/assets/{pug-C2lXyydO.js → pug-CIvCXkQY.js} +1 -1
- package/ui/dist/assets/{qml-Bl8egcGH.js → qml-NvdQJP41.js} +1 -1
- package/ui/dist/assets/{r-EJwt6W1C.js → r-CTxQa3JJ.js} +1 -1
- package/ui/dist/assets/{razor-CqdFmSYN.js → razor-6oObkjRl.js} +1 -1
- package/ui/dist/assets/{regexp-VbabPNwM.js → regexp-BoEgdKzz.js} +1 -1
- package/ui/dist/assets/rst-C1BRN5ux.js +1 -0
- package/ui/dist/assets/{ruby-D29JuVTu.js → ruby-ll_ilmOa.js} +1 -1
- package/ui/dist/assets/{sas-C-AnN273.js → sas-nmRD3ilr.js} +1 -1
- package/ui/dist/assets/{scss-BlX9mG-h.js → scss-DaWVZ0iP.js} +1 -1
- package/ui/dist/assets/{shellscript-CMUNLGjW.js → shellscript-CT8Jobwl.js} +1 -1
- package/ui/dist/assets/{shellsession-CU92PuJS.js → shellsession-CxpwtalA.js} +1 -1
- package/ui/dist/assets/{soy-B-tRZ9tr.js → soy-DEBXlOYH.js} +1 -1
- package/ui/dist/assets/{sql-DGtAX9J-.js → sql-3mfonMZP.js} +1 -1
- package/ui/dist/assets/{stata-MlknyQh8.js → stata-DaVf6BI8.js} +1 -1
- package/ui/dist/assets/{surrealql-DG9gpvrR.js → surrealql-BTM-6O5Q.js} +1 -1
- package/ui/dist/assets/{svelte-CRF-aI4U.js → svelte-CDPuyZop.js} +1 -1
- package/ui/dist/assets/{templ-D5LmSzZw.js → templ-CbDJ7JLK.js} +1 -1
- package/ui/dist/assets/{tex-rLbXYSuW.js → tex-DsKYCwQw.js} +1 -1
- package/ui/dist/assets/{ts-tags-BYnqcC40.js → ts-tags-BYhIdk0p.js} +1 -1
- package/ui/dist/assets/{tsx-DP4HxAmx.js → tsx-BjLM2BRB.js} +1 -1
- package/ui/dist/assets/{twig-CDmnuTZG.js → twig-DqinkzV-.js} +1 -1
- package/ui/dist/assets/{typescript-Ofbi-XAa.js → typescript-DH1pT4ZK.js} +1 -1
- package/ui/dist/assets/typst-BBE0SKCu.js +1 -0
- package/ui/dist/assets/{vue-AaAqfFpz.js → vue-DIIUy5X_.js} +1 -1
- package/ui/dist/assets/{vue-html-BzV_zJ1U.js → vue-html-BLERoY9d.js} +1 -1
- package/ui/dist/assets/{vue-vine-JBbwboUa.js → vue-vine-CGIG_xts.js} +1 -1
- package/ui/dist/assets/{xml-Bj-cIM0b.js → xml-BqbRoduq.js} +1 -1
- package/ui/dist/assets/{xsl-vvZR97oN.js → xsl-DZMfS9NA.js} +1 -1
- package/ui/dist/assets/{yaml-B-NDgHQf.js → yaml-BM5LLWf8.js} +1 -1
- package/ui/dist/index.html +3 -3
- package/ui/dist/assets/hurl-CAWxNLHB.js +0 -1
- package/ui/dist/assets/index-Cyh9CNgl.js +0 -4291
- package/ui/dist/assets/index-rBGdjbxx.css +0 -1
- package/ui/dist/assets/julia-uCo-07PP.js +0 -1
- package/ui/dist/assets/marko-VZPFNtBh.js +0 -1
- package/ui/dist/assets/rst-BgT4O1bg.js +0 -1
- package/ui/dist/assets/typst-DZ1MvNHq.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -1557,25 +1557,42 @@ var init_codex = __esm(() => {
|
|
|
1557
1557
|
});
|
|
1558
1558
|
|
|
1559
1559
|
// src/adapters/opencode/approve.ts
|
|
1560
|
-
|
|
1560
|
+
function declaredApproveVariants(ids) {
|
|
1561
|
+
if (!Array.isArray(ids) || !ids.includes(BUILD_VARIANT.id))
|
|
1562
|
+
return;
|
|
1563
|
+
return [...APPROVE_VARIANTS3, BUILD_VARIANT];
|
|
1564
|
+
}
|
|
1565
|
+
var APPROVE_VARIANTS3, BUILD_VARIANT;
|
|
1561
1566
|
var init_approve3 = __esm(() => {
|
|
1562
1567
|
APPROVE_VARIANTS3 = [
|
|
1563
1568
|
{ id: "default", label: "Approve", description: "Approve this plan" }
|
|
1564
1569
|
];
|
|
1570
|
+
BUILD_VARIANT = {
|
|
1571
|
+
id: "build",
|
|
1572
|
+
label: "Approve & build",
|
|
1573
|
+
description: "Approve and switch this session to the build agent"
|
|
1574
|
+
};
|
|
1565
1575
|
});
|
|
1566
1576
|
|
|
1567
1577
|
// src/adapters/opencode/feedback.ts
|
|
1568
1578
|
function toWireDecision(input) {
|
|
1569
1579
|
if (input.behavior === "allow") {
|
|
1570
1580
|
const notes = input.feedback?.trim();
|
|
1571
|
-
|
|
1581
|
+
const buildMode = input.acceptMode === BUILD_VARIANT.id ? input.acceptMode : undefined;
|
|
1582
|
+
return {
|
|
1583
|
+
behavior: "allow",
|
|
1584
|
+
...notes && { feedback: notes },
|
|
1585
|
+
...buildMode && { acceptMode: buildMode }
|
|
1586
|
+
};
|
|
1572
1587
|
}
|
|
1573
1588
|
return { behavior: "deny", feedback: denyMessage(input.feedback) };
|
|
1574
1589
|
}
|
|
1575
1590
|
function fatalDenyLine(reason) {
|
|
1576
1591
|
return JSON.stringify({ behavior: "deny", feedback: reason });
|
|
1577
1592
|
}
|
|
1578
|
-
var init_feedback3 = () => {
|
|
1593
|
+
var init_feedback3 = __esm(() => {
|
|
1594
|
+
init_approve3();
|
|
1595
|
+
});
|
|
1579
1596
|
|
|
1580
1597
|
// node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
1581
1598
|
function createScanner(text, ignoreTrivia = false) {
|
|
@@ -3390,12 +3407,13 @@ function hostCheck(hosts, keys, ignoredFiles) {
|
|
|
3390
3407
|
const faults = [];
|
|
3391
3408
|
const remedies = [];
|
|
3392
3409
|
for (const { bin, version } of hosts) {
|
|
3393
|
-
if (version === null
|
|
3410
|
+
if (version === null)
|
|
3394
3411
|
continue;
|
|
3395
3412
|
const shown = version.join(".");
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3413
|
+
const [floor, reason] = isV2Host(version) ? [V2_FLOOR, "the first where caret can review a plan file by `path`"] : [V1_FLOOR, "the first that loads caret"];
|
|
3414
|
+
if (isNewer(floor, shown)) {
|
|
3415
|
+
faults.push(`OpenCode ${shown} at ${bin} is older than ${floor}, ${reason}`);
|
|
3416
|
+
remedies.push(`upgrade OpenCode to ${floor} or later`);
|
|
3399
3417
|
}
|
|
3400
3418
|
}
|
|
3401
3419
|
const wrongKey = keys.find((k) => k !== pluginKeyFor(sharedHost(hosts)));
|
|
@@ -3425,7 +3443,7 @@ function hostCheck(hosts, keys, ignoredFiles) {
|
|
|
3425
3443
|
remedy: [...new Set(remedies)].join("; ")
|
|
3426
3444
|
};
|
|
3427
3445
|
}
|
|
3428
|
-
var OPENCODE_VERSION_TIMEOUT_MS = 5000, V1_FLOOR = "1.3.4";
|
|
3446
|
+
var OPENCODE_VERSION_TIMEOUT_MS = 5000, V1_FLOOR = "1.3.4", V2_FLOOR = "2.0.29";
|
|
3429
3447
|
var init_host = __esm(() => {
|
|
3430
3448
|
init_paths2();
|
|
3431
3449
|
});
|
|
@@ -21369,7 +21387,7 @@ var package_default;
|
|
|
21369
21387
|
var init_package = __esm(() => {
|
|
21370
21388
|
package_default = {
|
|
21371
21389
|
name: "@macintacos/caret",
|
|
21372
|
-
version: "1.
|
|
21390
|
+
version: "1.8.1",
|
|
21373
21391
|
license: "MIT",
|
|
21374
21392
|
type: "module",
|
|
21375
21393
|
description: "A Claude Code plugin that replaces the terminal plan-approval prompt with a local web UI for inline review, annotation, and approval.",
|
|
@@ -21423,7 +21441,7 @@ var init_package = __esm(() => {
|
|
|
21423
21441
|
"@laststance/tailwind-suggest-canonical-classes": "^0.1.1",
|
|
21424
21442
|
"@lezer/highlight": "^1.2.3",
|
|
21425
21443
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
21426
|
-
"@opencode/plugin": "^2.0.
|
|
21444
|
+
"@opencode/plugin": "^2.0.29",
|
|
21427
21445
|
"@pierre/diffs": "1.5.2",
|
|
21428
21446
|
"@pierre/trees": "1.0.0-beta.6",
|
|
21429
21447
|
"@playwright/test": "^1.62.1",
|
|
@@ -21748,7 +21766,8 @@ var init_opencode = __esm(() => {
|
|
|
21748
21766
|
sessionId: hook.session_id,
|
|
21749
21767
|
cwd: hook.cwd,
|
|
21750
21768
|
plan: hook.tool_input?.plan,
|
|
21751
|
-
planFilePath: hook.tool_input?.planFilePath
|
|
21769
|
+
planFilePath: hook.tool_input?.planFilePath,
|
|
21770
|
+
approveVariants: declaredApproveVariants(hook.approve_variants)
|
|
21752
21771
|
};
|
|
21753
21772
|
},
|
|
21754
21773
|
emitDecision(decision) {
|
|
@@ -23959,7 +23978,7 @@ var require_on_exit_leak_free = __commonJS(function(exports, module) {
|
|
|
23959
23978
|
var require_package = __commonJS(function(exports, module) {
|
|
23960
23979
|
module.exports = {
|
|
23961
23980
|
name: "thread-stream",
|
|
23962
|
-
version: "4.2.
|
|
23981
|
+
version: "4.2.1",
|
|
23963
23982
|
description: "A streaming way to send data to a Node.js Worker Thread",
|
|
23964
23983
|
main: "index.js",
|
|
23965
23984
|
types: "index.d.ts",
|
|
@@ -23970,7 +23989,7 @@ var require_package = __commonJS(function(exports, module) {
|
|
|
23970
23989
|
"real-require": "^1.0.0"
|
|
23971
23990
|
},
|
|
23972
23991
|
devDependencies: {
|
|
23973
|
-
"@types/node": "^
|
|
23992
|
+
"@types/node": "^26.1.1",
|
|
23974
23993
|
"@yao-pkg/pkg": "^6.0.0",
|
|
23975
23994
|
borp: "^1.0.0",
|
|
23976
23995
|
desm: "^1.3.0",
|
|
@@ -23980,16 +23999,21 @@ var require_package = __commonJS(function(exports, module) {
|
|
|
23980
23999
|
"pino-elasticsearch": "^9.0.0",
|
|
23981
24000
|
"sonic-boom": "^5.0.0",
|
|
23982
24001
|
"ts-node": "^10.8.0",
|
|
24002
|
+
tsd: "^0.33.0",
|
|
23983
24003
|
typescript: "~5.7.3"
|
|
23984
24004
|
},
|
|
23985
24005
|
scripts: {
|
|
23986
24006
|
build: "tsc --noEmit",
|
|
23987
24007
|
lint: "eslint",
|
|
23988
|
-
test: 'npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',
|
|
23989
|
-
"test:ci": 'npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"',
|
|
23990
|
-
"test:
|
|
24008
|
+
test: 'npm run lint && npm run build && npm run test:types && npm run transpile && borp --expose-gc --pattern "test/*.test.{js,mjs}"',
|
|
24009
|
+
"test:ci": 'npm run lint && npm run test:types && npm run transpile && borp --expose-gc --pattern "test/*.test.{js,mjs}"',
|
|
24010
|
+
"test:types": "tsd",
|
|
24011
|
+
"test:yarn": 'npm run transpile && borp --expose-gc --pattern "test/*.test.js"',
|
|
23991
24012
|
transpile: "sh ./test/ts/transpile.sh"
|
|
23992
24013
|
},
|
|
24014
|
+
tsd: {
|
|
24015
|
+
directory: "test/types"
|
|
24016
|
+
},
|
|
23993
24017
|
repository: {
|
|
23994
24018
|
type: "git",
|
|
23995
24019
|
url: "git+https://github.com/mcollina/thread-stream.git"
|
|
@@ -24014,12 +24038,16 @@ var require_wait = __commonJS(function(exports, module) {
|
|
|
24014
24038
|
var WAIT_MS = 1e4;
|
|
24015
24039
|
function wait(state, index, expected, timeout, done) {
|
|
24016
24040
|
const max = timeout === Infinity ? Infinity : Date.now() + timeout;
|
|
24017
|
-
const check = () => {
|
|
24041
|
+
const check = (previous) => {
|
|
24018
24042
|
const current = Atomics.load(state, index);
|
|
24019
|
-
if (current
|
|
24043
|
+
if (current >= expected) {
|
|
24020
24044
|
done(null, "ok");
|
|
24021
24045
|
return;
|
|
24022
24046
|
}
|
|
24047
|
+
if (previous !== undefined && current !== previous) {
|
|
24048
|
+
done(null, "not-equal");
|
|
24049
|
+
return;
|
|
24050
|
+
}
|
|
24023
24051
|
if (max !== Infinity && Date.now() > max) {
|
|
24024
24052
|
done(null, "timed-out");
|
|
24025
24053
|
return;
|
|
@@ -24027,9 +24055,16 @@ var require_wait = __commonJS(function(exports, module) {
|
|
|
24027
24055
|
const remaining = max === Infinity ? WAIT_MS : Math.min(WAIT_MS, Math.max(1, max - Date.now()));
|
|
24028
24056
|
const result = Atomics.waitAsync(state, index, current, remaining);
|
|
24029
24057
|
if (result.async) {
|
|
24030
|
-
result.value.then(
|
|
24058
|
+
result.value.then((res) => {
|
|
24059
|
+
if (res === "ok") {
|
|
24060
|
+
const latest = Atomics.load(state, index);
|
|
24061
|
+
done(null, latest >= expected ? "ok" : "not-equal");
|
|
24062
|
+
return;
|
|
24063
|
+
}
|
|
24064
|
+
check(current);
|
|
24065
|
+
});
|
|
24031
24066
|
} else {
|
|
24032
|
-
setImmediate(
|
|
24067
|
+
setImmediate(done, null, "not-equal");
|
|
24033
24068
|
}
|
|
24034
24069
|
};
|
|
24035
24070
|
check();
|
|
@@ -24107,6 +24142,7 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24107
24142
|
Atomics.store(stream[kImpl].state, READ_INDEX, 0);
|
|
24108
24143
|
Atomics.store(stream[kImpl].state, WRITE_INDEX, 0);
|
|
24109
24144
|
});
|
|
24145
|
+
Atomics.notify(stream[kImpl].state, READ_INDEX);
|
|
24110
24146
|
}
|
|
24111
24147
|
|
|
24112
24148
|
class FakeWeakRef {
|
|
@@ -24166,6 +24202,9 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24166
24202
|
function nextFlush(stream) {
|
|
24167
24203
|
while (true) {
|
|
24168
24204
|
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
24205
|
+
if (stream.destroyed || writeIndex < 0) {
|
|
24206
|
+
return;
|
|
24207
|
+
}
|
|
24169
24208
|
const leftover = stream[kImpl].data.length - writeIndex;
|
|
24170
24209
|
if (leftover > 0) {
|
|
24171
24210
|
if (stream[kImpl].bufLen === 0) {
|
|
@@ -24209,7 +24248,9 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24209
24248
|
}
|
|
24210
24249
|
switch (msg.code) {
|
|
24211
24250
|
case "READY":
|
|
24212
|
-
|
|
24251
|
+
if (!stream[kImpl].ending) {
|
|
24252
|
+
this.stream = new WeakRef2(stream);
|
|
24253
|
+
}
|
|
24213
24254
|
waitForRead(stream, () => {
|
|
24214
24255
|
stream[kImpl].ready = true;
|
|
24215
24256
|
stream.emit("ready");
|
|
@@ -24281,6 +24322,8 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24281
24322
|
this[kImpl].bufLen = 0;
|
|
24282
24323
|
this[kImpl].flushCallbacks = new Map;
|
|
24283
24324
|
this[kImpl].nextFlushId = 0;
|
|
24325
|
+
this[kImpl].flushRetainCount = 0;
|
|
24326
|
+
this[kImpl].userRef = true;
|
|
24284
24327
|
this.worker = createWorker(this, opts);
|
|
24285
24328
|
this.on("message", (message, transferList) => {
|
|
24286
24329
|
this.worker.postMessage(message, transferList);
|
|
@@ -24328,16 +24371,32 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24328
24371
|
return;
|
|
24329
24372
|
}
|
|
24330
24373
|
this[kImpl].ending = true;
|
|
24374
|
+
this.worker.stream = new FakeWeakRef(this);
|
|
24331
24375
|
end(this);
|
|
24332
24376
|
}
|
|
24333
24377
|
flush(cb) {
|
|
24334
|
-
|
|
24378
|
+
const userCb = typeof cb === "function" ? cb : null;
|
|
24379
|
+
cb = userCb || noop;
|
|
24380
|
+
if (userCb) {
|
|
24381
|
+
retainWorkerForPendingFlush(this);
|
|
24382
|
+
}
|
|
24383
|
+
let finished = false;
|
|
24384
|
+
const done = (err) => {
|
|
24385
|
+
if (finished) {
|
|
24386
|
+
return;
|
|
24387
|
+
}
|
|
24388
|
+
finished = true;
|
|
24389
|
+
if (userCb) {
|
|
24390
|
+
releaseWorkerForPendingFlush(this);
|
|
24391
|
+
}
|
|
24392
|
+
cb(err);
|
|
24393
|
+
};
|
|
24335
24394
|
flushBuffer(this, (err) => {
|
|
24336
24395
|
if (err) {
|
|
24337
|
-
process.nextTick(
|
|
24396
|
+
process.nextTick(done, err);
|
|
24338
24397
|
return;
|
|
24339
24398
|
}
|
|
24340
|
-
requestWorkerFlush(this,
|
|
24399
|
+
requestWorkerFlush(this, done);
|
|
24341
24400
|
});
|
|
24342
24401
|
}
|
|
24343
24402
|
flushSync() {
|
|
@@ -24348,9 +24407,13 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24348
24407
|
flushSync(this);
|
|
24349
24408
|
}
|
|
24350
24409
|
unref() {
|
|
24351
|
-
this.
|
|
24410
|
+
this[kImpl].userRef = false;
|
|
24411
|
+
if (this[kImpl].flushRetainCount === 0) {
|
|
24412
|
+
this.worker.unref();
|
|
24413
|
+
}
|
|
24352
24414
|
}
|
|
24353
24415
|
ref() {
|
|
24416
|
+
this[kImpl].userRef = true;
|
|
24354
24417
|
this.worker.ref();
|
|
24355
24418
|
}
|
|
24356
24419
|
get ready() {
|
|
@@ -24407,6 +24470,21 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24407
24470
|
cb();
|
|
24408
24471
|
});
|
|
24409
24472
|
}
|
|
24473
|
+
function retainWorkerForPendingFlush(stream) {
|
|
24474
|
+
if (stream[kImpl].flushRetainCount === 0) {
|
|
24475
|
+
stream.worker.ref();
|
|
24476
|
+
}
|
|
24477
|
+
stream[kImpl].flushRetainCount++;
|
|
24478
|
+
}
|
|
24479
|
+
function releaseWorkerForPendingFlush(stream) {
|
|
24480
|
+
if (stream[kImpl].flushRetainCount === 0) {
|
|
24481
|
+
return;
|
|
24482
|
+
}
|
|
24483
|
+
stream[kImpl].flushRetainCount--;
|
|
24484
|
+
if (stream[kImpl].flushRetainCount === 0 && !stream[kImpl].userRef) {
|
|
24485
|
+
stream.worker.unref();
|
|
24486
|
+
}
|
|
24487
|
+
}
|
|
24410
24488
|
function requestWorkerFlush(stream, cb) {
|
|
24411
24489
|
if (stream[kImpl].destroyed) {
|
|
24412
24490
|
process.nextTick(cb, new Error("the worker has exited"));
|
|
@@ -24558,6 +24636,9 @@ var require_thread_stream = __commonJS(function(exports, module) {
|
|
|
24558
24636
|
stream[kImpl].flushing = false;
|
|
24559
24637
|
while (stream[kImpl].bufLen !== 0) {
|
|
24560
24638
|
const writeIndex = Atomics.load(stream[kImpl].state, WRITE_INDEX);
|
|
24639
|
+
if (writeIndex < 0) {
|
|
24640
|
+
throw new Error("_writeSync failed");
|
|
24641
|
+
}
|
|
24561
24642
|
const leftover = stream[kImpl].data.length - writeIndex;
|
|
24562
24643
|
if (leftover === 0) {
|
|
24563
24644
|
flushSync(stream);
|
|
@@ -26679,6 +26760,7 @@ function toClientReview(review) {
|
|
|
26679
26760
|
generalCommentDraft: review.generalCommentDraft ?? "",
|
|
26680
26761
|
composerScratches: cur.composerScratches ?? [],
|
|
26681
26762
|
agentCopyMatches: cur.agentCopyMatches ?? false,
|
|
26763
|
+
approveVariants: review.approveVariants,
|
|
26682
26764
|
createdAt: review.createdAt,
|
|
26683
26765
|
updatedAt: review.updatedAt,
|
|
26684
26766
|
decision: review.decision
|
|
@@ -27450,6 +27532,8 @@ function isForeignWorld(h, currentStateDir) {
|
|
|
27450
27532
|
return h.stateDir !== undefined && !sameWorldPath(h.stateDir, currentStateDir);
|
|
27451
27533
|
}
|
|
27452
27534
|
async function ensureDaemon(deps, mode = "takeover") {
|
|
27535
|
+
if (deps.remote)
|
|
27536
|
+
return attachRemote(deps, mode);
|
|
27453
27537
|
const { timing } = deps;
|
|
27454
27538
|
const windowEnd = timing.now() + timing.windowMs;
|
|
27455
27539
|
const deadline = windowEnd + timing.reserveMs;
|
|
@@ -27537,6 +27621,23 @@ async function ensureDaemon(deps, mode = "takeover") {
|
|
|
27537
27621
|
}
|
|
27538
27622
|
throw new Error("caret daemon did not become healthy in time");
|
|
27539
27623
|
}
|
|
27624
|
+
async function attachRemote(deps, mode) {
|
|
27625
|
+
const { timing } = deps;
|
|
27626
|
+
const windowEnd = timing.now() + timing.windowMs;
|
|
27627
|
+
const draining = mode === "successor" ? (await deps.health(deps.baseUrl))?.instanceId : undefined;
|
|
27628
|
+
for (let attempt = 0;attempt < timing.maxAttempts && timing.now() < windowEnd; attempt++) {
|
|
27629
|
+
const h = await deps.health(deps.baseUrl);
|
|
27630
|
+
if (h && h.service !== "caret") {
|
|
27631
|
+
throw new Error(`${deps.baseUrl} is not a caret daemon \u2014 check daemon.host and daemon.port`);
|
|
27632
|
+
}
|
|
27633
|
+
if (h && (draining === undefined || h.instanceId !== draining))
|
|
27634
|
+
return deps.baseUrl;
|
|
27635
|
+
await timing.backoff(attempt);
|
|
27636
|
+
}
|
|
27637
|
+
if ((await deps.health(deps.baseUrl))?.service === "caret")
|
|
27638
|
+
return deps.baseUrl;
|
|
27639
|
+
throw new Error(`no caret daemon is answering at ${deps.baseUrl} \u2014 check that caret is running there ` + "and lists that address in its daemon.hostnames");
|
|
27640
|
+
}
|
|
27540
27641
|
function claimBoot(deps) {
|
|
27541
27642
|
const { bootMarker, timing } = deps;
|
|
27542
27643
|
if (bootMarker.claim({ pid: process.pid, claimedAt: timing.wallNow() })) {
|
|
@@ -27819,6 +27920,7 @@ async function prodEnsureDeps(s, service, reserveMs) {
|
|
|
27819
27920
|
return {
|
|
27820
27921
|
service: existsSync6(launcherServiceFile()) ? service() : undefined,
|
|
27821
27922
|
pinned: isLauncherPinned(),
|
|
27923
|
+
remote: isExposed(s.daemon.host) && await isAddrNotAvail(s.daemon.host),
|
|
27822
27924
|
baseUrl: daemonBaseUrl(s),
|
|
27823
27925
|
currentBuild: await currentBuildId(),
|
|
27824
27926
|
currentVersion: VERSION,
|
|
@@ -28390,7 +28492,7 @@ function runValidation(e, a) {
|
|
|
28390
28492
|
return e(a);
|
|
28391
28493
|
}
|
|
28392
28494
|
|
|
28393
|
-
class
|
|
28495
|
+
class y {
|
|
28394
28496
|
input;
|
|
28395
28497
|
output;
|
|
28396
28498
|
_abortSignal;
|
|
@@ -28548,10 +28650,10 @@ function g(l, e) {
|
|
|
28548
28650
|
if (e)
|
|
28549
28651
|
return l ? e : e[0];
|
|
28550
28652
|
}
|
|
28551
|
-
function
|
|
28653
|
+
function M(r) {
|
|
28552
28654
|
return [...r].map((t) => _2[t]);
|
|
28553
28655
|
}
|
|
28554
|
-
function
|
|
28656
|
+
function P2(r) {
|
|
28555
28657
|
const i = new Intl.DateTimeFormat(r, {
|
|
28556
28658
|
year: "numeric",
|
|
28557
28659
|
month: "2-digit",
|
|
@@ -28565,18 +28667,18 @@ function P(r) {
|
|
|
28565
28667
|
function p(r) {
|
|
28566
28668
|
return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
|
|
28567
28669
|
}
|
|
28568
|
-
function
|
|
28670
|
+
function f(r) {
|
|
28569
28671
|
return {
|
|
28570
28672
|
year: p(r.year),
|
|
28571
28673
|
month: p(r.month),
|
|
28572
28674
|
day: p(r.day)
|
|
28573
28675
|
};
|
|
28574
28676
|
}
|
|
28575
|
-
function
|
|
28677
|
+
function c2(r, t) {
|
|
28576
28678
|
return new Date(r || 2001, t || 1, 0).getDate();
|
|
28577
28679
|
}
|
|
28578
28680
|
function b(r) {
|
|
28579
|
-
const { year: t, month: i, day: s } =
|
|
28681
|
+
const { year: t, month: i, day: s } = f(r);
|
|
28580
28682
|
if (!t || t < 0 || t > 9999 || !i || i < 1 || i > 12 || !s || s < 1)
|
|
28581
28683
|
return;
|
|
28582
28684
|
const n = new Date(Date.UTC(t, i - 1, s));
|
|
@@ -28602,10 +28704,10 @@ function T2(r, t, i, s) {
|
|
|
28602
28704
|
max: e && t.year === e.year ? e.month : 12
|
|
28603
28705
|
} : {
|
|
28604
28706
|
min: n && t.year === n.year && t.month === n.month ? n.day : 1,
|
|
28605
|
-
max: e && t.year === e.year && t.month === e.month ? e.day :
|
|
28707
|
+
max: e && t.year === e.year && t.month === e.month ? e.day : c2(t.year, t.month)
|
|
28606
28708
|
};
|
|
28607
28709
|
}
|
|
28608
|
-
var import_sisteransi, a$1, t, settings2, R, CANCEL_SYMBOL, getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20, T$1, r, _2,
|
|
28710
|
+
var import_sisteransi, a$1, t, settings2, R, CANCEL_SYMBOL, getColumns = (e) => ("columns" in e) && typeof e.columns == "number" ? e.columns : 80, getRows = (e) => ("rows" in e) && typeof e.rows == "number" ? e.rows : 20, T$1, r, _2, U, u$2, o, h, a, u$1, n$1, u, n;
|
|
28609
28711
|
var init_dist4 = __esm(() => {
|
|
28610
28712
|
init_main2();
|
|
28611
28713
|
import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -28653,7 +28755,7 @@ var init_dist4 = __esm(() => {
|
|
|
28653
28755
|
};
|
|
28654
28756
|
R = globalThis.process.platform.startsWith("win");
|
|
28655
28757
|
CANCEL_SYMBOL = Symbol("clack:cancel");
|
|
28656
|
-
T$1 = class T extends
|
|
28758
|
+
T$1 = class T extends y {
|
|
28657
28759
|
filteredOptions;
|
|
28658
28760
|
multiple;
|
|
28659
28761
|
isNavigating = false;
|
|
@@ -28725,7 +28827,7 @@ var init_dist4 = __esm(() => {
|
|
|
28725
28827
|
}
|
|
28726
28828
|
}
|
|
28727
28829
|
};
|
|
28728
|
-
r = class r extends
|
|
28830
|
+
r = class r extends y {
|
|
28729
28831
|
get cursor() {
|
|
28730
28832
|
return this.value ? 0 : 1;
|
|
28731
28833
|
}
|
|
@@ -28747,7 +28849,7 @@ var init_dist4 = __esm(() => {
|
|
|
28747
28849
|
M: { type: "month", len: 2 },
|
|
28748
28850
|
D: { type: "day", len: 2 }
|
|
28749
28851
|
};
|
|
28750
|
-
|
|
28852
|
+
U = class U extends y {
|
|
28751
28853
|
#i;
|
|
28752
28854
|
#o;
|
|
28753
28855
|
#t;
|
|
@@ -28779,7 +28881,7 @@ var init_dist4 = __esm(() => {
|
|
|
28779
28881
|
this._setUserInput(this.#l(this.#t)), this._setValue(C2(this.#t) ?? undefined);
|
|
28780
28882
|
}
|
|
28781
28883
|
constructor(t) {
|
|
28782
|
-
const i = t.format ? { segments:
|
|
28884
|
+
const i = t.format ? { segments: M(t.format), separator: t.separator ?? "/" } : P2(t.locale), s = t.separator ?? i.separator, n = t.format ? M(t.format) : i.segments, e = t.initialValue ?? t.defaultValue, m = e ? {
|
|
28783
28885
|
year: String(e.getUTCFullYear()).padStart(4, "0"),
|
|
28784
28886
|
month: String(e.getUTCMonth() + 1).padStart(2, "0"),
|
|
28785
28887
|
day: String(e.getUTCDate()).padStart(2, "0")
|
|
@@ -28800,7 +28902,7 @@ var init_dist4 = __esm(() => {
|
|
|
28800
28902
|
const i = this.#a();
|
|
28801
28903
|
if (!i)
|
|
28802
28904
|
return;
|
|
28803
|
-
const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type,
|
|
28905
|
+
const { segment: s } = i, n = this.#t[s.type], e = !n || n.replace(/_/g, "") === "", m = Number.parseInt((n || "0").replace(/_/g, "0"), 10) || 0, o = T2(s.type, f(this.#t), this.#h, this.#u);
|
|
28804
28906
|
let a;
|
|
28805
28907
|
e ? a = t === 1 ? o.min : o.max : a = Math.max(Math.min(o.max, m + t), o.min), this.#t = {
|
|
28806
28908
|
...this.#t,
|
|
@@ -28875,7 +28977,7 @@ var init_dist4 = __esm(() => {
|
|
|
28875
28977
|
this.inlineError = "", this.#t[e.type] = l;
|
|
28876
28978
|
const y = l.includes("_") ? undefined : b(this.#t);
|
|
28877
28979
|
if (y) {
|
|
28878
|
-
const { year: h, month: d } = y, g =
|
|
28980
|
+
const { year: h, month: d } = y, g = c2(h, d);
|
|
28879
28981
|
this.#t = {
|
|
28880
28982
|
year: String(Math.max(0, Math.min(9999, h))).padStart(4, "0"),
|
|
28881
28983
|
month: String(Math.max(1, Math.min(12, d))).padStart(2, "0"),
|
|
@@ -28888,16 +28990,16 @@ var init_dist4 = __esm(() => {
|
|
|
28888
28990
|
}
|
|
28889
28991
|
}
|
|
28890
28992
|
#g(t, i) {
|
|
28891
|
-
const { month: s, day: n } =
|
|
28993
|
+
const { month: s, day: n } = f(t);
|
|
28892
28994
|
if (i.type === "month" && (s < 0 || s > 12))
|
|
28893
28995
|
return settings2.date.messages.invalidMonth;
|
|
28894
28996
|
if (i.type === "day" && (n < 0 || n > 31))
|
|
28895
28997
|
return settings2.date.messages.invalidDay(31, "any month");
|
|
28896
28998
|
}
|
|
28897
28999
|
#p(t) {
|
|
28898
|
-
const { year: i, month: s, day: n } =
|
|
29000
|
+
const { year: i, month: s, day: n } = f(this.#t);
|
|
28899
29001
|
if (i && s && n) {
|
|
28900
|
-
const e =
|
|
29002
|
+
const e = c2(i, s);
|
|
28901
29003
|
this.#t = {
|
|
28902
29004
|
...this.#t,
|
|
28903
29005
|
day: String(Math.min(n, e)).padStart(2, "0")
|
|
@@ -28906,7 +29008,7 @@ var init_dist4 = __esm(() => {
|
|
|
28906
29008
|
this.value = C2(this.#t) ?? t.defaultValue ?? undefined;
|
|
28907
29009
|
}
|
|
28908
29010
|
};
|
|
28909
|
-
u$2 = class u extends
|
|
29011
|
+
u$2 = class u extends y {
|
|
28910
29012
|
options;
|
|
28911
29013
|
cursor = 0;
|
|
28912
29014
|
#t;
|
|
@@ -28958,7 +29060,7 @@ var init_dist4 = __esm(() => {
|
|
|
28958
29060
|
}
|
|
28959
29061
|
};
|
|
28960
29062
|
o = /* @__PURE__ */ new Set(["up", "down", "left", "right"]);
|
|
28961
|
-
|
|
29063
|
+
h = class h extends y {
|
|
28962
29064
|
#t = false;
|
|
28963
29065
|
#s;
|
|
28964
29066
|
focused = "editor";
|
|
@@ -29041,7 +29143,7 @@ ${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
|
29041
29143
|
});
|
|
29042
29144
|
}
|
|
29043
29145
|
};
|
|
29044
|
-
a = class a extends
|
|
29146
|
+
a = class a extends y {
|
|
29045
29147
|
options;
|
|
29046
29148
|
cursor = 0;
|
|
29047
29149
|
get _value() {
|
|
@@ -29088,7 +29190,7 @@ ${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
|
29088
29190
|
});
|
|
29089
29191
|
}
|
|
29090
29192
|
};
|
|
29091
|
-
u$1 = class u extends
|
|
29193
|
+
u$1 = class u extends y {
|
|
29092
29194
|
_mask = "\u2022";
|
|
29093
29195
|
get cursor() {
|
|
29094
29196
|
return this._cursor;
|
|
@@ -29116,7 +29218,7 @@ ${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
|
29116
29218
|
});
|
|
29117
29219
|
}
|
|
29118
29220
|
};
|
|
29119
|
-
n$1 = class n extends
|
|
29221
|
+
n$1 = class n extends y {
|
|
29120
29222
|
options;
|
|
29121
29223
|
cursor = 0;
|
|
29122
29224
|
get _selectedValue() {
|
|
@@ -29144,7 +29246,7 @@ ${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
|
29144
29246
|
});
|
|
29145
29247
|
}
|
|
29146
29248
|
};
|
|
29147
|
-
u = class u extends
|
|
29249
|
+
u = class u extends y {
|
|
29148
29250
|
options;
|
|
29149
29251
|
cursor = 0;
|
|
29150
29252
|
constructor(t) {
|
|
@@ -29161,7 +29263,7 @@ ${i}` : `${s}${styleText("inverse", r)}${i}`;
|
|
|
29161
29263
|
});
|
|
29162
29264
|
}
|
|
29163
29265
|
};
|
|
29164
|
-
n = class n extends
|
|
29266
|
+
n = class n extends y {
|
|
29165
29267
|
get userInputWithCursor() {
|
|
29166
29268
|
if (this.state === "submit")
|
|
29167
29269
|
return this.userInput;
|
|
@@ -29268,10 +29370,10 @@ function formatInstructionFooter(o, e) {
|
|
|
29268
29370
|
const r = [`${e ? `${styleText2("cyan", S_BAR)} ` : ""}${o.join(" \u2022 ")}`];
|
|
29269
29371
|
return e && r.push(styleText2("cyan", S_BAR_END)), r;
|
|
29270
29372
|
}
|
|
29271
|
-
function
|
|
29373
|
+
function E2(t) {
|
|
29272
29374
|
return t.label ?? String(t.value ?? "");
|
|
29273
29375
|
}
|
|
29274
|
-
function
|
|
29376
|
+
function P3(t, c) {
|
|
29275
29377
|
if (!t)
|
|
29276
29378
|
return true;
|
|
29277
29379
|
const n = (c.label ?? String(c.value ?? "")).toLowerCase(), i = (c.hint ?? "").toLowerCase(), r = String(c.value).toLowerCase(), o = t.toLowerCase();
|
|
@@ -29426,14 +29528,14 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY =
|
|
|
29426
29528
|
initialUserInput: t.initialUserInput,
|
|
29427
29529
|
placeholder: t.placeholder,
|
|
29428
29530
|
completeOnTab: t.completeOnTab,
|
|
29429
|
-
filter: t.filter ?? ((n, i) =>
|
|
29531
|
+
filter: t.filter ?? ((n, i) => P3(n, i)),
|
|
29430
29532
|
signal: t.signal,
|
|
29431
29533
|
input: t.input,
|
|
29432
29534
|
output: t.output,
|
|
29433
29535
|
validate: t.validate,
|
|
29434
29536
|
render() {
|
|
29435
29537
|
const n = t.withGuide ?? settings2.withGuide, i = n ? [`${styleText2("gray", S_BAR)}`, `${symbol(this.state)} ${t.message}`] : [`${symbol(this.state)} ${t.message}`], r = this.userInput, o = this.options, m = t.placeholder, p = r === "" && m !== undefined, $ = (l, s) => {
|
|
29436
|
-
const a =
|
|
29538
|
+
const a = E2(l), u = l.hint && l.value === this.focusedValue ? styleText2("dim", ` (${l.hint})`) : "";
|
|
29437
29539
|
switch (s) {
|
|
29438
29540
|
case "active":
|
|
29439
29541
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${a}${u}`;
|
|
@@ -29445,7 +29547,7 @@ var import_sisteransi2, unicode, isCI = () => process.env.CI === "true", isTTY =
|
|
|
29445
29547
|
};
|
|
29446
29548
|
switch (this.state) {
|
|
29447
29549
|
case "submit": {
|
|
29448
|
-
const l = j2(this.selectedValues, o), s = l.length > 0 ? ` ${styleText2("dim", l.map(
|
|
29550
|
+
const l = j2(this.selectedValues, o), s = l.length > 0 ? ` ${styleText2("dim", l.map(E2).join(", "))}` : "", a = n ? styleText2("gray", S_BAR) : "";
|
|
29449
29551
|
return `${i.join(`
|
|
29450
29552
|
`)}
|
|
29451
29553
|
${a}${s}`;
|
|
@@ -29497,7 +29599,7 @@ ${s}${l}`;
|
|
|
29497
29599
|
options: t.options,
|
|
29498
29600
|
multiple: true,
|
|
29499
29601
|
placeholder: t.placeholder,
|
|
29500
|
-
filter: t.filter ?? ((i, r) =>
|
|
29602
|
+
filter: t.filter ?? ((i, r) => P3(i, r)),
|
|
29501
29603
|
validate: () => {
|
|
29502
29604
|
if (t.required && n.selectedValues.length === 0)
|
|
29503
29605
|
return "Please select at least one item";
|
|
@@ -29546,8 +29648,8 @@ ${s}${l}`;
|
|
|
29546
29648
|
}
|
|
29547
29649
|
});
|
|
29548
29650
|
return n.prompt();
|
|
29549
|
-
}, K2,
|
|
29550
|
-
const o = t?.output ?? process.stdout, i = getColumns(o), R = 1 * 2, u = t?.titlePadding ?? 1, h = t?.contentPadding ?? 2, w = t?.width === undefined || t.width === "auto" ? 1 : Math.min(1, t.width), m = t?.withGuide ?? settings2.withGuide ? `${styleText2("gray", S_BAR)} ` : "", b = t?.formatBorder ??
|
|
29651
|
+
}, K2, Q, U2 = (n) => n, box = (n = "", e = "", t) => {
|
|
29652
|
+
const o = t?.output ?? process.stdout, i = getColumns(o), R = 1 * 2, u = t?.titlePadding ?? 1, h = t?.contentPadding ?? 2, w = t?.width === undefined || t.width === "auto" ? 1 : Math.min(1, t.width), m = t?.withGuide ?? settings2.withGuide ? `${styleText2("gray", S_BAR)} ` : "", b = t?.formatBorder ?? U2, a = ((t?.rounded) ? K2 : Q).map(b), _ = b(S_BAR_H), p = b(S_BAR), x = dist_default2(m), B = dist_default2(e), y = i - x;
|
|
29551
29653
|
let r = Math.floor(i * w) - x;
|
|
29552
29654
|
if (t?.width === "auto") {
|
|
29553
29655
|
const c = n.split(`
|
|
@@ -29612,7 +29714,7 @@ ${g}
|
|
|
29612
29714
|
}).prompt();
|
|
29613
29715
|
}, date3 = (e) => {
|
|
29614
29716
|
const r = e.validate;
|
|
29615
|
-
return new
|
|
29717
|
+
return new U({
|
|
29616
29718
|
...e,
|
|
29617
29719
|
validate(t) {
|
|
29618
29720
|
if (t === undefined)
|
|
@@ -29861,7 +29963,7 @@ ${styleText2("gray", S_BAR_END)} ` : "";
|
|
|
29861
29963
|
i.write(`${e}${o}
|
|
29862
29964
|
|
|
29863
29965
|
`);
|
|
29864
|
-
}, multiline = (e) => new
|
|
29966
|
+
}, multiline = (e) => new h({
|
|
29865
29967
|
validate: e.validate,
|
|
29866
29968
|
placeholder: e.placeholder,
|
|
29867
29969
|
defaultValue: e.defaultValue,
|
|
@@ -29990,7 +30092,7 @@ ${n}
|
|
|
29990
30092
|
}
|
|
29991
30093
|
}
|
|
29992
30094
|
});
|
|
29993
|
-
},
|
|
30095
|
+
}, W2 = (l) => styleText2("magenta", l), spinner = ({
|
|
29994
30096
|
indicator: l = "dots",
|
|
29995
30097
|
onCancel: h,
|
|
29996
30098
|
output: n = process.stdout,
|
|
@@ -30003,7 +30105,7 @@ ${n}
|
|
|
30003
30105
|
} = {}) => {
|
|
30004
30106
|
const u = isCI();
|
|
30005
30107
|
let M, T, d = false, S = false, s = "", p, w = performance.now();
|
|
30006
|
-
const x = getColumns(n), k = I?.styleFrame ??
|
|
30108
|
+
const x = getColumns(n), k = I?.styleFrame ?? W2, g = (e) => {
|
|
30007
30109
|
const r = e > 1 ? O ?? settings2.messages.error : G ?? settings2.messages.cancel;
|
|
30008
30110
|
S = e === 1, d && (a(r, e), S && typeof h == "function" && h());
|
|
30009
30111
|
}, f = () => g(2), i = () => g(1), A = () => {
|
|
@@ -30070,7 +30172,7 @@ ${n}
|
|
|
30070
30172
|
return S;
|
|
30071
30173
|
}
|
|
30072
30174
|
};
|
|
30073
|
-
}, u2, SELECT_INSTRUCTIONS,
|
|
30175
|
+
}, u2, SELECT_INSTRUCTIONS, c3 = (t, o) => t.includes(`
|
|
30074
30176
|
`) ? t.split(`
|
|
30075
30177
|
`).map((d) => o(d)).join(`
|
|
30076
30178
|
`) : o(t), select = (t) => {
|
|
@@ -30080,15 +30182,15 @@ ${n}
|
|
|
30080
30182
|
const s = n.label ?? String(n.value);
|
|
30081
30183
|
switch (m) {
|
|
30082
30184
|
case "disabled":
|
|
30083
|
-
return `${styleText2("gray", S_RADIO_INACTIVE)} ${
|
|
30185
|
+
return `${styleText2("gray", S_RADIO_INACTIVE)} ${c3(s, (i) => styleText2("gray", i))}${n.hint ? ` ${styleText2("dim", `(${n.hint ?? "disabled"})`)}` : ""}`;
|
|
30084
30186
|
case "selected":
|
|
30085
|
-
return `${
|
|
30187
|
+
return `${c3(s, (i) => styleText2("dim", i))}`;
|
|
30086
30188
|
case "active":
|
|
30087
30189
|
return `${styleText2("green", S_RADIO_ACTIVE)} ${s}${n.hint ? ` ${styleText2("dim", `(${n.hint})`)}` : ""}`;
|
|
30088
30190
|
case "cancelled":
|
|
30089
|
-
return `${
|
|
30191
|
+
return `${c3(s, (i) => styleText2(["strikethrough", "dim"], i))}`;
|
|
30090
30192
|
default:
|
|
30091
|
-
return `${styleText2("dim", S_RADIO_INACTIVE)} ${
|
|
30193
|
+
return `${styleText2("dim", S_RADIO_INACTIVE)} ${c3(s, (i) => styleText2("dim", i))}`;
|
|
30092
30194
|
}
|
|
30093
30195
|
}, d = t.showInstructions ?? true;
|
|
30094
30196
|
return new n$1({
|
|
@@ -30178,7 +30280,7 @@ ${r}
|
|
|
30178
30280
|
const n = await t.task(s.message);
|
|
30179
30281
|
s.stop(n || t.title);
|
|
30180
30282
|
}
|
|
30181
|
-
},
|
|
30283
|
+
}, A = (l) => l.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), taskLog = (l) => {
|
|
30182
30284
|
const r = l.output ?? process.stdout, O = getColumns(r), i = styleText2("gray", S_BAR), p = l.spacing ?? 1, k = 3, m = l.retainLog === true, d = !isCI() && isTTY(r);
|
|
30183
30285
|
r.write(`${i}
|
|
30184
30286
|
`), r.write(`${styleText2("green", S_STEP_SUBMIT)} ${l.title}
|
|
@@ -30233,7 +30335,7 @@ ${e.value}` : e.value;
|
|
|
30233
30335
|
}
|
|
30234
30336
|
}, L = (e, s, t) => {
|
|
30235
30337
|
if (f(false), (t?.raw !== true || !v) && e.value !== "" && (e.value += `
|
|
30236
|
-
`), e.value +=
|
|
30338
|
+
`), e.value += A(s), v = t?.raw === true, l.limit !== undefined) {
|
|
30237
30339
|
const o = e.value.split(`
|
|
30238
30340
|
`), a = o.length - l.limit;
|
|
30239
30341
|
if (a > 0) {
|
|
@@ -30369,7 +30471,7 @@ var init_dist5 = __esm(() => {
|
|
|
30369
30471
|
S_CORNER_BOTTOM_LEFT,
|
|
30370
30472
|
S_CORNER_BOTTOM_RIGHT
|
|
30371
30473
|
];
|
|
30372
|
-
|
|
30474
|
+
Q = [S_BAR_START, S_BAR_START_RIGHT, S_BAR_END, S_BAR_END_RIGHT];
|
|
30373
30475
|
p2 = {
|
|
30374
30476
|
year: "yyyy",
|
|
30375
30477
|
month: "mm",
|
|
@@ -30464,7 +30566,8 @@ function buildEnvelope(plan, ctx) {
|
|
|
30464
30566
|
return JSON.stringify({
|
|
30465
30567
|
session_id: ctx.sessionID,
|
|
30466
30568
|
cwd: ctx.directory,
|
|
30467
|
-
tool_input: { plan, planFilePath: ctx.planFilePath }
|
|
30569
|
+
tool_input: { plan, planFilePath: ctx.planFilePath },
|
|
30570
|
+
approve_variants: ctx.approveVariants
|
|
30468
30571
|
});
|
|
30469
30572
|
}
|
|
30470
30573
|
function parseDecision(stdout) {
|
|
@@ -30474,7 +30577,12 @@ function parseDecision(stdout) {
|
|
|
30474
30577
|
const parsed = JSON.parse(line);
|
|
30475
30578
|
if (parsed.behavior === "allow") {
|
|
30476
30579
|
const notes = typeof parsed.feedback === "string" ? parsed.feedback.trim() : "";
|
|
30477
|
-
|
|
30580
|
+
const acceptMode = typeof parsed.acceptMode === "string" ? parsed.acceptMode : "";
|
|
30581
|
+
return {
|
|
30582
|
+
behavior: "allow",
|
|
30583
|
+
...notes && { feedback: notes },
|
|
30584
|
+
...acceptMode && { acceptMode }
|
|
30585
|
+
};
|
|
30478
30586
|
}
|
|
30479
30587
|
if (parsed.behavior === "deny") {
|
|
30480
30588
|
return {
|
|
@@ -45412,6 +45520,15 @@ class McpServer {
|
|
|
45412
45520
|
this._promptHandlersInitialized = false;
|
|
45413
45521
|
this.server = new Server(serverInfo, options);
|
|
45414
45522
|
this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
|
|
45523
|
+
if (options?.capabilities?.tools) {
|
|
45524
|
+
this.setToolRequestHandlers();
|
|
45525
|
+
}
|
|
45526
|
+
if (options?.capabilities?.resources) {
|
|
45527
|
+
this.setResourceRequestHandlers();
|
|
45528
|
+
}
|
|
45529
|
+
if (options?.capabilities?.prompts) {
|
|
45530
|
+
this.setPromptRequestHandlers();
|
|
45531
|
+
}
|
|
45415
45532
|
}
|
|
45416
45533
|
get experimental() {
|
|
45417
45534
|
if (!this._experimental) {
|
|
@@ -46755,184 +46872,184 @@ init_client();
|
|
|
46755
46872
|
init_log();
|
|
46756
46873
|
|
|
46757
46874
|
// node_modules/marked/lib/marked.esm.js
|
|
46758
|
-
function
|
|
46875
|
+
function H() {
|
|
46759
46876
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
46760
46877
|
}
|
|
46761
|
-
var
|
|
46762
|
-
function
|
|
46763
|
-
|
|
46878
|
+
var S = H();
|
|
46879
|
+
function se(a) {
|
|
46880
|
+
S = a;
|
|
46764
46881
|
}
|
|
46765
|
-
var
|
|
46882
|
+
var B = { exec: () => null };
|
|
46766
46883
|
function D(a) {
|
|
46767
46884
|
let e = [];
|
|
46768
46885
|
return (t) => {
|
|
46769
|
-
let n = Math.max(0, Math.min(3, t - 1)),
|
|
46770
|
-
return
|
|
46886
|
+
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
46887
|
+
return s || (s = a(n), e[n] = s), s;
|
|
46771
46888
|
};
|
|
46772
46889
|
}
|
|
46773
|
-
function
|
|
46774
|
-
let t = typeof a == "string" ? a : a.source, n = { replace: (
|
|
46890
|
+
function c(a, e = "") {
|
|
46891
|
+
let t = typeof a == "string" ? a : a.source, n = { replace: (s, r) => {
|
|
46775
46892
|
let o = typeof r == "string" ? r : r.source;
|
|
46776
|
-
return o = o.replace(
|
|
46893
|
+
return o = o.replace(T.caret, "$1"), t = t.replace(s, o), n;
|
|
46777
46894
|
}, getRegex: () => new RegExp(t, e) };
|
|
46778
46895
|
return n;
|
|
46779
46896
|
}
|
|
46780
|
-
var
|
|
46897
|
+
var Te = ((a = "") => {
|
|
46781
46898
|
try {
|
|
46782
46899
|
return !!new RegExp("(?<=1)(?<!1)" + a);
|
|
46783
46900
|
} catch {
|
|
46784
46901
|
return false;
|
|
46785
46902
|
}
|
|
46786
46903
|
})();
|
|
46787
|
-
var
|
|
46788
|
-
var
|
|
46789
|
-
var
|
|
46790
|
-
var
|
|
46791
|
-
var
|
|
46792
|
-
var
|
|
46793
|
-
var
|
|
46794
|
-
var
|
|
46795
|
-
var
|
|
46796
|
-
var
|
|
46797
|
-
var
|
|
46798
|
-
var
|
|
46799
|
-
var
|
|
46800
|
-
var
|
|
46801
|
-
var
|
|
46802
|
-
var
|
|
46803
|
-
var
|
|
46804
|
-
var
|
|
46805
|
-
var
|
|
46806
|
-
var
|
|
46807
|
-
var
|
|
46808
|
-
var
|
|
46809
|
-
var
|
|
46810
|
-
var
|
|
46811
|
-
var
|
|
46812
|
-
var
|
|
46813
|
-
]`).replace("lheading",
|
|
46814
|
-
var
|
|
46815
|
-
var
|
|
46816
|
-
var
|
|
46817
|
-
var
|
|
46818
|
-
var
|
|
46819
|
-
var
|
|
46820
|
-
var
|
|
46821
|
-
var
|
|
46822
|
-
var
|
|
46823
|
-
var
|
|
46824
|
-
var
|
|
46825
|
-
var
|
|
46826
|
-
var
|
|
46827
|
-
var
|
|
46828
|
-
var
|
|
46829
|
-
var
|
|
46830
|
-
var
|
|
46831
|
-
var
|
|
46832
|
-
var
|
|
46833
|
-
var
|
|
46834
|
-
var
|
|
46835
|
-
var
|
|
46836
|
-
var
|
|
46837
|
-
var
|
|
46838
|
-
var
|
|
46839
|
-
var
|
|
46840
|
-
var
|
|
46841
|
-
var
|
|
46842
|
-
var
|
|
46843
|
-
var
|
|
46844
|
-
var
|
|
46845
|
-
var
|
|
46846
|
-
var
|
|
46847
|
-
var
|
|
46848
|
-
var
|
|
46849
|
-
var
|
|
46850
|
-
var
|
|
46851
|
-
var
|
|
46852
|
-
var
|
|
46853
|
-
var
|
|
46854
|
-
var
|
|
46855
|
-
var
|
|
46856
|
-
var
|
|
46857
|
-
var
|
|
46858
|
-
var
|
|
46859
|
-
var
|
|
46860
|
-
var
|
|
46861
|
-
var
|
|
46862
|
-
var
|
|
46863
|
-
var
|
|
46864
|
-
var
|
|
46865
|
-
var
|
|
46866
|
-
var
|
|
46867
|
-
function
|
|
46904
|
+
var T = { codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, endingSpaceTabChar: /[ \t]$/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, leadingSpaceTab: /^[ \t]+/, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, blockquoteMarkerWhitespace: /^( {0,3}>)([ \t]+)/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\][ \t]+\S/, listReplaceTask: /^\[[ xX]\][ \t]+/, 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, numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/, numericCharacterReferenceOrAmpersand: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, 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: (a) => new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: D((a) => new RegExp(`^ {0,${a}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: D((a) => new RegExp(`^ {0,${a}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)), fencesBeginRegex: D((a) => new RegExp(`^ {0,${a}}(?:\`\`\`|~~~)`)), headingBeginRegex: D((a) => new RegExp(`^ {0,${a}}#{1,6}(?:\\s|$)`)), pedanticHeadingBeginRegex: D((a) => new RegExp(`^ {0,${a}}#`)), htmlBeginRegex: D((a) => new RegExp(`^ {0,${a}}(?:</?(?:${K})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`, "i")), blockquoteBeginRegex: D((a) => new RegExp(`^ {0,${a}}>`)) };
|
|
46905
|
+
var ve = /^(?:[ \t]*(?:\n|$))+/;
|
|
46906
|
+
var Ze = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
46907
|
+
var He = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/;
|
|
46908
|
+
var W = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
46909
|
+
var je = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
46910
|
+
var oe = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
46911
|
+
var Oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/;
|
|
46912
|
+
var we = c(Oe).replace(/bull/g, oe).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
46913
|
+
var Ge = c(Oe).replace(/bull/g, oe).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}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
46914
|
+
var ae = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
|
46915
|
+
var Ne = /^[^\n]+/;
|
|
46916
|
+
var le = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/;
|
|
46917
|
+
var Fe = c(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", le).replace("title", /(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex();
|
|
46918
|
+
var Qe = c(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, oe).getRegex();
|
|
46919
|
+
var K = "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";
|
|
46920
|
+
var ue = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
46921
|
+
var Ue = c("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$))", "i").replace("comment", ue).replace("tag", K).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
46922
|
+
var Pe = (a) => c(ae).replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", a).replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex();
|
|
46923
|
+
var We = Pe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
|
46924
|
+
var Ke = Pe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
|
46925
|
+
var Xe = c(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph", Ke).getRegex();
|
|
46926
|
+
var pe = { blockquote: Xe, code: Ze, def: Fe, fences: He, heading: je, hr: W, html: Ue, lheading: we, list: Qe, newline: ve, paragraph: We, table: B, text: Ne };
|
|
46927
|
+
var xe = c("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}\t)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex();
|
|
46928
|
+
var Ve = { ...pe, lheading: Ge, table: xe, paragraph: c(ae).replace("hr", W).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", xe).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", K).getRegex() };
|
|
46929
|
+
var Je = { ...pe, html: c(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment", ue).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: B, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: c(ae).replace("hr", W).replace("heading", ` *#{1,6} *[^
|
|
46930
|
+
]`).replace("lheading", we).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
46931
|
+
var Ye = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
46932
|
+
var et = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
46933
|
+
var Se = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
|
|
46934
|
+
var tt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
46935
|
+
var $ = /[\p{P}\p{S}]/u;
|
|
46936
|
+
var j = /[\s\p{P}\p{S}]/u;
|
|
46937
|
+
var X = /[^\s\p{P}\p{S}]/u;
|
|
46938
|
+
var nt = c(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, j).getRegex();
|
|
46939
|
+
var rt = /[\p{Pi}\p{Ps}"']/u;
|
|
46940
|
+
var ye = /(?!~)[\p{P}\p{S}]/u;
|
|
46941
|
+
var st = /(?!~)[\s\p{P}\p{S}]/u;
|
|
46942
|
+
var it = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
46943
|
+
var ot = c(/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();
|
|
46944
|
+
var _e = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
46945
|
+
var at = c(_e, "u").replace(/punct/g, $).getRegex();
|
|
46946
|
+
var lt = c(_e, "u").replace(/punct/g, ye).getRegex();
|
|
46947
|
+
var ut = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
|
|
46948
|
+
var pt = c(ut, "u").replace(/openQuote/g, rt).replace(/punct/g, $).getRegex();
|
|
46949
|
+
var $e = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
46950
|
+
var ct = c($e, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
46951
|
+
var ht = c($e, "gu").replace(/notPunctSpace/g, it).replace(/punctSpace/g, st).replace(/punct/g, ye).getRegex();
|
|
46952
|
+
var dt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
|
|
46953
|
+
var gt = c(dt, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
46954
|
+
var kt = c("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
46955
|
+
var ft = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
|
|
46956
|
+
var mt = c(ft, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
46957
|
+
var xt = c(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, $).getRegex();
|
|
46958
|
+
var bt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
46959
|
+
var Rt = c(bt, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, j).replace(/punct/g, $).getRegex();
|
|
46960
|
+
var Tt = c(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
46961
|
+
var Ot = c(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
46962
|
+
var wt = c(/^<(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();
|
|
46963
|
+
var Pt = c(ue).replace("(?:-->|$)", "-->").getRegex();
|
|
46964
|
+
var St = c("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Pt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
46965
|
+
var Le = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
|
|
46966
|
+
var re = c(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Le).getRegex();
|
|
46967
|
+
var yt = c(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", re).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex();
|
|
46968
|
+
var _t = c(/^!?\[(label)\]\[(ref)\]/).replace("label", re).replace("ref", le).getRegex();
|
|
46969
|
+
var $t = c(/^!?\[(ref)\](?:\[\])?/).replace("ref", le).getRegex();
|
|
46970
|
+
var be = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
|
|
46971
|
+
var Lt = c(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Le).getRegex();
|
|
46972
|
+
var Ct = c("reflink|nolink(?!\\()", "g").replace("reflink", c(/^!?\[(label)\]\[(ref)\]/).replace("label", Lt).replace("ref", be).getRegex()).replace("nolink", c(/^!?\[(ref)\](?:\[\])?/).replace("ref", be).getRegex()).getRegex();
|
|
46973
|
+
var Re = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
46974
|
+
var It = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/;
|
|
46975
|
+
var At = c(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, It).getRegex();
|
|
46976
|
+
var ce = { _backpedal: B, anyPunctuation: Tt, anyPunctuationOutsideCode: Ot, autolink: wt, blockSkip: ot, br: Se, code: et, del: B, delLDelim: B, delRDelim: B, emStrongLDelim: at, emStrongRDelimAst: ct, emStrongRDelimUnd: kt, escape: Ye, link: yt, nolink: $t, punctuation: nt, reflink: _t, reflinkSearch: Ct, tag: St, text: tt, url: B };
|
|
46977
|
+
var Et = { ...ce, emStrongLDelim: pt, emStrongRDelimAst: gt, emStrongRDelimUnd: mt, link: c(/^!?\[(label)\]\((.*?)\)/).replace("label", re).getRegex(), reflink: c(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", re).getRegex() };
|
|
46978
|
+
var ie = { ...ce, emStrongRDelimAst: ht, emStrongLDelim: lt, delLDelim: xt, delRDelim: Rt, url: c(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", At).replace("protocol", Re).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: c(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Re).replace(/emailProtocol/g, /(?:mailto|xmpp):/).replace("wwwStart", Te ? "(?<![^\\s*_~(])www\\." : "www\\.").getRegex() };
|
|
46979
|
+
var zt = { ...ie, br: c(Se).replace("{2,}", "*").getRegex(), text: c(ie.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
46980
|
+
var V = { normal: pe, gfm: Ve, pedantic: Je };
|
|
46981
|
+
var G = { normal: ce, gfm: ie, breaks: zt, pedantic: Et };
|
|
46982
|
+
var Mt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
46983
|
+
var Ce = (a) => Mt[a];
|
|
46984
|
+
function P(a, e) {
|
|
46868
46985
|
if (e) {
|
|
46869
|
-
if (
|
|
46870
|
-
return a.replace(
|
|
46871
|
-
} else if (
|
|
46872
|
-
return a.replace(
|
|
46986
|
+
if (T.escapeTest.test(a))
|
|
46987
|
+
return a.replace(T.escapeReplace, Ce);
|
|
46988
|
+
} else if (T.escapeTestNoEncode.test(a))
|
|
46989
|
+
return a.replace(T.escapeReplaceNoEncode, Ce);
|
|
46873
46990
|
return a;
|
|
46874
46991
|
}
|
|
46875
|
-
function
|
|
46876
|
-
return
|
|
46992
|
+
function Ie(a) {
|
|
46993
|
+
return T.numericCharacterReference.test(a) ? a.replace(T.numericCharacterReferenceOrAmpersand, (e, t, n) => {
|
|
46877
46994
|
if (t === undefined && n === undefined)
|
|
46878
46995
|
return "&";
|
|
46879
|
-
let
|
|
46880
|
-
return
|
|
46996
|
+
let s = t === undefined ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
46997
|
+
return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "\uFFFD" : s === 38 ? "&" : String.fromCodePoint(s);
|
|
46881
46998
|
}) : a;
|
|
46882
46999
|
}
|
|
46883
|
-
function
|
|
47000
|
+
function he(a) {
|
|
46884
47001
|
try {
|
|
46885
|
-
a = encodeURI(a).replace(
|
|
47002
|
+
a = encodeURI(a).replace(T.percentDecode, "%");
|
|
46886
47003
|
} catch {
|
|
46887
47004
|
return null;
|
|
46888
47005
|
}
|
|
46889
47006
|
return a;
|
|
46890
47007
|
}
|
|
46891
|
-
function
|
|
46892
|
-
let t = a.replace(
|
|
46893
|
-
let l = false,
|
|
46894
|
-
for (;--
|
|
47008
|
+
function de(a, e) {
|
|
47009
|
+
let t = a.replace(T.findPipe, (r, o, i) => {
|
|
47010
|
+
let l = false, p = o;
|
|
47011
|
+
for (;--p >= 0 && i[p] === "\\"; )
|
|
46895
47012
|
l = !l;
|
|
46896
47013
|
return l ? "|" : " |";
|
|
46897
|
-
}), n = t.split(
|
|
47014
|
+
}), n = t.split(T.splitPipe), s = 0;
|
|
46898
47015
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e)
|
|
46899
47016
|
if (n.length > e)
|
|
46900
47017
|
n.splice(e);
|
|
46901
47018
|
else
|
|
46902
47019
|
for (;n.length < e; )
|
|
46903
47020
|
n.push("");
|
|
46904
|
-
for (;
|
|
46905
|
-
n[
|
|
47021
|
+
for (;s < n.length; s++)
|
|
47022
|
+
n[s] = n[s].trim().replace(T.slashPipe, "|");
|
|
46906
47023
|
return n;
|
|
46907
47024
|
}
|
|
46908
|
-
function
|
|
47025
|
+
function L(a, e, t) {
|
|
46909
47026
|
let n = a.length;
|
|
46910
47027
|
if (n === 0)
|
|
46911
47028
|
return "";
|
|
46912
|
-
let
|
|
46913
|
-
for (;
|
|
46914
|
-
let r = a.charAt(n -
|
|
47029
|
+
let s = 0;
|
|
47030
|
+
for (;s < n; ) {
|
|
47031
|
+
let r = a.charAt(n - s - 1);
|
|
46915
47032
|
if (r === e && !t)
|
|
46916
|
-
|
|
47033
|
+
s++;
|
|
46917
47034
|
else if (r !== e && t)
|
|
46918
|
-
|
|
47035
|
+
s++;
|
|
46919
47036
|
else
|
|
46920
47037
|
break;
|
|
46921
47038
|
}
|
|
46922
|
-
return a.slice(0, n -
|
|
47039
|
+
return a.slice(0, n - s);
|
|
46923
47040
|
}
|
|
46924
|
-
function
|
|
47041
|
+
function ge(a) {
|
|
46925
47042
|
let e = a.split(`
|
|
46926
47043
|
`), t = e.length - 1;
|
|
46927
|
-
for (;t >= 0 &&
|
|
47044
|
+
for (;t >= 0 && T.blankLine.test(e[t]); )
|
|
46928
47045
|
t--;
|
|
46929
47046
|
return e.length - t <= 2 ? a : e.slice(0, t + 1).join(`
|
|
46930
47047
|
`);
|
|
46931
47048
|
}
|
|
46932
|
-
function
|
|
46933
|
-
return a.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
47049
|
+
function F(a) {
|
|
47050
|
+
return a.trim().replace(T.multipleSpaceGlobal, " ").toLowerCase().toUpperCase().toLowerCase();
|
|
46934
47051
|
}
|
|
46935
|
-
function
|
|
47052
|
+
function ke(a, e) {
|
|
46936
47053
|
if (a.indexOf(e[0]) === -1 && a.indexOf(e[1]) === -1)
|
|
46937
47054
|
return -1;
|
|
46938
47055
|
let t = 0;
|
|
@@ -46945,66 +47062,98 @@ function le(a, e) {
|
|
|
46945
47062
|
return n;
|
|
46946
47063
|
return t > 0 ? -2 : -1;
|
|
46947
47064
|
}
|
|
46948
|
-
|
|
47065
|
+
var N = new WeakMap;
|
|
47066
|
+
function fe(a) {
|
|
47067
|
+
let e = { "*": -1, _: -1 }, t = -1, n = a.length;
|
|
47068
|
+
for (let s = 0;s < n; s++) {
|
|
47069
|
+
let r = a[s];
|
|
47070
|
+
if (r !== "*" && r !== "_" && r !== "~")
|
|
47071
|
+
continue;
|
|
47072
|
+
let o = s === 0 ? `
|
|
47073
|
+
` : a[s - 1], i = s + 1;
|
|
47074
|
+
for (;i < n && a[i] === r; )
|
|
47075
|
+
i++;
|
|
47076
|
+
o !== " " && o !== "\t" && o !== `
|
|
47077
|
+
` && o !== "\r" && o !== "\f" && (r === "~" ? t = s : e[r] = s), s = i - 1;
|
|
47078
|
+
}
|
|
47079
|
+
return { maskedSrc: a, lastPossibleEmStrongCloserIndex: e, lastPossibleDelCloserIndex: t };
|
|
47080
|
+
}
|
|
47081
|
+
function Ae(a, e) {
|
|
47082
|
+
let t = fe(e), n = N.get(a);
|
|
47083
|
+
n ? n.push(t) : N.set(a, [t]);
|
|
47084
|
+
}
|
|
47085
|
+
function Ee(a) {
|
|
47086
|
+
let e = N.get(a);
|
|
47087
|
+
e && (e.pop(), e.length === 0 && N.delete(a));
|
|
47088
|
+
}
|
|
47089
|
+
function ze(a, e, t) {
|
|
47090
|
+
let n = N.get(a)?.at(-1);
|
|
47091
|
+
return n && n.maskedSrc === e ? n.lastPossibleEmStrongCloserIndex[t] : fe(e).lastPossibleEmStrongCloserIndex[t];
|
|
47092
|
+
}
|
|
47093
|
+
function Me(a, e) {
|
|
47094
|
+
let t = N.get(a)?.at(-1);
|
|
47095
|
+
return t && t.maskedSrc === e ? t.lastPossibleDelCloserIndex : fe(e).lastPossibleDelCloserIndex;
|
|
47096
|
+
}
|
|
47097
|
+
function J(a, e = 0) {
|
|
46949
47098
|
let t = e, n = "";
|
|
46950
|
-
for (let
|
|
46951
|
-
if (
|
|
47099
|
+
for (let s of a)
|
|
47100
|
+
if (s === "\t") {
|
|
46952
47101
|
let r = 4 - t % 4;
|
|
46953
47102
|
n += " ".repeat(r), t += r;
|
|
46954
47103
|
} else
|
|
46955
|
-
n +=
|
|
47104
|
+
n += s, t++;
|
|
46956
47105
|
return n;
|
|
46957
47106
|
}
|
|
46958
|
-
function
|
|
46959
|
-
let r = e.href, o = e.title || null,
|
|
47107
|
+
function De(a, e, t, n, s) {
|
|
47108
|
+
let r = e.href, o = e.title || null, i = a[1].replace(s.other.outputLinkReplace, "$1"), l = a[0].charAt(0) === "!", p = n.state.inLink, h = n.state.linkEmitted, u = n.state.inRawBlock;
|
|
46960
47109
|
n.state.inLink = true, n.state.linkEmitted = false;
|
|
46961
|
-
let d = n.inlineTokens(
|
|
46962
|
-
if (n.state.linkEmitted =
|
|
46963
|
-
if (
|
|
46964
|
-
n.state.inRawBlock =
|
|
47110
|
+
let d = n.inlineTokens(i), k = n.state.linkEmitted;
|
|
47111
|
+
if (n.state.linkEmitted = h, n.state.inLink = p, !l) {
|
|
47112
|
+
if (k) {
|
|
47113
|
+
n.state.inRawBlock = u;
|
|
46965
47114
|
return;
|
|
46966
47115
|
}
|
|
46967
47116
|
n.state.linkEmitted = true;
|
|
46968
47117
|
}
|
|
46969
|
-
return { type: l ? "image" : "link", raw: t, href: r, title: o, text:
|
|
47118
|
+
return { type: l ? "image" : "link", raw: t, href: r, title: o, text: i, tokens: d };
|
|
46970
47119
|
}
|
|
46971
|
-
function
|
|
47120
|
+
function Dt(a, e, t) {
|
|
46972
47121
|
let n = a.match(t.other.indentCodeCompensation);
|
|
46973
47122
|
if (n === null)
|
|
46974
47123
|
return e;
|
|
46975
|
-
let
|
|
47124
|
+
let s = n[1];
|
|
46976
47125
|
return e.split(`
|
|
46977
47126
|
`).map((r) => {
|
|
46978
47127
|
let o = r.match(t.other.beginningSpace);
|
|
46979
47128
|
if (o === null)
|
|
46980
47129
|
return r;
|
|
46981
|
-
let [
|
|
46982
|
-
return r.slice(Math.min(
|
|
47130
|
+
let [i] = o;
|
|
47131
|
+
return r.slice(Math.min(i.length, s.length));
|
|
46983
47132
|
}).join(`
|
|
46984
47133
|
`);
|
|
46985
47134
|
}
|
|
46986
|
-
function
|
|
47135
|
+
function Be(a, e, t, n) {
|
|
46987
47136
|
if (!e.includes("<"))
|
|
46988
47137
|
return false;
|
|
46989
|
-
for (let
|
|
46990
|
-
if (e[
|
|
46991
|
-
|
|
47138
|
+
for (let s = 0;s < e.length; s++) {
|
|
47139
|
+
if (e[s] === "\\") {
|
|
47140
|
+
s++;
|
|
46992
47141
|
continue;
|
|
46993
47142
|
}
|
|
46994
|
-
if (e[
|
|
46995
|
-
let
|
|
46996
|
-
if (
|
|
46997
|
-
|
|
47143
|
+
if (e[s] === "`") {
|
|
47144
|
+
let i = n.inline.code.exec(e.slice(s));
|
|
47145
|
+
if (i) {
|
|
47146
|
+
s += i[0].length - 1;
|
|
46998
47147
|
continue;
|
|
46999
47148
|
}
|
|
47000
47149
|
}
|
|
47001
|
-
if (e[
|
|
47150
|
+
if (e[s] !== "<")
|
|
47002
47151
|
continue;
|
|
47003
|
-
let r = a.slice(t +
|
|
47152
|
+
let r = a.slice(t + s), o = n.inline.tag.exec(r) || n.inline.autolink.exec(r);
|
|
47004
47153
|
if (o) {
|
|
47005
|
-
if (o[0].length > e.length -
|
|
47154
|
+
if (o[0].length > e.length - s)
|
|
47006
47155
|
return true;
|
|
47007
|
-
|
|
47156
|
+
s += o[0].length - 1;
|
|
47008
47157
|
}
|
|
47009
47158
|
}
|
|
47010
47159
|
return false;
|
|
@@ -47014,7 +47163,7 @@ var _ = class {
|
|
|
47014
47163
|
rules;
|
|
47015
47164
|
lexer;
|
|
47016
47165
|
constructor(e) {
|
|
47017
|
-
this.options = e ||
|
|
47166
|
+
this.options = e || S;
|
|
47018
47167
|
}
|
|
47019
47168
|
space(e) {
|
|
47020
47169
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -47024,15 +47173,15 @@ var _ = class {
|
|
|
47024
47173
|
code(e) {
|
|
47025
47174
|
let t = this.rules.block.code.exec(e);
|
|
47026
47175
|
if (t) {
|
|
47027
|
-
let n = this.options.pedantic ? t[0] :
|
|
47028
|
-
return { type: "code", raw: n, codeBlockStyle: "indented", text:
|
|
47176
|
+
let n = this.options.pedantic ? t[0] : ge(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
47177
|
+
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
47029
47178
|
}
|
|
47030
47179
|
}
|
|
47031
47180
|
fences(e) {
|
|
47032
47181
|
let t = this.rules.block.fences.exec(e);
|
|
47033
47182
|
if (t) {
|
|
47034
|
-
let n = t[0],
|
|
47035
|
-
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text:
|
|
47183
|
+
let n = t[0], s = Dt(n, t[3] || "", this.rules);
|
|
47184
|
+
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
47036
47185
|
}
|
|
47037
47186
|
}
|
|
47038
47187
|
heading(e) {
|
|
@@ -47040,175 +47189,187 @@ var _ = class {
|
|
|
47040
47189
|
if (t) {
|
|
47041
47190
|
let n = t[2].trim();
|
|
47042
47191
|
if (this.rules.other.endingHash.test(n)) {
|
|
47043
|
-
let
|
|
47044
|
-
(this.options.pedantic || !
|
|
47192
|
+
let s = L(n, "#");
|
|
47193
|
+
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (n = s.trim());
|
|
47045
47194
|
}
|
|
47046
|
-
return { type: "heading", raw:
|
|
47195
|
+
return { type: "heading", raw: L(t[0], `
|
|
47047
47196
|
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
47048
47197
|
}
|
|
47049
47198
|
}
|
|
47050
47199
|
hr(e) {
|
|
47051
47200
|
let t = this.rules.block.hr.exec(e);
|
|
47052
47201
|
if (t)
|
|
47053
|
-
return { type: "hr", raw:
|
|
47202
|
+
return { type: "hr", raw: L(t[0], `
|
|
47054
47203
|
`) };
|
|
47055
47204
|
}
|
|
47056
47205
|
blockquote(e) {
|
|
47057
47206
|
let t = this.rules.block.blockquote.exec(e);
|
|
47058
47207
|
if (t) {
|
|
47059
|
-
let n =
|
|
47208
|
+
let n = L(t[0], `
|
|
47060
47209
|
`).split(`
|
|
47061
|
-
`),
|
|
47210
|
+
`), s = "", r = "", o = [];
|
|
47062
47211
|
for (;n.length > 0; ) {
|
|
47063
|
-
let
|
|
47064
|
-
for (
|
|
47065
|
-
if (this.rules.other.blockquoteStart.test(n[
|
|
47066
|
-
l.push(n[
|
|
47067
|
-
else if (!
|
|
47068
|
-
l.push(n[
|
|
47212
|
+
let i = false, l = [], p;
|
|
47213
|
+
for (p = 0;p < n.length; p++)
|
|
47214
|
+
if (this.rules.other.blockquoteStart.test(n[p]))
|
|
47215
|
+
l.push(n[p]), i = true;
|
|
47216
|
+
else if (!i)
|
|
47217
|
+
l.push(n[p]);
|
|
47069
47218
|
else
|
|
47070
47219
|
break;
|
|
47071
|
-
n = n.slice(
|
|
47072
|
-
let
|
|
47073
|
-
`),
|
|
47220
|
+
n = n.slice(p);
|
|
47221
|
+
let h = l.join(`
|
|
47222
|
+
`), u = h.replace(this.rules.other.blockquoteMarkerWhitespace, (g, b, m) => b + J(m, b.length)).replace(this.rules.other.blockquoteSetextReplace, `
|
|
47074
47223
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
47075
|
-
|
|
47076
|
-
${
|
|
47077
|
-
${
|
|
47224
|
+
s = s ? `${s}
|
|
47225
|
+
${h}` : h, r = r ? `${r}
|
|
47226
|
+
${u}` : u;
|
|
47078
47227
|
let d = this.lexer.state.top;
|
|
47079
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(
|
|
47228
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(u, o, true), this.lexer.state.top = d, n.length === 0)
|
|
47080
47229
|
break;
|
|
47081
|
-
let
|
|
47082
|
-
if (
|
|
47230
|
+
let k = o.at(-1);
|
|
47231
|
+
if (k?.type === "code" || k?.type === "heading" || k?.type === "hr" || k?.type === "html" || k?.type === "table")
|
|
47083
47232
|
break;
|
|
47084
|
-
if (
|
|
47085
|
-
let
|
|
47086
|
-
`),
|
|
47087
|
-
` +
|
|
47088
|
-
o[o.length - 1] =
|
|
47089
|
-
let
|
|
47090
|
-
`).length : 0,
|
|
47091
|
-
|
|
47092
|
-
${
|
|
47093
|
-
`)}`), r = r.substring(0, r.length -
|
|
47233
|
+
if (k?.type === "blockquote") {
|
|
47234
|
+
let g = k, b = n.join(`
|
|
47235
|
+
`), m = g.raw + `
|
|
47236
|
+
` + b.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(m);
|
|
47237
|
+
o[o.length - 1] = f;
|
|
47238
|
+
let y = m.substring(f.raw.length).replace(/^\n/, ""), R = y ? y.split(`
|
|
47239
|
+
`).length : 0, A = R ? n.slice(0, -R) : n;
|
|
47240
|
+
if (A.length > 0 && (s = `${s}
|
|
47241
|
+
${A.join(`
|
|
47242
|
+
`)}`), r = r.substring(0, r.length - g.text.length) + f.text, n = n.slice(A.length), n.length > 0 && this.rules.other.blockquoteStart.test(n[0]))
|
|
47243
|
+
continue;
|
|
47094
47244
|
break;
|
|
47095
|
-
} else if (
|
|
47096
|
-
let
|
|
47245
|
+
} else if (k?.type === "list") {
|
|
47246
|
+
let g = k, b = g.raw + `
|
|
47097
47247
|
` + n.join(`
|
|
47098
|
-
`),
|
|
47099
|
-
o[o.length - 1] =
|
|
47248
|
+
`), m = this.list(b);
|
|
47249
|
+
o[o.length - 1] = m;
|
|
47250
|
+
let f = m.raw.length > g.raw.length ? b.slice(g.raw.length + 1, m.raw.length).split(`
|
|
47251
|
+
`).length : 0;
|
|
47252
|
+
if (f > 0) {
|
|
47253
|
+
let y = n.slice(0, f).join(`
|
|
47100
47254
|
`);
|
|
47255
|
+
s = `${s}
|
|
47256
|
+
${y}`, r = `${r}
|
|
47257
|
+
${y}`;
|
|
47258
|
+
}
|
|
47259
|
+
n = n.slice(f);
|
|
47101
47260
|
continue;
|
|
47102
47261
|
}
|
|
47103
47262
|
}
|
|
47104
|
-
return { type: "blockquote", raw:
|
|
47263
|
+
return { type: "blockquote", raw: s, tokens: o, text: r };
|
|
47105
47264
|
}
|
|
47106
47265
|
}
|
|
47107
47266
|
list(e) {
|
|
47108
47267
|
let t = this.rules.block.list.exec(e);
|
|
47109
47268
|
if (t) {
|
|
47110
|
-
let n = e,
|
|
47269
|
+
let n = e, s = () => n.length - e.length, r = t[1].trim(), o = r.length > 1, i = { type: "list", raw: "", ordered: o, start: o ? +r.slice(0, -1) : "", loose: false, items: [] };
|
|
47111
47270
|
r = o ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = o ? r : "[*+-]");
|
|
47112
|
-
let l = this.rules.other.listItemRegex(r),
|
|
47271
|
+
let l = this.rules.other.listItemRegex(r), p = false;
|
|
47113
47272
|
for (;e; ) {
|
|
47114
|
-
let
|
|
47273
|
+
let u = false, d = "";
|
|
47115
47274
|
if (!(t = l.exec(e)) || this.rules.block.hr.test(e))
|
|
47116
47275
|
break;
|
|
47117
|
-
let
|
|
47276
|
+
let k = s();
|
|
47118
47277
|
e = e.substring(t[0].length);
|
|
47119
|
-
let
|
|
47120
|
-
`, 1)[0],
|
|
47121
|
-
`, 1)[0],
|
|
47122
|
-
if (this.options.pedantic ? (
|
|
47123
|
-
let
|
|
47278
|
+
let g = t[2].split(`
|
|
47279
|
+
`, 1)[0], b = t[1].length, m = this.options.pedantic ? J(g, b) : g.replace(this.rules.other.leadingSpaceTab, (v) => J(v, b)), f = e.split(`
|
|
47280
|
+
`, 1)[0], y = !m.trim(), R = 0;
|
|
47281
|
+
if (this.options.pedantic ? (R = 2, d = m.trimStart()) : y ? R = b + 1 : (R = m.search(this.rules.other.nonSpaceChar), R = R > 4 ? 1 : R, d = m.slice(R), R += b), y && this.rules.other.blankLine.test(f) && (e = e.substring(f.length + 1), u = true), !u) {
|
|
47282
|
+
let v = this.rules.other.nextBulletRegex(R), Q = this.rules.other.hrRegex(R), ee = this.rules.other.fencesBeginRegex(R), te = this.options.pedantic ? this.rules.other.pedanticHeadingBeginRegex(R) : this.rules.other.headingBeginRegex(R), M = this.rules.other.htmlBeginRegex(R), ne = this.rules.other.blockquoteBeginRegex(R);
|
|
47124
47283
|
for (;e; ) {
|
|
47125
|
-
let
|
|
47126
|
-
`, 1)[0],
|
|
47127
|
-
if (
|
|
47284
|
+
let U = e.split(`
|
|
47285
|
+
`, 1)[0], Z;
|
|
47286
|
+
if (f = U, this.options.pedantic ? (f = f.replace(this.rules.other.listReplaceNesting, " "), Z = f) : Z = f.replace(this.rules.other.leadingSpaceTab, (me) => J(me)), ee.test(f) || te.test(f) || M.test(f) || ne.test(f) || v.test(f) || Q.test(f))
|
|
47128
47287
|
break;
|
|
47129
|
-
if (
|
|
47288
|
+
if (Z.search(this.rules.other.nonSpaceChar) >= R || !f.trim())
|
|
47130
47289
|
d += `
|
|
47131
|
-
` +
|
|
47290
|
+
` + Z.slice(R);
|
|
47132
47291
|
else {
|
|
47133
|
-
if (
|
|
47292
|
+
if (y || m.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ee.test(m) || te.test(m) || M.test(m) || Q.test(m))
|
|
47134
47293
|
break;
|
|
47294
|
+
let qe = !this.options.pedantic && /^ {0,3}(?:=+|-+) *$/.test(f) && this.rules.block.lheading.test(`${m}
|
|
47295
|
+
${f}`) ? ` ${Z.replace(/^ {0,3}/, "")}` : f;
|
|
47135
47296
|
d += `
|
|
47136
|
-
` +
|
|
47297
|
+
` + qe;
|
|
47137
47298
|
}
|
|
47138
|
-
|
|
47299
|
+
y = !f.trim(), e = e.substring(U.length + 1), m = Z.slice(R);
|
|
47139
47300
|
}
|
|
47140
47301
|
}
|
|
47141
|
-
let
|
|
47142
|
-
|
|
47302
|
+
let A = n.slice(k, s());
|
|
47303
|
+
i.loose || (p ? i.loose = true : this.rules.other.doubleBlankLine.test(A) && (p = true)), i.items.push({ type: "list_item", raw: A, task: !!this.options.gfm && this.rules.other.listIsTask.test(d), loose: false, text: d, tokens: [] });
|
|
47143
47304
|
}
|
|
47144
|
-
let
|
|
47145
|
-
if (
|
|
47146
|
-
|
|
47305
|
+
let h = i.items.at(-1);
|
|
47306
|
+
if (h)
|
|
47307
|
+
h.raw = h.raw.trimEnd(), h.text = h.text.trimEnd();
|
|
47147
47308
|
else
|
|
47148
47309
|
return;
|
|
47149
|
-
|
|
47150
|
-
for (let
|
|
47151
|
-
if (this.lexer.state.top = false,
|
|
47152
|
-
let d =
|
|
47153
|
-
|
|
47154
|
-
}
|
|
47155
|
-
for (let
|
|
47156
|
-
let d =
|
|
47157
|
-
if (
|
|
47158
|
-
|
|
47159
|
-
for (let
|
|
47160
|
-
if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[
|
|
47161
|
-
this.lexer.inlineQueue[
|
|
47310
|
+
i.raw = n.slice(0, s()).trimEnd();
|
|
47311
|
+
for (let u of i.items)
|
|
47312
|
+
if (this.lexer.state.top = false, u.tokens = this.lexer.blockTokens(u.text, []), !i.loose) {
|
|
47313
|
+
let d = u.tokens.filter((g) => g.type === "space"), k = d.length > 0 && d.some((g) => this.rules.other.anyLine.test(g.raw));
|
|
47314
|
+
i.loose = k;
|
|
47315
|
+
}
|
|
47316
|
+
for (let u of i.items) {
|
|
47317
|
+
let d = u.tokens[0];
|
|
47318
|
+
if (u.task && (d?.type === "text" || d?.type === "paragraph")) {
|
|
47319
|
+
u.text = u.text.replace(this.rules.other.listReplaceTask, ""), d.raw = d.raw.replace(this.rules.other.listReplaceTask, ""), d.text = d.text.replace(this.rules.other.listReplaceTask, "");
|
|
47320
|
+
for (let g = this.lexer.inlineQueue.length - 1;g >= 0; g--)
|
|
47321
|
+
if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)) {
|
|
47322
|
+
this.lexer.inlineQueue[g].src = this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask, "");
|
|
47162
47323
|
break;
|
|
47163
47324
|
}
|
|
47164
|
-
let
|
|
47165
|
-
if (
|
|
47166
|
-
let
|
|
47167
|
-
|
|
47325
|
+
let k = this.rules.other.listTaskCheckbox.exec(u.raw);
|
|
47326
|
+
if (k) {
|
|
47327
|
+
let g = { type: "checkbox", raw: k[0] + " ", checked: k[0] !== "[ ]" };
|
|
47328
|
+
u.checked = g.checked, i.loose ? u.tokens[0] && ["paragraph", "text"].includes(u.tokens[0].type) && "tokens" in u.tokens[0] && u.tokens[0].tokens ? (u.tokens[0].raw = g.raw + u.tokens[0].raw, u.tokens[0].text = g.raw + u.tokens[0].text, u.tokens[0].tokens.unshift(g)) : u.tokens.unshift({ type: "paragraph", raw: g.raw, text: g.raw, tokens: [g] }) : u.tokens.unshift(g);
|
|
47168
47329
|
}
|
|
47169
47330
|
} else
|
|
47170
|
-
|
|
47331
|
+
u.task && (u.task = false);
|
|
47171
47332
|
}
|
|
47172
|
-
if (
|
|
47173
|
-
for (let
|
|
47174
|
-
|
|
47175
|
-
for (let d of
|
|
47333
|
+
if (i.loose)
|
|
47334
|
+
for (let u of i.items) {
|
|
47335
|
+
u.loose = true;
|
|
47336
|
+
for (let d of u.tokens)
|
|
47176
47337
|
d.type === "text" && (d.type = "paragraph");
|
|
47177
47338
|
}
|
|
47178
|
-
return
|
|
47339
|
+
return i;
|
|
47179
47340
|
}
|
|
47180
47341
|
}
|
|
47181
47342
|
html(e) {
|
|
47182
47343
|
let t = this.rules.block.html.exec(e);
|
|
47183
47344
|
if (t) {
|
|
47184
|
-
let n =
|
|
47345
|
+
let n = ge(t[0]);
|
|
47185
47346
|
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
47186
47347
|
}
|
|
47187
47348
|
}
|
|
47188
47349
|
def(e) {
|
|
47189
47350
|
let t = this.rules.block.def.exec(e);
|
|
47190
47351
|
if (t) {
|
|
47191
|
-
if (!this.rules.other.startAngleBracket.test(t[2]) &&
|
|
47352
|
+
if (!this.rules.other.startAngleBracket.test(t[2]) && ke(t[2], "()") !== -1)
|
|
47192
47353
|
return;
|
|
47193
|
-
let n =
|
|
47194
|
-
return { type: "def", tag: n, raw:
|
|
47195
|
-
`), href:
|
|
47354
|
+
let n = F(t[1]), 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];
|
|
47355
|
+
return { type: "def", tag: n, raw: L(t[0], `
|
|
47356
|
+
`), href: s, title: r };
|
|
47196
47357
|
}
|
|
47197
47358
|
}
|
|
47198
47359
|
table(e) {
|
|
47199
47360
|
let t = this.rules.block.table.exec(e);
|
|
47200
47361
|
if (!t || !this.rules.other.tableDelimiter.test(t[2]))
|
|
47201
47362
|
return;
|
|
47202
|
-
let n =
|
|
47203
|
-
`) : [], o = { type: "table", raw:
|
|
47363
|
+
let n = de(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
47364
|
+
`) : [], o = { type: "table", raw: L(t[0], `
|
|
47204
47365
|
`), header: [], align: [], rows: [] };
|
|
47205
|
-
if (n.length ===
|
|
47206
|
-
for (let
|
|
47207
|
-
this.rules.other.tableAlignRight.test(
|
|
47208
|
-
for (let
|
|
47209
|
-
o.header.push({ text: n[
|
|
47210
|
-
for (let
|
|
47211
|
-
o.rows.push(
|
|
47366
|
+
if (n.length === s.length) {
|
|
47367
|
+
for (let i of s)
|
|
47368
|
+
this.rules.other.tableAlignRight.test(i) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? o.align.push("left") : o.align.push(null);
|
|
47369
|
+
for (let i = 0;i < n.length; i++)
|
|
47370
|
+
o.header.push({ text: n[i], tokens: this.lexer.inline(n[i]), header: true, align: o.align[i] });
|
|
47371
|
+
for (let i of r)
|
|
47372
|
+
o.rows.push(de(i, o.header.length).map((l, p) => ({ text: l, tokens: this.lexer.inline(l), header: false, align: o.align[p] })));
|
|
47212
47373
|
return o;
|
|
47213
47374
|
}
|
|
47214
47375
|
}
|
|
@@ -47216,7 +47377,7 @@ ${H.join(`
|
|
|
47216
47377
|
let t = this.rules.block.lheading.exec(e);
|
|
47217
47378
|
if (t) {
|
|
47218
47379
|
let n = t[1].trim();
|
|
47219
|
-
return { type: "heading", raw:
|
|
47380
|
+
return { type: "heading", raw: L(t[0], `
|
|
47220
47381
|
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
47221
47382
|
}
|
|
47222
47383
|
}
|
|
@@ -47249,85 +47410,104 @@ ${H.join(`
|
|
|
47249
47410
|
let t = this.rules.inline.link.exec(e);
|
|
47250
47411
|
if (t) {
|
|
47251
47412
|
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
47252
|
-
if (!this.options.pedantic &&
|
|
47413
|
+
if (!this.options.pedantic && Be(e, t[1], n, this.rules))
|
|
47253
47414
|
return;
|
|
47254
|
-
let
|
|
47255
|
-
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(
|
|
47256
|
-
if (!this.rules.other.endAngleBracket.test(
|
|
47415
|
+
let s = t[2].trim();
|
|
47416
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
47417
|
+
if (!this.rules.other.endAngleBracket.test(s))
|
|
47257
47418
|
return;
|
|
47258
|
-
let
|
|
47259
|
-
if ((
|
|
47419
|
+
let l = L(s.slice(0, -1), "\\");
|
|
47420
|
+
if ((s.length - l.length) % 2 === 0)
|
|
47260
47421
|
return;
|
|
47261
47422
|
} else {
|
|
47262
|
-
let
|
|
47263
|
-
if (
|
|
47423
|
+
let l = ke(t[2], "()");
|
|
47424
|
+
if (l === -2)
|
|
47264
47425
|
return;
|
|
47265
|
-
if (
|
|
47266
|
-
let
|
|
47267
|
-
t[2] = t[2].substring(0,
|
|
47426
|
+
if (l > -1) {
|
|
47427
|
+
let h = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + l;
|
|
47428
|
+
t[2] = t[2].substring(0, l), t[0] = t[0].substring(0, h).trim(), t[3] = "";
|
|
47268
47429
|
}
|
|
47269
47430
|
}
|
|
47270
|
-
let r = t[
|
|
47431
|
+
let r = L(t[0].slice(0, -1), "\\");
|
|
47432
|
+
if ((t[0].length - r.length) % 2 === 0)
|
|
47433
|
+
return;
|
|
47434
|
+
let o = t[2], i = "";
|
|
47271
47435
|
if (this.options.pedantic) {
|
|
47272
|
-
let
|
|
47273
|
-
|
|
47436
|
+
let l = this.rules.other.pedanticHrefTitle.exec(o);
|
|
47437
|
+
l && (o = l[1], i = l[3]);
|
|
47274
47438
|
} else
|
|
47275
|
-
|
|
47276
|
-
return
|
|
47439
|
+
i = t[3] ? t[3].slice(1, -1) : "";
|
|
47440
|
+
return o = o.trim(), this.rules.other.startAngleBracket.test(o) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? o = o.slice(1) : o = o.slice(1, -1)), De(t, { href: o && o.replace(this.rules.inline.anyPunctuation, "$1"), title: i && i.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
47277
47441
|
}
|
|
47278
47442
|
}
|
|
47279
47443
|
reflink(e, t) {
|
|
47280
47444
|
let n;
|
|
47281
47445
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
47282
|
-
let
|
|
47283
|
-
if (!this.options.pedantic &&
|
|
47446
|
+
let s = n[0].charAt(0) === "!" ? 2 : 1;
|
|
47447
|
+
if (!this.options.pedantic && Be(e, n[1], s, this.rules))
|
|
47284
47448
|
return;
|
|
47285
|
-
let r = (n[2] || n[1])
|
|
47286
|
-
if (!
|
|
47287
|
-
let
|
|
47288
|
-
return { type: "text", raw:
|
|
47449
|
+
let r = t[F(n[2] || n[1])];
|
|
47450
|
+
if (!r) {
|
|
47451
|
+
let o = n[0].charAt(0);
|
|
47452
|
+
return { type: "text", raw: o, text: o };
|
|
47289
47453
|
}
|
|
47290
|
-
return
|
|
47454
|
+
return De(n, r, n[0], this.lexer, this.rules);
|
|
47291
47455
|
}
|
|
47292
47456
|
}
|
|
47293
47457
|
emStrong(e, t, n = "") {
|
|
47294
|
-
let
|
|
47295
|
-
if (!
|
|
47458
|
+
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
47459
|
+
if (!s || !s[1] && !s[2] && !s[3] && !s[4])
|
|
47296
47460
|
return;
|
|
47297
|
-
|
|
47298
|
-
|
|
47299
|
-
|
|
47300
|
-
|
|
47461
|
+
let r = s[0][0], o = n === r, i = t.length - e.length, l = i;
|
|
47462
|
+
for (;!this.options.pedantic && l > 0 && t[l - 1] === r; )
|
|
47463
|
+
l--;
|
|
47464
|
+
let p = [...t.slice(Math.max(0, l - 2), l)].at(-1) ?? "", h = p === "*" || p === "_" || !!this.rules.inline.punctuation.exec(p);
|
|
47465
|
+
l < i && (n = p);
|
|
47466
|
+
let u = l < i ? h : !!this.rules.inline.punctuation.exec(n);
|
|
47467
|
+
if (s[4] && n.match(this.rules.other.unicodeAlphaNumeric))
|
|
47468
|
+
return;
|
|
47469
|
+
let d = s[1] || s[3] || "";
|
|
47470
|
+
if (!d || !n || u) {
|
|
47471
|
+
let k = [...s[0]].length - 1, g, b, m = k, f = 0, y = i - l + k, R = !this.options.pedantic && !!p.trim() && (!!d || r === "*" && !h);
|
|
47472
|
+
if (r !== "*" && r !== "_")
|
|
47473
|
+
return;
|
|
47474
|
+
let A = r === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd, v = ze(this, t, r), Q = t.length - e.length + k;
|
|
47475
|
+
if (v < Q)
|
|
47476
|
+
return;
|
|
47477
|
+
t = t.slice(-1 * e.length + k);
|
|
47478
|
+
let ee = v - Q;
|
|
47479
|
+
for (A.lastIndex = 0;(s = A.exec(t)) !== null && !(s.index > ee); ) {
|
|
47480
|
+
if (g = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !g)
|
|
47301
47481
|
continue;
|
|
47302
|
-
if (
|
|
47303
|
-
|
|
47482
|
+
if (b = [...g].length, s[3] || s[4]) {
|
|
47483
|
+
m += b;
|
|
47304
47484
|
continue;
|
|
47305
|
-
} else if (
|
|
47306
|
-
if (o
|
|
47307
|
-
|
|
47485
|
+
} else if (s[5] || s[6] || R) {
|
|
47486
|
+
if (o && (s[5] || s[6]))
|
|
47487
|
+
break;
|
|
47488
|
+
if (y % 3 && !((y + b) % 3)) {
|
|
47489
|
+
f += b;
|
|
47308
47490
|
continue;
|
|
47309
47491
|
}
|
|
47310
|
-
if (d)
|
|
47311
|
-
break;
|
|
47312
47492
|
}
|
|
47313
|
-
if (
|
|
47493
|
+
if (m -= b, m > 0)
|
|
47314
47494
|
continue;
|
|
47315
|
-
|
|
47316
|
-
let
|
|
47317
|
-
if (Math.min(
|
|
47318
|
-
let
|
|
47319
|
-
return { type: "em", raw:
|
|
47495
|
+
b = Math.min(b, b + m + f);
|
|
47496
|
+
let te = [...s[0]][0].length, M = e.slice(0, k + s.index + te + b);
|
|
47497
|
+
if (Math.min(k, b) % 2) {
|
|
47498
|
+
let U = M.slice(1, -1);
|
|
47499
|
+
return { type: "em", raw: M, text: U, tokens: this.lexer.inlineTokens(U) };
|
|
47320
47500
|
}
|
|
47321
|
-
let
|
|
47322
|
-
return { type: "strong", raw:
|
|
47501
|
+
let ne = M.slice(2, -2);
|
|
47502
|
+
return { type: "strong", raw: M, text: ne, tokens: this.lexer.inlineTokens(ne) };
|
|
47323
47503
|
}
|
|
47324
47504
|
}
|
|
47325
47505
|
}
|
|
47326
47506
|
codespan(e) {
|
|
47327
47507
|
let t = this.rules.inline.code.exec(e);
|
|
47328
47508
|
if (t) {
|
|
47329
|
-
let n = t[2].replace(this.rules.other.newLineCharGlobal, " "),
|
|
47330
|
-
return
|
|
47509
|
+
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);
|
|
47510
|
+
return s && r && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t[0], text: n };
|
|
47331
47511
|
}
|
|
47332
47512
|
}
|
|
47333
47513
|
br(e) {
|
|
@@ -47336,70 +47516,74 @@ ${H.join(`
|
|
|
47336
47516
|
return { type: "br", raw: t[0] };
|
|
47337
47517
|
}
|
|
47338
47518
|
del(e, t, n = "") {
|
|
47339
|
-
let
|
|
47340
|
-
if (!
|
|
47519
|
+
let s = this.rules.inline.delLDelim.exec(e);
|
|
47520
|
+
if (!s)
|
|
47341
47521
|
return;
|
|
47342
|
-
if (!(
|
|
47343
|
-
let o = [...
|
|
47344
|
-
|
|
47345
|
-
|
|
47522
|
+
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
47523
|
+
let o = [...s[0]].length - 1, i, l, p = o, h = this.rules.inline.delRDelim, u = Me(this, t), d = t.length - e.length + o;
|
|
47524
|
+
if (u < d)
|
|
47525
|
+
return;
|
|
47526
|
+
t = t.slice(-1 * e.length + o);
|
|
47527
|
+
let k = u - d;
|
|
47528
|
+
for (h.lastIndex = 0;(s = h.exec(t)) !== null && !(s.index > k); ) {
|
|
47529
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (l = [...i].length, l !== o))
|
|
47346
47530
|
continue;
|
|
47347
|
-
if (
|
|
47348
|
-
|
|
47531
|
+
if (s[3] || s[4]) {
|
|
47532
|
+
p += l;
|
|
47349
47533
|
continue;
|
|
47350
47534
|
}
|
|
47351
|
-
if (
|
|
47535
|
+
if (p -= l, p > 0)
|
|
47352
47536
|
continue;
|
|
47353
|
-
l = Math.min(l, l +
|
|
47354
|
-
let
|
|
47355
|
-
return { type: "del", raw:
|
|
47537
|
+
l = Math.min(l, l + p);
|
|
47538
|
+
let g = [...s[0]][0].length, b = e.slice(0, o + s.index + g + l), m = b.slice(o, -o);
|
|
47539
|
+
return { type: "del", raw: b, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
47356
47540
|
}
|
|
47357
47541
|
}
|
|
47358
47542
|
}
|
|
47359
47543
|
autolink(e) {
|
|
47360
47544
|
let t = this.rules.inline.autolink.exec(e);
|
|
47361
47545
|
if (t) {
|
|
47362
|
-
let n,
|
|
47363
|
-
return t[2] === "@" ? (n = t[1],
|
|
47546
|
+
let n, s;
|
|
47547
|
+
return t[2] === "@" ? (n = t[1], s = "mailto:" + n) : (n = t[1], s = n), { type: "link", raw: t[0], text: n, href: s, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
|
|
47364
47548
|
}
|
|
47365
47549
|
}
|
|
47366
47550
|
url(e) {
|
|
47367
47551
|
let t;
|
|
47368
47552
|
if (t = this.rules.inline.url.exec(e)) {
|
|
47369
|
-
let n,
|
|
47553
|
+
let n, s;
|
|
47370
47554
|
if (t[2] === "@")
|
|
47371
|
-
n = t[0],
|
|
47555
|
+
n = t[0], s = "mailto:" + n;
|
|
47372
47556
|
else {
|
|
47373
47557
|
let r;
|
|
47374
47558
|
do
|
|
47375
47559
|
r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
|
|
47376
47560
|
while (r !== t[0]);
|
|
47377
|
-
n = t[0], t[1] === "www." ?
|
|
47561
|
+
n = t[0], t[1] === "www." ? s = "http://" + t[0] : s = t[0];
|
|
47378
47562
|
}
|
|
47379
|
-
return { type: "link", raw: t[0], text: n, href:
|
|
47563
|
+
return { type: "link", raw: t[0], text: n, href: s, autolink: true, tokens: [{ type: "text", raw: n, text: n }] };
|
|
47380
47564
|
}
|
|
47381
47565
|
}
|
|
47382
47566
|
inlineText(e) {
|
|
47383
47567
|
let t = this.rules.inline.text.exec(e);
|
|
47384
47568
|
if (t) {
|
|
47385
47569
|
let n = this.lexer.state.inRawBlock;
|
|
47386
|
-
return { type: "text", raw: t[0], text: n ? t[0] :
|
|
47570
|
+
return { type: "text", raw: t[0], text: n ? t[0] : Ie(t[0]), escaped: n };
|
|
47387
47571
|
}
|
|
47388
47572
|
}
|
|
47389
47573
|
};
|
|
47390
|
-
var
|
|
47574
|
+
var O = class a {
|
|
47391
47575
|
tokens;
|
|
47392
47576
|
options;
|
|
47393
47577
|
state;
|
|
47394
47578
|
inlineQueue;
|
|
47395
47579
|
tokenizer;
|
|
47396
47580
|
constructor(e) {
|
|
47397
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e ||
|
|
47398
|
-
let t = { other:
|
|
47399
|
-
this.options.pedantic ? (t.block =
|
|
47581
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || S, this.options.tokenizer = this.options.tokenizer || new _, this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, linkParenPossible: true, top: true };
|
|
47582
|
+
let t = { other: T, block: V.normal, inline: G.normal };
|
|
47583
|
+
this.options.pedantic ? (t.block = V.pedantic, t.inline = G.pedantic) : this.options.gfm && (t.block = V.gfm, this.options.breaks ? t.inline = G.breaks : t.inline = G.gfm), this.tokenizer.rules = t;
|
|
47400
47584
|
}
|
|
47401
47585
|
static get rules() {
|
|
47402
|
-
return { block:
|
|
47586
|
+
return { block: V, inline: G };
|
|
47403
47587
|
}
|
|
47404
47588
|
static lex(e, t) {
|
|
47405
47589
|
return new a(t).lex(e);
|
|
@@ -47408,41 +47592,41 @@ var T = class a {
|
|
|
47408
47592
|
return new a(t).inlineTokens(e);
|
|
47409
47593
|
}
|
|
47410
47594
|
lex(e) {
|
|
47411
|
-
e = e.replace(
|
|
47595
|
+
e = e.replace(T.carriageReturn, `
|
|
47412
47596
|
`), this.blockTokens(e, this.tokens);
|
|
47413
47597
|
for (let t = 0;t < this.inlineQueue.length; t++) {
|
|
47414
47598
|
let n = this.inlineQueue[t];
|
|
47415
|
-
this.inlineTokens(n.src, n.tokens);
|
|
47599
|
+
this.state.inRawBlock = false, this.inlineTokens(n.src, n.tokens);
|
|
47416
47600
|
}
|
|
47417
47601
|
return this.inlineQueue = [], this.tokens;
|
|
47418
47602
|
}
|
|
47419
47603
|
blockTokens(e, t = [], n = false) {
|
|
47420
|
-
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(
|
|
47421
|
-
let
|
|
47604
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(T.tabCharGlobal, " ").replace(T.spaceLine, ""));
|
|
47605
|
+
let s = 1 / 0;
|
|
47422
47606
|
for (;e; ) {
|
|
47423
|
-
if (e.length <
|
|
47424
|
-
|
|
47607
|
+
if (e.length < s)
|
|
47608
|
+
s = e.length;
|
|
47425
47609
|
else {
|
|
47426
47610
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
47427
47611
|
break;
|
|
47428
47612
|
}
|
|
47429
47613
|
let r;
|
|
47430
|
-
if (this.options.extensions?.block?.some((
|
|
47614
|
+
if (this.options.extensions?.block?.some((i) => (r = i.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), true) : false))
|
|
47431
47615
|
continue;
|
|
47432
47616
|
if (r = this.tokenizer.space(e)) {
|
|
47433
47617
|
e = e.substring(r.raw.length);
|
|
47434
|
-
let
|
|
47435
|
-
r.raw.length === 1 &&
|
|
47618
|
+
let i = t.at(-1);
|
|
47619
|
+
r.raw.length === 1 && i !== undefined ? i.raw += `
|
|
47436
47620
|
` : t.push(r);
|
|
47437
47621
|
continue;
|
|
47438
47622
|
}
|
|
47439
47623
|
if (r = this.tokenizer.code(e)) {
|
|
47440
47624
|
e = e.substring(r.raw.length);
|
|
47441
|
-
let
|
|
47442
|
-
|
|
47625
|
+
let i = t.at(-1);
|
|
47626
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
47443
47627
|
`) ? "" : `
|
|
47444
|
-
`) + r.raw,
|
|
47445
|
-
` + r.text, this.inlineQueue.at(-1).src =
|
|
47628
|
+
`) + r.raw, i.text += `
|
|
47629
|
+
` + r.text, this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
47446
47630
|
continue;
|
|
47447
47631
|
}
|
|
47448
47632
|
if (r = this.tokenizer.fences(e)) {
|
|
@@ -47471,11 +47655,11 @@ var T = class a {
|
|
|
47471
47655
|
}
|
|
47472
47656
|
if (r = this.tokenizer.def(e)) {
|
|
47473
47657
|
e = e.substring(r.raw.length);
|
|
47474
|
-
let
|
|
47475
|
-
|
|
47658
|
+
let i = t.at(-1);
|
|
47659
|
+
i?.type === "paragraph" || i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
47476
47660
|
`) ? "" : `
|
|
47477
|
-
`) + r.raw,
|
|
47478
|
-
` + r.raw, this.inlineQueue.at(-1).src =
|
|
47661
|
+
`) + r.raw, i.text += `
|
|
47662
|
+
` + r.raw, this.inlineQueue.at(-1).src = i.text) : (this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { href: r.href, title: r.title }), t.push(r));
|
|
47479
47663
|
continue;
|
|
47480
47664
|
}
|
|
47481
47665
|
if (r = this.tokenizer.table(e)) {
|
|
@@ -47488,26 +47672,26 @@ var T = class a {
|
|
|
47488
47672
|
}
|
|
47489
47673
|
let o = e;
|
|
47490
47674
|
if (this.options.extensions?.startBlock) {
|
|
47491
|
-
let
|
|
47492
|
-
this.options.extensions.startBlock.forEach((
|
|
47493
|
-
|
|
47494
|
-
}),
|
|
47675
|
+
let i = 1 / 0, l = e.slice(1), p;
|
|
47676
|
+
this.options.extensions.startBlock.forEach((h) => {
|
|
47677
|
+
p = h.call({ lexer: this }, l), typeof p == "number" && p >= 0 && (i = Math.min(i, p));
|
|
47678
|
+
}), i < 1 / 0 && i >= 0 && (o = e.substring(0, i + 1));
|
|
47495
47679
|
}
|
|
47496
47680
|
if (this.state.top && (r = this.tokenizer.paragraph(o))) {
|
|
47497
|
-
let
|
|
47498
|
-
n &&
|
|
47681
|
+
let i = t.at(-1);
|
|
47682
|
+
n && i?.type === "paragraph" ? (i.raw += (i.raw.endsWith(`
|
|
47499
47683
|
`) ? "" : `
|
|
47500
|
-
`) + r.raw,
|
|
47501
|
-
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
47684
|
+
`) + r.raw, i.text += `
|
|
47685
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r), n = o.length !== e.length, e = e.substring(r.raw.length);
|
|
47502
47686
|
continue;
|
|
47503
47687
|
}
|
|
47504
47688
|
if (r = this.tokenizer.text(e)) {
|
|
47505
47689
|
e = e.substring(r.raw.length);
|
|
47506
|
-
let
|
|
47507
|
-
|
|
47690
|
+
let i = t.at(-1);
|
|
47691
|
+
i?.type === "text" ? (i.raw += (i.raw.endsWith(`
|
|
47508
47692
|
`) ? "" : `
|
|
47509
|
-
`) + r.raw,
|
|
47510
|
-
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src =
|
|
47693
|
+
`) + r.raw, i.text += `
|
|
47694
|
+
` + r.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = i.text) : t.push(r);
|
|
47511
47695
|
continue;
|
|
47512
47696
|
}
|
|
47513
47697
|
if (e) {
|
|
@@ -47528,8 +47712,8 @@ var T = class a {
|
|
|
47528
47712
|
if (t.test(n[0]) && e.charAt(n.index - 1) !== "!")
|
|
47529
47713
|
return true;
|
|
47530
47714
|
for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
47531
|
-
let
|
|
47532
|
-
if (!(
|
|
47715
|
+
let s = n[0], r = s.lastIndexOf("[");
|
|
47716
|
+
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, F(s.slice(r + 1, -1)))) && !(r > 1 && this.linkInText(s.slice(1, r - 1))))
|
|
47533
47717
|
return true;
|
|
47534
47718
|
}
|
|
47535
47719
|
return false;
|
|
@@ -47545,26 +47729,16 @@ var T = class a {
|
|
|
47545
47729
|
}
|
|
47546
47730
|
}
|
|
47547
47731
|
#e(e, t) {
|
|
47548
|
-
let n = e;
|
|
47549
|
-
|
|
47550
|
-
|
|
47551
|
-
|
|
47552
|
-
|
|
47553
|
-
|
|
47554
|
-
if (c > 1 && u.charAt(0) !== "!") {
|
|
47555
|
-
let p = u.slice(1, c - 1);
|
|
47556
|
-
if (this.linkInText(p))
|
|
47557
|
-
return "[" + p.replace(s, l) + "][" + "a".repeat(u.length - c - 2) + "]";
|
|
47558
|
-
}
|
|
47559
|
-
return "[" + "a".repeat(u.length - 2) + "]";
|
|
47560
|
-
};
|
|
47561
|
-
n = n.replace(s, l);
|
|
47732
|
+
let n = e.includes("*") || e.includes("_") || e.includes("~") || this.options.hooks?.emStrongMask || this.tokenizer.emStrong !== _.prototype.emStrong || this.tokenizer.del !== _.prototype.del ? this.#n(e) : e;
|
|
47733
|
+
Ae(this.tokenizer, n);
|
|
47734
|
+
try {
|
|
47735
|
+
return this.#t(e, n, t);
|
|
47736
|
+
} finally {
|
|
47737
|
+
Ee(this.tokenizer);
|
|
47562
47738
|
}
|
|
47563
|
-
|
|
47564
|
-
|
|
47565
|
-
|
|
47566
|
-
}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
47567
|
-
let i = false, r = "", o = 1 / 0;
|
|
47739
|
+
}
|
|
47740
|
+
#t(e, t, n) {
|
|
47741
|
+
let s = false, r = "", o = 1 / 0;
|
|
47568
47742
|
for (;e; ) {
|
|
47569
47743
|
if (e.length < o)
|
|
47570
47744
|
o = e.length;
|
|
@@ -47572,63 +47746,63 @@ var T = class a {
|
|
|
47572
47746
|
this.infiniteLoopError(e.charCodeAt(0));
|
|
47573
47747
|
break;
|
|
47574
47748
|
}
|
|
47575
|
-
|
|
47576
|
-
let
|
|
47577
|
-
if (this.options.extensions?.inline?.some((
|
|
47749
|
+
s || (r = ""), s = false;
|
|
47750
|
+
let i;
|
|
47751
|
+
if (this.options.extensions?.inline?.some((p) => (i = p.call({ lexer: this }, e, n)) ? (e = e.substring(i.raw.length), n.push(i), true) : false))
|
|
47578
47752
|
continue;
|
|
47579
|
-
if (
|
|
47580
|
-
e = e.substring(
|
|
47753
|
+
if (i = this.tokenizer.escape(e)) {
|
|
47754
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47581
47755
|
continue;
|
|
47582
47756
|
}
|
|
47583
|
-
if (
|
|
47584
|
-
e = e.substring(
|
|
47757
|
+
if (i = this.tokenizer.tag(e)) {
|
|
47758
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47585
47759
|
continue;
|
|
47586
47760
|
}
|
|
47587
|
-
if (
|
|
47588
|
-
e = e.substring(
|
|
47761
|
+
if (i = this.tokenizer.link(e)) {
|
|
47762
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47589
47763
|
continue;
|
|
47590
47764
|
}
|
|
47591
|
-
if (
|
|
47592
|
-
e = e.substring(
|
|
47593
|
-
let
|
|
47594
|
-
|
|
47765
|
+
if (i = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
47766
|
+
e = e.substring(i.raw.length);
|
|
47767
|
+
let p = n.at(-1);
|
|
47768
|
+
i.type === "text" && p?.type === "text" ? (p.raw += i.raw, p.text += i.text) : n.push(i);
|
|
47595
47769
|
continue;
|
|
47596
47770
|
}
|
|
47597
|
-
if (
|
|
47598
|
-
e = e.substring(
|
|
47771
|
+
if (i = this.tokenizer.emStrong(e, t, r)) {
|
|
47772
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47599
47773
|
continue;
|
|
47600
47774
|
}
|
|
47601
|
-
if (
|
|
47602
|
-
e = e.substring(
|
|
47775
|
+
if (i = this.tokenizer.codespan(e)) {
|
|
47776
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47603
47777
|
continue;
|
|
47604
47778
|
}
|
|
47605
|
-
if (
|
|
47606
|
-
e = e.substring(
|
|
47779
|
+
if (i = this.tokenizer.br(e)) {
|
|
47780
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47607
47781
|
continue;
|
|
47608
47782
|
}
|
|
47609
|
-
if (
|
|
47610
|
-
e = e.substring(
|
|
47783
|
+
if (i = this.tokenizer.del(e, t, r)) {
|
|
47784
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47611
47785
|
continue;
|
|
47612
47786
|
}
|
|
47613
|
-
if (
|
|
47614
|
-
e = e.substring(
|
|
47787
|
+
if (i = this.tokenizer.autolink(e)) {
|
|
47788
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47615
47789
|
continue;
|
|
47616
47790
|
}
|
|
47617
|
-
if (!this.state.inLink && (
|
|
47618
|
-
e = e.substring(
|
|
47791
|
+
if (!this.state.inLink && (i = this.tokenizer.url(e))) {
|
|
47792
|
+
e = e.substring(i.raw.length), n.push(i);
|
|
47619
47793
|
continue;
|
|
47620
47794
|
}
|
|
47621
47795
|
let l = e;
|
|
47622
47796
|
if (this.options.extensions?.startInline) {
|
|
47623
|
-
let
|
|
47797
|
+
let p = 1 / 0, h = e.slice(1), u;
|
|
47624
47798
|
this.options.extensions.startInline.forEach((d) => {
|
|
47625
|
-
|
|
47626
|
-
}),
|
|
47799
|
+
u = d.call({ lexer: this }, h), typeof u == "number" && u >= 0 && (p = Math.min(p, u));
|
|
47800
|
+
}), p < 1 / 0 && p >= 0 && (l = e.substring(0, p + 1));
|
|
47627
47801
|
}
|
|
47628
|
-
if (
|
|
47629
|
-
e = e.substring(
|
|
47630
|
-
let
|
|
47631
|
-
|
|
47802
|
+
if (i = this.tokenizer.inlineText(l)) {
|
|
47803
|
+
e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (r = i.raw.slice(-1)), s = true;
|
|
47804
|
+
let p = n.at(-1);
|
|
47805
|
+
p?.type === "text" ? (p.raw += i.raw, p.text += i.text) : n.push(i);
|
|
47632
47806
|
continue;
|
|
47633
47807
|
}
|
|
47634
47808
|
if (e) {
|
|
@@ -47636,7 +47810,28 @@ var T = class a {
|
|
|
47636
47810
|
break;
|
|
47637
47811
|
}
|
|
47638
47812
|
}
|
|
47639
|
-
return
|
|
47813
|
+
return n;
|
|
47814
|
+
}
|
|
47815
|
+
#n(e) {
|
|
47816
|
+
let t = e;
|
|
47817
|
+
if (this.tokens.links && e.includes("[")) {
|
|
47818
|
+
let n = this.tokenizer.rules.inline.reflinkSearch, s = (r) => {
|
|
47819
|
+
let o = r.lastIndexOf("[");
|
|
47820
|
+
if (!Object.hasOwn(this.tokens.links, F(r.slice(o + 1, -1))))
|
|
47821
|
+
return r;
|
|
47822
|
+
if (o > 1 && r.charAt(0) !== "!") {
|
|
47823
|
+
let i = r.slice(1, o - 1);
|
|
47824
|
+
if (this.linkInText(i))
|
|
47825
|
+
return "[" + i.replace(n, s) + "][" + "a".repeat(r.length - o - 2) + "]";
|
|
47826
|
+
}
|
|
47827
|
+
return "[" + "a".repeat(r.length - 2) + "]";
|
|
47828
|
+
};
|
|
47829
|
+
t = t.replace(n, s);
|
|
47830
|
+
}
|
|
47831
|
+
return t = t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode, (n, s, r) => r ? "+".repeat(n.length) : s ? s + n.slice(s.length, -s.length).replace(/`/g, "+") + s : n), t = t.replace(this.tokenizer.rules.inline.blockSkip, (n, s, r) => {
|
|
47832
|
+
let o = r ? r.length : 0;
|
|
47833
|
+
return n.slice(0, o) + "[" + "a".repeat(n.length - o - 2) + "]";
|
|
47834
|
+
}), t = this.options.hooks?.emStrongMask?.call({ lexer: this }, t) ?? t, t;
|
|
47640
47835
|
}
|
|
47641
47836
|
infiniteLoopError(e) {
|
|
47642
47837
|
let t = "Infinite loop on byte: " + e;
|
|
@@ -47646,20 +47841,20 @@ var T = class a {
|
|
|
47646
47841
|
throw new Error(t);
|
|
47647
47842
|
}
|
|
47648
47843
|
};
|
|
47649
|
-
var
|
|
47844
|
+
var C = class {
|
|
47650
47845
|
options;
|
|
47651
47846
|
parser;
|
|
47652
47847
|
constructor(e) {
|
|
47653
|
-
this.options = e ||
|
|
47848
|
+
this.options = e || S;
|
|
47654
47849
|
}
|
|
47655
47850
|
space(e) {
|
|
47656
47851
|
return "";
|
|
47657
47852
|
}
|
|
47658
47853
|
code({ text: e, lang: t, escaped: n }) {
|
|
47659
|
-
let
|
|
47854
|
+
let s = (t || "").match(T.notSpaceStart)?.[0], r = e ? e.replace(T.endingNewline, "") + `
|
|
47660
47855
|
` : "";
|
|
47661
|
-
return
|
|
47662
|
-
` : "<pre><code>" + (n ? r :
|
|
47856
|
+
return s ? '<pre><code class="language-' + P(s) + '">' + (n ? r : P(r, true)) + `</code></pre>
|
|
47857
|
+
` : "<pre><code>" + (n ? r : P(r, true)) + `</code></pre>
|
|
47663
47858
|
`;
|
|
47664
47859
|
}
|
|
47665
47860
|
blockquote({ tokens: e }) {
|
|
@@ -47682,14 +47877,14 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
47682
47877
|
`;
|
|
47683
47878
|
}
|
|
47684
47879
|
list(e) {
|
|
47685
|
-
let { ordered: t, start: n } = e,
|
|
47686
|
-
for (let
|
|
47687
|
-
let l = e.items[
|
|
47688
|
-
|
|
47880
|
+
let { ordered: t, start: n } = e, s = "";
|
|
47881
|
+
for (let i = 0;i < e.items.length; i++) {
|
|
47882
|
+
let l = e.items[i];
|
|
47883
|
+
s += this.listitem(l);
|
|
47689
47884
|
}
|
|
47690
47885
|
let r = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
47691
47886
|
return "<" + r + o + `>
|
|
47692
|
-
` +
|
|
47887
|
+
` + s + "</" + r + `>
|
|
47693
47888
|
`;
|
|
47694
47889
|
}
|
|
47695
47890
|
listitem(e) {
|
|
@@ -47708,18 +47903,18 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
47708
47903
|
for (let r = 0;r < e.header.length; r++)
|
|
47709
47904
|
n += this.tablecell(e.header[r]);
|
|
47710
47905
|
t += this.tablerow({ text: n });
|
|
47711
|
-
let
|
|
47906
|
+
let s = "";
|
|
47712
47907
|
for (let r = 0;r < e.rows.length; r++) {
|
|
47713
47908
|
let o = e.rows[r];
|
|
47714
47909
|
n = "";
|
|
47715
|
-
for (let
|
|
47716
|
-
n += this.tablecell(o[
|
|
47717
|
-
|
|
47910
|
+
for (let i = 0;i < o.length; i++)
|
|
47911
|
+
n += this.tablecell(o[i]);
|
|
47912
|
+
s += this.tablerow({ text: n });
|
|
47718
47913
|
}
|
|
47719
|
-
return
|
|
47914
|
+
return s && (s = `<tbody>${s}</tbody>`), `<table>
|
|
47720
47915
|
<thead>
|
|
47721
47916
|
` + t + `</thead>
|
|
47722
|
-
` +
|
|
47917
|
+
` + s + `</table>
|
|
47723
47918
|
`;
|
|
47724
47919
|
}
|
|
47725
47920
|
tablerow({ text: e }) {
|
|
@@ -47739,7 +47934,7 @@ ${e}</tr>
|
|
|
47739
47934
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
47740
47935
|
}
|
|
47741
47936
|
codespan({ text: e }) {
|
|
47742
|
-
return `<code>${
|
|
47937
|
+
return `<code>${P(e, true)}</code>`;
|
|
47743
47938
|
}
|
|
47744
47939
|
br(e) {
|
|
47745
47940
|
return "<br>";
|
|
@@ -47747,39 +47942,40 @@ ${e}</tr>
|
|
|
47747
47942
|
del({ tokens: e }) {
|
|
47748
47943
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
47749
47944
|
}
|
|
47750
|
-
link({ href: e, title: t, text: n, tokens:
|
|
47751
|
-
let o = r ?
|
|
47752
|
-
if (
|
|
47945
|
+
link({ href: e, title: t, text: n, tokens: s, autolink: r }) {
|
|
47946
|
+
let o = r ? P(n, true) : this.parser.parseInline(s), i = he(e);
|
|
47947
|
+
if (i === null)
|
|
47753
47948
|
return o;
|
|
47754
|
-
e =
|
|
47949
|
+
e = P(i, r);
|
|
47755
47950
|
let l = '<a href="' + e + '"';
|
|
47756
|
-
return t && (l += ' title="' +
|
|
47951
|
+
return t && (l += ' title="' + P(t) + '"'), l += ">" + o + "</a>", l;
|
|
47757
47952
|
}
|
|
47758
|
-
image({ href: e, title: t, text: n, tokens:
|
|
47759
|
-
|
|
47760
|
-
let r =
|
|
47953
|
+
image({ href: e, title: t, text: n, tokens: s }) {
|
|
47954
|
+
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
47955
|
+
let r = he(e);
|
|
47761
47956
|
if (r === null)
|
|
47762
|
-
return
|
|
47957
|
+
return P(n);
|
|
47763
47958
|
e = r;
|
|
47764
|
-
let o = `<img src="${
|
|
47765
|
-
return t && (o += ` title="${
|
|
47959
|
+
let o = `<img src="${P(e)}" alt="${P(n)}"`;
|
|
47960
|
+
return t && (o += ` title="${P(t)}"`), o += ">", o;
|
|
47766
47961
|
}
|
|
47767
47962
|
text(e) {
|
|
47768
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : ("escaped" in e) && e.escaped ? e.text :
|
|
47963
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : ("escaped" in e) && e.escaped ? e.text : P(e.text);
|
|
47769
47964
|
}
|
|
47770
47965
|
};
|
|
47771
|
-
var
|
|
47772
|
-
|
|
47773
|
-
|
|
47966
|
+
var E = class {
|
|
47967
|
+
parser;
|
|
47968
|
+
strong({ text: e, tokens: t }) {
|
|
47969
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
47774
47970
|
}
|
|
47775
|
-
em({ text: e }) {
|
|
47776
|
-
return e;
|
|
47971
|
+
em({ text: e, tokens: t }) {
|
|
47972
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
47777
47973
|
}
|
|
47778
47974
|
codespan({ text: e }) {
|
|
47779
47975
|
return e;
|
|
47780
47976
|
}
|
|
47781
|
-
del({ text: e }) {
|
|
47782
|
-
return e;
|
|
47977
|
+
del({ text: e, tokens: t }) {
|
|
47978
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
47783
47979
|
}
|
|
47784
47980
|
html({ text: e }) {
|
|
47785
47981
|
return e;
|
|
@@ -47787,11 +47983,11 @@ var z = class {
|
|
|
47787
47983
|
text({ text: e }) {
|
|
47788
47984
|
return e;
|
|
47789
47985
|
}
|
|
47790
|
-
link({ text: e }) {
|
|
47791
|
-
return
|
|
47986
|
+
link({ text: e, tokens: t }) {
|
|
47987
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
47792
47988
|
}
|
|
47793
|
-
image({ text: e }) {
|
|
47794
|
-
return
|
|
47989
|
+
image({ text: e, tokens: t }) {
|
|
47990
|
+
return t ? this.parser.parseInline(t, this) : e;
|
|
47795
47991
|
}
|
|
47796
47992
|
br() {
|
|
47797
47993
|
return "";
|
|
@@ -47800,12 +47996,12 @@ var z = class {
|
|
|
47800
47996
|
return e;
|
|
47801
47997
|
}
|
|
47802
47998
|
};
|
|
47803
|
-
var
|
|
47999
|
+
var w = class a {
|
|
47804
48000
|
options;
|
|
47805
48001
|
renderer;
|
|
47806
48002
|
textRenderer;
|
|
47807
48003
|
constructor(e) {
|
|
47808
|
-
this.options = e ||
|
|
48004
|
+
this.options = e || S, this.options.renderer = this.options.renderer || new C, this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new E, this.textRenderer.parser = this;
|
|
47809
48005
|
}
|
|
47810
48006
|
static parse(e, t) {
|
|
47811
48007
|
return new a(t).parse(e);
|
|
@@ -47817,15 +48013,15 @@ var O = class a {
|
|
|
47817
48013
|
this.renderer.parser = this;
|
|
47818
48014
|
let t = "";
|
|
47819
48015
|
for (let n = 0;n < e.length; n++) {
|
|
47820
|
-
let
|
|
47821
|
-
if (this.options.extensions?.renderers?.[
|
|
47822
|
-
let o =
|
|
47823
|
-
if (
|
|
47824
|
-
t +=
|
|
48016
|
+
let s = e[n];
|
|
48017
|
+
if (this.options.extensions?.renderers?.[s.type]) {
|
|
48018
|
+
let o = s, i = this.options.extensions.renderers[o.type].call({ parser: this }, o);
|
|
48019
|
+
if (i !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "checkbox", "html", "def", "paragraph", "text"].includes(o.type)) {
|
|
48020
|
+
t += i || "";
|
|
47825
48021
|
continue;
|
|
47826
48022
|
}
|
|
47827
48023
|
}
|
|
47828
|
-
let r =
|
|
48024
|
+
let r = s;
|
|
47829
48025
|
switch (r.type) {
|
|
47830
48026
|
case "space": {
|
|
47831
48027
|
t += this.renderer.space(r);
|
|
@@ -47888,12 +48084,12 @@ var O = class a {
|
|
|
47888
48084
|
parseInline(e, t = this.renderer) {
|
|
47889
48085
|
this.renderer.parser = this;
|
|
47890
48086
|
let n = "";
|
|
47891
|
-
for (let
|
|
47892
|
-
let r = e[
|
|
48087
|
+
for (let s = 0;s < e.length; s++) {
|
|
48088
|
+
let r = e[s];
|
|
47893
48089
|
if (this.options.extensions?.renderers?.[r.type]) {
|
|
47894
|
-
let
|
|
47895
|
-
if (
|
|
47896
|
-
n +=
|
|
48090
|
+
let i = this.options.extensions.renderers[r.type].call({ parser: this }, r);
|
|
48091
|
+
if (i !== false || !["escape", "html", "link", "image", "checkbox", "strong", "em", "codespan", "br", "del", "text"].includes(r.type)) {
|
|
48092
|
+
n += i || "";
|
|
47897
48093
|
continue;
|
|
47898
48094
|
}
|
|
47899
48095
|
}
|
|
@@ -47944,21 +48140,21 @@ var O = class a {
|
|
|
47944
48140
|
break;
|
|
47945
48141
|
}
|
|
47946
48142
|
default: {
|
|
47947
|
-
let
|
|
48143
|
+
let i = 'Token with "' + o.type + '" type was not found.';
|
|
47948
48144
|
if (this.options.silent)
|
|
47949
|
-
return console.error(
|
|
47950
|
-
throw new Error(
|
|
48145
|
+
return console.error(i), "";
|
|
48146
|
+
throw new Error(i);
|
|
47951
48147
|
}
|
|
47952
48148
|
}
|
|
47953
48149
|
}
|
|
47954
48150
|
return n;
|
|
47955
48151
|
}
|
|
47956
48152
|
};
|
|
47957
|
-
var
|
|
48153
|
+
var I = class {
|
|
47958
48154
|
options;
|
|
47959
48155
|
block;
|
|
47960
48156
|
constructor(e) {
|
|
47961
|
-
this.options = e ||
|
|
48157
|
+
this.options = e || S;
|
|
47962
48158
|
}
|
|
47963
48159
|
static passThroughHooks = new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
47964
48160
|
static passThroughHooksRespectAsync = new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
@@ -47975,73 +48171,73 @@ var L = class {
|
|
|
47975
48171
|
return e;
|
|
47976
48172
|
}
|
|
47977
48173
|
provideLexer(e = this.block) {
|
|
47978
|
-
return e ?
|
|
48174
|
+
return e ? O.lex : O.lexInline;
|
|
47979
48175
|
}
|
|
47980
48176
|
provideParser(e = this.block) {
|
|
47981
|
-
return e ?
|
|
48177
|
+
return e ? w.parse : w.parseInline;
|
|
47982
48178
|
}
|
|
47983
48179
|
};
|
|
47984
|
-
function
|
|
48180
|
+
function z(a, e) {
|
|
47985
48181
|
if (Array.isArray(e))
|
|
47986
48182
|
for (let t = 0;t < e.length; t++)
|
|
47987
48183
|
a.push(e[t]);
|
|
47988
48184
|
else
|
|
47989
48185
|
a.push(e);
|
|
47990
48186
|
}
|
|
47991
|
-
var
|
|
47992
|
-
defaults =
|
|
48187
|
+
var Y = class {
|
|
48188
|
+
defaults = H();
|
|
47993
48189
|
options = this.setOptions;
|
|
47994
48190
|
parse = this.parseMarkdown(true);
|
|
47995
48191
|
parseInline = this.parseMarkdown(false);
|
|
47996
|
-
Parser =
|
|
47997
|
-
Renderer =
|
|
47998
|
-
TextRenderer =
|
|
47999
|
-
Lexer =
|
|
48192
|
+
Parser = w;
|
|
48193
|
+
Renderer = C;
|
|
48194
|
+
TextRenderer = E;
|
|
48195
|
+
Lexer = O;
|
|
48000
48196
|
Tokenizer = _;
|
|
48001
|
-
Hooks =
|
|
48197
|
+
Hooks = I;
|
|
48002
48198
|
constructor(...e) {
|
|
48003
48199
|
this.use(...e);
|
|
48004
48200
|
}
|
|
48005
48201
|
walkTokens(e, t) {
|
|
48006
48202
|
let n = [];
|
|
48007
|
-
for (let
|
|
48008
|
-
switch (
|
|
48203
|
+
for (let s of e)
|
|
48204
|
+
switch (z(n, t.call(this, s)), s.type) {
|
|
48009
48205
|
case "table": {
|
|
48010
|
-
let r =
|
|
48206
|
+
let r = s;
|
|
48011
48207
|
for (let o of r.header)
|
|
48012
|
-
|
|
48208
|
+
z(n, this.walkTokens(o.tokens, t));
|
|
48013
48209
|
for (let o of r.rows)
|
|
48014
|
-
for (let
|
|
48015
|
-
|
|
48210
|
+
for (let i of o)
|
|
48211
|
+
z(n, this.walkTokens(i.tokens, t));
|
|
48016
48212
|
break;
|
|
48017
48213
|
}
|
|
48018
48214
|
case "list": {
|
|
48019
|
-
let r =
|
|
48020
|
-
|
|
48215
|
+
let r = s;
|
|
48216
|
+
z(n, this.walkTokens(r.items, t));
|
|
48021
48217
|
break;
|
|
48022
48218
|
}
|
|
48023
48219
|
default: {
|
|
48024
|
-
let r =
|
|
48220
|
+
let r = s;
|
|
48025
48221
|
this.defaults.extensions?.childTokens?.[r.type] ? this.defaults.extensions.childTokens[r.type].forEach((o) => {
|
|
48026
|
-
let
|
|
48027
|
-
|
|
48028
|
-
}) : r.tokens &&
|
|
48222
|
+
let i = r[o].flat(1 / 0);
|
|
48223
|
+
z(n, this.walkTokens(i, t));
|
|
48224
|
+
}) : r.tokens && z(n, this.walkTokens(r.tokens, t));
|
|
48029
48225
|
}
|
|
48030
48226
|
}
|
|
48031
48227
|
return n;
|
|
48032
48228
|
}
|
|
48033
48229
|
use(...e) {
|
|
48034
|
-
let t = this.defaults.extensions || { renderers:
|
|
48230
|
+
let t = this.defaults.extensions || { renderers: Object.create(null), childTokens: Object.create(null) };
|
|
48035
48231
|
return e.forEach((n) => {
|
|
48036
|
-
let
|
|
48037
|
-
if (
|
|
48232
|
+
let s = { ...n };
|
|
48233
|
+
if (s.async = this.defaults.async || s.async || false, n.extensions && (n.extensions.forEach((r) => {
|
|
48038
48234
|
if (!r.name)
|
|
48039
48235
|
throw new Error("extension name required");
|
|
48040
48236
|
if ("renderer" in r) {
|
|
48041
48237
|
let o = t.renderers[r.name];
|
|
48042
|
-
o ? t.renderers[r.name] = function(...
|
|
48043
|
-
let l = r.renderer.apply(this,
|
|
48044
|
-
return l === false && (l = o.apply(this,
|
|
48238
|
+
o ? t.renderers[r.name] = function(...i) {
|
|
48239
|
+
let l = r.renderer.apply(this, i);
|
|
48240
|
+
return l === false && (l = o.apply(this, i)), l;
|
|
48045
48241
|
} : t.renderers[r.name] = r.renderer;
|
|
48046
48242
|
}
|
|
48047
48243
|
if ("tokenizer" in r) {
|
|
@@ -48051,20 +48247,20 @@ var U = class {
|
|
|
48051
48247
|
o ? o.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]));
|
|
48052
48248
|
}
|
|
48053
48249
|
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
48054
|
-
}),
|
|
48055
|
-
let r = this.defaults.renderer || new
|
|
48250
|
+
}), s.extensions = t), n.renderer) {
|
|
48251
|
+
let r = this.defaults.renderer || new C(this.defaults);
|
|
48056
48252
|
for (let o in n.renderer) {
|
|
48057
48253
|
if (!(o in r))
|
|
48058
48254
|
throw new Error(`renderer '${o}' does not exist`);
|
|
48059
48255
|
if (["options", "parser"].includes(o))
|
|
48060
48256
|
continue;
|
|
48061
|
-
let
|
|
48062
|
-
r[
|
|
48063
|
-
let
|
|
48064
|
-
return
|
|
48257
|
+
let i = o, l = n.renderer[i], p = r[i];
|
|
48258
|
+
r[i] = (...h) => {
|
|
48259
|
+
let u = l.apply(r, h);
|
|
48260
|
+
return u === false && (u = p.apply(r, h)), u === false ? "" : u ?? "";
|
|
48065
48261
|
};
|
|
48066
48262
|
}
|
|
48067
|
-
|
|
48263
|
+
s.renderer = r;
|
|
48068
48264
|
}
|
|
48069
48265
|
if (n.tokenizer) {
|
|
48070
48266
|
let r = this.defaults.tokenizer || new _(this.defaults);
|
|
@@ -48073,85 +48269,85 @@ var U = class {
|
|
|
48073
48269
|
throw new Error(`tokenizer '${o}' does not exist`);
|
|
48074
48270
|
if (["options", "rules", "lexer"].includes(o))
|
|
48075
48271
|
continue;
|
|
48076
|
-
let
|
|
48077
|
-
r[
|
|
48078
|
-
let
|
|
48079
|
-
return
|
|
48272
|
+
let i = o, l = n.tokenizer[i], p = r[i];
|
|
48273
|
+
r[i] = (...h) => {
|
|
48274
|
+
let u = l.apply(r, h);
|
|
48275
|
+
return u === false && (u = p.apply(r, h)), u;
|
|
48080
48276
|
};
|
|
48081
48277
|
}
|
|
48082
|
-
|
|
48278
|
+
s.tokenizer = r;
|
|
48083
48279
|
}
|
|
48084
48280
|
if (n.hooks) {
|
|
48085
|
-
let r = this.defaults.hooks || new
|
|
48281
|
+
let r = this.defaults.hooks || new I;
|
|
48086
48282
|
for (let o in n.hooks) {
|
|
48087
48283
|
if (!(o in r))
|
|
48088
48284
|
throw new Error(`hook '${o}' does not exist`);
|
|
48089
48285
|
if (["options", "block"].includes(o))
|
|
48090
48286
|
continue;
|
|
48091
|
-
let
|
|
48092
|
-
|
|
48093
|
-
if (
|
|
48287
|
+
let i = o, l = n.hooks[i], p = r[i];
|
|
48288
|
+
I.passThroughHooks.has(o) ? r[i] = (h) => {
|
|
48289
|
+
if (r.options.async && I.passThroughHooksRespectAsync.has(o))
|
|
48094
48290
|
return (async () => {
|
|
48095
|
-
let d = await l.call(r,
|
|
48096
|
-
return
|
|
48291
|
+
let d = await l.call(r, h);
|
|
48292
|
+
return p.call(r, d);
|
|
48097
48293
|
})();
|
|
48098
|
-
let
|
|
48099
|
-
return
|
|
48100
|
-
} : r[
|
|
48101
|
-
if (
|
|
48294
|
+
let u = l.call(r, h);
|
|
48295
|
+
return p.call(r, u);
|
|
48296
|
+
} : r[i] = (...h) => {
|
|
48297
|
+
if (r.options.async)
|
|
48102
48298
|
return (async () => {
|
|
48103
|
-
let d = await l.apply(r,
|
|
48104
|
-
return d === false && (d = await
|
|
48299
|
+
let d = await l.apply(r, h);
|
|
48300
|
+
return d === false && (d = await p.apply(r, h)), d;
|
|
48105
48301
|
})();
|
|
48106
|
-
let
|
|
48107
|
-
return
|
|
48302
|
+
let u = l.apply(r, h);
|
|
48303
|
+
return u === false && (u = p.apply(r, h)), u;
|
|
48108
48304
|
};
|
|
48109
48305
|
}
|
|
48110
|
-
|
|
48306
|
+
s.hooks = r;
|
|
48111
48307
|
}
|
|
48112
48308
|
if (n.walkTokens) {
|
|
48113
48309
|
let r = this.defaults.walkTokens, o = n.walkTokens;
|
|
48114
|
-
|
|
48310
|
+
s.walkTokens = function(i) {
|
|
48115
48311
|
let l = [];
|
|
48116
|
-
return l
|
|
48312
|
+
return z(l, o.call(this, i)), r && z(l, r.call(this, i)), l;
|
|
48117
48313
|
};
|
|
48118
48314
|
}
|
|
48119
|
-
this.defaults = { ...this.defaults, ...
|
|
48315
|
+
this.defaults = { ...this.defaults, ...s };
|
|
48120
48316
|
}), this;
|
|
48121
48317
|
}
|
|
48122
48318
|
setOptions(e) {
|
|
48123
48319
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
48124
48320
|
}
|
|
48125
48321
|
lexer(e, t) {
|
|
48126
|
-
return
|
|
48322
|
+
return O.lex(e, t ?? this.defaults);
|
|
48127
48323
|
}
|
|
48128
48324
|
parser(e, t) {
|
|
48129
|
-
return
|
|
48325
|
+
return w.parse(e, t ?? this.defaults);
|
|
48130
48326
|
}
|
|
48131
48327
|
parseMarkdown(e) {
|
|
48132
|
-
return (n,
|
|
48133
|
-
let r = { ...
|
|
48328
|
+
return (n, s) => {
|
|
48329
|
+
let r = { ...s }, o = { ...this.defaults, ...r }, i = this.onError(!!o.silent, !!o.async);
|
|
48134
48330
|
if (this.defaults.async === true && r.async === false)
|
|
48135
|
-
return
|
|
48331
|
+
return i(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."));
|
|
48136
48332
|
if (typeof n > "u" || n === null)
|
|
48137
|
-
return
|
|
48333
|
+
return i(new Error("marked(): input parameter is undefined or null"));
|
|
48138
48334
|
if (typeof n != "string")
|
|
48139
|
-
return
|
|
48335
|
+
return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
48140
48336
|
if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async)
|
|
48141
48337
|
return (async () => {
|
|
48142
|
-
let l = o.hooks ? await o.hooks.preprocess(n) : n,
|
|
48143
|
-
o.walkTokens && await Promise.all(this.walkTokens(
|
|
48144
|
-
let
|
|
48145
|
-
return o.hooks ? await o.hooks.postprocess(
|
|
48146
|
-
})().catch(
|
|
48338
|
+
let l = o.hooks ? await o.hooks.preprocess(n) : n, h = await (o.hooks ? await o.hooks.provideLexer(e) : e ? O.lex : O.lexInline)(l, o), u = o.hooks ? await o.hooks.processAllTokens(h) : h;
|
|
48339
|
+
o.walkTokens && await Promise.all(this.walkTokens(u, o.walkTokens));
|
|
48340
|
+
let k = await (o.hooks ? await o.hooks.provideParser(e) : e ? w.parse : w.parseInline)(u, o);
|
|
48341
|
+
return o.hooks ? await o.hooks.postprocess(k) : k;
|
|
48342
|
+
})().catch(i);
|
|
48147
48343
|
try {
|
|
48148
48344
|
o.hooks && (n = o.hooks.preprocess(n));
|
|
48149
|
-
let
|
|
48150
|
-
o.hooks && (
|
|
48151
|
-
let
|
|
48152
|
-
return o.hooks && (
|
|
48345
|
+
let p = (o.hooks ? o.hooks.provideLexer(e) : e ? O.lex : O.lexInline)(n, o);
|
|
48346
|
+
o.hooks && (p = o.hooks.processAllTokens(p)), o.walkTokens && this.walkTokens(p, o.walkTokens);
|
|
48347
|
+
let u = (o.hooks ? o.hooks.provideParser(e) : e ? w.parse : w.parseInline)(p, o);
|
|
48348
|
+
return o.hooks && (u = o.hooks.postprocess(u)), u;
|
|
48153
48349
|
} catch (l) {
|
|
48154
|
-
return
|
|
48350
|
+
return i(l);
|
|
48155
48351
|
}
|
|
48156
48352
|
};
|
|
48157
48353
|
}
|
|
@@ -48159,8 +48355,8 @@ var U = class {
|
|
|
48159
48355
|
return (n) => {
|
|
48160
48356
|
if (n.message += `
|
|
48161
48357
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
48162
|
-
let
|
|
48163
|
-
return t ? Promise.resolve(
|
|
48358
|
+
let s = "<p>An error occurred:</p><pre>" + P(n.message + "", true) + "</pre>";
|
|
48359
|
+
return t ? Promise.resolve(s) : s;
|
|
48164
48360
|
}
|
|
48165
48361
|
if (t)
|
|
48166
48362
|
return Promise.reject(n);
|
|
@@ -48168,38 +48364,38 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
48168
48364
|
};
|
|
48169
48365
|
}
|
|
48170
48366
|
};
|
|
48171
|
-
var
|
|
48172
|
-
function
|
|
48173
|
-
return
|
|
48367
|
+
var q = new Y;
|
|
48368
|
+
function x(a, e) {
|
|
48369
|
+
return q.parse(a, e);
|
|
48174
48370
|
}
|
|
48175
|
-
|
|
48176
|
-
return
|
|
48371
|
+
x.options = x.setOptions = function(a) {
|
|
48372
|
+
return q.setOptions(a), x.defaults = q.defaults, se(x.defaults), x;
|
|
48177
48373
|
};
|
|
48178
|
-
|
|
48179
|
-
|
|
48180
|
-
function
|
|
48181
|
-
return
|
|
48182
|
-
}
|
|
48183
|
-
|
|
48184
|
-
|
|
48185
|
-
return
|
|
48374
|
+
x.getDefaults = H;
|
|
48375
|
+
x.defaults = S;
|
|
48376
|
+
function Bt(...a) {
|
|
48377
|
+
return q.use(...a), x.defaults = q.defaults, se(x.defaults), x;
|
|
48378
|
+
}
|
|
48379
|
+
x.use = Bt;
|
|
48380
|
+
x.walkTokens = function(a, e) {
|
|
48381
|
+
return q.walkTokens(a, e);
|
|
48186
48382
|
};
|
|
48187
|
-
|
|
48188
|
-
|
|
48189
|
-
|
|
48190
|
-
|
|
48191
|
-
|
|
48192
|
-
|
|
48193
|
-
|
|
48194
|
-
|
|
48195
|
-
|
|
48196
|
-
|
|
48197
|
-
var
|
|
48198
|
-
var
|
|
48199
|
-
var
|
|
48200
|
-
var
|
|
48201
|
-
var
|
|
48202
|
-
var
|
|
48383
|
+
x.parseInline = q.parseInline;
|
|
48384
|
+
x.Parser = w;
|
|
48385
|
+
x.parser = w.parse;
|
|
48386
|
+
x.Renderer = C;
|
|
48387
|
+
x.TextRenderer = E;
|
|
48388
|
+
x.Lexer = O;
|
|
48389
|
+
x.lexer = O.lex;
|
|
48390
|
+
x.Tokenizer = _;
|
|
48391
|
+
x.Hooks = I;
|
|
48392
|
+
x.parse = x;
|
|
48393
|
+
var _n = x.options;
|
|
48394
|
+
var $n = x.setOptions;
|
|
48395
|
+
var Ln = x.walkTokens;
|
|
48396
|
+
var Cn = x.parseInline;
|
|
48397
|
+
var An = w.parse;
|
|
48398
|
+
var En = O.lex;
|
|
48203
48399
|
|
|
48204
48400
|
// src/plan/format.ts
|
|
48205
48401
|
var PLAN_FORMAT_DENY_MESSAGE = "caret: this plan has a code block with no language marker, so it can't be " + "syntax-highlighted in the review UI. Add a language tag to every code block's " + "opening fence (e.g. ```ts, ```bash, ```json), and use `text` for non-code " + "blocks like directory trees, console output, or ASCII art. Then resubmit the plan.";
|
|
@@ -48207,7 +48403,7 @@ var PLAN_EMPTY_DENY_MESSAGE = "caret: no plan text reached caret, so there is no
|
|
|
48207
48403
|
function hasUntaggedCodeBlock(plan) {
|
|
48208
48404
|
if (!plan?.trim())
|
|
48209
48405
|
return false;
|
|
48210
|
-
const marked = new
|
|
48406
|
+
const marked = new Y({ gfm: true, breaks: false });
|
|
48211
48407
|
let untagged = false;
|
|
48212
48408
|
marked.walkTokens(marked.lexer(plan), (token) => {
|
|
48213
48409
|
if (token.type === "code" && !(token.lang ?? "").trim())
|
|
@@ -48413,6 +48609,9 @@ async function reviewHookInput(parsed, deps, readPlan) {
|
|
|
48413
48609
|
const input = fromFile?.trim() ? { ...payload, plan: fromFile } : payload;
|
|
48414
48610
|
return { decision: await runReview({ input }, deps), input };
|
|
48415
48611
|
}
|
|
48612
|
+
function declareApproveVariants(input, adapterVariants) {
|
|
48613
|
+
return input.approveVariants ? input : { ...input, approveVariants: [...adapterVariants] };
|
|
48614
|
+
}
|
|
48416
48615
|
async function runReviewSubcommand() {
|
|
48417
48616
|
const loaded = loadSettings();
|
|
48418
48617
|
bootHookLogging(loaded);
|
|
@@ -48441,7 +48640,7 @@ async function runReviewSubcommand() {
|
|
|
48441
48640
|
deps.onPosted = (handle) => {
|
|
48442
48641
|
posted = handle;
|
|
48443
48642
|
};
|
|
48444
|
-
const { decision: out, input } = await reviewHookInput(parseHook(adapter.parseHookInput, stdin), deps, readPlanFile);
|
|
48643
|
+
const { decision: out, input } = await reviewHookInput(parseHook((raw) => declareApproveVariants(adapter.parseHookInput(raw), adapter.approveVariants), stdin), deps, readPlanFile);
|
|
48445
48644
|
hookInput = input;
|
|
48446
48645
|
const target = notesAppendTarget(out, hookInput?.planFilePath, posted);
|
|
48447
48646
|
if (target === "skip-moved-on") {
|
|
@@ -48471,18 +48670,19 @@ async function awaitPendingReview(deps, attempts = 25, intervalMs = 200) {
|
|
|
48471
48670
|
return;
|
|
48472
48671
|
}
|
|
48473
48672
|
async function runBandLinkSubcommand(opts) {
|
|
48673
|
+
const { session } = opts;
|
|
48474
48674
|
try {
|
|
48475
48675
|
const s = loadSettings();
|
|
48476
48676
|
bootHookLogging(s);
|
|
48477
48677
|
setLogContext({ sessionId: opts.session });
|
|
48478
48678
|
if (opts.open || s.review.band) {
|
|
48479
48679
|
const baseUrl = daemonBaseUrl(s);
|
|
48480
|
-
const
|
|
48481
|
-
pendingReviewId: async () => (await sessionReview(baseUrl,
|
|
48680
|
+
const reviewId = session === undefined ? undefined : await awaitPendingReview({
|
|
48681
|
+
pendingReviewId: async () => (await sessionReview(baseUrl, session))?.id,
|
|
48482
48682
|
sleep: Bun.sleep
|
|
48483
48683
|
}, opts.open ? 1 : undefined);
|
|
48484
|
-
logDebug("band", "band link resolved", { found:
|
|
48485
|
-
const url = browserReviewLink(baseUrl, localHostname(s.daemon.host),
|
|
48684
|
+
logDebug("band", "band link resolved", { found: reviewId !== undefined });
|
|
48685
|
+
const url = browserReviewLink(baseUrl, localHostname(s.daemon.host), reviewId, browserLoginToken(s.daemon));
|
|
48486
48686
|
if (opts.open)
|
|
48487
48687
|
openBrowser(url);
|
|
48488
48688
|
else
|
|
@@ -49605,12 +49805,18 @@ function logReviewText(log, version, decision) {
|
|
|
49605
49805
|
|
|
49606
49806
|
// src/daemon/schemas.ts
|
|
49607
49807
|
init_zod();
|
|
49808
|
+
var ApproveVariantSchema = object({
|
|
49809
|
+
id: string2().min(1),
|
|
49810
|
+
label: string2().min(1),
|
|
49811
|
+
description: string2().optional()
|
|
49812
|
+
});
|
|
49608
49813
|
var PlanInputSchema = object({
|
|
49609
49814
|
sessionId: string2().optional(),
|
|
49610
49815
|
cwd: string2().optional(),
|
|
49611
49816
|
plan: string2().optional(),
|
|
49612
49817
|
planFilePath: string2().optional(),
|
|
49613
|
-
cmux: object({ workspaceId: string2().min(1), surfaceId: string2().min(1) }).optional().catch(undefined)
|
|
49818
|
+
cmux: object({ workspaceId: string2().min(1), surfaceId: string2().min(1) }).optional().catch(undefined),
|
|
49819
|
+
approveVariants: array(ApproveVariantSchema).min(1).optional().catch(undefined)
|
|
49614
49820
|
}).catch({});
|
|
49615
49821
|
var MAX_FILE_REFS = 1000;
|
|
49616
49822
|
var FileRefsBodySchema = object({ paths: array(string2()).catch([]) }).catch({ paths: [] });
|
|
@@ -50078,23 +50284,23 @@ import { chmodSync as chmodSync3, existsSync as existsSync9, mkdirSync as mkdirS
|
|
|
50078
50284
|
import { mkdtemp, rm as rm3 } from "fs/promises";
|
|
50079
50285
|
import { tmpdir } from "os";
|
|
50080
50286
|
import { dirname as dirname7, join as join17 } from "path";
|
|
50081
|
-
var RUMDL_VERSION = "0.3.
|
|
50287
|
+
var RUMDL_VERSION = "0.3.2";
|
|
50082
50288
|
var ASSETS = {
|
|
50083
50289
|
"darwin-arm64": {
|
|
50084
50290
|
url: `https://github.com/rvben/rumdl/releases/download/v${RUMDL_VERSION}/rumdl-v${RUMDL_VERSION}-aarch64-apple-darwin.tar.gz`,
|
|
50085
|
-
sha256: "
|
|
50291
|
+
sha256: "a1eefb1cd2e0cafa42f0ca98d3f8713d7e73f9eba77fc8ef0ed6836875197935"
|
|
50086
50292
|
},
|
|
50087
50293
|
"darwin-x64": {
|
|
50088
50294
|
url: `https://github.com/rvben/rumdl/releases/download/v${RUMDL_VERSION}/rumdl-v${RUMDL_VERSION}-x86_64-apple-darwin.tar.gz`,
|
|
50089
|
-
sha256: "
|
|
50295
|
+
sha256: "ab35f245127a06374833127162eebdbdec1be17c1e3d8274f02f1b909645635c"
|
|
50090
50296
|
},
|
|
50091
50297
|
"linux-arm64": {
|
|
50092
50298
|
url: `https://github.com/rvben/rumdl/releases/download/v${RUMDL_VERSION}/rumdl-v${RUMDL_VERSION}-aarch64-unknown-linux-musl.tar.gz`,
|
|
50093
|
-
sha256: "
|
|
50299
|
+
sha256: "afc6dd91f1c4f2a8cf4a40ab99f8e52e06e6dddfc5334f1c1db8b158d353d143"
|
|
50094
50300
|
},
|
|
50095
50301
|
"linux-x64": {
|
|
50096
50302
|
url: `https://github.com/rvben/rumdl/releases/download/v${RUMDL_VERSION}/rumdl-v${RUMDL_VERSION}-x86_64-unknown-linux-musl.tar.gz`,
|
|
50097
|
-
sha256: "
|
|
50303
|
+
sha256: "395c4061041c5a25301c7b3564a93c4a661ed4df93427a77b6fc9e426ec8a13a"
|
|
50098
50304
|
}
|
|
50099
50305
|
};
|
|
50100
50306
|
function rumdlAsset(platform = process.platform, arch = process.arch) {
|
|
@@ -50232,7 +50438,7 @@ function newReviewId() {
|
|
|
50232
50438
|
return randomBytes2(8).toString("base64url");
|
|
50233
50439
|
}
|
|
50234
50440
|
function deriveTitle(plan) {
|
|
50235
|
-
const tokens = new
|
|
50441
|
+
const tokens = new O({ gfm: true }).blockTokens(plan.replace(/\r\n?/g, `
|
|
50236
50442
|
`));
|
|
50237
50443
|
const heading = (depth) => tokens.find((t) => t.type === "heading" && t.depth === depth && t.text.trim() !== "")?.text;
|
|
50238
50444
|
const prose = tokens.find((t) => t.type === "paragraph")?.text.split(`
|
|
@@ -50266,6 +50472,7 @@ async function routeIncomingPlan(input, store, log = noopLogger) {
|
|
|
50266
50472
|
r.title = deriveTitle(plan);
|
|
50267
50473
|
r.status = "pending";
|
|
50268
50474
|
r.cmux = input.cmux ?? r.cmux;
|
|
50475
|
+
r.approveVariants = input.approveVariants ?? r.approveVariants;
|
|
50269
50476
|
r.decision = undefined;
|
|
50270
50477
|
});
|
|
50271
50478
|
log.info("review", `review appended: ${shortId(latest.id)} v${version}`, {
|
|
@@ -50290,6 +50497,7 @@ async function routeIncomingPlan(input, store, log = noopLogger) {
|
|
|
50290
50497
|
title: deriveTitle(plan),
|
|
50291
50498
|
status: "pending",
|
|
50292
50499
|
cmux: input.cmux,
|
|
50500
|
+
approveVariants: input.approveVariants,
|
|
50293
50501
|
versions: [{ version: 1, plan, annotations: [], agentCopyMatches, createdAt: now }],
|
|
50294
50502
|
createdAt: now,
|
|
50295
50503
|
updatedAt: now
|
|
@@ -50551,7 +50759,6 @@ function resolveOptions(opts) {
|
|
|
50551
50759
|
commit: opts.commit,
|
|
50552
50760
|
stateDir: opts.stateDir,
|
|
50553
50761
|
instanceId: opts.instanceId,
|
|
50554
|
-
approveVariants: opts.approveVariants,
|
|
50555
50762
|
approveCarriesNotes: opts.approveCarriesNotes,
|
|
50556
50763
|
source: opts.source,
|
|
50557
50764
|
listSkills: opts.listSkills,
|
|
@@ -50589,6 +50796,9 @@ function ifNoneMatchHit(header, etag) {
|
|
|
50589
50796
|
function isStaleVersion(review, version) {
|
|
50590
50797
|
return review !== undefined && version !== undefined && currentVersion(review).version !== version;
|
|
50591
50798
|
}
|
|
50799
|
+
function offersVariant(declared, id) {
|
|
50800
|
+
return id === undefined || declared === undefined || declared.some((v) => v.id === id);
|
|
50801
|
+
}
|
|
50592
50802
|
function expiredDeny() {
|
|
50593
50803
|
return {
|
|
50594
50804
|
behavior: "deny",
|
|
@@ -50603,7 +50813,7 @@ function createServer(opts) {
|
|
|
50603
50813
|
const cfg = resolveOptions(opts);
|
|
50604
50814
|
const { store, idle, heartbeat, resident, assets, onShutdown, routePlan, configPath, log } = cfg;
|
|
50605
50815
|
const { buildId, assetDigest, commit, stateDir, instanceId } = cfg;
|
|
50606
|
-
const {
|
|
50816
|
+
const { approveCarriesNotes, source, lockPath } = cfg;
|
|
50607
50817
|
const { awaitDecision, resolveDecision, clearDecision, openDecisionCount, unreadDecisionCount } = createDecisions(log);
|
|
50608
50818
|
const configWriter = createConfigWriter(configPath);
|
|
50609
50819
|
const { themeWriter } = cfg;
|
|
@@ -50658,7 +50868,6 @@ function createServer(opts) {
|
|
|
50658
50868
|
resident,
|
|
50659
50869
|
supervised: isSupervised(),
|
|
50660
50870
|
...process.env.CARET_FRESH === "1" ? { fresh: true } : {},
|
|
50661
|
-
...approveVariants ? { approveVariants: [...approveVariants] } : {},
|
|
50662
50871
|
...approveCarriesNotes === undefined ? {} : { approveCarriesNotes },
|
|
50663
50872
|
...source ? { source } : {},
|
|
50664
50873
|
...cfg.restartHint ? { restartHint: cfg.restartHint } : {},
|
|
@@ -51023,6 +51232,12 @@ function createServer(opts) {
|
|
|
51023
51232
|
}
|
|
51024
51233
|
if (existing?.status !== "pending")
|
|
51025
51234
|
return notFound();
|
|
51235
|
+
if (body.behavior !== "deny" && !offersVariant(existing.approveVariants, body.acceptMode)) {
|
|
51236
|
+
route.log.info("resolve", "resolve refused: approve variant not offered", {
|
|
51237
|
+
acceptMode: body.acceptMode
|
|
51238
|
+
});
|
|
51239
|
+
return Response.json({ error: `approve variant "${body.acceptMode}" is not offered for this review` }, { status: 400 });
|
|
51240
|
+
}
|
|
51026
51241
|
const decision = {
|
|
51027
51242
|
behavior: body.behavior === "deny" ? "deny" : "allow",
|
|
51028
51243
|
feedback: body.feedback,
|
|
@@ -51594,7 +51809,6 @@ async function runDaemon(opts) {
|
|
|
51594
51809
|
commit: built.commit,
|
|
51595
51810
|
stateDir: stateDir(),
|
|
51596
51811
|
instanceId: randomUUID().slice(0, 8),
|
|
51597
|
-
approveVariants: adapter.approveVariants,
|
|
51598
51812
|
approveCarriesNotes: adapter.approveCarriesNotes,
|
|
51599
51813
|
source: adapter.id,
|
|
51600
51814
|
listSkills: (cwd) => adapter.listSkills(cwd),
|
|
@@ -56156,7 +56370,7 @@ function buildProgram() {
|
|
|
56156
56370
|
program.command("review").description("review a plan from stdin (ExitPlanMode hook)").action(() => runReviewSubcommand());
|
|
56157
56371
|
program.command("mcp").description("serve caret's plan-review tool over MCP stdio (Claude Code plugin)").action(async () => (await Promise.resolve().then(() => (init_mcp2(), exports_mcp))).runMcpSubcommand());
|
|
56158
56372
|
program.command("reconcile").description("reconcile a terminal plan approval into the daemon (ExitPlanMode PostToolUse hook)").action(() => runReconcileSubcommand());
|
|
56159
|
-
program.command("band-link").description("print or open the link Claude Code's
|
|
56373
|
+
program.command("band-link").description("print or open the link to a session's pending review, else caret's home page (Claude Code's band, OpenCode's /caret)").option("--session <id>", "the Claude Code or OpenCode session whose review to link").option("--open", "open the link in a browser instead of printing it").action((opts) => runBandLinkSubcommand(opts));
|
|
56160
56374
|
program.command("steer").description("steer the model to title its plan (EnterPlanMode PostToolUse / UserPromptSubmit hook)").action(() => runSteerSubcommand());
|
|
56161
56375
|
program.command("redact").description("write redacted copies of the logs").action(() => runRedactSubcommand());
|
|
56162
56376
|
program.command("convert-theme").description("convert a VS Code color theme into a caret theme file").argument("<file>", "the VS Code theme JSON to convert").option("-o, --out <file>", "write the theme file here instead of to stdout").action((file, opts) => runConvertTheme(file, { out: opts.out }));
|