@hamsterbase/evidra 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk/conformance-rules.js +38 -24
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/rules.d.ts +1 -1
- package/dist/sdk/types-DHfARqti.d.ts +15 -0
- package/dist/service/cli.js +93 -57
- package/dist/web/assets/InterVariable-DiVDrmQJ.woff2 +0 -0
- package/dist/web/assets/{cssMode-Dhqi33oU.js → cssMode-CT7qaTm_.js} +1 -1
- package/dist/web/assets/{editor.api-BdoUH79A.js → editor.api-CsVhWQDt.js} +1 -1
- package/dist/web/assets/{freemarker2-Di1XsZv-.js → freemarker2-Biydhqq4.js} +1 -1
- package/dist/web/assets/{handlebars-BmMiVsf3.js → handlebars-OLGn3O0q.js} +1 -1
- package/dist/web/assets/{html-BWw9s24y.js → html-Cw5ATHyh.js} +1 -1
- package/dist/web/assets/{htmlMode-BLrNvZ52.js → htmlMode-BI1zICew.js} +1 -1
- package/dist/web/assets/index-C49ToWrK.js +2 -0
- package/dist/web/assets/{javascript-Bw0zDh-8.js → javascript-BS1aYt5R.js} +1 -1
- package/dist/web/assets/{jsonMode-Bg-zBRn4.js → jsonMode-DCJhJggA.js} +1 -1
- package/dist/web/assets/{liquid-QbiTMLnd.js → liquid-DoQa4FNY.js} +1 -1
- package/dist/web/assets/{lspLanguageFeatures-CxAtCJVb.js → lspLanguageFeatures-D9tA1yBW.js} +1 -1
- package/dist/web/assets/main-BO3J7gmH.css +2 -0
- package/dist/web/assets/main-Bpk1-JEL.css +1 -0
- package/dist/web/assets/main-DqSNHHTP.js +13 -0
- package/dist/web/assets/main-TbSjhXd2.js +18 -0
- package/dist/web/assets/{mdx-CEzuFeFS.js → mdx-CA3qWzFi.js} +1 -1
- package/dist/web/assets/{monaco-BUdi4Xi9.js → monaco-BtL7JKYj.js} +4 -4
- package/dist/web/assets/{python-_M325yHp.js → python-BrQiqC89.js} +1 -1
- package/dist/web/assets/{razor-B6FUqtCe.js → razor-08hjtCNT.js} +1 -1
- package/dist/web/assets/{tsMode-DTgoRzrO.js → tsMode-DC-2vqQt.js} +1 -1
- package/dist/web/assets/{typescript-Bzm0l5-o.js → typescript-9DOCFqrz.js} +1 -1
- package/dist/web/assets/useDisplayPreference-B-z8NzSv.js +23 -0
- package/dist/web/assets/{workers-Cga5X6ar.js → workers-BcFJUhLI.js} +1 -1
- package/dist/web/assets/{xml-BCwAkxsD.js → xml-ZJo8Un2M.js} +1 -1
- package/dist/web/assets/{yaml-ClBi6NOp.js → yaml-8EZC7v3K.js} +1 -1
- package/dist/web/index.html +1 -2
- package/package.json +5 -1
- package/dist/sdk/types-B6cBsknY.d.ts +0 -12
- package/dist/web/assets/index-7nw0XeCR.css +0 -2
- package/dist/web/assets/index-DUtB8WRj.js +0 -35
|
@@ -6,14 +6,15 @@ import { parseSync } from "oxc-parser";
|
|
|
6
6
|
// packages/conformance/rules/commit-message/index.ts
|
|
7
7
|
const execFileAsync = promisify(execFile);
|
|
8
8
|
function commitMessage(config = {}) {
|
|
9
|
-
|
|
9
|
+
const ruleName = "commit-message";
|
|
10
|
+
const task = async (common) => {
|
|
10
11
|
const { commits, scope } = await collectCommitSubjects(common.projectRoot, config.base);
|
|
11
12
|
const violations = commits.filter((commit) => (config.forbiddenPrefixes ?? ["```"]).some((prefix) => commit.subject.startsWith(prefix)));
|
|
12
13
|
const lines = [`扫描${scope} ${commits.length} 个提交 message。`];
|
|
13
14
|
if (violations.length === 0) {
|
|
14
15
|
lines.push("未发现以禁止的前缀开头的提交 message。");
|
|
15
16
|
return {
|
|
16
|
-
name:
|
|
17
|
+
name: ruleName,
|
|
17
18
|
success: true,
|
|
18
19
|
messages: lines.join("\n"),
|
|
19
20
|
howToFix: ""
|
|
@@ -22,12 +23,13 @@ function commitMessage(config = {}) {
|
|
|
22
23
|
lines.push(`发现 ${violations.length} 个提交 message 以禁止的前缀开头:`);
|
|
23
24
|
for (const violation of violations) lines.push(` - ${violation.hash.slice(0, 7)} ${violation.subject}`);
|
|
24
25
|
return {
|
|
25
|
-
name:
|
|
26
|
+
name: ruleName,
|
|
26
27
|
success: false,
|
|
27
28
|
messages: lines.join("\n"),
|
|
28
29
|
howToFix: "修改对应提交 message,移除禁止的前缀。"
|
|
29
30
|
};
|
|
30
31
|
};
|
|
32
|
+
return Object.assign(task, { displayName: ruleName });
|
|
31
33
|
}
|
|
32
34
|
async function collectCommitSubjects(repoRoot, base) {
|
|
33
35
|
const upstream = base ?? await readUpstream(repoRoot);
|
|
@@ -81,7 +83,8 @@ const SKIP_AST_KEYS$6 = /* @__PURE__ */ new Set([
|
|
|
81
83
|
"trailingComments"
|
|
82
84
|
]);
|
|
83
85
|
function duplicateLocalization(config) {
|
|
84
|
-
|
|
86
|
+
const ruleName = "duplicate-localization";
|
|
87
|
+
const task = async (common) => {
|
|
85
88
|
const options = {
|
|
86
89
|
...config,
|
|
87
90
|
repoRoot: common.projectRoot,
|
|
@@ -143,12 +146,13 @@ function duplicateLocalization(config) {
|
|
|
143
146
|
}
|
|
144
147
|
if (success) lines.push("No duplicate localization keys found.");
|
|
145
148
|
return {
|
|
146
|
-
name:
|
|
149
|
+
name: ruleName,
|
|
147
150
|
success,
|
|
148
151
|
messages: lines.join("\n"),
|
|
149
152
|
howToFix: success ? "" : "Replace template literals with string literals, and unify duplicate keys to share a single default message."
|
|
150
153
|
};
|
|
151
154
|
};
|
|
155
|
+
return Object.assign(task, { displayName: ruleName });
|
|
152
156
|
}
|
|
153
157
|
async function collectSourceFiles$2(root, excludeDirs, skipDirNames = [
|
|
154
158
|
"node_modules",
|
|
@@ -245,7 +249,8 @@ const SKIP_AST_KEYS$5 = /* @__PURE__ */ new Set([
|
|
|
245
249
|
"trailingComments"
|
|
246
250
|
]);
|
|
247
251
|
function syncLocales(config) {
|
|
248
|
-
|
|
252
|
+
const ruleName = "sync-locales";
|
|
253
|
+
const task = async (common) => {
|
|
249
254
|
const options = {
|
|
250
255
|
...config,
|
|
251
256
|
repoRoot: common.projectRoot,
|
|
@@ -302,12 +307,13 @@ function syncLocales(config) {
|
|
|
302
307
|
}
|
|
303
308
|
if (hasUntranslatedKeys) howToFix.push("Translate the listed key(s) in non-default locale files, then run the check again.");
|
|
304
309
|
return {
|
|
305
|
-
name:
|
|
310
|
+
name: ruleName,
|
|
306
311
|
success,
|
|
307
312
|
messages: lines.join("\n"),
|
|
308
313
|
howToFix: howToFix.join(" ")
|
|
309
314
|
};
|
|
310
315
|
};
|
|
316
|
+
return Object.assign(task, { displayName: ruleName });
|
|
311
317
|
}
|
|
312
318
|
function mergeDefaultLocale(oldConfig, newLocale, metadataKey) {
|
|
313
319
|
const result = {};
|
|
@@ -448,7 +454,8 @@ const ESM_SOURCE_EXTENSIONS = {
|
|
|
448
454
|
".jsx": [".tsx"]
|
|
449
455
|
};
|
|
450
456
|
function sameDirImportOnly(config) {
|
|
451
|
-
|
|
457
|
+
const ruleName = "same-dir-import-only";
|
|
458
|
+
const task = async (common) => {
|
|
452
459
|
const marker = config.marker ?? "@import-scope same-dir";
|
|
453
460
|
const aliases = Object.entries(config.aliases ?? {}).sort(([a], [b]) => b.length - a.length).map(([prefix, target]) => [prefix, path.resolve(common.projectRoot, target)]);
|
|
454
461
|
const options = {
|
|
@@ -478,7 +485,7 @@ function sameDirImportOnly(config) {
|
|
|
478
485
|
if (violations.length === 0) {
|
|
479
486
|
lines.push("No cross-directory imports of protected files found.");
|
|
480
487
|
return {
|
|
481
|
-
name:
|
|
488
|
+
name: ruleName,
|
|
482
489
|
success: true,
|
|
483
490
|
messages: lines.join("\n"),
|
|
484
491
|
howToFix: ""
|
|
@@ -490,12 +497,13 @@ function sameDirImportOnly(config) {
|
|
|
490
497
|
lines.push(` protected file: ${path.relative(options.repoRoot, violation.target)}`);
|
|
491
498
|
}
|
|
492
499
|
return {
|
|
493
|
-
name:
|
|
500
|
+
name: ruleName,
|
|
494
501
|
success: false,
|
|
495
502
|
messages: lines.join("\n"),
|
|
496
503
|
howToFix: `Only import files marked with '${marker}' from files in the same directory, or move shared API into an unmarked file.`
|
|
497
504
|
};
|
|
498
505
|
};
|
|
506
|
+
return Object.assign(task, { displayName: ruleName });
|
|
499
507
|
}
|
|
500
508
|
async function collectSourceFiles(root, excludeDirs, skipDirNames = [
|
|
501
509
|
"node_modules",
|
|
@@ -722,7 +730,8 @@ function formatLocation$3(repoRoot, file, line) {
|
|
|
722
730
|
const CJK_PATTERN = /[\u4e00-\u9fff\u3400-\u4dbf\u3000-\u303f\uff00-\uffef]/;
|
|
723
731
|
/** 本地化调用在代码中的默认文案必须使用源语言(不匹配 pattern),翻译放在语言文件中。 */
|
|
724
732
|
function sourceLocaleDefaults(options) {
|
|
725
|
-
|
|
733
|
+
const ruleName = "source-locale-defaults";
|
|
734
|
+
const task = async (context) => {
|
|
726
735
|
const files = await collectFiles$3(context.projectRoot, options, [".ts", ".tsx"]);
|
|
727
736
|
const findings = [];
|
|
728
737
|
for (const file of files) {
|
|
@@ -741,7 +750,7 @@ function sourceLocaleDefaults(options) {
|
|
|
741
750
|
if (findings.length === 0) {
|
|
742
751
|
lines.push("未发现违规文案。");
|
|
743
752
|
return {
|
|
744
|
-
name:
|
|
753
|
+
name: ruleName,
|
|
745
754
|
success: true,
|
|
746
755
|
messages: lines.join("\n"),
|
|
747
756
|
howToFix: ""
|
|
@@ -749,12 +758,13 @@ function sourceLocaleDefaults(options) {
|
|
|
749
758
|
}
|
|
750
759
|
lines.push(`发现 ${findings.length} 处违规文案:`, ...findings);
|
|
751
760
|
return {
|
|
752
|
-
name:
|
|
761
|
+
name: ruleName,
|
|
753
762
|
success: false,
|
|
754
763
|
messages: lines.join("\n"),
|
|
755
764
|
howToFix: "默认文案改用源语言,其他语言的翻译写入语言文件。"
|
|
756
765
|
};
|
|
757
766
|
};
|
|
767
|
+
return Object.assign(task, { displayName: ruleName });
|
|
758
768
|
}
|
|
759
769
|
function matchCall(calls, callee) {
|
|
760
770
|
if (!callee) return void 0;
|
|
@@ -875,7 +885,8 @@ function formatLocation$2(repoRoot, file, line) {
|
|
|
875
885
|
// packages/conformance/rules/single-component-file/index.ts
|
|
876
886
|
/** 每个 TSX 文件只定义一个返回 JSX 的组件。 */
|
|
877
887
|
function singleComponentFile(options) {
|
|
878
|
-
|
|
888
|
+
const ruleName = "single-component-file";
|
|
889
|
+
const task = async (context) => {
|
|
879
890
|
const wrappers = new Set(options.componentWrappers ?? ["memo", "forwardRef"]);
|
|
880
891
|
const files = await collectFiles$2(context.projectRoot, options, [".tsx"]);
|
|
881
892
|
const findings = [];
|
|
@@ -894,7 +905,7 @@ function singleComponentFile(options) {
|
|
|
894
905
|
if (findings.length === 0) {
|
|
895
906
|
lines.push("未发现包含多个组件的 TSX 文件。");
|
|
896
907
|
return {
|
|
897
|
-
name:
|
|
908
|
+
name: ruleName,
|
|
898
909
|
success: true,
|
|
899
910
|
messages: lines.join("\n"),
|
|
900
911
|
howToFix: ""
|
|
@@ -902,12 +913,13 @@ function singleComponentFile(options) {
|
|
|
902
913
|
}
|
|
903
914
|
lines.push("以下 TSX 文件包含多个组件:", ...findings);
|
|
904
915
|
return {
|
|
905
|
-
name:
|
|
916
|
+
name: ruleName,
|
|
906
917
|
success: false,
|
|
907
918
|
messages: lines.join("\n"),
|
|
908
919
|
howToFix: "把多出的组件移到各自的 TSX 文件,每个文件只保留一个组件。"
|
|
909
920
|
};
|
|
910
921
|
};
|
|
922
|
+
return Object.assign(task, { displayName: ruleName });
|
|
911
923
|
}
|
|
912
924
|
function readComponentName(node, wrappers) {
|
|
913
925
|
if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") {
|
|
@@ -1052,12 +1064,12 @@ function formatLocation$1(repoRoot, file, line) {
|
|
|
1052
1064
|
* 且 shared 与 utils 互不引用。
|
|
1053
1065
|
*/
|
|
1054
1066
|
function e2eScenariosStructure(options) {
|
|
1055
|
-
|
|
1067
|
+
const ruleName = options.name ?? "e2e-scenarios-structure";
|
|
1068
|
+
const task = async (context) => {
|
|
1056
1069
|
const repoRoot = context.projectRoot;
|
|
1057
1070
|
const entrySuffix = options.entrySuffix ?? ".spec.ts";
|
|
1058
1071
|
const strictRoot = options.strictRoot ?? false;
|
|
1059
1072
|
const root = path.resolve(repoRoot, options.root);
|
|
1060
|
-
const name = options.name ?? "e2e-scenarios-structure";
|
|
1061
1073
|
const sharedName = options.sharedDir ?? "shared";
|
|
1062
1074
|
const utilsName = options.utilsDir ?? "utils";
|
|
1063
1075
|
const threshold = options.sharedThreshold ?? 3;
|
|
@@ -1068,7 +1080,7 @@ function e2eScenariosStructure(options) {
|
|
|
1068
1080
|
const violations = [];
|
|
1069
1081
|
const entries = await readDirIfExists$1(root);
|
|
1070
1082
|
if (!entries) return {
|
|
1071
|
-
name,
|
|
1083
|
+
name: ruleName,
|
|
1072
1084
|
success: false,
|
|
1073
1085
|
messages: `场景根目录不存在:${path.relative(repoRoot, root)}`,
|
|
1074
1086
|
howToFix: "确认传入的场景根目录路径。"
|
|
@@ -1142,12 +1154,13 @@ function e2eScenariosStructure(options) {
|
|
|
1142
1154
|
if (success) lines.push("未发现结构违规。");
|
|
1143
1155
|
else lines.push(`发现 ${violations.filter((line) => line.startsWith(" - ")).length} 处违规:`, ...violations);
|
|
1144
1156
|
return {
|
|
1145
|
-
name,
|
|
1157
|
+
name: ruleName,
|
|
1146
1158
|
success,
|
|
1147
1159
|
messages: lines.join("\n"),
|
|
1148
1160
|
howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
|
|
1149
1161
|
};
|
|
1150
1162
|
};
|
|
1163
|
+
return Object.assign(task, { displayName: ruleName });
|
|
1151
1164
|
}
|
|
1152
1165
|
function readFunctionName$1(node) {
|
|
1153
1166
|
if (node.type === "FunctionDeclaration") return readName$1(node.id) ?? "匿名函数";
|
|
@@ -1287,13 +1300,13 @@ function formatLocation(repoRoot, file, line) {
|
|
|
1287
1300
|
* 且 shared 与 utils 互不引用。
|
|
1288
1301
|
*/
|
|
1289
1302
|
function uiScenariosStructure(options) {
|
|
1290
|
-
|
|
1303
|
+
const ruleName = options.name ?? "ui-scenarios-structure";
|
|
1304
|
+
const task = async (context) => {
|
|
1291
1305
|
const repoRoot = context.projectRoot;
|
|
1292
1306
|
const entrySuffix = options.entrySuffix ?? ".ts";
|
|
1293
1307
|
const strictRoot = options.strictRoot ?? true;
|
|
1294
1308
|
const exportName = options.exportName ?? "lint";
|
|
1295
1309
|
const root = path.resolve(repoRoot, options.root);
|
|
1296
|
-
const name = options.name ?? "ui-scenarios-structure";
|
|
1297
1310
|
const sharedName = options.sharedDir ?? "shared";
|
|
1298
1311
|
const utilsName = options.utilsDir ?? "utils";
|
|
1299
1312
|
const threshold = options.sharedThreshold ?? 3;
|
|
@@ -1304,7 +1317,7 @@ function uiScenariosStructure(options) {
|
|
|
1304
1317
|
const violations = [];
|
|
1305
1318
|
const entries = await readDirIfExists(root);
|
|
1306
1319
|
if (!entries) return {
|
|
1307
|
-
name,
|
|
1320
|
+
name: ruleName,
|
|
1308
1321
|
success: false,
|
|
1309
1322
|
messages: `场景根目录不存在:${path.relative(repoRoot, root)}`,
|
|
1310
1323
|
howToFix: "确认传入的场景根目录路径。"
|
|
@@ -1380,12 +1393,13 @@ function uiScenariosStructure(options) {
|
|
|
1380
1393
|
if (success) lines.push("未发现结构违规。");
|
|
1381
1394
|
else lines.push(`发现 ${violations.filter((line) => line.startsWith(" - ")).length} 处违规:`, ...violations);
|
|
1382
1395
|
return {
|
|
1383
|
-
name,
|
|
1396
|
+
name: ruleName,
|
|
1384
1397
|
success,
|
|
1385
1398
|
messages: lines.join("\n"),
|
|
1386
1399
|
howToFix: success ? "" : `helper 移出入口文件:被 ${threshold} 个及以上入口使用的放到 ${sharedName},其余放到 ${utilsName}/<入口名>;${sharedName} 与 ${utilsName} 不要互相引用。`
|
|
1387
1400
|
};
|
|
1388
1401
|
};
|
|
1402
|
+
return Object.assign(task, { displayName: ruleName });
|
|
1389
1403
|
}
|
|
1390
1404
|
function readFunctionName(node) {
|
|
1391
1405
|
if (node.type === "FunctionDeclaration") return readName(node.id) ?? "匿名函数";
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types-
|
|
1
|
+
import { n as RuleResult, r as RuleTask, t as CommonConfig } from "./types-DHfARqti.js";
|
|
2
2
|
/** evidra.conformance.ts 的默认导出。 */
|
|
3
3
|
interface Config {
|
|
4
4
|
/** 默认配置文件所在目录;相对路径也基于配置文件所在目录。 */
|
package/dist/sdk/rules.d.ts
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface RuleResult {
|
|
2
|
+
name: string;
|
|
3
|
+
success: boolean;
|
|
4
|
+
messages: string;
|
|
5
|
+
howToFix: string;
|
|
6
|
+
}
|
|
7
|
+
interface CommonConfig {
|
|
8
|
+
/** 已解析的项目绝对路径。 */
|
|
9
|
+
readonly projectRoot: string;
|
|
10
|
+
}
|
|
11
|
+
type RuleTask = ((commonConfig: CommonConfig) => Promise<RuleResult>) & {
|
|
12
|
+
/** 用于在执行前展示规则名称。 */
|
|
13
|
+
readonly displayName?: string;
|
|
14
|
+
};
|
|
15
|
+
export { RuleResult as n, RuleTask as r, CommonConfig as t };
|
package/dist/service/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/service/src/cli.ts
|
|
2
2
|
import { cac } from "cac";
|
|
3
|
-
import
|
|
3
|
+
import path34 from "node:path";
|
|
4
4
|
|
|
5
5
|
// modules/core/implementations/Functions/resolveConfig.ts
|
|
6
6
|
import path3 from "node:path";
|
|
@@ -1652,11 +1652,11 @@ async function currentBaseline(root, namespace) {
|
|
|
1652
1652
|
])
|
|
1653
1653
|
);
|
|
1654
1654
|
}
|
|
1655
|
-
var definition = (snapshot) => ({
|
|
1655
|
+
var definition = (snapshot, imageKey = snapshot.key) => ({
|
|
1656
1656
|
id: snapshot.id,
|
|
1657
1657
|
name: snapshot.name,
|
|
1658
1658
|
type: snapshot.type,
|
|
1659
|
-
content: snapshot.type === "image" ?
|
|
1659
|
+
content: snapshot.type === "image" ? imageKey : snapshot.body,
|
|
1660
1660
|
language: snapshot.language,
|
|
1661
1661
|
contentType: snapshot.contentType,
|
|
1662
1662
|
width: snapshot.width,
|
|
@@ -1766,13 +1766,28 @@ async function getBaselineChanges(input) {
|
|
|
1766
1766
|
)
|
|
1767
1767
|
);
|
|
1768
1768
|
for (const entry of entries2) {
|
|
1769
|
+
const { baseline, current, change } = entry.item;
|
|
1770
|
+
let screenshotKeyOnly = change === "modified" && baseline?.name === current?.name && canonical(baseline?.treePath) === canonical(current?.treePath);
|
|
1771
|
+
let hasScreenshotKeyChange = false;
|
|
1769
1772
|
for (const snapshot of entry.item.snapshots) {
|
|
1773
|
+
if (snapshot.change === "same") continue;
|
|
1770
1774
|
if (snapshot.baseline?.type === "image" && snapshot.current?.type === "image" && snapshot.baseline.key !== snapshot.current.key) {
|
|
1771
|
-
const file = await prepareImageDiff(
|
|
1772
|
-
|
|
1773
|
-
|
|
1775
|
+
const { file, diffPixels } = await prepareImageDiff(
|
|
1776
|
+
root,
|
|
1777
|
+
snapshot.baseline,
|
|
1778
|
+
snapshot.current
|
|
1779
|
+
);
|
|
1780
|
+
if (file) {
|
|
1781
|
+
snapshot.diffFile = path20.relative(reportDir, file).split(path20.sep).join("/");
|
|
1782
|
+
snapshot.diffUrl = reportStaticUrl(reportDir, file);
|
|
1783
|
+
}
|
|
1784
|
+
hasScreenshotKeyChange = true;
|
|
1785
|
+
screenshotKeyOnly &&= diffPixels === 0 && canonical(definition(snapshot.baseline)) === canonical(definition(snapshot.current, snapshot.baseline.key));
|
|
1786
|
+
} else {
|
|
1787
|
+
screenshotKeyOnly = false;
|
|
1774
1788
|
}
|
|
1775
1789
|
}
|
|
1790
|
+
if (screenshotKeyOnly && hasScreenshotKeyChange) entry.screenshotKeyOnly = true;
|
|
1776
1791
|
}
|
|
1777
1792
|
return {
|
|
1778
1793
|
ref,
|
|
@@ -1793,13 +1808,13 @@ async function prepareImageDiff(root, before, after) {
|
|
|
1793
1808
|
"comparisons",
|
|
1794
1809
|
version(["git", before.key, after.key])
|
|
1795
1810
|
);
|
|
1796
|
-
const index = path20.join(directory, "diff-
|
|
1811
|
+
const index = path20.join(directory, "diff-v3.json");
|
|
1797
1812
|
const cached = await readJson(index);
|
|
1798
1813
|
try {
|
|
1799
1814
|
if (cached) {
|
|
1800
|
-
const file2 = path20.join(directory, cached);
|
|
1801
|
-
await readFile9(file2);
|
|
1802
|
-
return file2;
|
|
1815
|
+
const file2 = cached.filename && path20.join(directory, cached.filename);
|
|
1816
|
+
if (file2) await readFile9(file2);
|
|
1817
|
+
return { file: file2, diffPixels: cached.diffPixels };
|
|
1803
1818
|
}
|
|
1804
1819
|
} catch (error) {
|
|
1805
1820
|
if (error.code !== "ENOENT") throw error;
|
|
@@ -1812,12 +1827,12 @@ async function prepareImageDiff(root, before, after) {
|
|
|
1812
1827
|
PNG2.bitblt(x, left, 0, 0, x.width, x.height, 0, 0);
|
|
1813
1828
|
PNG2.bitblt(y, right, 0, 0, y.width, y.height, 0, 0);
|
|
1814
1829
|
const result = localImageDiff(PNG2.sync.write(left), PNG2.sync.write(right));
|
|
1815
|
-
|
|
1816
|
-
const filename = `diff-${hash(result.png)}.png`;
|
|
1817
|
-
const file = path20.join(directory, filename);
|
|
1818
|
-
await writeBytesAtomic(file, result.png);
|
|
1819
|
-
await writeJsonAtomic(index, filename);
|
|
1820
|
-
return file;
|
|
1830
|
+
const diffPixels = x.width === y.width && x.height === y.height ? result.diffPixels : void 0;
|
|
1831
|
+
const filename = result.png && `diff-${hash(result.png)}.png`;
|
|
1832
|
+
const file = filename && path20.join(directory, filename);
|
|
1833
|
+
if (file && result.png) await writeBytesAtomic(file, result.png);
|
|
1834
|
+
await writeJsonAtomic(index, { filename, diffPixels });
|
|
1835
|
+
return { file, diffPixels };
|
|
1821
1836
|
}
|
|
1822
1837
|
|
|
1823
1838
|
// modules/core/implementations/Functions/reviewBaselineChanges.ts
|
|
@@ -2640,15 +2655,46 @@ import { serveStatic } from "@hono/node-server/serve-static";
|
|
|
2640
2655
|
import { Hono } from "hono";
|
|
2641
2656
|
import { existsSync } from "node:fs";
|
|
2642
2657
|
import { stat as stat2 } from "node:fs/promises";
|
|
2643
|
-
import
|
|
2658
|
+
import path31 from "node:path";
|
|
2644
2659
|
import { z as z27 } from "zod";
|
|
2660
|
+
|
|
2661
|
+
// packages/conformance/runner/load.ts
|
|
2662
|
+
import { access as access2 } from "node:fs/promises";
|
|
2663
|
+
import path30 from "node:path";
|
|
2664
|
+
import { pathToFileURL } from "node:url";
|
|
2665
|
+
import { tsImport } from "tsx/esm/api";
|
|
2666
|
+
async function loadConformanceConfig(directory) {
|
|
2667
|
+
const file = path30.resolve(directory, "evidra.conformance.ts");
|
|
2668
|
+
try {
|
|
2669
|
+
await access2(file);
|
|
2670
|
+
} catch (error) {
|
|
2671
|
+
if (error.code === "ENOENT") return null;
|
|
2672
|
+
throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${file}`, { cause: error });
|
|
2673
|
+
}
|
|
2674
|
+
let config;
|
|
2675
|
+
try {
|
|
2676
|
+
const loaded = (await tsImport(pathToFileURL(file).href, import.meta.url)).default;
|
|
2677
|
+
config = loaded?.__esModule ? loaded.default : loaded;
|
|
2678
|
+
} catch (error) {
|
|
2679
|
+
throw new Error(
|
|
2680
|
+
`\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25 ${file}\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
2681
|
+
);
|
|
2682
|
+
}
|
|
2683
|
+
if (!config || !Array.isArray(config.rules) || config.rules.some((task) => typeof task !== "function") || config.projectRoot !== void 0 && typeof config.projectRoot !== "string") {
|
|
2684
|
+
throw new Error(`${file} \u5FC5\u987B\u9ED8\u8BA4\u5BFC\u51FA { projectRoot?: string, rules: RuleTask[] }`);
|
|
2685
|
+
}
|
|
2686
|
+
const projectRoot = path30.resolve(path30.dirname(file), config.projectRoot ?? ".");
|
|
2687
|
+
return { projectRoot, rules: config.rules };
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
// packages/service/src/server.ts
|
|
2645
2691
|
function defaultWebDist() {
|
|
2646
|
-
const fromSource =
|
|
2647
|
-
const fromBundle =
|
|
2648
|
-
return [fromSource, fromBundle].find((directory) => existsSync(
|
|
2692
|
+
const fromSource = path31.resolve(import.meta.dirname, "../../../dist/web");
|
|
2693
|
+
const fromBundle = path31.resolve(import.meta.dirname, "../../dist/web");
|
|
2694
|
+
return [fromSource, fromBundle].find((directory) => existsSync(path31.join(directory, "index.html"))) ?? fromSource;
|
|
2649
2695
|
}
|
|
2650
2696
|
async function startServer(options) {
|
|
2651
|
-
const root =
|
|
2697
|
+
const root = path31.resolve(options.repoRoot);
|
|
2652
2698
|
await loadConfig({ repoRoot: root });
|
|
2653
2699
|
const webDist = options.webDist ?? defaultWebDist();
|
|
2654
2700
|
const app = createApp(root, webDist);
|
|
@@ -2690,6 +2736,13 @@ function createApp(root, webDist) {
|
|
|
2690
2736
|
"/api/project",
|
|
2691
2737
|
async (context) => context.json(await readProjectInfo({ repoRoot: root }))
|
|
2692
2738
|
);
|
|
2739
|
+
app.get("/api/conformance", async (context) => {
|
|
2740
|
+
const config = await loadConformanceConfig(root);
|
|
2741
|
+
const rules = config ? config.rules.map(
|
|
2742
|
+
(task, index) => task.displayName?.trim() || task.name || `rule[${index + 1}]`
|
|
2743
|
+
) : null;
|
|
2744
|
+
return context.json({ rules });
|
|
2745
|
+
});
|
|
2693
2746
|
app.get(
|
|
2694
2747
|
"/api/changelog",
|
|
2695
2748
|
async (context) => context.json(await listChangelogCommits({ repoRoot: root }))
|
|
@@ -2803,7 +2856,7 @@ function createApp(root, webDist) {
|
|
|
2803
2856
|
"ETag",
|
|
2804
2857
|
`W/"${stats.size.toString(16)}-${stats.mtimeMs.toString(16)}-${stats.ctimeMs.toString(16)}"`
|
|
2805
2858
|
);
|
|
2806
|
-
const relativePath =
|
|
2859
|
+
const relativePath = path31.relative(webDist, filePath).split(path31.sep).join("/");
|
|
2807
2860
|
const immutable = context.req.path.startsWith("/report-static/") && /(?:^|[-/])[a-f0-9]{64}\.png$/.test(context.req.path) || !context.req.path.startsWith("/report-static/") && /^assets\/.+-[\w-]{8,}\.[\w.]+$/.test(relativePath);
|
|
2808
2861
|
context.header("Cache-Control", immutable ? "public, max-age=31536000, immutable" : "no-cache");
|
|
2809
2862
|
if (context.res.status !== 200 || !["GET", "HEAD"].includes(context.req.method)) return;
|
|
@@ -2843,7 +2896,7 @@ function createApp(root, webDist) {
|
|
|
2843
2896
|
await next();
|
|
2844
2897
|
});
|
|
2845
2898
|
app.get("*", serveStatic({ root: webDist, ...staticOptions }));
|
|
2846
|
-
app.get("*", (context, next) =>
|
|
2899
|
+
app.get("*", (context, next) => path31.extname(context.req.path) ? context.notFound() : next());
|
|
2847
2900
|
app.get("*", serveStatic({ root: webDist, path: "index.html", ...staticOptions }));
|
|
2848
2901
|
app.get("*", (context) => context.text("\u62A5\u544A UI \u5C1A\u672A\u6784\u5EFA\uFF1A\u8BF7\u5148\u8FD0\u884C pnpm build", 404));
|
|
2849
2902
|
return app;
|
|
@@ -2873,47 +2926,44 @@ async function startWorkbench(options) {
|
|
|
2873
2926
|
|
|
2874
2927
|
// packages/service/src/init.ts
|
|
2875
2928
|
import { mkdir as mkdir3, readFile as readFile12, stat as stat3, writeFile as writeFile3 } from "node:fs/promises";
|
|
2876
|
-
import
|
|
2929
|
+
import path32 from "node:path";
|
|
2877
2930
|
async function initProject(directory) {
|
|
2878
|
-
const root =
|
|
2931
|
+
const root = path32.resolve(directory);
|
|
2879
2932
|
await mkdir3(root, { recursive: true });
|
|
2880
2933
|
const messages = [];
|
|
2881
2934
|
async function create(file, content) {
|
|
2882
2935
|
try {
|
|
2883
2936
|
await writeFile3(file, content, { flag: "wx" });
|
|
2884
|
-
messages.push(`\u5DF2\u521B\u5EFA ${
|
|
2937
|
+
messages.push(`\u5DF2\u521B\u5EFA ${path32.relative(root, file)}`);
|
|
2885
2938
|
} catch (error) {
|
|
2886
2939
|
if (error.code !== "EEXIST") throw error;
|
|
2887
|
-
messages.push(`\u5DF2\u4FDD\u7559 ${
|
|
2940
|
+
messages.push(`\u5DF2\u4FDD\u7559 ${path32.relative(root, file)}`);
|
|
2888
2941
|
}
|
|
2889
2942
|
}
|
|
2890
2943
|
const skill = await readFile12(
|
|
2891
|
-
|
|
2944
|
+
path32.resolve(import.meta.dirname, "../../../skills/evidra/SKILL.md"),
|
|
2892
2945
|
"utf8"
|
|
2893
2946
|
);
|
|
2894
2947
|
let injected = false;
|
|
2895
2948
|
for (const agent of [".claude", ".codex"]) {
|
|
2896
2949
|
let exists = false;
|
|
2897
2950
|
try {
|
|
2898
|
-
exists = (await stat3(
|
|
2951
|
+
exists = (await stat3(path32.join(root, agent))).isDirectory();
|
|
2899
2952
|
} catch (error) {
|
|
2900
2953
|
if (error.code !== "ENOENT") throw error;
|
|
2901
2954
|
}
|
|
2902
2955
|
if (!exists) continue;
|
|
2903
2956
|
injected = true;
|
|
2904
|
-
const target =
|
|
2957
|
+
const target = path32.join(root, agent, "skills/evidra");
|
|
2905
2958
|
await mkdir3(target, { recursive: true });
|
|
2906
|
-
await create(
|
|
2959
|
+
await create(path32.join(target, "SKILL.md"), skill);
|
|
2907
2960
|
}
|
|
2908
2961
|
if (!injected) messages.push("\u672A\u53D1\u73B0 .claude \u6216 .codex \u6587\u4EF6\u5939\uFF0C\u672A\u6CE8\u5165\u4EFB\u4F55 skill\u3002");
|
|
2909
2962
|
return messages;
|
|
2910
2963
|
}
|
|
2911
2964
|
|
|
2912
2965
|
// packages/conformance/runner/cli.ts
|
|
2913
|
-
import
|
|
2914
|
-
import path32 from "node:path";
|
|
2915
|
-
import { pathToFileURL } from "node:url";
|
|
2916
|
-
import { tsImport } from "tsx/esm/api";
|
|
2966
|
+
import path33 from "node:path";
|
|
2917
2967
|
|
|
2918
2968
|
// packages/conformance/runner/run.ts
|
|
2919
2969
|
async function runner(common, tasks) {
|
|
@@ -2950,30 +3000,16 @@ function printResults(results) {
|
|
|
2950
3000
|
|
|
2951
3001
|
// packages/conformance/runner/cli.ts
|
|
2952
3002
|
async function runConformance(directory) {
|
|
2953
|
-
const
|
|
2954
|
-
|
|
2955
|
-
throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${
|
|
2956
|
-
});
|
|
2957
|
-
let config;
|
|
2958
|
-
try {
|
|
2959
|
-
const loaded = (await tsImport(pathToFileURL(file).href, import.meta.url)).default;
|
|
2960
|
-
config = loaded?.__esModule ? loaded.default : loaded;
|
|
2961
|
-
} catch (error) {
|
|
2962
|
-
throw new Error(
|
|
2963
|
-
`\u52A0\u8F7D\u914D\u7F6E\u5931\u8D25 ${file}\uFF1A${error instanceof Error ? error.message : String(error)}`
|
|
2964
|
-
);
|
|
2965
|
-
}
|
|
2966
|
-
if (!config || !Array.isArray(config.rules) || config.rules.some((task) => typeof task !== "function") || config.projectRoot !== void 0 && typeof config.projectRoot !== "string") {
|
|
2967
|
-
throw new Error(`${file} \u5FC5\u987B\u9ED8\u8BA4\u5BFC\u51FA { projectRoot?: string, rules: RuleTask[] }`);
|
|
2968
|
-
}
|
|
2969
|
-
const projectRoot = path32.resolve(path32.dirname(file), config.projectRoot ?? ".");
|
|
2970
|
-
return printResults(await runner({ projectRoot }, config.rules));
|
|
3003
|
+
const config = await loadConformanceConfig(directory);
|
|
3004
|
+
if (!config)
|
|
3005
|
+
throw new Error(`\u65E0\u6CD5\u8BFB\u53D6\u914D\u7F6E\u6587\u4EF6\uFF1A${path33.resolve(directory, "evidra.conformance.ts")}`);
|
|
3006
|
+
return printResults(await runner({ projectRoot: config.projectRoot }, config.rules));
|
|
2971
3007
|
}
|
|
2972
3008
|
|
|
2973
3009
|
// packages/service/src/cli.ts
|
|
2974
3010
|
var cli = cac("evidra");
|
|
2975
3011
|
cli.command("init [path]", "\u590D\u5236 skill \u5230\u9879\u76EE\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").action(async (target) => {
|
|
2976
|
-
const root =
|
|
3012
|
+
const root = path34.resolve(target ?? process.cwd());
|
|
2977
3013
|
console.log(`\u521D\u59CB\u5316 Evidra\uFF1A${root}`);
|
|
2978
3014
|
for (const message of await initProject(root)) console.log(message);
|
|
2979
3015
|
});
|
|
@@ -2982,14 +3018,14 @@ cli.command("start", "\u542F\u52A8\u5DE5\u4F5C\u53F0\uFF0C\u670D\u52A1\u5728\u52
|
|
|
2982
3018
|
if (!Number.isInteger(port) || port < 1 || port > 65535)
|
|
2983
3019
|
throw new Error("\u7AEF\u53E3\u5FC5\u987B\u662F 1\u201365535 \u7684\u6574\u6570");
|
|
2984
3020
|
await startWorkbench({
|
|
2985
|
-
repoRoot:
|
|
3021
|
+
repoRoot: path34.resolve(options.repo ?? process.env.TEST_REPORT_REPO ?? process.cwd()),
|
|
2986
3022
|
port
|
|
2987
3023
|
});
|
|
2988
3024
|
});
|
|
2989
3025
|
cli.command("compare", "\u8C03\u7528 core \u6BD4\u8F83\u4EFB\u52A1\u548C\u57FA\u7EBF\uFF0C\u8F93\u51FA summary").option("--repo <path>", "\u4ED3\u5E93\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u5F53\u524D\u76EE\u5F55").option("--task-id <id>", "\u4EFB\u52A1 ID").option("--full", "\u8F93\u51FA\u5B8C\u6574\u6BD4\u8F83\u7ED3\u679C").action(async (options) => {
|
|
2990
3026
|
if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
|
|
2991
3027
|
const result = await compareTask({
|
|
2992
|
-
repoRoot:
|
|
3028
|
+
repoRoot: path34.resolve(options.repo ?? process.cwd()),
|
|
2993
3029
|
taskId: options.taskId
|
|
2994
3030
|
});
|
|
2995
3031
|
console.log(JSON.stringify(options.full ? result : result.summary, null, 2));
|
|
@@ -2999,7 +3035,7 @@ cli.command("compare-tasks", "\u6BD4\u8F83\u4E24\u4E2A\u4EFB\u52A1\u7684\u7528\u
|
|
|
2999
3035
|
if (!options.baseTaskId) throw new Error("\u8BF7\u63D0\u4F9B --base-task-id");
|
|
3000
3036
|
if (!options.taskId) throw new Error("\u8BF7\u63D0\u4F9B --task-id");
|
|
3001
3037
|
const result = await compareTasks({
|
|
3002
|
-
repoRoot:
|
|
3038
|
+
repoRoot: path34.resolve(options.repo ?? process.cwd()),
|
|
3003
3039
|
baseTaskId: options.baseTaskId,
|
|
3004
3040
|
taskId: options.taskId
|
|
3005
3041
|
});
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e}from"./editor.api-
|
|
1
|
+
import{m as e}from"./editor.api-CsVhWQDt.js";import{t}from"./workers-BcFJUhLI.js";import{_ as n,a as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y}from"./lspLanguageFeatures-D9tA1yBW.js";var b=12e4,x=class{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&=(this._worker.dispose(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>b&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=t({moduleId:`vs/language/css/cssWorker`,createWorker:()=>new Worker(new URL(`/assets/css.worker-DwfUZ3fB.js`,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}};function S(t){let n=[],s=[],c=new x(t);n.push(c);let g=(...e)=>c.getLanguageServiceWorker(...e);function y(){let{languageId:n,modeConfiguration:c}=t;w(s),c.completionItems&&s.push(e.registerCompletionItemProvider(n,new _(g,[`/`,`-`,`:`]))),c.hovers&&s.push(e.registerHoverProvider(n,new a(g))),c.documentHighlights&&s.push(e.registerDocumentHighlightProvider(n,new p(g))),c.definitions&&s.push(e.registerDefinitionProvider(n,new f(g))),c.references&&s.push(e.registerReferenceProvider(n,new o(g))),c.documentSymbols&&s.push(e.registerDocumentSymbolProvider(n,new u(g))),c.rename&&s.push(e.registerRenameProvider(n,new m(g))),c.colors&&s.push(e.registerColorProvider(n,new l(g))),c.foldingRanges&&s.push(e.registerFoldingRangeProvider(n,new v(g))),c.diagnostics&&s.push(new h(n,g,t.onDidChange)),c.selectionRanges&&s.push(e.registerSelectionRangeProvider(n,new d(g))),c.documentFormattingEdits&&s.push(e.registerDocumentFormattingEditProvider(n,new r(g))),c.documentRangeFormattingEdits&&s.push(e.registerDocumentRangeFormattingEditProvider(n,new i(g)))}return y(),n.push(C(s)),C(n)}function C(e){return{dispose:()=>w(e)}}function w(e){for(;e.length;)e.pop().dispose()}export{_ as CompletionAdapter,f as DefinitionAdapter,h as DiagnosticsAdapter,l as DocumentColorAdapter,r as DocumentFormattingEditProvider,p as DocumentHighlightAdapter,g as DocumentLinkAdapter,i as DocumentRangeFormattingEditProvider,u as DocumentSymbolAdapter,v as FoldingRangeAdapter,a as HoverAdapter,o as ReferenceAdapter,m as RenameAdapter,d as SelectionRangeAdapter,x as WorkerManager,c as fromPosition,s as fromRange,S as setupMode,n as toRange,y as toTextEdit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./index-
|
|
1
|
+
import{t as e}from"./index-C49ToWrK.js";function t(e){if(e.length===0)throw Error(`Invalid tail call`);return[e.slice(0,e.length-1),e[e.length-1]]}function n(e,t,n=(e,t)=>e===t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}function r(e,t){let n=e.length-1;t<n&&(e[t]=e[n]),e.pop()}function i(e,t,n){return a(e.length,r=>n(e[r],t))}function a(e,t){let n=0,r=e-1;for(;n<=r;){let e=(n+r)/2|0,i=t(e);if(i<0)n=e+1;else if(i>0)r=e-1;else return e}return-(n+1)}function o(e,t,n){if(e|=0,e>=t.length)throw TypeError(`invalid index`);let r=t[Math.floor(t.length*Math.random())],i=[],a=[],s=[];for(let e of t){let t=n(e,r);t<0?i.push(e):t>0?a.push(e):s.push(e)}return e<i.length?o(e,i,n):e<i.length+s.length?s[0]:o(e-(i.length+s.length),a,n)}function s(e,t){let n=[],r;for(let i of e.slice(0).sort(t))!r||t(r[0],i)!==0?(r=[i],n.push(r)):r.push(i);return n}function*c(e,t){let n,r;for(let i of e)r!==void 0&&t(r,i)?n.push(i):(n&&(yield n),n=[i]),r=i;n&&(yield n)}function l(e,t){for(let n=0;n<=e.length;n++)t(n===0?void 0:e[n-1],n===e.length?void 0:e[n])}function u(e,t){for(let n=0;n<e.length;n++)t(n===0?void 0:e[n-1],e[n],n+1===e.length?void 0:e[n+1])}function d(e){return e.filter(e=>!!e)}function f(e){let t=0;for(let n=0;n<e.length;n++)e[n]&&(e[t]=e[n],t+=1);e.length=t}function p(e){return!Array.isArray(e)||e.length===0}function m(e){return Array.isArray(e)&&e.length>0}function h(e,t=e=>e){let n=new Set;return e.filter(e=>{let r=t(e);return!n.has(r)&&(n.add(r),!0)})}function g(e,t){let n=typeof t==`number`?e:0;typeof t==`number`?n=e:(n=0,t=e);let r=[];if(n<=t)for(let e=n;e<t;e++)r.push(e);else for(let e=n;e>t;e--)r.push(e);return r}function _(e,t,n){let r=e.slice(0,t),i=e.slice(t);return r.concat(n,i)}function v(e,t){let n=e.indexOf(t);n>-1&&(e.splice(n,1),e.unshift(t))}function y(e,t){let n=e.indexOf(t);n>-1&&(e.splice(n,1),e.push(t))}function b(e,t){for(let n of t)e.push(n)}function x(e,t){let n=[];for(let r of e){let e=t(r);e!==void 0&&n.push(e)}return n}function S(e){return Array.isArray(e)?e:[e]}function C(e,t,n){let r=ee(e,t),i=e.length,a=n.length;e.length=i+a;for(let t=i-1;t>=r;t--)e[t+a]=e[t];for(let t=0;t<a;t++)e[t+r]=n[t]}function w(e,t,n,r){let i=ee(e,t),a=e.splice(i,n);return a===void 0&&(a=[]),C(e,i,r),a}function ee(e,t){return t<0?Math.max(t+e.length,0):Math.min(t,e.length)}var te;(function(e){function t(e){return e<0}e.isLessThan=t;function n(e){return e<=0}e.isLessThanOrEqual=n;function r(e){return e>0}e.isGreaterThan=r;function i(e){return e===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(te||={});function ne(e,t){return(n,r)=>t(e(n),e(r))}function re(...e){return(t,n)=>{for(let r of e){let e=r(t,n);if(!te.isNeitherLessOrGreaterThan(e))return e}return te.neitherLessOrGreaterThan}}var ie=(e,t)=>e-t,ae=(e,t)=>ie(+!!e,+!!t);function oe(e){return(t,n)=>-e(t,n)}function se(e){return(t,n)=>t===void 0?n===void 0?te.neitherLessOrGreaterThan:te.lessThan:n===void 0?te.greaterThan:e(t,n)}var ce=class{constructor(e){this.firstIdx=0,this.items=e,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t<=this.lastIdx&&e(this.items[t]);)t++;let n=t===this.firstIdx?null:this.items.slice(this.firstIdx,t);return this.firstIdx=t,n}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){let e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){let t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}},le=class e{static{this.empty=new e(e=>{})}constructor(e){this.iterate=e}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(n=>!t(n)||e(n)))}map(t){return new e(e=>this.iterate(n=>e(t(n))))}findLast(e){let t;return this.iterate(n=>(e(n)&&(t=n),!0)),t}findLastMaxBy(e){let t,n=!0;return this.iterate(r=>((n||te.isGreaterThan(e(r,t)))&&(n=!1,t=r),!0)),t}},ue=class e{constructor(e){this._indexMap=e}static createSortPermutation(t,n){let r=Array.from(t.keys()).sort((e,r)=>n(t[e],t[r]));return new e(r)}apply(e){return e.map((t,n)=>e[this._indexMap[n]])}inverse(){let t=this._indexMap.slice();for(let e=0;e<this._indexMap.length;e++)t[this._indexMap[e]]=e;return new e(t)}};function de(e){return e.reduce((e,t)=>e+t,0)}var fe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?we.isErrorNoTelemetry(e)?new we(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|