@nekosu/maa-checker 1.0.7 → 1.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/main.js CHANGED
@@ -1955,8 +1955,8 @@ var require_request = __commonJS({
1955
1955
  var require_dispatcher = __commonJS({
1956
1956
  "node_modules/.pnpm/undici@6.23.0/node_modules/undici/lib/dispatcher/dispatcher.js"(exports2, module2) {
1957
1957
  "use strict";
1958
- var EventEmitter5 = require("node:events");
1959
- var Dispatcher = class extends EventEmitter5 {
1958
+ var EventEmitter6 = require("node:events");
1959
+ var Dispatcher = class extends EventEmitter6 {
1960
1960
  dispatch() {
1961
1961
  throw new Error("not implemented");
1962
1962
  }
@@ -4856,12 +4856,12 @@ var require_file = __commonJS({
4856
4856
  var FileLike = class _FileLike {
4857
4857
  constructor(blobLike, fileName, options = {}) {
4858
4858
  const n = fileName;
4859
- const t = options.type;
4859
+ const t2 = options.type;
4860
4860
  const d = options.lastModified ?? Date.now();
4861
4861
  this[kState] = {
4862
4862
  blobLike,
4863
4863
  name: n,
4864
- type: t,
4864
+ type: t2,
4865
4865
  lastModified: d
4866
4866
  };
4867
4867
  }
@@ -8228,9 +8228,9 @@ var require_balanced_pool = __commonJS({
8228
8228
  function getGreatestCommonDivisor(a, b) {
8229
8229
  if (a === 0) return b;
8230
8230
  while (b !== 0) {
8231
- const t = b;
8231
+ const t2 = b;
8232
8232
  b = a % b;
8233
- a = t;
8233
+ a = t2;
8234
8234
  }
8235
8235
  return a;
8236
8236
  }
@@ -20790,9 +20790,245 @@ function getIDToken(aud) {
20790
20790
  }
20791
20791
 
20792
20792
  // pkgs/maa-checker/src/main.ts
20793
+ var import_node_fs3 = require("node:fs");
20793
20794
  var fs4 = __toESM(require("node:fs/promises"));
20794
20795
  var path10 = __toESM(require("node:path"));
20795
20796
 
20797
+ // pkgs/locale/src/locale.en.ts
20798
+ var locale_en_default = {
20799
+ "maa.pi.entry.switch-controller": "Switch controller",
20800
+ "maa.pi.entry.switch-resource": "Switch resource",
20801
+ "maa.pi.entry.add-task": "Add task",
20802
+ "maa.pi.entry.move-task": "Move task",
20803
+ "maa.pi.entry.remove-task": "Remove task",
20804
+ "maa.pi.entry.launch": "Launch",
20805
+ "maa.pi.title.choose-action": "Choose action",
20806
+ "maa.pi.title.select-controller": "Select controller",
20807
+ "maa.pi.title.select-device": "Select device",
20808
+ "maa.pi.title.select-window": "Select window",
20809
+ "maa.pi.title.select-resource": "Select resource",
20810
+ "maa.pi.title.select-task": "Select task",
20811
+ "maa.pi.title.select-option": "Select option {0}",
20812
+ "maa.pi.title.input-image": "Input image name",
20813
+ "maa.pi.title.init-config": "Init config",
20814
+ "maa.pi.item.empty-config": "Init empty config",
20815
+ "maa.pi.item.interactive-setup-config": "Interactive setup config",
20816
+ "maa.pi.error.cannot-find-controller": "Cannot find controller {0}",
20817
+ "maa.pi.error.cannot-find-adb-for-controller": "Cannot find adb config for controller {0}",
20818
+ "maa.pi.error.cannot-find-win32-for-controller": "Cannot find win32 config for controller {0}",
20819
+ "maa.pi.error.cannot-find-hwnd-for-controller": "Cannot find hwnd in win32/gamepad config for controller {0}, please reconfigure the controller",
20820
+ "maa.pi.error.cannot-find-playcover-for-controller": "Cannot find playcover config for controller {0}",
20821
+ "maa.pi.error.cannot-find-address-for-controller": "Cannot find address in playcover config for controller {0}, please reconfigure the controller",
20822
+ "maa.pi.error.cannot-find-gamepad-for-controller": "Cannot find gamepad config for controller {0}",
20823
+ "maa.pi.error.cannot-find-resource": "Cannot find resource {0}",
20824
+ "maa.pi.error.cannot-find-task": "Cannot find task {0}",
20825
+ "maa.pi.error.cannot-find-option": "Cannot find option {0}",
20826
+ "maa.pi.error.cannot-find-case-for-option": "Cannot find case {0} for option {1}",
20827
+ "maa.pi.error.no-devices-found": "No devices found",
20828
+ "maa.pi.error.no-win32-config-provided": "No win32 config provided",
20829
+ "maa.pi.error.load-interface-failed": "Failed to load interface",
20830
+ "maa.pi.error.generate-runtime-failed": "Generate runtime failed: {0}",
20831
+ "maa.debug.init-controller-failed": "Init controller failed",
20832
+ "maa.debug.init-resource-failed": "Init resource failed",
20833
+ "maa.debug.init-instance-failed": "Init instance failed",
20834
+ "maa.debug.init-instance-succeeded": "Init instance succeeded",
20835
+ "maa.debug.task-started": "Task started {0} - {1}",
20836
+ "maa.debug.task-finished": "Task finished {0} - {1}",
20837
+ "maa.debug.task-failed": "Task failed {0} - {1}",
20838
+ "maa.pipeline.codelens.launch": "Launch",
20839
+ "maa.pipeline.codelens.eval-task": "Eval Task",
20840
+ "maa.pipeline.codelens.eval-expr": "Eval {0}",
20841
+ "maa.pipeline.codelens.resource-switch": "Switch",
20842
+ "maa.pipeline.codelens.resource-activated": "Activated",
20843
+ "maa.pipeline.codelens.resource-disabled": "Disabled",
20844
+ "maa.pipeline.codelens.language-switch": "Switch",
20845
+ "maa.pipeline.codelens.language-activated": "Activated",
20846
+ "maa.pipeline.codeaction.extract-locale": "Extract localization text",
20847
+ "maa.pipeline.codeaction.input-key": "Input localization key",
20848
+ "maa.pipeline.codeaction.key-exists": "already exists",
20849
+ "maa.pipeline.codeaction.switch-to-v1": "Switch to V1",
20850
+ "maa.pipeline.codeaction.switch-to-v2": "Switch to V2",
20851
+ "maa.pipeline.error.no-interface-found": "No interface found",
20852
+ "maa.pipeline.error.not-exists": "{0} not exists",
20853
+ "maa.pipeline.error.conflict-task": "Conflict task {0}, previous defined in {1}",
20854
+ "maa.pipeline.error.unknown-task": "Unknown task {0}",
20855
+ "maa.pipeline.error.unknown-image": "Unknown image {0}",
20856
+ "maa.pipeline.error.unknown-anchor": "Unknown anchor {0}",
20857
+ "maa.pipeline.error.unknown-attr": "Unknown attribute {0}",
20858
+ "maa.pipeline.error.duplicate-next": "Duplicate route {0}",
20859
+ "maa.pipeline.error.conflict-controller": "Conflict controller {0}, previous defined in {1}",
20860
+ "maa.pipeline.error.unknown-controller": "Unknown controller {0}",
20861
+ "maa.pipeline.error.conflict-resource": "Conflict resource {0}, previous defined in {1}",
20862
+ "maa.pipeline.error.unknown-resource": "Unknown resource {0}",
20863
+ "maa.pipeline.error.conflict-option": "Conflict option {0}, previous defined in {1}",
20864
+ "maa.pipeline.error.unknown-option": "Unknown option {0}",
20865
+ "maa.pipeline.error.conflict-case": "Conflict case {0} for option {1}, previous defined in {2}",
20866
+ "maa.pipeline.error.unknown-case": "Unknown case {0} for option {1}",
20867
+ "maa.pipeline.error.switch-name-invalid": "Switch name invalid, should be Yes or No",
20868
+ "maa.pipeline.error.switch-missing-yes": "Switch option missing Yes",
20869
+ "maa.pipeline.error.switch-missing-no": "Switch option missing No",
20870
+ "maa.pipeline.error.switch-missing-all": "Switch option missing Yes and No",
20871
+ "maa.pipeline.warning.switch-name-should-fixed": "Switch name should use Yes or No",
20872
+ "maa.pipeline.error.unknown-entry-task": "Unknown entry task {0}",
20873
+ "maa.pipeline.error.override-unknown-task": "Overriding unknown task {0}",
20874
+ "maa.pipeline.warning.image-path-backslash": "Image path contains backslash, shall use forward slash instead",
20875
+ "maa.pipeline.warning.image-path-dot-slash": "Image path contains ./ , shall omit instead",
20876
+ "maa.pipeline.warning.image-path-missing-png": "Image path shall not omit .png",
20877
+ "maa.pipeline.warning.image-path-dynamic": "Dynamic image path detected",
20878
+ "maa.native.in-use": "In use",
20879
+ "maa.native.downloaded": "Downloaded",
20880
+ "maa.native.extension-expected-version": "Expected version for extension",
20881
+ "maa.native.auto": "Auto",
20882
+ "maa.native.use-extension-expected-version": "Use expected version for extension automatically",
20883
+ "maa.native.switch-mirror": "Switch download mirror",
20884
+ "maa.native.switch-maafw": "Switch MaaFramework version",
20885
+ "maa.native.fetching-index": "Fetching index",
20886
+ "maa.native.download.preparing-folder": "Preparing folder",
20887
+ "maa.native.download.downloading-scripts": "Downloading MaaFramework {0} scripts",
20888
+ "maa.native.download.downloading-binary": "Downloading MaaFramework {0} binary",
20889
+ "maa.native.download.moving-folder": "Moving folder",
20890
+ "maa.native.loaded-ver": "LoadedVer",
20891
+ "maa.native.ext-int-ver": "ExtIntVer",
20892
+ "maa.status.checking-task": "MaaSupport checking task",
20893
+ "maa.status.not-loaded": "Not loaded",
20894
+ "maa.core.cannot-find-log": "Cannot find log file: {0}",
20895
+ "maa.core.load-maafw-failed": "Load MaaFramework failed",
20896
+ "maa.crop.warning.no-resource": "resource of interface not configured, will save directly",
20897
+ "maa.eval.input-task": "Input task",
20898
+ "maa.eval.eval-failed": "Evaluate failed!",
20899
+ "maa.eval.loop-detected": "Loop detected",
20900
+ "maa.eval.cannot-find-task-base": "Cannot find task template {0}",
20901
+ "maa.eval.json.eval-task": "Evaluate Task",
20902
+ "maa.eval.json.eval-list": "Evaluate List",
20903
+ "maa.eval.json.stripped": "Stripped",
20904
+ "maa.eval.json.expanded-from": "Expanded From"
20905
+ };
20906
+
20907
+ // pkgs/locale/src/locale.zh-cn.ts
20908
+ var locale_zh_cn_default = {
20909
+ "maa.pi.entry.switch-controller": "\u66F4\u6539\u63A7\u5236\u5668",
20910
+ "maa.pi.entry.switch-resource": "\u66F4\u6539\u8D44\u6E90",
20911
+ "maa.pi.entry.add-task": "\u6DFB\u52A0\u4EFB\u52A1",
20912
+ "maa.pi.entry.move-task": "\u79FB\u52A8\u4EFB\u52A1",
20913
+ "maa.pi.entry.remove-task": "\u5220\u9664\u4EFB\u52A1",
20914
+ "maa.pi.entry.launch": "\u6267\u884C",
20915
+ "maa.pi.title.choose-action": "\u9009\u62E9\u64CD\u4F5C",
20916
+ "maa.pi.title.select-controller": "\u9009\u62E9\u63A7\u5236\u53F0",
20917
+ "maa.pi.title.select-device": "\u9009\u62E9\u8BBE\u5907",
20918
+ "maa.pi.title.select-window": "\u9009\u62E9\u7A97\u53E3",
20919
+ "maa.pi.title.select-resource": "\u9009\u62E9\u8D44\u6E90",
20920
+ "maa.pi.title.select-task": "\u9009\u62E9\u4EFB\u52A1",
20921
+ "maa.pi.title.select-option": "\u9009\u62E9\u9009\u9879 {0}",
20922
+ "maa.pi.title.input-image": "\u8F93\u5165\u56FE\u7247\u540D\u79F0",
20923
+ "maa.pi.title.init-config": "\u521D\u59CB\u5316\u914D\u7F6E",
20924
+ "maa.pi.item.empty-config": "\u7A7A\u914D\u7F6E",
20925
+ "maa.pi.item.interactive-setup-config": "\u4EA4\u4E92\u5F0F\u8BBE\u7F6E\u914D\u7F6E",
20926
+ "maa.pi.error.cannot-find-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0}",
20927
+ "maa.pi.error.cannot-find-adb-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 Adb \u914D\u7F6E",
20928
+ "maa.pi.error.cannot-find-win32-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 Win32 \u914D\u7F6E",
20929
+ "maa.pi.error.cannot-find-hwnd-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 Win32/Gamepad \u914D\u7F6E\u7684 hwnd, \u8BF7\u91CD\u65B0\u914D\u7F6E\u63A7\u5236\u5668",
20930
+ "maa.pi.error.cannot-find-playcover-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 PlayCover \u914D\u7F6E",
20931
+ "maa.pi.error.cannot-find-address-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 PlayCover \u914D\u7F6E\u7684 address, \u8BF7\u91CD\u65B0\u914D\u7F6E\u63A7\u5236\u5668",
20932
+ "maa.pi.error.cannot-find-gamepad-for-controller": "\u65E0\u6CD5\u627E\u5230\u63A7\u5236\u5668 {0} \u7684 Gamepad \u914D\u7F6E",
20933
+ "maa.pi.error.cannot-find-resource": "\u65E0\u6CD5\u627E\u5230\u8D44\u6E90 {0}",
20934
+ "maa.pi.error.cannot-find-task": "\u65E0\u6CD5\u627E\u5230\u4EFB\u52A1 {0}",
20935
+ "maa.pi.error.cannot-find-option": "\u65E0\u6CD5\u627E\u5230\u9009\u9879\u7EC4 {0}",
20936
+ "maa.pi.error.cannot-find-case-for-option": "\u65E0\u6CD5\u627E\u5230\u9009\u9879\u7EC4 {1} \u7684\u503C {0}",
20937
+ "maa.pi.error.no-devices-found": "\u672A\u627E\u5230\u8BBE\u5907",
20938
+ "maa.pi.error.no-win32-config-provided": "\u672A\u63D0\u4F9B Win32 \u914D\u7F6E",
20939
+ "maa.pi.error.load-interface-failed": "\u65E0\u6CD5\u52A0\u8F7Dinterface",
20940
+ "maa.pi.error.generate-runtime-failed": "\u751F\u6210\u914D\u7F6E\u5931\u8D25: {0}",
20941
+ "maa.debug.init-controller-failed": "\u521D\u59CB\u5316\u63A7\u5236\u5668\u5931\u8D25",
20942
+ "maa.debug.init-resource-failed": "\u521D\u59CB\u5316\u8D44\u6E90\u5931\u8D25",
20943
+ "maa.debug.init-instance-failed": "\u521D\u59CB\u5316\u5B9E\u4F8B\u5931\u8D25",
20944
+ "maa.debug.init-instance-succeeded": "\u521D\u59CB\u5316\u5B9E\u4F8B\u6210\u529F",
20945
+ "maa.debug.task-started": "\u4EFB\u52A1\u5F00\u59CB {0} - {1}",
20946
+ "maa.debug.task-finished": "\u4EFB\u52A1\u5B8C\u6210 {0} - {1}",
20947
+ "maa.debug.task-failed": "\u4EFB\u52A1\u5931\u8D25 {0} - {1}",
20948
+ "maa.pipeline.codelens.launch": "\u6267\u884C",
20949
+ "maa.pipeline.codelens.eval-task": "\u8BA1\u7B97\u4EFB\u52A1",
20950
+ "maa.pipeline.codelens.eval-expr": "\u8BA1\u7B97 {0}",
20951
+ "maa.pipeline.codelens.resource-switch": "\u5207\u6362",
20952
+ "maa.pipeline.codelens.resource-activated": "\u5DF2\u6FC0\u6D3B",
20953
+ "maa.pipeline.codelens.resource-disabled": "\u5DF2\u7981\u7528",
20954
+ "maa.pipeline.codelens.language-switch": "\u5207\u6362",
20955
+ "maa.pipeline.codelens.language-activated": "\u5DF2\u6FC0\u6D3B",
20956
+ "maa.pipeline.codeaction.extract-locale": "\u63D0\u53D6\u56FD\u9645\u5316\u6587\u6848",
20957
+ "maa.pipeline.codeaction.input-key": "\u8F93\u5165\u56FD\u9645\u5316Key",
20958
+ "maa.pipeline.codeaction.key-exists": "\u5DF2\u5B58\u5728",
20959
+ "maa.pipeline.codeaction.switch-to-v1": "\u5207\u6362\u5230 V1",
20960
+ "maa.pipeline.codeaction.switch-to-v2": "\u5207\u6362\u5230 V2",
20961
+ "maa.pipeline.error.no-interface-found": "\u672A\u627E\u5230interface",
20962
+ "maa.pipeline.error.not-exists": "{0} \u4E0D\u5B58\u5728",
20963
+ "maa.pipeline.error.conflict-task": "\u51B2\u7A81\u4EFB\u52A1 {0}, \u4E0A\u4E00\u4E2A\u5B9A\u4E49\u5728 {1}",
20964
+ "maa.pipeline.error.unknown-task": "\u672A\u77E5\u4EFB\u52A1 {0}",
20965
+ "maa.pipeline.error.unknown-image": "\u672A\u77E5\u56FE\u7247 {0}",
20966
+ "maa.pipeline.error.unknown-anchor": "\u672A\u77E5Anchor {0}",
20967
+ "maa.pipeline.error.unknown-attr": "\u672A\u77E5\u5C5E\u6027 {0}",
20968
+ "maa.pipeline.error.duplicate-next": "\u91CD\u590D\u8DEF\u7531 {0}",
20969
+ "maa.pipeline.error.conflict-controller": "\u51B2\u7A81\u63A7\u5236\u5668 {0}, \u4E0A\u4E00\u4E2A\u5B9A\u4E49\u5728 {1}",
20970
+ "maa.pipeline.error.unknown-controller": "\u672A\u77E5\u63A7\u5236\u5668 {0}",
20971
+ "maa.pipeline.error.conflict-resource": "\u51B2\u7A81\u8D44\u6E90 {0}, \u4E0A\u4E00\u4E2A\u5B9A\u4E49\u5728 {1}",
20972
+ "maa.pipeline.error.unknown-resource": "\u672A\u77E5\u8D44\u6E90 {0}",
20973
+ "maa.pipeline.error.conflict-option": "\u51B2\u7A81\u9009\u9879 {0}, \u4E0A\u4E00\u4E2A\u5B9A\u4E49\u5728 {1}",
20974
+ "maa.pipeline.error.unknown-option": "\u672A\u77E5\u9009\u9879 {0}",
20975
+ "maa.pipeline.error.conflict-case": "\u9009\u9879 {1} \u51B2\u7A81\u9009\u9879\u503C {0}, \u4E0A\u4E00\u4E2A\u5B9A\u4E49\u5728 {2}",
20976
+ "maa.pipeline.error.unknown-case": "\u9009\u9879 {1} \u672A\u77E5\u7684\u9009\u9879\u503C {0}",
20977
+ "maa.pipeline.error.switch-name-invalid": "\u5F00\u5173\u540D\u65E0\u6548, \u5E94\u4F7F\u7528 Yes \u6216 No",
20978
+ "maa.pipeline.error.switch-missing-yes": "\u5F00\u5173\u9009\u9879\u7F3A\u5C11 Yes",
20979
+ "maa.pipeline.error.switch-missing-no": "\u5F00\u5173\u9009\u9879\u7F3A\u5C11 No",
20980
+ "maa.pipeline.error.switch-missing-all": "\u5F00\u5173\u9009\u9879\u7F3A\u5C11 Yes \u548C No",
20981
+ "maa.pipeline.warning.switch-name-should-fixed": "\u5F00\u5173\u540D\u5E94\u4F7F\u7528 Yes \u6216 No",
20982
+ "maa.pipeline.error.unknown-entry-task": "\u672A\u77E5\u5165\u53E3\u4EFB\u52A1 {0}",
20983
+ "maa.pipeline.error.override-unknown-task": "\u8986\u76D6\u672A\u77E5\u4EFB\u52A1 {0}",
20984
+ "maa.pipeline.warning.image-path-backslash": "\u56FE\u7247\u8DEF\u5F84\u4E2D\u5305\u542B\u53CD\u659C\u6760, \u5E94\u4F7F\u7528\u6B63\u659C\u6760",
20985
+ "maa.pipeline.warning.image-path-dot-slash": "\u56FE\u7247\u8DEF\u5F84\u4E2D\u5305\u542B ./ , \u5E94\u79FB\u9664",
20986
+ "maa.pipeline.warning.image-path-missing-png": "\u56FE\u7247\u8DEF\u5F84\u4E0D\u5E94\u7701\u7565.png",
20987
+ "maa.pipeline.warning.image-path-dynamic": "\u68C0\u6D4B\u5230\u52A8\u6001\u56FE\u7247\u8DEF\u5F84",
20988
+ "maa.native.in-use": "\u6B63\u5728\u4F7F\u7528",
20989
+ "maa.native.downloaded": "\u5DF2\u4E0B\u8F7D",
20990
+ "maa.native.extension-expected-version": "\u63D2\u4EF6\u9884\u671F\u7248\u672C",
20991
+ "maa.native.auto": "\u81EA\u52A8",
20992
+ "maa.native.use-extension-expected-version": "\u81EA\u52A8\u4F7F\u7528\u63D2\u4EF6\u9884\u671F\u7248\u672C",
20993
+ "maa.native.switch-mirror": "\u5207\u6362\u4E0B\u8F7D\u6E90",
20994
+ "maa.native.switch-maafw": "\u5207\u6362 MaaFramework \u7248\u672C",
20995
+ "maa.native.fetching-index": "\u83B7\u53D6\u7D22\u5F15\u4E2D",
20996
+ "maa.native.download.preparing-folder": "\u51C6\u5907\u76EE\u5F55\u4E2D",
20997
+ "maa.native.download.downloading-scripts": "\u4E0B\u8F7D MaaFramework {0} \u811A\u672C\u4E2D",
20998
+ "maa.native.download.downloading-binary": "\u4E0B\u8F7D MaaFramework {0} \u4E8C\u8FDB\u5236\u4E2D",
20999
+ "maa.native.download.moving-folder": "\u79FB\u52A8\u76EE\u5F55\u4E2D",
21000
+ "maa.native.loaded-ver": "\u52A0\u8F7D\u7248\u672C",
21001
+ "maa.native.ext-int-ver": "\u63A5\u53E3\u7248\u672C",
21002
+ "maa.status.checking-task": "MaaSupport \u68C0\u67E5\u4EFB\u52A1\u4E2D",
21003
+ "maa.status.not-loaded": "\u672A\u52A0\u8F7D",
21004
+ "maa.core.cannot-find-log": "\u65E0\u6CD5\u627E\u5230\u65E5\u5FD7\u6587\u4EF6: {0}",
21005
+ "maa.core.load-maafw-failed": "\u52A0\u8F7D MaaFramework \u5931\u8D25",
21006
+ "maa.crop.warning.no-resource": "\u672A\u914D\u7F6Einterface\u7684\u8D44\u6E90, \u5C06\u76F4\u63A5\u4FDD\u5B58",
21007
+ "maa.eval.input-task": "\u8F93\u5165\u4EFB\u52A1",
21008
+ "maa.eval.eval-failed": "\u8BA1\u7B97\u5931\u8D25!",
21009
+ "maa.eval.loop-detected": "\u68C0\u6D4B\u5230\u5FAA\u73AF",
21010
+ "maa.eval.cannot-find-task-base": "\u65E0\u6CD5\u627E\u5230\u4EFB\u52A1\u6A21\u677F {0}",
21011
+ "maa.eval.json.eval-task": "\u8BA1\u7B97\u4EFB\u52A1",
21012
+ "maa.eval.json.eval-list": "\u8BA1\u7B97\u5217\u8868",
21013
+ "maa.eval.json.stripped": "\u5DF2\u53BB\u91CD",
21014
+ "maa.eval.json.expanded-from": "\u5C55\u5F00\u81EA"
21015
+ };
21016
+
21017
+ // pkgs/locale/src/index.ts
21018
+ var locale = "zh";
21019
+ var localeDict = locale_zh_cn_default;
21020
+ function setLocale(lec) {
21021
+ locale = lec;
21022
+ localeDict = locale === "zh" ? locale_zh_cn_default : locale_en_default;
21023
+ }
21024
+ function t(key, ...args) {
21025
+ let str = localeDict[key];
21026
+ for (const [idx, arg] of Object.entries(args)) {
21027
+ str = str.replaceAll(`{${idx}}`, arg);
21028
+ }
21029
+ return str;
21030
+ }
21031
+
20796
21032
  // pkgs/pipeline-manager/src/bundle/bundle.ts
20797
21033
  var import_node_events = __toESM(require("node:events"));
20798
21034
  var path7 = __toESM(require("node:path"));
@@ -21505,7 +21741,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
21505
21741
  _jsonPath.pop();
21506
21742
  return true;
21507
21743
  }
21508
- function parseObject3() {
21744
+ function parseObject4() {
21509
21745
  onObjectBegin();
21510
21746
  scanNext();
21511
21747
  let needsComma = false;
@@ -21594,7 +21830,7 @@ function visit(text, visitor, options = ParseOptions.DEFAULT) {
21594
21830
  case 3:
21595
21831
  return parseArray2();
21596
21832
  case 1:
21597
- return parseObject3();
21833
+ return parseObject4();
21598
21834
  case 10:
21599
21835
  return parseString(true);
21600
21836
  default:
@@ -21782,6 +22018,7 @@ var ContentJson = class {
21782
22018
  this.duringFlush = false;
21783
22019
  this.flushResolve = [];
21784
22020
  this.needFlush = false;
22021
+ this.load();
21785
22022
  }
21786
22023
  async load() {
21787
22024
  this.watcherCtrl?.stop();
@@ -21869,6 +22106,33 @@ function relativePath(base, target) {
21869
22106
  }
21870
22107
 
21871
22108
  // pkgs/pipeline-manager/src/layer/layer.ts
22109
+ function specialStringify(value, indent, indentCount) {
22110
+ if (Array.isArray(value)) {
22111
+ if (value.length === 0) {
22112
+ return "[]";
22113
+ }
22114
+ const result = ["["];
22115
+ for (const val of value) {
22116
+ result.push(indent.repeat(indentCount) + specialStringify(val, indent, indentCount + 1) + ",");
22117
+ }
22118
+ result.push(indent.repeat(indentCount - 1) + "]");
22119
+ return result.join("\n");
22120
+ } else if (typeof value === "object") {
22121
+ if (Object.keys(value).length === 0) {
22122
+ return "{}";
22123
+ }
22124
+ const result = ["{"];
22125
+ for (const [key, val] of Object.entries(value)) {
22126
+ result.push(
22127
+ indent.repeat(indentCount) + JSON.stringify(key) + ": " + specialStringify(val, indent, indentCount + 1) + ","
22128
+ );
22129
+ }
22130
+ result.push(indent.repeat(indentCount - 1) + "}");
22131
+ return result.join("\n");
22132
+ } else {
22133
+ return JSON.stringify(value);
22134
+ }
22135
+ }
21872
22136
  var LayerInfo = class {
21873
22137
  loader;
21874
22138
  maa;
@@ -21877,6 +22141,7 @@ var LayerInfo = class {
21877
22141
  type;
21878
22142
  tasks;
21879
22143
  images;
22144
+ extraDecls;
21880
22145
  extraRefs;
21881
22146
  dirty;
21882
22147
  mergedDeclsCache;
@@ -21888,6 +22153,7 @@ var LayerInfo = class {
21888
22153
  this.type = type;
21889
22154
  this.tasks = {};
21890
22155
  this.images = /* @__PURE__ */ new Set();
22156
+ this.extraDecls = [];
21891
22157
  this.extraRefs = [];
21892
22158
  this.dirty = true;
21893
22159
  this.mergedDeclsCache = [];
@@ -21896,6 +22162,7 @@ var LayerInfo = class {
21896
22162
  reset() {
21897
22163
  this.tasks = {};
21898
22164
  this.images = /* @__PURE__ */ new Set();
22165
+ this.extraDecls = [];
21899
22166
  this.extraRefs = [];
21900
22167
  this.dirty = true;
21901
22168
  this.mergedDeclsCache = [];
@@ -21918,6 +22185,8 @@ var LayerInfo = class {
21918
22185
  changed.push(task);
21919
22186
  }
21920
22187
  }
22188
+ this.extraDecls = this.extraDecls.filter((decl) => decl.file !== file);
22189
+ this.extraRefs = this.extraRefs.filter((ref) => ref.file !== file);
21921
22190
  this.markDirty();
21922
22191
  return changed;
21923
22192
  }
@@ -21952,6 +22221,7 @@ var LayerInfo = class {
21952
22221
  this.mergedRefsCache.push(...taskInfo.info.refs);
21953
22222
  }
21954
22223
  }
22224
+ this.mergedDeclsCache.push(...this.extraDecls);
21955
22225
  this.mergedRefsCache.push(...this.extraRefs);
21956
22226
  this.dirty = false;
21957
22227
  }
@@ -22055,6 +22325,56 @@ var LayerInfo = class {
22055
22325
  }
22056
22326
  return result;
22057
22327
  }
22328
+ toggleMode(mode, info2, indent = " ") {
22329
+ const parts = info2.info.parts;
22330
+ const data = {};
22331
+ if (mode === 1) {
22332
+ if (parts.recoType) {
22333
+ data.recognition = parts.recoType.value;
22334
+ }
22335
+ for (const [key, obj] of parts.reco) {
22336
+ data[key] = buildTree(obj);
22337
+ }
22338
+ if (parts.actType) {
22339
+ data.action = parts.actType.value;
22340
+ }
22341
+ for (const [key, obj] of parts.act) {
22342
+ data[key] = buildTree(obj);
22343
+ }
22344
+ } else if (mode === 2) {
22345
+ if (parts.recoType || parts.reco.length > 0) {
22346
+ data.recognition = {};
22347
+ if (parts.recoType) {
22348
+ data.recognition.type = parts.recoType.value;
22349
+ }
22350
+ if (parts.reco.length > 0) {
22351
+ data.recognition.param = {};
22352
+ for (const [key, obj] of parts.reco) {
22353
+ data.recognition.param[key] = buildTree(obj);
22354
+ }
22355
+ }
22356
+ }
22357
+ if (parts.actType || parts.act.length > 0) {
22358
+ data.action = {};
22359
+ if (parts.actType) {
22360
+ data.action.type = parts.actType.value;
22361
+ }
22362
+ if (parts.act.length > 0) {
22363
+ data.action.param = {};
22364
+ for (const [key, obj] of parts.act) {
22365
+ data.action.param[key] = buildTree(obj);
22366
+ }
22367
+ }
22368
+ }
22369
+ }
22370
+ for (const [key, obj] of parts.base) {
22371
+ data[key] = buildTree(obj);
22372
+ }
22373
+ for (const [key, obj] of parts.unknown) {
22374
+ data[key] = buildTree(obj);
22375
+ }
22376
+ return JSON.stringify(info2.prop.value) + ": " + specialStringify(data, indent, 2);
22377
+ }
22058
22378
  };
22059
22379
 
22060
22380
  // pkgs/pipeline-manager/src/parser/task/anchor.ts
@@ -22079,6 +22399,31 @@ function parseAnchor(node, info2, ctx) {
22079
22399
  }
22080
22400
  }
22081
22401
 
22402
+ // pkgs/pipeline-manager/src/parser/task/focus.ts
22403
+ function parseFocus(node, info2, ctx) {
22404
+ for (const [key, obj] of parseObject(node)) {
22405
+ if (isString(obj)) {
22406
+ if (obj.value.startsWith("$")) {
22407
+ info2.refs.push({
22408
+ file: ctx.file,
22409
+ location: obj,
22410
+ type: "task.locale",
22411
+ target: obj.value.substring(1)
22412
+ });
22413
+ } else {
22414
+ if (obj.value.length > 0) {
22415
+ info2.refs.push({
22416
+ file: ctx.file,
22417
+ location: obj,
22418
+ type: "task.can_locale",
22419
+ target: obj.value
22420
+ });
22421
+ }
22422
+ }
22423
+ }
22424
+ }
22425
+ }
22426
+
22082
22427
  // pkgs/pipeline-manager/src/parser/task/target.ts
22083
22428
  function parseTarget(node, info2, ctx, acceptArray = false) {
22084
22429
  if (isString(node)) {
@@ -23333,6 +23678,9 @@ function parseBase(props, info2, ctx) {
23333
23678
  case "repeat_wait_freezes":
23334
23679
  parseFreeze(obj, info2, ctx);
23335
23680
  break;
23681
+ case "focus":
23682
+ parseFocus(obj, info2, ctx);
23683
+ break;
23336
23684
  }
23337
23685
  }
23338
23686
  }
@@ -23358,8 +23706,19 @@ function parseReco(props, info2, prev, ctx, parent) {
23358
23706
  case "all_of":
23359
23707
  case "any_of":
23360
23708
  for (const sub of parseArray(obj)) {
23361
- const subInfo = splitNode(sub, false);
23362
- parseReco(subInfo.reco, info2, prev, ctx, sub);
23709
+ if (isString(sub)) {
23710
+ info2.refs.push({
23711
+ file: ctx.file,
23712
+ location: sub,
23713
+ type: "task.roi",
23714
+ target: sub.value,
23715
+ prev: [],
23716
+ task: ctx.taskName
23717
+ });
23718
+ } else {
23719
+ const subInfo = splitNode(sub, false);
23720
+ parseReco(subInfo.reco, info2, prev, ctx, sub);
23721
+ }
23363
23722
  }
23364
23723
  break;
23365
23724
  case "sub_name":
@@ -25861,9 +26220,80 @@ function performDiagnostic(bundle) {
25861
26220
  result.push(...checkInterface(bundle));
25862
26221
  return result;
25863
26222
  }
26223
+ async function buildDiagnosticMessage(root, diag, evalPos) {
26224
+ const buildPos = async (loc) => {
26225
+ const [line, column] = await evalPos(loc.file, loc.offset);
26226
+ return `${relativePath(root, loc.file)}:${line}:${column}`;
26227
+ };
26228
+ const start = await evalPos(diag.file, diag.offset);
26229
+ const end = await evalPos(diag.file, diag.offset + diag.length);
26230
+ const buildBrief = async () => {
26231
+ switch (diag.type) {
26232
+ case "conflict-task":
26233
+ return t("maa.pipeline.error.conflict-task", diag.task, await buildPos(diag.previous));
26234
+ case "duplicate-next":
26235
+ return t("maa.pipeline.error.duplicate-next", diag.task);
26236
+ case "unknown-task":
26237
+ return t("maa.pipeline.error.unknown-task", diag.task);
26238
+ case "dynamic-image":
26239
+ return t("maa.pipeline.warning.image-path-dynamic");
26240
+ case "image-path-back-slash":
26241
+ return t("maa.pipeline.warning.image-path-backslash");
26242
+ case "image-path-dot-slash":
26243
+ return t("maa.pipeline.warning.image-path-dot-slash");
26244
+ case "image-path-missing-png":
26245
+ return t("maa.pipeline.warning.image-path-missing-png");
26246
+ case "unknown-image":
26247
+ return t("maa.pipeline.error.unknown-image", diag.image);
26248
+ case "unknown-anchor":
26249
+ return t("maa.pipeline.error.unknown-anchor", diag.anchor);
26250
+ case "unknown-attr":
26251
+ return t("maa.pipeline.error.unknown-attr", diag.attr);
26252
+ case "int-conflict-controller":
26253
+ return t("maa.pipeline.error.conflict-controller", diag.ctrl, await buildPos(diag.previous));
26254
+ case "int-unknown-controller":
26255
+ return t("maa.pipeline.error.unknown-controller", diag.ctrl);
26256
+ case "int-conflict-resource":
26257
+ return t("maa.pipeline.error.conflict-resource", diag.res, await buildPos(diag.previous));
26258
+ case "int-unknown-resource":
26259
+ return t("maa.pipeline.error.unknown-resource", diag.res);
26260
+ case "int-conflict-option":
26261
+ return t("maa.pipeline.error.conflict-option", diag.option, await buildPos(diag.previous));
26262
+ case "int-unknown-option":
26263
+ return t("maa.pipeline.error.unknown-option", diag.option);
26264
+ case "int-conflict-case":
26265
+ return t(
26266
+ "maa.pipeline.error.conflict-case",
26267
+ diag.case,
26268
+ diag.option,
26269
+ await buildPos(diag.previous)
26270
+ );
26271
+ case "int-unknown-case":
26272
+ return t("maa.pipeline.error.unknown-case", diag.case, diag.option);
26273
+ case "int-switch-name-invalid":
26274
+ return t("maa.pipeline.error.switch-name-invalid");
26275
+ case "int-switch-missing":
26276
+ if (diag.missingYes && diag.missingNo) {
26277
+ return t("maa.pipeline.error.switch-missing-all");
26278
+ } else if (diag.missingYes) {
26279
+ return t("maa.pipeline.error.switch-missing-yes");
26280
+ } else {
26281
+ return t("maa.pipeline.error.switch-missing-no");
26282
+ }
26283
+ case "int-switch-should-fixed":
26284
+ return t("maa.pipeline.warning.switch-name-should-fixed");
26285
+ case "int-unknown-entry-task":
26286
+ return t("maa.pipeline.error.unknown-entry-task", diag.task);
26287
+ case "int-override-unknown-task":
26288
+ return t("maa.pipeline.error.override-unknown-task", diag.task);
26289
+ }
26290
+ return `unknown diagnostic: ${JSON.stringify(diag)}`;
26291
+ };
26292
+ return [start, end, await buildBrief()];
26293
+ }
25864
26294
 
25865
26295
  // pkgs/pipeline-manager/src/interface/interface.ts
25866
- var import_node_events3 = __toESM(require("node:events"));
26296
+ var import_node_events4 = __toESM(require("node:events"));
25867
26297
  var path9 = __toESM(require("node:path"));
25868
26298
 
25869
26299
  // pkgs/pipeline-manager/src/parser/interface/ctrlRef.ts
@@ -26164,20 +26594,32 @@ function parseResRef(node, info2, ctx) {
26164
26594
 
26165
26595
  // pkgs/pipeline-manager/src/parser/interface/interface.ts
26166
26596
  function parseController(node, info2, ctx) {
26597
+ let loc = null;
26598
+ const decl = {
26599
+ type: "interface.controller",
26600
+ name: "",
26601
+ attachs: []
26602
+ };
26167
26603
  for (const [key, obj] of parseObject(node)) {
26168
26604
  switch (key) {
26169
26605
  case "name":
26170
26606
  if (isString(obj)) {
26171
- info2.decls.push({
26172
- file: ctx.file,
26173
- location: obj,
26174
- type: "interface.controller",
26175
- name: obj.value
26176
- });
26607
+ loc = obj;
26608
+ decl.name = obj.value;
26177
26609
  }
26178
26610
  break;
26611
+ case "attach_resource_path":
26612
+ decl.attachs = parsePath(obj, info2, ctx);
26613
+ break;
26179
26614
  }
26180
26615
  }
26616
+ if (loc) {
26617
+ info2.decls.push({
26618
+ file: ctx.file,
26619
+ location: loc,
26620
+ ...decl
26621
+ });
26622
+ }
26181
26623
  }
26182
26624
  function parseResource(node, info2, ctx) {
26183
26625
  let loc = null;
@@ -26260,13 +26702,24 @@ function parseTaskSec(node, info2, ctx) {
26260
26702
  function parseLocalization(node, info2, ctx) {
26261
26703
  if (node.type === "object") {
26262
26704
  for (const [key, obj] of parseObject(node)) {
26263
- if (locKeys.includes(key) && isString(obj) && obj.value.startsWith("$")) {
26264
- info2.refs.push({
26265
- file: ctx.file,
26266
- location: obj,
26267
- type: "interface.locale",
26268
- target: obj.value.substring(1)
26269
- });
26705
+ if (locKeys.includes(key) && isString(obj)) {
26706
+ if (obj.value.startsWith("$")) {
26707
+ info2.layer.extraRefs.push({
26708
+ file: ctx.file,
26709
+ location: obj,
26710
+ type: "task.locale",
26711
+ target: obj.value.substring(1)
26712
+ });
26713
+ } else {
26714
+ if (obj.value.length > 0) {
26715
+ info2.layer.extraRefs.push({
26716
+ file: ctx.file,
26717
+ location: obj,
26718
+ type: "task.can_locale",
26719
+ target: obj.value
26720
+ });
26721
+ }
26722
+ }
26270
26723
  } else {
26271
26724
  parseLocalization(obj, info2, ctx);
26272
26725
  }
@@ -26314,6 +26767,163 @@ function parseInterface(node, info2, ctx) {
26314
26767
  parseLocalization(node, info2, ctx);
26315
26768
  }
26316
26769
 
26770
+ // pkgs/pipeline-manager/src/interface/language.ts
26771
+ var import_node_events3 = require("node:events");
26772
+ var LanguageBundle = class extends import_node_events3.EventEmitter {
26773
+ loader;
26774
+ watcher;
26775
+ root;
26776
+ langs;
26777
+ constructor(loader, watcher, root) {
26778
+ super();
26779
+ this.loader = loader;
26780
+ this.watcher = watcher;
26781
+ this.root = root;
26782
+ this.langs = [];
26783
+ }
26784
+ stop() {
26785
+ for (const lang of this.langs) {
26786
+ lang.content.stop();
26787
+ }
26788
+ }
26789
+ async flush() {
26790
+ await Promise.all(this.langs.map((lang) => lang.content.flush()));
26791
+ }
26792
+ async update(config) {
26793
+ const currentConfig = JSON.stringify(this.langs.map((info2) => [info2.name, info2.file]));
26794
+ if (currentConfig === JSON.stringify(config)) {
26795
+ return true;
26796
+ }
26797
+ this.stop();
26798
+ this.langs = config.map(([name, file], idx) => ({
26799
+ name,
26800
+ file,
26801
+ content: new ContentJson(this.loader, this.watcher, joinPath(this.root, file), async () => {
26802
+ await this.rebuildIndex(idx);
26803
+ }),
26804
+ entries: [],
26805
+ decls: []
26806
+ }));
26807
+ await Promise.all(this.langs.map((lang) => lang.content.load()));
26808
+ }
26809
+ async rebuildIndex(idx) {
26810
+ const lang = this.langs[idx];
26811
+ const full = joinPath(this.root, lang.file);
26812
+ lang.entries = [];
26813
+ lang.decls = [];
26814
+ for (const [key, obj, prop] of parseObject(lang.content.node)) {
26815
+ if (isString(obj)) {
26816
+ lang.entries.push({
26817
+ key,
26818
+ keyNode: prop,
26819
+ value: obj.value,
26820
+ valueNode: obj
26821
+ });
26822
+ lang.decls.push({
26823
+ location: prop,
26824
+ file: full,
26825
+ type: "task.locale",
26826
+ key,
26827
+ value: obj.value,
26828
+ valueNode: obj
26829
+ });
26830
+ }
26831
+ }
26832
+ this.emit("localeChanged");
26833
+ }
26834
+ allKeys() {
26835
+ const keys = this.langs.map((lang) => lang.entries.map((entry) => entry.key)).flat();
26836
+ return [...new Set(keys)];
26837
+ }
26838
+ queryName(name) {
26839
+ const idx = this.langs.findIndex((lang) => lang.name === name);
26840
+ return idx === -1 ? 0 : idx;
26841
+ }
26842
+ queryKey(key) {
26843
+ const result = [];
26844
+ for (const lang of this.langs) {
26845
+ const info2 = lang.entries.find((info3) => info3.key === key);
26846
+ result.push(info2 ?? null);
26847
+ }
26848
+ return result;
26849
+ }
26850
+ addPair(key, value, indent = " ") {
26851
+ const keys = this.allKeys();
26852
+ if (keys.includes(key)) {
26853
+ return [];
26854
+ }
26855
+ const row = JSON.stringify(key) + ": " + JSON.stringify(value);
26856
+ const result = [];
26857
+ if (keys.length === 0) {
26858
+ return this.langs.map((lang) => {
26859
+ return {
26860
+ type: "replace",
26861
+ file: joinPath(this.root, lang.file),
26862
+ content: `{
26863
+ ${indent}${row},
26864
+ }
26865
+ `
26866
+ };
26867
+ });
26868
+ } else {
26869
+ let insertIndex = keys.findIndex((val) => val.localeCompare(key) > 0);
26870
+ if (insertIndex === -1) {
26871
+ insertIndex = keys.length;
26872
+ }
26873
+ const upper = keys.slice(0, insertIndex);
26874
+ const lower = keys.slice(insertIndex);
26875
+ for (const lang of this.langs) {
26876
+ let found = false;
26877
+ for (const upKey of upper.toReversed()) {
26878
+ const anchor = lang.entries.find((entry) => entry.key === upKey);
26879
+ if (!anchor) {
26880
+ continue;
26881
+ }
26882
+ result.push({
26883
+ type: "insert",
26884
+ file: joinPath(this.root, lang.file),
26885
+ content: `,
26886
+ ${indent}${row}`,
26887
+ offset: anchor.valueNode.offset + anchor.valueNode.length
26888
+ });
26889
+ found = true;
26890
+ break;
26891
+ }
26892
+ if (found) {
26893
+ continue;
26894
+ }
26895
+ for (const loKey of lower) {
26896
+ const anchor = lang.entries.find((entry) => entry.key === loKey);
26897
+ if (!anchor) {
26898
+ continue;
26899
+ }
26900
+ result.push({
26901
+ type: "insert",
26902
+ file: joinPath(this.root, lang.file),
26903
+ content: `${row},
26904
+ ${indent}`,
26905
+ offset: anchor.keyNode.offset
26906
+ });
26907
+ found = true;
26908
+ break;
26909
+ }
26910
+ if (found) {
26911
+ continue;
26912
+ }
26913
+ result.push({
26914
+ type: "replace",
26915
+ file: joinPath(this.root, lang.file),
26916
+ content: `{
26917
+ ${indent}${row},
26918
+ }
26919
+ `
26920
+ });
26921
+ }
26922
+ }
26923
+ return result;
26924
+ }
26925
+ };
26926
+
26317
26927
  // pkgs/pipeline-manager/src/interface/interface.ts
26318
26928
  var MaaEvalDelegateImpl = class extends MaaEvalDelegate {
26319
26929
  intBundle;
@@ -26336,7 +26946,7 @@ var MaaEvalDelegateImpl = class extends MaaEvalDelegate {
26336
26946
  });
26337
26947
  }
26338
26948
  };
26339
- var InterfaceBundle = class extends import_node_events3.default {
26949
+ var InterfaceBundle = class extends import_node_events4.default {
26340
26950
  maa;
26341
26951
  root;
26342
26952
  file;
@@ -26344,14 +26954,12 @@ var InterfaceBundle = class extends import_node_events3.default {
26344
26954
  info;
26345
26955
  importFiles;
26346
26956
  imports;
26347
- active;
26957
+ activeController;
26958
+ activeResource;
26348
26959
  paths;
26349
26960
  bundles;
26350
- langFiles;
26351
- langs;
26352
- langIndex;
26961
+ langBundle;
26353
26962
  eval;
26354
- contentDebouncerTimer;
26355
26963
  set evalErrorDelegate(delegate) {
26356
26964
  this.eval.error = delegate;
26357
26965
  }
@@ -26376,12 +26984,11 @@ var InterfaceBundle = class extends import_node_events3.default {
26376
26984
  refs: [],
26377
26985
  layer: new LayerInfo(loader, this.maa, this.root, "interface")
26378
26986
  };
26379
- this.active = "";
26987
+ this.activeController = "";
26988
+ this.activeResource = "";
26380
26989
  this.paths = [];
26381
26990
  this.bundles = [];
26382
- this.langFiles = [];
26383
- this.langs = [];
26384
- this.langIndex = {};
26991
+ this.langBundle = new LanguageBundle(loader, watcher, this.root);
26385
26992
  this.importFiles = [];
26386
26993
  this.imports = [];
26387
26994
  this.eval = new MaaEvalDelegateImpl(this);
@@ -26393,9 +27000,6 @@ var InterfaceBundle = class extends import_node_events3.default {
26393
27000
  this.on("activeChanged", () => {
26394
27001
  this.updatePaths();
26395
27002
  });
26396
- this.on("langChanged", async () => {
26397
- await Promise.all(this.langs.map((content) => content.load()));
26398
- });
26399
27003
  this.on("importChanged", async () => {
26400
27004
  await Promise.all(this.imports.map((content) => content.load()));
26401
27005
  });
@@ -26408,6 +27012,7 @@ var InterfaceBundle = class extends import_node_events3.default {
26408
27012
  this.info.layer.parent = prev;
26409
27013
  await Promise.all(this.bundles.map((bundle) => bundle.load()));
26410
27014
  this.emit("bundleReloaded");
27015
+ this.emit("switchActiveFinished");
26411
27016
  });
26412
27017
  this.on("bundleReloaded", () => {
26413
27018
  for (const bundle of this.bundles) {
@@ -26422,6 +27027,10 @@ var InterfaceBundle = class extends import_node_events3.default {
26422
27027
  });
26423
27028
  }
26424
27029
  });
27030
+ this.langBundle.on("localeChanged", () => {
27031
+ this.info.layer.extraDecls = this.langBundle.langs.map((lang) => lang.decls).flat();
27032
+ this.emit("localeChanged");
27033
+ });
26425
27034
  }
26426
27035
  async load() {
26427
27036
  await this.content.load();
@@ -26437,27 +27046,45 @@ var InterfaceBundle = class extends import_node_events3.default {
26437
27046
  for (const imp of this.imports) {
26438
27047
  await imp.flush();
26439
27048
  }
27049
+ await this.langBundle.flush();
26440
27050
  if (flushBundles) {
26441
27051
  await Promise.all(this.bundles.map((bundle) => bundle.flush()));
26442
27052
  }
26443
27053
  }
26444
- switchActive(active) {
26445
- this.active = active;
27054
+ switchActive(controller, resource) {
27055
+ this.activeController = controller;
27056
+ this.activeResource = resource;
27057
+ const pro = new Promise((resolve5) => {
27058
+ this.once("switchActiveFinished", resolve5);
27059
+ });
26446
27060
  this.emit("activeChanged");
27061
+ return pro;
27062
+ }
27063
+ allControllerNames(onlyWithAttaches = false) {
27064
+ return this.info.decls.filter((decl) => decl.type === "interface.controller").filter(onlyWithAttaches ? (decl) => decl.attachs.length > 0 : () => true).map((info2) => info2.name);
26447
27065
  }
26448
27066
  allResourceNames() {
26449
27067
  return this.info.decls.filter((decl) => decl.type === "interface.resource").map((info2) => info2.name);
26450
27068
  }
26451
27069
  updatePaths() {
26452
- const resInfo = this.info.decls.filter((decl) => decl.type === "interface.resource").find((info2) => info2.name === this.active);
27070
+ const ctrlInfo = this.info.decls.filter((decl) => decl.type === "interface.controller").find((info2) => info2.name === this.activeController);
27071
+ const resInfo = this.info.decls.filter((decl) => decl.type === "interface.resource").find((info2) => info2.name === this.activeResource);
27072
+ const finalPaths = [];
26453
27073
  if (resInfo) {
26454
- if (JSON.stringify(this.paths) === JSON.stringify(resInfo.paths)) {
27074
+ finalPaths.push(...resInfo.paths);
27075
+ }
27076
+ if (ctrlInfo) {
27077
+ finalPaths.push(...ctrlInfo.attachs);
27078
+ }
27079
+ if (finalPaths.length > 0) {
27080
+ if (JSON.stringify(this.paths) === JSON.stringify(finalPaths)) {
27081
+ this.emit("switchActiveFinished");
26455
27082
  return;
26456
27083
  }
26457
- for (const content of this.langs) {
27084
+ for (const content of this.imports) {
26458
27085
  content.stop();
26459
27086
  }
26460
- this.paths = resInfo.paths;
27087
+ this.paths = finalPaths;
26461
27088
  this.bundles = this.paths.map((dir) => {
26462
27089
  return new Bundle(
26463
27090
  this.content.loader,
@@ -26478,44 +27105,9 @@ var InterfaceBundle = class extends import_node_events3.default {
26478
27105
  updateLangs() {
26479
27106
  const langInfos = this.info.decls.filter((decl) => decl.type === "interface.language");
26480
27107
  const newFiles = langInfos.map((info2) => [info2.name, info2.path]);
26481
- if (JSON.stringify(this.langFiles) === JSON.stringify(newFiles)) {
26482
- return;
26483
- }
26484
- for (const content of this.langs) {
26485
- content.stop();
26486
- }
26487
- this.langFiles = newFiles;
26488
- this.langs = newFiles.map(([locale, file]) => {
26489
- return new ContentJson(
26490
- this.content.loader,
26491
- this.content.watcher,
26492
- joinPath(this.root, file),
26493
- () => {
26494
- this.buildLangIndex();
26495
- }
26496
- );
27108
+ this.langBundle.update(newFiles).then(() => {
27109
+ this.emit("localeChanged");
26497
27110
  });
26498
- this.emit("langChanged");
26499
- }
26500
- buildLangIndex() {
26501
- this.langIndex = {};
26502
- for (const [index, [locale]] of this.langFiles.entries()) {
26503
- const lang = this.langs[index];
26504
- for (const [key, obj, prop] of parseObject(lang.node)) {
26505
- if (!isString(obj)) {
26506
- continue;
26507
- }
26508
- this.langIndex[key] = this.langIndex[key] ?? [];
26509
- this.langIndex[key].push({
26510
- location: obj,
26511
- locale,
26512
- localeIndex: index,
26513
- prop,
26514
- value: obj.value
26515
- });
26516
- }
26517
- }
26518
- this.emit("localeChanged");
26519
27111
  }
26520
27112
  removeFile(file) {
26521
27113
  this.info.decls = this.info.decls.filter((decl) => decl.file !== file);
@@ -26553,7 +27145,7 @@ var InterfaceBundle = class extends import_node_events3.default {
26553
27145
  }
26554
27146
  locateLayer(file) {
26555
27147
  const rel = relativePath(this.root, file).replaceAll(path9.sep, "/");
26556
- if (file === this.file || this.importFiles.includes(rel)) {
27148
+ if (file === this.file || this.importFiles.includes(rel) || this.langBundle.langs.find((lang) => lang.file === rel)) {
26557
27149
  return [this.info.layer, file, false];
26558
27150
  } else {
26559
27151
  for (const bundle of this.bundles) {
@@ -26601,7 +27193,7 @@ var InterfaceBundle = class extends import_node_events3.default {
26601
27193
  // pkgs/maa-checker/package.json
26602
27194
  var package_default = {
26603
27195
  name: "@nekosu/maa-checker",
26604
- version: "1.0.7",
27196
+ version: "1.0.9",
26605
27197
  bin: {
26606
27198
  "maa-checker": "bin/maa-checker"
26607
27199
  },
@@ -26612,6 +27204,7 @@ var package_default = {
26612
27204
  devDependencies: {
26613
27205
  "@actions/core": "^3.0.0",
26614
27206
  "@maaxyz/maa-node": "5.5.0",
27207
+ "@mse/locale": "workspace:*",
26615
27208
  "@mse/pipeline-manager": "workspace:*",
26616
27209
  "@mse/types": "workspace:*",
26617
27210
  "@tsconfig/node20": "^20.1.8",
@@ -26669,14 +27262,17 @@ Options:
26669
27262
  --github=<repo> Output github actions compatible warning & error messages, with repository folder <repo>.
26670
27263
  --ignore=<type> Ignore <type>
26671
27264
  Known types: ${allTypes.join(", ")}
27265
+ --locale=<lang> Use locale <lang>
27266
+ Known locales: zh, en
26672
27267
  `);
26673
27268
  process.exit(1);
26674
27269
  }
26675
- const interfacePath = path10.resolve(process.argv[2]);
27270
+ let interfacePath = path10.resolve(process.argv[2]);
26676
27271
  let rawMode = false;
26677
27272
  let githubMode = false;
26678
27273
  let repoFolder = process.cwd();
26679
27274
  const ignoreTypes = [];
27275
+ setLocale("en");
26680
27276
  rawMode = process.argv[3] === "--raw";
26681
27277
  for (const opt of process.argv.slice(3)) {
26682
27278
  if (opt === "--raw") {
@@ -26686,8 +27282,24 @@ Options:
26686
27282
  repoFolder = path10.resolve(opt.slice("--github=".length));
26687
27283
  } else if (opt.startsWith("--ignore=")) {
26688
27284
  ignoreTypes.push(opt.slice("--ignore=".length));
27285
+ } else if (opt.startsWith("--locale=")) {
27286
+ const locale2 = opt.slice("--locale=".length);
27287
+ if (["zh", "en"].includes(locale2)) {
27288
+ setLocale(locale2);
27289
+ }
26689
27290
  }
26690
27291
  }
27292
+ if ((0, import_node_fs3.existsSync)(interfacePath) && (0, import_node_fs3.statSync)(interfacePath).isDirectory()) {
27293
+ interfacePath = path10.join(interfacePath, "interface.json");
27294
+ }
27295
+ if (!(0, import_node_fs3.existsSync)(interfacePath)) {
27296
+ if (githubMode) {
27297
+ error(`${interfacePath} not found`);
27298
+ } else {
27299
+ console.error(`${interfacePath} not found`);
27300
+ }
27301
+ process.exit(1);
27302
+ }
26691
27303
  const bundle = new InterfaceBundle(
26692
27304
  new FsContentLoader(),
26693
27305
  new FsContentWatcher(),
@@ -26702,143 +27314,52 @@ Options:
26702
27314
  console.log("No resource found");
26703
27315
  process.exit(1);
26704
27316
  }
27317
+ const controllerNames = bundle.allControllerNames(true);
26705
27318
  const outputs = [];
26706
- for (const resourceName of resourceNames) {
26707
- if (!rawMode) {
26708
- if (githubMode) {
26709
- startGroup(resourceName);
26710
- } else {
26711
- console.log(`Checking ${resourceName}`);
27319
+ for (const controllerName of ["", ...controllerNames]) {
27320
+ for (const resourceName of resourceNames) {
27321
+ const groupName = controllerName ? `${controllerName}:${resourceName}` : resourceName;
27322
+ if (!rawMode) {
27323
+ if (githubMode) {
27324
+ startGroup(groupName);
27325
+ } else {
27326
+ console.log(`Checking ${groupName}`);
27327
+ }
26712
27328
  }
26713
- }
26714
- bundle.switchActive(resourceName);
26715
- await new Promise((resolve5) => {
26716
- bundle.once("bundleReloaded", resolve5);
26717
- });
26718
- const diags = performDiagnostic(bundle).filter((diag) => !ignoreTypes.includes(diag.type));
26719
- outputs.push(...diags);
26720
- if (rawMode) {
26721
- continue;
26722
- }
26723
- const files = {};
26724
- const locate = async (file, offset) => {
26725
- let content = files[file];
26726
- if (!content) {
26727
- content = await fs4.readFile(file, "utf8");
26728
- files[file] = content;
27329
+ await bundle.switchActive(controllerName, resourceName);
27330
+ const diags = performDiagnostic(bundle).filter((diag) => !ignoreTypes.includes(diag.type));
27331
+ outputs.push(...diags);
27332
+ if (rawMode) {
27333
+ continue;
26729
27334
  }
26730
- return calucateLocation(content, offset);
26731
- };
26732
- for (const diag of diags) {
26733
- const [line, col] = await locate(diag.file, diag.offset);
26734
- const relative6 = path10.relative(bundle.root, diag.file);
26735
- let brief = diag.type;
26736
- switch (diag.type) {
26737
- case "conflict-task": {
26738
- const prelative2 = path10.relative(bundle.root, diag.previous.file);
26739
- const [pline, pcol] = await locate(diag.previous.file, diag.previous.offset);
26740
- brief = `Conflict task \`${diag.task}\`, previous defined in ${prelative2}:${pline}:${pcol}`;
26741
- break;
27335
+ const files = {};
27336
+ const locate = async (file, offset) => {
27337
+ let content = files[file];
27338
+ if (!content) {
27339
+ content = await fs4.readFile(file, "utf8");
27340
+ files[file] = content;
26742
27341
  }
26743
- case "duplicate-next":
26744
- brief = `Duplicate route \`${diag.task}\``;
26745
- break;
26746
- case "unknown-task":
26747
- brief = `Unknown task \`${diag.task}\``;
26748
- break;
26749
- case "dynamic-image":
26750
- brief = `Dynamic image path detected`;
26751
- break;
26752
- case "image-path-back-slash":
26753
- brief = `Image path contains backslash`;
26754
- break;
26755
- case "image-path-dot-slash":
26756
- brief = `Image path contains ./`;
26757
- break;
26758
- case "image-path-missing-png":
26759
- brief = `Image path missing .png`;
26760
- break;
26761
- case "unknown-image":
26762
- brief = `Unknown image \`${diag.image}\``;
26763
- break;
26764
- case "unknown-anchor":
26765
- brief = `Unknown anchor \`${diag.anchor}\``;
26766
- break;
26767
- case "unknown-attr":
26768
- brief = `Unknown attribute \`${diag.attr}\``;
26769
- break;
26770
- case "int-conflict-controller": {
26771
- const prelative2 = path10.relative(bundle.root, diag.previous.file);
26772
- const [pline, pcol] = await locate(diag.previous.file, diag.previous.offset);
26773
- brief = `Conflict controller \`${diag.ctrl}\`, previous defined in ${prelative2}:${pline}:${pcol}`;
26774
- break;
26775
- }
26776
- case "int-unknown-controller":
26777
- brief = `Unknown controlle \`${diag.ctrl}\``;
26778
- break;
26779
- case "int-conflict-resource": {
26780
- const prelative2 = path10.relative(bundle.root, diag.previous.file);
26781
- const [pline, pcol] = await locate(diag.previous.file, diag.previous.offset);
26782
- brief = `Conflict resource \`${diag.res}\`, previous defined in ${prelative2}:${pline}:${pcol}`;
26783
- break;
26784
- }
26785
- case "int-unknown-resource":
26786
- brief = `Unknown resource \`${diag.res}\``;
26787
- break;
26788
- case "int-conflict-option": {
26789
- const prelative2 = path10.relative(bundle.root, diag.previous.file);
26790
- const [pline, pcol] = await locate(diag.previous.file, diag.previous.offset);
26791
- brief = `Conflict option \`${diag.option}\`, previous defined in ${prelative2}:${pline}:${pcol}`;
26792
- break;
26793
- }
26794
- case "int-unknown-option":
26795
- brief = `Unknown option \`${diag.option}\``;
26796
- break;
26797
- case "int-conflict-case": {
26798
- const prelative2 = path10.relative(bundle.root, diag.previous.file);
26799
- const [pline, pcol] = await locate(diag.previous.file, diag.previous.offset);
26800
- brief = `Conflict case \`${diag.case}\` for option \`${diag.option}\`, previous defined in ${prelative2}:${pline}:${pcol}`;
26801
- break;
27342
+ return calucateLocation(content, offset);
27343
+ };
27344
+ for (const diag of diags) {
27345
+ const [start, end, brief] = await buildDiagnosticMessage(bundle.root, diag, locate);
27346
+ const [line, col] = start;
27347
+ const relative6 = path10.relative(bundle.root, diag.file);
27348
+ if (githubMode) {
27349
+ core_exports[diag.level](brief, {
27350
+ file: path10.relative(repoFolder, diag.file),
27351
+ startLine: line,
27352
+ startColumn: col,
27353
+ endColumn: col + diag.length
27354
+ });
27355
+ } else {
27356
+ console.log(` ${diag.level}: ${relative6}:${line}:${col} ${brief}`);
26802
27357
  }
26803
- case "int-unknown-case":
26804
- brief = `Unknown case \`${diag.case}\` for option \`${diag.option}\``;
26805
- break;
26806
- case "int-switch-name-invalid":
26807
- brief = `Switch name invalid`;
26808
- break;
26809
- case "int-switch-missing":
26810
- if (diag.missingYes && diag.missingNo) {
26811
- brief = `Switch option missing \`Yes\` and \`No\``;
26812
- } else if (diag.missingYes) {
26813
- brief = `Switch option missing \`Yes\``;
26814
- } else {
26815
- brief = `Switch option missing \`No\``;
26816
- }
26817
- break;
26818
- case "int-switch-should-fixed":
26819
- brief = `Switch name should use \`Yes\` or \`No\``;
26820
- break;
26821
- case "int-unknown-entry-task":
26822
- brief = `Unknown entry task \`${diag.task}\``;
26823
- break;
26824
- case "int-override-unknown-task":
26825
- brief = `Overriding Unknown task \`${diag.task}\``;
26826
- break;
26827
27358
  }
26828
27359
  if (githubMode) {
26829
- core_exports[diag.level](brief, {
26830
- file: path10.relative(repoFolder, diag.file),
26831
- startLine: line,
26832
- startColumn: col,
26833
- endColumn: col + diag.length
26834
- });
26835
- } else {
26836
- console.log(` ${diag.level}: ${relative6}:${line}:${col} ${brief}`);
27360
+ endGroup();
26837
27361
  }
26838
27362
  }
26839
- if (githubMode) {
26840
- endGroup();
26841
- }
26842
27363
  }
26843
27364
  if (rawMode) {
26844
27365
  console.log(JSON.stringify(outputs));