@chainingintention/pi-web-cn 1.202610.2 → 1.202610.4

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.
Files changed (202) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.js +129 -122
  3. package/dist/cli.js.map +1 -1
  4. package/dist/client/assets/PiWebApp-CN3g7SqA.js +4362 -0
  5. package/dist/client/assets/external-DUGCSDhZ.js +2 -0
  6. package/dist/client/assets/index-JduZlbIF.js +2 -0
  7. package/dist/client/index.html +4 -4
  8. package/dist/client/manifest.webmanifest +2 -1
  9. package/dist/localization.js +24 -0
  10. package/dist/localization.js.map +1 -0
  11. package/dist/nativeServices/serviceDoctor.js +45 -44
  12. package/dist/nativeServices/serviceDoctor.js.map +1 -1
  13. package/dist/pi-packages/captains-log/dist/browser/index.js +46 -45
  14. package/dist/pi-packages/captains-log/dist/browser/markdown.js +2 -1
  15. package/dist/pi-packages/captains-log/dist/browser/panel.js +56 -55
  16. package/dist/pi-packages/captains-log/i18n.js +7 -0
  17. package/dist/pi-packages/relays/i18n.js +7 -0
  18. package/dist/pi-packages/relays/markdownDocument.js +2 -1
  19. package/dist/pi-packages/relays/pi-web-plugin.js +8 -6
  20. package/dist/pi-packages/relays/relaysPanelElement.js +24 -23
  21. package/dist/pi-web-plugins/files/browser/pi-web-plugin.js +124 -124
  22. package/dist/pi-web-plugins/git/browser/git-contract.js +13 -12
  23. package/dist/pi-web-plugins/git/browser/git-panel.js +25 -24
  24. package/dist/pi-web-plugins/git/browser/i18n.js +7 -0
  25. package/dist/pi-web-plugins/git/browser/pi-web-plugin.js +7 -3
  26. package/dist/pi-web-plugins/git/git-backend.js +10 -9
  27. package/dist/pi-web-plugins/git/i18n.js +7 -0
  28. package/dist/pi-web-plugins/git/server-plugin.js +21 -19
  29. package/dist/pi-web-plugins/info/i18n.js +7 -0
  30. package/dist/pi-web-plugins/info/infoInternals.js +57 -62
  31. package/dist/pi-web-plugins/info/pi-web-plugin.js +34 -36
  32. package/dist/pi-web-plugins/mermaid/browser/pi-web-plugin.js +3 -3
  33. package/dist/pi-web-plugins/terminal/browser/pi-web-plugin.js +55 -52
  34. package/dist/pi-web-plugins/terminal/i18n.js +7 -0
  35. package/dist/pi-web-plugins/terminal/server-plugin.js +23 -21
  36. package/dist/pi-web-plugins/terminal/terminalService.js +22 -21
  37. package/dist/pi-web-plugins/updates/i18n.js +7 -0
  38. package/dist/pi-web-plugins/updates/pi-web-plugin.js +58 -54
  39. package/dist/pi-web-plugins/updates/updatesLogic.js +21 -20
  40. package/dist/pi-web-plugins/workspace-tasks/config.js +12 -11
  41. package/dist/pi-web-plugins/workspace-tasks/i18n.js +7 -0
  42. package/dist/pi-web-plugins/workspace-tasks/pi-web-plugin.js +8 -6
  43. package/dist/pi-web-plugins/workspace-tasks/tasksPanelElement.js +20 -19
  44. package/dist/pi-web-plugins/workspace-tasks/workspaceTasksClient.js +12 -11
  45. package/dist/pi-web-plugins/zh-cn/auth.json +9 -0
  46. package/dist/pi-web-plugins/zh-cn/bundled.json +176 -0
  47. package/dist/pi-web-plugins/zh-cn/cli.json +171 -0
  48. package/dist/pi-web-plugins/zh-cn/client.json +219 -0
  49. package/dist/pi-web-plugins/zh-cn/components.json +1002 -0
  50. package/dist/pi-web-plugins/zh-cn/config-errors.json +172 -0
  51. package/dist/pi-web-plugins/zh-cn/files.json +41 -0
  52. package/dist/pi-web-plugins/zh-cn/machines.json +28 -0
  53. package/dist/pi-web-plugins/zh-cn/main.json +459 -0
  54. package/dist/pi-web-plugins/zh-cn/management-errors.json +23 -0
  55. package/dist/pi-web-plugins/zh-cn/manifest.webmanifest +25 -0
  56. package/dist/pi-web-plugins/zh-cn/metadata.json +3 -0
  57. package/dist/pi-web-plugins/zh-cn/package.json +10 -0
  58. package/dist/pi-web-plugins/zh-cn/pi-web-plugin.js +16 -0
  59. package/dist/pi-web-plugins/zh-cn/projects.json +6 -0
  60. package/dist/pi-web-plugins/zh-cn/provider-auth.json +17 -0
  61. package/dist/pi-web-plugins/zh-cn/routing.json +68 -0
  62. package/dist/pi-web-plugins/zh-cn/server-main.json +99 -0
  63. package/dist/pi-web-plugins/zh-cn/server.json +174 -0
  64. package/dist/piWebVersionReport.js +17 -16
  65. package/dist/piWebVersionReport.js.map +1 -1
  66. package/dist/plugin-api.d.ts +4 -1
  67. package/dist/pluginRecoveryCli.js +25 -24
  68. package/dist/pluginRecoveryCli.js.map +1 -1
  69. package/dist/server/app.js +43 -28
  70. package/dist/server/app.js.map +1 -1
  71. package/dist/server/audit/normalToolAuditCli.js +45 -43
  72. package/dist/server/audit/normalToolAuditCli.js.map +1 -1
  73. package/dist/server/configRoutes.js +39 -30
  74. package/dist/server/configRoutes.js.map +1 -1
  75. package/dist/server/diagnostics/nodePtyNativeModule.js +7 -6
  76. package/dist/server/diagnostics/nodePtyNativeModule.js.map +1 -1
  77. package/dist/server/diagnostics/nodePtySpawnHelper.js +21 -20
  78. package/dist/server/diagnostics/nodePtySpawnHelper.js.map +1 -1
  79. package/dist/server/knownAutoInstallPiPackages.js +2 -2
  80. package/dist/server/knownAutoInstallPiPackages.js.map +1 -1
  81. package/dist/server/knownPiPackages.js +2 -2
  82. package/dist/server/knownPiPackages.js.map +1 -1
  83. package/dist/server/machines/machineClient.js +8 -6
  84. package/dist/server/machines/machineClient.js.map +1 -1
  85. package/dist/server/machines/machinePluginProxyRoutes.js +11 -10
  86. package/dist/server/machines/machinePluginProxyRoutes.js.map +1 -1
  87. package/dist/server/machines/machineProxyRoutes.js +27 -29
  88. package/dist/server/machines/machineProxyRoutes.js.map +1 -1
  89. package/dist/server/machines/machineRoutes.js +10 -12
  90. package/dist/server/machines/machineRoutes.js.map +1 -1
  91. package/dist/server/machines/machineService.js +17 -18
  92. package/dist/server/machines/machineService.js.map +1 -1
  93. package/dist/server/managementEmbed.js +26 -25
  94. package/dist/server/managementEmbed.js.map +1 -1
  95. package/dist/server/normalAuth.js +29 -26
  96. package/dist/server/normalAuth.js.map +1 -1
  97. package/dist/server/passwordVerifier.js +2 -1
  98. package/dist/server/passwordVerifier.js.map +1 -1
  99. package/dist/server/piPackageService.js +7 -5
  100. package/dist/server/piPackageService.js.map +1 -1
  101. package/dist/server/piWebPluginService.js +27 -11
  102. package/dist/server/piWebPluginService.js.map +1 -1
  103. package/dist/server/piWebStatus.js +16 -14
  104. package/dist/server/piWebStatus.js.map +1 -1
  105. package/dist/server/plugins/serverPluginRuntime.js +4 -2
  106. package/dist/server/plugins/serverPluginRuntime.js.map +1 -1
  107. package/dist/server/projects/projectService.js +4 -3
  108. package/dist/server/projects/projectService.js.map +1 -1
  109. package/dist/server/sessiond/projectMutationRoutes.js +5 -4
  110. package/dist/server/sessiond/projectMutationRoutes.js.map +1 -1
  111. package/dist/server/sessiond/sessionProxyRoutes.js +11 -8
  112. package/dist/server/sessiond/sessionProxyRoutes.js.map +1 -1
  113. package/dist/server/sessiond/workspaceCatalogRoutes.js +5 -3
  114. package/dist/server/sessiond/workspaceCatalogRoutes.js.map +1 -1
  115. package/dist/server/sessiond.js +8 -3
  116. package/dist/server/sessiond.js.map +1 -1
  117. package/dist/server/sessions/authRoutes.js +20 -19
  118. package/dist/server/sessions/authRoutes.js.map +1 -1
  119. package/dist/server/sessions/authService.js +13 -10
  120. package/dist/server/sessions/authService.js.map +1 -1
  121. package/dist/server/sessions/builtinCommands.js +28 -21
  122. package/dist/server/sessions/builtinCommands.js.map +1 -1
  123. package/dist/server/sessions/oauthLoginFlowService.js +17 -15
  124. package/dist/server/sessions/oauthLoginFlowService.js.map +1 -1
  125. package/dist/server/sessions/piSessionService.js +229 -208
  126. package/dist/server/sessions/piSessionService.js.map +1 -1
  127. package/dist/server/sessions/projectAuthService.js +5 -3
  128. package/dist/server/sessions/projectAuthService.js.map +1 -1
  129. package/dist/server/sessions/sessionArchiveMapping.js +8 -7
  130. package/dist/server/sessions/sessionArchiveMapping.js.map +1 -1
  131. package/dist/server/sessions/sessionCleanup.js +4 -3
  132. package/dist/server/sessions/sessionCleanup.js.map +1 -1
  133. package/dist/server/sessions/sessionCommandService.js +70 -67
  134. package/dist/server/sessions/sessionCommandService.js.map +1 -1
  135. package/dist/server/sessions/sessionNotificationStore.js +12 -11
  136. package/dist/server/sessions/sessionNotificationStore.js.map +1 -1
  137. package/dist/server/sessions/sessionRoutes.js +74 -72
  138. package/dist/server/sessions/sessionRoutes.js.map +1 -1
  139. package/dist/server/sessions/sessionTreeProjection.js +50 -49
  140. package/dist/server/sessions/sessionTreeProjection.js.map +1 -1
  141. package/dist/server/sessions/sessionUnreadStore.js +25 -2
  142. package/dist/server/sessions/sessionUnreadStore.js.map +1 -1
  143. package/dist/server/terminals/managementCommandRunService.js +13 -12
  144. package/dist/server/terminals/managementCommandRunService.js.map +1 -1
  145. package/dist/server/workbench/accessStateStore.js +9 -7
  146. package/dist/server/workbench/accessStateStore.js.map +1 -1
  147. package/dist/server/workbench/capabilitySearch.js +3 -2
  148. package/dist/server/workbench/capabilitySearch.js.map +1 -1
  149. package/dist/server/workbench/knowledgeSearch.js +8 -7
  150. package/dist/server/workbench/knowledgeSearch.js.map +1 -1
  151. package/dist/server/workbench/mcpClient.js +6 -5
  152. package/dist/server/workbench/mcpClient.js.map +1 -1
  153. package/dist/server/workbench/skillSync.js +4 -2
  154. package/dist/server/workbench/skillSync.js.map +1 -1
  155. package/dist/server/workbench/workbenchClient.js +8 -7
  156. package/dist/server/workbench/workbenchClient.js.map +1 -1
  157. package/dist/server/workbench/workbenchTools.js +8 -6
  158. package/dist/server/workbench/workbenchTools.js.map +1 -1
  159. package/dist/server/workingDirectory.js +3 -2
  160. package/dist/server/workingDirectory.js.map +1 -1
  161. package/dist/server/workspaceExplorerRoutes.js +16 -13
  162. package/dist/server/workspaceExplorerRoutes.js.map +1 -1
  163. package/dist/server/workspaces/fileContentService.js +11 -10
  164. package/dist/server/workspaces/fileContentService.js.map +1 -1
  165. package/dist/server/workspaces/fileOperationService.js +7 -6
  166. package/dist/server/workspaces/fileOperationService.js.map +1 -1
  167. package/dist/server/workspaces/filePreviewService.js +5 -4
  168. package/dist/server/workspaces/filePreviewService.js.map +1 -1
  169. package/dist/server/workspaces/fileSuggestions.js +2 -1
  170. package/dist/server/workspaces/fileSuggestions.js.map +1 -1
  171. package/dist/server/workspaces/pathAccessPolicy.js +24 -18
  172. package/dist/server/workspaces/pathAccessPolicy.js.map +1 -1
  173. package/dist/server/workspaces/pathSafety.js +6 -5
  174. package/dist/server/workspaces/pathSafety.js.map +1 -1
  175. package/dist/server/workspaces/projectPiWebConfig.js +3 -2
  176. package/dist/server/workspaces/projectPiWebConfig.js.map +1 -1
  177. package/dist/server/workspaces/workspaceRemovalService.js +4 -3
  178. package/dist/server/workspaces/workspaceRemovalService.js.map +1 -1
  179. package/dist/server/workspaces/workspaceRouteErrors.js +4 -2
  180. package/dist/server/workspaces/workspaceRouteErrors.js.map +1 -1
  181. package/dist/server/workspaces/workspaceUserError.js +18 -0
  182. package/dist/server/workspaces/workspaceUserError.js.map +1 -0
  183. package/dist/server-plugin-api.d.ts +3 -1
  184. package/dist/server-plugin-api.js.map +1 -1
  185. package/dist/serverPluginRecovery.js +3 -2
  186. package/dist/serverPluginRecovery.js.map +1 -1
  187. package/dist/shared/apiTypes.js.map +1 -1
  188. package/dist/shared/i18n.js +41 -0
  189. package/dist/shared/i18n.js.map +1 -0
  190. package/dist/shared/piWebConfigParsing.js +52 -49
  191. package/dist/shared/piWebConfigParsing.js.map +1 -1
  192. package/dist/shared/pluginApiTypes.d.ts +7 -0
  193. package/dist/shared/requiredTerminalPlugin.js +1 -1
  194. package/dist/shared/requiredTerminalPlugin.js.map +1 -1
  195. package/dist/shared/sessionDefaults.js +7 -6
  196. package/dist/shared/sessionDefaults.js.map +1 -1
  197. package/dist/shared/thinkingLevels.js +17 -16
  198. package/dist/shared/thinkingLevels.js.map +1 -1
  199. package/docs/config.md +10 -1
  200. package/docs/plugins.md +8 -0
  201. package/package.json +1 -1
  202. package/dist/client/assets/index-CFhaGb5m.js +0 -4357
@@ -1,10 +1,5 @@
1
1
  // Generated from pi-web-plugins/info/infoInternals.ts. Do not edit directly.
2
- // Implementation details of the bundled Info plugin.
3
- //
4
- // This file is NOT part of the plugin skeleton. If you copied the Info plugin
5
- // as a starting point for your own plugin, replace everything here with your
6
- // own content — the plugin contract (metadata and contribution definitions)
7
- // lives in pi-web-plugin.ts.
2
+ import { t } from "./i18n.js";
8
3
  export function componentHealth(component) {
9
4
  if (!component.available)
10
5
  return "unavailable";
@@ -14,58 +9,58 @@ export function componentHealth(component) {
14
9
  }
15
10
  function componentHealthLabel(health) {
16
11
  if (health === "current")
17
- return "当前版本";
12
+ return t("bundled.info.current.837bc9", "Current");
18
13
  if (health === "restart needed")
19
- return "需要重启";
20
- return "不可用";
14
+ return t("bundled.info.restart.needed.1ffd00", "Restart needed");
15
+ return t("bundled.info.unavailable.460b35", "Unavailable");
21
16
  }
22
17
  function componentDisplayLabel(component) {
23
18
  if (component.component === "web")
24
- return "Web/界面";
25
- return "会话守护进程";
19
+ return t("bundled.info.web.ui.86d6a2", "Web/UI");
20
+ return t("bundled.info.session.daemon.757666", "Session daemon");
26
21
  }
27
22
  export function formatVersion(version) {
28
- return version === undefined || version === "" ? "未知" : version;
23
+ return version === undefined || version === "" ? t("bundled.info.unknown.4d8c1c", "Unknown") : version;
29
24
  }
30
25
  export function installationLabel(installation) {
31
26
  if (installation === undefined)
32
- return "安装方式未知";
27
+ return t("bundled.info.unknown.installation.b61c94", "Unknown installation");
33
28
  if (installation.kind === "pi-package") {
34
29
  const scope = installation.scope === undefined ? "" : ` · ${installationScopeLabel(installation.scope)}`;
35
- const source = installation.source ?? "Pi 包";
30
+ const source = installation.source ?? t("bundled.info.pi.package.feed18", "Pi package");
36
31
  return `${source}${scope}`;
37
32
  }
38
33
  if (installation.kind === "npm-global")
39
- return "全局 npm 包";
34
+ return t("bundled.info.global.npm.package.5e8079", "Global npm package");
40
35
  if (installation.kind === "local")
41
- return "本地检出";
36
+ return t("bundled.info.local.checkout.19c28f", "Local checkout");
42
37
  if (installation.kind === "docker")
43
- return installation.dockerMode === "dev" ? "Docker 开发运行时" : "Docker 运行时";
44
- return "安装方式未知";
38
+ return installation.dockerMode === "dev" ? t("bundled.info.docker.development.runtime.9ba6d5", "Docker development runtime") : t("bundled.info.docker.runtime.8ce6fc", "Docker runtime");
39
+ return t("bundled.info.unknown.installation.b61c94", "Unknown installation");
45
40
  }
46
41
  function installationScopeLabel(scope) {
47
- return scope === "user" ? "用户范围" : "项目范围";
42
+ return scope === "user" ? t("bundled.info.user.scope.7baed5", "User scope") : t("bundled.info.project.scope.0d9798", "Project scope");
48
43
  }
49
44
  export function machineKindLabel(kind) {
50
- return kind === "local" ? "本地机器" : "远程机器";
45
+ return kind === "local" ? t("bundled.info.local.machine.ae3fff", "Local machine") : t("bundled.info.remote.machine.674281", "Remote machine");
51
46
  }
52
47
  export function releaseSummary(release) {
53
48
  if (release.updateAvailable) {
54
49
  return release.latestVersion === undefined || release.latestVersion === ""
55
- ? "有可用更新"
56
- : `有可用更新:${release.latestVersion}`;
50
+ ? t("bundled.info.update.available.5f3ed8", "Update available")
51
+ : t("bundled.info.update.available.6dee04", "Update available: {value1}", { value1: release.latestVersion });
57
52
  }
58
53
  if (release.error !== undefined && release.error !== "")
59
- return `更新检查失败:${release.error}`;
54
+ return t("bundled.info.update.check.failed.b2e600", "Update check failed: {value1}", { value1: release.error });
60
55
  if (release.skipped === true)
61
- return "已跳过更新检查";
62
- return "已是最新版本";
56
+ return t("bundled.info.update.check.skipped.966bfb", "Update check skipped");
57
+ return t("bundled.info.up.to.date.bc3104", "Up to date");
63
58
  }
64
59
  /** One-line component summary used by the panel rows and the clipboard diagnostics. */
65
60
  export function componentDetails(component) {
66
61
  const parts = [
67
- `运行版本 ${formatVersion(component.runtimeVersion)}`,
68
- `安装版本 ${formatVersion(component.installedVersion)}`,
62
+ t("bundled.info.runtime.09b6b8", "Runtime {value1}", { value1: formatVersion(component.runtimeVersion) }),
63
+ t("bundled.info.installed.a6f713", "Installed {value1}", { value1: formatVersion(component.installedVersion) }),
69
64
  `Pi ${formatVersion(component.piVersion)}`,
70
65
  componentHealthLabel(componentHealth(component)),
71
66
  installationLabel(component.installation),
@@ -73,46 +68,46 @@ export function componentDetails(component) {
73
68
  if (component.installation?.path !== undefined && component.installation.path !== "")
74
69
  parts.push(component.installation.path);
75
70
  if (component.error !== undefined && component.error !== "")
76
- parts.push(`错误:${component.error}`);
71
+ parts.push(t("bundled.info.error.66432a", "Error: {value1}", { value1: component.error }));
77
72
  return parts.join(" · ");
78
73
  }
79
74
  /** Notes when the daemon has not yet reloaded the Pi version used by the web process. */
80
75
  export function piVersionDriftNote(web, sessiond) {
81
76
  if (!sessiond.available || web.piVersion === undefined || sessiond.piVersion === undefined)
82
77
  return undefined;
83
- return web.piVersion === sessiond.piVersion ? undefined : `会话守护进程正在运行 ${formatVersion(sessiond.piVersion)}`;
78
+ return web.piVersion === sessiond.piVersion ? undefined : t("ui.main.5f903de305f2", "The session daemon is running {arg0}", { arg0: formatVersion(sessiond.piVersion) });
84
79
  }
85
80
  export function workspaceFlags(workspace) {
86
81
  return [
87
82
  workspace.provider === undefined
88
- ? workspace.isGitRepo === undefined && workspace.isGitWorktree !== true ? "文件夹工作区" : undefined
89
- : `提供器 ${workspace.provider.pluginId}`,
90
- workspace.branch === undefined || workspace.branch === "" ? undefined : `分支 ${workspace.branch}`,
91
- workspace.isGitWorktree === true ? "Git 工作树" : workspace.isGitRepo === true ? "Git 仓库" : workspace.isGitRepo === false ? "非 Git 仓库" : undefined,
92
- workspace.isMain ? "主工作区" : undefined,
83
+ ? workspace.isGitRepo === undefined && workspace.isGitWorktree !== true ? t("ui.main.5a99dc72f4a4", "folder workspace") : undefined
84
+ : t("ui.main.830784126ed0", "Provider {arg0}", { arg0: workspace.provider.pluginId }),
85
+ workspace.branch === undefined || workspace.branch === "" ? undefined : t("bundled.info.branch.198c3e", "Branch {value1}", { value1: workspace.branch }),
86
+ workspace.isGitWorktree === true ? t("bundled.info.git.worktree.c0db6b", "Git worktree") : workspace.isGitRepo === true ? t("bundled.info.git.repository.6a0dac", "Git repository") : workspace.isGitRepo === false ? t("bundled.info.non.git.directory.0936b0", "Non-Git directory") : undefined,
87
+ workspace.isMain ? t("bundled.info.main.workspace.2ac45d", "Main workspace") : undefined,
93
88
  ].filter((flag) => flag !== undefined);
94
89
  }
95
90
  /** Plain-text status block suitable for pasting into a bug report. */
96
91
  export function diagnosticsSummary({ status, machine, workspace }) {
97
- const lines = ["PI WEB 诊断信息"];
92
+ const lines = [t("bundled.info.pi.web.diagnostics.1e6afe", "PI WEB diagnostics")];
98
93
  if (status === undefined) {
99
- lines.push("状态:不可用");
94
+ lines.push(t("bundled.info.status.unavailable.e0e66a", "Status: unavailable"));
100
95
  }
101
96
  else {
102
- lines.push(`包:${status.packageName}`);
103
- lines.push(`${componentDisplayLabel(status.components.web)}:${componentDetails(status.components.web)}`);
104
- lines.push(`${componentDisplayLabel(status.components.sessiond)}:${componentDetails(status.components.sessiond)}`);
105
- const checked = status.release.checkedAt === undefined || status.release.skipped === true ? "" : `(检查于 ${status.release.checkedAt})`;
106
- lines.push(`发布状态:${releaseSummary(status.release)}${checked}`);
107
- lines.push(`状态生成时间:${status.generatedAt}`);
97
+ lines.push(t("bundled.info.package.6efebc", "Package: {value1}", { value1: status.packageName }));
98
+ lines.push(t("bundled.info.component.details", "{component}: {details}", { component: componentDisplayLabel(status.components.web), details: componentDetails(status.components.web) }));
99
+ lines.push(t("bundled.info.component.details", "{component}: {details}", { component: componentDisplayLabel(status.components.sessiond), details: componentDetails(status.components.sessiond) }));
100
+ const checked = status.release.checkedAt === undefined || status.release.skipped === true ? "" : t("bundled.info.checked.at.1ecc98", " (checked at {value1})", { value1: status.release.checkedAt });
101
+ lines.push(t("bundled.info.release.386d3e", "Release: {value1}{value2}", { value1: releaseSummary(status.release), value2: checked }));
102
+ lines.push(t("bundled.info.status.generated.ff5eec", "Status generated: {value1}", { value1: status.generatedAt }));
108
103
  }
109
104
  if (machine !== undefined)
110
- lines.push(`机器:${machine.name}(${machineKindLabel(machine.kind)})`);
105
+ lines.push(t("bundled.info.machine.58d58d", "Machine: {value1} ({value2})", { value1: machine.name, value2: machineKindLabel(machine.kind) }));
111
106
  if (workspace === undefined) {
112
- lines.push("工作区:未选择");
107
+ lines.push(t("bundled.info.workspace.not.selected.a88368", "Workspace: not selected"));
113
108
  }
114
109
  else {
115
- lines.push(`工作区:${workspace.label} - ${workspace.path}(${workspaceFlags(workspace).join("、")})`);
110
+ lines.push(t("bundled.info.workspace.fd59a8", "Workspace: {value1} - {value2} ({value3})", { value1: workspace.label, value2: workspace.path, value3: workspaceFlags(workspace).join(t("bundled.info.list.separator", ", ")) }));
116
111
  }
117
112
  return lines.join("\n");
118
113
  }
@@ -140,7 +135,7 @@ function renderStatusSection(html, status) {
140
135
  return html `
141
136
  <section>
142
137
  <strong>PI WEB</strong>
143
- <p class="muted">PI WEB 状态暂不可用,后台会自动刷新。</p>
138
+ <p class="muted">${t("bundled.info.pi.web.status.is.unavailable.it.will.refresh.automatically.381f51", "PI WEB status is unavailable. It will refresh automatically.")}</p>
144
139
  </section>
145
140
  `;
146
141
  }
@@ -151,9 +146,9 @@ function renderStatusSection(html, status) {
151
146
  <section>
152
147
  <strong>PI WEB</strong>
153
148
  <div class="info-row">
154
- <span>版本</span>
149
+ <span>${t("bundled.info.version.5f76b2", "Version")}</span>
155
150
  <span>${formatVersion(web.runtimeVersion)}</span>
156
- ${web.installedVersion === undefined || web.installedVersion === web.runtimeVersion ? null : html `<small>已安装 ${formatVersion(web.installedVersion)}</small>`}
151
+ ${web.installedVersion === undefined || web.installedVersion === web.runtimeVersion ? null : html `<small>${t("ui.piPackageSettings.installed", "installed")} ${formatVersion(web.installedVersion)}</small>`}
157
152
  </div>
158
153
  <div class="info-row">
159
154
  <span>Pi</span>
@@ -161,24 +156,24 @@ function renderStatusSection(html, status) {
161
156
  ${driftNote === undefined ? null : html `<small>${driftNote}</small>`}
162
157
  </div>
163
158
  <div class="info-row">
164
- <span>包</span>
159
+ <span>${t("bundled.info.package.26b9c4", "Package")}</span>
165
160
  <span>${status.packageName}</span>
166
161
  </div>
167
162
  <div class="info-row">
168
- <span>安装方式</span>
163
+ <span>${t("bundled.info.installation.9c320c", "Installation")}</span>
169
164
  <span>${installationLabel(web.installation)}</span>
170
165
  ${web.installation?.path === undefined || web.installation.path === "" ? null : html `<small>${web.installation.path}</small>`}
171
166
  </div>
172
167
  <div class="info-row">
173
- <span>发布状态</span>
168
+ <span>${t("bundled.info.release.5100f0", "Release")}</span>
174
169
  <span>${releaseSummary(status.release)}</span>
175
- ${status.release.checkedAt === undefined || status.release.skipped === true ? null : html `<small>检查于 ${status.release.checkedAt}</small>`}
170
+ ${status.release.checkedAt === undefined || status.release.skipped === true ? null : html `<small>${t("bundled.info.checked.at.cc4691", "Checked at {value1}", { value1: status.release.checkedAt })}</small>`}
176
171
  </div>
177
- ${messageCount === 0 ? null : html `<p class="muted">${String(messageCount)} 条状态消息,请打开“更新”标签页查看详情。</p>`}
178
- <p class="muted">状态生成于 ${status.generatedAt}</p>
172
+ ${messageCount === 0 ? null : html `<p class="muted">${t("bundled.info.status.messages.open.updates.for.details.6ca1fc", "{value1} status messages. Open Updates for details.", { value1: String(messageCount) })}</p>`}
173
+ <p class="muted">${t("bundled.info.status.generated.at.92be3c", "Status generated at {value1}", { value1: status.generatedAt })}</p>
179
174
  </section>
180
175
  <section>
181
- <strong>服务</strong>
176
+ <strong>${t("bundled.info.services.ec309a", "Services")}</strong>
182
177
  ${renderComponent(html, status.components.web)}
183
178
  ${renderComponent(html, status.components.sessiond)}
184
179
  </section>
@@ -187,13 +182,13 @@ function renderStatusSection(html, status) {
187
182
  function renderMachineSection(html, machine) {
188
183
  return html `
189
184
  <section>
190
- <strong>机器</strong>
185
+ <strong>${t("bundled.info.machine.ece969", "Machine")}</strong>
191
186
  <div class="info-row">
192
- <span>名称</span>
187
+ <span>${t("bundled.info.name.d44e9b", "Name")}</span>
193
188
  <span>${machine.name}</span>
194
189
  </div>
195
190
  <div class="info-row">
196
- <span>类型</span>
191
+ <span>${t("bundled.info.type.ba4001", "Type")}</span>
197
192
  <span>${machineKindLabel(machine.kind)}</span>
198
193
  </div>
199
194
  </section>
@@ -202,13 +197,13 @@ function renderMachineSection(html, machine) {
202
197
  function renderWorkspaceSection(html, workspace) {
203
198
  return html `
204
199
  <section>
205
- <strong>工作区</strong>
200
+ <strong>${t("bundled.info.workspace.379798", "Workspace")}</strong>
206
201
  <div class="info-row">
207
- <span>名称</span>
202
+ <span>${t("bundled.info.name.d44e9b", "Name")}</span>
208
203
  <span>${workspace.label}</span>
209
204
  </div>
210
205
  <div class="info-row">
211
- <span>路径</span>
206
+ <span>${t("bundled.info.path.77e1ea", "Path")}</span>
212
207
  <span class="info-path">${workspace.path}</span>
213
208
  ${workspaceFlags(workspace).length === 0 ? null : html `<small>${workspaceFlags(workspace).join(" · ")}</small>`}
214
209
  </div>
@@ -229,7 +224,7 @@ export function renderInfoPanel(html, context) {
229
224
  .info-health-ok { color: var(--pi-success); }
230
225
  .info-health-attention { color: var(--pi-warning); }
231
226
  </style>
232
- <section class="toolbar"><strong>信息</strong></section>
227
+ <section class="toolbar"><strong>${t("bundled.info.info.e70286", "Info")}</strong></section>
233
228
  <section class="viewer info-status">
234
229
  ${renderStatusSection(html, context.state?.piWebStatus)}
235
230
  ${renderMachineSection(html, context.machine)}
@@ -1,48 +1,46 @@
1
1
  // Generated from pi-web-plugins/info/pi-web-plugin.ts. Do not edit directly.
2
- // Skeleton of a PI WEB plugin: metadata plus contribution definitions.
3
- //
4
- // Everything the bundled Info panel and action actually render lives in
5
- // infoInternals.ts. That file is replaceable implementation detail — when
6
- // copying this plugin as a starting point, keep this file's shape and swap
7
- // the internals for your own.
2
+ import { t, setTranslator } from "./i18n.js";
8
3
  import { copyDiagnostics, renderInfoPanel } from "./infoInternals.js";
9
4
  const plugin = {
10
5
  apiVersion: 4,
11
- name: "信息插件",
12
- activate: ({ html, svg }) => ({
13
- contributions: {
14
- actions: [
15
- {
16
- id: "copy-diagnostics",
17
- title: "复制 PI WEB 诊断信息",
18
- description: "复制此机器的版本、安装和状态详情,以便粘贴到错误报告中",
19
- group: "信息",
20
- run: (context) => copyDiagnostics(context),
21
- },
22
- ],
23
- workspaceLabels: [
24
- {
25
- id: "workspace.kind-label",
26
- order: 100,
27
- items: (context) => [{ type: "text", text: context.workspace.provider?.pluginId ?? (context.workspace.isGitRepo === true ? "Git" : "文件夹"), title: context.workspace.path }],
28
- },
29
- ],
30
- workspacePanels: [
31
- {
32
- id: "workspace.info",
33
- title: "信息",
34
- icon: svg `
6
+ name: t("bundled.info.info.plugin.b6e61e", "Info plugin"),
7
+ activate: ({ html, svg, translate }) => {
8
+ setTranslator(translate);
9
+ return ({
10
+ contributions: {
11
+ actions: [
12
+ {
13
+ id: "copy-diagnostics",
14
+ title: t("bundled.info.copy.pi.web.diagnostics.250f13", "Copy PI WEB diagnostics"),
15
+ description: t("bundled.info.copy.this.machine.s.version.installation.and.status.details.for.a.c01908", "Copy this machine's version, installation, and status details for a bug report"),
16
+ group: t("bundled.info.info.e70286", "Info"),
17
+ run: (context) => copyDiagnostics(context),
18
+ },
19
+ ],
20
+ workspaceLabels: [
21
+ {
22
+ id: "workspace.kind-label",
23
+ order: 100,
24
+ items: (context) => [{ type: "text", text: context.workspace.provider?.pluginId ?? (context.workspace.isGitRepo === true ? "Git" : t("bundled.info.folder.7c7802", "Folder")), title: context.workspace.path }],
25
+ },
26
+ ],
27
+ workspacePanels: [
28
+ {
29
+ id: "workspace.info",
30
+ title: t("bundled.info.info.e70286", "Info"),
31
+ icon: svg `
35
32
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
36
33
  <circle cx="12" cy="12" r="9"></circle>
37
34
  <path d="M12 11v5"></path>
38
35
  <path d="M12 8h.01"></path>
39
36
  </svg>
40
37
  `,
41
- order: 1000,
42
- render: (context) => renderInfoPanel(html, context),
43
- },
44
- ],
45
- },
46
- }),
38
+ order: 1000,
39
+ render: (context) => renderInfoPanel(html, context),
40
+ },
41
+ ],
42
+ },
43
+ });
44
+ },
47
45
  };
48
46
  export default plugin;
@@ -1,6 +1,6 @@
1
- var e=globalThis,t=e.ShadowRoot&&(e.ShadyCSS===void 0||e.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,n=Symbol(),r=new WeakMap,i=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,n=this.t;if(t&&e===void 0){let t=n!==void 0&&n.length===1;t&&(e=r.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&r.set(n,e))}return e}toString(){return this.cssText}},a=e=>new i(typeof e==`string`?e:e+``,void 0,n),o=(e,...t)=>new i(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,n),s=(n,r)=>{if(t)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let t of r){let r=document.createElement(`style`),i=e.litNonce;i!==void 0&&r.setAttribute(`nonce`,i),r.textContent=t.cssText,n.appendChild(r)}},c=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return a(t)})(e):e,{is:l,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:ee,getOwnPropertySymbols:te,getPrototypeOf:ne}=Object,f=globalThis,re=f.trustedTypes,ie=re?re.emptyScript:``,ae=f.reactiveElementPolyfillSupport,p=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?ie:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},h=(e,t)=>!l(e,t),g={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:h};Symbol.metadata??=Symbol(`metadata`),f.litPropertyMetadata??=new WeakMap;var _=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=g){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&u(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??g}static _$Ei(){if(this.hasOwnProperty(p(`elementProperties`)))return;let e=ne(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(p(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(p(`properties`))){let e=this.properties,t=[...ee(e),...te(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(c(e))}else e!==void 0&&t.push(c(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?m:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?m:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??h)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};_.elementStyles=[],_.shadowRootOptions={mode:`open`},_[p(`elementProperties`)]=new Map,_[p(`finalized`)]=new Map,ae?.({ReactiveElement:_}),(f.reactiveElementVersions??=[]).push(`2.1.2`);var v=globalThis,y=e=>e,b=v.trustedTypes,x=b?b.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,S=`$lit$`,C=`lit$${Math.random().toFixed(9).slice(2)}$`,w=`?`+C,oe=`<${w}>`,T=document,E=()=>T.createComment(``),D=e=>e===null||typeof e!=`object`&&typeof e!=`function`,O=Array.isArray,se=e=>O(e)||typeof e?.[Symbol.iterator]==`function`,k=`[
2
- \f\r]`,A=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,M=/>/g,N=RegExp(`>|${k}(?:([^\\s"'>=/]+)(${k}*=${k}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),P=/'/g,F=/"/g,I=/^(?:script|style|textarea|title)$/i,L=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),R=Symbol.for(`lit-noChange`),z=Symbol.for(`lit-nothing`),B=new WeakMap,V=T.createTreeWalker(T,129);function H(e,t){if(!O(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return x===void 0?t:x.createHTML(t)}var ce=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=A;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===A?c[1]===`!--`?o=j:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=N):(I.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=N):o=M:o===N?c[0]===`>`?(o=i??A,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?N:c[3]===`"`?F:P):o===F||o===P?o=N:o===j||o===M?o=A:(o=N,i=void 0);let d=o===N&&e[t+1].startsWith(`/>`)?` `:``;a+=o===A?n+oe:l>=0?(r.push(s),n.slice(0,l)+S+n.slice(l)+C+d):n+C+(l===-2?t:d)}return[H(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},U=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=ce(t,n);if(this.el=e.createElement(l,r),V.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=V.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(S)){let t=u[o++],n=i.getAttribute(e).split(C),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?ue:r[1]===`?`?de:r[1]===`@`?fe:K}),i.removeAttribute(e)}else e.startsWith(C)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(I.test(i.tagName)){let e=i.textContent.split(C),t=e.length-1;if(t>0){i.textContent=b?b.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],E()),V.nextNode(),c.push({type:2,index:++a});i.append(e[t],E())}}}else if(i.nodeType===8){if(i.data===w)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(C,e+1))!==-1;)c.push({type:7,index:a}),e+=C.length-1}}a++}}static createElement(e,t){let n=T.createElement(`template`);return n.innerHTML=e,n}};function W(e,t,n=e,r){if(t===R)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=D(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=W(e,i._$AS(e,t.values),i,r)),t}var le=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??T).importNode(t,!0);V.currentNode=r;let i=V.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new G(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new pe(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=V.nextNode(),a++)}return V.currentNode=T,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},G=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=W(this,e,t),D(e)?e===z||e==null||e===``?(this._$AH!==z&&this._$AR(),this._$AH=z):e!==this._$AH&&e!==R&&this._(e):e._$litType$===void 0?e.nodeType===void 0?se(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==z&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=U.createElement(H(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new le(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=B.get(e.strings);return t===void 0&&B.set(e.strings,t=new U(e)),t}k(t){O(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(E()),this.O(E()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=y(e).nextSibling;y(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},K=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=z,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=z}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=W(this,e,t,0),a=!D(e)||e!==this._$AH&&e!==R,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=W(this,r[n+o],t,o),s===R&&(s=this._$AH[o]),a||=!D(s)||s!==this._$AH[o],s===z?e=z:e!==z&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},ue=class extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===z?void 0:e}},de=class extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==z)}},fe=class extends K{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=W(this,e,t,0)??z)===R)return;let n=this._$AH,r=e===z&&n!==z||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==z&&(n===z||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},pe=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}},me=v.litHtmlPolyfillSupport;me?.(U,G),(v.litHtmlVersions??=[]).push(`3.3.3`);var he=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new G(t.insertBefore(E(),e),e,void 0,n??{})}return i._$AI(e),i},q=globalThis,J=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=he(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return R}};J._$litElement$=!0,J.finalized=!0,q.litElementHydrateSupport?.({LitElement:J});var ge=q.litElementPolyfillSupport;ge?.({LitElement:J}),(q.litElementVersions??=[]).push(`4.2.2`);var _e={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:h},ve=(e=_e,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Y(e){return(t,n)=>typeof n==`object`?ve(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function X(e){return Y({...e,state:!0,attribute:!1})}function Z(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Q;function ye(){return Q??=fetch(new URL(`./mermaid-engine.js`,import.meta.url),{signal:AbortSignal.timeout(3e4)}).then(async e=>{if(!e.ok)throw Error(`图表引擎不可用(${String(e.status)})`);return e.text()}).catch(e=>{throw Q=void 0,e}),Q}function be(e){return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'"><style>body{margin:0}svg{max-width:100%;height:auto;display:block;margin:auto}</style></head><body><script>${e.replace(/<\/script/giu,`<\\/script`)}<\/script></body></html>`}var $=class extends J{constructor(...e){super(...e),this.loadEngine=ye,this.height=300,this.generation=0}updated(e){(e.has(`input`)||e.has(`loadEngine`))&&this.draw()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.draw()}disconnectedCallback(){super.disconnectedCallback(),this.generation+=1,this.cleanup?.(),this.document=void 0}async draw(){this.cleanup?.(),this.document=void 0;let e=this.input,t=++this.generation;if(e===void 0||e.signal.aborted)return;let n=()=>this.isConnected&&!e.signal.aborted&&t===this.generation,r=t=>{let r=this.renderRoot.querySelector(`iframe`);if(!n()||t.source!==r?.contentWindow)return;let i=t.data;typeof i==`object`&&i&&`type`in i&&(i.type===`mermaid-ready`?r.contentWindow?.postMessage({type:`mermaid-render`,text:e.text},`*`):i.type===`mermaid-error`?(e.fail(Error(`无法渲染此图表源码`)),window.clearTimeout(a)):i.type===`mermaid-rendered`&&`height`in i&&typeof i.height==`number`&&Number.isFinite(i.height)&&(window.clearTimeout(a),this.height=Math.min(1600,Math.max(120,i.height+24))))},i=()=>{this.document=void 0,o()},a=window.setTimeout(()=>{n()&&(this.generation+=1,this.document=void 0,e.fail(Error(`图表预览超时`))),o()},3e4),o=()=>{window.clearTimeout(a),window.removeEventListener(`message`,r),e.signal.removeEventListener(`abort`,i)};this.cleanup=o,window.addEventListener(`message`,r),e.signal.addEventListener(`abort`,i,{once:!0});try{let e=await this.loadEngine();n()&&(this.document=be(e))}catch(t){n()&&e.fail(t),o()}}render(){return this.document===void 0?L`<p role="status">正在渲染图表…</p>`:L`<iframe title="图表" sandbox="allow-scripts" referrerpolicy="no-referrer" .srcdoc=${this.document} style=${`height:${String(this.height)}px`}></iframe>`}static{this.styles=o`
1
+ var e;function t(t){e=t}var n=(t,n,r)=>e?.(t,n,r)??n.replace(/\{([A-Za-z0-9_]+)\}/g,(e,t)=>String(r?.[t]??e)),r=globalThis,i=r.ShadowRoot&&(r.ShadyCSS===void 0||r.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,a=Symbol(),o=new WeakMap,s=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==a)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(i&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=o.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&o.set(t,e))}return e}toString(){return this.cssText}},c=e=>new s(typeof e==`string`?e:e+``,void 0,a),l=(e,...t)=>new s(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,a),u=(e,t)=>{if(i)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),i=r.litNonce;i!==void 0&&t.setAttribute(`nonce`,i),t.textContent=n.cssText,e.appendChild(t)}},d=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return c(t)})(e):e,{is:ee,defineProperty:te,getOwnPropertyDescriptor:ne,getOwnPropertyNames:re,getOwnPropertySymbols:ie,getPrototypeOf:ae}=Object,f=globalThis,p=f.trustedTypes,oe=p?p.emptyScript:``,se=f.reactiveElementPolyfillSupport,m=(e,t)=>e,h={toAttribute(e,t){switch(t){case Boolean:e=e?oe:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},g=(e,t)=>!ee(e,t),_={attribute:!0,type:String,converter:h,reflect:!1,useDefault:!1,hasChanged:g};Symbol.metadata??=Symbol(`metadata`),f.litPropertyMetadata??=new WeakMap;var v=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=_){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&te(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=ne(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(m(`elementProperties`)))return;let e=ae(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(m(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m(`properties`))){let e=this.properties,t=[...re(e),...ie(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(d(e))}else e!==void 0&&t.push(d(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?h:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?h:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??g)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};v.elementStyles=[],v.shadowRootOptions={mode:`open`},v[m(`elementProperties`)]=new Map,v[m(`finalized`)]=new Map,se?.({ReactiveElement:v}),(f.reactiveElementVersions??=[]).push(`2.1.2`);var y=globalThis,b=e=>e,x=y.trustedTypes,S=x?x.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ce=`$lit$`,C=`lit$${Math.random().toFixed(9).slice(2)}$`,w=`?`+C,le=`<${w}>`,T=document,E=()=>T.createComment(``),D=e=>e===null||typeof e!=`object`&&typeof e!=`function`,O=Array.isArray,ue=e=>O(e)||typeof e?.[Symbol.iterator]==`function`,k=`[
2
+ \f\r]`,A=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,M=/>/g,N=RegExp(`>|${k}(?:([^\\s"'>=/]+)(${k}*=${k}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),P=/'/g,F=/"/g,I=/^(?:script|style|textarea|title)$/i,L=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),R=Symbol.for(`lit-noChange`),z=Symbol.for(`lit-nothing`),B=new WeakMap,V=T.createTreeWalker(T,129);function H(e,t){if(!O(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return S===void 0?t:S.createHTML(t)}var de=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=A;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===A?c[1]===`!--`?o=j:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=N):(I.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=N):o=M:o===N?c[0]===`>`?(o=i??A,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?N:c[3]===`"`?F:P):o===F||o===P?o=N:o===j||o===M?o=A:(o=N,i=void 0);let d=o===N&&e[t+1].startsWith(`/>`)?` `:``;a+=o===A?n+le:l>=0?(r.push(s),n.slice(0,l)+ce+n.slice(l)+C+d):n+C+(l===-2?t:d)}return[H(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},U=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=de(t,n);if(this.el=e.createElement(l,r),V.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=V.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ce)){let t=u[o++],n=i.getAttribute(e).split(C),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?pe:r[1]===`?`?me:r[1]===`@`?he:K}),i.removeAttribute(e)}else e.startsWith(C)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(I.test(i.tagName)){let e=i.textContent.split(C),t=e.length-1;if(t>0){i.textContent=x?x.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],E()),V.nextNode(),c.push({type:2,index:++a});i.append(e[t],E())}}}else if(i.nodeType===8){if(i.data===w)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(C,e+1))!==-1;)c.push({type:7,index:a}),e+=C.length-1}}a++}}static createElement(e,t){let n=T.createElement(`template`);return n.innerHTML=e,n}};function W(e,t,n=e,r){if(t===R)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=D(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=W(e,i._$AS(e,t.values),i,r)),t}var fe=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??T).importNode(t,!0);V.currentNode=r;let i=V.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new G(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new ge(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=V.nextNode(),a++)}return V.currentNode=T,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},G=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=W(this,e,t),D(e)?e===z||e==null||e===``?(this._$AH!==z&&this._$AR(),this._$AH=z):e!==this._$AH&&e!==R&&this._(e):e._$litType$===void 0?e.nodeType===void 0?ue(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==z&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=U.createElement(H(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new fe(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=B.get(e.strings);return t===void 0&&B.set(e.strings,t=new U(e)),t}k(t){O(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(E()),this.O(E()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=b(e).nextSibling;b(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},K=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=z,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=z}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=W(this,e,t,0),a=!D(e)||e!==this._$AH&&e!==R,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=W(this,r[n+o],t,o),s===R&&(s=this._$AH[o]),a||=!D(s)||s!==this._$AH[o],s===z?e=z:e!==z&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},pe=class extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===z?void 0:e}},me=class extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==z)}},he=class extends K{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=W(this,e,t,0)??z)===R)return;let n=this._$AH,r=e===z&&n!==z||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==z&&(n===z||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},ge=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}},_e=y.litHtmlPolyfillSupport;_e?.(U,G),(y.litHtmlVersions??=[]).push(`3.3.3`);var ve=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new G(t.insertBefore(E(),e),e,void 0,n??{})}return i._$AI(e),i},q=globalThis,J=class extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ve(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return R}};J._$litElement$=!0,J.finalized=!0,q.litElementHydrateSupport?.({LitElement:J});var ye=q.litElementPolyfillSupport;ye?.({LitElement:J}),(q.litElementVersions??=[]).push(`4.2.2`);var be={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:g},xe=(e=be,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Y(e){return(t,n)=>typeof n==`object`?xe(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function X(e){return Y({...e,state:!0,attribute:!1})}function Z(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var Q;function Se(){return Q??=fetch(new URL(`./mermaid-engine.js`,import.meta.url),{signal:AbortSignal.timeout(3e4)}).then(async e=>{if(!e.ok)throw Error(n(`ui.main.47f00878a76b`,`Diagram engine unavailable ({arg0})`,{arg0:String(e.status)}));return e.text()}).catch(e=>{throw Q=void 0,e}),Q}function Ce(e){return`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'"><style>body{margin:0}svg{max-width:100%;height:auto;display:block;margin:auto}</style></head><body><script>${e.replace(/<\/script/giu,`<\\/script`)}<\/script></body></html>`}var $=class extends J{constructor(...e){super(...e),this.loadEngine=Se,this.height=300,this.generation=0}updated(e){(e.has(`input`)||e.has(`loadEngine`))&&this.draw()}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.draw()}disconnectedCallback(){super.disconnectedCallback(),this.generation+=1,this.cleanup?.(),this.document=void 0}async draw(){this.cleanup?.(),this.document=void 0;let e=this.input,t=++this.generation;if(e===void 0||e.signal.aborted)return;let r=()=>this.isConnected&&!e.signal.aborted&&t===this.generation,i=t=>{let i=this.renderRoot.querySelector(`iframe`);if(!r()||t.source!==i?.contentWindow)return;let a=t.data;typeof a==`object`&&a&&`type`in a&&(a.type===`mermaid-ready`?i.contentWindow?.postMessage({type:`mermaid-render`,text:e.text},`*`):a.type===`mermaid-error`?(e.fail(Error(n(`ui.main.71d2d7a799b5`,`Mermaid could not render this source`))),window.clearTimeout(o)):a.type===`mermaid-rendered`&&`height`in a&&typeof a.height==`number`&&Number.isFinite(a.height)&&(window.clearTimeout(o),this.height=Math.min(1600,Math.max(120,a.height+24))))},a=()=>{this.document=void 0,s()},o=window.setTimeout(()=>{r()&&(this.generation+=1,this.document=void 0,e.fail(Error(n(`ui.main.2b61a115b16d`,`Mermaid preview timed out`)))),s()},3e4),s=()=>{window.clearTimeout(o),window.removeEventListener(`message`,i),e.signal.removeEventListener(`abort`,a)};this.cleanup=s,window.addEventListener(`message`,i),e.signal.addEventListener(`abort`,a,{once:!0});try{let e=await this.loadEngine();r()&&(this.document=Ce(e))}catch(t){r()&&e.fail(t),s()}}render(){return this.document===void 0?L`<p role="status">${n(`ui.main.e1a26333e1cf`,`Rendering diagram…`)}</p>`:L`<iframe title="${n(`ui.main.a66b71e29e45`,`Mermaid diagram`)}" sandbox="allow-scripts" referrerpolicy="no-referrer" .srcdoc=${this.document} style=${`height:${String(this.height)}px`}></iframe>`}static{this.styles=l`
3
3
  :host { display: block; }
4
4
  iframe { display: block; width: 100%; border: 0; background: white; }
5
5
  p { color: var(--pi-muted); }
6
- `}};Z([Y({attribute:!1})],$.prototype,`input`,void 0),Z([Y({attribute:!1})],$.prototype,`loadEngine`,void 0),Z([X()],$.prototype,`document`,void 0),Z([X()],$.prototype,`height`,void 0);var xe={apiVersion:4,name:`图表`,requires:[{pluginId:`pi-web`,id:`content-rendering`,version:1,parse:()=>void 0}],activate:({html:e})=>(customElements.get(`pi-web-mermaid-preview`)===void 0&&customElements.define(`pi-web-mermaid-preview`,$),{contributions:{contentRenderers:[{id:`diagram`,languages:[`mermaid`],fileExtensions:[`mmd`,`mermaid`],render:t=>e`<pi-web-mermaid-preview .input=${t} .loadEngine=${ye}></pi-web-mermaid-preview>`}]}})};export{xe as default};
6
+ `}};Z([Y({attribute:!1})],$.prototype,`input`,void 0),Z([Y({attribute:!1})],$.prototype,`loadEngine`,void 0),Z([X()],$.prototype,`document`,void 0),Z([X()],$.prototype,`height`,void 0);var we={apiVersion:4,name:n(`ui.main.a66b71e29e45`,`Mermaid diagram`),requires:[{pluginId:`pi-web`,id:`content-rendering`,version:1,parse:()=>void 0}],activate:({html:e,translate:n})=>(t(n),customElements.get(`pi-web-mermaid-preview`)===void 0&&customElements.define(`pi-web-mermaid-preview`,$),{contributions:{contentRenderers:[{id:`diagram`,languages:[`mermaid`],fileExtensions:[`mmd`,`mermaid`],render:t=>e`<pi-web-mermaid-preview .input=${t} .loadEngine=${Se}></pi-web-mermaid-preview>`}]}})};export{we as default};