@zaly/agent 0.0.6 → 0.0.9
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/dist/{agent-BaD2kax9.mjs → agent-B7cQOuMZ.mjs} +2 -2
- package/dist/agent-B7cQOuMZ.mjs.map +1 -0
- package/dist/{agent-DirSoZjM.mjs → agent-D3wVIibN.mjs} +3 -3
- package/dist/{agent-DirSoZjM.mjs.map → agent-D3wVIibN.mjs.map} +1 -1
- package/dist/{compactions-3AjPqjeZ.mjs → compactions-B8VdZJoU.mjs} +2 -2
- package/dist/{compactions-3AjPqjeZ.mjs.map → compactions-B8VdZJoU.mjs.map} +1 -1
- package/dist/{edit-Qxl4w1C2.mjs → edit-D4yaBK1K.mjs} +9 -17
- package/dist/edit-D4yaBK1K.mjs.map +1 -0
- package/dist/{fetch-DXuxAg_t.mjs → fetch-VKhSWdEh.mjs} +2 -2
- package/dist/{fetch-DXuxAg_t.mjs.map → fetch-VKhSWdEh.mjs.map} +1 -1
- package/dist/{find-Bah9SKWX.mjs → find-CimUGn-L.mjs} +6 -20
- package/dist/find-CimUGn-L.mjs.map +1 -0
- package/dist/{grep-B4GF0svc.mjs → grep-6O3mjSvV.mjs} +10 -78
- package/dist/grep-6O3mjSvV.mjs.map +1 -0
- package/dist/{index-node-esm-DAnl9SaE.mjs → index-node-esm-CJsN8G51.mjs} +5 -3
- package/dist/index-node-esm-CJsN8G51.mjs.map +1 -0
- package/dist/index.d.mts +20 -37
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -953
- package/dist/{manager-DHBfEtge.mjs → manager-BqlbCGYV.mjs} +2 -2
- package/dist/{manager-DHBfEtge.mjs.map → manager-BqlbCGYV.mjs.map} +1 -1
- package/dist/{masker-Bv9KjkDF.mjs → masker-DRFztUwc.mjs} +2 -2
- package/dist/{masker-Bv9KjkDF.mjs.map → masker-DRFztUwc.mjs.map} +1 -1
- package/dist/{read-Djsx2NZl.mjs → read-CSL_8nAk.mjs} +47 -63
- package/dist/read-CSL_8nAk.mjs.map +1 -0
- package/dist/{registry-Bao6L4Ue.mjs → registry-L9GDccS0.mjs} +2 -2
- package/dist/{registry-Bao6L4Ue.mjs.map → registry-L9GDccS0.mjs.map} +1 -1
- package/dist/{session-B1lXSWhT.mjs → session-BSvUrr12.mjs} +2 -2
- package/dist/{session-B1lXSWhT.mjs.map → session-BSvUrr12.mjs.map} +1 -1
- package/dist/session.mjs +1 -1
- package/dist/src-fK6DL2bg.mjs +953 -0
- package/dist/src-fK6DL2bg.mjs.map +1 -0
- package/dist/{subagent-Zz-MQHk2.mjs → subagent-C8XCEecM.mjs} +2 -2
- package/dist/{subagent-Zz-MQHk2.mjs.map → subagent-C8XCEecM.mjs.map} +1 -1
- package/dist/{tools-CZvBFp-v.mjs → tools-wvkkuXWH.mjs} +2 -2
- package/dist/{tools-CZvBFp-v.mjs.map → tools-wvkkuXWH.mjs.map} +1 -1
- package/dist/{write-D3L-92vj.mjs → write-DwGiDNeG.mjs} +3 -11
- package/dist/write-DwGiDNeG.mjs.map +1 -0
- package/package.json +6 -6
- package/dist/agent-BaD2kax9.mjs.map +0 -1
- package/dist/edit-Qxl4w1C2.mjs.map +0 -1
- package/dist/find-Bah9SKWX.mjs.map +0 -1
- package/dist/grep-B4GF0svc.mjs.map +0 -1
- package/dist/index-node-esm-DAnl9SaE.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/read-Djsx2NZl.mjs.map +0 -1
- package/dist/write-D3L-92vj.mjs.map +0 -1
|
@@ -7,36 +7,22 @@ import { find } from "@zaly/shared/find";
|
|
|
7
7
|
const DEFAULT_LIMIT = 200;
|
|
8
8
|
const findTool = defineTool({
|
|
9
9
|
name: "find",
|
|
10
|
-
desc: "Find files using fd/fdfind or rg --files. `glob` is a filename/path glob, array of globs, or plain substring; empty, `*`, or `**/*` lists all files.
|
|
10
|
+
desc: "Find files using fd/fdfind or rg --files. `glob` is a filename/path glob, array of globs, or plain substring; empty, `*`, or `**/*` lists all files. Includes hidden files and respects .gitignore by default. Does not follow directory symlinks; prefer this over bash find for file discovery.",
|
|
11
11
|
parallel: true,
|
|
12
12
|
params: Type.Object({
|
|
13
13
|
glob: Type.Optional(Type.Union([Type.String(), Type.Array(Type.String())], {
|
|
14
14
|
default: "",
|
|
15
15
|
description: "Filename/path glob, array of globs, or plain substring. Empty, `*`, or `**/*` lists all files."
|
|
16
16
|
})),
|
|
17
|
-
cwd: Type.Optional(Type.String({ description: "Directory to search from. Defaults to cwd." })),
|
|
18
17
|
paths: Type.Optional(Type.Array(Type.String(), { description: "Optional directories to search, relative to cwd or absolute." })),
|
|
19
|
-
type: Type.Optional(Type.Union([
|
|
20
|
-
Type.Literal("file"),
|
|
21
|
-
Type.Literal("dir"),
|
|
22
|
-
Type.Literal("any")
|
|
23
|
-
], {
|
|
24
|
-
default: "file",
|
|
25
|
-
description: "Entry type to return. `dir` requires fd/fdfind or find fallback."
|
|
26
|
-
})),
|
|
27
|
-
exclude: Type.Optional(Type.Array(Type.String(), { description: "Patterns to exclude, e.g. [`node_modules`, `dist/**`]." })),
|
|
28
18
|
hidden: Type.Optional(Type.Boolean({
|
|
29
|
-
default:
|
|
30
|
-
description: "Include hidden
|
|
19
|
+
default: true,
|
|
20
|
+
description: "Include files in hidden directories and dotfiles."
|
|
31
21
|
})),
|
|
32
22
|
ignore: Type.Optional(Type.Boolean({
|
|
33
23
|
default: true,
|
|
34
24
|
description: "Respect .gitignore/.ignore rules."
|
|
35
25
|
})),
|
|
36
|
-
follow: Type.Optional(Type.Boolean({
|
|
37
|
-
default: false,
|
|
38
|
-
description: "Follow symlinks."
|
|
39
|
-
})),
|
|
40
26
|
limit: Type.Optional(Type.Integer({
|
|
41
27
|
default: DEFAULT_LIMIT,
|
|
42
28
|
description: "Maximum paths to keep inline.",
|
|
@@ -45,13 +31,13 @@ const findTool = defineTool({
|
|
|
45
31
|
}))
|
|
46
32
|
}),
|
|
47
33
|
async preflight(args, ctx) {
|
|
48
|
-
const cwd = normPath(ctx.cwd,
|
|
34
|
+
const cwd = normPath(ctx.cwd, ".");
|
|
49
35
|
await ctx.need?.("read", cwd);
|
|
50
36
|
const paths = (args.paths?.length ? args.paths : ["."]).map((p) => normPath(cwd, p));
|
|
51
37
|
await Promise.all(paths.map((path) => Promise.resolve(ctx.need?.("read", path))));
|
|
52
38
|
},
|
|
53
39
|
async call(args, ctx) {
|
|
54
|
-
const cwd = normPath(ctx.cwd,
|
|
40
|
+
const cwd = normPath(ctx.cwd, ".");
|
|
55
41
|
let result = [];
|
|
56
42
|
try {
|
|
57
43
|
result = (await Array.fromAsync(find({
|
|
@@ -84,4 +70,4 @@ const findTool = defineTool({
|
|
|
84
70
|
//#endregion
|
|
85
71
|
export { findTool };
|
|
86
72
|
|
|
87
|
-
//# sourceMappingURL=find-
|
|
73
|
+
//# sourceMappingURL=find-CimUGn-L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-CimUGn-L.mjs","names":[],"sources":["../src/tools/find.ts"],"sourcesContent":["import type { MetaPart, TextPart, ToolContext } from \"@zaly/ai\"\n\nimport { AiError, defineTool } from \"@zaly/ai\"\nimport { normPath } from \"@zaly/shared\"\nimport { find } from \"@zaly/shared/find\"\nimport { Type } from \"typebox\"\nimport { truncate } from \"../utils/truncate.ts\"\n\nconst DEFAULT_LIMIT = 200\nconst MAX_LIMIT = 1000\n\nexport type FindTool = typeof findTool\nexport type FindToolMeta = {\n cwd: string\n glob: string | string[]\n matches: number\n truncated: boolean\n}\n\n// oxlint-disable-next-line sort-keys -- semantic field order: name, desc, params, call\nexport const findTool = defineTool({\n name: \"find\",\n desc:\n \"Find files using fd/fdfind or rg --files. `glob` is a filename/path glob, \" +\n \"array of globs, or plain substring; empty, `*`, or `**/*` lists all files. \" +\n \"Includes hidden files and respects .gitignore by default. Does not follow directory symlinks; \" +\n \"prefer this over bash find for file discovery.\",\n parallel: true,\n // oxlint-disable-next-line sort-keys -- semantic param order\n params: Type.Object({\n glob: Type.Optional(\n Type.Union([Type.String(), Type.Array(Type.String())], {\n default: \"\",\n description:\n \"Filename/path glob, array of globs, or plain substring. Empty, `*`, or `**/*` lists all files.\",\n })\n ),\n paths: Type.Optional(\n Type.Array(Type.String(), {\n description: \"Optional directories to search, relative to cwd or absolute.\",\n })\n ),\n hidden: Type.Optional(\n Type.Boolean({\n default: true,\n description: \"Include files in hidden directories and dotfiles.\",\n })\n ),\n ignore: Type.Optional(\n Type.Boolean({ default: true, description: \"Respect .gitignore/.ignore rules.\" })\n ),\n limit: Type.Optional(\n Type.Integer({\n default: DEFAULT_LIMIT,\n description: \"Maximum paths to keep inline.\",\n maximum: MAX_LIMIT,\n minimum: 1,\n })\n ),\n }),\n\n async preflight(args, ctx: ToolContext<FindToolMeta>) {\n const cwd = normPath(ctx.cwd, \".\")\n await ctx.need?.(\"read\", cwd)\n const paths = (args.paths?.length ? args.paths : [\".\"]).map((p) => normPath(cwd, p))\n await Promise.all(paths.map((path) => Promise.resolve(ctx.need?.(\"read\", path))))\n },\n\n async call(args, ctx: ToolContext<FindToolMeta>): Promise<(MetaPart | TextPart)[]> {\n const cwd = normPath(ctx.cwd, \".\")\n\n let result: string[] = []\n try {\n const batch = await Array.fromAsync(\n find({ ...args, cwd, pattern: args.glob, signal: ctx.signal })\n )\n result = batch.flat()\n } catch (error) {\n throw AiError.from(error)\n }\n\n const limit = args.limit ?? DEFAULT_LIMIT\n const summary = truncate(result.join(\"\\n\"), {\n maxLines: limit + 1,\n strategy: \"head\",\n })\n\n const truncated = summary.truncated\n ctx.meta = {\n cwd,\n glob: args.glob ?? \"\",\n matches: summary.origLines,\n truncated,\n }\n\n return [{ text: summary.text || \"No files found.\", type: \"text\" }]\n },\n})\n"],"mappings":";;;;;;AAQA,MAAM,gBAAgB;AAYtB,MAAa,WAAW,WAAW;CACjC,MAAM;CACN,MACE;CAIF,UAAU;CAEV,QAAQ,KAAK,OAAO;EAClB,MAAM,KAAK,SACT,KAAK,M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OAAO;GACT;GACA,MAAM,KAAK,QAAQ;GACnB,SAAS,QAAQ;GACjB;EACF;EAEA,OAAO,CAAC;GAAE,MAAM,QAAQ,QAAQ;GAAmB,MAAM;EAAO,CAAC;CACnE;AACF,CAAC"}
|
|
@@ -16,49 +16,30 @@ const grepTool = defineTool({
|
|
|
16
16
|
parallel: true,
|
|
17
17
|
params: Type.Object({
|
|
18
18
|
pattern: Type.String({
|
|
19
|
-
description: "Text or regex pattern
|
|
19
|
+
description: "Text or regex pattern. Uses smart case: case-insensitive unless uppercase is present.",
|
|
20
20
|
minLength: 1
|
|
21
21
|
}),
|
|
22
|
-
cwd: Type.Optional(Type.String({ description: "Directory to search from. Defaults to cwd." })),
|
|
23
22
|
paths: Type.Optional(Type.Array(Type.String(), { description: "Optional files/directories to search, relative to cwd or absolute." })),
|
|
24
23
|
glob: Type.Optional(Type.Array(Type.String(), { description: "Ripgrep glob filters, e.g. [`*.ts`, `!dist/**`]." })),
|
|
25
|
-
exclude: Type.Optional(Type.Array(Type.String(), { description: "Patterns to exclude, e.g. [`node_modules`, `dist/**`]." })),
|
|
26
|
-
file_type: Type.Optional(Type.Array(Type.String(), { description: "Ripgrep file types (`-t`), e.g. [`ts`, `rust`, `markdown`]." })),
|
|
27
24
|
fixed_strings: Type.Optional(Type.Boolean({
|
|
28
25
|
default: false,
|
|
29
26
|
description: "Treat all patterns as literals instead of as regular expressions"
|
|
30
27
|
})),
|
|
31
|
-
case_sensitive: Type.Optional(Type.Boolean({
|
|
32
|
-
default: false,
|
|
33
|
-
description: "Case sensitive search. Default false is smart case (case-insensitive if pattern is lowercase)."
|
|
34
|
-
})),
|
|
35
|
-
hidden: Type.Optional(Type.Boolean({
|
|
36
|
-
default: false,
|
|
37
|
-
description: "Search hidden files/directories."
|
|
38
|
-
})),
|
|
39
|
-
ignore: Type.Optional(Type.Boolean({
|
|
40
|
-
default: true,
|
|
41
|
-
description: "Respect .gitignore/.ignore rules."
|
|
42
|
-
})),
|
|
43
|
-
follow: Type.Optional(Type.Boolean({
|
|
44
|
-
default: false,
|
|
45
|
-
description: "Follow symlinks."
|
|
46
|
-
})),
|
|
47
28
|
context: Type.Optional(Type.Integer({
|
|
48
29
|
default: 0,
|
|
49
|
-
description: "Context lines before/after each match. 0-
|
|
30
|
+
description: "Context lines before/after each match. 0-10.",
|
|
50
31
|
maximum: 10,
|
|
51
32
|
minimum: 0
|
|
52
33
|
})),
|
|
53
34
|
limit: Type.Optional(Type.Integer({
|
|
54
35
|
default: DEFAULT_LIMIT,
|
|
55
|
-
description: "Maximum
|
|
36
|
+
description: "Maximum output lines to keep inline, including file headings and context.",
|
|
56
37
|
maximum: MAX_LIMIT,
|
|
57
38
|
minimum: 1
|
|
58
39
|
}))
|
|
59
40
|
}),
|
|
60
41
|
async preflight(args, ctx) {
|
|
61
|
-
const cwd = normPath(ctx.cwd,
|
|
42
|
+
const cwd = normPath(ctx.cwd, ".");
|
|
62
43
|
await ctx.need?.("read", cwd);
|
|
63
44
|
const paths = (args.paths?.length ? args.paths : ["."]).map((p) => normPath(cwd, p));
|
|
64
45
|
await Promise.all(paths.map((path) => Promise.resolve(ctx.need?.("read", path))));
|
|
@@ -69,7 +50,7 @@ const grepTool = defineTool({
|
|
|
69
50
|
code: "MISSING_TOOL",
|
|
70
51
|
message: "grep requires rg or grep"
|
|
71
52
|
});
|
|
72
|
-
const cwd = normPath(ctx.cwd,
|
|
53
|
+
const cwd = normPath(ctx.cwd, ".");
|
|
73
54
|
const paths = args.paths?.length ? args.paths : [];
|
|
74
55
|
const cmdArgs = buildArgs(command.kind, args, paths);
|
|
75
56
|
const result = await new Spawn(command.cmd, cmdArgs, {
|
|
@@ -131,47 +112,6 @@ const grepTool = defineTool({
|
|
|
131
112
|
return parts;
|
|
132
113
|
}
|
|
133
114
|
});
|
|
134
|
-
const FILE_TYPE_EXTENSIONS = {
|
|
135
|
-
c: ["c", "h"],
|
|
136
|
-
cpp: [
|
|
137
|
-
"cpp",
|
|
138
|
-
"cc",
|
|
139
|
-
"cxx",
|
|
140
|
-
"hpp",
|
|
141
|
-
"hh",
|
|
142
|
-
"hxx"
|
|
143
|
-
],
|
|
144
|
-
go: ["go"],
|
|
145
|
-
java: ["java"],
|
|
146
|
-
js: [
|
|
147
|
-
"js",
|
|
148
|
-
"jsx",
|
|
149
|
-
"mjs",
|
|
150
|
-
"cjs"
|
|
151
|
-
],
|
|
152
|
-
json: ["json"],
|
|
153
|
-
lua: ["lua"],
|
|
154
|
-
markdown: ["md", "markdown"],
|
|
155
|
-
md: ["md", "markdown"],
|
|
156
|
-
py: ["py"],
|
|
157
|
-
python: ["py"],
|
|
158
|
-
rs: ["rs"],
|
|
159
|
-
rust: ["rs"],
|
|
160
|
-
toml: ["toml"],
|
|
161
|
-
ts: [
|
|
162
|
-
"ts",
|
|
163
|
-
"tsx",
|
|
164
|
-
"mts",
|
|
165
|
-
"cts"
|
|
166
|
-
],
|
|
167
|
-
yaml: ["yml", "yaml"]
|
|
168
|
-
};
|
|
169
|
-
function fileTypeExtensions(type) {
|
|
170
|
-
return FILE_TYPE_EXTENSIONS[type] ?? [type];
|
|
171
|
-
}
|
|
172
|
-
function fileTypeGlobs(type) {
|
|
173
|
-
return fileTypeExtensions(type).map((e) => `*.${e}`);
|
|
174
|
-
}
|
|
175
115
|
function resolveGrep() {
|
|
176
116
|
const rg = which("rg");
|
|
177
117
|
if (rg) return {
|
|
@@ -198,17 +138,11 @@ function buildRgArgs(args, paths) {
|
|
|
198
138
|
"--path-separator=/"
|
|
199
139
|
];
|
|
200
140
|
if (args.fixed_strings) ret.push("--fixed-strings");
|
|
201
|
-
|
|
202
|
-
else ret.push("--smart-case");
|
|
203
|
-
if (args.hidden) ret.push("--hidden");
|
|
204
|
-
else ret.push("--no-hidden");
|
|
205
|
-
if (!args.ignore) ret.push("--no-ignore");
|
|
206
|
-
if (args.follow) ret.push("--follow");
|
|
141
|
+
ret.push("--smart-case", "--no-hidden");
|
|
207
142
|
const context = args.context ?? 0;
|
|
208
143
|
if (context > 0) ret.push(`--context=${context}`);
|
|
209
|
-
for (const e of
|
|
144
|
+
for (const e of defaultExcludes(paths)) ret.push("--glob", `!${e}`);
|
|
210
145
|
for (const g of args.glob ?? []) ret.push("--glob", g);
|
|
211
|
-
for (const t of args.file_type ?? []) ret.push("--type", t);
|
|
212
146
|
ret.push("--", args.pattern, ...paths);
|
|
213
147
|
return ret;
|
|
214
148
|
}
|
|
@@ -222,12 +156,10 @@ function buildGrepArgs(args, paths) {
|
|
|
222
156
|
];
|
|
223
157
|
if (args.fixed_strings) ret.push("--fixed-strings");
|
|
224
158
|
else ret.push("--extended-regexp");
|
|
225
|
-
|
|
226
|
-
if (!args.case_sensitive && !hasUpper) ret.push("--ignore-case");
|
|
159
|
+
if (!/[A-Z]/.test(args.pattern)) ret.push("--ignore-case");
|
|
227
160
|
const context = args.context ?? 0;
|
|
228
161
|
if (context > 0) ret.push("--context", String(context));
|
|
229
|
-
for (const e of
|
|
230
|
-
for (const t of args.file_type ?? []) for (const g of fileTypeGlobs(t)) ret.push("--include", g);
|
|
162
|
+
for (const e of defaultExcludes(paths)) ret.push("--exclude-dir", e);
|
|
231
163
|
for (const g of args.glob ?? []) ret.push(...grepGlobArgs(g));
|
|
232
164
|
ret.push("--", args.pattern, ...paths);
|
|
233
165
|
return ret;
|
|
@@ -241,4 +173,4 @@ function grepGlobArgs(glob) {
|
|
|
241
173
|
//#endregion
|
|
242
174
|
export { grepTool };
|
|
243
175
|
|
|
244
|
-
//# sourceMappingURL=grep-
|
|
176
|
+
//# sourceMappingURL=grep-6O3mjSvV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grep-6O3mjSvV.mjs","names":[],"sources":["../src/tools/grep.ts"],"sourcesContent":["import type { MetaPart, TextPart, ToolContext } from \"@zaly/ai\"\n\nimport { AiError, defineTool } from \"@zaly/ai\"\nimport { normPath } from \"@zaly/shared\"\nimport { defaultExcludes } from \"@zaly/shared/find\"\nimport { Spawn, TextStream, which } from \"@zaly/shared/process\"\nimport { cleanTextTui } from \"@zaly/shared/text\"\nimport { Type } from \"typebox\"\nimport { truncate } from \"../utils/truncate.ts\"\n\nconst MAX_BUFFER = 512 * 1024\nconst DEFAULT_LIMIT = 100\nconst MAX_LIMIT = 1000\nconst MAX_COLUMNS = 200\n\nexport type GrepTool = typeof grepTool\nexport type GrepToolMeta = {\n cwd: string\n pattern: string\n truncated: boolean\n cmd: string[]\n}\n\n// oxlint-disable-next-line sort-keys -- semantic field order: name, desc, params, call\nexport const grepTool = defineTool({\n name: \"grep\",\n desc:\n `Search file contents using rg/grep. Respects .gitignore by default when ripgrep is available; ` +\n \"prefer this over bash grep/find for code search. Returns human-readable grouped matches with line numbers.\",\n parallel: true,\n // oxlint-disable-next-line sort-keys -- semantic param order\n params: Type.Object({\n pattern: Type.String({\n description:\n \"Text or regex pattern. Uses smart case: case-insensitive unless uppercase is present.\",\n minLength: 1,\n }),\n paths: Type.Optional(\n Type.Array(Type.String(), {\n description: \"Optional files/directories to search, relative to cwd or absolute.\",\n })\n ),\n glob: Type.Optional(\n Type.Array(Type.String(), {\n description: \"Ripgrep glob filters, e.g. [`*.ts`, `!dist/**`].\",\n })\n ),\n fixed_strings: Type.Optional(\n Type.Boolean({\n default: false,\n description: \"Treat all patterns as literals instead of as regular expressions\",\n })\n ),\n context: Type.Optional(\n Type.Integer({\n default: 0,\n description: \"Context lines before/after each match. 0-10.\",\n maximum: 10,\n minimum: 0,\n })\n ),\n limit: Type.Optional(\n Type.Integer({\n default: DEFAULT_LIMIT,\n description: \"Maximum output lines to keep inline, including file headings and context.\",\n maximum: MAX_LIMIT,\n minimum: 1,\n })\n ),\n }),\n\n async preflight(args, ctx: ToolContext<GrepToolMeta>) {\n const cwd = normPath(ctx.cwd, \".\")\n await ctx.need?.(\"read\", cwd)\n\n const paths = (args.paths?.length ? args.paths : [\".\"]).map((p) => normPath(cwd, p))\n await Promise.all(paths.map((path) => Promise.resolve(ctx.need?.(\"read\", path))))\n },\n\n async call(args, ctx: ToolContext<GrepToolMeta>): Promise<(MetaPart | TextPart)[]> {\n const command = resolveGrep()\n if (!command) throw new AiError({ code: \"MISSING_TOOL\", message: \"grep requires rg or grep\" })\n\n const cwd = normPath(ctx.cwd, \".\")\n const paths = args.paths?.length ? args.paths : []\n\n const cmdArgs = buildArgs(command.kind, args, paths)\n const proc = new Spawn(command.cmd, cmdArgs, {\n cwd,\n maxBuffer: MAX_BUFFER,\n signal: ctx.signal,\n stderr: new TextStream(),\n stdout: new TextStream(),\n timeout: 60_000,\n })\n const result = await proc.result.catch((error: unknown) => {\n throw new AiError({ cause: error, code: \"GREP_FAILED\", message: String(error) })\n })\n\n // rg/grep: 0 matches found, 1 no matches, >1 error.\n if (result.code > 1 && result.killReason !== \"maxBuffer\") {\n throw new AiError({\n code: \"GREP_FAILED\",\n data: { code: result.code, stderr: result.stderr },\n message: `${command.cmd} failed (${result.code}): ${result.stderr.slice(0, 500)}`,\n })\n }\n\n const text = cleanTextTui(result.stdout)\n const limit = args.limit ?? DEFAULT_LIMIT\n const summary = truncate(text, {\n maxLineChars: command.kind === \"rg\" ? 500 : MAX_COLUMNS,\n maxLines: limit + 1,\n strategy: \"head\",\n })\n\n const truncated = summary.truncated || result.killReason === \"maxBuffer\"\n ctx.meta = {\n cmd: [command.cmd, ...cmdArgs],\n cwd,\n pattern: args.pattern,\n truncated,\n }\n\n const parts: (MetaPart | TextPart)[] = []\n\n const stderr = result.stderr.trim()\n if (stderr || result.killReason) {\n const meta: Record<string, unknown> = {\n command: command.cmd,\n cwd,\n truncated,\n }\n if (result.killReason) meta.killReason = result.killReason\n if (stderr) meta.stderr = stderr.slice(0, 500)\n parts.push({ data: meta, tag: \"grep\", type: \"meta\" })\n }\n parts.push({ text: summary.text || \"No matches found.\", type: \"text\" })\n return parts\n },\n})\n\ntype GrepArgs = Parameters<GrepTool[\"call\"]>[0]\ntype GrepBackend = { cmd: string; kind: \"rg\" | \"grep\" }\n\nfunction resolveGrep(): GrepBackend | undefined {\n const rg = which(\"rg\")\n if (rg) return { cmd: rg, kind: \"rg\" }\n const grep = which(\"grep\")\n return grep ? { cmd: grep, kind: \"grep\" } : undefined\n}\n\nfunction buildArgs(kind: GrepBackend[\"kind\"], args: GrepArgs, paths: string[]): string[] {\n return kind === \"rg\" ? buildRgArgs(args, paths) : buildGrepArgs(args, paths)\n}\n\nfunction buildRgArgs(args: GrepArgs, paths: string[]): string[] {\n const ret = [\n \"--color=always\",\n \"--heading\",\n \"--with-filename\",\n \"--line-number\",\n `--max-columns=${MAX_COLUMNS}`,\n \"--max-columns-preview\",\n \"--path-separator=/\",\n ]\n\n if (args.fixed_strings) ret.push(\"--fixed-strings\")\n ret.push(\"--smart-case\", \"--no-hidden\")\n const context = args.context ?? 0\n if (context > 0) ret.push(`--context=${context}`)\n\n for (const e of defaultExcludes(paths)) ret.push(\"--glob\", `!${e}`)\n for (const g of args.glob ?? []) ret.push(\"--glob\", g)\n\n ret.push(\"--\", args.pattern, ...paths)\n return ret\n}\n\nfunction buildGrepArgs(args: GrepArgs, paths: string[]): string[] {\n const ret = [\n \"--recursive\",\n \"--line-number\",\n \"--with-filename\",\n \"--binary-files=without-match\",\n \"--color=always\",\n ]\n if (args.fixed_strings) ret.push(\"--fixed-strings\")\n else ret.push(\"--extended-regexp\")\n const hasUpper = /[A-Z]/.test(args.pattern)\n if (!hasUpper) ret.push(\"--ignore-case\")\n const context = args.context ?? 0\n if (context > 0) ret.push(\"--context\", String(context))\n for (const e of defaultExcludes(paths)) ret.push(\"--exclude-dir\", e)\n for (const g of args.glob ?? []) ret.push(...grepGlobArgs(g))\n ret.push(\"--\", args.pattern, ...paths)\n return ret\n}\n\nfunction grepGlobArgs(glob: string): string[] {\n if (!glob.startsWith(\"!\")) return [\"--include\", glob]\n const exclude = glob.slice(1)\n if (exclude.endsWith(\"/**\") && !exclude.slice(0, -3).includes(\"*\")) {\n return [\"--exclude-dir\", exclude.slice(0, -3)]\n }\n return [\"--exclude\", exclude]\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iBAAiB,CAAC;CACnE,KAAK,MAAM,KAAK,KAAK,QAAQ,CAAC,GAAG,IAAI,KAAK,GAAG,aAAa,CAAC,CAAC;CAC5D,IAAI,KAAK,MAAM,KAAK,SAAS,GAAG,KAAK;CACrC,OAAO;AACT;AAEA,SAAS,aAAa,MAAwB;CAC5C,IAAI,CAAC,KAAK,WAAW,GAAG,GAAG,OAAO,CAAC,aAAa,IAAI;CACpD,MAAM,UAAU,KAAK,MAAM,CAAC;CAC5B,IAAI,QAAQ,SAAS,KAAK,KAAK,CAAC,QAAQ,MAAM,GAAG,EAAE,CAAC,CAAC,SAAS,GAAG,GAC/D,OAAO,CAAC,iBAAiB,QAAQ,MAAM,GAAG,EAAE,CAAC;CAE/C,OAAO,CAAC,aAAa,OAAO;AAC9B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import vm from "node:vm";
|
|
2
|
-
//#region ../../node_modules/.bun/jsonpath-plus@11.2.
|
|
2
|
+
//#region ../../node_modules/.bun/jsonpath-plus@11.2.1/node_modules/jsonpath-plus/dist/index-node-esm.js
|
|
3
3
|
/**
|
|
4
4
|
* @implements {IHooks}
|
|
5
5
|
*/
|
|
@@ -999,6 +999,7 @@ const BINOPS = Object.assign(
|
|
|
999
999
|
/** @type {OperatorTable} */
|
|
1000
1000
|
{
|
|
1001
1001
|
"||": (a, b) => a || b(),
|
|
1002
|
+
"??": (a, b) => a ?? b(),
|
|
1002
1003
|
"&&": (a, b) => a && b(),
|
|
1003
1004
|
"|": (a, b) => a | b(),
|
|
1004
1005
|
"^": (a, b) => a ^ b(),
|
|
@@ -1018,7 +1019,8 @@ const BINOPS = Object.assign(
|
|
|
1018
1019
|
"-": (a, b) => a - b(),
|
|
1019
1020
|
"*": (a, b) => a * b(),
|
|
1020
1021
|
"/": (a, b) => a / b(),
|
|
1021
|
-
"%": (a, b) => a % b()
|
|
1022
|
+
"%": (a, b) => a % b(),
|
|
1023
|
+
"**": (a, b) => a ** b()
|
|
1022
1024
|
}
|
|
1023
1025
|
);
|
|
1024
1026
|
/**
|
|
@@ -2111,4 +2113,4 @@ JSONPathClass.prototype.vm = vm;
|
|
|
2111
2113
|
//#endregion
|
|
2112
2114
|
export { JSONPath };
|
|
2113
2115
|
|
|
2114
|
-
//# sourceMappingURL=index-node-esm-
|
|
2116
|
+
//# sourceMappingURL=index-node-esm-CJsN8G51.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-node-esm-CJsN8G51.mjs","names":["error"],"sources":["../../../node_modules/.bun/jsonpath-plus@11.2.1/node_modules/jsonpath-plus/dist/index-node-esm.js"],"sourcesContent":["import vm from 'node:vm';\n\n/**\n * @implements {IHooks}\n */\nclass Hooks {\n /**\n * @callback HookCallback\n * @this {*|Jsep} this\n * @param {Jsep} env\n * @returns: void\n */\n /**\n * Adds the given callback to the list of callbacks for the given hook.\n *\n * The callback will be invoked when the hook it is registered for is run.\n *\n * One callback function can be registered to multiple hooks and the same hook multiple times.\n *\n * @param {string|object} name The name of the hook, or an object of callbacks keyed by name\n * @param {HookCallback|boolean} callback The callback function which is given environment variables.\n * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)\n * @public\n */\n add(name, callback, first) {\n if (typeof arguments[0] != 'string') {\n // Multiple hook callbacks, keyed by name\n for (let name in arguments[0]) {\n this.add(name, arguments[0][name], arguments[1]);\n }\n } else {\n (Array.isArray(name) ? name : [name]).forEach(function (name) {\n this[name] = this[name] || [];\n if (callback) {\n this[name][first ? 'unshift' : 'push'](callback);\n }\n }, this);\n }\n }\n\n /**\n * Runs a hook invoking all registered callbacks with the given environment variables.\n *\n * Callbacks will be invoked synchronously and in the order in which they were registered.\n *\n * @param {string} name The name of the hook.\n * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.\n * @public\n */\n run(name, env) {\n this[name] = this[name] || [];\n this[name].forEach(function (callback) {\n callback.call(env && env.context ? env.context : env, env);\n });\n }\n}\n\n/**\n * @implements {IPlugins}\n */\nclass Plugins {\n constructor(jsep) {\n this.jsep = jsep;\n this.registered = {};\n }\n\n /**\n * @callback PluginSetup\n * @this {Jsep} jsep\n * @returns: void\n */\n /**\n * Adds the given plugin(s) to the registry\n *\n * @param {object} plugins\n * @param {string} plugins.name The name of the plugin\n * @param {PluginSetup} plugins.init The init function\n * @public\n */\n register(...plugins) {\n plugins.forEach(plugin => {\n if (typeof plugin !== 'object' || !plugin.name || !plugin.init) {\n throw new Error('Invalid JSEP plugin format');\n }\n if (this.registered[plugin.name]) {\n // already registered. Ignore.\n return;\n }\n plugin.init(this.jsep);\n this.registered[plugin.name] = plugin;\n });\n }\n}\n\n// JavaScript Expression Parser (JSEP) 1.4.0\n\nclass Jsep {\n /**\n * @returns {string}\n */\n static get version() {\n // To be filled in by the template\n return '1.4.0';\n }\n\n /**\n * @returns {string}\n */\n static toString() {\n return 'JavaScript Expression Parser (JSEP) v' + Jsep.version;\n }\n // ==================== CONFIG ================================\n /**\n * @method addUnaryOp\n * @param {string} op_name The name of the unary op to add\n * @returns {Jsep}\n */\n static addUnaryOp(op_name) {\n Jsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);\n Jsep.unary_ops[op_name] = 1;\n return Jsep;\n }\n\n /**\n * @method jsep.addBinaryOp\n * @param {string} op_name The name of the binary op to add\n * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence\n * @param {boolean} [isRightAssociative=false] whether operator is right-associative\n * @returns {Jsep}\n */\n static addBinaryOp(op_name, precedence, isRightAssociative) {\n Jsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);\n Jsep.binary_ops[op_name] = precedence;\n if (isRightAssociative) {\n Jsep.right_associative.add(op_name);\n } else {\n Jsep.right_associative.delete(op_name);\n }\n return Jsep;\n }\n\n /**\n * @method addIdentifierChar\n * @param {string} char The additional character to treat as a valid part of an identifier\n * @returns {Jsep}\n */\n static addIdentifierChar(char) {\n Jsep.additional_identifier_chars.add(char);\n return Jsep;\n }\n\n /**\n * @method addLiteral\n * @param {string} literal_name The name of the literal to add\n * @param {*} literal_value The value of the literal\n * @returns {Jsep}\n */\n static addLiteral(literal_name, literal_value) {\n Jsep.literals[literal_name] = literal_value;\n return Jsep;\n }\n\n /**\n * @method removeUnaryOp\n * @param {string} op_name The name of the unary op to remove\n * @returns {Jsep}\n */\n static removeUnaryOp(op_name) {\n delete Jsep.unary_ops[op_name];\n if (op_name.length === Jsep.max_unop_len) {\n Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\n }\n return Jsep;\n }\n\n /**\n * @method removeAllUnaryOps\n * @returns {Jsep}\n */\n static removeAllUnaryOps() {\n Jsep.unary_ops = {};\n Jsep.max_unop_len = 0;\n return Jsep;\n }\n\n /**\n * @method removeIdentifierChar\n * @param {string} char The additional character to stop treating as a valid part of an identifier\n * @returns {Jsep}\n */\n static removeIdentifierChar(char) {\n Jsep.additional_identifier_chars.delete(char);\n return Jsep;\n }\n\n /**\n * @method removeBinaryOp\n * @param {string} op_name The name of the binary op to remove\n * @returns {Jsep}\n */\n static removeBinaryOp(op_name) {\n delete Jsep.binary_ops[op_name];\n if (op_name.length === Jsep.max_binop_len) {\n Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n }\n Jsep.right_associative.delete(op_name);\n return Jsep;\n }\n\n /**\n * @method removeAllBinaryOps\n * @returns {Jsep}\n */\n static removeAllBinaryOps() {\n Jsep.binary_ops = {};\n Jsep.max_binop_len = 0;\n return Jsep;\n }\n\n /**\n * @method removeLiteral\n * @param {string} literal_name The name of the literal to remove\n * @returns {Jsep}\n */\n static removeLiteral(literal_name) {\n delete Jsep.literals[literal_name];\n return Jsep;\n }\n\n /**\n * @method removeAllLiterals\n * @returns {Jsep}\n */\n static removeAllLiterals() {\n Jsep.literals = {};\n return Jsep;\n }\n // ==================== END CONFIG ============================\n\n /**\n * @returns {string}\n */\n get char() {\n return this.expr.charAt(this.index);\n }\n\n /**\n * @returns {number}\n */\n get code() {\n return this.expr.charCodeAt(this.index);\n }\n /**\n * @param {string} expr a string with the passed in express\n * @returns Jsep\n */\n constructor(expr) {\n // `index` stores the character number we are currently at\n // All of the gobbles below will modify `index` as we move along\n this.expr = expr;\n this.index = 0;\n }\n\n /**\n * static top-level parser\n * @returns {jsep.Expression}\n */\n static parse(expr) {\n return new Jsep(expr).parse();\n }\n\n /**\n * Get the longest key length of any object\n * @param {object} obj\n * @returns {number}\n */\n static getMaxKeyLen(obj) {\n return Math.max(0, ...Object.keys(obj).map(k => k.length));\n }\n\n /**\n * `ch` is a character code in the next three functions\n * @param {number} ch\n * @returns {boolean}\n */\n static isDecimalDigit(ch) {\n return ch >= 48 && ch <= 57; // 0...9\n }\n\n /**\n * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.\n * @param {string} op_val\n * @returns {number}\n */\n static binaryPrecedence(op_val) {\n return Jsep.binary_ops[op_val] || 0;\n }\n\n /**\n * Looks for start of identifier\n * @param {number} ch\n * @returns {boolean}\n */\n static isIdentifierStart(ch) {\n return ch >= 65 && ch <= 90 ||\n // A...Z\n ch >= 97 && ch <= 122 ||\n // a...z\n ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)] ||\n // any non-ASCII that is not an operator\n Jsep.additional_identifier_chars.has(String.fromCharCode(ch)); // additional characters\n }\n\n /**\n * @param {number} ch\n * @returns {boolean}\n */\n static isIdentifierPart(ch) {\n return Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);\n }\n\n /**\n * throw error at index of the expression\n * @param {string} message\n * @throws\n */\n throwError(message) {\n const error = new Error(message + ' at character ' + this.index);\n error.index = this.index;\n error.description = message;\n throw error;\n }\n\n /**\n * Run a given hook\n * @param {string} name\n * @param {jsep.Expression|false} [node]\n * @returns {?jsep.Expression}\n */\n runHook(name, node) {\n if (Jsep.hooks[name]) {\n const env = {\n context: this,\n node\n };\n Jsep.hooks.run(name, env);\n return env.node;\n }\n return node;\n }\n\n /**\n * Runs a given hook until one returns a node\n * @param {string} name\n * @returns {?jsep.Expression}\n */\n searchHook(name) {\n if (Jsep.hooks[name]) {\n const env = {\n context: this\n };\n Jsep.hooks[name].find(function (callback) {\n callback.call(env.context, env);\n return env.node;\n });\n return env.node;\n }\n }\n\n /**\n * Push `index` up to the next non-space character\n */\n gobbleSpaces() {\n let ch = this.code;\n // Whitespace\n while (ch === Jsep.SPACE_CODE || ch === Jsep.TAB_CODE || ch === Jsep.LF_CODE || ch === Jsep.CR_CODE) {\n ch = this.expr.charCodeAt(++this.index);\n }\n this.runHook('gobble-spaces');\n }\n\n /**\n * Top-level method to parse all expressions and returns compound or single node\n * @returns {jsep.Expression}\n */\n parse() {\n this.runHook('before-all');\n const nodes = this.gobbleExpressions();\n\n // If there's only one expression just try returning the expression\n const node = nodes.length === 1 ? nodes[0] : {\n type: Jsep.COMPOUND,\n body: nodes\n };\n return this.runHook('after-all', node);\n }\n\n /**\n * top-level parser (but can be reused within as well)\n * @param {number} [untilICode]\n * @returns {jsep.Expression[]}\n */\n gobbleExpressions(untilICode) {\n let nodes = [],\n ch_i,\n node;\n while (this.index < this.expr.length) {\n ch_i = this.code;\n\n // Expressions can be separated by semicolons, commas, or just inferred without any\n // separators\n if (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {\n this.index++; // ignore separators\n } else {\n // Try to gobble each expression individually\n if (node = this.gobbleExpression()) {\n nodes.push(node);\n // If we weren't able to find a binary expression and are out of room, then\n // the expression passed in probably has too much\n } else if (this.index < this.expr.length) {\n if (ch_i === untilICode) {\n break;\n }\n this.throwError('Unexpected \"' + this.char + '\"');\n }\n }\n }\n return nodes;\n }\n\n /**\n * The main parsing function.\n * @returns {?jsep.Expression}\n */\n gobbleExpression() {\n const node = this.searchHook('gobble-expression') || this.gobbleBinaryExpression();\n this.gobbleSpaces();\n return this.runHook('after-expression', node);\n }\n\n /**\n * Search for the operation portion of the string (e.g. `+`, `===`)\n * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)\n * and move down from 3 to 2 to 1 character until a matching binary operation is found\n * then, return that binary operation\n * @returns {string|boolean}\n */\n gobbleBinaryOp() {\n this.gobbleSpaces();\n let to_check = this.expr.substr(this.index, Jsep.max_binop_len);\n let tc_len = to_check.length;\n while (tc_len > 0) {\n // Don't accept a binary op when it is an identifier.\n // Binary ops that start with a identifier-valid character must be followed\n // by a non identifier-part valid character\n if (Jsep.binary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {\n this.index += tc_len;\n return to_check;\n }\n to_check = to_check.substr(0, --tc_len);\n }\n return false;\n }\n\n /**\n * This function is responsible for gobbling an individual expression,\n * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`\n * @returns {?jsep.BinaryExpression}\n */\n gobbleBinaryExpression() {\n let node, biop, prec, stack, biop_info, left, right, i, cur_biop;\n\n // First, try to get the leftmost thing\n // Then, check to see if there's a binary operator operating on that leftmost thing\n // Don't gobbleBinaryOp without a left-hand-side\n left = this.gobbleToken();\n if (!left) {\n return left;\n }\n biop = this.gobbleBinaryOp();\n\n // If there wasn't a binary operator, just return the leftmost node\n if (!biop) {\n return left;\n }\n\n // Otherwise, we need to start a stack to properly place the binary operations in their\n // precedence structure\n biop_info = {\n value: biop,\n prec: Jsep.binaryPrecedence(biop),\n right_a: Jsep.right_associative.has(biop)\n };\n right = this.gobbleToken();\n if (!right) {\n this.throwError(\"Expected expression after \" + biop);\n }\n stack = [left, biop_info, right];\n\n // Properly deal with precedence using [recursive descent](http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm)\n while (biop = this.gobbleBinaryOp()) {\n prec = Jsep.binaryPrecedence(biop);\n if (prec === 0) {\n this.index -= biop.length;\n break;\n }\n biop_info = {\n value: biop,\n prec,\n right_a: Jsep.right_associative.has(biop)\n };\n cur_biop = biop;\n\n // Reduce: make a binary expression from the three topmost entries.\n const comparePrev = prev => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;\n while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {\n right = stack.pop();\n biop = stack.pop().value;\n left = stack.pop();\n node = {\n type: Jsep.BINARY_EXP,\n operator: biop,\n left,\n right\n };\n stack.push(node);\n }\n node = this.gobbleToken();\n if (!node) {\n this.throwError(\"Expected expression after \" + cur_biop);\n }\n stack.push(biop_info, node);\n }\n i = stack.length - 1;\n node = stack[i];\n while (i > 1) {\n node = {\n type: Jsep.BINARY_EXP,\n operator: stack[i - 1].value,\n left: stack[i - 2],\n right: node\n };\n i -= 2;\n }\n return node;\n }\n\n /**\n * An individual part of a binary expression:\n * e.g. `foo.bar(baz)`, `1`, `\"abc\"`, `(a % 2)` (because it's in parenthesis)\n * @returns {boolean|jsep.Expression}\n */\n gobbleToken() {\n let ch, to_check, tc_len, node;\n this.gobbleSpaces();\n node = this.searchHook('gobble-token');\n if (node) {\n return this.runHook('after-token', node);\n }\n ch = this.code;\n if (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {\n // Char code 46 is a dot `.` which can start off a numeric literal\n return this.gobbleNumericLiteral();\n }\n if (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {\n // Single or double quotes\n node = this.gobbleStringLiteral();\n } else if (ch === Jsep.OBRACK_CODE) {\n node = this.gobbleArray();\n } else {\n to_check = this.expr.substr(this.index, Jsep.max_unop_len);\n tc_len = to_check.length;\n while (tc_len > 0) {\n // Don't accept an unary op when it is an identifier.\n // Unary ops that start with a identifier-valid character must be followed\n // by a non identifier-part valid character\n if (Jsep.unary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {\n this.index += tc_len;\n const argument = this.gobbleToken();\n if (!argument) {\n this.throwError('missing unaryOp argument');\n }\n return this.runHook('after-token', {\n type: Jsep.UNARY_EXP,\n operator: to_check,\n argument,\n prefix: true\n });\n }\n to_check = to_check.substr(0, --tc_len);\n }\n if (Jsep.isIdentifierStart(ch)) {\n node = this.gobbleIdentifier();\n if (Jsep.literals.hasOwnProperty(node.name)) {\n node = {\n type: Jsep.LITERAL,\n value: Jsep.literals[node.name],\n raw: node.name\n };\n } else if (node.name === Jsep.this_str) {\n node = {\n type: Jsep.THIS_EXP\n };\n }\n } else if (ch === Jsep.OPAREN_CODE) {\n // open parenthesis\n node = this.gobbleGroup();\n }\n }\n if (!node) {\n return this.runHook('after-token', false);\n }\n node = this.gobbleTokenProperty(node);\n return this.runHook('after-token', node);\n }\n\n /**\n * Gobble properties of of identifiers/strings/arrays/groups.\n * e.g. `foo`, `bar.baz`, `foo['bar'].baz`\n * It also gobbles function calls:\n * e.g. `Math.acos(obj.angle)`\n * @param {jsep.Expression} node\n * @returns {jsep.Expression}\n */\n gobbleTokenProperty(node) {\n this.gobbleSpaces();\n let ch = this.code;\n while (ch === Jsep.PERIOD_CODE || ch === Jsep.OBRACK_CODE || ch === Jsep.OPAREN_CODE || ch === Jsep.QUMARK_CODE) {\n let optional;\n if (ch === Jsep.QUMARK_CODE) {\n if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {\n break;\n }\n optional = true;\n this.index += 2;\n this.gobbleSpaces();\n ch = this.code;\n }\n this.index++;\n if (ch === Jsep.OBRACK_CODE) {\n node = {\n type: Jsep.MEMBER_EXP,\n computed: true,\n object: node,\n property: this.gobbleExpression()\n };\n if (!node.property) {\n this.throwError('Unexpected \"' + this.char + '\"');\n }\n this.gobbleSpaces();\n ch = this.code;\n if (ch !== Jsep.CBRACK_CODE) {\n this.throwError('Unclosed [');\n }\n this.index++;\n } else if (ch === Jsep.OPAREN_CODE) {\n // A function call is being made; gobble all the arguments\n node = {\n type: Jsep.CALL_EXP,\n 'arguments': this.gobbleArguments(Jsep.CPAREN_CODE),\n callee: node\n };\n } else if (ch === Jsep.PERIOD_CODE || optional) {\n if (optional) {\n this.index--;\n }\n this.gobbleSpaces();\n node = {\n type: Jsep.MEMBER_EXP,\n computed: false,\n object: node,\n property: this.gobbleIdentifier()\n };\n }\n if (optional) {\n node.optional = true;\n } // else leave undefined for compatibility with esprima\n\n this.gobbleSpaces();\n ch = this.code;\n }\n return node;\n }\n\n /**\n * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to\n * keep track of everything in the numeric literal and then calling `parseFloat` on that string\n * @returns {jsep.Literal}\n */\n gobbleNumericLiteral() {\n let number = '',\n ch,\n chCode;\n while (Jsep.isDecimalDigit(this.code)) {\n number += this.expr.charAt(this.index++);\n }\n if (this.code === Jsep.PERIOD_CODE) {\n // can start with a decimal marker\n number += this.expr.charAt(this.index++);\n while (Jsep.isDecimalDigit(this.code)) {\n number += this.expr.charAt(this.index++);\n }\n }\n ch = this.char;\n if (ch === 'e' || ch === 'E') {\n // exponent marker\n number += this.expr.charAt(this.index++);\n ch = this.char;\n if (ch === '+' || ch === '-') {\n // exponent sign\n number += this.expr.charAt(this.index++);\n }\n while (Jsep.isDecimalDigit(this.code)) {\n // exponent itself\n number += this.expr.charAt(this.index++);\n }\n if (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {\n this.throwError('Expected exponent (' + number + this.char + ')');\n }\n }\n chCode = this.code;\n\n // Check to make sure this isn't a variable name that start with a number (123abc)\n if (Jsep.isIdentifierStart(chCode)) {\n this.throwError('Variable names cannot start with a number (' + number + this.char + ')');\n } else if (chCode === Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE) {\n this.throwError('Unexpected period');\n }\n return {\n type: Jsep.LITERAL,\n value: parseFloat(number),\n raw: number\n };\n }\n\n /**\n * Parses a string literal, staring with single or double quotes with basic support for escape codes\n * e.g. `\"hello world\"`, `'this is\\nJSEP'`\n * @returns {jsep.Literal}\n */\n gobbleStringLiteral() {\n let str = '';\n const startIndex = this.index;\n const quote = this.expr.charAt(this.index++);\n let closed = false;\n while (this.index < this.expr.length) {\n let ch = this.expr.charAt(this.index++);\n if (ch === quote) {\n closed = true;\n break;\n } else if (ch === '\\\\') {\n // Check for all of the common escape codes\n ch = this.expr.charAt(this.index++);\n switch (ch) {\n case 'n':\n str += '\\n';\n break;\n case 'r':\n str += '\\r';\n break;\n case 't':\n str += '\\t';\n break;\n case 'b':\n str += '\\b';\n break;\n case 'f':\n str += '\\f';\n break;\n case 'v':\n str += '\\x0B';\n break;\n default:\n str += ch;\n }\n } else {\n str += ch;\n }\n }\n if (!closed) {\n this.throwError('Unclosed quote after \"' + str + '\"');\n }\n return {\n type: Jsep.LITERAL,\n value: str,\n raw: this.expr.substring(startIndex, this.index)\n };\n }\n\n /**\n * Gobbles only identifiers\n * e.g.: `foo`, `_value`, `$x1`\n * Also, this function checks if that identifier is a literal:\n * (e.g. `true`, `false`, `null`) or `this`\n * @returns {jsep.Identifier}\n */\n gobbleIdentifier() {\n let ch = this.code,\n start = this.index;\n if (Jsep.isIdentifierStart(ch)) {\n this.index++;\n } else {\n this.throwError('Unexpected ' + this.char);\n }\n while (this.index < this.expr.length) {\n ch = this.code;\n if (Jsep.isIdentifierPart(ch)) {\n this.index++;\n } else {\n break;\n }\n }\n return {\n type: Jsep.IDENTIFIER,\n name: this.expr.slice(start, this.index)\n };\n }\n\n /**\n * Gobbles a list of arguments within the context of a function call\n * or array literal. This function also assumes that the opening character\n * `(` or `[` has already been gobbled, and gobbles expressions and commas\n * until the terminator character `)` or `]` is encountered.\n * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`\n * @param {number} termination\n * @returns {jsep.Expression[]}\n */\n gobbleArguments(termination) {\n const args = [];\n let closed = false;\n let separator_count = 0;\n while (this.index < this.expr.length) {\n this.gobbleSpaces();\n let ch_i = this.code;\n if (ch_i === termination) {\n // done parsing\n closed = true;\n this.index++;\n if (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {\n this.throwError('Unexpected token ' + String.fromCharCode(termination));\n }\n break;\n } else if (ch_i === Jsep.COMMA_CODE) {\n // between expressions\n this.index++;\n separator_count++;\n if (separator_count !== args.length) {\n // missing argument\n if (termination === Jsep.CPAREN_CODE) {\n this.throwError('Unexpected token ,');\n } else if (termination === Jsep.CBRACK_CODE) {\n for (let arg = args.length; arg < separator_count; arg++) {\n args.push(null);\n }\n }\n }\n } else if (args.length !== separator_count && separator_count !== 0) {\n // NOTE: `&& separator_count !== 0` allows for either all commas, or all spaces as arguments\n this.throwError('Expected comma');\n } else {\n const node = this.gobbleExpression();\n if (!node || node.type === Jsep.COMPOUND) {\n this.throwError('Expected comma');\n }\n args.push(node);\n }\n }\n if (!closed) {\n this.throwError('Expected ' + String.fromCharCode(termination));\n }\n return args;\n }\n\n /**\n * Responsible for parsing a group of things within parentheses `()`\n * that have no identifier in front (so not a function call)\n * This function assumes that it needs to gobble the opening parenthesis\n * and then tries to gobble everything within that parenthesis, assuming\n * that the next thing it should see is the close parenthesis. If not,\n * then the expression probably doesn't have a `)`\n * @returns {boolean|jsep.Expression}\n */\n gobbleGroup() {\n this.index++;\n let nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);\n if (this.code === Jsep.CPAREN_CODE) {\n this.index++;\n if (nodes.length === 1) {\n return nodes[0];\n } else if (!nodes.length) {\n return false;\n } else {\n return {\n type: Jsep.SEQUENCE_EXP,\n expressions: nodes\n };\n }\n } else {\n this.throwError('Unclosed (');\n }\n }\n\n /**\n * Responsible for parsing Array literals `[1, 2, 3]`\n * This function assumes that it needs to gobble the opening bracket\n * and then tries to gobble the expressions as arguments.\n * @returns {jsep.ArrayExpression}\n */\n gobbleArray() {\n this.index++;\n return {\n type: Jsep.ARRAY_EXP,\n elements: this.gobbleArguments(Jsep.CBRACK_CODE)\n };\n }\n}\n\n// Static fields:\nconst hooks = new Hooks();\nObject.assign(Jsep, {\n hooks,\n plugins: new Plugins(Jsep),\n // Node Types\n // ----------\n // This is the full set of types that any JSEP node can be.\n // Store them here to save space when minified\n COMPOUND: 'Compound',\n SEQUENCE_EXP: 'SequenceExpression',\n IDENTIFIER: 'Identifier',\n MEMBER_EXP: 'MemberExpression',\n LITERAL: 'Literal',\n THIS_EXP: 'ThisExpression',\n CALL_EXP: 'CallExpression',\n UNARY_EXP: 'UnaryExpression',\n BINARY_EXP: 'BinaryExpression',\n ARRAY_EXP: 'ArrayExpression',\n TAB_CODE: 9,\n LF_CODE: 10,\n CR_CODE: 13,\n SPACE_CODE: 32,\n PERIOD_CODE: 46,\n // '.'\n COMMA_CODE: 44,\n // ','\n SQUOTE_CODE: 39,\n // single quote\n DQUOTE_CODE: 34,\n // double quotes\n OPAREN_CODE: 40,\n // (\n CPAREN_CODE: 41,\n // )\n OBRACK_CODE: 91,\n // [\n CBRACK_CODE: 93,\n // ]\n QUMARK_CODE: 63,\n // ?\n SEMCOL_CODE: 59,\n // ;\n COLON_CODE: 58,\n // :\n\n // Operations\n // ----------\n // Use a quickly-accessible map to store all of the unary operators\n // Values are set to `1` (it really doesn't matter)\n unary_ops: {\n '-': 1,\n '!': 1,\n '~': 1,\n '+': 1\n },\n // Also use a map for the binary operations but set their values to their\n // binary precedence for quick reference (higher number = higher precedence)\n // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)\n binary_ops: {\n '||': 1,\n '??': 1,\n '&&': 2,\n '|': 3,\n '^': 4,\n '&': 5,\n '==': 6,\n '!=': 6,\n '===': 6,\n '!==': 6,\n '<': 7,\n '>': 7,\n '<=': 7,\n '>=': 7,\n '<<': 8,\n '>>': 8,\n '>>>': 8,\n '+': 9,\n '-': 9,\n '*': 10,\n '/': 10,\n '%': 10,\n '**': 11\n },\n // sets specific binary_ops as right-associative\n right_associative: new Set(['**']),\n // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)\n additional_identifier_chars: new Set(['$', '_']),\n // Literals\n // ----------\n // Store the values to return for the various literals we may encounter\n literals: {\n 'true': true,\n 'false': false,\n 'null': null\n },\n // Except for `this`, which is special. This could be changed to something like `'self'` as well\n this_str: 'this'\n});\nJsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);\nJsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);\n\n// Backward Compatibility:\nconst jsep = expr => new Jsep(expr).parse();\nconst stdClassProps = Object.getOwnPropertyNames(class Test {});\nObject.getOwnPropertyNames(Jsep).filter(prop => !stdClassProps.includes(prop) && jsep[prop] === undefined).forEach(m => {\n jsep[m] = Jsep[m];\n});\njsep.Jsep = Jsep; // allows for const { Jsep } = require('jsep');\n\nconst CONDITIONAL_EXP = 'ConditionalExpression';\nvar ternary = {\n name: 'ternary',\n init(jsep) {\n // Ternary expression: test ? consequent : alternate\n jsep.hooks.add('after-expression', function gobbleTernary(env) {\n if (env.node && this.code === jsep.QUMARK_CODE) {\n this.index++;\n const test = env.node;\n const consequent = this.gobbleExpression();\n if (!consequent) {\n this.throwError('Expected expression');\n }\n this.gobbleSpaces();\n if (this.code === jsep.COLON_CODE) {\n this.index++;\n const alternate = this.gobbleExpression();\n if (!alternate) {\n this.throwError('Expected expression');\n }\n env.node = {\n type: CONDITIONAL_EXP,\n test,\n consequent,\n alternate\n };\n\n // check for operators of higher priority than ternary (i.e. assignment)\n // jsep sets || at 1, and assignment at 0.9, and conditional should be between them\n if (test.operator && jsep.binary_ops[test.operator] <= 0.9) {\n let newTest = test;\n while (newTest.right.operator && jsep.binary_ops[newTest.right.operator] <= 0.9) {\n newTest = newTest.right;\n }\n env.node.test = newTest.right;\n newTest.right = env.node;\n env.node = test;\n }\n } else {\n this.throwError('Expected :');\n }\n }\n });\n }\n};\n\n// Add default plugins:\n\njsep.plugins.register(ternary);\n\nconst FSLASH_CODE = 47; // '/'\nconst BSLASH_CODE = 92; // '\\\\'\n\nvar index = {\n name: 'regex',\n init(jsep) {\n // Regex literal: /abc123/ig\n jsep.hooks.add('gobble-token', function gobbleRegexLiteral(env) {\n if (this.code === FSLASH_CODE) {\n const patternIndex = ++this.index;\n let inCharSet = false;\n while (this.index < this.expr.length) {\n if (this.code === FSLASH_CODE && !inCharSet) {\n const pattern = this.expr.slice(patternIndex, this.index);\n let flags = '';\n while (++this.index < this.expr.length) {\n const code = this.code;\n if (code >= 97 && code <= 122 // a...z\n || code >= 65 && code <= 90 // A...Z\n || code >= 48 && code <= 57) {\n // 0-9\n flags += this.char;\n } else {\n break;\n }\n }\n let value;\n try {\n value = new RegExp(pattern, flags);\n } catch (e) {\n this.throwError(e.message);\n }\n env.node = {\n type: jsep.LITERAL,\n value,\n raw: this.expr.slice(patternIndex - 1, this.index)\n };\n\n // allow . [] and () after regex: /regex/.test(a)\n env.node = this.gobbleTokenProperty(env.node);\n return env.node;\n }\n if (this.code === jsep.OBRACK_CODE) {\n inCharSet = true;\n } else if (inCharSet && this.code === jsep.CBRACK_CODE) {\n inCharSet = false;\n }\n this.index += this.code === BSLASH_CODE ? 2 : 1;\n }\n this.throwError('Unclosed Regex');\n }\n });\n }\n};\n\nconst PLUS_CODE = 43; // +\nconst MINUS_CODE = 45; // -\n\nconst plugin = {\n name: 'assignment',\n assignmentOperators: new Set(['=', '*=', '**=', '/=', '%=', '+=', '-=', '<<=', '>>=', '>>>=', '&=', '^=', '|=', '||=', '&&=', '??=']),\n updateOperators: [PLUS_CODE, MINUS_CODE],\n assignmentPrecedence: 0.9,\n init(jsep) {\n const updateNodeTypes = [jsep.IDENTIFIER, jsep.MEMBER_EXP];\n plugin.assignmentOperators.forEach(op => jsep.addBinaryOp(op, plugin.assignmentPrecedence, true));\n jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) {\n const code = this.code;\n if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {\n this.index += 2;\n env.node = {\n type: 'UpdateExpression',\n operator: code === PLUS_CODE ? '++' : '--',\n argument: this.gobbleTokenProperty(this.gobbleIdentifier()),\n prefix: true\n };\n if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {\n this.throwError(`Unexpected ${env.node.operator}`);\n }\n }\n });\n jsep.hooks.add('after-token', function gobbleUpdatePostfix(env) {\n if (env.node) {\n const code = this.code;\n if (plugin.updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) {\n if (!updateNodeTypes.includes(env.node.type)) {\n this.throwError(`Unexpected ${env.node.operator}`);\n }\n this.index += 2;\n env.node = {\n type: 'UpdateExpression',\n operator: code === PLUS_CODE ? '++' : '--',\n argument: env.node,\n prefix: false\n };\n }\n }\n });\n jsep.hooks.add('after-expression', function gobbleAssignment(env) {\n if (env.node) {\n // Note: Binaries can be chained in a single expression to respect\n // operator precedence (i.e. a = b = 1 + 2 + 3)\n // Update all binary assignment nodes in the tree\n updateBinariesToAssignments(env.node);\n }\n });\n function updateBinariesToAssignments(node) {\n if (plugin.assignmentOperators.has(node.operator)) {\n node.type = 'AssignmentExpression';\n updateBinariesToAssignments(node.left);\n updateBinariesToAssignments(node.right);\n } else if (!node.operator) {\n Object.values(node).forEach(val => {\n if (val && typeof val === 'object') {\n updateBinariesToAssignments(val);\n }\n });\n }\n }\n }\n};\n\n/* eslint-disable unicorn/no-top-level-side-effects -- Temporary? */\n/* eslint-disable no-bitwise -- Convenient */\n\n/**\n * @import {EvaluatedResult, UnknownResult} from './jsonpath.js';\n */\n\n/**\n * @typedef {any} AssignmentExpression\n */\n\n/**\n * @typedef {any} Substitution\n */\n\n/**\n * @typedef {any} AnyParameter\n */\n\n/**\n * @typedef {Record<string, Substitution>} Substitutions\n */\n\n// register plugins\njsep.plugins.register(index, plugin);\njsep.addUnaryOp('typeof');\njsep.addUnaryOp('void');\njsep.addLiteral('null', null);\njsep.addLiteral('undefined', undefined);\nconst BLOCKED_PROTO_PROPERTIES = new Set(['constructor', '__proto__', '__defineGetter__', '__defineSetter__', '__lookupGetter__', '__lookupSetter__']);\n\n// Every function-constructor variant, along with the invocation helpers which\n// could otherwise reach them indirectly, e.g., `Function.call(0, 'code')()`,\n// plus whichever BLOCKED_PROTO_PROPERTIES names resolve to an own method on\n// Object.prototype (e.g. `__defineGetter__`) - an own-property access on a\n// shared prototype (`@.prototype.__defineGetter__`) bypasses the\n// inherited-only name check below, so those methods need blocking by value.\n/** @type {WeakSet<object>} */\nconst BLOCKED_FUNCTIONS = new WeakSet([Function,\n// eslint-disable-next-line no-empty-function -- Only need the constructor\nfunction* () {}.constructor,\n// eslint-disable-next-line no-empty-function -- Only need the constructor\nasync function () {}.constructor,\n// eslint-disable-next-line no-empty-function -- Only need the constructor\nasync function* () {}.constructor, Function.prototype.call, Function.prototype.apply, Function.prototype.bind, Reflect.apply, Reflect.construct, ...[...BLOCKED_PROTO_PROPERTIES].map(name => Reflect.get(Object.prototype, name)).filter(value => typeof value === 'function')]);\n\n/**\n * @param {UnknownResult} value\n * @returns {boolean}\n */\nconst isBlockedFunction = value => {\n return typeof value === 'function' && BLOCKED_FUNCTIONS.has(value);\n};\n\n/**\n * Guarded `obj[prop]`, applying the same restrictions as a MemberExpression.\n * @param {UnknownResult} obj\n * @param {string} prop\n * @returns {UnknownResult}\n */\nconst getSafeProperty = (obj, prop) => {\n if (obj === undefined || obj === null) {\n throw new TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);\n }\n if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {\n throw new TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);\n }\n const result = /** @type {Record<string, UnknownResult>} */obj[prop];\n if (isBlockedFunction(result)) {\n throw new TypeError('Function constructor is disabled');\n }\n return result;\n};\n\n/**\n * @typedef {Record<\n * string,\n * (a: AnyParameter, b: AnyParameter) => UnknownResult\n * >} OperatorTable\n */\n\n// eslint-disable-next-line @stylistic/max-len -- Long\nconst BINOPS = Object.assign(Object.create(null), /** @type {OperatorTable} */{\n '||': (a, b) => a || b(),\n '??': (a, b) => a ?? b(),\n '&&': (a, b) => a && b(),\n '|': (a, b) => a | b(),\n '^': (a, b) => a ^ b(),\n '&': (a, b) => a & b(),\n // eslint-disable-next-line eqeqeq -- API\n '==': (a, b) => a == b(),\n // eslint-disable-next-line eqeqeq -- API\n '!=': (a, b) => a != b(),\n '===': (a, b) => a === b(),\n '!==': (a, b) => a !== b(),\n '<': (a, b) => a < b(),\n '>': (a, b) => a > b(),\n '<=': (a, b) => a <= b(),\n '>=': (a, b) => a >= b(),\n '<<': (a, b) => a << b(),\n '>>': (a, b) => a >> b(),\n '>>>': (a, b) => a >>> b(),\n '+': (a, b) => a + b(),\n '-': (a, b) => a - b(),\n '*': (a, b) => a * b(),\n '/': (a, b) => a / b(),\n '%': (a, b) => a % b(),\n '**': (a, b) => a ** b()\n});\n\n/**\n * @typedef {{\n * [key: string]: (a: AnyParameter) => UnknownResult\n * }} UnaryOperatorTable\n */\n\n// eslint-disable-next-line @stylistic/max-len -- Long\nconst UNOPS = Object.assign(Object.create(null), /** @type {UnaryOperatorTable} */{\n '-': a => -(/** @type {EvaluatedResult} */a),\n '!': a => !a,\n '~': a => ~(/** @type {EvaluatedResult} */a),\n // eslint-disable-next-line no-implicit-coercion -- API\n '+': a => +(/** @type {EvaluatedResult} */a),\n typeof: a => typeof a,\n void: () => undefined\n});\nconst SafeEval = {\n /**\n * @param {jsep.Expression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalAst(ast, subs) {\n switch (ast.type) {\n case 'BinaryExpression':\n case 'LogicalExpression':\n return SafeEval.evalBinaryExpression(/** @type {jsep.BinaryExpression} */ast, subs);\n case 'Compound':\n return SafeEval.evalCompound(/** @type {jsep.Compound} */ast, subs);\n case 'ConditionalExpression':\n return SafeEval.evalConditionalExpression(/** @type {jsep.ConditionalExpression} */ast, subs);\n case 'Identifier':\n return SafeEval.evalIdentifier(/** @type {jsep.Identifier} */ast, subs);\n case 'Literal':\n return SafeEval.evalLiteral(/** @type {jsep.Literal} */ast);\n case 'MemberExpression':\n return SafeEval.evalMemberExpression(/** @type {jsep.MemberExpression} */ast, subs);\n case 'UnaryExpression':\n return SafeEval.evalUnaryExpression(/** @type {jsep.UnaryExpression} */ast, subs);\n case 'ArrayExpression':\n return SafeEval.evalArrayExpression(/** @type {jsep.ArrayExpression} */ast, subs);\n case 'CallExpression':\n return SafeEval.evalCallExpression(/** @type {jsep.CallExpression} */ast, subs);\n case 'AssignmentExpression':\n return SafeEval.evalAssignmentExpression(/** @type {AssignmentExpression} */ast, subs);\n default:\n throw new SyntaxError('Unexpected expression', {\n cause: ast\n });\n }\n },\n /**\n * @param {jsep.BinaryExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalBinaryExpression(ast, subs) {\n /* c8 ignore next 3 -- Defensive guard for malformed ASTs */\n if (!Object.hasOwn(BINOPS, ast.operator)) {\n throw new SyntaxError(`Unknown binary operator: ${ast.operator}`);\n }\n const result = BINOPS[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));\n return result;\n },\n /**\n * @param {jsep.Compound} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalCompound(ast, subs) {\n let last;\n for (let i = 0; i < ast.body.length; i++) {\n if (ast.body[i].type === 'Identifier' && ['var', 'let', 'const'].includes(/** @type {jsep.Identifier} */\n ast.body[i].name) && Object.hasOwn(ast.body, i + 1) && ast.body[i + 1].type === 'AssignmentExpression') {\n // var x=2; is detected as\n // [{Identifier var}, {AssignmentExpression x=2}]\n i += 1;\n }\n const expr = ast.body[i];\n last = SafeEval.evalAst(expr, subs);\n }\n return last;\n },\n /**\n * @param {jsep.ConditionalExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalConditionalExpression(ast, subs) {\n return SafeEval.evalAst(ast.test, subs) ? SafeEval.evalAst(ast.consequent, subs) : SafeEval.evalAst(ast.alternate, subs);\n },\n /**\n * @param {jsep.Identifier} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalIdentifier(ast, subs) {\n if (Object.hasOwn(subs, ast.name)) {\n return subs[ast.name];\n }\n throw new ReferenceError(`${ast.name} is not defined`);\n },\n /**\n * @param {jsep.Literal} ast\n * @returns {UnknownResult}\n */\n evalLiteral(ast) {\n return ast.value;\n },\n /**\n * @param {jsep.MemberExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalMemberExpression(ast, subs) {\n const prop = String(\n // NOTE: `String(value)` throws error when\n // value has overwritten the toString method to return non-string\n // i.e. `value = {toString: () => []}`\n ast.computed ? SafeEval.evalAst(ast.property, subs) // `object[property]`\n : ast.property.name // `object.property` property is Identifier\n );\n const obj = SafeEval.evalAst(ast.object, subs);\n const result = getSafeProperty(obj, prop);\n if (typeof result === 'function') {\n return result.bind(obj); // arrow functions aren't affected by bind.\n }\n return result;\n },\n /**\n * @param {jsep.UnaryExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalUnaryExpression(ast, subs) {\n /* c8 ignore next 3 -- Defensive guard for malformed ASTs */\n if (!Object.hasOwn(UNOPS, ast.operator)) {\n throw new SyntaxError(`Unknown unary operator: ${ast.operator}`);\n }\n const operand = SafeEval.evalAst(ast.argument, subs);\n return UNOPS[ast.operator](operand);\n },\n /**\n * @param {jsep.ArrayExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalArrayExpression(ast, subs) {\n return ast.elements.map(el => SafeEval.evalAst(/** @type {jsep.Expression} */\n el, subs));\n },\n /**\n * @param {jsep.CallExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalCallExpression(ast, subs) {\n const args = ast.arguments.map(arg => SafeEval.evalAst(arg, subs));\n const func = SafeEval.evalAst(ast.callee, subs);\n if (isBlockedFunction(func) || args.some(arg => isBlockedFunction(arg))) {\n throw new Error('Function constructor is disabled');\n }\n return (/** @type {(...args: AnyParameter[]) => UnknownResult} */\n func)(...args);\n },\n /**\n * @param {AssignmentExpression} ast\n * @param {Substitutions} subs\n * @returns {UnknownResult}\n */\n evalAssignmentExpression(ast, subs) {\n if (ast.left.type !== 'Identifier') {\n throw new SyntaxError('Invalid left-hand side in assignment');\n }\n const id = /** @type {jsep.Identifier} */ast.left.name;\n const value = SafeEval.evalAst(ast.right, subs);\n subs[id] = value;\n return subs[id];\n }\n};\n\n/**\n * A replacement for NodeJS' VM.Script which is also {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy} friendly.\n */\nclass SafeScript {\n /**\n * @param {string} expr Expression to evaluate\n */\n constructor(expr) {\n this.code = expr;\n this.ast = /** @type {unknown} */jsep(this.code);\n }\n\n /**\n * @param {object} context Object whose items will be added\n * to evaluation\n * @returns {EvaluatedResult} Result of evaluated code\n */\n runInNewContext(context) {\n // `Object.create(null)` creates a prototypeless object\n const keyMap = Object.assign(Object.create(null), context);\n return SafeEval.evalAst(/** @type {jsep.Expression} */this.ast, keyMap);\n }\n}\n\n/**\n * @param {unknown} val\n */\nconst toStringTag = val => {\n return Object.prototype.toString.call(val).slice(8, -1);\n};\n\n/* eslint-disable camelcase -- Convenient for escaping */\n/* eslint-disable class-methods-use-this -- Consistent monkey-patching */\n/* eslint-disable unicorn/prefer-private-class-fields -- Allow\n monkey-patching */\nconst scriptCache = new Map();\nconst pathCache = new Map();\n\n/**\n * @typedef {any} AnyInput\n */\n\n/**\n * @typedef {((...args: any[]) => any)} SandboxCallback\n */\n\n/**\n * @typedef {any|SandboxCallback} SandboxPropertyValue\n */\n\n/**\n * @typedef {(string|number)[]} ExpressionArray\n */\n\n/**\n * @typedef {\"scalar\"|\"boolean\"|\"string\"|\"undefined\"\n * |\"function\"|\"integer\"|\"number\"|\"nonFinite\"|\"object\"\n * |\"array\"|\"other\"|\"null\"|\"symbol\"|\"Promise\"|\"BigInt\"\n * |\"jsonReference\"} ValueType\n */\n\n/**\n * @typedef {unknown} ParentValue\n */\n\n/**\n * @typedef {unknown} UnknownResult\n */\n\n/**\n * @typedef {string|number|null} ParentProperty\n */\n\n/**\n * @typedef {ReturnObject|string|number|boolean|null|unknown[]\n * |Record<string, unknown>} PreferredOutput\n */\n\n/**\n * Copies array and then pushes item into it.\n * @param {ExpressionArray} arr Array to copy and into which to push\n * @param {string|number} item Array item to add (to end)\n * @returns {ExpressionArray} Copy of the original array\n */\nfunction push(arr, item) {\n arr = arr.slice();\n arr.push(item);\n return arr;\n}\n/**\n * Copies array and then unshifts item into it.\n * @param {string|number} item Array item to add (to beginning)\n * @param {ExpressionArray} arr Array to copy and into which to unshift\n * @returns {ExpressionArray} Copy of the original array\n */\nfunction unshift(item, arr) {\n arr = arr.slice();\n arr.unshift(item);\n return arr;\n}\n\n/**\n * @typedef {object} ReturnObject\n * @property {ExpressionArray|string} path\n * @property {unknown} value\n * @property {ParentValue} parent\n * @property {ParentProperty} parentProperty\n * @property {boolean} [isParentSelector]\n * @property {boolean} [hasArrExpr]\n * @property {ExpressionArray} [expr]\n * @property {string} [pointer]\n */\n\n/**\n * @callback JSONPathCallback\n * @param {any} preferredOutput Using `any` type instead of `PreferredOutput` so\n * that user can supply flexible type\n * @param {\"value\"|\"property\"} type\n * @param {ReturnObject} fullRetObj\n * @returns {void}\n */\n\n/**\n * @callback OtherTypeCallback\n * @param {unknown} val\n * @param {ExpressionArray} path\n * @param {ParentValue} parent\n * @param {string|number|null} parentPropName\n * @param {string} arg\n * @returns {boolean|null}\n */\n\n/**\n * @typedef {any} ContextItem\n */\n\n/**\n * @typedef {any} EvaluatedResult\n */\n\n/**\n * @callback EvalCallback\n * @param {string} code\n * @param {ContextItem} context\n * @returns {EvaluatedResult}\n */\n\n/**\n * @typedef {new (expr: string) => {\n * runInNewContext: (context: object) => EvaluatedResult\n * }} ScriptConstructor\n */\n\n/**\n * @typedef {ScriptConstructor} EvalClass\n */\n\n/**\n * @typedef {\"value\"|\"path\"|\"pointer\"|\"parent\"|\"parentProperty\"\n * |\"all\"} ResultType\n */\n\n/**\n * @typedef {EvalCallback|EvalClass|'safe'|'native'|boolean} EvalValue\n */\n\n/**\n * @typedef {string|string[]} PathType\n */\n\n/**\n * @typedef {{Script: ScriptConstructor}} SafeScriptType\n */\n\n/**\n * @typedef {{Script: ScriptConstructor}} ScriptType\n */\n\n/**\n * @typedef {{\n * _$_path?: string,\n * _$_parentProperty?: ParentProperty,\n * _$_parent?: ParentValue,\n * _$_property?: string|number,\n * _$_root?: AnyInput,\n * _$_v?: unknown,\n * [key: string]: SandboxPropertyValue\n * }} SandboxType\n */\n\n/**\n * @typedef {object} JSONPathOptions\n * @property {AnyInput} [json]\n * @property {PathType} [path]\n * @property {ResultType} [resultType=\"value\"]\n * @property {boolean} [flatten=false]\n * @property {boolean} [wrap=true]\n * @property {SandboxType} [sandbox={}]\n * @property {EvalValue} [eval='safe']\n * @property {any|null} [parent=null]\n * @property {ParentProperty} [parentProperty=null]\n * @property {JSONPathCallback} [callback]\n * @property {OtherTypeCallback} [otherTypeCallback] Defaults to\n * function which throws on encountering `@other`\n * @property {Record<string, OtherTypeCallback>} [customTypes] Map of\n * custom type operator names to their evaluation callbacks\n * @property {boolean} [autostart=true]\n * @property {boolean} [ignoreEvalErrors=false]\n */\n\n/**\n * @overload\n * @param {string} opts JSON path to evaluate\n * @param {AnyInput} [expr] JSON object to evaluate against\n * @param {JSONPathCallback} [obj] Passed 3 arguments: 1) desired\n * payload per `resultType`, 2) `\"value\"|\"property\"`, 3) Full returned\n * object with all payloads\n * @param {OtherTypeCallback} [callback] If `@other()` is at the\n * end of one's query, this will be invoked with the value of the item,\n * its path, its parent, and its parent's property name, and it should\n * return a boolean indicating whether the supplied value belongs to the\n * \"other\" type or not (or it may handle transformations and return\n * `false`).\n * @param {undefined} [otherTypeCallback]\n * @returns {unknown} The string form always has `autostart` implicitly\n * `true`, so the result is the evaluated value, not a `JSONPathClass`\n */\n/**\n * @overload\n * @param {JSONPathOptions & {autostart: false}} opts An options object\n * with `autostart` explicitly set to `false` defers evaluation and\n * returns the `JSONPathClass` instance instead\n * @returns {JSONPathClass}\n */\n/**\n * @overload\n * @param {JSONPathOptions} opts If a string, will be treated as\n * `expr`\n * @returns {unknown}\n */\n/**\n * @param {JSONPathOptions|string} opts If a string, will be treated as `expr`\n * @param {string|AnyInput} [expr] JSON path to evaluate\n * @param {AnyInput|JSONPathCallback} [obj] JSON object to evaluate against\n * @param {JSONPathCallback|OtherTypeCallback} [callback] Passed 3\n * arguments: 1) desired payload per `resultType`,\n * 2) `\"value\"|\"property\"`, 3) Full returned object with\n * all payloads\n * @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the end\n * of one's query, this will be invoked with the value of the item, its\n * path, its parent, and its parent's property name, and it should return\n * a boolean indicating whether the supplied value belongs to the \"other\"\n * type or not (or it may handle transformations and return `false`).\n * @throws {Error}\n * @returns {unknown|JSONPathClass}\n */\nfunction JSONPath(opts, expr, obj, callback, otherTypeCallback) {\n try {\n if (opts && typeof opts === 'object') {\n return new JSONPathClass(opts);\n }\n return new JSONPathClass(opts, expr, /** @type {JSONPathCallback|undefined} */obj, /** @type {OtherTypeCallback|undefined} */callback, /** @type {undefined} */otherTypeCallback);\n } catch (e) {\n if (new.target) {\n throw e;\n }\n if (e && typeof e === 'object' && 'value' in e) {\n return /** @type {{value: UnknownResult}} */e.value;\n }\n throw e;\n }\n}\n\n/**\n *\n */\nclass JSONPathClass {\n /**\n * @overload\n * @param {string} opts JSON path to evaluate\n * @param {AnyInput} [expr] JSON object to evaluate against\n * @param {JSONPathCallback} [obj] Passed 3 arguments: 1) desired\n * payload per `resultType`, 2) `\"value\"|\"property\"`, 3) Full returned\n * object with all payloads\n * @param {OtherTypeCallback} [callback] If `@other()` is at the\n * end of one's query, this will be invoked with the value of the item,\n * its path, its parent, and its parent's property name, and it should\n * return a boolean indicating whether the supplied value belongs to the\n * \"other\" type or not (or it may handle transformations and return\n * `false`).\n * @param {undefined} [otherTypeCallback]\n */\n /**\n * @overload\n * @param {JSONPathOptions} opts If a string, will be treated as\n * `expr`\n */\n /**\n * @param {null|string|JSONPathOptions} opts If a string, will be treated as\n * `expr`\n * @param {string|AnyInput} [expr] JSON path to evaluate\n * @param {AnyInput|JSONPathCallback} [obj] JSON object to evaluate against\n * @param {JSONPathCallback|OtherTypeCallback} [callback] Passed 3\n * arguments: 1) desired payload per `resultType`,\n * 2) `\"value\"|\"property\"`, 3) Full returned\n * object with all payloads\n * @param {OtherTypeCallback} [otherTypeCallback] If `@other()` is at the\n * end of one's query, this will be invoked with the value of the item,\n * its path, its parent, and its parent's property name, and it should\n * return a boolean indicating whether the supplied value belongs to the\n * \"other\" type or not (or it may handle transformations and return\n * `false`).\n */\n constructor(opts, expr, obj, callback, otherTypeCallback) {\n if (typeof opts === 'string') {\n otherTypeCallback = /** @type {OtherTypeCallback} */\n callback;\n callback = /** @type {JSONPathCallback} */\n obj;\n obj = expr;\n expr = opts;\n opts = null;\n }\n const optObj = opts && typeof opts === 'object';\n opts ||= /** @type {JSONPathOptions} */{};\n /** @type {ResultType|undefined} */\n this.currResultType = undefined;\n\n /** @type {EvalValue|undefined} */\n this.currEval = undefined;\n\n /** @type {OtherTypeCallback|undefined} */\n this.currOtherTypeCallback = undefined;\n\n /** @type {Record<string, OtherTypeCallback>|undefined} */\n this.currCustomTypes = undefined;\n\n /** @type {SandboxType|undefined} */\n this.currSandbox = undefined;\n this._hasParentSelector = false;\n this.json = opts.json || obj;\n this.path = opts.path || expr;\n this.resultType = opts.resultType || 'value';\n this.flatten = Object.hasOwn(opts, 'flatten') && opts.flatten;\n this.wrap = !Object.hasOwn(opts, 'wrap') || opts.wrap;\n this.sandbox = opts.sandbox || {};\n this.eval = opts.eval === undefined ? 'safe' : opts.eval;\n this.ignoreEvalErrors = typeof opts.ignoreEvalErrors !== 'undefined' && opts.ignoreEvalErrors;\n this.parent = Object.hasOwn(opts, 'parent') ? opts.parent : null;\n this.parentProperty = Object.hasOwn(opts, 'parentProperty') ? opts.parentProperty : null;\n this.callback = opts.callback || (/** @type {JSONPathCallback} */\n callback) || null;\n this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function () {\n throw new TypeError('You must supply an otherTypeCallback callback option ' + 'with the @other() operator.');\n };\n this.customTypes = opts.customTypes || {};\n if (opts.autostart === false) {\n return;\n }\n const args = /** @type {JSONPathOptions} */{\n path: optObj ? opts.path : expr\n };\n if (!optObj && obj !== undefined) {\n args.json = obj;\n } else if ('json' in opts) {\n args.json = opts.json;\n }\n const ret = this.evaluate(args);\n if (!ret || typeof ret !== 'object') {\n const err = /** @type {Error & {value: UnknownResult}} */\n new Error('JSONPath should not be called with \"new\" (it ' + 'prevents return of (unwrapped) scalar values)');\n err.value = ret;\n throw err;\n }\n\n // @ts-expect-error - Constructor returns evaluate result for legacy API\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line consistent-return, no-constructor-return -- Legacy API\n return ret;\n }\n\n // PUBLIC METHODS\n\n /**\n * @overload\n * @param {JSONPathOptions} [expr]\n * @returns {ReturnObject|ReturnObject[]|undefined|unknown}\n */\n\n /**\n * @overload\n * @param {PathType|undefined} [expr]\n * @param {AnyInput} [json]\n * @param {JSONPathCallback|null} [callback]\n * @param {OtherTypeCallback} [otherTypeCallback]\n * @returns {ReturnObject|ReturnObject[]|undefined|unknown}\n */\n\n /**\n * @param {PathType|JSONPathOptions|undefined} [expr]\n * @param {AnyInput} [json]\n * @param {JSONPathCallback|null} [callback]\n * @param {OtherTypeCallback} [otherTypeCallback]\n * @returns {ReturnObject|ReturnObject[]|undefined|unknown}\n */\n evaluate(expr, json, callback, otherTypeCallback) {\n let currParent = this.parent,\n currParentProperty = this.parentProperty;\n let {\n flatten,\n wrap\n } = this;\n this.currResultType = this.resultType;\n this.currEval = this.eval;\n this.currSandbox = this.sandbox;\n callback ||= this.callback;\n this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;\n this.currCustomTypes = this.customTypes;\n if (expr && typeof expr === 'object' && !Array.isArray(expr)) {\n const exprObj = expr;\n if (!exprObj.path && exprObj.path !== '') {\n throw new TypeError('You must supply a \"path\" property when providing an ' + 'object argument to JSONPath.evaluate().');\n }\n if (!Object.hasOwn(exprObj, 'json')) {\n throw new TypeError('You must supply a \"json\" property when providing an ' + 'object argument to JSONPath.evaluate().');\n }\n ({\n json\n } = exprObj);\n flatten = Object.hasOwn(exprObj, 'flatten') ? exprObj.flatten : flatten;\n this.currResultType = Object.hasOwn(exprObj, 'resultType') ? exprObj.resultType : this.currResultType;\n this.currSandbox = Object.hasOwn(exprObj, 'sandbox') ? exprObj.sandbox : this.currSandbox;\n wrap = Object.hasOwn(exprObj, 'wrap') ? exprObj.wrap : wrap;\n this.currEval = Object.hasOwn(exprObj, 'eval') ? exprObj.eval : this.currEval;\n callback = Object.hasOwn(exprObj, 'callback') ? exprObj.callback : callback;\n this.currOtherTypeCallback = Object.hasOwn(exprObj, 'otherTypeCallback') ? exprObj.otherTypeCallback : this.currOtherTypeCallback;\n this.currCustomTypes = Object.hasOwn(exprObj, 'customTypes') ? exprObj.customTypes : this.currCustomTypes;\n currParent = Object.hasOwn(exprObj, 'parent') ? exprObj.parent : currParent;\n currParentProperty = Object.hasOwn(exprObj, 'parentProperty') ? exprObj.parentProperty : currParentProperty;\n expr = exprObj.path;\n } else {\n json ||= this.json;\n expr ||= this.path;\n }\n currParent ||= null;\n currParentProperty ||= null;\n if (Array.isArray(expr)) {\n expr = JSONPath.toPathString(expr);\n }\n if (!json || !expr && expr !== '') {\n return undefined;\n }\n const exprList = JSONPath.toPathArray(/** @type {string} */\n expr);\n if (exprList[0] === '$' && exprList.length > 1) {\n exprList.shift();\n }\n this._hasParentSelector = false;\n const traceResult = this._trace(exprList, json, ['$'], currParent, currParentProperty, callback ?? undefined, undefined);\n\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* c8 ignore next 2 -- Unreachable: _trace returns array when hasArrExpr set */\n const result = (Array.isArray(traceResult) ? traceResult : [traceResult]).filter(ea => {\n return ea && !ea.isParentSelector;\n });\n if (!result.length) {\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* c8 ignore next -- Unreachable: valid queries always produce results */\n return wrap ? [] : undefined;\n }\n if (!wrap && result.length === 1 && !result[0].hasArrExpr) {\n const preferredOutput = this._getPreferredOutput(result[0]);\n return preferredOutput;\n }\n const reduced = result.reduce((rslt, ea) => {\n const valOrPath = this._getPreferredOutput(ea);\n if (flatten && Array.isArray(valOrPath)) {\n rslt = rslt.concat(valOrPath);\n } else {\n rslt.push(valOrPath);\n }\n return rslt;\n }, /** @type {UnknownResult[]} */\n []);\n return reduced;\n }\n\n // PRIVATE METHODS\n\n /**\n * @param {ReturnObject} ea\n * @returns {PreferredOutput}\n */\n _getPreferredOutput(ea) {\n const resultType = this.currResultType;\n switch (resultType) {\n case 'all':\n {\n const path = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);\n ea.pointer = JSONPath.toPointer(/** @type {string[]} */path);\n ea.path = typeof ea.path === 'string' ? ea.path : JSONPath.toPathString(/** @type {string[]} */ea.path);\n return ea;\n }\n case 'value':\n case 'parent':\n case 'parentProperty':\n return /** @type {PreferredOutput} */ea[resultType];\n case 'path':\n if (typeof ea.path === 'string') {\n return ea.path;\n }\n return JSONPath.toPathString(/** @type {string[]} */ea.path);\n case 'pointer':\n {\n const pathArray = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);\n return JSONPath.toPointer(/** @type {string[]} */pathArray);\n }\n default:\n throw new TypeError('Unknown result type');\n }\n }\n\n /**\n * @param {ReturnObject} fullRetObj\n * @param {JSONPathCallback|undefined} callback\n * @param {\"value\"|\"property\"} type\n * @returns {void}\n */\n _handleCallback(fullRetObj, callback, type) {\n // Early return if no callback provided (defensive\n // check for internal calls)\n if (!callback) {\n return;\n }\n const preferredOutput = this._getPreferredOutput(fullRetObj);\n if (Array.isArray(fullRetObj.path)) {\n fullRetObj.path = JSONPath.toPathString(/** @type {string[]} */fullRetObj.path);\n }\n callback(preferredOutput, type, fullRetObj);\n }\n\n /**\n *\n * @param {ExpressionArray} expr\n * @param {unknown} val\n * @param {ExpressionArray} path\n * @param {ParentValue} parent\n * @param {ParentProperty} parentPropName\n * @param {JSONPathCallback|undefined} callback\n * @param {boolean|undefined} hasArrExpr\n * @param {boolean} [literalPriority]\n * @returns {ReturnObject|ReturnObject[]}\n */\n _trace(expr, val, path, parent, parentPropName, callback, hasArrExpr, literalPriority) {\n // No expr to follow? return path and value as the result of\n // this trace branch\n let retObj;\n if (!expr.length) {\n retObj = {\n path,\n value: val,\n parent,\n parentProperty: parentPropName,\n hasArrExpr\n };\n this._handleCallback(retObj, callback, 'value');\n return retObj;\n }\n const loc = /** @type {string} */expr[0],\n x = expr.slice(1);\n\n // We need to gather the return value of recursive trace calls in order\n // to do the parent sel computation.\n /** @type {ReturnObject[]} */\n const ret = [];\n /**\n *\n * @param {ReturnObject|ReturnObject[]} elems\n * @returns {void}\n */\n function addRet(elems) {\n if (Array.isArray(elems)) {\n // This was causing excessive stack size in Node (with or\n // without Babel) against our performance test:\n // `ret.push(...elems);`\n elems.forEach(t => {\n ret.push(t);\n });\n } else {\n ret.push(elems);\n }\n }\n if (val && (typeof loc !== 'string' || literalPriority) && Object.hasOwn(val, /** @type {PropertyKey} */loc)) {\n // simple case--directly follow property\n const valObj = /** @type {Record<string, unknown>} */val;\n addRet(this._trace(x, valObj[(/** @type {string} */loc)], push(path, loc), val, /** @type {string|number} */loc, callback, hasArrExpr));\n // eslint-disable-next-line unicorn/prefer-switch -- Part of larger `if`\n } else if (loc === '*') {\n // all child properties\n this._walk(val, m => {\n const valObj = /** @type {Record<string, unknown>} */val;\n addRet(this._trace(x, valObj[m], push(path, m), val, m, callback, true, true));\n });\n } else if (loc === '..') {\n // all descendent parent properties\n // Check remaining expression with val's immediate children\n addRet(this._trace(x, val, path, parent, parentPropName, callback, hasArrExpr));\n this._walk(val, m => {\n // We don't join m and x here because we only want parents,\n // not scalar values\n const valObj = /** @type {Record<string, unknown>} */val;\n if (typeof valObj[m] === 'object') {\n // Keep going with recursive descent on val's\n // object children\n addRet(this._trace(expr.slice(), valObj[m], push(path, m), val, m, callback, true));\n }\n });\n // The parent sel computation is handled in the frame above using the\n // ancestor object of val\n } else if (loc === '^') {\n // This is not a final endpoint, so we do not invoke the\n // callback here\n this._hasParentSelector = true;\n return /** @type {ReturnObject} */{\n path: path.slice(0, -1),\n expr: x,\n isParentSelector: true,\n value: undefined,\n parent: undefined,\n parentProperty: null\n };\n } else if (loc === '~') {\n // property name\n retObj = {\n path: push(path, loc),\n value: parentPropName,\n parent,\n parentProperty: null\n };\n this._handleCallback(retObj, callback, 'property');\n return retObj;\n } else if (loc === '$') {\n // root only\n addRet(this._trace(x, val, path, null, null, callback, hasArrExpr));\n } else if (/^(-?\\d*):(-?\\d*):?(\\d*)$/v.test(loc)) {\n // [start:end:step] Python slice syntax\n const sliceResult = this._slice(loc, x, val, path, parent, parentPropName, callback);\n if (sliceResult) {\n addRet(sliceResult);\n }\n } else if (loc.indexOf('?(') === 0) {\n // [?(expr)] (filtering)\n if (this.currEval === false) {\n throw new Error('Eval [?(expr)] prevented in JSONPath expression.');\n }\n const safeLoc = loc.replace(/^\\?\\((.*?)\\)$/v, '$1');\n // check for a nested filter expression\n\n const nested = /@.?([^?]*)[\\['](\\??\\(.*?\\))(?!.\\)\\])[\\]']/gv.exec(safeLoc);\n if (nested) {\n // find if there are matches in the nested expression\n // add them to the result set if there is at least one match\n this._walk(val, m => {\n const npath = [nested[2]];\n const valObj2 = /** @type {Record<string, unknown>} */\n val;\n // guard against nested[1] resolving to `constructor`\n const nvalue = /** @type {ValueType} */nested[1] ? getSafeProperty(/** @type {Record<string, unknown>} */\n valObj2[m], nested[1]) : valObj2[m];\n const filterResults = this._trace(npath, nvalue, path, parent, parentPropName, callback, true);\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* c8 ignore next 3 -- Unreachable: _trace always returns array for nested filters */\n const filterArray = Array.isArray(filterResults) ? filterResults : [filterResults];\n if (filterArray.length > 0) {\n addRet(this._trace(x, valObj2[m], push(path, m), val, m, callback, true));\n }\n });\n } else {\n const valObj3 = /** @type {Record<string, unknown>} */val;\n this._walk(val, m => {\n if (this._eval(safeLoc, valObj3[m], m, path, parent, parentPropName)) {\n addRet(this._trace(x, valObj3[m], push(path, m), val, m, callback, true));\n }\n });\n }\n } else if (loc[0] === '(') {\n // [(expr)] (dynamic property/index)\n if (this.currEval === false) {\n throw new Error('Eval [(expr)] prevented in JSONPath expression.');\n }\n // As this will resolve to a property name (but we don't know it\n // yet), property and parent information is relative to the\n const evalResult = this._eval(/** @type {string} */loc, val, /** @type {string|number} */path.at(-1), path.slice(0, -1), parent, parentPropName);\n const exprToUse = /** @type {string|number} */\n evalResult !== undefined ? evalResult : '';\n addRet(this._trace(unshift(exprToUse, x), val, path, parent, parentPropName, callback, hasArrExpr));\n } else if (loc[0] === '@') {\n // value type: @boolean(), etc.\n // eslint-disable-next-line no-useless-assignment -- ESLint bug\n let addType = false;\n const parenthIndex = loc.indexOf('(');\n const valueType = /** @type {ValueType|string} */loc.slice(1, parenthIndex);\n const lastParenth = loc.lastIndexOf(')');\n const argRaw = loc.slice(parenthIndex + 1, lastParenth);\n const arg = argRaw ? JSON.parse(argRaw) : undefined;\n switch (valueType) {\n case 'scalar':\n addType = !val || !['object', 'function'].includes(typeof val);\n break;\n case 'boolean':\n case 'string':\n case 'undefined':\n case 'function':\n addType = typeof val === valueType;\n break;\n case 'integer':\n addType = Number.isFinite(val) && !(/** @type {number} */val % 1);\n break;\n case 'number':\n addType = Number.isFinite(val);\n break;\n case 'nonFinite':\n addType = typeof val === 'number' && !Number.isFinite(val);\n break;\n case 'object':\n addType = Boolean(val) && typeof val === valueType;\n break;\n case 'array':\n addType = Array.isArray(val);\n break;\n case 'other':\n addType = /** @type {OtherTypeCallback} */this.currOtherTypeCallback(val, path, parent, parentPropName, arg) || false;\n break;\n case 'null':\n addType = val === null;\n break;\n case 'symbol':\n addType = typeof val === 'symbol';\n break;\n case 'BigInt':\n addType = typeof val === 'bigint';\n break;\n case 'Promise':\n addType = toStringTag(val) === 'Promise';\n break;\n case 'jsonReference':\n addType = Boolean(val) && typeof val === 'object' && Object.hasOwn(/** @type {object} */val, '$ref');\n break;\n default:\n if (this.currCustomTypes && Object.hasOwn(this.currCustomTypes, valueType)) {\n addType = this.currCustomTypes[valueType](val, path, parent, parentPropName, arg) || false;\n } else {\n throw new TypeError('Unknown value type ' + valueType);\n }\n }\n if (addType) {\n retObj = {\n path,\n value: val,\n parent,\n parentProperty: parentPropName\n };\n this._handleCallback(retObj, callback, 'value');\n return retObj;\n }\n // `-escaped property\n } else if (val && loc[0] === '`' && Object.hasOwn(val, loc.slice(1))) {\n const locProp = loc.slice(1);\n const valObj = /** @type {Record<string, unknown>} */val;\n addRet(this._trace(x, valObj[locProp], push(path, locProp), val, locProp, callback, hasArrExpr, true));\n } else if (loc[0] === \"'\" || loc[0] === '\"') {\n // ['name1','name2',...]\n // Quoted members are literal property names\n for (const [, single, double] of loc.matchAll(/'((?:\\\\.|[^'\\\\])*)'|\"((?:\\\\.|[^\"\\\\])*)\"/gv)) {\n const prop = (single ?? double).replaceAll(/\\\\(['\"\\\\])/gv, '$1');\n if (!val || !Object.hasOwn(val, prop)) {\n continue;\n }\n const valObj = /** @type {Record<string, unknown>} */val;\n addRet(this._trace(x, valObj[prop], push(path, prop), val, prop, callback, true));\n }\n } else if (loc.includes(',')) {\n // [name1,name2,...]\n const parts = loc.split(',');\n for (const part of parts) {\n addRet(this._trace(unshift(part, x), val, path, parent, parentPropName, callback, true));\n }\n // simple case--directly follow property\n } else if (!literalPriority && val && Object.hasOwn(val, loc)) {\n const valObj = /** @type {Record<string, unknown>} */val;\n addRet(this._trace(x, valObj[loc], push(path, loc), val, loc, callback, hasArrExpr, true));\n }\n\n // We check the resulting values for parent selections. For parent\n // selections we discard the value object and continue the trace with\n // the current val object\n if (this._hasParentSelector) {\n for (let t = 0; t < ret.length; t++) {\n const rett = ret[t];\n if (!rett || !rett.isParentSelector) {\n continue;\n }\n const exprToUse = /** @type {ExpressionArray} */\n rett.expr;\n const pathToUse = /** @type {ExpressionArray} */\n rett.path;\n const tmp = this._trace(exprToUse, val, pathToUse, parent, parentPropName, callback, hasArrExpr);\n if (Array.isArray(tmp)) {\n ret[t] = tmp[0];\n const tl = tmp.length;\n for (let tt = 1; tt < tl; tt++) {\n t++;\n ret.splice(t, 0, tmp[tt]);\n }\n } else {\n ret[t] = tmp;\n }\n }\n }\n return ret;\n }\n\n /**\n * @param {unknown} val\n * @param {(prop: string|number) => void} f\n * @returns {void}\n */\n _walk(val, f) {\n if (Array.isArray(val)) {\n const n = val.length;\n for (let i = 0; i < n; i++) {\n f(i);\n }\n } else if (val && typeof val === 'object') {\n Object.keys(val).forEach(m => {\n f(m);\n });\n }\n }\n\n /**\n * @param {string} loc\n * @param {ExpressionArray} expr\n * @param {unknown} val\n * @param {ExpressionArray} path\n * @param {ParentValue} parent\n * @param {ParentProperty} parentPropName\n * @param {JSONPathCallback|undefined} callback\n * @returns {ReturnObject[]|undefined}\n */\n _slice(loc, expr, val, path, parent, parentPropName, callback) {\n if (!Array.isArray(val)) {\n return undefined;\n }\n const len = val.length,\n parts = loc.split(':'),\n step = parts[2] && Number(parts[2]) || 1;\n let start = parts[0] && Number(parts[0]) || 0,\n end = parts[1] ? Number(parts[1]) : len;\n start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);\n end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);\n /** @type {ReturnObject[]} */\n const ret = [];\n for (let i = start; i < end; i += step) {\n const tmp = this._trace(unshift(i, expr), val, path, parent, parentPropName, callback, true);\n // Should only be possible to be an array here since first part of\n // ``unshift(i, expr)` passed in above would not be empty,\n // nor `~`, nor begin with `@` (as could return objects)\n // This was causing excessive stack size in Node (with or\n // without Babel) against our performance test: `ret.push(...tmp);`\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* c8 ignore next -- Unreachable: _trace returns array when expr non-empty */\n const tmpArray = Array.isArray(tmp) ? tmp : [tmp];\n tmpArray.forEach(t => {\n ret.push(t);\n });\n }\n return ret;\n }\n\n /**\n * @param {string} code\n * @param {unknown} _v\n * @param {string|number} _vname\n * @param {ExpressionArray} path\n * @param {ParentValue} parent\n * @param {ParentProperty} parentPropName\n * @returns {UnknownResult}\n */\n _eval(code, _v, _vname, path, parent, parentPropName) {\n if (this.currSandbox) {\n this.currSandbox._$_parentProperty = parentPropName;\n this.currSandbox._$_parent = parent;\n this.currSandbox._$_property = _vname;\n this.currSandbox._$_root = this.json;\n this.currSandbox._$_v = _v;\n }\n const containsPath = code.includes('@path');\n if (containsPath) {\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* c8 ignore next -- Unreachable: currSandbox set in evaluate() before _eval */\n const currSandbox = this.currSandbox ?? {};\n currSandbox._$_path = JSONPath.toPathString(/** @type {string[]} */path.concat([_vname]));\n }\n const scriptCacheKey = this.currEval + 'Script:' + code;\n if (!scriptCache.has(scriptCacheKey)) {\n let script = code.replaceAll('@parentProperty', '_$_parentProperty').replaceAll('@parent', '_$_parent').replaceAll('@property', '_$_property').replaceAll('@root', '_$_root')\n // Replace a bare `@` (not followed by an identifier\n // character) while leaving quoted string literals and\n // regex literals (a `/` where an operand is expected,\n // as opposed to division) intact\n .replaceAll(/('(?:\\\\.|[^'\\\\])*'|\"(?:\\\\.|[^\"\\\\])*\"|(?<=(?:^|[\\(,=:\\[!\\|?\\{\\};+\\-*%<>~^]|&)\\s*)\\/(?:\\\\.|\\[(?:\\\\.|[^\\]\\\\])*\\]|[^\\/\\\\\\[])+\\/[dgimsuvy]*)|@(?![\\w$])/gv, (_, literal) => literal ?? '_$_v');\n if (containsPath) {\n script = script.replaceAll('@path', '_$_path');\n }\n const evalType = /** @type {string|boolean|undefined} */\n this.currEval;\n if (['safe', true, undefined].includes(evalType)) {\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* eslint-disable unicorn/no-undeclared-class-members -- Prototype members */\n scriptCache.set(scriptCacheKey, new (\n /**\n * @type {JSONPathClass & {\n * safeVm: SafeScriptType,\n * vm: ScriptType\n * }}\n */ /** @type {unknown} */\n this).safeVm.Script(script));\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* eslint-enable unicorn/no-undeclared-class-members -- End prototype member scope */\n } else if (this.currEval === 'native') {\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* eslint-disable unicorn/no-undeclared-class-members -- Prototype members */\n scriptCache.set(scriptCacheKey, new (\n /**\n * @type {JSONPathClass & {\n * safeVm: SafeScriptType,\n * vm: ScriptType\n * }}\n */ /** @type {unknown} */\n this).vm.Script(script));\n // eslint-disable-next-line @stylistic/max-len -- Long\n /* eslint-enable unicorn/no-undeclared-class-members -- End prototype member scope */\n } else if (typeof this.currEval === 'function' && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, 'runInNewContext')) {\n const CurrEval = this.currEval;\n // eslint-disable-next-line @stylistic/max-len -- Long\n // @ts-expect-error - Type checked above to have proper constructor\n scriptCache.set(scriptCacheKey, new CurrEval(script));\n } else if (typeof this.currEval === 'function') {\n // Type narrowing: at this point currEval is a function\n // but not a constructor\n const evalFunc = /** @type {EvalCallback} */this.currEval;\n scriptCache.set(scriptCacheKey, {\n runInNewContext: (/** @type {ContextItem} */context) => evalFunc(script, context)\n });\n } else {\n throw new TypeError(`Unknown \"eval\" property \"${this.currEval}\"`);\n }\n }\n try {\n /**\n * @typedef {{\n * runInNewContext: (\n * ctx: SandboxType|undefined\n * ) => EvaluatedResult\n * }} RunInNewContext\n */\n\n return /** @type {RunInNewContext} */scriptCache.get(scriptCacheKey).runInNewContext(this.currSandbox);\n } catch (e) {\n if (this.ignoreEvalErrors) {\n return false;\n }\n const error = /** @type {Error} */e;\n throw new Error('jsonPath: ' + error.message + ': ' + code, {\n cause: e\n });\n }\n }\n}\n\n/** @type {{safeVm: SafeScriptType}} */\n(/** @type {unknown} */JSONPathClass.prototype).safeVm = {\n Script: SafeScript\n};\nJSONPath.prototype = JSONPathClass.prototype;\n\n// PUBLIC CLASS PROPERTIES AND METHODS\n\n/**\n * Clears cached parsed paths and compiled scripts.\n * @returns {void}\n */\nJSONPath.clearCache = function () {\n pathCache.clear();\n scriptCache.clear();\n};\n\n/**\n * @param {string[]} pathArr Array to convert\n * @returns {string} The path string\n */\nJSONPath.toPathString = function (pathArr) {\n const x = pathArr,\n n = x.length;\n let p = '$';\n for (let i = 1; i < n; i++) {\n if (!/^(~|\\^|@.*?\\(\\))$/v.test(x[i])) {\n p += /^[0-9*]+$/v.test(x[i]) ? '[' + x[i] + ']' : \"['\" + String(x[i]).replaceAll(/['\\\\]/gv, String.raw`\\$&`) + \"']\";\n }\n }\n return p;\n};\n\n/**\n * @param {string[]} pointer JSON Path array\n * @returns {string} JSON Pointer\n */\nJSONPath.toPointer = function (pointer) {\n const x = pointer,\n n = x.length;\n let p = '';\n for (let i = 1; i < n; i++) {\n if (!/^(~|\\^|@.*?\\(\\))$/v.test(x[i])) {\n p += '/' + x[i].toString().replaceAll('~', '~0').replaceAll('/', '~1');\n }\n }\n return p;\n};\n\n/**\n * @param {string} expr Expression to convert\n * @returns {string[]}\n */\nJSONPath.toPathArray = function (expr) {\n if (pathCache.has(expr)) {\n return /** @type {string[]} */pathCache.get(expr).concat();\n }\n /** @type {string[]} */\n const subx = [];\n const normalized = expr\n // Properties\n .replaceAll(/@[\\w$\\-]+\\([^\\)]*\\)/gv, ';$&;')\n // Parenthetical evaluations (filtering and otherwise), directly\n // within brackets or single quotes\n .replaceAll(/[\\['](\\??\\(.*?\\))[\\]'](?!.\\])/gv, function ($0, $1) {\n return '[#' + (\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line unicorn/no-return-array-push -- Optimization\n subx.push($1) - 1) + ']';\n })\n // Unions of quoted property names (e.g., `['x','y']`) and quoted\n // names with commas or backslash escapes, kept intact (with\n // quotes) so their members survive tokenization\n .replaceAll(/\\[\\s*((?:'(?:\\\\.|[^'\\\\])*'|\"(?:\\\\.|[^\"\\\\])*\")(?:\\s*,\\s*(?:'(?:\\\\.|[^'\\\\])*'|\"(?:\\\\.|[^\"\\\\])*\"))*)\\s*\\]/gv, function ($0, $1) {\n if (!/[,\\\\]/v.test($1)) {\n return $0;\n }\n // eslint-disable-next-line @stylistic/max-len -- Long\n // eslint-disable-next-line unicorn/no-return-array-push -- Optimization\n return '[#' + (subx.push($1) - 1) + ']';\n })\n // Escape periods and tildes within properties\n .replaceAll(/\\[['\"]([^'\\]]*)['\"]\\]/gv, function ($0, prop) {\n return \"['\" + prop.replaceAll('.', '%@%').replaceAll('~', '%%@@%%') + \"']\";\n })\n // Properties operator\n .replaceAll('~', ';~;')\n // Split by property boundaries\n .replaceAll(/['\"]?\\.['\"]?(?![^\\[]*\\])|\\[['\"]?/gv, ';')\n // Reinsert periods within properties\n .replaceAll('%@%', '.')\n // Reinsert tildes within properties\n .replaceAll('%%@@%%', '~')\n // Parent\n .replaceAll(/(?:;)?(\\^+)(?:;)?/gv, function ($0, ups) {\n return ';' + ups.split('').join(';') + ';';\n })\n // Descendents\n .replaceAll(/;;;|;;/gv, ';..;')\n // Remove trailing\n .replaceAll(/;$|'?\\]|'$/gv, '');\n const exprList = normalized.split(';').map(function (exp) {\n const match = exp.match(/#(\\d+)/v);\n return !match || !match[1] ? exp : subx[Number(match[1])];\n });\n pathCache.set(expr, exprList);\n return /** @type {string[]} */pathCache.get(expr).concat();\n};\n\n/**\n * @typedef {import('./jsonpath.js').AnyInput} AnyInput\n */\n/**\n * @typedef {import('./jsonpath.js').SandboxCallback} SandboxCallback\n */\n/**\n * @typedef {import('./jsonpath.js').SandboxPropertyValue} SandboxPropertyValue\n */\n/**\n * @typedef {import('./jsonpath.js').ExpressionArray} ExpressionArray\n */\n/**\n * @typedef {import('./jsonpath.js').ValueType} ValueType\n */\n/**\n * @typedef {import('./jsonpath.js').ParentValue} ParentValue\n */\n/**\n * @typedef {import('./jsonpath.js').UnknownResult} UnknownResult\n */\n/**\n * @typedef {import('./jsonpath.js').ParentProperty} ParentProperty\n */\n/**\n * @typedef {import('./jsonpath.js').PreferredOutput} PreferredOutput\n */\n/**\n * @typedef {import('./jsonpath.js').ReturnObject} ReturnObject\n */\n/**\n * @typedef {import('./jsonpath.js').JSONPathCallback} JSONPathCallback\n */\n/**\n * @typedef {import('./jsonpath.js').OtherTypeCallback} OtherTypeCallback\n */\n/**\n * @typedef {import('./jsonpath.js').ContextItem} ContextItem\n */\n/**\n * @typedef {import('./jsonpath.js').EvaluatedResult} EvaluatedResult\n */\n/**\n * @typedef {import('./jsonpath.js').EvalCallback} EvalCallback\n */\n/**\n * @typedef {import('./jsonpath.js').EvalClass} EvalClass\n */\n/**\n * @typedef {import('./jsonpath.js').ResultType} ResultType\n */\n/**\n * @typedef {import('./jsonpath.js').EvalValue} EvalValue\n */\n/**\n * @typedef {import('./jsonpath.js').PathType} PathType\n */\n/**\n * @typedef {import('./jsonpath.js').SafeScriptType} SafeScriptType\n */\n/**\n * @typedef {import('./jsonpath.js').ScriptType} ScriptType\n */\n/**\n * @typedef {import('./jsonpath.js').SandboxType} SandboxType\n */\n/**\n * @typedef {import('./jsonpath.js').JSONPathOptions} JSONPathOptions\n */\n\n// Node's vm module shape is wider than ScriptType, but is compatible for\n// the properties actually used (Script) -- kept Node-specific here so\n// `node:vm` types don't leak into the shared/browser declarations.\n/** @type {{vm: ScriptType}} */\n(/** @type {unknown} */JSONPathClass.prototype).vm = /** @type {ScriptType} */\n/** @type {unknown} */vm;\n\nexport { JSONPath, JSONPathClass };\n"],"ignoreList":[0],"mappings":";;;;;AAKA,IAAM,QAAN,MAAY;;;;;;;;;;;;;;;;;;;CAmBV,IAAI,MAAM,UAAU,OAAO;EACzB,IAAI,OAAO,UAAU,MAAM,UAEzB,KAAK,IAAI,QAAQ,UAAU,IACzB,KAAK,IAAI,MAAM,UAAU,EAAE,CAAC,OAAO,UAAU,EAAE;OAGjD,CAAC,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,EAAA,CAAG,QAAQ,SAAU,MAAM;GAC5D,KAAK,QAAQ,KAAK,SAAS,CAAC;GAC5B,IAAI,UACF,KAAK,KAAK,CAAC,QAAQ,YAAY,OAAO,CAAC,QAAQ;EAEnD,GAAG,IAAI;CAEX;;;;;;;;;;CAWA,IAAI,MAAM,KAAK;EACb,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