@neobiotechlabs/neobiotech-dev-agent 0.1.9 → 0.1.11
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/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -2
- package/dist/index.js +2034 -517
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -7,11 +7,11 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
7
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
8
|
var __getProtoOf = Object.getPrototypeOf;
|
|
9
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __require = /* @__PURE__ */ ((
|
|
11
|
-
get: (a,
|
|
12
|
-
}) :
|
|
10
|
+
var __require = /* @__PURE__ */ ((x3) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x3, {
|
|
11
|
+
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
12
|
+
}) : x3)(function(x3) {
|
|
13
13
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
14
|
-
throw Error('Dynamic require of "' +
|
|
14
|
+
throw Error('Dynamic require of "' + x3 + '" is not supported');
|
|
15
15
|
});
|
|
16
16
|
var __esm = (fn, res) => function __init() {
|
|
17
17
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -97,7 +97,7 @@ var require_code = __commonJS({
|
|
|
97
97
|
};
|
|
98
98
|
exports._Code = _Code;
|
|
99
99
|
exports.nil = new _Code("");
|
|
100
|
-
function
|
|
100
|
+
function _2(strs, ...args) {
|
|
101
101
|
const code = [strs[0]];
|
|
102
102
|
let i2 = 0;
|
|
103
103
|
while (i2 < args.length) {
|
|
@@ -106,7 +106,7 @@ var require_code = __commonJS({
|
|
|
106
106
|
}
|
|
107
107
|
return new _Code(code);
|
|
108
108
|
}
|
|
109
|
-
exports._ =
|
|
109
|
+
exports._ = _2;
|
|
110
110
|
var plus = new _Code("+");
|
|
111
111
|
function str(strs, ...args) {
|
|
112
112
|
const expr = [safeStringify(strs[0])];
|
|
@@ -143,41 +143,41 @@ var require_code = __commonJS({
|
|
|
143
143
|
i2++;
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
function mergeExprItems(a,
|
|
147
|
-
if (
|
|
146
|
+
function mergeExprItems(a, b2) {
|
|
147
|
+
if (b2 === '""')
|
|
148
148
|
return a;
|
|
149
149
|
if (a === '""')
|
|
150
|
-
return
|
|
150
|
+
return b2;
|
|
151
151
|
if (typeof a == "string") {
|
|
152
|
-
if (
|
|
152
|
+
if (b2 instanceof Name || a[a.length - 1] !== '"')
|
|
153
153
|
return;
|
|
154
|
-
if (typeof
|
|
155
|
-
return `${a.slice(0, -1)}${
|
|
156
|
-
if (
|
|
157
|
-
return a.slice(0, -1) +
|
|
154
|
+
if (typeof b2 != "string")
|
|
155
|
+
return `${a.slice(0, -1)}${b2}"`;
|
|
156
|
+
if (b2[0] === '"')
|
|
157
|
+
return a.slice(0, -1) + b2.slice(1);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
if (typeof
|
|
161
|
-
return `"${a}${
|
|
160
|
+
if (typeof b2 == "string" && b2[0] === '"' && !(a instanceof Name))
|
|
161
|
+
return `"${a}${b2.slice(1)}`;
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
function strConcat(c1, c2) {
|
|
165
165
|
return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
|
|
166
166
|
}
|
|
167
167
|
exports.strConcat = strConcat;
|
|
168
|
-
function interpolate(
|
|
169
|
-
return typeof
|
|
168
|
+
function interpolate(x3) {
|
|
169
|
+
return typeof x3 == "number" || typeof x3 == "boolean" || x3 === null ? x3 : safeStringify(Array.isArray(x3) ? x3.join(",") : x3);
|
|
170
170
|
}
|
|
171
|
-
function stringify(
|
|
172
|
-
return new _Code(safeStringify(
|
|
171
|
+
function stringify(x3) {
|
|
172
|
+
return new _Code(safeStringify(x3));
|
|
173
173
|
}
|
|
174
174
|
exports.stringify = stringify;
|
|
175
|
-
function safeStringify(
|
|
176
|
-
return JSON.stringify(
|
|
175
|
+
function safeStringify(x3) {
|
|
176
|
+
return JSON.stringify(x3).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
177
177
|
}
|
|
178
178
|
exports.safeStringify = safeStringify;
|
|
179
179
|
function getProperty(key) {
|
|
180
|
-
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) :
|
|
180
|
+
return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _2`[${key}]`;
|
|
181
181
|
}
|
|
182
182
|
exports.getProperty = getProperty;
|
|
183
183
|
function getEsmExportName(key) {
|
|
@@ -1036,8 +1036,8 @@ var require_codegen = __commonJS({
|
|
|
1036
1036
|
for (const n in from)
|
|
1037
1037
|
names[n] = (names[n] || 0) - (from[n] || 0);
|
|
1038
1038
|
}
|
|
1039
|
-
function not(
|
|
1040
|
-
return typeof
|
|
1039
|
+
function not(x3) {
|
|
1040
|
+
return typeof x3 == "boolean" || typeof x3 == "number" || x3 === null ? !x3 : (0, code_1._)`!${par(x3)}`;
|
|
1041
1041
|
}
|
|
1042
1042
|
exports.not = not;
|
|
1043
1043
|
var andCode = mappend(exports.operators.AND);
|
|
@@ -1051,10 +1051,10 @@ var require_codegen = __commonJS({
|
|
|
1051
1051
|
}
|
|
1052
1052
|
exports.or = or;
|
|
1053
1053
|
function mappend(op) {
|
|
1054
|
-
return (
|
|
1054
|
+
return (x3, y2) => x3 === code_1.nil ? y2 : y2 === code_1.nil ? x3 : (0, code_1._)`${par(x3)} ${op} ${par(y2)}`;
|
|
1055
1055
|
}
|
|
1056
|
-
function par(
|
|
1057
|
-
return
|
|
1056
|
+
function par(x3) {
|
|
1057
|
+
return x3 instanceof code_1.Name ? x3 : (0, code_1._)`(${x3})`;
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
1060
1060
|
});
|
|
@@ -1144,8 +1144,8 @@ var require_util = __commonJS({
|
|
|
1144
1144
|
exports.unescapeJsonPointer = unescapeJsonPointer;
|
|
1145
1145
|
function eachItem(xs, f3) {
|
|
1146
1146
|
if (Array.isArray(xs)) {
|
|
1147
|
-
for (const
|
|
1148
|
-
f3(
|
|
1147
|
+
for (const x3 of xs)
|
|
1148
|
+
f3(x3);
|
|
1149
1149
|
} else {
|
|
1150
1150
|
f3(xs);
|
|
1151
1151
|
}
|
|
@@ -1335,7 +1335,7 @@ var require_errors = __commonJS({
|
|
|
1335
1335
|
gen.return(false);
|
|
1336
1336
|
}
|
|
1337
1337
|
}
|
|
1338
|
-
var
|
|
1338
|
+
var E2 = {
|
|
1339
1339
|
keyword: new codegen_1.Name("keyword"),
|
|
1340
1340
|
schemaPath: new codegen_1.Name("schemaPath"),
|
|
1341
1341
|
// also used in JTD errors
|
|
@@ -1369,20 +1369,20 @@ var require_errors = __commonJS({
|
|
|
1369
1369
|
if (schemaPath) {
|
|
1370
1370
|
schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;
|
|
1371
1371
|
}
|
|
1372
|
-
return [
|
|
1372
|
+
return [E2.schemaPath, schPath];
|
|
1373
1373
|
}
|
|
1374
1374
|
function extraErrorProps(cxt, { params, message }, keyValues) {
|
|
1375
1375
|
const { keyword, data, schemaValue, it } = cxt;
|
|
1376
1376
|
const { opts, propertyName, topSchemaRef, schemaPath } = it;
|
|
1377
|
-
keyValues.push([
|
|
1377
|
+
keyValues.push([E2.keyword, keyword], [E2.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._)`{}`]);
|
|
1378
1378
|
if (opts.messages) {
|
|
1379
|
-
keyValues.push([
|
|
1379
|
+
keyValues.push([E2.message, typeof message == "function" ? message(cxt) : message]);
|
|
1380
1380
|
}
|
|
1381
1381
|
if (opts.verbose) {
|
|
1382
|
-
keyValues.push([
|
|
1382
|
+
keyValues.push([E2.schema, schemaValue], [E2.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
|
|
1383
1383
|
}
|
|
1384
1384
|
if (propertyName)
|
|
1385
|
-
keyValues.push([
|
|
1385
|
+
keyValues.push([E2.propertyName, propertyName]);
|
|
1386
1386
|
}
|
|
1387
1387
|
}
|
|
1388
1388
|
});
|
|
@@ -1446,8 +1446,8 @@ var require_rules = __commonJS({
|
|
|
1446
1446
|
exports.getRules = exports.isJSONType = void 0;
|
|
1447
1447
|
var _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
|
|
1448
1448
|
var jsonTypes = new Set(_jsonTypes);
|
|
1449
|
-
function isJSONType(
|
|
1450
|
-
return typeof
|
|
1449
|
+
function isJSONType(x3) {
|
|
1450
|
+
return typeof x3 == "string" && jsonTypes.has(x3);
|
|
1451
1451
|
}
|
|
1452
1452
|
exports.isJSONType = isJSONType;
|
|
1453
1453
|
function getRules() {
|
|
@@ -1938,7 +1938,7 @@ var require_keyword = __commonJS({
|
|
|
1938
1938
|
return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
|
|
1939
1939
|
}
|
|
1940
1940
|
function validSchemaType(schema, schemaType, allowUndefined = false) {
|
|
1941
|
-
return !schemaType.length || schemaType.some((
|
|
1941
|
+
return !schemaType.length || schemaType.some((st2) => st2 === "array" ? Array.isArray(schema) : st2 === "object" ? schema && typeof schema == "object" && !Array.isArray(schema) : typeof schema == st2 || allowUndefined && typeof schema == "undefined");
|
|
1942
1942
|
}
|
|
1943
1943
|
exports.validSchemaType = validSchemaType;
|
|
1944
1944
|
function validateKeywordUsage({ schema, opts, self: self2, errSchemaPath }, def, keyword) {
|
|
@@ -2051,33 +2051,33 @@ var require_subschema = __commonJS({
|
|
|
2051
2051
|
var require_fast_deep_equal = __commonJS({
|
|
2052
2052
|
"node_modules/fast-deep-equal/index.js"(exports, module) {
|
|
2053
2053
|
"use strict";
|
|
2054
|
-
module.exports = function equal(a,
|
|
2055
|
-
if (a ===
|
|
2056
|
-
if (a &&
|
|
2057
|
-
if (a.constructor !==
|
|
2054
|
+
module.exports = function equal(a, b2) {
|
|
2055
|
+
if (a === b2) return true;
|
|
2056
|
+
if (a && b2 && typeof a == "object" && typeof b2 == "object") {
|
|
2057
|
+
if (a.constructor !== b2.constructor) return false;
|
|
2058
2058
|
var length, i2, keys;
|
|
2059
2059
|
if (Array.isArray(a)) {
|
|
2060
2060
|
length = a.length;
|
|
2061
|
-
if (length !=
|
|
2061
|
+
if (length != b2.length) return false;
|
|
2062
2062
|
for (i2 = length; i2-- !== 0; )
|
|
2063
|
-
if (!equal(a[i2],
|
|
2063
|
+
if (!equal(a[i2], b2[i2])) return false;
|
|
2064
2064
|
return true;
|
|
2065
2065
|
}
|
|
2066
|
-
if (a.constructor === RegExp) return a.source ===
|
|
2067
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() ===
|
|
2068
|
-
if (a.toString !== Object.prototype.toString) return a.toString() ===
|
|
2066
|
+
if (a.constructor === RegExp) return a.source === b2.source && a.flags === b2.flags;
|
|
2067
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b2.valueOf();
|
|
2068
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b2.toString();
|
|
2069
2069
|
keys = Object.keys(a);
|
|
2070
2070
|
length = keys.length;
|
|
2071
|
-
if (length !== Object.keys(
|
|
2071
|
+
if (length !== Object.keys(b2).length) return false;
|
|
2072
2072
|
for (i2 = length; i2-- !== 0; )
|
|
2073
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
2073
|
+
if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false;
|
|
2074
2074
|
for (i2 = length; i2-- !== 0; ) {
|
|
2075
2075
|
var key = keys[i2];
|
|
2076
|
-
if (!equal(a[key],
|
|
2076
|
+
if (!equal(a[key], b2[key])) return false;
|
|
2077
2077
|
}
|
|
2078
2078
|
return true;
|
|
2079
2079
|
}
|
|
2080
|
-
return a !== a &&
|
|
2080
|
+
return a !== a && b2 !== b2;
|
|
2081
2081
|
};
|
|
2082
2082
|
}
|
|
2083
2083
|
});
|
|
@@ -2274,7 +2274,7 @@ var require_resolve = __commonJS({
|
|
|
2274
2274
|
const pathPrefix = getFullPath(uriResolver, schId, false);
|
|
2275
2275
|
const localRefs = {};
|
|
2276
2276
|
const schemaRefs = /* @__PURE__ */ new Set();
|
|
2277
|
-
traverse(schema, { allKeys: true }, (sch, jsonPtr,
|
|
2277
|
+
traverse(schema, { allKeys: true }, (sch, jsonPtr, _2, parentJsonPtr) => {
|
|
2278
2278
|
if (parentJsonPtr === void 0)
|
|
2279
2279
|
return;
|
|
2280
2280
|
const fullPath = pathPrefix + jsonPtr;
|
|
@@ -2735,8 +2735,8 @@ var require_validate = __commonJS({
|
|
|
2735
2735
|
if (schemaType.length) {
|
|
2736
2736
|
if (!(schemaCode instanceof codegen_1.Name))
|
|
2737
2737
|
throw new Error("ajv implementation error");
|
|
2738
|
-
const
|
|
2739
|
-
return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(
|
|
2738
|
+
const st2 = Array.isArray(schemaType) ? schemaType : [schemaType];
|
|
2739
|
+
return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(st2, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
|
|
2740
2740
|
}
|
|
2741
2741
|
return codegen_1.nil;
|
|
2742
2742
|
}
|
|
@@ -4011,14 +4011,14 @@ var require_core = __commonJS({
|
|
|
4011
4011
|
};
|
|
4012
4012
|
var MAX_EXPRESSION = 200;
|
|
4013
4013
|
function requiredOptions(o) {
|
|
4014
|
-
var _a, _b, _c, _d,
|
|
4014
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
4015
4015
|
const s2 = o.strict;
|
|
4016
4016
|
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
4017
4017
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
4018
4018
|
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
4019
4019
|
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
4020
4020
|
return {
|
|
4021
|
-
strictSchema: (_f = (
|
|
4021
|
+
strictSchema: (_f = (_e2 = o.strictSchema) !== null && _e2 !== void 0 ? _e2 : s2) !== null && _f !== void 0 ? _f : true,
|
|
4022
4022
|
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s2) !== null && _h !== void 0 ? _h : true,
|
|
4023
4023
|
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s2) !== null && _k !== void 0 ? _k : "log",
|
|
4024
4024
|
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s2) !== null && _m !== void 0 ? _m : "log",
|
|
@@ -4086,17 +4086,17 @@ var require_core = __commonJS({
|
|
|
4086
4086
|
return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
|
|
4087
4087
|
}
|
|
4088
4088
|
validate(schemaKeyRef, data) {
|
|
4089
|
-
let
|
|
4089
|
+
let v2;
|
|
4090
4090
|
if (typeof schemaKeyRef == "string") {
|
|
4091
|
-
|
|
4092
|
-
if (!
|
|
4091
|
+
v2 = this.getSchema(schemaKeyRef);
|
|
4092
|
+
if (!v2)
|
|
4093
4093
|
throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
4094
4094
|
} else {
|
|
4095
|
-
|
|
4095
|
+
v2 = this.compile(schemaKeyRef);
|
|
4096
4096
|
}
|
|
4097
|
-
const valid =
|
|
4098
|
-
if (!("$async" in
|
|
4099
|
-
this.errors =
|
|
4097
|
+
const valid = v2(data);
|
|
4098
|
+
if (!("$async" in v2))
|
|
4099
|
+
this.errors = v2.errors;
|
|
4100
4100
|
return valid;
|
|
4101
4101
|
}
|
|
4102
4102
|
compile(schema, _meta) {
|
|
@@ -4590,8 +4590,8 @@ var require_ref = __commonJS({
|
|
|
4590
4590
|
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
|
|
4591
4591
|
}
|
|
4592
4592
|
function callValidate(sch) {
|
|
4593
|
-
const
|
|
4594
|
-
callRef(cxt,
|
|
4593
|
+
const v2 = getValidate(cxt, sch);
|
|
4594
|
+
callRef(cxt, v2, sch, sch.$async);
|
|
4595
4595
|
}
|
|
4596
4596
|
function inlineRefSchema(sch) {
|
|
4597
4597
|
const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });
|
|
@@ -4613,7 +4613,7 @@ var require_ref = __commonJS({
|
|
|
4613
4613
|
return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`;
|
|
4614
4614
|
}
|
|
4615
4615
|
exports.getValidate = getValidate;
|
|
4616
|
-
function callRef(cxt,
|
|
4616
|
+
function callRef(cxt, v2, sch, $async) {
|
|
4617
4617
|
const { gen, it } = cxt;
|
|
4618
4618
|
const { allErrors, schemaEnv: env, opts } = it;
|
|
4619
4619
|
const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
|
|
@@ -4626,8 +4626,8 @@ var require_ref = __commonJS({
|
|
|
4626
4626
|
throw new Error("async schema referenced by sync schema");
|
|
4627
4627
|
const valid = gen.let("valid");
|
|
4628
4628
|
gen.try(() => {
|
|
4629
|
-
gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt,
|
|
4630
|
-
addEvaluatedFrom(
|
|
4629
|
+
gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v2, passCxt)}`);
|
|
4630
|
+
addEvaluatedFrom(v2);
|
|
4631
4631
|
if (!allErrors)
|
|
4632
4632
|
gen.assign(valid, true);
|
|
4633
4633
|
}, (e2) => {
|
|
@@ -4639,7 +4639,7 @@ var require_ref = __commonJS({
|
|
|
4639
4639
|
cxt.ok(valid);
|
|
4640
4640
|
}
|
|
4641
4641
|
function callSyncRef() {
|
|
4642
|
-
cxt.result((0, code_1.callValidateCode)(cxt,
|
|
4642
|
+
cxt.result((0, code_1.callValidateCode)(cxt, v2, passCxt), () => addEvaluatedFrom(v2), () => addErrorsFrom(v2));
|
|
4643
4643
|
}
|
|
4644
4644
|
function addErrorsFrom(source) {
|
|
4645
4645
|
const errs = (0, codegen_1._)`${source}.errors`;
|
|
@@ -5015,8 +5015,8 @@ var require_uniqueItems = __commonJS({
|
|
|
5015
5015
|
var util_1 = require_util();
|
|
5016
5016
|
var equal_1 = require_equal();
|
|
5017
5017
|
var error2 = {
|
|
5018
|
-
message: ({ params: { i: i2, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${
|
|
5019
|
-
params: ({ params: { i: i2, j } }) => (0, codegen_1._)`{i: ${i2}, j: ${
|
|
5018
|
+
message: ({ params: { i: i2, j: j2 } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j2} and ${i2} are identical)`,
|
|
5019
|
+
params: ({ params: { i: i2, j: j2 } }) => (0, codegen_1._)`{i: ${i2}, j: ${j2}}`
|
|
5020
5020
|
};
|
|
5021
5021
|
var def = {
|
|
5022
5022
|
keyword: "uniqueItems",
|
|
@@ -5034,15 +5034,15 @@ var require_uniqueItems = __commonJS({
|
|
|
5034
5034
|
cxt.ok(valid);
|
|
5035
5035
|
function validateUniqueItems() {
|
|
5036
5036
|
const i2 = gen.let("i", (0, codegen_1._)`${data}.length`);
|
|
5037
|
-
const
|
|
5038
|
-
cxt.setParams({ i: i2, j });
|
|
5037
|
+
const j2 = gen.let("j");
|
|
5038
|
+
cxt.setParams({ i: i2, j: j2 });
|
|
5039
5039
|
gen.assign(valid, true);
|
|
5040
|
-
gen.if((0, codegen_1._)`${i2} > 1`, () => (canOptimize() ? loopN : loopN2)(i2,
|
|
5040
|
+
gen.if((0, codegen_1._)`${i2} > 1`, () => (canOptimize() ? loopN : loopN2)(i2, j2));
|
|
5041
5041
|
}
|
|
5042
5042
|
function canOptimize() {
|
|
5043
5043
|
return itemTypes.length > 0 && !itemTypes.some((t2) => t2 === "object" || t2 === "array");
|
|
5044
5044
|
}
|
|
5045
|
-
function loopN(i2,
|
|
5045
|
+
function loopN(i2, j2) {
|
|
5046
5046
|
const item = gen.name("item");
|
|
5047
5047
|
const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);
|
|
5048
5048
|
const indices = gen.const("indices", (0, codegen_1._)`{}`);
|
|
@@ -5052,16 +5052,16 @@ var require_uniqueItems = __commonJS({
|
|
|
5052
5052
|
if (itemTypes.length > 1)
|
|
5053
5053
|
gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`);
|
|
5054
5054
|
gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => {
|
|
5055
|
-
gen.assign(
|
|
5055
|
+
gen.assign(j2, (0, codegen_1._)`${indices}[${item}]`);
|
|
5056
5056
|
cxt.error();
|
|
5057
5057
|
gen.assign(valid, false).break();
|
|
5058
5058
|
}).code((0, codegen_1._)`${indices}[${item}] = ${i2}`);
|
|
5059
5059
|
});
|
|
5060
5060
|
}
|
|
5061
|
-
function loopN2(i2,
|
|
5061
|
+
function loopN2(i2, j2) {
|
|
5062
5062
|
const eql = (0, util_1.useFunc)(gen, equal_1.default);
|
|
5063
5063
|
const outer = gen.name("outer");
|
|
5064
|
-
gen.label(outer).for((0, codegen_1._)`;${i2}--;`, () => gen.for((0, codegen_1._)`${
|
|
5064
|
+
gen.label(outer).for((0, codegen_1._)`;${i2}--;`, () => gen.for((0, codegen_1._)`${j2} = ${i2}; ${j2}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i2}], ${data}[${j2}])`, () => {
|
|
5065
5065
|
cxt.error();
|
|
5066
5066
|
gen.assign(valid, false).break(outer);
|
|
5067
5067
|
})));
|
|
@@ -5138,7 +5138,7 @@ var require_enum = __commonJS({
|
|
|
5138
5138
|
cxt.pass(valid);
|
|
5139
5139
|
function loopEnum() {
|
|
5140
5140
|
gen.assign(valid, false);
|
|
5141
|
-
gen.forOf("v", schemaCode, (
|
|
5141
|
+
gen.forOf("v", schemaCode, (v2) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v2})`, () => gen.assign(valid, true).break()));
|
|
5142
5142
|
}
|
|
5143
5143
|
function equalCode(vSchema, i2) {
|
|
5144
5144
|
const sch = schema[i2];
|
|
@@ -5285,10 +5285,10 @@ var require_items = __commonJS({
|
|
|
5285
5285
|
});
|
|
5286
5286
|
function checkStrictTuple(sch) {
|
|
5287
5287
|
const { opts, errSchemaPath } = it;
|
|
5288
|
-
const
|
|
5289
|
-
const fullTuple =
|
|
5288
|
+
const l3 = schArr.length;
|
|
5289
|
+
const fullTuple = l3 === sch.minItems && (l3 === sch.maxItems || sch[extraItems] === false);
|
|
5290
5290
|
if (opts.strictTuples && !fullTuple) {
|
|
5291
|
-
const msg = `"${keyword}" is ${
|
|
5291
|
+
const msg = `"${keyword}" is ${l3}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
|
|
5292
5292
|
(0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
|
|
5293
5293
|
}
|
|
5294
5294
|
}
|
|
@@ -6524,7 +6524,7 @@ var require_ajv = __commonJS({
|
|
|
6524
6524
|
var Ajv2 = class extends core_1.default {
|
|
6525
6525
|
_addVocabularies() {
|
|
6526
6526
|
super._addVocabularies();
|
|
6527
|
-
draft7_1.default.forEach((
|
|
6527
|
+
draft7_1.default.forEach((v2) => this.addVocabulary(v2));
|
|
6528
6528
|
if (this.opts.discriminator)
|
|
6529
6529
|
this.addKeyword(discriminator_1.default);
|
|
6530
6530
|
}
|
|
@@ -6952,8 +6952,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
6952
6952
|
function noop2() {
|
|
6953
6953
|
return void 0;
|
|
6954
6954
|
}
|
|
6955
|
-
function typeIsObject(
|
|
6956
|
-
return typeof
|
|
6955
|
+
function typeIsObject(x3) {
|
|
6956
|
+
return typeof x3 === "object" && x3 !== null || typeof x3 === "function";
|
|
6957
6957
|
}
|
|
6958
6958
|
const rethrowAssertionErrorRejection = noop2;
|
|
6959
6959
|
function setFunctionName(fn, name) {
|
|
@@ -7004,15 +7004,15 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7004
7004
|
}
|
|
7005
7005
|
return _queueMicrotask(callback);
|
|
7006
7006
|
};
|
|
7007
|
-
function reflectCall(
|
|
7008
|
-
if (typeof
|
|
7007
|
+
function reflectCall(F3, V2, args) {
|
|
7008
|
+
if (typeof F3 !== "function") {
|
|
7009
7009
|
throw new TypeError("Argument is not a function");
|
|
7010
7010
|
}
|
|
7011
|
-
return Function.prototype.apply.call(
|
|
7011
|
+
return Function.prototype.apply.call(F3, V2, args);
|
|
7012
7012
|
}
|
|
7013
|
-
function promiseCall(
|
|
7013
|
+
function promiseCall(F3, V2, args) {
|
|
7014
7014
|
try {
|
|
7015
|
-
return promiseResolvedWith(reflectCall(
|
|
7015
|
+
return promiseResolvedWith(reflectCall(F3, V2, args));
|
|
7016
7016
|
} catch (value) {
|
|
7017
7017
|
return promiseRejectedWith(value);
|
|
7018
7018
|
}
|
|
@@ -7175,71 +7175,71 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7175
7175
|
reader._closedPromise_resolve = void 0;
|
|
7176
7176
|
reader._closedPromise_reject = void 0;
|
|
7177
7177
|
}
|
|
7178
|
-
const NumberIsFinite = Number.isFinite || function(
|
|
7179
|
-
return typeof
|
|
7178
|
+
const NumberIsFinite = Number.isFinite || function(x3) {
|
|
7179
|
+
return typeof x3 === "number" && isFinite(x3);
|
|
7180
7180
|
};
|
|
7181
|
-
const MathTrunc = Math.trunc || function(
|
|
7182
|
-
return
|
|
7181
|
+
const MathTrunc = Math.trunc || function(v2) {
|
|
7182
|
+
return v2 < 0 ? Math.ceil(v2) : Math.floor(v2);
|
|
7183
7183
|
};
|
|
7184
|
-
function isDictionary(
|
|
7185
|
-
return typeof
|
|
7184
|
+
function isDictionary(x3) {
|
|
7185
|
+
return typeof x3 === "object" || typeof x3 === "function";
|
|
7186
7186
|
}
|
|
7187
7187
|
function assertDictionary(obj, context) {
|
|
7188
7188
|
if (obj !== void 0 && !isDictionary(obj)) {
|
|
7189
7189
|
throw new TypeError(`${context} is not an object.`);
|
|
7190
7190
|
}
|
|
7191
7191
|
}
|
|
7192
|
-
function assertFunction(
|
|
7193
|
-
if (typeof
|
|
7192
|
+
function assertFunction(x3, context) {
|
|
7193
|
+
if (typeof x3 !== "function") {
|
|
7194
7194
|
throw new TypeError(`${context} is not a function.`);
|
|
7195
7195
|
}
|
|
7196
7196
|
}
|
|
7197
|
-
function isObject2(
|
|
7198
|
-
return typeof
|
|
7197
|
+
function isObject2(x3) {
|
|
7198
|
+
return typeof x3 === "object" && x3 !== null || typeof x3 === "function";
|
|
7199
7199
|
}
|
|
7200
|
-
function assertObject(
|
|
7201
|
-
if (!isObject2(
|
|
7200
|
+
function assertObject(x3, context) {
|
|
7201
|
+
if (!isObject2(x3)) {
|
|
7202
7202
|
throw new TypeError(`${context} is not an object.`);
|
|
7203
7203
|
}
|
|
7204
7204
|
}
|
|
7205
|
-
function assertRequiredArgument(
|
|
7206
|
-
if (
|
|
7205
|
+
function assertRequiredArgument(x3, position, context) {
|
|
7206
|
+
if (x3 === void 0) {
|
|
7207
7207
|
throw new TypeError(`Parameter ${position} is required in '${context}'.`);
|
|
7208
7208
|
}
|
|
7209
7209
|
}
|
|
7210
|
-
function assertRequiredField(
|
|
7211
|
-
if (
|
|
7210
|
+
function assertRequiredField(x3, field, context) {
|
|
7211
|
+
if (x3 === void 0) {
|
|
7212
7212
|
throw new TypeError(`${field} is required in '${context}'.`);
|
|
7213
7213
|
}
|
|
7214
7214
|
}
|
|
7215
7215
|
function convertUnrestrictedDouble(value) {
|
|
7216
7216
|
return Number(value);
|
|
7217
7217
|
}
|
|
7218
|
-
function censorNegativeZero(
|
|
7219
|
-
return
|
|
7218
|
+
function censorNegativeZero(x3) {
|
|
7219
|
+
return x3 === 0 ? 0 : x3;
|
|
7220
7220
|
}
|
|
7221
|
-
function integerPart(
|
|
7222
|
-
return censorNegativeZero(MathTrunc(
|
|
7221
|
+
function integerPart(x3) {
|
|
7222
|
+
return censorNegativeZero(MathTrunc(x3));
|
|
7223
7223
|
}
|
|
7224
7224
|
function convertUnsignedLongLongWithEnforceRange(value, context) {
|
|
7225
7225
|
const lowerBound = 0;
|
|
7226
7226
|
const upperBound = Number.MAX_SAFE_INTEGER;
|
|
7227
|
-
let
|
|
7228
|
-
|
|
7229
|
-
if (!NumberIsFinite(
|
|
7227
|
+
let x3 = Number(value);
|
|
7228
|
+
x3 = censorNegativeZero(x3);
|
|
7229
|
+
if (!NumberIsFinite(x3)) {
|
|
7230
7230
|
throw new TypeError(`${context} is not a finite number`);
|
|
7231
7231
|
}
|
|
7232
|
-
|
|
7233
|
-
if (
|
|
7232
|
+
x3 = integerPart(x3);
|
|
7233
|
+
if (x3 < lowerBound || x3 > upperBound) {
|
|
7234
7234
|
throw new TypeError(`${context} is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`);
|
|
7235
7235
|
}
|
|
7236
|
-
if (!NumberIsFinite(
|
|
7236
|
+
if (!NumberIsFinite(x3) || x3 === 0) {
|
|
7237
7237
|
return 0;
|
|
7238
7238
|
}
|
|
7239
|
-
return
|
|
7239
|
+
return x3;
|
|
7240
7240
|
}
|
|
7241
|
-
function assertReadableStream(
|
|
7242
|
-
if (!IsReadableStream(
|
|
7241
|
+
function assertReadableStream(x3, context) {
|
|
7242
|
+
if (!IsReadableStream(x3)) {
|
|
7243
7243
|
throw new TypeError(`${context} is not a ReadableStream.`);
|
|
7244
7244
|
}
|
|
7245
7245
|
}
|
|
@@ -7363,14 +7363,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7363
7363
|
configurable: true
|
|
7364
7364
|
});
|
|
7365
7365
|
}
|
|
7366
|
-
function IsReadableStreamDefaultReader(
|
|
7367
|
-
if (!typeIsObject(
|
|
7366
|
+
function IsReadableStreamDefaultReader(x3) {
|
|
7367
|
+
if (!typeIsObject(x3)) {
|
|
7368
7368
|
return false;
|
|
7369
7369
|
}
|
|
7370
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
7370
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_readRequests")) {
|
|
7371
7371
|
return false;
|
|
7372
7372
|
}
|
|
7373
|
-
return
|
|
7373
|
+
return x3 instanceof ReadableStreamDefaultReader;
|
|
7374
7374
|
}
|
|
7375
7375
|
function ReadableStreamDefaultReaderRead(reader, readRequest) {
|
|
7376
7376
|
const stream = reader._ownerReadableStream;
|
|
@@ -7485,15 +7485,15 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7485
7485
|
iterator._asyncIteratorImpl = impl;
|
|
7486
7486
|
return iterator;
|
|
7487
7487
|
}
|
|
7488
|
-
function IsReadableStreamAsyncIterator(
|
|
7489
|
-
if (!typeIsObject(
|
|
7488
|
+
function IsReadableStreamAsyncIterator(x3) {
|
|
7489
|
+
if (!typeIsObject(x3)) {
|
|
7490
7490
|
return false;
|
|
7491
7491
|
}
|
|
7492
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
7492
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_asyncIteratorImpl")) {
|
|
7493
7493
|
return false;
|
|
7494
7494
|
}
|
|
7495
7495
|
try {
|
|
7496
|
-
return
|
|
7496
|
+
return x3._asyncIteratorImpl instanceof ReadableStreamAsyncIteratorImpl;
|
|
7497
7497
|
} catch (_a2) {
|
|
7498
7498
|
return false;
|
|
7499
7499
|
}
|
|
@@ -7501,8 +7501,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7501
7501
|
function streamAsyncIteratorBrandCheckException(name) {
|
|
7502
7502
|
return new TypeError(`ReadableStreamAsyncIterator.${name} can only be used on a ReadableSteamAsyncIterator`);
|
|
7503
7503
|
}
|
|
7504
|
-
const NumberIsNaN = Number.isNaN || function(
|
|
7505
|
-
return
|
|
7504
|
+
const NumberIsNaN = Number.isNaN || function(x3) {
|
|
7505
|
+
return x3 !== x3;
|
|
7506
7506
|
};
|
|
7507
7507
|
var _a, _b, _c;
|
|
7508
7508
|
function CreateArrayFromList(elements) {
|
|
@@ -7511,23 +7511,23 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7511
7511
|
function CopyDataBlockBytes(dest, destOffset, src, srcOffset, n) {
|
|
7512
7512
|
new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset);
|
|
7513
7513
|
}
|
|
7514
|
-
let TransferArrayBuffer = (
|
|
7515
|
-
if (typeof
|
|
7514
|
+
let TransferArrayBuffer = (O2) => {
|
|
7515
|
+
if (typeof O2.transfer === "function") {
|
|
7516
7516
|
TransferArrayBuffer = (buffer) => buffer.transfer();
|
|
7517
7517
|
} else if (typeof structuredClone === "function") {
|
|
7518
7518
|
TransferArrayBuffer = (buffer) => structuredClone(buffer, { transfer: [buffer] });
|
|
7519
7519
|
} else {
|
|
7520
7520
|
TransferArrayBuffer = (buffer) => buffer;
|
|
7521
7521
|
}
|
|
7522
|
-
return TransferArrayBuffer(
|
|
7522
|
+
return TransferArrayBuffer(O2);
|
|
7523
7523
|
};
|
|
7524
|
-
let IsDetachedBuffer = (
|
|
7525
|
-
if (typeof
|
|
7524
|
+
let IsDetachedBuffer = (O2) => {
|
|
7525
|
+
if (typeof O2.detached === "boolean") {
|
|
7526
7526
|
IsDetachedBuffer = (buffer) => buffer.detached;
|
|
7527
7527
|
} else {
|
|
7528
7528
|
IsDetachedBuffer = (buffer) => buffer.byteLength === 0;
|
|
7529
7529
|
}
|
|
7530
|
-
return IsDetachedBuffer(
|
|
7530
|
+
return IsDetachedBuffer(O2);
|
|
7531
7531
|
};
|
|
7532
7532
|
function ArrayBufferSlice(buffer, begin, end) {
|
|
7533
7533
|
if (buffer.slice) {
|
|
@@ -7595,20 +7595,20 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7595
7595
|
function IteratorValue(iterResult) {
|
|
7596
7596
|
return iterResult.value;
|
|
7597
7597
|
}
|
|
7598
|
-
function IsNonNegativeNumber(
|
|
7599
|
-
if (typeof
|
|
7598
|
+
function IsNonNegativeNumber(v2) {
|
|
7599
|
+
if (typeof v2 !== "number") {
|
|
7600
7600
|
return false;
|
|
7601
7601
|
}
|
|
7602
|
-
if (NumberIsNaN(
|
|
7602
|
+
if (NumberIsNaN(v2)) {
|
|
7603
7603
|
return false;
|
|
7604
7604
|
}
|
|
7605
|
-
if (
|
|
7605
|
+
if (v2 < 0) {
|
|
7606
7606
|
return false;
|
|
7607
7607
|
}
|
|
7608
7608
|
return true;
|
|
7609
7609
|
}
|
|
7610
|
-
function CloneAsUint8Array(
|
|
7611
|
-
const buffer = ArrayBufferSlice(
|
|
7610
|
+
function CloneAsUint8Array(O2) {
|
|
7611
|
+
const buffer = ArrayBufferSlice(O2.buffer, O2.byteOffset, O2.byteOffset + O2.byteLength);
|
|
7612
7612
|
return new Uint8Array(buffer);
|
|
7613
7613
|
}
|
|
7614
7614
|
function DequeueValue(container) {
|
|
@@ -7841,23 +7841,23 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
7841
7841
|
configurable: true
|
|
7842
7842
|
});
|
|
7843
7843
|
}
|
|
7844
|
-
function IsReadableByteStreamController(
|
|
7845
|
-
if (!typeIsObject(
|
|
7844
|
+
function IsReadableByteStreamController(x3) {
|
|
7845
|
+
if (!typeIsObject(x3)) {
|
|
7846
7846
|
return false;
|
|
7847
7847
|
}
|
|
7848
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
7848
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_controlledReadableByteStream")) {
|
|
7849
7849
|
return false;
|
|
7850
7850
|
}
|
|
7851
|
-
return
|
|
7851
|
+
return x3 instanceof ReadableByteStreamController;
|
|
7852
7852
|
}
|
|
7853
|
-
function IsReadableStreamBYOBRequest(
|
|
7854
|
-
if (!typeIsObject(
|
|
7853
|
+
function IsReadableStreamBYOBRequest(x3) {
|
|
7854
|
+
if (!typeIsObject(x3)) {
|
|
7855
7855
|
return false;
|
|
7856
7856
|
}
|
|
7857
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
7857
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_associatedReadableByteStreamController")) {
|
|
7858
7858
|
return false;
|
|
7859
7859
|
}
|
|
7860
|
-
return
|
|
7860
|
+
return x3 instanceof ReadableStreamBYOBRequest;
|
|
7861
7861
|
}
|
|
7862
7862
|
function ReadableByteStreamControllerCallPullIfNeeded(controller) {
|
|
7863
7863
|
const shouldPull = ReadableByteStreamControllerShouldCallPull(controller);
|
|
@@ -8489,14 +8489,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
8489
8489
|
configurable: true
|
|
8490
8490
|
});
|
|
8491
8491
|
}
|
|
8492
|
-
function IsReadableStreamBYOBReader(
|
|
8493
|
-
if (!typeIsObject(
|
|
8492
|
+
function IsReadableStreamBYOBReader(x3) {
|
|
8493
|
+
if (!typeIsObject(x3)) {
|
|
8494
8494
|
return false;
|
|
8495
8495
|
}
|
|
8496
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
8496
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_readIntoRequests")) {
|
|
8497
8497
|
return false;
|
|
8498
8498
|
}
|
|
8499
|
-
return
|
|
8499
|
+
return x3 instanceof ReadableStreamBYOBReader;
|
|
8500
8500
|
}
|
|
8501
8501
|
function ReadableStreamBYOBReaderRead(reader, view, min, readIntoRequest) {
|
|
8502
8502
|
const stream = reader._ownerReadableStream;
|
|
@@ -8583,8 +8583,8 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
8583
8583
|
assertFunction(fn, context);
|
|
8584
8584
|
return (chunk, controller) => promiseCall(fn, original, [chunk, controller]);
|
|
8585
8585
|
}
|
|
8586
|
-
function assertWritableStream(
|
|
8587
|
-
if (!IsWritableStream(
|
|
8586
|
+
function assertWritableStream(x3, context) {
|
|
8587
|
+
if (!IsWritableStream(x3)) {
|
|
8588
8588
|
throw new TypeError(`${context} is not a WritableStream.`);
|
|
8589
8589
|
}
|
|
8590
8590
|
}
|
|
@@ -8722,14 +8722,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
8722
8722
|
stream._pendingAbortRequest = void 0;
|
|
8723
8723
|
stream._backpressure = false;
|
|
8724
8724
|
}
|
|
8725
|
-
function IsWritableStream(
|
|
8726
|
-
if (!typeIsObject(
|
|
8725
|
+
function IsWritableStream(x3) {
|
|
8726
|
+
if (!typeIsObject(x3)) {
|
|
8727
8727
|
return false;
|
|
8728
8728
|
}
|
|
8729
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
8729
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_writableStreamController")) {
|
|
8730
8730
|
return false;
|
|
8731
8731
|
}
|
|
8732
|
-
return
|
|
8732
|
+
return x3 instanceof WritableStream;
|
|
8733
8733
|
}
|
|
8734
8734
|
function IsWritableStreamLocked(stream) {
|
|
8735
8735
|
if (stream._writer === void 0) {
|
|
@@ -9072,14 +9072,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
9072
9072
|
configurable: true
|
|
9073
9073
|
});
|
|
9074
9074
|
}
|
|
9075
|
-
function IsWritableStreamDefaultWriter(
|
|
9076
|
-
if (!typeIsObject(
|
|
9075
|
+
function IsWritableStreamDefaultWriter(x3) {
|
|
9076
|
+
if (!typeIsObject(x3)) {
|
|
9077
9077
|
return false;
|
|
9078
9078
|
}
|
|
9079
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
9079
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_ownerWritableStream")) {
|
|
9080
9080
|
return false;
|
|
9081
9081
|
}
|
|
9082
|
-
return
|
|
9082
|
+
return x3 instanceof WritableStreamDefaultWriter;
|
|
9083
9083
|
}
|
|
9084
9084
|
function WritableStreamDefaultWriterAbort(writer, reason) {
|
|
9085
9085
|
const stream = writer._ownerWritableStream;
|
|
@@ -9223,14 +9223,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
9223
9223
|
configurable: true
|
|
9224
9224
|
});
|
|
9225
9225
|
}
|
|
9226
|
-
function IsWritableStreamDefaultController(
|
|
9227
|
-
if (!typeIsObject(
|
|
9226
|
+
function IsWritableStreamDefaultController(x3) {
|
|
9227
|
+
if (!typeIsObject(x3)) {
|
|
9228
9228
|
return false;
|
|
9229
9229
|
}
|
|
9230
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
9230
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_controlledWritableStream")) {
|
|
9231
9231
|
return false;
|
|
9232
9232
|
}
|
|
9233
|
-
return
|
|
9233
|
+
return x3 instanceof WritableStreamDefaultController;
|
|
9234
9234
|
}
|
|
9235
9235
|
function SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithm, abortAlgorithm, highWaterMark, sizeAlgorithm) {
|
|
9236
9236
|
controller._controlledWritableStream = stream;
|
|
@@ -9773,14 +9773,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
9773
9773
|
configurable: true
|
|
9774
9774
|
});
|
|
9775
9775
|
}
|
|
9776
|
-
function IsReadableStreamDefaultController(
|
|
9777
|
-
if (!typeIsObject(
|
|
9776
|
+
function IsReadableStreamDefaultController(x3) {
|
|
9777
|
+
if (!typeIsObject(x3)) {
|
|
9778
9778
|
return false;
|
|
9779
9779
|
}
|
|
9780
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
9780
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_controlledReadableStream")) {
|
|
9781
9781
|
return false;
|
|
9782
9782
|
}
|
|
9783
|
-
return
|
|
9783
|
+
return x3 instanceof ReadableStreamDefaultController;
|
|
9784
9784
|
}
|
|
9785
9785
|
function ReadableStreamDefaultControllerCallPullIfNeeded(controller) {
|
|
9786
9786
|
const shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller);
|
|
@@ -10603,14 +10603,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
10603
10603
|
stream._storedError = void 0;
|
|
10604
10604
|
stream._disturbed = false;
|
|
10605
10605
|
}
|
|
10606
|
-
function IsReadableStream(
|
|
10607
|
-
if (!typeIsObject(
|
|
10606
|
+
function IsReadableStream(x3) {
|
|
10607
|
+
if (!typeIsObject(x3)) {
|
|
10608
10608
|
return false;
|
|
10609
10609
|
}
|
|
10610
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
10610
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_readableStreamController")) {
|
|
10611
10611
|
return false;
|
|
10612
10612
|
}
|
|
10613
|
-
return
|
|
10613
|
+
return x3 instanceof ReadableStream2;
|
|
10614
10614
|
}
|
|
10615
10615
|
function IsReadableStreamLocked(stream) {
|
|
10616
10616
|
if (stream._reader === void 0) {
|
|
@@ -10720,14 +10720,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
10720
10720
|
function byteLengthBrandCheckException(name) {
|
|
10721
10721
|
return new TypeError(`ByteLengthQueuingStrategy.prototype.${name} can only be used on a ByteLengthQueuingStrategy`);
|
|
10722
10722
|
}
|
|
10723
|
-
function IsByteLengthQueuingStrategy(
|
|
10724
|
-
if (!typeIsObject(
|
|
10723
|
+
function IsByteLengthQueuingStrategy(x3) {
|
|
10724
|
+
if (!typeIsObject(x3)) {
|
|
10725
10725
|
return false;
|
|
10726
10726
|
}
|
|
10727
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
10727
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_byteLengthQueuingStrategyHighWaterMark")) {
|
|
10728
10728
|
return false;
|
|
10729
10729
|
}
|
|
10730
|
-
return
|
|
10730
|
+
return x3 instanceof ByteLengthQueuingStrategy;
|
|
10731
10731
|
}
|
|
10732
10732
|
const countSizeFunction = () => {
|
|
10733
10733
|
return 1;
|
|
@@ -10772,14 +10772,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
10772
10772
|
function countBrandCheckException(name) {
|
|
10773
10773
|
return new TypeError(`CountQueuingStrategy.prototype.${name} can only be used on a CountQueuingStrategy`);
|
|
10774
10774
|
}
|
|
10775
|
-
function IsCountQueuingStrategy(
|
|
10776
|
-
if (!typeIsObject(
|
|
10775
|
+
function IsCountQueuingStrategy(x3) {
|
|
10776
|
+
if (!typeIsObject(x3)) {
|
|
10777
10777
|
return false;
|
|
10778
10778
|
}
|
|
10779
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
10779
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_countQueuingStrategyHighWaterMark")) {
|
|
10780
10780
|
return false;
|
|
10781
10781
|
}
|
|
10782
|
-
return
|
|
10782
|
+
return x3 instanceof CountQueuingStrategy;
|
|
10783
10783
|
}
|
|
10784
10784
|
function convertTransformer(original, context) {
|
|
10785
10785
|
assertDictionary(original, context);
|
|
@@ -10900,14 +10900,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
10900
10900
|
TransformStreamSetBackpressure(stream, true);
|
|
10901
10901
|
stream._transformStreamController = void 0;
|
|
10902
10902
|
}
|
|
10903
|
-
function IsTransformStream(
|
|
10904
|
-
if (!typeIsObject(
|
|
10903
|
+
function IsTransformStream(x3) {
|
|
10904
|
+
if (!typeIsObject(x3)) {
|
|
10905
10905
|
return false;
|
|
10906
10906
|
}
|
|
10907
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
10907
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_transformStreamController")) {
|
|
10908
10908
|
return false;
|
|
10909
10909
|
}
|
|
10910
|
-
return
|
|
10910
|
+
return x3 instanceof TransformStream;
|
|
10911
10911
|
}
|
|
10912
10912
|
function TransformStreamError(stream, e2) {
|
|
10913
10913
|
ReadableStreamDefaultControllerError(stream._readable._readableStreamController, e2);
|
|
@@ -10988,14 +10988,14 @@ var require_ponyfill_es2018 = __commonJS({
|
|
|
10988
10988
|
configurable: true
|
|
10989
10989
|
});
|
|
10990
10990
|
}
|
|
10991
|
-
function IsTransformStreamDefaultController(
|
|
10992
|
-
if (!typeIsObject(
|
|
10991
|
+
function IsTransformStreamDefaultController(x3) {
|
|
10992
|
+
if (!typeIsObject(x3)) {
|
|
10993
10993
|
return false;
|
|
10994
10994
|
}
|
|
10995
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
10995
|
+
if (!Object.prototype.hasOwnProperty.call(x3, "_controlledTransformStream")) {
|
|
10996
10996
|
return false;
|
|
10997
10997
|
}
|
|
10998
|
-
return
|
|
10998
|
+
return x3 instanceof TransformStreamDefaultController;
|
|
10999
10999
|
}
|
|
11000
11000
|
function SetUpTransformStreamDefaultController(stream, controller, transformAlgorithm, flushAlgorithm, cancelAlgorithm) {
|
|
11001
11001
|
controller._controlledTransformStream = stream;
|
|
@@ -11286,12 +11286,12 @@ async function* toIterator(parts, clone3 = true) {
|
|
|
11286
11286
|
yield part;
|
|
11287
11287
|
}
|
|
11288
11288
|
} else {
|
|
11289
|
-
let position = 0,
|
|
11289
|
+
let position = 0, b2 = (
|
|
11290
11290
|
/** @type {Blob} */
|
|
11291
11291
|
part
|
|
11292
11292
|
);
|
|
11293
|
-
while (position !==
|
|
11294
|
-
const chunk =
|
|
11293
|
+
while (position !== b2.size) {
|
|
11294
|
+
const chunk = b2.slice(position, Math.min(b2.size, position + POOL_SIZE));
|
|
11295
11295
|
const buffer = await chunk.arrayBuffer();
|
|
11296
11296
|
position += buffer.byteLength;
|
|
11297
11297
|
yield new Uint8Array(buffer);
|
|
@@ -11515,18 +11515,18 @@ var init_file = __esm({
|
|
|
11515
11515
|
});
|
|
11516
11516
|
|
|
11517
11517
|
// node_modules/formdata-polyfill/esm.min.js
|
|
11518
|
-
function formDataToBlob(
|
|
11519
|
-
var
|
|
11518
|
+
function formDataToBlob(F3, B2 = fetch_blob_default) {
|
|
11519
|
+
var b2 = `${r()}${r()}`.replace(/\./g, "").slice(-28).padStart(32, "-"), c = [], p = `--${b2}\r
|
|
11520
11520
|
Content-Disposition: form-data; name="`;
|
|
11521
|
-
|
|
11521
|
+
F3.forEach((v2, n) => typeof v2 == "string" ? c.push(p + e(n) + `"\r
|
|
11522
11522
|
\r
|
|
11523
|
-
${
|
|
11524
|
-
`) : c.push(p + e(n) + `"; filename="${e(
|
|
11525
|
-
Content-Type: ${
|
|
11523
|
+
${v2.replace(/\r(?!\n)|(?<!\r)\n/g, "\r\n")}\r
|
|
11524
|
+
`) : c.push(p + e(n) + `"; filename="${e(v2.name, 1)}"\r
|
|
11525
|
+
Content-Type: ${v2.type || "application/octet-stream"}\r
|
|
11526
11526
|
\r
|
|
11527
|
-
`,
|
|
11528
|
-
c.push(`--${
|
|
11529
|
-
return new
|
|
11527
|
+
`, v2, "\r\n"));
|
|
11528
|
+
c.push(`--${b2}--`);
|
|
11529
|
+
return new B2(c, { type: "multipart/form-data; boundary=" + b2 });
|
|
11530
11530
|
}
|
|
11531
11531
|
var t, i, h, r, m, f, e, x, FormData;
|
|
11532
11532
|
var init_esm_min = __esm({
|
|
@@ -11537,7 +11537,7 @@ var init_esm_min = __esm({
|
|
|
11537
11537
|
({ toStringTag: t, iterator: i, hasInstance: h } = Symbol);
|
|
11538
11538
|
r = Math.random;
|
|
11539
11539
|
m = "append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(",");
|
|
11540
|
-
f = (a,
|
|
11540
|
+
f = (a, b2, c) => (a += "", /^(Blob|File)$/.test(b2 && b2[t]) ? [(c = c !== void 0 ? c + "" : b2[t] == "File" ? b2.name : "blob", a), b2.name !== c || b2[t] == "blob" ? new file_default([b2], c, b2) : b2] : [a, b2 + ""]);
|
|
11541
11541
|
e = (c, f3) => (f3 ? c : c.replace(/\r?\n|\r/g, "\r\n")).replace(/\n/g, "%0A").replace(/\r/g, "%0D").replace(/"/g, "%22");
|
|
11542
11542
|
x = (n, a, e2) => {
|
|
11543
11543
|
if (a.length < e2) {
|
|
@@ -11556,7 +11556,7 @@ var init_esm_min = __esm({
|
|
|
11556
11556
|
return this.entries();
|
|
11557
11557
|
}
|
|
11558
11558
|
static [h](o) {
|
|
11559
|
-
return o && typeof o === "object" && o[t] === "FormData" && !m.some((
|
|
11559
|
+
return o && typeof o === "object" && o[t] === "FormData" && !m.some((m3) => typeof o[m3] != "function");
|
|
11560
11560
|
}
|
|
11561
11561
|
append(...a) {
|
|
11562
11562
|
x("append", arguments, 2);
|
|
@@ -11565,39 +11565,39 @@ var init_esm_min = __esm({
|
|
|
11565
11565
|
delete(a) {
|
|
11566
11566
|
x("delete", arguments, 1);
|
|
11567
11567
|
a += "";
|
|
11568
|
-
this.#d = this.#d.filter(([
|
|
11568
|
+
this.#d = this.#d.filter(([b2]) => b2 !== a);
|
|
11569
11569
|
}
|
|
11570
11570
|
get(a) {
|
|
11571
11571
|
x("get", arguments, 1);
|
|
11572
11572
|
a += "";
|
|
11573
|
-
for (var
|
|
11573
|
+
for (var b2 = this.#d, l3 = b2.length, c = 0; c < l3; c++) if (b2[c][0] === a) return b2[c][1];
|
|
11574
11574
|
return null;
|
|
11575
11575
|
}
|
|
11576
|
-
getAll(a,
|
|
11576
|
+
getAll(a, b2) {
|
|
11577
11577
|
x("getAll", arguments, 1);
|
|
11578
|
-
|
|
11578
|
+
b2 = [];
|
|
11579
11579
|
a += "";
|
|
11580
|
-
this.#d.forEach((c) => c[0] === a &&
|
|
11581
|
-
return
|
|
11580
|
+
this.#d.forEach((c) => c[0] === a && b2.push(c[1]));
|
|
11581
|
+
return b2;
|
|
11582
11582
|
}
|
|
11583
11583
|
has(a) {
|
|
11584
11584
|
x("has", arguments, 1);
|
|
11585
11585
|
a += "";
|
|
11586
|
-
return this.#d.some((
|
|
11586
|
+
return this.#d.some((b2) => b2[0] === a);
|
|
11587
11587
|
}
|
|
11588
|
-
forEach(a,
|
|
11588
|
+
forEach(a, b2) {
|
|
11589
11589
|
x("forEach", arguments, 1);
|
|
11590
|
-
for (var [c,
|
|
11590
|
+
for (var [c, d2] of this) a.call(b2, d2, c, this);
|
|
11591
11591
|
}
|
|
11592
11592
|
set(...a) {
|
|
11593
11593
|
x("set", arguments, 2);
|
|
11594
|
-
var
|
|
11594
|
+
var b2 = [], c = true;
|
|
11595
11595
|
a = f(...a);
|
|
11596
|
-
this.#d.forEach((
|
|
11597
|
-
|
|
11596
|
+
this.#d.forEach((d2) => {
|
|
11597
|
+
d2[0] === a[0] ? c && (c = !b2.push(a)) : b2.push(d2);
|
|
11598
11598
|
});
|
|
11599
|
-
c &&
|
|
11600
|
-
this.#d =
|
|
11599
|
+
c && b2.push(a);
|
|
11600
|
+
this.#d = b2;
|
|
11601
11601
|
}
|
|
11602
11602
|
*entries() {
|
|
11603
11603
|
yield* this.#d;
|
|
@@ -11720,14 +11720,14 @@ __export(multipart_parser_exports, {
|
|
|
11720
11720
|
toFormData: () => toFormData
|
|
11721
11721
|
});
|
|
11722
11722
|
function _fileName(headerValue) {
|
|
11723
|
-
const
|
|
11724
|
-
if (!
|
|
11723
|
+
const m3 = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
11724
|
+
if (!m3) {
|
|
11725
11725
|
return;
|
|
11726
11726
|
}
|
|
11727
|
-
const match =
|
|
11727
|
+
const match = m3[2] || m3[3] || "";
|
|
11728
11728
|
let filename = match.slice(match.lastIndexOf("\\") + 1);
|
|
11729
11729
|
filename = filename.replace(/%22/g, '"');
|
|
11730
|
-
filename = filename.replace(/&#(\d{4});/g, (
|
|
11730
|
+
filename = filename.replace(/&#(\d{4});/g, (m4, code) => {
|
|
11731
11731
|
return String.fromCharCode(code);
|
|
11732
11732
|
});
|
|
11733
11733
|
return filename;
|
|
@@ -11736,11 +11736,11 @@ async function toFormData(Body2, ct) {
|
|
|
11736
11736
|
if (!/multipart/i.test(ct)) {
|
|
11737
11737
|
throw new TypeError("Failed to fetch");
|
|
11738
11738
|
}
|
|
11739
|
-
const
|
|
11740
|
-
if (!
|
|
11739
|
+
const m3 = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
11740
|
+
if (!m3) {
|
|
11741
11741
|
throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
11742
11742
|
}
|
|
11743
|
-
const parser = new MultipartParser(
|
|
11743
|
+
const parser = new MultipartParser(m3[1] || m3[2]);
|
|
11744
11744
|
let headerField;
|
|
11745
11745
|
let headerValue;
|
|
11746
11746
|
let entryValue;
|
|
@@ -11785,9 +11785,9 @@ async function toFormData(Body2, ct) {
|
|
|
11785
11785
|
headerValue += decoder.decode();
|
|
11786
11786
|
headerField = headerField.toLowerCase();
|
|
11787
11787
|
if (headerField === "content-disposition") {
|
|
11788
|
-
const
|
|
11789
|
-
if (
|
|
11790
|
-
entryName =
|
|
11788
|
+
const m4 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
11789
|
+
if (m4) {
|
|
11790
|
+
entryName = m4[2] || m4[3] || "";
|
|
11791
11791
|
}
|
|
11792
11792
|
filename = _fileName(headerValue);
|
|
11793
11793
|
if (filename) {
|
|
@@ -13364,7 +13364,7 @@ function blockToMarkdown(block) {
|
|
|
13364
13364
|
const marker = block.type === "bulletList" ? "- " : "1. ";
|
|
13365
13365
|
const items = Array.isArray(block.content) ? block.content : [];
|
|
13366
13366
|
return items.filter((i2) => i2?.type === "listItem").map((i2) => {
|
|
13367
|
-
const para = (i2.content || []).find((
|
|
13367
|
+
const para = (i2.content || []).find((b2) => b2?.type === "paragraph");
|
|
13368
13368
|
return marker + inlineToMarkdown(para?.content);
|
|
13369
13369
|
}).join("\n");
|
|
13370
13370
|
}
|
|
@@ -13374,7 +13374,7 @@ function blockToMarkdown(block) {
|
|
|
13374
13374
|
}
|
|
13375
13375
|
case "blockquote": {
|
|
13376
13376
|
const inner = inlineToMarkdown(block.content);
|
|
13377
|
-
return inner.split("\n").map((
|
|
13377
|
+
return inner.split("\n").map((l3) => "> " + l3).join("\n");
|
|
13378
13378
|
}
|
|
13379
13379
|
default:
|
|
13380
13380
|
return inlineToMarkdown(block.content);
|
|
@@ -13389,7 +13389,7 @@ function inlineNodeToMarkdown(node) {
|
|
|
13389
13389
|
switch (node.type) {
|
|
13390
13390
|
case "text": {
|
|
13391
13391
|
let t2 = node.text || "";
|
|
13392
|
-
const marks = Array.isArray(node.marks) ? node.marks.map((
|
|
13392
|
+
const marks = Array.isArray(node.marks) ? node.marks.map((m3) => m3?.type) : [];
|
|
13393
13393
|
if (marks.includes("code")) return "`" + t2 + "`";
|
|
13394
13394
|
if (marks.includes("strong")) t2 = "**" + t2 + "**";
|
|
13395
13395
|
if (marks.includes("em")) t2 = "*" + t2 + "*";
|
|
@@ -13412,6 +13412,1471 @@ var init_adf = __esm({
|
|
|
13412
13412
|
}
|
|
13413
13413
|
});
|
|
13414
13414
|
|
|
13415
|
+
// node_modules/marked/lib/marked.esm.js
|
|
13416
|
+
function M() {
|
|
13417
|
+
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
13418
|
+
}
|
|
13419
|
+
function N(l3) {
|
|
13420
|
+
T = l3;
|
|
13421
|
+
}
|
|
13422
|
+
function E(l3) {
|
|
13423
|
+
let e2 = [];
|
|
13424
|
+
return (t2) => {
|
|
13425
|
+
let n = Math.max(0, Math.min(3, t2 - 1)), s2 = e2[n];
|
|
13426
|
+
return s2 || (s2 = l3(n), e2[n] = s2), s2;
|
|
13427
|
+
};
|
|
13428
|
+
}
|
|
13429
|
+
function d(l3, e2 = "") {
|
|
13430
|
+
let t2 = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s2, r2) => {
|
|
13431
|
+
let i2 = typeof r2 == "string" ? r2 : r2.source;
|
|
13432
|
+
return i2 = i2.replace(m2.caret, "$1"), t2 = t2.replace(s2, i2), n;
|
|
13433
|
+
}, getRegex: () => new RegExp(t2, e2) };
|
|
13434
|
+
return n;
|
|
13435
|
+
}
|
|
13436
|
+
function O(l3, e2) {
|
|
13437
|
+
if (e2) {
|
|
13438
|
+
if (m2.escapeTest.test(l3)) return l3.replace(m2.escapeReplace, ge);
|
|
13439
|
+
} else if (m2.escapeTestNoEncode.test(l3)) return l3.replace(m2.escapeReplaceNoEncode, ge);
|
|
13440
|
+
return l3;
|
|
13441
|
+
}
|
|
13442
|
+
function V(l3) {
|
|
13443
|
+
try {
|
|
13444
|
+
l3 = encodeURI(l3).replace(m2.percentDecode, "%");
|
|
13445
|
+
} catch {
|
|
13446
|
+
return null;
|
|
13447
|
+
}
|
|
13448
|
+
return l3;
|
|
13449
|
+
}
|
|
13450
|
+
function Y(l3, e2) {
|
|
13451
|
+
let t2 = l3.replace(m2.findPipe, (r2, i2, o) => {
|
|
13452
|
+
let u = false, a = i2;
|
|
13453
|
+
for (; --a >= 0 && o[a] === "\\"; ) u = !u;
|
|
13454
|
+
return u ? "|" : " |";
|
|
13455
|
+
}), n = t2.split(m2.splitPipe), s2 = 0;
|
|
13456
|
+
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e2) if (n.length > e2) n.splice(e2);
|
|
13457
|
+
else for (; n.length < e2; ) n.push("");
|
|
13458
|
+
for (; s2 < n.length; s2++) n[s2] = n[s2].trim().replace(m2.slashPipe, "|");
|
|
13459
|
+
return n;
|
|
13460
|
+
}
|
|
13461
|
+
function $(l3, e2, t2) {
|
|
13462
|
+
let n = l3.length;
|
|
13463
|
+
if (n === 0) return "";
|
|
13464
|
+
let s2 = 0;
|
|
13465
|
+
for (; s2 < n; ) {
|
|
13466
|
+
let r2 = l3.charAt(n - s2 - 1);
|
|
13467
|
+
if (r2 === e2 && !t2) s2++;
|
|
13468
|
+
else if (r2 !== e2 && t2) s2++;
|
|
13469
|
+
else break;
|
|
13470
|
+
}
|
|
13471
|
+
return l3.slice(0, n - s2);
|
|
13472
|
+
}
|
|
13473
|
+
function ee(l3) {
|
|
13474
|
+
let e2 = l3.split(`
|
|
13475
|
+
`), t2 = e2.length - 1;
|
|
13476
|
+
for (; t2 >= 0 && m2.blankLine.test(e2[t2]); ) t2--;
|
|
13477
|
+
return e2.length - t2 <= 2 ? l3 : e2.slice(0, t2 + 1).join(`
|
|
13478
|
+
`);
|
|
13479
|
+
}
|
|
13480
|
+
function fe(l3, e2) {
|
|
13481
|
+
if (l3.indexOf(e2[1]) === -1) return -1;
|
|
13482
|
+
let t2 = 0;
|
|
13483
|
+
for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
|
|
13484
|
+
else if (l3[n] === e2[0]) t2++;
|
|
13485
|
+
else if (l3[n] === e2[1] && (t2--, t2 < 0)) return n;
|
|
13486
|
+
return t2 > 0 ? -2 : -1;
|
|
13487
|
+
}
|
|
13488
|
+
function me(l3, e2 = 0) {
|
|
13489
|
+
let t2 = e2, n = "";
|
|
13490
|
+
for (let s2 of l3) if (s2 === " ") {
|
|
13491
|
+
let r2 = 4 - t2 % 4;
|
|
13492
|
+
n += " ".repeat(r2), t2 += r2;
|
|
13493
|
+
} else n += s2, t2++;
|
|
13494
|
+
return n;
|
|
13495
|
+
}
|
|
13496
|
+
function xe(l3, e2, t2, n, s2) {
|
|
13497
|
+
let r2 = e2.href, i2 = e2.title || null, o = l3[1].replace(s2.other.outputLinkReplace, "$1");
|
|
13498
|
+
n.state.inLink = true;
|
|
13499
|
+
let u = { type: l3[0].charAt(0) === "!" ? "image" : "link", raw: t2, href: r2, title: i2, text: o, tokens: n.inlineTokens(o) };
|
|
13500
|
+
return n.state.inLink = false, u;
|
|
13501
|
+
}
|
|
13502
|
+
function st(l3, e2, t2) {
|
|
13503
|
+
let n = l3.match(t2.other.indentCodeCompensation);
|
|
13504
|
+
if (n === null) return e2;
|
|
13505
|
+
let s2 = n[1];
|
|
13506
|
+
return e2.split(`
|
|
13507
|
+
`).map((r2) => {
|
|
13508
|
+
let i2 = r2.match(t2.other.beginningSpace);
|
|
13509
|
+
if (i2 === null) return r2;
|
|
13510
|
+
let [o] = i2;
|
|
13511
|
+
return o.length >= s2.length ? r2.slice(s2.length) : r2;
|
|
13512
|
+
}).join(`
|
|
13513
|
+
`);
|
|
13514
|
+
}
|
|
13515
|
+
function g(l3, e2) {
|
|
13516
|
+
return z.parse(l3, e2);
|
|
13517
|
+
}
|
|
13518
|
+
var T, _, Te, m2, Oe, we, ye, B, Pe, j, oe, ae, Se, F2, $e, U, Le, _e, H, K, ze, le, Me, W, se, Ee, Ie, Ae, Ce, ue, Be, I, Z2, X, De, pe, qe, ve, He, ce, Ze, Ge, he, Ne, Qe, je, Fe, Ue, Ke, We, Xe, Je, Ve, v, Ye, ke, de, et, ie, J, tt, Q, nt, D, A2, rt, ge, w, x2, y, L, b, P, q, z, Ft, Ut, Kt, Wt, Xt, Vt, Yt;
|
|
13519
|
+
var init_marked_esm = __esm({
|
|
13520
|
+
"node_modules/marked/lib/marked.esm.js"() {
|
|
13521
|
+
"use strict";
|
|
13522
|
+
T = M();
|
|
13523
|
+
_ = { exec: () => null };
|
|
13524
|
+
Te = ((l3 = "") => {
|
|
13525
|
+
try {
|
|
13526
|
+
return !!new RegExp("(?<=1)(?<!1)" + l3);
|
|
13527
|
+
} catch {
|
|
13528
|
+
return false;
|
|
13529
|
+
}
|
|
13530
|
+
})();
|
|
13531
|
+
m2 = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: E((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: E((l3) => new RegExp(`^ {0,${l3}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)), fencesBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}<(?:[a-z].*>|!--)`, "i")), blockquoteBeginRegex: E((l3) => new RegExp(`^ {0,${l3}}>`)) };
|
|
13532
|
+
Oe = /^(?:[ \t]*(?:\n|$))+/;
|
|
13533
|
+
we = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
13534
|
+
ye = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
13535
|
+
B = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
13536
|
+
Pe = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
13537
|
+
j = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
13538
|
+
oe = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
13539
|
+
ae = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
13540
|
+
Se = d(oe).replace(/bull/g, j).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
13541
|
+
F2 = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
|
13542
|
+
$e = /^[^\n]+/;
|
|
13543
|
+
U = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
13544
|
+
Le = d(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", U).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
13545
|
+
_e = d(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, j).getRegex();
|
|
13546
|
+
H = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
13547
|
+
K = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
13548
|
+
ze = d("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", K).replace("tag", H).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
13549
|
+
le = d(F2).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
|
|
13550
|
+
Me = d(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", le).getRegex();
|
|
13551
|
+
W = { blockquote: Me, code: we, def: Le, fences: ye, heading: Pe, hr: B, html: ze, lheading: ae, list: _e, newline: Oe, paragraph: le, table: _, text: $e };
|
|
13552
|
+
se = d("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex();
|
|
13553
|
+
Ee = { ...W, lheading: Se, table: se, paragraph: d(F2).replace("hr", B).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", se).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", H).getRegex() };
|
|
13554
|
+
Ie = { ...W, html: d(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", K).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: d(F2).replace("hr", B).replace("heading", ` *#{1,6} *[^
|
|
13555
|
+
]`).replace("lheading", ae).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
13556
|
+
Ae = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
13557
|
+
Ce = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
13558
|
+
ue = /^( {2,}|\\)\n(?!\s*$)/;
|
|
13559
|
+
Be = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
13560
|
+
I = /[\p{P}\p{S}]/u;
|
|
13561
|
+
Z2 = /[\s\p{P}\p{S}]/u;
|
|
13562
|
+
X = /[^\s\p{P}\p{S}]/u;
|
|
13563
|
+
De = d(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, Z2).getRegex();
|
|
13564
|
+
pe = /(?!~)[\p{P}\p{S}]/u;
|
|
13565
|
+
qe = /(?!~)[\s\p{P}\p{S}]/u;
|
|
13566
|
+
ve = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
13567
|
+
He = d(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Te ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
13568
|
+
ce = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
13569
|
+
Ze = d(ce, "u").replace(/punct/g, I).getRegex();
|
|
13570
|
+
Ge = d(ce, "u").replace(/punct/g, pe).getRegex();
|
|
13571
|
+
he = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
13572
|
+
Ne = d(he, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z2).replace(/punct/g, I).getRegex();
|
|
13573
|
+
Qe = d(he, "gu").replace(/notPunctSpace/g, ve).replace(/punctSpace/g, qe).replace(/punct/g, pe).getRegex();
|
|
13574
|
+
je = d("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z2).replace(/punct/g, I).getRegex();
|
|
13575
|
+
Fe = d(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, I).getRegex();
|
|
13576
|
+
Ue = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
13577
|
+
Ke = d(Ue, "gu").replace(/notPunctSpace/g, X).replace(/punctSpace/g, Z2).replace(/punct/g, I).getRegex();
|
|
13578
|
+
We = d(/\\(punct)/, "gu").replace(/punct/g, I).getRegex();
|
|
13579
|
+
Xe = d(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
13580
|
+
Je = d(K).replace("(?:-->|$)", "-->").getRegex();
|
|
13581
|
+
Ve = d("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", Je).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
13582
|
+
v = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/;
|
|
13583
|
+
Ye = d(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", v).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
13584
|
+
ke = d(/^!?\[(label)\]\[(ref)\]/).replace("label", v).replace("ref", U).getRegex();
|
|
13585
|
+
de = d(/^!?\[(ref)\](?:\[\])?/).replace("ref", U).getRegex();
|
|
13586
|
+
et = d("reflink|nolink(?!\\()", "g").replace("reflink", ke).replace("nolink", de).getRegex();
|
|
13587
|
+
ie = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
13588
|
+
J = { _backpedal: _, anyPunctuation: We, autolink: Xe, blockSkip: He, br: ue, code: Ce, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: Ze, emStrongRDelimAst: Ne, emStrongRDelimUnd: je, escape: Ae, link: Ye, nolink: de, punctuation: De, reflink: ke, reflinkSearch: et, tag: Ve, text: Be, url: _ };
|
|
13589
|
+
tt = { ...J, link: d(/^!?\[(label)\]\((.*?)\)/).replace("label", v).getRegex(), reflink: d(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", v).getRegex() };
|
|
13590
|
+
Q = { ...J, emStrongRDelimAst: Qe, emStrongLDelim: Ge, delLDelim: Fe, delRDelim: Ke, url: d(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", ie).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: d(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", ie).getRegex() };
|
|
13591
|
+
nt = { ...Q, br: d(ue).replace("{2,}", "*").getRegex(), text: d(Q.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
13592
|
+
D = { normal: W, gfm: Ee, pedantic: Ie };
|
|
13593
|
+
A2 = { normal: J, gfm: Q, breaks: nt, pedantic: tt };
|
|
13594
|
+
rt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
13595
|
+
ge = (l3) => rt[l3];
|
|
13596
|
+
w = class {
|
|
13597
|
+
options;
|
|
13598
|
+
rules;
|
|
13599
|
+
lexer;
|
|
13600
|
+
constructor(e2) {
|
|
13601
|
+
this.options = e2 || T;
|
|
13602
|
+
}
|
|
13603
|
+
space(e2) {
|
|
13604
|
+
let t2 = this.rules.block.newline.exec(e2);
|
|
13605
|
+
if (t2 && t2[0].length > 0) return { type: "space", raw: t2[0] };
|
|
13606
|
+
}
|
|
13607
|
+
code(e2) {
|
|
13608
|
+
let t2 = this.rules.block.code.exec(e2);
|
|
13609
|
+
if (t2) {
|
|
13610
|
+
let n = this.options.pedantic ? t2[0] : ee(t2[0]), s2 = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
13611
|
+
return { type: "code", raw: n, codeBlockStyle: "indented", text: s2 };
|
|
13612
|
+
}
|
|
13613
|
+
}
|
|
13614
|
+
fences(e2) {
|
|
13615
|
+
let t2 = this.rules.block.fences.exec(e2);
|
|
13616
|
+
if (t2) {
|
|
13617
|
+
let n = t2[0], s2 = st(n, t2[3] || "", this.rules);
|
|
13618
|
+
return { type: "code", raw: n, lang: t2[2] ? t2[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t2[2], text: s2 };
|
|
13619
|
+
}
|
|
13620
|
+
}
|
|
13621
|
+
heading(e2) {
|
|
13622
|
+
let t2 = this.rules.block.heading.exec(e2);
|
|
13623
|
+
if (t2) {
|
|
13624
|
+
let n = t2[2].trim();
|
|
13625
|
+
if (this.rules.other.endingHash.test(n)) {
|
|
13626
|
+
let s2 = $(n, "#");
|
|
13627
|
+
(this.options.pedantic || !s2 || this.rules.other.endingSpaceChar.test(s2)) && (n = s2.trim());
|
|
13628
|
+
}
|
|
13629
|
+
return { type: "heading", raw: $(t2[0], `
|
|
13630
|
+
`), depth: t2[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
13631
|
+
}
|
|
13632
|
+
}
|
|
13633
|
+
hr(e2) {
|
|
13634
|
+
let t2 = this.rules.block.hr.exec(e2);
|
|
13635
|
+
if (t2) return { type: "hr", raw: $(t2[0], `
|
|
13636
|
+
`) };
|
|
13637
|
+
}
|
|
13638
|
+
blockquote(e2) {
|
|
13639
|
+
let t2 = this.rules.block.blockquote.exec(e2);
|
|
13640
|
+
if (t2) {
|
|
13641
|
+
let n = $(t2[0], `
|
|
13642
|
+
`).split(`
|
|
13643
|
+
`), s2 = "", r2 = "", i2 = [];
|
|
13644
|
+
for (; n.length > 0; ) {
|
|
13645
|
+
let o = false, u = [], a;
|
|
13646
|
+
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), o = true;
|
|
13647
|
+
else if (!o) u.push(n[a]);
|
|
13648
|
+
else break;
|
|
13649
|
+
n = n.slice(a);
|
|
13650
|
+
let c = u.join(`
|
|
13651
|
+
`), p = c.replace(this.rules.other.blockquoteSetextReplace, `
|
|
13652
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
13653
|
+
s2 = s2 ? `${s2}
|
|
13654
|
+
${c}` : c, r2 = r2 ? `${r2}
|
|
13655
|
+
${p}` : p;
|
|
13656
|
+
let k = this.lexer.state.top;
|
|
13657
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(p, i2, true), this.lexer.state.top = k, n.length === 0) break;
|
|
13658
|
+
let h2 = i2.at(-1);
|
|
13659
|
+
if (h2?.type === "code") break;
|
|
13660
|
+
if (h2?.type === "blockquote") {
|
|
13661
|
+
let R = h2, f3 = R.raw + `
|
|
13662
|
+
` + n.join(`
|
|
13663
|
+
`), S2 = this.blockquote(f3);
|
|
13664
|
+
i2[i2.length - 1] = S2, s2 = s2.substring(0, s2.length - R.raw.length) + S2.raw, r2 = r2.substring(0, r2.length - R.text.length) + S2.text;
|
|
13665
|
+
break;
|
|
13666
|
+
} else if (h2?.type === "list") {
|
|
13667
|
+
let R = h2, f3 = R.raw + `
|
|
13668
|
+
` + n.join(`
|
|
13669
|
+
`), S2 = this.list(f3);
|
|
13670
|
+
i2[i2.length - 1] = S2, s2 = s2.substring(0, s2.length - h2.raw.length) + S2.raw, r2 = r2.substring(0, r2.length - R.raw.length) + S2.raw, n = f3.substring(i2.at(-1).raw.length).split(`
|
|
13671
|
+
`);
|
|
13672
|
+
continue;
|
|
13673
|
+
}
|
|
13674
|
+
}
|
|
13675
|
+
return { type: "blockquote", raw: s2, tokens: i2, text: r2 };
|
|
13676
|
+
}
|
|
13677
|
+
}
|
|
13678
|
+
list(e2) {
|
|
13679
|
+
let t2 = this.rules.block.list.exec(e2);
|
|
13680
|
+
if (t2) {
|
|
13681
|
+
let n = t2[1].trim(), s2 = n.length > 1, r2 = { type: "list", raw: "", ordered: s2, start: s2 ? +n.slice(0, -1) : "", loose: false, items: [] };
|
|
13682
|
+
n = s2 ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = s2 ? n : "[*+-]");
|
|
13683
|
+
let i2 = this.rules.other.listItemRegex(n), o = false;
|
|
13684
|
+
for (; e2; ) {
|
|
13685
|
+
let a = false, c = "", p = "";
|
|
13686
|
+
if (!(t2 = i2.exec(e2)) || this.rules.block.hr.test(e2)) break;
|
|
13687
|
+
c = t2[0], e2 = e2.substring(c.length);
|
|
13688
|
+
let k = me(t2[2].split(`
|
|
13689
|
+
`, 1)[0], t2[1].length), h2 = e2.split(`
|
|
13690
|
+
`, 1)[0], R = !k.trim(), f3 = 0;
|
|
13691
|
+
if (this.options.pedantic ? (f3 = 2, p = k.trimStart()) : R ? f3 = t2[1].length + 1 : (f3 = k.search(this.rules.other.nonSpaceChar), f3 = f3 > 4 ? 1 : f3, p = k.slice(f3), f3 += t2[1].length), R && this.rules.other.blankLine.test(h2) && (c += h2 + `
|
|
13692
|
+
`, e2 = e2.substring(h2.length + 1), a = true), !a) {
|
|
13693
|
+
let S2 = this.rules.other.nextBulletRegex(f3), te = this.rules.other.hrRegex(f3), ne = this.rules.other.fencesBeginRegex(f3), re = this.rules.other.headingBeginRegex(f3), be = this.rules.other.htmlBeginRegex(f3), Re = this.rules.other.blockquoteBeginRegex(f3);
|
|
13694
|
+
for (; e2; ) {
|
|
13695
|
+
let G = e2.split(`
|
|
13696
|
+
`, 1)[0], C;
|
|
13697
|
+
if (h2 = G, this.options.pedantic ? (h2 = h2.replace(this.rules.other.listReplaceNesting, " "), C = h2) : C = h2.replace(this.rules.other.tabCharGlobal, " "), ne.test(h2) || re.test(h2) || be.test(h2) || Re.test(h2) || S2.test(h2) || te.test(h2)) break;
|
|
13698
|
+
if (C.search(this.rules.other.nonSpaceChar) >= f3 || !h2.trim()) p += `
|
|
13699
|
+
` + C.slice(f3);
|
|
13700
|
+
else {
|
|
13701
|
+
if (R || k.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || ne.test(k) || re.test(k) || te.test(k)) break;
|
|
13702
|
+
p += `
|
|
13703
|
+
` + h2;
|
|
13704
|
+
}
|
|
13705
|
+
R = !h2.trim(), c += G + `
|
|
13706
|
+
`, e2 = e2.substring(G.length + 1), k = C.slice(f3);
|
|
13707
|
+
}
|
|
13708
|
+
}
|
|
13709
|
+
r2.loose || (o ? r2.loose = true : this.rules.other.doubleBlankLine.test(c) && (o = true)), r2.items.push({ type: "list_item", raw: c, task: !!this.options.gfm && this.rules.other.listIsTask.test(p), loose: false, text: p, tokens: [] }), r2.raw += c;
|
|
13710
|
+
}
|
|
13711
|
+
let u = r2.items.at(-1);
|
|
13712
|
+
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
13713
|
+
else return;
|
|
13714
|
+
r2.raw = r2.raw.trimEnd();
|
|
13715
|
+
for (let a of r2.items) {
|
|
13716
|
+
this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []);
|
|
13717
|
+
let c = a.tokens[0];
|
|
13718
|
+
if (a.task && (c?.type === "text" || c?.type === "paragraph")) {
|
|
13719
|
+
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), c.raw = c.raw.replace(this.rules.other.listReplaceTask, ""), c.text = c.text.replace(this.rules.other.listReplaceTask, "");
|
|
13720
|
+
for (let k = this.lexer.inlineQueue.length - 1; k >= 0; k--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[k].src)) {
|
|
13721
|
+
this.lexer.inlineQueue[k].src = this.lexer.inlineQueue[k].src.replace(this.rules.other.listReplaceTask, "");
|
|
13722
|
+
break;
|
|
13723
|
+
}
|
|
13724
|
+
let p = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
13725
|
+
if (p) {
|
|
13726
|
+
let k = { type: "checkbox", raw: p[0] + " ", checked: p[0] !== "[ ]" };
|
|
13727
|
+
a.checked = k.checked, r2.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = k.raw + a.tokens[0].raw, a.tokens[0].text = k.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(k)) : a.tokens.unshift({ type: "paragraph", raw: k.raw, text: k.raw, tokens: [k] }) : a.tokens.unshift(k);
|
|
13728
|
+
}
|
|
13729
|
+
} else a.task && (a.task = false);
|
|
13730
|
+
if (!r2.loose) {
|
|
13731
|
+
let p = a.tokens.filter((h2) => h2.type === "space"), k = p.length > 0 && p.some((h2) => this.rules.other.anyLine.test(h2.raw));
|
|
13732
|
+
r2.loose = k;
|
|
13733
|
+
}
|
|
13734
|
+
}
|
|
13735
|
+
if (r2.loose) for (let a of r2.items) {
|
|
13736
|
+
a.loose = true;
|
|
13737
|
+
for (let c of a.tokens) c.type === "text" && (c.type = "paragraph");
|
|
13738
|
+
}
|
|
13739
|
+
return r2;
|
|
13740
|
+
}
|
|
13741
|
+
}
|
|
13742
|
+
html(e2) {
|
|
13743
|
+
let t2 = this.rules.block.html.exec(e2);
|
|
13744
|
+
if (t2) {
|
|
13745
|
+
let n = ee(t2[0]);
|
|
13746
|
+
return { type: "html", block: true, raw: n, pre: t2[1] === "pre" || t2[1] === "script" || t2[1] === "style", text: n };
|
|
13747
|
+
}
|
|
13748
|
+
}
|
|
13749
|
+
def(e2) {
|
|
13750
|
+
let t2 = this.rules.block.def.exec(e2);
|
|
13751
|
+
if (t2) {
|
|
13752
|
+
let n = t2[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), s2 = t2[2] ? t2[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r2 = t2[3] ? t2[3].substring(1, t2[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t2[3];
|
|
13753
|
+
return { type: "def", tag: n, raw: $(t2[0], `
|
|
13754
|
+
`), href: s2, title: r2 };
|
|
13755
|
+
}
|
|
13756
|
+
}
|
|
13757
|
+
table(e2) {
|
|
13758
|
+
let t2 = this.rules.block.table.exec(e2);
|
|
13759
|
+
if (!t2 || !this.rules.other.tableDelimiter.test(t2[2])) return;
|
|
13760
|
+
let n = Y(t2[1]), s2 = t2[2].replace(this.rules.other.tableAlignChars, "").split("|"), r2 = t2[3]?.trim() ? t2[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
13761
|
+
`) : [], i2 = { type: "table", raw: $(t2[0], `
|
|
13762
|
+
`), header: [], align: [], rows: [] };
|
|
13763
|
+
if (n.length === s2.length) {
|
|
13764
|
+
for (let o of s2) this.rules.other.tableAlignRight.test(o) ? i2.align.push("right") : this.rules.other.tableAlignCenter.test(o) ? i2.align.push("center") : this.rules.other.tableAlignLeft.test(o) ? i2.align.push("left") : i2.align.push(null);
|
|
13765
|
+
for (let o = 0; o < n.length; o++) i2.header.push({ text: n[o], tokens: this.lexer.inline(n[o]), header: true, align: i2.align[o] });
|
|
13766
|
+
for (let o of r2) i2.rows.push(Y(o, i2.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: i2.align[a] })));
|
|
13767
|
+
return i2;
|
|
13768
|
+
}
|
|
13769
|
+
}
|
|
13770
|
+
lheading(e2) {
|
|
13771
|
+
let t2 = this.rules.block.lheading.exec(e2);
|
|
13772
|
+
if (t2) {
|
|
13773
|
+
let n = t2[1].trim();
|
|
13774
|
+
return { type: "heading", raw: $(t2[0], `
|
|
13775
|
+
`), depth: t2[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
13776
|
+
}
|
|
13777
|
+
}
|
|
13778
|
+
paragraph(e2) {
|
|
13779
|
+
let t2 = this.rules.block.paragraph.exec(e2);
|
|
13780
|
+
if (t2) {
|
|
13781
|
+
let n = t2[1].charAt(t2[1].length - 1) === `
|
|
13782
|
+
` ? t2[1].slice(0, -1) : t2[1];
|
|
13783
|
+
return { type: "paragraph", raw: t2[0], text: n, tokens: this.lexer.inline(n) };
|
|
13784
|
+
}
|
|
13785
|
+
}
|
|
13786
|
+
text(e2) {
|
|
13787
|
+
let t2 = this.rules.block.text.exec(e2);
|
|
13788
|
+
if (t2) return { type: "text", raw: t2[0], text: t2[0], tokens: this.lexer.inline(t2[0]) };
|
|
13789
|
+
}
|
|
13790
|
+
escape(e2) {
|
|
13791
|
+
let t2 = this.rules.inline.escape.exec(e2);
|
|
13792
|
+
if (t2) return { type: "escape", raw: t2[0], text: t2[1] };
|
|
13793
|
+
}
|
|
13794
|
+
tag(e2) {
|
|
13795
|
+
let t2 = this.rules.inline.tag.exec(e2);
|
|
13796
|
+
if (t2) return !this.lexer.state.inLink && this.rules.other.startATag.test(t2[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t2[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t2[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t2[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t2[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t2[0] };
|
|
13797
|
+
}
|
|
13798
|
+
link(e2) {
|
|
13799
|
+
let t2 = this.rules.inline.link.exec(e2);
|
|
13800
|
+
if (t2) {
|
|
13801
|
+
let n = t2[2].trim();
|
|
13802
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
13803
|
+
if (!this.rules.other.endAngleBracket.test(n)) return;
|
|
13804
|
+
let i2 = $(n.slice(0, -1), "\\");
|
|
13805
|
+
if ((n.length - i2.length) % 2 === 0) return;
|
|
13806
|
+
} else {
|
|
13807
|
+
let i2 = fe(t2[2], "()");
|
|
13808
|
+
if (i2 === -2) return;
|
|
13809
|
+
if (i2 > -1) {
|
|
13810
|
+
let u = (t2[0].indexOf("!") === 0 ? 5 : 4) + t2[1].length + i2;
|
|
13811
|
+
t2[2] = t2[2].substring(0, i2), t2[0] = t2[0].substring(0, u).trim(), t2[3] = "";
|
|
13812
|
+
}
|
|
13813
|
+
}
|
|
13814
|
+
let s2 = t2[2], r2 = "";
|
|
13815
|
+
if (this.options.pedantic) {
|
|
13816
|
+
let i2 = this.rules.other.pedanticHrefTitle.exec(s2);
|
|
13817
|
+
i2 && (s2 = i2[1], r2 = i2[3]);
|
|
13818
|
+
} else r2 = t2[3] ? t2[3].slice(1, -1) : "";
|
|
13819
|
+
return s2 = s2.trim(), this.rules.other.startAngleBracket.test(s2) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s2 = s2.slice(1) : s2 = s2.slice(1, -1)), xe(t2, { href: s2 && s2.replace(this.rules.inline.anyPunctuation, "$1"), title: r2 && r2.replace(this.rules.inline.anyPunctuation, "$1") }, t2[0], this.lexer, this.rules);
|
|
13820
|
+
}
|
|
13821
|
+
}
|
|
13822
|
+
reflink(e2, t2) {
|
|
13823
|
+
let n;
|
|
13824
|
+
if ((n = this.rules.inline.reflink.exec(e2)) || (n = this.rules.inline.nolink.exec(e2))) {
|
|
13825
|
+
let s2 = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), r2 = t2[s2.toLowerCase()];
|
|
13826
|
+
if (!r2) {
|
|
13827
|
+
let i2 = n[0].charAt(0);
|
|
13828
|
+
return { type: "text", raw: i2, text: i2 };
|
|
13829
|
+
}
|
|
13830
|
+
return xe(n, r2, n[0], this.lexer, this.rules);
|
|
13831
|
+
}
|
|
13832
|
+
}
|
|
13833
|
+
emStrong(e2, t2, n = "") {
|
|
13834
|
+
let s2 = this.rules.inline.emStrongLDelim.exec(e2);
|
|
13835
|
+
if (!s2 || !s2[1] && !s2[2] && !s2[3] && !s2[4] || s2[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
13836
|
+
if (!(s2[1] || s2[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
13837
|
+
let i2 = [...s2[0]].length - 1, o, u, a = i2, c = 0, p = s2[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
13838
|
+
for (p.lastIndex = 0, t2 = t2.slice(-1 * e2.length + i2); (s2 = p.exec(t2)) !== null; ) {
|
|
13839
|
+
if (o = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o) continue;
|
|
13840
|
+
if (u = [...o].length, s2[3] || s2[4]) {
|
|
13841
|
+
a += u;
|
|
13842
|
+
continue;
|
|
13843
|
+
} else if ((s2[5] || s2[6]) && i2 % 3 && !((i2 + u) % 3)) {
|
|
13844
|
+
c += u;
|
|
13845
|
+
continue;
|
|
13846
|
+
}
|
|
13847
|
+
if (a -= u, a > 0) continue;
|
|
13848
|
+
u = Math.min(u, u + a + c);
|
|
13849
|
+
let k = [...s2[0]][0].length, h2 = e2.slice(0, i2 + s2.index + k + u);
|
|
13850
|
+
if (Math.min(i2, u) % 2) {
|
|
13851
|
+
let f3 = h2.slice(1, -1);
|
|
13852
|
+
return { type: "em", raw: h2, text: f3, tokens: this.lexer.inlineTokens(f3) };
|
|
13853
|
+
}
|
|
13854
|
+
let R = h2.slice(2, -2);
|
|
13855
|
+
return { type: "strong", raw: h2, text: R, tokens: this.lexer.inlineTokens(R) };
|
|
13856
|
+
}
|
|
13857
|
+
}
|
|
13858
|
+
}
|
|
13859
|
+
codespan(e2) {
|
|
13860
|
+
let t2 = this.rules.inline.code.exec(e2);
|
|
13861
|
+
if (t2) {
|
|
13862
|
+
let n = t2[2].replace(this.rules.other.newLineCharGlobal, " "), s2 = this.rules.other.nonSpaceChar.test(n), r2 = this.rules.other.startingSpaceChar.test(n) && this.rules.other.endingSpaceChar.test(n);
|
|
13863
|
+
return s2 && r2 && (n = n.substring(1, n.length - 1)), { type: "codespan", raw: t2[0], text: n };
|
|
13864
|
+
}
|
|
13865
|
+
}
|
|
13866
|
+
br(e2) {
|
|
13867
|
+
let t2 = this.rules.inline.br.exec(e2);
|
|
13868
|
+
if (t2) return { type: "br", raw: t2[0] };
|
|
13869
|
+
}
|
|
13870
|
+
del(e2, t2, n = "") {
|
|
13871
|
+
let s2 = this.rules.inline.delLDelim.exec(e2);
|
|
13872
|
+
if (!s2) return;
|
|
13873
|
+
if (!(s2[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
13874
|
+
let i2 = [...s2[0]].length - 1, o, u, a = i2, c = this.rules.inline.delRDelim;
|
|
13875
|
+
for (c.lastIndex = 0, t2 = t2.slice(-1 * e2.length + i2); (s2 = c.exec(t2)) !== null; ) {
|
|
13876
|
+
if (o = s2[1] || s2[2] || s2[3] || s2[4] || s2[5] || s2[6], !o || (u = [...o].length, u !== i2)) continue;
|
|
13877
|
+
if (s2[3] || s2[4]) {
|
|
13878
|
+
a += u;
|
|
13879
|
+
continue;
|
|
13880
|
+
}
|
|
13881
|
+
if (a -= u, a > 0) continue;
|
|
13882
|
+
u = Math.min(u, u + a);
|
|
13883
|
+
let p = [...s2[0]][0].length, k = e2.slice(0, i2 + s2.index + p + u), h2 = k.slice(i2, -i2);
|
|
13884
|
+
return { type: "del", raw: k, text: h2, tokens: this.lexer.inlineTokens(h2) };
|
|
13885
|
+
}
|
|
13886
|
+
}
|
|
13887
|
+
}
|
|
13888
|
+
autolink(e2) {
|
|
13889
|
+
let t2 = this.rules.inline.autolink.exec(e2);
|
|
13890
|
+
if (t2) {
|
|
13891
|
+
let n, s2;
|
|
13892
|
+
return t2[2] === "@" ? (n = t2[1], s2 = "mailto:" + n) : (n = t2[1], s2 = n), { type: "link", raw: t2[0], text: n, href: s2, tokens: [{ type: "text", raw: n, text: n }] };
|
|
13893
|
+
}
|
|
13894
|
+
}
|
|
13895
|
+
url(e2) {
|
|
13896
|
+
let t2;
|
|
13897
|
+
if (t2 = this.rules.inline.url.exec(e2)) {
|
|
13898
|
+
let n, s2;
|
|
13899
|
+
if (t2[2] === "@") n = t2[0], s2 = "mailto:" + n;
|
|
13900
|
+
else {
|
|
13901
|
+
let r2;
|
|
13902
|
+
do
|
|
13903
|
+
r2 = t2[0], t2[0] = this.rules.inline._backpedal.exec(t2[0])?.[0] ?? "";
|
|
13904
|
+
while (r2 !== t2[0]);
|
|
13905
|
+
n = t2[0], t2[1] === "www." ? s2 = "http://" + t2[0] : s2 = t2[0];
|
|
13906
|
+
}
|
|
13907
|
+
return { type: "link", raw: t2[0], text: n, href: s2, tokens: [{ type: "text", raw: n, text: n }] };
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13910
|
+
inlineText(e2) {
|
|
13911
|
+
let t2 = this.rules.inline.text.exec(e2);
|
|
13912
|
+
if (t2) {
|
|
13913
|
+
let n = this.lexer.state.inRawBlock;
|
|
13914
|
+
return { type: "text", raw: t2[0], text: t2[0], escaped: n };
|
|
13915
|
+
}
|
|
13916
|
+
}
|
|
13917
|
+
};
|
|
13918
|
+
x2 = class l {
|
|
13919
|
+
tokens;
|
|
13920
|
+
options;
|
|
13921
|
+
state;
|
|
13922
|
+
inlineQueue;
|
|
13923
|
+
tokenizer;
|
|
13924
|
+
constructor(e2) {
|
|
13925
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e2 || T, this.options.tokenizer = this.options.tokenizer || new w(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, top: true };
|
|
13926
|
+
let t2 = { other: m2, block: D.normal, inline: A2.normal };
|
|
13927
|
+
this.options.pedantic ? (t2.block = D.pedantic, t2.inline = A2.pedantic) : this.options.gfm && (t2.block = D.gfm, this.options.breaks ? t2.inline = A2.breaks : t2.inline = A2.gfm), this.tokenizer.rules = t2;
|
|
13928
|
+
}
|
|
13929
|
+
static get rules() {
|
|
13930
|
+
return { block: D, inline: A2 };
|
|
13931
|
+
}
|
|
13932
|
+
static lex(e2, t2) {
|
|
13933
|
+
return new l(t2).lex(e2);
|
|
13934
|
+
}
|
|
13935
|
+
static lexInline(e2, t2) {
|
|
13936
|
+
return new l(t2).inlineTokens(e2);
|
|
13937
|
+
}
|
|
13938
|
+
lex(e2) {
|
|
13939
|
+
e2 = e2.replace(m2.carriageReturn, `
|
|
13940
|
+
`), this.blockTokens(e2, this.tokens);
|
|
13941
|
+
for (let t2 = 0; t2 < this.inlineQueue.length; t2++) {
|
|
13942
|
+
let n = this.inlineQueue[t2];
|
|
13943
|
+
this.inlineTokens(n.src, n.tokens);
|
|
13944
|
+
}
|
|
13945
|
+
return this.inlineQueue = [], this.tokens;
|
|
13946
|
+
}
|
|
13947
|
+
blockTokens(e2, t2 = [], n = false) {
|
|
13948
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e2 = e2.replace(m2.tabCharGlobal, " ").replace(m2.spaceLine, ""));
|
|
13949
|
+
let s2 = 1 / 0;
|
|
13950
|
+
for (; e2; ) {
|
|
13951
|
+
if (e2.length < s2) s2 = e2.length;
|
|
13952
|
+
else {
|
|
13953
|
+
this.infiniteLoopError(e2.charCodeAt(0));
|
|
13954
|
+
break;
|
|
13955
|
+
}
|
|
13956
|
+
let r2;
|
|
13957
|
+
if (this.options.extensions?.block?.some((o) => (r2 = o.call({ lexer: this }, e2, t2)) ? (e2 = e2.substring(r2.raw.length), t2.push(r2), true) : false)) continue;
|
|
13958
|
+
if (r2 = this.tokenizer.space(e2)) {
|
|
13959
|
+
e2 = e2.substring(r2.raw.length);
|
|
13960
|
+
let o = t2.at(-1);
|
|
13961
|
+
r2.raw.length === 1 && o !== void 0 ? o.raw += `
|
|
13962
|
+
` : t2.push(r2);
|
|
13963
|
+
continue;
|
|
13964
|
+
}
|
|
13965
|
+
if (r2 = this.tokenizer.code(e2)) {
|
|
13966
|
+
e2 = e2.substring(r2.raw.length);
|
|
13967
|
+
let o = t2.at(-1);
|
|
13968
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
13969
|
+
`) ? "" : `
|
|
13970
|
+
`) + r2.raw, o.text += `
|
|
13971
|
+
` + r2.text, this.inlineQueue.at(-1).src = o.text) : t2.push(r2);
|
|
13972
|
+
continue;
|
|
13973
|
+
}
|
|
13974
|
+
if (r2 = this.tokenizer.fences(e2)) {
|
|
13975
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13976
|
+
continue;
|
|
13977
|
+
}
|
|
13978
|
+
if (r2 = this.tokenizer.heading(e2)) {
|
|
13979
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13980
|
+
continue;
|
|
13981
|
+
}
|
|
13982
|
+
if (r2 = this.tokenizer.hr(e2)) {
|
|
13983
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13984
|
+
continue;
|
|
13985
|
+
}
|
|
13986
|
+
if (r2 = this.tokenizer.blockquote(e2)) {
|
|
13987
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13988
|
+
continue;
|
|
13989
|
+
}
|
|
13990
|
+
if (r2 = this.tokenizer.list(e2)) {
|
|
13991
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13992
|
+
continue;
|
|
13993
|
+
}
|
|
13994
|
+
if (r2 = this.tokenizer.html(e2)) {
|
|
13995
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
13996
|
+
continue;
|
|
13997
|
+
}
|
|
13998
|
+
if (r2 = this.tokenizer.def(e2)) {
|
|
13999
|
+
e2 = e2.substring(r2.raw.length);
|
|
14000
|
+
let o = t2.at(-1);
|
|
14001
|
+
o?.type === "paragraph" || o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
14002
|
+
`) ? "" : `
|
|
14003
|
+
`) + r2.raw, o.text += `
|
|
14004
|
+
` + r2.raw, this.inlineQueue.at(-1).src = o.text) : this.tokens.links[r2.tag] || (this.tokens.links[r2.tag] = { href: r2.href, title: r2.title }, t2.push(r2));
|
|
14005
|
+
continue;
|
|
14006
|
+
}
|
|
14007
|
+
if (r2 = this.tokenizer.table(e2)) {
|
|
14008
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
14009
|
+
continue;
|
|
14010
|
+
}
|
|
14011
|
+
if (r2 = this.tokenizer.lheading(e2)) {
|
|
14012
|
+
e2 = e2.substring(r2.raw.length), t2.push(r2);
|
|
14013
|
+
continue;
|
|
14014
|
+
}
|
|
14015
|
+
let i2 = e2;
|
|
14016
|
+
if (this.options.extensions?.startBlock) {
|
|
14017
|
+
let o = 1 / 0, u = e2.slice(1), a;
|
|
14018
|
+
this.options.extensions.startBlock.forEach((c) => {
|
|
14019
|
+
a = c.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (o = Math.min(o, a));
|
|
14020
|
+
}), o < 1 / 0 && o >= 0 && (i2 = e2.substring(0, o + 1));
|
|
14021
|
+
}
|
|
14022
|
+
if (this.state.top && (r2 = this.tokenizer.paragraph(i2))) {
|
|
14023
|
+
let o = t2.at(-1);
|
|
14024
|
+
n && o?.type === "paragraph" ? (o.raw += (o.raw.endsWith(`
|
|
14025
|
+
`) ? "" : `
|
|
14026
|
+
`) + r2.raw, o.text += `
|
|
14027
|
+
` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t2.push(r2), n = i2.length !== e2.length, e2 = e2.substring(r2.raw.length);
|
|
14028
|
+
continue;
|
|
14029
|
+
}
|
|
14030
|
+
if (r2 = this.tokenizer.text(e2)) {
|
|
14031
|
+
e2 = e2.substring(r2.raw.length);
|
|
14032
|
+
let o = t2.at(-1);
|
|
14033
|
+
o?.type === "text" ? (o.raw += (o.raw.endsWith(`
|
|
14034
|
+
`) ? "" : `
|
|
14035
|
+
`) + r2.raw, o.text += `
|
|
14036
|
+
` + r2.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = o.text) : t2.push(r2);
|
|
14037
|
+
continue;
|
|
14038
|
+
}
|
|
14039
|
+
if (e2) {
|
|
14040
|
+
this.infiniteLoopError(e2.charCodeAt(0));
|
|
14041
|
+
break;
|
|
14042
|
+
}
|
|
14043
|
+
}
|
|
14044
|
+
return this.state.top = true, t2;
|
|
14045
|
+
}
|
|
14046
|
+
inline(e2, t2 = []) {
|
|
14047
|
+
return this.inlineQueue.push({ src: e2, tokens: t2 }), t2;
|
|
14048
|
+
}
|
|
14049
|
+
inlineTokens(e2, t2 = []) {
|
|
14050
|
+
this.tokenizer.lexer = this;
|
|
14051
|
+
let n = e2, s2 = null;
|
|
14052
|
+
if (this.tokens.links) {
|
|
14053
|
+
let a = Object.keys(this.tokens.links);
|
|
14054
|
+
if (a.length > 0) for (; (s2 = this.tokenizer.rules.inline.reflinkSearch.exec(n)) !== null; ) a.includes(s2[0].slice(s2[0].lastIndexOf("[") + 1, -1)) && (n = n.slice(0, s2.index) + "[" + "a".repeat(s2[0].length - 2) + "]" + n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
14055
|
+
}
|
|
14056
|
+
for (; (s2 = this.tokenizer.rules.inline.anyPunctuation.exec(n)) !== null; ) n = n.slice(0, s2.index) + "++" + n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
14057
|
+
let r2;
|
|
14058
|
+
for (; (s2 = this.tokenizer.rules.inline.blockSkip.exec(n)) !== null; ) r2 = s2[2] ? s2[2].length : 0, n = n.slice(0, s2.index + r2) + "[" + "a".repeat(s2[0].length - r2 - 2) + "]" + n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
14059
|
+
n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
14060
|
+
let i2 = false, o = "", u = 1 / 0;
|
|
14061
|
+
for (; e2; ) {
|
|
14062
|
+
if (e2.length < u) u = e2.length;
|
|
14063
|
+
else {
|
|
14064
|
+
this.infiniteLoopError(e2.charCodeAt(0));
|
|
14065
|
+
break;
|
|
14066
|
+
}
|
|
14067
|
+
i2 || (o = ""), i2 = false;
|
|
14068
|
+
let a;
|
|
14069
|
+
if (this.options.extensions?.inline?.some((p) => (a = p.call({ lexer: this }, e2, t2)) ? (e2 = e2.substring(a.raw.length), t2.push(a), true) : false)) continue;
|
|
14070
|
+
if (a = this.tokenizer.escape(e2)) {
|
|
14071
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14072
|
+
continue;
|
|
14073
|
+
}
|
|
14074
|
+
if (a = this.tokenizer.tag(e2)) {
|
|
14075
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14076
|
+
continue;
|
|
14077
|
+
}
|
|
14078
|
+
if (a = this.tokenizer.link(e2)) {
|
|
14079
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14080
|
+
continue;
|
|
14081
|
+
}
|
|
14082
|
+
if (a = this.tokenizer.reflink(e2, this.tokens.links)) {
|
|
14083
|
+
e2 = e2.substring(a.raw.length);
|
|
14084
|
+
let p = t2.at(-1);
|
|
14085
|
+
a.type === "text" && p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t2.push(a);
|
|
14086
|
+
continue;
|
|
14087
|
+
}
|
|
14088
|
+
if (a = this.tokenizer.emStrong(e2, n, o)) {
|
|
14089
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14090
|
+
continue;
|
|
14091
|
+
}
|
|
14092
|
+
if (a = this.tokenizer.codespan(e2)) {
|
|
14093
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14094
|
+
continue;
|
|
14095
|
+
}
|
|
14096
|
+
if (a = this.tokenizer.br(e2)) {
|
|
14097
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14098
|
+
continue;
|
|
14099
|
+
}
|
|
14100
|
+
if (a = this.tokenizer.del(e2, n, o)) {
|
|
14101
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14102
|
+
continue;
|
|
14103
|
+
}
|
|
14104
|
+
if (a = this.tokenizer.autolink(e2)) {
|
|
14105
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14106
|
+
continue;
|
|
14107
|
+
}
|
|
14108
|
+
if (!this.state.inLink && (a = this.tokenizer.url(e2))) {
|
|
14109
|
+
e2 = e2.substring(a.raw.length), t2.push(a);
|
|
14110
|
+
continue;
|
|
14111
|
+
}
|
|
14112
|
+
let c = e2;
|
|
14113
|
+
if (this.options.extensions?.startInline) {
|
|
14114
|
+
let p = 1 / 0, k = e2.slice(1), h2;
|
|
14115
|
+
this.options.extensions.startInline.forEach((R) => {
|
|
14116
|
+
h2 = R.call({ lexer: this }, k), typeof h2 == "number" && h2 >= 0 && (p = Math.min(p, h2));
|
|
14117
|
+
}), p < 1 / 0 && p >= 0 && (c = e2.substring(0, p + 1));
|
|
14118
|
+
}
|
|
14119
|
+
if (a = this.tokenizer.inlineText(c)) {
|
|
14120
|
+
e2 = e2.substring(a.raw.length), a.raw.slice(-1) !== "_" && (o = a.raw.slice(-1)), i2 = true;
|
|
14121
|
+
let p = t2.at(-1);
|
|
14122
|
+
p?.type === "text" ? (p.raw += a.raw, p.text += a.text) : t2.push(a);
|
|
14123
|
+
continue;
|
|
14124
|
+
}
|
|
14125
|
+
if (e2) {
|
|
14126
|
+
this.infiniteLoopError(e2.charCodeAt(0));
|
|
14127
|
+
break;
|
|
14128
|
+
}
|
|
14129
|
+
}
|
|
14130
|
+
return t2;
|
|
14131
|
+
}
|
|
14132
|
+
infiniteLoopError(e2) {
|
|
14133
|
+
let t2 = "Infinite loop on byte: " + e2;
|
|
14134
|
+
if (this.options.silent) console.error(t2);
|
|
14135
|
+
else throw new Error(t2);
|
|
14136
|
+
}
|
|
14137
|
+
};
|
|
14138
|
+
y = class {
|
|
14139
|
+
options;
|
|
14140
|
+
parser;
|
|
14141
|
+
constructor(e2) {
|
|
14142
|
+
this.options = e2 || T;
|
|
14143
|
+
}
|
|
14144
|
+
space(e2) {
|
|
14145
|
+
return "";
|
|
14146
|
+
}
|
|
14147
|
+
code({ text: e2, lang: t2, escaped: n }) {
|
|
14148
|
+
let s2 = (t2 || "").match(m2.notSpaceStart)?.[0], r2 = e2.replace(m2.endingNewline, "") + `
|
|
14149
|
+
`;
|
|
14150
|
+
return s2 ? '<pre><code class="language-' + O(s2) + '">' + (n ? r2 : O(r2, true)) + `</code></pre>
|
|
14151
|
+
` : "<pre><code>" + (n ? r2 : O(r2, true)) + `</code></pre>
|
|
14152
|
+
`;
|
|
14153
|
+
}
|
|
14154
|
+
blockquote({ tokens: e2 }) {
|
|
14155
|
+
return `<blockquote>
|
|
14156
|
+
${this.parser.parse(e2)}</blockquote>
|
|
14157
|
+
`;
|
|
14158
|
+
}
|
|
14159
|
+
html({ text: e2 }) {
|
|
14160
|
+
return e2;
|
|
14161
|
+
}
|
|
14162
|
+
def(e2) {
|
|
14163
|
+
return "";
|
|
14164
|
+
}
|
|
14165
|
+
heading({ tokens: e2, depth: t2 }) {
|
|
14166
|
+
return `<h${t2}>${this.parser.parseInline(e2)}</h${t2}>
|
|
14167
|
+
`;
|
|
14168
|
+
}
|
|
14169
|
+
hr(e2) {
|
|
14170
|
+
return `<hr>
|
|
14171
|
+
`;
|
|
14172
|
+
}
|
|
14173
|
+
list(e2) {
|
|
14174
|
+
let t2 = e2.ordered, n = e2.start, s2 = "";
|
|
14175
|
+
for (let o = 0; o < e2.items.length; o++) {
|
|
14176
|
+
let u = e2.items[o];
|
|
14177
|
+
s2 += this.listitem(u);
|
|
14178
|
+
}
|
|
14179
|
+
let r2 = t2 ? "ol" : "ul", i2 = t2 && n !== 1 ? ' start="' + n + '"' : "";
|
|
14180
|
+
return "<" + r2 + i2 + `>
|
|
14181
|
+
` + s2 + "</" + r2 + `>
|
|
14182
|
+
`;
|
|
14183
|
+
}
|
|
14184
|
+
listitem(e2) {
|
|
14185
|
+
return `<li>${this.parser.parse(e2.tokens)}</li>
|
|
14186
|
+
`;
|
|
14187
|
+
}
|
|
14188
|
+
checkbox({ checked: e2 }) {
|
|
14189
|
+
return "<input " + (e2 ? 'checked="" ' : "") + 'disabled="" type="checkbox"> ';
|
|
14190
|
+
}
|
|
14191
|
+
paragraph({ tokens: e2 }) {
|
|
14192
|
+
return `<p>${this.parser.parseInline(e2)}</p>
|
|
14193
|
+
`;
|
|
14194
|
+
}
|
|
14195
|
+
table(e2) {
|
|
14196
|
+
let t2 = "", n = "";
|
|
14197
|
+
for (let r2 = 0; r2 < e2.header.length; r2++) n += this.tablecell(e2.header[r2]);
|
|
14198
|
+
t2 += this.tablerow({ text: n });
|
|
14199
|
+
let s2 = "";
|
|
14200
|
+
for (let r2 = 0; r2 < e2.rows.length; r2++) {
|
|
14201
|
+
let i2 = e2.rows[r2];
|
|
14202
|
+
n = "";
|
|
14203
|
+
for (let o = 0; o < i2.length; o++) n += this.tablecell(i2[o]);
|
|
14204
|
+
s2 += this.tablerow({ text: n });
|
|
14205
|
+
}
|
|
14206
|
+
return s2 && (s2 = `<tbody>${s2}</tbody>`), `<table>
|
|
14207
|
+
<thead>
|
|
14208
|
+
` + t2 + `</thead>
|
|
14209
|
+
` + s2 + `</table>
|
|
14210
|
+
`;
|
|
14211
|
+
}
|
|
14212
|
+
tablerow({ text: e2 }) {
|
|
14213
|
+
return `<tr>
|
|
14214
|
+
${e2}</tr>
|
|
14215
|
+
`;
|
|
14216
|
+
}
|
|
14217
|
+
tablecell(e2) {
|
|
14218
|
+
let t2 = this.parser.parseInline(e2.tokens), n = e2.header ? "th" : "td";
|
|
14219
|
+
return (e2.align ? `<${n} align="${e2.align}">` : `<${n}>`) + t2 + `</${n}>
|
|
14220
|
+
`;
|
|
14221
|
+
}
|
|
14222
|
+
strong({ tokens: e2 }) {
|
|
14223
|
+
return `<strong>${this.parser.parseInline(e2)}</strong>`;
|
|
14224
|
+
}
|
|
14225
|
+
em({ tokens: e2 }) {
|
|
14226
|
+
return `<em>${this.parser.parseInline(e2)}</em>`;
|
|
14227
|
+
}
|
|
14228
|
+
codespan({ text: e2 }) {
|
|
14229
|
+
return `<code>${O(e2, true)}</code>`;
|
|
14230
|
+
}
|
|
14231
|
+
br(e2) {
|
|
14232
|
+
return "<br>";
|
|
14233
|
+
}
|
|
14234
|
+
del({ tokens: e2 }) {
|
|
14235
|
+
return `<del>${this.parser.parseInline(e2)}</del>`;
|
|
14236
|
+
}
|
|
14237
|
+
link({ href: e2, title: t2, tokens: n }) {
|
|
14238
|
+
let s2 = this.parser.parseInline(n), r2 = V(e2);
|
|
14239
|
+
if (r2 === null) return s2;
|
|
14240
|
+
e2 = r2;
|
|
14241
|
+
let i2 = '<a href="' + e2 + '"';
|
|
14242
|
+
return t2 && (i2 += ' title="' + O(t2) + '"'), i2 += ">" + s2 + "</a>", i2;
|
|
14243
|
+
}
|
|
14244
|
+
image({ href: e2, title: t2, text: n, tokens: s2 }) {
|
|
14245
|
+
s2 && (n = this.parser.parseInline(s2, this.parser.textRenderer));
|
|
14246
|
+
let r2 = V(e2);
|
|
14247
|
+
if (r2 === null) return O(n);
|
|
14248
|
+
e2 = r2;
|
|
14249
|
+
let i2 = `<img src="${e2}" alt="${O(n)}"`;
|
|
14250
|
+
return t2 && (i2 += ` title="${O(t2)}"`), i2 += ">", i2;
|
|
14251
|
+
}
|
|
14252
|
+
text(e2) {
|
|
14253
|
+
return "tokens" in e2 && e2.tokens ? this.parser.parseInline(e2.tokens) : "escaped" in e2 && e2.escaped ? e2.text : O(e2.text);
|
|
14254
|
+
}
|
|
14255
|
+
};
|
|
14256
|
+
L = class {
|
|
14257
|
+
strong({ text: e2 }) {
|
|
14258
|
+
return e2;
|
|
14259
|
+
}
|
|
14260
|
+
em({ text: e2 }) {
|
|
14261
|
+
return e2;
|
|
14262
|
+
}
|
|
14263
|
+
codespan({ text: e2 }) {
|
|
14264
|
+
return e2;
|
|
14265
|
+
}
|
|
14266
|
+
del({ text: e2 }) {
|
|
14267
|
+
return e2;
|
|
14268
|
+
}
|
|
14269
|
+
html({ text: e2 }) {
|
|
14270
|
+
return e2;
|
|
14271
|
+
}
|
|
14272
|
+
text({ text: e2 }) {
|
|
14273
|
+
return e2;
|
|
14274
|
+
}
|
|
14275
|
+
link({ text: e2 }) {
|
|
14276
|
+
return "" + e2;
|
|
14277
|
+
}
|
|
14278
|
+
image({ text: e2 }) {
|
|
14279
|
+
return "" + e2;
|
|
14280
|
+
}
|
|
14281
|
+
br() {
|
|
14282
|
+
return "";
|
|
14283
|
+
}
|
|
14284
|
+
checkbox({ raw: e2 }) {
|
|
14285
|
+
return e2;
|
|
14286
|
+
}
|
|
14287
|
+
};
|
|
14288
|
+
b = class l2 {
|
|
14289
|
+
options;
|
|
14290
|
+
renderer;
|
|
14291
|
+
textRenderer;
|
|
14292
|
+
constructor(e2) {
|
|
14293
|
+
this.options = e2 || T, this.options.renderer = this.options.renderer || new y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new L();
|
|
14294
|
+
}
|
|
14295
|
+
static parse(e2, t2) {
|
|
14296
|
+
return new l2(t2).parse(e2);
|
|
14297
|
+
}
|
|
14298
|
+
static parseInline(e2, t2) {
|
|
14299
|
+
return new l2(t2).parseInline(e2);
|
|
14300
|
+
}
|
|
14301
|
+
parse(e2) {
|
|
14302
|
+
this.renderer.parser = this;
|
|
14303
|
+
let t2 = "";
|
|
14304
|
+
for (let n = 0; n < e2.length; n++) {
|
|
14305
|
+
let s2 = e2[n];
|
|
14306
|
+
if (this.options.extensions?.renderers?.[s2.type]) {
|
|
14307
|
+
let i2 = s2, o = this.options.extensions.renderers[i2.type].call({ parser: this }, i2);
|
|
14308
|
+
if (o !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "def", "paragraph", "text"].includes(i2.type)) {
|
|
14309
|
+
t2 += o || "";
|
|
14310
|
+
continue;
|
|
14311
|
+
}
|
|
14312
|
+
}
|
|
14313
|
+
let r2 = s2;
|
|
14314
|
+
switch (r2.type) {
|
|
14315
|
+
case "space": {
|
|
14316
|
+
t2 += this.renderer.space(r2);
|
|
14317
|
+
break;
|
|
14318
|
+
}
|
|
14319
|
+
case "hr": {
|
|
14320
|
+
t2 += this.renderer.hr(r2);
|
|
14321
|
+
break;
|
|
14322
|
+
}
|
|
14323
|
+
case "heading": {
|
|
14324
|
+
t2 += this.renderer.heading(r2);
|
|
14325
|
+
break;
|
|
14326
|
+
}
|
|
14327
|
+
case "code": {
|
|
14328
|
+
t2 += this.renderer.code(r2);
|
|
14329
|
+
break;
|
|
14330
|
+
}
|
|
14331
|
+
case "table": {
|
|
14332
|
+
t2 += this.renderer.table(r2);
|
|
14333
|
+
break;
|
|
14334
|
+
}
|
|
14335
|
+
case "blockquote": {
|
|
14336
|
+
t2 += this.renderer.blockquote(r2);
|
|
14337
|
+
break;
|
|
14338
|
+
}
|
|
14339
|
+
case "list": {
|
|
14340
|
+
t2 += this.renderer.list(r2);
|
|
14341
|
+
break;
|
|
14342
|
+
}
|
|
14343
|
+
case "checkbox": {
|
|
14344
|
+
t2 += this.renderer.checkbox(r2);
|
|
14345
|
+
break;
|
|
14346
|
+
}
|
|
14347
|
+
case "html": {
|
|
14348
|
+
t2 += this.renderer.html(r2);
|
|
14349
|
+
break;
|
|
14350
|
+
}
|
|
14351
|
+
case "def": {
|
|
14352
|
+
t2 += this.renderer.def(r2);
|
|
14353
|
+
break;
|
|
14354
|
+
}
|
|
14355
|
+
case "paragraph": {
|
|
14356
|
+
t2 += this.renderer.paragraph(r2);
|
|
14357
|
+
break;
|
|
14358
|
+
}
|
|
14359
|
+
case "text": {
|
|
14360
|
+
t2 += this.renderer.text(r2);
|
|
14361
|
+
break;
|
|
14362
|
+
}
|
|
14363
|
+
default: {
|
|
14364
|
+
let i2 = 'Token with "' + r2.type + '" type was not found.';
|
|
14365
|
+
if (this.options.silent) return console.error(i2), "";
|
|
14366
|
+
throw new Error(i2);
|
|
14367
|
+
}
|
|
14368
|
+
}
|
|
14369
|
+
}
|
|
14370
|
+
return t2;
|
|
14371
|
+
}
|
|
14372
|
+
parseInline(e2, t2 = this.renderer) {
|
|
14373
|
+
this.renderer.parser = this;
|
|
14374
|
+
let n = "";
|
|
14375
|
+
for (let s2 = 0; s2 < e2.length; s2++) {
|
|
14376
|
+
let r2 = e2[s2];
|
|
14377
|
+
if (this.options.extensions?.renderers?.[r2.type]) {
|
|
14378
|
+
let o = this.options.extensions.renderers[r2.type].call({ parser: this }, r2);
|
|
14379
|
+
if (o !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(r2.type)) {
|
|
14380
|
+
n += o || "";
|
|
14381
|
+
continue;
|
|
14382
|
+
}
|
|
14383
|
+
}
|
|
14384
|
+
let i2 = r2;
|
|
14385
|
+
switch (i2.type) {
|
|
14386
|
+
case "escape": {
|
|
14387
|
+
n += t2.text(i2);
|
|
14388
|
+
break;
|
|
14389
|
+
}
|
|
14390
|
+
case "html": {
|
|
14391
|
+
n += t2.html(i2);
|
|
14392
|
+
break;
|
|
14393
|
+
}
|
|
14394
|
+
case "link": {
|
|
14395
|
+
n += t2.link(i2);
|
|
14396
|
+
break;
|
|
14397
|
+
}
|
|
14398
|
+
case "image": {
|
|
14399
|
+
n += t2.image(i2);
|
|
14400
|
+
break;
|
|
14401
|
+
}
|
|
14402
|
+
case "checkbox": {
|
|
14403
|
+
n += t2.checkbox(i2);
|
|
14404
|
+
break;
|
|
14405
|
+
}
|
|
14406
|
+
case "strong": {
|
|
14407
|
+
n += t2.strong(i2);
|
|
14408
|
+
break;
|
|
14409
|
+
}
|
|
14410
|
+
case "em": {
|
|
14411
|
+
n += t2.em(i2);
|
|
14412
|
+
break;
|
|
14413
|
+
}
|
|
14414
|
+
case "codespan": {
|
|
14415
|
+
n += t2.codespan(i2);
|
|
14416
|
+
break;
|
|
14417
|
+
}
|
|
14418
|
+
case "br": {
|
|
14419
|
+
n += t2.br(i2);
|
|
14420
|
+
break;
|
|
14421
|
+
}
|
|
14422
|
+
case "del": {
|
|
14423
|
+
n += t2.del(i2);
|
|
14424
|
+
break;
|
|
14425
|
+
}
|
|
14426
|
+
case "text": {
|
|
14427
|
+
n += t2.text(i2);
|
|
14428
|
+
break;
|
|
14429
|
+
}
|
|
14430
|
+
default: {
|
|
14431
|
+
let o = 'Token with "' + i2.type + '" type was not found.';
|
|
14432
|
+
if (this.options.silent) return console.error(o), "";
|
|
14433
|
+
throw new Error(o);
|
|
14434
|
+
}
|
|
14435
|
+
}
|
|
14436
|
+
}
|
|
14437
|
+
return n;
|
|
14438
|
+
}
|
|
14439
|
+
};
|
|
14440
|
+
P = class {
|
|
14441
|
+
options;
|
|
14442
|
+
block;
|
|
14443
|
+
constructor(e2) {
|
|
14444
|
+
this.options = e2 || T;
|
|
14445
|
+
}
|
|
14446
|
+
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
14447
|
+
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
14448
|
+
preprocess(e2) {
|
|
14449
|
+
return e2;
|
|
14450
|
+
}
|
|
14451
|
+
postprocess(e2) {
|
|
14452
|
+
return e2;
|
|
14453
|
+
}
|
|
14454
|
+
processAllTokens(e2) {
|
|
14455
|
+
return e2;
|
|
14456
|
+
}
|
|
14457
|
+
emStrongMask(e2) {
|
|
14458
|
+
return e2;
|
|
14459
|
+
}
|
|
14460
|
+
provideLexer(e2 = this.block) {
|
|
14461
|
+
return e2 ? x2.lex : x2.lexInline;
|
|
14462
|
+
}
|
|
14463
|
+
provideParser(e2 = this.block) {
|
|
14464
|
+
return e2 ? b.parse : b.parseInline;
|
|
14465
|
+
}
|
|
14466
|
+
};
|
|
14467
|
+
q = class {
|
|
14468
|
+
defaults = M();
|
|
14469
|
+
options = this.setOptions;
|
|
14470
|
+
parse = this.parseMarkdown(true);
|
|
14471
|
+
parseInline = this.parseMarkdown(false);
|
|
14472
|
+
Parser = b;
|
|
14473
|
+
Renderer = y;
|
|
14474
|
+
TextRenderer = L;
|
|
14475
|
+
Lexer = x2;
|
|
14476
|
+
Tokenizer = w;
|
|
14477
|
+
Hooks = P;
|
|
14478
|
+
constructor(...e2) {
|
|
14479
|
+
this.use(...e2);
|
|
14480
|
+
}
|
|
14481
|
+
walkTokens(e2, t2) {
|
|
14482
|
+
let n = [];
|
|
14483
|
+
for (let s2 of e2) switch (n = n.concat(t2.call(this, s2)), s2.type) {
|
|
14484
|
+
case "table": {
|
|
14485
|
+
let r2 = s2;
|
|
14486
|
+
for (let i2 of r2.header) n = n.concat(this.walkTokens(i2.tokens, t2));
|
|
14487
|
+
for (let i2 of r2.rows) for (let o of i2) n = n.concat(this.walkTokens(o.tokens, t2));
|
|
14488
|
+
break;
|
|
14489
|
+
}
|
|
14490
|
+
case "list": {
|
|
14491
|
+
let r2 = s2;
|
|
14492
|
+
n = n.concat(this.walkTokens(r2.items, t2));
|
|
14493
|
+
break;
|
|
14494
|
+
}
|
|
14495
|
+
default: {
|
|
14496
|
+
let r2 = s2;
|
|
14497
|
+
this.defaults.extensions?.childTokens?.[r2.type] ? this.defaults.extensions.childTokens[r2.type].forEach((i2) => {
|
|
14498
|
+
let o = r2[i2].flat(1 / 0);
|
|
14499
|
+
n = n.concat(this.walkTokens(o, t2));
|
|
14500
|
+
}) : r2.tokens && (n = n.concat(this.walkTokens(r2.tokens, t2)));
|
|
14501
|
+
}
|
|
14502
|
+
}
|
|
14503
|
+
return n;
|
|
14504
|
+
}
|
|
14505
|
+
use(...e2) {
|
|
14506
|
+
let t2 = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
|
14507
|
+
return e2.forEach((n) => {
|
|
14508
|
+
let s2 = { ...n };
|
|
14509
|
+
if (s2.async = this.defaults.async || s2.async || false, n.extensions && (n.extensions.forEach((r2) => {
|
|
14510
|
+
if (!r2.name) throw new Error("extension name required");
|
|
14511
|
+
if ("renderer" in r2) {
|
|
14512
|
+
let i2 = t2.renderers[r2.name];
|
|
14513
|
+
i2 ? t2.renderers[r2.name] = function(...o) {
|
|
14514
|
+
let u = r2.renderer.apply(this, o);
|
|
14515
|
+
return u === false && (u = i2.apply(this, o)), u;
|
|
14516
|
+
} : t2.renderers[r2.name] = r2.renderer;
|
|
14517
|
+
}
|
|
14518
|
+
if ("tokenizer" in r2) {
|
|
14519
|
+
if (!r2.level || r2.level !== "block" && r2.level !== "inline") throw new Error("extension level must be 'block' or 'inline'");
|
|
14520
|
+
let i2 = t2[r2.level];
|
|
14521
|
+
i2 ? i2.unshift(r2.tokenizer) : t2[r2.level] = [r2.tokenizer], r2.start && (r2.level === "block" ? t2.startBlock ? t2.startBlock.push(r2.start) : t2.startBlock = [r2.start] : r2.level === "inline" && (t2.startInline ? t2.startInline.push(r2.start) : t2.startInline = [r2.start]));
|
|
14522
|
+
}
|
|
14523
|
+
"childTokens" in r2 && r2.childTokens && (t2.childTokens[r2.name] = r2.childTokens);
|
|
14524
|
+
}), s2.extensions = t2), n.renderer) {
|
|
14525
|
+
let r2 = this.defaults.renderer || new y(this.defaults);
|
|
14526
|
+
for (let i2 in n.renderer) {
|
|
14527
|
+
if (!(i2 in r2)) throw new Error(`renderer '${i2}' does not exist`);
|
|
14528
|
+
if (["options", "parser"].includes(i2)) continue;
|
|
14529
|
+
let o = i2, u = n.renderer[o], a = r2[o];
|
|
14530
|
+
r2[o] = (...c) => {
|
|
14531
|
+
let p = u.apply(r2, c);
|
|
14532
|
+
return p === false && (p = a.apply(r2, c)), p || "";
|
|
14533
|
+
};
|
|
14534
|
+
}
|
|
14535
|
+
s2.renderer = r2;
|
|
14536
|
+
}
|
|
14537
|
+
if (n.tokenizer) {
|
|
14538
|
+
let r2 = this.defaults.tokenizer || new w(this.defaults);
|
|
14539
|
+
for (let i2 in n.tokenizer) {
|
|
14540
|
+
if (!(i2 in r2)) throw new Error(`tokenizer '${i2}' does not exist`);
|
|
14541
|
+
if (["options", "rules", "lexer"].includes(i2)) continue;
|
|
14542
|
+
let o = i2, u = n.tokenizer[o], a = r2[o];
|
|
14543
|
+
r2[o] = (...c) => {
|
|
14544
|
+
let p = u.apply(r2, c);
|
|
14545
|
+
return p === false && (p = a.apply(r2, c)), p;
|
|
14546
|
+
};
|
|
14547
|
+
}
|
|
14548
|
+
s2.tokenizer = r2;
|
|
14549
|
+
}
|
|
14550
|
+
if (n.hooks) {
|
|
14551
|
+
let r2 = this.defaults.hooks || new P();
|
|
14552
|
+
for (let i2 in n.hooks) {
|
|
14553
|
+
if (!(i2 in r2)) throw new Error(`hook '${i2}' does not exist`);
|
|
14554
|
+
if (["options", "block"].includes(i2)) continue;
|
|
14555
|
+
let o = i2, u = n.hooks[o], a = r2[o];
|
|
14556
|
+
P.passThroughHooks.has(i2) ? r2[o] = (c) => {
|
|
14557
|
+
if (this.defaults.async && P.passThroughHooksRespectAsync.has(i2)) return (async () => {
|
|
14558
|
+
let k = await u.call(r2, c);
|
|
14559
|
+
return a.call(r2, k);
|
|
14560
|
+
})();
|
|
14561
|
+
let p = u.call(r2, c);
|
|
14562
|
+
return a.call(r2, p);
|
|
14563
|
+
} : r2[o] = (...c) => {
|
|
14564
|
+
if (this.defaults.async) return (async () => {
|
|
14565
|
+
let k = await u.apply(r2, c);
|
|
14566
|
+
return k === false && (k = await a.apply(r2, c)), k;
|
|
14567
|
+
})();
|
|
14568
|
+
let p = u.apply(r2, c);
|
|
14569
|
+
return p === false && (p = a.apply(r2, c)), p;
|
|
14570
|
+
};
|
|
14571
|
+
}
|
|
14572
|
+
s2.hooks = r2;
|
|
14573
|
+
}
|
|
14574
|
+
if (n.walkTokens) {
|
|
14575
|
+
let r2 = this.defaults.walkTokens, i2 = n.walkTokens;
|
|
14576
|
+
s2.walkTokens = function(o) {
|
|
14577
|
+
let u = [];
|
|
14578
|
+
return u.push(i2.call(this, o)), r2 && (u = u.concat(r2.call(this, o))), u;
|
|
14579
|
+
};
|
|
14580
|
+
}
|
|
14581
|
+
this.defaults = { ...this.defaults, ...s2 };
|
|
14582
|
+
}), this;
|
|
14583
|
+
}
|
|
14584
|
+
setOptions(e2) {
|
|
14585
|
+
return this.defaults = { ...this.defaults, ...e2 }, this;
|
|
14586
|
+
}
|
|
14587
|
+
lexer(e2, t2) {
|
|
14588
|
+
return x2.lex(e2, t2 ?? this.defaults);
|
|
14589
|
+
}
|
|
14590
|
+
parser(e2, t2) {
|
|
14591
|
+
return b.parse(e2, t2 ?? this.defaults);
|
|
14592
|
+
}
|
|
14593
|
+
parseMarkdown(e2) {
|
|
14594
|
+
return (n, s2) => {
|
|
14595
|
+
let r2 = { ...s2 }, i2 = { ...this.defaults, ...r2 }, o = this.onError(!!i2.silent, !!i2.async);
|
|
14596
|
+
if (this.defaults.async === true && r2.async === false) return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
14597
|
+
if (typeof n > "u" || n === null) return o(new Error("marked(): input parameter is undefined or null"));
|
|
14598
|
+
if (typeof n != "string") return o(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
14599
|
+
if (i2.hooks && (i2.hooks.options = i2, i2.hooks.block = e2), i2.async) return (async () => {
|
|
14600
|
+
let u = i2.hooks ? await i2.hooks.preprocess(n) : n, c = await (i2.hooks ? await i2.hooks.provideLexer(e2) : e2 ? x2.lex : x2.lexInline)(u, i2), p = i2.hooks ? await i2.hooks.processAllTokens(c) : c;
|
|
14601
|
+
i2.walkTokens && await Promise.all(this.walkTokens(p, i2.walkTokens));
|
|
14602
|
+
let h2 = await (i2.hooks ? await i2.hooks.provideParser(e2) : e2 ? b.parse : b.parseInline)(p, i2);
|
|
14603
|
+
return i2.hooks ? await i2.hooks.postprocess(h2) : h2;
|
|
14604
|
+
})().catch(o);
|
|
14605
|
+
try {
|
|
14606
|
+
i2.hooks && (n = i2.hooks.preprocess(n));
|
|
14607
|
+
let a = (i2.hooks ? i2.hooks.provideLexer(e2) : e2 ? x2.lex : x2.lexInline)(n, i2);
|
|
14608
|
+
i2.hooks && (a = i2.hooks.processAllTokens(a)), i2.walkTokens && this.walkTokens(a, i2.walkTokens);
|
|
14609
|
+
let p = (i2.hooks ? i2.hooks.provideParser(e2) : e2 ? b.parse : b.parseInline)(a, i2);
|
|
14610
|
+
return i2.hooks && (p = i2.hooks.postprocess(p)), p;
|
|
14611
|
+
} catch (u) {
|
|
14612
|
+
return o(u);
|
|
14613
|
+
}
|
|
14614
|
+
};
|
|
14615
|
+
}
|
|
14616
|
+
onError(e2, t2) {
|
|
14617
|
+
return (n) => {
|
|
14618
|
+
if (n.message += `
|
|
14619
|
+
Please report this to https://github.com/markedjs/marked.`, e2) {
|
|
14620
|
+
let s2 = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
14621
|
+
return t2 ? Promise.resolve(s2) : s2;
|
|
14622
|
+
}
|
|
14623
|
+
if (t2) return Promise.reject(n);
|
|
14624
|
+
throw n;
|
|
14625
|
+
};
|
|
14626
|
+
}
|
|
14627
|
+
};
|
|
14628
|
+
z = new q();
|
|
14629
|
+
g.options = g.setOptions = function(l3) {
|
|
14630
|
+
return z.setOptions(l3), g.defaults = z.defaults, N(g.defaults), g;
|
|
14631
|
+
};
|
|
14632
|
+
g.getDefaults = M;
|
|
14633
|
+
g.defaults = T;
|
|
14634
|
+
g.use = function(...l3) {
|
|
14635
|
+
return z.use(...l3), g.defaults = z.defaults, N(g.defaults), g;
|
|
14636
|
+
};
|
|
14637
|
+
g.walkTokens = function(l3, e2) {
|
|
14638
|
+
return z.walkTokens(l3, e2);
|
|
14639
|
+
};
|
|
14640
|
+
g.parseInline = z.parseInline;
|
|
14641
|
+
g.Parser = b;
|
|
14642
|
+
g.parser = b.parse;
|
|
14643
|
+
g.Renderer = y;
|
|
14644
|
+
g.TextRenderer = L;
|
|
14645
|
+
g.Lexer = x2;
|
|
14646
|
+
g.lexer = x2.lex;
|
|
14647
|
+
g.Tokenizer = w;
|
|
14648
|
+
g.Hooks = P;
|
|
14649
|
+
g.parse = g;
|
|
14650
|
+
Ft = g.options;
|
|
14651
|
+
Ut = g.setOptions;
|
|
14652
|
+
Kt = g.use;
|
|
14653
|
+
Wt = g.walkTokens;
|
|
14654
|
+
Xt = g.parseInline;
|
|
14655
|
+
Vt = b.parse;
|
|
14656
|
+
Yt = x2.lex;
|
|
14657
|
+
}
|
|
14658
|
+
});
|
|
14659
|
+
|
|
14660
|
+
// src/utils/markdown.ts
|
|
14661
|
+
var markdown_exports = {};
|
|
14662
|
+
__export(markdown_exports, {
|
|
14663
|
+
markdownToAdf: () => markdownToAdf,
|
|
14664
|
+
markdownToStorageFormat: () => markdownToStorageFormat
|
|
14665
|
+
});
|
|
14666
|
+
function stripFrontmatter(md) {
|
|
14667
|
+
return md.replace(FRONTMATTER_RE, "");
|
|
14668
|
+
}
|
|
14669
|
+
function stripLeftoverStars(s2) {
|
|
14670
|
+
return s2.replace(/\*\*/g, "");
|
|
14671
|
+
}
|
|
14672
|
+
function inlineTokensToAdf(tokens, parentMarks) {
|
|
14673
|
+
if (!Array.isArray(tokens)) return [];
|
|
14674
|
+
const out = [];
|
|
14675
|
+
for (const raw of tokens) {
|
|
14676
|
+
const tok = raw;
|
|
14677
|
+
if (!tok || typeof tok !== "object") continue;
|
|
14678
|
+
switch (tok.type) {
|
|
14679
|
+
case "strong":
|
|
14680
|
+
out.push(...inlineTokensToAdf(tok.tokens, [...parentMarks, { type: "strong" }]));
|
|
14681
|
+
break;
|
|
14682
|
+
case "em":
|
|
14683
|
+
out.push(...inlineTokensToAdf(tok.tokens, [...parentMarks, { type: "em" }]));
|
|
14684
|
+
break;
|
|
14685
|
+
case "del":
|
|
14686
|
+
out.push(...inlineTokensToAdf(tok.tokens, [...parentMarks, { type: "strike" }]));
|
|
14687
|
+
break;
|
|
14688
|
+
case "codespan":
|
|
14689
|
+
out.push({ type: "text", text: String(tok.text ?? ""), marks: [...parentMarks, { type: "code" }] });
|
|
14690
|
+
break;
|
|
14691
|
+
case "text":
|
|
14692
|
+
case "escape":
|
|
14693
|
+
out.push({ type: "text", text: stripLeftoverStars(String(tok.text ?? "")), marks: parentMarks.length ? parentMarks : void 0 });
|
|
14694
|
+
break;
|
|
14695
|
+
case "link":
|
|
14696
|
+
out.push(...inlineTokensToAdf(tok.tokens, parentMarks));
|
|
14697
|
+
break;
|
|
14698
|
+
case "image":
|
|
14699
|
+
if (tok.text) out.push({ type: "text", text: stripLeftoverStars(String(tok.text)), marks: parentMarks.length ? parentMarks : void 0 });
|
|
14700
|
+
break;
|
|
14701
|
+
case "br":
|
|
14702
|
+
out.push({ type: "text", text: "\n", marks: parentMarks.length ? parentMarks : void 0 });
|
|
14703
|
+
break;
|
|
14704
|
+
case "html":
|
|
14705
|
+
out.push({ type: "text", text: stripLeftoverStars(String(tok.text ?? "").replace(/<[^>]+>/g, "")), marks: parentMarks.length ? parentMarks : void 0 });
|
|
14706
|
+
break;
|
|
14707
|
+
default:
|
|
14708
|
+
if (tok.text) out.push({ type: "text", text: stripLeftoverStars(String(tok.text)), marks: parentMarks.length ? parentMarks : void 0 });
|
|
14709
|
+
}
|
|
14710
|
+
}
|
|
14711
|
+
return out;
|
|
14712
|
+
}
|
|
14713
|
+
function splitHardBreaks(nodes) {
|
|
14714
|
+
const out = [];
|
|
14715
|
+
for (const node of nodes) {
|
|
14716
|
+
if (!node.text.includes("\n")) {
|
|
14717
|
+
out.push(node);
|
|
14718
|
+
continue;
|
|
14719
|
+
}
|
|
14720
|
+
const parts = node.text.split("\n");
|
|
14721
|
+
for (let i2 = 0; i2 < parts.length; i2++) {
|
|
14722
|
+
if (parts[i2]) out.push({ type: "text", text: parts[i2], marks: node.marks });
|
|
14723
|
+
if (i2 < parts.length - 1) out.push({ type: "hardBreak" });
|
|
14724
|
+
}
|
|
14725
|
+
}
|
|
14726
|
+
return out;
|
|
14727
|
+
}
|
|
14728
|
+
function paragraphFromTokens(text, tokens) {
|
|
14729
|
+
const inline = inlineTokensToAdf(tokens, []);
|
|
14730
|
+
const content = inline.length ? splitHardBreaks(inline) : text ? [{ type: "text", text }] : [];
|
|
14731
|
+
return { type: "paragraph", content };
|
|
14732
|
+
}
|
|
14733
|
+
function listItemToBlocks(item) {
|
|
14734
|
+
const subs = Array.isArray(item?.tokens) ? item.tokens : [];
|
|
14735
|
+
const blocks = [];
|
|
14736
|
+
for (const sub of subs) {
|
|
14737
|
+
const b2 = tokenToAdfBlock(sub);
|
|
14738
|
+
if (b2) blocks.push(b2);
|
|
14739
|
+
}
|
|
14740
|
+
if (!blocks.length) {
|
|
14741
|
+
blocks.push({ type: "paragraph", content: item?.text ? [{ type: "text", text: String(item.text) }] : [] });
|
|
14742
|
+
}
|
|
14743
|
+
return blocks;
|
|
14744
|
+
}
|
|
14745
|
+
function tableToAdf(t2) {
|
|
14746
|
+
const headerCells = (t2.header || []).map((c) => ({
|
|
14747
|
+
type: "tableHeader",
|
|
14748
|
+
attrs: {},
|
|
14749
|
+
content: [paragraphFromTokens(c?.text, c?.tokens)]
|
|
14750
|
+
}));
|
|
14751
|
+
const rows = (t2.rows || []).map((row) => ({
|
|
14752
|
+
type: "tableRow",
|
|
14753
|
+
content: row.map((c) => ({
|
|
14754
|
+
type: "tableCell",
|
|
14755
|
+
attrs: {},
|
|
14756
|
+
content: [paragraphFromTokens(c?.text, c?.tokens)]
|
|
14757
|
+
}))
|
|
14758
|
+
}));
|
|
14759
|
+
return {
|
|
14760
|
+
type: "table",
|
|
14761
|
+
attrs: {},
|
|
14762
|
+
content: [{ type: "tableRow", content: headerCells }, ...rows]
|
|
14763
|
+
};
|
|
14764
|
+
}
|
|
14765
|
+
function tokenToAdfBlock(tok) {
|
|
14766
|
+
if (!tok || typeof tok !== "object") return null;
|
|
14767
|
+
switch (tok.type) {
|
|
14768
|
+
case "heading":
|
|
14769
|
+
return {
|
|
14770
|
+
type: "heading",
|
|
14771
|
+
attrs: { level: Math.min(Math.max(Number(tok.depth) || 1, 1), 6) },
|
|
14772
|
+
content: inlineTokensToAdf(tok.tokens, [])
|
|
14773
|
+
};
|
|
14774
|
+
case "paragraph":
|
|
14775
|
+
return paragraphFromTokens(tok.text, tok.tokens);
|
|
14776
|
+
case "code":
|
|
14777
|
+
return {
|
|
14778
|
+
type: "codeBlock",
|
|
14779
|
+
content: [{ type: "text", text: String(tok.text ?? "") }],
|
|
14780
|
+
attrs: tok.lang ? { language: String(tok.lang) } : void 0
|
|
14781
|
+
};
|
|
14782
|
+
case "blockquote": {
|
|
14783
|
+
const inner = [];
|
|
14784
|
+
for (const sub of tok.tokens || []) {
|
|
14785
|
+
const b2 = tokenToAdfBlock(sub);
|
|
14786
|
+
if (b2) inner.push(b2);
|
|
14787
|
+
}
|
|
14788
|
+
return { type: "blockquote", content: inner };
|
|
14789
|
+
}
|
|
14790
|
+
case "list": {
|
|
14791
|
+
const items = (tok.items || []).map((item) => ({
|
|
14792
|
+
type: "listItem",
|
|
14793
|
+
content: listItemToBlocks(item)
|
|
14794
|
+
}));
|
|
14795
|
+
return { type: tok.ordered ? "orderedList" : "bulletList", content: items };
|
|
14796
|
+
}
|
|
14797
|
+
case "table":
|
|
14798
|
+
return tableToAdf(tok);
|
|
14799
|
+
case "hr":
|
|
14800
|
+
return { type: "rule" };
|
|
14801
|
+
default:
|
|
14802
|
+
return null;
|
|
14803
|
+
}
|
|
14804
|
+
}
|
|
14805
|
+
function markdownToAdf(md) {
|
|
14806
|
+
const tokens = g.lexer(stripFrontmatter(md ?? ""));
|
|
14807
|
+
const content = [];
|
|
14808
|
+
for (const tok of tokens) {
|
|
14809
|
+
const block = tokenToAdfBlock(tok);
|
|
14810
|
+
if (block) content.push(block);
|
|
14811
|
+
}
|
|
14812
|
+
if (!content.length) content.push({ type: "paragraph", content: [] });
|
|
14813
|
+
return { type: "doc", version: 1, content };
|
|
14814
|
+
}
|
|
14815
|
+
function escapeHtml(s2) {
|
|
14816
|
+
return s2.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
14817
|
+
}
|
|
14818
|
+
function stripLeftoverStarsFromHtml(html) {
|
|
14819
|
+
return html.split(/(<code>[\s\S]*?<\/code>)/g).map((part, i2) => i2 % 2 === 1 ? part : part.replace(/\*\*/g, "")).join("");
|
|
14820
|
+
}
|
|
14821
|
+
function inlineToHtml(text) {
|
|
14822
|
+
const html = g.parseInline(text ?? "");
|
|
14823
|
+
return stripLeftoverStarsFromHtml(typeof html === "string" ? html : "").replace(/<br\s*\/?>/gi, "<br/>");
|
|
14824
|
+
}
|
|
14825
|
+
function listItemToHtml(item) {
|
|
14826
|
+
const subs = Array.isArray(item?.tokens) ? item.tokens : [];
|
|
14827
|
+
const paras = subs.filter((t2) => t2?.type === "paragraph");
|
|
14828
|
+
if (paras.length) return paras.map((p) => inlineToHtml(p.text)).join("<br/>");
|
|
14829
|
+
return inlineToHtml(item?.text);
|
|
14830
|
+
}
|
|
14831
|
+
function tokenToStorageHtml(tok) {
|
|
14832
|
+
if (!tok || typeof tok !== "object") return "";
|
|
14833
|
+
switch (tok.type) {
|
|
14834
|
+
case "heading":
|
|
14835
|
+
return `<h${tok.depth}>${inlineToHtml(tok.text)}</h${tok.depth}>`;
|
|
14836
|
+
case "paragraph":
|
|
14837
|
+
return `<p>${inlineToHtml(tok.text)}</p>`;
|
|
14838
|
+
case "code": {
|
|
14839
|
+
const langParam = tok.lang ? `<ac:parameter ac:name="language">${escapeHtml(String(tok.lang))}</ac:parameter>` : "";
|
|
14840
|
+
return `<ac:structured-macro ac:name="code">${langParam}<ac:plain-text-body><![CDATA[${tok.text ?? ""}]]></ac:plain-text-body></ac:structured-macro>`;
|
|
14841
|
+
}
|
|
14842
|
+
case "list": {
|
|
14843
|
+
const tag = tok.ordered ? "ol" : "ul";
|
|
14844
|
+
const items = (tok.items || []).map((i2) => `<li>${listItemToHtml(i2)}</li>`).join("");
|
|
14845
|
+
return `<${tag}>${items}</${tag}>`;
|
|
14846
|
+
}
|
|
14847
|
+
case "blockquote":
|
|
14848
|
+
return `<blockquote>${(tok.tokens || []).map((t2) => tokenToStorageHtml(t2)).join("")}</blockquote>`;
|
|
14849
|
+
case "table": {
|
|
14850
|
+
const header = (tok.header || []).map((c) => `<th>${inlineToHtml(c.text)}</th>`).join("");
|
|
14851
|
+
const rows = (tok.rows || []).map(
|
|
14852
|
+
(row) => `<tr>${row.map((c) => `<td>${inlineToHtml(c.text)}</td>`).join("")}</tr>`
|
|
14853
|
+
).join("");
|
|
14854
|
+
return `<table><tbody><tr>${header}</tr>${rows}</tbody></table>`;
|
|
14855
|
+
}
|
|
14856
|
+
case "hr":
|
|
14857
|
+
return "<hr/>";
|
|
14858
|
+
default:
|
|
14859
|
+
return "";
|
|
14860
|
+
}
|
|
14861
|
+
}
|
|
14862
|
+
function markdownToStorageFormat(md) {
|
|
14863
|
+
const tokens = g.lexer(stripFrontmatter(md ?? ""));
|
|
14864
|
+
const parts = [];
|
|
14865
|
+
for (const tok of tokens) {
|
|
14866
|
+
const html = tokenToStorageHtml(tok);
|
|
14867
|
+
if (html) parts.push(html);
|
|
14868
|
+
}
|
|
14869
|
+
return parts.join("\n") || "<p></p>";
|
|
14870
|
+
}
|
|
14871
|
+
var FRONTMATTER_RE;
|
|
14872
|
+
var init_markdown = __esm({
|
|
14873
|
+
"src/utils/markdown.ts"() {
|
|
14874
|
+
"use strict";
|
|
14875
|
+
init_marked_esm();
|
|
14876
|
+
FRONTMATTER_RE = /^---\r?\n[\s\S]*?\r?\n---\r?\n?/;
|
|
14877
|
+
}
|
|
14878
|
+
});
|
|
14879
|
+
|
|
13415
14880
|
// src/utils/jira-fields.ts
|
|
13416
14881
|
function inferFieldFormat(type, custom3, hasAllowedValues = false) {
|
|
13417
14882
|
if (type === "doc") return "adf";
|
|
@@ -13456,6 +14921,7 @@ var init_jira_client = __esm({
|
|
|
13456
14921
|
"use strict";
|
|
13457
14922
|
init_src();
|
|
13458
14923
|
init_adf();
|
|
14924
|
+
init_markdown();
|
|
13459
14925
|
init_jira_fields();
|
|
13460
14926
|
JiraClient = class {
|
|
13461
14927
|
baseUrl;
|
|
@@ -13505,7 +14971,7 @@ var init_jira_client = __esm({
|
|
|
13505
14971
|
return this.request(`/issue/${key}`, { method: "PUT", body: { fields } });
|
|
13506
14972
|
}
|
|
13507
14973
|
async addComment(key, body) {
|
|
13508
|
-
return this.request(`/issue/${key}/comment`, { method: "POST", body: { body:
|
|
14974
|
+
return this.request(`/issue/${key}/comment`, { method: "POST", body: { body: markdownToAdf(body) } });
|
|
13509
14975
|
}
|
|
13510
14976
|
async createLink(linkType, inwardKey, outwardKey) {
|
|
13511
14977
|
return this.request("/issueLink", {
|
|
@@ -13835,16 +15301,16 @@ var require_errors2 = __commonJS({
|
|
|
13835
15301
|
// Comment can be max 65535 bytes long (NOTE: some non-US characters may take more space)
|
|
13836
15302
|
EXTRA_FIELD_PARSE_ERROR: "Extra field parsing error"
|
|
13837
15303
|
};
|
|
13838
|
-
function
|
|
15304
|
+
function E2(message) {
|
|
13839
15305
|
return function(...args) {
|
|
13840
15306
|
if (args.length) {
|
|
13841
|
-
message = message.replace(/\{(\d)\}/g, (
|
|
15307
|
+
message = message.replace(/\{(\d)\}/g, (_2, n) => args[n] || "");
|
|
13842
15308
|
}
|
|
13843
15309
|
return new Error("ADM-ZIP: " + message);
|
|
13844
15310
|
};
|
|
13845
15311
|
}
|
|
13846
15312
|
for (const msg of Object.keys(errors)) {
|
|
13847
|
-
exports[msg] =
|
|
15313
|
+
exports[msg] = E2(errors[msg]);
|
|
13848
15314
|
}
|
|
13849
15315
|
}
|
|
13850
15316
|
});
|
|
@@ -14073,8 +15539,8 @@ var require_utils2 = __commonJS({
|
|
|
14073
15539
|
Utils.sanitize = function(prefix, name) {
|
|
14074
15540
|
prefix = pth.resolve(pth.normalize(prefix));
|
|
14075
15541
|
var parts = name.split("/");
|
|
14076
|
-
for (var i2 = 0,
|
|
14077
|
-
var path2 = pth.normalize(pth.join(prefix, parts.slice(i2,
|
|
15542
|
+
for (var i2 = 0, l3 = parts.length; i2 < l3; i2++) {
|
|
15543
|
+
var path2 = pth.normalize(pth.join(prefix, parts.slice(i2, l3).join(pth.sep)));
|
|
14078
15544
|
if (path2 === prefix || path2.startsWith(prefix + pth.sep)) {
|
|
14079
15545
|
return path2;
|
|
14080
15546
|
}
|
|
@@ -14547,45 +16013,45 @@ var require_mainHeader = __commonJS({
|
|
|
14547
16013
|
},
|
|
14548
16014
|
toBinary: function() {
|
|
14549
16015
|
if (!needsZip64()) {
|
|
14550
|
-
var
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
return
|
|
14560
|
-
}
|
|
14561
|
-
var
|
|
16016
|
+
var b2 = Buffer.alloc(Constants.ENDHDR + _commentLength);
|
|
16017
|
+
b2.writeUInt32LE(Constants.ENDSIG, 0);
|
|
16018
|
+
b2.writeUInt32LE(0, 4);
|
|
16019
|
+
b2.writeUInt16LE(_volumeEntries, Constants.ENDSUB);
|
|
16020
|
+
b2.writeUInt16LE(_totalEntries, Constants.ENDTOT);
|
|
16021
|
+
b2.writeUInt32LE(_size2, Constants.ENDSIZ);
|
|
16022
|
+
b2.writeUInt32LE(_offset, Constants.ENDOFF);
|
|
16023
|
+
b2.writeUInt16LE(_commentLength, Constants.ENDCOM);
|
|
16024
|
+
b2.fill(" ", Constants.ENDHDR);
|
|
16025
|
+
return b2;
|
|
16026
|
+
}
|
|
16027
|
+
var b2 = Buffer.alloc(this.mainHeaderSize);
|
|
14562
16028
|
let offset = 0;
|
|
14563
|
-
|
|
14564
|
-
Utils.writeBigUInt64LE(
|
|
14565
|
-
|
|
14566
|
-
|
|
14567
|
-
|
|
14568
|
-
|
|
14569
|
-
Utils.writeBigUInt64LE(
|
|
14570
|
-
Utils.writeBigUInt64LE(
|
|
14571
|
-
Utils.writeBigUInt64LE(
|
|
14572
|
-
Utils.writeBigUInt64LE(
|
|
16029
|
+
b2.writeUInt32LE(Constants.ZIP64SIG, offset);
|
|
16030
|
+
Utils.writeBigUInt64LE(b2, Constants.ZIP64HDR - Constants.ZIP64LEAD, offset + Constants.ZIP64SIZE);
|
|
16031
|
+
b2.writeUInt16LE(45, offset + Constants.ZIP64VEM);
|
|
16032
|
+
b2.writeUInt16LE(45, offset + Constants.ZIP64VER);
|
|
16033
|
+
b2.writeUInt32LE(0, offset + Constants.ZIP64DSK);
|
|
16034
|
+
b2.writeUInt32LE(0, offset + Constants.ZIP64DSKDIR);
|
|
16035
|
+
Utils.writeBigUInt64LE(b2, _volumeEntries, offset + Constants.ZIP64SUB);
|
|
16036
|
+
Utils.writeBigUInt64LE(b2, _totalEntries, offset + Constants.ZIP64TOT);
|
|
16037
|
+
Utils.writeBigUInt64LE(b2, _size2, offset + Constants.ZIP64SIZB);
|
|
16038
|
+
Utils.writeBigUInt64LE(b2, _offset, offset + Constants.ZIP64OFF);
|
|
14573
16039
|
const zip64EndOffset = _offset + _size2;
|
|
14574
16040
|
offset += Constants.ZIP64HDR;
|
|
14575
|
-
|
|
14576
|
-
|
|
14577
|
-
Utils.writeBigUInt64LE(
|
|
14578
|
-
|
|
16041
|
+
b2.writeUInt32LE(Constants.END64SIG, offset);
|
|
16042
|
+
b2.writeUInt32LE(0, offset + Constants.END64START);
|
|
16043
|
+
Utils.writeBigUInt64LE(b2, zip64EndOffset, offset + Constants.END64OFF);
|
|
16044
|
+
b2.writeUInt32LE(1, offset + Constants.END64NUMDISKS);
|
|
14579
16045
|
offset += Constants.END64HDR;
|
|
14580
|
-
|
|
14581
|
-
|
|
14582
|
-
|
|
14583
|
-
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
return
|
|
16046
|
+
b2.writeUInt32LE(Constants.ENDSIG, offset);
|
|
16047
|
+
b2.writeUInt32LE(0, offset + 4);
|
|
16048
|
+
b2.writeUInt16LE(Math.min(_volumeEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDSUB);
|
|
16049
|
+
b2.writeUInt16LE(Math.min(_totalEntries, Constants.EF_ZIP64_OR_16), offset + Constants.ENDTOT);
|
|
16050
|
+
b2.writeUInt32LE(Math.min(_size2, Constants.EF_ZIP64_OR_32), offset + Constants.ENDSIZ);
|
|
16051
|
+
b2.writeUInt32LE(Math.min(_offset, Constants.EF_ZIP64_OR_32), offset + Constants.ENDOFF);
|
|
16052
|
+
b2.writeUInt16LE(_commentLength, offset + Constants.ENDCOM);
|
|
16053
|
+
b2.fill(" ", offset + Constants.ENDHDR);
|
|
16054
|
+
return b2;
|
|
14589
16055
|
},
|
|
14590
16056
|
toJSON: function() {
|
|
14591
16057
|
const offset = function(nr, len) {
|
|
@@ -14694,7 +16160,7 @@ var require_zipcrypto = __commonJS({
|
|
|
14694
16160
|
var { randomFillSync } = __require("crypto");
|
|
14695
16161
|
var Errors = require_errors2();
|
|
14696
16162
|
var crctable = new Uint32Array(256).map((t2, crc) => {
|
|
14697
|
-
for (let
|
|
16163
|
+
for (let j2 = 0; j2 < 8; j2++) {
|
|
14698
16164
|
if (0 !== (crc & 1)) {
|
|
14699
16165
|
crc = crc >>> 1 ^ 3988292384;
|
|
14700
16166
|
} else {
|
|
@@ -14703,7 +16169,7 @@ var require_zipcrypto = __commonJS({
|
|
|
14703
16169
|
}
|
|
14704
16170
|
return crc >>> 0;
|
|
14705
16171
|
});
|
|
14706
|
-
var uMul = (a,
|
|
16172
|
+
var uMul = (a, b2) => Math.imul(a, b2) >>> 0;
|
|
14707
16173
|
var crc32update = (pCrc32, bval) => {
|
|
14708
16174
|
return crctable[(pCrc32 ^ bval) & 255] ^ pCrc32 >>> 8;
|
|
14709
16175
|
};
|
|
@@ -15241,7 +16707,7 @@ var require_zipFile = __commonJS({
|
|
|
15241
16707
|
}
|
|
15242
16708
|
function sortEntries() {
|
|
15243
16709
|
if (entryList.length > 1 && !noSort) {
|
|
15244
|
-
entryList.sort((a,
|
|
16710
|
+
entryList.sort((a, b2) => a.entryName.toLowerCase().localeCompare(b2.entryName.toLowerCase()));
|
|
15245
16711
|
}
|
|
15246
16712
|
}
|
|
15247
16713
|
return {
|
|
@@ -16399,7 +17865,7 @@ __export(external_exports, {
|
|
|
16399
17865
|
// node_modules/zod/v3/helpers/util.js
|
|
16400
17866
|
var util;
|
|
16401
17867
|
(function(util2) {
|
|
16402
|
-
util2.assertEqual = (
|
|
17868
|
+
util2.assertEqual = (_2) => {
|
|
16403
17869
|
};
|
|
16404
17870
|
function assertIs2(_arg) {
|
|
16405
17871
|
}
|
|
@@ -16449,7 +17915,7 @@ var util;
|
|
|
16449
17915
|
return array2.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
16450
17916
|
}
|
|
16451
17917
|
util2.joinValues = joinValues2;
|
|
16452
|
-
util2.jsonStringifyReplacer = (
|
|
17918
|
+
util2.jsonStringifyReplacer = (_2, value) => {
|
|
16453
17919
|
if (typeof value === "bigint") {
|
|
16454
17920
|
return value.toString();
|
|
16455
17921
|
}
|
|
@@ -16776,7 +18242,7 @@ var makeIssue = (params) => {
|
|
|
16776
18242
|
};
|
|
16777
18243
|
}
|
|
16778
18244
|
let errorMessage = "";
|
|
16779
|
-
const maps = errorMaps.filter((
|
|
18245
|
+
const maps = errorMaps.filter((m3) => !!m3).slice().reverse();
|
|
16780
18246
|
for (const map of maps) {
|
|
16781
18247
|
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
16782
18248
|
}
|
|
@@ -16802,7 +18268,7 @@ function addIssueToContext(ctx2, issueData) {
|
|
|
16802
18268
|
// then global override map
|
|
16803
18269
|
overrideMap === en_default ? void 0 : en_default
|
|
16804
18270
|
// then global default map
|
|
16805
|
-
].filter((
|
|
18271
|
+
].filter((x3) => !!x3)
|
|
16806
18272
|
});
|
|
16807
18273
|
ctx2.common.issues.push(issue2);
|
|
16808
18274
|
}
|
|
@@ -16865,10 +18331,10 @@ var INVALID = Object.freeze({
|
|
|
16865
18331
|
});
|
|
16866
18332
|
var DIRTY = (value) => ({ status: "dirty", value });
|
|
16867
18333
|
var OK = (value) => ({ status: "valid", value });
|
|
16868
|
-
var isAborted = (
|
|
16869
|
-
var isDirty = (
|
|
16870
|
-
var isValid = (
|
|
16871
|
-
var isAsync = (
|
|
18334
|
+
var isAborted = (x3) => x3.status === "aborted";
|
|
18335
|
+
var isDirty = (x3) => x3.status === "dirty";
|
|
18336
|
+
var isValid = (x3) => x3.status === "valid";
|
|
18337
|
+
var isAsync = (x3) => typeof Promise !== "undefined" && x3 instanceof Promise;
|
|
16872
18338
|
|
|
16873
18339
|
// node_modules/zod/v3/helpers/errorUtil.js
|
|
16874
18340
|
var errorUtil;
|
|
@@ -19188,17 +20654,17 @@ var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
|
19188
20654
|
});
|
|
19189
20655
|
}
|
|
19190
20656
|
};
|
|
19191
|
-
function mergeValues(a,
|
|
20657
|
+
function mergeValues(a, b2) {
|
|
19192
20658
|
const aType = getParsedType(a);
|
|
19193
|
-
const bType = getParsedType(
|
|
19194
|
-
if (a ===
|
|
20659
|
+
const bType = getParsedType(b2);
|
|
20660
|
+
if (a === b2) {
|
|
19195
20661
|
return { valid: true, data: a };
|
|
19196
20662
|
} else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
|
|
19197
|
-
const bKeys = util.objectKeys(
|
|
20663
|
+
const bKeys = util.objectKeys(b2);
|
|
19198
20664
|
const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
19199
|
-
const newObj = { ...a, ...
|
|
20665
|
+
const newObj = { ...a, ...b2 };
|
|
19200
20666
|
for (const key of sharedKeys) {
|
|
19201
|
-
const sharedValue = mergeValues(a[key],
|
|
20667
|
+
const sharedValue = mergeValues(a[key], b2[key]);
|
|
19202
20668
|
if (!sharedValue.valid) {
|
|
19203
20669
|
return { valid: false };
|
|
19204
20670
|
}
|
|
@@ -19206,13 +20672,13 @@ function mergeValues(a, b) {
|
|
|
19206
20672
|
}
|
|
19207
20673
|
return { valid: true, data: newObj };
|
|
19208
20674
|
} else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
|
|
19209
|
-
if (a.length !==
|
|
20675
|
+
if (a.length !== b2.length) {
|
|
19210
20676
|
return { valid: false };
|
|
19211
20677
|
}
|
|
19212
20678
|
const newArray = [];
|
|
19213
20679
|
for (let index = 0; index < a.length; index++) {
|
|
19214
20680
|
const itemA = a[index];
|
|
19215
|
-
const itemB =
|
|
20681
|
+
const itemB = b2[index];
|
|
19216
20682
|
const sharedValue = mergeValues(itemA, itemB);
|
|
19217
20683
|
if (!sharedValue.valid) {
|
|
19218
20684
|
return { valid: false };
|
|
@@ -19220,7 +20686,7 @@ function mergeValues(a, b) {
|
|
|
19220
20686
|
newArray.push(sharedValue.data);
|
|
19221
20687
|
}
|
|
19222
20688
|
return { valid: true, data: newArray };
|
|
19223
|
-
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +
|
|
20689
|
+
} else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b2) {
|
|
19224
20690
|
return { valid: true, data: a };
|
|
19225
20691
|
} else {
|
|
19226
20692
|
return { valid: false };
|
|
@@ -19316,7 +20782,7 @@ var ZodTuple = class _ZodTuple extends ZodType {
|
|
|
19316
20782
|
if (!schema)
|
|
19317
20783
|
return null;
|
|
19318
20784
|
return schema._parse(new ParseInputLazyPath(ctx2, item, ctx2.path, itemIndex));
|
|
19319
|
-
}).filter((
|
|
20785
|
+
}).filter((x3) => !!x3);
|
|
19320
20786
|
if (ctx2.common.async) {
|
|
19321
20787
|
return Promise.all(items).then((results) => {
|
|
19322
20788
|
return ParseStatus.mergeArray(status, results);
|
|
@@ -19569,7 +21035,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
19569
21035
|
return makeIssue({
|
|
19570
21036
|
data: args,
|
|
19571
21037
|
path: ctx2.path,
|
|
19572
|
-
errorMaps: [ctx2.common.contextualErrorMap, ctx2.schemaErrorMap, getErrorMap(), en_default].filter((
|
|
21038
|
+
errorMaps: [ctx2.common.contextualErrorMap, ctx2.schemaErrorMap, getErrorMap(), en_default].filter((x3) => !!x3),
|
|
19573
21039
|
issueData: {
|
|
19574
21040
|
code: ZodIssueCode.invalid_arguments,
|
|
19575
21041
|
argumentsError: error2
|
|
@@ -19580,7 +21046,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
19580
21046
|
return makeIssue({
|
|
19581
21047
|
data: returns,
|
|
19582
21048
|
path: ctx2.path,
|
|
19583
|
-
errorMaps: [ctx2.common.contextualErrorMap, ctx2.schemaErrorMap, getErrorMap(), en_default].filter((
|
|
21049
|
+
errorMaps: [ctx2.common.contextualErrorMap, ctx2.schemaErrorMap, getErrorMap(), en_default].filter((x3) => !!x3),
|
|
19584
21050
|
issueData: {
|
|
19585
21051
|
code: ZodIssueCode.invalid_return_type,
|
|
19586
21052
|
returnTypeError: error2
|
|
@@ -19590,29 +21056,29 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
19590
21056
|
const params = { errorMap: ctx2.common.contextualErrorMap };
|
|
19591
21057
|
const fn = ctx2.data;
|
|
19592
21058
|
if (this._def.returns instanceof ZodPromise) {
|
|
19593
|
-
const
|
|
21059
|
+
const me2 = this;
|
|
19594
21060
|
return OK(async function(...args) {
|
|
19595
21061
|
const error2 = new ZodError([]);
|
|
19596
|
-
const parsedArgs = await
|
|
21062
|
+
const parsedArgs = await me2._def.args.parseAsync(args, params).catch((e2) => {
|
|
19597
21063
|
error2.addIssue(makeArgsIssue(args, e2));
|
|
19598
21064
|
throw error2;
|
|
19599
21065
|
});
|
|
19600
21066
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
19601
|
-
const parsedReturns = await
|
|
21067
|
+
const parsedReturns = await me2._def.returns._def.type.parseAsync(result, params).catch((e2) => {
|
|
19602
21068
|
error2.addIssue(makeReturnsIssue(result, e2));
|
|
19603
21069
|
throw error2;
|
|
19604
21070
|
});
|
|
19605
21071
|
return parsedReturns;
|
|
19606
21072
|
});
|
|
19607
21073
|
} else {
|
|
19608
|
-
const
|
|
21074
|
+
const me2 = this;
|
|
19609
21075
|
return OK(function(...args) {
|
|
19610
|
-
const parsedArgs =
|
|
21076
|
+
const parsedArgs = me2._def.args.safeParse(args, params);
|
|
19611
21077
|
if (!parsedArgs.success) {
|
|
19612
21078
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
19613
21079
|
}
|
|
19614
21080
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
19615
|
-
const parsedReturns =
|
|
21081
|
+
const parsedReturns = me2._def.returns.safeParse(result, params);
|
|
19616
21082
|
if (!parsedReturns.success) {
|
|
19617
21083
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
19618
21084
|
}
|
|
@@ -20174,10 +21640,10 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
20174
21640
|
}
|
|
20175
21641
|
}
|
|
20176
21642
|
}
|
|
20177
|
-
static create(a,
|
|
21643
|
+
static create(a, b2) {
|
|
20178
21644
|
return new _ZodPipeline({
|
|
20179
21645
|
in: a,
|
|
20180
|
-
out:
|
|
21646
|
+
out: b2,
|
|
20181
21647
|
typeName: ZodFirstPartyTypeKind.ZodPipeline
|
|
20182
21648
|
});
|
|
20183
21649
|
}
|
|
@@ -20340,18 +21806,18 @@ function $constructor(name, initializer3, params) {
|
|
|
20340
21806
|
(_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
|
|
20341
21807
|
inst._zod.traits.add(name);
|
|
20342
21808
|
initializer3(inst, def);
|
|
20343
|
-
for (const k in
|
|
21809
|
+
for (const k in _2.prototype) {
|
|
20344
21810
|
if (!(k in inst))
|
|
20345
|
-
Object.defineProperty(inst, k, { value:
|
|
21811
|
+
Object.defineProperty(inst, k, { value: _2.prototype[k].bind(inst) });
|
|
20346
21812
|
}
|
|
20347
|
-
inst._zod.constr =
|
|
21813
|
+
inst._zod.constr = _2;
|
|
20348
21814
|
inst._zod.def = def;
|
|
20349
21815
|
}
|
|
20350
21816
|
const Parent = params?.Parent ?? Object;
|
|
20351
21817
|
class Definition extends Parent {
|
|
20352
21818
|
}
|
|
20353
21819
|
Object.defineProperty(Definition, "name", { value: name });
|
|
20354
|
-
function
|
|
21820
|
+
function _2(def) {
|
|
20355
21821
|
var _a;
|
|
20356
21822
|
const inst = params?.Parent ? new Definition() : this;
|
|
20357
21823
|
init(inst, def);
|
|
@@ -20361,16 +21827,16 @@ function $constructor(name, initializer3, params) {
|
|
|
20361
21827
|
}
|
|
20362
21828
|
return inst;
|
|
20363
21829
|
}
|
|
20364
|
-
Object.defineProperty(
|
|
20365
|
-
Object.defineProperty(
|
|
21830
|
+
Object.defineProperty(_2, "init", { value: init });
|
|
21831
|
+
Object.defineProperty(_2, Symbol.hasInstance, {
|
|
20366
21832
|
value: (inst) => {
|
|
20367
21833
|
if (params?.Parent && inst instanceof params.Parent)
|
|
20368
21834
|
return true;
|
|
20369
21835
|
return inst?._zod?.traits?.has(name);
|
|
20370
21836
|
}
|
|
20371
21837
|
});
|
|
20372
|
-
Object.defineProperty(
|
|
20373
|
-
return
|
|
21838
|
+
Object.defineProperty(_2, "name", { value: name });
|
|
21839
|
+
return _2;
|
|
20374
21840
|
}
|
|
20375
21841
|
var $ZodAsyncError = class extends Error {
|
|
20376
21842
|
constructor() {
|
|
@@ -20448,17 +21914,17 @@ function assertIs(_arg) {
|
|
|
20448
21914
|
function assertNever(_x) {
|
|
20449
21915
|
throw new Error();
|
|
20450
21916
|
}
|
|
20451
|
-
function assert(
|
|
21917
|
+
function assert(_2) {
|
|
20452
21918
|
}
|
|
20453
21919
|
function getEnumValues(entries) {
|
|
20454
|
-
const numericValues = Object.values(entries).filter((
|
|
20455
|
-
const values = Object.entries(entries).filter(([k,
|
|
21920
|
+
const numericValues = Object.values(entries).filter((v2) => typeof v2 === "number");
|
|
21921
|
+
const values = Object.entries(entries).filter(([k, _2]) => numericValues.indexOf(+k) === -1).map(([_2, v2]) => v2);
|
|
20456
21922
|
return values;
|
|
20457
21923
|
}
|
|
20458
21924
|
function joinValues(array2, separator = "|") {
|
|
20459
21925
|
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
20460
21926
|
}
|
|
20461
|
-
function jsonStringifyReplacer(
|
|
21927
|
+
function jsonStringifyReplacer(_2, value) {
|
|
20462
21928
|
if (typeof value === "bigint")
|
|
20463
21929
|
return value.toString();
|
|
20464
21930
|
return value;
|
|
@@ -20503,9 +21969,9 @@ function defineLazy(object3, key, getter) {
|
|
|
20503
21969
|
}
|
|
20504
21970
|
throw new Error("cached value already set");
|
|
20505
21971
|
},
|
|
20506
|
-
set(
|
|
21972
|
+
set(v2) {
|
|
20507
21973
|
Object.defineProperty(object3, key, {
|
|
20508
|
-
value:
|
|
21974
|
+
value: v2
|
|
20509
21975
|
// configurable: true,
|
|
20510
21976
|
});
|
|
20511
21977
|
},
|
|
@@ -20557,10 +22023,10 @@ var allowsEval = cached(() => {
|
|
|
20557
22023
|
return false;
|
|
20558
22024
|
}
|
|
20559
22025
|
try {
|
|
20560
|
-
const
|
|
20561
|
-
new
|
|
22026
|
+
const F3 = Function;
|
|
22027
|
+
new F3("");
|
|
20562
22028
|
return true;
|
|
20563
|
-
} catch (
|
|
22029
|
+
} catch (_2) {
|
|
20564
22030
|
return false;
|
|
20565
22031
|
}
|
|
20566
22032
|
});
|
|
@@ -20661,31 +22127,31 @@ function normalizeParams(_params) {
|
|
|
20661
22127
|
function createTransparentProxy(getter) {
|
|
20662
22128
|
let target;
|
|
20663
22129
|
return new Proxy({}, {
|
|
20664
|
-
get(
|
|
22130
|
+
get(_2, prop, receiver) {
|
|
20665
22131
|
target ?? (target = getter());
|
|
20666
22132
|
return Reflect.get(target, prop, receiver);
|
|
20667
22133
|
},
|
|
20668
|
-
set(
|
|
22134
|
+
set(_2, prop, value, receiver) {
|
|
20669
22135
|
target ?? (target = getter());
|
|
20670
22136
|
return Reflect.set(target, prop, value, receiver);
|
|
20671
22137
|
},
|
|
20672
|
-
has(
|
|
22138
|
+
has(_2, prop) {
|
|
20673
22139
|
target ?? (target = getter());
|
|
20674
22140
|
return Reflect.has(target, prop);
|
|
20675
22141
|
},
|
|
20676
|
-
deleteProperty(
|
|
22142
|
+
deleteProperty(_2, prop) {
|
|
20677
22143
|
target ?? (target = getter());
|
|
20678
22144
|
return Reflect.deleteProperty(target, prop);
|
|
20679
22145
|
},
|
|
20680
|
-
ownKeys(
|
|
22146
|
+
ownKeys(_2) {
|
|
20681
22147
|
target ?? (target = getter());
|
|
20682
22148
|
return Reflect.ownKeys(target);
|
|
20683
22149
|
},
|
|
20684
|
-
getOwnPropertyDescriptor(
|
|
22150
|
+
getOwnPropertyDescriptor(_2, prop) {
|
|
20685
22151
|
target ?? (target = getter());
|
|
20686
22152
|
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
20687
22153
|
},
|
|
20688
|
-
defineProperty(
|
|
22154
|
+
defineProperty(_2, prop, descriptor) {
|
|
20689
22155
|
target ?? (target = getter());
|
|
20690
22156
|
return Reflect.defineProperty(target, prop, descriptor);
|
|
20691
22157
|
}
|
|
@@ -20764,15 +22230,15 @@ function extend(schema, shape) {
|
|
|
20764
22230
|
};
|
|
20765
22231
|
return clone(schema, def);
|
|
20766
22232
|
}
|
|
20767
|
-
function merge(a,
|
|
22233
|
+
function merge(a, b2) {
|
|
20768
22234
|
return clone(a, {
|
|
20769
22235
|
...a._zod.def,
|
|
20770
22236
|
get shape() {
|
|
20771
|
-
const _shape = { ...a._zod.def.shape, ...
|
|
22237
|
+
const _shape = { ...a._zod.def.shape, ...b2._zod.def.shape };
|
|
20772
22238
|
assignProp(this, "shape", _shape);
|
|
20773
22239
|
return _shape;
|
|
20774
22240
|
},
|
|
20775
|
-
catchall:
|
|
22241
|
+
catchall: b2._zod.def.catchall,
|
|
20776
22242
|
checks: []
|
|
20777
22243
|
// delete existing checks
|
|
20778
22244
|
});
|
|
@@ -20836,9 +22302,9 @@ function required(Class2, schema, mask) {
|
|
|
20836
22302
|
checks: []
|
|
20837
22303
|
});
|
|
20838
22304
|
}
|
|
20839
|
-
function aborted(
|
|
20840
|
-
for (let i2 = startIndex; i2 <
|
|
20841
|
-
if (
|
|
22305
|
+
function aborted(x3, startIndex = 0) {
|
|
22306
|
+
for (let i2 = startIndex; i2 < x3.issues.length; i2++) {
|
|
22307
|
+
if (x3.issues[i2]?.continue !== true)
|
|
20842
22308
|
return true;
|
|
20843
22309
|
}
|
|
20844
22310
|
return false;
|
|
@@ -20896,7 +22362,7 @@ function issue(...args) {
|
|
|
20896
22362
|
return { ...iss };
|
|
20897
22363
|
}
|
|
20898
22364
|
function cleanEnum(obj) {
|
|
20899
|
-
return Object.entries(obj).filter(([k,
|
|
22365
|
+
return Object.entries(obj).filter(([k, _2]) => {
|
|
20900
22366
|
return Number.isNaN(Number.parseInt(k, 10));
|
|
20901
22367
|
}).map((el) => el[1]);
|
|
20902
22368
|
}
|
|
@@ -21495,19 +22961,19 @@ var Doc = class {
|
|
|
21495
22961
|
return;
|
|
21496
22962
|
}
|
|
21497
22963
|
const content = arg;
|
|
21498
|
-
const lines = content.split("\n").filter((
|
|
21499
|
-
const minIndent = Math.min(...lines.map((
|
|
21500
|
-
const dedented = lines.map((
|
|
22964
|
+
const lines = content.split("\n").filter((x3) => x3);
|
|
22965
|
+
const minIndent = Math.min(...lines.map((x3) => x3.length - x3.trimStart().length));
|
|
22966
|
+
const dedented = lines.map((x3) => x3.slice(minIndent)).map((x3) => " ".repeat(this.indent * 2) + x3);
|
|
21501
22967
|
for (const line of dedented) {
|
|
21502
22968
|
this.content.push(line);
|
|
21503
22969
|
}
|
|
21504
22970
|
}
|
|
21505
22971
|
compile() {
|
|
21506
|
-
const
|
|
22972
|
+
const F3 = Function;
|
|
21507
22973
|
const args = this?.args;
|
|
21508
22974
|
const content = this?.content ?? [``];
|
|
21509
|
-
const lines = [...content.map((
|
|
21510
|
-
return new
|
|
22975
|
+
const lines = [...content.map((x3) => ` ${x3}`)];
|
|
22976
|
+
return new F3(...args, lines.join("\n"));
|
|
21511
22977
|
}
|
|
21512
22978
|
};
|
|
21513
22979
|
|
|
@@ -21552,13 +23018,13 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
21552
23018
|
continue;
|
|
21553
23019
|
}
|
|
21554
23020
|
const currLen = payload.issues.length;
|
|
21555
|
-
const
|
|
21556
|
-
if (
|
|
23021
|
+
const _2 = ch._zod.check(payload);
|
|
23022
|
+
if (_2 instanceof Promise && ctx2?.async === false) {
|
|
21557
23023
|
throw new $ZodAsyncError();
|
|
21558
23024
|
}
|
|
21559
|
-
if (asyncResult ||
|
|
23025
|
+
if (asyncResult || _2 instanceof Promise) {
|
|
21560
23026
|
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
21561
|
-
await
|
|
23027
|
+
await _2;
|
|
21562
23028
|
const nextLen = payload.issues.length;
|
|
21563
23029
|
if (nextLen === currLen)
|
|
21564
23030
|
return;
|
|
@@ -21595,7 +23061,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
21595
23061
|
try {
|
|
21596
23062
|
const r2 = safeParse(inst, value);
|
|
21597
23063
|
return r2.success ? { value: r2.data } : { issues: r2.error?.issues };
|
|
21598
|
-
} catch (
|
|
23064
|
+
} catch (_2) {
|
|
21599
23065
|
return safeParseAsync(inst, value).then((r2) => r2.success ? { value: r2.data } : { issues: r2.error?.issues });
|
|
21600
23066
|
}
|
|
21601
23067
|
},
|
|
@@ -21606,11 +23072,11 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
21606
23072
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
21607
23073
|
$ZodType.init(inst, def);
|
|
21608
23074
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
21609
|
-
inst._zod.parse = (payload,
|
|
23075
|
+
inst._zod.parse = (payload, _2) => {
|
|
21610
23076
|
if (def.coerce)
|
|
21611
23077
|
try {
|
|
21612
23078
|
payload.value = String(payload.value);
|
|
21613
|
-
} catch (
|
|
23079
|
+
} catch (_3) {
|
|
21614
23080
|
}
|
|
21615
23081
|
if (typeof payload.value === "string")
|
|
21616
23082
|
return payload;
|
|
@@ -21643,10 +23109,10 @@ var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
|
21643
23109
|
v7: 7,
|
|
21644
23110
|
v8: 8
|
|
21645
23111
|
};
|
|
21646
|
-
const
|
|
21647
|
-
if (
|
|
23112
|
+
const v2 = versionMap[def.version];
|
|
23113
|
+
if (v2 === void 0)
|
|
21648
23114
|
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
21649
|
-
def.pattern ?? (def.pattern = uuid(
|
|
23115
|
+
def.pattern ?? (def.pattern = uuid(v2));
|
|
21650
23116
|
} else
|
|
21651
23117
|
def.pattern ?? (def.pattern = uuid());
|
|
21652
23118
|
$ZodStringFormat.init(inst, def);
|
|
@@ -21696,7 +23162,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
21696
23162
|
payload.value = href;
|
|
21697
23163
|
}
|
|
21698
23164
|
return;
|
|
21699
|
-
} catch (
|
|
23165
|
+
} catch (_2) {
|
|
21700
23166
|
payload.issues.push({
|
|
21701
23167
|
code: "invalid_format",
|
|
21702
23168
|
format: "url",
|
|
@@ -21909,7 +23375,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
21909
23375
|
if (def.coerce)
|
|
21910
23376
|
try {
|
|
21911
23377
|
payload.value = Number(payload.value);
|
|
21912
|
-
} catch (
|
|
23378
|
+
} catch (_2) {
|
|
21913
23379
|
}
|
|
21914
23380
|
const input = payload.value;
|
|
21915
23381
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
@@ -21937,7 +23403,7 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
21937
23403
|
if (def.coerce)
|
|
21938
23404
|
try {
|
|
21939
23405
|
payload.value = Boolean(payload.value);
|
|
21940
|
-
} catch (
|
|
23406
|
+
} catch (_2) {
|
|
21941
23407
|
}
|
|
21942
23408
|
const input = payload.value;
|
|
21943
23409
|
if (typeof input === "boolean")
|
|
@@ -22072,8 +23538,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
22072
23538
|
const field = shape[key]._zod;
|
|
22073
23539
|
if (field.values) {
|
|
22074
23540
|
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
22075
|
-
for (const
|
|
22076
|
-
propValues[key].add(
|
|
23541
|
+
for (const v2 of field.values)
|
|
23542
|
+
propValues[key].add(v2);
|
|
22077
23543
|
}
|
|
22078
23544
|
}
|
|
22079
23545
|
return propValues;
|
|
@@ -22274,10 +23740,10 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
22274
23740
|
const pv = option._zod.propValues;
|
|
22275
23741
|
if (!pv || Object.keys(pv).length === 0)
|
|
22276
23742
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
22277
|
-
for (const [k,
|
|
23743
|
+
for (const [k, v2] of Object.entries(pv)) {
|
|
22278
23744
|
if (!propValues[k])
|
|
22279
23745
|
propValues[k] = /* @__PURE__ */ new Set();
|
|
22280
|
-
for (const val of
|
|
23746
|
+
for (const val of v2) {
|
|
22281
23747
|
propValues[k].add(val);
|
|
22282
23748
|
}
|
|
22283
23749
|
}
|
|
@@ -22291,11 +23757,11 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
22291
23757
|
const values = o._zod.propValues[def.discriminator];
|
|
22292
23758
|
if (!values || values.size === 0)
|
|
22293
23759
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
22294
|
-
for (const
|
|
22295
|
-
if (map.has(
|
|
22296
|
-
throw new Error(`Duplicate discriminator value "${String(
|
|
23760
|
+
for (const v2 of values) {
|
|
23761
|
+
if (map.has(v2)) {
|
|
23762
|
+
throw new Error(`Duplicate discriminator value "${String(v2)}"`);
|
|
22297
23763
|
}
|
|
22298
|
-
map.set(
|
|
23764
|
+
map.set(v2, o);
|
|
22299
23765
|
}
|
|
22300
23766
|
}
|
|
22301
23767
|
return map;
|
|
@@ -22344,19 +23810,19 @@ var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, d
|
|
|
22344
23810
|
return handleIntersectionResults(payload, left, right);
|
|
22345
23811
|
};
|
|
22346
23812
|
});
|
|
22347
|
-
function mergeValues2(a,
|
|
22348
|
-
if (a ===
|
|
23813
|
+
function mergeValues2(a, b2) {
|
|
23814
|
+
if (a === b2) {
|
|
22349
23815
|
return { valid: true, data: a };
|
|
22350
23816
|
}
|
|
22351
|
-
if (a instanceof Date &&
|
|
23817
|
+
if (a instanceof Date && b2 instanceof Date && +a === +b2) {
|
|
22352
23818
|
return { valid: true, data: a };
|
|
22353
23819
|
}
|
|
22354
|
-
if (isPlainObject(a) && isPlainObject(
|
|
22355
|
-
const bKeys = Object.keys(
|
|
23820
|
+
if (isPlainObject(a) && isPlainObject(b2)) {
|
|
23821
|
+
const bKeys = Object.keys(b2);
|
|
22356
23822
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
22357
|
-
const newObj = { ...a, ...
|
|
23823
|
+
const newObj = { ...a, ...b2 };
|
|
22358
23824
|
for (const key of sharedKeys) {
|
|
22359
|
-
const sharedValue = mergeValues2(a[key],
|
|
23825
|
+
const sharedValue = mergeValues2(a[key], b2[key]);
|
|
22360
23826
|
if (!sharedValue.valid) {
|
|
22361
23827
|
return {
|
|
22362
23828
|
valid: false,
|
|
@@ -22367,14 +23833,14 @@ function mergeValues2(a, b) {
|
|
|
22367
23833
|
}
|
|
22368
23834
|
return { valid: true, data: newObj };
|
|
22369
23835
|
}
|
|
22370
|
-
if (Array.isArray(a) && Array.isArray(
|
|
22371
|
-
if (a.length !==
|
|
23836
|
+
if (Array.isArray(a) && Array.isArray(b2)) {
|
|
23837
|
+
if (a.length !== b2.length) {
|
|
22372
23838
|
return { valid: false, mergeErrorPath: [] };
|
|
22373
23839
|
}
|
|
22374
23840
|
const newArray = [];
|
|
22375
23841
|
for (let index = 0; index < a.length; index++) {
|
|
22376
23842
|
const itemA = a[index];
|
|
22377
|
-
const itemB =
|
|
23843
|
+
const itemB = b2[index];
|
|
22378
23844
|
const sharedValue = mergeValues2(itemA, itemB);
|
|
22379
23845
|
if (!sharedValue.valid) {
|
|
22380
23846
|
return {
|
|
@@ -22626,8 +24092,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
22626
24092
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
22627
24093
|
$ZodType.init(inst, def);
|
|
22628
24094
|
defineLazy(inst._zod, "values", () => {
|
|
22629
|
-
const
|
|
22630
|
-
return
|
|
24095
|
+
const v2 = def.innerType._zod.values;
|
|
24096
|
+
return v2 ? new Set([...v2].filter((x3) => x3 !== void 0)) : void 0;
|
|
22631
24097
|
});
|
|
22632
24098
|
inst._zod.parse = (payload, ctx2) => {
|
|
22633
24099
|
const result = def.innerType._zod.run(payload, ctx2);
|
|
@@ -22725,7 +24191,7 @@ function handleReadonlyResult(payload) {
|
|
|
22725
24191
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
22726
24192
|
$ZodCheck.init(inst, def);
|
|
22727
24193
|
$ZodType.init(inst, def);
|
|
22728
|
-
inst._zod.parse = (payload,
|
|
24194
|
+
inst._zod.parse = (payload, _2) => {
|
|
22729
24195
|
return payload;
|
|
22730
24196
|
};
|
|
22731
24197
|
inst._zod.check = (payload) => {
|
|
@@ -23548,11 +25014,11 @@ var JSONSchemaGenerator = class {
|
|
|
23548
25014
|
}
|
|
23549
25015
|
const allKeys = new Set(Object.keys(shape));
|
|
23550
25016
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
23551
|
-
const
|
|
25017
|
+
const v2 = def.shape[key]._zod;
|
|
23552
25018
|
if (this.io === "input") {
|
|
23553
|
-
return
|
|
25019
|
+
return v2.optin === void 0;
|
|
23554
25020
|
} else {
|
|
23555
|
-
return
|
|
25021
|
+
return v2.optout === void 0;
|
|
23556
25022
|
}
|
|
23557
25023
|
}));
|
|
23558
25024
|
if (requiredKeys.size > 0) {
|
|
@@ -23573,7 +25039,7 @@ var JSONSchemaGenerator = class {
|
|
|
23573
25039
|
}
|
|
23574
25040
|
case "union": {
|
|
23575
25041
|
const json = _json;
|
|
23576
|
-
json.anyOf = def.options.map((
|
|
25042
|
+
json.anyOf = def.options.map((x3, i2) => this.process(x3, {
|
|
23577
25043
|
...params,
|
|
23578
25044
|
path: [...params.path, "anyOf", i2]
|
|
23579
25045
|
}));
|
|
@@ -23585,14 +25051,14 @@ var JSONSchemaGenerator = class {
|
|
|
23585
25051
|
...params,
|
|
23586
25052
|
path: [...params.path, "allOf", 0]
|
|
23587
25053
|
});
|
|
23588
|
-
const
|
|
25054
|
+
const b2 = this.process(def.right, {
|
|
23589
25055
|
...params,
|
|
23590
25056
|
path: [...params.path, "allOf", 1]
|
|
23591
25057
|
});
|
|
23592
25058
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
23593
25059
|
const allOf = [
|
|
23594
25060
|
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
23595
|
-
...isSimpleIntersection(
|
|
25061
|
+
...isSimpleIntersection(b2) ? b2.allOf : [b2]
|
|
23596
25062
|
];
|
|
23597
25063
|
json.allOf = allOf;
|
|
23598
25064
|
break;
|
|
@@ -23600,7 +25066,7 @@ var JSONSchemaGenerator = class {
|
|
|
23600
25066
|
case "tuple": {
|
|
23601
25067
|
const json = _json;
|
|
23602
25068
|
json.type = "array";
|
|
23603
|
-
const prefixItems = def.items.map((
|
|
25069
|
+
const prefixItems = def.items.map((x3, i2) => this.process(x3, { ...params, path: [...params.path, "prefixItems", i2] }));
|
|
23604
25070
|
if (this.target === "draft-2020-12") {
|
|
23605
25071
|
json.prefixItems = prefixItems;
|
|
23606
25072
|
} else {
|
|
@@ -23655,9 +25121,9 @@ var JSONSchemaGenerator = class {
|
|
|
23655
25121
|
case "enum": {
|
|
23656
25122
|
const json = _json;
|
|
23657
25123
|
const values = getEnumValues(def.entries);
|
|
23658
|
-
if (values.every((
|
|
25124
|
+
if (values.every((v2) => typeof v2 === "number"))
|
|
23659
25125
|
json.type = "number";
|
|
23660
|
-
if (values.every((
|
|
25126
|
+
if (values.every((v2) => typeof v2 === "string"))
|
|
23661
25127
|
json.type = "string";
|
|
23662
25128
|
json.enum = values;
|
|
23663
25129
|
break;
|
|
@@ -23687,13 +25153,13 @@ var JSONSchemaGenerator = class {
|
|
|
23687
25153
|
json.type = val === null ? "null" : typeof val;
|
|
23688
25154
|
json.const = val;
|
|
23689
25155
|
} else {
|
|
23690
|
-
if (vals.every((
|
|
25156
|
+
if (vals.every((v2) => typeof v2 === "number"))
|
|
23691
25157
|
json.type = "number";
|
|
23692
|
-
if (vals.every((
|
|
25158
|
+
if (vals.every((v2) => typeof v2 === "string"))
|
|
23693
25159
|
json.type = "string";
|
|
23694
|
-
if (vals.every((
|
|
25160
|
+
if (vals.every((v2) => typeof v2 === "boolean"))
|
|
23695
25161
|
json.type = "string";
|
|
23696
|
-
if (vals.every((
|
|
25162
|
+
if (vals.every((v2) => v2 === null))
|
|
23697
25163
|
json.type = "null";
|
|
23698
25164
|
json.enum = vals;
|
|
23699
25165
|
}
|
|
@@ -23716,8 +25182,8 @@ var JSONSchemaGenerator = class {
|
|
|
23716
25182
|
file.contentMediaType = mime[0];
|
|
23717
25183
|
Object.assign(json, file);
|
|
23718
25184
|
} else {
|
|
23719
|
-
json.anyOf = mime.map((
|
|
23720
|
-
const mFile = { ...file, contentMediaType:
|
|
25185
|
+
json.anyOf = mime.map((m3) => {
|
|
25186
|
+
const mFile = { ...file, contentMediaType: m3 };
|
|
23721
25187
|
return mFile;
|
|
23722
25188
|
});
|
|
23723
25189
|
}
|
|
@@ -24000,7 +25466,7 @@ function toJSONSchema(input, _params) {
|
|
|
24000
25466
|
const gen2 = new JSONSchemaGenerator(_params);
|
|
24001
25467
|
const defs = {};
|
|
24002
25468
|
for (const entry of input._idmap.entries()) {
|
|
24003
|
-
const [
|
|
25469
|
+
const [_2, schema] = entry;
|
|
24004
25470
|
gen2.process(schema);
|
|
24005
25471
|
}
|
|
24006
25472
|
const schemas = {};
|
|
@@ -24239,7 +25705,7 @@ function normalizeObjectSchema(schema) {
|
|
|
24239
25705
|
const asV4 = schema;
|
|
24240
25706
|
if (!asV3._def && !asV4._zod) {
|
|
24241
25707
|
const values = Object.values(schema);
|
|
24242
|
-
if (values.length > 0 && values.every((
|
|
25708
|
+
if (values.length > 0 && values.every((v2) => typeof v2 === "object" && v2 !== null && (v2._def !== void 0 || v2._zod !== void 0 || typeof v2.parse === "function"))) {
|
|
24243
25709
|
return objectFromShape(schema);
|
|
24244
25710
|
}
|
|
24245
25711
|
}
|
|
@@ -24806,7 +26272,7 @@ var ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
|
24806
26272
|
};
|
|
24807
26273
|
});
|
|
24808
26274
|
function _enum(values, params) {
|
|
24809
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((
|
|
26275
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v2) => [v2, v2])) : values;
|
|
24810
26276
|
return new ZodEnum2({
|
|
24811
26277
|
type: "enum",
|
|
24812
26278
|
entries,
|
|
@@ -25018,7 +26484,7 @@ var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
|
25018
26484
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
25019
26485
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
25020
26486
|
var JSONRPC_VERSION = "2.0";
|
|
25021
|
-
var AssertObjectSchema = custom2((
|
|
26487
|
+
var AssertObjectSchema = custom2((v2) => v2 !== null && (typeof v2 === "object" || typeof v2 === "function"));
|
|
25022
26488
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
25023
26489
|
var CursorSchema = string2();
|
|
25024
26490
|
var TaskCreationParamsSchema = looseObject({
|
|
@@ -26829,7 +28295,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
26829
28295
|
...refs,
|
|
26830
28296
|
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
26831
28297
|
})
|
|
26832
|
-
].filter((
|
|
28298
|
+
].filter((x3) => !!x3);
|
|
26833
28299
|
let unevaluatedProperties = refs.target === "jsonSchema2019-09" ? { unevaluatedProperties: false } : void 0;
|
|
26834
28300
|
const mergedAllOf = [];
|
|
26835
28301
|
allOf.forEach((schema) => {
|
|
@@ -27047,7 +28513,7 @@ function parseStringDef(def, refs) {
|
|
|
27047
28513
|
case "trim":
|
|
27048
28514
|
break;
|
|
27049
28515
|
default:
|
|
27050
|
-
/* @__PURE__ */ ((
|
|
28516
|
+
/* @__PURE__ */ ((_2) => {
|
|
27051
28517
|
})(check2);
|
|
27052
28518
|
}
|
|
27053
28519
|
}
|
|
@@ -27069,7 +28535,7 @@ function escapeNonAlphaNumeric(source) {
|
|
|
27069
28535
|
return result;
|
|
27070
28536
|
}
|
|
27071
28537
|
function addFormat(schema, value, message, refs) {
|
|
27072
|
-
if (schema.format || schema.anyOf?.some((
|
|
28538
|
+
if (schema.format || schema.anyOf?.some((x3) => x3.format)) {
|
|
27073
28539
|
if (!schema.anyOf) {
|
|
27074
28540
|
schema.anyOf = [];
|
|
27075
28541
|
}
|
|
@@ -27097,7 +28563,7 @@ function addFormat(schema, value, message, refs) {
|
|
|
27097
28563
|
}
|
|
27098
28564
|
}
|
|
27099
28565
|
function addPattern(schema, regex, message, refs) {
|
|
27100
|
-
if (schema.pattern || schema.allOf?.some((
|
|
28566
|
+
if (schema.pattern || schema.allOf?.some((x3) => x3.pattern)) {
|
|
27101
28567
|
if (!schema.allOf) {
|
|
27102
28568
|
schema.allOf = [];
|
|
27103
28569
|
}
|
|
@@ -27323,17 +28789,17 @@ function parseUnionDef(def, refs) {
|
|
|
27323
28789
|
if (refs.target === "openApi3")
|
|
27324
28790
|
return asAnyOf(def, refs);
|
|
27325
28791
|
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
27326
|
-
if (options.every((
|
|
27327
|
-
const types3 = options.reduce((types4,
|
|
27328
|
-
const type = primitiveMappings[
|
|
28792
|
+
if (options.every((x3) => x3._def.typeName in primitiveMappings && (!x3._def.checks || !x3._def.checks.length))) {
|
|
28793
|
+
const types3 = options.reduce((types4, x3) => {
|
|
28794
|
+
const type = primitiveMappings[x3._def.typeName];
|
|
27329
28795
|
return type && !types4.includes(type) ? [...types4, type] : types4;
|
|
27330
28796
|
}, []);
|
|
27331
28797
|
return {
|
|
27332
28798
|
type: types3.length > 1 ? types3 : types3[0]
|
|
27333
28799
|
};
|
|
27334
|
-
} else if (options.every((
|
|
27335
|
-
const types3 = options.reduce((acc,
|
|
27336
|
-
const type = typeof
|
|
28800
|
+
} else if (options.every((x3) => x3._def.typeName === "ZodLiteral" && !x3.description)) {
|
|
28801
|
+
const types3 = options.reduce((acc, x3) => {
|
|
28802
|
+
const type = typeof x3._def.value;
|
|
27337
28803
|
switch (type) {
|
|
27338
28804
|
case "string":
|
|
27339
28805
|
case "number":
|
|
@@ -27342,7 +28808,7 @@ function parseUnionDef(def, refs) {
|
|
|
27342
28808
|
case "bigint":
|
|
27343
28809
|
return [...acc, "integer"];
|
|
27344
28810
|
case "object":
|
|
27345
|
-
if (
|
|
28811
|
+
if (x3._def.value === null)
|
|
27346
28812
|
return [...acc, "null"];
|
|
27347
28813
|
case "symbol":
|
|
27348
28814
|
case "undefined":
|
|
@@ -27352,30 +28818,30 @@ function parseUnionDef(def, refs) {
|
|
|
27352
28818
|
}
|
|
27353
28819
|
}, []);
|
|
27354
28820
|
if (types3.length === options.length) {
|
|
27355
|
-
const uniqueTypes = types3.filter((
|
|
28821
|
+
const uniqueTypes = types3.filter((x3, i2, a) => a.indexOf(x3) === i2);
|
|
27356
28822
|
return {
|
|
27357
28823
|
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
27358
|
-
enum: options.reduce((acc,
|
|
27359
|
-
return acc.includes(
|
|
28824
|
+
enum: options.reduce((acc, x3) => {
|
|
28825
|
+
return acc.includes(x3._def.value) ? acc : [...acc, x3._def.value];
|
|
27360
28826
|
}, [])
|
|
27361
28827
|
};
|
|
27362
28828
|
}
|
|
27363
|
-
} else if (options.every((
|
|
28829
|
+
} else if (options.every((x3) => x3._def.typeName === "ZodEnum")) {
|
|
27364
28830
|
return {
|
|
27365
28831
|
type: "string",
|
|
27366
|
-
enum: options.reduce((acc,
|
|
28832
|
+
enum: options.reduce((acc, x3) => [
|
|
27367
28833
|
...acc,
|
|
27368
|
-
...
|
|
28834
|
+
...x3._def.values.filter((x4) => !acc.includes(x4))
|
|
27369
28835
|
], [])
|
|
27370
28836
|
};
|
|
27371
28837
|
}
|
|
27372
28838
|
return asAnyOf(def, refs);
|
|
27373
28839
|
}
|
|
27374
28840
|
var asAnyOf = (def, refs) => {
|
|
27375
|
-
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((
|
|
28841
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map((x3, i2) => parseDef(x3._def, {
|
|
27376
28842
|
...refs,
|
|
27377
28843
|
currentPath: [...refs.currentPath, "anyOf", `${i2}`]
|
|
27378
|
-
})).filter((
|
|
28844
|
+
})).filter((x3) => !!x3 && (!refs.strictUnions || typeof x3 === "object" && Object.keys(x3).length > 0));
|
|
27379
28845
|
return anyOf.length ? { anyOf } : void 0;
|
|
27380
28846
|
};
|
|
27381
28847
|
|
|
@@ -27560,12 +29026,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
27560
29026
|
...refs,
|
|
27561
29027
|
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
27562
29028
|
});
|
|
27563
|
-
const
|
|
29029
|
+
const b2 = parseDef(def.out._def, {
|
|
27564
29030
|
...refs,
|
|
27565
29031
|
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
27566
29032
|
});
|
|
27567
29033
|
return {
|
|
27568
|
-
allOf: [a,
|
|
29034
|
+
allOf: [a, b2].filter((x3) => x3 !== void 0)
|
|
27569
29035
|
};
|
|
27570
29036
|
};
|
|
27571
29037
|
|
|
@@ -27600,10 +29066,10 @@ function parseTupleDef(def, refs) {
|
|
|
27600
29066
|
return {
|
|
27601
29067
|
type: "array",
|
|
27602
29068
|
minItems: def.items.length,
|
|
27603
|
-
items: def.items.map((
|
|
29069
|
+
items: def.items.map((x3, i2) => parseDef(x3._def, {
|
|
27604
29070
|
...refs,
|
|
27605
29071
|
currentPath: [...refs.currentPath, "items", `${i2}`]
|
|
27606
|
-
})).reduce((acc,
|
|
29072
|
+
})).reduce((acc, x3) => x3 === void 0 ? acc : [...acc, x3], []),
|
|
27607
29073
|
additionalItems: parseDef(def.rest._def, {
|
|
27608
29074
|
...refs,
|
|
27609
29075
|
currentPath: [...refs.currentPath, "additionalItems"]
|
|
@@ -27614,10 +29080,10 @@ function parseTupleDef(def, refs) {
|
|
|
27614
29080
|
type: "array",
|
|
27615
29081
|
minItems: def.items.length,
|
|
27616
29082
|
maxItems: def.items.length,
|
|
27617
|
-
items: def.items.map((
|
|
29083
|
+
items: def.items.map((x3, i2) => parseDef(x3._def, {
|
|
27618
29084
|
...refs,
|
|
27619
29085
|
currentPath: [...refs.currentPath, "items", `${i2}`]
|
|
27620
|
-
})).reduce((acc,
|
|
29086
|
+
})).reduce((acc, x3) => x3 === void 0 ? acc : [...acc, x3], [])
|
|
27621
29087
|
};
|
|
27622
29088
|
}
|
|
27623
29089
|
}
|
|
@@ -27711,7 +29177,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
27711
29177
|
case ZodFirstPartyTypeKind.ZodSymbol:
|
|
27712
29178
|
return void 0;
|
|
27713
29179
|
default:
|
|
27714
|
-
return /* @__PURE__ */ ((
|
|
29180
|
+
return /* @__PURE__ */ ((_2) => void 0)(typeName);
|
|
27715
29181
|
}
|
|
27716
29182
|
};
|
|
27717
29183
|
|
|
@@ -29918,7 +31384,7 @@ var McpServer = class {
|
|
|
29918
31384
|
}
|
|
29919
31385
|
});
|
|
29920
31386
|
this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => {
|
|
29921
|
-
const resources = Object.entries(this._registeredResources).filter(([
|
|
31387
|
+
const resources = Object.entries(this._registeredResources).filter(([_2, resource]) => resource.enabled).map(([uri, resource]) => ({
|
|
29922
31388
|
uri,
|
|
29923
31389
|
name: resource.name,
|
|
29924
31390
|
...resource.metadata
|
|
@@ -30119,7 +31585,7 @@ var McpServer = class {
|
|
|
30119
31585
|
};
|
|
30120
31586
|
this._registeredResourceTemplates[name] = registeredResourceTemplate;
|
|
30121
31587
|
const variableNames = template.uriTemplate.variableNames;
|
|
30122
|
-
const hasCompleter = Array.isArray(variableNames) && variableNames.some((
|
|
31588
|
+
const hasCompleter = Array.isArray(variableNames) && variableNames.some((v2) => !!template.completeCallback(v2));
|
|
30123
31589
|
if (hasCompleter) {
|
|
30124
31590
|
this.setCompletionRequestHandler();
|
|
30125
31591
|
}
|
|
@@ -30236,7 +31702,7 @@ var McpServer = class {
|
|
|
30236
31702
|
annotations = rest.shift();
|
|
30237
31703
|
}
|
|
30238
31704
|
} else if (typeof firstArg === "object" && firstArg !== null) {
|
|
30239
|
-
if (Object.values(firstArg).some((
|
|
31705
|
+
if (Object.values(firstArg).some((v2) => typeof v2 === "object" && v2 !== null)) {
|
|
30240
31706
|
throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);
|
|
30241
31707
|
}
|
|
30242
31708
|
annotations = rest.shift();
|
|
@@ -30501,6 +31967,7 @@ init_jira_client();
|
|
|
30501
31967
|
|
|
30502
31968
|
// src/confluence-client.ts
|
|
30503
31969
|
init_src();
|
|
31970
|
+
var REQUEST_TIMEOUT_MS = 6e4;
|
|
30504
31971
|
var ConfluenceClient = class {
|
|
30505
31972
|
baseUrl;
|
|
30506
31973
|
auth;
|
|
@@ -30517,22 +31984,48 @@ var ConfluenceClient = class {
|
|
|
30517
31984
|
authHeader() {
|
|
30518
31985
|
return `Basic ${Buffer.from(`${this.auth.username}:${this.auth.password}`).toString("base64")}`;
|
|
30519
31986
|
}
|
|
31987
|
+
/** Jira/Confluence 공통 base URL(트레일링 슬래시 제거). 툴에서 페이지 webui URL 조합용. */
|
|
31988
|
+
getBaseUrl() {
|
|
31989
|
+
return this.baseUrl;
|
|
31990
|
+
}
|
|
31991
|
+
/**
|
|
31992
|
+
* 공통 fetch 래퍼 — timeout(AbortController) + 인증 헤더 + 에러 정규화.
|
|
31993
|
+
* label은 에러 메시지 식별용(get/create/update/...). 빈 응답은 null 반환.
|
|
31994
|
+
* timeout 초과 시 throw(`Confluence <label> timed out after Ns`).
|
|
31995
|
+
*/
|
|
31996
|
+
async request(url, init) {
|
|
31997
|
+
const controller = new AbortController();
|
|
31998
|
+
const timer = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
31999
|
+
try {
|
|
32000
|
+
const resp = await fetch(url, {
|
|
32001
|
+
method: init.method || "GET",
|
|
32002
|
+
headers: { ...this.headers(), Authorization: this.authHeader() },
|
|
32003
|
+
body: init.body,
|
|
32004
|
+
signal: controller.signal
|
|
32005
|
+
});
|
|
32006
|
+
if (!resp.ok) {
|
|
32007
|
+
throw new Error(`Confluence ${init.label} ${resp.status}: ${await resp.text()}`);
|
|
32008
|
+
}
|
|
32009
|
+
const text = await resp.text();
|
|
32010
|
+
return text ? JSON.parse(text) : null;
|
|
32011
|
+
} catch (err) {
|
|
32012
|
+
if (err?.name === "AbortError") {
|
|
32013
|
+
throw new Error(`Confluence ${init.label} timed out after ${REQUEST_TIMEOUT_MS / 1e3}s`);
|
|
32014
|
+
}
|
|
32015
|
+
throw err;
|
|
32016
|
+
} finally {
|
|
32017
|
+
clearTimeout(timer);
|
|
32018
|
+
}
|
|
32019
|
+
}
|
|
30520
32020
|
async getPage(pageId, expand) {
|
|
30521
32021
|
const params = expand?.length ? `?expand=${expand.join(",")}` : "";
|
|
30522
|
-
|
|
30523
|
-
`${this.baseUrl}/wiki/rest/api/content/${pageId}${params}`,
|
|
30524
|
-
{ headers: { ...this.headers(), Authorization: this.authHeader() } }
|
|
30525
|
-
);
|
|
30526
|
-
if (!resp.ok) throw new Error(`Confluence get ${resp.status}: ${await resp.text()}`);
|
|
30527
|
-
return resp.json();
|
|
32022
|
+
return this.request(`${this.baseUrl}/wiki/rest/api/content/${pageId}${params}`, { label: "get" });
|
|
30528
32023
|
}
|
|
30529
32024
|
async search(cql, limit = 25) {
|
|
30530
|
-
|
|
32025
|
+
return this.request(
|
|
30531
32026
|
`${this.baseUrl}/wiki/rest/api/content/search?cql=${encodeURIComponent(cql)}&limit=${limit}`,
|
|
30532
|
-
{
|
|
32027
|
+
{ label: "search" }
|
|
30533
32028
|
);
|
|
30534
|
-
if (!resp.ok) throw new Error(`Confluence search ${resp.status}: ${await resp.text()}`);
|
|
30535
|
-
return resp.json();
|
|
30536
32029
|
}
|
|
30537
32030
|
async createPage(spaceKey, title, body, parentId) {
|
|
30538
32031
|
const payload = {
|
|
@@ -30549,65 +32042,44 @@ var ConfluenceClient = class {
|
|
|
30549
32042
|
if (parentId) {
|
|
30550
32043
|
payload.ancestors = [{ id: parentId }];
|
|
30551
32044
|
}
|
|
30552
|
-
|
|
30553
|
-
|
|
30554
|
-
|
|
30555
|
-
|
|
30556
|
-
|
|
30557
|
-
body: JSON.stringify(payload)
|
|
30558
|
-
}
|
|
30559
|
-
);
|
|
30560
|
-
if (!resp.ok) throw new Error(`Confluence create ${resp.status}: ${await resp.text()}`);
|
|
30561
|
-
return resp.json();
|
|
32045
|
+
return this.request(`${this.baseUrl}/wiki/rest/api/content`, {
|
|
32046
|
+
method: "POST",
|
|
32047
|
+
label: "create",
|
|
32048
|
+
body: JSON.stringify(payload)
|
|
32049
|
+
});
|
|
30562
32050
|
}
|
|
30563
32051
|
async updatePage(pageId, title, body, version2) {
|
|
30564
|
-
|
|
30565
|
-
|
|
30566
|
-
|
|
30567
|
-
|
|
30568
|
-
|
|
30569
|
-
|
|
30570
|
-
|
|
30571
|
-
|
|
30572
|
-
|
|
30573
|
-
|
|
30574
|
-
|
|
30575
|
-
value: body,
|
|
30576
|
-
representation: "storage"
|
|
30577
|
-
}
|
|
32052
|
+
return this.request(`${this.baseUrl}/wiki/rest/api/content/${pageId}`, {
|
|
32053
|
+
method: "PUT",
|
|
32054
|
+
label: "update",
|
|
32055
|
+
body: JSON.stringify({
|
|
32056
|
+
type: "page",
|
|
32057
|
+
title,
|
|
32058
|
+
version: { number: version2 + 1 },
|
|
32059
|
+
body: {
|
|
32060
|
+
storage: {
|
|
32061
|
+
value: body,
|
|
32062
|
+
representation: "storage"
|
|
30578
32063
|
}
|
|
30579
|
-
}
|
|
30580
|
-
}
|
|
30581
|
-
);
|
|
30582
|
-
if (!resp.ok) throw new Error(`Confluence update ${resp.status}: ${await resp.text()}`);
|
|
30583
|
-
return resp.json();
|
|
32064
|
+
}
|
|
32065
|
+
})
|
|
32066
|
+
});
|
|
30584
32067
|
}
|
|
30585
32068
|
async deletePage(pageId) {
|
|
30586
|
-
|
|
30587
|
-
|
|
30588
|
-
|
|
30589
|
-
|
|
30590
|
-
headers: { ...this.headers(), Authorization: this.authHeader() }
|
|
30591
|
-
}
|
|
30592
|
-
);
|
|
30593
|
-
if (!resp.ok) throw new Error(`Confluence delete ${resp.status}: ${await resp.text()}`);
|
|
32069
|
+
await this.request(`${this.baseUrl}/wiki/rest/api/content/${pageId}`, {
|
|
32070
|
+
method: "DELETE",
|
|
32071
|
+
label: "delete"
|
|
32072
|
+
});
|
|
30594
32073
|
return { success: true };
|
|
30595
32074
|
}
|
|
30596
32075
|
async getSpaces() {
|
|
30597
|
-
|
|
30598
|
-
`${this.baseUrl}/wiki/rest/api/space?limit=100`,
|
|
30599
|
-
{ headers: { ...this.headers(), Authorization: this.authHeader() } }
|
|
30600
|
-
);
|
|
30601
|
-
if (!resp.ok) throw new Error(`Confluence spaces ${resp.status}: ${await resp.text()}`);
|
|
30602
|
-
return resp.json();
|
|
32076
|
+
return this.request(`${this.baseUrl}/wiki/rest/api/space?limit=100`, { label: "spaces" });
|
|
30603
32077
|
}
|
|
30604
32078
|
async getPageChildren(pageId, limit = 25) {
|
|
30605
|
-
|
|
32079
|
+
return this.request(
|
|
30606
32080
|
`${this.baseUrl}/wiki/rest/api/content/${pageId}/child/page?limit=${limit}`,
|
|
30607
|
-
{
|
|
32081
|
+
{ label: "children" }
|
|
30608
32082
|
);
|
|
30609
|
-
if (!resp.ok) throw new Error(`Confluence children ${resp.status}: ${await resp.text()}`);
|
|
30610
|
-
return resp.json();
|
|
30611
32083
|
}
|
|
30612
32084
|
};
|
|
30613
32085
|
|
|
@@ -30791,7 +32263,7 @@ var XrayClient = class {
|
|
|
30791
32263
|
};
|
|
30792
32264
|
|
|
30793
32265
|
// src/tools/jira-crud.ts
|
|
30794
|
-
|
|
32266
|
+
init_markdown();
|
|
30795
32267
|
init_jira_fields();
|
|
30796
32268
|
var registerJiraCrudTools = (ctx2) => {
|
|
30797
32269
|
const { server: server2, jira: jira2 } = ctx2;
|
|
@@ -30814,7 +32286,7 @@ var registerJiraCrudTools = (ctx2) => {
|
|
|
30814
32286
|
project: external_exports.string().describe("Project key (e.g. PROJ)"),
|
|
30815
32287
|
summary: external_exports.string().describe("Issue summary/title"),
|
|
30816
32288
|
issuetype: external_exports.string().describe("Issue type name (e.g. Task, Story, Bug, Requirement)"),
|
|
30817
|
-
description: external_exports.string().optional().describe("Issue description (plain text, auto-converted to ADF)"),
|
|
32289
|
+
description: external_exports.string().optional().describe("Issue description (markdown or plain text, auto-converted to ADF: headings/lists/tables/code supported)"),
|
|
30818
32290
|
assignee: external_exports.string().optional().describe("Assignee email or accountId"),
|
|
30819
32291
|
labels: external_exports.array(external_exports.string()).optional().describe("Labels to apply"),
|
|
30820
32292
|
priority: external_exports.string().optional().describe("Priority name (e.g. High, Medium, Low)"),
|
|
@@ -30828,7 +32300,7 @@ var registerJiraCrudTools = (ctx2) => {
|
|
|
30828
32300
|
summary,
|
|
30829
32301
|
issuetype: { name: issuetype }
|
|
30830
32302
|
};
|
|
30831
|
-
if (description) fields.description =
|
|
32303
|
+
if (description) fields.description = markdownToAdf(description);
|
|
30832
32304
|
if (assignee) fields.assignee = { emailAddress: assignee };
|
|
30833
32305
|
if (labels?.length) fields.labels = labels;
|
|
30834
32306
|
if (priority) fields.priority = { name: priority };
|
|
@@ -30844,15 +32316,15 @@ var registerJiraCrudTools = (ctx2) => {
|
|
|
30844
32316
|
const data = await jira2.createIssue(finalFields);
|
|
30845
32317
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
30846
32318
|
});
|
|
30847
|
-
server2.tool("jira_update_issue", "Update fields on a Jira issue. Rich-text customfields: pass their keys in rich_text_custom_fields (string values auto-converted to ADF), or set auto_detect_rich_text to infer them from the issue's field schema. description is accepted as plain text and auto-converted to ADF.", {
|
|
32319
|
+
server2.tool("jira_update_issue", "Update fields on a Jira issue. Rich-text customfields: pass their keys in rich_text_custom_fields (string values auto-converted to ADF), or set auto_detect_rich_text to infer them from the issue's field schema. description is accepted as markdown/plain text and auto-converted to ADF (headings/lists/tables/code supported).", {
|
|
30848
32320
|
issue_key: external_exports.string().describe("Issue key (e.g. PROJ-123)"),
|
|
30849
32321
|
fields: external_exports.record(external_exports.unknown()).describe("Fields to update as key-value pairs. Rich-text (ADF) fields should be listed in rich_text_custom_fields; otherwise pass a pre-built ADF object."),
|
|
30850
|
-
description: external_exports.string().optional().describe("New description (plain text, auto-converted to ADF). Overrides fields.description if present."),
|
|
32322
|
+
description: external_exports.string().optional().describe("New description (markdown or plain text, auto-converted to ADF: headings/lists/tables/code supported). Overrides fields.description if present."),
|
|
30851
32323
|
rich_text_custom_fields: external_exports.array(external_exports.string()).optional().describe("customfield keys whose plain-text values should be auto-converted to ADF. Discover ADF candidates via jira_get_issue_type_schema (inferredFormat: adf/adf-suspect)."),
|
|
30852
32324
|
auto_detect_rich_text: external_exports.boolean().optional().describe("If true, detect ADF fields from the issue's issuetype schema and auto-convert (merged with rich_text_custom_fields). Adds extra API calls.")
|
|
30853
32325
|
}, async ({ issue_key, fields, description, rich_text_custom_fields, auto_detect_rich_text }) => {
|
|
30854
32326
|
const merged = { ...fields };
|
|
30855
|
-
if (description !== void 0) merged.description =
|
|
32327
|
+
if (description !== void 0) merged.description = markdownToAdf(description);
|
|
30856
32328
|
let adfKeys = rich_text_custom_fields || [];
|
|
30857
32329
|
if (auto_detect_rich_text) {
|
|
30858
32330
|
const issue2 = await jira2.getIssue(issue_key, ["issuetype", "project"]);
|
|
@@ -30924,6 +32396,8 @@ var registerJiraCrudTools = (ctx2) => {
|
|
|
30924
32396
|
};
|
|
30925
32397
|
|
|
30926
32398
|
// src/tools/confluence.ts
|
|
32399
|
+
init_markdown();
|
|
32400
|
+
var STORAGE_BODY_WARN_BYTES = 2 * 1024 * 1024;
|
|
30927
32401
|
var registerConfluenceTools = (ctx2) => {
|
|
30928
32402
|
const { server: server2, confluence: confluence2 } = ctx2;
|
|
30929
32403
|
server2.tool("confluence_get_page", "Get a Confluence page by ID", {
|
|
@@ -30975,6 +32449,48 @@ var registerConfluenceTools = (ctx2) => {
|
|
|
30975
32449
|
const data = await confluence2.getPageChildren(page_id, limit);
|
|
30976
32450
|
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
30977
32451
|
});
|
|
32452
|
+
server2.tool("confluence_publish_doc", "Publish a markdown document as a Confluence page. Markdown is converted to native Confluence storage format (headings/lists/tables/inline marks + code fences \u2192 code macro; YAML frontmatter auto-stripped). Create a new page, or update an existing one when page_id is provided (version auto-incremented). Use to publish doc_render output to Confluence after human review.", {
|
|
32453
|
+
space_key: external_exports.string().describe("Confluence space key (e.g. PROJ). Required even in update mode (returned for reference)."),
|
|
32454
|
+
title: external_exports.string().describe("Page title"),
|
|
32455
|
+
markdown: external_exports.string().describe("Document content in markdown. Headings (#), bullet/ordered lists, GFM tables, fenced code blocks, and inline marks (**bold**/*italic*/`code`) are supported."),
|
|
32456
|
+
parent_page_id: external_exports.string().optional().describe("Parent page ID \u2014 create mode only, nests the new page under this parent. Ignored in update mode."),
|
|
32457
|
+
page_id: external_exports.string().optional().describe("Existing page ID. When provided, the page is UPDATED (current version fetched then incremented). When omitted, a NEW page is created.")
|
|
32458
|
+
}, async ({ space_key, title, markdown, parent_page_id, page_id }) => {
|
|
32459
|
+
const body = markdownToStorageFormat(markdown);
|
|
32460
|
+
const bodyBytes = Buffer.byteLength(body, "utf8");
|
|
32461
|
+
const warning = bodyBytes > STORAGE_BODY_WARN_BYTES ? `storage body is ${bodyBytes} bytes (> ${STORAGE_BODY_WARN_BYTES}). Confluence may reject or render slowly \u2014 consider splitting into child pages.` : void 0;
|
|
32462
|
+
if (warning) console.error(`[confluence_publish_doc] ${warning}`);
|
|
32463
|
+
let result;
|
|
32464
|
+
let mode;
|
|
32465
|
+
if (page_id) {
|
|
32466
|
+
mode = "update";
|
|
32467
|
+
const current = await confluence2.getPage(page_id, ["version"]);
|
|
32468
|
+
const currentVersion = current?.version?.number ?? 0;
|
|
32469
|
+
result = await confluence2.updatePage(page_id, title, body, currentVersion);
|
|
32470
|
+
} else {
|
|
32471
|
+
mode = "create";
|
|
32472
|
+
result = await confluence2.createPage(space_key, title, body, parent_page_id);
|
|
32473
|
+
}
|
|
32474
|
+
const pageIdOut = result?.id ?? page_id;
|
|
32475
|
+
const webui = result?._links?.webui;
|
|
32476
|
+
const url = webui ? webui.startsWith("http") ? webui : `${confluence2.getBaseUrl()}${webui}` : void 0;
|
|
32477
|
+
return {
|
|
32478
|
+
content: [{
|
|
32479
|
+
type: "text",
|
|
32480
|
+
text: JSON.stringify({
|
|
32481
|
+
mode,
|
|
32482
|
+
page_id: pageIdOut,
|
|
32483
|
+
title,
|
|
32484
|
+
space_key,
|
|
32485
|
+
version: result?.version?.number,
|
|
32486
|
+
url,
|
|
32487
|
+
body_chars: body.length,
|
|
32488
|
+
body_bytes: bodyBytes,
|
|
32489
|
+
...warning ? { warning } : {}
|
|
32490
|
+
}, null, 2)
|
|
32491
|
+
}]
|
|
32492
|
+
};
|
|
32493
|
+
});
|
|
30978
32494
|
};
|
|
30979
32495
|
|
|
30980
32496
|
// src/config/project-config.ts
|
|
@@ -31068,7 +32584,7 @@ ${results.join("\n")}` }] };
|
|
|
31068
32584
|
return { content: [{ type: "text", text: JSON.stringify({
|
|
31069
32585
|
risk_model_key: config2.risk_model_key,
|
|
31070
32586
|
risk_sets: config2.risk_sets,
|
|
31071
|
-
classifiers: Object.fromEntries(Object.entries(config2.classifiers).map(([k,
|
|
32587
|
+
classifiers: Object.fromEntries(Object.entries(config2.classifiers).map(([k, v2]) => [k, { id: v2.id, options: Object.keys(v2.options) }]))
|
|
31072
32588
|
}, null, 2) }] };
|
|
31073
32589
|
});
|
|
31074
32590
|
server2.tool("risk_create_hazards", "Batch create Hazard tickets with Risk panel activation, risk values, and Risk Source links. Migrated from rmr_create_hazards.py.", {
|
|
@@ -31233,15 +32749,15 @@ function parseCvssVector(vector) {
|
|
|
31233
32749
|
const colonIdx = part.indexOf(":");
|
|
31234
32750
|
if (colonIdx > 0) {
|
|
31235
32751
|
const k = part.substring(0, colonIdx);
|
|
31236
|
-
const
|
|
31237
|
-
if (k !== "CVSS") result[k] =
|
|
32752
|
+
const v2 = part.substring(colonIdx + 1);
|
|
32753
|
+
if (k !== "CVSS") result[k] = v2;
|
|
31238
32754
|
}
|
|
31239
32755
|
}
|
|
31240
32756
|
return result;
|
|
31241
32757
|
}
|
|
31242
32758
|
function buildCvssVector(metrics) {
|
|
31243
|
-
const base = BASE_METRICS.filter((
|
|
31244
|
-
const supp = SUPPLEMENTAL_METRICS.filter((
|
|
32759
|
+
const base = BASE_METRICS.filter((m3) => metrics[m3]).map((m3) => `${m3}:${metrics[m3]}`).join("/");
|
|
32760
|
+
const supp = SUPPLEMENTAL_METRICS.filter((m3) => metrics[m3] && metrics[m3] !== "X").map((m3) => `${m3}:${metrics[m3]}`).join("/");
|
|
31245
32761
|
return `CVSS:4.0/${base}${supp ? "/" + supp : ""}`;
|
|
31246
32762
|
}
|
|
31247
32763
|
function calculateCvssScore(metrics) {
|
|
@@ -31266,10 +32782,10 @@ function calculateCvssScore(metrics) {
|
|
|
31266
32782
|
}
|
|
31267
32783
|
function validateMetrics(metrics) {
|
|
31268
32784
|
const errors = [];
|
|
31269
|
-
for (const [k,
|
|
32785
|
+
for (const [k, v2] of Object.entries(metrics)) {
|
|
31270
32786
|
const valid = METRIC_VALUES[k];
|
|
31271
32787
|
if (!valid) errors.push(`Unknown metric: ${k}`);
|
|
31272
|
-
else if (!valid.includes(
|
|
32788
|
+
else if (!valid.includes(v2)) errors.push(`Invalid value ${v2} for ${k}. Valid: ${valid.join(", ")}`);
|
|
31273
32789
|
}
|
|
31274
32790
|
return errors;
|
|
31275
32791
|
}
|
|
@@ -31287,7 +32803,7 @@ ${errors.join("\n")}` }] };
|
|
|
31287
32803
|
}
|
|
31288
32804
|
const vector = buildCvssVector(metrics);
|
|
31289
32805
|
const { score, severity } = calculateCvssScore(metrics);
|
|
31290
|
-
const details = Object.entries(metrics).map(([k,
|
|
32806
|
+
const details = Object.entries(metrics).map(([k, v2]) => ` ${k} = ${v2} (${METRIC_LABELS[k] || k})`).join("\n");
|
|
31291
32807
|
return { content: [{ type: "text", text: `CVSS Vector: ${vector}
|
|
31292
32808
|
Score: ${score} (${severity})
|
|
31293
32809
|
|
|
@@ -31331,7 +32847,7 @@ ${errors.join("\n")}` }] };
|
|
|
31331
32847
|
let details = "";
|
|
31332
32848
|
if (vector) {
|
|
31333
32849
|
const metrics = parseCvssVector(vector);
|
|
31334
|
-
details = "\n\nMetrics:\n" + Object.entries(metrics).map(([k,
|
|
32850
|
+
details = "\n\nMetrics:\n" + Object.entries(metrics).map(([k, v2]) => ` ${k} = ${v2} (${METRIC_LABELS[k] || k})`).join("\n");
|
|
31335
32851
|
}
|
|
31336
32852
|
return { content: [{ type: "text", text: `${issue_key}: ${f3?.summary}
|
|
31337
32853
|
CVSS Vector: ${vector}
|
|
@@ -31402,7 +32918,7 @@ var registerTraceabilityTools = (ctx2) => {
|
|
|
31402
32918
|
`Subtasks: ${(f3.subtasks || []).map((s2) => s2.key).join(", ") || "(none)"}`,
|
|
31403
32919
|
"",
|
|
31404
32920
|
`Links (${links.length}):`,
|
|
31405
|
-
...links.map((
|
|
32921
|
+
...links.map((l3) => ` ${l3.direction === "inward" ? "\u2190" : "\u2192"} [${l3.link_type}] ${l3.key}: ${l3.summary}`)
|
|
31406
32922
|
];
|
|
31407
32923
|
return { content: [{ type: "text", text: report.join("\n") }] };
|
|
31408
32924
|
});
|
|
@@ -31414,14 +32930,14 @@ var registerTraceabilityTools = (ctx2) => {
|
|
|
31414
32930
|
const missing = [];
|
|
31415
32931
|
for (const gate of gates.issues || []) {
|
|
31416
32932
|
const gateLinks = extractLinks(gate);
|
|
31417
|
-
const documentKeys = gateLinks.filter((
|
|
32933
|
+
const documentKeys = gateLinks.filter((l3) => l3.link_type === "is blocked by").map((l3) => l3.key);
|
|
31418
32934
|
for (const docKey of documentKeys) {
|
|
31419
32935
|
const docData = await jira2.getIssue(docKey, ["summary", "issuetype", "issuelinks"]);
|
|
31420
32936
|
const docLinks = extractLinks(docData);
|
|
31421
32937
|
const docType = docData.fields?.issuetype?.name;
|
|
31422
32938
|
const docSummary = docData.fields?.summary || "";
|
|
31423
32939
|
if (docType === "Document" && docSummary.includes("Risk Management Report")) {
|
|
31424
|
-
const hasHazardLinks = docLinks.some((
|
|
32940
|
+
const hasHazardLinks = docLinks.some((l3) => l3.link_type === "Relates");
|
|
31425
32941
|
if (!hasHazardLinks && documentKeys.length > 0) {
|
|
31426
32942
|
missing.push({ source: docKey, target: "(any Hazard)", expected_link: "Relates" });
|
|
31427
32943
|
}
|
|
@@ -31429,7 +32945,7 @@ var registerTraceabilityTools = (ctx2) => {
|
|
|
31429
32945
|
}
|
|
31430
32946
|
}
|
|
31431
32947
|
return { content: [{ type: "text", text: missing.length > 0 ? `Missing links found:
|
|
31432
|
-
${missing.map((
|
|
32948
|
+
${missing.map((m3) => ` ${m3.source} \u2192 ${m3.target} [${m3.expected_link}]`).join("\n")}` : `No missing links found for Gate issues in ${projectKey}` }] };
|
|
31433
32949
|
});
|
|
31434
32950
|
server2.tool("traceability_fix", "Automatically create missing traceability links", {
|
|
31435
32951
|
links: external_exports.array(external_exports.object({
|
|
@@ -31439,12 +32955,12 @@ ${missing.map((m2) => ` ${m2.source} \u2192 ${m2.target} [${m2.expected_link}]`
|
|
|
31439
32955
|
})).describe("Array of links to create")
|
|
31440
32956
|
}, async ({ links: linksToCreate }) => {
|
|
31441
32957
|
const results = [];
|
|
31442
|
-
for (const
|
|
32958
|
+
for (const l3 of linksToCreate) {
|
|
31443
32959
|
try {
|
|
31444
|
-
await jira2.createLink(
|
|
31445
|
-
results.push({ link: `${
|
|
32960
|
+
await jira2.createLink(l3.link_type, l3.inward_key, l3.outward_key);
|
|
32961
|
+
results.push({ link: `${l3.inward_key} \u2190[${l3.link_type}]\u2192 ${l3.outward_key}`, status: "created" });
|
|
31446
32962
|
} catch (e2) {
|
|
31447
|
-
results.push({ link: `${
|
|
32963
|
+
results.push({ link: `${l3.inward_key} \u2190[${l3.link_type}]\u2192 ${l3.outward_key}`, status: `failed: ${e2.message}` });
|
|
31448
32964
|
}
|
|
31449
32965
|
}
|
|
31450
32966
|
return { content: [{ type: "text", text: results.map((r2) => `${r2.status}: ${r2.link}`).join("\n") }] };
|
|
@@ -31583,12 +33099,12 @@ ${steps.map((s2) => `\u2022 ${s2}`).join("\n")}${LINK_GUIDE}` }] };
|
|
|
31583
33099
|
phase: external_exports.number().optional().describe("Implementation phase number"),
|
|
31584
33100
|
blocks: external_exports.array(external_exports.string()).optional().describe("Summary strings of tasks this blocks (for linking later)")
|
|
31585
33101
|
}, async ({ project_key, summary, description, sds_key, dd_keys, phase, blocks }) => {
|
|
31586
|
-
const {
|
|
33102
|
+
const { markdownToAdf: markdownToAdf2 } = await Promise.resolve().then(() => (init_markdown(), markdown_exports));
|
|
31587
33103
|
const issue2 = await jira2.createIssue({
|
|
31588
33104
|
project: { key: project_key },
|
|
31589
33105
|
summary,
|
|
31590
33106
|
issuetype: { name: "Task" },
|
|
31591
|
-
description:
|
|
33107
|
+
description: markdownToAdf2(description || summary)
|
|
31592
33108
|
});
|
|
31593
33109
|
const issueKey = issue2.key;
|
|
31594
33110
|
await jira2.createLink("Relates", issueKey, sds_key);
|
|
@@ -31603,8 +33119,8 @@ ${steps.map((s2) => `\u2022 ${s2}`).join("\n")}${LINK_GUIDE}` }] };
|
|
|
31603
33119
|
issue_key: external_exports.string().describe("Ticket key"),
|
|
31604
33120
|
content: external_exports.string().describe("Document content (markdown or plain text)")
|
|
31605
33121
|
}, async ({ issue_key, content }) => {
|
|
31606
|
-
const {
|
|
31607
|
-
await jira2.updateIssue(issue_key, { description:
|
|
33122
|
+
const { markdownToAdf: markdownToAdf2 } = await Promise.resolve().then(() => (init_markdown(), markdown_exports));
|
|
33123
|
+
await jira2.updateIssue(issue_key, { description: markdownToAdf2(content) });
|
|
31608
33124
|
return { content: [{ type: "text", text: `Updated ${issue_key} description (${content.length} chars)` }] };
|
|
31609
33125
|
});
|
|
31610
33126
|
};
|
|
@@ -31630,6 +33146,7 @@ var TOOL_CATALOG = [
|
|
|
31630
33146
|
{ name: "confluence_delete_page", description: "\uD398\uC774\uC9C0 \uC0AD\uC81C", category: "Confluence" },
|
|
31631
33147
|
{ name: "confluence_get_spaces", description: "\uC2A4\uD398\uC774\uC2A4 \uBAA9\uB85D", category: "Confluence" },
|
|
31632
33148
|
{ name: "confluence_get_page_children", description: "\uD558\uC704 \uD398\uC774\uC9C0 \uC870\uD68C", category: "Confluence" },
|
|
33149
|
+
{ name: "confluence_publish_doc", description: "\uB9C8\uD06C\uB2E4\uC6B4 \uBB38\uC11C \u2192 Confluence \uD398\uC774\uC9C0 \uAC8C\uC7AC (create/update \uC790\uB3D9 \uBD84\uAE30, \uCF54\uB4DC\uD39C\uC2A4 \u2192 \uCF54\uB4DC \uB9E4\uD06C\uB85C)", category: "Confluence" },
|
|
31633
33150
|
{ name: "risk_get_config", description: "\uB9AC\uC2A4\uD06C \uAD00\uB9AC \uC124\uC815 \uC870\uD68C", category: "\uB9AC\uC2A4\uD06C \uAD00\uB9AC" },
|
|
31634
33151
|
{ name: "risk_activate_panel", description: "\uB9AC\uC2A4\uD06C \uD328\uB110 \uD65C\uC131\uD654", category: "\uB9AC\uC2A4\uD06C \uAD00\uB9AC" },
|
|
31635
33152
|
{ name: "risk_set_values", description: "\uB9AC\uC2A4\uD06C \uAC12(severity, p1, p2) \uC124\uC815", category: "\uB9AC\uC2A4\uD06C \uAD00\uB9AC" },
|
|
@@ -32331,9 +33848,9 @@ import path from "path";
|
|
|
32331
33848
|
var VAR_RE = /\{([A-Z0-9_]+)\}/g;
|
|
32332
33849
|
function extractVars(template) {
|
|
32333
33850
|
const names = /* @__PURE__ */ new Set();
|
|
32334
|
-
let
|
|
32335
|
-
while ((
|
|
32336
|
-
names.add(
|
|
33851
|
+
let m3;
|
|
33852
|
+
while ((m3 = VAR_RE.exec(template)) !== null) {
|
|
33853
|
+
names.add(m3[1]);
|
|
32337
33854
|
}
|
|
32338
33855
|
return [...names];
|
|
32339
33856
|
}
|
|
@@ -32349,13 +33866,13 @@ function renderTemplate(input) {
|
|
|
32349
33866
|
const vars = extractVars(input.template);
|
|
32350
33867
|
let rendered = input.template;
|
|
32351
33868
|
const unresolved = [];
|
|
32352
|
-
for (const
|
|
32353
|
-
const resolver = META_RESOLVERS[
|
|
33869
|
+
for (const v2 of vars) {
|
|
33870
|
+
const resolver = META_RESOLVERS[v2];
|
|
32354
33871
|
const val = resolver ? resolver(input) : void 0;
|
|
32355
33872
|
if (val !== void 0 && val !== "") {
|
|
32356
|
-
rendered = rendered.split(`{${
|
|
33873
|
+
rendered = rendered.split(`{${v2}}`).join(val);
|
|
32357
33874
|
} else {
|
|
32358
|
-
unresolved.push(
|
|
33875
|
+
unresolved.push(v2);
|
|
32359
33876
|
}
|
|
32360
33877
|
}
|
|
32361
33878
|
return { rendered, unresolved };
|
|
@@ -32462,7 +33979,7 @@ var registerDocRenderTools = (ctx2) => {
|
|
|
32462
33979
|
"```",
|
|
32463
33980
|
"",
|
|
32464
33981
|
"## \uCC44\uC6CC\uC57C \uD560 placeholder \uBCC0\uC218 (\uD2F0\uCF13 \uB370\uC774\uD130\uB97C \uADFC\uAC70\uB85C \uC791\uC131)",
|
|
32465
|
-
unresolved.length > 0 ? unresolved.map((
|
|
33982
|
+
unresolved.length > 0 ? unresolved.map((v2) => `- {${v2}}`).join("\n") : "(\uC5C6\uC74C \u2014 \uBAA8\uB4E0 \uBCC0\uC218\uAC00 \uCE58\uD658\uB428)",
|
|
32466
33983
|
"",
|
|
32467
33984
|
"## \uD2F0\uCF13 \uB370\uC774\uD130 (\uBE48\uCE78 \uC791\uC131\uC6A9 \uC7AC\uB8CC)",
|
|
32468
33985
|
"```json",
|
|
@@ -32491,7 +34008,7 @@ var xrayClientSecret = process.env.XRAY_CLIENT_SECRET || "";
|
|
|
32491
34008
|
var xray = xrayClientId && xrayClientSecret ? new XrayClient(xrayClientId, xrayClientSecret, jiraUrl, jiraEmail, jiraToken) : null;
|
|
32492
34009
|
var server = new McpServer({
|
|
32493
34010
|
name: "jira-confluence",
|
|
32494
|
-
version: "0.1.
|
|
34011
|
+
version: "0.1.11"
|
|
32495
34012
|
});
|
|
32496
34013
|
var ctx = { server, jira, confluence, risk, xray };
|
|
32497
34014
|
registerJiraCrudTools(ctx);
|